@cydm/happy-elves 0.1.0-beta.48 → 0.1.0-beta.486
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/README.md +0 -2
- package/apps/cli/dist/commands/account.js +1 -0
- package/apps/cli/dist/commands/app.js +19 -0
- package/apps/cli/dist/commands/artifact.d.ts +2 -0
- package/apps/cli/dist/commands/artifact.js +97 -0
- package/apps/cli/dist/commands/collect.js +1 -0
- package/apps/cli/dist/commands/command.js +1 -0
- package/apps/cli/dist/commands/config.js +1 -0
- package/apps/cli/dist/commands/daemon.js +101 -13
- package/apps/cli/dist/commands/dispatch.d.ts +2 -0
- package/apps/cli/dist/commands/dispatch.js +130 -0
- package/apps/cli/dist/commands/gateway.d.ts +2 -0
- package/apps/cli/dist/commands/gateway.js +429 -0
- package/apps/cli/dist/commands/lib/args.js +79 -3
- package/apps/cli/dist/commands/lib/audit.js +1 -0
- package/apps/cli/dist/commands/lib/bootstrap-config.js +1 -0
- package/apps/cli/dist/commands/lib/bootstrap-daemon.js +12 -4
- package/apps/cli/dist/commands/lib/bootstrap-output.js +1 -0
- package/apps/cli/dist/commands/lib/bootstrap.js +1 -0
- package/apps/cli/dist/commands/lib/config.js +53 -0
- package/apps/cli/dist/commands/lib/doctor.d.ts +11 -0
- package/apps/cli/dist/commands/lib/doctor.js +277 -11
- package/apps/cli/dist/commands/lib/exit.js +1 -0
- package/apps/cli/dist/commands/lib/gateway-store.d.ts +38 -0
- package/apps/cli/dist/commands/lib/gateway-store.js +33 -0
- package/apps/cli/dist/commands/lib/index.d.ts +3 -0
- package/apps/cli/dist/commands/lib/index.js +4 -0
- package/apps/cli/dist/commands/lib/json.d.ts +1 -1
- package/apps/cli/dist/commands/lib/json.js +6 -2
- package/apps/cli/dist/commands/lib/local-daemon.d.ts +1 -0
- package/apps/cli/dist/commands/lib/local-daemon.js +40 -9
- package/apps/cli/dist/commands/lib/loop-store.js +8 -16
- package/apps/cli/dist/commands/lib/paths.d.ts +2 -0
- package/apps/cli/dist/commands/lib/paths.js +3 -0
- package/apps/cli/dist/commands/lib/relay-db-audit.d.ts +37 -0
- package/apps/cli/dist/commands/lib/relay-db-audit.js +287 -0
- package/apps/cli/dist/commands/lib/relay-debug.d.ts +84 -0
- package/apps/cli/dist/commands/lib/relay-debug.js +190 -0
- package/apps/cli/dist/commands/lib/relay-http.js +1 -0
- package/apps/cli/dist/commands/lib/scope.d.ts +4 -3
- package/apps/cli/dist/commands/lib/scope.js +10 -13
- package/apps/cli/dist/commands/lib/session-output.d.ts +12 -0
- package/apps/cli/dist/commands/lib/session-output.js +282 -16
- package/apps/cli/dist/commands/lib/session-view.js +1 -0
- package/apps/cli/dist/commands/lib/status.js +21 -4
- package/apps/cli/dist/commands/lib/types.d.ts +14 -5
- package/apps/cli/dist/commands/lib/types.js +1 -0
- package/apps/cli/dist/commands/lib/usage.js +170 -74
- package/apps/cli/dist/commands/lib/workspace.js +36 -2
- package/apps/cli/dist/commands/loop.js +17 -64
- package/apps/cli/dist/commands/machine.js +51 -9
- package/apps/cli/dist/commands/memory.d.ts +2 -0
- package/apps/cli/dist/commands/memory.js +179 -0
- package/apps/cli/dist/commands/queue.d.ts +2 -0
- package/apps/cli/dist/commands/queue.js +95 -0
- package/apps/cli/dist/commands/relay.d.ts +1 -1
- package/apps/cli/dist/commands/relay.js +332 -23
- package/apps/cli/dist/commands/release.d.ts +2 -0
- package/apps/cli/dist/commands/release.js +224 -0
- package/apps/cli/dist/commands/remote.js +11 -2
- package/apps/cli/dist/commands/schedule.d.ts +2 -0
- package/apps/cli/dist/commands/schedule.js +273 -0
- package/apps/cli/dist/commands/session.js +82 -204
- package/apps/cli/dist/commands/sidechat.d.ts +2 -0
- package/apps/cli/dist/commands/sidechat.js +72 -0
- package/apps/cli/dist/commands/token.js +27 -10
- package/apps/cli/dist/commands/turn.js +313 -18
- package/apps/cli/dist/commands/workspace.d.ts +2 -0
- package/apps/cli/dist/commands/workspace.js +68 -0
- package/apps/cli/dist/errors.js +1 -0
- package/apps/cli/dist/index.js +1 -0
- package/apps/cli/package.json +6 -0
- package/apps/daemon/dist/app.js +1 -0
- package/apps/daemon/dist/args.js +1 -0
- package/apps/daemon/dist/artifact/handler.d.ts +17 -0
- package/apps/daemon/dist/artifact/handler.js +858 -0
- package/apps/daemon/dist/artifact/pitch-review-sdk.d.ts +1 -0
- package/apps/daemon/dist/artifact/pitch-review-sdk.js +63 -0
- package/apps/daemon/dist/artifact/store.d.ts +141 -0
- package/apps/daemon/dist/artifact/store.js +652 -0
- package/apps/daemon/dist/artifact/vendor/lavish-axi/LICENSE +21 -0
- package/apps/daemon/dist/artifact/vendor/lavish-axi/artifact-sdk.js +2729 -0
- package/apps/daemon/dist/artifact/vendor/lavish-axi/mermaid-node.js +83 -0
- package/apps/daemon/dist/artifact/vendor/lavish-axi/table-cell.js +168 -0
- package/apps/daemon/dist/audit.js +1 -0
- package/apps/daemon/dist/cli.js +1 -0
- package/apps/daemon/dist/config.js +35 -0
- package/apps/daemon/dist/direct/server.d.ts +8 -0
- package/apps/daemon/dist/direct/server.js +1120 -0
- package/apps/daemon/dist/direct/state.d.ts +10 -0
- package/apps/daemon/dist/direct/state.js +8 -0
- package/apps/daemon/dist/direct/tickets.d.ts +65 -0
- package/apps/daemon/dist/direct/tickets.js +242 -0
- package/apps/daemon/dist/errors.js +1 -0
- package/apps/daemon/dist/gateway/adapters.d.ts +38 -0
- package/apps/daemon/dist/gateway/adapters.js +2 -0
- package/apps/daemon/dist/gateway/feishu.d.ts +65 -0
- package/apps/daemon/dist/gateway/feishu.js +493 -0
- package/apps/daemon/dist/gateway/format.d.ts +2 -0
- package/apps/daemon/dist/gateway/format.js +19 -0
- package/apps/daemon/dist/gateway/handler.d.ts +7 -0
- package/apps/daemon/dist/gateway/handler.js +162 -0
- package/apps/daemon/dist/gateway/runtime.d.ts +33 -0
- package/apps/daemon/dist/gateway/runtime.js +850 -0
- package/apps/daemon/dist/gateway/store.d.ts +92 -0
- package/apps/daemon/dist/gateway/store.js +268 -0
- package/apps/daemon/dist/loop/runner.js +95 -101
- package/apps/daemon/dist/loop/store.js +8 -16
- package/apps/daemon/dist/memory/handler.d.ts +7 -0
- package/apps/daemon/dist/memory/handler.js +127 -0
- package/apps/daemon/dist/memory/manager.d.ts +44 -0
- package/apps/daemon/dist/memory/manager.js +359 -0
- package/apps/daemon/dist/memory/settings.d.ts +11 -0
- package/apps/daemon/dist/memory/settings.js +56 -0
- package/apps/daemon/dist/orchestration/crew-queue.d.ts +28 -0
- package/apps/daemon/dist/orchestration/crew-queue.js +834 -0
- package/apps/daemon/dist/orchestration/handler.d.ts +31 -0
- package/apps/daemon/dist/orchestration/handler.js +1456 -0
- package/apps/daemon/dist/orchestration/queue-state.d.ts +49 -0
- package/apps/daemon/dist/orchestration/queue-state.js +172 -0
- package/apps/daemon/dist/orchestration/runner.d.ts +2 -0
- package/apps/daemon/dist/orchestration/runner.js +449 -0
- package/apps/daemon/dist/orchestration/store-file.d.ts +3 -0
- package/apps/daemon/dist/orchestration/store-file.js +20 -0
- package/apps/daemon/dist/orchestration/store.d.ts +285 -0
- package/apps/daemon/dist/orchestration/store.js +1529 -0
- package/apps/daemon/dist/orchestration/wake-identity.d.ts +13 -0
- package/apps/daemon/dist/orchestration/wake-identity.js +20 -0
- package/apps/daemon/dist/orchestration/watcher.d.ts +22 -0
- package/apps/daemon/dist/orchestration/watcher.js +302 -0
- package/apps/daemon/dist/pair.js +2 -1
- package/apps/daemon/dist/paths.d.ts +7 -1
- package/apps/daemon/dist/paths.js +8 -1
- package/apps/daemon/dist/process.d.ts +1 -0
- package/apps/daemon/dist/process.js +12 -4
- package/apps/daemon/dist/relay/admission.d.ts +44 -0
- package/apps/daemon/dist/relay/admission.js +238 -0
- package/apps/daemon/dist/relay/connection.d.ts +2 -0
- package/apps/daemon/dist/relay/connection.js +508 -18
- package/apps/daemon/dist/relay/devtools.js +84 -12
- package/apps/daemon/dist/relay/inbound-prompt.d.ts +14 -0
- package/apps/daemon/dist/relay/inbound-prompt.js +151 -0
- package/apps/daemon/dist/relay/prompt-admission-store.d.ts +49 -0
- package/apps/daemon/dist/relay/prompt-admission-store.js +348 -0
- package/apps/daemon/dist/relay/register.js +68 -27
- package/apps/daemon/dist/relay/remote-command.d.ts +22 -0
- package/apps/daemon/dist/relay/remote-command.js +128 -0
- package/apps/daemon/dist/relay/send.d.ts +10 -2
- package/apps/daemon/dist/relay/send.js +313 -8
- package/apps/daemon/dist/relay-http.js +1 -0
- package/apps/daemon/dist/runtime/headless-binding.d.ts +13 -0
- package/apps/daemon/dist/runtime/headless-binding.js +32 -0
- package/apps/daemon/dist/runtime/headless-event-projector.d.ts +38 -0
- package/apps/daemon/dist/runtime/headless-event-projector.js +1018 -0
- package/apps/daemon/dist/runtime/headless-history-reader.d.ts +13 -0
- package/apps/daemon/dist/runtime/headless-history-reader.js +64 -0
- package/apps/daemon/dist/runtime/headless-manager.d.ts +60 -0
- package/apps/daemon/dist/runtime/headless-manager.js +270 -0
- package/apps/daemon/dist/runtime/headless-official-tool-bridge.d.ts +4 -0
- package/apps/daemon/dist/runtime/headless-official-tool-bridge.js +95 -0
- package/apps/daemon/dist/runtime/headless-server-request.d.ts +17 -0
- package/apps/daemon/dist/runtime/headless-server-request.js +32 -0
- package/apps/daemon/dist/runtime/headless-session-context.d.ts +11 -0
- package/apps/daemon/dist/runtime/headless-session-context.js +41 -0
- package/apps/daemon/dist/runtime/headless-session-history.d.ts +13 -0
- package/apps/daemon/dist/runtime/headless-session-history.js +507 -0
- package/apps/daemon/dist/runtime/headless-session-primitives.d.ts +33 -0
- package/apps/daemon/dist/runtime/headless-session-primitives.js +64 -0
- package/apps/daemon/dist/runtime/headless-turn-inspector.d.ts +8 -0
- package/apps/daemon/dist/runtime/headless-turn-inspector.js +116 -0
- package/apps/daemon/dist/runtime/headless-turn-runner.d.ts +29 -0
- package/apps/daemon/dist/runtime/headless-turn-runner.js +388 -0
- package/apps/daemon/dist/runtime.d.ts +10 -5
- package/apps/daemon/dist/runtime.js +85 -61
- package/apps/daemon/dist/schedule/handler.d.ts +9 -0
- package/apps/daemon/dist/schedule/handler.js +159 -0
- package/apps/daemon/dist/schedule/runner.d.ts +21 -0
- package/apps/daemon/dist/schedule/runner.js +547 -0
- package/apps/daemon/dist/schedule/store.d.ts +9 -0
- package/apps/daemon/dist/schedule/store.js +143 -0
- package/apps/daemon/dist/session/create-session.js +8 -1
- package/apps/daemon/dist/session/directory.d.ts +1 -6
- package/apps/daemon/dist/session/directory.js +48 -106
- package/apps/daemon/dist/session/events.d.ts +8 -2
- package/apps/daemon/dist/session/events.js +145 -39
- package/apps/daemon/dist/session/file-preview.js +7 -3
- package/apps/daemon/dist/session/he-official/approval.d.ts +12 -0
- package/apps/daemon/dist/session/he-official/approval.js +52 -0
- package/apps/daemon/dist/session/he-official/artifact-commands.d.ts +6 -0
- package/apps/daemon/dist/session/he-official/artifact-commands.js +293 -0
- package/apps/daemon/dist/session/he-official/common.d.ts +401 -0
- package/apps/daemon/dist/session/he-official/common.js +311 -0
- package/apps/daemon/dist/session/he-official/delegate-commands.d.ts +5 -0
- package/apps/daemon/dist/session/he-official/delegate-commands.js +424 -0
- package/apps/daemon/dist/session/he-official/options.d.ts +4 -0
- package/apps/daemon/dist/session/he-official/options.js +72 -0
- package/apps/daemon/dist/session/he-official/orchestration-commands.d.ts +74 -0
- package/apps/daemon/dist/session/he-official/orchestration-commands.js +381 -0
- package/apps/daemon/dist/session/he-official/result.d.ts +34 -0
- package/apps/daemon/dist/session/he-official/result.js +292 -0
- package/apps/daemon/dist/session/he-official/session-commands.d.ts +20 -0
- package/apps/daemon/dist/session/he-official/session-commands.js +132 -0
- package/apps/daemon/dist/session/he-official/trace.d.ts +65 -0
- package/apps/daemon/dist/session/he-official/trace.js +210 -0
- package/apps/daemon/dist/session/he-official/turn-commands.d.ts +31 -0
- package/apps/daemon/dist/session/he-official/turn-commands.js +315 -0
- package/apps/daemon/dist/session/he-official-tools.d.ts +6 -0
- package/apps/daemon/dist/session/he-official-tools.js +97 -0
- package/apps/daemon/dist/session/history-backfill.d.ts +45 -0
- package/apps/daemon/dist/session/history-backfill.js +139 -0
- package/apps/daemon/dist/session/lifecycle.d.ts +9 -16
- package/apps/daemon/dist/session/lifecycle.js +760 -390
- package/apps/daemon/dist/session/metadata.d.ts +3 -2
- package/apps/daemon/dist/session/metadata.js +120 -11
- package/apps/daemon/dist/session/native-identity.d.ts +21 -0
- package/apps/daemon/dist/session/native-identity.js +32 -0
- package/apps/daemon/dist/session/primitives.js +83 -68
- package/apps/daemon/dist/session/prompt.d.ts +42 -2
- package/apps/daemon/dist/session/prompt.js +1073 -164
- package/apps/daemon/dist/session/reconcile.d.ts +3 -0
- package/apps/daemon/dist/session/reconcile.js +236 -0
- package/apps/daemon/dist/session/runtime-read.d.ts +7 -0
- package/apps/daemon/dist/session/runtime-read.js +23 -0
- package/apps/daemon/dist/session/runtime-truth.d.ts +26 -0
- package/apps/daemon/dist/session/runtime-truth.js +453 -0
- package/apps/daemon/dist/session/sidechat.d.ts +11 -0
- package/apps/daemon/dist/session/sidechat.js +236 -0
- package/apps/daemon/dist/session/store.d.ts +21 -0
- package/apps/daemon/dist/session/store.js +245 -0
- package/apps/daemon/dist/start.js +46 -41
- package/apps/daemon/dist/state.d.ts +21 -6
- package/apps/daemon/dist/state.js +36 -0
- package/apps/daemon/dist/turn-coordinator.d.ts +1 -0
- package/apps/daemon/dist/turn-coordinator.js +5 -0
- package/apps/daemon/dist/types.d.ts +111 -23
- package/apps/daemon/dist/types.js +1 -0
- package/apps/daemon/dist/utils.js +1 -0
- package/apps/daemon/package.json +1 -1
- package/apps/relay/dist/auth.js +7 -5
- package/apps/relay/dist/control-plane-store.d.ts +229 -0
- package/apps/relay/dist/control-plane-store.js +263 -0
- package/apps/relay/dist/db.d.ts +1 -2
- package/apps/relay/dist/db.js +57 -317
- package/apps/relay/dist/direct-ticket-grants.d.ts +1 -0
- package/apps/relay/dist/direct-ticket-grants.js +16 -0
- package/apps/relay/dist/errors.d.ts +2 -1
- package/apps/relay/dist/errors.js +4 -1
- package/apps/relay/dist/http-routes.js +189 -464
- package/apps/relay/dist/http-schemas.d.ts +58 -40
- package/apps/relay/dist/http-schemas.js +50 -42
- package/apps/relay/dist/index.js +77 -21
- package/apps/relay/dist/packet-store.d.ts +73 -0
- package/apps/relay/dist/packet-store.js +265 -0
- package/apps/relay/dist/relay-context.d.ts +57 -142
- package/apps/relay/dist/relay-context.js +155 -751
- package/apps/relay/dist/relay-migration.d.ts +26 -0
- package/apps/relay/dist/relay-migration.js +315 -0
- package/apps/relay/dist/retention.js +2 -2
- package/apps/relay/dist/security.js +1 -0
- package/apps/relay/dist/types.d.ts +36 -91
- package/apps/relay/dist/types.js +1 -0
- package/apps/relay/dist/websocket.d.ts +24 -0
- package/apps/relay/dist/websocket.js +705 -133
- package/package.json +15 -28
- package/packages/agent-sdk/dist/index.d.ts +8 -124
- package/packages/agent-sdk/dist/index.js +13 -198
- package/packages/client/dist/account.d.ts +20 -2
- package/packages/client/dist/account.js +169 -3
- package/packages/client/dist/client.d.ts +83 -7
- package/packages/client/dist/client.js +870 -113
- package/packages/client/dist/command-contracts.d.ts +6 -0
- package/packages/client/dist/command-contracts.js +20 -0
- package/packages/client/dist/direct.d.ts +12 -0
- package/packages/client/dist/direct.js +427 -0
- package/packages/client/dist/errors.d.ts +1 -0
- package/packages/client/dist/errors.js +1 -0
- package/packages/client/dist/http.d.ts +1 -0
- package/packages/client/dist/http.js +1 -0
- package/packages/client/dist/index.d.ts +2 -4
- package/packages/client/dist/index.js +1 -2
- package/packages/client/dist/parsers.d.ts +28 -1
- package/packages/client/dist/parsers.js +179 -19
- package/packages/client/dist/product-materializer.d.ts +27 -0
- package/packages/client/dist/product-materializer.js +469 -0
- package/packages/client/dist/transport.d.ts +57 -4
- package/packages/client/dist/transport.js +441 -180
- package/packages/client/dist/types.d.ts +385 -17
- package/packages/client/dist/types.js +1 -0
- package/packages/client/dist/validation.d.ts +1 -1
- package/packages/client/dist/validation.js +1 -9
- package/packages/client/dist/workspace-shared-config.d.ts +23 -0
- package/packages/client/dist/workspace-shared-config.js +487 -0
- package/packages/headless-runtime/dist/claude-provider.d.ts +20 -0
- package/packages/headless-runtime/dist/claude-provider.js +1295 -0
- package/packages/{runtime-cli → headless-runtime}/dist/claude-session-store.d.ts +2 -1
- package/packages/{runtime-cli → headless-runtime}/dist/claude-session-store.js +34 -12
- package/packages/headless-runtime/dist/cli.d.ts +3 -0
- package/packages/headless-runtime/dist/cli.js +1243 -0
- package/packages/headless-runtime/dist/client.d.ts +78 -0
- package/packages/headless-runtime/dist/client.js +493 -0
- package/packages/headless-runtime/dist/codex-provider.d.ts +9 -0
- package/packages/headless-runtime/dist/codex-provider.js +1767 -0
- package/packages/headless-runtime/dist/core.d.ts +365 -0
- package/packages/headless-runtime/dist/core.js +3408 -0
- package/packages/headless-runtime/dist/event-log.d.ts +11 -0
- package/packages/headless-runtime/dist/event-log.js +257 -0
- package/packages/headless-runtime/dist/history-index.d.ts +28 -0
- package/packages/headless-runtime/dist/history-index.js +72 -0
- package/packages/headless-runtime/dist/host-tools.d.ts +21 -0
- package/packages/headless-runtime/dist/host-tools.js +252 -0
- package/packages/headless-runtime/dist/host.d.ts +63 -0
- package/packages/headless-runtime/dist/host.js +451 -0
- package/packages/headless-runtime/dist/index.d.ts +45 -0
- package/packages/headless-runtime/dist/index.js +527 -0
- package/packages/headless-runtime/dist/ipc.d.ts +4 -0
- package/packages/headless-runtime/dist/ipc.js +28 -0
- package/packages/headless-runtime/dist/mock-scenario.d.ts +7 -0
- package/packages/headless-runtime/dist/mock-scenario.js +65 -0
- package/packages/headless-runtime/dist/model-catalog.d.ts +21 -0
- package/packages/headless-runtime/dist/model-catalog.js +271 -0
- package/packages/headless-runtime/dist/provider-command.d.ts +10 -0
- package/packages/headless-runtime/dist/provider-command.js +432 -0
- package/packages/headless-runtime/dist/provider-turn-metadata.d.ts +9 -0
- package/packages/headless-runtime/dist/provider-turn-metadata.js +76 -0
- package/packages/headless-runtime/dist/public-response.d.ts +9 -0
- package/packages/headless-runtime/dist/public-response.js +112 -0
- package/packages/headless-runtime/dist/runtime-projection-store.d.ts +50 -0
- package/packages/headless-runtime/dist/runtime-projection-store.js +349 -0
- package/packages/headless-runtime/dist/trace-log.d.ts +31 -0
- package/packages/headless-runtime/dist/trace-log.js +106 -0
- package/packages/pie-provider/dist/index.d.ts +1 -0
- package/packages/pie-provider/dist/index.js +927 -740
- package/packages/runtime/dist/headless.d.ts +641 -0
- package/packages/runtime/dist/headless.js +3 -0
- package/packages/runtime/dist/index.d.ts +246 -104
- package/packages/runtime/dist/index.js +1 -0
- package/packages/shared/dist/args.d.ts +2 -0
- package/packages/shared/dist/args.js +9 -2
- package/packages/shared/dist/crypto.d.ts +2 -0
- package/packages/shared/dist/crypto.js +6 -0
- package/packages/shared/dist/diagnostics.d.ts +31 -0
- package/packages/shared/dist/diagnostics.js +81 -0
- package/packages/shared/dist/file-lock.d.ts +29 -0
- package/packages/shared/dist/file-lock.js +301 -0
- package/packages/shared/dist/he-official-tools.d.ts +78 -0
- package/packages/shared/dist/he-official-tools.js +737 -0
- package/packages/shared/dist/ids.d.ts +1 -0
- package/packages/shared/dist/ids.js +1 -0
- package/packages/shared/dist/index.d.ts +8 -0
- package/packages/shared/dist/index.js +8 -0
- package/packages/shared/dist/orchestration-routing.d.ts +10 -0
- package/packages/shared/dist/orchestration-routing.js +113 -0
- package/packages/shared/dist/packet-relay.d.ts +220 -0
- package/packages/shared/dist/packet-relay.js +120 -0
- package/packages/shared/dist/protocol-schemas.d.ts +2914 -40
- package/packages/shared/dist/protocol-schemas.js +873 -1
- package/packages/shared/dist/protocol-types.d.ts +882 -3
- package/packages/shared/dist/protocol-types.js +1 -0
- package/packages/shared/dist/protocol.d.ts +739 -20
- package/packages/shared/dist/protocol.js +830 -25
- package/packages/shared/dist/relay-scope.d.ts +32 -0
- package/packages/shared/dist/relay-scope.js +23 -0
- package/packages/shared/dist/session-name.d.ts +1 -0
- package/packages/shared/dist/session-name.js +1 -0
- package/packages/shared/dist/session-state.d.ts +2 -1
- package/packages/shared/dist/session-state.js +1 -0
- package/packages/shared/dist/session-tags.d.ts +12 -0
- package/packages/shared/dist/session-tags.js +50 -0
- package/apps/daemon/dist/runtime/external-provider.d.ts +0 -20
- package/apps/daemon/dist/runtime/external-provider.js +0 -910
- package/apps/daemon/dist/session/runtime-handle.d.ts +0 -7
- package/apps/daemon/dist/session/runtime-handle.js +0 -47
- package/apps/daemon/dist/session/workspace-paths.d.ts +0 -3
- package/apps/daemon/dist/session/workspace-paths.js +0 -30
- package/apps/relay/dist/connections.d.ts +0 -28
- package/apps/relay/dist/connections.js +0 -10
- package/apps/relay/dist/controller-handlers.d.ts +0 -54
- package/apps/relay/dist/controller-handlers.js +0 -918
- package/apps/relay/dist/event-visibility.d.ts +0 -7
- package/apps/relay/dist/event-visibility.js +0 -46
- package/apps/relay/dist/machine-command-result-handlers.d.ts +0 -4
- package/apps/relay/dist/machine-command-result-handlers.js +0 -532
- package/apps/relay/dist/machine-handler-context.d.ts +0 -79
- package/apps/relay/dist/machine-handler-context.js +0 -1
- package/apps/relay/dist/machine-handlers.d.ts +0 -4
- package/apps/relay/dist/machine-handlers.js +0 -20
- package/apps/relay/dist/machine-reliability.d.ts +0 -7
- package/apps/relay/dist/machine-reliability.js +0 -12
- package/apps/relay/dist/projection-repository.d.ts +0 -87
- package/apps/relay/dist/projection-repository.js +0 -220
- package/apps/relay/dist/projections.d.ts +0 -7
- package/apps/relay/dist/projections.js +0 -124
- package/apps/relay/dist/repositories.d.ts +0 -13
- package/apps/relay/dist/repositories.js +0 -71
- package/apps/relay/dist/scope.d.ts +0 -33
- package/apps/relay/dist/scope.js +0 -187
- package/apps/relay/dist/session-projection-reducer.d.ts +0 -4
- package/apps/relay/dist/session-projection-reducer.js +0 -448
- package/npm-shrinkwrap.json +0 -1615
- package/packages/client/dist/live.d.ts +0 -182
- package/packages/client/dist/live.js +0 -1117
- package/packages/client/dist/session-event-order.d.ts +0 -16
- package/packages/client/dist/session-event-order.js +0 -83
- package/packages/client/dist/session-event-window.d.ts +0 -5
- package/packages/client/dist/session-event-window.js +0 -54
- package/packages/provider-protocol/dist/index.d.ts +0 -843
- package/packages/provider-protocol/dist/index.js +0 -332
- package/packages/runtime-acpx/dist/index.d.ts +0 -10
- package/packages/runtime-acpx/dist/index.js +0 -111
- package/packages/runtime-cli/dist/async-queue.d.ts +0 -9
- package/packages/runtime-cli/dist/async-queue.js +0 -31
- package/packages/runtime-cli/dist/claude-history.d.ts +0 -6
- package/packages/runtime-cli/dist/claude-history.js +0 -343
- package/packages/runtime-cli/dist/claude-json.d.ts +0 -28
- package/packages/runtime-cli/dist/claude-json.js +0 -28
- package/packages/runtime-cli/dist/claude-rename.d.ts +0 -5
- package/packages/runtime-cli/dist/claude-rename.js +0 -14
- package/packages/runtime-cli/dist/claude-turn.d.ts +0 -12
- package/packages/runtime-cli/dist/claude-turn.js +0 -131
- package/packages/runtime-cli/dist/codex-app-server.d.ts +0 -69
- package/packages/runtime-cli/dist/codex-app-server.js +0 -462
- package/packages/runtime-cli/dist/codex-approvals.d.ts +0 -7
- package/packages/runtime-cli/dist/codex-approvals.js +0 -32
- package/packages/runtime-cli/dist/codex-history.d.ts +0 -16
- package/packages/runtime-cli/dist/codex-history.js +0 -710
- package/packages/runtime-cli/dist/codex-json-rpc.d.ts +0 -29
- package/packages/runtime-cli/dist/codex-json-rpc.js +0 -198
- package/packages/runtime-cli/dist/codex-lifecycle.d.ts +0 -24
- package/packages/runtime-cli/dist/codex-lifecycle.js +0 -71
- package/packages/runtime-cli/dist/codex-protocol.d.ts +0 -5
- package/packages/runtime-cli/dist/codex-protocol.js +0 -52
- package/packages/runtime-cli/dist/command-resolver.d.ts +0 -23
- package/packages/runtime-cli/dist/command-resolver.js +0 -100
- package/packages/runtime-cli/dist/history-merge.d.ts +0 -17
- package/packages/runtime-cli/dist/history-merge.js +0 -286
- package/packages/runtime-cli/dist/index.d.ts +0 -10
- package/packages/runtime-cli/dist/index.js +0 -257
- package/packages/runtime-cli/dist/permissions.d.ts +0 -5
- package/packages/runtime-cli/dist/permissions.js +0 -21
- package/packages/runtime-cli/dist/session-store.d.ts +0 -32
- package/packages/runtime-cli/dist/session-store.js +0 -91
package/README.md
CHANGED
|
@@ -11,7 +11,5 @@ happy-elves account create --relay https://relay.happyelves.ai --device-name "CL
|
|
|
11
11
|
## Self-host relay
|
|
12
12
|
|
|
13
13
|
```bash
|
|
14
|
-
HAPPY_ELVES_ENV=production \
|
|
15
|
-
HAPPY_ELVES_ALLOWED_ORIGINS=https://your-controller.example \
|
|
16
14
|
happy-elves relay serve --host 0.0.0.0 --port 8787 --json
|
|
17
15
|
```
|
|
@@ -4,13 +4,22 @@ import { handleAccount } from "./account.js";
|
|
|
4
4
|
import { handleCollect } from "./collect.js";
|
|
5
5
|
import { handleConfig } from "./config.js";
|
|
6
6
|
import { handleDaemon } from "./daemon.js";
|
|
7
|
+
import { handleDispatch } from "./dispatch.js";
|
|
8
|
+
import { handleArtifact } from "./artifact.js";
|
|
9
|
+
import { handleGateway } from "./gateway.js";
|
|
7
10
|
import { handleLoop } from "./loop.js";
|
|
8
11
|
import { handleMachine } from "./machine.js";
|
|
12
|
+
import { handleMemory } from "./memory.js";
|
|
13
|
+
import { handleQueue } from "./queue.js";
|
|
9
14
|
import { handleRelay } from "./relay.js";
|
|
15
|
+
import { handleRelease } from "./release.js";
|
|
16
|
+
import { handleSchedule } from "./schedule.js";
|
|
10
17
|
import { handleRemote } from "./remote.js";
|
|
11
18
|
import { handleSession } from "./session.js";
|
|
19
|
+
import { handleSidechat } from "./sidechat.js";
|
|
12
20
|
import { handleToken } from "./token.js";
|
|
13
21
|
import { handleTurn } from "./turn.js";
|
|
22
|
+
import { handleWorkspace } from "./workspace.js";
|
|
14
23
|
import { commandUsage, commandUsageText, handleCliError, parseCliFlags, skillText, startBootstrap, topLevelDoctor, topLevelStatus, usage, usageText } from "./lib/index.js";
|
|
15
24
|
export { handleCliError };
|
|
16
25
|
const domainHandlers = [
|
|
@@ -18,12 +27,21 @@ const domainHandlers = [
|
|
|
18
27
|
handleConfig,
|
|
19
28
|
handleRemote,
|
|
20
29
|
handleToken,
|
|
30
|
+
handleGateway,
|
|
21
31
|
handleLoop,
|
|
32
|
+
handleDispatch,
|
|
33
|
+
handleQueue,
|
|
34
|
+
handleArtifact,
|
|
35
|
+
handleSidechat,
|
|
22
36
|
handleDaemon,
|
|
23
37
|
handleRelay,
|
|
38
|
+
handleRelease,
|
|
24
39
|
handleMachine,
|
|
40
|
+
handleMemory,
|
|
41
|
+
handleSchedule,
|
|
25
42
|
handleSession,
|
|
26
43
|
handleTurn,
|
|
44
|
+
handleWorkspace,
|
|
27
45
|
handleCollect,
|
|
28
46
|
];
|
|
29
47
|
export async function main() {
|
|
@@ -97,3 +115,4 @@ function cliVersion() {
|
|
|
97
115
|
}
|
|
98
116
|
return "0.1.0";
|
|
99
117
|
}
|
|
118
|
+
//# sourceMappingURL=app.js.map
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { CliError, ControllerClient, ok, readConfig, requirePositional, requireString, wantsJson, } from "./lib/index.js";
|
|
2
|
+
export async function handleArtifact({ domain, action, positional, flags }) {
|
|
3
|
+
if (domain !== "artifact")
|
|
4
|
+
return false;
|
|
5
|
+
const config = await readConfig(flags);
|
|
6
|
+
const client = new ControllerClient(config);
|
|
7
|
+
if (action === "register") {
|
|
8
|
+
const machineId = requireString(flags, "machine");
|
|
9
|
+
const consumerSessionId = requireString(flags, "consumer-session");
|
|
10
|
+
const file = requireString(flags, "file");
|
|
11
|
+
const publish = typeof flags.publish === "string" ? flags.publish : undefined;
|
|
12
|
+
if (publish !== undefined && publish !== "relay") {
|
|
13
|
+
throw new CliError(`Unsupported --publish value: ${publish}`, "INVALID_ARGUMENT");
|
|
14
|
+
}
|
|
15
|
+
const result = await client.artifactRegister({
|
|
16
|
+
machineId,
|
|
17
|
+
consumerSessionId,
|
|
18
|
+
file,
|
|
19
|
+
...(typeof flags["artifact-id"] === "string" ? { artifactId: flags["artifact-id"] } : {}),
|
|
20
|
+
...(typeof flags["task-id"] === "string" ? { taskId: flags["task-id"] } : {}),
|
|
21
|
+
...(typeof flags["crew-session"] === "string" ? { crewSessionId: flags["crew-session"] } : {}),
|
|
22
|
+
...(typeof flags["turn-id"] === "string" ? { turnId: flags["turn-id"] } : {}),
|
|
23
|
+
...(typeof flags.title === "string" ? { title: flags.title } : {}),
|
|
24
|
+
...(typeof flags["request-id"] === "string" ? { requestId: flags["request-id"] } : {}),
|
|
25
|
+
...(publish === "relay" ? { publish: "relay" } : {}),
|
|
26
|
+
});
|
|
27
|
+
if (!wantsJson(flags)) {
|
|
28
|
+
console.log(`${result.artifactId} rev:${result.revision} ${result.admission}/${result.publishState} ${result.url}`);
|
|
29
|
+
if (result.publishState === "failed")
|
|
30
|
+
process.exitCode = 1;
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
ok("artifact.register", result, { requestId: result.requestId, machineId }, result.publishState !== "failed");
|
|
34
|
+
if (result.publishState === "failed")
|
|
35
|
+
process.exitCode = 1;
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
if (action === "list") {
|
|
39
|
+
const machineId = requireString(flags, "machine");
|
|
40
|
+
const result = await client.artifactList({
|
|
41
|
+
machineId,
|
|
42
|
+
...(typeof flags["consumer-session"] === "string" ? { consumerSessionId: flags["consumer-session"] } : {}),
|
|
43
|
+
...(typeof flags["task-id"] === "string" ? { taskId: flags["task-id"] } : {}),
|
|
44
|
+
...(typeof flags["request-id"] === "string" ? { requestId: flags["request-id"] } : {}),
|
|
45
|
+
});
|
|
46
|
+
if (!wantsJson(flags)) {
|
|
47
|
+
if (result.records.length === 0)
|
|
48
|
+
console.log("No artifacts.");
|
|
49
|
+
else
|
|
50
|
+
for (const record of result.records) {
|
|
51
|
+
console.log(`${record.artifactId} rev:${record.revision} ${record.publishState} consumer:${record.consumerSessionId} task:${record.taskId ?? "-"}`);
|
|
52
|
+
}
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
ok("artifact.list", result, { requestId: result.requestId, machineId });
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
if (action === "status") {
|
|
59
|
+
const machineId = requireString(flags, "machine");
|
|
60
|
+
const artifactId = requirePositional(positional[0], "artifactId");
|
|
61
|
+
const result = await client.artifactStatus({
|
|
62
|
+
machineId,
|
|
63
|
+
artifactId,
|
|
64
|
+
...(typeof flags["request-id"] === "string" ? { requestId: flags["request-id"] } : {}),
|
|
65
|
+
});
|
|
66
|
+
if (!wantsJson(flags)) {
|
|
67
|
+
const artifact = result.artifact;
|
|
68
|
+
console.log(artifact ? `${artifact.artifactId} rev:${artifact.revision} ${artifact.publishState} feedback:${artifact.feedbackCursor ?? "-"}` : "Artifact not found.");
|
|
69
|
+
return true;
|
|
70
|
+
}
|
|
71
|
+
ok("artifact.status", result, { requestId: result.requestId, machineId });
|
|
72
|
+
return true;
|
|
73
|
+
}
|
|
74
|
+
if (action === "feedback" && positional[0] === "list") {
|
|
75
|
+
const machineId = requireString(flags, "machine");
|
|
76
|
+
const artifactId = requirePositional(positional[1], "artifactId");
|
|
77
|
+
const result = await client.artifactFeedbackList({
|
|
78
|
+
machineId,
|
|
79
|
+
artifactId,
|
|
80
|
+
...(typeof flags.after === "string" ? { after: flags.after } : {}),
|
|
81
|
+
...(typeof flags["request-id"] === "string" ? { requestId: flags["request-id"] } : {}),
|
|
82
|
+
});
|
|
83
|
+
if (!wantsJson(flags)) {
|
|
84
|
+
if (result.records.length === 0)
|
|
85
|
+
console.log("No feedback.");
|
|
86
|
+
else
|
|
87
|
+
for (const record of result.records) {
|
|
88
|
+
console.log(`${record.feedbackCursor} ${record.kind} rev:${record.revision} ${record.prompt}`);
|
|
89
|
+
}
|
|
90
|
+
return true;
|
|
91
|
+
}
|
|
92
|
+
ok("artifact.feedback.list", result, { requestId: result.requestId, machineId });
|
|
93
|
+
return true;
|
|
94
|
+
}
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=artifact.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import os from "node:os";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
import { CliError, compactText, ControllerClient, configDir, configPath,
|
|
3
|
+
import { CliError, compactText, ControllerClient, configDir, configPath, deriveOrchestration, ensureDaemonRunning, idleSessionStatuses, localDaemonStatus, ok, parsePairingClaimResponse, randomId, readConfig, readDaemonConfig, readLocalAuditLog, readRelayJson, redactedDaemonConfig, requirePositional, requireRelayUrl, requireString, restartDaemonForNewConfig, showMachine, stopLocalDaemon, throwRelayHttpError, waitForMachineProjection, wantsJson, writeDaemonConfig } from "./lib/index.js";
|
|
4
4
|
export async function handleDaemon({ domain, action, flags }) {
|
|
5
5
|
if (domain === "daemon" && action === "pair") {
|
|
6
6
|
const relayUrl = requireRelayUrl(flags);
|
|
@@ -25,11 +25,87 @@ export async function handleDaemon({ domain, action, flags }) {
|
|
|
25
25
|
machineToken: claimed.machineToken,
|
|
26
26
|
accountSecret,
|
|
27
27
|
};
|
|
28
|
+
const localBefore = await localDaemonStatus();
|
|
28
29
|
const daemonConfigPath = await writeDaemonConfig(daemonConfig);
|
|
29
|
-
|
|
30
|
+
let daemonStart = { skipped: true, reason: "not requested" };
|
|
31
|
+
let projection = { checked: false, reason: "not checked" };
|
|
32
|
+
let startError;
|
|
33
|
+
if (flags["no-start"] === true) {
|
|
34
|
+
daemonStart = { skipped: true, reason: "--no-start" };
|
|
35
|
+
projection = { checked: false, reason: "--no-start" };
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
try {
|
|
39
|
+
const startResult = localBefore.running
|
|
40
|
+
? await restartDaemonForNewConfig(relayUrl)
|
|
41
|
+
: await ensureDaemonRunning(relayUrl);
|
|
42
|
+
daemonStart = {
|
|
43
|
+
skipped: false,
|
|
44
|
+
restarted: localBefore.running,
|
|
45
|
+
local: startResult.local,
|
|
46
|
+
started: startResult.started,
|
|
47
|
+
...(startResult.startedPid ? { startedPid: startResult.startedPid } : {}),
|
|
48
|
+
...("stopped" in startResult ? { stop: startResult.stopped } : {}),
|
|
49
|
+
};
|
|
50
|
+
try {
|
|
51
|
+
const controllerConfig = await readConfig({ relay: relayUrl });
|
|
52
|
+
const machine = await waitForMachineProjection(new ControllerClient(controllerConfig), claimed.machineId, 10_000);
|
|
53
|
+
projection = {
|
|
54
|
+
checked: true,
|
|
55
|
+
online: machine?.online === true,
|
|
56
|
+
machineId: claimed.machineId,
|
|
57
|
+
...(machine?.lastSeen ? { lastSeen: machine.lastSeen } : {}),
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
projection = {
|
|
62
|
+
checked: false,
|
|
63
|
+
reason: error instanceof Error ? error.message : String(error),
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
const code = error instanceof CliError ? error.code : "DAEMON_START_FAILED";
|
|
69
|
+
startError = { code, message: error instanceof Error ? error.message : String(error) };
|
|
70
|
+
process.exitCode = 1;
|
|
71
|
+
daemonStart = { skipped: true, reason: "start failed" };
|
|
72
|
+
projection = { checked: false, reason: "daemon did not start" };
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
const data = {
|
|
30
76
|
path: daemonConfigPath,
|
|
31
77
|
config: redactedDaemonConfig(daemonConfig),
|
|
32
|
-
|
|
78
|
+
daemon: daemonStart,
|
|
79
|
+
projection,
|
|
80
|
+
...(startError ? { error: startError } : {}),
|
|
81
|
+
};
|
|
82
|
+
const commandOk = !startError && !(projection.checked && !projection.online);
|
|
83
|
+
if (!commandOk)
|
|
84
|
+
process.exitCode = 1;
|
|
85
|
+
if (!wantsJson(flags)) {
|
|
86
|
+
console.log(`Paired ${machineName} with ${relayUrl}`);
|
|
87
|
+
console.log(`Config: ${daemonConfigPath}`);
|
|
88
|
+
if (startError) {
|
|
89
|
+
console.error(`Daemon start failed: ${startError.message}`);
|
|
90
|
+
}
|
|
91
|
+
else if (daemonStart.skipped) {
|
|
92
|
+
console.log(`Daemon start: skipped (${daemonStart.reason})`);
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
console.log(`${daemonStart.restarted ? "Restarted" : "Started"} daemon${daemonStart.startedPid ? ` pid ${daemonStart.startedPid}` : ""}`);
|
|
96
|
+
}
|
|
97
|
+
if (projection.checked) {
|
|
98
|
+
console.log(`Relay projection: ${projection.online ? "online" : "offline"} (${projection.machineId})`);
|
|
99
|
+
if (!projection.online) {
|
|
100
|
+
console.log("If this stays offline, run happy-elves daemon logs --tail 100 and happy-elves daemon status --local.");
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
console.log(`Relay projection: not checked (${projection.reason})`);
|
|
105
|
+
}
|
|
106
|
+
return true;
|
|
107
|
+
}
|
|
108
|
+
ok("daemon.pair", data, { machineId: claimed.machineId }, commandOk);
|
|
33
109
|
return true;
|
|
34
110
|
}
|
|
35
111
|
if (domain === "daemon" && action === "doctor") {
|
|
@@ -57,9 +133,13 @@ export async function handleDaemon({ domain, action, flags }) {
|
|
|
57
133
|
for (const check of checks) {
|
|
58
134
|
console.log(`${check.ok ? "ok" : "fail"} ${check.name}: ${check.message}`);
|
|
59
135
|
}
|
|
136
|
+
if (!data.ok)
|
|
137
|
+
process.exitCode = 1;
|
|
60
138
|
return true;
|
|
61
139
|
}
|
|
62
|
-
|
|
140
|
+
if (!data.ok)
|
|
141
|
+
process.exitCode = 1;
|
|
142
|
+
ok("daemon.doctor", data, {}, data.ok);
|
|
63
143
|
return true;
|
|
64
144
|
}
|
|
65
145
|
if (domain === "daemon" && action === "config") {
|
|
@@ -114,13 +194,21 @@ export async function handleDaemon({ domain, action, flags }) {
|
|
|
114
194
|
if (domain === "daemon" && action === "start") {
|
|
115
195
|
const status = await localDaemonStatus();
|
|
116
196
|
if (status.running) {
|
|
197
|
+
const existingConfig = await readDaemonConfig();
|
|
198
|
+
if (typeof flags.relay === "string")
|
|
199
|
+
existingConfig.relayUrl = requireRelayUrl(flags);
|
|
200
|
+
const restarted = await ensureDaemonRunning(existingConfig.relayUrl);
|
|
201
|
+
if (restarted.started) {
|
|
202
|
+
ok("daemon.start", { ...restarted.local, started: true, startedPid: restarted.startedPid, restartedForChangedConfig: true });
|
|
203
|
+
return true;
|
|
204
|
+
}
|
|
117
205
|
ok("daemon.start", { ...status, started: false });
|
|
118
206
|
return true;
|
|
119
207
|
}
|
|
120
|
-
await readDaemonConfig();
|
|
121
|
-
const
|
|
122
|
-
const
|
|
123
|
-
ok("daemon.start", {
|
|
208
|
+
const daemonConfig = await readDaemonConfig();
|
|
209
|
+
const relayUrl = typeof flags.relay === "string" ? requireRelayUrl(flags) : daemonConfig.relayUrl;
|
|
210
|
+
const started = await ensureDaemonRunning(relayUrl);
|
|
211
|
+
ok("daemon.start", { ...started.local, started: started.started, startedPid: started.startedPid, startupLogPath: path.join(configDir, "daemon.startup.log") });
|
|
124
212
|
return true;
|
|
125
213
|
}
|
|
126
214
|
if (domain === "daemon" && action === "stop") {
|
|
@@ -128,11 +216,10 @@ export async function handleDaemon({ domain, action, flags }) {
|
|
|
128
216
|
return true;
|
|
129
217
|
}
|
|
130
218
|
if (domain === "daemon" && action === "restart") {
|
|
131
|
-
await readDaemonConfig();
|
|
132
|
-
const
|
|
133
|
-
const
|
|
134
|
-
|
|
135
|
-
ok("daemon.restart", { stop, startedPid: pid, pidPath: daemonPidPath });
|
|
219
|
+
const daemonConfig = await readDaemonConfig();
|
|
220
|
+
const relayUrl = typeof flags.relay === "string" ? requireRelayUrl(flags) : daemonConfig.relayUrl;
|
|
221
|
+
const restarted = await restartDaemonForNewConfig(relayUrl);
|
|
222
|
+
ok("daemon.restart", { stop: restarted.stopped, ...restarted.local, startedPid: restarted.startedPid, startupLogPath: path.join(configDir, "daemon.startup.log") });
|
|
136
223
|
return true;
|
|
137
224
|
}
|
|
138
225
|
if (domain === "daemon" && action === "status" && flags.local === true) {
|
|
@@ -216,3 +303,4 @@ export async function handleDaemon({ domain, action, flags }) {
|
|
|
216
303
|
}
|
|
217
304
|
return false;
|
|
218
305
|
}
|
|
306
|
+
//# sourceMappingURL=daemon.js.map
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { CliError, ControllerClient, ok, parsePermissionMode, readConfig, readPromptTextFile, requirePositional, requireString, wantsJson, } from "./lib/index.js";
|
|
2
|
+
export async function handleDispatch({ domain, action, positional, flags }) {
|
|
3
|
+
if (domain !== "dispatch")
|
|
4
|
+
return false;
|
|
5
|
+
const config = await readConfig(flags);
|
|
6
|
+
const client = new ControllerClient(config);
|
|
7
|
+
if (action === "run") {
|
|
8
|
+
const machineId = requireString(flags, "machine");
|
|
9
|
+
const consumerSessionId = requireString(flags, "consumer-session");
|
|
10
|
+
const agent = requireString(flags, "agent");
|
|
11
|
+
const cwd = requireString(flags, "cwd");
|
|
12
|
+
const briefFile = requireString(flags, "brief-file");
|
|
13
|
+
const brief = await readPromptTextFile(briefFile);
|
|
14
|
+
if (!brief.trim())
|
|
15
|
+
throw new CliError("--brief-file is empty", "MISSING_ARGUMENT");
|
|
16
|
+
if (typeof flags["crew-session"] === "string" && typeof flags["fork-from-crew"] === "string") {
|
|
17
|
+
throw new CliError("--crew-session and --fork-from-crew are mutually exclusive", "INVALID_ARGUMENT");
|
|
18
|
+
}
|
|
19
|
+
const routeDecision = routeDecisionFromFlags(flags);
|
|
20
|
+
const permissionMode = parsePermissionMode(flags["permission-mode"] ?? flags.permission);
|
|
21
|
+
const result = await client.dispatchRun({
|
|
22
|
+
machineId,
|
|
23
|
+
consumerSessionId,
|
|
24
|
+
agent,
|
|
25
|
+
cwd,
|
|
26
|
+
brief,
|
|
27
|
+
...(typeof flags["task-id"] === "string" ? { taskId: flags["task-id"] } : {}),
|
|
28
|
+
...(typeof flags["request-id"] === "string" ? { requestId: flags["request-id"] } : {}),
|
|
29
|
+
...(typeof flags["crew-session"] === "string" ? { crewSessionId: flags["crew-session"] } : {}),
|
|
30
|
+
...(typeof flags["fork-from-crew"] === "string" ? { forkFromCrewSessionId: flags["fork-from-crew"] } : {}),
|
|
31
|
+
...(typeof flags["fork-checkpoint"] === "string" ? { forkCheckpointId: flags["fork-checkpoint"] } : {}),
|
|
32
|
+
...(routeDecision ? { routeDecision } : {}),
|
|
33
|
+
...(permissionMode ? { permissionMode } : {}),
|
|
34
|
+
...(typeof flags.model === "string" ? { model: flags.model } : {}),
|
|
35
|
+
...(typeof flags["thinking-level"] === "string" ? { thinkingLevel: flags["thinking-level"] } : {}),
|
|
36
|
+
subscribe: flags.subscribe !== false,
|
|
37
|
+
});
|
|
38
|
+
if (!wantsJson(flags)) {
|
|
39
|
+
console.log(`${result.taskId} ${result.admission}/${result.dispatch} owner:${result.consumerMachineId ?? "-"} crewMachine:${result.crewMachineId ?? machineId} crew:${result.crewSessionId ?? "-"} turn:${result.turnId ?? "-"}`);
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
ok("dispatch.run", result, {
|
|
43
|
+
requestId: result.requestId,
|
|
44
|
+
machineId: result.consumerMachineId ?? machineId,
|
|
45
|
+
consumerMachineId: result.consumerMachineId ?? machineId,
|
|
46
|
+
crewMachineId: result.crewMachineId ?? machineId,
|
|
47
|
+
sessionId: result.crewSessionId,
|
|
48
|
+
turnId: result.turnId,
|
|
49
|
+
}, result.dispatch !== "failed");
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
if (action === "status") {
|
|
53
|
+
const machineId = requireString(flags, "machine");
|
|
54
|
+
const taskId = requirePositional(positional[0], "taskId");
|
|
55
|
+
const result = await client.dispatchStatus({
|
|
56
|
+
machineId,
|
|
57
|
+
taskId,
|
|
58
|
+
...(typeof flags["request-id"] === "string" ? { requestId: flags["request-id"] } : {}),
|
|
59
|
+
});
|
|
60
|
+
if (!wantsJson(flags)) {
|
|
61
|
+
const admission = result.admission;
|
|
62
|
+
const attention = result.attention;
|
|
63
|
+
console.log(`${result.taskId} admission:${admission?.admission ?? "-"} dispatch:${admission?.dispatch ?? "-"} attention:${attention?.status ?? "-"}`);
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
ok("dispatch.status", result, { requestId: result.requestId, machineId });
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
69
|
+
if (action === "list") {
|
|
70
|
+
const machineId = requireString(flags, "machine");
|
|
71
|
+
const result = await client.dispatchList({
|
|
72
|
+
machineId,
|
|
73
|
+
...(typeof flags["consumer-session"] === "string" ? { consumerSessionId: flags["consumer-session"] } : {}),
|
|
74
|
+
...(typeof flags["request-id"] === "string" ? { requestId: flags["request-id"] } : {}),
|
|
75
|
+
});
|
|
76
|
+
if (!wantsJson(flags)) {
|
|
77
|
+
for (const record of result.records) {
|
|
78
|
+
const attention = record.attention;
|
|
79
|
+
const reason = attention?.reasons.at(-1) ?? record.error ?? record.briefPreview ?? "";
|
|
80
|
+
console.log([
|
|
81
|
+
record.taskId,
|
|
82
|
+
`dispatch:${record.dispatch}`,
|
|
83
|
+
`attention:${attention?.status ?? "-"}`,
|
|
84
|
+
`crew:${record.crewSessionId ?? "-"}`,
|
|
85
|
+
reason ? `reason:${reason}` : "",
|
|
86
|
+
].filter(Boolean).join(" "));
|
|
87
|
+
}
|
|
88
|
+
return true;
|
|
89
|
+
}
|
|
90
|
+
ok("dispatch.list", result, { requestId: result.requestId, machineId });
|
|
91
|
+
return true;
|
|
92
|
+
}
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
function routeDecisionFromFlags(flags) {
|
|
96
|
+
const raw = flags["route-decision"];
|
|
97
|
+
const ifBusy = flags["if-busy"];
|
|
98
|
+
if (ifBusy !== undefined && ifBusy !== "queue") {
|
|
99
|
+
throw new CliError("--if-busy must be queue", "INVALID_ARGUMENT");
|
|
100
|
+
}
|
|
101
|
+
if (typeof raw !== "string") {
|
|
102
|
+
if (ifBusy === "queue" && typeof flags["crew-session"] === "string" && typeof flags["fork-from-crew"] !== "string") {
|
|
103
|
+
return { kind: "reuse", crewSessionId: flags["crew-session"], ifBusy };
|
|
104
|
+
}
|
|
105
|
+
if (ifBusy === "queue")
|
|
106
|
+
throw new CliError("--if-busy queue requires --crew-session or --route-decision reuse", "INVALID_ARGUMENT");
|
|
107
|
+
return undefined;
|
|
108
|
+
}
|
|
109
|
+
if (raw === "new") {
|
|
110
|
+
if (ifBusy === "queue")
|
|
111
|
+
throw new CliError("--if-busy queue is only valid with --route-decision reuse", "INVALID_ARGUMENT");
|
|
112
|
+
return { kind: "new" };
|
|
113
|
+
}
|
|
114
|
+
if (raw === "reuse") {
|
|
115
|
+
const crewSessionId = requireString(flags, "crew-session");
|
|
116
|
+
return { kind: "reuse", crewSessionId, ...(ifBusy === "queue" ? { ifBusy } : {}) };
|
|
117
|
+
}
|
|
118
|
+
if (ifBusy === "queue")
|
|
119
|
+
throw new CliError("--if-busy queue is only valid with --route-decision reuse", "INVALID_ARGUMENT");
|
|
120
|
+
if (raw === "fork") {
|
|
121
|
+
const crewSessionId = requireString(flags, "fork-from-crew");
|
|
122
|
+
return {
|
|
123
|
+
kind: "fork",
|
|
124
|
+
crewSessionId,
|
|
125
|
+
...(typeof flags["fork-checkpoint"] === "string" ? { forkCheckpointId: flags["fork-checkpoint"] } : {}),
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
throw new CliError("--route-decision must be one of new, reuse, or fork", "INVALID_ARGUMENT");
|
|
129
|
+
}
|
|
130
|
+
//# sourceMappingURL=dispatch.js.map
|