actoviq-agent-sdk 0.4.17 → 0.4.19

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 (265) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/src/codeact/codeActArtifacts.d.ts +18 -0
  3. package/dist/src/codeact/codeActArtifacts.d.ts.map +1 -1
  4. package/dist/src/codeact/codeActArtifacts.js +33 -0
  5. package/dist/src/codeact/codeActArtifacts.js.map +1 -1
  6. package/dist/src/codeact/codeActPolicy.d.ts +5 -0
  7. package/dist/src/codeact/codeActPolicy.d.ts.map +1 -1
  8. package/dist/src/codeact/codeActPolicy.js +15 -0
  9. package/dist/src/codeact/codeActPolicy.js.map +1 -1
  10. package/dist/src/codeact/codeActPrompt.d.ts +3 -1
  11. package/dist/src/codeact/codeActPrompt.d.ts.map +1 -1
  12. package/dist/src/codeact/codeActPrompt.js +17 -3
  13. package/dist/src/codeact/codeActPrompt.js.map +1 -1
  14. package/dist/src/codeact/codeActSdk.d.ts +22 -0
  15. package/dist/src/codeact/codeActSdk.d.ts.map +1 -0
  16. package/dist/src/codeact/codeActSdk.js +353 -0
  17. package/dist/src/codeact/codeActSdk.js.map +1 -0
  18. package/dist/src/codeact/codeActService.d.ts.map +1 -1
  19. package/dist/src/codeact/codeActService.js +50 -8
  20. package/dist/src/codeact/codeActService.js.map +1 -1
  21. package/dist/src/codeact/codeCellTool.js +6 -6
  22. package/dist/src/codeact/codeCellTool.js.map +1 -1
  23. package/dist/src/codeact/codeRuntime.d.ts +86 -0
  24. package/dist/src/codeact/codeRuntime.d.ts.map +1 -0
  25. package/dist/src/codeact/codeRuntime.js +77 -0
  26. package/dist/src/codeact/codeRuntime.js.map +1 -0
  27. package/dist/src/codeact/hostRpcDispatcher.d.ts +24 -1
  28. package/dist/src/codeact/hostRpcDispatcher.d.ts.map +1 -1
  29. package/dist/src/codeact/hostRpcDispatcher.js +97 -4
  30. package/dist/src/codeact/hostRpcDispatcher.js.map +1 -1
  31. package/dist/src/codeact/index.d.ts +4 -0
  32. package/dist/src/codeact/index.d.ts.map +1 -1
  33. package/dist/src/codeact/index.js +4 -0
  34. package/dist/src/codeact/index.js.map +1 -1
  35. package/dist/src/codeact/kernelPool.d.ts +2 -1
  36. package/dist/src/codeact/kernelPool.d.ts.map +1 -1
  37. package/dist/src/codeact/kernelPool.js +4 -1
  38. package/dist/src/codeact/kernelPool.js.map +1 -1
  39. package/dist/src/codeact/kernelProtocol.d.ts +4 -0
  40. package/dist/src/codeact/kernelProtocol.d.ts.map +1 -1
  41. package/dist/src/codeact/kernelProtocol.js +2 -1
  42. package/dist/src/codeact/kernelProtocol.js.map +1 -1
  43. package/dist/src/codeact/presentationTypes.d.ts +9 -0
  44. package/dist/src/codeact/presentationTypes.d.ts.map +1 -0
  45. package/dist/src/codeact/presentationTypes.js +11 -0
  46. package/dist/src/codeact/presentationTypes.js.map +1 -0
  47. package/dist/src/codeact/processKernelAdapter.d.ts.map +1 -1
  48. package/dist/src/codeact/processKernelAdapter.js +161 -42
  49. package/dist/src/codeact/processKernelAdapter.js.map +1 -1
  50. package/dist/src/codeact/programmaticToolRuntime.d.ts +51 -0
  51. package/dist/src/codeact/programmaticToolRuntime.d.ts.map +1 -0
  52. package/dist/src/codeact/programmaticToolRuntime.js +268 -0
  53. package/dist/src/codeact/programmaticToolRuntime.js.map +1 -0
  54. package/dist/src/codeact/pythonKernelProgram.d.ts.map +1 -1
  55. package/dist/src/codeact/pythonKernelProgram.js +205 -31
  56. package/dist/src/codeact/pythonKernelProgram.js.map +1 -1
  57. package/dist/src/codeact/runCodeTool.d.ts +20 -0
  58. package/dist/src/codeact/runCodeTool.d.ts.map +1 -0
  59. package/dist/src/codeact/runCodeTool.js +66 -0
  60. package/dist/src/codeact/runCodeTool.js.map +1 -0
  61. package/dist/src/codeact/subdispatchScheduler.d.ts +39 -0
  62. package/dist/src/codeact/subdispatchScheduler.d.ts.map +1 -0
  63. package/dist/src/codeact/subdispatchScheduler.js +239 -0
  64. package/dist/src/codeact/subdispatchScheduler.js.map +1 -0
  65. package/dist/src/codeact/toolPresentation.d.ts +30 -0
  66. package/dist/src/codeact/toolPresentation.d.ts.map +1 -0
  67. package/dist/src/codeact/toolPresentation.js +86 -0
  68. package/dist/src/codeact/toolPresentation.js.map +1 -0
  69. package/dist/src/codeact/tsSdkRenderer.d.ts +15 -0
  70. package/dist/src/codeact/tsSdkRenderer.d.ts.map +1 -0
  71. package/dist/src/codeact/tsSdkRenderer.js +203 -0
  72. package/dist/src/codeact/tsSdkRenderer.js.map +1 -0
  73. package/dist/src/codeact/types.d.ts +30 -1
  74. package/dist/src/codeact/types.d.ts.map +1 -1
  75. package/dist/src/codeact/workerThreadCodeRuntime.d.ts +31 -0
  76. package/dist/src/codeact/workerThreadCodeRuntime.d.ts.map +1 -0
  77. package/dist/src/codeact/workerThreadCodeRuntime.js +277 -0
  78. package/dist/src/codeact/workerThreadCodeRuntime.js.map +1 -0
  79. package/dist/src/config/agentProfileTypes.d.ts +3 -0
  80. package/dist/src/config/agentProfileTypes.d.ts.map +1 -1
  81. package/dist/src/config/agentProfiles.d.ts +4 -2
  82. package/dist/src/config/agentProfiles.d.ts.map +1 -1
  83. package/dist/src/config/agentProfiles.js +9 -1
  84. package/dist/src/config/agentProfiles.js.map +1 -1
  85. package/dist/src/config/hadamardHome.js +1 -0
  86. package/dist/src/config/hadamardHome.js.map +1 -1
  87. package/dist/src/config/modelContextWindow.d.ts +4 -2
  88. package/dist/src/config/modelContextWindow.d.ts.map +1 -1
  89. package/dist/src/config/modelContextWindow.js +15 -15
  90. package/dist/src/config/modelContextWindow.js.map +1 -1
  91. package/dist/src/config/projectSettings.d.ts +3 -0
  92. package/dist/src/config/projectSettings.d.ts.map +1 -1
  93. package/dist/src/config/projectSettings.js +10 -0
  94. package/dist/src/config/projectSettings.js.map +1 -1
  95. package/dist/src/config/resolveRuntimeConfig.d.ts.map +1 -1
  96. package/dist/src/config/resolveRuntimeConfig.js +24 -1
  97. package/dist/src/config/resolveRuntimeConfig.js.map +1 -1
  98. package/dist/src/contrib/contributionHost.d.ts +85 -0
  99. package/dist/src/contrib/contributionHost.d.ts.map +1 -0
  100. package/dist/src/contrib/contributionHost.js +361 -0
  101. package/dist/src/contrib/contributionHost.js.map +1 -0
  102. package/dist/src/contrib/contributionLoader.d.ts +26 -0
  103. package/dist/src/contrib/contributionLoader.d.ts.map +1 -0
  104. package/dist/src/contrib/contributionLoader.js +49 -0
  105. package/dist/src/contrib/contributionLoader.js.map +1 -0
  106. package/dist/src/contrib/contributionServices.d.ts +23 -0
  107. package/dist/src/contrib/contributionServices.d.ts.map +1 -0
  108. package/dist/src/contrib/contributionServices.js +21 -0
  109. package/dist/src/contrib/contributionServices.js.map +1 -0
  110. package/dist/src/device-link/providerShare.d.ts +20 -0
  111. package/dist/src/device-link/providerShare.d.ts.map +1 -0
  112. package/dist/src/device-link/providerShare.js +39 -0
  113. package/dist/src/device-link/providerShare.js.map +1 -0
  114. package/dist/src/events/codeActEvents.d.ts +20 -0
  115. package/dist/src/events/codeActEvents.d.ts.map +1 -1
  116. package/dist/src/gui/guiBridgeContextClientScript.d.ts +2 -0
  117. package/dist/src/gui/guiBridgeContextClientScript.d.ts.map +1 -0
  118. package/dist/src/gui/guiBridgeContextClientScript.js +54 -0
  119. package/dist/src/gui/guiBridgeContextClientScript.js.map +1 -0
  120. package/dist/src/gui/guiChatHttpController.d.ts +1 -1
  121. package/dist/src/gui/guiChatHttpController.d.ts.map +1 -1
  122. package/dist/src/gui/guiChatHttpController.js +2 -2
  123. package/dist/src/gui/guiChatHttpController.js.map +1 -1
  124. package/dist/src/gui/guiSessionClientScript.d.ts.map +1 -1
  125. package/dist/src/gui/guiSessionClientScript.js +9 -4
  126. package/dist/src/gui/guiSessionClientScript.js.map +1 -1
  127. package/dist/src/gui/hadamardGui.d.ts.map +1 -1
  128. package/dist/src/gui/hadamardGui.js +96 -30
  129. package/dist/src/gui/hadamardGui.js.map +1 -1
  130. package/dist/src/gui/hadamardGuiAssets.d.ts.map +1 -1
  131. package/dist/src/gui/hadamardGuiAssets.js +211 -116
  132. package/dist/src/gui/hadamardGuiAssets.js.map +1 -1
  133. package/dist/src/index.d.ts +18 -0
  134. package/dist/src/index.d.ts.map +1 -1
  135. package/dist/src/index.js +9 -0
  136. package/dist/src/index.js.map +1 -1
  137. package/dist/src/memory/hadamardTranscriptLogger.d.ts +7 -0
  138. package/dist/src/memory/hadamardTranscriptLogger.d.ts.map +1 -1
  139. package/dist/src/memory/hadamardTranscriptLogger.js +20 -0
  140. package/dist/src/memory/hadamardTranscriptLogger.js.map +1 -1
  141. package/dist/src/plugins/managedContributions.d.ts +12 -0
  142. package/dist/src/plugins/managedContributions.d.ts.map +1 -0
  143. package/dist/src/plugins/managedContributions.js +96 -0
  144. package/dist/src/plugins/managedContributions.js.map +1 -0
  145. package/dist/src/plugins/managedPluginRuntime.d.ts.map +1 -1
  146. package/dist/src/plugins/managedPluginRuntime.js +4 -42
  147. package/dist/src/plugins/managedPluginRuntime.js.map +1 -1
  148. package/dist/src/provider/client.d.ts +13 -1
  149. package/dist/src/provider/client.d.ts.map +1 -1
  150. package/dist/src/provider/client.js +23 -11
  151. package/dist/src/provider/client.js.map +1 -1
  152. package/dist/src/provider/openai-client.d.ts +8 -0
  153. package/dist/src/provider/openai-client.d.ts.map +1 -1
  154. package/dist/src/provider/openai-client.js +16 -7
  155. package/dist/src/provider/openai-client.js.map +1 -1
  156. package/dist/src/provider/openai-model-api.d.ts +2 -1
  157. package/dist/src/provider/openai-model-api.d.ts.map +1 -1
  158. package/dist/src/provider/openai-model-api.js +2 -1
  159. package/dist/src/provider/openai-model-api.js.map +1 -1
  160. package/dist/src/provider/retryPolicy.d.ts +42 -0
  161. package/dist/src/provider/retryPolicy.d.ts.map +1 -0
  162. package/dist/src/provider/retryPolicy.js +67 -0
  163. package/dist/src/provider/retryPolicy.js.map +1 -0
  164. package/dist/src/runtime/agentClient.d.ts +10 -0
  165. package/dist/src/runtime/agentClient.d.ts.map +1 -1
  166. package/dist/src/runtime/agentClient.js +191 -44
  167. package/dist/src/runtime/agentClient.js.map +1 -1
  168. package/dist/src/runtime/agentSession.d.ts +13 -0
  169. package/dist/src/runtime/agentSession.d.ts.map +1 -1
  170. package/dist/src/runtime/agentSession.js +32 -1
  171. package/dist/src/runtime/agentSession.js.map +1 -1
  172. package/dist/src/runtime/codeDispatchTranscript.d.ts +23 -0
  173. package/dist/src/runtime/codeDispatchTranscript.d.ts.map +1 -0
  174. package/dist/src/runtime/codeDispatchTranscript.js +26 -0
  175. package/dist/src/runtime/codeDispatchTranscript.js.map +1 -0
  176. package/dist/src/runtime/conversationEngine.d.ts.map +1 -1
  177. package/dist/src/runtime/conversationEngine.js +622 -160
  178. package/dist/src/runtime/conversationEngine.js.map +1 -1
  179. package/dist/src/runtime/conversationExtensions.d.ts +10 -0
  180. package/dist/src/runtime/conversationExtensions.d.ts.map +1 -0
  181. package/dist/src/runtime/conversationExtensions.js +156 -0
  182. package/dist/src/runtime/conversationExtensions.js.map +1 -0
  183. package/dist/src/runtime/conversationPorts.d.ts +56 -1
  184. package/dist/src/runtime/conversationPorts.d.ts.map +1 -1
  185. package/dist/src/runtime/conversationToolBatch.d.ts +60 -1
  186. package/dist/src/runtime/conversationToolBatch.d.ts.map +1 -1
  187. package/dist/src/runtime/conversationToolBatch.js +194 -0
  188. package/dist/src/runtime/conversationToolBatch.js.map +1 -1
  189. package/dist/src/runtime/conversationToolExecutor.d.ts +7 -0
  190. package/dist/src/runtime/conversationToolExecutor.d.ts.map +1 -1
  191. package/dist/src/runtime/conversationToolExecutor.js +106 -60
  192. package/dist/src/runtime/conversationToolExecutor.js.map +1 -1
  193. package/dist/src/runtime/dynamicSkillRegistry.d.ts +17 -0
  194. package/dist/src/runtime/dynamicSkillRegistry.d.ts.map +1 -0
  195. package/dist/src/runtime/dynamicSkillRegistry.js +51 -0
  196. package/dist/src/runtime/dynamicSkillRegistry.js.map +1 -0
  197. package/dist/src/runtime/externalSkillRuntime.js +7 -0
  198. package/dist/src/runtime/externalSkillRuntime.js.map +1 -1
  199. package/dist/src/runtime/hadamardCompact.d.ts +2 -52
  200. package/dist/src/runtime/hadamardCompact.d.ts.map +1 -1
  201. package/dist/src/runtime/hadamardCompact.js +51 -12
  202. package/dist/src/runtime/hadamardCompact.js.map +1 -1
  203. package/dist/src/runtime/hadamardModelApi.d.ts +2 -1
  204. package/dist/src/runtime/hadamardModelApi.d.ts.map +1 -1
  205. package/dist/src/runtime/hadamardModelApi.js +2 -1
  206. package/dist/src/runtime/hadamardModelApi.js.map +1 -1
  207. package/dist/src/runtime/hadamardSkills.d.ts +1 -0
  208. package/dist/src/runtime/hadamardSkills.d.ts.map +1 -1
  209. package/dist/src/runtime/hadamardSkills.js +25 -5
  210. package/dist/src/runtime/hadamardSkills.js.map +1 -1
  211. package/dist/src/runtime/modelRequestPolicy.d.ts +6 -0
  212. package/dist/src/runtime/modelRequestPolicy.d.ts.map +1 -1
  213. package/dist/src/runtime/modelRequestPolicy.js +25 -0
  214. package/dist/src/runtime/modelRequestPolicy.js.map +1 -1
  215. package/dist/src/runtime/repeatCallGuard.d.ts +39 -0
  216. package/dist/src/runtime/repeatCallGuard.d.ts.map +1 -0
  217. package/dist/src/runtime/repeatCallGuard.js +90 -0
  218. package/dist/src/runtime/repeatCallGuard.js.map +1 -0
  219. package/dist/src/runtime/requestProposalPolicy.d.ts +14 -0
  220. package/dist/src/runtime/requestProposalPolicy.d.ts.map +1 -0
  221. package/dist/src/runtime/requestProposalPolicy.js +37 -0
  222. package/dist/src/runtime/requestProposalPolicy.js.map +1 -0
  223. package/dist/src/runtime/surfaceProjection.d.ts +43 -0
  224. package/dist/src/runtime/surfaceProjection.d.ts.map +1 -0
  225. package/dist/src/runtime/surfaceProjection.js +77 -0
  226. package/dist/src/runtime/surfaceProjection.js.map +1 -0
  227. package/dist/src/runtime/toolPolicyPipeline.d.ts +79 -0
  228. package/dist/src/runtime/toolPolicyPipeline.d.ts.map +1 -0
  229. package/dist/src/runtime/toolPolicyPipeline.js +136 -0
  230. package/dist/src/runtime/toolPolicyPipeline.js.map +1 -0
  231. package/dist/src/runtime/tools.d.ts.map +1 -1
  232. package/dist/src/runtime/tools.js +1 -0
  233. package/dist/src/runtime/tools.js.map +1 -1
  234. package/dist/src/runtime/trajectoryEvents.d.ts +131 -0
  235. package/dist/src/runtime/trajectoryEvents.d.ts.map +1 -0
  236. package/dist/src/runtime/trajectoryEvents.js +2 -0
  237. package/dist/src/runtime/trajectoryEvents.js.map +1 -0
  238. package/dist/src/sandbox/sandboxExecutor.js +10 -0
  239. package/dist/src/sandbox/sandboxExecutor.js.map +1 -1
  240. package/dist/src/storage/sessionCatalog.d.ts +2 -1
  241. package/dist/src/storage/sessionCatalog.d.ts.map +1 -1
  242. package/dist/src/storage/sessionCatalog.js +4 -3
  243. package/dist/src/storage/sessionCatalog.js.map +1 -1
  244. package/dist/src/tui/hadamardTuiController.d.ts.map +1 -1
  245. package/dist/src/tui/hadamardTuiController.js +65 -12
  246. package/dist/src/tui/hadamardTuiController.js.map +1 -1
  247. package/dist/src/tui/tuiConfigurationCommandHandler.d.ts +1 -0
  248. package/dist/src/tui/tuiConfigurationCommandHandler.d.ts.map +1 -1
  249. package/dist/src/tui/tuiConfigurationCommandHandler.js +3 -0
  250. package/dist/src/tui/tuiConfigurationCommandHandler.js.map +1 -1
  251. package/dist/src/tui/tuiInputController.d.ts +11 -0
  252. package/dist/src/tui/tuiInputController.d.ts.map +1 -1
  253. package/dist/src/tui/tuiInputController.js +39 -2
  254. package/dist/src/tui/tuiInputController.js.map +1 -1
  255. package/dist/src/tui/tuiOnboarding.d.ts +7 -0
  256. package/dist/src/tui/tuiOnboarding.d.ts.map +1 -1
  257. package/dist/src/tui/tuiOnboarding.js +33 -17
  258. package/dist/src/tui/tuiOnboarding.js.map +1 -1
  259. package/dist/src/types.d.ts +185 -1
  260. package/dist/src/types.d.ts.map +1 -1
  261. package/dist/src/types.js.map +1 -1
  262. package/dist/src/ui/commandSurface.d.ts.map +1 -1
  263. package/dist/src/ui/commandSurface.js +1 -0
  264. package/dist/src/ui/commandSurface.js.map +1 -1
  265. package/package.json +3 -1
package/CHANGELOG.md CHANGED
@@ -6,6 +6,15 @@ The format is based on Keep a Changelog, with automated updates from GitHub Rele
6
6
 
7
7
  ## Unreleased
8
8
 
9
+ ## v0.4.18 - 2026-08-16
10
+
11
+ ### Features
12
+
13
+ - Rename the Bridge tab to Configuration, move it above Agents, and manage local runtime discovery and login checks there
14
+ - Redesign the Devices tab with card headers, status pills, permission scope chips, and clearer pairing and paired-device sections
15
+
16
+ **Full Changelog**: https://github.com/DeconBear/hadamard/compare/v0.4.17...v0.4.18
17
+
9
18
  ## v0.4.17 - 2026-08-14
10
19
 
11
20
  ### Fixes
@@ -8,4 +8,22 @@ export declare class CodeActArtifactRecorder {
8
8
  mediaType: string;
9
9
  }): Promise<CodeActArtifactReference>;
10
10
  }
11
+ /**
12
+ * Spill oversized cell output to a session-scoped artifact and replace the
13
+ * model-facing streams with a bounded head/tail preview plus the locator
14
+ * (dsh spill-policy shape). Best-effort: a write failure keeps the inline
15
+ * content unchanged and never turns the cell result into an error.
16
+ */
17
+ export declare function spillOversizedCellOutput(options: {
18
+ artifacts: CodeActArtifactRecorder;
19
+ workDir: string;
20
+ sessionId: string;
21
+ executionId: string;
22
+ maxChars: number;
23
+ result: {
24
+ stdout: string;
25
+ stderr: string;
26
+ artifacts: CodeActArtifactReference[];
27
+ };
28
+ }): Promise<void>;
11
29
  //# sourceMappingURL=codeActArtifacts.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"codeActArtifacts.d.ts","sourceRoot":"","sources":["../../../src/codeact/codeActArtifacts.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAEpF,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED,qBAAa,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,OAAO,CAAC,IAAI,CAAC,CA4BhB"}
@@ -44,4 +44,37 @@ function isAlreadyExists(error) {
44
44
  function safeSegment(value) {
45
45
  return value.replace(/[^A-Za-z0-9_.-]+/g, '_').slice(0, 100) || 'artifact';
46
46
  }
47
+ /**
48
+ * Spill oversized cell output to a session-scoped artifact and replace the
49
+ * model-facing streams with a bounded head/tail preview plus the locator
50
+ * (dsh spill-policy shape). Best-effort: a write failure keeps the inline
51
+ * content unchanged and never turns the cell result into an error.
52
+ */
53
+ export async function spillOversizedCellOutput(options) {
54
+ const combined = options.result.stderr
55
+ ? options.result.stdout + '\n--- stderr ---\n' + options.result.stderr
56
+ : options.result.stdout;
57
+ if (combined.length <= options.maxChars)
58
+ return;
59
+ const artifact = await options.artifacts.putHostArtifact(options.workDir, options.sessionId, {
60
+ name: 'cell-output-' + safeSegment(options.executionId) + '.txt',
61
+ content: combined,
62
+ mediaType: 'text/plain',
63
+ }).catch(() => undefined);
64
+ if (!artifact)
65
+ return;
66
+ // Reserve the notice bytes INSIDE the budget so preview + locator never
67
+ // exceed maxChars (dsh spill-policy reservation rule).
68
+ const notice = 'Full cell output stored at: ' + artifact.path + ' (read it with the Read tool when you need the omitted middle).';
69
+ const budget = Math.max(0, options.maxChars - notice.length - 2);
70
+ const headChars = Math.floor(budget / 2);
71
+ const tailChars = Math.max(0, budget - headChars);
72
+ const omitted = Math.max(0, combined.length - headChars - tailChars);
73
+ const preview = combined.slice(0, headChars)
74
+ + (omitted > 0 ? '\n...[omitted ' + omitted + ' chars]...\n' : '\n')
75
+ + combined.slice(-tailChars);
76
+ options.result.stdout = preview + '\n' + notice;
77
+ options.result.stderr = '';
78
+ options.result.artifacts.push(artifact);
79
+ }
47
80
  //# sourceMappingURL=codeActArtifacts.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"codeActArtifacts.js","sourceRoot":"","sources":["../../../src/codeact/codeActArtifacts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAA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AE,CAAC,SAAS,CAAC,CAAC;IACzB,IAAI,CAAC,QAAQ;QAAE,OAAO;IACtB,wEAAwE;IACxE,uDAAuD;IACvD,MAAM,MAAM,GAAG,8BAA8B,GAAG,QAAQ,CAAC,IAAI,GAAG,iEAAiE,CAAC;IAClI,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,QAAQ,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACjE,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACzC,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IAClD,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,CAAC,MAAM,GAAG,SAAS,GAAG,SAAS,CAAC,CAAC;IACrE,MAAM,OAAO,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC;UACxC,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,gBAAgB,GAAG,OAAO,GAAG,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC;UAClE,QAAQ,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,CAAC;IAC/B,OAAO,CAAC,MAAM,CAAC,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,MAAM,CAAC;IAChD,OAAO,CAAC,MAAM,CAAC,MAAM,GAAG,EAAE,CAAC;IAC3B,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AAC1C,CAAC"}
@@ -6,4 +6,9 @@ export declare class CodeActConfigurationError extends HadamardSdkError {
6
6
  export declare function resolveCodeActSettings(input: CodeActSettings): ResolvedCodeActSettings;
7
7
  export declare function buildCodeActEnvironment(allowlist: readonly string[], source?: NodeJS.ProcessEnv): Record<string, string>;
8
8
  export declare function assertCodeActBackend(settings: ResolvedCodeActSettings, adapter: CodeActKernelAdapter): Promise<CodeActBackendStatus>;
9
+ /**
10
+ * Assert the worker-thread PTC backend: it is containment, not a security
11
+ * boundary, so enforce mode (which requires strong isolation) refuses it.
12
+ */
13
+ export declare function assertWorkerThreadPtcBackend(settings: ResolvedCodeActSettings): void;
9
14
  //# sourceMappingURL=codeActPolicy.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"codeActPolicy.d.ts","sourceRoot":"","sources":["../../../src/codeact/codeActPolicy.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,KAAK,EACV,oBAAoB,EACpB,oBAAoB,EACpB,eAAe,EACf,uBAAuB,EACxB,MAAM,YAAY,CAAC;AAOpB,qBAAa,yBAA0B,SAAQ,gBAAgB;gBACjD,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,kBAAkB,GAAG,6BAA6B,GAAG,wBAAwB;CAGjH;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,eAAe,GAAG,uBAAuB,CActF;AAED,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,SAAS,MAAM,EAAE,EAC5B,MAAM,GAAE,MAAM,CAAC,UAAwB,GACtC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAYxB;AAED,wBAAsB,oBAAoB,CACxC,QAAQ,EAAE,uBAAuB,EACjC,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,oBAAoB,CAAC,CAe/B"}
1
+ {"version":3,"file":"codeActPolicy.d.ts","sourceRoot":"","sources":["../../../src/codeact/codeActPolicy.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,KAAK,EACV,oBAAoB,EACpB,oBAAoB,EACpB,eAAe,EACf,uBAAuB,EACxB,MAAM,YAAY,CAAC;AAOpB,qBAAa,yBAA0B,SAAQ,gBAAgB;gBACjD,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,kBAAkB,GAAG,6BAA6B,GAAG,wBAAwB;CAGjH;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,eAAe,GAAG,uBAAuB,CAsBtF;AAED,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,SAAS,MAAM,EAAE,EAC5B,MAAM,GAAE,MAAM,CAAC,UAAwB,GACtC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAYxB;AAED,wBAAsB,oBAAoB,CACxC,QAAQ,EAAE,uBAAuB,EACjC,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,oBAAoB,CAAC,CAe/B;AAgBD;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,QAAQ,EAAE,uBAAuB,GAAG,IAAI,CAUpF"}
@@ -13,15 +13,18 @@ export function resolveCodeActSettings(input) {
13
13
  return {
14
14
  enabled: input.enabled,
15
15
  backend: input.backend ?? 'process',
16
+ ptcBackend: input.ptcBackend ?? input.backend ?? 'process',
16
17
  securityMode: input.securityMode ?? 'trusted',
17
18
  pythonCommand: input.pythonCommand?.trim() || (process.platform === 'win32' ? 'python' : 'python3'),
18
19
  idleTimeoutMs: clampInteger(input.idleTimeoutMs, 60_000, 1_000, 3_600_000),
19
20
  executionTimeoutMs: clampInteger(input.executionTimeoutMs, 120_000, 100, 3_600_000),
20
21
  maxOutputChars: clampInteger(input.maxOutputChars, 80_000, 1_000, 10_000_000),
22
+ maxOutputBytes: clampInteger(input.maxOutputBytes, (input.maxOutputChars ?? 80_000) * 4, 1_000, 40_000_000),
21
23
  environmentAllowlist: uniqueStrings(input.environmentAllowlist ?? []),
22
24
  containerImage: input.containerImage?.trim() || 'python:3.12-alpine',
23
25
  containerMemoryMb: clampInteger(input.containerMemoryMb, 512, 64, 32_768),
24
26
  containerCpuLimit: clampNumber(input.containerCpuLimit, 1, 0.1, 64),
27
+ maxParallelSubCalls: clampInteger(input.maxParallelSubCalls, 10, 1, 32),
25
28
  };
26
29
  }
27
30
  export function buildCodeActEnvironment(allowlist, source = process.env) {
@@ -65,4 +68,16 @@ function clampNumber(value, fallback, min, max) {
65
68
  return fallback;
66
69
  return Math.min(max, Math.max(min, value));
67
70
  }
71
+ /**
72
+ * Assert the worker-thread PTC backend: it is containment, not a security
73
+ * boundary, so enforce mode (which requires strong isolation) refuses it.
74
+ */
75
+ export function assertWorkerThreadPtcBackend(settings) {
76
+ if (!settings.enabled) {
77
+ throw new CodeActConfigurationError('CodeAct is disabled for this project.', 'CODEACT_DISABLED');
78
+ }
79
+ if (settings.securityMode === 'enforce') {
80
+ throw new CodeActConfigurationError('CodeAct enforce mode requires a strong-isolation container backend; the worker-thread backend is containment only.', 'CODEACT_UNSAFE_BACKEND');
81
+ }
82
+ }
68
83
  //# sourceMappingURL=codeActPolicy.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"codeActPolicy.js","sourceRoot":"","sources":["../../../src/codeact/codeActPolicy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AAEzB,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAQhD,MAAM,kBAAkB,GAAG,sDAAsD,CAAC;AAClF,MAAM,gBAAgB,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO;IACnD,CAAC,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,CAAC;IACpE,CAAC,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;AAErD,MAAM,OAAO,yBAA0B,SAAQ,gBAAgB;IAC7D,YAAY,OAAe,EAAE,IAAmF;QAC9G,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IACvB,CAAC;CACF;AAED,MAAM,UAAU,sBAAsB,CAAC,KAAsB;IAC3D,OAAO;QACL,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,OAAO,EAA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S,aAAa,CAAC,MAAyB;IAC9C,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AACzE,CAAC;AAED,SAAS,YAAY,CAAC,KAAyB,EAAE,QAAgB,EAAE,GAAW,EAAE,GAAW;IACzF,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,QAAQ,CAAC;IAC7C,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,KAAM,CAAC,CAAC,CAAC,CAAC;AAC1D,CAAC;AAED,SAAS,WAAW,CAAC,KAAyB,EAAE,QAAgB,EAAE,GAAW,EAAE,GAAW;IACxF,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,QAAQ,CAAC;IAC7C,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,KAAM,CAAC,CAAC,CAAC;AAC9C,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,4BAA4B,CAAC,QAAiC;IAC5E,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;QACtB,MAAM,IAAI,yBAAyB,CAAC,uCAAuC,EAAE,kBAAkB,CAAC,CAAC;IACnG,CAAC;IACD,IAAI,QAAQ,CAAC,YAAY,KAAK,SAAS,EAAE,CAAC;QACxC,MAAM,IAAI,yBAAyB,CACjC,oHAAoH,EACpH,wBAAwB,CACzB,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -2,7 +2,9 @@ import type { AgentExecutionPolicy } from '../runtime/agentExecutionPolicy.js';
2
2
  import type { AgentToolDefinition } from '../types.js';
3
3
  export interface AgentModePromptCapabilities {
4
4
  hostCapabilities?: readonly string[];
5
+ /** Rendered typed host-tool stubs (CodeAct SDK section) for codeact/hybrid modes. */
6
+ hostSdk?: string;
5
7
  }
6
- export declare function buildAgentModePrompt(policy: AgentExecutionPolicy, capabilities?: AgentModePromptCapabilities): string;
8
+ export declare function buildAgentModePrompt(policy: AgentExecutionPolicy, capabilities?: AgentModePromptCapabilities, presentation?: 'native' | 'ptc' | 'both'): string;
7
9
  export declare function filterToolsForExecutionPolicy(tools: readonly AgentToolDefinition[], policy: AgentExecutionPolicy): AgentToolDefinition[];
8
10
  //# sourceMappingURL=codeActPrompt.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"codeActPrompt.d.ts","sourceRoot":"","sources":["../../../src/codeact/codeActPrompt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC/E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAGvD,MAAM,WAAW,2BAA2B;IAC1C,gBAAgB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACtC;AAED,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,oBAAoB,EAC5B,YAAY,GAAE,2BAAgC,GAC7C,MAAM,CAwBR;AAED,wBAAgB,6BAA6B,CAC3C,KAAK,EAAE,SAAS,mBAAmB,EAAE,EACrC,MAAM,EAAE,oBAAoB,GAC3B,mBAAmB,EAAE,CAOvB"}
1
+ {"version":3,"file":"codeActPrompt.d.ts","sourceRoot":"","sources":["../../../src/codeact/codeActPrompt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC/E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAGvD,MAAM,WAAW,2BAA2B;IAC1C,gBAAgB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,qFAAqF;IACrF,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,oBAAoB,EAC5B,YAAY,GAAE,2BAAgC,EAC9C,YAAY,GAAE,QAAQ,GAAG,KAAK,GAAG,MAAiB,GACjD,MAAM,CAiCR;AAED,wBAAgB,6BAA6B,CAC3C,KAAK,EAAE,SAAS,mBAAmB,EAAE,EACrC,MAAM,EAAE,oBAAoB,GAC3B,mBAAmB,EAAE,CAOvB"}
@@ -1,5 +1,5 @@
1
1
  import { CODE_CELL_TOOL_NAME } from './codeCellTool.js';
2
- export function buildAgentModePrompt(policy, capabilities = {}) {
2
+ export function buildAgentModePrompt(policy, capabilities = {}, presentation = 'native') {
3
3
  if (policy.turnPolicy === 'single') {
4
4
  if (policy.actionSpace === 'none') {
5
5
  return 'Answer this node once and finish directly. No tools are available.';
@@ -10,8 +10,18 @@ export function buildAgentModePrompt(policy, capabilities = {}) {
10
10
  'After that result, produce the final answer immediately. Do not start another tool call.',
11
11
  ].join('\n');
12
12
  }
13
+ // Under the ptc presentation the wire carries only run_code, so
14
+ // code-cell/hybrid guidance would name tools the model cannot call and
15
+ // duplicate the SDK the presentation instructions already carry.
16
+ if (presentation === 'ptc')
17
+ return '';
18
+ // Under 'both' the presentation instructions own the SDK section; keep
19
+ // the mode guidance but drop the duplicate host SDK.
20
+ const effective = presentation === 'both'
21
+ ? { ...capabilities, hostSdk: undefined }
22
+ : capabilities;
13
23
  if (policy.actionSpace === 'code-cell') {
14
- return codeCellInstructions(capabilities);
24
+ return codeCellInstructions(effective);
15
25
  }
16
26
  if (policy.actionSpace === 'hybrid') {
17
27
  return [
@@ -19,7 +29,7 @@ export function buildAgentModePrompt(policy, capabilities = {}) {
19
29
  'Use ordinary JSON tools for deterministic metadata, permission-sensitive filesystem actions, external services, and one-step host operations.',
20
30
  'Use CodeCell for loops, data transformations, mathematical work, experiments, and multi-step computation.',
21
31
  'Prefer ordinary structured calls before CodeCell when both would mutate the same state in one action group.',
22
- codeCellInstructions(capabilities),
32
+ codeCellInstructions(effective),
23
33
  ].join('\n\n');
24
34
  }
25
35
  return '';
@@ -38,11 +48,15 @@ function codeCellInstructions(capabilities) {
38
48
  const host = capabilities.hostCapabilities?.length
39
49
  ? `Allowed host RPC capabilities: ${capabilities.hostCapabilities.join(', ')}.`
40
50
  : 'Host RPC capabilities are explicit and may be unavailable; never assume direct access to provider credentials.';
51
+ const sdk = capabilities.hostSdk?.trim()
52
+ ? `Typed host-tool surface reachable from CodeCell code (signatures are authoritative for parameter names):\n${capabilities.hostSdk}`
53
+ : '';
41
54
  return [
42
55
  'Use CodeCell with language="python" and executable Python source.',
43
56
  'The namespace persists for this session until a restart, crash, interrupt, or idle cleanup changes the generation.',
44
57
  'Inspect stdout, stderr, the structured final-expression result, artifact references, and stateLost after every cell.',
45
58
  host,
59
+ ...(sdk ? [sdk] : []),
46
60
  'Keep cells auditable and bounded. Finish only when the requested observable result is verified.',
47
61
  ].join('\n');
48
62
  }
@@ -1 +1 @@
1
- {"version":3,"file":"codeActPrompt.js","sourceRoot":"","sources":["../../../src/codeact/codeActPrompt.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAMxD,MAAM,UAAU,oBAAoB,CAClC,MAA4B,EAC5B,eAA4C,EAAE;IAE9C,IAAI,MAAM,CAAC,UAAU,KAAK,QAAQ,EAAE,CAAC;QACnC,IAAI,MAAM,CAAC,WAAW,KAAK,MAAM,EAAE,CAAC;YAClC,OAAO,oEAAoE,CAAC;QAC9E,CAAC;QACD,OAAO;YACL,qCAAqC;YACrC,2CAA2C,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,GAAG;YACrE,0FAA0F;SAC3F,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACf,CAAC;IACD,IAAI,MAAM,CAAC,WAAW,KAAK,WAAW,EAAE,CAAC;QACvC,OAAO,oBAAoB,CAAC,YAAY,CAAC,CAAC;IAC5C,CAAC;IACD,IAAI,MAAM,CAAC,WAAW,KAAK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{ AgentToolDefinition } from '../types.js';
2
+ /** Fixed HadamardHost methods the kernel already implements directly. */
3
+ export declare const RESERVED_HOST_METHODS: ReadonlySet<string>;
4
+ /** Default SDK section size cap before folding kicks in. */
5
+ export declare const DEFAULT_MAX_SDK_CHARS = 24000;
6
+ export interface CodeActSdkRenderOptions {
7
+ /** Fold docstrings (then truncate the tool list) beyond this size. */
8
+ maxChars?: number;
9
+ }
10
+ /** Deterministic sanitization shared by the renderer and the kernel tool map. */
11
+ export declare function sanitizeCodeActName(name: string): string;
12
+ /**
13
+ * Render the typed host-tool stubs for the given tools (CodeCell itself is
14
+ * excluded). Stable byte-for-byte output for a stable tool set: tools are
15
+ * sorted by name and schema fields render in declaration order.
16
+ */
17
+ export declare function renderCodeActHostSdk(tools: readonly AgentToolDefinition[], options?: CodeActSdkRenderOptions): string;
18
+ /** Build the collision-safe typed-method dispatch map used by the kernel. */
19
+ export declare function buildCodeActToolNameMap(tools: readonly AgentToolDefinition[]): Record<string, string>;
20
+ /** Render one JSON Schema node as a Python type annotation (bounded depth). */
21
+ export declare function jsonSchemaToPythonType(schema: unknown, depth?: number): string;
22
+ //# sourceMappingURL=codeActSdk.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codeActSdk.d.ts","sourceRoot":"","sources":["../../../src/codeact/codeActSdk.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAsBvD,yEAAyE;AACzE,eAAO,MAAM,qBAAqB,EAAE,WAAW,CAAC,MAAM,CAEpD,CAAC;AAIH,4DAA4D;AAC5D,eAAO,MAAM,qBAAqB,QAAS,CAAC;AAI5C,MAAM,WAAW,uBAAuB;IACtC,sEAAsE;IACtE,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,iFAAiF;AACjF,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAKxD;AAgBD;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,SAAS,mBAAmB,EAAE,EACrC,OAAO,GAAE,uBAA4B,GACpC,MAAM,CA6HR;AA2DD,6EAA6E;AAC7E,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,SAAS,mBAAmB,EAAE,GACpC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAUxB;AA4CD,+EAA+E;AAC/E,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,SAAI,GAAG,MAAM,CAoCzE"}
@@ -0,0 +1,353 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * CodeAct typed host-tool SDK generation: projects host tool schemas into
4
+ * Python stub text the model programs against inside CodeCell code (the dsh
5
+ * tools:sdk equivalent for the Python kernel). One source of truth is the
6
+ * tool definition (inputSchema + outputSchema), so a stub can never drift
7
+ * from the dispatch surface.
8
+ *
9
+ * @module src/codeact/codeActSdk
10
+ */
11
+ const PYTHON_IDENTIFIER = /^[A-Za-z_][A-Za-z0-9_]*$/;
12
+ const PYTHON_KEYWORDS = new Set([
13
+ 'False', 'None', 'True', 'and', 'as', 'assert', 'async', 'await', 'break',
14
+ 'class', 'continue', 'def', 'del', 'elif', 'else', 'except', 'finally',
15
+ 'for', 'from', 'global', 'if', 'import', 'in', 'is', 'lambda', 'nonlocal',
16
+ 'not', 'or', 'pass', 'raise', 'return', 'try', 'while', 'with', 'yield',
17
+ 'match', 'case', 'type',
18
+ ]);
19
+ /** Fixed HadamardHost methods the kernel already implements directly. */
20
+ export const RESERVED_HOST_METHODS = new Set([
21
+ 'call', 'tool', 'tool_schema', 'artifact', 'read', 'write', 'search',
22
+ ]);
23
+ /** Nesting cap: beyond this a schema node degrades to a broad type. */
24
+ const MAX_RENDER_DEPTH = 4;
25
+ /** Default SDK section size cap before folding kicks in. */
26
+ export const DEFAULT_MAX_SDK_CHARS = 24_000;
27
+ /** Docstring cap per tool. */
28
+ const MAX_DOC_CHARS = 280;
29
+ /** Deterministic sanitization shared by the renderer and the kernel tool map. */
30
+ export function sanitizeCodeActName(name) {
31
+ let out = name.replace(/[^A-Za-z0-9_]+/g, '_');
32
+ if (!/^[A-Za-z_]/.test(out))
33
+ out = `_${out}`;
34
+ if (PYTHON_KEYWORDS.has(out))
35
+ out = `${out}_`;
36
+ return /^_*$/.test(out) ? 'tool' : out;
37
+ }
38
+ /**
39
+ * Render the typed host-tool stubs for the given tools (CodeCell itself is
40
+ * excluded). Stable byte-for-byte output for a stable tool set: tools are
41
+ * sorted by name and schema fields render in declaration order.
42
+ */
43
+ export function renderCodeActHostSdk(tools, options = {}) {
44
+ const maxChars = options.maxChars ?? DEFAULT_MAX_SDK_CHARS;
45
+ const stubs = [];
46
+ const reservedNotes = [];
47
+ const sortedTools = [...tools].sort((left, right) => left.name.localeCompare(right.name));
48
+ const sanitizedCounts = countDynamicMethodNames(sortedTools);
49
+ const visibleTools = sortedTools.filter((tool) => tool.name !== 'CodeCell' && tool.name !== 'run_code');
50
+ const untypedCount = visibleTools.filter((tool) => !tool.outputSchema).length;
51
+ for (const tool of sortedTools) {
52
+ if (tool.name === 'CodeCell' || tool.name === 'run_code')
53
+ continue;
54
+ const fixedMethodName = FIXED_HELPER_METHODS[tool.name];
55
+ if (fixedMethodName) {
56
+ stubs.push({
57
+ methodName: fixedMethodName,
58
+ realName: tool.name,
59
+ signature: renderToolSignature(tool, fixedMethodName),
60
+ doc: `${collapseDoc(tool.description)} Host tool: ${tool.name}.`,
61
+ purpose: oneLinePurpose(tool.description),
62
+ });
63
+ continue;
64
+ }
65
+ const methodName = sanitizeCodeActName(tool.name);
66
+ if (RESERVED_HOST_METHODS.has(methodName)) {
67
+ reservedNotes.push({
68
+ realName: tool.name,
69
+ note: `# Host tool "${tool.name}" collides with the reserved ${methodName} helper; call hadamard.tool("${tool.name}", {...}) with: ${describeSchema(tool.inputJsonSchema)}.`,
70
+ purpose: oneLinePurpose(tool.description),
71
+ });
72
+ continue;
73
+ }
74
+ if ((sanitizedCounts.get(methodName) ?? 0) > 1) {
75
+ reservedNotes.push({
76
+ realName: tool.name,
77
+ note: `# Host tool "${tool.name}" and another host tool share the sanitized Python name ${methodName}; call hadamard.tool("${tool.name}", {...}) with: ${describeSchema(tool.inputJsonSchema)}.`,
78
+ purpose: oneLinePurpose(tool.description),
79
+ });
80
+ continue;
81
+ }
82
+ const { omitted } = renderParams(tool.inputJsonSchema);
83
+ const docParts = [collapseDoc(tool.description), `Host tool: ${tool.name}.`];
84
+ if (methodName !== tool.name)
85
+ docParts.push(`Called as hadamard.${methodName}.`);
86
+ if (omitted.length > 0) {
87
+ docParts.push(`Not keyword-accessible (invalid Python identifiers): ${omitted.join(', ')}.`);
88
+ }
89
+ stubs.push({
90
+ methodName,
91
+ realName: tool.name,
92
+ signature: renderToolSignature(tool, methodName),
93
+ doc: docParts.join(' '),
94
+ purpose: oneLinePurpose(tool.description),
95
+ });
96
+ }
97
+ const header = [
98
+ '# Typed host-tool stubs reachable from CodeCell code through the global',
99
+ '# `hadamard` object. Signatures are authoritative for parameter names; every',
100
+ '# method dispatches the matching host tool, and `hadamard.tool("<name>", {...})` stays',
101
+ '# available for tools without a typed stub.',
102
+ '# A failed host call raises HadamardToolError with a `tool_name` attribute;',
103
+ '# catch it to branch on which tool failed.',
104
+ '# Any tool schema is queryable on demand with hadamard.tool_schema("<ToolName>").',
105
+ ...(untypedCount > 0
106
+ ? [`# Degraded typing: ${untypedCount} of ${visibleTools.length} visible tool(s) declare no output schema, so their results are untyped (Any) — treat them as opaque and degrade accordingly.`]
107
+ : []),
108
+ ].join('\n');
109
+ let body = renderStubClass(stubs, reservedNotes, true);
110
+ if (body.length > maxChars) {
111
+ body = renderStubClass(stubs, reservedNotes, false);
112
+ }
113
+ if (body.length > maxChars) {
114
+ const truncated = [];
115
+ let size = 0;
116
+ for (const stub of stubs) {
117
+ const line = ` def ${stub.signature}: ... # ${stub.realName}`;
118
+ if (size + line.length + 1 > maxChars - 400)
119
+ break;
120
+ truncated.push(line);
121
+ size += line.length + 1;
122
+ }
123
+ const omittedIndex = [
124
+ ...stubs.slice(truncated.length).map(stub => ({ name: stub.realName, purpose: stub.purpose })),
125
+ ...reservedNotes.map(note => ({ name: note.realName, purpose: note.purpose })),
126
+ ];
127
+ const lines = [
128
+ 'class HadamardHost:',
129
+ ' """Host-tool bridge (truncated typed surface)."""',
130
+ ...truncated,
131
+ ];
132
+ const noteLines = [
133
+ ` # ${omittedIndex.length} further host tool(s) omitted for prompt budget; the index below keeps every remaining tool discoverable.`,
134
+ ' # Query any tool schema on demand with hadamard.tool_schema("<ToolName>").',
135
+ ];
136
+ const budget = Math.max(0, maxChars - lines.join('\n').length - noteLines.join('\n').length - 2);
137
+ const indexLines = [];
138
+ let used = 0;
139
+ for (const entry of omittedIndex) {
140
+ const line = ` # ${entry.name} — ${entry.purpose}`;
141
+ if (used + line.length + 1 > budget)
142
+ break;
143
+ indexLines.push(line);
144
+ used += line.length + 1;
145
+ }
146
+ const rest = omittedIndex.slice(indexLines.length).map(entry => entry.name);
147
+ if (rest.length > 0) {
148
+ // Discovery floor: every remaining name stays visible in a compact
149
+ // budget-exempt index (names are short; the cap protects against
150
+ // doc/schema blowup, which is the actual prompt-flooding risk).
151
+ const prefix = ' # Compact name index: ';
152
+ let current = prefix;
153
+ for (const name of rest) {
154
+ const piece = (current === prefix ? '' : ', ') + name;
155
+ if (current.length + piece.length > 96) {
156
+ indexLines.push(current);
157
+ current = ` # ${name}`;
158
+ }
159
+ else {
160
+ current += piece;
161
+ }
162
+ }
163
+ indexLines.push(current);
164
+ indexLines.push(' # (schema on demand: hadamard.tool_schema("<name>"))');
165
+ }
166
+ body = [...lines, ...noteLines, ...indexLines].join('\n');
167
+ }
168
+ if (body.length === 0)
169
+ return '';
170
+ return `${header}\n${body}`;
171
+ }
172
+ function renderStubClass(stubs, reservedNotes, withDocs) {
173
+ const lines = [
174
+ 'class HadamardHost:',
175
+ ' """Host-tool bridge (typed surface)."""',
176
+ ];
177
+ if (!withDocs) {
178
+ lines.push(' # Docstrings folded for prompt budget; parameter names remain authoritative.');
179
+ }
180
+ for (const stub of stubs) {
181
+ if (withDocs) {
182
+ lines.push('');
183
+ lines.push(` def ${stub.signature}:`);
184
+ lines.push(` """${stub.doc}"""`);
185
+ lines.push(' ...');
186
+ }
187
+ else {
188
+ lines.push(` def ${stub.signature}: ...`);
189
+ }
190
+ }
191
+ for (const note of reservedNotes) {
192
+ lines.push('');
193
+ lines.push(` ${note.note}`);
194
+ }
195
+ return lines.join('\n');
196
+ }
197
+ /** Fixed kernel helpers whose behavior is wired in the kernel program itself. */
198
+ const FIXED_HELPER_METHODS = {
199
+ Read: 'read',
200
+ Write: 'write',
201
+ Grep: 'search',
202
+ };
203
+ function renderToolSignature(tool, methodName) {
204
+ const { params } = renderParams(tool.inputJsonSchema);
205
+ const returnType = tool.outputSchema
206
+ ? jsonSchemaToPythonType(z.toJSONSchema(tool.outputSchema))
207
+ : 'Any';
208
+ return params.length > 0
209
+ ? `${methodName}(self, ${params.join(', ')}) -> ${returnType}`
210
+ : `${methodName}(self) -> ${returnType}`;
211
+ }
212
+ function countDynamicMethodNames(tools) {
213
+ const counts = new Map();
214
+ for (const tool of tools) {
215
+ if (tool.name === 'CodeCell' || FIXED_HELPER_METHODS[tool.name])
216
+ continue;
217
+ const methodName = sanitizeCodeActName(tool.name);
218
+ if (RESERVED_HOST_METHODS.has(methodName))
219
+ continue;
220
+ counts.set(methodName, (counts.get(methodName) ?? 0) + 1);
221
+ }
222
+ return counts;
223
+ }
224
+ /** Build the collision-safe typed-method dispatch map used by the kernel. */
225
+ export function buildCodeActToolNameMap(tools) {
226
+ const counts = countDynamicMethodNames(tools);
227
+ const result = {};
228
+ for (const tool of [...tools].sort((left, right) => left.name.localeCompare(right.name))) {
229
+ if (tool.name === 'CodeCell' || FIXED_HELPER_METHODS[tool.name])
230
+ continue;
231
+ const methodName = sanitizeCodeActName(tool.name);
232
+ if (RESERVED_HOST_METHODS.has(methodName) || counts.get(methodName) !== 1)
233
+ continue;
234
+ result[methodName] = tool.name;
235
+ }
236
+ return result;
237
+ }
238
+ function collapseDoc(description) {
239
+ const collapsed = description.replace(/\s+/g, ' ').trim().replace(/"""/g, "''\"");
240
+ return collapsed.length > MAX_DOC_CHARS ? `${collapsed.slice(0, MAX_DOC_CHARS - 3)}...` : collapsed;
241
+ }
242
+ /** Compact one-line purpose for the truncated-discovery index. */
243
+ function oneLinePurpose(description) {
244
+ const collapsed = description.replace(/\s+/g, ' ').trim();
245
+ return collapsed.length > 90 ? `${collapsed.slice(0, 87)}...` : collapsed;
246
+ }
247
+ function describeSchema(schema) {
248
+ const record = isRecord(schema) ? schema : {};
249
+ const properties = isRecord(record.properties) ? record.properties : {};
250
+ const parts = [];
251
+ for (const [key, value] of Object.entries(properties)) {
252
+ parts.push(`${key}: ${jsonSchemaToPythonType(value)}`);
253
+ }
254
+ return parts.length > 0 ? parts.join(', ') : jsonSchemaToPythonType(schema);
255
+ }
256
+ function renderParams(schema) {
257
+ if (!isRecord(schema))
258
+ return { params: [], omitted: [] };
259
+ const properties = isRecord(schema.properties) ? schema.properties : {};
260
+ const required = new Set(Array.isArray(schema.required) ? schema.required.filter((key) => typeof key === 'string') : []);
261
+ const params = [];
262
+ const omitted = [];
263
+ for (const [key, value] of Object.entries(properties)) {
264
+ if (!PYTHON_IDENTIFIER.test(key)) {
265
+ omitted.push(key);
266
+ continue;
267
+ }
268
+ const type = jsonSchemaToPythonType(value);
269
+ if (required.has(key)) {
270
+ params.push(`${key}: ${type}`);
271
+ }
272
+ else {
273
+ params.push(`${key}: ${type} | None = None`);
274
+ }
275
+ }
276
+ return { params, omitted };
277
+ }
278
+ /** Render one JSON Schema node as a Python type annotation (bounded depth). */
279
+ export function jsonSchemaToPythonType(schema, depth = 0) {
280
+ if (!isRecord(schema) || depth > MAX_RENDER_DEPTH)
281
+ return 'Any';
282
+ if (schema.const !== undefined)
283
+ return renderLiteral(schema.const);
284
+ if (Array.isArray(schema.enum) && schema.enum.length > 0) {
285
+ return renderLiteralUnion(schema.enum);
286
+ }
287
+ if (Array.isArray(schema.anyOf) && schema.anyOf.length > 0) {
288
+ return renderSchemaUnion(schema.anyOf, depth);
289
+ }
290
+ if (Array.isArray(schema.oneOf) && schema.oneOf.length > 0) {
291
+ return renderSchemaUnion(schema.oneOf, depth);
292
+ }
293
+ if (Array.isArray(schema.type)) {
294
+ return renderSchemaUnion(schema.type.map((entry) => ({ type: entry })), depth);
295
+ }
296
+ switch (schema.type) {
297
+ case 'string': return 'str';
298
+ case 'integer': return 'int';
299
+ case 'number': return 'float';
300
+ case 'boolean': return 'bool';
301
+ case 'null': return 'None';
302
+ case 'array': {
303
+ const items = jsonSchemaToPythonType(schema.items, depth + 1);
304
+ return `list[${items}]`;
305
+ }
306
+ case 'object': {
307
+ if (depth >= MAX_RENDER_DEPTH)
308
+ return 'dict[str, Any]';
309
+ const properties = isRecord(schema.properties) ? schema.properties : {};
310
+ if (Object.keys(properties).length === 0)
311
+ return 'dict[str, Any]';
312
+ // Nested objects stay bounded: dict with an item type when homogeneous.
313
+ const itemTypes = new Set(Object.values(properties).map((entry) => jsonSchemaToPythonType(entry, depth + 1)));
314
+ if (itemTypes.size === 1)
315
+ return `dict[str, ${[...itemTypes][0]}]`;
316
+ return 'dict[str, Any]';
317
+ }
318
+ default: return 'Any';
319
+ }
320
+ }
321
+ function renderSchemaUnion(members, depth) {
322
+ const types = new Set();
323
+ for (const member of members.slice(0, 5)) {
324
+ types.add(jsonSchemaToPythonType(member, depth + 1));
325
+ }
326
+ if (members.length > 5)
327
+ types.add('Any');
328
+ return types.size === 1 ? [...types][0] : [...types].join(' | ');
329
+ }
330
+ function renderLiteralUnion(values) {
331
+ const literals = new Set();
332
+ for (const value of values.slice(0, 6)) {
333
+ literals.add(renderLiteral(value));
334
+ }
335
+ if (values.length > 6)
336
+ literals.add('Any');
337
+ return literals.size === 1 ? [...literals][0] : [...literals].join(' | ');
338
+ }
339
+ function renderLiteral(value) {
340
+ if (value === null)
341
+ return 'None';
342
+ if (typeof value === 'string')
343
+ return `Literal['${value.replace(/\\/g, '\\\\').replace(/'/g, "\\'")}']`;
344
+ if (typeof value === 'number')
345
+ return `Literal[${value}]`;
346
+ if (typeof value === 'boolean')
347
+ return `Literal[${value ? 'True' : 'False'}]`;
348
+ return 'Any';
349
+ }
350
+ function isRecord(value) {
351
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
352
+ }
353
+ //# sourceMappingURL=codeActSdk.js.map