@namzu/sdk 3.0.0 → 3.2.0

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 (307) hide show
  1. package/CHANGELOG.md +223 -0
  2. package/dist/advisory/__tests__/consultation-context.test.d.ts +2 -0
  3. package/dist/advisory/__tests__/consultation-context.test.d.ts.map +1 -0
  4. package/dist/advisory/__tests__/consultation-context.test.js +124 -0
  5. package/dist/advisory/__tests__/consultation-context.test.js.map +1 -0
  6. package/dist/advisory/context.d.ts +25 -0
  7. package/dist/advisory/context.d.ts.map +1 -1
  8. package/dist/advisory/context.js +18 -0
  9. package/dist/advisory/context.js.map +1 -1
  10. package/dist/advisory/executor.d.ts.map +1 -1
  11. package/dist/advisory/executor.js +25 -3
  12. package/dist/advisory/executor.js.map +1 -1
  13. package/dist/compaction/__tests__/context-reducer.test.d.ts +2 -0
  14. package/dist/compaction/__tests__/context-reducer.test.d.ts.map +1 -0
  15. package/dist/compaction/__tests__/context-reducer.test.js +197 -0
  16. package/dist/compaction/__tests__/context-reducer.test.js.map +1 -0
  17. package/dist/compaction/factory.d.ts +7 -0
  18. package/dist/compaction/factory.d.ts.map +1 -1
  19. package/dist/compaction/factory.js +7 -0
  20. package/dist/compaction/factory.js.map +1 -1
  21. package/dist/compaction/index.d.ts +2 -0
  22. package/dist/compaction/index.d.ts.map +1 -1
  23. package/dist/compaction/index.js +1 -0
  24. package/dist/compaction/index.js.map +1 -1
  25. package/dist/compaction/interface.d.ts +13 -0
  26. package/dist/compaction/interface.d.ts.map +1 -1
  27. package/dist/compaction/managers/null.d.ts +3 -0
  28. package/dist/compaction/managers/null.d.ts.map +1 -1
  29. package/dist/compaction/managers/null.js +3 -0
  30. package/dist/compaction/managers/null.js.map +1 -1
  31. package/dist/compaction/managers/slidingWindow.d.ts +6 -0
  32. package/dist/compaction/managers/slidingWindow.d.ts.map +1 -1
  33. package/dist/compaction/managers/slidingWindow.js +6 -0
  34. package/dist/compaction/managers/slidingWindow.js.map +1 -1
  35. package/dist/compaction/managers/structured.d.ts +10 -0
  36. package/dist/compaction/managers/structured.d.ts.map +1 -1
  37. package/dist/compaction/managers/structured.js +10 -0
  38. package/dist/compaction/managers/structured.js.map +1 -1
  39. package/dist/compaction/reducer.d.ts +86 -0
  40. package/dist/compaction/reducer.d.ts.map +1 -0
  41. package/dist/compaction/reducer.js +77 -0
  42. package/dist/compaction/reducer.js.map +1 -0
  43. package/dist/connector/builtins/__tests__/oauth2-auth.test.d.ts +2 -0
  44. package/dist/connector/builtins/__tests__/oauth2-auth.test.d.ts.map +1 -0
  45. package/dist/connector/builtins/__tests__/oauth2-auth.test.js +54 -0
  46. package/dist/connector/builtins/__tests__/oauth2-auth.test.js.map +1 -0
  47. package/dist/connector/builtins/http.d.ts.map +1 -1
  48. package/dist/connector/builtins/http.js +24 -2
  49. package/dist/connector/builtins/http.js.map +1 -1
  50. package/dist/connector/builtins/http.test.js +18 -2
  51. package/dist/connector/builtins/http.test.js.map +1 -1
  52. package/dist/connector/index.d.ts +2 -2
  53. package/dist/connector/index.d.ts.map +1 -1
  54. package/dist/connector/index.js +1 -1
  55. package/dist/connector/index.js.map +1 -1
  56. package/dist/connector/mcp/__tests__/prompts-and-lifecycle.test.d.ts +2 -0
  57. package/dist/connector/mcp/__tests__/prompts-and-lifecycle.test.d.ts.map +1 -0
  58. package/dist/connector/mcp/__tests__/prompts-and-lifecycle.test.js +214 -0
  59. package/dist/connector/mcp/__tests__/prompts-and-lifecycle.test.js.map +1 -0
  60. package/dist/connector/mcp/client.d.ts +52 -1
  61. package/dist/connector/mcp/client.d.ts.map +1 -1
  62. package/dist/connector/mcp/client.js +86 -0
  63. package/dist/connector/mcp/client.js.map +1 -1
  64. package/dist/connector/mcp/discovery.d.ts +12 -1
  65. package/dist/connector/mcp/discovery.d.ts.map +1 -1
  66. package/dist/connector/mcp/discovery.js +19 -4
  67. package/dist/connector/mcp/discovery.js.map +1 -1
  68. package/dist/connector/mcp/index.d.ts +2 -2
  69. package/dist/connector/mcp/index.d.ts.map +1 -1
  70. package/dist/connector/mcp/index.js +1 -1
  71. package/dist/connector/mcp/index.js.map +1 -1
  72. package/dist/connector/mcp/server.d.ts +42 -1
  73. package/dist/connector/mcp/server.d.ts.map +1 -1
  74. package/dist/connector/mcp/server.js +77 -4
  75. package/dist/connector/mcp/server.js.map +1 -1
  76. package/dist/manager/agent/__tests__/depth-limit-authority.test.d.ts +2 -0
  77. package/dist/manager/agent/__tests__/depth-limit-authority.test.d.ts.map +1 -0
  78. package/dist/manager/agent/__tests__/depth-limit-authority.test.js +58 -0
  79. package/dist/manager/agent/__tests__/depth-limit-authority.test.js.map +1 -0
  80. package/dist/plugin/__tests__/discovery-scopes.test.d.ts +2 -0
  81. package/dist/plugin/__tests__/discovery-scopes.test.d.ts.map +1 -0
  82. package/dist/plugin/__tests__/discovery-scopes.test.js +97 -0
  83. package/dist/plugin/__tests__/discovery-scopes.test.js.map +1 -0
  84. package/dist/plugin/__tests__/enable-contributions.test.js +5 -1
  85. package/dist/plugin/__tests__/enable-contributions.test.js.map +1 -1
  86. package/dist/plugin/__tests__/mcp-admission.test.d.ts +2 -0
  87. package/dist/plugin/__tests__/mcp-admission.test.d.ts.map +1 -0
  88. package/dist/plugin/__tests__/mcp-admission.test.js +192 -0
  89. package/dist/plugin/__tests__/mcp-admission.test.js.map +1 -0
  90. package/dist/plugin/lifecycle.d.ts +41 -0
  91. package/dist/plugin/lifecycle.d.ts.map +1 -1
  92. package/dist/plugin/lifecycle.js +29 -1
  93. package/dist/plugin/lifecycle.js.map +1 -1
  94. package/dist/plugin/loader.d.ts +39 -3
  95. package/dist/plugin/loader.d.ts.map +1 -1
  96. package/dist/plugin/loader.js +37 -4
  97. package/dist/plugin/loader.js.map +1 -1
  98. package/dist/public-runtime.d.ts +5 -3
  99. package/dist/public-runtime.d.ts.map +1 -1
  100. package/dist/public-runtime.js +11 -3
  101. package/dist/public-runtime.js.map +1 -1
  102. package/dist/public-types.d.ts +2 -2
  103. package/dist/public-types.d.ts.map +1 -1
  104. package/dist/rag/__tests__/namespace-isolation.test.d.ts +2 -0
  105. package/dist/rag/__tests__/namespace-isolation.test.d.ts.map +1 -0
  106. package/dist/rag/__tests__/namespace-isolation.test.js +80 -0
  107. package/dist/rag/__tests__/namespace-isolation.test.js.map +1 -0
  108. package/dist/rag/ingestion.d.ts.map +1 -1
  109. package/dist/rag/ingestion.js +1 -0
  110. package/dist/rag/ingestion.js.map +1 -1
  111. package/dist/rag/retriever.d.ts.map +1 -1
  112. package/dist/rag/retriever.js +2 -0
  113. package/dist/rag/retriever.js.map +1 -1
  114. package/dist/rag/vector-store.d.ts.map +1 -1
  115. package/dist/rag/vector-store.js +6 -0
  116. package/dist/rag/vector-store.js.map +1 -1
  117. package/dist/registry/tool/execute.d.ts.map +1 -1
  118. package/dist/registry/tool/execute.js +113 -109
  119. package/dist/registry/tool/execute.js.map +1 -1
  120. package/dist/runtime/query/__tests__/capability-negotiation.test.js +59 -0
  121. package/dist/runtime/query/__tests__/capability-negotiation.test.js.map +1 -1
  122. package/dist/runtime/query/__tests__/per-step-skills.test.d.ts +10 -0
  123. package/dist/runtime/query/__tests__/per-step-skills.test.d.ts.map +1 -0
  124. package/dist/runtime/query/__tests__/per-step-skills.test.js +122 -0
  125. package/dist/runtime/query/__tests__/per-step-skills.test.js.map +1 -0
  126. package/dist/runtime/query/__tests__/per-step-tool-choice.test.d.ts +2 -0
  127. package/dist/runtime/query/__tests__/per-step-tool-choice.test.d.ts.map +1 -0
  128. package/dist/runtime/query/__tests__/per-step-tool-choice.test.js +153 -0
  129. package/dist/runtime/query/__tests__/per-step-tool-choice.test.js.map +1 -0
  130. package/dist/runtime/query/__tests__/resume-run.test.d.ts +2 -0
  131. package/dist/runtime/query/__tests__/resume-run.test.d.ts.map +1 -0
  132. package/dist/runtime/query/__tests__/resume-run.test.js +211 -0
  133. package/dist/runtime/query/__tests__/resume-run.test.js.map +1 -0
  134. package/dist/runtime/query/executor.d.ts +1 -0
  135. package/dist/runtime/query/executor.d.ts.map +1 -1
  136. package/dist/runtime/query/executor.js +10 -1
  137. package/dist/runtime/query/executor.js.map +1 -1
  138. package/dist/runtime/query/index.d.ts +10 -0
  139. package/dist/runtime/query/index.d.ts.map +1 -1
  140. package/dist/runtime/query/index.js +26 -0
  141. package/dist/runtime/query/index.js.map +1 -1
  142. package/dist/runtime/query/iteration/index.d.ts.map +1 -1
  143. package/dist/runtime/query/iteration/index.js +118 -34
  144. package/dist/runtime/query/iteration/index.js.map +1 -1
  145. package/dist/runtime/query/iteration/phases/compaction-model-routing.test.d.ts +2 -0
  146. package/dist/runtime/query/iteration/phases/compaction-model-routing.test.d.ts.map +1 -0
  147. package/dist/runtime/query/iteration/phases/compaction-model-routing.test.js +96 -0
  148. package/dist/runtime/query/iteration/phases/compaction-model-routing.test.js.map +1 -0
  149. package/dist/runtime/query/iteration/phases/compaction.d.ts.map +1 -1
  150. package/dist/runtime/query/iteration/phases/compaction.js +95 -5
  151. package/dist/runtime/query/iteration/phases/compaction.js.map +1 -1
  152. package/dist/runtime/query/iteration/phases/context-reducer-dispatch.test.d.ts +2 -0
  153. package/dist/runtime/query/iteration/phases/context-reducer-dispatch.test.d.ts.map +1 -0
  154. package/dist/runtime/query/iteration/phases/context-reducer-dispatch.test.js +180 -0
  155. package/dist/runtime/query/iteration/phases/context-reducer-dispatch.test.js.map +1 -0
  156. package/dist/runtime/query/iteration/phases/context.d.ts +9 -0
  157. package/dist/runtime/query/iteration/phases/context.d.ts.map +1 -1
  158. package/dist/runtime/query/iteration/phases/context.js.map +1 -1
  159. package/dist/runtime/query/resume-run.d.ts +70 -0
  160. package/dist/runtime/query/resume-run.d.ts.map +1 -0
  161. package/dist/runtime/query/resume-run.js +46 -0
  162. package/dist/runtime/query/resume-run.js.map +1 -0
  163. package/dist/telemetry/__tests__/model-call-span.test.d.ts +2 -0
  164. package/dist/telemetry/__tests__/model-call-span.test.d.ts.map +1 -0
  165. package/dist/telemetry/__tests__/model-call-span.test.js +147 -0
  166. package/dist/telemetry/__tests__/model-call-span.test.js.map +1 -0
  167. package/dist/telemetry/__tests__/span-closure.test.d.ts +2 -0
  168. package/dist/telemetry/__tests__/span-closure.test.d.ts.map +1 -0
  169. package/dist/telemetry/__tests__/span-closure.test.js +124 -0
  170. package/dist/telemetry/__tests__/span-closure.test.js.map +1 -0
  171. package/dist/tools/advisory/index.js +1 -1
  172. package/dist/tools/advisory/index.js.map +1 -1
  173. package/dist/tools/builtins/__tests__/edit-commits-atomically.test.d.ts +2 -0
  174. package/dist/tools/builtins/__tests__/edit-commits-atomically.test.d.ts.map +1 -0
  175. package/dist/tools/builtins/__tests__/edit-commits-atomically.test.js +78 -0
  176. package/dist/tools/builtins/__tests__/edit-commits-atomically.test.js.map +1 -0
  177. package/dist/tools/builtins/__tests__/edit.test.js +242 -1
  178. package/dist/tools/builtins/__tests__/edit.test.js.map +1 -1
  179. package/dist/tools/builtins/__tests__/stale-file-refusal.test.d.ts +2 -0
  180. package/dist/tools/builtins/__tests__/stale-file-refusal.test.d.ts.map +1 -0
  181. package/dist/tools/builtins/__tests__/stale-file-refusal.test.js +187 -0
  182. package/dist/tools/builtins/__tests__/stale-file-refusal.test.js.map +1 -0
  183. package/dist/tools/builtins/atomic-write-file.d.ts +1 -1
  184. package/dist/tools/builtins/atomic-write-file.d.ts.map +1 -1
  185. package/dist/tools/builtins/atomic-write-file.js +31 -2
  186. package/dist/tools/builtins/atomic-write-file.js.map +1 -1
  187. package/dist/tools/builtins/content-fingerprint.d.ts +23 -0
  188. package/dist/tools/builtins/content-fingerprint.d.ts.map +1 -0
  189. package/dist/tools/builtins/content-fingerprint.js +30 -0
  190. package/dist/tools/builtins/content-fingerprint.js.map +1 -0
  191. package/dist/tools/builtins/edit.d.ts.map +1 -1
  192. package/dist/tools/builtins/edit.js +172 -31
  193. package/dist/tools/builtins/edit.js.map +1 -1
  194. package/dist/tools/builtins/read-file.d.ts.map +1 -1
  195. package/dist/tools/builtins/read-file.js +5 -2
  196. package/dist/tools/builtins/read-file.js.map +1 -1
  197. package/dist/tools/builtins/write-file.d.ts.map +1 -1
  198. package/dist/tools/builtins/write-file.js +75 -27
  199. package/dist/tools/builtins/write-file.js.map +1 -1
  200. package/dist/tools/coordinator/__tests__/ask-user-question.test.js +55 -0
  201. package/dist/tools/coordinator/__tests__/ask-user-question.test.js.map +1 -1
  202. package/dist/tools/coordinator/__tests__/plan-dependencies.test.d.ts +2 -0
  203. package/dist/tools/coordinator/__tests__/plan-dependencies.test.d.ts.map +1 -0
  204. package/dist/tools/coordinator/__tests__/plan-dependencies.test.js +126 -0
  205. package/dist/tools/coordinator/__tests__/plan-dependencies.test.js.map +1 -0
  206. package/dist/tools/coordinator/index.d.ts.map +1 -1
  207. package/dist/tools/coordinator/index.js +75 -5
  208. package/dist/tools/coordinator/index.js.map +1 -1
  209. package/dist/tools/coordinator/plan-dependencies.d.ts +43 -0
  210. package/dist/tools/coordinator/plan-dependencies.d.ts.map +1 -0
  211. package/dist/tools/coordinator/plan-dependencies.js +148 -0
  212. package/dist/tools/coordinator/plan-dependencies.js.map +1 -0
  213. package/dist/types/agent/supervisor.d.ts +15 -0
  214. package/dist/types/agent/supervisor.d.ts.map +1 -1
  215. package/dist/types/connector/core.d.ts +34 -0
  216. package/dist/types/connector/core.d.ts.map +1 -1
  217. package/dist/types/connector/definition.d.ts +10 -0
  218. package/dist/types/connector/definition.d.ts.map +1 -1
  219. package/dist/types/connector/mcp.d.ts +13 -0
  220. package/dist/types/connector/mcp.d.ts.map +1 -1
  221. package/dist/types/rag/retrieval.d.ts +16 -0
  222. package/dist/types/rag/retrieval.d.ts.map +1 -1
  223. package/dist/types/rag/storage.d.ts +9 -0
  224. package/dist/types/rag/storage.d.ts.map +1 -1
  225. package/dist/types/rag/vector.d.ts +11 -0
  226. package/dist/types/rag/vector.d.ts.map +1 -1
  227. package/dist/types/router/task-router.d.ts +19 -0
  228. package/dist/types/router/task-router.d.ts.map +1 -1
  229. package/dist/types/run/prepare-step.d.ts +56 -3
  230. package/dist/types/run/prepare-step.d.ts.map +1 -1
  231. package/dist/types/tool/index.d.ts +17 -1
  232. package/dist/types/tool/index.d.ts.map +1 -1
  233. package/dist/types/tool/index.js.map +1 -1
  234. package/dist/types/toolset/index.d.ts +22 -0
  235. package/dist/types/toolset/index.d.ts.map +1 -1
  236. package/package.json +1 -1
  237. package/src/advisory/__tests__/consultation-context.test.ts +191 -0
  238. package/src/advisory/context.ts +32 -0
  239. package/src/advisory/executor.ts +30 -3
  240. package/src/compaction/__tests__/context-reducer.test.ts +239 -0
  241. package/src/compaction/factory.ts +7 -0
  242. package/src/compaction/index.ts +8 -0
  243. package/src/compaction/interface.ts +13 -0
  244. package/src/compaction/managers/null.ts +3 -0
  245. package/src/compaction/managers/slidingWindow.ts +6 -0
  246. package/src/compaction/managers/structured.ts +10 -0
  247. package/src/compaction/reducer.ts +154 -0
  248. package/src/connector/builtins/__tests__/oauth2-auth.test.ts +73 -0
  249. package/src/connector/builtins/http.test.ts +28 -2
  250. package/src/connector/builtins/http.ts +26 -2
  251. package/src/connector/index.ts +6 -2
  252. package/src/connector/mcp/__tests__/prompts-and-lifecycle.test.ts +286 -0
  253. package/src/connector/mcp/client.ts +95 -0
  254. package/src/connector/mcp/discovery.ts +19 -4
  255. package/src/connector/mcp/index.ts +6 -2
  256. package/src/connector/mcp/server.ts +101 -3
  257. package/src/manager/agent/__tests__/depth-limit-authority.test.ts +74 -0
  258. package/src/plugin/__tests__/discovery-scopes.test.ts +133 -0
  259. package/src/plugin/__tests__/enable-contributions.test.ts +5 -1
  260. package/src/plugin/__tests__/mcp-admission.test.ts +242 -0
  261. package/src/plugin/lifecycle.ts +57 -1
  262. package/src/plugin/loader.ts +57 -3
  263. package/src/public-runtime.ts +16 -1
  264. package/src/public-types.ts +5 -0
  265. package/src/rag/__tests__/namespace-isolation.test.ts +109 -0
  266. package/src/rag/ingestion.ts +1 -0
  267. package/src/rag/retriever.ts +2 -0
  268. package/src/rag/vector-store.ts +5 -0
  269. package/src/registry/tool/execute.ts +123 -119
  270. package/src/runtime/query/__tests__/capability-negotiation.test.ts +69 -0
  271. package/src/runtime/query/__tests__/per-step-skills.test.ts +154 -0
  272. package/src/runtime/query/__tests__/per-step-tool-choice.test.ts +180 -0
  273. package/src/runtime/query/__tests__/resume-run.test.ts +262 -0
  274. package/src/runtime/query/executor.ts +9 -1
  275. package/src/runtime/query/index.ts +39 -0
  276. package/src/runtime/query/iteration/index.ts +130 -34
  277. package/src/runtime/query/iteration/phases/compaction-model-routing.test.ts +125 -0
  278. package/src/runtime/query/iteration/phases/compaction.ts +106 -5
  279. package/src/runtime/query/iteration/phases/context-reducer-dispatch.test.ts +238 -0
  280. package/src/runtime/query/iteration/phases/context.ts +11 -0
  281. package/src/runtime/query/resume-run.ts +93 -0
  282. package/src/telemetry/__tests__/model-call-span.test.ts +189 -0
  283. package/src/telemetry/__tests__/span-closure.test.ts +153 -0
  284. package/src/tools/advisory/index.ts +1 -1
  285. package/src/tools/builtins/__tests__/edit-commits-atomically.test.ts +103 -0
  286. package/src/tools/builtins/__tests__/edit.test.ts +324 -1
  287. package/src/tools/builtins/__tests__/stale-file-refusal.test.ts +258 -0
  288. package/src/tools/builtins/atomic-write-file.ts +30 -2
  289. package/src/tools/builtins/content-fingerprint.ts +33 -0
  290. package/src/tools/builtins/edit.ts +188 -36
  291. package/src/tools/builtins/read-file.ts +5 -2
  292. package/src/tools/builtins/write-file.ts +79 -28
  293. package/src/tools/coordinator/__tests__/ask-user-question.test.ts +68 -0
  294. package/src/tools/coordinator/__tests__/plan-dependencies.test.ts +186 -0
  295. package/src/tools/coordinator/index.ts +116 -42
  296. package/src/tools/coordinator/plan-dependencies.ts +175 -0
  297. package/src/types/agent/supervisor.ts +15 -0
  298. package/src/types/connector/core.ts +34 -0
  299. package/src/types/connector/definition.ts +10 -0
  300. package/src/types/connector/mcp.ts +14 -0
  301. package/src/types/rag/retrieval.ts +16 -0
  302. package/src/types/rag/storage.ts +9 -0
  303. package/src/types/rag/vector.ts +11 -0
  304. package/src/types/router/task-router.ts +19 -0
  305. package/src/types/run/prepare-step.ts +58 -3
  306. package/src/types/tool/index.ts +17 -1
  307. package/src/types/toolset/index.ts +22 -0
@@ -14,6 +14,15 @@ export interface Chunk {
14
14
  documentId: DocumentId;
15
15
  knowledgeBaseId: KnowledgeBaseId;
16
16
  tenantId: TenantId;
17
+ /**
18
+ * The partition this chunk was ingested into, from `TenantScope`.
19
+ *
20
+ * `TenantScope.namespace` and `KnowledgeBaseConfig.namespace` were both
21
+ * declared from the start and neither reached storage: ingestion copied
22
+ * `scope.tenantId` onto every chunk and dropped the namespace, so a
23
+ * partition a host had asked for did not exist at all.
24
+ */
25
+ namespace?: string;
17
26
  content: string;
18
27
  index: number;
19
28
  tokenCount: number;
@@ -1 +1 @@
1
- {"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../../src/types/rag/storage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AACrF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAElD,MAAM,WAAW,QAAQ;IACxB,EAAE,EAAE,UAAU,CAAA;IACd,eAAe,EAAE,eAAe,CAAA;IAChC,QAAQ,EAAE,QAAQ,CAAA;IAClB,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,gBAAgB,CAAA;IAC1B,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,KAAK;IACrB,EAAE,EAAE,OAAO,CAAA;IACX,UAAU,EAAE,UAAU,CAAA;IACtB,eAAe,EAAE,eAAe,CAAA;IAChC,QAAQ,EAAE,QAAQ,CAAA;IAClB,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAA;IACpB,QAAQ,EAAE,gBAAgB,CAAA;IAC1B,SAAS,EAAE,MAAM,CAAA;CACjB"}
1
+ {"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../../src/types/rag/storage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AACrF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAElD,MAAM,WAAW,QAAQ;IACxB,EAAE,EAAE,UAAU,CAAA;IACd,eAAe,EAAE,eAAe,CAAA;IAChC,QAAQ,EAAE,QAAQ,CAAA;IAClB,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,gBAAgB,CAAA;IAC1B,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,KAAK;IACrB,EAAE,EAAE,OAAO,CAAA;IACX,UAAU,EAAE,UAAU,CAAA;IACtB,eAAe,EAAE,eAAe,CAAA;IAChC,QAAQ,EAAE,QAAQ,CAAA;IAClB;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAA;IACpB,QAAQ,EAAE,gBAAgB,CAAA;IAC1B,SAAS,EAAE,MAAM,CAAA;CACjB"}
@@ -9,6 +9,17 @@ export interface VectorStoreQuery {
9
9
  topK: number;
10
10
  tenantId: TenantId;
11
11
  knowledgeBaseId?: KnowledgeBaseId;
12
+ /**
13
+ * The partition to search. Matched by equality, INCLUDING absence.
14
+ *
15
+ * An omitted namespace means "the default partition", not "no filter".
16
+ * Reading it as "no filter" is how an isolation boundary leaks: a caller
17
+ * who never asked for a namespace would see every namespaced chunk in
18
+ * the tenant, which is the opposite of what partitioning is for. A
19
+ * caller who genuinely wants everything asks the store for each
20
+ * namespace it holds.
21
+ */
22
+ namespace?: string;
12
23
  filter?: Record<string, unknown>;
13
24
  minScore?: number;
14
25
  }
@@ -1 +1 @@
1
- {"version":3,"file":"vector.d.ts","sourceRoot":"","sources":["../../../src/types/rag/vector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AACrF,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAA;AAEzC,MAAM,WAAW,kBAAkB;IAClC,KAAK,EAAE,KAAK,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;CACb;AAED,MAAM,WAAW,gBAAgB;IAChC,SAAS,EAAE,MAAM,EAAE,CAAA;IACnB,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,QAAQ,CAAA;IAClB,eAAe,CAAC,EAAE,eAAe,CAAA;IACjC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAChC,QAAQ,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,WAAW;IAC3B,MAAM,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACtC,MAAM,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAAA;IAC9D,MAAM,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC1C,gBAAgB,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACvD,qBAAqB,CAAC,eAAe,EAAE,eAAe,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CAC1F"}
1
+ {"version":3,"file":"vector.d.ts","sourceRoot":"","sources":["../../../src/types/rag/vector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AACrF,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAA;AAEzC,MAAM,WAAW,kBAAkB;IAClC,KAAK,EAAE,KAAK,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;CACb;AAED,MAAM,WAAW,gBAAgB;IAChC,SAAS,EAAE,MAAM,EAAE,CAAA;IACnB,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,QAAQ,CAAA;IAClB,eAAe,CAAC,EAAE,eAAe,CAAA;IACjC;;;;;;;;;OASG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAChC,QAAQ,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,WAAW;IAC3B,MAAM,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACtC,MAAM,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAAA;IAC9D,MAAM,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC1C,gBAAgB,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACvD,qBAAqB,CAAC,eAAe,EAAE,eAAe,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CAC1F"}
@@ -1,4 +1,23 @@
1
1
  export type TaskType = 'compaction' | 'summarization' | 'exploration' | 'coding' | 'verification' | 'planning' | 'advisory' | 'default';
2
+ /**
3
+ * Send a particular kind of work to a particular model.
4
+ *
5
+ * **Which keys the runtime consults today: `compaction`, and `default` as its
6
+ * fallback.** That is stated because the rest are silently inert, and an
7
+ * inert key is worse than an absent one — a host who sets `coding` reads it
8
+ * as taking effect. The compaction summary is the call worth routing first
9
+ * regardless: it is the only model call a run makes that nobody asked for,
10
+ * it reads a transcript and writes a summary, and it fires on exactly the
11
+ * long runs where the primary model costs the most.
12
+ *
13
+ * The remaining keys describe sub-agent routing. `SupervisorAgent` already
14
+ * threads this config down to the agent factory, but nothing classifies a
15
+ * spawned task as exploration or coding, and guessing a classifier here
16
+ * would put a wrong model behind a right-looking config.
17
+ *
18
+ * `advisory` is deliberately not consulted: an advisor carries its own
19
+ * `model`, so routing would override an explicit choice with a general one.
20
+ */
2
21
  export interface TaskRouterConfig {
3
22
  readonly compaction?: string | null;
4
23
  readonly summarization?: string | null;
@@ -1 +1 @@
1
- {"version":3,"file":"task-router.d.ts","sourceRoot":"","sources":["../../../src/types/router/task-router.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GACjB,YAAY,GACZ,eAAe,GACf,aAAa,GACb,QAAQ,GACR,cAAc,GACd,UAAU,GACV,UAAU,GACV,SAAS,CAAA;AAEZ,MAAM,WAAW,gBAAgB;IAChC,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACnC,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACtC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACpC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC/B,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACrC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACjC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACjC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAChC"}
1
+ {"version":3,"file":"task-router.d.ts","sourceRoot":"","sources":["../../../src/types/router/task-router.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GACjB,YAAY,GACZ,eAAe,GACf,aAAa,GACb,QAAQ,GACR,cAAc,GACd,UAAU,GACV,UAAU,GACV,SAAS,CAAA;AAEZ;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,WAAW,gBAAgB;IAChC,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACnC,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACtC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACpC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC/B,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACrC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACjC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACjC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAChC"}
@@ -1,5 +1,7 @@
1
1
  import type { RunId } from '../ids/index.js';
2
2
  import type { Message } from '../message/index.js';
3
+ import type { ToolChoice } from '../provider/chat.js';
4
+ import type { Skill } from '../skills/index.js';
3
5
  import type { StepResult } from './step.js';
4
6
  /**
5
7
  * What the loop knows before it calls the model again.
@@ -48,11 +50,62 @@ export interface PrepareStepResult {
48
50
  * it is worth doing when a phase boundary genuinely changes what the
49
51
  * agent should reach for — and not worth doing every step.
50
52
  *
51
- * Note it does NOT touch `tool_choice`. Not every provider has an `allowed_tools`
52
- * parameter, and moving `tool_choice` invalidates cached MESSAGE blocks
53
- * as well — a strictly worse trade for the same effect.
53
+ * Note it does NOT imply a `tool_choice`. Not every provider has an
54
+ * `allowed_tools` parameter, and moving `tool_choice` invalidates cached
55
+ * MESSAGE blocks as well — a strictly worse trade for the same effect.
56
+ * When a step genuinely needs the model FORCED rather than narrowed, ask
57
+ * for it explicitly through {@link PrepareStepResult.toolChoice} and pay
58
+ * that cost knowingly.
54
59
  */
55
60
  readonly activeTools?: readonly string[];
61
+ /**
62
+ * Force this step's tool use: `'required'` to make the model call
63
+ * something, `'none'` to forbid it, or a named function to demand that
64
+ * one. Absent leaves the provider's default.
65
+ *
66
+ * **It applies to this step only, by construction.** That is the whole
67
+ * reason it lives here rather than on the run config. A forced choice
68
+ * that persists makes the model call a tool, see the result, and be
69
+ * forced again — an agent that cannot stop. The one peer SDK that puts
70
+ * `tool_choice` on persistent model settings has to undo it with a
71
+ * tool-use tracker, an opt-out flag and a reset applied at two call
72
+ * sites; the flag defaults to on precisely because turning it off hangs
73
+ * the agent. Here there is nothing to reset and no flag to get wrong:
74
+ * the next step is prepared fresh, so the force cannot outlive the step
75
+ * that asked for it.
76
+ *
77
+ * **It costs more cache than `activeTools`.** Narrowing tools
78
+ * invalidates the tool prefix; moving `tool_choice` invalidates cached
79
+ * message blocks too. Worth it at a real phase boundary — "this step
80
+ * must produce the structured answer" — and not worth it as a habit.
81
+ */
82
+ readonly toolChoice?: ToolChoice;
83
+ /**
84
+ * Put these skills in front of the model for this step only.
85
+ *
86
+ * A run's skills are fixed at `query()` time and rendered into the cached
87
+ * system prefix, so every skill a run might ever need is paid for on
88
+ * every single turn. A phased agent rarely needs them all at once —
89
+ * research wants the search skill, writing wants the style guide, and
90
+ * neither benefits from carrying the other.
91
+ *
92
+ * Rendered into the same ephemeral trailing system message `system`
93
+ * uses, and for the same reason: appending leaves the cached prefix
94
+ * intact, where rewriting the run's prompt would invalidate it every
95
+ * iteration for what is usually one phase's worth of guidance.
96
+ *
97
+ * ADDITIVE to the run's skills, not a replacement. A skill the run
98
+ * always carries is not something a step should be able to take away by
99
+ * naming a different one — that would make every step's list a complete
100
+ * restatement, and a phase that forgot one would silently lose it.
101
+ *
102
+ * Sub-agents are deliberately NOT per-step. Which agents `create_task`
103
+ * can reach is baked into that tool's input schema, so varying it would
104
+ * rebuild the tool catalogue every step — a worse prompt-cache trade
105
+ * than moving tools, for a narrowing a step can already express by
106
+ * withholding `create_task` through {@link PrepareStepResult.activeTools}.
107
+ */
108
+ readonly skills?: readonly Skill[];
56
109
  /** Use a different model for this step. */
57
110
  readonly model?: string;
58
111
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"prepare-step.d.ts","sourceRoot":"","sources":["../../../src/types/run/prepare-step.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAE3C;;;;;;;;;;GAUG;AACH,MAAM,WAAW,kBAAkB;IAClC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAA;IACrB,mEAAmE;IACnE,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,uEAAuE;IACvE,QAAQ,CAAC,QAAQ,EAAE,SAAS,OAAO,EAAE,CAAA;IACrC,sCAAsC;IACtC,QAAQ,CAAC,KAAK,EAAE,SAAS,UAAU,EAAE,CAAA;IAErC;;;;;;;OAOG;IACH,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,iBAAiB,CAAC,CAAA;CAC9C;AAED;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IACjC;;;;;;;;;;;;;;;OAeG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IAExC,2CAA2C;IAC3C,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;IAEvB;;;;;;;OAOG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;IAExB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;IAC7B,QAAQ,CAAC,iBAAiB,CAAC,E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,UAAU,CAAA;IAEhC;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,KAAK,EAAE,CAAA;IAElC,2CAA2C;IAC3C,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;IAEvB;;;;;;;OAOG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;IAExB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;IAC7B,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAA;CACnC;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,WAAW,GAAG,CACzB,OAAO,EAAE,kBAAkB,KACvB,iBAAiB,GAAG,SAAS,GAAG,OAAO,CAAC,iBAAiB,GAAG,SAAS,CAAC,CAAA;AAE3E;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,gBAAgB,GAAG,WAAW,GAAG,SAAS,WAAW,EAAE,CAAA"}
@@ -17,8 +17,24 @@ export interface ToolRegistryRef {
17
17
  * is active, absolute (`workingDirectory`-resolved) otherwise.
18
18
  */
19
19
  export interface FileReadTracker {
20
- recordRead(key: string): void;
20
+ /**
21
+ * `content` lets the tracker fingerprint what was read, which is what
22
+ * makes drift detectable later. Optional so a host that only needs the
23
+ * read-before-overwrite guard can keep its existing implementation.
24
+ */
25
+ recordRead(key: string, content?: string): void;
21
26
  hasRead(key: string): boolean;
27
+ /**
28
+ * Fingerprint of the body captured at the last read, when one was.
29
+ *
30
+ * A file mutation is computed against what the agent READ, and between
31
+ * that read and the write the file may have moved under it — a person
32
+ * editing in an editor, another process, a second agent. The in-process
33
+ * lock cannot see any of those. Comparing this against the body actually
34
+ * on disk at mutation time is what turns a silent lost update into a
35
+ * refusal the agent can act on by re-reading.
36
+ */
37
+ fingerprint?(key: string): string | undefined;
22
38
  }
23
39
  export interface ToolPauseOption {
24
40
  readonly id: string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","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,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAA;CAClD;AAED,cAAc,aAAa,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/tool/index.ts"],"names":[],"mappings":"AAyXA,cAAc,aAAa,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/tool/index.ts"],"names":[],"mappings":"AAyYA,cAAc,aAAa,CAAA"}
@@ -1,4 +1,20 @@
1
1
  import type { LLMToolSchema, ToolDefinition, ToolPermission } from '../tool/index.js';
2
+ /**
3
+ * @deprecated Slated for removal in the next major. Nothing produces or
4
+ * reads it — no code constructs any member, and `ToolsetPolicy.surfaces`,
5
+ * the only field that carries it, is never consulted.
6
+ *
7
+ * It is also the wrong axis. Which tools a run may use is already
8
+ * expressible four ways, all of them per-run and dynamic where this is
9
+ * fixed at definition: `allowedTools` on the query, `ToolAvailability`
10
+ * (`active` / `deferred` / `suspended`) with mid-run activation,
11
+ * `runtimeToolOverrides`, and capability negotiation stripping tools a
12
+ * driver cannot carry. Prefer `allowedTools`.
13
+ *
14
+ * The member names encode deployment shapes this kernel does not own,
15
+ * which is the deeper reason not to keep them: a host's surfaces are the
16
+ * host's to name.
17
+ */
2
18
  export type ToolCatalogSurface = 'chat' | 'supervised' | 'managed-agent' | 'worker' | 'code';
3
19
  export type ToolSourceKind = 'host_tool' | 'provider_builtin' | 'mcp_server' | 'skill' | 'plugin' | 'connector';
4
20
  export type ToolLoadingMode = 'eager' | 'deferred' | 'disabled' | 'suspended';
@@ -30,6 +46,12 @@ export interface ToolsetPolicy {
30
46
  readonly enabled?: boolean;
31
47
  readonly loading?: ToolLoadingMode;
32
48
  readonly preferred?: boolean;
49
+ /**
50
+ * @deprecated Slated for removal in the next major. Never read by
51
+ * anything — setting it has no effect today. Use `allowedTools` on the
52
+ * query to bound which tools a run may use; it says the same thing per
53
+ * run instead of per definition. See {@link ToolCatalogSurface}.
54
+ */
33
55
  readonly surfaces?: readonly ToolCatalogSurface[];
34
56
  readonly providerConfig?: Record<string, unknown>;
35
57
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/toolset/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAErF,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,YAAY,GAAG,eAAe,GAAG,QAAQ,GAAG,MAAM,CAAA;AAE5F,MAAM,MAAM,cAAc,GACvB,WAAW,GACX,kBAAkB,GAClB,YAAY,GACZ,OAAO,GACP,QAAQ,GACR,WAAW,CAAA;AAEd,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,UAAU,GAAG,UAAU,GAAG,WAAW,CAAA;AAE7E,MAAM,WAAW,UAAU;IAC1B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAA;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;IAC7B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,SAAS,CAAC,EAAE;QACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;QACrB,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAA;QACrB,QAAQ,CAAC,SAAS,CAAC,EAAE,iBAAiB,GAAG,KAAK,GAAG,OAAO,CAAA;QACxD,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAA;KAClC,CAAA;IACD,QAAQ,CAAC,YAAY,CAAC,EAAE;QACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;QACrB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;QACtB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;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AAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAA;CACnC;AAED,MAAM,WAAW,mBAAmB;IACnC,QAAQ,CAAC,OAAO,EAAE,SAAS,UAAU,EAAE,CAAA;IACvC,QAAQ,CAAC,QAAQ,EAAE,SAAS,iBAAiB,EAAE,CAAA;IAC/C,QAAQ,CAAC,KAAK,EAAE,SAAS,gBAAgB,EAAE,CAAA;CAC3C"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@namzu/sdk",
3
- "version": "3.0.0",
3
+ "version": "3.2.0",
4
4
  "description": "Open-source AI agent SDK with a built-in runtime. Nothing between you and your agents.",
5
5
  "license": "FSL-1.1-MIT",
6
6
  "type": "module",
@@ -0,0 +1,191 @@
1
+ import { describe, expect, it, vi } from 'vitest'
2
+
3
+ import type { AdvisorDefinition } from '../../types/advisory/index.js'
4
+ import type { Message } from '../../types/message/index.js'
5
+ import { AdvisoryContext } from '../context.js'
6
+ import { TriggerEvaluator } from '../evaluator.js'
7
+ import { AdvisoryExecutor } from '../executor.js'
8
+ import { ADVISORY_RESPONSE_CONTRACT } from '../parse.js'
9
+ import { AdvisorRegistry } from '../registry.js'
10
+
11
+ /**
12
+ * An advisor consulted BY THE MODEL saw the question and nothing else.
13
+ *
14
+ * Two paths reach `AdvisoryExecutor.consult`. The trigger path
15
+ * (`iteration/phases/advisory.ts`) has always passed the live messages, the
16
+ * working state and the tool catalogue. The tool path passed
17
+ * `{ messages: [], iteration: 0 }` — a literal empty context — so the
18
+ * model's own `include_context: true` had nothing to include, and the
19
+ * advisor answered a question about a situation it could not see.
20
+ */
21
+
22
+ function recordingProvider(): { provider: AdvisorDefinition['provider']; calls: Message[][] } {
23
+ const calls: Message[][] = []
24
+ const provider = {
25
+ chatStream: async function* (params: { messages: Message[] }) {
26
+ calls.push(params.messages)
27
+ yield { id: 'a1', delta: { content: 'ADVICE: do the thing' } }
28
+ yield {
29
+ id: 'a1',
30
+ delta: {},
31
+ finishReason: 'stop',
32
+ usage: { promptTokens: 1, completionTokens: 1, totalTokens: 2 },
33
+ }
34
+ },
35
+ } as unknown as AdvisorDefinition['provider']
36
+ return { provider, calls }
37
+ }
38
+
39
+ function advisor(over: Partial<AdvisorDefinition> = {}): AdvisorDefinition {
40
+ return {
41
+ id: 'adv_1',
42
+ name: 'Reviewer',
43
+ provider: recordingProvider().provider,
44
+ model: 'mock-model',
45
+ ...over,
46
+ } as AdvisorDefinition
47
+ }
48
+
49
+ const log = {
50
+ debug: vi.fn(),
51
+ info: vi.fn(),
52
+ warn: vi.fn(),
53
+ error: vi.fn(),
54
+ child: () => log,
55
+ } as never
56
+
57
+ function contextFor(a: AdvisorDefinition): AdvisoryContext {
58
+ return new AdvisoryContext(
59
+ new AdvisorRegistry([a]),
60
+ new AdvisoryExecutor(log),
61
+ new TriggerEvaluator([]),
62
+ )
63
+ }
64
+
65
+ describe('the context a tool-initiated consultation is given', () => {
66
+ it('is empty until the runtime supplies one', () => {
67
+ const ctx = contextFor(advisor())
68
+
69
+ // The fallback exists for a context built without a runtime, and it is
70
+ // what every tool-initiated call used to get.
71
+ expect(ctx.callContext()).toEqual({ messages: [], iteration: 0 })
72
+ })
73
+
74
+ it('is the live run once the runtime wires it', () => {
75
+ const ctx = contextFor(advisor())
76
+ const messages: Message[] = [{ role: 'user', content: 'the situation', timestamp: 1 }]
77
+
78
+ ctx.setCallContextProvider(() => ({ messages, iteration: 7 }))
79
+
80
+ expect(ctx.callContext().messages).toBe(messages)
81
+ expect(ctx.callContext().iteration).toBe(7)
82
+ })
83
+
84
+ it('is read at call time, not at construction', () => {
85
+ const ctx = contextFor(advisor())
86
+ let iteration = 1
87
+ ctx.setCallContextProvider(() => ({ messages: [], iteration }))
88
+
89
+ iteration = 4
90
+
91
+ // The tool is built once per run and called at an unknown later point.
92
+ // A snapshot would hand every advisor the state the run started with.
93
+ expect(ctx.callContext().iteration).toBe(4)
94
+ })
95
+ })
96
+
97
+ describe('what the advisor actually receives', () => {
98
+ it('sees the conversation when context is included', async () => {
99
+ const { provider, calls } = recordingProvider()
100
+ const executor = new AdvisoryExecutor(log)
101
+
102
+ await executor.consult(
103
+ advisor({ provider }),
104
+ { advisorId: 'adv_1', question: 'what next?', includeContext: true },
105
+ { messages: [{ role: 'user', content: 'deploy is failing', timestamp: 1 }], iteration: 2 },
106
+ )
107
+
108
+ const sent = JSON.stringify(calls[0])
109
+ expect(sent).toContain('deploy is failing')
110
+ })
111
+
112
+ it('sees none of it when the caller says not to', async () => {
113
+ const { provider, calls } = recordingProvider()
114
+ const executor = new AdvisoryExecutor(log)
115
+
116
+ await executor.consult(
117
+ advisor({ provider }),
118
+ { advisorId: 'adv_1', question: 'what next?', includeContext: false },
119
+ { messages: [{ role: 'user', content: 'deploy is failing', timestamp: 1 }], iteration: 2 },
120
+ )
121
+
122
+ expect(JSON.stringify(calls[0])).not.toContain('deploy is failing')
123
+ })
124
+
125
+ it('is told when the caller marked the request urgent', async () => {
126
+ const { provider, calls } = recordingProvider()
127
+ const executor = new AdvisoryExecutor(log)
128
+
129
+ await executor.consult(
130
+ advisor({ provider }),
131
+ { advisorId: 'adv_1', question: 'what next?', urgency: 'high' },
132
+ { messages: [], iteration: 1 },
133
+ )
134
+
135
+ // The value used to reach exactly one debug log line, so 'high' and
136
+ // 'low' produced byte-identical requests.
137
+ expect(String(calls[0]?.[0]?.content)).toContain('URGENT')
138
+ })
139
+
140
+ it('is told when there is room to consider alternatives', async () => {
141
+ const { provider, calls } = recordingProvider()
142
+ const executor = new AdvisoryExecutor(log)
143
+
144
+ await executor.consult(
145
+ advisor({ provider }),
146
+ { advisorId: 'adv_1', question: 'what next?', urgency: 'low' },
147
+ { messages: [], iteration: 1 },
148
+ )
149
+
150
+ expect(String(calls[0]?.[0]?.content)).toContain('low urgency')
151
+ })
152
+
153
+ it("appends nothing at all for 'normal', which is the point of not stating it", async () => {
154
+ const { provider, calls } = recordingProvider()
155
+ const executor = new AdvisoryExecutor(log)
156
+ const a = advisor({ provider })
157
+
158
+ await executor.consult(
159
+ a,
160
+ { advisorId: 'adv_1', question: 'what next?', urgency: 'normal' },
161
+ { messages: [], iteration: 1 },
162
+ )
163
+ await executor.consult(
164
+ a,
165
+ { advisorId: 'adv_1', question: 'what next?', urgency: 'high' },
166
+ { messages: [], iteration: 1 },
167
+ )
168
+
169
+ // Asserting "does not contain the other two phrases" is too weak — it
170
+ // would let ANY new sentence in. The response contract is the last
171
+ // thing the prompt says when urgency contributes nothing, so ending on
172
+ // it is what "appended nothing" actually means.
173
+ expect(String(calls[0]?.[0]?.content).trimEnd().endsWith(ADVISORY_RESPONSE_CONTRACT)).toBe(true)
174
+ expect(String(calls[1]?.[0]?.content).trimEnd().endsWith(ADVISORY_RESPONSE_CONTRACT)).toBe(
175
+ false,
176
+ )
177
+ })
178
+
179
+ it('says nothing about urgency when the caller did not', async () => {
180
+ const { provider, calls } = recordingProvider()
181
+ const executor = new AdvisoryExecutor(log)
182
+
183
+ await executor.consult(
184
+ advisor({ provider }),
185
+ { advisorId: 'adv_1', question: 'what next?' },
186
+ { messages: [], iteration: 1 },
187
+ )
188
+
189
+ expect(String(calls[0]?.[0]?.content).trimEnd().endsWith(ADVISORY_RESPONSE_CONTRACT)).toBe(true)
190
+ })
191
+ })
@@ -1,8 +1,20 @@
1
1
  import type { AdvisoryBudget, AdvisoryCallRecord } from '../types/advisory/index.js'
2
2
  import type { TriggerEvaluator } from './evaluator.js'
3
+ import type { AdvisoryCallContext } from './executor.js'
3
4
  import type { AdvisoryExecutor } from './executor.js'
4
5
  import type { AdvisorRegistry } from './registry.js'
5
6
 
7
+ /**
8
+ * What the run looks like right now, for an advisory call that did not come
9
+ * from the iteration loop.
10
+ *
11
+ * A function rather than a snapshot because the tool is built once per run
12
+ * and called at an unknown later point: capturing the context at
13
+ * construction would hand every advisor the state the run had before it
14
+ * started.
15
+ */
16
+ export type AdvisoryCallContextProvider = () => AdvisoryCallContext
17
+
6
18
  export class AdvisoryContext {
7
19
  readonly registry: AdvisorRegistry
8
20
  readonly executor: AdvisoryExecutor
@@ -10,6 +22,7 @@ export class AdvisoryContext {
10
22
  readonly callHistory: AdvisoryCallRecord[] = []
11
23
 
12
24
  private readonly budget: AdvisoryBudget | undefined
25
+ private callContextProvider: AdvisoryCallContextProvider | undefined
13
26
 
14
27
  constructor(
15
28
  registry: AdvisorRegistry,
@@ -23,6 +36,25 @@ export class AdvisoryContext {
23
36
  this.budget = budget
24
37
  }
25
38
 
39
+ /** Wired by the runtime once the run exists. */
40
+ setCallContextProvider(provider: AdvisoryCallContextProvider): void {
41
+ this.callContextProvider = provider
42
+ }
43
+
44
+ /**
45
+ * The call context for a tool-initiated consultation.
46
+ *
47
+ * The trigger path (`iteration/phases/advisory.ts`) has always passed the
48
+ * live messages, working state and tool catalogue. The TOOL path passed
49
+ * `{ messages: [], iteration: 0 }` — a literal empty context — so an
50
+ * advisor consulted by the model saw the question and nothing else, and
51
+ * the model's `include_context` had nothing to include either way. The
52
+ * empty fallback survives only for a context built without a runtime.
53
+ */
54
+ callContext(): AdvisoryCallContext {
55
+ return this.callContextProvider?.() ?? { messages: [], iteration: 0 }
56
+ }
57
+
26
58
  recordCall(record: AdvisoryCallRecord): void {
27
59
  this.callHistory.push(record)
28
60
  }
@@ -11,6 +11,19 @@ import { calculateCost } from '../utils/cost.js'
11
11
  import { type Logger, getRootLogger } from '../utils/logger.js'
12
12
  import { ADVISORY_RESPONSE_CONTRACT, parseAdvisoryResponse } from './parse.js'
13
13
 
14
+ /**
15
+ * What the advisor is told about how urgent the caller said this is.
16
+ *
17
+ * `'normal'` says nothing on purpose. A sentence asserting the ordinary case
18
+ * is prompt weight that changes no answer, and stating it on every call
19
+ * would make the two that matter harder to notice.
20
+ */
21
+ const URGENCY_DIRECTION: Record<'low' | 'normal' | 'high', string | undefined> = {
22
+ high: 'This request is marked URGENT. Lead with the single most important action and keep the reasoning to what is needed to justify it.',
23
+ normal: undefined,
24
+ low: 'This request is marked low urgency. There is room to note secondary considerations and alternatives worth weighing.',
25
+ }
26
+
14
27
  export interface AdvisoryCallContext {
15
28
  readonly messages: Message[]
16
29
  readonly workingStateSummary?: string
@@ -53,7 +66,7 @@ export class AdvisoryExecutor {
53
66
  ): Promise<AdvisoryExecutionResult> {
54
67
  const startMs = Date.now()
55
68
 
56
- const systemPrompt = this.buildSystemPrompt(advisor)
69
+ const systemPrompt = this.buildSystemPrompt(advisor, request.urgency)
57
70
  const contextMessages = this.buildContext(advisor, request, callCtx)
58
71
 
59
72
  const messages: Message[] = [
@@ -100,11 +113,25 @@ export class AdvisoryExecutor {
100
113
  }
101
114
  }
102
115
 
103
- private buildSystemPrompt(advisor: AdvisorDefinition): string {
116
+ private buildSystemPrompt(
117
+ advisor: AdvisorDefinition,
118
+ urgency?: AdvisoryRequest['urgency'],
119
+ ): string {
104
120
  // The contract is appended to every branch, not folded into the
105
121
  // default: an advisor with its own prompt or a persona is still read
106
122
  // back by the same parser, and used to be the one never told so.
107
- return `${this.describeAdvisor(advisor)}\n\n${ADVISORY_RESPONSE_CONTRACT}`
123
+ const parts = [this.describeAdvisor(advisor), ADVISORY_RESPONSE_CONTRACT]
124
+
125
+ // The caller is invited to say how urgent this is, and the value used
126
+ // to reach exactly one debug log line — `urgency: 'high'` and
127
+ // `urgency: 'low'` produced byte-identical requests. Telling the
128
+ // ADVISOR is the honest minimum: it is the party that can act on the
129
+ // answer, and it costs one sentence rather than a routing policy this
130
+ // kernel has no business inventing.
131
+ const direction = URGENCY_DIRECTION[urgency ?? 'normal']
132
+ if (direction) parts.push(direction)
133
+
134
+ return parts.join('\n\n')
108
135
  }
109
136
 
110
137
  private describeAdvisor(advisor: AdvisorDefinition): string {