@hheei/pi-subagents 0.1.2 → 0.2.3

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.
Files changed (65) hide show
  1. package/README.md +45 -137
  2. package/dist/agent-resolver.d.ts +20 -0
  3. package/dist/agent-resolver.js +155 -21
  4. package/dist/bridge-client.d.ts +55 -0
  5. package/dist/bridge-client.js +453 -0
  6. package/dist/bridge-server.d.ts +72 -0
  7. package/dist/bridge-server.js +490 -0
  8. package/dist/builtin-agents.d.ts +24 -0
  9. package/dist/builtin-agents.js +152 -0
  10. package/dist/child-bridge.d.ts +31 -15
  11. package/dist/child-bridge.js +95 -117
  12. package/dist/child-control.d.ts +58 -0
  13. package/dist/child-control.js +176 -0
  14. package/dist/child-process.d.ts +21 -0
  15. package/dist/child-process.js +93 -0
  16. package/dist/commands.d.ts +2 -2
  17. package/dist/commands.js +52 -60
  18. package/dist/diagnostics.d.ts +0 -2
  19. package/dist/diagnostics.js +0 -8
  20. package/dist/domain.d.ts +57 -27
  21. package/dist/domain.js +60 -11
  22. package/dist/extension.d.ts +26 -1
  23. package/dist/extension.js +243 -46
  24. package/dist/host-adapter.d.ts +37 -12
  25. package/dist/host-adapter.js +214 -63
  26. package/dist/json-lines.js +2 -1
  27. package/dist/launch-spec.d.ts +8 -6
  28. package/dist/launch-spec.js +61 -18
  29. package/dist/manager.d.ts +93 -49
  30. package/dist/manager.js +1175 -528
  31. package/dist/markdown.d.ts +8 -0
  32. package/dist/markdown.js +21 -0
  33. package/dist/protocol.d.ts +33 -52
  34. package/dist/protocol.js +41 -52
  35. package/dist/registry.d.ts +3 -8
  36. package/dist/registry.js +41 -163
  37. package/dist/rpc-events.d.ts +3 -5
  38. package/dist/rpc-events.js +5 -9
  39. package/dist/runtime.d.ts +66 -11
  40. package/dist/runtime.js +182 -208
  41. package/dist/session-bootstrap.d.ts +23 -7
  42. package/dist/session-bootstrap.js +79 -15
  43. package/dist/session-fork.d.ts +16 -0
  44. package/dist/session-fork.js +67 -0
  45. package/dist/state.d.ts +7 -0
  46. package/dist/state.js +60 -25
  47. package/dist/tool-activation.d.ts +18 -0
  48. package/dist/tool-activation.js +227 -0
  49. package/dist/tools.d.ts +6 -3
  50. package/dist/tools.js +213 -72
  51. package/dist/widget.d.ts +4 -8
  52. package/dist/widget.js +55 -64
  53. package/package.json +51 -52
  54. package/dist/child-nudge.d.ts +0 -24
  55. package/dist/child-nudge.js +0 -102
  56. package/dist/connector.d.ts +0 -53
  57. package/dist/connector.js +0 -283
  58. package/dist/pause-gate.d.ts +0 -14
  59. package/dist/pause-gate.js +0 -64
  60. package/dist/rpc-adapter.d.ts +0 -40
  61. package/dist/rpc-adapter.js +0 -194
  62. package/dist/runner-entry.d.ts +0 -24
  63. package/dist/runner-entry.js +0 -166
  64. package/dist/runner.d.ts +0 -52
  65. package/dist/runner.js +0 -930
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Transforms plain agent and background task identifiers (e.g. `agent-1`, `bash-1`)
3
+ * in Markdown prose by wrapping them in inline code backticks, making them visually
4
+ * distinct in terminal TUI rendering.
5
+ *
6
+ * Preserves text inside code blocks, inline code, and URLs intact.
7
+ */
8
+ export declare function transformSubagentsMarkdown(markdown: string): string;
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Transforms plain agent and background task identifiers (e.g. `agent-1`, `bash-1`)
3
+ * in Markdown prose by wrapping them in inline code backticks, making them visually
4
+ * distinct in terminal TUI rendering.
5
+ *
6
+ * Preserves text inside code blocks, inline code, and URLs intact.
7
+ */
8
+ export function transformSubagentsMarkdown(markdown) {
9
+ if (!/(?:agent|bash)-\d+/.test(markdown))
10
+ return markdown;
11
+ // Split by code blocks (```...```) and inline code (`...`) to only transform prose
12
+ const parts = markdown.split(/(```[\s\S]*?```|`[^`\n]+`)/g);
13
+ for (let i = 0; i < parts.length; i += 2) {
14
+ const part = parts[i];
15
+ if (part !== undefined && /(?:agent|bash)-\d+/.test(part)) {
16
+ // Match word boundary: agent-N or bash-N not inside markdown link URLs like (http.../agent-1)
17
+ parts[i] = part.replace(/(?<![`/\w])((?:agent|bash)-\d+)(?![`\w])/g, "`$1`");
18
+ }
19
+ }
20
+ return parts.join("");
21
+ }
@@ -2,20 +2,27 @@ import { type Static, Type } from "typebox";
2
2
  export declare const DEFAULT_MAX_FRAME_BYTES: number;
3
3
  export declare const DEFAULT_MAX_PENDING_REQUESTS = 128;
4
4
  export declare const DEFAULT_MAX_BUFFERED_EVENTS = 256;
5
- export declare const RUNNER_OPERATIONS: readonly ["prompt", "steer", "follow_up", "abort", "get_state", "get_entries", "get_session_stats", "shutdown", "contact_parent", "report_lifecycle", "report_paused", "pause", "cancel_pause", "close_writer", "start_rpc"];
6
- export type RunnerOperation = (typeof RUNNER_OPERATIONS)[number];
7
- /** Runner-local event emitted when the Pi child process exits. */
8
- export declare const RUNNER_EXIT_EVENT: "runner_exit";
9
- /** Runner-local event emitted when only the RPC writer exited and the runner stayed up. */
10
- export declare const WRITER_EXIT_EVENT: "writer_exit";
11
- /** Runner-local event emitted when buffered events had to be dropped. */
12
- export declare const RUNNER_EVENTS_DROPPED_EVENT: "runner_events_dropped";
13
- /** Child-branch event: the TUI left the bound session, quit, or was interrupted. */
5
+ /**
6
+ * Every operation one end of the bridge may ask of the other. The parent drives the child with the
7
+ * input and state operations; the child returns reports and its Task result as requests, so a
8
+ * report the parent refuses (a second Task result) is refused to the child that sent it.
9
+ */
10
+ export declare const BRIDGE_OPERATIONS: readonly ["prompt", "steer", "follow_up", "abort", "get_state", "get_entries", "shutdown", "contact_parent", "task_result"];
11
+ export type BridgeOperation = (typeof BRIDGE_OPERATIONS)[number];
12
+ /** Child-branch event: the child left the bound session, quit, or was interrupted. */
14
13
  export declare const CHILD_LIFECYCLE_EVENT: "child_lifecycle";
15
- /** Runner-to-bridge event: hold the current turn_end until close_writer or cancel. */
16
- export declare const PAUSE_EVENT: "pause";
17
- /** Runner-to-bridge event: release a previous pause generation. */
18
- export declare const CANCEL_PAUSE_EVENT: "cancel_pause";
14
+ /** Child-to-parent event: the task child submitted its final result. */
15
+ /** Child-to-parent event: input arrived in the child, carrying only where it came from. */
16
+ export declare const CHILD_INPUT_EVENT: "child_input";
17
+ export type ChildInputSource = "interactive" | "extension" | "rpc";
18
+ /**
19
+ * Transport-level failure with a stable code, shared by both ends of the bridge: the parent sees
20
+ * it when a child call fails, the child sees the code the parent refused a report with.
21
+ */
22
+ export declare class BridgeError extends Error {
23
+ readonly code: string;
24
+ constructor(code: string, message: string);
25
+ }
19
26
  export declare const HelloFrameSchema: Type.TObject<{
20
27
  parentSessionId: Type.TString;
21
28
  subagentId: Type.TString;
@@ -24,8 +31,7 @@ export declare const HelloFrameSchema: Type.TObject<{
24
31
  token: Type.TString;
25
32
  version: Type.TLiteral<1>;
26
33
  type: Type.TLiteral<"hello">;
27
- role: Type.TOptional<Type.TUnion<[Type.TLiteral<"controller">, Type.TLiteral<"reporter">, Type.TLiteral<"recovery">, Type.TLiteral<"bridge">]>>;
28
- claimId: Type.TOptional<Type.TString>;
34
+ role: Type.TOptional<Type.TLiteral<"child">>;
29
35
  }>;
30
36
  export declare const HelloAckFrameSchema: Type.TObject<{
31
37
  version: Type.TLiteral<1>;
@@ -35,10 +41,10 @@ export declare const RequestFrameSchema: Type.TObject<{
35
41
  version: Type.TLiteral<1>;
36
42
  type: Type.TLiteral<"request">;
37
43
  id: Type.TString;
38
- operation: Type.TUnion<Type.TLiteral<"steer" | "follow_up" | "contact_parent" | "pause" | "prompt" | "abort" | "get_state" | "get_entries" | "get_session_stats" | "shutdown" | "report_lifecycle" | "report_paused" | "cancel_pause" | "close_writer" | "start_rpc">[]>;
44
+ operation: Type.TUnion<Type.TLiteral<"contact_parent" | "steer" | "follow_up" | "prompt" | "abort" | "get_state" | "get_entries" | "shutdown" | "task_result">[]>;
39
45
  payload: Type.TOptional<Type.TUnknown>;
40
46
  }>;
41
- export declare const RunnerErrorSchema: Type.TObject<{
47
+ export declare const BridgeErrorSchema: Type.TObject<{
42
48
  code: Type.TString;
43
49
  message: Type.TString;
44
50
  }>;
@@ -63,41 +69,15 @@ export declare const EventFrameSchema: Type.TObject<{
63
69
  type: Type.TLiteral<"event">;
64
70
  event: Type.TUnknown;
65
71
  }>;
66
- export declare const ServerFrameSchema: Type.TUnion<[Type.TObject<{
67
- version: Type.TLiteral<1>;
68
- type: Type.TLiteral<"hello_ack">;
69
- }>, Type.TUnion<[Type.TObject<{
70
- version: Type.TLiteral<1>;
71
- type: Type.TLiteral<"response">;
72
- id: Type.TString;
73
- ok: Type.TLiteral<true>;
74
- data: Type.TOptional<Type.TUnknown>;
75
- }>, Type.TObject<{
76
- version: Type.TLiteral<1>;
77
- type: Type.TLiteral<"response">;
78
- id: Type.TString;
79
- ok: Type.TLiteral<false>;
80
- error: Type.TObject<{
81
- code: Type.TString;
82
- message: Type.TString;
83
- }>;
84
- }>]>, Type.TObject<{
85
- version: Type.TLiteral<1>;
86
- type: Type.TLiteral<"event">;
87
- event: Type.TUnknown;
88
- }>]>;
89
72
  export declare const PromptPayloadSchema: Type.TObject<{
90
73
  message: Type.TString;
91
74
  }>;
92
- export declare const GetEntriesPayloadSchema: Type.TObject<{
93
- since: Type.TString;
94
- }>;
95
75
  export declare const ContactReportPayloadSchema: Type.TObject<{
96
76
  type: Type.TLiteral<"pi_subagent_report">;
97
77
  parentSessionId: Type.TString;
98
78
  childId: Type.TString;
99
79
  runtimeIdentity: Type.TString;
100
- reason: Type.TUnion<[Type.TLiteral<"progress_update">, Type.TLiteral<"important_finding">, Type.TLiteral<"need_decision">, Type.TLiteral<"blocked">]>;
80
+ reason: Type.TOptional<Type.TUnion<[Type.TLiteral<"success">, Type.TLiteral<"blocked">]>>;
101
81
  message: Type.TString;
102
82
  sessionId: Type.TOptional<Type.TString>;
103
83
  }>;
@@ -110,32 +90,33 @@ export declare const ChildLifecyclePayloadSchema: Type.TObject<{
110
90
  sessionId: Type.TString;
111
91
  message: Type.TOptional<Type.TString>;
112
92
  }>;
113
- export declare const PauseReportPayloadSchema: Type.TObject<{
114
- type: Type.TLiteral<"report_paused">;
93
+ /**
94
+ * Only the source of the input, never its text: the parent needs to know a human used the child,
95
+ * and the child's conversation stays in the child.
96
+ */
97
+ export declare const ChildInputPayloadSchema: Type.TObject<{
98
+ type: Type.TLiteral<"child_input">;
115
99
  parentSessionId: Type.TString;
116
100
  childId: Type.TString;
117
101
  runtimeIdentity: Type.TString;
118
- generation: Type.TInteger;
102
+ source: Type.TUnion<[Type.TLiteral<"interactive">, Type.TLiteral<"extension">, Type.TLiteral<"rpc">]>;
119
103
  }>;
120
104
  export type HelloFrame = Static<typeof HelloFrameSchema>;
121
105
  export type HelloAckFrame = Static<typeof HelloAckFrameSchema>;
122
106
  export type RequestFrame = Static<typeof RequestFrameSchema>;
123
107
  export type ResponseFrame = Static<typeof ResponseFrameSchema>;
124
108
  export type EventFrame = Static<typeof EventFrameSchema>;
125
- export type ServerFrame = Static<typeof ServerFrameSchema>;
126
109
  export type ContactReportPayload = Static<typeof ContactReportPayloadSchema>;
127
110
  export type ChildLifecyclePayload = Static<typeof ChildLifecyclePayloadSchema>;
128
- export type PauseReportPayload = Static<typeof PauseReportPayloadSchema>;
129
- export declare function isRunnerOperation(value: unknown): value is RunnerOperation;
111
+ export type ChildInputPayload = Static<typeof ChildInputPayloadSchema>;
130
112
  export declare function isHelloFrame(value: unknown): value is HelloFrame;
131
113
  export declare function isHelloAckFrame(value: unknown): value is HelloAckFrame;
132
114
  export declare function isRequestFrame(value: unknown): value is RequestFrame;
133
115
  export declare function isContactReportPayload(value: unknown): value is ContactReportPayload;
134
116
  export declare function isChildLifecyclePayload(value: unknown): value is ChildLifecyclePayload;
135
- export declare function isPauseReportPayload(value: unknown): value is PauseReportPayload;
117
+ export declare function isChildInputPayload(value: unknown): value is ChildInputPayload;
136
118
  export declare function isResponseFrame(value: unknown): value is ResponseFrame;
137
119
  export declare function isEventFrame(value: unknown): value is EventFrame;
138
- export declare function isServerFrame(value: unknown): value is ServerFrame;
139
120
  export declare function successResponse(id: string, data?: unknown): ResponseFrame;
140
121
  export declare function failureResponse(id: string, code: string, message: string): ResponseFrame;
141
122
  export declare function eventFrame(event: unknown): EventFrame;
package/dist/protocol.js CHANGED
@@ -4,37 +4,41 @@ import { PROTOCOL_VERSION } from "./domain.js";
4
4
  export const DEFAULT_MAX_FRAME_BYTES = 1024 * 1024;
5
5
  export const DEFAULT_MAX_PENDING_REQUESTS = 128;
6
6
  export const DEFAULT_MAX_BUFFERED_EVENTS = 256;
7
- export const RUNNER_OPERATIONS = [
7
+ /**
8
+ * Every operation one end of the bridge may ask of the other. The parent drives the child with the
9
+ * input and state operations; the child returns reports and its Task result as requests, so a
10
+ * report the parent refuses (a second Task result) is refused to the child that sent it.
11
+ */
12
+ export const BRIDGE_OPERATIONS = [
8
13
  "prompt",
9
14
  "steer",
10
15
  "follow_up",
11
16
  "abort",
12
17
  "get_state",
13
18
  "get_entries",
14
- "get_session_stats",
15
19
  "shutdown",
16
20
  "contact_parent",
17
- "report_lifecycle",
18
- "report_paused",
19
- "pause",
20
- "cancel_pause",
21
- "close_writer",
22
- "start_rpc",
21
+ "task_result",
23
22
  ];
24
- /** Runner-local event emitted when the Pi child process exits. */
25
- export const RUNNER_EXIT_EVENT = "runner_exit";
26
- /** Runner-local event emitted when only the RPC writer exited and the runner stayed up. */
27
- export const WRITER_EXIT_EVENT = "writer_exit";
28
- /** Runner-local event emitted when buffered events had to be dropped. */
29
- export const RUNNER_EVENTS_DROPPED_EVENT = "runner_events_dropped";
30
- /** Child-branch event: the TUI left the bound session, quit, or was interrupted. */
23
+ /** Child-branch event: the child left the bound session, quit, or was interrupted. */
31
24
  export const CHILD_LIFECYCLE_EVENT = "child_lifecycle";
32
- /** Runner-to-bridge event: hold the current turn_end until close_writer or cancel. */
33
- export const PAUSE_EVENT = "pause";
34
- /** Runner-to-bridge event: release a previous pause generation. */
35
- export const CANCEL_PAUSE_EVENT = "cancel_pause";
25
+ /** Child-to-parent event: the task child submitted its final result. */
26
+ /** Child-to-parent event: input arrived in the child, carrying only where it came from. */
27
+ export const CHILD_INPUT_EVENT = "child_input";
28
+ /**
29
+ * Transport-level failure with a stable code, shared by both ends of the bridge: the parent sees
30
+ * it when a child call fails, the child sees the code the parent refused a report with.
31
+ */
32
+ export class BridgeError extends Error {
33
+ code;
34
+ constructor(code, message) {
35
+ super(message);
36
+ this.name = "BridgeError";
37
+ this.code = code;
38
+ }
39
+ }
36
40
  const nonEmptyString = Type.String({ minLength: 1 });
37
- const operationSchema = Type.Union(RUNNER_OPERATIONS.map((operation) => Type.Literal(operation)));
41
+ const operationSchema = Type.Union(BRIDGE_OPERATIONS.map((operation) => Type.Literal(operation)));
38
42
  const identityProperties = {
39
43
  parentSessionId: nonEmptyString,
40
44
  subagentId: nonEmptyString,
@@ -45,13 +49,7 @@ const identityProperties = {
45
49
  export const HelloFrameSchema = Type.Object({
46
50
  version: Type.Literal(PROTOCOL_VERSION),
47
51
  type: Type.Literal("hello"),
48
- role: Type.Optional(Type.Union([
49
- Type.Literal("controller"),
50
- Type.Literal("reporter"),
51
- Type.Literal("recovery"),
52
- Type.Literal("bridge"),
53
- ])),
54
- claimId: Type.Optional(nonEmptyString),
52
+ role: Type.Optional(Type.Literal("child")),
55
53
  ...identityProperties,
56
54
  }, { additionalProperties: false });
57
55
  export const HelloAckFrameSchema = Type.Object({ version: Type.Literal(PROTOCOL_VERSION), type: Type.Literal("hello_ack") }, { additionalProperties: false });
@@ -62,7 +60,7 @@ export const RequestFrameSchema = Type.Object({
62
60
  operation: operationSchema,
63
61
  payload: Type.Optional(Type.Unknown()),
64
62
  }, { additionalProperties: false });
65
- export const RunnerErrorSchema = Type.Object({ code: nonEmptyString, message: nonEmptyString }, { additionalProperties: false });
63
+ export const BridgeErrorSchema = Type.Object({ code: nonEmptyString, message: nonEmptyString }, { additionalProperties: false });
66
64
  export const ResponseFrameSchema = Type.Union([
67
65
  Type.Object({
68
66
  version: Type.Literal(PROTOCOL_VERSION),
@@ -76,28 +74,17 @@ export const ResponseFrameSchema = Type.Union([
76
74
  type: Type.Literal("response"),
77
75
  id: nonEmptyString,
78
76
  ok: Type.Literal(false),
79
- error: RunnerErrorSchema,
77
+ error: BridgeErrorSchema,
80
78
  }, { additionalProperties: false }),
81
79
  ]);
82
80
  export const EventFrameSchema = Type.Object({ version: Type.Literal(PROTOCOL_VERSION), type: Type.Literal("event"), event: Type.Unknown() }, { additionalProperties: false });
83
- export const ServerFrameSchema = Type.Union([
84
- HelloAckFrameSchema,
85
- ResponseFrameSchema,
86
- EventFrameSchema,
87
- ]);
88
81
  export const PromptPayloadSchema = Type.Object({ message: nonEmptyString }, { additionalProperties: false });
89
- export const GetEntriesPayloadSchema = Type.Object({ since: nonEmptyString }, { additionalProperties: false });
90
82
  export const ContactReportPayloadSchema = Type.Object({
91
83
  type: Type.Literal("pi_subagent_report"),
92
84
  parentSessionId: nonEmptyString,
93
85
  childId: nonEmptyString,
94
86
  runtimeIdentity: nonEmptyString,
95
- reason: Type.Union([
96
- Type.Literal("progress_update"),
97
- Type.Literal("important_finding"),
98
- Type.Literal("need_decision"),
99
- Type.Literal("blocked"),
100
- ]),
87
+ reason: Type.Optional(Type.Union([Type.Literal("success"), Type.Literal("blocked")])),
101
88
  message: nonEmptyString,
102
89
  sessionId: Type.Optional(nonEmptyString),
103
90
  }, { additionalProperties: false });
@@ -114,16 +101,21 @@ export const ChildLifecyclePayloadSchema = Type.Object({
114
101
  sessionId: nonEmptyString,
115
102
  message: Type.Optional(Type.String()),
116
103
  }, { additionalProperties: false });
117
- export const PauseReportPayloadSchema = Type.Object({
118
- type: Type.Literal("report_paused"),
104
+ /**
105
+ * Only the source of the input, never its text: the parent needs to know a human used the child,
106
+ * and the child's conversation stays in the child.
107
+ */
108
+ export const ChildInputPayloadSchema = Type.Object({
109
+ type: Type.Literal(CHILD_INPUT_EVENT),
119
110
  parentSessionId: nonEmptyString,
120
111
  childId: nonEmptyString,
121
112
  runtimeIdentity: nonEmptyString,
122
- generation: Type.Integer({ minimum: 1 }),
113
+ source: Type.Union([
114
+ Type.Literal("interactive"),
115
+ Type.Literal("extension"),
116
+ Type.Literal("rpc"),
117
+ ]),
123
118
  }, { additionalProperties: false });
124
- export function isRunnerOperation(value) {
125
- return typeof value === "string" && RUNNER_OPERATIONS.includes(value);
126
- }
127
119
  export function isHelloFrame(value) {
128
120
  return Value.Check(HelloFrameSchema, value);
129
121
  }
@@ -139,8 +131,8 @@ export function isContactReportPayload(value) {
139
131
  export function isChildLifecyclePayload(value) {
140
132
  return Value.Check(ChildLifecyclePayloadSchema, value);
141
133
  }
142
- export function isPauseReportPayload(value) {
143
- return Value.Check(PauseReportPayloadSchema, value);
134
+ export function isChildInputPayload(value) {
135
+ return Value.Check(ChildInputPayloadSchema, value);
144
136
  }
145
137
  export function isResponseFrame(value) {
146
138
  return Value.Check(ResponseFrameSchema, value);
@@ -148,9 +140,6 @@ export function isResponseFrame(value) {
148
140
  export function isEventFrame(value) {
149
141
  return Value.Check(EventFrameSchema, value);
150
142
  }
151
- export function isServerFrame(value) {
152
- return Value.Check(ServerFrameSchema, value);
153
- }
154
143
  export function successResponse(id, data) {
155
144
  return {
156
145
  version: PROTOCOL_VERSION,
@@ -1,5 +1,5 @@
1
- import type { RuntimeClaim, SubagentRecord } from "./domain.js";
2
- export type RegistryErrorCode = "invalid_parent_session" | "corrupt_registry" | "unsupported_version" | "parent_mismatch" | "invalid_record" | "duplicate_child" | "unknown_child" | "stale_revision" | "runtime_mismatch" | "claim_conflict" | "claim_mismatch" | "stopped_child";
1
+ import type { SubagentRecord } from "./domain.js";
2
+ export type RegistryErrorCode = "invalid_parent_session" | "corrupt_registry" | "unsupported_version" | "parent_mismatch" | "invalid_record" | "duplicate_child" | "unknown_child" | "stale_revision" | "runtime_mismatch" | "stopped_child";
3
3
  export declare class SubagentRegistryError extends Error {
4
4
  readonly code: RegistryErrorCode;
5
5
  constructor(code: RegistryErrorCode, message: string);
@@ -22,12 +22,7 @@ export interface SubagentRegistry {
22
22
  * already been replaced by a newer one. The registry owns `revision` and
23
23
  * `updatedAt`; the updater's values for those fields are ignored.
24
24
  */
25
- update(id: string, expectedRevision: number, updater: (record: SubagentRecord) => SubagentRecord, expectedRuntimeIdentity?: string, signal?: AbortSignal): Promise<SubagentRecord>;
26
- claim(id: string, expectedRevision: number, claim: RuntimeClaim, expectedRuntimeIdentity?: string, expectedClaimId?: string, signal?: AbortSignal): Promise<SubagentRecord>;
27
- markClaimRunner(id: string, claimId: string, runnerPid: number, signal?: AbortSignal): Promise<SubagentRecord>;
28
- activateClaim(id: string, claimId: string, runnerPid: number, signal?: AbortSignal): Promise<SubagentRecord>;
29
- consumeReconnectClaim(id: string, claimId: string, controllerTokenHash: string, signal?: AbortSignal): Promise<SubagentRecord>;
30
- releaseClaim(id: string, claimId: string, signal?: AbortSignal): Promise<SubagentRecord>;
25
+ update(id: string, expectedRevision: number | undefined, updater: (record: SubagentRecord) => SubagentRecord, expectedRuntimeIdentity?: string, signal?: AbortSignal): Promise<SubagentRecord>;
31
26
  }
32
27
  export interface CreateSubagentRegistryOptions {
33
28
  readonly parentSessionId: string;