@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.
- package/LICENSE +201 -201
- package/NOTICE +7 -7
- package/README.md +64 -26
- package/dist/config-schema/agent.d.ts +89 -1
- package/dist/config-schema/agent.js +81 -5
- package/dist/config-schema/context.d.ts +24 -5
- package/dist/config-schema/context.js +28 -1
- package/dist/config-schema/engine.d.ts +205 -13
- package/dist/config-schema/engine.js +31 -2
- package/dist/config-schema/governance.d.ts +95 -0
- package/dist/config-schema/governance.js +93 -1
- package/dist/config-schema/models.d.ts +3 -3
- package/dist/config-schema/observability.d.ts +6 -0
- package/dist/config-schema/observability.js +16 -0
- package/dist/config-schema/run.d.ts +10 -0
- package/dist/config-schema/run.js +18 -0
- package/dist/config-schema/shared.d.ts +13 -0
- package/dist/config-schema/shared.js +22 -0
- package/dist/config-schema/substrate.d.ts +2 -2
- package/dist/config-schema/subsystems.d.ts +1 -1
- package/dist/config-schema/subsystems.js +2 -1
- package/dist/config.d.ts +201 -8
- package/dist/config.js +105 -3
- package/dist/harness/activation/compiler.js +3 -0
- package/dist/harness/activation/runtime.d.ts +7 -0
- package/dist/harness/activation/runtime.js +60 -2
- package/dist/harness/activation/sources/agent-signal.d.ts +11 -0
- package/dist/harness/activation/sources/agent-signal.js +33 -0
- package/dist/harness/activation/types.d.ts +6 -1
- package/dist/harness/agent/builder.d.ts +50 -5
- package/dist/harness/agent/builder.js +189 -59
- package/dist/harness/agent/config-bridge.d.ts +33 -25
- package/dist/harness/agent/config-bridge.js +84 -291
- package/dist/harness/agent/index.d.ts +3 -1
- package/dist/harness/agent/index.js +2 -1
- package/dist/harness/agent/tool-purpose.d.ts +46 -0
- package/dist/harness/agent/tool-purpose.js +127 -0
- package/dist/harness/agent/wire-agent-builder.d.ts +133 -0
- package/dist/harness/agent/wire-agent-builder.js +370 -0
- package/dist/harness/collaboration/autonomous-subsystem/boundary/validator.d.ts +11 -1
- package/dist/harness/collaboration/autonomous-subsystem/boundary/validator.js +11 -1
- package/dist/harness/collaboration/autonomous-subsystem/loader.d.ts +13 -0
- package/dist/harness/collaboration/autonomous-subsystem/loader.js +16 -1
- package/dist/harness/collaboration/autonomous-subsystem/runtime.d.ts +8 -1
- package/dist/harness/collaboration/autonomous-subsystem/runtime.js +17 -9
- package/dist/harness/collaboration/autonomous-subsystem/sense/metrics.d.ts +12 -0
- package/dist/harness/collaboration/autonomous-subsystem/sense/metrics.js +19 -0
- package/dist/harness/collaboration/autonomous-subsystem/sense/session-lifecycle-bridge.d.ts +6 -0
- package/dist/harness/collaboration/autonomous-subsystem/sense/session-lifecycle-bridge.js +24 -7
- package/dist/harness/collaboration/autonomous-subsystem/think/executor.d.ts +5 -2
- package/dist/harness/collaboration/autonomous-subsystem/think/executor.js +11 -3
- package/dist/harness/collaboration/autonomous-subsystem/think/index.d.ts +1 -1
- package/dist/harness/collaboration/autonomous-subsystem/think/index.js +1 -1
- package/dist/harness/collaboration/autonomous-subsystem/think/llm-port.d.ts +7 -4
- package/dist/harness/collaboration/autonomous-subsystem/think/llm-port.js +8 -9
- package/dist/harness/collaboration/autonomous-subsystem/think/model-resolver.d.ts +36 -10
- package/dist/harness/collaboration/autonomous-subsystem/think/model-resolver.js +60 -7
- package/dist/harness/collaboration/delegation/child-run.d.ts +144 -0
- package/dist/harness/collaboration/delegation/child-run.js +241 -0
- package/dist/harness/collaboration/delegation/index.d.ts +26 -0
- package/dist/harness/collaboration/delegation/index.js +25 -0
- package/dist/harness/collaboration/delegation/notifier.d.ts +46 -0
- package/dist/harness/collaboration/delegation/notifier.js +84 -0
- package/dist/harness/collaboration/delegation/registry-types.d.ts +200 -0
- package/dist/harness/collaboration/delegation/registry-types.js +61 -0
- package/dist/harness/collaboration/delegation/registry.d.ts +110 -0
- package/dist/harness/collaboration/delegation/registry.js +220 -0
- package/dist/harness/collaboration/delegation/service.d.ts +249 -0
- package/dist/harness/collaboration/delegation/service.js +499 -0
- package/dist/harness/collaboration/delegation/store.d.ts +155 -0
- package/dist/harness/collaboration/delegation/store.js +271 -0
- package/dist/harness/collaboration/delegation/transport.d.ts +73 -0
- package/dist/harness/collaboration/delegation/transport.js +61 -0
- package/dist/harness/collaboration/delegation/types.d.ts +231 -0
- package/dist/harness/collaboration/delegation/types.js +70 -0
- package/dist/harness/collaboration/delegation/wiring.d.ts +111 -0
- package/dist/harness/collaboration/delegation/wiring.js +145 -0
- package/dist/harness/collaboration/orchestration/index.d.ts +11 -13
- package/dist/harness/collaboration/orchestration/index.js +11 -11
- package/dist/harness/context/assembler.d.ts +2 -2
- package/dist/harness/context/assembler.js +12 -7
- package/dist/harness/context/capabilities/compact/engine.js +80 -38
- package/dist/harness/context/capabilities/compact/types.d.ts +12 -1
- package/dist/harness/context/capabilities/summary/registry.js +10 -0
- package/dist/harness/context/constitution/default-agents.md +230 -228
- package/dist/harness/context/default-context-engine.d.ts +101 -23
- package/dist/harness/context/default-context-engine.js +483 -172
- package/dist/harness/context/hybrid-compressor.d.ts +3 -3
- package/dist/harness/context/hybrid-compressor.js +18 -23
- package/dist/harness/context/index.d.ts +5 -1
- package/dist/harness/context/index.js +2 -0
- package/dist/harness/context/layer-snapshot.d.ts +4 -0
- package/dist/harness/context/layer-snapshot.js +30 -18
- package/dist/harness/context/layer-types.d.ts +85 -1
- package/dist/harness/context/layer-types.js +110 -4
- package/dist/harness/context/layers.d.ts +5 -2
- package/dist/harness/context/layers.js +11 -5
- package/dist/harness/context/llm-summarizer.d.ts +15 -1
- package/dist/harness/context/llm-summarizer.js +107 -56
- package/dist/harness/context/message-selector.js +6 -2
- package/dist/harness/context/root-instructions.d.ts +72 -0
- package/dist/harness/context/root-instructions.js +227 -0
- package/dist/harness/context/runtime-datetime.d.ts +34 -7
- package/dist/harness/context/runtime-datetime.js +66 -10
- package/dist/harness/context/smart-router.d.ts +1 -1
- package/dist/harness/context/smart-router.js +1 -1
- package/dist/harness/context/system-prompt-assembler.d.ts +30 -0
- package/dist/harness/context/system-prompt-assembler.js +73 -6
- package/dist/harness/context/token-constants.d.ts +2 -2
- package/dist/harness/context/token-constants.js +2 -2
- package/dist/harness/context/token-estimate-fns.d.ts +1 -3
- package/dist/harness/context/token-estimate-fns.js +2 -4
- package/dist/harness/context/token-estimator.d.ts +1 -1
- package/dist/harness/context/token-estimator.js +14 -6
- package/dist/harness/context/tool-result-aging.d.ts +140 -0
- package/dist/harness/context/tool-result-aging.js +331 -0
- package/dist/harness/context/tool-result-body.d.ts +10 -0
- package/dist/harness/context/tool-result-body.js +27 -0
- package/dist/harness/context/turn-envelope.d.ts +123 -0
- package/dist/harness/context/turn-envelope.js +188 -0
- package/dist/harness/context/types.d.ts +35 -47
- package/dist/harness/extension/execution-environment/effect-policy.d.ts +258 -0
- package/dist/harness/extension/execution-environment/effect-policy.js +358 -0
- package/dist/harness/extension/execution-environment/index.d.ts +18 -2
- package/dist/harness/extension/execution-environment/index.js +11 -2
- package/dist/harness/extension/execution-environment/isolation.js +5 -1
- package/dist/harness/extension/execution-environment/memory-undo.d.ts +101 -0
- package/dist/harness/extension/execution-environment/memory-undo.js +192 -0
- package/dist/harness/extension/execution-environment/process-isolation.d.ts +84 -0
- package/dist/harness/extension/execution-environment/process-isolation.js +315 -0
- package/dist/harness/extension/execution-environment/resource-limits.d.ts +36 -0
- package/dist/harness/extension/execution-environment/resource-limits.js +84 -0
- package/dist/harness/extension/execution-environment/sandbox.d.ts +125 -4
- package/dist/harness/extension/execution-environment/sandbox.js +521 -51
- package/dist/harness/extension/execution-environment/shell-journal.d.ts +100 -0
- package/dist/harness/extension/execution-environment/shell-journal.js +299 -0
- package/dist/harness/extension/execution-environment/tool-capabilities.d.ts +45 -0
- package/dist/harness/extension/execution-environment/tool-capabilities.js +126 -0
- package/dist/harness/extension/execution-environment/types.d.ts +67 -39
- package/dist/harness/extension/execution-environment/types.js +2 -2
- package/dist/harness/extension/execution-environment/undo-log.d.ts +203 -0
- package/dist/harness/extension/execution-environment/undo-log.js +627 -0
- package/dist/harness/extension/execution-environment/undo-merge.d.ts +40 -0
- package/dist/harness/extension/execution-environment/undo-merge.js +167 -0
- package/dist/harness/extension/plugin-ecosystem/client-tools/index.d.ts +1 -1
- package/dist/harness/extension/plugin-ecosystem/client-tools/types.d.ts +9 -0
- package/dist/harness/extension/plugin-ecosystem/mcp/bridge.js +2 -0
- package/dist/harness/extension/plugin-ecosystem/plugins/api.d.ts +1 -6
- package/dist/harness/extension/plugin-ecosystem/plugins/api.js +3 -8
- package/dist/harness/extension/plugin-ecosystem/plugins/capability.d.ts +0 -3
- package/dist/harness/extension/plugin-ecosystem/plugins/capability.js +0 -3
- package/dist/harness/extension/plugin-ecosystem/plugins/entry.d.ts +2 -10
- package/dist/harness/extension/plugin-ecosystem/plugins/entry.js +2 -9
- package/dist/harness/extension/plugin-ecosystem/plugins/index.d.ts +1 -3
- package/dist/harness/extension/plugin-ecosystem/plugins/index.js +1 -3
- package/dist/harness/extension/plugin-ecosystem/plugins/loader.d.ts +2 -4
- package/dist/harness/extension/plugin-ecosystem/plugins/loader.js +4 -21
- package/dist/harness/extension/plugin-ecosystem/plugins/manager.d.ts +3 -9
- package/dist/harness/extension/plugin-ecosystem/plugins/manager.js +4 -8
- package/dist/harness/extension/plugin-ecosystem/plugins/manifest.d.ts +1 -4
- package/dist/harness/extension/plugin-ecosystem/plugins/manifest.js +1 -3
- package/dist/harness/extension/plugin-ecosystem/skills/manager.d.ts +1 -1
- package/dist/harness/extension/plugin-ecosystem/skills/manager.js +1 -1
- package/dist/harness/extension/plugin-ecosystem/tools/allowlisted-run.d.ts +51 -0
- package/dist/harness/extension/plugin-ecosystem/tools/allowlisted-run.js +153 -0
- package/dist/harness/extension/plugin-ecosystem/tools/ask-user.js +1 -0
- package/dist/harness/extension/plugin-ecosystem/tools/builtin.d.ts +18 -3
- package/dist/harness/extension/plugin-ecosystem/tools/builtin.js +277 -81
- package/dist/harness/extension/plugin-ecosystem/tools/delegation.d.ts +31 -0
- package/dist/harness/extension/plugin-ecosystem/tools/delegation.js +291 -0
- package/dist/harness/extension/plugin-ecosystem/tools/document-tools.js +10 -2
- package/dist/harness/extension/plugin-ecosystem/tools/env-info.js +1 -0
- package/dist/harness/extension/plugin-ecosystem/tools/eol.d.ts +35 -0
- package/dist/harness/extension/plugin-ecosystem/tools/eol.js +43 -0
- package/dist/harness/extension/plugin-ecosystem/tools/file-edit.js +40 -9
- package/dist/harness/extension/plugin-ecosystem/tools/file-ops.d.ts +33 -0
- package/dist/harness/extension/plugin-ecosystem/tools/file-ops.js +376 -0
- package/dist/harness/extension/plugin-ecosystem/tools/file-search.d.ts +12 -2
- package/dist/harness/extension/plugin-ecosystem/tools/file-search.js +241 -70
- package/dist/harness/extension/plugin-ecosystem/tools/git-runner.d.ts +31 -0
- package/dist/harness/extension/plugin-ecosystem/tools/git-runner.js +104 -0
- package/dist/harness/extension/plugin-ecosystem/tools/git-status-snapshot.d.ts +111 -0
- package/dist/harness/extension/plugin-ecosystem/tools/git-status-snapshot.js +197 -0
- package/dist/harness/extension/plugin-ecosystem/tools/git-tools.d.ts +27 -0
- package/dist/harness/extension/plugin-ecosystem/tools/git-tools.js +463 -0
- package/dist/harness/extension/plugin-ecosystem/tools/http.d.ts +10 -6
- package/dist/harness/extension/plugin-ecosystem/tools/http.js +41 -47
- package/dist/harness/extension/plugin-ecosystem/tools/index.d.ts +6 -0
- package/dist/harness/extension/plugin-ecosystem/tools/index.js +4 -0
- package/dist/harness/extension/plugin-ecosystem/tools/knowledge.js +4 -0
- package/dist/harness/extension/plugin-ecosystem/tools/memory.js +25 -1
- package/dist/harness/extension/plugin-ecosystem/tools/package-tools.d.ts +13 -0
- package/dist/harness/extension/plugin-ecosystem/tools/package-tools.js +391 -0
- package/dist/harness/extension/plugin-ecosystem/tools/platform.d.ts +51 -2
- package/dist/harness/extension/plugin-ecosystem/tools/platform.js +151 -12
- package/dist/harness/extension/plugin-ecosystem/tools/session-history.js +2 -0
- package/dist/harness/extension/plugin-ecosystem/tools/tool-bus.d.ts +10 -1
- package/dist/harness/extension/plugin-ecosystem/tools/tool-bus.js +35 -19
- package/dist/harness/extension/plugin-ecosystem/tools/tool-set.d.ts +8 -0
- package/dist/harness/extension/plugin-ecosystem/tools/tool-set.js +5 -0
- package/dist/harness/extension/plugin-ecosystem/tools/web-search.js +1 -0
- package/dist/harness/governance/credentials/index.d.ts +1 -1
- package/dist/harness/governance/credentials/store.d.ts +16 -4
- package/dist/harness/governance/credentials/store.js +33 -6
- package/dist/harness/governance/credentials/types.d.ts +11 -0
- package/dist/harness/governance/human-in-the-loop/decision-cache.d.ts +105 -0
- package/dist/harness/governance/human-in-the-loop/decision-cache.js +184 -0
- package/dist/harness/governance/human-in-the-loop/index.d.ts +5 -5
- package/dist/harness/governance/human-in-the-loop/index.js +3 -3
- package/dist/harness/governance/human-in-the-loop/types.d.ts +7 -62
- package/dist/harness/governance/human-in-the-loop/types.js +6 -2
- package/dist/harness/governance/security/capability-enforcer.d.ts +9 -1
- package/dist/harness/governance/security/capability-enforcer.js +31 -8
- package/dist/harness/governance/security/degradation.js +5 -7
- package/dist/harness/governance/security/risk-evaluator.d.ts +1 -1
- package/dist/harness/governance/security/risk-evaluator.js +4 -82
- package/dist/harness/governance/security/temp-path.d.ts +41 -0
- package/dist/harness/governance/security/temp-path.js +117 -0
- package/dist/harness/governance/session-acl/index.d.ts +1 -0
- package/dist/harness/governance/session-acl/index.js +1 -0
- package/dist/harness/governance/session-acl/rights.d.ts +12 -0
- package/dist/harness/governance/session-acl/rights.js +89 -7
- package/dist/harness/governance/session-acl/seed-roles.js +9 -1
- package/dist/harness/governance/session-acl/service.js +21 -29
- package/dist/harness/governance/session-acl/tool-rights.d.ts +81 -0
- package/dist/harness/governance/session-acl/tool-rights.js +238 -0
- package/dist/harness/governance/session-acl/types.d.ts +22 -0
- package/dist/harness/index.d.ts +16 -12
- package/dist/harness/index.js +10 -6
- package/dist/harness/knowledge/file-identity.d.ts +8 -0
- package/dist/harness/knowledge/file-identity.js +26 -1
- package/dist/harness/knowledge/file-index-store.js +11 -11
- package/dist/harness/knowledge/grounding.d.ts +2 -1
- package/dist/harness/knowledge/grounding.js +8 -5
- package/dist/harness/knowledge/index-store.d.ts +31 -4
- package/dist/harness/knowledge/index-store.js +121 -39
- package/dist/harness/knowledge/index.d.ts +2 -2
- package/dist/harness/knowledge/index.js +1 -1
- package/dist/harness/knowledge/ingest.d.ts +115 -115
- package/dist/harness/knowledge/ingest.js +154 -151
- package/dist/harness/knowledge/job-control-state.js +4 -4
- package/dist/harness/knowledge/job-control.js +11 -11
- package/dist/harness/knowledge/knowledge-serve-child.js +1 -1
- package/dist/harness/knowledge/membership-store.js +11 -11
- package/dist/harness/knowledge/network-guard.d.ts +61 -4
- package/dist/harness/knowledge/network-guard.js +390 -113
- package/dist/harness/knowledge/purge.js +4 -1
- package/dist/harness/knowledge/query-service.js +3 -3
- package/dist/harness/knowledge/writer-service.d.ts +2 -0
- package/dist/harness/knowledge/writer-service.js +14 -13
- package/dist/harness/memory/backfill-coverage.js +3 -1
- package/dist/harness/memory/backfill-trigger.d.ts +2 -2
- package/dist/harness/memory/backfill-trigger.js +4 -4
- package/dist/harness/memory/index.d.ts +1 -0
- package/dist/harness/memory/index.js +1 -0
- package/dist/harness/memory/sqlite/agent-db.js +2 -0
- package/dist/harness/memory/sqlite/memory-store.d.ts +1 -0
- package/dist/harness/memory/sqlite/memory-store.js +14 -4
- package/dist/harness/memory/sqlite/wisdom-store.js +9 -9
- package/dist/harness/memory/store.d.ts +1 -0
- package/dist/harness/memory/store.js +3 -0
- package/dist/harness/memory/time-format.d.ts +28 -0
- package/dist/harness/memory/time-format.js +52 -0
- package/dist/harness/memory/types.d.ts +12 -0
- package/dist/harness/observability/observer/hub.js +53 -2
- package/dist/harness/observability/observer/index.d.ts +2 -2
- package/dist/harness/observability/observer/index.js +1 -1
- package/dist/harness/observability/observer/types.d.ts +80 -0
- package/dist/harness/observability/observer/types.js +118 -9
- package/dist/harness/run/agent/agent.d.ts +18 -0
- package/dist/harness/run/agent/agent.js +26 -0
- package/dist/harness/run/concurrency/tool-loop-detection-core.d.ts +1 -1
- package/dist/harness/run/concurrency/tool-loop-detection-core.js +1 -1
- package/dist/harness/run/reliability/harness-events.d.ts +4 -0
- package/dist/harness/run/reliability/run-agent.js +110 -18
- package/dist/harness/run/reliability/run-metrics-collector.d.ts +28 -2
- package/dist/harness/run/reliability/run-metrics-collector.js +92 -2
- package/dist/harness/run/run-guard/default-run-guard.d.ts +0 -5
- package/dist/harness/run/run-guard/default-run-guard.js +104 -44
- package/dist/harness/run/run-scope.d.ts +52 -0
- package/dist/harness/run/runner.d.ts +117 -16
- package/dist/harness/run/runner.js +668 -157
- package/dist/harness/session/attachments/llm-intent.js +17 -17
- package/dist/harness/session/history/port.js +16 -5
- package/dist/harness/session/in-memory-store.d.ts +6 -0
- package/dist/harness/session/in-memory-store.js +55 -3
- package/dist/harness/session/schedules/index.d.ts +10 -0
- package/dist/harness/session/schedules/index.js +10 -0
- package/dist/harness/session/schedules/render.d.ts +13 -0
- package/dist/harness/session/schedules/render.js +63 -0
- package/dist/harness/session/schedules/service.d.ts +179 -0
- package/dist/harness/session/schedules/service.js +695 -0
- package/dist/harness/session/schedules/store.d.ts +119 -0
- package/dist/harness/session/schedules/store.js +323 -0
- package/dist/harness/session/schedules/tools.d.ts +39 -0
- package/dist/harness/session/schedules/tools.js +442 -0
- package/dist/harness/session/schedules/types.d.ts +104 -0
- package/dist/harness/session/schedules/types.js +97 -0
- package/dist/harness/session/tasks/tools.js +22 -0
- package/dist/harness/session/title.js +25 -9
- package/dist/harness/session/types.d.ts +35 -0
- package/dist/harness/shared/events/agent-event-map.d.ts +39 -0
- package/dist/harness/shared/events/agent-event-map.js +2 -0
- package/dist/harness/shared/types/agent-definition.d.ts +23 -0
- package/dist/index.d.ts +25 -9
- package/dist/index.js +11 -2
- package/dist/integration/observability/run-telemetry.d.ts +8 -0
- package/dist/integration/observability/run-telemetry.js +31 -8
- package/dist/integration/observability/trace-collector.js +26 -4
- package/dist/integration/observability/trace-events.d.ts +1 -0
- package/dist/integration/observability/trace-events.js +2 -0
- package/dist/integration/observability/trace-logger.js +27 -17
- package/dist/integration/providers/anthropic.d.ts +10 -0
- package/dist/integration/providers/anthropic.js +44 -1
- package/dist/integration/providers/openai.d.ts +10 -0
- package/dist/integration/providers/openai.js +58 -2
- package/dist/integration/providers/wire-dump-diff.d.ts +191 -0
- package/dist/integration/providers/wire-dump-diff.js +351 -0
- package/dist/integration/providers/wire-dump.d.ts +178 -0
- package/dist/integration/providers/wire-dump.js +396 -0
- package/dist/integration/storage/jsonl.d.ts +29 -0
- package/dist/integration/storage/jsonl.js +243 -41
- package/dist/integration/storage/session-index.js +63 -8
- package/dist/paths.d.ts +19 -0
- package/dist/paths.js +38 -1
- package/dist/subsystems/cognition-steward/conceptualize/SUBSYSTEM.md +43 -43
- package/dist/subsystems/cognition-steward/conceptualize/config.yaml +50 -50
- package/dist/subsystems/cognition-steward/consolidate/SUBSYSTEM.md +6 -6
- package/dist/subsystems/cognition-steward/consolidate/config.yaml +54 -54
- package/dist/subsystems/memory-steward/backfill/handler.js +9 -0
- package/dist/subsystems/safety-guard/config.yaml +3 -1
- package/dist/subsystems/wisdom-steward/evaluate/config.yaml +50 -50
- package/dist/subsystems/wisdom-steward/formation/SUBSYSTEM.md +42 -42
- package/dist/subsystems/wisdom-steward/formation/config.yaml +54 -54
- package/dist/subsystems/wisdom-steward/govern/config.yaml +55 -55
- package/package.json +115 -115
- package/dist/harness/collaboration/multi-agent/agent-registry-types.d.ts +0 -144
- package/dist/harness/collaboration/multi-agent/agent-registry-types.js +0 -25
- package/dist/harness/collaboration/multi-agent/index.d.ts +0 -17
- package/dist/harness/collaboration/multi-agent/index.js +0 -15
- package/dist/harness/collaboration/multi-agent/process.d.ts +0 -167
- package/dist/harness/collaboration/multi-agent/process.js +0 -256
- package/dist/harness/collaboration/multi-agent/registry.d.ts +0 -36
- package/dist/harness/collaboration/multi-agent/registry.js +0 -137
- package/dist/harness/collaboration/multi-agent/swarm.d.ts +0 -135
- package/dist/harness/collaboration/multi-agent/swarm.js +0 -317
- package/dist/harness/collaboration/multi-agent/types.d.ts +0 -66
- package/dist/harness/collaboration/multi-agent/types.js +0 -15
- package/dist/harness/collaboration/orchestration/async-task-store.d.ts +0 -107
- package/dist/harness/collaboration/orchestration/async-task-store.js +0 -12
- package/dist/harness/collaboration/orchestration/async-task.d.ts +0 -156
- package/dist/harness/collaboration/orchestration/async-task.js +0 -359
- package/dist/harness/collaboration/orchestration/planner/hybrid-planner.d.ts +0 -47
- package/dist/harness/collaboration/orchestration/planner/hybrid-planner.js +0 -61
- package/dist/harness/collaboration/orchestration/planner/index.d.ts +0 -9
- package/dist/harness/collaboration/orchestration/planner/index.js +0 -6
- package/dist/harness/collaboration/orchestration/planner/llm-planner.d.ts +0 -54
- package/dist/harness/collaboration/orchestration/planner/llm-planner.js +0 -167
- package/dist/harness/collaboration/orchestration/planner/rule-planner.d.ts +0 -85
- package/dist/harness/collaboration/orchestration/planner/rule-planner.js +0 -175
- package/dist/harness/collaboration/orchestration/quality/classifier.d.ts +0 -21
- package/dist/harness/collaboration/orchestration/quality/classifier.js +0 -235
- package/dist/harness/collaboration/orchestration/quality/gate.d.ts +0 -29
- package/dist/harness/collaboration/orchestration/quality/gate.js +0 -409
- package/dist/harness/collaboration/orchestration/quality/index.d.ts +0 -9
- package/dist/harness/collaboration/orchestration/quality/index.js +0 -8
- package/dist/harness/collaboration/orchestration/quality/types.d.ts +0 -159
- package/dist/harness/collaboration/orchestration/quality/types.js +0 -33
- package/dist/harness/collaboration/orchestration/scheduler/index.d.ts +0 -5
- package/dist/harness/collaboration/orchestration/scheduler/index.js +0 -4
- package/dist/harness/collaboration/orchestration/scheduler/task-scheduler.d.ts +0 -143
- package/dist/harness/collaboration/orchestration/scheduler/task-scheduler.js +0 -297
- package/dist/harness/collaboration/orchestration/strategy/classifier.d.ts +0 -12
- package/dist/harness/collaboration/orchestration/strategy/classifier.js +0 -81
- package/dist/harness/collaboration/orchestration/strategy/index.d.ts +0 -3
- package/dist/harness/collaboration/orchestration/strategy/index.js +0 -2
- package/dist/harness/collaboration/orchestration/strategy/router.d.ts +0 -28
- package/dist/harness/collaboration/orchestration/strategy/router.js +0 -105
- package/dist/harness/collaboration/orchestration/strategy/types.d.ts +0 -49
- package/dist/harness/collaboration/orchestration/strategy/types.js +0 -4
- package/dist/harness/collaboration/orchestration/workflow/engine.d.ts +0 -86
- package/dist/harness/collaboration/orchestration/workflow/engine.js +0 -298
- package/dist/harness/collaboration/orchestration/workflow/index.d.ts +0 -9
- package/dist/harness/collaboration/orchestration/workflow/index.js +0 -7
- package/dist/harness/collaboration/orchestration/workflow/types.d.ts +0 -143
- package/dist/harness/collaboration/orchestration/workflow/types.js +0 -7
- package/dist/harness/governance/human-in-the-loop/approval-manager.d.ts +0 -32
- package/dist/harness/governance/human-in-the-loop/approval-manager.js +0 -93
- /package/dist/harness/collaboration/{multi-agent → delegation}/message-channel-types.d.ts +0 -0
- /package/dist/harness/collaboration/{multi-agent → delegation}/message-channel-types.js +0 -0
|
@@ -32,6 +32,7 @@ export function createTaskListTool(service) {
|
|
|
32
32
|
return {
|
|
33
33
|
definition: {
|
|
34
34
|
name: 'task_list',
|
|
35
|
+
capabilities: ['fs-read'],
|
|
35
36
|
description: 'List session tasks (goals and steps). Goals have no parent_id; steps have parent_id of their goal.',
|
|
36
37
|
parameters: {
|
|
37
38
|
status: {
|
|
@@ -71,6 +72,7 @@ export function createTaskCreateTool(service) {
|
|
|
71
72
|
return {
|
|
72
73
|
definition: {
|
|
73
74
|
name: 'task_create',
|
|
75
|
+
capabilities: ['fs-write'],
|
|
74
76
|
description: 'Create a session task. Without parent_id creates a user-level goal. With parent_id creates a step under an existing goal (depth 1 only).',
|
|
75
77
|
parameters: {
|
|
76
78
|
description: {
|
|
@@ -84,6 +86,8 @@ export function createTaskCreateTool(service) {
|
|
|
84
86
|
},
|
|
85
87
|
},
|
|
86
88
|
},
|
|
89
|
+
// 写共享 SessionData(读改写整包存回):所在 tool_call 批次整体串行,防并发丢更新
|
|
90
|
+
executionMode: 'sequential',
|
|
87
91
|
handler: async (args, context) => {
|
|
88
92
|
const description = String(args.description ?? '');
|
|
89
93
|
const parentId = args.parent_id ? String(args.parent_id) : undefined;
|
|
@@ -96,6 +100,7 @@ export function createTaskPlanTool(service) {
|
|
|
96
100
|
return {
|
|
97
101
|
definition: {
|
|
98
102
|
name: 'task_plan',
|
|
103
|
+
capabilities: ['fs-write'],
|
|
99
104
|
description: 'Create ordered steps for an existing goal in one call.',
|
|
100
105
|
parameters: {
|
|
101
106
|
goal_id: { type: 'string', description: 'Goal task id', required: true },
|
|
@@ -108,6 +113,8 @@ export function createTaskPlanTool(service) {
|
|
|
108
113
|
},
|
|
109
114
|
},
|
|
110
115
|
},
|
|
116
|
+
// 写共享 SessionData(读改写整包存回):所在 tool_call 批次整体串行,防并发丢更新
|
|
117
|
+
executionMode: 'sequential',
|
|
111
118
|
handler: async (args, context) => {
|
|
112
119
|
const goalId = String(args.goal_id ?? '');
|
|
113
120
|
const raw = args.steps;
|
|
@@ -124,12 +131,15 @@ export function createTaskCompleteTool(service) {
|
|
|
124
131
|
return {
|
|
125
132
|
definition: {
|
|
126
133
|
name: 'task_complete',
|
|
134
|
+
capabilities: ['fs-write'],
|
|
127
135
|
description: 'Mark a goal or step as done. Explicitly complete the goal when the whole job is finished.',
|
|
128
136
|
parameters: {
|
|
129
137
|
task_id: { type: 'string', description: 'Task id', required: true },
|
|
130
138
|
progress_note: { type: 'string', description: 'Optional short progress note' },
|
|
131
139
|
},
|
|
132
140
|
},
|
|
141
|
+
// 写共享 SessionData(读改写整包存回):所在 tool_call 批次整体串行,防并发丢更新
|
|
142
|
+
executionMode: 'sequential',
|
|
133
143
|
handler: async (args, context) => {
|
|
134
144
|
const taskId = String(args.task_id ?? '');
|
|
135
145
|
const progressNote = args.progress_note ? String(args.progress_note) : undefined;
|
|
@@ -142,12 +152,15 @@ export function createTaskPauseTool(service) {
|
|
|
142
152
|
return {
|
|
143
153
|
definition: {
|
|
144
154
|
name: 'task_pause',
|
|
155
|
+
capabilities: ['fs-write'],
|
|
145
156
|
description: 'Pause an open task (goal or step).',
|
|
146
157
|
parameters: {
|
|
147
158
|
task_id: { type: 'string', description: 'Task id', required: true },
|
|
148
159
|
reason: { type: 'string', description: 'Optional reason' },
|
|
149
160
|
},
|
|
150
161
|
},
|
|
162
|
+
// 写共享 SessionData(读改写整包存回):所在 tool_call 批次整体串行,防并发丢更新
|
|
163
|
+
executionMode: 'sequential',
|
|
151
164
|
handler: async (args, context) => {
|
|
152
165
|
const taskId = String(args.task_id ?? '');
|
|
153
166
|
const reason = args.reason ? String(args.reason) : undefined;
|
|
@@ -160,11 +173,14 @@ export function createTaskResumeTool(service) {
|
|
|
160
173
|
return {
|
|
161
174
|
definition: {
|
|
162
175
|
name: 'task_resume',
|
|
176
|
+
capabilities: ['fs-write'],
|
|
163
177
|
description: 'Resume a paused task.',
|
|
164
178
|
parameters: {
|
|
165
179
|
task_id: { type: 'string', description: 'Task id', required: true },
|
|
166
180
|
},
|
|
167
181
|
},
|
|
182
|
+
// 写共享 SessionData(读改写整包存回):所在 tool_call 批次整体串行,防并发丢更新
|
|
183
|
+
executionMode: 'sequential',
|
|
168
184
|
handler: async (args, context) => {
|
|
169
185
|
const taskId = String(args.task_id ?? '');
|
|
170
186
|
const task = await service.resume(context.agentId, context.sessionId, taskId);
|
|
@@ -176,12 +192,15 @@ export function createTaskDropTool(service) {
|
|
|
176
192
|
return {
|
|
177
193
|
definition: {
|
|
178
194
|
name: 'task_drop',
|
|
195
|
+
capabilities: ['fs-write'],
|
|
179
196
|
description: 'Drop/cancel a task. Dropping a goal also drops its open steps.',
|
|
180
197
|
parameters: {
|
|
181
198
|
task_id: { type: 'string', description: 'Task id', required: true },
|
|
182
199
|
reason: { type: 'string', description: 'Optional reason' },
|
|
183
200
|
},
|
|
184
201
|
},
|
|
202
|
+
// 写共享 SessionData(读改写整包存回):所在 tool_call 批次整体串行,防并发丢更新
|
|
203
|
+
executionMode: 'sequential',
|
|
185
204
|
handler: async (args, context) => {
|
|
186
205
|
const taskId = String(args.task_id ?? '');
|
|
187
206
|
const reason = args.reason ? String(args.reason) : undefined;
|
|
@@ -194,12 +213,15 @@ export function createTaskNoteTool(service) {
|
|
|
194
213
|
return {
|
|
195
214
|
definition: {
|
|
196
215
|
name: 'task_note',
|
|
216
|
+
capabilities: ['fs-write'],
|
|
197
217
|
description: 'Update the progress note on a task without changing status.',
|
|
198
218
|
parameters: {
|
|
199
219
|
task_id: { type: 'string', description: 'Task id', required: true },
|
|
200
220
|
progress_note: { type: 'string', description: 'Short progress note', required: true },
|
|
201
221
|
},
|
|
202
222
|
},
|
|
223
|
+
// 写共享 SessionData(读改写整包存回):所在 tool_call 批次整体串行,防并发丢更新
|
|
224
|
+
executionMode: 'sequential',
|
|
203
225
|
handler: async (args, context) => {
|
|
204
226
|
const taskId = String(args.task_id ?? '');
|
|
205
227
|
const progressNote = String(args.progress_note ?? '');
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
*
|
|
4
4
|
* 目标:历史列表一眼可认;「你好」类碎消息不浪费 LLM 调用。
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
6
|
+
import { extractUserMessageText } from '../context/turn-envelope.js';
|
|
7
|
+
import { isHumanSpeech } from '../context/layer-types.js';
|
|
7
8
|
/** 首条有效用户消息达到该长度才可直接摘要 */
|
|
8
9
|
export const TITLE_MIN_FIRST_USER_CHARS = 16;
|
|
9
10
|
/** 累计有效用户内容达到该长度(且至少 1 轮完成)可摘要 */
|
|
@@ -12,18 +13,25 @@ export const TITLE_MIN_TOTAL_USER_CHARS = 40;
|
|
|
12
13
|
export const TITLE_SNIPPET_MAX_CHARS = 24;
|
|
13
14
|
/** 生成标题最大长度 */
|
|
14
15
|
export const TITLE_MAX_CHARS = 40;
|
|
15
|
-
/** 参与标题信号统计的用户消息(排除 slash
|
|
16
|
+
/** 参与标题信号统计的用户消息(排除 slash 命令留痕与机器插槽;唯一谓词在 layer-types) */
|
|
16
17
|
function isTitleRelevantUserMessage(msg) {
|
|
17
|
-
if (msg
|
|
18
|
+
if (!isHumanSpeech(msg))
|
|
18
19
|
return false;
|
|
19
20
|
const kind = msg.metadata?.kind;
|
|
20
21
|
if (kind === 'command' || kind === 'command_result')
|
|
21
22
|
return false;
|
|
22
23
|
return true;
|
|
23
24
|
}
|
|
24
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* 提取纯文本并压空白。
|
|
27
|
+
*
|
|
28
|
+
* f126dc9 后真实用户消息的 content 是 `<turn_start>` 整封(含 turn_context
|
|
29
|
+
* 快照/grounding):必须解包取 `<user_message>` 原文,否则标题信号被信封
|
|
30
|
+
* boilerplate 吃满、snippet 被信封形状误判为载荷(OP-WEB-5② 残留)。
|
|
31
|
+
* 非信封正文(assistant / 载体 / 便签)原样返回。
|
|
32
|
+
*/
|
|
25
33
|
function messageText(msg) {
|
|
26
|
-
return
|
|
34
|
+
return extractUserMessageText(msg.content).replace(/\s+/g, ' ').trim();
|
|
27
35
|
}
|
|
28
36
|
function safeDecodeURIComponent(s) {
|
|
29
37
|
try {
|
|
@@ -239,11 +247,19 @@ export function isWeakTitle(title) {
|
|
|
239
247
|
export function buildTitlePrompt(messages) {
|
|
240
248
|
const entries = [];
|
|
241
249
|
for (const msg of messages) {
|
|
242
|
-
if (msg.role
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
250
|
+
if (msg.role === 'user') {
|
|
251
|
+
// 用户侧复用唯一谓词(载体/命令留痕过滤单源)
|
|
252
|
+
if (!isTitleRelevantUserMessage(msg))
|
|
253
|
+
continue;
|
|
254
|
+
}
|
|
255
|
+
else if (msg.role === 'assistant') {
|
|
256
|
+
const kind = msg.metadata?.kind;
|
|
257
|
+
if (kind === 'command' || kind === 'command_result')
|
|
258
|
+
continue;
|
|
259
|
+
}
|
|
260
|
+
else {
|
|
246
261
|
continue;
|
|
262
|
+
}
|
|
247
263
|
const text = titleText(msg);
|
|
248
264
|
if (!text)
|
|
249
265
|
continue;
|
|
@@ -19,6 +19,27 @@ export interface SessionSwitchRecord extends PrincipalRef {
|
|
|
19
19
|
toPrimaryAgentId?: string;
|
|
20
20
|
reason?: string;
|
|
21
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* 委派产生的 Session 父子关联(I2 投影可重建)
|
|
24
|
+
*
|
|
25
|
+
* 子 agent 经委派(`arch/delegation.md`)起 Run 时落**独立 Session**,
|
|
26
|
+
* 并在此记录来源,使审计链不断(D7)。
|
|
27
|
+
*
|
|
28
|
+
* 刻意不塞 `metadata`:I2 要求 Discourse 权威可重建,
|
|
29
|
+
* 显式字段才好投影 / 检索 / 审计。
|
|
30
|
+
*/
|
|
31
|
+
export interface SessionSpawnLink {
|
|
32
|
+
/** 委派单 ID(`harness/collaboration/delegation`) */
|
|
33
|
+
delegationId: string;
|
|
34
|
+
/** 发起委派的 agentId */
|
|
35
|
+
parentAgentId: string;
|
|
36
|
+
/** 父 session ID */
|
|
37
|
+
parentSessionId: string;
|
|
38
|
+
/** 父 run ID */
|
|
39
|
+
parentRunId: string;
|
|
40
|
+
/** 委派链深度(根委派 = 1) */
|
|
41
|
+
depth?: number;
|
|
42
|
+
}
|
|
22
43
|
/** Session 生命周期状态(`extracted` 已废除:提炼进度归 memory.steward) */
|
|
23
44
|
export type SessionLifecycleStatus = 'active' | 'recent' | 'archived';
|
|
24
45
|
/**
|
|
@@ -60,11 +81,25 @@ export interface SessionData {
|
|
|
60
81
|
preferredAgentId?: string;
|
|
61
82
|
/** preferred / handoff 切换审计(I6 Principal 进审计) */
|
|
62
83
|
switchAudit?: SessionSwitchRecord[];
|
|
84
|
+
/**
|
|
85
|
+
* 委派来源(`arch/delegation.md` D7)。
|
|
86
|
+
*
|
|
87
|
+
* 本 Session 由父 agent 的委派产生时写入;用户直接创建的 Session 无此字段。
|
|
88
|
+
* 父 Run 结束后子 Session **继续存在**(决策 C1),故关联必须持久化。
|
|
89
|
+
*/
|
|
90
|
+
spawnBy?: SessionSpawnLink;
|
|
63
91
|
meta: SessionMeta;
|
|
64
92
|
messages: Message[];
|
|
65
93
|
turns: Turn[];
|
|
66
94
|
metadata: Record<string, unknown>;
|
|
67
95
|
lifecycle?: SessionLifecycleMeta;
|
|
96
|
+
/**
|
|
97
|
+
* 上下文租约截断点(messages 下标)。
|
|
98
|
+
*
|
|
99
|
+
* 仅影响 LLM 默认消息窗口;Discourse 全量仍在 `messages`。
|
|
100
|
+
* `undefined` / `0` = 不截断。由 Runner 在 `idleExpiryMs` 显式配置且闲置超时后写入。
|
|
101
|
+
*/
|
|
102
|
+
contextDetachIndex?: number;
|
|
68
103
|
/**
|
|
69
104
|
* 会话任务(goal/step 两级)。见 docs/task-system.md。
|
|
70
105
|
* 历史数据可能缺省;Service/Runner 会视作 []。
|
|
@@ -32,6 +32,8 @@ export interface AgentEventMap {
|
|
|
32
32
|
stopped?: boolean;
|
|
33
33
|
error?: boolean;
|
|
34
34
|
usage?: import('@octopi-agent/core/types/turn.js').TokenUsage;
|
|
35
|
+
/** F3 LLM 计时摘要(loop turn_end 透传;Run 页签耗时区消费) */
|
|
36
|
+
llmTiming?: import('@octopi-agent/core/loop/types.js').LoopLLMTiming;
|
|
35
37
|
contextTokens?: number;
|
|
36
38
|
contextWindow?: number;
|
|
37
39
|
};
|
|
@@ -47,6 +49,41 @@ export interface AgentEventMap {
|
|
|
47
49
|
hasError?: boolean;
|
|
48
50
|
result?: unknown;
|
|
49
51
|
durationMs?: number;
|
|
52
|
+
/** 行动简述 */
|
|
53
|
+
purpose?: string;
|
|
54
|
+
};
|
|
55
|
+
/** ToolEffectPolicy §5.6 效应账本摘要(turn 级;Observer tool.effect) */
|
|
56
|
+
'tool.effect.ledger': {
|
|
57
|
+
entries: number;
|
|
58
|
+
truncated?: boolean;
|
|
59
|
+
notReversed?: {
|
|
60
|
+
reason: string;
|
|
61
|
+
created?: string[];
|
|
62
|
+
modified?: string[];
|
|
63
|
+
deleted?: string[];
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
/** Runner 收口计时(F3 `[timing]` 探针转正;wait/build/run_end 分段,事件旁路 eventSink) */
|
|
67
|
+
'run.timing': {
|
|
68
|
+
stage: 'run_start' | 'context_ready' | 'run_end';
|
|
69
|
+
/** 排队/等锁耗时(stage=run_start) */
|
|
70
|
+
waitMs?: number;
|
|
71
|
+
/** 上下文组装耗时,从拿锁后起算(stage=context_ready) */
|
|
72
|
+
buildMs?: number;
|
|
73
|
+
/** 消息数(stage=context_ready) */
|
|
74
|
+
msgs?: number;
|
|
75
|
+
/** system prompt 稳定前缀字符数(E8 后不含易变快照) */
|
|
76
|
+
sysChars?: number;
|
|
77
|
+
/** grounding 估算 tokens(stage=context_ready) */
|
|
78
|
+
groundingTokens?: number;
|
|
79
|
+
/** run 总耗时(stage=run_end) */
|
|
80
|
+
durMs?: number;
|
|
81
|
+
/** 观测口径结束原因(stage=run_end) */
|
|
82
|
+
reason?: string;
|
|
83
|
+
/** 循环结束原因(stage=run_end) */
|
|
84
|
+
loopEnd?: string;
|
|
85
|
+
/** 停止闸门原因(stage=run_end) */
|
|
86
|
+
stopReason?: string;
|
|
50
87
|
};
|
|
51
88
|
'budget.exceeded': {
|
|
52
89
|
reason: 'wall_clock' | 'iteration' | 'tool_calls';
|
|
@@ -240,6 +277,8 @@ export declare const AgentEvents: {
|
|
|
240
277
|
readonly ENGINE_ERROR: "engine.error";
|
|
241
278
|
readonly ITERATION_START: "iteration.start";
|
|
242
279
|
readonly TURN_END: "turn.end";
|
|
280
|
+
/** Runner 收口计时(F3 转正) */
|
|
281
|
+
readonly RUN_TIMING: "run.timing";
|
|
243
282
|
readonly TOOL_EXEC_START: "tool.exec.start";
|
|
244
283
|
readonly TOOL_EXEC_END: "tool.exec.end";
|
|
245
284
|
readonly INJECTION_DETECTED: "injection.detected";
|
|
@@ -20,6 +20,8 @@ export const AgentEvents = {
|
|
|
20
20
|
ENGINE_ERROR: 'engine.error',
|
|
21
21
|
ITERATION_START: 'iteration.start',
|
|
22
22
|
TURN_END: 'turn.end',
|
|
23
|
+
/** Runner 收口计时(F3 转正) */
|
|
24
|
+
RUN_TIMING: 'run.timing',
|
|
23
25
|
TOOL_EXEC_START: 'tool.exec.start',
|
|
24
26
|
TOOL_EXEC_END: 'tool.exec.end',
|
|
25
27
|
INJECTION_DETECTED: 'injection.detected',
|
|
@@ -43,9 +43,32 @@ export interface AgentDefinition {
|
|
|
43
43
|
* handle authorize 时与角色 max / 绑定取交集。
|
|
44
44
|
*/
|
|
45
45
|
maxSessionRights?: SessionRights;
|
|
46
|
+
/** ToolEffectPolicy 运行模式(P3);agents[].effectPolicy 覆盖顶层 */
|
|
47
|
+
effectPolicy?: import('../../extension/execution-environment/effect-policy.js').EffectPolicyConfig;
|
|
46
48
|
/** Knowledge 召回姿态(覆盖全局 knowledge.recall) */
|
|
47
49
|
knowledge?: {
|
|
48
50
|
recall?: 'off' | 'hint' | 'hybrid' | 'inject';
|
|
49
51
|
};
|
|
52
|
+
/** 特质标签(arch/delegation.md §9.2:供父 agent 按特质发现委派目标);无权限语义 */
|
|
53
|
+
traits?: string[];
|
|
54
|
+
/** 委派策略(arch/delegation.md §9.2);整段可省略 = 用 DEFAULT_DELEGATION_POLICY(委派默认开启) */
|
|
55
|
+
delegation?: {
|
|
56
|
+
/** 能否被委派(默认 true;显式 false = 只能被用户直接对话) */
|
|
57
|
+
callable: boolean;
|
|
58
|
+
/** 允许哪些 agentId 调我(缺省 = 任意) */
|
|
59
|
+
callableBy?: string[];
|
|
60
|
+
/** 我能不能再委派、获得 delegate_* 工具(默认 true) */
|
|
61
|
+
canDelegate: boolean;
|
|
62
|
+
/** 递归上限(默认 1 = 我能派子,子不能再派;runaway 兜底) */
|
|
63
|
+
maxDepth?: number;
|
|
64
|
+
/** 被委派时的权利天花板(只能收紧不能放宽,D3) */
|
|
65
|
+
rightsCeiling?: SessionRights;
|
|
66
|
+
/** 委派预算上限(请求预算与此取交集) */
|
|
67
|
+
budget?: {
|
|
68
|
+
maxTurns?: number;
|
|
69
|
+
maxTokens?: number;
|
|
70
|
+
timeoutMs?: number;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
50
73
|
}
|
|
51
74
|
export type { ModelInfo, ToolPolicy };
|
package/dist/index.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ export type { SecurityAction } from '@octopi-agent/core/security-guard.js';
|
|
|
22
22
|
export type { Observer, Span, LogLevel } from '@octopi-agent/core/interfaces/observer.js';
|
|
23
23
|
export type { SessionStore, SessionListFilter } from '@octopi-agent/core/interfaces/session-store.js';
|
|
24
24
|
export type { SessionData, SessionLifecycleMeta, SessionLifecycleStatus, MemoryExtractionStatus } from './harness/session/types.js';
|
|
25
|
-
export type { ContextEngine, ContextEngineInfo, AssembleParams, AssembleResult, IngestParams,
|
|
25
|
+
export type { ContextEngine, ContextEngineInfo, AssembleParams, AssembleResult, IngestParams, CompactResult, AfterTurnParams, TokenEstimator, SummarizeFunction, MessageSelector, SelectResult, SelectOptions, Compressor, CompressParams, CompressResult, BudgetAllocator, BudgetAllocateParams, BudgetAllocateResult, } from './harness/context/types.js';
|
|
26
26
|
export { setRunTelemetryFactory, getRunTelemetryFactory } from './harness/observability/run-telemetry.js';
|
|
27
27
|
export type { RunTelemetry, RunTelemetryFactory } from './harness/observability/run-telemetry.js';
|
|
28
28
|
export { createRunTelemetry } from './integration/observability/run-telemetry.js';
|
|
@@ -36,6 +36,20 @@ export type { HarnessLoopEvent, BudgetControlEvent, ControlStopMetric, PolicyUni
|
|
|
36
36
|
export { SessionAwareRunner } from './harness/run/runner.js';
|
|
37
37
|
export { DEFAULT_TOOL_ISOLATION, resolveToolIsolationCwd, } from './harness/extension/execution-environment/isolation.js';
|
|
38
38
|
export type { ToolIsolationMode } from './harness/extension/execution-environment/isolation.js';
|
|
39
|
+
export { TurnFileUndoLog, commitSessionFileUndo, discardSessionFileUndo, resolveSessionUndoPaths, resolveSessionUndoOnClose, createUnconfiguredFileEffects, createUnconfiguredMemoryEffects, } from './harness/extension/execution-environment/undo-log.js';
|
|
40
|
+
export { TurnMemoryJournal, JournaledMemoryStore, createMemoryRestorer, discardMemoryUndo, } from './harness/extension/execution-environment/memory-undo.js';
|
|
41
|
+
export type { MemoryUndoEntry, MemoryEffectRestorer, DiscardMemoryEffectsResult, } from './harness/extension/execution-environment/memory-undo.js';
|
|
42
|
+
export type { MemoryEffectJournal, MemoryEffectDomain } from '@octopi-agent/core/types/tools.js';
|
|
43
|
+
export { resolveEffectiveEffectPolicy, requiresJail, isPathAllowed, isToolAllowedOnSurface, DEFAULT_EFFECT_RUN_MODE, readSessionEffectOverrides, normalizeTransactionRoots, mergeTransactionRoots, SESSION_EFFECT_OVERRIDES_KEY, } from './harness/extension/execution-environment/effect-policy.js';
|
|
44
|
+
export { ProcessSandbox, createProcessSandbox, assessL4ProcessMinimum, probeProcessIsolation, scrubEnv, killProcessTree, supervisedSpawnProfile, } from './harness/extension/execution-environment/index.js';
|
|
45
|
+
export type { ProcessIsolationProfile, IsolationBackend, L4ProcessAssessment, } from './harness/extension/execution-environment/process-isolation.js';
|
|
46
|
+
export { runWithToolLimits, resolveToolTimeoutMs, ToolTimeoutError, } from './harness/extension/execution-environment/resource-limits.js';
|
|
47
|
+
export type { EffectIntent, ConfirmEffect, ConfirmEffectDecision, UntrustedAdmission, ToolSurface, SecurityDegradation, SessionEffectOverrides, } from './harness/extension/execution-environment/effect-policy.js';
|
|
48
|
+
export type { EffectRunMode, EffectPolicyConfig, EffectiveEffectPolicy, PathContainment, ShellEscapePolicy, } from './harness/extension/execution-environment/effect-policy.js';
|
|
49
|
+
export { scanOrphanSessionUndo, } from './harness/extension/execution-environment/undo-log.js';
|
|
50
|
+
export type { SessionUndoPaths, FileUndoEntry, DiscardFileEffectsResult, DiscardConflictReason, EditResendResult, NotReversedEffects, NotReversedReason, UndoLimitConfig, OrphanUndoDir, } from './harness/extension/execution-environment/undo-log.js';
|
|
51
|
+
export type { ShellJournalMode } from './harness/extension/execution-environment/effect-policy.js';
|
|
52
|
+
export type { ToolFileEffects } from '@octopi-agent/core/types/tools.js';
|
|
39
53
|
export { InProcessSessionLock } from './harness/run/concurrency/session-lease.js';
|
|
40
54
|
export type { SessionLease } from './harness/run/concurrency/session-lease.js';
|
|
41
55
|
export { SessionAclService, BUILTIN_SESSION_ROLES, computeEffectiveRights, } from './harness/governance/session-acl/index.js';
|
|
@@ -69,10 +83,13 @@ export type { SkillDefinition, SkillManager } from './harness/extension/plugin-e
|
|
|
69
83
|
/** 产品装配 DTO(非 Kernel);ModelInfo/ToolPolicy 仍从 core/types 导出 */
|
|
70
84
|
export type { AgentPersona, ModelConfig, AgentDefinition } from './harness/shared/types/agent-definition.js';
|
|
71
85
|
export { DefaultToolBus } from './harness/extension/plugin-ecosystem/tools/tool-bus.js';
|
|
86
|
+
export { buildToolLlmParameters, prepareHandlerArgs, readToolCallPurpose, resolveToolCallPurpose, sanitizeToolJsonSchema, toolDeclaresPurpose, TOOL_PURPOSE_PARAM, TOOL_PURPOSE_SYSTEM_NOTE, } from './harness/agent/tool-purpose.js';
|
|
72
87
|
export { createClientTool, makeClientToolCallId, ClientToolRegistry, DEFAULT_CLIENT_TOOL_TIMEOUT_MS, } from './harness/extension/plugin-ecosystem/client-tools/index.js';
|
|
73
|
-
export type { ClientToolCall, ClientToolCallId, ClientToolCallOutcome, ClientToolDescriptor, ClientToolDeviceMeta, ClientToolErrorReason, ClientToolInvoker, ClientToolInteraction, ClientToolName, ClientToolProvider, ClientToolResult, ClientToolSensitivity, ClientToolRouteDecision, } from './harness/extension/plugin-ecosystem/client-tools/index.js';
|
|
88
|
+
export type { ClientToolCall, ClientToolCallId, ClientToolCallOutcome, ClientToolDescriptor, ClientToolDeviceMeta, ClientToolErrorReason, ClientToolInvoker, ClientToolInteraction, ClientToolName, ClientToolProvider, ClientToolFileRef, ClientToolResult, ClientToolSensitivity, ClientToolRouteDecision, } from './harness/extension/plugin-ecosystem/client-tools/index.js';
|
|
74
89
|
export { getBuiltinTools, createShellTool, createFileReadTool, createFileWriteTool, createFileListTool } from './harness/extension/plugin-ecosystem/tools/builtin.js';
|
|
75
90
|
export { createToolSet } from './harness/extension/plugin-ecosystem/tools/tool-set.js';
|
|
91
|
+
export { readGitStatusSnapshot, parsePorcelainV2 } from './harness/extension/plugin-ecosystem/tools/git-status-snapshot.js';
|
|
92
|
+
export type { GitStatusSnapshot, GitStatusSnapshotBody, GitStatusSnapshotOptions, GitStatusEntry, GitStatusBranch, GitStatusCounts, GitStatusGroup, GitStatusKind, } from './harness/extension/plugin-ecosystem/tools/git-status-snapshot.js';
|
|
76
93
|
export { createSummaryPort, applyToolOutputGate, createCompactEngine } from './harness/context/capabilities/index.js';
|
|
77
94
|
export { createDefaultDocumentPort, createDocumentPortFromConfig, DocumentExtractError } from './harness/capabilities/document/index.js';
|
|
78
95
|
export type { SummaryPort, SummaryPolicy, ContentUnit, ToolSummarySupport, CompactEngine } from './harness/context/capabilities/index.js';
|
|
@@ -85,10 +102,8 @@ export { createSessionHistoryTools, createSessionSearchTool, createSessionReadTo
|
|
|
85
102
|
export type { SessionHistoryPort, SessionHistoryQuery, SessionHistorySearchResult, } from './harness/session/history/index.js';
|
|
86
103
|
export { buildFromConfig } from './harness/agent/config-bridge.js';
|
|
87
104
|
export type { BuiltAgent } from './harness/agent/config-bridge.js';
|
|
88
|
-
export { DefaultAgentRegistry,
|
|
89
|
-
export type {
|
|
90
|
-
export type { AgentRegistry, AgentInfo, AgentQuery, AgentRelation, AgentRelationType } from './harness/collaboration/multi-agent/agent-registry-types.js';
|
|
91
|
-
export { AgentRegistryEvents } from './harness/collaboration/multi-agent/agent-registry-types.js';
|
|
105
|
+
export { DefaultAgentRegistry, DelegationStore, DelegateService, DelegateResolutionError, InProcessTransport, RunnerChildRunPort, createChildRunExecutor, createDelegationNotifier, renderDelegationNotice, wireDelegation, createDelegationRuntime, AgentRegistryEvents, DelegationEvents, DELEGATION_SCHEMA_VERSION, } from './harness/collaboration/delegation/index.js';
|
|
106
|
+
export type { Delegation, DelegateRequest, DelegateResult, AgentHandle, AgentRegistry, AgentInfo, AgentQuery, AgentRelation, AgentRelationType, AgentDelegationPolicy, DelegateTransport, DelegatableAgent, DelegationRuntime, } from './harness/collaboration/delegation/index.js';
|
|
92
107
|
export { JsonlSessionStore } from './integration/storage/jsonl.js';
|
|
93
108
|
export { InMemorySessionStore } from './integration/storage/memory.js';
|
|
94
109
|
export { SessionArchiveManager } from './integration/storage/archive-manager.js';
|
|
@@ -112,10 +127,11 @@ export type { EngineConfig } from './config-schema/engine.js';
|
|
|
112
127
|
export { getBuiltinModelInfo, mergeWithBuiltinInfo } from './builtin-model-info.js';
|
|
113
128
|
export * from '@octopi-agent/core/types.js';
|
|
114
129
|
export { getTextContent, hasMediaContent } from '@octopi-agent/core/types.js';
|
|
115
|
-
export type { AsyncTaskStore, AsyncTaskRecord } from './harness/collaboration/orchestration/async-task-store.js';
|
|
116
130
|
export type { MemoryStore, MemoryEntry, MemoryType, MemoryQuery, MemoryStats, WisdomStore, WisdomEntry, WisdomStatus, WisdomOrigin, WisdomKind, WisdomScenario, WisdomEffect, WisdomDerivation, WisdomOutcomes, AdmitWisdomInput, AdmitWisdomResult, WisdomInjectQuery, WisdomInjectPick, WisdomStats, ConceptGraphStore, ConceptNode, ConceptEdge, ConceptGraph, ConceptKind, ConceptRelationType, ConceptStatus, EvidenceClass, EdgeBasis, AdmitConceptInput, AdmitConceptResult, AdmitEdgeInput, AdmitEdgeResult, SpreadingActivateOptions, ActivatedGraph, ConceptGraphStats, DecayResult, MergeCandidate, ConceptGateReason, KnowledgeCatalogItem, KnowledgeCatalogProvider, Planner, Reflector, AgentState, } from './harness/index.js';
|
|
117
131
|
export type { McpClient, McpManager, McpServerConfig, McpToolDefinition, McpToolResult, } from './harness/extension/plugin-ecosystem/mcp/types.js';
|
|
118
|
-
export type { MessageChannel, ProcessMessage, } from './harness/collaboration/
|
|
119
|
-
export type {
|
|
132
|
+
export type { MessageChannel, ProcessMessage, } from './harness/collaboration/delegation/message-channel-types.js';
|
|
133
|
+
export type { HitlDecision } from '@octopi-agent/core/types/tools.js';
|
|
134
|
+
export { HitlDecisionCache, defaultHitlCache, resolveHitlDecision, } from './harness/governance/human-in-the-loop/decision-cache.js';
|
|
135
|
+
export type { HitlChannel, HitlCacheScope, } from './harness/governance/human-in-the-loop/decision-cache.js';
|
|
120
136
|
export type { SandboxProvider, Workspace, IsolationLevel, SandboxConfig, SandboxResult, } from './harness/extension/execution-environment/types.js';
|
|
121
137
|
export type { EventSource, EventSourceDescriptor, ExternalEvent, } from './harness/activation/event-source-types.js';
|
package/dist/index.js
CHANGED
|
@@ -25,6 +25,12 @@ export { AgentBuilder, createAgent, isSubsystemAllowed, discoverSubsystemSpecs }
|
|
|
25
25
|
export { Agent } from './harness/run/agent/index.js';
|
|
26
26
|
export { SessionAwareRunner } from './harness/run/runner.js';
|
|
27
27
|
export { DEFAULT_TOOL_ISOLATION, resolveToolIsolationCwd, } from './harness/extension/execution-environment/isolation.js';
|
|
28
|
+
export { TurnFileUndoLog, commitSessionFileUndo, discardSessionFileUndo, resolveSessionUndoPaths, resolveSessionUndoOnClose, createUnconfiguredFileEffects, createUnconfiguredMemoryEffects, } from './harness/extension/execution-environment/undo-log.js';
|
|
29
|
+
export { TurnMemoryJournal, JournaledMemoryStore, createMemoryRestorer, discardMemoryUndo, } from './harness/extension/execution-environment/memory-undo.js';
|
|
30
|
+
export { resolveEffectiveEffectPolicy, requiresJail, isPathAllowed, isToolAllowedOnSurface, DEFAULT_EFFECT_RUN_MODE, readSessionEffectOverrides, normalizeTransactionRoots, mergeTransactionRoots, SESSION_EFFECT_OVERRIDES_KEY, } from './harness/extension/execution-environment/effect-policy.js';
|
|
31
|
+
export { ProcessSandbox, createProcessSandbox, assessL4ProcessMinimum, probeProcessIsolation, scrubEnv, killProcessTree, supervisedSpawnProfile, } from './harness/extension/execution-environment/index.js';
|
|
32
|
+
export { runWithToolLimits, resolveToolTimeoutMs, ToolTimeoutError, } from './harness/extension/execution-environment/resource-limits.js';
|
|
33
|
+
export { scanOrphanSessionUndo, } from './harness/extension/execution-environment/undo-log.js';
|
|
28
34
|
export { InProcessSessionLock } from './harness/run/concurrency/session-lease.js';
|
|
29
35
|
export { SessionAclService, BUILTIN_SESSION_ROLES, computeEffectiveRights, } from './harness/governance/session-acl/index.js';
|
|
30
36
|
export { loadPersona, composePersonas, PersonaSource } from './harness/agent/persona.js';
|
|
@@ -45,17 +51,19 @@ export { CapabilityRegistry } from './harness/extension/plugin-ecosystem/plugins
|
|
|
45
51
|
export { validateManifest, parseManifest } from './harness/extension/plugin-ecosystem/plugins/manifest.js';
|
|
46
52
|
export { DefaultSkillManager, FileSystemSkillSource } from './harness/extension/plugin-ecosystem/skills/manager.js';
|
|
47
53
|
export { DefaultToolBus } from './harness/extension/plugin-ecosystem/tools/tool-bus.js';
|
|
54
|
+
export { buildToolLlmParameters, prepareHandlerArgs, readToolCallPurpose, resolveToolCallPurpose, sanitizeToolJsonSchema, toolDeclaresPurpose, TOOL_PURPOSE_PARAM, TOOL_PURPOSE_SYSTEM_NOTE, } from './harness/agent/tool-purpose.js';
|
|
48
55
|
export { createClientTool, makeClientToolCallId, ClientToolRegistry, DEFAULT_CLIENT_TOOL_TIMEOUT_MS, } from './harness/extension/plugin-ecosystem/client-tools/index.js';
|
|
49
56
|
export { getBuiltinTools, createShellTool, createFileReadTool, createFileWriteTool, createFileListTool } from './harness/extension/plugin-ecosystem/tools/builtin.js';
|
|
50
57
|
export { createToolSet } from './harness/extension/plugin-ecosystem/tools/tool-set.js';
|
|
58
|
+
export { readGitStatusSnapshot, parsePorcelainV2 } from './harness/extension/plugin-ecosystem/tools/git-status-snapshot.js';
|
|
51
59
|
export { createSummaryPort, applyToolOutputGate, createCompactEngine } from './harness/context/capabilities/index.js';
|
|
52
60
|
export { createDefaultDocumentPort, createDocumentPortFromConfig, DocumentExtractError } from './harness/capabilities/document/index.js';
|
|
53
61
|
export { createWebSearchTool } from './harness/extension/plugin-ecosystem/tools/web-search.js';
|
|
54
62
|
export { createSessionHistoryPort, resolveHistoryAccess, } from './harness/session/history/index.js';
|
|
55
63
|
export { createSessionHistoryTools, createSessionSearchTool, createSessionReadTool, } from './harness/extension/plugin-ecosystem/tools/session-history.js';
|
|
56
64
|
export { buildFromConfig } from './harness/agent/config-bridge.js';
|
|
57
|
-
|
|
58
|
-
export { AgentRegistryEvents } from './harness/collaboration/
|
|
65
|
+
// ── Delegation(L2 委派契约层;arch/delegation.md)──
|
|
66
|
+
export { DefaultAgentRegistry, DelegationStore, DelegateService, DelegateResolutionError, InProcessTransport, RunnerChildRunPort, createChildRunExecutor, createDelegationNotifier, renderDelegationNotice, wireDelegation, createDelegationRuntime, AgentRegistryEvents, DelegationEvents, DELEGATION_SCHEMA_VERSION, } from './harness/collaboration/delegation/index.js';
|
|
59
67
|
// ============================================================
|
|
60
68
|
// Integration 层(engine 库能力)
|
|
61
69
|
// ============================================================
|
|
@@ -80,3 +88,4 @@ export { getBuiltinModelInfo, mergeWithBuiltinInfo } from './builtin-model-info.
|
|
|
80
88
|
// ============================================================
|
|
81
89
|
export * from '@octopi-agent/core/types.js';
|
|
82
90
|
export { getTextContent, hasMediaContent } from '@octopi-agent/core/types.js';
|
|
91
|
+
export { HitlDecisionCache, defaultHitlCache, resolveHitlDecision, } from './harness/governance/human-in-the-loop/decision-cache.js';
|
|
@@ -18,6 +18,14 @@ export interface CreateRunTelemetryOptions {
|
|
|
18
18
|
/** 预创建实例(测试注入) */
|
|
19
19
|
collector?: TraceCollector;
|
|
20
20
|
metricsInstance?: MetricsAggregator;
|
|
21
|
+
/**
|
|
22
|
+
* 归因上下文解析(组合根注入,如 RunScope ALS)。
|
|
23
|
+
* LoopObserver 路径的 model.call.* 行靠它带 sessionId/agentId。
|
|
24
|
+
*/
|
|
25
|
+
resolveContext?: () => {
|
|
26
|
+
sessionId?: string;
|
|
27
|
+
agentId?: string;
|
|
28
|
+
};
|
|
21
29
|
}
|
|
22
30
|
/**
|
|
23
31
|
* 创建一套 RunTelemetry
|
|
@@ -45,31 +45,54 @@ export function createRunTelemetry(options = {}) {
|
|
|
45
45
|
/**
|
|
46
46
|
* 只补 LLM 调用生命周期(Runner 事件流无 model.call.*)。
|
|
47
47
|
* 工具事件由 onEvent 接收 Runner 的 tool.exec.*,避免双计。
|
|
48
|
+
*
|
|
49
|
+
* 计时按 callId 隔离(同 agent 并发 run 共用本 observer,单变量会互相覆盖)。
|
|
48
50
|
*/
|
|
49
51
|
createLoopObserver(traceOpts) {
|
|
50
52
|
const c = ensureCollector(traceOpts);
|
|
51
|
-
|
|
53
|
+
/** callId → 计时状态(onLLMEnd 清理,无泄漏) */
|
|
54
|
+
const calls = new Map();
|
|
55
|
+
const ctx = () => options.resolveContext?.() ?? {};
|
|
56
|
+
/** 无 callId 的旧调用方回退键(顺序调用沿用旧单变量语义;并发场景请传 callId) */
|
|
57
|
+
const keyOf = (callId) => callId ?? 'default';
|
|
52
58
|
return {
|
|
53
59
|
onLLMStart(params) {
|
|
54
|
-
|
|
60
|
+
const startTs = Date.now();
|
|
61
|
+
calls.set(keyOf(params.callId), { startTs });
|
|
55
62
|
c.record({
|
|
56
63
|
type: 'model.call.start',
|
|
57
|
-
timestamp:
|
|
58
|
-
data: {
|
|
59
|
-
|
|
64
|
+
timestamp: startTs,
|
|
65
|
+
data: {
|
|
66
|
+
model: params.model,
|
|
67
|
+
callId: params.callId,
|
|
68
|
+
reqChars: params.reqChars,
|
|
69
|
+
toolChars: params.toolChars,
|
|
70
|
+
},
|
|
71
|
+
}, ctx());
|
|
72
|
+
},
|
|
73
|
+
onLLMFirstToken(params) {
|
|
74
|
+
const call = calls.get(keyOf(params.callId));
|
|
75
|
+
if (call)
|
|
76
|
+
call.ttftMs = params.ttftMs;
|
|
60
77
|
},
|
|
61
78
|
onLLMEnd(params) {
|
|
62
|
-
const
|
|
63
|
-
|
|
79
|
+
const call = calls.get(keyOf(params.callId));
|
|
80
|
+
calls.delete(keyOf(params.callId));
|
|
81
|
+
// 无 start 记录(异常调用序)时 duration 缺省,不伪造 0
|
|
82
|
+
const durationMs = call ? Date.now() - call.startTs : undefined;
|
|
64
83
|
c.record({
|
|
65
84
|
type: 'model.call.end',
|
|
66
85
|
timestamp: Date.now(),
|
|
67
86
|
data: {
|
|
68
87
|
model: params.model,
|
|
88
|
+
callId: params.callId,
|
|
69
89
|
usage: params.usage,
|
|
70
90
|
durationMs,
|
|
91
|
+
ttftMs: params.ttftMs ?? call?.ttftMs,
|
|
92
|
+
outChars: params.outChars,
|
|
93
|
+
finishReason: params.finishReason,
|
|
71
94
|
},
|
|
72
|
-
},
|
|
95
|
+
}, ctx());
|
|
73
96
|
},
|
|
74
97
|
};
|
|
75
98
|
},
|
|
@@ -46,13 +46,20 @@ export class TraceCollector {
|
|
|
46
46
|
const turnId = `turn_${++this.turnCount}`;
|
|
47
47
|
this.currentTurnId = turnId;
|
|
48
48
|
this.logger.info(TRACE_EVENTS.TURN_START, { turnId }, ctx);
|
|
49
|
+
let sawTurnEnd = false;
|
|
49
50
|
for await (const event of events) {
|
|
51
|
+
if (event.type === 'turn.end')
|
|
52
|
+
sawTurnEnd = true;
|
|
50
53
|
// 记录到 trace
|
|
51
54
|
this.recordEvent(event, ctx, turnId);
|
|
52
55
|
// 原样传递
|
|
53
56
|
yield event;
|
|
54
57
|
}
|
|
55
|
-
|
|
58
|
+
// 收口行仅在事件流自身无 turn.end 时补——recordEvent 已把 turn.end 映射为 TURN_END,
|
|
59
|
+
// 再补一行即双计(turn 统计翻倍)
|
|
60
|
+
if (!sawTurnEnd) {
|
|
61
|
+
this.logger.info(TRACE_EVENTS.TURN_END, { turnId }, ctx);
|
|
62
|
+
}
|
|
56
63
|
}
|
|
57
64
|
/**
|
|
58
65
|
* 获取 MetricsAggregator 实例
|
|
@@ -92,29 +99,44 @@ export class TraceCollector {
|
|
|
92
99
|
case 'turn.start':
|
|
93
100
|
this.logger.info(TRACE_EVENTS.TURN_START, { turnId }, base);
|
|
94
101
|
break;
|
|
95
|
-
// Runner 词表:turn.end 携带 usage
|
|
102
|
+
// Runner 词表:turn.end 携带 usage。F3-c 起不再冒充 model.call.end
|
|
103
|
+
//(LoopObserver 的 model.call.end 才带 durationMs/ttft;两行各归各位,p50/p95 取数不双计。
|
|
104
|
+
// F3-d 起 turn.end 事件还带 llmTiming 供 UI timeline 展示,本白名单仍不落盘——trace 指标只认 model.call.*)
|
|
96
105
|
case 'turn.end':
|
|
97
|
-
this.logger.info(TRACE_EVENTS.
|
|
106
|
+
this.logger.info(TRACE_EVENTS.TURN_END, {
|
|
98
107
|
contentLength: event.data?.content?.length ?? 0,
|
|
99
108
|
usage: event.data?.usage,
|
|
100
109
|
turnId,
|
|
101
110
|
}, base);
|
|
102
|
-
this.logger.info(TRACE_EVENTS.TURN_END, { turnId }, base);
|
|
103
111
|
break;
|
|
104
112
|
case 'model.call.start':
|
|
105
113
|
this.logger.info(TRACE_EVENTS.MODEL_CALL_START, {
|
|
106
114
|
model: event.data?.model,
|
|
115
|
+
callId: event.data?.callId,
|
|
116
|
+
reqChars: event.data?.reqChars,
|
|
117
|
+
toolChars: event.data?.toolChars,
|
|
107
118
|
turnId,
|
|
108
119
|
}, base);
|
|
109
120
|
break;
|
|
110
121
|
case 'model.call.end':
|
|
111
122
|
this.logger.info(TRACE_EVENTS.MODEL_CALL_END, {
|
|
123
|
+
model: event.data?.model,
|
|
124
|
+
callId: event.data?.callId,
|
|
125
|
+
// durationMs/ttftMs/reqChars 是 F3 回归指标口径(long-session-latency §7):白名单漏掉即断档
|
|
126
|
+
durationMs: event.data?.durationMs,
|
|
127
|
+
ttftMs: event.data?.ttftMs,
|
|
128
|
+
outChars: event.data?.outChars,
|
|
129
|
+
finishReason: event.data?.finishReason,
|
|
112
130
|
contentLength: event.data?.content?.length ?? 0,
|
|
113
131
|
toolCallCount: event.data?.toolCallCount ?? 0,
|
|
114
132
|
usage: event.data?.usage,
|
|
115
133
|
turnId,
|
|
116
134
|
}, base);
|
|
117
135
|
break;
|
|
136
|
+
// Runner 收口计时(wait/build/run_end;`[timing]` 探针转正,F3)
|
|
137
|
+
case 'run.timing':
|
|
138
|
+
this.logger.info(TRACE_EVENTS.RUN_TIMING, event.data, base);
|
|
139
|
+
break;
|
|
118
140
|
case 'model.call.error':
|
|
119
141
|
this.logger.error(TRACE_EVENTS.MODEL_CALL_ERROR, {
|
|
120
142
|
error: event.data?.error,
|
|
@@ -47,6 +47,7 @@ export declare const TRACE_EVENTS: {
|
|
|
47
47
|
readonly TOOL_EXEC_END: "tool.exec.end";
|
|
48
48
|
readonly SESSION_LOAD: "session.load";
|
|
49
49
|
readonly SESSION_SAVE: "session.save";
|
|
50
|
+
readonly RUN_TIMING: "run.timing";
|
|
50
51
|
readonly MODEL_RETRY: "model.retry";
|
|
51
52
|
readonly MODEL_FALLBACK: "model.fallback";
|
|
52
53
|
readonly EMPTY_RESPONSE: "empty.response";
|
|
@@ -42,6 +42,8 @@ export const TRACE_EVENTS = {
|
|
|
42
42
|
TOOL_EXEC_END: 'tool.exec.end',
|
|
43
43
|
SESSION_LOAD: 'session.load',
|
|
44
44
|
SESSION_SAVE: 'session.save',
|
|
45
|
+
// Runner 收口计时(wait/build/run_end;F3 `[timing]` 探针转正)
|
|
46
|
+
RUN_TIMING: 'run.timing',
|
|
45
47
|
// Level 2: WARN
|
|
46
48
|
MODEL_RETRY: 'model.retry',
|
|
47
49
|
MODEL_FALLBACK: 'model.fallback',
|