visionclaw 0.1.213-beta.13 → 0.1.213-beta.16
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/applied-credential-signature.d.ts +53 -0
- package/dist/agent/applied-credential-signature.d.ts.map +1 -0
- package/dist/agent/applied-credential-signature.js +137 -0
- package/dist/agent/applied-credential-signature.js.map +1 -0
- package/dist/agent/capabilities.d.ts +56 -0
- package/dist/agent/capabilities.d.ts.map +1 -0
- package/dist/agent/capabilities.js +121 -0
- package/dist/agent/capabilities.js.map +1 -0
- package/dist/agent/compaction-failure.d.ts +9 -0
- package/dist/agent/compaction-failure.d.ts.map +1 -0
- package/dist/agent/compaction-failure.js +11 -0
- package/dist/agent/compaction-failure.js.map +1 -0
- package/dist/agent/compaction-policy.d.ts +2 -0
- package/dist/agent/compaction-policy.d.ts.map +1 -1
- package/dist/agent/compaction-policy.js +2 -0
- package/dist/agent/compaction-policy.js.map +1 -1
- package/dist/agent/context-refresh.d.ts +2 -0
- package/dist/agent/context-refresh.d.ts.map +1 -1
- package/dist/agent/context-refresh.js +8 -2
- package/dist/agent/context-refresh.js.map +1 -1
- package/dist/agent/deep-night-dreaming.d.ts +68 -0
- package/dist/agent/deep-night-dreaming.d.ts.map +1 -0
- package/dist/agent/deep-night-dreaming.js +99 -0
- package/dist/agent/deep-night-dreaming.js.map +1 -0
- package/dist/agent/engines/client-factory.d.ts +63 -0
- package/dist/agent/engines/client-factory.d.ts.map +1 -0
- package/dist/agent/engines/client-factory.js +382 -0
- package/dist/agent/engines/client-factory.js.map +1 -0
- package/dist/agent/engines/engine.d.ts +8 -0
- package/dist/agent/engines/engine.d.ts.map +1 -0
- package/dist/agent/engines/engine.js +15 -0
- package/dist/agent/engines/engine.js.map +1 -0
- package/dist/agent/engines/openai/file-session.d.ts +19 -0
- package/dist/agent/engines/openai/file-session.d.ts.map +1 -0
- package/dist/agent/engines/openai/file-session.js +78 -0
- package/dist/agent/engines/openai/file-session.js.map +1 -0
- package/dist/agent/engines/openai/file-tools.d.ts +35 -0
- package/dist/agent/engines/openai/file-tools.d.ts.map +1 -0
- package/dist/agent/engines/openai/file-tools.js +194 -0
- package/dist/agent/engines/openai/file-tools.js.map +1 -0
- package/dist/agent/engines/openai/session.d.ts +55 -0
- package/dist/agent/engines/openai/session.d.ts.map +1 -0
- package/dist/agent/engines/openai/session.js +447 -0
- package/dist/agent/engines/openai/session.js.map +1 -0
- package/dist/agent/engines/openai/tools.d.ts +15 -0
- package/dist/agent/engines/openai/tools.d.ts.map +1 -0
- package/dist/agent/engines/openai/tools.js +221 -0
- package/dist/agent/engines/openai/tools.js.map +1 -0
- package/dist/agent/engines/pi/session.d.ts +49 -0
- package/dist/agent/engines/pi/session.d.ts.map +1 -0
- package/dist/agent/engines/pi/session.js +309 -0
- package/dist/agent/engines/pi/session.js.map +1 -0
- package/dist/agent/engines/pi-coding/responses-image-detail.d.ts +7 -0
- package/dist/agent/engines/pi-coding/responses-image-detail.d.ts.map +1 -0
- package/dist/agent/engines/pi-coding/responses-image-detail.js +29 -0
- package/dist/agent/engines/pi-coding/responses-image-detail.js.map +1 -0
- package/dist/agent/engines/pi-coding/session.d.ts +1 -0
- package/dist/agent/engines/pi-coding/session.d.ts.map +1 -1
- package/dist/agent/engines/pi-coding/session.js +36 -5
- package/dist/agent/engines/pi-coding/session.js.map +1 -1
- package/dist/agent/external-context/finapp-capability.d.ts +30 -0
- package/dist/agent/external-context/finapp-capability.d.ts.map +1 -0
- package/dist/agent/external-context/finapp-capability.js +72 -0
- package/dist/agent/external-context/finapp-capability.js.map +1 -0
- package/dist/agent/external-context/providers/finapp.d.ts.map +1 -1
- package/dist/agent/external-context/providers/finapp.js +48 -8
- package/dist/agent/external-context/providers/finapp.js.map +1 -1
- package/dist/agent/heartbeat-manager.d.ts +20 -0
- package/dist/agent/heartbeat-manager.d.ts.map +1 -1
- package/dist/agent/heartbeat-manager.js +24 -0
- package/dist/agent/heartbeat-manager.js.map +1 -1
- package/dist/agent/interrupt-handler.d.ts +7 -0
- package/dist/agent/interrupt-handler.d.ts.map +1 -1
- package/dist/agent/interrupt-handler.js +34 -7
- package/dist/agent/interrupt-handler.js.map +1 -1
- package/dist/agent/loop.d.ts.map +1 -1
- package/dist/agent/loop.js +15 -33
- package/dist/agent/loop.js.map +1 -1
- package/dist/agent/memory-dreaming-sweep.d.ts +99 -0
- package/dist/agent/memory-dreaming-sweep.d.ts.map +1 -0
- package/dist/agent/memory-dreaming-sweep.js +171 -0
- package/dist/agent/memory-dreaming-sweep.js.map +1 -0
- package/dist/agent/memory-dreaming.d.ts +85 -43
- package/dist/agent/memory-dreaming.d.ts.map +1 -1
- package/dist/agent/memory-dreaming.js +476 -188
- package/dist/agent/memory-dreaming.js.map +1 -1
- package/dist/agent/memory-injector.d.ts.map +1 -1
- package/dist/agent/memory-injector.js +16 -14
- package/dist/agent/memory-injector.js.map +1 -1
- package/dist/agent/memory-preload.d.ts +55 -0
- package/dist/agent/memory-preload.d.ts.map +1 -0
- package/dist/agent/memory-preload.js +166 -0
- package/dist/agent/memory-preload.js.map +1 -0
- package/dist/agent/providers/claude/cli-resolver.d.ts +16 -0
- package/dist/agent/providers/claude/cli-resolver.d.ts.map +1 -0
- package/dist/agent/providers/claude/cli-resolver.js +83 -0
- package/dist/agent/providers/claude/cli-resolver.js.map +1 -0
- package/dist/agent/providers/claude/session-browser-policy.d.ts +9 -0
- package/dist/agent/providers/claude/session-browser-policy.d.ts.map +1 -0
- package/dist/agent/providers/claude/session-browser-policy.js +49 -0
- package/dist/agent/providers/claude/session-browser-policy.js.map +1 -0
- package/dist/agent/providers/claude/session.d.ts +304 -0
- package/dist/agent/providers/claude/session.d.ts.map +1 -0
- package/dist/agent/providers/claude/session.js +1236 -0
- package/dist/agent/providers/claude/session.js.map +1 -0
- package/dist/agent/providers/client-factory.d.ts +60 -0
- package/dist/agent/providers/client-factory.d.ts.map +1 -0
- package/dist/agent/providers/client-factory.js +400 -0
- package/dist/agent/providers/client-factory.js.map +1 -0
- package/dist/agent/providers/openai/file-session.d.ts +19 -0
- package/dist/agent/providers/openai/file-session.d.ts.map +1 -0
- package/dist/agent/providers/openai/file-session.js +78 -0
- package/dist/agent/providers/openai/file-session.js.map +1 -0
- package/dist/agent/providers/openai/session.d.ts +55 -0
- package/dist/agent/providers/openai/session.d.ts.map +1 -0
- package/dist/agent/providers/openai/session.js +447 -0
- package/dist/agent/providers/openai/session.js.map +1 -0
- package/dist/agent/providers/openai/tools.d.ts +15 -0
- package/dist/agent/providers/openai/tools.d.ts.map +1 -0
- package/dist/agent/providers/openai/tools.js +229 -0
- package/dist/agent/providers/openai/tools.js.map +1 -0
- package/dist/agent/providers/session-types.d.ts +153 -0
- package/dist/agent/providers/session-types.d.ts.map +1 -0
- package/dist/agent/providers/session-types.js +2 -0
- package/dist/agent/providers/session-types.js.map +1 -0
- package/dist/agent/providers/system-prompt-log.d.ts +9 -0
- package/dist/agent/providers/system-prompt-log.d.ts.map +1 -0
- package/dist/agent/providers/system-prompt-log.js +46 -0
- package/dist/agent/providers/system-prompt-log.js.map +1 -0
- package/dist/agent/qq-claim-signal.d.ts +9 -0
- package/dist/agent/qq-claim-signal.d.ts.map +1 -0
- package/dist/agent/qq-claim-signal.js +38 -0
- package/dist/agent/qq-claim-signal.js.map +1 -0
- package/dist/agent/runtime-telemetry-redaction.d.ts +4 -0
- package/dist/agent/runtime-telemetry-redaction.d.ts.map +1 -0
- package/dist/agent/runtime-telemetry-redaction.js +92 -0
- package/dist/agent/runtime-telemetry-redaction.js.map +1 -0
- package/dist/agent/stream-handler.d.ts.map +1 -1
- package/dist/agent/stream-handler.js +13 -1
- package/dist/agent/stream-handler.js.map +1 -1
- package/dist/agent/transcript-backfill.d.ts +54 -0
- package/dist/agent/transcript-backfill.d.ts.map +1 -0
- package/dist/agent/transcript-backfill.js +604 -0
- package/dist/agent/transcript-backfill.js.map +1 -0
- package/dist/agent/transcript-indexer.d.ts +200 -0
- package/dist/agent/transcript-indexer.d.ts.map +1 -0
- package/dist/agent/transcript-indexer.js +775 -0
- package/dist/agent/transcript-indexer.js.map +1 -0
- package/dist/agent/transcript-memory-migrations.d.ts +25 -0
- package/dist/agent/transcript-memory-migrations.d.ts.map +1 -0
- package/dist/agent/transcript-memory-migrations.js +87 -0
- package/dist/agent/transcript-memory-migrations.js.map +1 -0
- package/dist/agent/transcript-summarizer.d.ts +6 -2
- package/dist/agent/transcript-summarizer.d.ts.map +1 -1
- package/dist/agent/transcript-summarizer.js +8 -4
- package/dist/agent/transcript-summarizer.js.map +1 -1
- package/dist/agent/tunnel-credential-handler.d.ts +90 -0
- package/dist/agent/tunnel-credential-handler.d.ts.map +1 -0
- package/dist/agent/tunnel-credential-handler.js +162 -0
- package/dist/agent/tunnel-credential-handler.js.map +1 -0
- package/dist/agent/usage-backfill-handler.d.ts +18 -0
- package/dist/agent/usage-backfill-handler.d.ts.map +1 -0
- package/dist/agent/usage-backfill-handler.js +69 -0
- package/dist/agent/usage-backfill-handler.js.map +1 -0
- package/dist/agent/usage-gate.d.ts +25 -0
- package/dist/agent/usage-gate.d.ts.map +1 -0
- package/dist/agent/usage-gate.js +83 -0
- package/dist/agent/usage-gate.js.map +1 -0
- package/dist/agent/usage-handler.d.ts +7 -0
- package/dist/agent/usage-handler.d.ts.map +1 -0
- package/dist/agent/usage-handler.js +28 -0
- package/dist/agent/usage-handler.js.map +1 -0
- package/dist/agent/usage-report-builder.d.ts +26 -0
- package/dist/agent/usage-report-builder.d.ts.map +1 -0
- package/dist/agent/usage-report-builder.js +80 -0
- package/dist/agent/usage-report-builder.js.map +1 -0
- package/dist/agent/usage-report-queue.d.ts +26 -0
- package/dist/agent/usage-report-queue.d.ts.map +1 -0
- package/dist/agent/usage-report-queue.js +199 -0
- package/dist/agent/usage-report-queue.js.map +1 -0
- package/dist/agent/usage-report-types.d.ts +41 -0
- package/dist/agent/usage-report-types.d.ts.map +1 -0
- package/dist/agent/usage-report-types.js +2 -0
- package/dist/agent/usage-report-types.js.map +1 -0
- package/dist/agent/usage-reporter.d.ts +31 -0
- package/dist/agent/usage-reporter.d.ts.map +1 -0
- package/dist/agent/usage-reporter.js +102 -0
- package/dist/agent/usage-reporter.js.map +1 -0
- package/dist/agent/wake-cycle-runner.d.ts.map +1 -1
- package/dist/agent/wake-cycle-runner.js +72 -0
- package/dist/agent/wake-cycle-runner.js.map +1 -1
- package/dist/agent/wake-cycle-tool-tracker.d.ts +39 -0
- package/dist/agent/wake-cycle-tool-tracker.d.ts.map +1 -0
- package/dist/agent/wake-cycle-tool-tracker.js +72 -0
- package/dist/agent/wake-cycle-tool-tracker.js.map +1 -0
- package/dist/anthropic-credentials.d.ts +24 -0
- package/dist/anthropic-credentials.d.ts.map +1 -0
- package/dist/anthropic-credentials.js +37 -0
- package/dist/anthropic-credentials.js.map +1 -0
- package/dist/billing/payg-handler.d.ts +29 -0
- package/dist/billing/payg-handler.d.ts.map +1 -0
- package/dist/billing/payg-handler.js +92 -0
- package/dist/billing/payg-handler.js.map +1 -0
- package/dist/billing/payment-handler.d.ts +24 -0
- package/dist/billing/payment-handler.d.ts.map +1 -0
- package/dist/billing/payment-handler.js +101 -0
- package/dist/billing/payment-handler.js.map +1 -0
- package/dist/builtin-skills/catalog/phone-adb-automation/SKILL.md +412 -0
- package/dist/builtin-skills/catalog/phone-adb-automation/phone_input.sh +132 -0
- package/dist/builtin-skills/catalog/phone-adb-automation/phone_launch.sh +166 -0
- package/dist/builtin-skills/catalog/phone-adb-automation/phone_screenshot.sh +87 -0
- package/dist/builtin-skills/catalog/phone-adb-automation/phone_security_kbd.py +174 -0
- package/dist/builtin-skills/catalog/phone-adb-automation/phone_setup.sh +274 -0
- package/dist/builtin-skills/catalog/phone-adb-automation/phone_swipe.sh +111 -0
- package/dist/builtin-skills/catalog/phone-adb-automation/phone_tap.sh +87 -0
- package/dist/builtin-skills/catalog/phone-adb-automation/phone_ui_parse.py +176 -0
- package/dist/builtin-skills/catalog/phone-adb-automation/phone_wake_unlock.sh +67 -0
- package/dist/builtin-skills/fin-app/SKILL.md +3 -3
- package/dist/builtin-skills/fin-app/core-contract.md +4 -3
- package/dist/builtin-skills/transcribe-audio/SKILL.md +122 -0
- package/dist/calendar/google-calendar.d.ts +54 -0
- package/dist/calendar/google-calendar.d.ts.map +1 -0
- package/dist/calendar/google-calendar.js +156 -0
- package/dist/calendar/google-calendar.js.map +1 -0
- package/dist/channels/web.d.ts +40 -0
- package/dist/channels/web.d.ts.map +1 -0
- package/dist/channels/web.js +137 -0
- package/dist/channels/web.js.map +1 -0
- package/dist/config/models.d.ts +32 -0
- package/dist/config/models.d.ts.map +1 -0
- package/dist/config/models.js +57 -0
- package/dist/config/models.js.map +1 -0
- package/dist/data-processing/convert-demo-cli.d.ts +7 -0
- package/dist/data-processing/convert-demo-cli.d.ts.map +1 -0
- package/dist/data-processing/convert-demo-cli.js +30 -0
- package/dist/data-processing/convert-demo-cli.js.map +1 -0
- package/dist/data-processing/convert-demo.d.ts +26 -0
- package/dist/data-processing/convert-demo.d.ts.map +1 -0
- package/dist/data-processing/convert-demo.js +233 -0
- package/dist/data-processing/convert-demo.js.map +1 -0
- package/dist/drive/google-drive.d.ts +83 -0
- package/dist/drive/google-drive.d.ts.map +1 -0
- package/dist/drive/google-drive.js +219 -0
- package/dist/drive/google-drive.js.map +1 -0
- package/dist/email/gmail-email.d.ts +64 -0
- package/dist/email/gmail-email.d.ts.map +1 -0
- package/dist/email/gmail-email.js +167 -0
- package/dist/email/gmail-email.js.map +1 -0
- package/dist/factcheck/agent.d.ts +50 -0
- package/dist/factcheck/agent.d.ts.map +1 -0
- package/dist/factcheck/agent.js +508 -0
- package/dist/factcheck/agent.js.map +1 -0
- package/dist/factcheck/financial-verifier.d.ts +49 -0
- package/dist/factcheck/financial-verifier.d.ts.map +1 -0
- package/dist/factcheck/financial-verifier.js +109 -0
- package/dist/factcheck/financial-verifier.js.map +1 -0
- package/dist/factcheck/setup.d.ts +32 -0
- package/dist/factcheck/setup.d.ts.map +1 -0
- package/dist/factcheck/setup.js +70 -0
- package/dist/factcheck/setup.js.map +1 -0
- package/dist/factcheck/sidecar.d.ts +131 -0
- package/dist/factcheck/sidecar.d.ts.map +1 -0
- package/dist/factcheck/sidecar.js +348 -0
- package/dist/factcheck/sidecar.js.map +1 -0
- package/dist/factcheck/store.d.ts +111 -0
- package/dist/factcheck/store.d.ts.map +1 -0
- package/dist/factcheck/store.js +246 -0
- package/dist/factcheck/store.js.map +1 -0
- package/dist/factcheck/web-searcher.d.ts +22 -0
- package/dist/factcheck/web-searcher.d.ts.map +1 -0
- package/dist/factcheck/web-searcher.js +90 -0
- package/dist/factcheck/web-searcher.js.map +1 -0
- package/dist/obs/auth.d.ts +45 -0
- package/dist/obs/auth.d.ts.map +1 -0
- package/dist/obs/auth.js +181 -0
- package/dist/obs/auth.js.map +1 -0
- package/dist/obs/console/ui.d.ts +2 -0
- package/dist/obs/console/ui.d.ts.map +1 -0
- package/dist/obs/console/ui.js +459 -0
- package/dist/obs/console/ui.js.map +1 -0
- package/dist/obs/mini-app/tasks.d.ts +2 -0
- package/dist/obs/mini-app/tasks.d.ts.map +1 -0
- package/dist/obs/mini-app/tasks.js +506 -0
- package/dist/obs/mini-app/tasks.js.map +1 -0
- package/dist/obs/rdp/icons/icons/app_windows.svg +4 -0
- package/dist/obs/rdp/icons/icons/clip_get.svg +4 -0
- package/dist/obs/rdp/icons/icons/clip_send.svg +4 -0
- package/dist/obs/rdp/icons/icons/clip_shared.svg +4 -0
- package/dist/obs/rdp/icons/icons/clipboard.svg +4 -0
- package/dist/obs/rdp/icons/icons/clipboard_shared.svg +4 -0
- package/dist/obs/rdp/icons/icons/control.svg +4 -0
- package/dist/obs/rdp/icons/icons/desktop.svg +4 -0
- package/dist/obs/rdp/icons/icons/display.svg +4 -0
- package/dist/obs/rdp/icons/icons/launchpad.svg +4 -0
- package/dist/obs/rdp/icons/icons/mission_control.svg +4 -0
- package/dist/obs/rdp/icons/icons/screenshot.svg +4 -0
- package/dist/obs/rdp/icons/icons/zoom_actual.svg +4 -0
- package/dist/obs/rdp/icons/icons/zoom_fit.svg +4 -0
- package/dist/obs/rdp/icons/icons/zoom_in.svg +4 -0
- package/dist/obs/rdp/icons/icons/zoom_out.svg +4 -0
- package/dist/obs/tunnel-telemetry.d.ts +46 -0
- package/dist/obs/tunnel-telemetry.d.ts.map +1 -0
- package/dist/obs/tunnel-telemetry.js +70 -0
- package/dist/obs/tunnel-telemetry.js.map +1 -0
- package/dist/obs/ui.d.ts +2 -0
- package/dist/obs/ui.d.ts.map +1 -0
- package/dist/obs/ui.js +1129 -0
- package/dist/obs/ui.js.map +1 -0
- package/dist/onboarding/cloudflared-cert.d.ts +15 -0
- package/dist/onboarding/cloudflared-cert.d.ts.map +1 -0
- package/dist/onboarding/cloudflared-cert.js +57 -0
- package/dist/onboarding/cloudflared-cert.js.map +1 -0
- package/dist/onboarding/gh-auth-browser.d.ts +10 -0
- package/dist/onboarding/gh-auth-browser.d.ts.map +1 -0
- package/dist/onboarding/gh-auth-browser.js +70 -0
- package/dist/onboarding/gh-auth-browser.js.map +1 -0
- package/dist/onboarding/provision-eth-wallet.d.ts +7 -0
- package/dist/onboarding/provision-eth-wallet.d.ts.map +1 -0
- package/dist/onboarding/provision-eth-wallet.js +14 -0
- package/dist/onboarding/provision-eth-wallet.js.map +1 -0
- package/dist/onboarding/provision-workspace-account.d.ts +14 -0
- package/dist/onboarding/provision-workspace-account.d.ts.map +1 -0
- package/dist/onboarding/provision-workspace-account.js +165 -0
- package/dist/onboarding/provision-workspace-account.js.map +1 -0
- package/dist/onboarding/provisioning-spec.d.ts +62 -0
- package/dist/onboarding/provisioning-spec.d.ts.map +1 -0
- package/dist/onboarding/provisioning-spec.js +159 -0
- package/dist/onboarding/provisioning-spec.js.map +1 -0
- package/dist/onboarding/send-identity-credentials.d.ts +11 -0
- package/dist/onboarding/send-identity-credentials.d.ts.map +1 -0
- package/dist/onboarding/send-identity-credentials.js +110 -0
- package/dist/onboarding/send-identity-credentials.js.map +1 -0
- package/dist/onboarding/setup-credentials.d.ts +7 -0
- package/dist/onboarding/setup-credentials.d.ts.map +1 -0
- package/dist/onboarding/setup-credentials.js +44 -0
- package/dist/onboarding/setup-credentials.js.map +1 -0
- package/dist/onboarding/telegram-claim.d.ts +42 -0
- package/dist/onboarding/telegram-claim.d.ts.map +1 -0
- package/dist/onboarding/telegram-claim.js +76 -0
- package/dist/onboarding/telegram-claim.js.map +1 -0
- package/dist/openai-credentials.d.ts +30 -0
- package/dist/openai-credentials.d.ts.map +1 -0
- package/dist/openai-credentials.js +37 -0
- package/dist/openai-credentials.js.map +1 -0
- package/dist/phonecall-credentials.d.ts +21 -0
- package/dist/phonecall-credentials.d.ts.map +1 -0
- package/dist/phonecall-credentials.js +34 -0
- package/dist/phonecall-credentials.js.map +1 -0
- package/dist/realtime/agent-bridge.d.ts +7 -0
- package/dist/realtime/agent-bridge.d.ts.map +1 -0
- package/dist/realtime/agent-bridge.js +31 -0
- package/dist/realtime/agent-bridge.js.map +1 -0
- package/dist/realtime/assets/index.html +1058 -0
- package/dist/realtime/assets/samples/alloy.mp3 +0 -0
- package/dist/realtime/assets/samples/ash.mp3 +0 -0
- package/dist/realtime/assets/samples/ballad.mp3 +0 -0
- package/dist/realtime/assets/samples/cedar.mp3 +0 -0
- package/dist/realtime/assets/samples/coral.mp3 +0 -0
- package/dist/realtime/assets/samples/echo.mp3 +0 -0
- package/dist/realtime/assets/samples/marin.mp3 +0 -0
- package/dist/realtime/assets/samples/sage.mp3 +0 -0
- package/dist/realtime/assets/samples/shimmer.mp3 +0 -0
- package/dist/realtime/assets/samples/verse.mp3 +0 -0
- package/dist/realtime/context.d.ts +14 -0
- package/dist/realtime/context.d.ts.map +1 -0
- package/dist/realtime/context.js +153 -0
- package/dist/realtime/context.js.map +1 -0
- package/dist/realtime/http-helpers.d.ts +5 -0
- package/dist/realtime/http-helpers.d.ts.map +1 -0
- package/dist/realtime/http-helpers.js +29 -0
- package/dist/realtime/http-helpers.js.map +1 -0
- package/dist/realtime/index.d.ts +62 -0
- package/dist/realtime/index.d.ts.map +1 -0
- package/dist/realtime/index.js +94 -0
- package/dist/realtime/index.js.map +1 -0
- package/dist/realtime/server.d.ts +6 -0
- package/dist/realtime/server.d.ts.map +1 -0
- package/dist/realtime/server.js +479 -0
- package/dist/realtime/server.js.map +1 -0
- package/dist/realtime/telegram-auth.d.ts +2 -0
- package/dist/realtime/telegram-auth.d.ts.map +1 -0
- package/dist/realtime/telegram-auth.js +24 -0
- package/dist/realtime/telegram-auth.js.map +1 -0
- package/dist/realtime/tools.d.ts +829 -0
- package/dist/realtime/tools.d.ts.map +1 -0
- package/dist/realtime/tools.js +611 -0
- package/dist/realtime/tools.js.map +1 -0
- package/dist/realtime/types.d.ts +62 -0
- package/dist/realtime/types.d.ts.map +1 -0
- package/dist/realtime/types.js +3 -0
- package/dist/realtime/types.js.map +1 -0
- package/dist/realtime/voice-summarizer.d.ts +4 -0
- package/dist/realtime/voice-summarizer.d.ts.map +1 -0
- package/dist/realtime/voice-summarizer.js +123 -0
- package/dist/realtime/voice-summarizer.js.map +1 -0
- package/dist/realtime/websocket.d.ts +7 -0
- package/dist/realtime/websocket.d.ts.map +1 -0
- package/dist/realtime/websocket.js +65 -0
- package/dist/realtime/websocket.js.map +1 -0
- package/dist/service/gbox-tun.d.ts +14 -0
- package/dist/service/gbox-tun.d.ts.map +1 -0
- package/dist/service/gbox-tun.js +315 -0
- package/dist/service/gbox-tun.js.map +1 -0
- package/dist/skills/installed.d.ts +11 -0
- package/dist/skills/installed.d.ts.map +1 -0
- package/dist/skills/installed.js +35 -0
- package/dist/skills/installed.js.map +1 -0
- package/dist/threads/ipc.d.ts +0 -4
- package/dist/threads/ipc.d.ts.map +1 -1
- package/dist/threads/ipc.js.map +1 -1
- package/dist/threads/relay-adapter.d.ts +6 -6
- package/dist/threads/relay-adapter.d.ts.map +1 -1
- package/dist/threads/relay-adapter.js +7 -9
- package/dist/threads/relay-adapter.js.map +1 -1
- package/dist/threads/supervisor.d.ts +28 -6
- package/dist/threads/supervisor.d.ts.map +1 -1
- package/dist/threads/supervisor.js +54 -25
- package/dist/threads/supervisor.js.map +1 -1
- package/dist/threads/worker-desktop-runtime.d.ts +6 -0
- package/dist/threads/worker-desktop-runtime.d.ts.map +1 -0
- package/dist/threads/worker-desktop-runtime.js +26 -0
- package/dist/threads/worker-desktop-runtime.js.map +1 -0
- package/dist/tools/card.d.ts +11 -0
- package/dist/tools/card.d.ts.map +1 -0
- package/dist/tools/card.js +87 -0
- package/dist/tools/card.js.map +1 -0
- package/dist/tools/coordinate-resolver.d.ts +30 -0
- package/dist/tools/coordinate-resolver.d.ts.map +1 -0
- package/dist/tools/coordinate-resolver.js +104 -0
- package/dist/tools/coordinate-resolver.js.map +1 -0
- package/dist/tools/sms.d.ts +16 -0
- package/dist/tools/sms.d.ts.map +1 -0
- package/dist/tools/sms.js +78 -0
- package/dist/tools/sms.js.map +1 -0
- package/dist/tools/stock-data.d.ts +70 -0
- package/dist/tools/stock-data.d.ts.map +1 -0
- package/dist/tools/stock-data.js +596 -0
- package/dist/tools/stock-data.js.map +1 -0
- package/dist/tools/webapp.d.ts +30 -0
- package/dist/tools/webapp.d.ts.map +1 -0
- package/dist/tools/webapp.js +114 -0
- package/dist/tools/webapp.js.map +1 -0
- package/dist/tui/auth.d.ts +6 -0
- package/dist/tui/auth.d.ts.map +1 -0
- package/dist/tui/auth.js +65 -0
- package/dist/tui/auth.js.map +1 -0
- package/dist/tui/run-store.d.ts +47 -0
- package/dist/tui/run-store.d.ts.map +1 -0
- package/dist/tui/run-store.js +166 -0
- package/dist/tui/run-store.js.map +1 -0
- package/dist/utils/wechat-monitor.d.ts +21 -0
- package/dist/utils/wechat-monitor.d.ts.map +1 -0
- package/dist/utils/wechat-monitor.js +88 -0
- package/dist/utils/wechat-monitor.js.map +1 -0
- package/dist/webapp/index.d.ts +28 -0
- package/dist/webapp/index.d.ts.map +1 -0
- package/dist/webapp/index.js +75 -0
- package/dist/webapp/index.js.map +1 -0
- package/dist/webapp/server.d.ts +32 -0
- package/dist/webapp/server.d.ts.map +1 -0
- package/dist/webapp/server.js +375 -0
- package/dist/webapp/server.js.map +1 -0
- package/dist/webapp/storage.d.ts +64 -0
- package/dist/webapp/storage.d.ts.map +1 -0
- package/dist/webapp/storage.js +103 -0
- package/dist/webapp/storage.js.map +1 -0
- package/dist/webapp/ui.d.ts +2 -0
- package/dist/webapp/ui.d.ts.map +1 -0
- package/dist/webapp/ui.js +319 -0
- package/dist/webapp/ui.js.map +1 -0
- package/dist-agent/assets/index.html +1058 -0
- package/dist-agent/assets/samples/alloy.mp3 +0 -0
- package/dist-agent/assets/samples/ash.mp3 +0 -0
- package/dist-agent/assets/samples/ballad.mp3 +0 -0
- package/dist-agent/assets/samples/cedar.mp3 +0 -0
- package/dist-agent/assets/samples/coral.mp3 +0 -0
- package/dist-agent/assets/samples/echo.mp3 +0 -0
- package/dist-agent/assets/samples/marin.mp3 +0 -0
- package/dist-agent/assets/samples/sage.mp3 +0 -0
- package/dist-agent/assets/samples/shimmer.mp3 +0 -0
- package/dist-agent/assets/samples/verse.mp3 +0 -0
- package/dist-agent/bundle.cjs +1818 -1457
- package/dist-agent/realtime/assets/index.html +1058 -0
- package/dist-agent/realtime/assets/samples/alloy.mp3 +0 -0
- package/dist-agent/realtime/assets/samples/ash.mp3 +0 -0
- package/dist-agent/realtime/assets/samples/ballad.mp3 +0 -0
- package/dist-agent/realtime/assets/samples/cedar.mp3 +0 -0
- package/dist-agent/realtime/assets/samples/coral.mp3 +0 -0
- package/dist-agent/realtime/assets/samples/echo.mp3 +0 -0
- package/dist-agent/realtime/assets/samples/marin.mp3 +0 -0
- package/dist-agent/realtime/assets/samples/sage.mp3 +0 -0
- package/dist-agent/realtime/assets/samples/shimmer.mp3 +0 -0
- package/dist-agent/realtime/assets/samples/verse.mp3 +0 -0
- package/package.json +2 -2
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Applied-credential signature manifest.
|
|
3
|
+
*
|
|
4
|
+
* Persisted alongside materialised tunnel credentials at
|
|
5
|
+
* `<profileTunnelDir>/.applied-signature.json`. Records the signature
|
|
6
|
+
* the server handed us with the last bundle we successfully applied.
|
|
7
|
+
*
|
|
8
|
+
* The manifest is the *only* piece of state the agent has to remember
|
|
9
|
+
* across process restarts about credential bundles — everything else
|
|
10
|
+
* (creds JSON, config.yml) is reconstructable from a fresh server
|
|
11
|
+
* delivery. The signature is opaque to us; we just echo it back on the
|
|
12
|
+
* next heartbeat so the server can decide whether to re-ship the body.
|
|
13
|
+
*
|
|
14
|
+
* Self-healing properties (intentional):
|
|
15
|
+
* - Manifest missing on disk → no signature sent → server sends
|
|
16
|
+
* bundle → we re-apply and rewrite the manifest. Recovers any
|
|
17
|
+
* install where the manifest was deleted but credentials weren't,
|
|
18
|
+
* or vice versa.
|
|
19
|
+
* - Manifest present but probe says no live tunnel files → we treat
|
|
20
|
+
* the manifest as unusable (return null from `loadIfValid`), the
|
|
21
|
+
* next heartbeat goes signature-free, the server re-ships the
|
|
22
|
+
* bundle, and we land back in a coherent state.
|
|
23
|
+
* - Process restart with everything intact → manifest signature is
|
|
24
|
+
* sent on the startup heartbeat, server replies with no
|
|
25
|
+
* `credentialBundle`, no disk writes, no tunnel restart.
|
|
26
|
+
*/
|
|
27
|
+
/**
|
|
28
|
+
* Read the persisted signature, if any. Returns `null` when the file
|
|
29
|
+
* does not exist, fails to parse, has the wrong shape, or refers to a
|
|
30
|
+
* tunnel state that no longer matches what's on disk.
|
|
31
|
+
*
|
|
32
|
+
* The on-disk-coherence check (`probeLocalTunnelCredential()`) is what
|
|
33
|
+
* gives us self-healing: a stranded manifest from a wiped tunnel dir
|
|
34
|
+
* gets ignored, forcing a fresh bundle on the next heartbeat.
|
|
35
|
+
*/
|
|
36
|
+
export declare function loadAppliedSignatureIfValid(): string | null;
|
|
37
|
+
/**
|
|
38
|
+
* Persist the signature for the most recently applied bundle. Best-
|
|
39
|
+
* effort: a write failure is logged but does not throw, since the
|
|
40
|
+
* worst case is just an extra full-bundle delivery on the next
|
|
41
|
+
* heartbeat.
|
|
42
|
+
*
|
|
43
|
+
* The file is written with 0o600 to match the credentials sitting next
|
|
44
|
+
* to it; the directory itself is already 0o700 from
|
|
45
|
+
* `runtime-credentials.ts`.
|
|
46
|
+
*/
|
|
47
|
+
export declare function writeAppliedSignature(signature: string): void;
|
|
48
|
+
/**
|
|
49
|
+
* Forget the persisted signature. Used by tests; production code never
|
|
50
|
+
* needs to delete it explicitly because writes overwrite in place.
|
|
51
|
+
*/
|
|
52
|
+
export declare function __clearAppliedSignatureForTests(): void;
|
|
53
|
+
//# sourceMappingURL=applied-credential-signature.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"applied-credential-signature.d.ts","sourceRoot":"","sources":["../../src/agent/applied-credential-signature.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAwBH;;;;;;;;GAQG;AACH,wBAAgB,2BAA2B,IAAI,MAAM,GAAG,IAAI,CA2C3D;AAED;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAgC7D;AAED;;;GAGG;AACH,wBAAgB,+BAA+B,IAAI,IAAI,CAMtD"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Applied-credential signature manifest.
|
|
3
|
+
*
|
|
4
|
+
* Persisted alongside materialised tunnel credentials at
|
|
5
|
+
* `<profileTunnelDir>/.applied-signature.json`. Records the signature
|
|
6
|
+
* the server handed us with the last bundle we successfully applied.
|
|
7
|
+
*
|
|
8
|
+
* The manifest is the *only* piece of state the agent has to remember
|
|
9
|
+
* across process restarts about credential bundles — everything else
|
|
10
|
+
* (creds JSON, config.yml) is reconstructable from a fresh server
|
|
11
|
+
* delivery. The signature is opaque to us; we just echo it back on the
|
|
12
|
+
* next heartbeat so the server can decide whether to re-ship the body.
|
|
13
|
+
*
|
|
14
|
+
* Self-healing properties (intentional):
|
|
15
|
+
* - Manifest missing on disk → no signature sent → server sends
|
|
16
|
+
* bundle → we re-apply and rewrite the manifest. Recovers any
|
|
17
|
+
* install where the manifest was deleted but credentials weren't,
|
|
18
|
+
* or vice versa.
|
|
19
|
+
* - Manifest present but probe says no live tunnel files → we treat
|
|
20
|
+
* the manifest as unusable (return null from `loadIfValid`), the
|
|
21
|
+
* next heartbeat goes signature-free, the server re-ships the
|
|
22
|
+
* bundle, and we land back in a coherent state.
|
|
23
|
+
* - Process restart with everything intact → manifest signature is
|
|
24
|
+
* sent on the startup heartbeat, server replies with no
|
|
25
|
+
* `credentialBundle`, no disk writes, no tunnel restart.
|
|
26
|
+
*/
|
|
27
|
+
import fs from "node:fs";
|
|
28
|
+
import path from "node:path";
|
|
29
|
+
import { getProfileTunnelDir } from "../config/index.js";
|
|
30
|
+
import { probeLocalTunnelCredential } from "./runtime-credentials.js";
|
|
31
|
+
import { logger } from "../logger.js";
|
|
32
|
+
const MANIFEST_FILENAME = ".applied-signature.json";
|
|
33
|
+
const MANIFEST_VERSION = 1;
|
|
34
|
+
function getManifestPath() {
|
|
35
|
+
return path.join(getProfileTunnelDir(), MANIFEST_FILENAME);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Read the persisted signature, if any. Returns `null` when the file
|
|
39
|
+
* does not exist, fails to parse, has the wrong shape, or refers to a
|
|
40
|
+
* tunnel state that no longer matches what's on disk.
|
|
41
|
+
*
|
|
42
|
+
* The on-disk-coherence check (`probeLocalTunnelCredential()`) is what
|
|
43
|
+
* gives us self-healing: a stranded manifest from a wiped tunnel dir
|
|
44
|
+
* gets ignored, forcing a fresh bundle on the next heartbeat.
|
|
45
|
+
*/
|
|
46
|
+
export function loadAppliedSignatureIfValid() {
|
|
47
|
+
const manifestPath = getManifestPath();
|
|
48
|
+
if (!fs.existsSync(manifestPath))
|
|
49
|
+
return null;
|
|
50
|
+
let raw;
|
|
51
|
+
try {
|
|
52
|
+
raw = fs.readFileSync(manifestPath, "utf-8");
|
|
53
|
+
}
|
|
54
|
+
catch (err) {
|
|
55
|
+
logger.warn(`Applied-signature manifest unreadable: ${err instanceof Error ? err.message : String(err)}`);
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
let parsed;
|
|
59
|
+
try {
|
|
60
|
+
parsed = JSON.parse(raw);
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
logger.warn(`Applied-signature manifest malformed; ignoring`);
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
if (!parsed ||
|
|
67
|
+
typeof parsed !== "object" ||
|
|
68
|
+
!("signature" in parsed) ||
|
|
69
|
+
typeof parsed.signature !== "string" ||
|
|
70
|
+
parsed.signature.trim() === "") {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
const signature = parsed.signature.trim();
|
|
74
|
+
// Coherence: a manifest is only meaningful when the credentials it
|
|
75
|
+
// refers to actually still exist on disk. If the tunnel files were
|
|
76
|
+
// wiped (e.g. operator deleted `~/.visionclaw/profiles/default/tunnel`)
|
|
77
|
+
// the stored signature lies about our state, so pretend we have none
|
|
78
|
+
// and let the server reissue the bundle.
|
|
79
|
+
if (probeLocalTunnelCredential() === null) {
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
return signature;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Persist the signature for the most recently applied bundle. Best-
|
|
86
|
+
* effort: a write failure is logged but does not throw, since the
|
|
87
|
+
* worst case is just an extra full-bundle delivery on the next
|
|
88
|
+
* heartbeat.
|
|
89
|
+
*
|
|
90
|
+
* The file is written with 0o600 to match the credentials sitting next
|
|
91
|
+
* to it; the directory itself is already 0o700 from
|
|
92
|
+
* `runtime-credentials.ts`.
|
|
93
|
+
*/
|
|
94
|
+
export function writeAppliedSignature(signature) {
|
|
95
|
+
if (typeof signature !== "string" || signature.trim() === "")
|
|
96
|
+
return;
|
|
97
|
+
const manifestPath = getManifestPath();
|
|
98
|
+
const dir = path.dirname(manifestPath);
|
|
99
|
+
try {
|
|
100
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
101
|
+
}
|
|
102
|
+
catch {
|
|
103
|
+
// best-effort; the credential apply path will have created it
|
|
104
|
+
}
|
|
105
|
+
const payload = {
|
|
106
|
+
version: MANIFEST_VERSION,
|
|
107
|
+
signature: signature.trim(),
|
|
108
|
+
appliedAt: new Date().toISOString(),
|
|
109
|
+
};
|
|
110
|
+
try {
|
|
111
|
+
fs.writeFileSync(manifestPath, JSON.stringify(payload, null, 2), "utf-8");
|
|
112
|
+
if (process.platform !== "win32") {
|
|
113
|
+
try {
|
|
114
|
+
fs.chmodSync(manifestPath, 0o600);
|
|
115
|
+
}
|
|
116
|
+
catch {
|
|
117
|
+
// best-effort; directory perms still protect
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
catch (err) {
|
|
122
|
+
logger.warn(`Failed to persist applied-signature manifest: ${err instanceof Error ? err.message : String(err)}`);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Forget the persisted signature. Used by tests; production code never
|
|
127
|
+
* needs to delete it explicitly because writes overwrite in place.
|
|
128
|
+
*/
|
|
129
|
+
export function __clearAppliedSignatureForTests() {
|
|
130
|
+
try {
|
|
131
|
+
fs.rmSync(getManifestPath(), { force: true });
|
|
132
|
+
}
|
|
133
|
+
catch {
|
|
134
|
+
// ignore
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
//# sourceMappingURL=applied-credential-signature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"applied-credential-signature.js","sourceRoot":"","sources":["../../src/agent/applied-credential-signature.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;A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A6C;YAC/C,CAAC;QACH,CAAC;IACH,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,CAAC,IAAI,CACT,iDAAiD,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CACpG,CAAC;IACJ,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,+BAA+B;IAC7C,IAAI,CAAC;QACH,EAAE,CAAC,MAAM,CAAC,eAAe,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAChD,CAAC;IAAC,MAAM,CAAC;QACP,SAAS;IACX,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Versioned, server-authoritative optional runtime surfaces.
|
|
3
|
+
*
|
|
4
|
+
* Core model routing, local execution, localhost health/status, and the TUI
|
|
5
|
+
* control channel are deliberately not switches: every Agent needs them to be
|
|
6
|
+
* operable. Everything in this list may be omitted by an explicit setup.
|
|
7
|
+
*/
|
|
8
|
+
export declare const AGENT_CAPABILITIES: readonly ["managed_workspace", "messaging_channels", "interactive_onboarding", "heartbeat", "tunnel", "gemini", "computer_use", "memory", "skills", "dynamic_mcp", "upgrade", "event_trigger", "external_integrations"];
|
|
9
|
+
export type AgentCapability = (typeof AGENT_CAPABILITIES)[number];
|
|
10
|
+
export interface AgentCapabilitySetData {
|
|
11
|
+
schemaVersion: 1;
|
|
12
|
+
enabled: AgentCapability[];
|
|
13
|
+
}
|
|
14
|
+
interface CapabilityCredentialBody {
|
|
15
|
+
tunnel?: unknown;
|
|
16
|
+
tunnelRotation?: unknown;
|
|
17
|
+
google?: unknown;
|
|
18
|
+
zoho?: unknown;
|
|
19
|
+
serpapi?: unknown;
|
|
20
|
+
gemini?: unknown;
|
|
21
|
+
llmGateway?: unknown;
|
|
22
|
+
eventTrigger?: unknown;
|
|
23
|
+
finApp?: unknown;
|
|
24
|
+
financialTool?: unknown;
|
|
25
|
+
}
|
|
26
|
+
interface CapabilityConfigShape {
|
|
27
|
+
capabilitySet?: AgentCapabilitySetData;
|
|
28
|
+
workspaceEnabled?: boolean;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Central capability policy object. Call sites ask a positive question
|
|
32
|
+
* (`capabilities.has("gemini")`) instead of re-implementing legacy defaults or
|
|
33
|
+
* decoding the wire object themselves.
|
|
34
|
+
*/
|
|
35
|
+
export declare class CapabilitySet {
|
|
36
|
+
private readonly enabled;
|
|
37
|
+
private readonly legacyMode;
|
|
38
|
+
private constructor();
|
|
39
|
+
/** Today's behavior. Only the pre-existing Workspace flag can narrow it. */
|
|
40
|
+
static legacy(options?: {
|
|
41
|
+
workspaceEnabled?: boolean;
|
|
42
|
+
}): CapabilitySet;
|
|
43
|
+
static explicit(data: AgentCapabilitySetData): CapabilitySet;
|
|
44
|
+
static parse(value: unknown): CapabilitySet;
|
|
45
|
+
/** Missing capability data is the compatibility contract, never an empty set. */
|
|
46
|
+
static fromConfig(config: CapabilityConfigShape): CapabilitySet;
|
|
47
|
+
has(capability: AgentCapability): boolean;
|
|
48
|
+
/** Client-side defense in depth for a mistakenly over-broad bundle. */
|
|
49
|
+
filterCredentialBody<T extends CapabilityCredentialBody>(body: T): Partial<T>;
|
|
50
|
+
/** Unknown admin commands remain compatible only for legacy/full Agents. */
|
|
51
|
+
allowsPendingCommand(command: string): boolean;
|
|
52
|
+
toJSON(): AgentCapabilitySetData;
|
|
53
|
+
}
|
|
54
|
+
export declare function hasAgentCapability(config: CapabilityConfigShape, capability: AgentCapability): boolean;
|
|
55
|
+
export {};
|
|
56
|
+
//# sourceMappingURL=capabilities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capabilities.d.ts","sourceRoot":"","sources":["../../src/agent/capabilities.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,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S,wBAAwB,EAAE,IAAI,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAqB7E,4EAA4E;IAC5E,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;IAY9C,MAAM,IAAI,sBAAsB;CAMjC;AAED,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,qBAAqB,EAC7B,UAAU,EAAE,eAAe,GAC1B,OAAO,CAET"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Versioned, server-authoritative optional runtime surfaces.
|
|
3
|
+
*
|
|
4
|
+
* Core model routing, local execution, localhost health/status, and the TUI
|
|
5
|
+
* control channel are deliberately not switches: every Agent needs them to be
|
|
6
|
+
* operable. Everything in this list may be omitted by an explicit setup.
|
|
7
|
+
*/
|
|
8
|
+
export const AGENT_CAPABILITIES = [
|
|
9
|
+
"managed_workspace",
|
|
10
|
+
"messaging_channels",
|
|
11
|
+
"interactive_onboarding",
|
|
12
|
+
"heartbeat",
|
|
13
|
+
"tunnel",
|
|
14
|
+
"gemini",
|
|
15
|
+
"computer_use",
|
|
16
|
+
"memory",
|
|
17
|
+
"skills",
|
|
18
|
+
"dynamic_mcp",
|
|
19
|
+
"upgrade",
|
|
20
|
+
"event_trigger",
|
|
21
|
+
"external_integrations",
|
|
22
|
+
];
|
|
23
|
+
const KNOWN_CAPABILITIES = new Set(AGENT_CAPABILITIES);
|
|
24
|
+
function canonicalCapabilities(values) {
|
|
25
|
+
const selected = new Set(values);
|
|
26
|
+
return AGENT_CAPABILITIES.filter((capability) => selected.has(capability));
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Central capability policy object. Call sites ask a positive question
|
|
30
|
+
* (`capabilities.has("gemini")`) instead of re-implementing legacy defaults or
|
|
31
|
+
* decoding the wire object themselves.
|
|
32
|
+
*/
|
|
33
|
+
export class CapabilitySet {
|
|
34
|
+
enabled;
|
|
35
|
+
legacyMode;
|
|
36
|
+
constructor(enabled, legacyMode = false) {
|
|
37
|
+
this.enabled = new Set(canonicalCapabilities(enabled));
|
|
38
|
+
this.legacyMode = legacyMode;
|
|
39
|
+
}
|
|
40
|
+
/** Today's behavior. Only the pre-existing Workspace flag can narrow it. */
|
|
41
|
+
static legacy(options = {}) {
|
|
42
|
+
const enabled = options.workspaceEnabled === false
|
|
43
|
+
? AGENT_CAPABILITIES.filter((capability) => capability !== "managed_workspace")
|
|
44
|
+
: AGENT_CAPABILITIES;
|
|
45
|
+
return new CapabilitySet(enabled, true);
|
|
46
|
+
}
|
|
47
|
+
static explicit(data) {
|
|
48
|
+
return CapabilitySet.parse(data);
|
|
49
|
+
}
|
|
50
|
+
static parse(value) {
|
|
51
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
52
|
+
throw new Error("Agent capability set must be an object");
|
|
53
|
+
}
|
|
54
|
+
const data = value;
|
|
55
|
+
if (data.schemaVersion !== 1 || !Array.isArray(data.enabled)) {
|
|
56
|
+
throw new Error("Unsupported Agent capability schema");
|
|
57
|
+
}
|
|
58
|
+
const enabled = [];
|
|
59
|
+
for (const rawCapability of data.enabled) {
|
|
60
|
+
if (typeof rawCapability !== "string" || !KNOWN_CAPABILITIES.has(rawCapability)) {
|
|
61
|
+
throw new Error(`Unknown Agent capability: ${String(rawCapability)}`);
|
|
62
|
+
}
|
|
63
|
+
enabled.push(rawCapability);
|
|
64
|
+
}
|
|
65
|
+
return new CapabilitySet(enabled);
|
|
66
|
+
}
|
|
67
|
+
/** Missing capability data is the compatibility contract, never an empty set. */
|
|
68
|
+
static fromConfig(config) {
|
|
69
|
+
return config.capabilitySet
|
|
70
|
+
? CapabilitySet.explicit(config.capabilitySet)
|
|
71
|
+
: CapabilitySet.legacy({ workspaceEnabled: config.workspaceEnabled });
|
|
72
|
+
}
|
|
73
|
+
has(capability) {
|
|
74
|
+
return this.enabled.has(capability);
|
|
75
|
+
}
|
|
76
|
+
/** Client-side defense in depth for a mistakenly over-broad bundle. */
|
|
77
|
+
filterCredentialBody(body) {
|
|
78
|
+
return {
|
|
79
|
+
...(this.has("tunnel") && body.tunnel !== undefined ? { tunnel: body.tunnel } : {}),
|
|
80
|
+
...(this.has("tunnel") && body.tunnelRotation !== undefined
|
|
81
|
+
? { tunnelRotation: body.tunnelRotation }
|
|
82
|
+
: {}),
|
|
83
|
+
...(this.has("managed_workspace") && body.google !== undefined ? { google: body.google } : {}),
|
|
84
|
+
...(this.has("managed_workspace") && body.zoho !== undefined ? { zoho: body.zoho } : {}),
|
|
85
|
+
...(this.has("external_integrations") && body.serpapi !== undefined ? { serpapi: body.serpapi } : {}),
|
|
86
|
+
...(this.has("gemini") && body.gemini !== undefined ? { gemini: body.gemini } : {}),
|
|
87
|
+
...(body.llmGateway !== undefined ? { llmGateway: body.llmGateway } : {}),
|
|
88
|
+
...(this.has("event_trigger") && body.eventTrigger !== undefined
|
|
89
|
+
? { eventTrigger: body.eventTrigger }
|
|
90
|
+
: {}),
|
|
91
|
+
...(this.has("messaging_channels") && body.finApp !== undefined ? { finApp: body.finApp } : {}),
|
|
92
|
+
...(this.has("external_integrations") && body.financialTool !== undefined
|
|
93
|
+
? { financialTool: body.financialTool }
|
|
94
|
+
: {}),
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
/** Unknown admin commands remain compatible only for legacy/full Agents. */
|
|
98
|
+
allowsPendingCommand(command) {
|
|
99
|
+
if (command === "upgrade" || command === "upgrade_beta")
|
|
100
|
+
return this.has("upgrade");
|
|
101
|
+
if (command === "create_rdp_session") {
|
|
102
|
+
return this.has("computer_use") && this.has("tunnel");
|
|
103
|
+
}
|
|
104
|
+
if (command === "notify")
|
|
105
|
+
return this.has("messaging_channels");
|
|
106
|
+
if (["collect_data", "usage", "usage_backfill", "switch_engine"].includes(command)) {
|
|
107
|
+
return true;
|
|
108
|
+
}
|
|
109
|
+
return this.legacyMode;
|
|
110
|
+
}
|
|
111
|
+
toJSON() {
|
|
112
|
+
return {
|
|
113
|
+
schemaVersion: 1,
|
|
114
|
+
enabled: canonicalCapabilities([...this.enabled]),
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
export function hasAgentCapability(config, capability) {
|
|
119
|
+
return CapabilitySet.fromConfig(config).has(capability);
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=capabilities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capabilities.js","sourceRoot":"","sources":["../../src/agent/capabilities.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,mBAAmB;IACnB,oBAAoB;IACpB,wBAAwB;IACxB,WAAW;IACX,QAAQ;IACR,QAAQ;IACR,cAAc;IACd,QAAQ;IACR,QAAQ;IACR,aAAa;IACb,SAAS;IACT,eAAe;IACf,uBAAuB;CACf,CAAC;AA2BX,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAS,kBAAkB,CAAC,CAAC;AAE/D,SAAS,qBAAqB,CAAC,MAAkC;IAC/D,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC;IACjC,OAAO,kBAAkB,CAAC,MAAM,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC;AAC7E,CAAC;AAED;;;;GAIG;AACH,MAAM,OAAO,aAAa;IACP,OAAO,CAA+B;IACtC,UAAU,CAAU;IAErC,YAAoB,OAAmC,EAAE,UAAU,GAAG,KAAK;QACzE,IAAI,CAAC,OAAO,GAAG,IAAI,GAAG,CAAC,qBAAqB,CAAC,OAAO,CAAC,CAAC,CAAC;QACvD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;IAED,4EAA4E;IAC5E,MAAM,CAAC,MAAM,CAAC,UAA0C,EAAE;QACxD,MAAM,OAAO,GAAG,OAAO,CAAC,gBAAgB,KAAK,KAAK;YAChD,CAAC,CAAC,kBAAkB,CAAC,M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C,GAAG,CAAC,oBAAoB,CAAC,CAAC;QAChE,IAAI,CAAC,cAAc,EAAE,OAAO,EAAE,gBAAgB,EAAE,eAAe,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;YACnF,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAED,MAAM;QACJ,OAAO;YACL,aAAa,EAAE,CAAC;YAChB,OAAO,EAAE,qBAAqB,CAAC,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC;SAClD,CAAC;IACJ,CAAC;CACF;AAED,MAAM,UAAU,kBAAkB,CAChC,MAA6B,EAC7B,UAA2B;IAE3B,OAAO,aAAa,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;AAC1D,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare class CompactionFailureError extends Error {
|
|
2
|
+
readonly errorCode: string;
|
|
3
|
+
readonly sessionId: string | null;
|
|
4
|
+
constructor(message: string, options: {
|
|
5
|
+
errorCode: string;
|
|
6
|
+
sessionId: string | null;
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=compaction-failure.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compaction-failure.d.ts","sourceRoot":"","sources":["../../src/agent/compaction-failure.ts"],"names":[],"mappings":"AAAA,qBAAa,sBAAuB,SAAQ,KAAK;IAC/C,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;gBAEtB,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE;CAMtF"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export class CompactionFailureError extends Error {
|
|
2
|
+
errorCode;
|
|
3
|
+
sessionId;
|
|
4
|
+
constructor(message, options) {
|
|
5
|
+
super(message);
|
|
6
|
+
this.name = "CompactionFailureError";
|
|
7
|
+
this.errorCode = options.errorCode;
|
|
8
|
+
this.sessionId = options.sessionId;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=compaction-failure.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compaction-failure.js","sourceRoot":"","sources":["../../src/agent/compaction-failure.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,sBAAuB,SAAQ,KAAK;IACtC,SAAS,CAAS;IAClB,SAAS,CAAgB;IAElC,YAAY,OAAe,EAAE,OAAwD;QACnF,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,wBAAwB,CAAC;QACrC,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;QACnC,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;IACrC,CAAC;CACF"}
|
|
@@ -34,6 +34,8 @@ export declare const CONTEXT_REFRESH_RESTART_TIMEOUT_MS = 420000;
|
|
|
34
34
|
export declare const AUTO_REFRESH_ENABLED: boolean;
|
|
35
35
|
/** Consecutive compaction timeouts required before forcing a refresh. */
|
|
36
36
|
export declare const AUTO_REFRESH_TIMEOUT_STREAK = 2;
|
|
37
|
+
/** Error codes that identify a failed Pi auto-compaction worth recovering. */
|
|
38
|
+
export declare const COMPACTION_FAILURE_ERROR_CODES: Set<string>;
|
|
37
39
|
/** Minimum gap between two automatic refreshes. */
|
|
38
40
|
export declare const AUTO_REFRESH_COOLDOWN_MS = 1800000;
|
|
39
41
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compaction-policy.d.ts","sourceRoot":"","sources":["../../src/agent/compaction-policy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;;;GAIG;AACH,eAAO,MAAM,6BAA6B,SAAU,CAAC;AAErD;;;;GAIG;AACH,eAAO,MAAM,iCAAiC,QAAS,CAAC;AAExD,2EAA2E;AAC3E,eAAO,MAAM,kCAAkC,SAAU,CAAC;AAE1D;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,EAAW,OAAO,CAAC;AAEpD,yEAAyE;AACzE,eAAO,MAAM,2BAA2B,IAAI,CAAC;AAE7C,mDAAmD;AACnD,eAAO,MAAM,wBAAwB,UAAY,CAAC;AAElD;;;GAGG;AACH,eAAO,MAAM,yBAAyB,EAAW,OAAO,CAAC"}
|
|
1
|
+
{"version":3,"file":"compaction-policy.d.ts","sourceRoot":"","sources":["../../src/agent/compaction-policy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;;;GAIG;AACH,eAAO,MAAM,6BAA6B,SAAU,CAAC;AAErD;;;;GAIG;AACH,eAAO,MAAM,iCAAiC,QAAS,CAAC;AAExD,2EAA2E;AAC3E,eAAO,MAAM,kCAAkC,SAAU,CAAC;AAE1D;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,EAAW,OAAO,CAAC;AAEpD,yEAAyE;AACzE,eAAO,MAAM,2BAA2B,IAAI,CAAC;AAE7C,8EAA8E;AAC9E,eAAO,MAAM,8BAA8B,aAAiC,CAAC;AAE7E,mDAAmD;AACnD,eAAO,MAAM,wBAAwB,UAAY,CAAC;AAElD;;;GAGG;AACH,eAAO,MAAM,yBAAyB,EAAW,OAAO,CAAC"}
|
|
@@ -34,6 +34,8 @@ export const CONTEXT_REFRESH_RESTART_TIMEOUT_MS = 420_000; // 7 minutes
|
|
|
34
34
|
export const AUTO_REFRESH_ENABLED = true;
|
|
35
35
|
/** Consecutive compaction timeouts required before forcing a refresh. */
|
|
36
36
|
export const AUTO_REFRESH_TIMEOUT_STREAK = 2;
|
|
37
|
+
/** Error codes that identify a failed Pi auto-compaction worth recovering. */
|
|
38
|
+
export const COMPACTION_FAILURE_ERROR_CODES = new Set(["400", "413", "504"]);
|
|
37
39
|
/** Minimum gap between two automatic refreshes. */
|
|
38
40
|
export const AUTO_REFRESH_COOLDOWN_MS = 1_800_000; // 30 minutes
|
|
39
41
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compaction-policy.js","sourceRoot":"","sources":["../../src/agent/compaction-policy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,OAAO,CAAC,CAAC,YAAY;AAElE;;;;GAIG;AACH,MAAM,CAAC,MAAM,iCAAiC,GAAG,MAAM,CAAC;AAExD,2EAA2E;AAC3E,MAAM,CAAC,MAAM,kCAAkC,GAAG,OAAO,CAAC,CAAC,YAAY;AAEvE;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAe,CAAC;AAEpD,yEAAyE;AACzE,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC;AAE7C,mDAAmD;AACnD,MAAM,CAAC,MAAM,wBAAwB,GAAG,SAAS,CAAC,CAAC,aAAa;AAEhE;;;GAGG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,IAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"compaction-policy.js","sourceRoot":"","sources":["../../src/agent/compaction-policy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,OAAO,CAAC,CAAC,YAAY;AAElE;;;;GAIG;AACH,MAAM,CAAC,MAAM,iCAAiC,GAAG,MAAM,CAAC;AAExD,2EAA2E;AAC3E,MAAM,CAAC,MAAM,kCAAkC,GAAG,OAAO,CAAC,CAAC,YAAY;AAEvE;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAe,CAAC;AAEpD,yEAAyE;AACzE,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC;AAE7C,8EAA8E;AAC9E,MAAM,CAAC,MAAM,8BAA8B,GAAG,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;AAE7E,mDAAmD;AACnD,MAAM,CAAC,MAAM,wBAAwB,GAAG,SAAS,CAAC,CAAC,aAAa;AAEhE;;;GAGG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,IAAe,CAAC"}
|
|
@@ -11,6 +11,8 @@ export interface PerformContextRefreshDeps {
|
|
|
11
11
|
export interface PerformContextRefreshOptions {
|
|
12
12
|
/** Short reason for logs (e.g. "manual" or "compaction-timeout-streak"). */
|
|
13
13
|
reason: string;
|
|
14
|
+
/** Bound the summarizer input after a provider payload overflow. */
|
|
15
|
+
compactInput?: boolean;
|
|
14
16
|
/**
|
|
15
17
|
* System message enqueued for the next wake cycle so the new session knows
|
|
16
18
|
* a refresh happened. Defaults to the manual-refresh wording.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-refresh.d.ts","sourceRoot":"","sources":["../../src/agent/context-refresh.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAM7C,MAAM,WAAW,yBAAyB;IACxC,OAAO,EAAE,cAAc,CAAC;IACxB,MAAM,EAAE,gBAAgB,CAAC;IACzB,YAAY,EAAE,YAAY,CAAC;IAC3B,eAAe,CAAC,EAAE,UAAU,CAAC,wBAAwB,CAAC,CAAC;CACxD;AAED,MAAM,WAAW,4BAA4B;IAC3C,4EAA4E;IAC5E,MAAM,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,2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EAAE,YAAY,CAAA;CAAE,GACxB;IAAE,MAAM,EAAE,cAAc,CAAA;CAAE,CAAC;AAoB/B;;;;;;;;;;;;GAYG;AACH,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,qBAAqB,EAC3B,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,wBAAwB,CAAC,CAkDnC"}
|
|
@@ -44,7 +44,9 @@ export async function performContextRefresh(deps, options) {
|
|
|
44
44
|
? transcriptInfo.sessionFilePath ?? activeSession.getTranscriptPath()
|
|
45
45
|
: null;
|
|
46
46
|
const { summarizeWithFallback } = await import("./transcript-summarizer.js");
|
|
47
|
-
const finalSummary =
|
|
47
|
+
const finalSummary = options.compactInput
|
|
48
|
+
? await summarizeWithFallback(transcriptPath, config, { compactInput: true })
|
|
49
|
+
: await summarizeWithFallback(transcriptPath, config);
|
|
48
50
|
// Persist critical working state to /memories before the reset so the next
|
|
49
51
|
// session can rehydrate it. Self-gated on the memory feature flag. Wrapped so
|
|
50
52
|
// that neither the dynamic import nor the flush can block the refresh.
|
|
@@ -126,7 +128,11 @@ export async function runContextRefresh(deps, options) {
|
|
|
126
128
|
config,
|
|
127
129
|
messageQueue,
|
|
128
130
|
taskReplyTarget: agentState.currentTaskReplyTarget,
|
|
129
|
-
}, {
|
|
131
|
+
}, {
|
|
132
|
+
reason,
|
|
133
|
+
systemMessage,
|
|
134
|
+
...(options.compactInput ? { compactInput: true } : {}),
|
|
135
|
+
});
|
|
130
136
|
if (!result.refreshed) {
|
|
131
137
|
return { status: "no_session" };
|
|
132
138
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-refresh.js","sourceRoot":"","sources":["../../src/agent/context-refresh.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,+BAA+B,EAAE,MAAM,sCAAsC,CAAC;AACvF,OAAO,EAAE,kCAAkC,EAAE,MAAM,wBAAwB,CAAC;AAC5E,O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QACT,qBAAqB,EAAE,CAAC;QACxB,UAAU,CAAC,UAAU,GAAG,KAAK,CAAC;IAChC,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Client-side deep-night dreaming decision.
|
|
3
|
+
*
|
|
4
|
+
* The agent decides for itself when to dream. Everything the decision needs is
|
|
5
|
+
* local: its own wall clock (the deep-night window), its own `.dream_log`
|
|
6
|
+
* state (has it already dreamed today), and its own transcripts (whether there
|
|
7
|
+
* is anything worth dreaming — that gate lives downstream in
|
|
8
|
+
* `runMemoryDreaming`). The server contributes nothing: dreaming is a default
|
|
9
|
+
* agent capability with no feature gate, so there is no delivery ordering, no
|
|
10
|
+
* ack and no server-side latch to keep in sync.
|
|
11
|
+
*
|
|
12
|
+
* This replaces the earlier server-dispatched `do_dreaming` command. Four of
|
|
13
|
+
* the defects found in review of that design (handler-registration race,
|
|
14
|
+
* ack-before-drain, the supervisor-free dispatch failure, and the swallowed
|
|
15
|
+
* dispatch error) were failure shapes of the distribution itself, not of the
|
|
16
|
+
* scheduling rule — a local `if` cannot have them.
|
|
17
|
+
*/
|
|
18
|
+
import type { VisionClawConfig } from "../config/types.js";
|
|
19
|
+
import type { ThreadSupervisor } from "../threads/supervisor.js";
|
|
20
|
+
/**
|
|
21
|
+
* Deep-night window, half-open `[start, end)`, in the agent's own local time.
|
|
22
|
+
* Inherited unchanged from the deleted server-side dispatcher.
|
|
23
|
+
*/
|
|
24
|
+
export declare const DREAM_WINDOW_START_HOUR = 2;
|
|
25
|
+
export declare const DREAM_WINDOW_END_HOUR = 6;
|
|
26
|
+
/** `YYYYMMDD` for a local date — the granularity of the once-a-day latch. */
|
|
27
|
+
export declare function localDayNumber(now: Date): number;
|
|
28
|
+
/** Why a deep-night check declined to run, for logging and tests. */
|
|
29
|
+
export type DeepNightSkipReason = "outside-window" | "already-dreamed-today";
|
|
30
|
+
export type DeepNightDecision = {
|
|
31
|
+
run: true;
|
|
32
|
+
localDay: number;
|
|
33
|
+
} | {
|
|
34
|
+
run: false;
|
|
35
|
+
reason: DeepNightSkipReason;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Pure scheduling rule: inside the local deep-night window, at most once per
|
|
39
|
+
* local natural day.
|
|
40
|
+
*
|
|
41
|
+
* `lastDreamedDay` is the `YYYYMMDD` latch read from `.dream_log/state.json`.
|
|
42
|
+
* Comparing for equality rather than ordering means a backwards clock jump (or
|
|
43
|
+
* a state file copied from another machine) costs at most one extra sweep,
|
|
44
|
+
* where `>=` could latch the agent out of dreaming until the stored day passes.
|
|
45
|
+
*/
|
|
46
|
+
export declare function decideDeepNightDreaming(input: {
|
|
47
|
+
now: Date;
|
|
48
|
+
lastDreamedDay: number | null;
|
|
49
|
+
}): DeepNightDecision;
|
|
50
|
+
/**
|
|
51
|
+
* Evaluate the rule and, when it says yes, run the sweep. Called from the idle
|
|
52
|
+
* heartbeat tick (every 5 minutes while asleep), so it must be cheap in the
|
|
53
|
+
* overwhelmingly common "not 2am" case — reading the latch file only happens
|
|
54
|
+
* once the window check has already passed.
|
|
55
|
+
*
|
|
56
|
+
* The day latch is written BEFORE the sweep starts. That makes "one sweep per
|
|
57
|
+
* local day" hold even if the sweep throws or the process dies mid-way: the
|
|
58
|
+
* cost of a failed night is one skipped night, whereas latching afterwards
|
|
59
|
+
* would let a reproducible failure retry every five minutes for four hours.
|
|
60
|
+
* Per-transcript progress is not lost either way — `runMemoryDreaming` keeps
|
|
61
|
+
* its own mtime watermark and only latches transcripts it actually dreamed.
|
|
62
|
+
*
|
|
63
|
+
* Never throws: this is fire-and-forget from the heartbeat tick.
|
|
64
|
+
*/
|
|
65
|
+
export declare function maybeRunDeepNightDreaming(config: VisionClawConfig, getSupervisor: () => ThreadSupervisor | null, options?: {
|
|
66
|
+
now?: Date;
|
|
67
|
+
}): Promise<DeepNightDecision>;
|
|
68
|
+
//# sourceMappingURL=deep-night-dreaming.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deep-night-dreaming.d.ts","sourceRoot":"","sources":["../../src/agent/deep-night-dreaming.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAGjE;;;GAGG;AACH,eAAO,MAAM,uBAAuB,IAAI,CAAC;AACzC,eAAO,MAAM,qBAAqB,IAAI,CAAC;AAEvC,6EAA6E;AAC7E,wBAAgB,cAAc,CAAC,GAAG,EAAE,IAAI,GAAG,MAAM,CAEhD;AAED,qEAAqE;AACrE,MAAM,MAAM,mBAAmB,GAAG,gBAAgB,GAAG,uBAAuB,CAAC;AAE7E,MAAM,MAAM,iBAAiB,GACzB;IAAE,GAAG,EAAE,IAAI,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GAC/B;IAAE,GAAG,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,mBAAmB,CAAA;CAAE,CAAC;AAEhD;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE;IAC7C,GAAG,EAAE,IAAI,CAAC;IACV,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B,GAAG,iBAAiB,CAUpB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,yBAAyB,CAC7C,MAAM,EAAE,gBAAgB,EACxB,aAAa,EAAE,MAAM,gBAAgB,GAAG,IAAI,EAC5C,OAAO,GAAE;IAAE,GAAG,CAAC,EAAE,IAAI,CAAA;CAAO,GAC3B,OAAO,CAAC,iBAAiB,CAAC,CAqC5B"}
|