@octopi-agent/engine 0.70.7 → 0.90.11

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 (390) hide show
  1. package/LICENSE +201 -201
  2. package/NOTICE +7 -7
  3. package/README.md +64 -26
  4. package/dist/config-schema/agent.d.ts +89 -1
  5. package/dist/config-schema/agent.js +81 -5
  6. package/dist/config-schema/context.d.ts +24 -5
  7. package/dist/config-schema/context.js +28 -1
  8. package/dist/config-schema/engine.d.ts +205 -13
  9. package/dist/config-schema/engine.js +31 -2
  10. package/dist/config-schema/governance.d.ts +95 -0
  11. package/dist/config-schema/governance.js +93 -1
  12. package/dist/config-schema/models.d.ts +3 -3
  13. package/dist/config-schema/observability.d.ts +6 -0
  14. package/dist/config-schema/observability.js +16 -0
  15. package/dist/config-schema/run.d.ts +10 -0
  16. package/dist/config-schema/run.js +18 -0
  17. package/dist/config-schema/shared.d.ts +13 -0
  18. package/dist/config-schema/shared.js +22 -0
  19. package/dist/config-schema/substrate.d.ts +2 -2
  20. package/dist/config-schema/subsystems.d.ts +1 -1
  21. package/dist/config-schema/subsystems.js +2 -1
  22. package/dist/config.d.ts +201 -8
  23. package/dist/config.js +105 -3
  24. package/dist/harness/activation/compiler.js +3 -0
  25. package/dist/harness/activation/runtime.d.ts +7 -0
  26. package/dist/harness/activation/runtime.js +60 -2
  27. package/dist/harness/activation/sources/agent-signal.d.ts +11 -0
  28. package/dist/harness/activation/sources/agent-signal.js +33 -0
  29. package/dist/harness/activation/types.d.ts +6 -1
  30. package/dist/harness/agent/builder.d.ts +50 -5
  31. package/dist/harness/agent/builder.js +189 -59
  32. package/dist/harness/agent/config-bridge.d.ts +33 -25
  33. package/dist/harness/agent/config-bridge.js +84 -291
  34. package/dist/harness/agent/index.d.ts +3 -1
  35. package/dist/harness/agent/index.js +2 -1
  36. package/dist/harness/agent/tool-purpose.d.ts +46 -0
  37. package/dist/harness/agent/tool-purpose.js +127 -0
  38. package/dist/harness/agent/wire-agent-builder.d.ts +133 -0
  39. package/dist/harness/agent/wire-agent-builder.js +370 -0
  40. package/dist/harness/collaboration/autonomous-subsystem/boundary/validator.d.ts +11 -1
  41. package/dist/harness/collaboration/autonomous-subsystem/boundary/validator.js +11 -1
  42. package/dist/harness/collaboration/autonomous-subsystem/loader.d.ts +13 -0
  43. package/dist/harness/collaboration/autonomous-subsystem/loader.js +16 -1
  44. package/dist/harness/collaboration/autonomous-subsystem/runtime.d.ts +8 -1
  45. package/dist/harness/collaboration/autonomous-subsystem/runtime.js +17 -9
  46. package/dist/harness/collaboration/autonomous-subsystem/sense/metrics.d.ts +12 -0
  47. package/dist/harness/collaboration/autonomous-subsystem/sense/metrics.js +19 -0
  48. package/dist/harness/collaboration/autonomous-subsystem/sense/session-lifecycle-bridge.d.ts +6 -0
  49. package/dist/harness/collaboration/autonomous-subsystem/sense/session-lifecycle-bridge.js +24 -7
  50. package/dist/harness/collaboration/autonomous-subsystem/think/executor.d.ts +5 -2
  51. package/dist/harness/collaboration/autonomous-subsystem/think/executor.js +11 -3
  52. package/dist/harness/collaboration/autonomous-subsystem/think/index.d.ts +1 -1
  53. package/dist/harness/collaboration/autonomous-subsystem/think/index.js +1 -1
  54. package/dist/harness/collaboration/autonomous-subsystem/think/llm-port.d.ts +7 -4
  55. package/dist/harness/collaboration/autonomous-subsystem/think/llm-port.js +8 -9
  56. package/dist/harness/collaboration/autonomous-subsystem/think/model-resolver.d.ts +36 -10
  57. package/dist/harness/collaboration/autonomous-subsystem/think/model-resolver.js +60 -7
  58. package/dist/harness/collaboration/delegation/child-run.d.ts +144 -0
  59. package/dist/harness/collaboration/delegation/child-run.js +241 -0
  60. package/dist/harness/collaboration/delegation/index.d.ts +26 -0
  61. package/dist/harness/collaboration/delegation/index.js +25 -0
  62. package/dist/harness/collaboration/delegation/notifier.d.ts +46 -0
  63. package/dist/harness/collaboration/delegation/notifier.js +84 -0
  64. package/dist/harness/collaboration/delegation/registry-types.d.ts +200 -0
  65. package/dist/harness/collaboration/delegation/registry-types.js +61 -0
  66. package/dist/harness/collaboration/delegation/registry.d.ts +110 -0
  67. package/dist/harness/collaboration/delegation/registry.js +220 -0
  68. package/dist/harness/collaboration/delegation/service.d.ts +249 -0
  69. package/dist/harness/collaboration/delegation/service.js +499 -0
  70. package/dist/harness/collaboration/delegation/store.d.ts +155 -0
  71. package/dist/harness/collaboration/delegation/store.js +271 -0
  72. package/dist/harness/collaboration/delegation/transport.d.ts +73 -0
  73. package/dist/harness/collaboration/delegation/transport.js +61 -0
  74. package/dist/harness/collaboration/delegation/types.d.ts +231 -0
  75. package/dist/harness/collaboration/delegation/types.js +70 -0
  76. package/dist/harness/collaboration/delegation/wiring.d.ts +111 -0
  77. package/dist/harness/collaboration/delegation/wiring.js +145 -0
  78. package/dist/harness/collaboration/orchestration/index.d.ts +11 -13
  79. package/dist/harness/collaboration/orchestration/index.js +11 -11
  80. package/dist/harness/context/assembler.d.ts +2 -2
  81. package/dist/harness/context/assembler.js +12 -7
  82. package/dist/harness/context/capabilities/compact/engine.js +80 -38
  83. package/dist/harness/context/capabilities/compact/types.d.ts +12 -1
  84. package/dist/harness/context/capabilities/summary/registry.js +10 -0
  85. package/dist/harness/context/constitution/default-agents.md +230 -228
  86. package/dist/harness/context/default-context-engine.d.ts +101 -23
  87. package/dist/harness/context/default-context-engine.js +483 -172
  88. package/dist/harness/context/hybrid-compressor.d.ts +3 -3
  89. package/dist/harness/context/hybrid-compressor.js +18 -23
  90. package/dist/harness/context/index.d.ts +5 -1
  91. package/dist/harness/context/index.js +2 -0
  92. package/dist/harness/context/layer-snapshot.d.ts +4 -0
  93. package/dist/harness/context/layer-snapshot.js +30 -18
  94. package/dist/harness/context/layer-types.d.ts +85 -1
  95. package/dist/harness/context/layer-types.js +110 -4
  96. package/dist/harness/context/layers.d.ts +5 -2
  97. package/dist/harness/context/layers.js +11 -5
  98. package/dist/harness/context/llm-summarizer.d.ts +15 -1
  99. package/dist/harness/context/llm-summarizer.js +107 -56
  100. package/dist/harness/context/message-selector.js +6 -2
  101. package/dist/harness/context/root-instructions.d.ts +72 -0
  102. package/dist/harness/context/root-instructions.js +227 -0
  103. package/dist/harness/context/runtime-datetime.d.ts +34 -7
  104. package/dist/harness/context/runtime-datetime.js +66 -10
  105. package/dist/harness/context/smart-router.d.ts +1 -1
  106. package/dist/harness/context/smart-router.js +1 -1
  107. package/dist/harness/context/system-prompt-assembler.d.ts +30 -0
  108. package/dist/harness/context/system-prompt-assembler.js +73 -6
  109. package/dist/harness/context/token-constants.d.ts +2 -2
  110. package/dist/harness/context/token-constants.js +2 -2
  111. package/dist/harness/context/token-estimate-fns.d.ts +1 -3
  112. package/dist/harness/context/token-estimate-fns.js +2 -4
  113. package/dist/harness/context/token-estimator.d.ts +1 -1
  114. package/dist/harness/context/token-estimator.js +14 -6
  115. package/dist/harness/context/tool-result-aging.d.ts +140 -0
  116. package/dist/harness/context/tool-result-aging.js +331 -0
  117. package/dist/harness/context/tool-result-body.d.ts +10 -0
  118. package/dist/harness/context/tool-result-body.js +27 -0
  119. package/dist/harness/context/turn-envelope.d.ts +123 -0
  120. package/dist/harness/context/turn-envelope.js +188 -0
  121. package/dist/harness/context/types.d.ts +35 -47
  122. package/dist/harness/extension/execution-environment/effect-policy.d.ts +258 -0
  123. package/dist/harness/extension/execution-environment/effect-policy.js +358 -0
  124. package/dist/harness/extension/execution-environment/index.d.ts +18 -2
  125. package/dist/harness/extension/execution-environment/index.js +11 -2
  126. package/dist/harness/extension/execution-environment/isolation.js +5 -1
  127. package/dist/harness/extension/execution-environment/memory-undo.d.ts +101 -0
  128. package/dist/harness/extension/execution-environment/memory-undo.js +192 -0
  129. package/dist/harness/extension/execution-environment/process-isolation.d.ts +84 -0
  130. package/dist/harness/extension/execution-environment/process-isolation.js +315 -0
  131. package/dist/harness/extension/execution-environment/resource-limits.d.ts +36 -0
  132. package/dist/harness/extension/execution-environment/resource-limits.js +84 -0
  133. package/dist/harness/extension/execution-environment/sandbox.d.ts +125 -4
  134. package/dist/harness/extension/execution-environment/sandbox.js +521 -51
  135. package/dist/harness/extension/execution-environment/shell-journal.d.ts +100 -0
  136. package/dist/harness/extension/execution-environment/shell-journal.js +299 -0
  137. package/dist/harness/extension/execution-environment/tool-capabilities.d.ts +45 -0
  138. package/dist/harness/extension/execution-environment/tool-capabilities.js +126 -0
  139. package/dist/harness/extension/execution-environment/types.d.ts +67 -39
  140. package/dist/harness/extension/execution-environment/types.js +2 -2
  141. package/dist/harness/extension/execution-environment/undo-log.d.ts +203 -0
  142. package/dist/harness/extension/execution-environment/undo-log.js +627 -0
  143. package/dist/harness/extension/execution-environment/undo-merge.d.ts +40 -0
  144. package/dist/harness/extension/execution-environment/undo-merge.js +167 -0
  145. package/dist/harness/extension/plugin-ecosystem/client-tools/index.d.ts +1 -1
  146. package/dist/harness/extension/plugin-ecosystem/client-tools/types.d.ts +9 -0
  147. package/dist/harness/extension/plugin-ecosystem/mcp/bridge.js +2 -0
  148. package/dist/harness/extension/plugin-ecosystem/plugins/api.d.ts +1 -6
  149. package/dist/harness/extension/plugin-ecosystem/plugins/api.js +3 -8
  150. package/dist/harness/extension/plugin-ecosystem/plugins/capability.d.ts +0 -3
  151. package/dist/harness/extension/plugin-ecosystem/plugins/capability.js +0 -3
  152. package/dist/harness/extension/plugin-ecosystem/plugins/entry.d.ts +2 -10
  153. package/dist/harness/extension/plugin-ecosystem/plugins/entry.js +2 -9
  154. package/dist/harness/extension/plugin-ecosystem/plugins/index.d.ts +1 -3
  155. package/dist/harness/extension/plugin-ecosystem/plugins/index.js +1 -3
  156. package/dist/harness/extension/plugin-ecosystem/plugins/loader.d.ts +2 -4
  157. package/dist/harness/extension/plugin-ecosystem/plugins/loader.js +4 -21
  158. package/dist/harness/extension/plugin-ecosystem/plugins/manager.d.ts +3 -9
  159. package/dist/harness/extension/plugin-ecosystem/plugins/manager.js +4 -8
  160. package/dist/harness/extension/plugin-ecosystem/plugins/manifest.d.ts +1 -4
  161. package/dist/harness/extension/plugin-ecosystem/plugins/manifest.js +1 -3
  162. package/dist/harness/extension/plugin-ecosystem/skills/manager.d.ts +1 -1
  163. package/dist/harness/extension/plugin-ecosystem/skills/manager.js +1 -1
  164. package/dist/harness/extension/plugin-ecosystem/tools/allowlisted-run.d.ts +51 -0
  165. package/dist/harness/extension/plugin-ecosystem/tools/allowlisted-run.js +153 -0
  166. package/dist/harness/extension/plugin-ecosystem/tools/ask-user.js +1 -0
  167. package/dist/harness/extension/plugin-ecosystem/tools/builtin.d.ts +18 -3
  168. package/dist/harness/extension/plugin-ecosystem/tools/builtin.js +277 -81
  169. package/dist/harness/extension/plugin-ecosystem/tools/delegation.d.ts +31 -0
  170. package/dist/harness/extension/plugin-ecosystem/tools/delegation.js +291 -0
  171. package/dist/harness/extension/plugin-ecosystem/tools/document-tools.js +10 -2
  172. package/dist/harness/extension/plugin-ecosystem/tools/env-info.js +1 -0
  173. package/dist/harness/extension/plugin-ecosystem/tools/eol.d.ts +35 -0
  174. package/dist/harness/extension/plugin-ecosystem/tools/eol.js +43 -0
  175. package/dist/harness/extension/plugin-ecosystem/tools/file-edit.js +40 -9
  176. package/dist/harness/extension/plugin-ecosystem/tools/file-ops.d.ts +33 -0
  177. package/dist/harness/extension/plugin-ecosystem/tools/file-ops.js +376 -0
  178. package/dist/harness/extension/plugin-ecosystem/tools/file-search.d.ts +12 -2
  179. package/dist/harness/extension/plugin-ecosystem/tools/file-search.js +241 -70
  180. package/dist/harness/extension/plugin-ecosystem/tools/git-runner.d.ts +31 -0
  181. package/dist/harness/extension/plugin-ecosystem/tools/git-runner.js +104 -0
  182. package/dist/harness/extension/plugin-ecosystem/tools/git-status-snapshot.d.ts +111 -0
  183. package/dist/harness/extension/plugin-ecosystem/tools/git-status-snapshot.js +197 -0
  184. package/dist/harness/extension/plugin-ecosystem/tools/git-tools.d.ts +27 -0
  185. package/dist/harness/extension/plugin-ecosystem/tools/git-tools.js +463 -0
  186. package/dist/harness/extension/plugin-ecosystem/tools/http.d.ts +10 -6
  187. package/dist/harness/extension/plugin-ecosystem/tools/http.js +41 -47
  188. package/dist/harness/extension/plugin-ecosystem/tools/index.d.ts +6 -0
  189. package/dist/harness/extension/plugin-ecosystem/tools/index.js +4 -0
  190. package/dist/harness/extension/plugin-ecosystem/tools/knowledge.js +4 -0
  191. package/dist/harness/extension/plugin-ecosystem/tools/memory.js +25 -1
  192. package/dist/harness/extension/plugin-ecosystem/tools/package-tools.d.ts +13 -0
  193. package/dist/harness/extension/plugin-ecosystem/tools/package-tools.js +391 -0
  194. package/dist/harness/extension/plugin-ecosystem/tools/platform.d.ts +51 -2
  195. package/dist/harness/extension/plugin-ecosystem/tools/platform.js +151 -12
  196. package/dist/harness/extension/plugin-ecosystem/tools/session-history.js +2 -0
  197. package/dist/harness/extension/plugin-ecosystem/tools/tool-bus.d.ts +10 -1
  198. package/dist/harness/extension/plugin-ecosystem/tools/tool-bus.js +35 -19
  199. package/dist/harness/extension/plugin-ecosystem/tools/tool-set.d.ts +8 -0
  200. package/dist/harness/extension/plugin-ecosystem/tools/tool-set.js +5 -0
  201. package/dist/harness/extension/plugin-ecosystem/tools/web-search.js +1 -0
  202. package/dist/harness/governance/credentials/index.d.ts +1 -1
  203. package/dist/harness/governance/credentials/store.d.ts +16 -4
  204. package/dist/harness/governance/credentials/store.js +33 -6
  205. package/dist/harness/governance/credentials/types.d.ts +11 -0
  206. package/dist/harness/governance/human-in-the-loop/decision-cache.d.ts +105 -0
  207. package/dist/harness/governance/human-in-the-loop/decision-cache.js +184 -0
  208. package/dist/harness/governance/human-in-the-loop/index.d.ts +5 -5
  209. package/dist/harness/governance/human-in-the-loop/index.js +3 -3
  210. package/dist/harness/governance/human-in-the-loop/types.d.ts +7 -62
  211. package/dist/harness/governance/human-in-the-loop/types.js +6 -2
  212. package/dist/harness/governance/security/capability-enforcer.d.ts +9 -1
  213. package/dist/harness/governance/security/capability-enforcer.js +31 -8
  214. package/dist/harness/governance/security/degradation.js +5 -7
  215. package/dist/harness/governance/security/risk-evaluator.d.ts +1 -1
  216. package/dist/harness/governance/security/risk-evaluator.js +4 -82
  217. package/dist/harness/governance/security/temp-path.d.ts +41 -0
  218. package/dist/harness/governance/security/temp-path.js +117 -0
  219. package/dist/harness/governance/session-acl/index.d.ts +1 -0
  220. package/dist/harness/governance/session-acl/index.js +1 -0
  221. package/dist/harness/governance/session-acl/rights.d.ts +12 -0
  222. package/dist/harness/governance/session-acl/rights.js +89 -7
  223. package/dist/harness/governance/session-acl/seed-roles.js +9 -1
  224. package/dist/harness/governance/session-acl/service.js +21 -29
  225. package/dist/harness/governance/session-acl/tool-rights.d.ts +81 -0
  226. package/dist/harness/governance/session-acl/tool-rights.js +238 -0
  227. package/dist/harness/governance/session-acl/types.d.ts +22 -0
  228. package/dist/harness/index.d.ts +16 -12
  229. package/dist/harness/index.js +10 -6
  230. package/dist/harness/knowledge/file-identity.d.ts +8 -0
  231. package/dist/harness/knowledge/file-identity.js +26 -1
  232. package/dist/harness/knowledge/file-index-store.js +11 -11
  233. package/dist/harness/knowledge/grounding.d.ts +2 -1
  234. package/dist/harness/knowledge/grounding.js +8 -5
  235. package/dist/harness/knowledge/index-store.d.ts +31 -4
  236. package/dist/harness/knowledge/index-store.js +121 -39
  237. package/dist/harness/knowledge/index.d.ts +2 -2
  238. package/dist/harness/knowledge/index.js +1 -1
  239. package/dist/harness/knowledge/ingest.d.ts +115 -115
  240. package/dist/harness/knowledge/ingest.js +154 -151
  241. package/dist/harness/knowledge/job-control-state.js +4 -4
  242. package/dist/harness/knowledge/job-control.js +11 -11
  243. package/dist/harness/knowledge/knowledge-serve-child.js +1 -1
  244. package/dist/harness/knowledge/membership-store.js +11 -11
  245. package/dist/harness/knowledge/network-guard.d.ts +61 -4
  246. package/dist/harness/knowledge/network-guard.js +390 -113
  247. package/dist/harness/knowledge/purge.js +4 -1
  248. package/dist/harness/knowledge/query-service.js +3 -3
  249. package/dist/harness/knowledge/writer-service.d.ts +2 -0
  250. package/dist/harness/knowledge/writer-service.js +14 -13
  251. package/dist/harness/memory/backfill-coverage.js +3 -1
  252. package/dist/harness/memory/backfill-trigger.d.ts +2 -2
  253. package/dist/harness/memory/backfill-trigger.js +4 -4
  254. package/dist/harness/memory/index.d.ts +1 -0
  255. package/dist/harness/memory/index.js +1 -0
  256. package/dist/harness/memory/sqlite/agent-db.js +2 -0
  257. package/dist/harness/memory/sqlite/memory-store.d.ts +1 -0
  258. package/dist/harness/memory/sqlite/memory-store.js +14 -4
  259. package/dist/harness/memory/sqlite/wisdom-store.js +9 -9
  260. package/dist/harness/memory/store.d.ts +1 -0
  261. package/dist/harness/memory/store.js +3 -0
  262. package/dist/harness/memory/time-format.d.ts +28 -0
  263. package/dist/harness/memory/time-format.js +52 -0
  264. package/dist/harness/memory/types.d.ts +12 -0
  265. package/dist/harness/observability/observer/hub.js +53 -2
  266. package/dist/harness/observability/observer/index.d.ts +2 -2
  267. package/dist/harness/observability/observer/index.js +1 -1
  268. package/dist/harness/observability/observer/types.d.ts +80 -0
  269. package/dist/harness/observability/observer/types.js +118 -9
  270. package/dist/harness/run/agent/agent.d.ts +18 -0
  271. package/dist/harness/run/agent/agent.js +26 -0
  272. package/dist/harness/run/concurrency/tool-loop-detection-core.d.ts +1 -1
  273. package/dist/harness/run/concurrency/tool-loop-detection-core.js +1 -1
  274. package/dist/harness/run/reliability/harness-events.d.ts +4 -0
  275. package/dist/harness/run/reliability/run-agent.js +110 -18
  276. package/dist/harness/run/reliability/run-metrics-collector.d.ts +28 -2
  277. package/dist/harness/run/reliability/run-metrics-collector.js +92 -2
  278. package/dist/harness/run/run-guard/default-run-guard.d.ts +0 -5
  279. package/dist/harness/run/run-guard/default-run-guard.js +104 -44
  280. package/dist/harness/run/run-scope.d.ts +52 -0
  281. package/dist/harness/run/runner.d.ts +117 -16
  282. package/dist/harness/run/runner.js +668 -157
  283. package/dist/harness/session/attachments/llm-intent.js +17 -17
  284. package/dist/harness/session/history/port.js +16 -5
  285. package/dist/harness/session/in-memory-store.d.ts +6 -0
  286. package/dist/harness/session/in-memory-store.js +55 -3
  287. package/dist/harness/session/schedules/index.d.ts +10 -0
  288. package/dist/harness/session/schedules/index.js +10 -0
  289. package/dist/harness/session/schedules/render.d.ts +13 -0
  290. package/dist/harness/session/schedules/render.js +63 -0
  291. package/dist/harness/session/schedules/service.d.ts +179 -0
  292. package/dist/harness/session/schedules/service.js +695 -0
  293. package/dist/harness/session/schedules/store.d.ts +119 -0
  294. package/dist/harness/session/schedules/store.js +323 -0
  295. package/dist/harness/session/schedules/tools.d.ts +39 -0
  296. package/dist/harness/session/schedules/tools.js +442 -0
  297. package/dist/harness/session/schedules/types.d.ts +104 -0
  298. package/dist/harness/session/schedules/types.js +97 -0
  299. package/dist/harness/session/tasks/tools.js +22 -0
  300. package/dist/harness/session/title.js +25 -9
  301. package/dist/harness/session/types.d.ts +35 -0
  302. package/dist/harness/shared/events/agent-event-map.d.ts +39 -0
  303. package/dist/harness/shared/events/agent-event-map.js +2 -0
  304. package/dist/harness/shared/types/agent-definition.d.ts +23 -0
  305. package/dist/index.d.ts +25 -9
  306. package/dist/index.js +11 -2
  307. package/dist/integration/observability/run-telemetry.d.ts +8 -0
  308. package/dist/integration/observability/run-telemetry.js +31 -8
  309. package/dist/integration/observability/trace-collector.js +26 -4
  310. package/dist/integration/observability/trace-events.d.ts +1 -0
  311. package/dist/integration/observability/trace-events.js +2 -0
  312. package/dist/integration/observability/trace-logger.js +27 -17
  313. package/dist/integration/providers/anthropic.d.ts +10 -0
  314. package/dist/integration/providers/anthropic.js +44 -1
  315. package/dist/integration/providers/openai.d.ts +10 -0
  316. package/dist/integration/providers/openai.js +58 -2
  317. package/dist/integration/providers/wire-dump-diff.d.ts +191 -0
  318. package/dist/integration/providers/wire-dump-diff.js +351 -0
  319. package/dist/integration/providers/wire-dump.d.ts +178 -0
  320. package/dist/integration/providers/wire-dump.js +396 -0
  321. package/dist/integration/storage/jsonl.d.ts +29 -0
  322. package/dist/integration/storage/jsonl.js +243 -41
  323. package/dist/integration/storage/session-index.js +63 -8
  324. package/dist/paths.d.ts +19 -0
  325. package/dist/paths.js +38 -1
  326. package/dist/subsystems/cognition-steward/conceptualize/SUBSYSTEM.md +43 -43
  327. package/dist/subsystems/cognition-steward/conceptualize/config.yaml +50 -50
  328. package/dist/subsystems/cognition-steward/consolidate/SUBSYSTEM.md +6 -6
  329. package/dist/subsystems/cognition-steward/consolidate/config.yaml +54 -54
  330. package/dist/subsystems/memory-steward/backfill/handler.js +9 -0
  331. package/dist/subsystems/safety-guard/config.yaml +3 -1
  332. package/dist/subsystems/wisdom-steward/evaluate/config.yaml +50 -50
  333. package/dist/subsystems/wisdom-steward/formation/SUBSYSTEM.md +42 -42
  334. package/dist/subsystems/wisdom-steward/formation/config.yaml +54 -54
  335. package/dist/subsystems/wisdom-steward/govern/config.yaml +55 -55
  336. package/package.json +115 -115
  337. package/dist/harness/collaboration/multi-agent/agent-registry-types.d.ts +0 -144
  338. package/dist/harness/collaboration/multi-agent/agent-registry-types.js +0 -25
  339. package/dist/harness/collaboration/multi-agent/index.d.ts +0 -17
  340. package/dist/harness/collaboration/multi-agent/index.js +0 -15
  341. package/dist/harness/collaboration/multi-agent/process.d.ts +0 -167
  342. package/dist/harness/collaboration/multi-agent/process.js +0 -256
  343. package/dist/harness/collaboration/multi-agent/registry.d.ts +0 -36
  344. package/dist/harness/collaboration/multi-agent/registry.js +0 -137
  345. package/dist/harness/collaboration/multi-agent/swarm.d.ts +0 -135
  346. package/dist/harness/collaboration/multi-agent/swarm.js +0 -317
  347. package/dist/harness/collaboration/multi-agent/types.d.ts +0 -66
  348. package/dist/harness/collaboration/multi-agent/types.js +0 -15
  349. package/dist/harness/collaboration/orchestration/async-task-store.d.ts +0 -107
  350. package/dist/harness/collaboration/orchestration/async-task-store.js +0 -12
  351. package/dist/harness/collaboration/orchestration/async-task.d.ts +0 -156
  352. package/dist/harness/collaboration/orchestration/async-task.js +0 -359
  353. package/dist/harness/collaboration/orchestration/planner/hybrid-planner.d.ts +0 -47
  354. package/dist/harness/collaboration/orchestration/planner/hybrid-planner.js +0 -61
  355. package/dist/harness/collaboration/orchestration/planner/index.d.ts +0 -9
  356. package/dist/harness/collaboration/orchestration/planner/index.js +0 -6
  357. package/dist/harness/collaboration/orchestration/planner/llm-planner.d.ts +0 -54
  358. package/dist/harness/collaboration/orchestration/planner/llm-planner.js +0 -167
  359. package/dist/harness/collaboration/orchestration/planner/rule-planner.d.ts +0 -85
  360. package/dist/harness/collaboration/orchestration/planner/rule-planner.js +0 -175
  361. package/dist/harness/collaboration/orchestration/quality/classifier.d.ts +0 -21
  362. package/dist/harness/collaboration/orchestration/quality/classifier.js +0 -235
  363. package/dist/harness/collaboration/orchestration/quality/gate.d.ts +0 -29
  364. package/dist/harness/collaboration/orchestration/quality/gate.js +0 -409
  365. package/dist/harness/collaboration/orchestration/quality/index.d.ts +0 -9
  366. package/dist/harness/collaboration/orchestration/quality/index.js +0 -8
  367. package/dist/harness/collaboration/orchestration/quality/types.d.ts +0 -159
  368. package/dist/harness/collaboration/orchestration/quality/types.js +0 -33
  369. package/dist/harness/collaboration/orchestration/scheduler/index.d.ts +0 -5
  370. package/dist/harness/collaboration/orchestration/scheduler/index.js +0 -4
  371. package/dist/harness/collaboration/orchestration/scheduler/task-scheduler.d.ts +0 -143
  372. package/dist/harness/collaboration/orchestration/scheduler/task-scheduler.js +0 -297
  373. package/dist/harness/collaboration/orchestration/strategy/classifier.d.ts +0 -12
  374. package/dist/harness/collaboration/orchestration/strategy/classifier.js +0 -81
  375. package/dist/harness/collaboration/orchestration/strategy/index.d.ts +0 -3
  376. package/dist/harness/collaboration/orchestration/strategy/index.js +0 -2
  377. package/dist/harness/collaboration/orchestration/strategy/router.d.ts +0 -28
  378. package/dist/harness/collaboration/orchestration/strategy/router.js +0 -105
  379. package/dist/harness/collaboration/orchestration/strategy/types.d.ts +0 -49
  380. package/dist/harness/collaboration/orchestration/strategy/types.js +0 -4
  381. package/dist/harness/collaboration/orchestration/workflow/engine.d.ts +0 -86
  382. package/dist/harness/collaboration/orchestration/workflow/engine.js +0 -298
  383. package/dist/harness/collaboration/orchestration/workflow/index.d.ts +0 -9
  384. package/dist/harness/collaboration/orchestration/workflow/index.js +0 -7
  385. package/dist/harness/collaboration/orchestration/workflow/types.d.ts +0 -143
  386. package/dist/harness/collaboration/orchestration/workflow/types.js +0 -7
  387. package/dist/harness/governance/human-in-the-loop/approval-manager.d.ts +0 -32
  388. package/dist/harness/governance/human-in-the-loop/approval-manager.js +0 -93
  389. /package/dist/harness/collaboration/{multi-agent → delegation}/message-channel-types.d.ts +0 -0
  390. /package/dist/harness/collaboration/{multi-agent → delegation}/message-channel-types.js +0 -0
@@ -1,49 +0,0 @@
1
- /**
2
- * StrategyRouter 类型定义
3
- */
4
- /** 任务复杂度 */
5
- export type TaskComplexity = 'simple' | 'moderate' | 'complex';
6
- /** 任务类型 */
7
- export type TaskCategory = 'question' | 'lookup' | 'analysis' | 'creation' | 'coding' | 'planning' | 'conversation' | 'unknown';
8
- /** 任务分类结果 */
9
- export interface TaskClassification {
10
- /** 任务类型 */
11
- category: TaskCategory;
12
- /** 复杂度 */
13
- complexity: TaskComplexity;
14
- /** 置信度 0-1 */
15
- confidence: number;
16
- /** 是否需要工具 */
17
- needsTools: boolean;
18
- /** 是否需要规划 */
19
- needsPlanning: boolean;
20
- /** 推理 */
21
- reasoning?: string;
22
- }
23
- /** 推理策略类型 */
24
- export type StrategyKind = 'direct' | 'chain_of_thought' | 'plan_and_execute' | 'tool_use' | 'reflect' | 'multi_agent';
25
- /** 推理策略 */
26
- export interface Strategy {
27
- /** 策略类型 */
28
- kind: StrategyKind;
29
- /** 策略名称 */
30
- name: string;
31
- /** 策略描述 */
32
- description: string;
33
- /** 系统提示词补充 */
34
- systemPromptAddition?: string;
35
- /** 最大迭代次数 */
36
- maxIterations?: number;
37
- /** 是否需要反思 */
38
- needsReflection?: boolean;
39
- /** 温度调整 */
40
- temperature?: number;
41
- }
42
- export interface TaskClassifier {
43
- readonly name: string;
44
- classify(input: string, context?: Record<string, unknown>): Promise<TaskClassification>;
45
- }
46
- export interface StrategyRouter {
47
- readonly name: string;
48
- select(classification: TaskClassification): Strategy;
49
- }
@@ -1,4 +0,0 @@
1
- /**
2
- * StrategyRouter 类型定义
3
- */
4
- export {};
@@ -1,86 +0,0 @@
1
- /**
2
- * WorkflowEngine — Workflow 执行引擎
3
- *
4
- * 确定性多步骤编排(experimental)。
5
- * 支持顺序执行、条件分支、循环、并行、错误处理。
6
- * 与 SessionTask 状态机无关;长流水线如需用户可见任务,经 SessionTaskService 单向登记。
7
- */
8
- import type { WorkflowDefinition, WorkflowStep, WorkflowInstance, WorkflowContext, WorkflowEvent, StepExecutor } from './types.js';
9
- /** WorkflowEngine 配置 */
10
- export interface WorkflowEngineConfig {
11
- /** 步骤执行器 */
12
- stepExecutor: StepExecutor;
13
- /** 最大并发步骤数(用于并行) */
14
- maxConcurrency?: number;
15
- }
16
- /**
17
- * WorkflowEngine
18
- *
19
- * 执行 Workflow 定义,管理实例生命周期。
20
- */
21
- export declare class WorkflowEngine {
22
- private config;
23
- private definitions;
24
- private instances;
25
- constructor(config: WorkflowEngineConfig);
26
- /**
27
- * 注册 Workflow 定义
28
- */
29
- register(definition: WorkflowDefinition): void;
30
- /**
31
- * 获取 Workflow 定义
32
- */
33
- getDefinition(id: string): WorkflowDefinition | undefined;
34
- /**
35
- * 列出所有已注册的 Workflow
36
- */
37
- listDefinitions(): WorkflowDefinition[];
38
- /**
39
- * 创建执行实例
40
- */
41
- createInstance(workflowId: string, variables?: Record<string, unknown>): WorkflowInstance;
42
- /**
43
- * 获取实例
44
- */
45
- getInstance(id: string): WorkflowInstance | undefined;
46
- /**
47
- * 列出所有实例
48
- */
49
- listInstances(): WorkflowInstance[];
50
- /**
51
- * 执行 Workflow
52
- *
53
- * @param instanceId - 实例 ID
54
- * @yields WorkflowEvent 事件流
55
- */
56
- execute(instanceId: string): AsyncGenerator<WorkflowEvent>;
57
- /**
58
- * 暂停实例
59
- */
60
- pause(instanceId: string): void;
61
- /**
62
- * 恢复实例
63
- */
64
- resume(instanceId: string): void;
65
- /**
66
- * 取消实例
67
- */
68
- cancel(instanceId: string): void;
69
- /**
70
- * 执行步骤(带重试)
71
- */
72
- private executeWithRetry;
73
- /**
74
- * 解析下一步
75
- */
76
- private resolveNext;
77
- }
78
- /**
79
- * 简单步骤执行器
80
- *
81
- * 用于测试和简单场景。
82
- * 实际使用时应替换为集成 Agent 的执行器。
83
- */
84
- export declare class SimpleStepExecutor implements StepExecutor {
85
- execute(step: WorkflowStep, context: WorkflowContext): Promise<unknown>;
86
- }
@@ -1,298 +0,0 @@
1
- /**
2
- * WorkflowEngine — Workflow 执行引擎
3
- *
4
- * 确定性多步骤编排(experimental)。
5
- * 支持顺序执行、条件分支、循环、并行、错误处理。
6
- * 与 SessionTask 状态机无关;长流水线如需用户可见任务,经 SessionTaskService 单向登记。
7
- */
8
- import { randomUUID } from 'node:crypto';
9
- /**
10
- * WorkflowEngine
11
- *
12
- * 执行 Workflow 定义,管理实例生命周期。
13
- */
14
- export class WorkflowEngine {
15
- config;
16
- definitions = new Map();
17
- instances = new Map();
18
- constructor(config) {
19
- this.config = config;
20
- }
21
- // ================================================================
22
- // 定义管理
23
- // ================================================================
24
- /**
25
- * 注册 Workflow 定义
26
- */
27
- register(definition) {
28
- this.definitions.set(definition.id, definition);
29
- }
30
- /**
31
- * 获取 Workflow 定义
32
- */
33
- getDefinition(id) {
34
- return this.definitions.get(id);
35
- }
36
- /**
37
- * 列出所有已注册的 Workflow
38
- */
39
- listDefinitions() {
40
- return Array.from(this.definitions.values());
41
- }
42
- // ================================================================
43
- // 实例管理
44
- // ================================================================
45
- /**
46
- * 创建执行实例
47
- */
48
- createInstance(workflowId, variables) {
49
- const def = this.definitions.get(workflowId);
50
- if (!def) {
51
- throw new Error(`Workflow "${workflowId}" not found`);
52
- }
53
- const instance = {
54
- id: `wf-${randomUUID().slice(0, 8)}`,
55
- definitionId: workflowId,
56
- status: 'pending',
57
- currentStep: def.startStep,
58
- variables: new Map(Object.entries(def.variables ?? {})),
59
- history: [],
60
- startedAt: Date.now(),
61
- };
62
- // 合并调用方提供的变量
63
- if (variables) {
64
- for (const [key, value] of Object.entries(variables)) {
65
- instance.variables.set(key, value);
66
- }
67
- }
68
- this.instances.set(instance.id, instance);
69
- return instance;
70
- }
71
- /**
72
- * 获取实例
73
- */
74
- getInstance(id) {
75
- return this.instances.get(id);
76
- }
77
- /**
78
- * 列出所有实例
79
- */
80
- listInstances() {
81
- return Array.from(this.instances.values());
82
- }
83
- // ================================================================
84
- // 执行
85
- // ================================================================
86
- /**
87
- * 执行 Workflow
88
- *
89
- * @param instanceId - 实例 ID
90
- * @yields WorkflowEvent 事件流
91
- */
92
- async *execute(instanceId) {
93
- const instance = this.instances.get(instanceId);
94
- if (!instance) {
95
- throw new Error(`Workflow instance "${instanceId}" not found`);
96
- }
97
- const def = this.definitions.get(instance.definitionId);
98
- if (!def) {
99
- throw new Error(`Workflow definition "${instance.definitionId}" not found`);
100
- }
101
- instance.status = 'running';
102
- while (instance.currentStep) {
103
- const step = def.steps.find(s => s.id === instance.currentStep);
104
- if (!step) {
105
- yield { type: 'workflow.fail', instanceId, data: { error: `Step "${instance.currentStep}" not found` } };
106
- instance.status = 'failed';
107
- return;
108
- }
109
- yield { type: 'step.start', instanceId, stepId: step.id };
110
- const startTime = Date.now();
111
- step.status = 'running';
112
- try {
113
- // 创建执行上下文
114
- const context = {
115
- variables: instance.variables,
116
- history: instance.history,
117
- };
118
- // 执行步骤(支持重试)
119
- const result = await this.executeWithRetry(step, context);
120
- // 记录执行历史
121
- const execution = {
122
- stepId: step.id,
123
- taskId: step.taskId,
124
- status: 'completed',
125
- output: result,
126
- duration: Date.now() - startTime,
127
- };
128
- instance.history.push(execution);
129
- step.status = 'completed';
130
- yield { type: 'step.complete', instanceId, stepId: step.id, data: result };
131
- // 确定下一步
132
- const nextStep = this.resolveNext(step, result, { variables: instance.variables, history: instance.history });
133
- instance.currentStep = nextStep ?? '';
134
- }
135
- catch (error) {
136
- const errorMsg = error instanceof Error ? error.message : String(error);
137
- // 记录失败
138
- const execution = {
139
- stepId: step.id,
140
- taskId: step.taskId,
141
- status: 'failed',
142
- error: errorMsg,
143
- duration: Date.now() - startTime,
144
- };
145
- instance.history.push(execution);
146
- step.status = 'failed';
147
- yield { type: 'step.fail', instanceId, stepId: step.id, data: { error: errorMsg } };
148
- // 错误处理
149
- if (step.onError === 'skip') {
150
- // 跳过当前步骤,继续下一步
151
- const nextStep = this.resolveNext(step, undefined, { variables: instance.variables, history: instance.history });
152
- instance.currentStep = nextStep ?? '';
153
- continue;
154
- }
155
- else if (step.onError === 'abort' || !step.onError) {
156
- // 中止 Workflow
157
- instance.status = 'failed';
158
- instance.completedAt = Date.now();
159
- yield { type: 'workflow.fail', instanceId, data: { error: errorMsg } };
160
- return;
161
- }
162
- else {
163
- // 跳转到指定步骤
164
- instance.currentStep = step.onError;
165
- continue;
166
- }
167
- }
168
- }
169
- // 所有步骤完成
170
- instance.status = 'completed';
171
- instance.completedAt = Date.now();
172
- yield { type: 'workflow.complete', instanceId };
173
- }
174
- /**
175
- * 暂停实例
176
- */
177
- pause(instanceId) {
178
- const instance = this.instances.get(instanceId);
179
- if (!instance)
180
- throw new Error(`Instance "${instanceId}" not found`);
181
- if (instance.status !== 'running') {
182
- throw new Error(`Instance "${instanceId}" is not running`);
183
- }
184
- instance.status = 'paused';
185
- }
186
- /**
187
- * 恢复实例
188
- */
189
- resume(instanceId) {
190
- const instance = this.instances.get(instanceId);
191
- if (!instance)
192
- throw new Error(`Instance "${instanceId}" not found`);
193
- if (instance.status !== 'paused') {
194
- throw new Error(`Instance "${instanceId}" is not paused`);
195
- }
196
- instance.status = 'running';
197
- }
198
- /**
199
- * 取消实例
200
- */
201
- cancel(instanceId) {
202
- const instance = this.instances.get(instanceId);
203
- if (!instance)
204
- throw new Error(`Instance "${instanceId}" not found`);
205
- instance.status = 'cancelled';
206
- instance.completedAt = Date.now();
207
- }
208
- // ================================================================
209
- // 内部方法
210
- // ================================================================
211
- /**
212
- * 执行步骤(带重试)
213
- */
214
- async executeWithRetry(step, context) {
215
- const maxRetries = step.retryPolicy?.maxRetries ?? 0;
216
- const delayMs = step.retryPolicy?.delayMs ?? 0;
217
- let lastError;
218
- for (let attempt = 0; attempt <= maxRetries; attempt++) {
219
- try {
220
- return await this.config.stepExecutor.execute(step, context);
221
- }
222
- catch (error) {
223
- lastError = error instanceof Error ? error : new Error(String(error));
224
- if (attempt < maxRetries && delayMs > 0) {
225
- await new Promise(r => setTimeout(r, delayMs));
226
- }
227
- }
228
- }
229
- throw lastError;
230
- }
231
- /**
232
- * 解析下一步
233
- */
234
- resolveNext(step, result, context) {
235
- if (!step.next)
236
- return undefined;
237
- // 顺序执行
238
- if (typeof step.next === 'string')
239
- return step.next;
240
- // 条件分支
241
- for (const branch of step.next) {
242
- let conditionResult = false;
243
- if (typeof branch.condition === 'function') {
244
- conditionResult = branch.condition({ ...context, currentResult: result });
245
- }
246
- else if (typeof branch.condition === 'string') {
247
- // 简单表达式求值(安全限制)
248
- try {
249
- const fn = new Function('context', `return ${branch.condition}`);
250
- conditionResult = fn({ ...context, currentResult: result });
251
- }
252
- catch {
253
- conditionResult = false;
254
- }
255
- }
256
- if (conditionResult) {
257
- return branch.target;
258
- }
259
- }
260
- return undefined;
261
- }
262
- }
263
- // ================================================================
264
- // 内置步骤执行器
265
- // ================================================================
266
- /**
267
- * 简单步骤执行器
268
- *
269
- * 用于测试和简单场景。
270
- * 实际使用时应替换为集成 Agent 的执行器。
271
- */
272
- export class SimpleStepExecutor {
273
- async execute(step, context) {
274
- switch (step.type) {
275
- case 'agent':
276
- return { type: 'agent', result: `Agent executed: ${step.config.prompt ?? step.name}` };
277
- case 'tool':
278
- return { type: 'tool', result: `Tool executed: ${step.config.toolName}` };
279
- case 'condition':
280
- if (typeof step.config.expression === 'string') {
281
- try {
282
- const fn = new Function('context', `return ${step.config.expression}`);
283
- return { type: 'condition', result: fn(context) };
284
- }
285
- catch {
286
- return { type: 'condition', result: false };
287
- }
288
- }
289
- return { type: 'condition', result: false };
290
- case 'loop':
291
- return { type: 'loop', result: 'Loop completed' };
292
- case 'human':
293
- return { type: 'human', result: 'Human approval required' };
294
- default:
295
- return { type: step.type, result: 'Executed' };
296
- }
297
- }
298
- }
@@ -1,9 +0,0 @@
1
- /**
2
- * Workflow 引擎
3
- *
4
- * 确定性多步骤编排(experimental)。
5
- * 支持顺序执行、条件分支、循环、并行、错误处理。
6
- */
7
- export { WorkflowEngine, SimpleStepExecutor } from './engine.js';
8
- export type { WorkflowEngineConfig } from './engine.js';
9
- export type { WorkflowDefinition, WorkflowStep, WorkflowInstance, WorkflowContext, WorkflowEvent, WorkflowStatus, StepType, StepStatus, StepExecution, StepExecutor, StepConfig, ConditionalNext, RetryPolicy, } from './types.js';
@@ -1,7 +0,0 @@
1
- /**
2
- * Workflow 引擎
3
- *
4
- * 确定性多步骤编排(experimental)。
5
- * 支持顺序执行、条件分支、循环、并行、错误处理。
6
- */
7
- export { WorkflowEngine, SimpleStepExecutor } from './engine.js';
@@ -1,143 +0,0 @@
1
- /**
2
- * Workflow 引擎 — 类型定义
3
- *
4
- * 确定性多步骤编排(experimental)。
5
- * Workflow 定义执行顺序和条件分支;与 SessionTask 状态机无关。
6
- */
7
- /** Workflow 步骤类型 */
8
- export type StepType = 'agent' | 'tool' | 'condition' | 'loop' | 'parallel' | 'human' | 'subworkflow';
9
- /** 步骤状态 */
10
- export type StepStatus = 'pending' | 'running' | 'completed' | 'failed' | 'skipped' | 'cancelled';
11
- /** Workflow 状态 */
12
- export type WorkflowStatus = 'pending' | 'running' | 'paused' | 'completed' | 'failed' | 'cancelled';
13
- /** 条件分支 */
14
- export interface ConditionalNext {
15
- /** 条件表达式(返回 boolean) */
16
- condition: string | ((context: WorkflowContext) => boolean);
17
- /** 目标步骤 ID */
18
- target: string;
19
- }
20
- /** Workflow 步骤 */
21
- export interface WorkflowStep {
22
- /** 步骤 ID */
23
- id: string;
24
- /** 步骤类型 */
25
- type: StepType;
26
- /** 步骤名称 */
27
- name: string;
28
- /** 步骤配置 */
29
- config: StepConfig;
30
- /** 下一步(字符串表示顺序执行,数组表示条件分支) */
31
- next?: string | ConditionalNext[];
32
- /** 错误处理策略 */
33
- onError?: 'retry' | 'skip' | 'abort' | string;
34
- /** 重试策略 */
35
- retryPolicy?: RetryPolicy;
36
- /** 步骤状态(运行时) */
37
- status?: StepStatus;
38
- /** 关联的 Task ID(运行时) */
39
- taskId?: string;
40
- }
41
- /** 重试策略 */
42
- export interface RetryPolicy {
43
- /** 最大重试次数 */
44
- maxRetries: number;
45
- /** 重试间隔(毫秒) */
46
- delayMs: number;
47
- }
48
- /** 步骤配置 */
49
- export interface StepConfig {
50
- agentId?: string;
51
- prompt?: string;
52
- systemPrompt?: string;
53
- toolName?: string;
54
- toolArgs?: Record<string, unknown>;
55
- expression?: string;
56
- llmJudge?: boolean;
57
- maxIterations?: number;
58
- until?: string | ((context: WorkflowContext) => boolean);
59
- approvalRequired?: boolean;
60
- approver?: string;
61
- timeout?: number;
62
- metadata?: Record<string, unknown>;
63
- }
64
- /** Workflow 定义 */
65
- export interface WorkflowDefinition {
66
- /** Workflow ID */
67
- id: string;
68
- /** Workflow 名称 */
69
- name: string;
70
- /** 描述 */
71
- description: string;
72
- /** 版本 */
73
- version: string;
74
- /** 步骤列表 */
75
- steps: WorkflowStep[];
76
- /** 起始步骤 ID */
77
- startStep: string;
78
- /** 初始变量 */
79
- variables?: Record<string, unknown>;
80
- }
81
- /** Workflow 执行上下文 */
82
- export interface WorkflowContext {
83
- /** 变量 */
84
- variables: Map<string, unknown>;
85
- /** 当前步骤结果 */
86
- currentResult?: unknown;
87
- /** 步骤历史 */
88
- history: StepExecution[];
89
- }
90
- /** Workflow 执行实例 */
91
- export interface WorkflowInstance {
92
- /** 实例 ID */
93
- id: string;
94
- /** Workflow 定义 ID */
95
- definitionId: string;
96
- /** 状态 */
97
- status: WorkflowStatus;
98
- /** 当前步骤 ID */
99
- currentStep: string;
100
- /** 变量 */
101
- variables: Map<string, unknown>;
102
- /** 步骤执行历史 */
103
- history: StepExecution[];
104
- /** 开始时间 */
105
- startedAt: number;
106
- /** 完成时间 */
107
- completedAt?: number;
108
- }
109
- /** 步骤执行记录 */
110
- export interface StepExecution {
111
- /** 步骤 ID */
112
- stepId: string;
113
- /** 关联的任务 ID */
114
- taskId?: string;
115
- /** 执行状态 */
116
- status: StepStatus;
117
- /** 输入 */
118
- input?: unknown;
119
- /** 输出 */
120
- output?: unknown;
121
- /** 耗时(毫秒) */
122
- duration: number;
123
- /** 错误信息 */
124
- error?: string;
125
- }
126
- /** Workflow 事件 */
127
- export interface WorkflowEvent {
128
- type: 'step.start' | 'step.complete' | 'step.fail' | 'workflow.complete' | 'workflow.fail' | 'human.required';
129
- instanceId: string;
130
- stepId?: string;
131
- data?: unknown;
132
- }
133
- /** 步骤执行器接口 */
134
- export interface StepExecutor {
135
- /**
136
- * 执行步骤
137
- *
138
- * @param step - 步骤定义
139
- * @param context - 执行上下文
140
- * @returns 执行结果
141
- */
142
- execute(step: WorkflowStep, context: WorkflowContext): Promise<unknown>;
143
- }
@@ -1,7 +0,0 @@
1
- /**
2
- * Workflow 引擎 — 类型定义
3
- *
4
- * 确定性多步骤编排(experimental)。
5
- * Workflow 定义执行顺序和条件分支;与 SessionTask 状态机无关。
6
- */
7
- export {};
@@ -1,32 +0,0 @@
1
- /**
2
- * ApprovalManager — 审批管理器
3
- *
4
- * 管理审批请求的生命周期:创建 → 等待决策 → 应用结果。
5
- * 支持决策缓存(session 级 / 永久)。
6
- */
7
- import type { ToolCall } from '@octopi-agent/core/types/messages.js';
8
- import type { ApprovalProvider, ApprovalPolicy, ApprovalLevel } from './types.js';
9
- /** ApprovalManager 配置 */
10
- export interface ApprovalManagerConfig {
11
- /** 全局审批级别 */
12
- level: ApprovalLevel;
13
- /** 请求超时(毫秒,默认 60s) */
14
- timeoutMs?: number;
15
- /** 审批提供者(TUI/Gateway 实现) */
16
- provider?: ApprovalProvider;
17
- }
18
- export declare class ApprovalManager {
19
- private config;
20
- private decisionCache;
21
- constructor(config: ApprovalManagerConfig);
22
- /**
23
- * 判断是否需要审批,需要时请求审批
24
- *
25
- * @returns true 表示放行,false 表示拒绝
26
- */
27
- check(toolCall: ToolCall, riskLevel: string, riskDescription: string): Promise<boolean>;
28
- private needsApproval;
29
- private getCachedDecision;
30
- }
31
- /** 创建默认审批策略 */
32
- export declare function createApprovalPolicy(level: ApprovalLevel): ApprovalPolicy;