@jungjaehoon/mama-os 0.28.6 → 0.29.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent/agent-loop.d.ts +0 -4
- package/dist/agent/agent-loop.d.ts.map +1 -1
- package/dist/agent/agent-loop.js +33 -10
- package/dist/agent/agent-loop.js.map +1 -1
- package/dist/agent/code-act/host-bridge.d.ts.map +1 -1
- package/dist/agent/code-act/host-bridge.js +53 -3
- package/dist/agent/code-act/host-bridge.js.map +1 -1
- package/dist/agent/code-act/tool-policy.d.ts.map +1 -1
- package/dist/agent/code-act/tool-policy.js +5 -0
- package/dist/agent/code-act/tool-policy.js.map +1 -1
- package/dist/agent/codex-auth.d.ts +0 -1
- package/dist/agent/codex-auth.d.ts.map +1 -1
- package/dist/agent/codex-auth.js +0 -4
- package/dist/agent/codex-auth.js.map +1 -1
- package/dist/agent/codex-home.d.ts +0 -2
- package/dist/agent/codex-home.d.ts.map +1 -1
- package/dist/agent/codex-home.js +0 -66
- package/dist/agent/codex-home.js.map +1 -1
- package/dist/agent/context-compile-service.d.ts +9 -0
- package/dist/agent/context-compile-service.d.ts.map +1 -1
- package/dist/agent/context-compile-service.js +6 -0
- package/dist/agent/context-compile-service.js.map +1 -1
- package/dist/agent/context-prompt-builder.d.ts +0 -6
- package/dist/agent/context-prompt-builder.d.ts.map +1 -1
- package/dist/agent/context-prompt-builder.js +0 -131
- package/dist/agent/context-prompt-builder.js.map +1 -1
- package/dist/agent/contract-extractor.d.ts +0 -4
- package/dist/agent/contract-extractor.d.ts.map +1 -1
- package/dist/agent/contract-extractor.js +0 -68
- package/dist/agent/contract-extractor.js.map +1 -1
- package/dist/agent/gateway-tool-executor.d.ts +20 -15
- package/dist/agent/gateway-tool-executor.d.ts.map +1 -1
- package/dist/agent/gateway-tool-executor.js +236 -90
- package/dist/agent/gateway-tool-executor.js.map +1 -1
- package/dist/agent/gateway-tools.md +7 -4
- package/dist/agent/skill-loader.d.ts +0 -7
- package/dist/agent/skill-loader.d.ts.map +1 -1
- package/dist/agent/skill-loader.js +0 -86
- package/dist/agent/skill-loader.js.map +1 -1
- package/dist/agent/token-estimator.d.ts +0 -8
- package/dist/agent/token-estimator.d.ts.map +1 -1
- package/dist/agent/token-estimator.js +0 -14
- package/dist/agent/token-estimator.js.map +1 -1
- package/dist/agent/tool-registry.d.ts.map +1 -1
- package/dist/agent/tool-registry.js +23 -5
- package/dist/agent/tool-registry.js.map +1 -1
- package/dist/agent/types.d.ts +27 -1
- package/dist/agent/types.d.ts.map +1 -1
- package/dist/agent/types.js.map +1 -1
- package/dist/api/agent-graph-handler.d.ts +9 -0
- package/dist/api/agent-graph-handler.d.ts.map +1 -1
- package/dist/api/agent-graph-handler.js +27 -1
- package/dist/api/agent-graph-handler.js.map +1 -1
- package/dist/api/entity-audit-handler.d.ts +1 -2
- package/dist/api/entity-audit-handler.d.ts.map +1 -1
- package/dist/api/entity-audit-handler.js +0 -5
- package/dist/api/entity-audit-handler.js.map +1 -1
- package/dist/api/index.d.ts +1 -9
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +4 -17
- package/dist/api/index.js.map +1 -1
- package/dist/api/intelligence-handler.d.ts +0 -5
- package/dist/api/intelligence-handler.d.ts.map +1 -1
- package/dist/api/intelligence-handler.js +0 -15
- package/dist/api/intelligence-handler.js.map +1 -1
- package/dist/api/types.d.ts +1 -5
- package/dist/api/types.d.ts.map +1 -1
- package/dist/api/types.js +0 -14
- package/dist/api/types.js.map +1 -1
- package/dist/cli/commands/start.d.ts +117 -3
- package/dist/cli/commands/start.d.ts.map +1 -1
- package/dist/cli/commands/start.js +223 -62
- package/dist/cli/commands/start.js.map +1 -1
- package/dist/cli/config/config-manager.d.ts +0 -5
- package/dist/cli/config/config-manager.d.ts.map +1 -1
- package/dist/cli/config/config-manager.js +0 -29
- package/dist/cli/config/config-manager.js.map +1 -1
- package/dist/cli/config/types.d.ts.map +1 -1
- package/dist/cli/config/types.js +3 -0
- package/dist/cli/config/types.js.map +1 -1
- package/dist/cli/runtime/api-routes-init.d.ts.map +1 -1
- package/dist/cli/runtime/api-routes-init.js +32 -5
- package/dist/cli/runtime/api-routes-init.js.map +1 -1
- package/dist/cli/runtime/api-server-init.d.ts.map +1 -1
- package/dist/cli/runtime/api-server-init.js +2 -0
- package/dist/cli/runtime/api-server-init.js.map +1 -1
- package/dist/cli/runtime/gateway-init.d.ts +1 -1
- package/dist/cli/runtime/gateway-init.d.ts.map +1 -1
- package/dist/cli/runtime/gateway-init.js +11 -38
- package/dist/cli/runtime/gateway-init.js.map +1 -1
- package/dist/cli/runtime/gateway-wiring.d.ts.map +1 -1
- package/dist/cli/runtime/gateway-wiring.js +6 -120
- package/dist/cli/runtime/gateway-wiring.js.map +1 -1
- package/dist/cli/utils/pid-manager.d.ts +0 -10
- package/dist/cli/utils/pid-manager.d.ts.map +1 -1
- package/dist/cli/utils/pid-manager.js +0 -26
- package/dist/cli/utils/pid-manager.js.map +1 -1
- package/dist/connectors/framework/polling-scheduler.d.ts +33 -1
- package/dist/connectors/framework/polling-scheduler.d.ts.map +1 -1
- package/dist/connectors/framework/polling-scheduler.js +46 -40
- package/dist/connectors/framework/polling-scheduler.js.map +1 -1
- package/dist/connectors/trello/query-tools.d.ts +32 -5
- package/dist/connectors/trello/query-tools.d.ts.map +1 -1
- package/dist/connectors/trello/query-tools.js +56 -17
- package/dist/connectors/trello/query-tools.js.map +1 -1
- package/dist/db/agent-store.d.ts +0 -4
- package/dist/db/agent-store.d.ts.map +1 -1
- package/dist/db/agent-store.js +0 -65
- package/dist/db/agent-store.js.map +1 -1
- package/dist/envelope/enforcer.d.ts.map +1 -1
- package/dist/envelope/enforcer.js +10 -1
- package/dist/envelope/enforcer.js.map +1 -1
- package/dist/envelope/index.d.ts +0 -1
- package/dist/envelope/index.d.ts.map +1 -1
- package/dist/envelope/index.js +0 -1
- package/dist/envelope/index.js.map +1 -1
- package/dist/envelope/signature.d.ts +0 -1
- package/dist/envelope/signature.d.ts.map +1 -1
- package/dist/envelope/signature.js +0 -7
- package/dist/envelope/signature.js.map +1 -1
- package/dist/envelope/tool-connector-scope.d.ts +35 -0
- package/dist/envelope/tool-connector-scope.d.ts.map +1 -0
- package/dist/envelope/tool-connector-scope.js +57 -0
- package/dist/envelope/tool-connector-scope.js.map +1 -0
- package/dist/evidence/effects.d.ts +107 -0
- package/dist/evidence/effects.d.ts.map +1 -0
- package/dist/evidence/effects.js +281 -0
- package/dist/evidence/effects.js.map +1 -0
- package/dist/evidence/read.d.ts +75 -0
- package/dist/evidence/read.d.ts.map +1 -0
- package/dist/evidence/read.js +105 -0
- package/dist/evidence/read.js.map +1 -0
- package/dist/gateways/base-gateway.d.ts +23 -3
- package/dist/gateways/base-gateway.d.ts.map +1 -1
- package/dist/gateways/base-gateway.js +15 -2
- package/dist/gateways/base-gateway.js.map +1 -1
- package/dist/gateways/discord.d.ts +4 -16
- package/dist/gateways/discord.d.ts.map +1 -1
- package/dist/gateways/discord.js +22 -189
- package/dist/gateways/discord.js.map +1 -1
- package/dist/gateways/index.d.ts +2 -1
- package/dist/gateways/index.d.ts.map +1 -1
- package/dist/gateways/message-router.d.ts +13 -20
- package/dist/gateways/message-router.d.ts.map +1 -1
- package/dist/gateways/message-router.js +32 -3
- package/dist/gateways/message-router.js.map +1 -1
- package/dist/gateways/slack.d.ts +2 -12
- package/dist/gateways/slack.d.ts.map +1 -1
- package/dist/gateways/slack.js +6 -220
- package/dist/gateways/slack.js.map +1 -1
- package/dist/gateways/telegram.d.ts +2 -2
- package/dist/gateways/telegram.d.ts.map +1 -1
- package/dist/gateways/telegram.js +3 -2
- package/dist/gateways/telegram.js.map +1 -1
- package/dist/gateways/turn-contract.d.ts +104 -0
- package/dist/gateways/turn-contract.d.ts.map +1 -0
- package/dist/{memory/consult-contract.js → gateways/turn-contract.js} +1 -1
- package/dist/gateways/turn-contract.js.map +1 -0
- package/dist/memory/provenance-live.d.ts +111 -0
- package/dist/memory/provenance-live.d.ts.map +1 -0
- package/dist/memory/provenance-live.js +381 -0
- package/dist/memory/provenance-live.js.map +1 -0
- package/dist/memory/provenance-resolver.d.ts +184 -0
- package/dist/memory/provenance-resolver.d.ts.map +1 -0
- package/dist/memory/provenance-resolver.js +152 -0
- package/dist/memory/provenance-resolver.js.map +1 -0
- package/dist/multi-agent/agent-event-bus.d.ts +1 -0
- package/dist/multi-agent/agent-event-bus.d.ts.map +1 -1
- package/dist/multi-agent/bmad-templates.d.ts +0 -18
- package/dist/multi-agent/bmad-templates.d.ts.map +1 -1
- package/dist/multi-agent/bmad-templates.js +0 -127
- package/dist/multi-agent/bmad-templates.js.map +1 -1
- package/dist/multi-agent/dashboard-agent-persona.js +3 -3
- package/dist/operator/board-reconcile.d.ts +2 -3
- package/dist/operator/board-reconcile.d.ts.map +1 -1
- package/dist/operator/board-reconcile.js +18 -32
- package/dist/operator/board-reconcile.js.map +1 -1
- package/dist/operator/changes-projection.d.ts +70 -0
- package/dist/operator/changes-projection.d.ts.map +1 -0
- package/dist/operator/changes-projection.js +109 -0
- package/dist/operator/changes-projection.js.map +1 -0
- package/dist/operator/external-correlation.d.ts +94 -0
- package/dist/operator/external-correlation.d.ts.map +1 -0
- package/dist/operator/external-correlation.js +177 -0
- package/dist/operator/external-correlation.js.map +1 -0
- package/dist/operator/operator-trigger-loop.d.ts +9 -1
- package/dist/operator/operator-trigger-loop.d.ts.map +1 -1
- package/dist/operator/operator-trigger-loop.js +8 -4
- package/dist/operator/operator-trigger-loop.js.map +1 -1
- package/dist/operator/provenance-lookup.d.ts +18 -0
- package/dist/operator/provenance-lookup.d.ts.map +1 -0
- package/dist/operator/provenance-lookup.js +54 -0
- package/dist/operator/provenance-lookup.js.map +1 -0
- package/dist/operator/report-carry.d.ts +18 -1
- package/dist/operator/report-carry.d.ts.map +1 -1
- package/dist/operator/report-carry.js +22 -3
- package/dist/operator/report-carry.js.map +1 -1
- package/dist/operator/report-run.d.ts +31 -0
- package/dist/operator/report-run.d.ts.map +1 -1
- package/dist/operator/report-run.js +140 -22
- package/dist/operator/report-run.js.map +1 -1
- package/dist/operator/task-ledger.d.ts +84 -2
- package/dist/operator/task-ledger.d.ts.map +1 -1
- package/dist/operator/task-ledger.js +274 -31
- package/dist/operator/task-ledger.js.map +1 -1
- package/dist/operator/trigger-author.d.ts +7 -0
- package/dist/operator/trigger-author.d.ts.map +1 -1
- package/dist/operator/trigger-author.js +78 -7
- package/dist/operator/trigger-author.js.map +1 -1
- package/dist/operator/worker-run.js +1 -1
- package/dist/operator/worker-run.js.map +1 -1
- package/dist/operator/workorder-hooks.d.ts +79 -4
- package/dist/operator/workorder-hooks.d.ts.map +1 -1
- package/dist/operator/workorder-hooks.js +152 -20
- package/dist/operator/workorder-hooks.js.map +1 -1
- package/dist/operator/workorder-publishers.d.ts +2 -0
- package/dist/operator/workorder-publishers.d.ts.map +1 -1
- package/dist/operator/workorder-publishers.js +8 -1
- package/dist/operator/workorder-publishers.js.map +1 -1
- package/dist/utils/untrusted-content.d.ts +11 -0
- package/dist/utils/untrusted-content.d.ts.map +1 -1
- package/dist/utils/untrusted-content.js +20 -0
- package/dist/utils/untrusted-content.js.map +1 -1
- package/package.json +4 -3
- package/scripts/backfill-channel-keys.ts +451 -0
- package/dist/agent/auto-recall.d.ts +0 -48
- package/dist/agent/auto-recall.d.ts.map +0 -1
- package/dist/agent/auto-recall.js +0 -192
- package/dist/agent/auto-recall.js.map +0 -1
- package/dist/agent/claude-client.d.ts +0 -50
- package/dist/agent/claude-client.d.ts.map +0 -1
- package/dist/agent/claude-client.js +0 -219
- package/dist/agent/claude-client.js.map +0 -1
- package/dist/agent/delegation-executor.d.ts +0 -49
- package/dist/agent/delegation-executor.d.ts.map +0 -1
- package/dist/agent/delegation-executor.js +0 -692
- package/dist/agent/delegation-executor.js.map +0 -1
- package/dist/agent/mcp-executor.d.ts +0 -60
- package/dist/agent/mcp-executor.d.ts.map +0 -1
- package/dist/agent/mcp-executor.js +0 -190
- package/dist/agent/mcp-executor.js.map +0 -1
- package/dist/agent/process-tree.d.ts +0 -6
- package/dist/agent/process-tree.d.ts.map +0 -1
- package/dist/agent/process-tree.js +0 -21
- package/dist/agent/process-tree.js.map +0 -1
- package/dist/agent/streaming-callback-manager.d.ts +0 -85
- package/dist/agent/streaming-callback-manager.d.ts.map +0 -1
- package/dist/agent/streaming-callback-manager.js +0 -103
- package/dist/agent/streaming-callback-manager.js.map +0 -1
- package/dist/agent/token-budget.d.ts +0 -49
- package/dist/agent/token-budget.d.ts.map +0 -1
- package/dist/agent/token-budget.js +0 -92
- package/dist/agent/token-budget.js.map +0 -1
- package/dist/connectors/kagemusha/history-compiler.d.ts +0 -18
- package/dist/connectors/kagemusha/history-compiler.d.ts.map +0 -1
- package/dist/connectors/kagemusha/history-compiler.js +0 -35
- package/dist/connectors/kagemusha/history-compiler.js.map +0 -1
- package/dist/db/migrations/wiki-artifacts.d.ts +0 -3
- package/dist/db/migrations/wiki-artifacts.d.ts.map +0 -1
- package/dist/db/migrations/wiki-artifacts.js +0 -24
- package/dist/db/migrations/wiki-artifacts.js.map +0 -1
- package/dist/envelope/subset.d.ts +0 -9
- package/dist/envelope/subset.d.ts.map +0 -1
- package/dist/envelope/subset.js +0 -67
- package/dist/envelope/subset.js.map +0 -1
- package/dist/memory/consult-contract.d.ts +0 -8
- package/dist/memory/consult-contract.d.ts.map +0 -1
- package/dist/memory/consult-contract.js.map +0 -1
- package/dist/multi-agent/agent-message-queue.d.ts +0 -104
- package/dist/multi-agent/agent-message-queue.d.ts.map +0 -1
- package/dist/multi-agent/agent-message-queue.js +0 -227
- package/dist/multi-agent/agent-message-queue.js.map +0 -1
- package/dist/multi-agent/background-task-manager.d.ts +0 -248
- package/dist/multi-agent/background-task-manager.d.ts.map +0 -1
- package/dist/multi-agent/background-task-manager.js +0 -415
- package/dist/multi-agent/background-task-manager.js.map +0 -1
- package/dist/multi-agent/category-router.d.ts +0 -56
- package/dist/multi-agent/category-router.d.ts.map +0 -1
- package/dist/multi-agent/category-router.js +0 -99
- package/dist/multi-agent/category-router.js.map +0 -1
- package/dist/multi-agent/council-engine.d.ts +0 -60
- package/dist/multi-agent/council-engine.d.ts.map +0 -1
- package/dist/multi-agent/council-engine.js +0 -284
- package/dist/multi-agent/council-engine.js.map +0 -1
- package/dist/multi-agent/delegation-format-validator.d.ts +0 -22
- package/dist/multi-agent/delegation-format-validator.d.ts.map +0 -1
- package/dist/multi-agent/delegation-format-validator.js +0 -31
- package/dist/multi-agent/delegation-format-validator.js.map +0 -1
- package/dist/multi-agent/delegation-manager.d.ts +0 -128
- package/dist/multi-agent/delegation-manager.d.ts.map +0 -1
- package/dist/multi-agent/delegation-manager.js +0 -276
- package/dist/multi-agent/delegation-manager.js.map +0 -1
- package/dist/multi-agent/i18n-messages.d.ts +0 -35
- package/dist/multi-agent/i18n-messages.d.ts.map +0 -1
- package/dist/multi-agent/i18n-messages.js +0 -54
- package/dist/multi-agent/i18n-messages.js.map +0 -1
- package/dist/multi-agent/index.d.ts +0 -31
- package/dist/multi-agent/index.d.ts.map +0 -1
- package/dist/multi-agent/index.js +0 -46
- package/dist/multi-agent/index.js.map +0 -1
- package/dist/multi-agent/multi-agent-base.d.ts +0 -223
- package/dist/multi-agent/multi-agent-base.d.ts.map +0 -1
- package/dist/multi-agent/multi-agent-base.js +0 -592
- package/dist/multi-agent/multi-agent-base.js.map +0 -1
- package/dist/multi-agent/multi-agent-discord.d.ts +0 -142
- package/dist/multi-agent/multi-agent-discord.d.ts.map +0 -1
- package/dist/multi-agent/multi-agent-discord.js +0 -1235
- package/dist/multi-agent/multi-agent-discord.js.map +0 -1
- package/dist/multi-agent/multi-agent-slack.d.ts +0 -146
- package/dist/multi-agent/multi-agent-slack.d.ts.map +0 -1
- package/dist/multi-agent/multi-agent-slack.js +0 -953
- package/dist/multi-agent/multi-agent-slack.js.map +0 -1
- package/dist/multi-agent/multi-bot-manager.d.ts +0 -119
- package/dist/multi-agent/multi-bot-manager.d.ts.map +0 -1
- package/dist/multi-agent/multi-bot-manager.js +0 -449
- package/dist/multi-agent/multi-bot-manager.js.map +0 -1
- package/dist/multi-agent/orchestrator.d.ts +0 -110
- package/dist/multi-agent/orchestrator.d.ts.map +0 -1
- package/dist/multi-agent/orchestrator.js +0 -436
- package/dist/multi-agent/orchestrator.js.map +0 -1
- package/dist/multi-agent/rate-limiter.d.ts +0 -76
- package/dist/multi-agent/rate-limiter.d.ts.map +0 -1
- package/dist/multi-agent/rate-limiter.js +0 -128
- package/dist/multi-agent/rate-limiter.js.map +0 -1
- package/dist/multi-agent/shared-context.d.ts +0 -127
- package/dist/multi-agent/shared-context.d.ts.map +0 -1
- package/dist/multi-agent/shared-context.js +0 -239
- package/dist/multi-agent/shared-context.js.map +0 -1
- package/dist/multi-agent/slack-config-validator.d.ts +0 -42
- package/dist/multi-agent/slack-config-validator.d.ts.map +0 -1
- package/dist/multi-agent/slack-config-validator.js +0 -194
- package/dist/multi-agent/slack-config-validator.js.map +0 -1
- package/dist/multi-agent/slack-multi-bot-manager.d.ts +0 -143
- package/dist/multi-agent/slack-multi-bot-manager.d.ts.map +0 -1
- package/dist/multi-agent/slack-multi-bot-manager.js +0 -413
- package/dist/multi-agent/slack-multi-bot-manager.js.map +0 -1
- package/dist/multi-agent/swarm/swarm-anti-pattern-detector.d.ts +0 -98
- package/dist/multi-agent/swarm/swarm-anti-pattern-detector.d.ts.map +0 -1
- package/dist/multi-agent/swarm/swarm-anti-pattern-detector.js +0 -225
- package/dist/multi-agent/swarm/swarm-anti-pattern-detector.js.map +0 -1
- package/dist/multi-agent/swarm/swarm-db.d.ts +0 -175
- package/dist/multi-agent/swarm/swarm-db.d.ts.map +0 -1
- package/dist/multi-agent/swarm/swarm-db.js +0 -313
- package/dist/multi-agent/swarm/swarm-db.js.map +0 -1
- package/dist/multi-agent/swarm/swarm-event-reporter.d.ts +0 -116
- package/dist/multi-agent/swarm/swarm-event-reporter.d.ts.map +0 -1
- package/dist/multi-agent/swarm/swarm-event-reporter.js +0 -243
- package/dist/multi-agent/swarm/swarm-event-reporter.js.map +0 -1
- package/dist/multi-agent/swarm/swarm-mama-adapter.d.ts +0 -57
- package/dist/multi-agent/swarm/swarm-mama-adapter.d.ts.map +0 -1
- package/dist/multi-agent/swarm/swarm-mama-adapter.js +0 -87
- package/dist/multi-agent/swarm/swarm-mama-adapter.js.map +0 -1
- package/dist/multi-agent/swarm/swarm-manager.d.ts +0 -122
- package/dist/multi-agent/swarm/swarm-manager.d.ts.map +0 -1
- package/dist/multi-agent/swarm/swarm-manager.js +0 -199
- package/dist/multi-agent/swarm/swarm-manager.js.map +0 -1
- package/dist/multi-agent/swarm/swarm-task-learner.d.ts +0 -104
- package/dist/multi-agent/swarm/swarm-task-learner.d.ts.map +0 -1
- package/dist/multi-agent/swarm/swarm-task-learner.js +0 -211
- package/dist/multi-agent/swarm/swarm-task-learner.js.map +0 -1
- package/dist/multi-agent/swarm/swarm-task-runner.d.ts +0 -155
- package/dist/multi-agent/swarm/swarm-task-runner.d.ts.map +0 -1
- package/dist/multi-agent/swarm/swarm-task-runner.js +0 -615
- package/dist/multi-agent/swarm/swarm-task-runner.js.map +0 -1
- package/dist/multi-agent/swarm/wave-engine.d.ts +0 -96
- package/dist/multi-agent/swarm/wave-engine.d.ts.map +0 -1
- package/dist/multi-agent/swarm/wave-engine.js +0 -123
- package/dist/multi-agent/swarm/wave-engine.js.map +0 -1
- package/dist/multi-agent/system-reminder.d.ts +0 -206
- package/dist/multi-agent/system-reminder.d.ts.map +0 -1
- package/dist/multi-agent/system-reminder.js +0 -455
- package/dist/multi-agent/system-reminder.js.map +0 -1
- package/dist/multi-agent/task-continuation.d.ts +0 -74
- package/dist/multi-agent/task-continuation.d.ts.map +0 -1
- package/dist/multi-agent/task-continuation.js +0 -172
- package/dist/multi-agent/task-continuation.js.map +0 -1
- package/dist/multi-agent/ultrawork-state.d.ts +0 -57
- package/dist/multi-agent/ultrawork-state.d.ts.map +0 -1
- package/dist/multi-agent/ultrawork-state.js +0 -191
- package/dist/multi-agent/ultrawork-state.js.map +0 -1
- package/dist/multi-agent/ultrawork.d.ts +0 -152
- package/dist/multi-agent/ultrawork.d.ts.map +0 -1
- package/dist/multi-agent/ultrawork.js +0 -879
- package/dist/multi-agent/ultrawork.js.map +0 -1
- package/dist/multi-agent/work-tracker.d.ts +0 -22
- package/dist/multi-agent/work-tracker.d.ts.map +0 -1
- package/dist/multi-agent/work-tracker.js +0 -45
- package/dist/multi-agent/work-tracker.js.map +0 -1
- package/dist/multi-agent/workflow-engine.d.ts +0 -87
- package/dist/multi-agent/workflow-engine.d.ts.map +0 -1
- package/dist/multi-agent/workflow-engine.js +0 -604
- package/dist/multi-agent/workflow-engine.js.map +0 -1
- package/dist/onboarding/all-tools.d.ts +0 -18
- package/dist/onboarding/all-tools.d.ts.map +0 -1
- package/dist/onboarding/all-tools.js +0 -149
- package/dist/onboarding/all-tools.js.map +0 -1
- package/dist/onboarding/autonomous-discovery-tools.d.ts +0 -23
- package/dist/onboarding/autonomous-discovery-tools.d.ts.map +0 -1
- package/dist/onboarding/autonomous-discovery-tools.js +0 -268
- package/dist/onboarding/autonomous-discovery-tools.js.map +0 -1
- package/dist/onboarding/onboarding-state.d.ts +0 -70
- package/dist/onboarding/onboarding-state.d.ts.map +0 -1
- package/dist/onboarding/onboarding-state.js +0 -183
- package/dist/onboarding/onboarding-state.js.map +0 -1
- package/dist/onboarding/personality-quiz.d.ts +0 -35
- package/dist/onboarding/personality-quiz.d.ts.map +0 -1
- package/dist/onboarding/personality-quiz.js +0 -219
- package/dist/onboarding/personality-quiz.js.map +0 -1
- package/dist/onboarding/phase-5-summary.d.ts +0 -26
- package/dist/onboarding/phase-5-summary.d.ts.map +0 -1
- package/dist/onboarding/phase-5-summary.js +0 -153
- package/dist/onboarding/phase-5-summary.js.map +0 -1
- package/dist/onboarding/phase-6-security.d.ts +0 -33
- package/dist/onboarding/phase-6-security.d.ts.map +0 -1
- package/dist/onboarding/phase-6-security.js +0 -473
- package/dist/onboarding/phase-6-security.js.map +0 -1
- package/dist/onboarding/phase-7-integrations.d.ts +0 -91
- package/dist/onboarding/phase-7-integrations.d.ts.map +0 -1
- package/dist/onboarding/phase-7-integrations.js +0 -725
- package/dist/onboarding/phase-7-integrations.js.map +0 -1
- package/dist/onboarding/phase-8-demo.d.ts +0 -43
- package/dist/onboarding/phase-8-demo.d.ts.map +0 -1
- package/dist/onboarding/phase-8-demo.js +0 -346
- package/dist/onboarding/phase-8-demo.js.map +0 -1
- package/dist/onboarding/phase-9-finalization.d.ts +0 -27
- package/dist/onboarding/phase-9-finalization.d.ts.map +0 -1
- package/dist/onboarding/phase-9-finalization.js +0 -417
- package/dist/onboarding/phase-9-finalization.js.map +0 -1
- package/dist/onboarding/ritual-prompt.d.ts +0 -2
- package/dist/onboarding/ritual-prompt.d.ts.map +0 -1
- package/dist/onboarding/ritual-prompt.js +0 -285
- package/dist/onboarding/ritual-prompt.js.map +0 -1
- package/dist/onboarding/ritual-tools.d.ts +0 -17
- package/dist/onboarding/ritual-tools.d.ts.map +0 -1
- package/dist/onboarding/ritual-tools.js +0 -93
- package/dist/onboarding/ritual-tools.js.map +0 -1
- package/dist/setup/setup-tools.d.ts +0 -13
- package/dist/setup/setup-tools.d.ts.map +0 -1
- package/dist/setup/setup-tools.js +0 -106
- package/dist/setup/setup-tools.js.map +0 -1
- package/dist/utils/slack-input-validator.d.ts +0 -74
- package/dist/utils/slack-input-validator.d.ts.map +0 -1
- package/dist/utils/slack-input-validator.js +0 -275
- package/dist/utils/slack-input-validator.js.map +0 -1
- package/dist/utils/slack-rate-limiter.d.ts +0 -139
- package/dist/utils/slack-rate-limiter.d.ts.map +0 -1
- package/dist/utils/slack-rate-limiter.js +0 -324
- package/dist/utils/slack-rate-limiter.js.map +0 -1
- package/dist/wiki/wiki-compiler.d.ts +0 -13
- package/dist/wiki/wiki-compiler.d.ts.map +0 -1
- package/dist/wiki/wiki-compiler.js +0 -82
- package/dist/wiki/wiki-compiler.js.map +0 -1
|
@@ -1,692 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.DelegationExecutor = void 0;
|
|
37
|
-
const fs_1 = require("fs");
|
|
38
|
-
const os_1 = require("os");
|
|
39
|
-
const path_1 = require("path");
|
|
40
|
-
const debugLogger = __importStar(require("@jungjaehoon/mama-core/debug-logger"));
|
|
41
|
-
const agent_store_js_1 = require("../db/agent-store.js");
|
|
42
|
-
const { DebugLogger } = debugLogger;
|
|
43
|
-
const securityLogger = new DebugLogger('SecurityAudit');
|
|
44
|
-
const AGENT_TEST_WORKER_LIMIT = 3;
|
|
45
|
-
const DELEGATE_MAX_RETRIES = 3;
|
|
46
|
-
function summarizeActivityOutput(output) {
|
|
47
|
-
if (output === undefined || output === null) {
|
|
48
|
-
return undefined;
|
|
49
|
-
}
|
|
50
|
-
if (typeof output === 'string') {
|
|
51
|
-
return output.slice(0, 500);
|
|
52
|
-
}
|
|
53
|
-
try {
|
|
54
|
-
return JSON.stringify(output).slice(0, 500);
|
|
55
|
-
}
|
|
56
|
-
catch {
|
|
57
|
-
return String(output).slice(0, 500);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
function resolveSkillPath(skillName) {
|
|
61
|
-
if (!/^[a-zA-Z0-9_-]+$/.test(skillName)) {
|
|
62
|
-
return null;
|
|
63
|
-
}
|
|
64
|
-
const skillsDir = (0, path_1.join)((0, os_1.homedir)(), '.mama', 'skills');
|
|
65
|
-
const resolved = (0, path_1.resolve)(skillsDir, `${skillName}.md`);
|
|
66
|
-
if (!resolved.startsWith(skillsDir)) {
|
|
67
|
-
return null;
|
|
68
|
-
}
|
|
69
|
-
return resolved;
|
|
70
|
-
}
|
|
71
|
-
function requireRoutingField(routing, field) {
|
|
72
|
-
const value = routing?.[field];
|
|
73
|
-
if (typeof value !== 'string' || value.trim() === '') {
|
|
74
|
-
throw new Error(`[delegation] missing routing.${field}`);
|
|
75
|
-
}
|
|
76
|
-
return value;
|
|
77
|
-
}
|
|
78
|
-
function requireRouting(routing) {
|
|
79
|
-
const input = routing;
|
|
80
|
-
return {
|
|
81
|
-
agentId: requireRoutingField(input, 'agentId'),
|
|
82
|
-
source: requireRoutingField(input, 'source'),
|
|
83
|
-
channelId: requireRoutingField(input, 'channelId'),
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
class DelegationExecutor {
|
|
87
|
-
deps;
|
|
88
|
-
testInFlight = new Map();
|
|
89
|
-
constructor(deps) {
|
|
90
|
-
this.deps = deps;
|
|
91
|
-
}
|
|
92
|
-
async runAgentTest(input, routing) {
|
|
93
|
-
const permError = this.deps.checkViewerOnly();
|
|
94
|
-
if (permError) {
|
|
95
|
-
return { success: false, error: permError };
|
|
96
|
-
}
|
|
97
|
-
const { agent_id } = input;
|
|
98
|
-
const sample_count = Number.parseInt(String(input.sample_count ?? 2), 10);
|
|
99
|
-
const resolvedAgentId = this.deps.resolveManagedAgentId(agent_id);
|
|
100
|
-
if (!Number.isFinite(sample_count) || sample_count < 1) {
|
|
101
|
-
securityLogger.warn('[Agent test] Invalid sample_count received', {
|
|
102
|
-
agent_id: resolvedAgentId,
|
|
103
|
-
sample_count: input.sample_count ?? null,
|
|
104
|
-
});
|
|
105
|
-
return {
|
|
106
|
-
success: false,
|
|
107
|
-
error: `Invalid sample_count for '${resolvedAgentId}': ${String(input.sample_count)}. Must be >= 1.`,
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
if (this.testInFlight.has(resolvedAgentId)) {
|
|
111
|
-
return { success: false, error: 'test_already_running' };
|
|
112
|
-
}
|
|
113
|
-
const promise = this.runAgentTestInternal(resolvedAgentId, sample_count, routing, input.test_data);
|
|
114
|
-
this.testInFlight.set(resolvedAgentId, promise);
|
|
115
|
-
try {
|
|
116
|
-
return await promise;
|
|
117
|
-
}
|
|
118
|
-
finally {
|
|
119
|
-
this.testInFlight.delete(resolvedAgentId);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
async runDelegate(input, routing) {
|
|
123
|
-
return this.runDelegateInternal(input, routing);
|
|
124
|
-
}
|
|
125
|
-
cleanupValidationSessionOnTelemetryFailure(session, error, label) {
|
|
126
|
-
if (!session || !this.deps.validationService) {
|
|
127
|
-
return null;
|
|
128
|
-
}
|
|
129
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
130
|
-
try {
|
|
131
|
-
this.deps.validationService.finalizeSession(session.id, {
|
|
132
|
-
execution_status: 'failed',
|
|
133
|
-
error_message: `${label}: ${message}`,
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
catch (cleanupErr) {
|
|
137
|
-
securityLogger.warn(`[Delegation telemetry] Failed to clean up validation session ${session.id}`, cleanupErr);
|
|
138
|
-
}
|
|
139
|
-
return null;
|
|
140
|
-
}
|
|
141
|
-
async runAgentTestInternal(agentId, sampleCount, routing, testData) {
|
|
142
|
-
const processManager = this.deps.agentProcessManager;
|
|
143
|
-
const delegationManager = this.deps.delegationManagerRef;
|
|
144
|
-
if (!processManager || !delegationManager) {
|
|
145
|
-
return {
|
|
146
|
-
success: false,
|
|
147
|
-
error: 'agent_timeout: multi-agent not configured',
|
|
148
|
-
};
|
|
149
|
-
}
|
|
150
|
-
const startTime = Date.now();
|
|
151
|
-
let items;
|
|
152
|
-
if (testData && testData.length > 0) {
|
|
153
|
-
const normalizedItems = [];
|
|
154
|
-
for (let index = 0; index < testData.length; index++) {
|
|
155
|
-
const rawItem = testData[index];
|
|
156
|
-
if (typeof rawItem.input !== 'string') {
|
|
157
|
-
return {
|
|
158
|
-
success: false,
|
|
159
|
-
error: `Invalid test_data[${index}].input: expected string`,
|
|
160
|
-
};
|
|
161
|
-
}
|
|
162
|
-
if (rawItem.expected !== undefined && typeof rawItem.expected !== 'string') {
|
|
163
|
-
return {
|
|
164
|
-
success: false,
|
|
165
|
-
error: `Invalid test_data[${index}].expected: expected string`,
|
|
166
|
-
};
|
|
167
|
-
}
|
|
168
|
-
normalizedItems.push({
|
|
169
|
-
input: rawItem.input,
|
|
170
|
-
...(typeof rawItem.expected === 'string' ? { expected: rawItem.expected } : {}),
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
items = normalizedItems;
|
|
174
|
-
}
|
|
175
|
-
else if (this.deps.rawStore) {
|
|
176
|
-
const agentConfig = delegationManager.getAgentConfig(agentId);
|
|
177
|
-
const connectors = agentConfig?.connectors ?? [];
|
|
178
|
-
if (connectors.length === 0) {
|
|
179
|
-
return {
|
|
180
|
-
success: false,
|
|
181
|
-
error: 'connector_unavailable: no connectors configured',
|
|
182
|
-
};
|
|
183
|
-
}
|
|
184
|
-
const allItems = [];
|
|
185
|
-
const missingConnectors = [];
|
|
186
|
-
for (const conn of connectors) {
|
|
187
|
-
if (!this.deps.rawStore.hasConnector(conn)) {
|
|
188
|
-
missingConnectors.push(conn);
|
|
189
|
-
continue;
|
|
190
|
-
}
|
|
191
|
-
const recent = this.deps.rawStore.getRecent(conn, sampleCount);
|
|
192
|
-
for (const item of recent) {
|
|
193
|
-
allItems.push({ input: `[${item.type}] ${item.content}` });
|
|
194
|
-
}
|
|
195
|
-
if (allItems.length >= sampleCount) {
|
|
196
|
-
break;
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
if (allItems.length === 0) {
|
|
200
|
-
const detail = missingConnectors.length > 0
|
|
201
|
-
? `connector(s) not found: ${missingConnectors.join(', ')}`
|
|
202
|
-
: 'no recent data';
|
|
203
|
-
return {
|
|
204
|
-
success: false,
|
|
205
|
-
error: `connector_unavailable: ${detail}`,
|
|
206
|
-
};
|
|
207
|
-
}
|
|
208
|
-
items = allItems.slice(0, sampleCount);
|
|
209
|
-
}
|
|
210
|
-
else {
|
|
211
|
-
return {
|
|
212
|
-
success: false,
|
|
213
|
-
error: 'connector_unavailable: rawStore not available',
|
|
214
|
-
};
|
|
215
|
-
}
|
|
216
|
-
const testVer = this.deps.sessionsDb ? (0, agent_store_js_1.getLatestVersion)(this.deps.sessionsDb, agentId) : null;
|
|
217
|
-
const testAgentVersion = testVer?.version ?? 0;
|
|
218
|
-
let testValSession = null;
|
|
219
|
-
try {
|
|
220
|
-
testValSession =
|
|
221
|
-
this.deps.validationService?.startSession(agentId, testAgentVersion, 'agent_test', {
|
|
222
|
-
goal: `Test with ${items.length} items`,
|
|
223
|
-
customBeforeSnapshot: JSON.stringify({
|
|
224
|
-
schema_version: 1,
|
|
225
|
-
test_input_summary: items.map((i) => i.input.slice(0, 80)).join('; '),
|
|
226
|
-
sample_count: items.length,
|
|
227
|
-
}),
|
|
228
|
-
}) ?? null;
|
|
229
|
-
}
|
|
230
|
-
catch (telemetryErr) {
|
|
231
|
-
securityLogger.warn('[Agent test telemetry] Failed to start validation session', {
|
|
232
|
-
agentId,
|
|
233
|
-
testAgentVersion,
|
|
234
|
-
error: telemetryErr instanceof Error ? telemetryErr.message : String(telemetryErr),
|
|
235
|
-
});
|
|
236
|
-
}
|
|
237
|
-
let testRunId = null;
|
|
238
|
-
if (this.deps.sessionsDb) {
|
|
239
|
-
try {
|
|
240
|
-
const row = (0, agent_store_js_1.logActivity)(this.deps.sessionsDb, {
|
|
241
|
-
agent_id: agentId,
|
|
242
|
-
agent_version: testAgentVersion,
|
|
243
|
-
type: 'test_run',
|
|
244
|
-
input_summary: `Testing with ${items.length} items`,
|
|
245
|
-
run_id: testValSession?.id,
|
|
246
|
-
execution_status: 'started',
|
|
247
|
-
trigger_reason: 'agent_test',
|
|
248
|
-
});
|
|
249
|
-
testRunId = row.id;
|
|
250
|
-
if (testValSession && this.deps.validationService) {
|
|
251
|
-
this.deps.validationService.recordRun(testValSession.id, { activityId: row.id });
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
catch (telemetryErr) {
|
|
255
|
-
securityLogger.warn('[Agent test telemetry] Failed to persist startup activity', {
|
|
256
|
-
agentId,
|
|
257
|
-
testValSessionId: testValSession?.id ?? null,
|
|
258
|
-
error: telemetryErr instanceof Error ? telemetryErr.message : String(telemetryErr),
|
|
259
|
-
});
|
|
260
|
-
testValSession = this.cleanupValidationSessionOnTelemetryFailure(testValSession, telemetryErr, 'agent_test startup telemetry failed');
|
|
261
|
-
testRunId = null;
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
const results = [];
|
|
265
|
-
const workerCount = Math.min(AGENT_TEST_WORKER_LIMIT, items.length);
|
|
266
|
-
let nextIndex = 0;
|
|
267
|
-
const workers = Array.from({ length: workerCount }, async () => {
|
|
268
|
-
for (;;) {
|
|
269
|
-
const currentIndex = nextIndex;
|
|
270
|
-
nextIndex++;
|
|
271
|
-
if (currentIndex >= items.length) {
|
|
272
|
-
return;
|
|
273
|
-
}
|
|
274
|
-
const item = items[currentIndex];
|
|
275
|
-
try {
|
|
276
|
-
const r = await this.runDelegateInternal({
|
|
277
|
-
agentId,
|
|
278
|
-
task: `Process this data:\n${item.input}`,
|
|
279
|
-
}, routing);
|
|
280
|
-
const rAny = r;
|
|
281
|
-
const output = r.success
|
|
282
|
-
? String(rAny.data?.response ?? '')
|
|
283
|
-
: undefined;
|
|
284
|
-
results[currentIndex] = {
|
|
285
|
-
input: item.input,
|
|
286
|
-
output,
|
|
287
|
-
error: r.success ? undefined : String(rAny.error ?? 'unknown'),
|
|
288
|
-
};
|
|
289
|
-
}
|
|
290
|
-
catch (err) {
|
|
291
|
-
results[currentIndex] = { input: item.input, error: String(err) };
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
});
|
|
295
|
-
await Promise.all(workers);
|
|
296
|
-
const passed = results.filter((r, index) => {
|
|
297
|
-
if (r.error) {
|
|
298
|
-
return false;
|
|
299
|
-
}
|
|
300
|
-
const expected = items[index]?.expected;
|
|
301
|
-
if (expected === undefined) {
|
|
302
|
-
return true;
|
|
303
|
-
}
|
|
304
|
-
return (r.output ?? '').trim() === expected.trim();
|
|
305
|
-
}).length;
|
|
306
|
-
const failed = results.length - passed;
|
|
307
|
-
const autoScore = results.length > 0 ? Math.round((passed / results.length) * 100) : 0;
|
|
308
|
-
if (this.deps.sessionsDb && testRunId) {
|
|
309
|
-
try {
|
|
310
|
-
(0, agent_store_js_1.updateActivityScore)(this.deps.sessionsDb, testRunId, autoScore, {
|
|
311
|
-
total: results.length,
|
|
312
|
-
passed,
|
|
313
|
-
failed,
|
|
314
|
-
items: results.map((r, index) => ({
|
|
315
|
-
input: r.input.slice(0, 100),
|
|
316
|
-
result: r.error ||
|
|
317
|
-
(items[index]?.expected !== undefined &&
|
|
318
|
-
(r.output ?? '').trim() !== items[index].expected.trim())
|
|
319
|
-
? 'fail'
|
|
320
|
-
: 'pass',
|
|
321
|
-
})),
|
|
322
|
-
}, 'completed');
|
|
323
|
-
}
|
|
324
|
-
catch (telemetryErr) {
|
|
325
|
-
securityLogger.warn('[Agent test telemetry] Failed to persist test score', {
|
|
326
|
-
agentId,
|
|
327
|
-
testRunId,
|
|
328
|
-
autoScore,
|
|
329
|
-
totalResults: results.length,
|
|
330
|
-
error: telemetryErr instanceof Error ? telemetryErr.message : String(telemetryErr),
|
|
331
|
-
});
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
const testDurationMs = Date.now() - startTime;
|
|
335
|
-
if (testValSession && this.deps.validationService) {
|
|
336
|
-
try {
|
|
337
|
-
this.deps.validationService.finalizeSession(testValSession.id, {
|
|
338
|
-
execution_status: 'completed',
|
|
339
|
-
metrics: {
|
|
340
|
-
duration_ms: testDurationMs,
|
|
341
|
-
completion_rate: results.length > 0 ? passed / results.length : 0,
|
|
342
|
-
auto_score: autoScore,
|
|
343
|
-
},
|
|
344
|
-
test_input_summary: items.map((i) => i.input.slice(0, 80)).join('; '),
|
|
345
|
-
});
|
|
346
|
-
}
|
|
347
|
-
catch (telemetryErr) {
|
|
348
|
-
securityLogger.warn('[Agent test telemetry] Failed to finalize validation session', {
|
|
349
|
-
agentId,
|
|
350
|
-
testValSessionId: testValSession.id,
|
|
351
|
-
autoScore,
|
|
352
|
-
totalResults: results.length,
|
|
353
|
-
error: telemetryErr instanceof Error ? telemetryErr.message : String(telemetryErr),
|
|
354
|
-
});
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
return {
|
|
358
|
-
success: true,
|
|
359
|
-
data: {
|
|
360
|
-
test_run_id: testRunId,
|
|
361
|
-
agent_id: agentId,
|
|
362
|
-
results,
|
|
363
|
-
auto_score: autoScore,
|
|
364
|
-
duration_ms: testDurationMs,
|
|
365
|
-
validation_session_id: testValSession?.id ?? null,
|
|
366
|
-
...(testRunId === null ? { warning: 'score_not_persisted' } : {}),
|
|
367
|
-
},
|
|
368
|
-
};
|
|
369
|
-
}
|
|
370
|
-
async runDelegateInternal(input, routing) {
|
|
371
|
-
const { task, background } = input;
|
|
372
|
-
const agentId = this.deps.resolveManagedAgentId(input.agentId);
|
|
373
|
-
const processManager = this.deps.agentProcessManager;
|
|
374
|
-
const delegationManager = this.deps.delegationManagerRef;
|
|
375
|
-
if (!processManager || !delegationManager) {
|
|
376
|
-
return { success: false, error: 'Multi-agent not configured' };
|
|
377
|
-
}
|
|
378
|
-
const { agentId: sourceAgentId, source, channelId } = requireRouting(routing);
|
|
379
|
-
const check = delegationManager.isDelegationAllowed(sourceAgentId, agentId);
|
|
380
|
-
if (!check.allowed) {
|
|
381
|
-
return {
|
|
382
|
-
success: false,
|
|
383
|
-
error: `Delegation denied: ${check.reason}`,
|
|
384
|
-
};
|
|
385
|
-
}
|
|
386
|
-
if (background) {
|
|
387
|
-
let bgAgentVersion = 0;
|
|
388
|
-
let bgValSession = null;
|
|
389
|
-
try {
|
|
390
|
-
const bgVer = this.deps.sessionsDb ? (0, agent_store_js_1.getLatestVersion)(this.deps.sessionsDb, agentId) : null;
|
|
391
|
-
bgAgentVersion = bgVer?.version ?? 0;
|
|
392
|
-
bgValSession =
|
|
393
|
-
this.deps.validationService?.startSession(agentId, bgAgentVersion, 'delegate_run') ??
|
|
394
|
-
null;
|
|
395
|
-
if (this.deps.sessionsDb) {
|
|
396
|
-
const row = (0, agent_store_js_1.logActivity)(this.deps.sessionsDb, {
|
|
397
|
-
agent_id: agentId,
|
|
398
|
-
agent_version: bgAgentVersion,
|
|
399
|
-
type: 'task_start',
|
|
400
|
-
input_summary: task?.slice(0, 200),
|
|
401
|
-
run_id: bgValSession?.id,
|
|
402
|
-
execution_status: 'started',
|
|
403
|
-
trigger_reason: 'delegate_run',
|
|
404
|
-
});
|
|
405
|
-
if (bgValSession && this.deps.validationService) {
|
|
406
|
-
this.deps.validationService.recordRun(bgValSession.id, { activityId: row.id });
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
catch (telemetryErr) {
|
|
411
|
-
securityLogger.warn('[Delegation telemetry] Background bootstrap failed', telemetryErr);
|
|
412
|
-
bgAgentVersion = 0;
|
|
413
|
-
bgValSession = this.cleanupValidationSessionOnTelemetryFailure(bgValSession, telemetryErr, 'background delegate bootstrap failed');
|
|
414
|
-
}
|
|
415
|
-
const bgStartTime = Date.now();
|
|
416
|
-
void (async () => {
|
|
417
|
-
try {
|
|
418
|
-
const result = await this.sendDelegationMessageWithRetry({
|
|
419
|
-
processManager,
|
|
420
|
-
delegationManager,
|
|
421
|
-
source,
|
|
422
|
-
channelId,
|
|
423
|
-
agentId,
|
|
424
|
-
sourceAgentId,
|
|
425
|
-
task,
|
|
426
|
-
skill: input.skill,
|
|
427
|
-
});
|
|
428
|
-
const durationMs = Date.now() - bgStartTime;
|
|
429
|
-
try {
|
|
430
|
-
if (this.deps.sessionsDb) {
|
|
431
|
-
const row = (0, agent_store_js_1.logActivity)(this.deps.sessionsDb, {
|
|
432
|
-
agent_id: agentId,
|
|
433
|
-
agent_version: bgAgentVersion,
|
|
434
|
-
type: 'task_complete',
|
|
435
|
-
input_summary: task?.slice(0, 200),
|
|
436
|
-
output_summary: summarizeActivityOutput(result?.response),
|
|
437
|
-
duration_ms: durationMs,
|
|
438
|
-
run_id: bgValSession?.id,
|
|
439
|
-
execution_status: 'completed',
|
|
440
|
-
trigger_reason: 'delegate_run',
|
|
441
|
-
});
|
|
442
|
-
if (bgValSession && this.deps.validationService) {
|
|
443
|
-
this.deps.validationService.recordRun(bgValSession.id, {
|
|
444
|
-
activityId: row.id,
|
|
445
|
-
duration_ms: durationMs,
|
|
446
|
-
});
|
|
447
|
-
}
|
|
448
|
-
}
|
|
449
|
-
}
|
|
450
|
-
catch (telemetryErr) {
|
|
451
|
-
securityLogger.warn('[Delegation telemetry] Background completion activity failed', telemetryErr);
|
|
452
|
-
}
|
|
453
|
-
try {
|
|
454
|
-
if (bgValSession && this.deps.validationService) {
|
|
455
|
-
this.deps.validationService.finalizeSession(bgValSession.id, {
|
|
456
|
-
execution_status: 'completed',
|
|
457
|
-
metrics: { duration_ms: durationMs },
|
|
458
|
-
});
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
catch (telemetryErr) {
|
|
462
|
-
securityLogger.warn('[Delegation telemetry] Background completion finalize failed', telemetryErr);
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
catch (err) {
|
|
466
|
-
const durationMs = Date.now() - bgStartTime;
|
|
467
|
-
try {
|
|
468
|
-
if (this.deps.sessionsDb) {
|
|
469
|
-
const row = (0, agent_store_js_1.logActivity)(this.deps.sessionsDb, {
|
|
470
|
-
agent_id: agentId,
|
|
471
|
-
agent_version: bgAgentVersion,
|
|
472
|
-
type: 'task_error',
|
|
473
|
-
input_summary: task?.slice(0, 200),
|
|
474
|
-
error_message: String(err),
|
|
475
|
-
duration_ms: durationMs,
|
|
476
|
-
run_id: bgValSession?.id,
|
|
477
|
-
execution_status: 'failed',
|
|
478
|
-
trigger_reason: 'delegate_run',
|
|
479
|
-
});
|
|
480
|
-
if (bgValSession && this.deps.validationService) {
|
|
481
|
-
this.deps.validationService.recordRun(bgValSession.id, {
|
|
482
|
-
activityId: row.id,
|
|
483
|
-
duration_ms: durationMs,
|
|
484
|
-
});
|
|
485
|
-
}
|
|
486
|
-
}
|
|
487
|
-
}
|
|
488
|
-
catch (telemetryErr) {
|
|
489
|
-
securityLogger.warn('[Delegation telemetry] Background failure activity failed', telemetryErr);
|
|
490
|
-
}
|
|
491
|
-
try {
|
|
492
|
-
if (bgValSession && this.deps.validationService) {
|
|
493
|
-
this.deps.validationService.finalizeSession(bgValSession.id, {
|
|
494
|
-
execution_status: 'failed',
|
|
495
|
-
error_message: String(err),
|
|
496
|
-
metrics: { duration_ms: durationMs },
|
|
497
|
-
});
|
|
498
|
-
}
|
|
499
|
-
}
|
|
500
|
-
catch (telemetryErr) {
|
|
501
|
-
securityLogger.warn('[Delegation telemetry] Background failure finalize failed', telemetryErr);
|
|
502
|
-
}
|
|
503
|
-
}
|
|
504
|
-
})();
|
|
505
|
-
return {
|
|
506
|
-
success: true,
|
|
507
|
-
data: { agentId, background: true, message: 'Background task submitted' },
|
|
508
|
-
};
|
|
509
|
-
}
|
|
510
|
-
const startTime = Date.now();
|
|
511
|
-
let agentVersion = 0;
|
|
512
|
-
let valSession = null;
|
|
513
|
-
try {
|
|
514
|
-
const ver = this.deps.sessionsDb ? (0, agent_store_js_1.getLatestVersion)(this.deps.sessionsDb, agentId) : null;
|
|
515
|
-
agentVersion = ver?.version ?? 0;
|
|
516
|
-
valSession =
|
|
517
|
-
this.deps.validationService?.startSession(agentId, agentVersion, 'delegate_run') ?? null;
|
|
518
|
-
if (this.deps.sessionsDb) {
|
|
519
|
-
const row = (0, agent_store_js_1.logActivity)(this.deps.sessionsDb, {
|
|
520
|
-
agent_id: agentId,
|
|
521
|
-
agent_version: agentVersion,
|
|
522
|
-
type: 'task_start',
|
|
523
|
-
input_summary: task?.slice(0, 200),
|
|
524
|
-
run_id: valSession?.id,
|
|
525
|
-
execution_status: 'started',
|
|
526
|
-
trigger_reason: 'delegate_run',
|
|
527
|
-
});
|
|
528
|
-
if (valSession && this.deps.validationService) {
|
|
529
|
-
this.deps.validationService.recordRun(valSession.id, { activityId: row.id });
|
|
530
|
-
}
|
|
531
|
-
}
|
|
532
|
-
}
|
|
533
|
-
catch (telemetryErr) {
|
|
534
|
-
securityLogger.warn('[Delegation telemetry] Validation bootstrap failed', telemetryErr);
|
|
535
|
-
agentVersion = 0;
|
|
536
|
-
valSession = this.cleanupValidationSessionOnTelemetryFailure(valSession, telemetryErr, 'delegate bootstrap failed');
|
|
537
|
-
}
|
|
538
|
-
try {
|
|
539
|
-
const result = await this.sendDelegationMessageWithRetry({
|
|
540
|
-
processManager,
|
|
541
|
-
delegationManager,
|
|
542
|
-
source,
|
|
543
|
-
channelId,
|
|
544
|
-
agentId,
|
|
545
|
-
sourceAgentId,
|
|
546
|
-
task,
|
|
547
|
-
skill: input.skill,
|
|
548
|
-
});
|
|
549
|
-
const durationMs = Date.now() - startTime;
|
|
550
|
-
try {
|
|
551
|
-
if (this.deps.sessionsDb) {
|
|
552
|
-
const row = (0, agent_store_js_1.logActivity)(this.deps.sessionsDb, {
|
|
553
|
-
agent_id: agentId,
|
|
554
|
-
agent_version: agentVersion,
|
|
555
|
-
type: 'task_complete',
|
|
556
|
-
input_summary: task?.slice(0, 200),
|
|
557
|
-
output_summary: summarizeActivityOutput(result.response),
|
|
558
|
-
duration_ms: durationMs,
|
|
559
|
-
run_id: valSession?.id,
|
|
560
|
-
execution_status: 'completed',
|
|
561
|
-
trigger_reason: 'delegate_run',
|
|
562
|
-
});
|
|
563
|
-
if (valSession && this.deps.validationService) {
|
|
564
|
-
this.deps.validationService.recordRun(valSession.id, {
|
|
565
|
-
activityId: row.id,
|
|
566
|
-
duration_ms: durationMs,
|
|
567
|
-
});
|
|
568
|
-
}
|
|
569
|
-
}
|
|
570
|
-
}
|
|
571
|
-
catch (telemetryErr) {
|
|
572
|
-
securityLogger.warn('[Delegation telemetry] Completion activity failed', telemetryErr);
|
|
573
|
-
}
|
|
574
|
-
try {
|
|
575
|
-
if (valSession && this.deps.validationService) {
|
|
576
|
-
this.deps.validationService.finalizeSession(valSession.id, {
|
|
577
|
-
execution_status: 'completed',
|
|
578
|
-
metrics: { duration_ms: durationMs },
|
|
579
|
-
});
|
|
580
|
-
}
|
|
581
|
-
}
|
|
582
|
-
catch (telemetryErr) {
|
|
583
|
-
securityLogger.warn('[Delegation telemetry] Completion finalize failed', telemetryErr);
|
|
584
|
-
}
|
|
585
|
-
return {
|
|
586
|
-
success: true,
|
|
587
|
-
data: { agentId, response: result.response, duration_ms: durationMs },
|
|
588
|
-
};
|
|
589
|
-
}
|
|
590
|
-
catch (err) {
|
|
591
|
-
const lastError = err instanceof Error ? err : new Error(String(err));
|
|
592
|
-
const failedDurationMs = Date.now() - startTime;
|
|
593
|
-
try {
|
|
594
|
-
if (this.deps.sessionsDb) {
|
|
595
|
-
const row = (0, agent_store_js_1.logActivity)(this.deps.sessionsDb, {
|
|
596
|
-
agent_id: agentId,
|
|
597
|
-
agent_version: agentVersion,
|
|
598
|
-
type: 'task_error',
|
|
599
|
-
input_summary: task?.slice(0, 200),
|
|
600
|
-
error_message: lastError.message,
|
|
601
|
-
duration_ms: failedDurationMs,
|
|
602
|
-
run_id: valSession?.id,
|
|
603
|
-
execution_status: 'failed',
|
|
604
|
-
trigger_reason: 'delegate_run',
|
|
605
|
-
});
|
|
606
|
-
if (valSession && this.deps.validationService) {
|
|
607
|
-
this.deps.validationService.recordRun(valSession.id, {
|
|
608
|
-
activityId: row.id,
|
|
609
|
-
duration_ms: failedDurationMs,
|
|
610
|
-
});
|
|
611
|
-
}
|
|
612
|
-
}
|
|
613
|
-
}
|
|
614
|
-
catch (telemetryErr) {
|
|
615
|
-
securityLogger.warn('[Delegation telemetry] Failure activity failed', telemetryErr);
|
|
616
|
-
}
|
|
617
|
-
try {
|
|
618
|
-
if (valSession && this.deps.validationService) {
|
|
619
|
-
this.deps.validationService.finalizeSession(valSession.id, {
|
|
620
|
-
execution_status: 'failed',
|
|
621
|
-
error_message: lastError.message,
|
|
622
|
-
metrics: { duration_ms: failedDurationMs },
|
|
623
|
-
});
|
|
624
|
-
}
|
|
625
|
-
}
|
|
626
|
-
catch (telemetryErr) {
|
|
627
|
-
securityLogger.warn('[Delegation telemetry] Failure finalize failed', telemetryErr);
|
|
628
|
-
}
|
|
629
|
-
return {
|
|
630
|
-
success: false,
|
|
631
|
-
error: `Delegation to ${agentId} failed after ${DELEGATE_MAX_RETRIES} attempts: ${lastError.message}`,
|
|
632
|
-
};
|
|
633
|
-
}
|
|
634
|
-
}
|
|
635
|
-
async sendDelegationMessageWithRetry(args) {
|
|
636
|
-
let lastError = null;
|
|
637
|
-
for (let attempt = 0; attempt < DELEGATE_MAX_RETRIES; attempt++) {
|
|
638
|
-
try {
|
|
639
|
-
const process = await args.processManager.getProcess(args.source, args.channelId, args.agentId);
|
|
640
|
-
let delegationPrompt = this.buildDelegationPrompt(args);
|
|
641
|
-
const sessionId = process.getSessionId?.();
|
|
642
|
-
if (!sessionId || attempt > 0) {
|
|
643
|
-
delegationPrompt = await this.withChannelHistory(delegationPrompt, args.channelId, args.agentId);
|
|
644
|
-
}
|
|
645
|
-
return await process.sendMessage(delegationPrompt);
|
|
646
|
-
}
|
|
647
|
-
catch (err) {
|
|
648
|
-
lastError = err instanceof Error ? err : new Error(String(err));
|
|
649
|
-
const isBusy = lastError.message.includes('busy');
|
|
650
|
-
const isCrash = lastError.message.includes('exited with code');
|
|
651
|
-
if (isCrash) {
|
|
652
|
-
args.processManager.stopProcess(args.source, args.channelId, args.agentId);
|
|
653
|
-
}
|
|
654
|
-
if (attempt < DELEGATE_MAX_RETRIES - 1 && (isBusy || isCrash)) {
|
|
655
|
-
await new Promise((resolveDelay) => setTimeout(resolveDelay, this.deps.retryDelayMs * (attempt + 1)));
|
|
656
|
-
continue;
|
|
657
|
-
}
|
|
658
|
-
break;
|
|
659
|
-
}
|
|
660
|
-
}
|
|
661
|
-
throw lastError ?? new Error('unknown delegation failure');
|
|
662
|
-
}
|
|
663
|
-
buildDelegationPrompt(args) {
|
|
664
|
-
let delegationPrompt = args.delegationManager.buildDelegationPrompt(args.sourceAgentId, args.task);
|
|
665
|
-
if (args.skill) {
|
|
666
|
-
const skillPath = resolveSkillPath(args.skill);
|
|
667
|
-
if (skillPath && (0, fs_1.existsSync)(skillPath)) {
|
|
668
|
-
const skillContent = (0, fs_1.readFileSync)(skillPath, 'utf-8');
|
|
669
|
-
delegationPrompt = skillContent + '\n\n---\n\n' + delegationPrompt;
|
|
670
|
-
}
|
|
671
|
-
}
|
|
672
|
-
return delegationPrompt;
|
|
673
|
-
}
|
|
674
|
-
async withChannelHistory(prompt, channelId, agentId) {
|
|
675
|
-
try {
|
|
676
|
-
const { getChannelHistory } = await import('../gateways/channel-history.js');
|
|
677
|
-
const channelHistory = getChannelHistory();
|
|
678
|
-
if (channelHistory) {
|
|
679
|
-
const historyContext = channelHistory.formatForContext(channelId, '', agentId);
|
|
680
|
-
if (historyContext) {
|
|
681
|
-
return `${historyContext}\n\n${prompt}`;
|
|
682
|
-
}
|
|
683
|
-
}
|
|
684
|
-
}
|
|
685
|
-
catch {
|
|
686
|
-
// Channel history injection is best-effort.
|
|
687
|
-
}
|
|
688
|
-
return prompt;
|
|
689
|
-
}
|
|
690
|
-
}
|
|
691
|
-
exports.DelegationExecutor = DelegationExecutor;
|
|
692
|
-
//# sourceMappingURL=delegation-executor.js.map
|