experimental-ash 0.2.0-alpha.21 → 0.2.0-alpha.22

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 (185) hide show
  1. package/dist/src/channel/slack-channel.d.ts +14 -7
  2. package/dist/src/channel/slack-channel.d.ts.map +1 -1
  3. package/dist/src/channel/slack-channel.js +21 -11
  4. package/dist/src/channel/slack-channel.js.map +1 -1
  5. package/dist/src/channel/types.d.ts +14 -14
  6. package/dist/src/channel/types.d.ts.map +1 -1
  7. package/dist/src/channel/types.js +6 -0
  8. package/dist/src/channel/types.js.map +1 -1
  9. package/dist/src/context/accessors.d.ts +24 -10
  10. package/dist/src/context/accessors.d.ts.map +1 -1
  11. package/dist/src/context/accessors.js +34 -16
  12. package/dist/src/context/accessors.js.map +1 -1
  13. package/dist/src/context/container.d.ts +43 -20
  14. package/dist/src/context/container.d.ts.map +1 -1
  15. package/dist/src/context/container.js +54 -22
  16. package/dist/src/context/container.js.map +1 -1
  17. package/dist/src/context/key.d.ts +68 -39
  18. package/dist/src/context/key.d.ts.map +1 -1
  19. package/dist/src/context/key.js +49 -62
  20. package/dist/src/context/key.js.map +1 -1
  21. package/dist/src/context/keys.d.ts +6 -6
  22. package/dist/src/context/keys.d.ts.map +1 -1
  23. package/dist/src/context/keys.js +7 -9
  24. package/dist/src/context/keys.js.map +1 -1
  25. package/dist/src/context/node.d.ts +2 -2
  26. package/dist/src/context/node.d.ts.map +1 -1
  27. package/dist/src/context/node.js +1 -1
  28. package/dist/src/context/node.js.map +1 -1
  29. package/dist/src/context/provider.d.ts +24 -11
  30. package/dist/src/context/provider.d.ts.map +1 -1
  31. package/dist/src/context/providers/connection.d.ts +2 -2
  32. package/dist/src/context/providers/connection.d.ts.map +1 -1
  33. package/dist/src/context/providers/connection.js +1 -1
  34. package/dist/src/context/providers/connection.js.map +1 -1
  35. package/dist/src/context/providers/sandbox.d.ts +2 -2
  36. package/dist/src/context/providers/sandbox.d.ts.map +1 -1
  37. package/dist/src/context/providers/sandbox.js +2 -2
  38. package/dist/src/context/providers/sandbox.js.map +1 -1
  39. package/dist/src/context/providers/session.d.ts +2 -2
  40. package/dist/src/context/providers/session.d.ts.map +1 -1
  41. package/dist/src/context/providers/session.js +4 -4
  42. package/dist/src/context/providers/session.js.map +1 -1
  43. package/dist/src/context/providers/skill.d.ts +2 -2
  44. package/dist/src/context/providers/skill.d.ts.map +1 -1
  45. package/dist/src/context/providers/skill.js +2 -2
  46. package/dist/src/context/providers/skill.js.map +1 -1
  47. package/dist/src/context/run-step.d.ts +9 -8
  48. package/dist/src/context/run-step.d.ts.map +1 -1
  49. package/dist/src/context/run-step.js +32 -22
  50. package/dist/src/context/run-step.js.map +1 -1
  51. package/dist/src/context/seed-keys.d.ts +7 -7
  52. package/dist/src/context/seed-keys.d.ts.map +1 -1
  53. package/dist/src/context/seed-keys.js +7 -19
  54. package/dist/src/context/seed-keys.js.map +1 -1
  55. package/dist/src/context/serialize.d.ts +10 -9
  56. package/dist/src/context/serialize.d.ts.map +1 -1
  57. package/dist/src/context/serialize.js +18 -30
  58. package/dist/src/context/serialize.js.map +1 -1
  59. package/dist/src/execution/continuous-entry.d.ts +8 -6
  60. package/dist/src/execution/continuous-entry.d.ts.map +1 -1
  61. package/dist/src/execution/continuous-entry.js +27 -25
  62. package/dist/src/execution/continuous-entry.js.map +1 -1
  63. package/dist/src/execution/continuous-runtime.d.ts.map +1 -1
  64. package/dist/src/execution/continuous-runtime.js +1 -4
  65. package/dist/src/execution/continuous-runtime.js.map +1 -1
  66. package/dist/src/execution/node-step.js +1 -0
  67. package/dist/src/execution/node-step.js.map +1 -1
  68. package/dist/src/execution/runtime-context.d.ts +3 -3
  69. package/dist/src/execution/runtime-context.d.ts.map +1 -1
  70. package/dist/src/execution/runtime-context.js +3 -3
  71. package/dist/src/execution/runtime-context.js.map +1 -1
  72. package/dist/src/execution/sandboxes/read-file-tool.js +2 -2
  73. package/dist/src/execution/sandboxes/read-file-tool.js.map +1 -1
  74. package/dist/src/execution/sandboxes/require-sandbox.js +2 -2
  75. package/dist/src/execution/sandboxes/require-sandbox.js.map +1 -1
  76. package/dist/src/execution/sandboxes/write-file-tool.d.ts.map +1 -1
  77. package/dist/src/execution/sandboxes/write-file-tool.js +3 -3
  78. package/dist/src/execution/sandboxes/write-file-tool.js.map +1 -1
  79. package/dist/src/execution/subagent-tool.js +6 -6
  80. package/dist/src/execution/subagent-tool.js.map +1 -1
  81. package/dist/src/execution/tool-compaction.d.ts +3 -1
  82. package/dist/src/execution/tool-compaction.d.ts.map +1 -1
  83. package/dist/src/execution/tool-compaction.js +19 -8
  84. package/dist/src/execution/tool-compaction.js.map +1 -1
  85. package/dist/src/execution/types.d.ts +1 -0
  86. package/dist/src/execution/types.d.ts.map +1 -1
  87. package/dist/src/execution/workflow-entry.d.ts +5 -4
  88. package/dist/src/execution/workflow-entry.d.ts.map +1 -1
  89. package/dist/src/execution/workflow-entry.js +8 -3
  90. package/dist/src/execution/workflow-entry.js.map +1 -1
  91. package/dist/src/execution/workflow-runtime.d.ts.map +1 -1
  92. package/dist/src/execution/workflow-runtime.js +2 -3
  93. package/dist/src/execution/workflow-runtime.js.map +1 -1
  94. package/dist/src/execution/workflow-steps.d.ts +2 -2
  95. package/dist/src/execution/workflow-steps.d.ts.map +1 -1
  96. package/dist/src/execution/workflow-steps.js +42 -17
  97. package/dist/src/execution/workflow-steps.js.map +1 -1
  98. package/dist/src/harness/emission.d.ts +1 -1
  99. package/dist/src/harness/emission.js +3 -3
  100. package/dist/src/harness/emission.js.map +1 -1
  101. package/dist/src/harness/execute-tool.d.ts +1 -0
  102. package/dist/src/harness/execute-tool.d.ts.map +1 -1
  103. package/dist/src/harness/execute-tool.js.map +1 -1
  104. package/dist/src/harness/input-requests.d.ts +2 -22
  105. package/dist/src/harness/input-requests.d.ts.map +1 -1
  106. package/dist/src/harness/input-requests.js +47 -41
  107. package/dist/src/harness/input-requests.js.map +1 -1
  108. package/dist/src/harness/tool-loop.d.ts.map +1 -1
  109. package/dist/src/harness/tool-loop.js +19 -1
  110. package/dist/src/harness/tool-loop.js.map +1 -1
  111. package/dist/src/harness/tools.js +5 -1
  112. package/dist/src/harness/tools.js.map +1 -1
  113. package/dist/src/harness/types.d.ts +3 -15
  114. package/dist/src/harness/types.d.ts.map +1 -1
  115. package/dist/src/harness/types.js +1 -6
  116. package/dist/src/harness/types.js.map +1 -1
  117. package/dist/src/internal/application/package.js +1 -1
  118. package/dist/src/internal/authored-definition/connection.d.ts.map +1 -1
  119. package/dist/src/internal/authored-definition/connection.js +14 -1
  120. package/dist/src/internal/authored-definition/connection.js.map +1 -1
  121. package/dist/src/internal/nitro/routes/runtime-stack.d.ts +3 -3
  122. package/dist/src/internal/nitro/routes/runtime-stack.js +3 -3
  123. package/dist/src/public/channels/slack/index.d.ts +0 -5
  124. package/dist/src/public/channels/slack/index.d.ts.map +1 -1
  125. package/dist/src/public/channels/slack/index.js.map +1 -1
  126. package/dist/src/public/definitions/connections/mcp.d.ts +13 -0
  127. package/dist/src/public/definitions/connections/mcp.d.ts.map +1 -1
  128. package/dist/src/public/definitions/connections/mcp.js.map +1 -1
  129. package/dist/src/public/definitions/tool.d.ts +10 -6
  130. package/dist/src/public/definitions/tool.d.ts.map +1 -1
  131. package/dist/src/public/definitions/tool.js.map +1 -1
  132. package/dist/src/public/index.d.ts +2 -1
  133. package/dist/src/public/index.d.ts.map +1 -1
  134. package/dist/src/public/index.js +1 -1
  135. package/dist/src/public/index.js.map +1 -1
  136. package/dist/src/public/tools/defaults.d.ts +4 -4
  137. package/dist/src/public/tools/defaults.js +4 -4
  138. package/dist/src/runtime/connections/registry.d.ts +6 -0
  139. package/dist/src/runtime/connections/registry.d.ts.map +1 -1
  140. package/dist/src/runtime/connections/registry.js +8 -0
  141. package/dist/src/runtime/connections/registry.js.map +1 -1
  142. package/dist/src/runtime/connections/types.d.ts +2 -0
  143. package/dist/src/runtime/connections/types.d.ts.map +1 -1
  144. package/dist/src/runtime/framework-tools/connection-execute.d.ts.map +1 -1
  145. package/dist/src/runtime/framework-tools/connection-execute.js +17 -6
  146. package/dist/src/runtime/framework-tools/connection-execute.js.map +1 -1
  147. package/dist/src/runtime/framework-tools/connection-search.d.ts +2 -2
  148. package/dist/src/runtime/framework-tools/connection-search.d.ts.map +1 -1
  149. package/dist/src/runtime/framework-tools/connection-search.js +4 -4
  150. package/dist/src/runtime/framework-tools/connection-search.js.map +1 -1
  151. package/dist/src/runtime/framework-tools/file-state.d.ts +5 -7
  152. package/dist/src/runtime/framework-tools/file-state.d.ts.map +1 -1
  153. package/dist/src/runtime/framework-tools/file-state.js +4 -6
  154. package/dist/src/runtime/framework-tools/file-state.js.map +1 -1
  155. package/dist/src/runtime/framework-tools/skill.js +3 -3
  156. package/dist/src/runtime/framework-tools/skill.js.map +1 -1
  157. package/dist/src/runtime/framework-tools/todo.js +3 -3
  158. package/dist/src/runtime/framework-tools/todo.js.map +1 -1
  159. package/dist/src/runtime/prompt/connections.d.ts.map +1 -1
  160. package/dist/src/runtime/prompt/connections.js +3 -2
  161. package/dist/src/runtime/prompt/connections.js.map +1 -1
  162. package/dist/src/runtime/resolve-agent-graph.js +3 -2
  163. package/dist/src/runtime/resolve-agent-graph.js.map +1 -1
  164. package/dist/src/runtime/resolve-connection.d.ts.map +1 -1
  165. package/dist/src/runtime/resolve-connection.js +3 -0
  166. package/dist/src/runtime/resolve-connection.js.map +1 -1
  167. package/dist/src/runtime/sessions/auth.d.ts +1 -1
  168. package/dist/src/runtime/types.d.ts +13 -0
  169. package/dist/src/runtime/types.d.ts.map +1 -1
  170. package/docs/internals/context.md +257 -81
  171. package/docs/public/README.md +17 -19
  172. package/docs/public/channels/README.md +9 -3
  173. package/docs/public/session-context.md +95 -49
  174. package/docs/public/tools.md +25 -17
  175. package/docs/public/typescript-api.md +2 -6
  176. package/package.json +1 -1
  177. package/dist/src/context/durable-context.d.ts +0 -18
  178. package/dist/src/context/durable-context.d.ts.map +0 -1
  179. package/dist/src/context/durable-context.js +0 -49
  180. package/dist/src/context/durable-context.js.map +0 -1
  181. package/dist/src/execution/step-context.d.ts +0 -27
  182. package/dist/src/execution/step-context.d.ts.map +0 -1
  183. package/dist/src/execution/step-context.js +0 -54
  184. package/dist/src/execution/step-context.js.map +0 -1
  185. package/docs/public/migration-guide.md +0 -71
@@ -1 +1 @@
1
- {"version":3,"file":"sandbox.d.ts","sourceRoot":"","sources":["../../../../src/context/providers/sandbox.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AAIxE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEtD,eAAO,MAAM,eAAe,EAAE,eAAe,CAAC,aAAa,CA4B1D,CAAC"}
1
+ {"version":3,"file":"sandbox.d.ts","sourceRoot":"","sources":["../../../../src/context/providers/sandbox.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AAIxE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAE/D,eAAO,MAAM,eAAe,EAAE,wBAAwB,CAAC,aAAa,CA4BnE,CAAC"}
@@ -5,7 +5,7 @@ import { getActiveRuntimeNode } from "../node.js";
5
5
  export const sandboxProvider = {
6
6
  key: SandboxKey,
7
7
  async create(ctx, session) {
8
- const bundle = ctx.tryGet(BundleKey);
8
+ const bundle = ctx.get(BundleKey);
9
9
  if (bundle === undefined)
10
10
  return undefined;
11
11
  const registry = getActiveRuntimeNode(ctx).sandboxRegistry;
@@ -18,7 +18,7 @@ export const sandboxProvider = {
18
18
  compiledArtifactsSource: bundle.compiledArtifactsSource,
19
19
  defaultSandboxSkillSeedFiles: skillSeedFiles.length > 0 ? skillSeedFiles : undefined,
20
20
  registry,
21
- sessionId: ctx.get(SessionIdKey),
21
+ sessionId: ctx.require(SessionIdKey),
22
22
  state: session.sandboxState ?? null,
23
23
  }),
24
24
  };
@@ -1 +1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AK,GAAG,MAAM,MAAM,CAAC,YAAY,EAAE,CAAC;QAC1C,OAAO,EAAE,GAAG,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC;IAC7C,CAAC;CACF,CAAC"}
@@ -1,4 +1,4 @@
1
1
  import { type Session } from "../keys.js";
2
- import type { ContextProvider } from "../provider.js";
3
- export declare const sessionProvider: ContextProvider<Session>;
2
+ import type { FrameworkContextProvider } from "../provider.js";
3
+ export declare const sessionProvider: FrameworkContextProvider<Session>;
4
4
  //# sourceMappingURL=session.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../../src/context/providers/session.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,OAAO,EAGb,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEtD,eAAO,MAAM,eAAe,EAAE,eAAe,CAAC,OAAO,CAiBpD,CAAC"}
1
+ {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../../src/context/providers/session.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,OAAO,EAGb,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAE/D,eAAO,MAAM,eAAe,EAAE,wBAAwB,CAAC,OAAO,CAiB7D,CAAC"}
@@ -2,15 +2,15 @@ import { AuthKey, InitiatorAuthKey, ParentSessionKey, SessionIdKey, SessionKey,
2
2
  export const sessionProvider = {
3
3
  key: SessionKey,
4
4
  create(ctx) {
5
- const currentAuth = ctx.get(AuthKey);
5
+ const currentAuth = ctx.require(AuthKey);
6
6
  return {
7
7
  value: Object.freeze({
8
8
  auth: {
9
9
  current: currentAuth,
10
- initiator: ctx.tryGet(InitiatorAuthKey) ?? currentAuth,
10
+ initiator: ctx.get(InitiatorAuthKey) ?? currentAuth,
11
11
  },
12
- parent: ctx.tryGet(ParentSessionKey),
13
- sessionId: ctx.get(SessionIdKey),
12
+ parent: ctx.get(ParentSessionKey),
13
+ sessionId: ctx.require(SessionIdKey),
14
14
  turn: { id: `turn-${crypto.randomUUID()}`, sequence: 0 },
15
15
  }),
16
16
  };
@@ -1 +1 @@
1
- {"version":3,"file":"session.js","sourceRoot":"","sources":["../../../../src/context/providers/session.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,gBAAgB,EAChB,gBAAgB,EAEhB,YAAY,EACZ,UAAU,GACX,MAAM,YAAY,CAAC;AAGpB,MAAM,CAAC,MAAM,eAAe,GAA6B;IACvD,GAAG,EAAE,UAAU;IACf,MAAM,CAAC,GAAG;QACR,MAAM,WAAW,GAAG,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAErC,OAAO;YACL,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC;gBACnB,IAAI,EAAE;oBACJ,OAAO,EAAE,WAAW;oBACpB,SAAS,EAAE,GAAG,CAAC,MAAM,CAAC,gBAAgB,CAAC,IAAI,WAAW;iBACvD;gBACD,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,gBAAgB,CAAC;gBACpC,SAAS,EAAE,GAAG,CAAC,GAAG,CAAC,YAAY,CAAC;gBAChC,IAAI,EAAE,EAAE,EAAE,EAAE,QAAQ,MAAM,CAAC,UAAU,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE;aACzD,CAAC;SACH,CAAC;IACJ,CAAC;CACF,CAAC"}
1
+ {"version":3,"file":"session.js","sourceRoot":"","sources":["../../../../src/context/providers/session.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,gBAAgB,EAChB,gBAAgB,EAEhB,YAAY,EACZ,UAAU,GACX,MAAM,YAAY,CAAC;AAGpB,MAAM,CAAC,MAAM,eAAe,GAAsC;IAChE,GAAG,EAAE,UAAU;IACf,MAAM,CAAC,GAAG;QACR,MAAM,WAAW,GAAG,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAEzC,OAAO;YACL,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC;gBACnB,IAAI,EAAE;oBACJ,OAAO,EAAE,WAAW;oBACpB,SAAS,EAAE,GAAG,CAAC,GAAG,CAAC,gBAAgB,CAAC,IAAI,WAAW;iBACpD;gBACD,MAAM,EAAE,GAAG,CAAC,GAAG,CAAC,gBAAgB,CAAC;gBACjC,SAAS,EAAE,GAAG,CAAC,OAAO,CAAC,YAAY,CAAC;gBACpC,IAAI,EAAE,EAAE,EAAE,EAAE,QAAQ,MAAM,CAAC,UAAU,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE;aACzD,CAAC;SACH,CAAC;IACJ,CAAC;CACF,CAAC"}
@@ -1,4 +1,4 @@
1
1
  import type { SkillAccess } from "../../execution/skills/types.js";
2
- import type { ContextProvider } from "../provider.js";
3
- export declare const skillProvider: ContextProvider<SkillAccess>;
2
+ import type { FrameworkContextProvider } from "../provider.js";
3
+ export declare const skillProvider: FrameworkContextProvider<SkillAccess>;
4
4
  //# sourceMappingURL=skill.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"skill.d.ts","sourceRoot":"","sources":["../../../../src/context/providers/skill.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAInE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEtD,eAAO,MAAM,aAAa,EAAE,eAAe,CAAC,WAAW,CActD,CAAC"}
1
+ {"version":3,"file":"skill.d.ts","sourceRoot":"","sources":["../../../../src/context/providers/skill.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAInE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAE/D,eAAO,MAAM,aAAa,EAAE,wBAAwB,CAAC,WAAW,CAc/D,CAAC"}
@@ -5,13 +5,13 @@ import { getActiveRuntimeNode } from "../node.js";
5
5
  export const skillProvider = {
6
6
  key: SkillKey,
7
7
  create(ctx, _session) {
8
- const bundle = ctx.tryGet(BundleKey);
8
+ const bundle = ctx.get(BundleKey);
9
9
  if (bundle === undefined)
10
10
  return undefined;
11
11
  const skills = getActiveRuntimeNode(ctx).turnAgent.skills;
12
12
  if (skills.length === 0)
13
13
  return undefined;
14
- const skillState = ctx.tryGet(SkillStateKey);
14
+ const skillState = ctx.get(SkillStateKey);
15
15
  const activeSkillIds = skillState?.activeIds ?? [];
16
16
  return { value: createSkillAccess({ activeSkillIds, skills }) };
17
17
  },
@@ -1 +1 @@
1
- {"version":3,"file":"skill.js","sourceRoot":"","sources":["../../../../src/context/providers/skill.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAErE,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAGlD,MAAM,CAAC,MAAM,aAAa,GAAiC;IACzD,GAAG,EAAE,QAAQ;IAEb,MAAM,CAAC,GAAG,EAAE,QAAQ;QAClB,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QACrC,IAAI,MAAM,KAAK,SAAS;YAAE,OAAO,SAAS,CAAC;QAC3C,MAAM,MAAM,GAAG,oBAAoB,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC;QAC1D,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,SAAS,CAAC;QAE1C,MAAM,UAAU,GAAG,GAAG,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;QAC7C,MAAM,cAAc,GAAG,UAAU,EAAE,SAAS,IAAI,EAAE,CAAC;QAEnD,OAAO,EAAE,KAAK,EAAE,iBAAiB,CAAC,EAAE,cAAc,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;IAClE,CAAC;CACF,CAAC"}
1
+ {"version":3,"file":"skill.js","sourceRoot":"","sources":["../../../../src/context/providers/skill.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAErE,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAGlD,MAAM,CAAC,MAAM,aAAa,GAA0C;IAClE,GAAG,EAAE,QAAQ;IAEb,MAAM,CAAC,GAAG,EAAE,QAAQ;QAClB,MAAM,MAAM,GAAG,GAAG,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QAClC,IAAI,MAAM,KAAK,SAAS;YAAE,OAAO,SAAS,CAAC;QAC3C,MAAM,MAAM,GAAG,oBAAoB,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC;QAC1D,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,SAAS,CAAC;QAE1C,MAAM,UAAU,GAAG,GAAG,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;QAC1C,MAAM,cAAc,GAAG,UAAU,EAAE,SAAS,IAAI,EAAE,CAAC;QAEnD,OAAO,EAAE,KAAK,EAAE,iBAAiB,CAAC,EAAE,cAAc,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;IAClE,CAAC;CACF,CAAC"}
@@ -1,14 +1,15 @@
1
1
  import type { HarnessSession, StepResult } from "../harness/types.js";
2
- import { type AshContext } from "./container.js";
2
+ import { type ContextContainer } from "./container.js";
3
3
  /**
4
4
  * Runs one step inside the unified context.
5
5
  *
6
- * 1. Iterates framework providers in order — each may populate its runtime
7
- * key on `ctx` and optionally modify the harness session.
8
- * 2. Runs `callback` inside the ALS scope so authored code can read context.
9
- * 3. After the step, runs each provider's `commit` hook to persist mutable
10
- * runtime state back onto the session.
11
- * 4. Commits the full durable context bag back to `session.context`.
6
+ * 1. Clears all previous step-local provider values.
7
+ * 2. Builds framework virtual providers in dependency order.
8
+ * 3. Builds any channel-scoped public providers declared on the active
9
+ * channel class.
10
+ * 4. Runs `callback` inside the ALS scope so authored code can read context.
11
+ * 5. After the step, runs framework provider commit hooks to persist
12
+ * provider-owned session data (for example sandbox snapshots).
12
13
  */
13
- export declare function runStep(ctx: AshContext, harnessSession: HarnessSession, callback: (session: HarnessSession) => Promise<StepResult>): Promise<StepResult>;
14
+ export declare function runStep(ctx: ContextContainer, harnessSession: HarnessSession, callback: (session: HarnessSession) => Promise<StepResult>): Promise<StepResult>;
14
15
  //# sourceMappingURL=run-step.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"run-step.d.ts","sourceRoot":"","sources":["../../../src/context/run-step.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAAE,KAAK,UAAU,EAAkB,MAAM,gBAAgB,CAAC;AAsBjE;;;;;;;;;GASG;AACH,wBAAsB,OAAO,CAC3B,GAAG,EAAE,UAAU,EACf,cAAc,EAAE,cAAc,EAC9B,QAAQ,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,OAAO,CAAC,UAAU,CAAC,GACzD,OAAO,CAAC,UAAU,CAAC,CAiCrB"}
1
+ {"version":3,"file":"run-step.d.ts","sourceRoot":"","sources":["../../../src/context/run-step.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAAE,KAAK,gBAAgB,EAAkB,MAAM,gBAAgB,CAAC;AAsBvE;;;;;;;;;;GAUG;AACH,wBAAsB,OAAO,CAC3B,GAAG,EAAE,gBAAgB,EACrB,cAAc,EAAE,cAAc,EAC9B,QAAQ,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,OAAO,CAAC,UAAU,CAAC,GACzD,OAAO,CAAC,UAAU,CAAC,CA2CrB"}
@@ -1,5 +1,6 @@
1
+ import { getChannelClassContextProviders } from "../channel/types.js";
1
2
  import { contextStorage } from "./container.js";
2
- import { commitDurableContext } from "./durable-context.js";
3
+ import { ChannelKey } from "./keys.js";
3
4
  import { connectionProvider } from "./providers/connection.js";
4
5
  import { sandboxProvider } from "./providers/sandbox.js";
5
6
  import { sessionProvider } from "./providers/session.js";
@@ -7,11 +8,11 @@ import { skillProvider } from "./providers/skill.js";
7
8
  /**
8
9
  * Framework providers in dependency order.
9
10
  *
10
- * Session runs first (depends only on seed keys). Sandbox and skill depend on
11
- * `BundleKey` (a seed) and optionally `SessionKey`.
11
+ * Session runs first (depends only on durable seed values). Later providers
12
+ * may read framework-derived virtual values through the unified context view.
12
13
  */
13
- // biome-ignore lint/suspicious/noExplicitAny: heterogeneous provider collection
14
- const providers = [
14
+ // biome-ignore lint/suspicious/noExplicitAny: heterogeneous provider collection requires type erasure
15
+ const frameworkProviders = [
15
16
  sessionProvider,
16
17
  connectionProvider,
17
18
  sandboxProvider,
@@ -20,36 +21,45 @@ const providers = [
20
21
  /**
21
22
  * Runs one step inside the unified context.
22
23
  *
23
- * 1. Iterates framework providers in order — each may populate its runtime
24
- * key on `ctx` and optionally modify the harness session.
25
- * 2. Runs `callback` inside the ALS scope so authored code can read context.
26
- * 3. After the step, runs each provider's `commit` hook to persist mutable
27
- * runtime state back onto the session.
28
- * 4. Commits the full durable context bag back to `session.context`.
24
+ * 1. Clears all previous step-local provider values.
25
+ * 2. Builds framework virtual providers in dependency order.
26
+ * 3. Builds any channel-scoped public providers declared on the active
27
+ * channel class.
28
+ * 4. Runs `callback` inside the ALS scope so authored code can read context.
29
+ * 5. After the step, runs framework provider commit hooks to persist
30
+ * provider-owned session data (for example sandbox snapshots).
29
31
  */
30
32
  export async function runStep(ctx, harnessSession, callback) {
31
33
  let session = harnessSession;
32
- // 1. Run providers
33
- for (const p of providers) {
34
- const result = await p.create(ctx, session);
34
+ ctx.clearVirtualContext();
35
+ // 1. Build framework providers
36
+ for (const provider of frameworkProviders) {
37
+ const result = await provider.create(ctx, session);
35
38
  if (result !== undefined) {
36
- ctx.set(p.key, result.value);
39
+ ctx.setVirtualContext(provider.key, result.value);
37
40
  if (result.session !== undefined) {
38
41
  session = result.session;
39
42
  }
40
43
  }
41
44
  }
42
- // 2. Run callback inside ALS scope
45
+ // 2. Build channel-scoped providers
46
+ const channel = ctx.require(ChannelKey);
47
+ const channelProviders = getChannelClassContextProviders(channel.constructor);
48
+ for (const provider of channelProviders) {
49
+ const value = await provider.create(ctx);
50
+ if (value !== undefined) {
51
+ ctx.setVirtualContext(provider.key, value);
52
+ }
53
+ }
54
+ // 3. Run callback inside ALS scope
43
55
  const stepResult = await contextStorage.run(ctx, () => callback(session));
44
- // 3. Commit providers
56
+ // 4. Commit framework providers
45
57
  let committed = stepResult.session;
46
- for (const p of providers) {
47
- if (p.commit && ctx.has(p.key)) {
48
- committed = await p.commit(ctx.get(p.key), committed);
58
+ for (const provider of frameworkProviders) {
59
+ if (provider.commit && ctx.has(provider.key)) {
60
+ committed = await provider.commit(ctx.require(provider.key), committed);
49
61
  }
50
62
  }
51
- // 4. Commit durable context
52
- committed = commitDurableContext(ctx, committed);
53
63
  if (committed === stepResult.session) {
54
64
  return stepResult;
55
65
  }
@@ -1 +1 @@
1
- {"version":3,"file":"run-step.js","sourceRoot":"","sources":["../../../src/context/run-step.ts"],"names":[],"mappings":"AACA,OAAO,EAAmB,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAE5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,sBA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*/
12
12
  import type { SessionAuthContext, SessionParent } from "../channel/types.js";
13
13
  import type { RunMode } from "../run-mode.js";
14
- import { RuntimeContextKey } from "./key.js";
15
- export declare const AuthKey: RuntimeContextKey<SessionAuthContext | null>;
16
- export declare const InitiatorAuthKey: RuntimeContextKey<SessionAuthContext | null>;
17
- export declare const SessionIdKey: RuntimeContextKey<string>;
18
- export declare const ContinuationTokenKey: RuntimeContextKey<string>;
19
- export declare const ModeKey: RuntimeContextKey<RunMode>;
20
- export declare const ParentSessionKey: RuntimeContextKey<SessionParent>;
14
+ import { ContextKey } from "./key.js";
15
+ export declare const AuthKey: ContextKey<SessionAuthContext | null>;
16
+ export declare const InitiatorAuthKey: ContextKey<SessionAuthContext | null>;
17
+ export declare const SessionIdKey: ContextKey<string>;
18
+ export declare const ContinuationTokenKey: ContextKey<string>;
19
+ export declare const ModeKey: ContextKey<RunMode>;
20
+ export declare const ParentSessionKey: ContextKey<SessionParent>;
21
21
  //# sourceMappingURL=seed-keys.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"seed-keys.d.ts","sourceRoot":"","sources":["../../../src/context/seed-keys.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAC7E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAE7C,eAAO,MAAM,OAAO,8CAElB,CAAC;AACH,eAAO,MAAM,gBAAgB,8CAK5B,CAAC;AACF,eAAO,MAAM,YAAY,2BAEvB,CAAC;AACH,eAAO,MAAM,oBAAoB,2BAE/B,CAAC;AACH,eAAO,MAAM,OAAO,4BAElB,CAAC;AACH,eAAO,MAAM,gBAAgB,kCAE3B,CAAC"}
1
+ {"version":3,"file":"seed-keys.d.ts","sourceRoot":"","sources":["../../../src/context/seed-keys.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAC7E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,eAAO,MAAM,OAAO,uCAAwD,CAAC;AAC7E,eAAO,MAAM,gBAAgB,uCAAiE,CAAC;AAC/F,eAAO,MAAM,YAAY,oBAA0C,CAAC;AACpE,eAAO,MAAM,oBAAoB,oBAAkD,CAAC;AACpF,eAAO,MAAM,OAAO,qBAAsC,CAAC;AAC3D,eAAO,MAAM,gBAAgB,2BAAqD,CAAC"}
@@ -9,23 +9,11 @@
9
9
  * ({@link import("./keys.js").SessionKey SessionKey}, etc.) live in
10
10
  * `context/keys.ts` which re-exports everything from this module.
11
11
  */
12
- import { RuntimeContextKey } from "./key.js";
13
- export const AuthKey = new RuntimeContextKey("ash.auth", {
14
- serializable: true,
15
- });
16
- export const InitiatorAuthKey = new RuntimeContextKey("ash.initiatorAuth", {
17
- serializable: true,
18
- });
19
- export const SessionIdKey = new RuntimeContextKey("ash.sessionId", {
20
- serializable: true,
21
- });
22
- export const ContinuationTokenKey = new RuntimeContextKey("ash.continuationToken", {
23
- serializable: true,
24
- });
25
- export const ModeKey = new RuntimeContextKey("ash.mode", {
26
- serializable: true,
27
- });
28
- export const ParentSessionKey = new RuntimeContextKey("ash.parentSession", {
29
- serializable: true,
30
- });
12
+ import { ContextKey } from "./key.js";
13
+ export const AuthKey = new ContextKey("ash.auth");
14
+ export const InitiatorAuthKey = new ContextKey("ash.initiatorAuth");
15
+ export const SessionIdKey = new ContextKey("ash.sessionId");
16
+ export const ContinuationTokenKey = new ContextKey("ash.continuationToken");
17
+ export const ModeKey = new ContextKey("ash.mode");
18
+ export const ParentSessionKey = new ContextKey("ash.parentSession");
31
19
  //# sourceMappingURL=seed-keys.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"seed-keys.js","sourceRoot":"","sources":["../../../src/context/seed-keys.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAE7C,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,iBAAiB,CAA4B,UAAU,EAAE;IAClF,YAAY,EAAE,IAAI;CACnB,CAAC,CAAC;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,iBAAiB,CACnD,mBAAmB,EACnB;IACE,YAAY,EAAE,IAAI;CACnB,CACF,CAAC;AACF,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,iBAAiB,CAAS,eAAe,EAAE;IACzE,YAAY,EAAE,IAAI;CACnB,CAAC,CAAC;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,iBAAiB,CAAS,uBAAuB,EAAE;IACzF,YAAY,EAAE,IAAI;CACnB,CAAC,CAAC;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,iBAAiB,CAAU,UAAU,EAAE;IAChE,YAAY,EAAE,IAAI;CACnB,CAAC,CAAC;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,iBAAiB,CAAgB,mBAAmB,EAAE;IACxF,YAAY,EAAE,IAAI;CACnB,CAAC,CAAC"}
1
+ {"version":3,"file":"seed-keys.js","sourceRoot":"","sources":["../../../src/context/seed-keys.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,UAAU,CAA4B,UAAU,CAAC,CAAC;AAC7E,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,UAAU,CAA4B,mBAAmB,CAAC,CAAC;AAC/F,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,UAAU,CAAS,eAAe,CAAC,CAAC;AACpE,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,UAAU,CAAS,uBAAuB,CAAC,CAAC;AACpF,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,UAAU,CAAU,UAAU,CAAC,CAAC;AAC3D,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,UAAU,CAAgB,mBAAmB,CAAC,CAAC"}
@@ -1,15 +1,16 @@
1
- import { type AshContext } from "./container.js";
1
+ import { type AshContext, ContextContainer } from "./container.js";
2
2
  /**
3
- * Serializes all runtime seed values that must cross durable workflow
4
- * boundaries.
3
+ * Serializes every value in the context to a plain JSON record.
4
+ *
5
+ * Keys with a codec are run through `codec.serialize`; keys without one
6
+ * are stored as-is (they must already be JSON-safe).
5
7
  */
6
- export declare function serializeRuntimeContext(ctx: AshContext): Record<string, unknown>;
8
+ export declare function serializeContext(ctx: AshContext): Record<string, unknown>;
7
9
  /**
8
- * Deserializes runtime seed values into a fresh context container.
10
+ * Deserializes a plain JSON record into a fresh context container.
9
11
  *
10
- * `ash.bundle` must be restored before keys whose codecs depend on the
11
- * compiled runtime bundle, such as `ash.channel`.
12
+ * Each entry is matched to a registered {@link ContextKey} by name.
13
+ * Unknown entries (no registered key) are silently dropped.
12
14
  */
13
- export declare function deserializeRuntimeContext(data: Record<string, unknown>): Promise<AshContext>;
14
- export declare function assertNoDurableContextInRuntimeSeed(ctx: AshContext): void;
15
+ export declare function deserializeContext(data: Record<string, unknown>): Promise<ContextContainer>;
15
16
  //# sourceMappingURL=serialize.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"serialize.d.ts","sourceRoot":"","sources":["../../../src/context/serialize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAkB,MAAM,gBAAgB,CAAC;AAQjE;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAiBhF;AAED;;;;;GAKG;AACH,wBAAsB,yBAAyB,CAC7C,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,OAAO,CAAC,UAAU,CAAC,CA0BrB;AAED,wBAAgB,mCAAmC,CAAC,GAAG,EAAE,UAAU,GAAG,IAAI,CAQzE"}
1
+ {"version":3,"file":"serialize.d.ts","sourceRoot":"","sources":["../../../src/context/serialize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAInE;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAMzE;AAED;;;;;GAKG;AACH,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAqBjG"}
@@ -1,32 +1,27 @@
1
- import { AshContextImpl } from "./container.js";
2
- import { getSerializableRuntimeContextKeys, isRuntimeContextKey, resolveRuntimeContextKey, } from "./key.js";
1
+ import { ContextContainer } from "./container.js";
2
+ import { resolveKey } from "./key.js";
3
3
  import { BundleKey } from "./keys.js";
4
4
  /**
5
- * Serializes all runtime seed values that must cross durable workflow
6
- * boundaries.
5
+ * Serializes every value in the context to a plain JSON record.
6
+ *
7
+ * Keys with a codec are run through `codec.serialize`; keys without one
8
+ * are stored as-is (they must already be JSON-safe).
7
9
  */
8
- export function serializeRuntimeContext(ctx) {
10
+ export function serializeContext(ctx) {
9
11
  const data = {};
10
- for (const key of getSerializableRuntimeContextKeys()) {
11
- if (!ctx.has(key)) {
12
- continue;
13
- }
14
- const value = ctx.get(key);
15
- if (value === undefined) {
16
- continue;
17
- }
12
+ for (const [key, value] of ctx.entries()) {
18
13
  data[key.name] = key.codec ? key.codec.serialize(value) : value;
19
14
  }
20
15
  return data;
21
16
  }
22
17
  /**
23
- * Deserializes runtime seed values into a fresh context container.
18
+ * Deserializes a plain JSON record into a fresh context container.
24
19
  *
25
- * `ash.bundle` must be restored before keys whose codecs depend on the
26
- * compiled runtime bundle, such as `ash.channel`.
20
+ * Each entry is matched to a registered {@link ContextKey} by name.
21
+ * Unknown entries (no registered key) are silently dropped.
27
22
  */
28
- export async function deserializeRuntimeContext(data) {
29
- const ctx = new AshContextImpl();
23
+ export async function deserializeContext(data) {
24
+ const ctx = new ContextContainer();
30
25
  const serializedBundle = data[BundleKey.name];
31
26
  if (serializedBundle !== undefined) {
32
27
  const codec = BundleKey.codec;
@@ -36,22 +31,15 @@ export async function deserializeRuntimeContext(data) {
36
31
  ctx.set(BundleKey, await codec.deserialize(serializedBundle, ctx));
37
32
  }
38
33
  for (const [name, raw] of Object.entries(data)) {
39
- if (raw === undefined || name === BundleKey.name) {
34
+ if (raw === undefined)
40
35
  continue;
41
- }
42
- const key = resolveRuntimeContextKey(name);
43
- if (key === undefined) {
36
+ if (name === BundleKey.name)
44
37
  continue;
38
+ const key = resolveKey(name);
39
+ if (key !== undefined) {
40
+ ctx.set(key, key.codec ? await key.codec.deserialize(raw, ctx) : raw);
45
41
  }
46
- ctx.set(key, key.codec ? await key.codec.deserialize(raw, ctx) : raw);
47
42
  }
48
43
  return ctx;
49
44
  }
50
- export function assertNoDurableContextInRuntimeSeed(ctx) {
51
- for (const [key] of ctx.entries()) {
52
- if (!isRuntimeContextKey(key)) {
53
- throw new Error(`Durable context key "${key.name}" leaked into runtime seed serialization. Durable context must live on session.context, not the serialized runtime seed.`);
54
- }
55
- }
56
- }
57
45
  //# sourceMappingURL=serialize.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"serialize.js","sourceRoot":"","sources":["../../../src/context/serialize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,EACL,iCAAiC,EACjC,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC;;;GAGG;AACH,MAAM,UAAU,u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;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,IAA6B;IACpE,MAAM,GAAG,GAAG,IAAI,gBAAgB,EAAE,CAAC;IAEnC,MAAM,gBAAgB,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAC9C,IAAI,gBAAgB,KAAK,SAAS,EAAE,CAAC;QACnC,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC;QAC9B,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;QAClE,CAAC;QACD,GAAG,CAAC,GAAG,CAAC,SAAS,EAAE,MAAM,KAAK,CAAC,WAAW,CAAC,gBAAgB,EAAE,GAAG,CAAC,CAAC,CAAC;IACrE,CAAC;IAED,KAAK,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QAC/C,IAAI,GAAG,KAAK,SAAS;YAAE,SAAS;QAChC,IAAI,IAAI,KAAK,SAAS,CAAC,IAAI;YAAE,SAAS;QACtC,MAAM,GAAG,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;QAC7B,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;YACtB,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QACxE,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import type { DeliverPayload, SessionAuthContext } from "../channel/types.js";
2
- import { type HarnessEmitFn } from "../harness/types.js";
2
+ import { type ContextContainer } from "../context/container.js";
3
+ import type { HarnessEmitFn } from "../harness/types.js";
3
4
  import { type CreateRuntime } from "./node-step.js";
4
5
  /**
5
6
  * One item in the continuous runtime's in-memory delivery queue.
@@ -15,10 +16,11 @@ export interface QueueItem {
15
16
  * Input for the continuous (non-durable) entry.
16
17
  *
17
18
  * The caller — the continuous runtime — provides the durability shell:
18
- * one serialized runtime seed context, a composed `emit` function backed by
19
- * the event stream, the initial user message, the inbound message queue, a
20
- * `park` function, and a `createRuntime` factory so the subagent tool wrapper
21
- * can start delegated child runs on the same runtime flavor.
19
+ * the pre-seeded {@link AshContext}, a composed `emit` function backed
20
+ * by the event stream, the initial user message, the inbound message
21
+ * queue, a `park` function, and a `createRuntime` factory so the
22
+ * subagent tool wrapper can start delegated child runs on the same
23
+ * runtime flavor.
22
24
  *
23
25
  * Everything else (session construction, node step wiring, provider
24
26
  * lifecycle, the turn loop) is owned by this module, mirroring how
@@ -27,13 +29,13 @@ export interface QueueItem {
27
29
  */
28
30
  export interface ContinuousEntryInput {
29
31
  readonly createRuntime: CreateRuntime;
32
+ readonly ctx: ContextContainer;
30
33
  readonly emit: HarnessEmitFn;
31
34
  readonly input: {
32
35
  readonly message: string;
33
36
  };
34
37
  readonly park: () => Promise<void>;
35
38
  readonly queue: QueueItem[];
36
- readonly serializedRuntimeContext: Record<string, unknown>;
37
39
  }
38
40
  /**
39
41
  * Result returned when the continuous entry completes. The continuous
@@ -1 +1 @@
1
- {"version":3,"file":"continuous-entry.d.ts","sourceRoot":"","sources":["../../../src/execution/continuous-entry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAI9E,OAAO,EACL,KAAK,aAAa,EAInB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,KAAK,aAAa,EAA2B,MAAM,gBAAgB,CAAC;AAS7E;;;;;GAKG;AACH,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,IAAI,CAAC,EAAE,kBAAkB,GAAG,IAAI,CAAC;IAC1C,Q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MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAC;IACtC,QAAQ,CAAC,GAAG,EAAE,gBAAgB,CAAC;IAC/B,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE;QAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAC7C,QAAQ,CAAC,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC,QAAQ,CAAC,KAAK,EAAE,SAAS,EAAE,CAAC;CAC7B;AAED;;;;;GAKG;AACH,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;CAC9B;AAED;;;;;;;;GAQG;AACH,wBAAsB,eAAe,CAAC,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CA0FjG"}
@@ -1,10 +1,9 @@
1
- import { BundleKey, ContinuationTokenKey, ModeKey, SessionIdKey } from "../context/keys.js";
2
- import { deserializeRuntimeContext } from "../context/serialize.js";
1
+ import { toContextAccessor } from "../context/container.js";
2
+ import { AuthKey, BundleKey, ChannelKey, ContinuationTokenKey, ModeKey, SessionIdKey, } from "../context/keys.js";
3
+ import { runStep } from "../context/run-step.js";
3
4
  import { coalesceTurnInputs } from "../harness/messages.js";
4
- import { isStepDone, } from "../harness/types.js";
5
5
  import { createExecutionNodeStep } from "./node-step.js";
6
6
  import { createSession } from "./session.js";
7
- import { prepareStepContext, runStepWithChannelGuard } from "./step-context.js";
8
7
  import { createTaskModeWaitError } from "./task-mode.js";
9
8
  /**
10
9
  * Main body of a continuous (in-memory) run.
@@ -16,18 +15,18 @@ import { createTaskModeWaitError } from "./task-mode.js";
16
15
  * on the queue and coalesce follow-up messages before the next turn.
17
16
  */
18
17
  export async function continuousEntry(input) {
19
- const { createRuntime, emit, input: entryInput, park, queue, serializedRuntimeContext } = input;
20
- const seedCtx = await deserializeRuntimeContext(serializedRuntimeContext);
21
- const bundle = seedCtx.get(BundleKey);
22
- const mode = seedCtx.get(ModeKey);
18
+ const { createRuntime, ctx, emit, input: entryInput, park, queue } = input;
19
+ const bundle = ctx.require(BundleKey);
20
+ const mode = ctx.require(ModeKey);
23
21
  const session = createSession({
24
22
  compactionOverrides: {
25
23
  thresholdPercent: bundle.resolvedAgent.config.compaction?.thresholdPercent,
26
24
  },
27
- continuationToken: seedCtx.get(ContinuationTokenKey),
28
- sessionId: seedCtx.get(SessionIdKey),
25
+ continuationToken: ctx.require(ContinuationTokenKey),
26
+ sessionId: ctx.require(SessionIdKey),
29
27
  turnAgent: bundle.turnAgent,
30
28
  });
29
+ const channel = ctx.require(ChannelKey);
31
30
  const rawStep = createExecutionNodeStep({
32
31
  compiledArtifactsSource: bundle.compiledArtifactsSource,
33
32
  createRuntime,
@@ -36,18 +35,25 @@ export async function continuousEntry(input) {
36
35
  node: bundle.graph.root,
37
36
  });
38
37
  /**
39
- * Wraps a raw step with context provider lifecycle. When a
38
+ * Wraps the raw step with context provider lifecycle. When a
40
39
  * {@link QueueItem} carries deliver-time auth, it is applied to the
41
40
  * in-memory context before the channel's onDeliver hook runs.
41
+ * onDeliver sets custom context and transforms the payload.
42
42
  */
43
43
  const deliverStep = (item) => {
44
- return async (stepSession) => {
45
- const prepared = await prepareStepContext({
46
- delivery: item,
47
- serializedRuntimeContext,
48
- session: stepSession,
44
+ return async (stepSession, _stepInput) => {
45
+ // Continuous runs reuse one in-memory container across turns, so
46
+ // clear the previous step's virtual provider overlay before
47
+ // `onDeliver()`. `runStep()` clears again before rebuilding
48
+ // providers for the step body.
49
+ ctx.clearVirtualContext();
50
+ if (item.auth !== undefined) {
51
+ ctx.set(AuthKey, item.auth ?? null);
52
+ }
53
+ const resolved = await channel.onDeliver(toContextAccessor(ctx), item.payload);
54
+ return await runStep(ctx, stepSession, (enrichedSession) => {
55
+ return rawStep(enrichedSession, resolved);
49
56
  });
50
- return runStepWithChannelGuard(prepared, stepSession, (enrichedSession) => rawStep(enrichedSession, prepared.input));
51
57
  };
52
58
  };
53
59
  /**
@@ -55,20 +61,16 @@ export async function continuousEntry(input) {
55
61
  * function (tool-loop continuation). No deliver payload.
56
62
  */
57
63
  const wrapContinuation = (innerStep) => {
58
- return async (stepSession, stepInput) => {
59
- const prepared = await prepareStepContext({
60
- serializedRuntimeContext,
61
- session: stepSession,
62
- });
63
- return runStepWithChannelGuard(prepared, stepSession, (enrichedSession) => innerStep(enrichedSession, stepInput));
64
- };
64
+ return async (stepSession, stepInput) => await runStep(ctx, stepSession, (enrichedSession) => innerStep(enrichedSession, stepInput));
65
65
  };
66
66
  let currentStep = deliverStep({ payload: { message: entryInput.message } });
67
67
  let currentSession = session;
68
68
  while (true) {
69
69
  const stepResult = await currentStep(currentSession, undefined);
70
70
  currentSession = stepResult.session;
71
- if (isStepDone(stepResult.next)) {
71
+ if (stepResult.next !== null &&
72
+ typeof stepResult.next === "object" &&
73
+ "done" in stepResult.next) {
72
74
  return { output: stepResult.next.output, status: "completed" };
73
75
  }
74
76
  if (stepResult.next === null) {
@@ -1 +1 @@
1
- {"version":3,"file":"continuous-entry.js","sourceRoot":"","sources":["../../../src/execution/continuous-entry.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC5F,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAGL,UAAU,GAEX,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAsB,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAChF,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,CAAC;AAO7B,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,yCAAyC,CAAC;AAK9F;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,2BAA2B,CAAC,MAAM,EAAE;IAClD,QAAQ,CAAC,uBAAuB,EAAE,8BAA8B,CAAC;IACjE,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;CAChC,GAAG,OAAO,CAiGV"}
1
+ {"version":3,"file":"continuous-runtime.d.ts","sourceRoot":"","sources":["../../../src/execution/continuous-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAKV,OAAO,EACR,MAAM,qBAAqB,CAAC;AAG7B,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,yCAAyC,CAAC;AAK9F;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,2BAA2B,CAAC,MAAM,EAAE;IAClD,QAAQ,CAAC,uBAAuB,EAAE,8BAA8B,CAAC;IACjE,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;CAChC,GAAG,OAAO,CA+FV"}