experimental-ash 0.2.0-alpha.11 → 0.2.0-alpha.14

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 (155) hide show
  1. package/dist/src/channel/channel-registry.d.ts +34 -0
  2. package/dist/src/channel/channel-registry.d.ts.map +1 -0
  3. package/dist/src/channel/channel-registry.js +63 -0
  4. package/dist/src/channel/channel-registry.js.map +1 -0
  5. package/dist/src/channel/http-channel.d.ts +19 -0
  6. package/dist/src/channel/http-channel.d.ts.map +1 -0
  7. package/dist/src/channel/http-channel.js +26 -0
  8. package/dist/src/channel/http-channel.js.map +1 -0
  9. package/dist/src/channel/schedule-channel.d.ts +18 -0
  10. package/dist/src/channel/schedule-channel.d.ts.map +1 -0
  11. package/dist/src/channel/schedule-channel.js +25 -0
  12. package/dist/src/channel/schedule-channel.js.map +1 -0
  13. package/dist/src/channel/schedule.d.ts +4 -6
  14. package/dist/src/channel/schedule.d.ts.map +1 -1
  15. package/dist/src/channel/schedule.js +6 -9
  16. package/dist/src/channel/schedule.js.map +1 -1
  17. package/dist/src/channel/{slack-emitter.d.ts → slack-channel.d.ts} +36 -15
  18. package/dist/src/channel/slack-channel.d.ts.map +1 -0
  19. package/dist/src/channel/{slack-emitter.js → slack-channel.js} +10 -10
  20. package/dist/src/channel/slack-channel.js.map +1 -0
  21. package/dist/src/channel/subagent-channel.d.ts +43 -0
  22. package/dist/src/channel/subagent-channel.d.ts.map +1 -0
  23. package/dist/src/channel/{subagent-emitter.js → subagent-channel.js} +14 -14
  24. package/dist/src/channel/subagent-channel.js.map +1 -0
  25. package/dist/src/channel/types.d.ts +101 -86
  26. package/dist/src/channel/types.d.ts.map +1 -1
  27. package/dist/src/compiler/manifest.d.ts +2 -2
  28. package/dist/src/compiler/normalize-channel.d.ts +1 -1
  29. package/dist/src/compiler/normalize-channel.js +3 -3
  30. package/dist/src/compiler/normalize-channel.js.map +1 -1
  31. package/dist/src/context/keys.d.ts +6 -6
  32. package/dist/src/context/keys.d.ts.map +1 -1
  33. package/dist/src/context/keys.js +12 -12
  34. package/dist/src/context/keys.js.map +1 -1
  35. package/dist/src/discover/grammar.d.ts +1 -1
  36. package/dist/src/discover/grammar.js +1 -1
  37. package/dist/src/execution/continuous-entry.d.ts +12 -2
  38. package/dist/src/execution/continuous-entry.d.ts.map +1 -1
  39. package/dist/src/execution/continuous-entry.js +37 -12
  40. package/dist/src/execution/continuous-entry.js.map +1 -1
  41. package/dist/src/execution/continuous-runtime.d.ts +1 -1
  42. package/dist/src/execution/continuous-runtime.d.ts.map +1 -1
  43. package/dist/src/execution/continuous-runtime.js +9 -8
  44. package/dist/src/execution/continuous-runtime.js.map +1 -1
  45. package/dist/src/execution/runtime-context.d.ts +3 -0
  46. package/dist/src/execution/runtime-context.d.ts.map +1 -1
  47. package/dist/src/execution/runtime-context.js +6 -3
  48. package/dist/src/execution/runtime-context.js.map +1 -1
  49. package/dist/src/execution/subagent-tool.d.ts +1 -1
  50. package/dist/src/execution/subagent-tool.js +3 -3
  51. package/dist/src/execution/subagent-tool.js.map +1 -1
  52. package/dist/src/execution/types.d.ts +1 -1
  53. package/dist/src/execution/types.d.ts.map +1 -1
  54. package/dist/src/execution/workflow-entry.d.ts.map +1 -1
  55. package/dist/src/execution/workflow-entry.js +5 -2
  56. package/dist/src/execution/workflow-entry.js.map +1 -1
  57. package/dist/src/execution/workflow-runtime.d.ts.map +1 -1
  58. package/dist/src/execution/workflow-runtime.js +5 -1
  59. package/dist/src/execution/workflow-runtime.js.map +1 -1
  60. package/dist/src/execution/workflow-steps.d.ts +9 -8
  61. package/dist/src/execution/workflow-steps.d.ts.map +1 -1
  62. package/dist/src/execution/workflow-steps.js +21 -13
  63. package/dist/src/execution/workflow-steps.js.map +1 -1
  64. package/dist/src/harness/emission.d.ts +10 -41
  65. package/dist/src/harness/emission.d.ts.map +1 -1
  66. package/dist/src/harness/emission.js +57 -238
  67. package/dist/src/harness/emission.js.map +1 -1
  68. package/dist/src/harness/step-hooks.d.ts +77 -0
  69. package/dist/src/harness/step-hooks.d.ts.map +1 -0
  70. package/dist/src/harness/step-hooks.js +192 -0
  71. package/dist/src/harness/step-hooks.js.map +1 -0
  72. package/dist/src/harness/tool-loop.d.ts +4 -2
  73. package/dist/src/harness/tool-loop.d.ts.map +1 -1
  74. package/dist/src/harness/tool-loop.js +107 -171
  75. package/dist/src/harness/tool-loop.js.map +1 -1
  76. package/dist/src/internal/application/package.js +1 -1
  77. package/dist/src/internal/authored-definition/channel.d.ts +3 -3
  78. package/dist/src/internal/authored-definition/channel.d.ts.map +1 -1
  79. package/dist/src/internal/authored-definition/channel.js +1 -1
  80. package/dist/src/internal/authored-definition/channel.js.map +1 -1
  81. package/dist/src/internal/nitro/host/configure-message-routes.js +1 -1
  82. package/dist/src/internal/nitro/host/configure-message-routes.js.map +1 -1
  83. package/dist/src/internal/nitro/routes/channel-dispatch.d.ts +1 -1
  84. package/dist/src/internal/nitro/routes/channel-dispatch.js +4 -4
  85. package/dist/src/internal/nitro/routes/channel-dispatch.js.map +1 -1
  86. package/dist/src/internal/nitro/routes/runtime-stack.d.ts +3 -3
  87. package/dist/src/internal/nitro/routes/runtime-stack.d.ts.map +1 -1
  88. package/dist/src/internal/nitro/routes/runtime-stack.js +3 -3
  89. package/dist/src/internal/nitro/routes/runtime-stack.js.map +1 -1
  90. package/dist/src/internal/nitro/routes/schedule-task.js +3 -3
  91. package/dist/src/internal/nitro/routes/schedule-task.js.map +1 -1
  92. package/dist/src/public/channels/auth.d.ts +32 -81
  93. package/dist/src/public/channels/auth.d.ts.map +1 -1
  94. package/dist/src/public/channels/auth.js +23 -86
  95. package/dist/src/public/channels/auth.js.map +1 -1
  96. package/dist/src/public/channels/http.d.ts +16 -16
  97. package/dist/src/public/channels/http.d.ts.map +1 -1
  98. package/dist/src/public/channels/http.js +38 -43
  99. package/dist/src/public/channels/http.js.map +1 -1
  100. package/dist/src/public/channels/index.d.ts +9 -9
  101. package/dist/src/public/channels/index.d.ts.map +1 -1
  102. package/dist/src/public/channels/index.js +8 -8
  103. package/dist/src/public/channels/index.js.map +1 -1
  104. package/dist/src/public/channels/slack/index.d.ts +56 -25
  105. package/dist/src/public/channels/slack/index.d.ts.map +1 -1
  106. package/dist/src/public/channels/slack/index.js +29 -27
  107. package/dist/src/public/channels/slack/index.js.map +1 -1
  108. package/dist/src/public/channels/slack/lowlevel.d.ts +5 -5
  109. package/dist/src/public/channels/slack/lowlevel.d.ts.map +1 -1
  110. package/dist/src/public/channels/slack/lowlevel.js +4 -4
  111. package/dist/src/public/channels/slack/lowlevel.js.map +1 -1
  112. package/dist/src/public/definitions/channel.d.ts +52 -52
  113. package/dist/src/public/definitions/channel.d.ts.map +1 -1
  114. package/dist/src/public/definitions/channel.js +24 -24
  115. package/dist/src/public/definitions/channel.js.map +1 -1
  116. package/dist/src/public/index.d.ts +6 -6
  117. package/dist/src/public/index.d.ts.map +1 -1
  118. package/dist/src/public/index.js +5 -5
  119. package/dist/src/public/index.js.map +1 -1
  120. package/dist/src/public/sandboxes/internal.d.ts +1 -1
  121. package/dist/src/public/sandboxes/internal.js +1 -1
  122. package/dist/src/public/tools/internal.d.ts +1 -1
  123. package/dist/src/public/tools/internal.js +1 -1
  124. package/dist/src/runtime/framework-channels/index.d.ts +3 -3
  125. package/dist/src/runtime/framework-channels/index.js +6 -6
  126. package/dist/src/runtime/framework-channels/index.js.map +1 -1
  127. package/dist/src/runtime/resolve-agent-graph.js +1 -1
  128. package/dist/src/runtime/resolve-agent-graph.js.map +1 -1
  129. package/dist/src/runtime/types.d.ts +3 -3
  130. package/dist/src/runtime/types.d.ts.map +1 -1
  131. package/docs/internals/channels.md +10 -7
  132. package/docs/internals/context.md +57 -3
  133. package/docs/internals/message-runtime.md +3 -3
  134. package/docs/public/auth-and-route-protection.md +11 -7
  135. package/docs/public/channels/README.md +12 -10
  136. package/docs/public/session-context.md +79 -1
  137. package/docs/public/typescript-api.md +6 -6
  138. package/package.json +11 -11
  139. package/dist/src/channel/emitter-registry.d.ts +0 -34
  140. package/dist/src/channel/emitter-registry.d.ts.map +0 -1
  141. package/dist/src/channel/emitter-registry.js +0 -63
  142. package/dist/src/channel/emitter-registry.js.map +0 -1
  143. package/dist/src/channel/http-emitter.d.ts +0 -18
  144. package/dist/src/channel/http-emitter.d.ts.map +0 -1
  145. package/dist/src/channel/http-emitter.js +0 -26
  146. package/dist/src/channel/http-emitter.js.map +0 -1
  147. package/dist/src/channel/schedule-emitter.d.ts +0 -17
  148. package/dist/src/channel/schedule-emitter.d.ts.map +0 -1
  149. package/dist/src/channel/schedule-emitter.js +0 -25
  150. package/dist/src/channel/schedule-emitter.js.map +0 -1
  151. package/dist/src/channel/slack-emitter.d.ts.map +0 -1
  152. package/dist/src/channel/slack-emitter.js.map +0 -1
  153. package/dist/src/channel/subagent-emitter.d.ts +0 -42
  154. package/dist/src/channel/subagent-emitter.d.ts.map +0 -1
  155. package/dist/src/channel/subagent-emitter.js.map +0 -1
@@ -0,0 +1,34 @@
1
+ import type { ChannelClass } from "./types.js";
2
+ /**
3
+ * Registers a {@link ChannelClass} so the framework can rebuild
4
+ * instances after a workflow step boundary. Call this once at module load
5
+ * time, alongside the class definition.
6
+ *
7
+ * Framework-shipped channels (Slack, subagent, schedule, http) call this at
8
+ * the bottom of their module file. User-authored channels do the same in
9
+ * their channel module so importing the channel file is enough to make the
10
+ * channel discoverable to the runtime codec.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * class MyChannel implements Channel {
15
+ * static readonly kind = "my-channel";
16
+ * readonly kind = "my-channel";
17
+ * // ...
18
+ * }
19
+ * registerChannel(MyChannel);
20
+ * ```
21
+ */
22
+ export declare function registerChannel<E extends ChannelClass>(cls: E): void;
23
+ /**
24
+ * Returns the registered {@link ChannelClass} for one `kind`, or
25
+ * `undefined` if no class has been registered. The codec throws a more
26
+ * descriptive error when `undefined` is returned at deserialization time.
27
+ */
28
+ export declare function getChannelClass(kind: string): ChannelClass | undefined;
29
+ /**
30
+ * Returns the set of currently-registered channel kinds. Used by tests and
31
+ * by diagnostic tooling that wants to enumerate available channels.
32
+ */
33
+ export declare function listRegisteredChannelKinds(): readonly string[];
34
+ //# sourceMappingURL=channel-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"channel-registry.d.ts","sourceRoot":"","sources":["../../../src/channel/channel-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAiB/C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,eAAe,CAAC,CAAC,SAAS,YAAY,EAAE,GAAG,EAAE,CAAC,GAAG,IAAI,CAkBpE;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,CAEtE;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,IAAI,SAAS,MAAM,EAAE,CAE9D"}
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Process-global registry mapping a {@link ChannelClass.kind} to its
3
+ * class. Populated by side-effecting `registerChannel` calls at
4
+ * module load time.
5
+ *
6
+ * Used by the {@link ChannelKey} codec in `context/keys.ts` to
7
+ * deserialize channel state across workflow step boundaries — the codec
8
+ * has no compile-time knowledge of which channels exist, so it asks the
9
+ * registry by `kind` instead.
10
+ *
11
+ * The registry is keyed by string `kind`. Two distinct classes registering
12
+ * the same `kind` is a programming error and throws.
13
+ */
14
+ const REGISTRY = new Map();
15
+ /**
16
+ * Registers a {@link ChannelClass} so the framework can rebuild
17
+ * instances after a workflow step boundary. Call this once at module load
18
+ * time, alongside the class definition.
19
+ *
20
+ * Framework-shipped channels (Slack, subagent, schedule, http) call this at
21
+ * the bottom of their module file. User-authored channels do the same in
22
+ * their channel module so importing the channel file is enough to make the
23
+ * channel discoverable to the runtime codec.
24
+ *
25
+ * @example
26
+ * ```ts
27
+ * class MyChannel implements Channel {
28
+ * static readonly kind = "my-channel";
29
+ * readonly kind = "my-channel";
30
+ * // ...
31
+ * }
32
+ * registerChannel(MyChannel);
33
+ * ```
34
+ */
35
+ export function registerChannel(cls) {
36
+ if (typeof cls.kind !== "string" || cls.kind.length === 0) {
37
+ throw new TypeError("registerChannel: class must declare a non-empty static `kind` field.");
38
+ }
39
+ if (typeof cls.deserialize !== "function") {
40
+ throw new TypeError(`registerChannel: class for kind "${cls.kind}" must declare a static \`deserialize\` method.`);
41
+ }
42
+ const existing = REGISTRY.get(cls.kind);
43
+ if (existing !== undefined && existing !== cls) {
44
+ throw new Error(`registerChannel: duplicate registration for kind "${cls.kind}". A different class is already registered.`);
45
+ }
46
+ REGISTRY.set(cls.kind, cls);
47
+ }
48
+ /**
49
+ * Returns the registered {@link ChannelClass} for one `kind`, or
50
+ * `undefined` if no class has been registered. The codec throws a more
51
+ * descriptive error when `undefined` is returned at deserialization time.
52
+ */
53
+ export function getChannelClass(kind) {
54
+ return REGISTRY.get(kind);
55
+ }
56
+ /**
57
+ * Returns the set of currently-registered channel kinds. Used by tests and
58
+ * by diagnostic tooling that wants to enumerate available channels.
59
+ */
60
+ export function listRegisteredChannelKinds() {
61
+ return [...REGISTRY.keys()];
62
+ }
63
+ //# sourceMappingURL=channel-registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"channel-registry.js","sourceRoot":"","sources":["../../../src/channel/channel-registry.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AACH,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAwB,CAAC;AAEjD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,eAAe,CAAyB,GAAM;IAC5D,IAAI,OAAO,GAAG,CAAC,IAAI,KAAK,QAAQ,IAAI,GAAG,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1D,MAAM,IAAI,SAAS,CAAC,sEAAsE,CAAC,CAAC;IAC9F,CAAC;IACD,IAAI,OAAO,GAAG,CAAC,WAAW,KAAK,UAAU,EAAE,CAAC;QAC1C,MAAM,IAAI,SAAS,CACjB,oCAAoC,GAAG,CAAC,IAAI,iDAAiD,CAC9F,CAAC;IACJ,CAAC;IAED,MAAM,QAAQ,GAAG,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACxC,IAAI,QAAQ,KAAK,SAAS,IAAI,QAAQ,KAAK,GAAG,EAAE,CAAC;QAC/C,MAAM,IAAI,KAAK,CACb,qDAAqD,GAAG,CAAC,IAAI,6CAA6C,CAC3G,CAAC;IACJ,CAAC;IAED,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;AAC9B,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,IAAY;IAC1C,OAAO,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AAC5B,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,0BAA0B;IACxC,OAAO,CAAC,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;AAC9B,CAAC"}
@@ -0,0 +1,19 @@
1
+ import type { StepInput } from "../harness/types.js";
2
+ import type { HandleMessageStreamEvent } from "../protocol/message.js";
3
+ import type { Channel, ContextAccessor, DeliverPayload } from "./types.js";
4
+ /**
5
+ * Stateless channel for HTTP routes.
6
+ *
7
+ * Events pass straight through to the stream (no side effects). Deliver
8
+ * payloads pass through untransformed — HTTP clients send structured
9
+ * {@link InputResponse} objects directly.
10
+ */
11
+ export declare class HttpChannel implements Channel {
12
+ static readonly kind = "http";
13
+ readonly kind = "http";
14
+ onEvent(event: HandleMessageStreamEvent): Promise<HandleMessageStreamEvent>;
15
+ onDeliver(_ctx: ContextAccessor, payload: DeliverPayload): Promise<StepInput>;
16
+ serialize(): Record<string, unknown>;
17
+ static deserialize(_state: Record<string, unknown>): HttpChannel;
18
+ }
19
+ //# sourceMappingURL=http-channel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-channel.d.ts","sourceRoot":"","sources":["../../../src/channel/http-channel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAEvE,OAAO,KAAK,EAAE,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE3E;;;;;;GAMG;AACH,qBAAa,WAAY,YAAW,OAAO;IACzC,MAAM,CAAC,QAAQ,CAAC,IAAI,UAAU;IAC9B,QAAQ,CAAC,IAAI,UAAU;IAEjB,OAAO,CAAC,KAAK,EAAE,wBAAwB,GAAG,OAAO,CAAC,wBAAwB,CAAC;IAI3E,SAAS,CAAC,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,SAAS,CAAC;IAInF,SAAS,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAIpC,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,WAAW;CAGjE"}
@@ -0,0 +1,26 @@
1
+ import { registerChannel } from "./channel-registry.js";
2
+ /**
3
+ * Stateless channel for HTTP routes.
4
+ *
5
+ * Events pass straight through to the stream (no side effects). Deliver
6
+ * payloads pass through untransformed — HTTP clients send structured
7
+ * {@link InputResponse} objects directly.
8
+ */
9
+ export class HttpChannel {
10
+ static kind = "http";
11
+ kind = "http";
12
+ async onEvent(event) {
13
+ return event;
14
+ }
15
+ async onDeliver(_ctx, payload) {
16
+ return payload;
17
+ }
18
+ serialize() {
19
+ return {};
20
+ }
21
+ static deserialize(_state) {
22
+ return new HttpChannel();
23
+ }
24
+ }
25
+ registerChannel(HttpChannel);
26
+ //# sourceMappingURL=http-channel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-channel.js","sourceRoot":"","sources":["../../../src/channel/http-channel.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAGxD;;;;;;GAMG;AACH,MAAM,OAAO,WAAW;IACtB,MAAM,CAAU,IAAI,GAAG,MAAM,CAAC;IACrB,IAAI,GAAG,MAAM,CAAC;IAEvB,KAAK,CAAC,OAAO,CAAC,KAA+B;QAC3C,OAAO,KAAK,CAAC;IACf,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,IAAqB,EAAE,OAAuB;QAC5D,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,SAAS;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,CAAC,WAAW,CAAC,MAA+B;QAChD,OAAO,IAAI,WAAW,EAAE,CAAC;IAC3B,CAAC;;AAGH,eAAe,CAAC,WAAW,CAAC,CAAC"}
@@ -0,0 +1,18 @@
1
+ import type { StepInput } from "../harness/types.js";
2
+ import type { HandleMessageStreamEvent } from "../protocol/message.js";
3
+ import type { Channel, ContextAccessor, DeliverPayload } from "./types.js";
4
+ /**
5
+ * Stateless channel for scheduled runs.
6
+ *
7
+ * Events pass straight through to the stream (no side effects). Deliver
8
+ * payloads pass through untransformed.
9
+ */
10
+ export declare class ScheduleChannel implements Channel {
11
+ static readonly kind = "schedule";
12
+ readonly kind = "schedule";
13
+ onEvent(event: HandleMessageStreamEvent): Promise<HandleMessageStreamEvent>;
14
+ onDeliver(_ctx: ContextAccessor, payload: DeliverPayload): Promise<StepInput>;
15
+ serialize(): Record<string, unknown>;
16
+ static deserialize(_state: Record<string, unknown>): ScheduleChannel;
17
+ }
18
+ //# sourceMappingURL=schedule-channel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schedule-channel.d.ts","sourceRoot":"","sources":["../../../src/channel/schedule-channel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAEvE,OAAO,KAAK,EAAE,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE3E;;;;;GAKG;AACH,qBAAa,eAAgB,YAAW,OAAO;IAC7C,MAAM,CAAC,QAAQ,CAAC,IAAI,cAAc;IAClC,QAAQ,CAAC,IAAI,cAAc;IAErB,OAAO,CAAC,KAAK,EAAE,wBAAwB,GAAG,OAAO,CAAC,wBAAwB,CAAC;IAI3E,SAAS,CAAC,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,SAAS,CAAC;IAInF,SAAS,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAIpC,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,eAAe;CAGrE"}
@@ -0,0 +1,25 @@
1
+ import { registerChannel } from "./channel-registry.js";
2
+ /**
3
+ * Stateless channel for scheduled runs.
4
+ *
5
+ * Events pass straight through to the stream (no side effects). Deliver
6
+ * payloads pass through untransformed.
7
+ */
8
+ export class ScheduleChannel {
9
+ static kind = "schedule";
10
+ kind = "schedule";
11
+ async onEvent(event) {
12
+ return event;
13
+ }
14
+ async onDeliver(_ctx, payload) {
15
+ return payload;
16
+ }
17
+ serialize() {
18
+ return {};
19
+ }
20
+ static deserialize(_state) {
21
+ return new ScheduleChannel();
22
+ }
23
+ }
24
+ registerChannel(ScheduleChannel);
25
+ //# sourceMappingURL=schedule-channel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schedule-channel.js","sourceRoot":"","sources":["../../../src/channel/schedule-channel.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAGxD;;;;;GAKG;AACH,MAAM,OAAO,eAAe;IAC1B,MAAM,CAAU,IAAI,GAAG,UAAU,CAAC;IACzB,IAAI,GAAG,UAAU,CAAC;IAE3B,KAAK,CAAC,OAAO,CAAC,KAA+B;QAC3C,OAAO,KAAK,CAAC;IACf,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,IAAqB,EAAE,OAAuB;QAC5D,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,SAAS;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,CAAC,WAAW,CAAC,MAA+B;QAChD,OAAO,IAAI,eAAe,EAAE,CAAC;IAC/B,CAAC;;AAGH,eAAe,CAAC,eAAe,CAAC,CAAC"}
@@ -1,6 +1,5 @@
1
- import { ScheduleChannelEmitter } from "./schedule-emitter.js";
2
1
  import type { RunHandle, Runtime } from "./types.js";
3
- export { ScheduleChannelEmitter } from "./schedule-emitter.js";
2
+ export { ScheduleChannel } from "./schedule-channel.js";
4
3
  /**
5
4
  * Input for triggering a one-shot schedule run.
6
5
  */
@@ -9,23 +8,22 @@ export interface ScheduleTriggerInput {
9
8
  readonly scheduleId: string;
10
9
  }
11
10
  /**
12
- * Channel for one-shot scheduled task execution.
11
+ * Dispatcher for one-shot scheduled task execution.
13
12
  *
14
13
  * Each trigger generates a unique continuation token so every cron
15
14
  * invocation starts a fresh session. Schedule runs always use task
16
15
  * mode, so the runtime requires the harness to finish within the
17
16
  * current invocation instead of parking for follow-up messages.
18
17
  *
19
- * The channel never touches the compiled bundle, the {@link AshContext},
18
+ * The dispatcher never touches the compiled bundle, the {@link AshContext},
20
19
  * or any execution-layer machinery — it speaks to the runtime through
21
20
  * `run` and `deliver` only.
22
21
  */
23
- export declare class ScheduleChannel {
22
+ export declare class ScheduleDispatcher {
24
23
  private readonly runtime;
25
24
  constructor(config: {
26
25
  readonly runtime: Runtime;
27
26
  });
28
- createEmitter(): ScheduleChannelEmitter;
29
27
  trigger(input: ScheduleTriggerInput): Promise<RunHandle>;
30
28
  }
31
29
  //# sourceMappingURL=schedule.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"schedule.d.ts","sourceRoot":"","sources":["../../../src/channel/schedule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,KAAK,EAAE,SAAS,EAAE,OAAO,EAAsB,MAAM,YAAY,CAAC;AAEzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAE/D;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;;;;;;;GAWG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAU;gBAEtB,MAAM,EAAE;QAAE,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;KAAE;IAIjD,aAAa,IAAI,sBAAsB;IAIjC,OAAO,CAAC,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAAC,SAAS,CAAC;CAW/D"}
1
+ {"version":3,"file":"schedule.d.ts","sourceRoot":"","sources":["../../../src/channel/schedule.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,OAAO,EAAsB,MAAM,YAAY,CAAC;AAEzE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;;;;;;;GAWG;AACH,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAU;gBAEtB,MAAM,EAAE;QAAE,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;KAAE;IAI3C,OAAO,CAAC,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAAC,SAAS,CAAC;CAW/D"}
@@ -1,30 +1,27 @@
1
- import { ScheduleChannelEmitter } from "./schedule-emitter.js";
2
- export { ScheduleChannelEmitter } from "./schedule-emitter.js";
1
+ import { ScheduleChannel } from "./schedule-channel.js";
2
+ export { ScheduleChannel } from "./schedule-channel.js";
3
3
  /**
4
- * Channel for one-shot scheduled task execution.
4
+ * Dispatcher for one-shot scheduled task execution.
5
5
  *
6
6
  * Each trigger generates a unique continuation token so every cron
7
7
  * invocation starts a fresh session. Schedule runs always use task
8
8
  * mode, so the runtime requires the harness to finish within the
9
9
  * current invocation instead of parking for follow-up messages.
10
10
  *
11
- * The channel never touches the compiled bundle, the {@link AshContext},
11
+ * The dispatcher never touches the compiled bundle, the {@link AshContext},
12
12
  * or any execution-layer machinery — it speaks to the runtime through
13
13
  * `run` and `deliver` only.
14
14
  */
15
- export class ScheduleChannel {
15
+ export class ScheduleDispatcher {
16
16
  runtime;
17
17
  constructor(config) {
18
18
  this.runtime = config.runtime;
19
19
  }
20
- createEmitter() {
21
- return new ScheduleChannelEmitter();
22
- }
23
20
  async trigger(input) {
24
21
  const continuationToken = `schedule:${input.scheduleId}:${crypto.randomUUID()}`;
25
22
  return await this.runtime.run({
26
23
  auth: createScheduleAuthContext(input.scheduleId),
27
- channelEmitter: this.createEmitter(),
24
+ channel: new ScheduleChannel(),
28
25
  continuationToken,
29
26
  input: { message: input.markdown },
30
27
  mode: "task",
@@ -1 +1 @@
1
- {"version":3,"file":"schedule.js","sourceRoot":"","sources":["../../../src/channel/schedule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAG/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAU/D;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,eAAe;IACT,OAAO,CAAU;IAElC,YAAY,MAAqC;QAC/C,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;IAChC,CAAC;IAED,aAAa;QACX,OAAO,IAAI,sBAAsB,EAAE,CAAC;IACtC,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,KAA2B;QACvC,MAAM,iBAAiB,GAAG,YAAY,KAAK,CAAC,UAAU,IAAI,MAAM,CAAC,UAAU,EAAE,EAAE,CAAC;Q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EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,QAAQ,EAAE;YAClC,IAAI,EAAE,MAAM;YACZ,SAAS,EAAE,MAAM,CAAC,UAAU,EAAE;SAC/B,CAAC,CAAC;IACL,CAAC;CACF;AAED,SAAS,yBAAyB,CAAC,UAAkB;IACnD,OAAO;QACL,UAAU,EAAE,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE;QAC3C,aAAa,EAAE,UAAU;QACzB,MAAM,EAAE,iBAAiB;QACzB,WAAW,EAAE,gBAAgB,UAAU,EAAE;QACzC,aAAa,EAAE,SAAS;QACxB,OAAO,EAAE,UAAU;KACpB,CAAC;AACJ,CAAC"}
@@ -1,11 +1,12 @@
1
- import type { SerializedThread } from "chat";
1
+ import type { Actions, Button, Card, CardText, Select, SelectOption, SerializedThread } from "chat";
2
+ import type { StepInput } from "../harness/types.js";
2
3
  import type { HandleMessageStreamEvent } from "../protocol/message.js";
3
4
  import type { InputRequest } from "../runtime/input/types.js";
4
- import type { ChannelEmitter, DeliverPayload, EventEmitFn, ResolvedStepInput } from "./types.js";
5
+ import type { Channel, ContextAccessor, DeliverPayload } from "./types.js";
5
6
  /**
6
- * Minimal serializable state for the Slack emitter.
7
+ * Minimal serializable state for the Slack channel.
7
8
  */
8
- export interface SlackChannelEmitterState {
9
+ export interface SlackChannelState {
9
10
  readonly botToken?: string;
10
11
  readonly serializedThread: SerializedThread;
11
12
  /**
@@ -15,8 +16,27 @@ export interface SlackChannelEmitterState {
15
16
  */
16
17
  readonly pendingRequests?: readonly InputRequest[];
17
18
  }
19
+ interface RehydratedThread {
20
+ post(message: string | {
21
+ readonly markdown: string;
22
+ } | unknown): Promise<unknown>;
23
+ startTyping(status?: string): Promise<void>;
24
+ }
25
+ /**
26
+ * Dynamically imported Chat SDK card element constructors.
27
+ * Loaded lazily alongside the adapter to avoid bundling `chat`
28
+ * in workflow VMs.
29
+ */
30
+ interface CardKit {
31
+ Actions: typeof Actions;
32
+ Button: typeof Button;
33
+ Card: typeof Card;
34
+ CardText: typeof CardText;
35
+ Select: typeof Select;
36
+ SelectOption: typeof SelectOption;
37
+ }
18
38
  /**
19
- * Emitter that rehydrates a Chat SDK `Thread` from serialized state and
39
+ * Channel that rehydrates a Chat SDK `Thread` from serialized state and
20
40
  * uses `thread.startTyping()` to show typing status with tool names while
21
41
  * the agent is working, then posts the final reply via `thread.post()`.
22
42
  *
@@ -24,26 +44,26 @@ export interface SlackChannelEmitterState {
24
44
  * (Block Kit buttons and select menus) and stores the pending requests
25
45
  * in serializable state so `onDeliver` can resolve text replies.
26
46
  */
27
- export declare class SlackChannelEmitter implements ChannelEmitter {
47
+ export declare class SlackChannel implements Channel {
28
48
  static readonly kind = "slack";
29
49
  readonly kind = "slack";
30
50
  private _state;
31
51
  private _cardKit;
32
52
  private _pendingToolCallMessage;
33
53
  private _thread;
34
- constructor(state: SlackChannelEmitterState);
54
+ constructor(state: SlackChannelState);
35
55
  get botToken(): string | undefined;
36
56
  get serializedThread(): SerializedThread;
37
57
  serialize(): Record<string, unknown>;
38
- static deserialize(state: Record<string, unknown>): SlackChannelEmitter;
39
- onDeliver(payload: DeliverPayload): ResolvedStepInput;
40
- onEvent(event: HandleMessageStreamEvent, emit: EventEmitFn): Promise<void>;
58
+ static deserialize(state: Record<string, unknown>): SlackChannel;
59
+ onDeliver(_ctx: ContextAccessor, payload: DeliverPayload): Promise<StepInput>;
60
+ onEvent(event: HandleMessageStreamEvent): Promise<HandleMessageStreamEvent>;
41
61
  private consumePendingToolCallMessage;
42
62
  private consumePendingToolCallStatus;
43
63
  private clearPendingToolCallMessage;
44
64
  private setPendingToolCallMessage;
45
- private post;
46
- private startTyping;
65
+ protected post(text: string): Promise<void>;
66
+ protected startTyping(status: string): Promise<void>;
47
67
  /**
48
68
  * Renders each pending input request as a rich Card element with
49
69
  * interactive buttons or select menus, posted to the Slack thread.
@@ -52,7 +72,7 @@ export declare class SlackChannelEmitter implements ChannelEmitter {
52
72
  /**
53
73
  * Lazily imports the Chat SDK card element constructors.
54
74
  */
55
- private getCardKit;
75
+ protected getCardKit(): Promise<CardKit>;
56
76
  /**
57
77
  * Lazily rehydrates the Chat SDK Thread from serialized state.
58
78
  *
@@ -62,6 +82,7 @@ export declare class SlackChannelEmitter implements ChannelEmitter {
62
82
  * errors in the workflow VM). esbuild's final Vercel-function
63
83
  * re-bundle resolves and inlines them with `platform: "node"`.
64
84
  */
65
- private getThread;
85
+ protected getThread(): Promise<RehydratedThread>;
66
86
  }
67
- //# sourceMappingURL=slack-emitter.d.ts.map
87
+ export {};
88
+ //# sourceMappingURL=slack-channel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slack-channel.d.ts","sourceRoot":"","sources":["../../../src/channel/slack-channel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,MAAM,CAAC;AACpG,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAEvE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAG9D,OAAO,KAAK,EAAE,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE3E;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;IAC5C;;;;OAIG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,SAAS,YAAY,EAAE,CAAC;CACpD;AAED,UAAU,gBAAgB;IACxB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG;QAAE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,GAAG,OAAO,CAAC,OAAO,CA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AAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAS1D;;;OAGG;YACW,mBAAmB;IAcjC;;OAEG;cACa,UAAU,IAAI,OAAO,CAAC,OAAO,CAAC;IAiB9C;;;;;;;;OAQG;cACa,SAAS,IAAI,OAAO,CAAC,gBAAgB,CAAC;CAevD"}
@@ -1,4 +1,4 @@
1
- import { registerChannelEmitter } from "./emitter-registry.js";
1
+ import { registerChannel } from "./channel-registry.js";
2
2
  import { resolveTextToResponses } from "./resolve-text.js";
3
3
  const SLACK_MAX_TYPING_STATUS_LENGTH = 50;
4
4
  function labelForAction(action) {
@@ -29,10 +29,10 @@ function truncateTypingStatus(status) {
29
29
  return `${normalized.slice(0, SLACK_MAX_TYPING_STATUS_LENGTH - 3).trimEnd()}...`;
30
30
  }
31
31
  // ---------------------------------------------------------------------------
32
- // Emitter
32
+ // Channel
33
33
  // ---------------------------------------------------------------------------
34
34
  /**
35
- * Emitter that rehydrates a Chat SDK `Thread` from serialized state and
35
+ * Channel that rehydrates a Chat SDK `Thread` from serialized state and
36
36
  * uses `thread.startTyping()` to show typing status with tool names while
37
37
  * the agent is working, then posts the final reply via `thread.post()`.
38
38
  *
@@ -40,7 +40,7 @@ function truncateTypingStatus(status) {
40
40
  * (Block Kit buttons and select menus) and stores the pending requests
41
41
  * in serializable state so `onDeliver` can resolve text replies.
42
42
  */
43
- export class SlackChannelEmitter {
43
+ export class SlackChannel {
44
44
  static kind = "slack";
45
45
  kind = "slack";
46
46
  _state;
@@ -64,14 +64,14 @@ export class SlackChannelEmitter {
64
64
  };
65
65
  }
66
66
  static deserialize(state) {
67
- return new SlackChannelEmitter({
67
+ return new SlackChannel({
68
68
  botToken: state.botToken,
69
69
  pendingRequests: state.pendingRequests,
70
70
  serializedThread: state.serializedThread,
71
71
  });
72
72
  }
73
73
  // ── Inbound: transform delivered input ─────────────────
74
- onDeliver(payload) {
74
+ async onDeliver(_ctx, payload) {
75
75
  // Structured responses (Slack button callback, HTTP client) —
76
76
  // pass through untouched.
77
77
  if (payload.inputResponses !== undefined && payload.inputResponses.length > 0) {
@@ -91,8 +91,7 @@ export class SlackChannelEmitter {
91
91
  return { message: payload.message };
92
92
  }
93
93
  // ── Outbound: render events to Slack ───────────────────
94
- async onEvent(event, emit) {
95
- await emit(event);
94
+ async onEvent(event) {
96
95
  switch (event.type) {
97
96
  case "turn.started":
98
97
  this.clearPendingToolCallMessage();
@@ -130,6 +129,7 @@ export class SlackChannelEmitter {
130
129
  await this.post("Something went wrong.");
131
130
  break;
132
131
  }
132
+ return event;
133
133
  }
134
134
  consumePendingToolCallMessage() {
135
135
  const message = this._pendingToolCallMessage;
@@ -229,7 +229,7 @@ export class SlackChannelEmitter {
229
229
  return thread;
230
230
  }
231
231
  }
232
- registerChannelEmitter(SlackChannelEmitter);
232
+ registerChannel(SlackChannel);
233
233
  const INPUT_OPTION_STYLE_TO_BUTTON_STYLE = {
234
234
  danger: "danger",
235
235
  default: undefined,
@@ -279,4 +279,4 @@ function buildInputRequestCard(kit, request) {
279
279
  children: [kit.CardText(request.prompt)],
280
280
  });
281
281
  }
282
- //# sourceMappingURL=slack-emitter.js.map
282
+ //# sourceMappingURL=slack-channel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slack-channel.js","sourceRoot":"","sources":["../../../src/channel/slack-channel.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAoC3D,MAAM,8BAA8B,GAAG,EAAE,CAAC;AAE1C,SAAS,cAAc,CAAC,MAA4B;IAClD,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;QACpB,KAAK,YAAY;YACf,OAAO,YAAY,CAAC;QACtB,KAAK,eAAe;YAClB,OAAO,MAAM,CAAC,YAAY,CAAC;QAC7B,KAAK,WAAW;YACd,OAAO,MAAM,CAAC,QAAQ,CAAC;IAC3B,CAAC;AACH,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C,OAAO,CAAC,MAAM,CAAC,CAAC;KACzC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,43 @@
1
+ import type { StepInput } from "../harness/types.js";
2
+ import { type HandleMessageStreamEvent } from "../protocol/message.js";
3
+ import type { Channel, ContextAccessor, DeliverPayload } from "./types.js";
4
+ /**
5
+ * Serializable state for the subagent channel.
6
+ *
7
+ * All fields are constant for the lifetime of one child run and are
8
+ * round-tripped through the {@link ChannelKey} codec so the
9
+ * channel can be reconstructed at every workflow step boundary.
10
+ */
11
+ export interface SubagentChannelState {
12
+ readonly callId: string;
13
+ readonly subagentName: string;
14
+ }
15
+ /**
16
+ * Channel attached to a delegated subagent child run.
17
+ *
18
+ * Wraps every event in a `subagent.event` envelope tagged with the
19
+ * child's call id and subagent name and writes the envelope to the
20
+ * child's event stream. The parent's subagent tool wrapper drains
21
+ * that stream and forwards each pre-wrapped envelope verbatim to its
22
+ * own emit function — no envelope-construction logic in the pump.
23
+ *
24
+ * Holding the wrapping responsibility inside the channel
25
+ * (rather than in the parent-side pump) keeps delivery policy in the
26
+ * channel layer (CLAUDE.md rule 17) and makes the subagent channel
27
+ * structurally and behaviorally parallel to other channels
28
+ * like {@link SlackChannel} that hold serializable state and
29
+ * do real work in `onEvent`.
30
+ */
31
+ export declare class SubagentChannel implements Channel {
32
+ static readonly kind = "subagent";
33
+ readonly kind = "subagent";
34
+ private readonly _state;
35
+ constructor(state: SubagentChannelState);
36
+ get callId(): string;
37
+ get subagentName(): string;
38
+ onEvent(event: HandleMessageStreamEvent): Promise<HandleMessageStreamEvent>;
39
+ onDeliver(_ctx: ContextAccessor, payload: DeliverPayload): Promise<StepInput>;
40
+ serialize(): Record<string, unknown>;
41
+ static deserialize(state: Record<string, unknown>): SubagentChannel;
42
+ }
43
+ //# sourceMappingURL=subagent-channel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subagent-channel.d.ts","sourceRoot":"","sources":["../../../src/channel/subagent-channel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAEL,KAAK,wBAAwB,EAC9B,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EAAE,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE3E;;;;;;GAMG;AACH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC/B;AAED;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,eAAgB,YAAW,OAAO;IAC7C,MAAM,CAAC,QAAQ,CAAC,IAAI,cAAc;IAClC,QAAQ,CAAC,IAAI,cAAc;IAE3B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAuB;gBAElC,KAAK,EAAE,oBAAoB;IAIvC,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED,IAAI,YAAY,IAAI,MAAM,CAEzB;IAEK,OAAO,CAAC,KAAK,EAAE,wBAAwB,GAAG,OAAO,CAAC,wBAAwB,CAAC;IAQ3E,SAAS,CAAC,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,SAAS,CAAC;IAInF,SAAS,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAOpC,MAAM,CAAC,WAAW,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,eAAe;CAMpE"}
@@ -1,7 +1,7 @@
1
1
  import { createSubagentChildEventEvent, } from "../protocol/message.js";
2
- import { registerChannelEmitter } from "./emitter-registry.js";
2
+ import { registerChannel } from "./channel-registry.js";
3
3
  /**
4
- * Channel emitter attached to a delegated subagent child run.
4
+ * Channel attached to a delegated subagent child run.
5
5
  *
6
6
  * Wraps every event in a `subagent.event` envelope tagged with the
7
7
  * child's call id and subagent name and writes the envelope to the
@@ -9,14 +9,14 @@ import { registerChannelEmitter } from "./emitter-registry.js";
9
9
  * that stream and forwards each pre-wrapped envelope verbatim to its
10
10
  * own emit function — no envelope-construction logic in the pump.
11
11
  *
12
- * Holding the wrapping responsibility inside the channel emitter
12
+ * Holding the wrapping responsibility inside the channel
13
13
  * (rather than in the parent-side pump) keeps delivery policy in the
14
- * channel layer (CLAUDE.md rule 17) and makes the subagent emitter
15
- * structurally and behaviorally parallel to other channel emitters
16
- * like {@link SlackChannelEmitter} that hold serializable state and
14
+ * channel layer (CLAUDE.md rule 17) and makes the subagent channel
15
+ * structurally and behaviorally parallel to other channels
16
+ * like {@link SlackChannel} that hold serializable state and
17
17
  * do real work in `onEvent`.
18
18
  */
19
- export class SubagentChannelEmitter {
19
+ export class SubagentChannel {
20
20
  static kind = "subagent";
21
21
  kind = "subagent";
22
22
  _state;
@@ -29,14 +29,14 @@ export class SubagentChannelEmitter {
29
29
  get subagentName() {
30
30
  return this._state.subagentName;
31
31
  }
32
- async onEvent(event, emit) {
33
- await emit(createSubagentChildEventEvent({
32
+ async onEvent(event) {
33
+ return createSubagentChildEventEvent({
34
34
  callId: this._state.callId,
35
35
  event,
36
36
  subagentName: this._state.subagentName,
37
- }));
37
+ });
38
38
  }
39
- onDeliver(payload) {
39
+ async onDeliver(_ctx, payload) {
40
40
  return payload;
41
41
  }
42
42
  serialize() {
@@ -46,11 +46,11 @@ export class SubagentChannelEmitter {
46
46
  };
47
47
  }
48
48
  static deserialize(state) {
49
- return new SubagentChannelEmitter({
49
+ return new SubagentChannel({
50
50
  callId: state.callId,
51
51
  subagentName: state.subagentName,
52
52
  });
53
53
  }
54
54
  }
55
- registerChannelEmitter(SubagentChannelEmitter);
56
- //# sourceMappingURL=subagent-emitter.js.map
55
+ registerChannel(SubagentChannel);
56
+ //# sourceMappingURL=subagent-channel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subagent-channel.js","sourceRoot":"","sources":["../../../src/channel/subagent-channel.ts"],"names":[],"mappings":"AACA,OAAO,EACL,6BAA6B,GAE9B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAexD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,OAAO,eAAe;IAC1B,MAAM,CAAU,IAAI,GAAG,UAAU,CAAC;IACzB,IAAI,GAAG,UAAU,CAAC;IAEV,MAAM,CAAuB;IAE9C,YAAY,KAA2B;QACrC,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACtB,CAAC;IAED,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;IAC5B,CAAC;IAED,IAAI,YAAY;QACd,OAAO,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC;IAClC,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,KAA+B;QAC3C,OAAO,6BAA6B,CAAC;YACnC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM;YAC1B,KAAK;YACL,YAAY,EAAE,IAAI,CAAC,MAAM,CAAC,YAAY;SACvC,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,IAAqB,EAAE,OAAuB;QAC5D,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,SAAS;QACP,OAAO;YACL,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM;YAC1B,YAAY,EAAE,IAAI,CAAC,MAAM,CAAC,YAAY;SACvC,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,WAAW,CAAC,KAA8B;QAC/C,OAAO,IAAI,eAAe,CAAC;YACzB,MAAM,EAAE,KAAK,CAAC,MAAgB;YAC9B,YAAY,EAAE,KAAK,CAAC,YAAsB;SAC3C,CAAC,CAAC;IACL,CAAC;;AAGH,eAAe,CAAC,eAAe,CAAC,CAAC"}