0agent 1.0.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 (443) hide show
  1. package/README.md +164 -0
  2. package/bin/0agent.js +614 -0
  3. package/package.json +59 -0
  4. package/packages/core/dist/bootstrap/BootstrapProtocol.d.ts +37 -0
  5. package/packages/core/dist/bootstrap/BootstrapProtocol.d.ts.map +1 -0
  6. package/packages/core/dist/bootstrap/BootstrapProtocol.js +82 -0
  7. package/packages/core/dist/bootstrap/BootstrapProtocol.js.map +1 -0
  8. package/packages/core/dist/bootstrap/GraphConstructor.d.ts +44 -0
  9. package/packages/core/dist/bootstrap/GraphConstructor.d.ts.map +1 -0
  10. package/packages/core/dist/bootstrap/GraphConstructor.js +160 -0
  11. package/packages/core/dist/bootstrap/GraphConstructor.js.map +1 -0
  12. package/packages/core/dist/bootstrap/HypothesisManager.d.ts +50 -0
  13. package/packages/core/dist/bootstrap/HypothesisManager.d.ts.map +1 -0
  14. package/packages/core/dist/bootstrap/HypothesisManager.js +108 -0
  15. package/packages/core/dist/bootstrap/HypothesisManager.js.map +1 -0
  16. package/packages/core/dist/bootstrap/StagedMutations.d.ts +50 -0
  17. package/packages/core/dist/bootstrap/StagedMutations.d.ts.map +1 -0
  18. package/packages/core/dist/bootstrap/StagedMutations.js +80 -0
  19. package/packages/core/dist/bootstrap/StagedMutations.js.map +1 -0
  20. package/packages/core/dist/concurrency/EdgeWeightUpdater.d.ts +16 -0
  21. package/packages/core/dist/concurrency/EdgeWeightUpdater.d.ts.map +1 -0
  22. package/packages/core/dist/concurrency/EdgeWeightUpdater.js +57 -0
  23. package/packages/core/dist/concurrency/EdgeWeightUpdater.js.map +1 -0
  24. package/packages/core/dist/concurrency/SessionSnapshot.d.ts +63 -0
  25. package/packages/core/dist/concurrency/SessionSnapshot.d.ts.map +1 -0
  26. package/packages/core/dist/concurrency/SessionSnapshot.js +124 -0
  27. package/packages/core/dist/concurrency/SessionSnapshot.js.map +1 -0
  28. package/packages/core/dist/embedding/HNSWIndex.d.ts +37 -0
  29. package/packages/core/dist/embedding/HNSWIndex.d.ts.map +1 -0
  30. package/packages/core/dist/embedding/HNSWIndex.js +86 -0
  31. package/packages/core/dist/embedding/HNSWIndex.js.map +1 -0
  32. package/packages/core/dist/embedding/MultimodalEmbedder.d.ts +24 -0
  33. package/packages/core/dist/embedding/MultimodalEmbedder.d.ts.map +1 -0
  34. package/packages/core/dist/embedding/MultimodalEmbedder.js +75 -0
  35. package/packages/core/dist/embedding/MultimodalEmbedder.js.map +1 -0
  36. package/packages/core/dist/embedding/adapters/NomicAdapter.d.ts +7 -0
  37. package/packages/core/dist/embedding/adapters/NomicAdapter.d.ts.map +1 -0
  38. package/packages/core/dist/embedding/adapters/NomicAdapter.js +11 -0
  39. package/packages/core/dist/embedding/adapters/NomicAdapter.js.map +1 -0
  40. package/packages/core/dist/embedding/adapters/OllamaAdapter.d.ts +19 -0
  41. package/packages/core/dist/embedding/adapters/OllamaAdapter.d.ts.map +1 -0
  42. package/packages/core/dist/embedding/adapters/OllamaAdapter.js +27 -0
  43. package/packages/core/dist/embedding/adapters/OllamaAdapter.js.map +1 -0
  44. package/packages/core/dist/embedding/adapters/OpenAIAdapter.d.ts +14 -0
  45. package/packages/core/dist/embedding/adapters/OpenAIAdapter.d.ts.map +1 -0
  46. package/packages/core/dist/embedding/adapters/OpenAIAdapter.js +48 -0
  47. package/packages/core/dist/embedding/adapters/OpenAIAdapter.js.map +1 -0
  48. package/packages/core/dist/engine/CreditAttribution.d.ts +47 -0
  49. package/packages/core/dist/engine/CreditAttribution.d.ts.map +1 -0
  50. package/packages/core/dist/engine/CreditAttribution.js +196 -0
  51. package/packages/core/dist/engine/CreditAttribution.js.map +1 -0
  52. package/packages/core/dist/engine/DecayScheduler.d.ts +45 -0
  53. package/packages/core/dist/engine/DecayScheduler.d.ts.map +1 -0
  54. package/packages/core/dist/engine/DecayScheduler.js +115 -0
  55. package/packages/core/dist/engine/DecayScheduler.js.map +1 -0
  56. package/packages/core/dist/engine/InferenceEngine.d.ts +95 -0
  57. package/packages/core/dist/engine/InferenceEngine.d.ts.map +1 -0
  58. package/packages/core/dist/engine/InferenceEngine.js +242 -0
  59. package/packages/core/dist/engine/InferenceEngine.js.map +1 -0
  60. package/packages/core/dist/engine/SelectionPolicy.d.ts +29 -0
  61. package/packages/core/dist/engine/SelectionPolicy.d.ts.map +1 -0
  62. package/packages/core/dist/engine/SelectionPolicy.js +58 -0
  63. package/packages/core/dist/engine/SelectionPolicy.js.map +1 -0
  64. package/packages/core/dist/engine/SelfImprovementEngine.d.ts +58 -0
  65. package/packages/core/dist/engine/SelfImprovementEngine.d.ts.map +1 -0
  66. package/packages/core/dist/engine/SelfImprovementEngine.js +265 -0
  67. package/packages/core/dist/engine/SelfImprovementEngine.js.map +1 -0
  68. package/packages/core/dist/engine/SelfImprovementPrompt.d.ts +10 -0
  69. package/packages/core/dist/engine/SelfImprovementPrompt.d.ts.map +1 -0
  70. package/packages/core/dist/engine/SelfImprovementPrompt.js +193 -0
  71. package/packages/core/dist/engine/SelfImprovementPrompt.js.map +1 -0
  72. package/packages/core/dist/engine/WeightPropagation.d.ts +77 -0
  73. package/packages/core/dist/engine/WeightPropagation.d.ts.map +1 -0
  74. package/packages/core/dist/engine/WeightPropagation.js +101 -0
  75. package/packages/core/dist/engine/WeightPropagation.js.map +1 -0
  76. package/packages/core/dist/engine/WorkflowSuggestionEngine.d.ts +26 -0
  77. package/packages/core/dist/engine/WorkflowSuggestionEngine.d.ts.map +1 -0
  78. package/packages/core/dist/engine/WorkflowSuggestionEngine.js +54 -0
  79. package/packages/core/dist/engine/WorkflowSuggestionEngine.js.map +1 -0
  80. package/packages/core/dist/entity/AliasIndex.d.ts +39 -0
  81. package/packages/core/dist/entity/AliasIndex.d.ts.map +1 -0
  82. package/packages/core/dist/entity/AliasIndex.js +81 -0
  83. package/packages/core/dist/entity/AliasIndex.js.map +1 -0
  84. package/packages/core/dist/entity/ContextActivator.d.ts +53 -0
  85. package/packages/core/dist/entity/ContextActivator.d.ts.map +1 -0
  86. package/packages/core/dist/entity/ContextActivator.js +163 -0
  87. package/packages/core/dist/entity/ContextActivator.js.map +1 -0
  88. package/packages/core/dist/entity/EntityHierarchy.d.ts +48 -0
  89. package/packages/core/dist/entity/EntityHierarchy.d.ts.map +1 -0
  90. package/packages/core/dist/entity/EntityHierarchy.js +134 -0
  91. package/packages/core/dist/entity/EntityHierarchy.js.map +1 -0
  92. package/packages/core/dist/entity/EntityResolutionPipeline.d.ts +48 -0
  93. package/packages/core/dist/entity/EntityResolutionPipeline.d.ts.map +1 -0
  94. package/packages/core/dist/entity/EntityResolutionPipeline.js +221 -0
  95. package/packages/core/dist/entity/EntityResolutionPipeline.js.map +1 -0
  96. package/packages/core/dist/entity/MCPEnrichedResolver.d.ts +17 -0
  97. package/packages/core/dist/entity/MCPEnrichedResolver.d.ts.map +1 -0
  98. package/packages/core/dist/entity/MCPEnrichedResolver.js +19 -0
  99. package/packages/core/dist/entity/MCPEnrichedResolver.js.map +1 -0
  100. package/packages/core/dist/entity/NodeResolutionService.d.ts +46 -0
  101. package/packages/core/dist/entity/NodeResolutionService.d.ts.map +1 -0
  102. package/packages/core/dist/entity/NodeResolutionService.js +150 -0
  103. package/packages/core/dist/entity/NodeResolutionService.js.map +1 -0
  104. package/packages/core/dist/entity/PersonalityAccumulator.d.ts +41 -0
  105. package/packages/core/dist/entity/PersonalityAccumulator.d.ts.map +1 -0
  106. package/packages/core/dist/entity/PersonalityAccumulator.js +126 -0
  107. package/packages/core/dist/entity/PersonalityAccumulator.js.map +1 -0
  108. package/packages/core/dist/entity/PersonalityProfile.d.ts +31 -0
  109. package/packages/core/dist/entity/PersonalityProfile.d.ts.map +1 -0
  110. package/packages/core/dist/entity/PersonalityProfile.js +94 -0
  111. package/packages/core/dist/entity/PersonalityProfile.js.map +1 -0
  112. package/packages/core/dist/entity/index.d.ts +4 -0
  113. package/packages/core/dist/entity/index.d.ts.map +1 -0
  114. package/packages/core/dist/entity/index.js +4 -0
  115. package/packages/core/dist/entity/index.js.map +1 -0
  116. package/packages/core/dist/graph/GraphEdge.d.ts +37 -0
  117. package/packages/core/dist/graph/GraphEdge.d.ts.map +1 -0
  118. package/packages/core/dist/graph/GraphEdge.js +29 -0
  119. package/packages/core/dist/graph/GraphEdge.js.map +1 -0
  120. package/packages/core/dist/graph/GraphNode.d.ts +52 -0
  121. package/packages/core/dist/graph/GraphNode.d.ts.map +1 -0
  122. package/packages/core/dist/graph/GraphNode.js +41 -0
  123. package/packages/core/dist/graph/GraphNode.js.map +1 -0
  124. package/packages/core/dist/graph/GraphQuery.d.ts +46 -0
  125. package/packages/core/dist/graph/GraphQuery.d.ts.map +1 -0
  126. package/packages/core/dist/graph/GraphQuery.js +47 -0
  127. package/packages/core/dist/graph/GraphQuery.js.map +1 -0
  128. package/packages/core/dist/graph/KnowledgeGraph.d.ts +38 -0
  129. package/packages/core/dist/graph/KnowledgeGraph.d.ts.map +1 -0
  130. package/packages/core/dist/graph/KnowledgeGraph.js +345 -0
  131. package/packages/core/dist/graph/KnowledgeGraph.js.map +1 -0
  132. package/packages/core/dist/graph/SubGraph.d.ts +36 -0
  133. package/packages/core/dist/graph/SubGraph.d.ts.map +1 -0
  134. package/packages/core/dist/graph/SubGraph.js +86 -0
  135. package/packages/core/dist/graph/SubGraph.js.map +1 -0
  136. package/packages/core/dist/index.d.ts +54 -0
  137. package/packages/core/dist/index.d.ts.map +1 -0
  138. package/packages/core/dist/index.js +62 -0
  139. package/packages/core/dist/index.js.map +1 -0
  140. package/packages/core/dist/maintenance/CompactionOrchestrator.d.ts +22 -0
  141. package/packages/core/dist/maintenance/CompactionOrchestrator.d.ts.map +1 -0
  142. package/packages/core/dist/maintenance/CompactionOrchestrator.js +62 -0
  143. package/packages/core/dist/maintenance/CompactionOrchestrator.js.map +1 -0
  144. package/packages/core/dist/maintenance/EdgePruner.d.ts +20 -0
  145. package/packages/core/dist/maintenance/EdgePruner.d.ts.map +1 -0
  146. package/packages/core/dist/maintenance/EdgePruner.js +65 -0
  147. package/packages/core/dist/maintenance/EdgePruner.js.map +1 -0
  148. package/packages/core/dist/maintenance/GraphCheckpoint.d.ts +51 -0
  149. package/packages/core/dist/maintenance/GraphCheckpoint.d.ts.map +1 -0
  150. package/packages/core/dist/maintenance/GraphCheckpoint.js +81 -0
  151. package/packages/core/dist/maintenance/GraphCheckpoint.js.map +1 -0
  152. package/packages/core/dist/maintenance/GraphRollback.d.ts +36 -0
  153. package/packages/core/dist/maintenance/GraphRollback.d.ts.map +1 -0
  154. package/packages/core/dist/maintenance/GraphRollback.js +154 -0
  155. package/packages/core/dist/maintenance/GraphRollback.js.map +1 -0
  156. package/packages/core/dist/maintenance/NodeDeduplicator.d.ts +26 -0
  157. package/packages/core/dist/maintenance/NodeDeduplicator.d.ts.map +1 -0
  158. package/packages/core/dist/maintenance/NodeDeduplicator.js +171 -0
  159. package/packages/core/dist/maintenance/NodeDeduplicator.js.map +1 -0
  160. package/packages/core/dist/maintenance/SubgraphArchiver.d.ts +18 -0
  161. package/packages/core/dist/maintenance/SubgraphArchiver.d.ts.map +1 -0
  162. package/packages/core/dist/maintenance/SubgraphArchiver.js +180 -0
  163. package/packages/core/dist/maintenance/SubgraphArchiver.js.map +1 -0
  164. package/packages/core/dist/memory/ArchivalMemory.d.ts +28 -0
  165. package/packages/core/dist/memory/ArchivalMemory.d.ts.map +1 -0
  166. package/packages/core/dist/memory/ArchivalMemory.js +26 -0
  167. package/packages/core/dist/memory/ArchivalMemory.js.map +1 -0
  168. package/packages/core/dist/memory/BlinkingMemory.d.ts +34 -0
  169. package/packages/core/dist/memory/BlinkingMemory.d.ts.map +1 -0
  170. package/packages/core/dist/memory/BlinkingMemory.js +44 -0
  171. package/packages/core/dist/memory/BlinkingMemory.js.map +1 -0
  172. package/packages/core/dist/memory/WorkingMemory.d.ts +38 -0
  173. package/packages/core/dist/memory/WorkingMemory.d.ts.map +1 -0
  174. package/packages/core/dist/memory/WorkingMemory.js +70 -0
  175. package/packages/core/dist/memory/WorkingMemory.js.map +1 -0
  176. package/packages/core/dist/storage/ObjectStore.d.ts +24 -0
  177. package/packages/core/dist/storage/ObjectStore.d.ts.map +1 -0
  178. package/packages/core/dist/storage/ObjectStore.js +50 -0
  179. package/packages/core/dist/storage/ObjectStore.js.map +1 -0
  180. package/packages/core/dist/storage/TraceStore.d.ts +16 -0
  181. package/packages/core/dist/storage/TraceStore.d.ts.map +1 -0
  182. package/packages/core/dist/storage/TraceStore.js +19 -0
  183. package/packages/core/dist/storage/TraceStore.js.map +1 -0
  184. package/packages/core/dist/storage/WeightEventLog.d.ts +11 -0
  185. package/packages/core/dist/storage/WeightEventLog.d.ts.map +1 -0
  186. package/packages/core/dist/storage/WeightEventLog.js +16 -0
  187. package/packages/core/dist/storage/WeightEventLog.js.map +1 -0
  188. package/packages/core/dist/storage/adapters/SQLiteAdapter.d.ts +86 -0
  189. package/packages/core/dist/storage/adapters/SQLiteAdapter.d.ts.map +1 -0
  190. package/packages/core/dist/storage/adapters/SQLiteAdapter.js +514 -0
  191. package/packages/core/dist/storage/adapters/SQLiteAdapter.js.map +1 -0
  192. package/packages/core/dist/trace/DeferredTrace.d.ts +43 -0
  193. package/packages/core/dist/trace/DeferredTrace.d.ts.map +1 -0
  194. package/packages/core/dist/trace/DeferredTrace.js +44 -0
  195. package/packages/core/dist/trace/DeferredTrace.js.map +1 -0
  196. package/packages/core/dist/trace/OutcomeTrace.d.ts +38 -0
  197. package/packages/core/dist/trace/OutcomeTrace.d.ts.map +1 -0
  198. package/packages/core/dist/trace/OutcomeTrace.js +9 -0
  199. package/packages/core/dist/trace/OutcomeTrace.js.map +1 -0
  200. package/packages/core/dist/trace/SkillTraceDecorator.d.ts +25 -0
  201. package/packages/core/dist/trace/SkillTraceDecorator.d.ts.map +1 -0
  202. package/packages/core/dist/trace/SkillTraceDecorator.js +41 -0
  203. package/packages/core/dist/trace/SkillTraceDecorator.js.map +1 -0
  204. package/packages/core/dist/trace/TraceReplay.d.ts +25 -0
  205. package/packages/core/dist/trace/TraceReplay.d.ts.map +1 -0
  206. package/packages/core/dist/trace/TraceReplay.js +40 -0
  207. package/packages/core/dist/trace/TraceReplay.js.map +1 -0
  208. package/packages/core/dist/trace/TraversalLedger.d.ts +33 -0
  209. package/packages/core/dist/trace/TraversalLedger.d.ts.map +1 -0
  210. package/packages/core/dist/trace/TraversalLedger.js +61 -0
  211. package/packages/core/dist/trace/TraversalLedger.js.map +1 -0
  212. package/packages/core/dist/types/SelfImprovement.d.ts +174 -0
  213. package/packages/core/dist/types/SelfImprovement.d.ts.map +1 -0
  214. package/packages/core/dist/types/SelfImprovement.js +23 -0
  215. package/packages/core/dist/types/SelfImprovement.js.map +1 -0
  216. package/packages/core/dist/types/SkillDefinition.d.ts +68 -0
  217. package/packages/core/dist/types/SkillDefinition.d.ts.map +1 -0
  218. package/packages/core/dist/types/SkillDefinition.js +12 -0
  219. package/packages/core/dist/types/SkillDefinition.js.map +1 -0
  220. package/packages/daemon/dist/BackgroundWorkers.d.ts +55 -0
  221. package/packages/daemon/dist/BackgroundWorkers.d.ts.map +1 -0
  222. package/packages/daemon/dist/BackgroundWorkers.js +121 -0
  223. package/packages/daemon/dist/BackgroundWorkers.js.map +1 -0
  224. package/packages/daemon/dist/EntityScopedContext.d.ts +22 -0
  225. package/packages/daemon/dist/EntityScopedContext.d.ts.map +1 -0
  226. package/packages/daemon/dist/EntityScopedContext.js +85 -0
  227. package/packages/daemon/dist/EntityScopedContext.js.map +1 -0
  228. package/packages/daemon/dist/HTTPServer.d.ts +27 -0
  229. package/packages/daemon/dist/HTTPServer.d.ts.map +1 -0
  230. package/packages/daemon/dist/HTTPServer.js +62 -0
  231. package/packages/daemon/dist/HTTPServer.js.map +1 -0
  232. package/packages/daemon/dist/SessionManager.d.ts +95 -0
  233. package/packages/daemon/dist/SessionManager.d.ts.map +1 -0
  234. package/packages/daemon/dist/SessionManager.js +205 -0
  235. package/packages/daemon/dist/SessionManager.js.map +1 -0
  236. package/packages/daemon/dist/SkillRegistry.d.ts +34 -0
  237. package/packages/daemon/dist/SkillRegistry.d.ts.map +1 -0
  238. package/packages/daemon/dist/SkillRegistry.js +90 -0
  239. package/packages/daemon/dist/SkillRegistry.js.map +1 -0
  240. package/packages/daemon/dist/SkillVariableResolver.d.ts +24 -0
  241. package/packages/daemon/dist/SkillVariableResolver.d.ts.map +1 -0
  242. package/packages/daemon/dist/SkillVariableResolver.js +85 -0
  243. package/packages/daemon/dist/SkillVariableResolver.js.map +1 -0
  244. package/packages/daemon/dist/WebSocketEvents.d.ts +107 -0
  245. package/packages/daemon/dist/WebSocketEvents.d.ts.map +1 -0
  246. package/packages/daemon/dist/WebSocketEvents.js +111 -0
  247. package/packages/daemon/dist/WebSocketEvents.js.map +1 -0
  248. package/packages/daemon/dist/ZeroAgentDaemon.d.ts +39 -0
  249. package/packages/daemon/dist/ZeroAgentDaemon.d.ts.map +1 -0
  250. package/packages/daemon/dist/ZeroAgentDaemon.js +161 -0
  251. package/packages/daemon/dist/ZeroAgentDaemon.js.map +1 -0
  252. package/packages/daemon/dist/config/ConfigSchema.d.ts +631 -0
  253. package/packages/daemon/dist/config/ConfigSchema.d.ts.map +1 -0
  254. package/packages/daemon/dist/config/ConfigSchema.js +107 -0
  255. package/packages/daemon/dist/config/ConfigSchema.js.map +1 -0
  256. package/packages/daemon/dist/config/DaemonConfig.d.ts +10 -0
  257. package/packages/daemon/dist/config/DaemonConfig.d.ts.map +1 -0
  258. package/packages/daemon/dist/config/DaemonConfig.js +34 -0
  259. package/packages/daemon/dist/config/DaemonConfig.js.map +1 -0
  260. package/packages/daemon/dist/index.d.ts +10 -0
  261. package/packages/daemon/dist/index.d.ts.map +1 -0
  262. package/packages/daemon/dist/index.js +8 -0
  263. package/packages/daemon/dist/index.js.map +1 -0
  264. package/packages/daemon/dist/routes/entities.d.ts +6 -0
  265. package/packages/daemon/dist/routes/entities.d.ts.map +1 -0
  266. package/packages/daemon/dist/routes/entities.js +54 -0
  267. package/packages/daemon/dist/routes/entities.js.map +1 -0
  268. package/packages/daemon/dist/routes/graph.d.ts +6 -0
  269. package/packages/daemon/dist/routes/graph.d.ts.map +1 -0
  270. package/packages/daemon/dist/routes/graph.js +61 -0
  271. package/packages/daemon/dist/routes/graph.js.map +1 -0
  272. package/packages/daemon/dist/routes/health.d.ts +15 -0
  273. package/packages/daemon/dist/routes/health.d.ts.map +1 -0
  274. package/packages/daemon/dist/routes/health.js +11 -0
  275. package/packages/daemon/dist/routes/health.js.map +1 -0
  276. package/packages/daemon/dist/routes/sessions.d.ts +6 -0
  277. package/packages/daemon/dist/routes/sessions.d.ts.map +1 -0
  278. package/packages/daemon/dist/routes/sessions.js +43 -0
  279. package/packages/daemon/dist/routes/sessions.js.map +1 -0
  280. package/packages/daemon/dist/routes/skills.d.ts +6 -0
  281. package/packages/daemon/dist/routes/skills.d.ts.map +1 -0
  282. package/packages/daemon/dist/routes/skills.js +62 -0
  283. package/packages/daemon/dist/routes/skills.js.map +1 -0
  284. package/packages/daemon/dist/routes/subagents.d.ts +3 -0
  285. package/packages/daemon/dist/routes/subagents.d.ts.map +1 -0
  286. package/packages/daemon/dist/routes/subagents.js +14 -0
  287. package/packages/daemon/dist/routes/subagents.js.map +1 -0
  288. package/packages/daemon/dist/routes/traces.d.ts +6 -0
  289. package/packages/daemon/dist/routes/traces.d.ts.map +1 -0
  290. package/packages/daemon/dist/routes/traces.js +31 -0
  291. package/packages/daemon/dist/routes/traces.js.map +1 -0
  292. package/packages/daemon/dist/start.d.ts +7 -0
  293. package/packages/daemon/dist/start.d.ts.map +1 -0
  294. package/packages/daemon/dist/start.js +24 -0
  295. package/packages/daemon/dist/start.js.map +1 -0
  296. package/packages/mcp-hub/dist/FilteredProxy.d.ts +20 -0
  297. package/packages/mcp-hub/dist/FilteredProxy.d.ts.map +1 -0
  298. package/packages/mcp-hub/dist/FilteredProxy.js +43 -0
  299. package/packages/mcp-hub/dist/FilteredProxy.js.map +1 -0
  300. package/packages/mcp-hub/dist/MCPDiscovery.d.ts +18 -0
  301. package/packages/mcp-hub/dist/MCPDiscovery.d.ts.map +1 -0
  302. package/packages/mcp-hub/dist/MCPDiscovery.js +86 -0
  303. package/packages/mcp-hub/dist/MCPDiscovery.js.map +1 -0
  304. package/packages/mcp-hub/dist/MCPHub.d.ts +48 -0
  305. package/packages/mcp-hub/dist/MCPHub.d.ts.map +1 -0
  306. package/packages/mcp-hub/dist/MCPHub.js +100 -0
  307. package/packages/mcp-hub/dist/MCPHub.js.map +1 -0
  308. package/packages/mcp-hub/dist/builtin/BrowserMCP.d.ts +6 -0
  309. package/packages/mcp-hub/dist/builtin/BrowserMCP.d.ts.map +1 -0
  310. package/packages/mcp-hub/dist/builtin/BrowserMCP.js +69 -0
  311. package/packages/mcp-hub/dist/builtin/BrowserMCP.js.map +1 -0
  312. package/packages/mcp-hub/dist/builtin/FilesystemMCP.d.ts +11 -0
  313. package/packages/mcp-hub/dist/builtin/FilesystemMCP.d.ts.map +1 -0
  314. package/packages/mcp-hub/dist/builtin/FilesystemMCP.js +104 -0
  315. package/packages/mcp-hub/dist/builtin/FilesystemMCP.js.map +1 -0
  316. package/packages/mcp-hub/dist/builtin/MemoryMCP.d.ts +9 -0
  317. package/packages/mcp-hub/dist/builtin/MemoryMCP.d.ts.map +1 -0
  318. package/packages/mcp-hub/dist/builtin/MemoryMCP.js +185 -0
  319. package/packages/mcp-hub/dist/builtin/MemoryMCP.js.map +1 -0
  320. package/packages/mcp-hub/dist/builtin/ShellMCP.d.ts +8 -0
  321. package/packages/mcp-hub/dist/builtin/ShellMCP.d.ts.map +1 -0
  322. package/packages/mcp-hub/dist/builtin/ShellMCP.js +74 -0
  323. package/packages/mcp-hub/dist/builtin/ShellMCP.js.map +1 -0
  324. package/packages/mcp-hub/dist/index.d.ts +9 -0
  325. package/packages/mcp-hub/dist/index.d.ts.map +1 -0
  326. package/packages/mcp-hub/dist/index.js +8 -0
  327. package/packages/mcp-hub/dist/index.js.map +1 -0
  328. package/packages/mcp-hub/dist/types.d.ts +30 -0
  329. package/packages/mcp-hub/dist/types.d.ts.map +1 -0
  330. package/packages/mcp-hub/dist/types.js +2 -0
  331. package/packages/mcp-hub/dist/types.js.map +1 -0
  332. package/packages/subagent/dist/CapabilityToken.d.ts +66 -0
  333. package/packages/subagent/dist/CapabilityToken.d.ts.map +1 -0
  334. package/packages/subagent/dist/CapabilityToken.js +120 -0
  335. package/packages/subagent/dist/CapabilityToken.js.map +1 -0
  336. package/packages/subagent/dist/ResourceDefaults.d.ts +16 -0
  337. package/packages/subagent/dist/ResourceDefaults.d.ts.map +1 -0
  338. package/packages/subagent/dist/ResourceDefaults.js +68 -0
  339. package/packages/subagent/dist/ResourceDefaults.js.map +1 -0
  340. package/packages/subagent/dist/SkillInputResolver.d.ts +30 -0
  341. package/packages/subagent/dist/SkillInputResolver.d.ts.map +1 -0
  342. package/packages/subagent/dist/SkillInputResolver.js +59 -0
  343. package/packages/subagent/dist/SkillInputResolver.js.map +1 -0
  344. package/packages/subagent/dist/SkillInvoker.d.ts +33 -0
  345. package/packages/subagent/dist/SkillInvoker.d.ts.map +1 -0
  346. package/packages/subagent/dist/SkillInvoker.js +69 -0
  347. package/packages/subagent/dist/SkillInvoker.js.map +1 -0
  348. package/packages/subagent/dist/SubagentOrchestrator.d.ts +52 -0
  349. package/packages/subagent/dist/SubagentOrchestrator.d.ts.map +1 -0
  350. package/packages/subagent/dist/SubagentOrchestrator.js +198 -0
  351. package/packages/subagent/dist/SubagentOrchestrator.js.map +1 -0
  352. package/packages/subagent/dist/SubagentResult.d.ts +34 -0
  353. package/packages/subagent/dist/SubagentResult.d.ts.map +1 -0
  354. package/packages/subagent/dist/SubagentResult.js +21 -0
  355. package/packages/subagent/dist/SubagentResult.js.map +1 -0
  356. package/packages/subagent/dist/Watchdog.d.ts +23 -0
  357. package/packages/subagent/dist/Watchdog.d.ts.map +1 -0
  358. package/packages/subagent/dist/Watchdog.js +44 -0
  359. package/packages/subagent/dist/Watchdog.js.map +1 -0
  360. package/packages/subagent/dist/index.d.ts +15 -0
  361. package/packages/subagent/dist/index.d.ts.map +1 -0
  362. package/packages/subagent/dist/index.js +23 -0
  363. package/packages/subagent/dist/index.js.map +1 -0
  364. package/packages/subagent/dist/sandbox/BwrapBackend.d.ts +14 -0
  365. package/packages/subagent/dist/sandbox/BwrapBackend.d.ts.map +1 -0
  366. package/packages/subagent/dist/sandbox/BwrapBackend.js +171 -0
  367. package/packages/subagent/dist/sandbox/BwrapBackend.js.map +1 -0
  368. package/packages/subagent/dist/sandbox/CloudBackend.d.ts +28 -0
  369. package/packages/subagent/dist/sandbox/CloudBackend.d.ts.map +1 -0
  370. package/packages/subagent/dist/sandbox/CloudBackend.js +52 -0
  371. package/packages/subagent/dist/sandbox/CloudBackend.js.map +1 -0
  372. package/packages/subagent/dist/sandbox/DockerBackend.d.ts +14 -0
  373. package/packages/subagent/dist/sandbox/DockerBackend.d.ts.map +1 -0
  374. package/packages/subagent/dist/sandbox/DockerBackend.js +149 -0
  375. package/packages/subagent/dist/sandbox/DockerBackend.js.map +1 -0
  376. package/packages/subagent/dist/sandbox/FirecrackerBackend.d.ts +17 -0
  377. package/packages/subagent/dist/sandbox/FirecrackerBackend.d.ts.map +1 -0
  378. package/packages/subagent/dist/sandbox/FirecrackerBackend.js +54 -0
  379. package/packages/subagent/dist/sandbox/FirecrackerBackend.js.map +1 -0
  380. package/packages/subagent/dist/sandbox/PodmanBackend.d.ts +13 -0
  381. package/packages/subagent/dist/sandbox/PodmanBackend.d.ts.map +1 -0
  382. package/packages/subagent/dist/sandbox/PodmanBackend.js +144 -0
  383. package/packages/subagent/dist/sandbox/PodmanBackend.js.map +1 -0
  384. package/packages/subagent/dist/sandbox/ProcessBackend.d.ts +16 -0
  385. package/packages/subagent/dist/sandbox/ProcessBackend.d.ts.map +1 -0
  386. package/packages/subagent/dist/sandbox/ProcessBackend.js +152 -0
  387. package/packages/subagent/dist/sandbox/ProcessBackend.js.map +1 -0
  388. package/packages/subagent/dist/sandbox/SandboxManager.d.ts +17 -0
  389. package/packages/subagent/dist/sandbox/SandboxManager.d.ts.map +1 -0
  390. package/packages/subagent/dist/sandbox/SandboxManager.js +45 -0
  391. package/packages/subagent/dist/sandbox/SandboxManager.js.map +1 -0
  392. package/packages/subagent/dist/sandbox/types.d.ts +35 -0
  393. package/packages/subagent/dist/sandbox/types.d.ts.map +1 -0
  394. package/packages/subagent/dist/sandbox/types.js +5 -0
  395. package/packages/subagent/dist/sandbox/types.js.map +1 -0
  396. package/packages/subagent-runtime/dist/AgentLoop.d.ts +46 -0
  397. package/packages/subagent-runtime/dist/AgentLoop.d.ts.map +1 -0
  398. package/packages/subagent-runtime/dist/AgentLoop.js +85 -0
  399. package/packages/subagent-runtime/dist/AgentLoop.js.map +1 -0
  400. package/packages/subagent-runtime/dist/MCPProxy.d.ts +24 -0
  401. package/packages/subagent-runtime/dist/MCPProxy.d.ts.map +1 -0
  402. package/packages/subagent-runtime/dist/MCPProxy.js +31 -0
  403. package/packages/subagent-runtime/dist/MCPProxy.js.map +1 -0
  404. package/packages/subagent-runtime/dist/OutputChannel.d.ts +10 -0
  405. package/packages/subagent-runtime/dist/OutputChannel.d.ts.map +1 -0
  406. package/packages/subagent-runtime/dist/OutputChannel.js +14 -0
  407. package/packages/subagent-runtime/dist/OutputChannel.js.map +1 -0
  408. package/packages/subagent-runtime/dist/ResourceTracker.d.ts +29 -0
  409. package/packages/subagent-runtime/dist/ResourceTracker.d.ts.map +1 -0
  410. package/packages/subagent-runtime/dist/ResourceTracker.js +46 -0
  411. package/packages/subagent-runtime/dist/ResourceTracker.js.map +1 -0
  412. package/packages/subagent-runtime/dist/TokenValidator.d.ts +17 -0
  413. package/packages/subagent-runtime/dist/TokenValidator.d.ts.map +1 -0
  414. package/packages/subagent-runtime/dist/TokenValidator.js +29 -0
  415. package/packages/subagent-runtime/dist/TokenValidator.js.map +1 -0
  416. package/packages/subagent-runtime/dist/index.d.ts +6 -0
  417. package/packages/subagent-runtime/dist/index.d.ts.map +1 -0
  418. package/packages/subagent-runtime/dist/index.js +11 -0
  419. package/packages/subagent-runtime/dist/index.js.map +1 -0
  420. package/packages/subagent-runtime/dist/main.d.ts +2 -0
  421. package/packages/subagent-runtime/dist/main.d.ts.map +1 -0
  422. package/packages/subagent-runtime/dist/main.js +102 -0
  423. package/packages/subagent-runtime/dist/main.js.map +1 -0
  424. package/seeds/b2b-outbound/package.json +6 -0
  425. package/seeds/research/package.json +6 -0
  426. package/seeds/software-engineering/install.ts +78 -0
  427. package/seeds/software-engineering/package.json +6 -0
  428. package/seeds/software-engineering/sprint-workflow.json +102 -0
  429. package/skills/build.yaml +97 -0
  430. package/skills/debug.yaml +117 -0
  431. package/skills/design-review.yaml +119 -0
  432. package/skills/doc.yaml +107 -0
  433. package/skills/office-hours.yaml +76 -0
  434. package/skills/plan-ceo-review.yaml +84 -0
  435. package/skills/plan-eng-review.yaml +96 -0
  436. package/skills/qa.yaml +116 -0
  437. package/skills/refactor.yaml +125 -0
  438. package/skills/research.yaml +108 -0
  439. package/skills/retro.yaml +106 -0
  440. package/skills/review.yaml +101 -0
  441. package/skills/security-audit.yaml +114 -0
  442. package/skills/ship.yaml +108 -0
  443. package/skills/test-writer.yaml +131 -0
@@ -0,0 +1,31 @@
1
+ /**
2
+ * MCPProxy — connects to the parent daemon's filtered MCP proxy endpoint.
3
+ *
4
+ * In Phase 3 this is a stub that logs calls and returns mock results.
5
+ * The real implementation will issue HTTP requests to the daemon's
6
+ * per-subagent MCP proxy endpoint, which filters tool access based on
7
+ * the capability token's allowed_tools list.
8
+ */
9
+ export class MCPProxy {
10
+ proxyUrl;
11
+ constructor(proxyUrl) {
12
+ this.proxyUrl = proxyUrl;
13
+ }
14
+ /**
15
+ * Call a tool through the MCP proxy.
16
+ */
17
+ async call(toolName, args) {
18
+ // Phase 3 stub — log and return mock result.
19
+ // Real implementation: POST to proxyUrl with { tool_name, args }
20
+ console.log(`[MCPProxy] ${toolName}(${JSON.stringify(args)})`);
21
+ return { type: 'text', text: `Stub: ${toolName} called` };
22
+ }
23
+ /**
24
+ * List tools available through the proxy.
25
+ */
26
+ async listTools() {
27
+ // Phase 3 stub — real implementation: GET proxyUrl/tools
28
+ return [];
29
+ }
30
+ }
31
+ //# sourceMappingURL=MCPProxy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MCPProxy.js","sourceRoot":"","sources":["../src/MCPProxy.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,OAAO,QAAQ;IACU;IAA7B,YAA6B,QAAgB;QAAhB,aAAQ,GAAR,QAAQ,CAAQ;IAAG,CAAC;IAEjD;;OAEG;IACH,KAAK,CAAC,IAAI,CACR,QAAgB,EAChB,IAA6B;QAE7B,6CAA6C;QAC7C,iEAAiE;QACjE,OAAO,CAAC,GAAG,CAAC,cAAc,QAAQ,IAAI,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC/D,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,QAAQ,SAAS,EAAE,CAAC;IAC5D,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,SAAS;QACb,yDAAyD;QACzD,OAAO,EAAE,CAAC;IACZ,CAAC;CACF"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Writes structured JSON output to stdout with a sentinel marker.
3
+ *
4
+ * The parent orchestrator reads stdout and splits on the sentinel
5
+ * to extract the subagent's result payload.
6
+ */
7
+ export declare class OutputChannel {
8
+ write(data: Record<string, unknown>): void;
9
+ }
10
+ //# sourceMappingURL=OutputChannel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OutputChannel.d.ts","sourceRoot":"","sources":["../src/OutputChannel.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,qBAAa,aAAa;IACxB,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;CAI3C"}
@@ -0,0 +1,14 @@
1
+ const OUTPUT_SENTINEL = '__OUTPUT_END__';
2
+ /**
3
+ * Writes structured JSON output to stdout with a sentinel marker.
4
+ *
5
+ * The parent orchestrator reads stdout and splits on the sentinel
6
+ * to extract the subagent's result payload.
7
+ */
8
+ export class OutputChannel {
9
+ write(data) {
10
+ const json = JSON.stringify(data);
11
+ process.stdout.write(json + '\n' + OUTPUT_SENTINEL + '\n');
12
+ }
13
+ }
14
+ //# sourceMappingURL=OutputChannel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OutputChannel.js","sourceRoot":"","sources":["../src/OutputChannel.ts"],"names":[],"mappings":"AAAA,MAAM,eAAe,GAAG,gBAAgB,CAAC;AAEzC;;;;;GAKG;AACH,MAAM,OAAO,aAAa;IACxB,KAAK,CAAC,IAA6B;QACjC,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAClC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,GAAG,IAAI,GAAG,eAAe,GAAG,IAAI,CAAC,CAAC;IAC7D,CAAC;CACF"}
@@ -0,0 +1,29 @@
1
+ export interface ToolCallRecord {
2
+ tool_name: string;
3
+ input: Record<string, unknown>;
4
+ output_summary: string;
5
+ duration_ms: number;
6
+ timestamp: number;
7
+ }
8
+ /**
9
+ * Counts resource usage against token-imposed limits.
10
+ *
11
+ * The subagent runtime checks this tracker before every LLM call
12
+ * and tool call to enforce the capability token's resource budget.
13
+ */
14
+ export declare class ResourceTracker {
15
+ private readonly maxLLMCalls;
16
+ private readonly maxTokens;
17
+ private readonly maxToolCalls;
18
+ llm_calls: number;
19
+ tokens_used: number;
20
+ tool_calls_count: number;
21
+ private tool_call_records;
22
+ constructor(maxLLMCalls: number, maxTokens: number, maxToolCalls: number);
23
+ canMakeLLMCall(): boolean;
24
+ canMakeToolCall(): boolean;
25
+ recordLLMCall(tokensUsed: number): void;
26
+ recordToolCall(name: string, input: Record<string, unknown>, output: unknown, durationMs: number): void;
27
+ getToolCallRecords(): ToolCallRecord[];
28
+ }
29
+ //# sourceMappingURL=ResourceTracker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ResourceTracker.d.ts","sourceRoot":"","sources":["../src/ResourceTracker.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;CACnB;AAID;;;;;GAKG;AACH,qBAAa,eAAe;IAOxB,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,YAAY;IAR/B,SAAS,SAAK;IACd,WAAW,SAAK;IAChB,gBAAgB,SAAK;IACrB,OAAO,CAAC,iBAAiB,CAAwB;gBAG9B,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM;IAGvC,cAAc,IAAI,OAAO;IAIzB,eAAe,IAAI,OAAO;IAI1B,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAKvC,cAAc,CACZ,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,MAAM,EAAE,OAAO,EACf,UAAU,EAAE,MAAM,GACjB,IAAI;IAWP,kBAAkB,IAAI,cAAc,EAAE;CAGvC"}
@@ -0,0 +1,46 @@
1
+ // ─── Types ──────────────────────────────────────────
2
+ // ─── ResourceTracker ────────────────────────────────
3
+ /**
4
+ * Counts resource usage against token-imposed limits.
5
+ *
6
+ * The subagent runtime checks this tracker before every LLM call
7
+ * and tool call to enforce the capability token's resource budget.
8
+ */
9
+ export class ResourceTracker {
10
+ maxLLMCalls;
11
+ maxTokens;
12
+ maxToolCalls;
13
+ llm_calls = 0;
14
+ tokens_used = 0;
15
+ tool_calls_count = 0;
16
+ tool_call_records = [];
17
+ constructor(maxLLMCalls, maxTokens, maxToolCalls) {
18
+ this.maxLLMCalls = maxLLMCalls;
19
+ this.maxTokens = maxTokens;
20
+ this.maxToolCalls = maxToolCalls;
21
+ }
22
+ canMakeLLMCall() {
23
+ return this.llm_calls < this.maxLLMCalls;
24
+ }
25
+ canMakeToolCall() {
26
+ return this.tool_calls_count < this.maxToolCalls;
27
+ }
28
+ recordLLMCall(tokensUsed) {
29
+ this.llm_calls++;
30
+ this.tokens_used += tokensUsed;
31
+ }
32
+ recordToolCall(name, input, output, durationMs) {
33
+ this.tool_calls_count++;
34
+ this.tool_call_records.push({
35
+ tool_name: name,
36
+ input,
37
+ output_summary: String(output).slice(0, 200),
38
+ duration_ms: durationMs,
39
+ timestamp: Date.now(),
40
+ });
41
+ }
42
+ getToolCallRecords() {
43
+ return this.tool_call_records;
44
+ }
45
+ }
46
+ //# sourceMappingURL=ResourceTracker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ResourceTracker.js","sourceRoot":"","sources":["../src/ResourceTracker.ts"],"names":[],"mappings":"AAAA,uDAAuD;AAUvD,uDAAuD;AAEvD;;;;;GAKG;AACH,MAAM,OAAO,eAAe;IAOP;IACA;IACA;IARnB,SAAS,GAAG,CAAC,CAAC;IACd,WAAW,GAAG,CAAC,CAAC;IAChB,gBAAgB,GAAG,CAAC,CAAC;IACb,iBAAiB,GAAqB,EAAE,CAAC;IAEjD,YACmB,WAAmB,EACnB,SAAiB,EACjB,YAAoB;QAFpB,gBAAW,GAAX,WAAW,CAAQ;QACnB,cAAS,GAAT,SAAS,CAAQ;QACjB,iBAAY,GAAZ,YAAY,CAAQ;IACpC,CAAC;IAEJ,cAAc;QACZ,OAAO,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,WAAW,CAAC;IAC3C,CAAC;IAED,eAAe;QACb,OAAO,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC,YAAY,CAAC;IACnD,CAAC;IAED,aAAa,CAAC,UAAkB;QAC9B,IAAI,CAAC,SAAS,EAAE,CAAC;QACjB,IAAI,CAAC,WAAW,IAAI,UAAU,CAAC;IACjC,CAAC;IAED,cAAc,CACZ,IAAY,EACZ,KAA8B,EAC9B,MAAe,EACf,UAAkB;QAElB,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACxB,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC;YAC1B,SAAS,EAAE,IAAI;YACf,KAAK;YACL,cAAc,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC;YAC5C,WAAW,EAAE,UAAU;YACvB,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;SACtB,CAAC,CAAC;IACL,CAAC;IAED,kBAAkB;QAChB,OAAO,IAAI,CAAC,iBAAiB,CAAC;IAChC,CAAC;CACF"}
@@ -0,0 +1,17 @@
1
+ export interface ValidationResult {
2
+ valid: boolean;
3
+ reason?: string;
4
+ }
5
+ /**
6
+ * Validates a capability token inside the sandbox.
7
+ *
8
+ * Note: the sandbox does NOT have access to the daemon secret, so HMAC
9
+ * verification is not possible here. The parent orchestrator already
10
+ * validated the signature before injecting the token.
11
+ *
12
+ * This validator checks structural integrity and expiry only.
13
+ */
14
+ export declare class TokenValidator {
15
+ validate(token: Record<string, unknown>): ValidationResult;
16
+ }
17
+ //# sourceMappingURL=TokenValidator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TokenValidator.d.ts","sourceRoot":"","sources":["../src/TokenValidator.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAID;;;;;;;;GAQG;AACH,qBAAa,cAAc;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,gBAAgB;CAmB3D"}
@@ -0,0 +1,29 @@
1
+ // ─── Types ──────────────────────────────────────────
2
+ // ─── TokenValidator ─────────────────────────────────
3
+ /**
4
+ * Validates a capability token inside the sandbox.
5
+ *
6
+ * Note: the sandbox does NOT have access to the daemon secret, so HMAC
7
+ * verification is not possible here. The parent orchestrator already
8
+ * validated the signature before injecting the token.
9
+ *
10
+ * This validator checks structural integrity and expiry only.
11
+ */
12
+ export class TokenValidator {
13
+ validate(token) {
14
+ if (!token.id || !token.subagent_id) {
15
+ return { valid: false, reason: 'missing_fields' };
16
+ }
17
+ if (typeof token.expires_at !== 'number') {
18
+ return { valid: false, reason: 'invalid_expiry' };
19
+ }
20
+ if (Date.now() > token.expires_at) {
21
+ return { valid: false, reason: 'expired' };
22
+ }
23
+ if (token.graph_write !== false) {
24
+ return { valid: false, reason: 'graph_write_not_false' };
25
+ }
26
+ return { valid: true };
27
+ }
28
+ }
29
+ //# sourceMappingURL=TokenValidator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TokenValidator.js","sourceRoot":"","sources":["../src/TokenValidator.ts"],"names":[],"mappings":"AAAA,uDAAuD;AAOvD,uDAAuD;AAEvD;;;;;;;;GAQG;AACH,MAAM,OAAO,cAAc;IACzB,QAAQ,CAAC,KAA8B;QACrC,IAAI,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC;YACpC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,gBAAgB,EAAE,CAAC;QACpD,CAAC;QAED,IAAI,OAAO,KAAK,CAAC,UAAU,KAAK,QAAQ,EAAE,CAAC;YACzC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,gBAAgB,EAAE,CAAC;QACpD,CAAC;QAED,IAAI,IAAI,CAAC,GAAG,EAAE,GAAI,KAAK,CAAC,UAAqB,EAAE,CAAC;YAC9C,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;QAC7C,CAAC;QAED,IAAI,KAAK,CAAC,WAAW,KAAK,KAAK,EAAE,CAAC;YAChC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,uBAAuB,EAAE,CAAC;QAC3D,CAAC;QAED,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IACzB,CAAC;CACF"}
@@ -0,0 +1,6 @@
1
+ export { AgentLoop, type AgentLoopResult, type ILLMClient, type LLMMessage, type LLMResponse, } from './AgentLoop.js';
2
+ export { MCPProxy } from './MCPProxy.js';
3
+ export { OutputChannel } from './OutputChannel.js';
4
+ export { TokenValidator } from './TokenValidator.js';
5
+ export { ResourceTracker } from './ResourceTracker.js';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,SAAS,EACT,KAAK,eAAe,EACpB,KAAK,UAAU,EACf,KAAK,UAAU,EACf,KAAK,WAAW,GACjB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAGzC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGnD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAGrD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,11 @@
1
+ // ─── Agent Loop ─────────────────────────────────────
2
+ export { AgentLoop, } from './AgentLoop.js';
3
+ // ─── MCP Proxy ──────────────────────────────────────
4
+ export { MCPProxy } from './MCPProxy.js';
5
+ // ─── Output Channel ─────────────────────────────────
6
+ export { OutputChannel } from './OutputChannel.js';
7
+ // ─── Token Validator ────────────────────────────────
8
+ export { TokenValidator } from './TokenValidator.js';
9
+ // ─── Resource Tracker ───────────────────────────────
10
+ export { ResourceTracker } from './ResourceTracker.js';
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,OAAO,EACL,SAAS,GAKV,MAAM,gBAAgB,CAAC;AAExB,uDAAuD;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,uDAAuD;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,uDAAuD;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,uDAAuD;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=main.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":""}
@@ -0,0 +1,102 @@
1
+ import { AgentLoop } from './AgentLoop.js';
2
+ import { MCPProxy } from './MCPProxy.js';
3
+ import { OutputChannel } from './OutputChannel.js';
4
+ import { TokenValidator } from './TokenValidator.js';
5
+ import { ResourceTracker } from './ResourceTracker.js';
6
+ const INPUT_SENTINEL = '__PAYLOAD_END__';
7
+ // ─── Stub LLM client (Phase 3) ─────────────────────
8
+ /**
9
+ * Placeholder LLM client. In production this will be replaced by
10
+ * the real Anthropic/OpenAI client injected via config.
11
+ */
12
+ const stubLLM = {
13
+ async complete(messages) {
14
+ const lastMessage = messages[messages.length - 1];
15
+ return {
16
+ content: `[stub] Processed: ${lastMessage?.content?.slice(0, 100) ?? ''}`,
17
+ finish_reason: 'stop',
18
+ tokens_used: 0,
19
+ };
20
+ },
21
+ };
22
+ // ─── Read stdin until sentinel ──────────────────────
23
+ function readStdin() {
24
+ return new Promise((resolve, reject) => {
25
+ const chunks = [];
26
+ process.stdin.on('data', (chunk) => {
27
+ chunks.push(chunk);
28
+ const combined = Buffer.concat(chunks).toString('utf-8');
29
+ if (combined.includes(INPUT_SENTINEL)) {
30
+ const payload = combined.split(INPUT_SENTINEL)[0].trim();
31
+ resolve(payload);
32
+ }
33
+ });
34
+ process.stdin.on('error', reject);
35
+ process.stdin.on('end', () => {
36
+ const combined = Buffer.concat(chunks).toString('utf-8');
37
+ const payload = combined.split(INPUT_SENTINEL)[0].trim();
38
+ resolve(payload);
39
+ });
40
+ process.stdin.resume();
41
+ });
42
+ }
43
+ // ─── Main ───────────────────────────────────────────
44
+ async function main() {
45
+ const output = new OutputChannel();
46
+ try {
47
+ // 1. Read payload from stdin
48
+ const raw = await readStdin();
49
+ const payload = JSON.parse(raw);
50
+ // 2. Validate token
51
+ const validator = new TokenValidator();
52
+ const validation = validator.validate(payload.token);
53
+ if (!validation.valid) {
54
+ output.write({
55
+ output: '',
56
+ exit_reason: 'error',
57
+ error: `Token validation failed: ${validation.reason}`,
58
+ tool_calls: [],
59
+ llm_calls_used: 0,
60
+ tokens_used: 0,
61
+ tool_calls_count: 0,
62
+ artifacts: [],
63
+ });
64
+ process.exit(1);
65
+ }
66
+ // 3. Create resource tracker from token limits
67
+ const tracker = new ResourceTracker(payload.token.max_llm_calls ?? 10, payload.token.max_llm_tokens ?? 20_000, payload.token.max_tool_calls ?? 20);
68
+ // 4. Create MCP proxy
69
+ const proxyUrl = payload.mcp_proxy_url ?? 'http://localhost:3000/mcp';
70
+ const proxy = new MCPProxy(proxyUrl);
71
+ // 5. Create and run agent loop
72
+ const systemPrompt = payload.system_prompt || 'You are a subagent. Complete the given task.';
73
+ const loop = new AgentLoop(systemPrompt, stubLLM, proxy, tracker);
74
+ const result = await loop.run(payload.task);
75
+ // 6. Write result to stdout
76
+ output.write({
77
+ output: result.output,
78
+ exit_reason: result.exit_reason,
79
+ tool_calls: result.tool_calls,
80
+ llm_calls_used: result.llm_calls_used,
81
+ tokens_used: result.tokens_used,
82
+ tool_calls_count: result.tool_calls.length,
83
+ artifacts: [],
84
+ });
85
+ }
86
+ catch (err) {
87
+ const message = err instanceof Error ? err.message : String(err);
88
+ output.write({
89
+ output: '',
90
+ exit_reason: 'error',
91
+ error: message,
92
+ tool_calls: [],
93
+ llm_calls_used: 0,
94
+ tokens_used: 0,
95
+ tool_calls_count: 0,
96
+ artifacts: [],
97
+ });
98
+ process.exit(1);
99
+ }
100
+ }
101
+ main();
102
+ //# sourceMappingURL=main.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,6 @@
1
+ {
2
+ "name": "@0agent/seed-b2b-outbound",
3
+ "version": "0.1.0",
4
+ "main": "install.js",
5
+ "type": "module"
6
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "name": "@0agent/seed-research",
3
+ "version": "0.1.0",
4
+ "main": "install.js",
5
+ "type": "module"
6
+ }
@@ -0,0 +1,78 @@
1
+ import type { KnowledgeGraph } from '@0agent/core';
2
+ import { createNode, createEdge, NodeType, EdgeType } from '@0agent/core';
3
+ import { readFileSync } from 'node:fs';
4
+ import { join, dirname } from 'node:path';
5
+ import { fileURLToPath } from 'node:url';
6
+
7
+ interface SeedNodeData {
8
+ id?: string;
9
+ label: string;
10
+ type: string;
11
+ metadata?: Record<string, unknown>;
12
+ }
13
+
14
+ interface SeedEdgeData {
15
+ id?: string;
16
+ from: string;
17
+ to: string;
18
+ type?: string;
19
+ weight?: number;
20
+ }
21
+
22
+ interface SeedGraph {
23
+ nodes: SeedNodeData[];
24
+ edges: SeedEdgeData[];
25
+ }
26
+
27
+ export async function installSeed(
28
+ graph: KnowledgeGraph,
29
+ graphId: string = 'root',
30
+ ): Promise<{ nodes: number; edges: number }> {
31
+ // Check idempotency
32
+ const existing = graph.nodeCount(graphId);
33
+ if (existing > 0) {
34
+ console.log('[Seed] software-engineering already installed, skipping');
35
+ return { nodes: 0, edges: 0 };
36
+ }
37
+
38
+ // Read graph data from the same directory
39
+ const dir = dirname(fileURLToPath(import.meta.url));
40
+ const data: SeedGraph = JSON.parse(
41
+ readFileSync(join(dir, 'sprint-workflow.json'), 'utf8'),
42
+ );
43
+
44
+ let nodeCount = 0;
45
+ let edgeCount = 0;
46
+
47
+ for (const n of data.nodes) {
48
+ graph.addNode(
49
+ createNode({
50
+ id: n.id ?? crypto.randomUUID(),
51
+ graph_id: graphId,
52
+ label: n.label,
53
+ type: n.type as NodeType,
54
+ metadata: n.metadata ?? {},
55
+ }),
56
+ );
57
+ nodeCount++;
58
+ }
59
+
60
+ for (const e of data.edges) {
61
+ graph.addEdge(
62
+ createEdge({
63
+ id: e.id ?? crypto.randomUUID(),
64
+ graph_id: graphId,
65
+ from_node: e.from,
66
+ to_node: e.to,
67
+ type: (e.type as EdgeType) ?? EdgeType.LEADS_TO,
68
+ weight: e.weight ?? 0.5,
69
+ }),
70
+ );
71
+ edgeCount++;
72
+ }
73
+
74
+ console.log(
75
+ `[Seed] Installed software-engineering: ${nodeCount} nodes, ${edgeCount} edges`,
76
+ );
77
+ return { nodes: nodeCount, edges: edgeCount };
78
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "name": "@0agent/seed-software-engineering",
3
+ "version": "0.1.0",
4
+ "main": "install.js",
5
+ "type": "module"
6
+ }
@@ -0,0 +1,102 @@
1
+ {
2
+ "name": "@0agent/software-engineering",
3
+ "version": "1.0.0",
4
+ "description": "Sprint workflow: Think → Plan → Build → Review → Test → Ship → Reflect",
5
+
6
+ "nodes": [
7
+ {"label": "new_feature", "type": "context"},
8
+ {"label": "bug_fix", "type": "context"},
9
+ {"label": "refactor_needed", "type": "context"},
10
+ {"label": "tech_debt", "type": "context"},
11
+
12
+ {"label": "office-hours", "type": "plan", "metadata": {"is_skill": true}},
13
+ {"label": "plan-ceo-review", "type": "plan", "metadata": {"is_skill": true}},
14
+ {"label": "plan-eng-review", "type": "plan", "metadata": {"is_skill": true}},
15
+ {"label": "build", "type": "step", "metadata": {"is_skill": true}},
16
+ {"label": "review", "type": "step", "metadata": {"is_skill": true}},
17
+ {"label": "qa", "type": "step", "metadata": {"is_skill": true}},
18
+ {"label": "security-audit", "type": "step", "metadata": {"is_skill": true}},
19
+ {"label": "ship", "type": "step", "metadata": {"is_skill": true}},
20
+ {"label": "retro", "type": "outcome", "metadata": {"is_skill": true}},
21
+ {"label": "debug", "type": "step", "metadata": {"is_skill": true}},
22
+ {"label": "test-writer", "type": "step", "metadata": {"is_skill": true}},
23
+ {"label": "refactor", "type": "step", "metadata": {"is_skill": true}},
24
+ {"label": "research", "type": "step", "metadata": {"is_skill": true}},
25
+ {"label": "design-review", "type": "step", "metadata": {"is_skill": true}},
26
+ {"label": "doc", "type": "step", "metadata": {"is_skill": true}},
27
+
28
+ {"label": "shipped_clean", "type": "outcome"},
29
+ {"label": "qa_caught_bugs", "type": "signal"},
30
+ {"label": "review_caught_bugs", "type": "signal"},
31
+ {"label": "shipped_with_issues", "type": "outcome"}
32
+ ],
33
+
34
+ "edges": [
35
+ {"from": "new_feature", "to": "office-hours", "weight": 0.80, "type": "leads_to",
36
+ "rationale": "New features benefit from design thinking before building"},
37
+ {"from": "new_feature", "to": "build", "weight": 0.30, "type": "leads_to",
38
+ "rationale": "Sometimes you just need to build it — but risky without planning"},
39
+
40
+ {"from": "bug_fix", "to": "debug", "weight": 0.85, "type": "leads_to",
41
+ "rationale": "Bugs should be diagnosed before fixed"},
42
+ {"from": "bug_fix", "to": "build", "weight": 0.50, "type": "leads_to",
43
+ "rationale": "Simple bugs can go straight to fix"},
44
+
45
+ {"from": "refactor_needed", "to": "test-writer", "weight": 0.80, "type": "leads_to",
46
+ "rationale": "Write tests before refactoring — safety net first"},
47
+ {"from": "refactor_needed", "to": "refactor", "weight": 0.40, "type": "leads_to",
48
+ "rationale": "Refactoring without tests is risky — lower initial weight"},
49
+
50
+ {"from": "office-hours", "to": "plan-ceo-review", "weight": 0.85, "type": "leads_to",
51
+ "rationale": "Design docs should be validated for product fit"},
52
+ {"from": "plan-ceo-review", "to": "plan-eng-review", "weight": 0.80, "type": "leads_to",
53
+ "rationale": "Product-approved plans need technical architecture review"},
54
+ {"from": "plan-eng-review", "to": "build", "weight": 0.90, "type": "leads_to",
55
+ "rationale": "Technically reviewed plans are ready for implementation"},
56
+
57
+ {"from": "build", "to": "review", "weight": 0.90, "type": "leads_to",
58
+ "rationale": "All code should be reviewed before testing"},
59
+ {"from": "build", "to": "design-review", "weight": 0.45, "type": "leads_to",
60
+ "rationale": "UI changes benefit from design review — context-dependent"},
61
+ {"from": "build", "to": "qa", "weight": 0.35, "type": "leads_to",
62
+ "rationale": "Skipping review is risky — low initial weight, will learn"},
63
+
64
+ {"from": "design-review", "to": "review", "weight": 0.70, "type": "leads_to",
65
+ "rationale": "Design-reviewed code proceeds to code review"},
66
+
67
+ {"from": "review", "to": "qa", "weight": 0.85, "type": "leads_to",
68
+ "rationale": "Reviewed code should proceed to QA testing"},
69
+ {"from": "review", "to": "security-audit", "weight": 0.50, "type": "leads_to",
70
+ "rationale": "Security audit is context-dependent — starts neutral"},
71
+ {"from": "review", "to": "ship", "weight": 0.30, "type": "leads_to",
72
+ "rationale": "Shipping without QA is risky — low initial weight"},
73
+
74
+ {"from": "security-audit", "to": "qa", "weight": 0.75, "type": "leads_to",
75
+ "rationale": "Security-audited code still needs QA"},
76
+
77
+ {"from": "qa", "to": "ship", "weight": 0.85, "type": "leads_to",
78
+ "rationale": "QA-passed code is ready to ship"},
79
+ {"from": "qa", "to": "build", "weight": 0.60, "type": "leads_to",
80
+ "rationale": "QA failures go back to build for fixes"},
81
+
82
+ {"from": "ship", "to": "retro", "weight": 0.70, "type": "leads_to",
83
+ "rationale": "Shipped features benefit from retrospective — not always needed"},
84
+ {"from": "ship", "to": "doc", "weight": 0.55, "type": "leads_to",
85
+ "rationale": "Shipped features should be documented"},
86
+
87
+ {"from": "ship", "to": "shipped_clean", "weight": 0.50, "type": "leads_to",
88
+ "rationale": "Neutral — will learn from actual ship outcomes"},
89
+
90
+ {"from": "review", "to": "review_caught_bugs", "weight": 0.50, "type": "leads_to",
91
+ "rationale": "Starts neutral — /retro will adjust based on actual catch rate"},
92
+ {"from": "qa", "to": "qa_caught_bugs", "weight": 0.50, "type": "leads_to",
93
+ "rationale": "Starts neutral — /retro will adjust based on actual catch rate"},
94
+
95
+ {"from": "debug", "to": "build", "weight": 0.85, "type": "leads_to",
96
+ "rationale": "Diagnosed bugs proceed to fix implementation"},
97
+ {"from": "test-writer", "to": "refactor", "weight": 0.80, "type": "leads_to",
98
+ "rationale": "Tests written → safe to refactor"},
99
+ {"from": "refactor", "to": "review", "weight": 0.85, "type": "leads_to",
100
+ "rationale": "Refactored code needs review"}
101
+ ]
102
+ }