@kilnai/core 0.23.2 → 1.0.1

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 (297) hide show
  1. package/dist/agents/execution-identity.d.ts +15 -0
  2. package/dist/agents/execution-identity.d.ts.map +1 -0
  3. package/dist/agents/execution-identity.js +42 -0
  4. package/dist/agents/execution-identity.js.map +1 -0
  5. package/dist/agents/index.d.ts +6 -1
  6. package/dist/agents/index.d.ts.map +1 -1
  7. package/dist/agents/index.js +4 -1
  8. package/dist/agents/index.js.map +1 -1
  9. package/dist/agents/infrastructure/__tests__/codex-oauth-auth.test.d.ts +2 -0
  10. package/dist/agents/infrastructure/__tests__/codex-oauth-auth.test.d.ts.map +1 -0
  11. package/dist/agents/infrastructure/__tests__/codex-oauth-auth.test.js +313 -0
  12. package/dist/agents/infrastructure/__tests__/codex-oauth-auth.test.js.map +1 -0
  13. package/dist/agents/infrastructure/__tests__/codex-oauth.test.d.ts +2 -0
  14. package/dist/agents/infrastructure/__tests__/codex-oauth.test.d.ts.map +1 -0
  15. package/dist/agents/infrastructure/__tests__/codex-oauth.test.js +720 -0
  16. package/dist/agents/infrastructure/__tests__/codex-oauth.test.js.map +1 -0
  17. package/dist/agents/infrastructure/codex-oauth-auth.d.ts +41 -0
  18. package/dist/agents/infrastructure/codex-oauth-auth.d.ts.map +1 -0
  19. package/dist/agents/infrastructure/codex-oauth-auth.js +204 -0
  20. package/dist/agents/infrastructure/codex-oauth-auth.js.map +1 -0
  21. package/dist/agents/infrastructure/codex-oauth.d.ts +32 -0
  22. package/dist/agents/infrastructure/codex-oauth.d.ts.map +1 -0
  23. package/dist/agents/infrastructure/codex-oauth.js +371 -0
  24. package/dist/agents/infrastructure/codex-oauth.js.map +1 -0
  25. package/dist/agents/model-capability-registry.d.ts +2 -0
  26. package/dist/agents/model-capability-registry.d.ts.map +1 -1
  27. package/dist/agents/model-capability-registry.js +11 -2
  28. package/dist/agents/model-capability-registry.js.map +1 -1
  29. package/dist/agents/model-pricing.d.ts +2 -0
  30. package/dist/agents/model-pricing.d.ts.map +1 -1
  31. package/dist/agents/model-pricing.js +10 -0
  32. package/dist/agents/model-pricing.js.map +1 -1
  33. package/dist/cost/cost-tracker.d.ts +1 -0
  34. package/dist/cost/cost-tracker.d.ts.map +1 -1
  35. package/dist/cost/cost-tracker.js +6 -3
  36. package/dist/cost/cost-tracker.js.map +1 -1
  37. package/dist/cost/index.d.ts +2 -0
  38. package/dist/cost/index.d.ts.map +1 -1
  39. package/dist/cost/index.js +1 -0
  40. package/dist/cost/index.js.map +1 -1
  41. package/dist/cost/models-dev-client.d.ts +20 -0
  42. package/dist/cost/models-dev-client.d.ts.map +1 -0
  43. package/dist/cost/models-dev-client.js +91 -0
  44. package/dist/cost/models-dev-client.js.map +1 -0
  45. package/dist/domain/index.d.ts +1 -0
  46. package/dist/domain/index.d.ts.map +1 -1
  47. package/dist/domain/index.js.map +1 -1
  48. package/dist/engine/composites/team.d.ts +1 -1
  49. package/dist/engine/composites/team.d.ts.map +1 -1
  50. package/dist/engine/composites/team.js +1 -17
  51. package/dist/engine/composites/team.js.map +1 -1
  52. package/dist/engine/domain/cron.d.ts +3 -1
  53. package/dist/engine/domain/cron.d.ts.map +1 -1
  54. package/dist/engine/domain/cron.js +41 -10
  55. package/dist/engine/domain/cron.js.map +1 -1
  56. package/dist/engine/domain/tool-execution.d.ts +21 -0
  57. package/dist/engine/domain/tool-execution.d.ts.map +1 -1
  58. package/dist/engine/error-catalog.d.ts.map +1 -1
  59. package/dist/engine/error-catalog.js +8 -0
  60. package/dist/engine/error-catalog.js.map +1 -1
  61. package/dist/engine/errors.d.ts +2 -1
  62. package/dist/engine/errors.d.ts.map +1 -1
  63. package/dist/engine/errors.js +10 -0
  64. package/dist/engine/errors.js.map +1 -1
  65. package/dist/engine/index.d.ts +1 -1
  66. package/dist/engine/index.d.ts.map +1 -1
  67. package/dist/engine/index.js +1 -1
  68. package/dist/engine/index.js.map +1 -1
  69. package/dist/engine/loader/app-loader.js +1 -1
  70. package/dist/engine/loader/app-loader.js.map +1 -1
  71. package/dist/events/index.d.ts +18 -1
  72. package/dist/events/index.d.ts.map +1 -1
  73. package/dist/events/index.js +2 -0
  74. package/dist/events/index.js.map +1 -1
  75. package/dist/field/domain/field-config.d.ts +8 -0
  76. package/dist/field/domain/field-config.d.ts.map +1 -0
  77. package/dist/field/domain/field-config.js +7 -0
  78. package/dist/field/domain/field-config.js.map +1 -0
  79. package/dist/field/domain/field-store.d.ts +8 -0
  80. package/dist/field/domain/field-store.d.ts.map +1 -0
  81. package/dist/field/domain/field-store.js +2 -0
  82. package/dist/field/domain/field-store.js.map +1 -0
  83. package/dist/field/domain/field.d.ts +22 -0
  84. package/dist/field/domain/field.d.ts.map +1 -0
  85. package/dist/field/domain/field.js +2 -0
  86. package/dist/field/domain/field.js.map +1 -0
  87. package/dist/field/field-inhibitor.d.ts +17 -0
  88. package/dist/field/field-inhibitor.d.ts.map +1 -0
  89. package/dist/field/field-inhibitor.js +50 -0
  90. package/dist/field/field-inhibitor.js.map +1 -0
  91. package/dist/field/field-propagator.d.ts +19 -0
  92. package/dist/field/field-propagator.d.ts.map +1 -0
  93. package/dist/field/field-propagator.js +69 -0
  94. package/dist/field/field-propagator.js.map +1 -0
  95. package/dist/field/field-service.d.ts +18 -0
  96. package/dist/field/field-service.d.ts.map +1 -0
  97. package/dist/field/field-service.js +57 -0
  98. package/dist/field/field-service.js.map +1 -0
  99. package/dist/field/field-updater.d.ts +19 -0
  100. package/dist/field/field-updater.d.ts.map +1 -0
  101. package/dist/field/field-updater.js +64 -0
  102. package/dist/field/field-updater.js.map +1 -0
  103. package/dist/field/index.d.ts +15 -0
  104. package/dist/field/index.d.ts.map +1 -0
  105. package/dist/field/index.js +9 -0
  106. package/dist/field/index.js.map +1 -0
  107. package/dist/field/infrastructure/in-memory-field-store.d.ts +16 -0
  108. package/dist/field/infrastructure/in-memory-field-store.d.ts.map +1 -0
  109. package/dist/field/infrastructure/in-memory-field-store.js +72 -0
  110. package/dist/field/infrastructure/in-memory-field-store.js.map +1 -0
  111. package/dist/field/infrastructure/sqlite-field-store.d.ts +20 -0
  112. package/dist/field/infrastructure/sqlite-field-store.d.ts.map +1 -0
  113. package/dist/field/infrastructure/sqlite-field-store.js +107 -0
  114. package/dist/field/infrastructure/sqlite-field-store.js.map +1 -0
  115. package/dist/field/stability-monitor.d.ts +24 -0
  116. package/dist/field/stability-monitor.d.ts.map +1 -0
  117. package/dist/field/stability-monitor.js +72 -0
  118. package/dist/field/stability-monitor.js.map +1 -0
  119. package/dist/index.d.ts +5 -1
  120. package/dist/index.d.ts.map +1 -1
  121. package/dist/index.js +4 -1
  122. package/dist/index.js.map +1 -1
  123. package/dist/memory/context-budget.d.ts +17 -0
  124. package/dist/memory/context-budget.d.ts.map +1 -0
  125. package/dist/memory/context-budget.js +29 -0
  126. package/dist/memory/context-budget.js.map +1 -0
  127. package/dist/memory/context-cache.d.ts +23 -0
  128. package/dist/memory/context-cache.d.ts.map +1 -0
  129. package/dist/memory/context-cache.js +34 -0
  130. package/dist/memory/context-cache.js.map +1 -0
  131. package/dist/memory/index.d.ts +15 -3
  132. package/dist/memory/index.d.ts.map +1 -1
  133. package/dist/memory/index.js +5 -0
  134. package/dist/memory/index.js.map +1 -1
  135. package/dist/memory/memory-manager.d.ts +1 -1
  136. package/dist/memory/memory-manager.d.ts.map +1 -1
  137. package/dist/memory/memory-manager.js +2 -2
  138. package/dist/memory/memory-manager.js.map +1 -1
  139. package/dist/memory/project-store.js +1 -1
  140. package/dist/memory/project-store.js.map +1 -1
  141. package/dist/memory/resume-policy.d.ts +21 -0
  142. package/dist/memory/resume-policy.d.ts.map +1 -0
  143. package/dist/memory/resume-policy.js +70 -0
  144. package/dist/memory/resume-policy.js.map +1 -0
  145. package/dist/memory/resume-signals.d.ts +8 -0
  146. package/dist/memory/resume-signals.d.ts.map +1 -0
  147. package/dist/memory/resume-signals.js +8 -0
  148. package/dist/memory/resume-signals.js.map +1 -0
  149. package/dist/memory/sqlite-store.d.ts +6 -1
  150. package/dist/memory/sqlite-store.d.ts.map +1 -1
  151. package/dist/memory/sqlite-store.js +88 -11
  152. package/dist/memory/sqlite-store.js.map +1 -1
  153. package/dist/memory/task-shape.d.ts +2 -0
  154. package/dist/memory/task-shape.d.ts.map +1 -0
  155. package/dist/memory/task-shape.js +9 -0
  156. package/dist/memory/task-shape.js.map +1 -0
  157. package/dist/observability/span-mapper.d.ts.map +1 -1
  158. package/dist/observability/span-mapper.js +18 -0
  159. package/dist/observability/span-mapper.js.map +1 -1
  160. package/dist/orchestrator/chain-governor.d.ts +62 -0
  161. package/dist/orchestrator/chain-governor.d.ts.map +1 -0
  162. package/dist/orchestrator/chain-governor.js +80 -0
  163. package/dist/orchestrator/chain-governor.js.map +1 -0
  164. package/dist/orchestrator/demand-allocator.d.ts +64 -0
  165. package/dist/orchestrator/demand-allocator.d.ts.map +1 -0
  166. package/dist/orchestrator/demand-allocator.js +139 -0
  167. package/dist/orchestrator/demand-allocator.js.map +1 -0
  168. package/dist/orchestrator/demand-signal.d.ts +9 -0
  169. package/dist/orchestrator/demand-signal.d.ts.map +1 -0
  170. package/dist/orchestrator/demand-signal.js +23 -0
  171. package/dist/orchestrator/demand-signal.js.map +1 -0
  172. package/dist/orchestrator/index.d.ts +8 -2
  173. package/dist/orchestrator/index.d.ts.map +1 -1
  174. package/dist/orchestrator/index.js +8 -1
  175. package/dist/orchestrator/index.js.map +1 -1
  176. package/dist/orchestrator/orchestrator-checkpoint-support.d.ts +43 -0
  177. package/dist/orchestrator/orchestrator-checkpoint-support.d.ts.map +1 -0
  178. package/dist/orchestrator/orchestrator-checkpoint-support.js +147 -0
  179. package/dist/orchestrator/orchestrator-checkpoint-support.js.map +1 -0
  180. package/dist/orchestrator/orchestrator-dev-tool-support.d.ts +30 -0
  181. package/dist/orchestrator/orchestrator-dev-tool-support.d.ts.map +1 -0
  182. package/dist/orchestrator/orchestrator-dev-tool-support.js +125 -0
  183. package/dist/orchestrator/orchestrator-dev-tool-support.js.map +1 -0
  184. package/dist/orchestrator/orchestrator-interrupt-support.d.ts +22 -0
  185. package/dist/orchestrator/orchestrator-interrupt-support.d.ts.map +1 -0
  186. package/dist/orchestrator/orchestrator-interrupt-support.js +64 -0
  187. package/dist/orchestrator/orchestrator-interrupt-support.js.map +1 -0
  188. package/dist/orchestrator/orchestrator-memory-sync-support.d.ts +16 -0
  189. package/dist/orchestrator/orchestrator-memory-sync-support.d.ts.map +1 -0
  190. package/dist/orchestrator/orchestrator-memory-sync-support.js +25 -0
  191. package/dist/orchestrator/orchestrator-memory-sync-support.js.map +1 -0
  192. package/dist/orchestrator/orchestrator-verification-support.d.ts +17 -0
  193. package/dist/orchestrator/orchestrator-verification-support.d.ts.map +1 -0
  194. package/dist/orchestrator/orchestrator-verification-support.js +29 -0
  195. package/dist/orchestrator/orchestrator-verification-support.js.map +1 -0
  196. package/dist/orchestrator/orchestrator.d.ts +24 -16
  197. package/dist/orchestrator/orchestrator.d.ts.map +1 -1
  198. package/dist/orchestrator/orchestrator.js +106 -235
  199. package/dist/orchestrator/orchestrator.js.map +1 -1
  200. package/dist/orchestrator/strategies/index.d.ts +0 -1
  201. package/dist/orchestrator/strategies/index.d.ts.map +1 -1
  202. package/dist/orchestrator/strategies/index.js +1 -5
  203. package/dist/orchestrator/strategies/index.js.map +1 -1
  204. package/dist/orchestrator/task-registry.d.ts +94 -0
  205. package/dist/orchestrator/task-registry.d.ts.map +1 -0
  206. package/dist/orchestrator/task-registry.js +167 -0
  207. package/dist/orchestrator/task-registry.js.map +1 -0
  208. package/dist/safety/pii-scanner.d.ts.map +1 -1
  209. package/dist/safety/pii-scanner.js +7 -8
  210. package/dist/safety/pii-scanner.js.map +1 -1
  211. package/dist/safety/rails.d.ts.map +1 -1
  212. package/dist/safety/rails.js +9 -5
  213. package/dist/safety/rails.js.map +1 -1
  214. package/dist/security/dangerous-command-detector.d.ts +5 -0
  215. package/dist/security/dangerous-command-detector.d.ts.map +1 -0
  216. package/dist/security/dangerous-command-detector.js +92 -0
  217. package/dist/security/dangerous-command-detector.js.map +1 -0
  218. package/dist/security/index.d.ts +1 -0
  219. package/dist/security/index.d.ts.map +1 -1
  220. package/dist/security/index.js +1 -0
  221. package/dist/security/index.js.map +1 -1
  222. package/dist/security/prompt-scanner.d.ts.map +1 -1
  223. package/dist/security/prompt-scanner.js +117 -4
  224. package/dist/security/prompt-scanner.js.map +1 -1
  225. package/dist/skill/index.d.ts +4 -0
  226. package/dist/skill/index.d.ts.map +1 -1
  227. package/dist/skill/index.js +2 -0
  228. package/dist/skill/index.js.map +1 -1
  229. package/dist/skill/skill-capture.d.ts +46 -0
  230. package/dist/skill/skill-capture.d.ts.map +1 -0
  231. package/dist/skill/skill-capture.js +150 -0
  232. package/dist/skill/skill-capture.js.map +1 -0
  233. package/dist/skill/skill-generator.d.ts +20 -0
  234. package/dist/skill/skill-generator.d.ts.map +1 -0
  235. package/dist/skill/skill-generator.js +106 -0
  236. package/dist/skill/skill-generator.js.map +1 -0
  237. package/dist/tools/domain/tool-environment.d.ts +16 -0
  238. package/dist/tools/domain/tool-environment.d.ts.map +1 -0
  239. package/dist/tools/domain/tool-environment.js +94 -0
  240. package/dist/tools/domain/tool-environment.js.map +1 -0
  241. package/dist/tools/domain/tool-registry.d.ts +10 -0
  242. package/dist/tools/domain/tool-registry.d.ts.map +1 -0
  243. package/dist/tools/domain/tool-registry.js +23 -0
  244. package/dist/tools/domain/tool-registry.js.map +1 -0
  245. package/dist/tools/domain/tool.d.ts +29 -0
  246. package/dist/tools/domain/tool.d.ts.map +1 -0
  247. package/dist/tools/domain/tool.js +123 -0
  248. package/dist/tools/domain/tool.js.map +1 -0
  249. package/dist/tools/index.d.ts +18 -0
  250. package/dist/tools/index.d.ts.map +1 -0
  251. package/dist/tools/index.js +13 -0
  252. package/dist/tools/index.js.map +1 -0
  253. package/dist/tools/infrastructure/bash-tool.d.ts +20 -0
  254. package/dist/tools/infrastructure/bash-tool.d.ts.map +1 -0
  255. package/dist/tools/infrastructure/bash-tool.js +84 -0
  256. package/dist/tools/infrastructure/bash-tool.js.map +1 -0
  257. package/dist/tools/infrastructure/edit-tool.d.ts +9 -0
  258. package/dist/tools/infrastructure/edit-tool.d.ts.map +1 -0
  259. package/dist/tools/infrastructure/edit-tool.js +80 -0
  260. package/dist/tools/infrastructure/edit-tool.js.map +1 -0
  261. package/dist/tools/infrastructure/git-tool.d.ts +20 -0
  262. package/dist/tools/infrastructure/git-tool.d.ts.map +1 -0
  263. package/dist/tools/infrastructure/git-tool.js +85 -0
  264. package/dist/tools/infrastructure/git-tool.js.map +1 -0
  265. package/dist/tools/infrastructure/glob-tool.d.ts +23 -0
  266. package/dist/tools/infrastructure/glob-tool.d.ts.map +1 -0
  267. package/dist/tools/infrastructure/glob-tool.js +88 -0
  268. package/dist/tools/infrastructure/glob-tool.js.map +1 -0
  269. package/dist/tools/infrastructure/grep-tool.d.ts +23 -0
  270. package/dist/tools/infrastructure/grep-tool.d.ts.map +1 -0
  271. package/dist/tools/infrastructure/grep-tool.js +146 -0
  272. package/dist/tools/infrastructure/grep-tool.js.map +1 -0
  273. package/dist/tools/infrastructure/read-tool.d.ts +9 -0
  274. package/dist/tools/infrastructure/read-tool.d.ts.map +1 -0
  275. package/dist/tools/infrastructure/read-tool.js +45 -0
  276. package/dist/tools/infrastructure/read-tool.js.map +1 -0
  277. package/dist/tools/infrastructure/tool-helpers.d.ts +37 -0
  278. package/dist/tools/infrastructure/tool-helpers.d.ts.map +1 -0
  279. package/dist/tools/infrastructure/tool-helpers.js +145 -0
  280. package/dist/tools/infrastructure/tool-helpers.js.map +1 -0
  281. package/dist/tools/infrastructure/write-tool.d.ts +9 -0
  282. package/dist/tools/infrastructure/write-tool.d.ts.map +1 -0
  283. package/dist/tools/infrastructure/write-tool.js +38 -0
  284. package/dist/tools/infrastructure/write-tool.js.map +1 -0
  285. package/dist/tools/mcp/dev-tools-server.d.ts +37 -0
  286. package/dist/tools/mcp/dev-tools-server.d.ts.map +1 -0
  287. package/dist/tools/mcp/dev-tools-server.js +94 -0
  288. package/dist/tools/mcp/dev-tools-server.js.map +1 -0
  289. package/dist/tools/tool-executor.d.ts +34 -0
  290. package/dist/tools/tool-executor.d.ts.map +1 -0
  291. package/dist/tools/tool-executor.js +123 -0
  292. package/dist/tools/tool-executor.js.map +1 -0
  293. package/package.json +6 -5
  294. package/dist/orchestrator/strategies/swarm-strategy.d.ts +0 -36
  295. package/dist/orchestrator/strategies/swarm-strategy.d.ts.map +0 -1
  296. package/dist/orchestrator/strategies/swarm-strategy.js +0 -126
  297. package/dist/orchestrator/strategies/swarm-strategy.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dev-tools-server.js","sourceRoot":"","sources":["../../../src/tools/mcp/dev-tools-server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGjD,MAAM,WAAW,GAAG,kBAAkB,CAAC;AACvC,MAAM,cAAc,GAAG,OAAO,CAAC;AAkB/B,SAAS,cAAc;IACrB,OAAO,OAAO,CAAC,GAAG,CAAC;QACjB,MAAM,CAAC,2CAA2C,CAAC;QACnD,MAAM,CAAC,oCAAoC,CAAC;KAC7C,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,YAAY,EAAE,WAAW,CAAC,EAAE,EAAE,CAAC,CAAC;QACxC,MAAM,EAAE,YAAY,CAAC,MAAyC;QAC9D,sBAAsB,EAAE,WAAW,CAAC,sBAAsB;QAC1D,qBAAqB,EAAE,WAAW,CAAC,qBAAqB;KACzD,CAAC,CAAC,CAAC;AACN,CAAC;AAiBD,MAAM,OAAO,iBAAiB;IACX,MAAM,CAAyB;IACxC,GAAG,CAAyB;IAC5B,UAAU,CAAkC;IAEpD,YAAY,OAAiC;QAC3C,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAC/B,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,KAAc;QACvC,IAAI,KAAK,YAAY,SAAS,EAAE,CAAC;YAC/B,OAAO,GAAG,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC;QAC3C,CAAC;QACD,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAChE,CAAC;CACF"}
@@ -0,0 +1,34 @@
1
+ import type { RetryConfig, ToolAuthorizer, ToolExecutionResult } from "../engine/domain/tool-execution.js";
2
+ import type { ToolResult } from "./domain/tool.js";
3
+ import { DevToolRegistry } from "./domain/tool-registry.js";
4
+ export interface DevToolExecutionRequest {
5
+ readonly name: string;
6
+ readonly input: Record<string, unknown>;
7
+ readonly sandbox?: unknown;
8
+ readonly retry?: RetryConfig;
9
+ }
10
+ export interface DevToolExecutionBridgeOptions {
11
+ readonly registry: DevToolRegistry;
12
+ readonly authorizer?: ToolAuthorizer;
13
+ }
14
+ export interface DevToolExecutionResult extends ToolExecutionResult {
15
+ readonly result: ToolResult;
16
+ }
17
+ export interface DevToolAuthorizationDecision {
18
+ readonly toolName: string;
19
+ readonly level: number;
20
+ readonly allowed: boolean;
21
+ readonly requiresApproval: boolean;
22
+ readonly reason: string;
23
+ }
24
+ export declare class DevToolExecutionBridge {
25
+ private readonly registry;
26
+ private readonly authorizer?;
27
+ constructor(options: DevToolExecutionBridgeOptions);
28
+ execute(request: DevToolExecutionRequest): Promise<DevToolExecutionResult>;
29
+ authorizeRequest(name: string): DevToolAuthorizationDecision;
30
+ private executeSingle;
31
+ private authorize;
32
+ private getAuthorizationDecision;
33
+ }
34
+ //# sourceMappingURL=tool-executor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-executor.d.ts","sourceRoot":"","sources":["../../src/tools/tool-executor.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,WAAW,EACX,cAAc,EACd,mBAAmB,EACpB,MAAM,oCAA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} from "../agents/tool-execution-engine.js";
2
+ import { KilnError } from "../engine/errors.js";
3
+ export class DevToolExecutionBridge {
4
+ registry;
5
+ authorizer;
6
+ constructor(options) {
7
+ this.registry = options.registry;
8
+ this.authorizer = options.authorizer;
9
+ }
10
+ async execute(request) {
11
+ const primaryTool = this.registry.lookup(request.name);
12
+ if (!primaryTool) {
13
+ throw new KilnError("INTERNAL_ERROR", `Tool "${request.name}" is not registered`, {
14
+ context: { toolName: request.name },
15
+ retryable: false,
16
+ });
17
+ }
18
+ this.authorize(primaryTool);
19
+ if (request.retry?.fallback && !this.registry.lookup(request.retry.fallback)) {
20
+ throw new KilnError("INTERNAL_ERROR", `Fallback tool "${request.retry.fallback}" is not registered`, {
21
+ context: { fallbackToolName: request.retry.fallback },
22
+ retryable: false,
23
+ });
24
+ }
25
+ const executor = async (toolName, input) => {
26
+ return await this.executeSingle(toolName, input, request.sandbox);
27
+ };
28
+ const fallbackExecutor = request.retry?.fallback ? executor : undefined;
29
+ const execution = await executeWithRetry(request.name, request.input, executor, request.retry, fallbackExecutor);
30
+ if (!isToolResult(execution.result)) {
31
+ throw new KilnError("INTERNAL_ERROR", `Tool "${request.name}" returned an invalid result shape`, {
32
+ context: {
33
+ toolName: request.name,
34
+ resultType: typeof execution.result,
35
+ },
36
+ retryable: false,
37
+ });
38
+ }
39
+ return {
40
+ ...execution,
41
+ result: execution.result,
42
+ };
43
+ }
44
+ authorizeRequest(name) {
45
+ const tool = this.registry.lookup(name);
46
+ if (!tool) {
47
+ throw new KilnError("INTERNAL_ERROR", `Tool "${name}" is not registered`, {
48
+ context: { toolName: name },
49
+ retryable: false,
50
+ });
51
+ }
52
+ return this.getAuthorizationDecision(tool);
53
+ }
54
+ async executeSingle(toolName, input, sandbox) {
55
+ const tool = this.registry.lookup(toolName);
56
+ if (!tool) {
57
+ throw new KilnError("INTERNAL_ERROR", `Tool "${toolName}" is not registered`, {
58
+ context: { toolName },
59
+ retryable: false,
60
+ });
61
+ }
62
+ this.authorize(tool);
63
+ return await tool.execute({ name: toolName, input }, sandbox);
64
+ }
65
+ authorize(tool) {
66
+ const decision = this.getAuthorizationDecision(tool);
67
+ if (!decision.allowed) {
68
+ throw new KilnError("TOOL_AUTHORIZATION_DENIED", decision.reason, {
69
+ context: {
70
+ toolName: tool.name,
71
+ level: decision.level,
72
+ },
73
+ retryable: false,
74
+ });
75
+ }
76
+ if (decision.requiresApproval) {
77
+ throw new KilnError("TOOL_APPROVAL_REQUIRED", decision.reason, {
78
+ context: {
79
+ toolName: tool.name,
80
+ level: decision.level,
81
+ requiresApproval: true,
82
+ },
83
+ retryable: false,
84
+ });
85
+ }
86
+ }
87
+ getAuthorizationDecision(tool) {
88
+ if (!this.authorizer) {
89
+ return {
90
+ toolName: tool.name,
91
+ level: 2,
92
+ allowed: true,
93
+ requiresApproval: false,
94
+ reason: "Audited execution",
95
+ };
96
+ }
97
+ const decision = this.authorizer.authorize(tool.name, tool.annotations);
98
+ return {
99
+ toolName: tool.name,
100
+ level: decision.level,
101
+ allowed: decision.allowed,
102
+ requiresApproval: decision.requiresApproval,
103
+ reason: decision.reason,
104
+ };
105
+ }
106
+ }
107
+ function isToolResult(value) {
108
+ if (!value || typeof value !== "object") {
109
+ return false;
110
+ }
111
+ const candidate = value;
112
+ if (typeof candidate.output !== "string") {
113
+ return false;
114
+ }
115
+ if (typeof candidate.isError !== "boolean") {
116
+ return false;
117
+ }
118
+ if (candidate.metadata !== undefined && typeof candidate.metadata !== "object") {
119
+ return false;
120
+ }
121
+ return true;
122
+ }
123
+ //# sourceMappingURL=tool-executor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-executor.js","sourceRoot":"","sources":["../../src/tools/tool-executor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAOtE,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AA4BhD,MAAM,OAAO,sBAAsB;IAChB,QAAQ,CAAkB;IAC1B,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EACT,IAAI,CAAC,WAAgD,CACtD,CAAC;QAEF,OAAO;YACL,QAAQ,EAAE,IAAI,CAAC,IAAI;YACnB,KAAK,EAAE,QAAQ,CAAC,KAAK;YACrB,OAAO,EAAE,QAAQ,CAAC,OAAO;YACzB,gBAAgB,EAAE,QAAQ,CAAC,gBAAgB;YAC3C,MAAM,EAAE,QAAQ,CAAC,MAAM;SACxB,CAAC;IACJ,CAAC;CACF;AAED,SAAS,YAAY,CAAC,KAAc;IAClC,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QACxC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,SAAS,GAAG,KAIjB,CAAC;IAEF,IAAI,OAAO,SAAS,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;QACzC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,OAAO,SAAS,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;QAC3C,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,SAAS,CAAC,QAAQ,KAAK,SAAS,IAAI,OAAO,SAAS,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAC/E,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kilnai/core",
3
- "version": "0.23.2",
4
- "description": "Domain-agnostic AI orchestration engine -- 7 primitives, 3 composites, YAML-configured",
3
+ "version": "1.0.1",
4
+ "description": "Cybernetic control plane for agentic systems with governed context, memory, safety, and execution",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {
@@ -19,7 +19,7 @@
19
19
  "typecheck": "tsc --noEmit",
20
20
  "test": "vitest run"
21
21
  },
22
- "license": "MIT",
22
+ "license": "Apache-2.0",
23
23
  "repository": {
24
24
  "type": "git",
25
25
  "url": "https://github.com/sequelcore/kiln.git",
@@ -28,8 +28,8 @@
28
28
  "homepage": "https://github.com/sequelcore/kiln/tree/main/packages/core",
29
29
  "keywords": [
30
30
  "ai",
31
- "orchestration",
32
- "multi-agent",
31
+ "control-plane",
32
+ "agentic",
33
33
  "yaml",
34
34
  "llm",
35
35
  "anthropic",
@@ -40,6 +40,7 @@
40
40
  "access": "public"
41
41
  },
42
42
  "dependencies": {
43
+ "@kilnai/tools": "^1.0.1",
43
44
  "@anthropic-ai/sdk": "^0.74.0",
44
45
  "@modelcontextprotocol/sdk": "^1.26.0",
45
46
  "yaml": "^2.8.2"
@@ -1,36 +0,0 @@
1
- import type { ExecutionStrategy, StrategyContext, StrategyHandler } from "./index.js";
2
- import type { TaskNode } from "../../tree/index.js";
3
- /** Handoff request parsed from agent output */
4
- export interface HandoffRequest {
5
- readonly targetAgent: string;
6
- readonly reason: string;
7
- readonly context?: Record<string, unknown>;
8
- }
9
- /** Configuration for swarm behavior */
10
- export interface SwarmConfig {
11
- readonly maxHandoffDepth: number;
12
- }
13
- /**
14
- * Swarm mode: agents hand control to each other via handoff capabilities.
15
- * No central coordinator. Active agent tracked per-task.
16
- *
17
- * Flow:
18
- * 1. Start with first agent in the agents map
19
- * 2. Active agent processes the current task
20
- * 3. If agent output indicates a handoff, control transfers to target agent
21
- * 4. Continue until no more handoffs (agent completes without handoff)
22
- *
23
- * Cycle detection: track handoff chain, error if same agent seen twice in one task.
24
- * Max handoff depth per task (configurable, default 10).
25
- */
26
- export declare class SwarmStrategy implements ExecutionStrategy {
27
- private readonly config;
28
- constructor(config?: Partial<SwarmConfig>);
29
- execute(context: StrategyContext, handler: StrategyHandler): Promise<TaskNode[]>;
30
- /**
31
- * Parse a handoff request from agent output.
32
- * Returns null if no handoff is indicated.
33
- */
34
- private parseHandoff;
35
- }
36
- //# sourceMappingURL=swarm-strategy.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"swarm-strategy.d.ts","sourceRoot":"","sources":["../../../src/orchestrator/strategies/swarm-strategy.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AACtF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAGpD,+CAA+C;AAC/C,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC5C;AAED,uCAAuC;AACvC,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;CAClC;AAMD;;;;;;;;;;;;GAYG;AACH,qBAAa,aAAc,YAAW,iBAAiB;IACrD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAc;gBAEzB,MAAM,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC;IAInC,OAAO,CAAC,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IAqFtF;;;OAGG;IACH,OAAO,CAAC,YAAY;CA0BrB"}
@@ -1,126 +0,0 @@
1
- // Swarm strategy: agents hand control to each other via handoff capabilities
2
- // No central coordinator. Active agent tracked per-task.
3
- const DEFAULT_SWARM_CONFIG = {
4
- maxHandoffDepth: 10,
5
- };
6
- /**
7
- * Swarm mode: agents hand control to each other via handoff capabilities.
8
- * No central coordinator. Active agent tracked per-task.
9
- *
10
- * Flow:
11
- * 1. Start with first agent in the agents map
12
- * 2. Active agent processes the current task
13
- * 3. If agent output indicates a handoff, control transfers to target agent
14
- * 4. Continue until no more handoffs (agent completes without handoff)
15
- *
16
- * Cycle detection: track handoff chain, error if same agent seen twice in one task.
17
- * Max handoff depth per task (configurable, default 10).
18
- */
19
- export class SwarmStrategy {
20
- config;
21
- constructor(config) {
22
- this.config = { ...DEFAULT_SWARM_CONFIG, ...config };
23
- }
24
- async execute(context, handler) {
25
- const { team, tree, eventBus, sessionId } = context;
26
- const agentKeys = Object.keys(team.agents);
27
- if (agentKeys.length < 2) {
28
- throw new Error("Swarm strategy requires at least 2 agents");
29
- }
30
- while (!tree.isComplete) {
31
- const batch = tree.selectBatch();
32
- if (batch.length === 0)
33
- break;
34
- for (const task of batch) {
35
- try {
36
- let activeAgent = agentKeys[0];
37
- const visitedAgents = new Set();
38
- let handoffCount = 0;
39
- let taskCompleted = false;
40
- while (!taskCompleted) {
41
- // Cycle detection -- mark task as refuted instead of aborting batch
42
- if (visitedAgents.has(activeAgent)) {
43
- tree.updateStatus(task.id, "refuted");
44
- break;
45
- }
46
- visitedAgents.add(activeAgent);
47
- // Depth check -- mark task as refuted instead of aborting batch
48
- if (handoffCount >= this.config.maxHandoffDepth) {
49
- tree.updateStatus(task.id, "refuted");
50
- break;
51
- }
52
- // Execute with active agent
53
- const result = await handler(task, handoffCount, activeAgent);
54
- // Record evidence
55
- for (const evidence of result.evidence) {
56
- tree.addEvidence(task.id, evidence);
57
- }
58
- // Check for handoff in the output
59
- const handoff = this.parseHandoff(result.output, agentKeys);
60
- if (handoff) {
61
- // Emit handoff events
62
- const handoffRequest = {
63
- type: "handoff_requested",
64
- fromAgent: activeAgent,
65
- toAgent: handoff.targetAgent,
66
- reason: handoff.reason,
67
- context: handoff.context,
68
- timestamp: new Date(),
69
- sessionId,
70
- };
71
- eventBus.emit(handoffRequest);
72
- const handoffComplete = {
73
- type: "handoff_completed",
74
- fromAgent: activeAgent,
75
- toAgent: handoff.targetAgent,
76
- accepted: true,
77
- timestamp: new Date(),
78
- sessionId,
79
- };
80
- eventBus.emit(handoffComplete);
81
- activeAgent = handoff.targetAgent;
82
- handoffCount++;
83
- }
84
- else {
85
- // No handoff -- task is complete
86
- tree.updateStatus(task.id, result.success ? "supported" : "refuted");
87
- taskCompleted = true;
88
- }
89
- }
90
- }
91
- catch {
92
- // Handler error -- mark task as refuted, continue with remaining tasks
93
- tree.updateStatus(task.id, "refuted");
94
- }
95
- }
96
- }
97
- return tree.allNodes;
98
- }
99
- /**
100
- * Parse a handoff request from agent output.
101
- * Returns null if no handoff is indicated.
102
- */
103
- parseHandoff(output, agentKeys) {
104
- try {
105
- const parsed = JSON.parse(output);
106
- if (typeof parsed === "object" &&
107
- parsed !== null &&
108
- parsed.type === "handoff" &&
109
- typeof parsed.targetAgent === "string" &&
110
- agentKeys.includes(parsed.targetAgent)) {
111
- return {
112
- targetAgent: parsed.targetAgent,
113
- reason: typeof parsed.reason === "string" ? parsed.reason : "",
114
- context: typeof parsed.context === "object" && parsed.context !== null
115
- ? parsed.context
116
- : undefined,
117
- };
118
- }
119
- }
120
- catch {
121
- // Not valid JSON or not a handoff -- no handoff
122
- }
123
- return null;
124
- }
125
- }
126
- //# sourceMappingURL=swarm-strategy.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"swarm-strategy.js","sourceRoot":"","sources":["../../../src/orchestrator/strategies/swarm-strategy.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,yDAAyD;AAkBzD,MAAM,oBAAoB,GAAgB;IACxC,eAAe,EAAE,EAAE;CACpB,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,aAAa;IACP,MAAM,CAAc;IAErC,YAAY,MAA6B;QACvC,IAAI,CAAC,MAAM,GAAG,EAAE,GAAG,oBAAoB,EAAE,GAAG,MAAM,EAAE,CAAC;IACvD,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,OAAwB,EAAE,OAAwB;QAC9D,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC;QACpD,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAE3C,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACzB,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;QAC/D,CAAC;QAED,OAAO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