@aigne/agent-runtime 1.12.0-beta.5

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 (234) hide show
  1. package/LICENSE.md +26 -0
  2. package/README.md +79 -0
  3. package/dist/agent-runners/ai-runner.cjs +133 -0
  4. package/dist/agent-runners/ai-runner.d.cts +33 -0
  5. package/dist/agent-runners/ai-runner.d.cts.map +1 -0
  6. package/dist/agent-runners/ai-runner.d.mts +33 -0
  7. package/dist/agent-runners/ai-runner.d.mts.map +1 -0
  8. package/dist/agent-runners/ai-runner.mjs +134 -0
  9. package/dist/agent-runners/ai-runner.mjs.map +1 -0
  10. package/dist/agent-runners/ash-runner.cjs +272 -0
  11. package/dist/agent-runners/ash-runner.d.cts +30 -0
  12. package/dist/agent-runners/ash-runner.d.cts.map +1 -0
  13. package/dist/agent-runners/ash-runner.d.mts +30 -0
  14. package/dist/agent-runners/ash-runner.d.mts.map +1 -0
  15. package/dist/agent-runners/ash-runner.mjs +273 -0
  16. package/dist/agent-runners/ash-runner.mjs.map +1 -0
  17. package/dist/agent-runners/budget.cjs +71 -0
  18. package/dist/agent-runners/budget.d.cts +40 -0
  19. package/dist/agent-runners/budget.d.cts.map +1 -0
  20. package/dist/agent-runners/budget.d.mts +40 -0
  21. package/dist/agent-runners/budget.d.mts.map +1 -0
  22. package/dist/agent-runners/budget.mjs +67 -0
  23. package/dist/agent-runners/budget.mjs.map +1 -0
  24. package/dist/agent-runners/code-runner.cjs +61 -0
  25. package/dist/agent-runners/code-runner.mjs +61 -0
  26. package/dist/agent-runners/code-runner.mjs.map +1 -0
  27. package/dist/agent-runners/env-whitelist.cjs +36 -0
  28. package/dist/agent-runners/env-whitelist.d.cts +5 -0
  29. package/dist/agent-runners/env-whitelist.d.cts.map +1 -0
  30. package/dist/agent-runners/env-whitelist.d.mts +5 -0
  31. package/dist/agent-runners/env-whitelist.d.mts.map +1 -0
  32. package/dist/agent-runners/env-whitelist.mjs +36 -0
  33. package/dist/agent-runners/env-whitelist.mjs.map +1 -0
  34. package/dist/agent-runners/guide-rails.cjs +47 -0
  35. package/dist/agent-runners/guide-rails.d.cts +16 -0
  36. package/dist/agent-runners/guide-rails.d.cts.map +1 -0
  37. package/dist/agent-runners/guide-rails.d.mts +16 -0
  38. package/dist/agent-runners/guide-rails.d.mts.map +1 -0
  39. package/dist/agent-runners/guide-rails.mjs +48 -0
  40. package/dist/agent-runners/guide-rails.mjs.map +1 -0
  41. package/dist/agent-runners/hook-channel.cjs +55 -0
  42. package/dist/agent-runners/hook-channel.d.cts +38 -0
  43. package/dist/agent-runners/hook-channel.d.cts.map +1 -0
  44. package/dist/agent-runners/hook-channel.d.mts +38 -0
  45. package/dist/agent-runners/hook-channel.d.mts.map +1 -0
  46. package/dist/agent-runners/hook-channel.mjs +55 -0
  47. package/dist/agent-runners/hook-channel.mjs.map +1 -0
  48. package/dist/agent-runners/hooks.cjs +107 -0
  49. package/dist/agent-runners/hooks.d.cts +41 -0
  50. package/dist/agent-runners/hooks.d.cts.map +1 -0
  51. package/dist/agent-runners/hooks.d.mts +41 -0
  52. package/dist/agent-runners/hooks.d.mts.map +1 -0
  53. package/dist/agent-runners/hooks.mjs +107 -0
  54. package/dist/agent-runners/hooks.mjs.map +1 -0
  55. package/dist/agent-runners/memory-afs.cjs +342 -0
  56. package/dist/agent-runners/memory-afs.d.cts +221 -0
  57. package/dist/agent-runners/memory-afs.d.cts.map +1 -0
  58. package/dist/agent-runners/memory-afs.d.mts +221 -0
  59. package/dist/agent-runners/memory-afs.d.mts.map +1 -0
  60. package/dist/agent-runners/memory-afs.mjs +326 -0
  61. package/dist/agent-runners/memory-afs.mjs.map +1 -0
  62. package/dist/agent-runners/memory-archive.cjs +263 -0
  63. package/dist/agent-runners/memory-archive.d.cts +47 -0
  64. package/dist/agent-runners/memory-archive.d.cts.map +1 -0
  65. package/dist/agent-runners/memory-archive.d.mts +47 -0
  66. package/dist/agent-runners/memory-archive.d.mts.map +1 -0
  67. package/dist/agent-runners/memory-archive.mjs +257 -0
  68. package/dist/agent-runners/memory-archive.mjs.map +1 -0
  69. package/dist/agent-runners/orchestrator-runner.cjs +302 -0
  70. package/dist/agent-runners/orchestrator-runner.d.cts +23 -0
  71. package/dist/agent-runners/orchestrator-runner.d.cts.map +1 -0
  72. package/dist/agent-runners/orchestrator-runner.d.mts +23 -0
  73. package/dist/agent-runners/orchestrator-runner.d.mts.map +1 -0
  74. package/dist/agent-runners/orchestrator-runner.mjs +303 -0
  75. package/dist/agent-runners/orchestrator-runner.mjs.map +1 -0
  76. package/dist/agent-runners/orchestrator-state.cjs +68 -0
  77. package/dist/agent-runners/orchestrator-state.d.cts +23 -0
  78. package/dist/agent-runners/orchestrator-state.d.cts.map +1 -0
  79. package/dist/agent-runners/orchestrator-state.d.mts +23 -0
  80. package/dist/agent-runners/orchestrator-state.d.mts.map +1 -0
  81. package/dist/agent-runners/orchestrator-state.mjs +65 -0
  82. package/dist/agent-runners/orchestrator-state.mjs.map +1 -0
  83. package/dist/agent-runners/retry.cjs +30 -0
  84. package/dist/agent-runners/retry.d.cts +13 -0
  85. package/dist/agent-runners/retry.d.cts.map +1 -0
  86. package/dist/agent-runners/retry.d.mts +13 -0
  87. package/dist/agent-runners/retry.d.mts.map +1 -0
  88. package/dist/agent-runners/retry.mjs +30 -0
  89. package/dist/agent-runners/retry.mjs.map +1 -0
  90. package/dist/agent-runners/scratchpad-afs.cjs +276 -0
  91. package/dist/agent-runners/scratchpad-afs.d.cts +103 -0
  92. package/dist/agent-runners/scratchpad-afs.d.cts.map +1 -0
  93. package/dist/agent-runners/scratchpad-afs.d.mts +103 -0
  94. package/dist/agent-runners/scratchpad-afs.d.mts.map +1 -0
  95. package/dist/agent-runners/scratchpad-afs.mjs +271 -0
  96. package/dist/agent-runners/scratchpad-afs.mjs.map +1 -0
  97. package/dist/agent-runners/stream-router.cjs +72 -0
  98. package/dist/agent-runners/stream-router.d.cts +22 -0
  99. package/dist/agent-runners/stream-router.d.cts.map +1 -0
  100. package/dist/agent-runners/stream-router.d.mts +22 -0
  101. package/dist/agent-runners/stream-router.d.mts.map +1 -0
  102. package/dist/agent-runners/stream-router.mjs +72 -0
  103. package/dist/agent-runners/stream-router.mjs.map +1 -0
  104. package/dist/agent-runners/system-prompt.cjs +35 -0
  105. package/dist/agent-runners/system-prompt.d.cts +17 -0
  106. package/dist/agent-runners/system-prompt.d.cts.map +1 -0
  107. package/dist/agent-runners/system-prompt.d.mts +17 -0
  108. package/dist/agent-runners/system-prompt.d.mts.map +1 -0
  109. package/dist/agent-runners/system-prompt.mjs +34 -0
  110. package/dist/agent-runners/system-prompt.mjs.map +1 -0
  111. package/dist/agent-runners/team-modes/aggregates.cjs +36 -0
  112. package/dist/agent-runners/team-modes/aggregates.mjs +35 -0
  113. package/dist/agent-runners/team-modes/aggregates.mjs.map +1 -0
  114. package/dist/agent-runners/team-modes/iterate.cjs +46 -0
  115. package/dist/agent-runners/team-modes/iterate.mjs +47 -0
  116. package/dist/agent-runners/team-modes/iterate.mjs.map +1 -0
  117. package/dist/agent-runners/team-modes/parallel.cjs +59 -0
  118. package/dist/agent-runners/team-modes/parallel.mjs +60 -0
  119. package/dist/agent-runners/team-modes/parallel.mjs.map +1 -0
  120. package/dist/agent-runners/team-modes/reflection.cjs +155 -0
  121. package/dist/agent-runners/team-modes/reflection.mjs +156 -0
  122. package/dist/agent-runners/team-modes/reflection.mjs.map +1 -0
  123. package/dist/agent-runners/team-modes/sequential.cjs +63 -0
  124. package/dist/agent-runners/team-modes/sequential.mjs +64 -0
  125. package/dist/agent-runners/team-modes/sequential.mjs.map +1 -0
  126. package/dist/agent-runners/team-modes/utils.cjs +39 -0
  127. package/dist/agent-runners/team-modes/utils.mjs +36 -0
  128. package/dist/agent-runners/team-modes/utils.mjs.map +1 -0
  129. package/dist/agent-runners/team-runner.cjs +277 -0
  130. package/dist/agent-runners/team-runner.d.cts +34 -0
  131. package/dist/agent-runners/team-runner.d.cts.map +1 -0
  132. package/dist/agent-runners/team-runner.d.mts +34 -0
  133. package/dist/agent-runners/team-runner.d.mts.map +1 -0
  134. package/dist/agent-runners/team-runner.mjs +278 -0
  135. package/dist/agent-runners/team-runner.mjs.map +1 -0
  136. package/dist/agent-runners/template-context.cjs +32 -0
  137. package/dist/agent-runners/template-context.d.cts +43 -0
  138. package/dist/agent-runners/template-context.d.cts.map +1 -0
  139. package/dist/agent-runners/template-context.d.mts +43 -0
  140. package/dist/agent-runners/template-context.d.mts.map +1 -0
  141. package/dist/agent-runners/template-context.mjs +33 -0
  142. package/dist/agent-runners/template-context.mjs.map +1 -0
  143. package/dist/index.cjs +123 -0
  144. package/dist/index.d.cts +29 -0
  145. package/dist/index.d.mts +29 -0
  146. package/dist/index.mjs +29 -0
  147. package/dist/program/agent-action.cjs +496 -0
  148. package/dist/program/agent-action.d.cts +42 -0
  149. package/dist/program/agent-action.d.cts.map +1 -0
  150. package/dist/program/agent-action.d.mts +42 -0
  151. package/dist/program/agent-action.d.mts.map +1 -0
  152. package/dist/program/agent-action.mjs +497 -0
  153. package/dist/program/agent-action.mjs.map +1 -0
  154. package/dist/program/agent-messages-tools.cjs +137 -0
  155. package/dist/program/agent-messages-tools.d.cts +59 -0
  156. package/dist/program/agent-messages-tools.d.cts.map +1 -0
  157. package/dist/program/agent-messages-tools.d.mts +59 -0
  158. package/dist/program/agent-messages-tools.d.mts.map +1 -0
  159. package/dist/program/agent-messages-tools.mjs +130 -0
  160. package/dist/program/agent-messages-tools.mjs.map +1 -0
  161. package/dist/program/agent-runner-registry.cjs +314 -0
  162. package/dist/program/agent-runner-registry.d.cts +52 -0
  163. package/dist/program/agent-runner-registry.d.cts.map +1 -0
  164. package/dist/program/agent-runner-registry.d.mts +52 -0
  165. package/dist/program/agent-runner-registry.d.mts.map +1 -0
  166. package/dist/program/agent-runner-registry.mjs +313 -0
  167. package/dist/program/agent-runner-registry.mjs.map +1 -0
  168. package/dist/program/agent-subscribe.cjs +72 -0
  169. package/dist/program/agent-subscribe.d.cts +18 -0
  170. package/dist/program/agent-subscribe.d.cts.map +1 -0
  171. package/dist/program/agent-subscribe.d.mts +18 -0
  172. package/dist/program/agent-subscribe.d.mts.map +1 -0
  173. package/dist/program/agent-subscribe.mjs +73 -0
  174. package/dist/program/agent-subscribe.mjs.map +1 -0
  175. package/dist/program/agent-tools.cjs +135 -0
  176. package/dist/program/agent-tools.d.cts +35 -0
  177. package/dist/program/agent-tools.d.cts.map +1 -0
  178. package/dist/program/agent-tools.d.mts +35 -0
  179. package/dist/program/agent-tools.d.mts.map +1 -0
  180. package/dist/program/agent-tools.mjs +136 -0
  181. package/dist/program/agent-tools.mjs.map +1 -0
  182. package/dist/program/manifest-nesting.cjs +57 -0
  183. package/dist/program/manifest-nesting.d.cts +13 -0
  184. package/dist/program/manifest-nesting.d.cts.map +1 -0
  185. package/dist/program/manifest-nesting.d.mts +13 -0
  186. package/dist/program/manifest-nesting.d.mts.map +1 -0
  187. package/dist/program/manifest-nesting.mjs +57 -0
  188. package/dist/program/manifest-nesting.mjs.map +1 -0
  189. package/dist/program/result-contract.cjs +55 -0
  190. package/dist/program/result-contract.d.cts +23 -0
  191. package/dist/program/result-contract.d.cts.map +1 -0
  192. package/dist/program/result-contract.d.mts +23 -0
  193. package/dist/program/result-contract.d.mts.map +1 -0
  194. package/dist/program/result-contract.mjs +51 -0
  195. package/dist/program/result-contract.mjs.map +1 -0
  196. package/dist/program/runner-error.cjs +71 -0
  197. package/dist/program/runner-error.d.cts +25 -0
  198. package/dist/program/runner-error.d.cts.map +1 -0
  199. package/dist/program/runner-error.d.mts +25 -0
  200. package/dist/program/runner-error.d.mts.map +1 -0
  201. package/dist/program/runner-error.mjs +72 -0
  202. package/dist/program/runner-error.mjs.map +1 -0
  203. package/dist/program/scoped-afs.cjs +538 -0
  204. package/dist/program/scoped-afs.d.cts +245 -0
  205. package/dist/program/scoped-afs.d.cts.map +1 -0
  206. package/dist/program/scoped-afs.d.mts +245 -0
  207. package/dist/program/scoped-afs.d.mts.map +1 -0
  208. package/dist/program/scoped-afs.mjs +531 -0
  209. package/dist/program/scoped-afs.mjs.map +1 -0
  210. package/dist/program/session-hierarchy.cjs +1 -0
  211. package/dist/program/session-hierarchy.d.cts +2 -0
  212. package/dist/program/session-hierarchy.d.mts +2 -0
  213. package/dist/program/session-hierarchy.mjs +3 -0
  214. package/dist/program/tool-discovery/ash-frontmatter.cjs +83 -0
  215. package/dist/program/tool-discovery/ash-frontmatter.d.cts +21 -0
  216. package/dist/program/tool-discovery/ash-frontmatter.d.cts.map +1 -0
  217. package/dist/program/tool-discovery/ash-frontmatter.d.mts +21 -0
  218. package/dist/program/tool-discovery/ash-frontmatter.d.mts.map +1 -0
  219. package/dist/program/tool-discovery/ash-frontmatter.mjs +84 -0
  220. package/dist/program/tool-discovery/ash-frontmatter.mjs.map +1 -0
  221. package/dist/program/tool-discovery/dot-path-resolver.cjs +60 -0
  222. package/dist/program/tool-discovery/dot-path-resolver.mjs +61 -0
  223. package/dist/program/tool-discovery/dot-path-resolver.mjs.map +1 -0
  224. package/dist/program/tool-discovery/skill-gate.cjs +36 -0
  225. package/dist/program/tool-discovery/skill-gate.d.cts +10 -0
  226. package/dist/program/tool-discovery/skill-gate.d.cts.map +1 -0
  227. package/dist/program/tool-discovery/skill-gate.d.mts +10 -0
  228. package/dist/program/tool-discovery/skill-gate.d.mts.map +1 -0
  229. package/dist/program/tool-discovery/skill-gate.mjs +35 -0
  230. package/dist/program/tool-discovery/skill-gate.mjs.map +1 -0
  231. package/dist/providers/basic/ash/dist/index.cjs +1809 -0
  232. package/dist/providers/basic/ash/dist/index.mjs +1807 -0
  233. package/dist/providers/basic/ash/dist/index.mjs.map +1 -0
  234. package/package.json +67 -0
@@ -0,0 +1,32 @@
1
+ const require_env_whitelist = require('./env-whitelist.cjs');
2
+ let _aigne_afs_agent = require("@aigne/afs-agent");
3
+
4
+ //#region src/agent-runners/template-context.ts
5
+ function buildTemplateContext(opts) {
6
+ const { input, manifest, session, parentInfo, envWhitelist, scratch, catalogResult } = opts;
7
+ const $env = require_env_whitelist.resolveEnv(envWhitelist);
8
+ const $scratch = scratch ? (0, _aigne_afs_agent.getStateProxy)(scratch) : Object.freeze({});
9
+ const $skills = (catalogResult?.helpers ?? []).map((h) => ({
10
+ name: h.schema.name,
11
+ skill: h.skill
12
+ }));
13
+ const $tools = (catalogResult?.catalog ?? []).map((t) => t.name);
14
+ return {
15
+ $input: input,
16
+ $manifest: {
17
+ name: manifest.name,
18
+ type: manifest.type,
19
+ ...manifest.description ? { description: manifest.description } : {}
20
+ },
21
+ $session: { id: session },
22
+ $parent: parentInfo,
23
+ $env,
24
+ $now: (/* @__PURE__ */ new Date()).toISOString(),
25
+ $scratch,
26
+ $skills,
27
+ $tools
28
+ };
29
+ }
30
+
31
+ //#endregion
32
+ exports.buildTemplateContext = buildTemplateContext;
@@ -0,0 +1,43 @@
1
+ import { CatalogResult } from "../program/agent-tools.cjs";
2
+ import { AgentManifest } from "@aigne/afs";
3
+ import { ScratchLayout } from "@aigne/afs-agent";
4
+
5
+ //#region src/agent-runners/template-context.d.ts
6
+ interface ParentAgentInfo {
7
+ name: string;
8
+ type: string;
9
+ session: string;
10
+ }
11
+ interface TemplateContextOptions {
12
+ input: Record<string, unknown>;
13
+ manifest: AgentManifest;
14
+ session: string | undefined;
15
+ parentInfo: ParentAgentInfo | null;
16
+ envWhitelist: string[] | undefined;
17
+ scratch: ScratchLayout | null;
18
+ catalogResult: CatalogResult | null;
19
+ }
20
+ interface TemplateContext {
21
+ $input: Record<string, unknown>;
22
+ $manifest: {
23
+ name: string;
24
+ type: string;
25
+ description?: string;
26
+ };
27
+ $session: {
28
+ id: string | undefined;
29
+ };
30
+ $parent: ParentAgentInfo | null;
31
+ $env: Record<string, string | undefined>;
32
+ $now: string;
33
+ $scratch: Record<string, unknown>;
34
+ $skills: Array<{
35
+ name: string;
36
+ skill: string;
37
+ }>;
38
+ $tools: string[];
39
+ }
40
+ declare function buildTemplateContext(opts: TemplateContextOptions): TemplateContext;
41
+ //#endregion
42
+ export { ParentAgentInfo, TemplateContext, TemplateContextOptions, buildTemplateContext };
43
+ //# sourceMappingURL=template-context.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template-context.d.cts","names":[],"sources":["../../src/agent-runners/template-context.ts"],"mappings":";;;;;UAMiB,eAAA;EACf,IAAA;EACA,IAAA;EACA,OAAA;AAAA;AAAA,UAGe,sBAAA;EACf,KAAA,EAAO,MAAA;EACP,QAAA,EAAU,aAAA;EACV,OAAA;EACA,UAAA,EAAY,eAAA;EACZ,YAAA;EACA,OAAA,EAAS,aAAA;EACT,aAAA,EAAe,aAAA;AAAA;AAAA,UAGA,eAAA;EACf,MAAA,EAAQ,MAAA;EACR,SAAA;IAAa,IAAA;IAAc,IAAA;IAAc,WAAA;EAAA;EACzC,QAAA;IAAY,EAAA;EAAA;EACZ,OAAA,EAAS,eAAA;EACT,IAAA,EAAM,MAAA;EACN,IAAA;EACA,QAAA,EAAU,MAAA;EACV,OAAA,EAAS,KAAA;IAAQ,IAAA;IAAc,KAAA;EAAA;EAC/B,MAAA;AAAA;AAAA,iBAGc,oBAAA,CAAqB,IAAA,EAAM,sBAAA,GAAyB,eAAA"}
@@ -0,0 +1,43 @@
1
+ import { CatalogResult } from "../program/agent-tools.mjs";
2
+ import { ScratchLayout } from "@aigne/afs-agent";
3
+ import { AgentManifest } from "@aigne/afs";
4
+
5
+ //#region src/agent-runners/template-context.d.ts
6
+ interface ParentAgentInfo {
7
+ name: string;
8
+ type: string;
9
+ session: string;
10
+ }
11
+ interface TemplateContextOptions {
12
+ input: Record<string, unknown>;
13
+ manifest: AgentManifest;
14
+ session: string | undefined;
15
+ parentInfo: ParentAgentInfo | null;
16
+ envWhitelist: string[] | undefined;
17
+ scratch: ScratchLayout | null;
18
+ catalogResult: CatalogResult | null;
19
+ }
20
+ interface TemplateContext {
21
+ $input: Record<string, unknown>;
22
+ $manifest: {
23
+ name: string;
24
+ type: string;
25
+ description?: string;
26
+ };
27
+ $session: {
28
+ id: string | undefined;
29
+ };
30
+ $parent: ParentAgentInfo | null;
31
+ $env: Record<string, string | undefined>;
32
+ $now: string;
33
+ $scratch: Record<string, unknown>;
34
+ $skills: Array<{
35
+ name: string;
36
+ skill: string;
37
+ }>;
38
+ $tools: string[];
39
+ }
40
+ declare function buildTemplateContext(opts: TemplateContextOptions): TemplateContext;
41
+ //#endregion
42
+ export { ParentAgentInfo, TemplateContext, TemplateContextOptions, buildTemplateContext };
43
+ //# sourceMappingURL=template-context.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template-context.d.mts","names":[],"sources":["../../src/agent-runners/template-context.ts"],"mappings":";;;;;UAMiB,eAAA;EACf,IAAA;EACA,IAAA;EACA,OAAA;AAAA;AAAA,UAGe,sBAAA;EACf,KAAA,EAAO,MAAA;EACP,QAAA,EAAU,aAAA;EACV,OAAA;EACA,UAAA,EAAY,eAAA;EACZ,YAAA;EACA,OAAA,EAAS,aAAA;EACT,aAAA,EAAe,aAAA;AAAA;AAAA,UAGA,eAAA;EACf,MAAA,EAAQ,MAAA;EACR,SAAA;IAAa,IAAA;IAAc,IAAA;IAAc,WAAA;EAAA;EACzC,QAAA;IAAY,EAAA;EAAA;EACZ,OAAA,EAAS,eAAA;EACT,IAAA,EAAM,MAAA;EACN,IAAA;EACA,QAAA,EAAU,MAAA;EACV,OAAA,EAAS,KAAA;IAAQ,IAAA;IAAc,KAAA;EAAA;EAC/B,MAAA;AAAA;AAAA,iBAGc,oBAAA,CAAqB,IAAA,EAAM,sBAAA,GAAyB,eAAA"}
@@ -0,0 +1,33 @@
1
+ import { resolveEnv } from "./env-whitelist.mjs";
2
+ import { getStateProxy } from "@aigne/afs-agent";
3
+
4
+ //#region src/agent-runners/template-context.ts
5
+ function buildTemplateContext(opts) {
6
+ const { input, manifest, session, parentInfo, envWhitelist, scratch, catalogResult } = opts;
7
+ const $env = resolveEnv(envWhitelist);
8
+ const $scratch = scratch ? getStateProxy(scratch) : Object.freeze({});
9
+ const $skills = (catalogResult?.helpers ?? []).map((h) => ({
10
+ name: h.schema.name,
11
+ skill: h.skill
12
+ }));
13
+ const $tools = (catalogResult?.catalog ?? []).map((t) => t.name);
14
+ return {
15
+ $input: input,
16
+ $manifest: {
17
+ name: manifest.name,
18
+ type: manifest.type,
19
+ ...manifest.description ? { description: manifest.description } : {}
20
+ },
21
+ $session: { id: session },
22
+ $parent: parentInfo,
23
+ $env,
24
+ $now: (/* @__PURE__ */ new Date()).toISOString(),
25
+ $scratch,
26
+ $skills,
27
+ $tools
28
+ };
29
+ }
30
+
31
+ //#endregion
32
+ export { buildTemplateContext };
33
+ //# sourceMappingURL=template-context.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template-context.mjs","names":[],"sources":["../../src/agent-runners/template-context.ts"],"sourcesContent":["import type { AgentManifest } from \"@aigne/afs\";\nimport type { ScratchLayout } from \"@aigne/afs-agent\";\nimport { getStateProxy } from \"@aigne/afs-agent\";\nimport type { CatalogResult } from \"../program/agent-tools.js\";\nimport { resolveEnv } from \"./env-whitelist.js\";\n\nexport interface ParentAgentInfo {\n name: string;\n type: string;\n session: string;\n}\n\nexport interface TemplateContextOptions {\n input: Record<string, unknown>;\n manifest: AgentManifest;\n session: string | undefined;\n parentInfo: ParentAgentInfo | null;\n envWhitelist: string[] | undefined;\n scratch: ScratchLayout | null;\n catalogResult: CatalogResult | null;\n}\n\nexport interface TemplateContext {\n $input: Record<string, unknown>;\n $manifest: { name: string; type: string; description?: string };\n $session: { id: string | undefined };\n $parent: ParentAgentInfo | null;\n $env: Record<string, string | undefined>;\n $now: string;\n $scratch: Record<string, unknown>;\n $skills: Array<{ name: string; skill: string }>;\n $tools: string[];\n}\n\nexport function buildTemplateContext(opts: TemplateContextOptions): TemplateContext {\n const { input, manifest, session, parentInfo, envWhitelist, scratch, catalogResult } = opts;\n\n const $env = resolveEnv(envWhitelist);\n\n const $scratch = scratch ? getStateProxy(scratch) : Object.freeze({});\n\n const $skills = (catalogResult?.helpers ?? []).map((h) => ({\n name: h.schema.name,\n skill: h.skill,\n }));\n\n const $tools = (catalogResult?.catalog ?? []).map((t) => t.name);\n\n return {\n $input: input,\n $manifest: {\n name: manifest.name,\n type: manifest.type,\n ...(manifest.description ? { description: manifest.description } : {}),\n },\n $session: { id: session },\n $parent: parentInfo,\n $env,\n $now: new Date().toISOString(),\n $scratch,\n $skills,\n $tools,\n };\n}\n"],"mappings":";;;;AAkCA,SAAgB,qBAAqB,MAA+C;CAClF,MAAM,EAAE,OAAO,UAAU,SAAS,YAAY,cAAc,SAAS,kBAAkB;CAEvF,MAAM,OAAO,WAAW,aAAa;CAErC,MAAM,WAAW,UAAU,cAAc,QAAQ,GAAG,OAAO,OAAO,EAAE,CAAC;CAErE,MAAM,WAAW,eAAe,WAAW,EAAE,EAAE,KAAK,OAAO;EACzD,MAAM,EAAE,OAAO;EACf,OAAO,EAAE;EACV,EAAE;CAEH,MAAM,UAAU,eAAe,WAAW,EAAE,EAAE,KAAK,MAAM,EAAE,KAAK;AAEhE,QAAO;EACL,QAAQ;EACR,WAAW;GACT,MAAM,SAAS;GACf,MAAM,SAAS;GACf,GAAI,SAAS,cAAc,EAAE,aAAa,SAAS,aAAa,GAAG,EAAE;GACtE;EACD,UAAU,EAAE,IAAI,SAAS;EACzB,SAAS;EACT;EACA,uBAAM,IAAI,MAAM,EAAC,aAAa;EAC9B;EACA;EACA;EACD"}
package/dist/index.cjs ADDED
@@ -0,0 +1,123 @@
1
+ const require_agent_tools = require('./program/agent-tools.cjs');
2
+ const require_budget = require('./agent-runners/budget.cjs');
3
+ const require_memory_archive = require('./agent-runners/memory-archive.cjs');
4
+ const require_env_whitelist = require('./agent-runners/env-whitelist.cjs');
5
+ const require_template_context = require('./agent-runners/template-context.cjs');
6
+ const require_ai_runner = require('./agent-runners/ai-runner.cjs');
7
+ const require_ash_runner = require('./agent-runners/ash-runner.cjs');
8
+ const require_guide_rails = require('./agent-runners/guide-rails.cjs');
9
+ const require_scratchpad_afs = require('./agent-runners/scratchpad-afs.cjs');
10
+ const require_hook_channel = require('./agent-runners/hook-channel.cjs');
11
+ const require_hooks = require('./agent-runners/hooks.cjs');
12
+ const require_memory_afs = require('./agent-runners/memory-afs.cjs');
13
+ const require_agent_messages_tools = require('./program/agent-messages-tools.cjs');
14
+ const require_scoped_afs = require('./program/scoped-afs.cjs');
15
+ require('./program/session-hierarchy.cjs');
16
+ const require_stream_router = require('./agent-runners/stream-router.cjs');
17
+ const require_system_prompt = require('./agent-runners/system-prompt.cjs');
18
+ const require_team_runner = require('./agent-runners/team-runner.cjs');
19
+ const require_retry = require('./agent-runners/retry.cjs');
20
+ const require_result_contract = require('./program/result-contract.cjs');
21
+ const require_runner_error = require('./program/runner-error.cjs');
22
+ const require_agent_action = require('./program/agent-action.cjs');
23
+ const require_agent_runner_registry = require('./program/agent-runner-registry.cjs');
24
+ const require_orchestrator_state = require('./agent-runners/orchestrator-state.cjs');
25
+ const require_orchestrator_runner = require('./agent-runners/orchestrator-runner.cjs');
26
+ const require_agent_subscribe = require('./program/agent-subscribe.cjs');
27
+ const require_manifest_nesting = require('./program/manifest-nesting.cjs');
28
+ let _aigne_afs_agent = require("@aigne/afs-agent");
29
+
30
+ exports.AGENTS_ROOT = require_agent_messages_tools.AGENTS_ROOT;
31
+ exports.CHAIN_DEPTH_HARD_CAP = require_scoped_afs.CHAIN_DEPTH_HARD_CAP;
32
+ exports.DEFAULT_MAX_ROUNDS = require_budget.DEFAULT_MAX_ROUNDS;
33
+ exports.DEFAULT_TOTAL_TOKENS = require_budget.DEFAULT_TOTAL_TOKENS;
34
+ exports.MAX_ROUNDS_HARD_CAP = require_budget.MAX_ROUNDS_HARD_CAP;
35
+ exports.MEMORY_SCOPE_ROOT = require_memory_afs.MEMORY_SCOPE_ROOT;
36
+ exports.MEMORY_SCRATCH_ROOT = require_scratchpad_afs.MEMORY_SCRATCH_ROOT;
37
+ exports.MESSAGING_AGENTS_ROOT = require_agent_messages_tools.MESSAGING_AGENTS_ROOT;
38
+ exports.MESSAGING_ROOT = require_agent_messages_tools.MESSAGING_ROOT;
39
+ exports.MESSAGING_TOOLS_GLOB = require_agent_messages_tools.MESSAGING_TOOLS_GLOB;
40
+ exports.MESSAGING_TOOLS_ROOT = require_agent_messages_tools.MESSAGING_TOOLS_ROOT;
41
+ exports.SCRATCH_SCOPE_ROOT = require_scratchpad_afs.SCRATCH_SCOPE_ROOT;
42
+ exports.SESSION_MEMORY_STORAGE_KEY = require_memory_afs.SESSION_MEMORY_STORAGE_KEY;
43
+ exports.agentMsgDir = require_agent_messages_tools.agentMsgDir;
44
+ exports.attachMemoryMount = require_memory_afs.attachMemoryMount;
45
+ exports.attachScratchMount = require_scratchpad_afs.attachScratchMount;
46
+ exports.attachSessionIndex = require_memory_afs.attachSessionIndex;
47
+ exports.attachSessionMemoryStorage = require_memory_afs.attachSessionMemoryStorage;
48
+ exports.buildMemoryIndexOptsForAfs = require_memory_afs.buildMemoryIndexOptsForAfs;
49
+ exports.buildMemoryStorageForAfs = require_memory_afs.buildMemoryStorageForAfs;
50
+ exports.buildTemplateContext = require_template_context.buildTemplateContext;
51
+ Object.defineProperty(exports, 'checkSpawnDepth', {
52
+ enumerable: true,
53
+ get: function () {
54
+ return _aigne_afs_agent.checkSpawnDepth;
55
+ }
56
+ });
57
+ exports.clearAgentIndexAfsForTesting = require_memory_afs.clearAgentIndexAfsForTesting;
58
+ exports.clearAgentMemoryRootForTesting = require_memory_afs.clearAgentMemoryRootForTesting;
59
+ exports.clearMemoryProviderCacheForTesting = require_memory_afs.clearMemoryProviderCacheForTesting;
60
+ exports.compileToolCatalog = require_agent_tools.compileToolCatalog;
61
+ exports.computeScratchLayout = require_scratchpad_afs.computeScratchLayout;
62
+ exports.createAgentActionHandlers = require_agent_action.createAgentActionHandlers;
63
+ exports.createBudgetTracker = require_budget.createBudgetTracker;
64
+ exports.createHookChannel = require_hook_channel.createHookChannel;
65
+ exports.createHookDispatcher = require_hooks.createHookDispatcher;
66
+ exports.createInitialState = require_orchestrator_state.createInitialState;
67
+ exports.createMemoryProvider = require_memory_afs.createMemoryProvider;
68
+ exports.createScratchProvider = require_scratchpad_afs.createScratchProvider;
69
+ exports.createStreamProgressRouter = require_stream_router.createStreamProgressRouter;
70
+ Object.defineProperty(exports, 'deriveChildSession', {
71
+ enumerable: true,
72
+ get: function () {
73
+ return _aigne_afs_agent.deriveChildSession;
74
+ }
75
+ });
76
+ exports.deserializeState = require_orchestrator_state.deserializeState;
77
+ exports.detectUISessionPath = require_stream_router.detectUISessionPath;
78
+ exports.ensureScopeWithMounts = require_scoped_afs.ensureScopeWithMounts;
79
+ exports.estimateTokens = require_orchestrator_state.estimateTokens;
80
+ exports.extractBlockletId = require_system_prompt.extractBlockletId;
81
+ exports.fireHook = require_hooks.fireHook;
82
+ exports.formatRecallForPrompt = require_memory_archive.formatRecallForPrompt;
83
+ exports.getMessagingToolDefinitions = require_agent_messages_tools.getMessagingToolDefinitions;
84
+ exports.getRunnerForType = require_agent_runner_registry.getRunnerForType;
85
+ exports.handlePostMessage = require_agent_messages_tools.handlePostMessage;
86
+ exports.handleReadMessages = require_agent_messages_tools.handleReadMessages;
87
+ exports.isHandoffReadThroughEnabled = require_memory_archive.isHandoffReadThroughEnabled;
88
+ exports.isJsonSafe = require_result_contract.isJsonSafe;
89
+ exports.isMemoryArchiveEnabled = require_memory_archive.isMemoryArchiveEnabled;
90
+ exports.isMemoryPath = require_memory_afs.isMemoryPath;
91
+ exports.isSubAgentResult = require_result_contract.isSubAgentResult;
92
+ exports.mountManifestMemory = require_memory_afs.mountManifestMemory;
93
+ exports.normalizeManifestTools = require_scoped_afs.normalizeManifestTools;
94
+ exports.normalizeRunnerError = require_runner_error.normalizeRunnerError;
95
+ exports.persistHookEvents = require_hook_channel.persistHookEvents;
96
+ exports.projectForChild = require_scoped_afs.projectForChild;
97
+ exports.provisionScratchViaAFS = require_scratchpad_afs.provisionScratchViaAFS;
98
+ exports.readSessionIndex = require_memory_afs.readSessionIndex;
99
+ exports.rebaseNestedManifest = require_manifest_nesting.rebaseNestedManifest;
100
+ exports.recallForHandoff = require_memory_archive.recallForHandoff;
101
+ exports.registerAgentActions = require_agent_runner_registry.registerAgentActions;
102
+ exports.registerAgentSubscribes = require_agent_subscribe.registerAgentSubscribes;
103
+ exports.resolveBudget = require_budget.resolveBudget;
104
+ exports.resolveEnv = require_env_whitelist.resolveEnv;
105
+ exports.resolveMemoryDomain = require_memory_afs.resolveMemoryDomain;
106
+ exports.resolveParentAgentScope = require_scoped_afs.resolveParentAgentScope;
107
+ exports.rootAgentScope = require_scoped_afs.rootAgentScope;
108
+ exports.runAIAgent = require_ai_runner.runAIAgent;
109
+ exports.runAshAgent = require_ash_runner.runAshAgent;
110
+ exports.runGuideRails = require_guide_rails.runGuideRails;
111
+ exports.runOrchestratorAgent = require_orchestrator_runner.runOrchestratorAgent;
112
+ exports.runTeamAgent = require_team_runner.runTeamAgent;
113
+ exports.sanitizeMetaEnv = require_result_contract.sanitizeMetaEnv;
114
+ exports.sanitizeScratchPath = require_result_contract.sanitizeScratchPath;
115
+ exports.sanitizeSystemAppend = require_system_prompt.sanitizeSystemAppend;
116
+ exports.scopeToJSON = require_scoped_afs.toJSON;
117
+ exports.serializeState = require_orchestrator_state.serializeState;
118
+ exports.setAgentIndexAfs = require_memory_afs.setAgentIndexAfs;
119
+ exports.setAgentMemoryRoot = require_memory_afs.setAgentMemoryRoot;
120
+ exports.stripSubAgentMeta = require_result_contract.stripSubAgentMeta;
121
+ exports.teardownScratchViaAFS = require_scratchpad_afs.teardownScratchViaAFS;
122
+ exports.truncateHistory = require_orchestrator_state.truncateHistory;
123
+ exports.withRetry = require_retry.withRetry;
@@ -0,0 +1,29 @@
1
+ import { ToolSchema } from "./program/tool-discovery/ash-frontmatter.cjs";
2
+ import { CatalogResult, CompileOptions, compileToolCatalog } from "./program/agent-tools.cjs";
3
+ import { ParentAgentInfo, TemplateContext, TemplateContextOptions, buildTemplateContext } from "./agent-runners/template-context.cjs";
4
+ import { AIRunnerInput, AIRunnerResult, runAIAgent } from "./agent-runners/ai-runner.cjs";
5
+ import { AshRunnerInput, AshRunnerResult, runAshAgent } from "./agent-runners/ash-runner.cjs";
6
+ import { BudgetConfig, BudgetTracker, DEFAULT_MAX_ROUNDS, DEFAULT_TOTAL_TOKENS, MAX_ROUNDS_HARD_CAP, ResolvedBudget, createBudgetTracker, resolveBudget } from "./agent-runners/budget.cjs";
7
+ import { resolveEnv } from "./agent-runners/env-whitelist.cjs";
8
+ import { GuideRailResult, RunGuideRailsOptions, runGuideRails } from "./agent-runners/guide-rails.cjs";
9
+ import { HookChannel, HookEvent, createHookChannel, persistHookEvents } from "./agent-runners/hook-channel.cjs";
10
+ import { HookConfig, HookDispatcher, SkillEndPayload, createHookDispatcher, fireHook } from "./agent-runners/hooks.cjs";
11
+ import { CreateMemoryProviderOptions, MEMORY_SCOPE_ROOT, SESSION_MEMORY_STORAGE_KEY, SessionIndexConfig, attachMemoryMount, attachSessionIndex, attachSessionMemoryStorage, buildMemoryIndexOptsForAfs, buildMemoryStorageForAfs, clearAgentIndexAfsForTesting, clearAgentMemoryRootForTesting, clearMemoryProviderCacheForTesting, createMemoryProvider, isMemoryPath, mountManifestMemory, readSessionIndex, resolveMemoryDomain, setAgentIndexAfs, setAgentMemoryRoot } from "./agent-runners/memory-afs.cjs";
12
+ import { RecalledEntry, formatRecallForPrompt, isHandoffReadThroughEnabled, isMemoryArchiveEnabled, recallForHandoff } from "./agent-runners/memory-archive.cjs";
13
+ import { AgentRunner, RegisterAgentActionsOptions, RunnerContext, getRunnerForType, registerAgentActions } from "./program/agent-runner-registry.cjs";
14
+ import { OrchestratorRunnerResult, runOrchestratorAgent } from "./agent-runners/orchestrator-runner.cjs";
15
+ import { OrchestratorState, TaskResult, createInitialState, deserializeState, estimateTokens, serializeState, truncateHistory } from "./agent-runners/orchestrator-state.cjs";
16
+ import { RetryConfig, WithRetryOptions, withRetry } from "./agent-runners/retry.cjs";
17
+ import { AFSScratchLayout, MEMORY_SCRATCH_ROOT, SCRATCH_SCOPE_ROOT, ScratchProvider, ScratchProviderOptions, ScratchRetention, attachScratchMount, computeScratchLayout, createScratchProvider, provisionScratchViaAFS, teardownScratchViaAFS } from "./agent-runners/scratchpad-afs.cjs";
18
+ import { StreamProgressRouter, StreamProgressRouterOptions, createStreamProgressRouter, detectUISessionPath } from "./agent-runners/stream-router.cjs";
19
+ import { extractBlockletId, sanitizeSystemAppend } from "./agent-runners/system-prompt.cjs";
20
+ import { TeamRunnerResult, runTeamAgent } from "./agent-runners/team-runner.cjs";
21
+ import { AgentActionHandler, AgentActionHandlers, createAgentActionHandlers } from "./program/agent-action.cjs";
22
+ import { AGENTS_ROOT, AgentMessage, MESSAGING_AGENTS_ROOT, MESSAGING_ROOT, MESSAGING_TOOLS_GLOB, MESSAGING_TOOLS_ROOT, MessagingContext, ToolDefinition, agentMsgDir, getMessagingToolDefinitions, handlePostMessage, handleReadMessages } from "./program/agent-messages-tools.cjs";
23
+ import { AgentSubscribeDispatch, AgentSubscribeHandle, RegisterAgentSubscribesOptions, registerAgentSubscribes } from "./program/agent-subscribe.cjs";
24
+ import { rebaseNestedManifest } from "./program/manifest-nesting.cjs";
25
+ import { isJsonSafe, isSubAgentResult, sanitizeMetaEnv, sanitizeScratchPath, stripSubAgentMeta } from "./program/result-contract.cjs";
26
+ import { NormalizedRunnerError, normalizeRunnerError } from "./program/runner-error.cjs";
27
+ import { AgentScope, AgentScopeDescriptor, AgentScopeDescriptorFields, CHAIN_DEPTH_HARD_CAP, ProjectForChildOptions, ensureScopeWithMounts, normalizeManifestTools, projectForChild, resolveParentAgentScope, rootAgentScope, toJSON } from "./program/scoped-afs.cjs";
28
+ import { checkSpawnDepth, deriveChildSession } from "./program/session-hierarchy.cjs";
29
+ export { type AFSScratchLayout, AGENTS_ROOT, type AIRunnerInput, type AIRunnerResult, type AgentActionHandler, type AgentActionHandlers, type AgentMessage, type AgentRunner, type AgentScope, type AgentScopeDescriptor, type AgentScopeDescriptorFields, type AgentSubscribeDispatch, type AgentSubscribeHandle, type AshRunnerInput, type AshRunnerResult, type BudgetConfig, type BudgetTracker, CHAIN_DEPTH_HARD_CAP, type CatalogResult, type CompileOptions, type CreateMemoryProviderOptions, DEFAULT_MAX_ROUNDS, DEFAULT_TOTAL_TOKENS, type GuideRailResult, type HookChannel, type HookConfig, type HookDispatcher, type HookEvent, MAX_ROUNDS_HARD_CAP, MEMORY_SCOPE_ROOT, MEMORY_SCRATCH_ROOT, MESSAGING_AGENTS_ROOT, MESSAGING_ROOT, MESSAGING_TOOLS_GLOB, MESSAGING_TOOLS_ROOT, type MessagingContext, type NormalizedRunnerError, type OrchestratorRunnerResult, type OrchestratorState, type ParentAgentInfo, type ProjectForChildOptions, type RecalledEntry, type RegisterAgentActionsOptions, type RegisterAgentSubscribesOptions, type ResolvedBudget, type RetryConfig, type RunGuideRailsOptions, type RunnerContext, SCRATCH_SCOPE_ROOT, SESSION_MEMORY_STORAGE_KEY, type ScratchProvider, type ScratchProviderOptions, type ScratchRetention, type SessionIndexConfig, type SkillEndPayload, type StreamProgressRouter, type StreamProgressRouterOptions, type TaskResult, type TeamRunnerResult, type TemplateContext, type TemplateContextOptions, type ToolDefinition, type ToolSchema, type WithRetryOptions, agentMsgDir, attachMemoryMount, attachScratchMount, attachSessionIndex, attachSessionMemoryStorage, buildMemoryIndexOptsForAfs, buildMemoryStorageForAfs, buildTemplateContext, checkSpawnDepth, clearAgentIndexAfsForTesting, clearAgentMemoryRootForTesting, clearMemoryProviderCacheForTesting, compileToolCatalog, computeScratchLayout, createAgentActionHandlers, createBudgetTracker, createHookChannel, createHookDispatcher, createInitialState, createMemoryProvider, createScratchProvider, createStreamProgressRouter, deriveChildSession, deserializeState, detectUISessionPath, ensureScopeWithMounts, estimateTokens, extractBlockletId, fireHook, formatRecallForPrompt, getMessagingToolDefinitions, getRunnerForType, handlePostMessage, handleReadMessages, isHandoffReadThroughEnabled, isJsonSafe, isMemoryArchiveEnabled, isMemoryPath, isSubAgentResult, mountManifestMemory, normalizeManifestTools, normalizeRunnerError, persistHookEvents, projectForChild, provisionScratchViaAFS, readSessionIndex, rebaseNestedManifest, recallForHandoff, registerAgentActions, registerAgentSubscribes, resolveBudget, resolveEnv, resolveMemoryDomain, resolveParentAgentScope, rootAgentScope, runAIAgent, runAshAgent, runGuideRails, runOrchestratorAgent, runTeamAgent, sanitizeMetaEnv, sanitizeScratchPath, sanitizeSystemAppend, toJSON as scopeToJSON, serializeState, setAgentIndexAfs, setAgentMemoryRoot, stripSubAgentMeta, teardownScratchViaAFS, truncateHistory, withRetry };
@@ -0,0 +1,29 @@
1
+ import { ToolSchema } from "./program/tool-discovery/ash-frontmatter.mjs";
2
+ import { CatalogResult, CompileOptions, compileToolCatalog } from "./program/agent-tools.mjs";
3
+ import { ParentAgentInfo, TemplateContext, TemplateContextOptions, buildTemplateContext } from "./agent-runners/template-context.mjs";
4
+ import { AIRunnerInput, AIRunnerResult, runAIAgent } from "./agent-runners/ai-runner.mjs";
5
+ import { AshRunnerInput, AshRunnerResult, runAshAgent } from "./agent-runners/ash-runner.mjs";
6
+ import { BudgetConfig, BudgetTracker, DEFAULT_MAX_ROUNDS, DEFAULT_TOTAL_TOKENS, MAX_ROUNDS_HARD_CAP, ResolvedBudget, createBudgetTracker, resolveBudget } from "./agent-runners/budget.mjs";
7
+ import { resolveEnv } from "./agent-runners/env-whitelist.mjs";
8
+ import { GuideRailResult, RunGuideRailsOptions, runGuideRails } from "./agent-runners/guide-rails.mjs";
9
+ import { HookChannel, HookEvent, createHookChannel, persistHookEvents } from "./agent-runners/hook-channel.mjs";
10
+ import { HookConfig, HookDispatcher, SkillEndPayload, createHookDispatcher, fireHook } from "./agent-runners/hooks.mjs";
11
+ import { CreateMemoryProviderOptions, MEMORY_SCOPE_ROOT, SESSION_MEMORY_STORAGE_KEY, SessionIndexConfig, attachMemoryMount, attachSessionIndex, attachSessionMemoryStorage, buildMemoryIndexOptsForAfs, buildMemoryStorageForAfs, clearAgentIndexAfsForTesting, clearAgentMemoryRootForTesting, clearMemoryProviderCacheForTesting, createMemoryProvider, isMemoryPath, mountManifestMemory, readSessionIndex, resolveMemoryDomain, setAgentIndexAfs, setAgentMemoryRoot } from "./agent-runners/memory-afs.mjs";
12
+ import { RecalledEntry, formatRecallForPrompt, isHandoffReadThroughEnabled, isMemoryArchiveEnabled, recallForHandoff } from "./agent-runners/memory-archive.mjs";
13
+ import { AgentRunner, RegisterAgentActionsOptions, RunnerContext, getRunnerForType, registerAgentActions } from "./program/agent-runner-registry.mjs";
14
+ import { OrchestratorRunnerResult, runOrchestratorAgent } from "./agent-runners/orchestrator-runner.mjs";
15
+ import { OrchestratorState, TaskResult, createInitialState, deserializeState, estimateTokens, serializeState, truncateHistory } from "./agent-runners/orchestrator-state.mjs";
16
+ import { RetryConfig, WithRetryOptions, withRetry } from "./agent-runners/retry.mjs";
17
+ import { AFSScratchLayout, MEMORY_SCRATCH_ROOT, SCRATCH_SCOPE_ROOT, ScratchProvider, ScratchProviderOptions, ScratchRetention, attachScratchMount, computeScratchLayout, createScratchProvider, provisionScratchViaAFS, teardownScratchViaAFS } from "./agent-runners/scratchpad-afs.mjs";
18
+ import { StreamProgressRouter, StreamProgressRouterOptions, createStreamProgressRouter, detectUISessionPath } from "./agent-runners/stream-router.mjs";
19
+ import { extractBlockletId, sanitizeSystemAppend } from "./agent-runners/system-prompt.mjs";
20
+ import { TeamRunnerResult, runTeamAgent } from "./agent-runners/team-runner.mjs";
21
+ import { AgentActionHandler, AgentActionHandlers, createAgentActionHandlers } from "./program/agent-action.mjs";
22
+ import { AGENTS_ROOT, AgentMessage, MESSAGING_AGENTS_ROOT, MESSAGING_ROOT, MESSAGING_TOOLS_GLOB, MESSAGING_TOOLS_ROOT, MessagingContext, ToolDefinition, agentMsgDir, getMessagingToolDefinitions, handlePostMessage, handleReadMessages } from "./program/agent-messages-tools.mjs";
23
+ import { AgentSubscribeDispatch, AgentSubscribeHandle, RegisterAgentSubscribesOptions, registerAgentSubscribes } from "./program/agent-subscribe.mjs";
24
+ import { rebaseNestedManifest } from "./program/manifest-nesting.mjs";
25
+ import { isJsonSafe, isSubAgentResult, sanitizeMetaEnv, sanitizeScratchPath, stripSubAgentMeta } from "./program/result-contract.mjs";
26
+ import { NormalizedRunnerError, normalizeRunnerError } from "./program/runner-error.mjs";
27
+ import { AgentScope, AgentScopeDescriptor, AgentScopeDescriptorFields, CHAIN_DEPTH_HARD_CAP, ProjectForChildOptions, ensureScopeWithMounts, normalizeManifestTools, projectForChild, resolveParentAgentScope, rootAgentScope, toJSON } from "./program/scoped-afs.mjs";
28
+ import { checkSpawnDepth, deriveChildSession } from "./program/session-hierarchy.mjs";
29
+ export { type AFSScratchLayout, AGENTS_ROOT, type AIRunnerInput, type AIRunnerResult, type AgentActionHandler, type AgentActionHandlers, type AgentMessage, type AgentRunner, type AgentScope, type AgentScopeDescriptor, type AgentScopeDescriptorFields, type AgentSubscribeDispatch, type AgentSubscribeHandle, type AshRunnerInput, type AshRunnerResult, type BudgetConfig, type BudgetTracker, CHAIN_DEPTH_HARD_CAP, type CatalogResult, type CompileOptions, type CreateMemoryProviderOptions, DEFAULT_MAX_ROUNDS, DEFAULT_TOTAL_TOKENS, type GuideRailResult, type HookChannel, type HookConfig, type HookDispatcher, type HookEvent, MAX_ROUNDS_HARD_CAP, MEMORY_SCOPE_ROOT, MEMORY_SCRATCH_ROOT, MESSAGING_AGENTS_ROOT, MESSAGING_ROOT, MESSAGING_TOOLS_GLOB, MESSAGING_TOOLS_ROOT, type MessagingContext, type NormalizedRunnerError, type OrchestratorRunnerResult, type OrchestratorState, type ParentAgentInfo, type ProjectForChildOptions, type RecalledEntry, type RegisterAgentActionsOptions, type RegisterAgentSubscribesOptions, type ResolvedBudget, type RetryConfig, type RunGuideRailsOptions, type RunnerContext, SCRATCH_SCOPE_ROOT, SESSION_MEMORY_STORAGE_KEY, type ScratchProvider, type ScratchProviderOptions, type ScratchRetention, type SessionIndexConfig, type SkillEndPayload, type StreamProgressRouter, type StreamProgressRouterOptions, type TaskResult, type TeamRunnerResult, type TemplateContext, type TemplateContextOptions, type ToolDefinition, type ToolSchema, type WithRetryOptions, agentMsgDir, attachMemoryMount, attachScratchMount, attachSessionIndex, attachSessionMemoryStorage, buildMemoryIndexOptsForAfs, buildMemoryStorageForAfs, buildTemplateContext, checkSpawnDepth, clearAgentIndexAfsForTesting, clearAgentMemoryRootForTesting, clearMemoryProviderCacheForTesting, compileToolCatalog, computeScratchLayout, createAgentActionHandlers, createBudgetTracker, createHookChannel, createHookDispatcher, createInitialState, createMemoryProvider, createScratchProvider, createStreamProgressRouter, deriveChildSession, deserializeState, detectUISessionPath, ensureScopeWithMounts, estimateTokens, extractBlockletId, fireHook, formatRecallForPrompt, getMessagingToolDefinitions, getRunnerForType, handlePostMessage, handleReadMessages, isHandoffReadThroughEnabled, isJsonSafe, isMemoryArchiveEnabled, isMemoryPath, isSubAgentResult, mountManifestMemory, normalizeManifestTools, normalizeRunnerError, persistHookEvents, projectForChild, provisionScratchViaAFS, readSessionIndex, rebaseNestedManifest, recallForHandoff, registerAgentActions, registerAgentSubscribes, resolveBudget, resolveEnv, resolveMemoryDomain, resolveParentAgentScope, rootAgentScope, runAIAgent, runAshAgent, runGuideRails, runOrchestratorAgent, runTeamAgent, sanitizeMetaEnv, sanitizeScratchPath, sanitizeSystemAppend, toJSON as scopeToJSON, serializeState, setAgentIndexAfs, setAgentMemoryRoot, stripSubAgentMeta, teardownScratchViaAFS, truncateHistory, withRetry };
package/dist/index.mjs ADDED
@@ -0,0 +1,29 @@
1
+ import { compileToolCatalog } from "./program/agent-tools.mjs";
2
+ import { DEFAULT_MAX_ROUNDS, DEFAULT_TOTAL_TOKENS, MAX_ROUNDS_HARD_CAP, createBudgetTracker, resolveBudget } from "./agent-runners/budget.mjs";
3
+ import { formatRecallForPrompt, isHandoffReadThroughEnabled, isMemoryArchiveEnabled, recallForHandoff } from "./agent-runners/memory-archive.mjs";
4
+ import { resolveEnv } from "./agent-runners/env-whitelist.mjs";
5
+ import { buildTemplateContext } from "./agent-runners/template-context.mjs";
6
+ import { runAIAgent } from "./agent-runners/ai-runner.mjs";
7
+ import { runAshAgent } from "./agent-runners/ash-runner.mjs";
8
+ import { runGuideRails } from "./agent-runners/guide-rails.mjs";
9
+ import { MEMORY_SCRATCH_ROOT, SCRATCH_SCOPE_ROOT, attachScratchMount, computeScratchLayout, createScratchProvider, provisionScratchViaAFS, teardownScratchViaAFS } from "./agent-runners/scratchpad-afs.mjs";
10
+ import { createHookChannel, persistHookEvents } from "./agent-runners/hook-channel.mjs";
11
+ import { createHookDispatcher, fireHook } from "./agent-runners/hooks.mjs";
12
+ import { MEMORY_SCOPE_ROOT, SESSION_MEMORY_STORAGE_KEY, attachMemoryMount, attachSessionIndex, attachSessionMemoryStorage, buildMemoryIndexOptsForAfs, buildMemoryStorageForAfs, clearAgentIndexAfsForTesting, clearAgentMemoryRootForTesting, clearMemoryProviderCacheForTesting, createMemoryProvider, isMemoryPath, mountManifestMemory, readSessionIndex, resolveMemoryDomain, setAgentIndexAfs, setAgentMemoryRoot } from "./agent-runners/memory-afs.mjs";
13
+ import { AGENTS_ROOT, MESSAGING_AGENTS_ROOT, MESSAGING_ROOT, MESSAGING_TOOLS_GLOB, MESSAGING_TOOLS_ROOT, agentMsgDir, getMessagingToolDefinitions, handlePostMessage, handleReadMessages } from "./program/agent-messages-tools.mjs";
14
+ import { CHAIN_DEPTH_HARD_CAP, ensureScopeWithMounts, normalizeManifestTools, projectForChild, resolveParentAgentScope, rootAgentScope, toJSON } from "./program/scoped-afs.mjs";
15
+ import { checkSpawnDepth, deriveChildSession } from "./program/session-hierarchy.mjs";
16
+ import { createStreamProgressRouter, detectUISessionPath } from "./agent-runners/stream-router.mjs";
17
+ import { extractBlockletId, sanitizeSystemAppend } from "./agent-runners/system-prompt.mjs";
18
+ import { runTeamAgent } from "./agent-runners/team-runner.mjs";
19
+ import { withRetry } from "./agent-runners/retry.mjs";
20
+ import { isJsonSafe, isSubAgentResult, sanitizeMetaEnv, sanitizeScratchPath, stripSubAgentMeta } from "./program/result-contract.mjs";
21
+ import { normalizeRunnerError } from "./program/runner-error.mjs";
22
+ import { createAgentActionHandlers } from "./program/agent-action.mjs";
23
+ import { getRunnerForType, registerAgentActions } from "./program/agent-runner-registry.mjs";
24
+ import { createInitialState, deserializeState, estimateTokens, serializeState, truncateHistory } from "./agent-runners/orchestrator-state.mjs";
25
+ import { runOrchestratorAgent } from "./agent-runners/orchestrator-runner.mjs";
26
+ import { registerAgentSubscribes } from "./program/agent-subscribe.mjs";
27
+ import { rebaseNestedManifest } from "./program/manifest-nesting.mjs";
28
+
29
+ export { AGENTS_ROOT, CHAIN_DEPTH_HARD_CAP, DEFAULT_MAX_ROUNDS, DEFAULT_TOTAL_TOKENS, MAX_ROUNDS_HARD_CAP, MEMORY_SCOPE_ROOT, MEMORY_SCRATCH_ROOT, MESSAGING_AGENTS_ROOT, MESSAGING_ROOT, MESSAGING_TOOLS_GLOB, MESSAGING_TOOLS_ROOT, SCRATCH_SCOPE_ROOT, SESSION_MEMORY_STORAGE_KEY, agentMsgDir, attachMemoryMount, attachScratchMount, attachSessionIndex, attachSessionMemoryStorage, buildMemoryIndexOptsForAfs, buildMemoryStorageForAfs, buildTemplateContext, checkSpawnDepth, clearAgentIndexAfsForTesting, clearAgentMemoryRootForTesting, clearMemoryProviderCacheForTesting, compileToolCatalog, computeScratchLayout, createAgentActionHandlers, createBudgetTracker, createHookChannel, createHookDispatcher, createInitialState, createMemoryProvider, createScratchProvider, createStreamProgressRouter, deriveChildSession, deserializeState, detectUISessionPath, ensureScopeWithMounts, estimateTokens, extractBlockletId, fireHook, formatRecallForPrompt, getMessagingToolDefinitions, getRunnerForType, handlePostMessage, handleReadMessages, isHandoffReadThroughEnabled, isJsonSafe, isMemoryArchiveEnabled, isMemoryPath, isSubAgentResult, mountManifestMemory, normalizeManifestTools, normalizeRunnerError, persistHookEvents, projectForChild, provisionScratchViaAFS, readSessionIndex, rebaseNestedManifest, recallForHandoff, registerAgentActions, registerAgentSubscribes, resolveBudget, resolveEnv, resolveMemoryDomain, resolveParentAgentScope, rootAgentScope, runAIAgent, runAshAgent, runGuideRails, runOrchestratorAgent, runTeamAgent, sanitizeMetaEnv, sanitizeScratchPath, sanitizeSystemAppend, toJSON as scopeToJSON, serializeState, setAgentIndexAfs, setAgentMemoryRoot, stripSubAgentMeta, teardownScratchViaAFS, truncateHistory, withRetry };