pi-harness-runtime 1.1.397 → 1.1.402
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/AGENTS.md +44 -2
- package/CHANGELOG.md +21 -0
- package/RULES.md +28 -0
- package/harness/agent-handoff.ts +2 -3
- package/harness/autonomous-review.ts +1 -1
- package/harness/blackboard.ts +2 -3
- package/harness/context-compact-orchestrator.ts +1 -1
- package/harness/context-window-manager.ts +2 -2
- package/harness/e2e/playwright-runner.ts +6 -4
- package/harness/herdr-agents.ts +1 -1
- package/harness/job-state-machine.ts +1 -1
- package/harness/langchain/daemon.ts +3 -3
- package/harness/langchain/graph.ts +2 -2
- package/harness/langchain/ping-pong-middleware.ts +2 -2
- package/harness/loop-code-agent.ts +6 -4
- package/harness/loop-controller.ts +1 -1
- package/harness/loop-review-agent.ts +1 -1
- package/harness/loop-types.ts +1 -1
- package/harness/master-planner.ts +1 -1
- package/harness/notification-events.ts +6 -6
- package/harness/project-detector/detector.ts +1 -2
- package/harness/repair-engine.ts +2 -4
- package/harness/service-diagnostics.ts +1 -1
- package/harness/skill-sync.ts +3 -3
- package/index.ts +276 -55
- package/mirror.ts +1 -1
- package/package.json +5 -3
- package/packages/a2a-adapter/dist/discovery.d.ts.map +1 -1
- package/packages/a2a-adapter/dist/discovery.js +0 -1
- package/packages/a2a-adapter/dist/discovery.js.map +1 -1
- package/packages/a2a-adapter/package.json +1 -1
- package/packages/a2a-adapter/src/discovery.ts +0 -1
- package/packages/agent-policy/package.json +1 -1
- package/packages/architecture-generator/package.json +1 -1
- package/packages/auth/dist/index.d.ts +9 -0
- package/packages/auth/dist/index.d.ts.map +1 -0
- package/packages/auth/dist/index.js +9 -0
- package/packages/auth/dist/index.js.map +1 -0
- package/packages/auth/package.json +1 -1
- package/packages/auth/src/index.ts +9 -0
- package/packages/autonomous-refactor/package.json +1 -1
- package/packages/autonomous-runtime/package.json +1 -1
- package/packages/cache-strategy/package.json +1 -1
- package/packages/capability-registry/package.json +1 -1
- package/packages/checkpoint/package.json +1 -1
- package/packages/cli-plugin-sdk/package.json +1 -1
- package/packages/clipboard/package.json +1 -1
- package/packages/clipboard-plugin/package.json +1 -1
- package/packages/code-generation/package.json +1 -1
- package/packages/code-review/package.json +1 -1
- package/packages/codex-adapter/package.json +1 -1
- package/packages/codex-watcher/package.json +1 -1
- package/packages/config-capture/dist/index.d.ts +52 -0
- package/packages/config-capture/dist/index.d.ts.map +1 -0
- package/packages/config-capture/dist/index.js +261 -0
- package/packages/config-capture/dist/index.js.map +1 -0
- package/packages/config-capture/package.json +1 -1
- package/packages/connection-runtime/package.json +1 -1
- package/packages/context-compiler/package.json +1 -1
- package/packages/context-discovery/package.json +1 -1
- package/packages/context-manager/package.json +1 -1
- package/packages/contracts/package.json +1 -1
- package/packages/cookie-sanitizer/package.json +1 -1
- package/packages/cost-optimizer/package.json +1 -1
- package/packages/dependency-analyzer/package.json +1 -1
- package/packages/django-plugin/package.json +1 -1
- package/packages/doc-generator/package.json +1 -1
- package/packages/durable-review/package.json +1 -1
- package/packages/e2e-tester/package.json +1 -1
- package/packages/evaluation-engine/package.json +1 -1
- package/packages/evaluation-runner/package.json +1 -1
- package/packages/event-bus/package.json +1 -1
- package/packages/event-sink/package.json +1 -1
- package/packages/event-store/package.json +1 -1
- package/packages/experience-replay/package.json +1 -1
- package/packages/feedback-collector/package.json +1 -1
- package/packages/file-copy-helper/dist/extension.d.ts +15 -0
- package/packages/file-copy-helper/dist/extension.d.ts.map +1 -0
- package/packages/file-copy-helper/dist/extension.debug.d.ts +15 -0
- package/packages/file-copy-helper/dist/extension.debug.d.ts.map +1 -0
- package/packages/file-copy-helper/dist/extension.debug.js +215 -0
- package/packages/file-copy-helper/dist/extension.debug.js.map +1 -0
- package/packages/file-copy-helper/dist/extension.js +222 -0
- package/packages/file-copy-helper/dist/extension.js.map +1 -0
- package/packages/file-copy-helper/dist/index.d.ts +3 -0
- package/packages/file-copy-helper/dist/index.d.ts.map +1 -0
- package/packages/file-copy-helper/dist/index.js +3 -0
- package/packages/file-copy-helper/dist/index.js.map +1 -0
- package/packages/file-copy-helper/dist/intent-detector.d.ts +21 -0
- package/packages/file-copy-helper/dist/intent-detector.d.ts.map +1 -0
- package/packages/file-copy-helper/dist/intent-detector.js +348 -0
- package/packages/file-copy-helper/dist/intent-detector.js.map +1 -0
- package/packages/file-copy-helper/package.json +1 -1
- package/packages/framework-detector/package.json +1 -1
- package/packages/framework-plugin-sdk/package.json +1 -1
- package/packages/frappe-plugin/package.json +1 -1
- package/packages/generic-web-plugin/package.json +1 -1
- package/packages/health-monitor/package.json +1 -1
- package/packages/intent-analyzer/package.json +1 -1
- package/packages/jev-judge/dist/auto-continue.d.ts +161 -2
- package/packages/jev-judge/dist/auto-continue.d.ts.map +1 -1
- package/packages/jev-judge/dist/auto-continue.js +267 -22
- package/packages/jev-judge/dist/auto-continue.js.map +1 -1
- package/packages/jev-judge/dist/index.d.ts +2 -0
- package/packages/jev-judge/dist/index.d.ts.map +1 -1
- package/packages/jev-judge/dist/index.js +2 -0
- package/packages/jev-judge/dist/index.js.map +1 -1
- package/packages/jev-judge/dist/question-risk.d.ts +50 -0
- package/packages/jev-judge/dist/question-risk.d.ts.map +1 -0
- package/packages/jev-judge/dist/question-risk.js +100 -0
- package/packages/jev-judge/dist/question-risk.js.map +1 -0
- package/packages/jev-judge/package.json +1 -1
- package/packages/jev-judge/src/auto-continue.ts +426 -29
- package/packages/jev-judge/src/index.ts +4 -0
- package/packages/jev-judge/src/question-risk.ts +151 -0
- package/packages/jev-judge/tests/auto-continue-context.test.ts +221 -0
- package/packages/jev-judge/tests/outcome-application.test.ts +132 -0
- package/packages/jev-judge/tests/question-risk.test.ts +116 -0
- package/packages/knowledge-graph/package.json +1 -1
- package/packages/knowledge-retrieval/package.json +1 -1
- package/packages/laravel-plugin/package.json +1 -1
- package/packages/learning-engine/package.json +1 -1
- package/packages/logging/README.md +36 -3
- package/packages/logging/dist/config.d.ts +7 -0
- package/packages/logging/dist/config.d.ts.map +1 -1
- package/packages/logging/dist/config.js +14 -0
- package/packages/logging/dist/config.js.map +1 -1
- package/packages/logging/dist/incidents/schema.d.ts +111 -0
- package/packages/logging/dist/incidents/schema.d.ts.map +1 -0
- package/packages/logging/dist/incidents/schema.js +0 -0
- package/packages/logging/dist/incidents/schema.js.map +1 -0
- package/packages/logging/dist/index.d.ts +2 -0
- package/packages/logging/dist/index.d.ts.map +1 -1
- package/packages/logging/dist/index.js +2 -0
- package/packages/logging/dist/index.js.map +1 -1
- package/packages/logging/dist/server/http.d.ts +4 -3
- package/packages/logging/dist/server/http.d.ts.map +1 -1
- package/packages/logging/dist/server/http.js +35 -3
- package/packages/logging/dist/server/http.js.map +1 -1
- package/packages/logging/dist/server/incident-qdrant.d.ts +83 -0
- package/packages/logging/dist/server/incident-qdrant.d.ts.map +1 -0
- package/packages/logging/dist/server/incident-qdrant.js +129 -0
- package/packages/logging/dist/server/incident-qdrant.js.map +1 -0
- package/packages/logging/dist/server/incident-store.d.ts +76 -0
- package/packages/logging/dist/server/incident-store.d.ts.map +1 -0
- package/packages/logging/dist/server/incident-store.js +157 -0
- package/packages/logging/dist/server/incident-store.js.map +1 -0
- package/packages/logging/dist/server/index.d.ts +4 -0
- package/packages/logging/dist/server/index.d.ts.map +1 -1
- package/packages/logging/dist/server/index.js +2 -0
- package/packages/logging/dist/server/index.js.map +1 -1
- package/packages/logging/dist/server/service.d.ts +33 -0
- package/packages/logging/dist/server/service.d.ts.map +1 -1
- package/packages/logging/dist/server/service.js +63 -0
- package/packages/logging/dist/server/service.js.map +1 -1
- package/packages/logging/dist/shipper.d.ts +74 -3
- package/packages/logging/dist/shipper.d.ts.map +1 -1
- package/packages/logging/dist/shipper.js +88 -5
- package/packages/logging/dist/shipper.js.map +1 -1
- package/packages/logging/dist/singleton.d.ts.map +1 -1
- package/packages/logging/dist/singleton.js +1 -0
- package/packages/logging/dist/singleton.js.map +1 -1
- package/packages/logging/package.json +1 -1
- package/packages/logging/src/config.ts +22 -0
- package/packages/logging/src/incidents/schema.ts +0 -0
- package/packages/logging/src/index.ts +17 -0
- package/packages/logging/src/server/http.ts +42 -3
- package/packages/logging/src/server/incident-qdrant.ts +177 -0
- package/packages/logging/src/server/incident-store.ts +192 -0
- package/packages/logging/src/server/index.ts +21 -0
- package/packages/logging/src/server/service.ts +79 -0
- package/packages/logging/src/shipper.ts +120 -5
- package/packages/logging/src/singleton.ts +1 -0
- package/packages/logging/test/fanout.test.ts +186 -0
- package/packages/logging/test/incidents.test.ts +404 -0
- package/packages/mcp-adapter/package.json +1 -1
- package/packages/memory-engine/package.json +1 -1
- package/packages/milestone-manager/package.json +1 -1
- package/packages/model-registry/package.json +1 -1
- package/packages/nextjs-plugin/package.json +1 -1
- package/packages/notification/dist/adapters/detail-format.d.ts +42 -0
- package/packages/notification/dist/adapters/detail-format.d.ts.map +1 -0
- package/packages/notification/dist/adapters/detail-format.js +94 -0
- package/packages/notification/dist/adapters/detail-format.js.map +1 -0
- package/packages/notification/dist/adapters/email-adapter.d.ts.map +1 -1
- package/packages/notification/dist/adapters/email-adapter.js +3 -2
- package/packages/notification/dist/adapters/email-adapter.js.map +1 -1
- package/packages/notification/dist/adapters/line-adapter.d.ts +33 -0
- package/packages/notification/dist/adapters/line-adapter.d.ts.map +1 -1
- package/packages/notification/dist/adapters/line-adapter.js +87 -9
- package/packages/notification/dist/adapters/line-adapter.js.map +1 -1
- package/packages/notification/dist/adapters/ntfy-adapter.d.ts.map +1 -1
- package/packages/notification/dist/adapters/ntfy-adapter.js +3 -2
- package/packages/notification/dist/adapters/ntfy-adapter.js.map +1 -1
- package/packages/notification/dist/adapters/telegram-adapter.d.ts +14 -0
- package/packages/notification/dist/adapters/telegram-adapter.d.ts.map +1 -1
- package/packages/notification/dist/adapters/telegram-adapter.js +89 -69
- package/packages/notification/dist/adapters/telegram-adapter.js.map +1 -1
- package/packages/notification/dist/notification-center.d.ts.map +1 -1
- package/packages/notification/dist/notification-center.js +60 -7
- package/packages/notification/dist/notification-center.js.map +1 -1
- package/packages/notification/dist/pending-question.d.ts +69 -2
- package/packages/notification/dist/pending-question.d.ts.map +1 -1
- package/packages/notification/dist/pending-question.js +88 -2
- package/packages/notification/dist/pending-question.js.map +1 -1
- package/packages/notification/dist/types.d.ts +21 -0
- package/packages/notification/dist/types.d.ts.map +1 -1
- package/packages/notification/package.json +1 -1
- package/packages/notification/src/adapters/detail-format.ts +114 -0
- package/packages/notification/src/adapters/email-adapter.ts +3 -2
- package/packages/notification/src/adapters/line-adapter.ts +97 -9
- package/packages/notification/src/adapters/ntfy-adapter.ts +3 -2
- package/packages/notification/src/adapters/telegram-adapter.ts +98 -76
- package/packages/notification/src/notification-center.ts +66 -8
- package/packages/notification/src/pending-question.ts +160 -8
- package/packages/notification/src/types.ts +21 -0
- package/packages/notification/test/approval-payload.test.ts +269 -0
- package/packages/notification/test/detail-format.test.ts +106 -0
- package/packages/notification/test/pending-question-lifecycle.test.ts +195 -0
- package/packages/observability/package.json +1 -1
- package/packages/okf-indexer/dist/index.d.ts +9 -0
- package/packages/okf-indexer/dist/index.d.ts.map +1 -0
- package/packages/okf-indexer/dist/index.js +9 -0
- package/packages/okf-indexer/dist/index.js.map +1 -0
- package/packages/okf-indexer/package.json +1 -1
- package/packages/okf-indexer/src/index.ts +9 -0
- package/packages/paperclip-integration/package.json +1 -1
- package/packages/performance-optimizer/package.json +1 -1
- package/packages/permission-mode/package.json +1 -1
- package/packages/privilege-broker/package.json +1 -1
- package/packages/project-analyzer/package.json +1 -1
- package/packages/project-bootstrap/package.json +1 -1
- package/packages/projection-engine/package.json +1 -1
- package/packages/prompt-compiler/package.json +1 -1
- package/packages/prompt-versioning/package.json +1 -1
- package/packages/provider-adapter-sdk/package.json +1 -1
- package/packages/provider-router/dist/provider-router.d.ts.map +1 -1
- package/packages/provider-router/dist/types.d.ts +2 -2
- package/packages/provider-router/dist/types.d.ts.map +1 -1
- package/packages/provider-router/dist/types.js +1 -1
- package/packages/provider-router/package.json +1 -1
- package/packages/provider-router/src/types.ts +2 -2
- package/packages/provider-selector/package.json +1 -1
- package/packages/providers/package.json +1 -1
- package/packages/qdrant-skills/package.json +1 -1
- package/packages/quota-manager/package.json +1 -1
- package/packages/rate-limiter/package.json +1 -1
- package/packages/react-vite-plugin/package.json +1 -1
- package/packages/relay/package.json +1 -1
- package/packages/release-manager/package.json +1 -1
- package/packages/requirement-compiler/package.json +1 -1
- package/packages/runtime/package.json +1 -1
- package/packages/scheduler/dist/index.d.ts +9 -0
- package/packages/scheduler/dist/index.d.ts.map +1 -0
- package/packages/scheduler/dist/index.js +9 -0
- package/packages/scheduler/dist/index.js.map +1 -0
- package/packages/scheduler/dist/scheduler.d.ts +17 -0
- package/packages/scheduler/dist/scheduler.d.ts.map +1 -0
- package/packages/scheduler/dist/scheduler.js +41 -0
- package/packages/scheduler/dist/scheduler.js.map +1 -0
- package/packages/scheduler/package.json +1 -1
- package/packages/scheduler/src/index.ts +9 -0
- package/packages/scheduler-adapter/package.json +1 -1
- package/packages/session/package.json +1 -1
- package/packages/session-api/package.json +1 -1
- package/packages/session-export/package.json +1 -1
- package/packages/shared-context/dist/index.d.ts +7 -0
- package/packages/shared-context/dist/index.d.ts.map +1 -0
- package/packages/shared-context/dist/index.js +7 -0
- package/packages/shared-context/dist/index.js.map +1 -0
- package/packages/shared-context/dist/shared-context.d.ts +12 -0
- package/packages/shared-context/dist/shared-context.d.ts.map +1 -0
- package/packages/shared-context/dist/shared-context.js +39 -0
- package/packages/shared-context/dist/shared-context.js.map +1 -0
- package/packages/shared-context/package.json +1 -1
- package/packages/skill-mcp-client/dist/client.d.ts +56 -0
- package/packages/skill-mcp-client/dist/client.d.ts.map +1 -0
- package/packages/skill-mcp-client/dist/client.js +101 -0
- package/packages/skill-mcp-client/dist/client.js.map +1 -0
- package/packages/skill-mcp-client/dist/errors.d.ts +44 -0
- package/packages/skill-mcp-client/dist/errors.d.ts.map +1 -0
- package/packages/skill-mcp-client/dist/errors.js +68 -0
- package/packages/skill-mcp-client/dist/errors.js.map +1 -0
- package/packages/skill-mcp-client/dist/index.d.ts +9 -0
- package/packages/skill-mcp-client/dist/index.d.ts.map +1 -0
- package/packages/skill-mcp-client/dist/index.js +9 -0
- package/packages/skill-mcp-client/dist/index.js.map +1 -0
- package/packages/skill-mcp-client/dist/types.d.ts +106 -0
- package/packages/skill-mcp-client/dist/types.d.ts.map +1 -0
- package/packages/skill-mcp-client/dist/types.js +14 -0
- package/packages/skill-mcp-client/dist/types.js.map +1 -0
- package/packages/skill-mcp-client/package.json +1 -1
- package/packages/skill-registry/package.json +1 -1
- package/packages/skills/package.json +1 -5
- package/packages/sprint-planner/package.json +1 -1
- package/packages/subscription-engine/package.json +1 -1
- package/packages/task-compiler/package.json +1 -1
- package/packages/telegram/package.json +1 -1
- package/packages/telegram/src/agent-messages.d.ts +28 -0
- package/packages/telegram/src/agent-messages.js +90 -0
- package/packages/telegram/src/bindings.d.ts +296 -0
- package/packages/telegram/src/bindings.js +1086 -0
- package/packages/telegram/src/bus.d.ts +759 -0
- package/packages/telegram/src/bus.js +2732 -0
- package/packages/telegram/src/commands.d.ts +761 -0
- package/packages/telegram/src/commands.js +2622 -0
- package/packages/telegram/src/config.d.ts +222 -0
- package/packages/telegram/src/config.js +844 -0
- package/packages/telegram/src/delivery.d.ts +161 -0
- package/packages/telegram/src/delivery.js +550 -0
- package/packages/telegram/src/extension.d.ts +7 -0
- package/packages/telegram/src/extension.js +2444 -0
- package/packages/telegram/src/inbound.d.ts +94 -0
- package/packages/telegram/src/inbound.js +478 -0
- package/packages/telegram/src/index.d.ts +6 -0
- package/packages/telegram/src/index.js +6 -0
- package/packages/telegram/src/keyboard.d.ts +21 -0
- package/packages/telegram/src/keyboard.js +37 -0
- package/packages/telegram/src/lifecycle.d.ts +210 -0
- package/packages/telegram/src/lifecycle.js +538 -0
- package/packages/telegram/src/pi.d.ts +76 -0
- package/packages/telegram/src/pi.js +130 -0
- package/packages/telegram/src/polling.d.ts +332 -0
- package/packages/telegram/src/polling.js +1219 -0
- package/packages/telegram/src/replies.d.ts +210 -0
- package/packages/telegram/src/replies.js +752 -0
- package/packages/telegram/src/routing.d.ts +388 -0
- package/packages/telegram/src/routing.js +7886 -0
- package/packages/telegram/src/runtime.d.ts +159 -0
- package/packages/telegram/src/runtime.js +351 -0
- package/packages/telegram/src/telegram-api.d.ts +564 -0
- package/packages/telegram/src/telegram-api.js +1332 -0
- package/packages/telegram/src/turns.d.ts +108 -0
- package/packages/telegram/src/turns.js +482 -0
- package/packages/telegram/src/updates.d.ts +1545 -0
- package/packages/telegram/src/updates.js +6420 -0
- package/packages/tencentdb-memory/package.json +1 -1
- package/packages/tencentdb-sync/package.json +1 -1
- package/packages/test-data-generator/package.json +1 -1
- package/packages/test-generator/package.json +1 -1
- package/packages/todo-bd-sync/dist/detector.d.ts +54 -0
- package/packages/todo-bd-sync/dist/detector.d.ts.map +1 -0
- package/packages/todo-bd-sync/dist/detector.js +132 -0
- package/packages/todo-bd-sync/dist/detector.js.map +1 -0
- package/packages/todo-bd-sync/dist/extension.d.ts +30 -0
- package/packages/todo-bd-sync/dist/extension.d.ts.map +1 -0
- package/packages/todo-bd-sync/dist/extension.js +35 -0
- package/packages/todo-bd-sync/dist/extension.js.map +1 -0
- package/packages/todo-bd-sync/dist/index.d.ts +87 -0
- package/packages/todo-bd-sync/dist/index.d.ts.map +1 -0
- package/packages/todo-bd-sync/dist/index.js +296 -0
- package/packages/todo-bd-sync/dist/index.js.map +1 -0
- package/packages/todo-bd-sync/dist/sync.d.ts +72 -0
- package/packages/todo-bd-sync/dist/sync.d.ts.map +1 -0
- package/packages/todo-bd-sync/dist/sync.js +290 -0
- package/packages/todo-bd-sync/dist/sync.js.map +1 -0
- package/packages/todo-bd-sync/dist/task-analyzer.d.ts +49 -0
- package/packages/todo-bd-sync/dist/task-analyzer.d.ts.map +1 -0
- package/packages/todo-bd-sync/dist/task-analyzer.js +240 -0
- package/packages/todo-bd-sync/dist/task-analyzer.js.map +1 -0
- package/packages/todo-bd-sync/dist/todo-reminder.d.ts +126 -0
- package/packages/todo-bd-sync/dist/todo-reminder.d.ts.map +1 -0
- package/packages/todo-bd-sync/dist/todo-reminder.js +329 -0
- package/packages/todo-bd-sync/dist/todo-reminder.js.map +1 -0
- package/packages/todo-bd-sync/dist/types.d.ts +65 -0
- package/packages/todo-bd-sync/dist/types.d.ts.map +1 -0
- package/packages/todo-bd-sync/dist/types.js +67 -0
- package/packages/todo-bd-sync/dist/types.js.map +1 -0
- package/packages/todo-bd-sync/package.json +1 -1
- package/packages/token-estimation/dist/index.d.ts +94 -0
- package/packages/token-estimation/dist/index.d.ts.map +1 -0
- package/packages/token-estimation/dist/index.js +115 -0
- package/packages/token-estimation/dist/index.js.map +1 -0
- package/packages/token-estimation/package.json +1 -1
- package/packages/token-optimizer/package.json +1 -1
- package/packages/trajectory/package.json +1 -1
- package/packages/tui/package.json +1 -1
- package/packages/types/dist/ai-providers.d.ts +36 -0
- package/packages/types/dist/ai-providers.d.ts.map +1 -0
- package/packages/types/dist/ai-providers.js +66 -0
- package/packages/types/dist/ai-providers.js.map +1 -0
- package/packages/types/dist/index.d.ts +12 -0
- package/packages/types/dist/index.d.ts.map +1 -0
- package/packages/types/dist/index.js +12 -0
- package/packages/types/dist/index.js.map +1 -0
- package/packages/types/package.json +5 -5
- package/packages/types/src/index.ts +12 -0
- package/packages/voice-api/package.json +1 -1
- package/packages/webmcp-tester/package.json +1 -1
- package/packages/wiki/package.json +1 -1
- package/packages/workflow-events/package.json +1 -1
- package/packages/workspace-scanner/package.json +1 -1
- package/packages/worktree/package.json +1 -1
- package/packages/worktree/worktree.ts +1 -1
- package/packages/write-review/package.json +1 -1
- package/renderer.ts +1 -1
- package/scripts/build-packages.ts +162 -0
- package/scripts/relay-client.ts +2 -2
- package/scripts/typecheck-packages.mjs +3 -3
- package/scripts/unified-webhook-server.ts +22 -10
- package/scripts/verify-package-contents.ts +345 -0
- package/scripts/ws-server.ts +1 -1
- package/tracker.ts +1 -1
- package/harness/browser-scrapers/base-browser-scraper.d.ts +0 -91
- package/harness/browser-scrapers/chrome-profile-manager.d.ts +0 -80
- package/harness/browser-scrapers/codex-browser-scraper.d.ts +0 -60
- package/harness/browser-scrapers/index.d.ts +0 -29
- package/harness/browser-scrapers/zai-browser-scraper.d.ts +0 -79
- package/harness/e2e/browser-scrapers/base-browser-scraper.d.ts +0 -92
- package/harness/e2e/browser-scrapers/chrome-profile-manager.d.ts +0 -81
- package/harness/e2e/browser-scrapers/codex-browser-scraper.d.ts +0 -61
- package/harness/e2e/browser-scrapers/index.d.ts +0 -30
- package/harness/e2e/browser-scrapers/zai-browser-scraper.d.ts +0 -80
- package/harness/langchain/agents.d.ts +0 -143
- package/harness/langchain/agents.test.d.ts +0 -2
- package/harness/langchain/checkpointer.d.ts +0 -48
- package/harness/langchain/checkpointer.test.d.ts +0 -8
- package/harness/langchain/cron-cli.d.ts +0 -12
- package/harness/langchain/daemon.d.ts +0 -161
- package/harness/langchain/daemon.test.d.ts +0 -11
- package/harness/langchain/file-tools.d.ts +0 -97
- package/harness/langchain/graph.d.ts +0 -706
- package/harness/langchain/model-router.d.ts +0 -63
- package/harness/langchain/model-router.test.d.ts +0 -2
- package/harness/langchain/models.d.ts +0 -72
- package/harness/langchain/ping-pong-middleware.d.ts +0 -28
- package/harness/langchain/ping-pong-middleware.test.d.ts +0 -2
- package/harness/langchain/run.d.ts +0 -15
- package/harness/langchain/scoreboard.test.d.ts +0 -13
- package/harness/langchain/status-line.d.ts +0 -91
- package/harness/langchain/status-line.test.d.ts +0 -8
- package/harness/langchain/surge.d.ts +0 -111
- package/harness/langchain/surge.test.d.ts +0 -10
- package/harness/langchain/widget.d.ts +0 -105
- package/harness/langchain/widget.test.d.ts +0 -8
- package/packages/autonomous-runtime/dist/worker.d.ts +0 -63
- package/packages/autonomous-runtime/dist/worker.js +0 -133
- package/packages/capability-registry/src/types.d.ts +0 -47
- package/packages/clipboard/dist/clipboard.d.ts +0 -11
- package/packages/clipboard/dist/clipboard.js +0 -40
- package/packages/clipboard/dist/index.d.ts +0 -2
- package/packages/clipboard/dist/index.js +0 -2
- package/packages/clipboard/dist/types.d.ts +0 -13
- package/packages/clipboard/dist/types.js +0 -5
- package/packages/context-discovery/dist/discover.d.ts +0 -3
- package/packages/context-discovery/dist/discover.js +0 -42
- package/packages/context-discovery/dist/discovery.d.ts +0 -28
- package/packages/context-discovery/dist/discovery.js +0 -21
- package/packages/context-discovery/dist/index.d.ts +0 -3
- package/packages/context-discovery/dist/index.js +0 -2
- package/packages/context-discovery/dist/types.d.ts +0 -16
- package/packages/context-discovery/dist/types.js +0 -2
- package/packages/event-bus/dist/bus.d.ts +0 -15
- package/packages/event-bus/dist/bus.js +0 -90
- package/packages/event-bus/dist/index.d.ts +0 -4
- package/packages/event-bus/dist/index.js +0 -3
- package/packages/event-bus/dist/test/bus.test.js +0 -52
- package/packages/event-bus/dist/types.d.ts +0 -27
- package/packages/event-bus/dist/types.js +0 -10
- package/packages/event-store/dist/index.d.ts +0 -3
- package/packages/event-store/dist/index.js +0 -2
- package/packages/event-store/dist/store.d.ts +0 -15
- package/packages/event-store/dist/store.js +0 -131
- package/packages/event-store/dist/test/store.test.js +0 -57
- package/packages/event-store/dist/types.d.ts +0 -48
- package/packages/event-store/dist/types.js +0 -5
- package/packages/event-store/src/types.d.ts +0 -48
- package/packages/file-copy-helper/dist/src/extension.js +0 -186
- package/packages/model-registry/src/types.d.ts +0 -63
- package/packages/notification/dist/src/adapters/email-adapter.d.ts +0 -17
- package/packages/notification/dist/src/adapters/email-adapter.d.ts.map +0 -1
- package/packages/notification/dist/src/adapters/email-adapter.js +0 -89
- package/packages/notification/dist/src/adapters/email-adapter.js.map +0 -1
- package/packages/notification/dist/src/adapters/line-adapter.d.ts +0 -17
- package/packages/notification/dist/src/adapters/line-adapter.d.ts.map +0 -1
- package/packages/notification/dist/src/adapters/line-adapter.js +0 -99
- package/packages/notification/dist/src/adapters/line-adapter.js.map +0 -1
- package/packages/notification/dist/src/adapters/ntfy-adapter.d.ts +0 -17
- package/packages/notification/dist/src/adapters/ntfy-adapter.d.ts.map +0 -1
- package/packages/notification/dist/src/adapters/ntfy-adapter.js +0 -84
- package/packages/notification/dist/src/adapters/ntfy-adapter.js.map +0 -1
- package/packages/notification/dist/src/adapters/telegram-adapter.d.ts +0 -56
- package/packages/notification/dist/src/adapters/telegram-adapter.d.ts.map +0 -1
- package/packages/notification/dist/src/adapters/telegram-adapter.js +0 -251
- package/packages/notification/dist/src/adapters/telegram-adapter.js.map +0 -1
- package/packages/notification/dist/src/adapters/webhook-adapter.d.ts +0 -15
- package/packages/notification/dist/src/adapters/webhook-adapter.d.ts.map +0 -1
- package/packages/notification/dist/src/adapters/webhook-adapter.js +0 -64
- package/packages/notification/dist/src/adapters/webhook-adapter.js.map +0 -1
- package/packages/notification/dist/src/base-adapter.d.ts +0 -36
- package/packages/notification/dist/src/base-adapter.d.ts.map +0 -1
- package/packages/notification/dist/src/base-adapter.js +0 -39
- package/packages/notification/dist/src/base-adapter.js.map +0 -1
- package/packages/notification/dist/src/index.d.ts +0 -12
- package/packages/notification/dist/src/index.d.ts.map +0 -1
- package/packages/notification/dist/src/index.js +0 -12
- package/packages/notification/dist/src/index.js.map +0 -1
- package/packages/notification/dist/src/notification-center.d.ts +0 -89
- package/packages/notification/dist/src/notification-center.d.ts.map +0 -1
- package/packages/notification/dist/src/notification-center.js +0 -356
- package/packages/notification/dist/src/notification-center.js.map +0 -1
- package/packages/notification/dist/src/notification-policy.d.ts +0 -66
- package/packages/notification/dist/src/notification-policy.d.ts.map +0 -1
- package/packages/notification/dist/src/notification-policy.js +0 -153
- package/packages/notification/dist/src/notification-policy.js.map +0 -1
- package/packages/notification/dist/src/telegram-webhook-handler.d.ts +0 -86
- package/packages/notification/dist/src/telegram-webhook-handler.d.ts.map +0 -1
- package/packages/notification/dist/src/telegram-webhook-handler.js +0 -149
- package/packages/notification/dist/src/telegram-webhook-handler.js.map +0 -1
- package/packages/notification/dist/src/types.d.ts +0 -106
- package/packages/notification/dist/src/types.d.ts.map +0 -1
- package/packages/notification/dist/src/types.js +0 -7
- package/packages/notification/dist/src/types.js.map +0 -1
- package/packages/projection-engine/dist/engine.d.ts +0 -61
- package/packages/projection-engine/dist/engine.js +0 -76
- package/packages/projection-engine/dist/index.d.ts +0 -2
- package/packages/projection-engine/dist/index.js +0 -2
- package/packages/projection-engine/dist/project.d.ts +0 -3
- package/packages/projection-engine/dist/project.js +0 -24
- package/packages/projection-engine/dist/types.d.ts +0 -55
- package/packages/projection-engine/dist/types.js +0 -5
- package/packages/projection-engine/src/types.d.ts +0 -55
- package/packages/provider-adapter-sdk/dist/src/builder.d.ts +0 -140
- package/packages/provider-adapter-sdk/dist/src/builder.d.ts.map +0 -1
- package/packages/provider-adapter-sdk/dist/src/builder.js +0 -332
- package/packages/provider-adapter-sdk/dist/src/builder.js.map +0 -1
- package/packages/provider-adapter-sdk/dist/src/errors.d.ts +0 -71
- package/packages/provider-adapter-sdk/dist/src/errors.d.ts.map +0 -1
- package/packages/provider-adapter-sdk/dist/src/errors.js +0 -111
- package/packages/provider-adapter-sdk/dist/src/errors.js.map +0 -1
- package/packages/provider-adapter-sdk/dist/src/index.d.ts +0 -15
- package/packages/provider-adapter-sdk/dist/src/index.d.ts.map +0 -1
- package/packages/provider-adapter-sdk/dist/src/index.js +0 -19
- package/packages/provider-adapter-sdk/dist/src/index.js.map +0 -1
- package/packages/provider-adapter-sdk/dist/src/registry.d.ts +0 -108
- package/packages/provider-adapter-sdk/dist/src/registry.d.ts.map +0 -1
- package/packages/provider-adapter-sdk/dist/src/registry.js +0 -301
- package/packages/provider-adapter-sdk/dist/src/registry.js.map +0 -1
- package/packages/provider-adapter-sdk/dist/src/tester.d.ts +0 -71
- package/packages/provider-adapter-sdk/dist/src/tester.d.ts.map +0 -1
- package/packages/provider-adapter-sdk/dist/src/tester.js +0 -392
- package/packages/provider-adapter-sdk/dist/src/tester.js.map +0 -1
- package/packages/provider-adapter-sdk/dist/src/types.d.ts +0 -182
- package/packages/provider-adapter-sdk/dist/src/types.d.ts.map +0 -1
- package/packages/provider-adapter-sdk/dist/src/types.js +0 -11
- package/packages/provider-adapter-sdk/dist/src/types.js.map +0 -1
- package/packages/provider-router/dist/capability-registry/src/types.d.ts +0 -47
- package/packages/provider-router/dist/capability-registry/src/types.d.ts.map +0 -1
- package/packages/provider-router/dist/capability-registry/src/types.js +0 -10
- package/packages/provider-router/dist/capability-registry/src/types.js.map +0 -1
- package/packages/provider-router/dist/provider-router/src/index.d.ts +0 -23
- package/packages/provider-router/dist/provider-router/src/index.d.ts.map +0 -1
- package/packages/provider-router/dist/provider-router/src/index.js +0 -25
- package/packages/provider-router/dist/provider-router/src/index.js.map +0 -1
- package/packages/provider-router/dist/provider-router/src/policy.d.ts +0 -10
- package/packages/provider-router/dist/provider-router/src/policy.d.ts.map +0 -1
- package/packages/provider-router/dist/provider-router/src/policy.js +0 -45
- package/packages/provider-router/dist/provider-router/src/policy.js.map +0 -1
- package/packages/provider-router/dist/provider-router/src/provider-router.d.ts +0 -56
- package/packages/provider-router/dist/provider-router/src/provider-router.d.ts.map +0 -1
- package/packages/provider-router/dist/provider-router/src/provider-router.js +0 -222
- package/packages/provider-router/dist/provider-router/src/provider-router.js.map +0 -1
- package/packages/provider-router/dist/provider-router/src/strategies.d.ts +0 -19
- package/packages/provider-router/dist/provider-router/src/strategies.d.ts.map +0 -1
- package/packages/provider-router/dist/provider-router/src/strategies.js +0 -110
- package/packages/provider-router/dist/provider-router/src/strategies.js.map +0 -1
- package/packages/provider-router/dist/provider-router/src/types.d.ts +0 -91
- package/packages/provider-router/dist/provider-router/src/types.d.ts.map +0 -1
- package/packages/provider-router/dist/provider-router/src/types.js +0 -10
- package/packages/provider-router/dist/provider-router/src/types.js.map +0 -1
- package/packages/provider-router/dist/src/index.d.ts +0 -23
- package/packages/provider-router/dist/src/index.d.ts.map +0 -1
- package/packages/provider-router/dist/src/index.js +0 -25
- package/packages/provider-router/dist/src/index.js.map +0 -1
- package/packages/provider-router/dist/src/policy.d.ts +0 -10
- package/packages/provider-router/dist/src/policy.d.ts.map +0 -1
- package/packages/provider-router/dist/src/policy.js +0 -45
- package/packages/provider-router/dist/src/policy.js.map +0 -1
- package/packages/provider-router/dist/src/provider-router.d.ts +0 -56
- package/packages/provider-router/dist/src/provider-router.d.ts.map +0 -1
- package/packages/provider-router/dist/src/provider-router.js +0 -222
- package/packages/provider-router/dist/src/provider-router.js.map +0 -1
- package/packages/provider-router/dist/src/strategies.d.ts +0 -19
- package/packages/provider-router/dist/src/strategies.d.ts.map +0 -1
- package/packages/provider-router/dist/src/strategies.js +0 -110
- package/packages/provider-router/dist/src/strategies.js.map +0 -1
- package/packages/provider-router/dist/src/types.d.ts +0 -91
- package/packages/provider-router/dist/src/types.d.ts.map +0 -1
- package/packages/provider-router/dist/src/types.js +0 -10
- package/packages/provider-router/dist/src/types.js.map +0 -1
- package/packages/provider-router/dist/types/src/runtime-types.d.ts +0 -412
- package/packages/provider-router/dist/types/src/runtime-types.d.ts.map +0 -1
- package/packages/provider-router/dist/types/src/runtime-types.js +0 -2
- package/packages/provider-router/dist/types/src/runtime-types.js.map +0 -1
- package/packages/session-api/dist/api.d.ts +0 -83
- package/packages/session-api/dist/api.js +0 -35
- package/packages/session-api/dist/index.d.ts +0 -2
- package/packages/session-api/dist/index.js +0 -2
- package/packages/session-api/dist/types.d.ts +0 -22
- package/packages/session-api/dist/types.js +0 -5
- package/packages/session-export/dist/exporter.d.ts +0 -28
- package/packages/session-export/dist/exporter.js +0 -38
- package/packages/session-export/dist/index.d.ts +0 -2
- package/packages/session-export/dist/index.js +0 -2
- package/packages/session-export/dist/types.d.ts +0 -20
- package/packages/session-export/dist/types.js +0 -5
- package/packages/subscription-engine/dist/engine.d.ts +0 -13
- package/packages/subscription-engine/dist/engine.js +0 -40
- package/packages/subscription-engine/dist/index.d.ts +0 -2
- package/packages/subscription-engine/dist/index.js +0 -2
- package/packages/subscription-engine/dist/subscriptions.d.ts +0 -19
- package/packages/subscription-engine/dist/subscriptions.js +0 -32
- package/packages/subscription-engine/dist/types.d.ts +0 -24
- package/packages/subscription-engine/dist/types.js +0 -5
- package/packages/trajectory/test/store.test.d.ts +0 -2
- package/packages/workflow-events/dist/events.d.ts +0 -38
- package/packages/workflow-events/dist/events.js +0 -46
- package/packages/workflow-events/dist/index.d.ts +0 -2
- package/packages/workflow-events/dist/index.js +0 -2
- package/packages/workflow-events/dist/pipeline.d.ts +0 -21
- package/packages/workflow-events/dist/pipeline.js +0 -27
- package/packages/workflow-events/dist/types.d.ts +0 -110
- package/packages/workflow-events/dist/types.js +0 -5
- package/packages/workflow-events/src/types.d.ts +0 -110
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The risk facts of a pending question.
|
|
3
|
+
*
|
|
4
|
+
* The autonomous decision is only as safe as the facts it is based on: a
|
|
5
|
+
* question that asks for permission for a destructive or irreversible
|
|
6
|
+
* action must never be approved while the user is away. The facts are
|
|
7
|
+
* derived deterministically from the question the agent asked and from the
|
|
8
|
+
* kind of the question - never from a guess.
|
|
9
|
+
*
|
|
10
|
+
* The classifier is deliberately conservative: an uncertain case is
|
|
11
|
+
* classified as "needs an explicit authorization", so the deterministic
|
|
12
|
+
* policy waits for a human instead of continuing the work.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
export type QuestionKindLike =
|
|
16
|
+
| "routine"
|
|
17
|
+
| "approval"
|
|
18
|
+
| "clarification"
|
|
19
|
+
| "explicit"
|
|
20
|
+
| (string & {});
|
|
21
|
+
|
|
22
|
+
/** The risk facts of a proposed action. */
|
|
23
|
+
export interface QuestionRiskFacts {
|
|
24
|
+
/** Does the action need an explicit human authorization? */
|
|
25
|
+
requiresExplicitAuthorization: boolean;
|
|
26
|
+
/** Can the action destroy or damage something? */
|
|
27
|
+
destructive: boolean;
|
|
28
|
+
/** Can the action be undone? */
|
|
29
|
+
reversible: boolean;
|
|
30
|
+
/** Does the action reach the outside world? */
|
|
31
|
+
external: boolean;
|
|
32
|
+
/** The signals that produced the facts (for diagnostics). */
|
|
33
|
+
signals: string[];
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface QuestionRiskInput {
|
|
37
|
+
/** The kind of the question ("routine", "approval", ...). */
|
|
38
|
+
kind?: QuestionKindLike;
|
|
39
|
+
/** The complete question text. */
|
|
40
|
+
text?: string;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
interface RiskPattern {
|
|
44
|
+
/** The name of the signal, used for diagnostics. */
|
|
45
|
+
name: string;
|
|
46
|
+
pattern: RegExp;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Words that name an action that destroys, drops or overwrites something.
|
|
51
|
+
*/
|
|
52
|
+
const DESTRUCTIVE_PATTERNS: RiskPattern[] = [
|
|
53
|
+
{ name: "delete", pattern: /\b(delete|remove|drop|truncate|wipe|purge|destroy|erase)\b/ },
|
|
54
|
+
{ name: "reset", pattern: /\b(reset|rollback|revert)\b/ },
|
|
55
|
+
{ name: "revoke", pattern: /\b(revoke|rotate|invalidate)\b/ },
|
|
56
|
+
{ name: "force-push", pattern: /\b(force[\s-]?push|push\s+(--force|-f\b)|reset\s+--hard|clean\s+-\w*f)\b/ },
|
|
57
|
+
{ name: "drop-object", pattern: /\bdrop\s+(table|database|schema|collection|index|bucket)\b/ },
|
|
58
|
+
{ name: "delete-object", pattern: /\bdelete\s+(the\s+)?(database|table|file|folder|branch|tag|user|account|volume|key)\b/ },
|
|
59
|
+
{ name: "terminate", pattern: /\b(terminate|kill|shutdown|stop)\b/ },
|
|
60
|
+
{ name: "overwrite", pattern: /\boverwrite\b/ },
|
|
61
|
+
];
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Words that name an action that reaches the outside world.
|
|
65
|
+
*/
|
|
66
|
+
const EXTERNAL_PATTERNS: RiskPattern[] = [
|
|
67
|
+
{ name: "production", pattern: /\b(production|prod|live)\b/ },
|
|
68
|
+
{ name: "deploy", pattern: /\b(deploy|publish|release|ship)\b/ },
|
|
69
|
+
{ name: "merge-main", pattern: /\bmerge\b.*\b(main|master|develop)\b/ },
|
|
70
|
+
{ name: "notify-people", pattern: /\b(send|post|notify|email|message|announce)\b.*\b(users|customers|clients|everyone|subscribers|team|customer)\b/ },
|
|
71
|
+
{ name: "money", pattern: /\b(payment|purchase|order|invoice|charge|refund|spend|billing)\b/ },
|
|
72
|
+
];
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Words that name a secret or a credential.
|
|
76
|
+
*/
|
|
77
|
+
const SENSITIVE_PATTERNS: RiskPattern[] = [
|
|
78
|
+
{ name: "credentials", pattern: /\b(secret|credential|api[\s-]?key|token|password)\b/ },
|
|
79
|
+
];
|
|
80
|
+
|
|
81
|
+
function matchPatterns(
|
|
82
|
+
text: string,
|
|
83
|
+
patterns: RiskPattern[],
|
|
84
|
+
signals: string[],
|
|
85
|
+
): boolean {
|
|
86
|
+
let matched = false;
|
|
87
|
+
for (const { name, pattern } of patterns) {
|
|
88
|
+
if (pattern.test(text)) {
|
|
89
|
+
signals.push(name);
|
|
90
|
+
matched = true;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return matched;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Derive the risk facts of a pending question.
|
|
98
|
+
*
|
|
99
|
+
* The rules:
|
|
100
|
+
*
|
|
101
|
+
* - A question that asks for permission for a concrete action ("approval",
|
|
102
|
+
* "explicit") needs the explicit authorization of a human. Jev never
|
|
103
|
+
* approves it on its own.
|
|
104
|
+
* - A question that names a destructive action is destructive, and its
|
|
105
|
+
* reversibility cannot be proven - so it waits.
|
|
106
|
+
* - A question with an unknown kind or an empty text is uncertain, and an
|
|
107
|
+
* uncertain case waits for the human.
|
|
108
|
+
* - Only a routine question without a destructive or external signal is
|
|
109
|
+
* harmless enough for an autonomous decision.
|
|
110
|
+
*/
|
|
111
|
+
export function classifyQuestionRisk(
|
|
112
|
+
input: QuestionRiskInput,
|
|
113
|
+
): QuestionRiskFacts {
|
|
114
|
+
const text = (input.text ?? "").toLowerCase();
|
|
115
|
+
const kind = input.kind;
|
|
116
|
+
const signals: string[] = [];
|
|
117
|
+
|
|
118
|
+
const destructive = matchPatterns(text, DESTRUCTIVE_PATTERNS, signals);
|
|
119
|
+
const external = matchPatterns(text, EXTERNAL_PATTERNS, signals);
|
|
120
|
+
const sensitive = matchPatterns(text, SENSITIVE_PATTERNS, signals);
|
|
121
|
+
|
|
122
|
+
// The agent asked for permission for a concrete action.
|
|
123
|
+
let requiresExplicitAuthorization =
|
|
124
|
+
kind === "approval" || kind === "explicit";
|
|
125
|
+
|
|
126
|
+
// A destructive action never gets an autonomous approval.
|
|
127
|
+
if (destructive) {
|
|
128
|
+
requiresExplicitAuthorization = true;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// An action that reaches the outside world or touches a secret needs a
|
|
132
|
+
// human as well.
|
|
133
|
+
if (external || sensitive) {
|
|
134
|
+
requiresExplicitAuthorization = true;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// Unknown kind or unknown text: the action cannot be judged.
|
|
138
|
+
if (!kind || !text.trim()) {
|
|
139
|
+
requiresExplicitAuthorization = true;
|
|
140
|
+
signals.push("unknown-question");
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
return {
|
|
144
|
+
requiresExplicitAuthorization,
|
|
145
|
+
destructive,
|
|
146
|
+
// A destructive action is not provably reversible.
|
|
147
|
+
reversible: !destructive,
|
|
148
|
+
external,
|
|
149
|
+
signals,
|
|
150
|
+
};
|
|
151
|
+
}
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Decision context tests.
|
|
3
|
+
*
|
|
4
|
+
* Jev has to see the question it decides about, and the deterministic policy
|
|
5
|
+
* has to decide what is actually allowed. A clarification is never an
|
|
6
|
+
* approval, and an action that needs an explicit authorization or that
|
|
7
|
+
* cannot be undone is never approved autonomously.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { describe, it, expect } from "bun:test";
|
|
11
|
+
import {
|
|
12
|
+
applyDecisionPolicy,
|
|
13
|
+
buildDecisionState,
|
|
14
|
+
createTaskState,
|
|
15
|
+
isEligibleForDecision,
|
|
16
|
+
MAX_LISTED_TASKS,
|
|
17
|
+
MAX_QUESTION_CHARS,
|
|
18
|
+
type DecisionContext,
|
|
19
|
+
} from "../src/auto-continue.js";
|
|
20
|
+
|
|
21
|
+
function context(overrides: Partial<DecisionContext> = {}): DecisionContext {
|
|
22
|
+
return {
|
|
23
|
+
question: {
|
|
24
|
+
requestId: "q-123",
|
|
25
|
+
text: "Want me to implement the toggle buttons now?",
|
|
26
|
+
kind: "approval",
|
|
27
|
+
proposedAction: "implement the toggle buttons",
|
|
28
|
+
consequence: "the button files change",
|
|
29
|
+
requiresExplicitAuthorization: false,
|
|
30
|
+
destructive: false,
|
|
31
|
+
external: false,
|
|
32
|
+
reversible: true,
|
|
33
|
+
},
|
|
34
|
+
currentTask: "Build the toggle",
|
|
35
|
+
completionRatio: 0.5,
|
|
36
|
+
totalTasks: 4,
|
|
37
|
+
completedTasks: 2,
|
|
38
|
+
blockers: [],
|
|
39
|
+
nextTasks: ["Build the toggle", "Write the test"],
|
|
40
|
+
validationStatus: "no pending final tier",
|
|
41
|
+
waitedMinutes: 6,
|
|
42
|
+
deadlineMinutes: 30,
|
|
43
|
+
...overrides,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
describe("decision threshold", () => {
|
|
48
|
+
it("is not eligible before the threshold", () => {
|
|
49
|
+
expect(isEligibleForDecision(4.9, 5)).toBe(false);
|
|
50
|
+
expect(isEligibleForDecision(5, 5)).toBe(true);
|
|
51
|
+
expect(isEligibleForDecision(30, 5)).toBe(true);
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
describe("decision state", () => {
|
|
56
|
+
it("carries the question, the kind and the risk of the action", () => {
|
|
57
|
+
const state = buildDecisionState(
|
|
58
|
+
createTaskState(["a"], ["b"], new Date(), new Date(), context()),
|
|
59
|
+
) as any;
|
|
60
|
+
|
|
61
|
+
expect(state.pending_question.request_id).toBe("q-123");
|
|
62
|
+
expect(state.pending_question.kind).toBe("approval");
|
|
63
|
+
expect(state.pending_question.text).toContain("toggle buttons");
|
|
64
|
+
expect(state.pending_question.proposed_action).toBe(
|
|
65
|
+
"implement the toggle buttons",
|
|
66
|
+
);
|
|
67
|
+
expect(state.pending_question.consequence_of_approval).toBe(
|
|
68
|
+
"the button files change",
|
|
69
|
+
);
|
|
70
|
+
expect(state.pending_question.destructive).toBe(false);
|
|
71
|
+
expect(state.pending_question.reversible).toBe(true);
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
it("carries the bounded task and risk context", () => {
|
|
75
|
+
const state = buildDecisionState(
|
|
76
|
+
createTaskState(["a"], ["b"], new Date(), new Date(), context()),
|
|
77
|
+
) as any;
|
|
78
|
+
|
|
79
|
+
expect(state.decision_context.current_task).toBe("Build the toggle");
|
|
80
|
+
expect(state.decision_context.completion_ratio).toBe(0.5);
|
|
81
|
+
expect(state.decision_context.validation_status).toBe(
|
|
82
|
+
"no pending final tier",
|
|
83
|
+
);
|
|
84
|
+
expect(state.decision_context.waited_minutes).toBe(6);
|
|
85
|
+
expect(state.decision_context.deadline_minutes).toBe(30);
|
|
86
|
+
expect(state.decision_context.next_tasks).toHaveLength(2);
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
it("bounds the task lists and the question text", () => {
|
|
90
|
+
const many = Array.from({ length: 50 }, (_, i) => `task ${i}`);
|
|
91
|
+
const state = buildDecisionState(
|
|
92
|
+
createTaskState(
|
|
93
|
+
many,
|
|
94
|
+
many,
|
|
95
|
+
new Date(),
|
|
96
|
+
new Date(),
|
|
97
|
+
context({
|
|
98
|
+
question: {
|
|
99
|
+
requestId: "q-123",
|
|
100
|
+
text: "x".repeat(MAX_QUESTION_CHARS + 500),
|
|
101
|
+
kind: "approval",
|
|
102
|
+
},
|
|
103
|
+
nextTasks: many,
|
|
104
|
+
}),
|
|
105
|
+
),
|
|
106
|
+
) as any;
|
|
107
|
+
|
|
108
|
+
expect(state.task_summary.completed_list).toHaveLength(MAX_LISTED_TASKS);
|
|
109
|
+
expect(state.task_summary.remaining_list).toHaveLength(MAX_LISTED_TASKS);
|
|
110
|
+
expect(state.decision_context.next_tasks).toHaveLength(MAX_LISTED_TASKS);
|
|
111
|
+
expect(state.pending_question.text).toHaveLength(MAX_QUESTION_CHARS);
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
it("has no question when there is none", () => {
|
|
115
|
+
const state = buildDecisionState(
|
|
116
|
+
createTaskState(["a"], ["b"], new Date(), new Date()),
|
|
117
|
+
) as any;
|
|
118
|
+
|
|
119
|
+
expect(state.pending_question).toBeNull();
|
|
120
|
+
});
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
describe("decision policy", () => {
|
|
124
|
+
it("never turns a clarification into an approval", () => {
|
|
125
|
+
const result = applyDecisionPolicy(
|
|
126
|
+
"approve",
|
|
127
|
+
context({
|
|
128
|
+
question: {
|
|
129
|
+
requestId: "q-1",
|
|
130
|
+
text: "Do you mean the toggle or the switch?",
|
|
131
|
+
kind: "clarification",
|
|
132
|
+
},
|
|
133
|
+
}),
|
|
134
|
+
{ confidence: 0.99 },
|
|
135
|
+
);
|
|
136
|
+
|
|
137
|
+
expect(result.outcome).toBe("wait");
|
|
138
|
+
expect(result.appliedRule).toBe("clarification-never-approved");
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
it("never approves an action that needs an explicit authorization", () => {
|
|
142
|
+
const result = applyDecisionPolicy(
|
|
143
|
+
"approve",
|
|
144
|
+
context({
|
|
145
|
+
question: {
|
|
146
|
+
requestId: "q-1",
|
|
147
|
+
text: "Shall I deploy to production?",
|
|
148
|
+
kind: "explicit",
|
|
149
|
+
requiresExplicitAuthorization: true,
|
|
150
|
+
},
|
|
151
|
+
}),
|
|
152
|
+
{ confidence: 0.99 },
|
|
153
|
+
);
|
|
154
|
+
|
|
155
|
+
expect(result.outcome).toBe("wait");
|
|
156
|
+
expect(result.appliedRule).toBe("explicit-authorization-required");
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
it("never approves an irreversible destructive action", () => {
|
|
160
|
+
const result = applyDecisionPolicy(
|
|
161
|
+
"approve",
|
|
162
|
+
context({
|
|
163
|
+
question: {
|
|
164
|
+
requestId: "q-1",
|
|
165
|
+
text: "Shall I drop the production table?",
|
|
166
|
+
kind: "approval",
|
|
167
|
+
destructive: true,
|
|
168
|
+
reversible: false,
|
|
169
|
+
},
|
|
170
|
+
}),
|
|
171
|
+
{ confidence: 0.99 },
|
|
172
|
+
);
|
|
173
|
+
|
|
174
|
+
expect(result.outcome).toBe("wait");
|
|
175
|
+
expect(result.appliedRule).toBe("irreversible-action");
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
it("proceeds with caution when a destructive action is reversible", () => {
|
|
179
|
+
const result = applyDecisionPolicy(
|
|
180
|
+
"approve",
|
|
181
|
+
context({
|
|
182
|
+
question: {
|
|
183
|
+
requestId: "q-1",
|
|
184
|
+
text: "Shall I regenerate the snapshots?",
|
|
185
|
+
kind: "approval",
|
|
186
|
+
destructive: true,
|
|
187
|
+
reversible: true,
|
|
188
|
+
},
|
|
189
|
+
}),
|
|
190
|
+
{ confidence: 0.99 },
|
|
191
|
+
);
|
|
192
|
+
|
|
193
|
+
expect(result.outcome).toBe("proceed_with_caution");
|
|
194
|
+
expect(result.appliedRule).toBe("destructive-action");
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
it("waits when the confidence is below the threshold", () => {
|
|
198
|
+
const result = applyDecisionPolicy("approve", context(), {
|
|
199
|
+
confidence: 0.4,
|
|
200
|
+
confidenceThreshold: 0.7,
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
expect(result.outcome).toBe("wait");
|
|
204
|
+
expect(result.appliedRule).toBe("confidence-below-threshold");
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
it("approves a low risk approval with a high confidence", () => {
|
|
208
|
+
const result = applyDecisionPolicy("approve", context(), {
|
|
209
|
+
confidence: 0.9,
|
|
210
|
+
confidenceThreshold: 0.7,
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
expect(result.outcome).toBe("approve");
|
|
214
|
+
expect(result.appliedRule).toBeUndefined();
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
it("keeps a wait and a reject decision", () => {
|
|
218
|
+
expect(applyDecisionPolicy("wait", context()).outcome).toBe("wait");
|
|
219
|
+
expect(applyDecisionPolicy("reject", context()).outcome).toBe("reject");
|
|
220
|
+
});
|
|
221
|
+
});
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The structured outcome of the evaluation.
|
|
3
|
+
*
|
|
4
|
+
* Jev has to be able to reject a proposed action, and the outcome of the
|
|
5
|
+
* evaluation may only tighten the decision the thresholds allow.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { describe, it, expect } from "bun:test";
|
|
9
|
+
import {
|
|
10
|
+
applyDecisionPolicy,
|
|
11
|
+
isDecisionOutcome,
|
|
12
|
+
tightenOutcome,
|
|
13
|
+
type DecisionContext,
|
|
14
|
+
} from "../src/auto-continue.js";
|
|
15
|
+
|
|
16
|
+
const context: DecisionContext = {
|
|
17
|
+
question: {
|
|
18
|
+
requestId: "q-1",
|
|
19
|
+
text: "Should I continue with the remaining tasks?",
|
|
20
|
+
kind: "routine",
|
|
21
|
+
requiresExplicitAuthorization: false,
|
|
22
|
+
destructive: false,
|
|
23
|
+
external: false,
|
|
24
|
+
reversible: true,
|
|
25
|
+
},
|
|
26
|
+
currentTask: "Build the toggle",
|
|
27
|
+
completionRatio: 0.5,
|
|
28
|
+
totalTasks: 4,
|
|
29
|
+
completedTasks: 2,
|
|
30
|
+
blockers: [],
|
|
31
|
+
nextTasks: ["Build the toggle"],
|
|
32
|
+
validationStatus: "no pending final tier",
|
|
33
|
+
waitedMinutes: 6,
|
|
34
|
+
deadlineMinutes: 30,
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
describe("the structured outcome of the evaluation", () => {
|
|
38
|
+
it("recognizes the known outcomes", () => {
|
|
39
|
+
expect(isDecisionOutcome("approve")).toBe(true);
|
|
40
|
+
expect(isDecisionOutcome("proceed_with_caution")).toBe(true);
|
|
41
|
+
expect(isDecisionOutcome("wait")).toBe(true);
|
|
42
|
+
expect(isDecisionOutcome("reject")).toBe(true);
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
it("ignores an unknown outcome", () => {
|
|
46
|
+
expect(isDecisionOutcome("maybe")).toBe(false);
|
|
47
|
+
expect(isDecisionOutcome(undefined)).toBe(false);
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
describe("tightenOutcome", () => {
|
|
52
|
+
it("keeps a rejection a rejection", () => {
|
|
53
|
+
expect(tightenOutcome("approve", "reject")).toBe("reject");
|
|
54
|
+
expect(tightenOutcome("wait", "reject")).toBe("reject");
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it("keeps a wait a wait", () => {
|
|
58
|
+
expect(tightenOutcome("approve", "wait")).toBe("wait");
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it("turns an approval into a cautious approval", () => {
|
|
62
|
+
expect(tightenOutcome("approve", "proceed_with_caution")).toBe(
|
|
63
|
+
"proceed_with_caution",
|
|
64
|
+
);
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it("never lets an approval beat the thresholds", () => {
|
|
68
|
+
expect(tightenOutcome("wait", "approve")).toBe("wait");
|
|
69
|
+
expect(tightenOutcome("proceed_with_caution", "approve")).toBe(
|
|
70
|
+
"proceed_with_caution",
|
|
71
|
+
);
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
it("keeps the threshold outcome without a proposal", () => {
|
|
75
|
+
expect(tightenOutcome("approve", undefined)).toBe("approve");
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
describe("the policy of a rejection", () => {
|
|
80
|
+
it("keeps a rejection", () => {
|
|
81
|
+
const result = applyDecisionPolicy("reject", context);
|
|
82
|
+
|
|
83
|
+
expect(result.outcome).toBe("reject");
|
|
84
|
+
expect(result.appliedRule).toBeUndefined();
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
it("never turns a rejection into an approval", () => {
|
|
88
|
+
const result = applyDecisionPolicy("reject", context, {
|
|
89
|
+
confidence: 0.99,
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
expect(result.outcome).toBe("reject");
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
describe("the policy of unknown risk facts", () => {
|
|
97
|
+
it("waits when nothing is known about the action", () => {
|
|
98
|
+
const result = applyDecisionPolicy(
|
|
99
|
+
"approve",
|
|
100
|
+
{
|
|
101
|
+
...context,
|
|
102
|
+
question: {
|
|
103
|
+
requestId: "q-1",
|
|
104
|
+
text: "Should I continue?",
|
|
105
|
+
kind: "routine",
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
{ confidence: 0.99 },
|
|
109
|
+
);
|
|
110
|
+
|
|
111
|
+
expect(result.outcome).toBe("wait");
|
|
112
|
+
expect(result.appliedRule).toBe("unknown-risk-facts");
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
it("still blocks a clarification first", () => {
|
|
116
|
+
const result = applyDecisionPolicy(
|
|
117
|
+
"approve",
|
|
118
|
+
{
|
|
119
|
+
...context,
|
|
120
|
+
question: {
|
|
121
|
+
requestId: "q-1",
|
|
122
|
+
text: "Do you mean the toggle or the switch?",
|
|
123
|
+
kind: "clarification",
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
{ confidence: 0.99 },
|
|
127
|
+
);
|
|
128
|
+
|
|
129
|
+
expect(result.outcome).toBe("wait");
|
|
130
|
+
expect(result.appliedRule).toBe("clarification-never-approved");
|
|
131
|
+
});
|
|
132
|
+
});
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The risk facts of a pending question.
|
|
3
|
+
*
|
|
4
|
+
* The autonomous decision is only as safe as the facts it rests on: a
|
|
5
|
+
* question that asks for permission for a destructive or irreversible
|
|
6
|
+
* action must never be approved while the user is away.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { describe, it, expect } from "bun:test";
|
|
10
|
+
import { classifyQuestionRisk } from "../src/question-risk.js";
|
|
11
|
+
|
|
12
|
+
describe("classifyQuestionRisk", () => {
|
|
13
|
+
describe("a routine continuation question", () => {
|
|
14
|
+
it("is harmless enough for an autonomous decision", () => {
|
|
15
|
+
const risk = classifyQuestionRisk({
|
|
16
|
+
kind: "routine",
|
|
17
|
+
text: "Should I continue with the remaining tasks?",
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
expect(risk.requiresExplicitAuthorization).toBe(false);
|
|
21
|
+
expect(risk.destructive).toBe(false);
|
|
22
|
+
expect(risk.reversible).toBe(true);
|
|
23
|
+
expect(risk.external).toBe(false);
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
describe("a question that asks for permission", () => {
|
|
28
|
+
it("needs an explicit authorization for an approval question", () => {
|
|
29
|
+
const risk = classifyQuestionRisk({
|
|
30
|
+
kind: "approval",
|
|
31
|
+
text: "Want me to implement the toggle buttons now?",
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
expect(risk.requiresExplicitAuthorization).toBe(true);
|
|
35
|
+
expect(risk.destructive).toBe(false);
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it("needs an explicit authorization for an explicit question", () => {
|
|
39
|
+
const risk = classifyQuestionRisk({
|
|
40
|
+
kind: "explicit",
|
|
41
|
+
text: "Shall I push the release?",
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
expect(risk.requiresExplicitAuthorization).toBe(true);
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
describe("a destructive action", () => {
|
|
49
|
+
it("is destructive even in a routine question", () => {
|
|
50
|
+
const risk = classifyQuestionRisk({
|
|
51
|
+
kind: "routine",
|
|
52
|
+
text: "Should I remove the old config file now?",
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
expect(risk.destructive).toBe(true);
|
|
56
|
+
expect(risk.requiresExplicitAuthorization).toBe(true);
|
|
57
|
+
expect(risk.reversible).toBe(false);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
it("recognizes a dropped database table", () => {
|
|
61
|
+
const risk = classifyQuestionRisk({
|
|
62
|
+
kind: "routine",
|
|
63
|
+
text: "Should I drop table users from the dev database?",
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
expect(risk.destructive).toBe(true);
|
|
67
|
+
expect(risk.reversible).toBe(false);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it("recognizes a force push", () => {
|
|
71
|
+
const risk = classifyQuestionRisk({
|
|
72
|
+
kind: "routine",
|
|
73
|
+
text: "Should I git push --force to the remote?",
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
expect(risk.destructive).toBe(true);
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
describe("an uncertain question", () => {
|
|
81
|
+
it("waits when the kind is unknown", () => {
|
|
82
|
+
const risk = classifyQuestionRisk({ text: "Should I go on?" });
|
|
83
|
+
|
|
84
|
+
expect(risk.requiresExplicitAuthorization).toBe(true);
|
|
85
|
+
expect(risk.signals).toContain("unknown-question");
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
it("waits when the text is empty", () => {
|
|
89
|
+
const risk = classifyQuestionRisk({ kind: "routine", text: " " });
|
|
90
|
+
|
|
91
|
+
expect(risk.requiresExplicitAuthorization).toBe(true);
|
|
92
|
+
expect(risk.signals).toContain("unknown-question");
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
describe("an action that reaches the outside world", () => {
|
|
97
|
+
it("is external", () => {
|
|
98
|
+
const risk = classifyQuestionRisk({
|
|
99
|
+
kind: "routine",
|
|
100
|
+
text: "Should I deploy to production now?",
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
expect(risk.external).toBe(true);
|
|
104
|
+
expect(risk.requiresExplicitAuthorization).toBe(true);
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
it("recognizes a message to the users", () => {
|
|
108
|
+
const risk = classifyQuestionRisk({
|
|
109
|
+
kind: "routine",
|
|
110
|
+
text: "Should I send the announcement email to all customers?",
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
expect(risk.external).toBe(true);
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
});
|