@otto-code/protocol 0.5.2 → 0.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,6 +8,41 @@ export declare function isPersonalityRole(value: string): value is PersonalityRo
8
8
  */
9
9
  export declare function normalizePersonalityRoles(roles: readonly string[] | undefined): PersonalityRole[];
10
10
  export declare function personalityHasRole(personality: Pick<AgentPersonality, "roles">, role: PersonalityRole): boolean;
11
+ export type PersonalityRoleTier = "coordinator" | "focused";
12
+ interface PersonalityRoleInfo {
13
+ tier: PersonalityRoleTier;
14
+ guidance: string;
15
+ }
16
+ export declare const PERSONALITY_ROLE_INFO: Readonly<Record<PersonalityRole, PersonalityRoleInfo>>;
17
+ /**
18
+ * A personality may launch/coordinate when it carries at least one coordinator
19
+ * role. A personality whose roles are entirely focused (researcher, planner,
20
+ * judger, advisor, coder, designer, writer), or that has no roles at all, is a
21
+ * "lifter": it should finish its task, not fan out.
22
+ */
23
+ export declare function personalityCanLaunch(personality: Pick<AgentPersonality, "roles">): boolean;
24
+ export interface PersonalitySelectionSummary {
25
+ tier: PersonalityRoleTier;
26
+ canLaunch: boolean;
27
+ /** The "why you'd choose me" blurb — each of the personality's roles, joined. */
28
+ guidance: string;
29
+ }
30
+ /**
31
+ * Build the selection decision-aid for a personality from its roles: the tier
32
+ * (coordinator if any role coordinates), whether it may launch, and a short
33
+ * multi-role "why choose me" blurb. Surfaced by list_personalities so a
34
+ * deciding agent can pick the right teammate from the list alone.
35
+ */
36
+ export declare function summarizePersonalityForSelection(personality: Pick<AgentPersonality, "roles">): PersonalitySelectionSummary;
37
+ export declare const ORCHESTRATOR_METHOD_DIRECTIVE: string;
38
+ /**
39
+ * The in-context "role directive" injected into a personality's system prompt at
40
+ * spawn. The orchestrator gets the full conductor method; other coordinators
41
+ * (chatter/artificer/scheduler) get a lighter delegate nudge; focused workers
42
+ * are told to stay on the task someone is waiting on. Roleless spawns get
43
+ * nothing. This is guidance, not a gate — the tools stay available either way.
44
+ */
45
+ export declare function composeRoleFocusDirective(roles: readonly string[] | undefined): string | undefined;
11
46
  export type PersonalityUnavailableCode = "provider-missing" | "provider-disabled" | "provider-not-ready" | "model-missing" | "mode-missing";
12
47
  export interface PersonalityAvailabilityInput {
13
48
  /** Provider snapshot status, or undefined when the provider is absent entirely. */
@@ -30,4 +65,5 @@ export type PersonalityAvailability = {
30
65
  * The caller grays it out in pickers and hard-fails it in automation.
31
66
  */
32
67
  export declare function checkPersonalityAvailability(personality: Pick<AgentPersonality, "provider" | "model" | "modeId">, input: PersonalityAvailabilityInput): PersonalityAvailability;
68
+ export {};
33
69
  //# sourceMappingURL=agent-personalities.d.ts.map
@@ -37,6 +37,110 @@ export function normalizePersonalityRoles(roles) {
37
37
  export function personalityHasRole(personality, role) {
38
38
  return normalizePersonalityRoles(personality.roles).includes(role);
39
39
  }
40
+ export const PERSONALITY_ROLE_INFO = {
41
+ // ── Surfaces ──────────────────────────────────────────────────────────────
42
+ chatter: {
43
+ tier: "coordinator",
44
+ guidance: "Interactive driver — converse, plan, and delegate. Pick to run a chat or coordinate work.",
45
+ },
46
+ artificer: {
47
+ tier: "coordinator",
48
+ guidance: "Builds and manages artifacts; may run multi-step work to produce them. Pick for artifact creation.",
49
+ },
50
+ scheduler: {
51
+ tier: "coordinator",
52
+ guidance: "Creates and manages schedules; may orchestrate recurring or multi-step jobs. Pick for scheduling.",
53
+ },
54
+ // ── Thinking workers (read-only, structured findings) ─────────────────────
55
+ researcher: {
56
+ tier: "focused",
57
+ guidance: "Read-only surveyor — maps the code or domain and reports files, types, patterns, and gotchas. Pick to gather facts; proposes no solutions and edits nothing.",
58
+ },
59
+ planner: {
60
+ tier: "focused",
61
+ guidance: "Planning specialist — turns a goal into a typed, sequenced phase plan for others to execute. Pick to draft an actionable plan; stays on the plan and doesn't dispatch.",
62
+ },
63
+ judger: {
64
+ tier: "focused",
65
+ guidance: "Review specialist — evaluates work or a plan against criteria and returns a structured verdict. Pick for a focused review; stays on task.",
66
+ },
67
+ advisor: {
68
+ tier: "focused",
69
+ guidance: "Read-only second opinion — weighs the trade-offs and returns one recommendation. Pick for advice; never edits and does not fan out.",
70
+ },
71
+ // ── Making workers (produce code, design, or text) ────────────────────────
72
+ coder: {
73
+ tier: "focused",
74
+ guidance: "Focused implementer — writes code for one sub-task others are waiting on. Pick to get a coding job done; stays on task.",
75
+ },
76
+ designer: {
77
+ tier: "focused",
78
+ guidance: "Design maker — styling and layout plus the human-skill text (copy, naming). Pick for the look-and-feel or the words; stays on task.",
79
+ },
80
+ writer: {
81
+ tier: "focused",
82
+ guidance: "Fast small-text specialist — commit messages, summaries, names. Pick for quick text; stays on the one task.",
83
+ },
84
+ // ── Conductor ─────────────────────────────────────────────────────────────
85
+ orchestrator: {
86
+ tier: "coordinator",
87
+ guidance: "The sole conductor — plans team-shaped work, dispatches typed tasks to the right teammates, gathers, and synthesizes. Pick to run a multi-agent workflow.",
88
+ },
89
+ };
90
+ /**
91
+ * A personality may launch/coordinate when it carries at least one coordinator
92
+ * role. A personality whose roles are entirely focused (researcher, planner,
93
+ * judger, advisor, coder, designer, writer), or that has no roles at all, is a
94
+ * "lifter": it should finish its task, not fan out.
95
+ */
96
+ export function personalityCanLaunch(personality) {
97
+ return normalizePersonalityRoles(personality.roles).some((role) => PERSONALITY_ROLE_INFO[role].tier === "coordinator");
98
+ }
99
+ /**
100
+ * Build the selection decision-aid for a personality from its roles: the tier
101
+ * (coordinator if any role coordinates), whether it may launch, and a short
102
+ * multi-role "why choose me" blurb. Surfaced by list_personalities so a
103
+ * deciding agent can pick the right teammate from the list alone.
104
+ */
105
+ export function summarizePersonalityForSelection(personality) {
106
+ const roles = normalizePersonalityRoles(personality.roles);
107
+ const canLaunch = roles.some((role) => PERSONALITY_ROLE_INFO[role].tier === "coordinator");
108
+ return {
109
+ tier: canLaunch ? "coordinator" : "focused",
110
+ canLaunch,
111
+ guidance: roles.map((role) => PERSONALITY_ROLE_INFO[role].guidance).join(" "),
112
+ };
113
+ }
114
+ // The conductor's standing directive — the distilled `/epic` method taught to
115
+ // the sole orchestrator role at spawn, so orchestration is emergent (the agent
116
+ // recognizes team-shaped work and runs it) rather than something a user must
117
+ // invoke. Kept here as one exported constant so the wording is testable and
118
+ // shared. See projects/agent-orchestration/agent-orchestration.md.
119
+ export const ORCHESTRATOR_METHOD_DIRECTIVE = "You are the orchestrator — the team's sole conductor. Team-shaped work is yours to run, and you should reach for it naturally, not only when asked. " +
120
+ "First apply the complexity gate: if a task is small and not splittable, just do it — no ceremony. Only orchestrate when the work is large, parallelizable, or benefits from independent perspectives. " +
121
+ "When you do orchestrate: (1) if the shape is unclear, dispatch a researcher to survey and a planner to draft a typed plan; (2) declare that plan as a Run with start_run — phases typed research/plan/implement/design/verify/gate/deliver, fanning out candidates where several angles help and attaching a judger to grade them, looping until enough pass; (3) put a gate before irreversible or costly steps so the user approves; (4) synthesize the passing results into the deliverable. " +
122
+ "Prefer start_run over hand-spawning and tracking agents yourself — the runtime fans out, gathers typed verdicts, and enforces the loop for you. Every phase maps to a teammate's role; if the active team lacks a role a phase needs, say so plainly and stop rather than papering over the gap.";
123
+ /**
124
+ * The in-context "role directive" injected into a personality's system prompt at
125
+ * spawn. The orchestrator gets the full conductor method; other coordinators
126
+ * (chatter/artificer/scheduler) get a lighter delegate nudge; focused workers
127
+ * are told to stay on the task someone is waiting on. Roleless spawns get
128
+ * nothing. This is guidance, not a gate — the tools stay available either way.
129
+ */
130
+ export function composeRoleFocusDirective(roles) {
131
+ const normalized = normalizePersonalityRoles(roles);
132
+ if (normalized.length === 0) {
133
+ return undefined;
134
+ }
135
+ const roleList = normalized.join(", ");
136
+ if (normalized.includes("orchestrator")) {
137
+ return `${ORCHESTRATOR_METHOD_DIRECTIVE} (Your roles: ${roleList}.)`;
138
+ }
139
+ if (normalized.some((role) => PERSONALITY_ROLE_INFO[role].tier === "coordinator")) {
140
+ return `You are a coordinator personality (roles: ${roleList}). You front interactive work and may delegate: use list_personalities to see who else is available, and spawn other agents or hand off to the team's orchestrator whenever delegating gets the work done faster or better.`;
141
+ }
142
+ return `You are a focused worker personality (roles: ${roleList}). Someone is waiting on this specific task — stay on it and finish it. You can still call list_personalities to see the roster, but don't spawn sub-agents or start side workflows unless it is genuinely essential to completing this job.`;
143
+ }
40
144
  /**
41
145
  * Decide whether a personality is usable against a provider's current snapshot.
42
146
  * A personality is out of commission the moment any bound setting can't resolve:
@@ -399,6 +399,10 @@ export type AgentStreamEvent = {
399
399
  item: AgentTimelineItem;
400
400
  turnId?: string;
401
401
  timestamp?: string;
402
+ } | {
403
+ type: "background_shell_task_updated";
404
+ provider: AgentProvider;
405
+ update: BackgroundShellTaskUpdate;
402
406
  };
403
407
  export declare function getAgentStreamEventTurnId(event: AgentStreamEvent): string | undefined;
404
408
  /**
@@ -419,6 +423,23 @@ export interface ObservedSubagentUpdate {
419
423
  requiresAttention?: boolean;
420
424
  usage?: AgentUsage;
421
425
  }
426
+ /**
427
+ * A background shell task reported by a provider's own Bash tool (Claude:
428
+ * `run_in_background`). `key` is a provider-local stable identifier (Claude:
429
+ * the Bash tool_use id); the daemon namespaces it under the owning agent.
430
+ * Unlike {@link ObservedSubagentUpdate} this has no transcript/pane — it's a
431
+ * plain status row (command, status, elapsed) in the Background Tasks track.
432
+ */
433
+ export interface BackgroundShellTaskUpdate {
434
+ key: string;
435
+ /** Provider task id, used to stop the task (Claude: `task_id`). */
436
+ taskId?: string;
437
+ command?: string;
438
+ description?: string;
439
+ status: "running" | "idle" | "error" | "closed";
440
+ requiresAttention?: boolean;
441
+ usage?: AgentUsage;
442
+ }
422
443
  export type AgentPermissionRequestKind = "tool" | "plan" | "question" | "mode" | "other";
423
444
  export type AgentPermissionUpdate = AgentMetadata;
424
445
  export interface AgentPermissionAction {
@@ -73,8 +73,8 @@ export declare const ArtifactListResponseSchema: z.ZodObject<{
73
73
  starred: z.ZodBoolean;
74
74
  status: z.ZodEnum<{
75
75
  error: "error";
76
- generating: "generating";
77
76
  ready: "ready";
77
+ generating: "generating";
78
78
  }>;
79
79
  createdAt: z.ZodString;
80
80
  updatedAt: z.ZodString;
@@ -109,8 +109,8 @@ export declare const ArtifactCreateResponseSchema: z.ZodObject<{
109
109
  starred: z.ZodBoolean;
110
110
  status: z.ZodEnum<{
111
111
  error: "error";
112
- generating: "generating";
113
112
  ready: "ready";
113
+ generating: "generating";
114
114
  }>;
115
115
  createdAt: z.ZodString;
116
116
  updatedAt: z.ZodString;
@@ -153,8 +153,8 @@ export declare const ArtifactStarResponseSchema: z.ZodObject<{
153
153
  starred: z.ZodBoolean;
154
154
  status: z.ZodEnum<{
155
155
  error: "error";
156
- generating: "generating";
157
156
  ready: "ready";
157
+ generating: "generating";
158
158
  }>;
159
159
  createdAt: z.ZodString;
160
160
  updatedAt: z.ZodString;
@@ -189,8 +189,8 @@ export declare const ArtifactUpdateResponseSchema: z.ZodObject<{
189
189
  starred: z.ZodBoolean;
190
190
  status: z.ZodEnum<{
191
191
  error: "error";
192
- generating: "generating";
193
192
  ready: "ready";
193
+ generating: "generating";
194
194
  }>;
195
195
  createdAt: z.ZodString;
196
196
  updatedAt: z.ZodString;
@@ -225,8 +225,8 @@ export declare const ArtifactRegenerateResponseSchema: z.ZodObject<{
225
225
  starred: z.ZodBoolean;
226
226
  status: z.ZodEnum<{
227
227
  error: "error";
228
- generating: "generating";
229
228
  ready: "ready";
229
+ generating: "generating";
230
230
  }>;
231
231
  createdAt: z.ZodString;
232
232
  updatedAt: z.ZodString;
@@ -261,8 +261,8 @@ export declare const ArtifactCancelResponseSchema: z.ZodObject<{
261
261
  starred: z.ZodBoolean;
262
262
  status: z.ZodEnum<{
263
263
  error: "error";
264
- generating: "generating";
265
264
  ready: "ready";
265
+ generating: "generating";
266
266
  }>;
267
267
  createdAt: z.ZodString;
268
268
  updatedAt: z.ZodString;
@@ -306,8 +306,8 @@ export declare const ArtifactCreatedNotificationSchema: z.ZodObject<{
306
306
  starred: z.ZodBoolean;
307
307
  status: z.ZodEnum<{
308
308
  error: "error";
309
- generating: "generating";
310
309
  ready: "ready";
310
+ generating: "generating";
311
311
  }>;
312
312
  createdAt: z.ZodString;
313
313
  updatedAt: z.ZodString;
@@ -339,8 +339,8 @@ export declare const ArtifactUpdatedNotificationSchema: z.ZodObject<{
339
339
  starred: z.ZodBoolean;
340
340
  status: z.ZodEnum<{
341
341
  error: "error";
342
- generating: "generating";
343
342
  ready: "ready";
343
+ generating: "generating";
344
344
  }>;
345
345
  createdAt: z.ZodString;
346
346
  updatedAt: z.ZodString;
@@ -5,8 +5,8 @@ export declare const ArtifactKindSchema: z.ZodEnum<{
5
5
  export type ArtifactKind = z.infer<typeof ArtifactKindSchema>;
6
6
  export declare const ArtifactStatusSchema: z.ZodEnum<{
7
7
  error: "error";
8
- generating: "generating";
9
8
  ready: "ready";
9
+ generating: "generating";
10
10
  }>;
11
11
  export type ArtifactStatus = z.infer<typeof ArtifactStatusSchema>;
12
12
  export declare const ArtifactSpinnerSchema: z.ZodObject<{
@@ -26,8 +26,8 @@ export declare const ArtifactMetadataSchema: z.ZodObject<{
26
26
  starred: z.ZodBoolean;
27
27
  status: z.ZodEnum<{
28
28
  error: "error";
29
- generating: "generating";
30
29
  ready: "ready";
30
+ generating: "generating";
31
31
  }>;
32
32
  createdAt: z.ZodString;
33
33
  updatedAt: z.ZodString;
@@ -55,8 +55,8 @@ export declare const ArtifactSummarySchema: z.ZodObject<{
55
55
  starred: z.ZodBoolean;
56
56
  status: z.ZodEnum<{
57
57
  error: "error";
58
- generating: "generating";
59
58
  ready: "ready";
59
+ generating: "generating";
60
60
  }>;
61
61
  createdAt: z.ZodString;
62
62
  updatedAt: z.ZodString;
@@ -79,8 +79,8 @@ export declare const ArtifactRunTriggerSchema: z.ZodEnum<{
79
79
  export type ArtifactRunTrigger = z.infer<typeof ArtifactRunTriggerSchema>;
80
80
  export declare const ArtifactRunStatusSchema: z.ZodEnum<{
81
81
  running: "running";
82
- succeeded: "succeeded";
83
82
  failed: "failed";
83
+ succeeded: "succeeded";
84
84
  }>;
85
85
  export type ArtifactRunStatus = z.infer<typeof ArtifactRunStatusSchema>;
86
86
  export declare const ArtifactRunSchema: z.ZodObject<{
@@ -91,8 +91,8 @@ export declare const ArtifactRunSchema: z.ZodObject<{
91
91
  }>;
92
92
  status: z.ZodEnum<{
93
93
  running: "running";
94
- succeeded: "succeeded";
95
94
  failed: "failed";
95
+ succeeded: "succeeded";
96
96
  }>;
97
97
  startedAt: z.ZodString;
98
98
  endedAt: z.ZodNullable<z.ZodString>;
@@ -114,8 +114,8 @@ export declare const StoredArtifactSchema: z.ZodObject<{
114
114
  starred: z.ZodBoolean;
115
115
  status: z.ZodEnum<{
116
116
  error: "error";
117
- generating: "generating";
118
117
  ready: "ready";
118
+ generating: "generating";
119
119
  }>;
120
120
  createdAt: z.ZodString;
121
121
  updatedAt: z.ZodString;
@@ -137,8 +137,8 @@ export declare const StoredArtifactSchema: z.ZodObject<{
137
137
  }>;
138
138
  status: z.ZodEnum<{
139
139
  running: "running";
140
- succeeded: "succeeded";
141
140
  failed: "failed";
141
+ succeeded: "succeeded";
142
142
  }>;
143
143
  startedAt: z.ZodString;
144
144
  endedAt: z.ZodNullable<z.ZodString>;
@@ -9,11 +9,13 @@
9
9
  // - Ids are STABLE and prefixed `personality_builtin_*`. Restore re-adds only
10
10
  // the builtins whose id is missing, so a user who kept/renamed some never
11
11
  // gets duplicates. Renaming a builtin keeps its id, so it is still "present".
12
- // - Every one of the 8 roles is covered; some personalities are multi-role to
13
- // show that a single template can serve several surfaces. Dash is the Writer
14
- // (fast, cheap small-text generation commit messages, summaries, branch
15
- // names) and Sprocket is the Coder (methodical sub-agent building work); the
16
- // two together are the heirs of the retired "worker" role.
12
+ // - Every one of the 11 roles is covered; some personalities are multi-role to
13
+ // show that a single template can serve several lanes. Sage is the team's
14
+ // read-only thinker (advisor + researcher + planner); Pixel both an artificer
15
+ // and a designer. Dash is the Writer (fast, cheap small-text generation
16
+ // commit messages, summaries, branch names) and Sprocket is the Coder
17
+ // (methodical sub-agent building work); the two together are the heirs of the
18
+ // retired "worker" role. Atlas is the sole conductor (orchestrator).
17
19
  // - Models are Anthropic (Claude Code) — the assumption for launch. On a host
18
20
  // without Claude these simply show as "out of commission" until a matching
19
21
  // provider exists; nothing breaks.
@@ -54,11 +56,13 @@ export const DEFAULT_AGENT_PERSONALITIES = [
54
56
  effortLevel: "xhigh",
55
57
  modeId: "plan",
56
58
  respectGlobalAppendPrompt: true,
57
- roles: ["advisor"],
58
- personalityPrompt: "You are Sage, a trusted advisor. You are read-only: you counsel, you never change " +
59
- "code. Step back before answering, weigh the real trade-offs, surface the risk others " +
60
- "miss, and give the one option you would take and why a clear recommendation, not a " +
61
- "menu of possibilities.",
59
+ roles: ["advisor", "researcher", "planner"],
60
+ personalityPrompt: "You are Sage, the team's read-only thinker: you research, you plan, and you advise, but " +
61
+ "you never change code. Asked to survey, map what actually exists the files, types, " +
62
+ "patterns, and gotchas and report facts, not solutions. Asked to plan, turn the goal " +
63
+ "into a clear, sequenced set of steps a team could execute. Asked to advise, weigh the " +
64
+ "real trade-offs, surface the risk others miss, and give the one option you would take and " +
65
+ "why — a recommendation, not a menu.",
62
66
  spinner: { glowA: "#14B8A6", glowB: "#8B5CF6" },
63
67
  voice: kokoroVoice("af_heart"),
64
68
  },
@@ -86,7 +90,7 @@ export const DEFAULT_AGENT_PERSONALITIES = [
86
90
  effortLevel: "medium",
87
91
  modeId: "acceptEdits",
88
92
  respectGlobalAppendPrompt: true,
89
- roles: ["artificer"],
93
+ roles: ["artificer", "designer"],
90
94
  personalityPrompt: "You are Pixel, a maker of polished things. You build artifacts and interfaces that " +
91
95
  "feel intentional — real hierarchy, deliberate spacing, no templated defaults. Sweat " +
92
96
  "the small stuff, prefer a clean version that ships over a clever one that doesn't, and " +