governance.PersonActortypeno test imports ittype PersonActor = { readonly kind: "person"; readonly id: string; readonly name: string };A person: an id and a name. It names no agent and no principal.
The actor of an event: a person, an agent or a tool (0037-planning FR-005). An agent acts on behalf of a person, its principal (PROV-O section 4.1, prov:actedOnBehalfOf; delegation is the assignment of authority and responsibility to an agent while the agent it acts on behalf of retains some responsibility for the outcome), and the actor says how the principal was established. The rule is in the types and in the smart constructors: an agent value has a principal that is a person, a person value has no principal, and a tool may name the person who ran it. The principal of an agent is established from who runs the work and never guessed (FR-045): actorFor takes a run's context and refuses an agent or a person where the context has none.
import { agent, person } from "./actor.ts";
const p = person("ada", "Ada");
p.kind === "ok" && agent("claude", "Claude", p.value, "session"); // an agent acting for Adagovernance.PersonActortypeno test imports ittype PersonActor = { readonly kind: "person"; readonly id: string; readonly name: string };A person: an id and a name. It names no agent and no principal.
governance.AgentActortypeno test imports ittype AgentActor = { readonly kind: "agent"; readonly id: string; readonly name: string; readonly principal: PersonActor; readonly basis: PrincipalBasis };An AI agent, with the person it acts for and how that person was established.
governance.ToolActortypeno test imports ittype ToolActor = { readonly kind: "tool"; readonly id: string; readonly name: string; readonly ranBy?: PersonActor };A program with no judgement of its own; it may name the person who ran it.
governance.Actortypeno test imports ittype Actor = PersonActor | AgentActor | ToolActor;The one who wrote an event: a person, an agent or a tool.
governance.ActorProblemtypeno test imports ittype ActorProblem =
| { readonly kind: "bad-actor-id"; readonly message: string }
| { readonly kind: "agent-without-… (463 characters)type ActorProblem =
| { readonly kind: "bad-actor-id"; readonly message: string }
| { readonly kind: "agent-without-principal"; readonly agent: string }
| { readonly kind: "principal-not-a-person"; readonly agent: string }
| { readonly kind: "person-names-an-agent"; readonly person: string; readonly field: string }
| { readonly kind: "no-person-in-context"; readonly asked: "person" | "agent" | "tool" }
| { readonly kind: "commit-rule-not-named" };Why an actor is refused.
governance.describeActorProblemfunctionno test imports itfunction describeActorProblem(p: ActorProblem): stringOne sentence for a refusal.
governance.personfunctionno test imports itfunction person(id: string, name: string): Result<PersonActor, ActorProblem>A person.
governance.agentfunctionno test imports itfunction agent(id: string, name: string, principal: PersonActor, basis: "argument" | "commit-author" | "configuration" | "session"): Result<AgentActor, ActorProblem>An agent acting for principal, the person it acts for, established as basis says. A principal that is not a person is refused.
governance.toolfunctionno test imports itfunction tool(id: string, name: string, ranBy?: PersonActor | undefined): Result<ToolActor, ActorProblem>A tool, with the person who ran it where there is one.
governance.checkActorfunctionno test imports itfunction checkActor(value: unknown): Result<Actor, ActorProblem>Whether a value that came from outside (a file, a call) is an actor that keeps the rules, or why it is not.
governance.RunContexttypeno test imports ittype RunContext =
| { readonly kind: "session"; readonly person: PersonActor }
| { readonly kind: "argument"; readonly person: PersonActor }
| { readonly kind: "configuration"; readonly person: PersonActor }
| { readonly kind: "commit-author"; readonly person: PersonActor }
| { readonly kind: "none" };Who runs the work (0037-planning FR-045): the person whose credentials or session launched the program, a person an argument names, the principal of a headless run's configuration, or the author of a commit where the configuration names that rule. A context with no person is none.
governance.contextOfCommitfunctionno test imports itfunction contextOfCommit(author: PersonActor, configurationNamesTheRule: boolean): Result<RunContext, ActorProblem>The context of a commit whose author is a person and whose trailer names an agent: allowed only where the configuration names the rule.
governance.ActorRoletypeno test imports ittype ActorRole = { readonly kind: "person" } | { readonly kind: "agent"; readonly id: string; readonly name: string } | { readonly kind: "tool"; readonly id: string; readonly name: string };Who the event is to be written as: the person who runs the work, an agent acting for that person, or a tool.
governance.actorForfunctionno test imports itfunction actorFor(context: RunContext, role: ActorRole): Result<Actor, ActorProblem>The actor of an event made in a context. A person's event needs a person's credentials, configuration or argument; an agent's event takes the context's person as its principal, with the basis the context says; a tool names the person who ran it where there is one. A context with no person refuses a person and an agent, and says that no principal is established.
PersonActortypeno test imports ittype PersonActor = { readonly kind: "person"; readonly id: string; readonly name: string };A person: an id and a name. It names no agent and no principal.
AgentActortypeno test imports ittype AgentActor = { readonly kind: "agent"; readonly id: string; readonly name: string; readonly principal: PersonActor; readonly basis: PrincipalBasis };An AI agent, with the person it acts for and how that person was established.
ToolActortypeno test imports ittype ToolActor = { readonly kind: "tool"; readonly id: string; readonly name: string; readonly ranBy?: PersonActor };A program with no judgement of its own; it may name the person who ran it.
Actortypeno test imports ittype Actor = PersonActor | AgentActor | ToolActor;The one who wrote an event: a person, an agent or a tool.
ActorProblemtypeno test imports ittype ActorProblem =
| { readonly kind: "bad-actor-id"; readonly message: string }
| { readonly kind: "agent-without-… (463 characters)type ActorProblem =
| { readonly kind: "bad-actor-id"; readonly message: string }
| { readonly kind: "agent-without-principal"; readonly agent: string }
| { readonly kind: "principal-not-a-person"; readonly agent: string }
| { readonly kind: "person-names-an-agent"; readonly person: string; readonly field: string }
| { readonly kind: "no-person-in-context"; readonly asked: "person" | "agent" | "tool" }
| { readonly kind: "commit-rule-not-named" };Why an actor is refused.
describeActorProblemfunctionno test imports itfunction describeActorProblem(p: ActorProblem): stringOne sentence for a refusal.
personfunctionno test imports itfunction person(id: string, name: string): Result<PersonActor, ActorProblem>A person.
agentfunctionno test imports itfunction agent(id: string, name: string, principal: PersonActor, basis: "argument" | "commit-author" | "configuration" | "session"): Result<AgentActor, ActorProblem>An agent acting for principal, the person it acts for, established as basis says. A principal that is not a person is refused.
toolfunctionno test imports itfunction tool(id: string, name: string, ranBy?: PersonActor | undefined): Result<ToolActor, ActorProblem>A tool, with the person who ran it where there is one.
checkActorfunctionno test imports itfunction checkActor(value: unknown): Result<Actor, ActorProblem>Whether a value that came from outside (a file, a call) is an actor that keeps the rules, or why it is not.
RunContexttypeno test imports ittype RunContext =
| { readonly kind: "session"; readonly person: PersonActor }
| { readonly kind: "argument"; readonly person: PersonActor }
| { readonly kind: "configuration"; readonly person: PersonActor }
| { readonly kind: "commit-author"; readonly person: PersonActor }
| { readonly kind: "none" };Who runs the work (0037-planning FR-045): the person whose credentials or session launched the program, a person an argument names, the principal of a headless run's configuration, or the author of a commit where the configuration names that rule. A context with no person is none.
contextOfCommitfunctionno test imports itfunction contextOfCommit(author: PersonActor, configurationNamesTheRule: boolean): Result<RunContext, ActorProblem>The context of a commit whose author is a person and whose trailer names an agent: allowed only where the configuration names the rule.
ActorRoletypeno test imports ittype ActorRole = { readonly kind: "person" } | { readonly kind: "agent"; readonly id: string; readonly name: string } | { readonly kind: "tool"; readonly id: string; readonly name: string };Who the event is to be written as: the person who runs the work, an agent acting for that person, or a tool.
actorForfunctionno test imports itfunction actorFor(context: RunContext, role: ActorRole): Result<Actor, ActorProblem>The actor of an event made in a context. A person's event needs a person's credentials, configuration or argument; an agent's event takes the context's person as its principal, with the basis the context says; a tool names the person who ran it where there is one. A context with no person refuses a person and an agent, and says that no principal is established.