@evalops/maestro 0.10.8 → 0.10.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/dist/agent/action-approval.d.ts +6 -0
- package/dist/agent/action-approval.d.ts.map +1 -1
- package/dist/agent/action-approval.js.map +1 -1
- package/dist/agent/agent.d.ts +13 -1
- package/dist/agent/agent.d.ts.map +1 -1
- package/dist/agent/agent.js +368 -1
- package/dist/agent/agent.js.map +1 -1
- package/dist/agent/auto-compaction.d.ts +4 -4
- package/dist/agent/auto-compaction.d.ts.map +1 -1
- package/dist/agent/auto-compaction.js.map +1 -1
- package/dist/agent/compaction-cleanup.d.ts +2 -0
- package/dist/agent/compaction-cleanup.d.ts.map +1 -1
- package/dist/agent/compaction-cleanup.js +17 -2
- package/dist/agent/compaction-cleanup.js.map +1 -1
- package/dist/agent/compaction.d.ts +3 -1
- package/dist/agent/compaction.d.ts.map +1 -1
- package/dist/agent/compaction.js +10 -2
- package/dist/agent/compaction.js.map +1 -1
- package/dist/agent/context-manager.d.ts +4 -0
- package/dist/agent/context-manager.d.ts.map +1 -1
- package/dist/agent/context-manager.js +8 -0
- package/dist/agent/context-manager.js.map +1 -1
- package/dist/agent/context-providers.d.ts +2 -0
- package/dist/agent/context-providers.d.ts.map +1 -1
- package/dist/agent/context-providers.js +3 -2
- package/dist/agent/context-providers.js.map +1 -1
- package/dist/agent/providers/google-gemini-cli.js +17 -5
- package/dist/agent/providers/google.js +174 -144
- package/dist/agent/providers/openai-codex-responses.d.ts +4 -0
- package/dist/agent/providers/openai-codex-responses.d.ts.map +1 -0
- package/dist/agent/providers/openai-codex-responses.js +637 -0
- package/dist/agent/providers/openai-codex-responses.js.map +1 -0
- package/dist/agent/providers/openai-codex-session.d.ts +18 -0
- package/dist/agent/providers/openai-codex-session.d.ts.map +1 -0
- package/dist/agent/providers/openai-codex-session.js +53 -0
- package/dist/agent/providers/openai-codex-session.js.map +1 -0
- package/dist/agent/providers/openai-responses-sdk.d.ts.map +1 -1
- package/dist/agent/providers/openai-responses-sdk.js +16 -6
- package/dist/agent/providers/openai-responses-sdk.js.map +1 -1
- package/dist/agent/providers/openai-shared.d.ts +12 -5
- package/dist/agent/providers/openai-shared.d.ts.map +1 -1
- package/dist/agent/providers/openai-shared.js +291 -2
- package/dist/agent/providers/openai-shared.js.map +1 -1
- package/dist/agent/providers/openai.d.ts +1 -1
- package/dist/agent/providers/openai.d.ts.map +1 -1
- package/dist/agent/providers/openai.js +48 -20
- package/dist/agent/providers/openai.js.map +1 -1
- package/dist/agent/providers/vertex.js +7 -0
- package/dist/agent/tracing.d.ts +16 -5
- package/dist/agent/tracing.d.ts.map +1 -1
- package/dist/agent/tracing.js +44 -2
- package/dist/agent/tracing.js.map +1 -1
- package/dist/agent/transport/create-provider-stream.d.ts.map +1 -1
- package/dist/agent/transport/create-provider-stream.js +9 -0
- package/dist/agent/transport/create-provider-stream.js.map +1 -1
- package/dist/agent/transport/tool-execution-bridge.d.ts +86 -0
- package/dist/agent/transport/tool-execution-bridge.d.ts.map +1 -0
- package/dist/agent/transport/tool-execution-bridge.js +665 -0
- package/dist/agent/transport/tool-execution-bridge.js.map +1 -0
- package/dist/agent/transport/tool-execution.d.ts +3 -0
- package/dist/agent/transport/tool-execution.d.ts.map +1 -1
- package/dist/agent/transport/tool-execution.js +16 -1
- package/dist/agent/transport/tool-execution.js.map +1 -1
- package/dist/agent/transport/tool-safety-pipeline.d.ts +7 -1
- package/dist/agent/transport/tool-safety-pipeline.d.ts.map +1 -1
- package/dist/agent/transport/tool-safety-pipeline.js +207 -40
- package/dist/agent/transport/tool-safety-pipeline.js.map +1 -1
- package/dist/agent/transport/tool-update-queue.d.ts +2 -0
- package/dist/agent/transport/tool-update-queue.d.ts.map +1 -1
- package/dist/agent/transport/tool-update-queue.js.map +1 -1
- package/dist/agent/transport.d.ts +3 -0
- package/dist/agent/transport.d.ts.map +1 -1
- package/dist/agent/transport.js +96 -16
- package/dist/agent/transport.js.map +1 -1
- package/dist/agent/types.d.ts +50 -2
- package/dist/agent/types.d.ts.map +1 -1
- package/dist/agent/types.js.map +1 -1
- package/dist/approvals/platform-action-approval.d.ts +32 -0
- package/dist/approvals/platform-action-approval.d.ts.map +1 -0
- package/dist/approvals/platform-action-approval.js +210 -0
- package/dist/approvals/platform-action-approval.js.map +1 -0
- package/dist/approvals/service-client.d.ts +56 -0
- package/dist/approvals/service-client.d.ts.map +1 -0
- package/dist/approvals/service-client.js +316 -0
- package/dist/approvals/service-client.js.map +1 -0
- package/dist/audit/logger.d.ts +4 -4
- package/dist/bootstrap/auth-setup.d.ts +2 -2
- package/dist/bootstrap/auth-setup.d.ts.map +1 -1
- package/dist/bootstrap/auth-setup.js +4 -7
- package/dist/bootstrap/auth-setup.js.map +1 -1
- package/dist/cli/args.d.ts +2 -0
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +29 -0
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/commands/codex.d.ts +2 -0
- package/dist/cli/commands/codex.d.ts.map +1 -0
- package/dist/cli/commands/codex.js +65 -0
- package/dist/cli/commands/codex.js.map +1 -0
- package/dist/cli/commands/config.js +1 -1
- package/dist/cli/commands/config.js.map +1 -1
- package/dist/cli/commands/evalops.d.ts +2 -0
- package/dist/cli/commands/evalops.d.ts.map +1 -0
- package/dist/cli/commands/evalops.js +74 -0
- package/dist/cli/commands/evalops.js.map +1 -0
- package/dist/cli/commands/hosted-runner.d.ts +23 -0
- package/dist/cli/commands/hosted-runner.d.ts.map +1 -0
- package/dist/cli/commands/hosted-runner.js +241 -0
- package/dist/cli/commands/hosted-runner.js.map +1 -0
- package/dist/cli/commands/init.d.ts +4 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +140 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/commands/memory.d.ts.map +1 -1
- package/dist/cli/commands/memory.js +23 -30
- package/dist/cli/commands/memory.js.map +1 -1
- package/dist/cli/commands/remote.d.ts +3 -0
- package/dist/cli/commands/remote.d.ts.map +1 -0
- package/dist/cli/commands/remote.js +631 -0
- package/dist/cli/commands/remote.js.map +1 -0
- package/dist/cli/commands/stats.d.ts +7 -0
- package/dist/cli/commands/stats.d.ts.map +1 -0
- package/dist/cli/commands/stats.js +167 -0
- package/dist/cli/commands/stats.js.map +1 -0
- package/dist/cli/headless-protocol.d.ts +16 -1
- package/dist/cli/headless-protocol.d.ts.map +1 -1
- package/dist/cli/headless-protocol.js +60 -4
- package/dist/cli/headless-protocol.js.map +1 -1
- package/dist/cli/headless.d.ts.map +1 -1
- package/dist/cli/headless.js +1 -0
- package/dist/cli/headless.js.map +1 -1
- package/dist/cli/help.d.ts.map +1 -1
- package/dist/cli/help.js +44 -1
- package/dist/cli/help.js.map +1 -1
- package/dist/cli/jsonl-writer.d.ts.map +1 -1
- package/dist/cli/jsonl-writer.js +19 -6
- package/dist/cli/jsonl-writer.js.map +1 -1
- package/dist/cli-tui/client-tools/client-tool-controller.d.ts.map +1 -1
- package/dist/cli-tui/client-tools/client-tool-controller.js +17 -1
- package/dist/cli-tui/client-tools/client-tool-controller.js.map +1 -1
- package/dist/cli-tui/commands/access-command.js +1 -1
- package/dist/cli-tui/commands/access-command.js.map +1 -1
- package/dist/cli-tui/commands/audit-command.js +1 -1
- package/dist/cli-tui/commands/audit-command.js.map +1 -1
- package/dist/cli-tui/commands/command-catalog.d.ts +29 -0
- package/dist/cli-tui/commands/command-catalog.d.ts.map +1 -0
- package/dist/cli-tui/commands/command-catalog.js +645 -0
- package/dist/cli-tui/commands/command-catalog.js.map +1 -0
- package/dist/cli-tui/commands/command-registry-adapter.d.ts +12 -0
- package/dist/cli-tui/commands/command-registry-adapter.d.ts.map +1 -0
- package/dist/cli-tui/commands/command-registry-adapter.js +120 -0
- package/dist/cli-tui/commands/command-registry-adapter.js.map +1 -0
- package/dist/cli-tui/commands/command-suite-catalog.d.ts +14 -0
- package/dist/cli-tui/commands/command-suite-catalog.d.ts.map +1 -0
- package/dist/cli-tui/commands/command-suite-catalog.js +147 -0
- package/dist/cli-tui/commands/command-suite-catalog.js.map +1 -0
- package/dist/cli-tui/commands/{grouped-command-handlers.d.ts → command-suite-handlers.d.ts} +27 -26
- package/dist/cli-tui/commands/command-suite-handlers.d.ts.map +1 -0
- package/dist/cli-tui/commands/command-suite-handlers.js +110 -0
- package/dist/cli-tui/commands/command-suite-handlers.js.map +1 -0
- package/dist/cli-tui/commands/hotkeys-command.d.ts +1 -1
- package/dist/cli-tui/commands/hotkeys-command.d.ts.map +1 -1
- package/dist/cli-tui/commands/hotkeys-command.js +2 -2
- package/dist/cli-tui/commands/hotkeys-command.js.map +1 -1
- package/dist/cli-tui/commands/limits-command.js +1 -1
- package/dist/cli-tui/commands/limits-command.js.map +1 -1
- package/dist/cli-tui/commands/pii-command.js +1 -1
- package/dist/cli-tui/commands/pii-command.js.map +1 -1
- package/dist/cli-tui/commands/registry.d.ts +1 -1
- package/dist/cli-tui/commands/registry.d.ts.map +1 -1
- package/dist/cli-tui/commands/registry.js +29 -921
- package/dist/cli-tui/commands/registry.js.map +1 -1
- package/dist/cli-tui/commands/{grouped → subcommands}/auth-commands.d.ts +2 -1
- package/dist/cli-tui/commands/subcommands/auth-commands.d.ts.map +1 -0
- package/dist/cli-tui/commands/{grouped → subcommands}/auth-commands.js +22 -6
- package/dist/cli-tui/commands/subcommands/auth-commands.js.map +1 -0
- package/dist/cli-tui/commands/{grouped → subcommands}/config-commands.d.ts +0 -1
- package/dist/cli-tui/commands/subcommands/config-commands.d.ts.map +1 -0
- package/dist/cli-tui/commands/{grouped → subcommands}/config-commands.js +2 -2
- package/dist/cli-tui/commands/subcommands/config-commands.js.map +1 -0
- package/dist/cli-tui/commands/{grouped → subcommands}/diag-commands.d.ts +1 -2
- package/dist/cli-tui/commands/subcommands/diag-commands.d.ts.map +1 -0
- package/dist/cli-tui/commands/{grouped → subcommands}/diag-commands.js +5 -7
- package/dist/cli-tui/commands/subcommands/diag-commands.js.map +1 -0
- package/dist/cli-tui/commands/{grouped → subcommands}/git-commands.d.ts +0 -2
- package/dist/cli-tui/commands/subcommands/git-commands.d.ts.map +1 -0
- package/dist/cli-tui/commands/{grouped → subcommands}/git-commands.js +2 -2
- package/dist/cli-tui/commands/subcommands/git-commands.js.map +1 -0
- package/dist/cli-tui/commands/{grouped → subcommands}/index.d.ts +2 -2
- package/dist/cli-tui/commands/subcommands/index.d.ts.map +1 -0
- package/dist/cli-tui/commands/{grouped → subcommands}/index.js +2 -2
- package/dist/cli-tui/commands/subcommands/index.js.map +1 -0
- package/dist/cli-tui/commands/{grouped → subcommands}/safety-commands.d.ts +0 -1
- package/dist/cli-tui/commands/subcommands/safety-commands.d.ts.map +1 -0
- package/dist/cli-tui/commands/{grouped → subcommands}/safety-commands.js +12 -12
- package/dist/cli-tui/commands/subcommands/safety-commands.js.map +1 -0
- package/dist/cli-tui/commands/{grouped → subcommands}/session-commands.d.ts +1 -2
- package/dist/cli-tui/commands/subcommands/session-commands.d.ts.map +1 -0
- package/dist/cli-tui/commands/{grouped → subcommands}/session-commands.js +3 -3
- package/dist/cli-tui/commands/subcommands/session-commands.js.map +1 -0
- package/dist/cli-tui/commands/{grouped → subcommands}/tools-commands.d.ts +0 -1
- package/dist/cli-tui/commands/subcommands/tools-commands.d.ts.map +1 -0
- package/dist/cli-tui/commands/{grouped → subcommands}/tools-commands.js +2 -2
- package/dist/cli-tui/commands/subcommands/tools-commands.js.map +1 -0
- package/dist/cli-tui/commands/{grouped → subcommands}/ui-commands.d.ts +0 -1
- package/dist/cli-tui/commands/subcommands/ui-commands.d.ts.map +1 -0
- package/dist/cli-tui/commands/{grouped → subcommands}/ui-commands.js +5 -5
- package/dist/cli-tui/commands/subcommands/ui-commands.js.map +1 -0
- package/dist/cli-tui/commands/{grouped → subcommands}/undo-commands.d.ts +1 -2
- package/dist/cli-tui/commands/subcommands/undo-commands.d.ts.map +1 -0
- package/dist/cli-tui/commands/{grouped → subcommands}/undo-commands.js +6 -6
- package/dist/cli-tui/commands/subcommands/undo-commands.js.map +1 -0
- package/dist/cli-tui/commands/subcommands/usage-commands.d.ts.map +1 -0
- package/dist/cli-tui/commands/{grouped → subcommands}/usage-commands.js +2 -2
- package/dist/cli-tui/commands/subcommands/usage-commands.js.map +1 -0
- package/dist/cli-tui/commands/{grouped → subcommands}/utils.d.ts +15 -15
- package/dist/cli-tui/commands/subcommands/utils.d.ts.map +1 -0
- package/dist/cli-tui/commands/{grouped → subcommands}/utils.js +13 -8
- package/dist/cli-tui/commands/subcommands/utils.js.map +1 -0
- package/dist/cli-tui/commands/types.d.ts +3 -3
- package/dist/cli-tui/commands/types.d.ts.map +1 -1
- package/dist/cli-tui/commands/types.js.map +1 -1
- package/dist/cli-tui/editor-view.d.ts +1 -1
- package/dist/cli-tui/editor-view.d.ts.map +1 -1
- package/dist/cli-tui/editor-view.js +1 -1
- package/dist/cli-tui/editor-view.js.map +1 -1
- package/dist/cli-tui/oauth/oauth-flow-controller.d.ts +4 -0
- package/dist/cli-tui/oauth/oauth-flow-controller.d.ts.map +1 -1
- package/dist/cli-tui/oauth/oauth-flow-controller.js +76 -5
- package/dist/cli-tui/oauth/oauth-flow-controller.js.map +1 -1
- package/dist/cli-tui/run/run-controller.d.ts +2 -2
- package/dist/cli-tui/run/run-controller.d.ts.map +1 -1
- package/dist/cli-tui/run/run-controller.js +3 -2
- package/dist/cli-tui/run/run-controller.js.map +1 -1
- package/dist/cli-tui/run/run-shell-command.d.ts.map +1 -1
- package/dist/cli-tui/run/run-shell-command.js +11 -3
- package/dist/cli-tui/run/run-shell-command.js.map +1 -1
- package/dist/cli-tui/run/streaming-shell-command.d.ts.map +1 -1
- package/dist/cli-tui/run/streaming-shell-command.js +11 -3
- package/dist/cli-tui/run/streaming-shell-command.js.map +1 -1
- package/dist/cli-tui/selectors/model-selector.d.ts.map +1 -1
- package/dist/cli-tui/selectors/model-selector.js +1 -0
- package/dist/cli-tui/selectors/model-selector.js.map +1 -1
- package/dist/cli-tui/tui-renderer/agent-event-bridge.d.ts +8 -0
- package/dist/cli-tui/tui-renderer/agent-event-bridge.d.ts.map +1 -1
- package/dist/cli-tui/tui-renderer/agent-event-bridge.js +23 -2
- package/dist/cli-tui/tui-renderer/agent-event-bridge.js.map +1 -1
- package/dist/cli-tui/tui-renderer/command-registry-options.d.ts +3 -3
- package/dist/cli-tui/tui-renderer/command-registry-options.d.ts.map +1 -1
- package/dist/cli-tui/tui-renderer/command-registry-options.js +12 -2
- package/dist/cli-tui/tui-renderer/command-registry-options.js.map +1 -1
- package/dist/cli-tui/tui-renderer/command-suite-wiring.d.ts +32 -0
- package/dist/cli-tui/tui-renderer/command-suite-wiring.d.ts.map +1 -0
- package/dist/cli-tui/tui-renderer/command-suite-wiring.js +108 -0
- package/dist/cli-tui/tui-renderer/command-suite-wiring.js.map +1 -0
- package/dist/cli-tui/tui-renderer/input-controller.d.ts +2 -2
- package/dist/cli-tui/tui-renderer/input-controller.d.ts.map +1 -1
- package/dist/cli-tui/tui-renderer/input-controller.js +2 -2
- package/dist/cli-tui/tui-renderer/input-controller.js.map +1 -1
- package/dist/cli-tui/tui-renderer/ui-state-controller.d.ts +1 -1
- package/dist/cli-tui/tui-renderer/ui-state-controller.js +1 -1
- package/dist/cli-tui/tui-renderer/ui-state-controller.js.map +1 -1
- package/dist/cli-tui/tui-renderer.d.ts +1 -3
- package/dist/cli-tui/tui-renderer.d.ts.map +1 -1
- package/dist/cli-tui/tui-renderer.js +37 -83
- package/dist/cli-tui/tui-renderer.js.map +1 -1
- package/dist/cli-tui/utils/runtime-badges.d.ts +8 -0
- package/dist/cli-tui/utils/runtime-badges.d.ts.map +1 -1
- package/dist/cli-tui/utils/runtime-badges.js +58 -0
- package/dist/cli-tui/utils/runtime-badges.js.map +1 -1
- package/dist/cli.js +42555 -23133
- package/dist/cli.js.map +1 -1
- package/dist/config/env-vars.d.ts +4 -0
- package/dist/config/env-vars.d.ts.map +1 -1
- package/dist/config/env-vars.js +4 -0
- package/dist/config/env-vars.js.map +1 -1
- package/dist/config/feature-flags.d.ts +44 -0
- package/dist/config/feature-flags.d.ts.map +1 -1
- package/dist/config/feature-flags.js +214 -0
- package/dist/config/feature-flags.js.map +1 -1
- package/dist/connectors/service-client.d.ts +98 -0
- package/dist/connectors/service-client.d.ts.map +1 -0
- package/dist/connectors/service-client.js +459 -0
- package/dist/connectors/service-client.js.map +1 -0
- package/dist/conversation/render-model.d.ts.map +1 -1
- package/dist/conversation/render-model.js +53 -3
- package/dist/conversation/render-model.js.map +1 -1
- package/dist/db/health.d.ts +8 -0
- package/dist/db/health.d.ts.map +1 -0
- package/dist/db/health.js +64 -0
- package/dist/db/health.js.map +1 -0
- package/dist/db/migrate.d.ts +301 -0
- package/dist/db/migrate.d.ts.map +1 -1
- package/dist/db/migrate.js +186 -0
- package/dist/db/migrate.js.map +1 -1
- package/dist/db/migrations/0000_initial.sql +308 -0
- package/dist/db/migrations/0001_shared_sessions.sql +18 -0
- package/dist/db/migrations/0002_usage_metrics.sql +28 -0
- package/dist/db/migrations/0003_execution_traces.sql +18 -0
- package/dist/db/migrations/0004_workspace_config.sql +11 -0
- package/dist/db/migrations/0005_revenue_attribution.sql +31 -0
- package/dist/db/migrations/0006_hosted_session_storage.sql +51 -0
- package/dist/db/migrations/0007_reconcile_legacy_audit_hash_cache.sql +24 -0
- package/dist/db/migrations/0008_reconcile_legacy_webhook_deliveries.sql +290 -0
- package/dist/db/migrations/meta/0000_snapshot.json +2438 -0
- package/dist/db/migrations/meta/_journal.json +69 -0
- package/dist/db/schema.d.ts +2232 -844
- package/dist/db/schema.d.ts.map +1 -1
- package/dist/db/schema.js +187 -1
- package/dist/db/schema.js.map +1 -1
- package/dist/evalops/agent-bootstrap.d.ts +73 -0
- package/dist/evalops/agent-bootstrap.d.ts.map +1 -0
- package/dist/evalops/agent-bootstrap.js +380 -0
- package/dist/evalops/agent-bootstrap.js.map +1 -0
- package/dist/export-html.d.ts.map +1 -1
- package/dist/export-html.js +7 -4
- package/dist/export-html.js.map +1 -1
- package/dist/headless/utility-command-manager.d.ts +2 -1
- package/dist/headless/utility-command-manager.d.ts.map +1 -1
- package/dist/headless/utility-command-manager.js +12 -6
- package/dist/headless/utility-command-manager.js.map +1 -1
- package/dist/headless/utility-file-read.d.ts +1 -0
- package/dist/headless/utility-file-read.d.ts.map +1 -1
- package/dist/headless/utility-file-read.js +5 -1
- package/dist/headless/utility-file-read.js.map +1 -1
- package/dist/headless/utility-file-search.d.ts +1 -0
- package/dist/headless/utility-file-search.d.ts.map +1 -1
- package/dist/headless/utility-file-search.js +4 -1
- package/dist/headless/utility-file-search.js.map +1 -1
- package/dist/headless/utility-file-watch-manager.d.ts +2 -1
- package/dist/headless/utility-file-watch-manager.d.ts.map +1 -1
- package/dist/headless/utility-file-watch-manager.js +6 -2
- package/dist/headless/utility-file-watch-manager.js.map +1 -1
- package/dist/headless/workspace-root.d.ts +8 -0
- package/dist/headless/workspace-root.d.ts.map +1 -0
- package/dist/headless/workspace-root.js +74 -0
- package/dist/headless/workspace-root.js.map +1 -0
- package/dist/hooks/notification-hooks.d.ts +5 -0
- package/dist/hooks/notification-hooks.d.ts.map +1 -1
- package/dist/hooks/notification-hooks.js +4 -0
- package/dist/hooks/notification-hooks.js.map +1 -1
- package/dist/lsp/diagnostic-deltas.d.ts +20 -0
- package/dist/lsp/diagnostic-deltas.d.ts.map +1 -0
- package/dist/lsp/diagnostic-deltas.js +92 -0
- package/dist/lsp/diagnostic-deltas.js.map +1 -0
- package/dist/lsp/diagnostic-repair.d.ts +48 -0
- package/dist/lsp/diagnostic-repair.d.ts.map +1 -0
- package/dist/lsp/diagnostic-repair.js +143 -0
- package/dist/lsp/diagnostic-repair.js.map +1 -0
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +127 -37
- package/dist/main.js.map +1 -1
- package/dist/mcp/config.d.ts +4 -2
- package/dist/mcp/config.d.ts.map +1 -1
- package/dist/mcp/config.js +58 -14
- package/dist/mcp/config.js.map +1 -1
- package/dist/mcp/index.d.ts +1 -0
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +1 -0
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/manager.d.ts +1 -0
- package/dist/mcp/manager.d.ts.map +1 -1
- package/dist/mcp/manager.js +1 -0
- package/dist/mcp/manager.js.map +1 -1
- package/dist/mcp/platform-plugin.d.ts +3 -0
- package/dist/mcp/platform-plugin.d.ts.map +1 -0
- package/dist/mcp/platform-plugin.js +117 -0
- package/dist/mcp/platform-plugin.js.map +1 -0
- package/dist/mcp/tool-bridge.d.ts +15 -0
- package/dist/mcp/tool-bridge.d.ts.map +1 -1
- package/dist/mcp/tool-bridge.js +194 -6
- package/dist/mcp/tool-bridge.js.map +1 -1
- package/dist/memory/platform-memory-client.d.ts +130 -0
- package/dist/memory/platform-memory-client.d.ts.map +1 -0
- package/dist/memory/platform-memory-client.js +330 -0
- package/dist/memory/platform-memory-client.js.map +1 -0
- package/dist/memory/service-client.d.ts.map +1 -1
- package/dist/memory/service-client.js +1 -2
- package/dist/memory/service-client.js.map +1 -1
- package/dist/models/builtin.d.ts.map +1 -1
- package/dist/models/builtin.js +137 -0
- package/dist/models/builtin.js.map +1 -1
- package/dist/models/config-loader.d.ts +10 -10
- package/dist/models/config-loader.d.ts.map +1 -1
- package/dist/models/config-loader.js +1 -0
- package/dist/models/config-loader.js.map +1 -1
- package/dist/models/registry.d.ts +1 -0
- package/dist/models/registry.d.ts.map +1 -1
- package/dist/models/registry.js +1 -0
- package/dist/models/registry.js.map +1 -1
- package/dist/oauth/connectors.d.ts +25 -0
- package/dist/oauth/connectors.d.ts.map +1 -0
- package/dist/oauth/connectors.js +253 -0
- package/dist/oauth/connectors.js.map +1 -0
- package/dist/oauth/device-identity.d.ts +18 -0
- package/dist/oauth/device-identity.d.ts.map +1 -0
- package/dist/oauth/device-identity.js +193 -0
- package/dist/oauth/device-identity.js.map +1 -0
- package/dist/oauth/evalops.d.ts.map +1 -1
- package/dist/oauth/evalops.js +74 -15
- package/dist/oauth/evalops.js.map +1 -1
- package/dist/oauth/index.d.ts +1 -1
- package/dist/oauth/index.d.ts.map +1 -1
- package/dist/oauth/index.js +31 -1
- package/dist/oauth/index.js.map +1 -1
- package/dist/oauth/openai-codex.d.ts +16 -0
- package/dist/oauth/openai-codex.d.ts.map +1 -0
- package/dist/oauth/openai-codex.js +300 -0
- package/dist/oauth/openai-codex.js.map +1 -0
- package/dist/opentelemetry.d.ts.map +1 -1
- package/dist/opentelemetry.js +9 -2
- package/dist/opentelemetry.js.map +1 -1
- package/dist/platform/agent-runtime-client.d.ts +279 -0
- package/dist/platform/agent-runtime-client.d.ts.map +1 -0
- package/dist/platform/agent-runtime-client.js +515 -0
- package/dist/platform/agent-runtime-client.js.map +1 -0
- package/dist/platform/cerebro-facts-client.d.ts +56 -0
- package/dist/platform/cerebro-facts-client.d.ts.map +1 -0
- package/dist/platform/cerebro-facts-client.js +297 -0
- package/dist/platform/cerebro-facts-client.js.map +1 -0
- package/dist/platform/client.d.ts +2 -1
- package/dist/platform/client.d.ts.map +1 -1
- package/dist/platform/client.js +9 -26
- package/dist/platform/client.js.map +1 -1
- package/dist/platform/core-services.d.ts +128 -0
- package/dist/platform/core-services.d.ts.map +1 -1
- package/dist/platform/core-services.js +128 -0
- package/dist/platform/core-services.js.map +1 -1
- package/dist/platform/maestro-timeline-client.d.ts +22 -0
- package/dist/platform/maestro-timeline-client.d.ts.map +1 -0
- package/dist/platform/maestro-timeline-client.js +373 -0
- package/dist/platform/maestro-timeline-client.js.map +1 -0
- package/dist/platform/tool-execution-client.d.ts +104 -0
- package/dist/platform/tool-execution-client.d.ts.map +1 -0
- package/dist/platform/tool-execution-client.js +284 -0
- package/dist/platform/tool-execution-client.js.map +1 -0
- package/dist/prompts/service-client.d.ts.map +1 -1
- package/dist/prompts/service-client.js +5 -2
- package/dist/prompts/service-client.js.map +1 -1
- package/dist/providers/anthropic-auth.d.ts.map +1 -1
- package/dist/providers/anthropic-auth.js +8 -6
- package/dist/providers/anthropic-auth.js.map +1 -1
- package/dist/providers/api-keys.d.ts +1 -0
- package/dist/providers/api-keys.d.ts.map +1 -1
- package/dist/providers/api-keys.js +5 -0
- package/dist/providers/api-keys.js.map +1 -1
- package/dist/providers/auth.d.ts +2 -1
- package/dist/providers/auth.d.ts.map +1 -1
- package/dist/providers/auth.js +26 -3
- package/dist/providers/auth.js.map +1 -1
- package/dist/remote-runner/attach-client.d.ts +41 -0
- package/dist/remote-runner/attach-client.d.ts.map +1 -0
- package/dist/remote-runner/attach-client.js +692 -0
- package/dist/remote-runner/attach-client.js.map +1 -0
- package/dist/remote-runner/client.d.ts +205 -0
- package/dist/remote-runner/client.d.ts.map +1 -0
- package/dist/remote-runner/client.js +633 -0
- package/dist/remote-runner/client.js.map +1 -0
- package/dist/safety/action-firewall.d.ts +6 -1
- package/dist/safety/action-firewall.d.ts.map +1 -1
- package/dist/safety/action-firewall.js +62 -26
- package/dist/safety/action-firewall.js.map +1 -1
- package/dist/safety/governance-service-client.d.ts +36 -0
- package/dist/safety/governance-service-client.d.ts.map +1 -0
- package/dist/safety/governance-service-client.js +279 -0
- package/dist/safety/governance-service-client.js.map +1 -0
- package/dist/safety/policy.d.ts +13 -2
- package/dist/safety/policy.d.ts.map +1 -1
- package/dist/safety/policy.js +474 -52
- package/dist/safety/policy.js.map +1 -1
- package/dist/sdk-tools.d.ts +21 -0
- package/dist/sdk-tools.d.ts.map +1 -1
- package/dist/sdk-tools.js +16 -0
- package/dist/sdk-tools.js.map +1 -1
- package/dist/server/app-context.d.ts +25 -0
- package/dist/server/app-context.d.ts.map +1 -1
- package/dist/server/app-context.js.map +1 -1
- package/dist/server/approval-service.d.ts +7 -8
- package/dist/server/approval-service.d.ts.map +1 -1
- package/dist/server/approval-service.js +12 -24
- package/dist/server/approval-service.js.map +1 -1
- package/dist/server/authz.d.ts +23 -2
- package/dist/server/authz.d.ts.map +1 -1
- package/dist/server/authz.js +153 -17
- package/dist/server/authz.js.map +1 -1
- package/dist/server/handlers/approvals.d.ts.map +1 -1
- package/dist/server/handlers/approvals.js +3 -10
- package/dist/server/handlers/approvals.js.map +1 -1
- package/dist/server/handlers/branch.d.ts.map +1 -1
- package/dist/server/handlers/branch.js +29 -20
- package/dist/server/handlers/branch.js.map +1 -1
- package/dist/server/handlers/bridge.d.ts.map +1 -1
- package/dist/server/handlers/bridge.js +3 -2
- package/dist/server/handlers/bridge.js.map +1 -1
- package/dist/server/handlers/chat-ws.d.ts.map +1 -1
- package/dist/server/handlers/chat-ws.js +23 -31
- package/dist/server/handlers/chat-ws.js.map +1 -1
- package/dist/server/handlers/chat.d.ts.map +1 -1
- package/dist/server/handlers/chat.js +105 -46
- package/dist/server/handlers/chat.js.map +1 -1
- package/dist/server/handlers/compliance.d.ts +3 -0
- package/dist/server/handlers/compliance.d.ts.map +1 -0
- package/dist/server/handlers/compliance.js +53 -0
- package/dist/server/handlers/compliance.js.map +1 -0
- package/dist/server/handlers/context.d.ts.map +1 -1
- package/dist/server/handlers/context.js +3 -8
- package/dist/server/handlers/context.js.map +1 -1
- package/dist/server/handlers/fleet.d.ts +4 -0
- package/dist/server/handlers/fleet.d.ts.map +1 -0
- package/dist/server/handlers/fleet.js +9 -0
- package/dist/server/handlers/fleet.js.map +1 -0
- package/dist/server/handlers/headless-sessions.d.ts +4 -0
- package/dist/server/handlers/headless-sessions.d.ts.map +1 -1
- package/dist/server/handlers/headless-sessions.js +168 -3
- package/dist/server/handlers/headless-sessions.js.map +1 -1
- package/dist/server/handlers/health.d.ts +31 -2
- package/dist/server/handlers/health.d.ts.map +1 -1
- package/dist/server/handlers/health.js +82 -8
- package/dist/server/handlers/health.js.map +1 -1
- package/dist/server/handlers/hosted-runner-drain.d.ts +128 -0
- package/dist/server/handlers/hosted-runner-drain.d.ts.map +1 -0
- package/dist/server/handlers/hosted-runner-drain.js +373 -0
- package/dist/server/handlers/hosted-runner-drain.js.map +1 -0
- package/dist/server/handlers/hosted-runner-identity.d.ts +17 -0
- package/dist/server/handlers/hosted-runner-identity.d.ts.map +1 -0
- package/dist/server/handlers/hosted-runner-identity.js +39 -0
- package/dist/server/handlers/hosted-runner-identity.js.map +1 -0
- package/dist/server/handlers/intelligent-router.d.ts +3 -0
- package/dist/server/handlers/intelligent-router.d.ts.map +1 -0
- package/dist/server/handlers/intelligent-router.js +141 -0
- package/dist/server/handlers/intelligent-router.js.map +1 -0
- package/dist/server/handlers/models.d.ts.map +1 -1
- package/dist/server/handlers/models.js +14 -0
- package/dist/server/handlers/models.js.map +1 -1
- package/dist/server/handlers/pending-requests.d.ts +8 -0
- package/dist/server/handlers/pending-requests.d.ts.map +1 -0
- package/dist/server/handlers/pending-requests.js +149 -0
- package/dist/server/handlers/pending-requests.js.map +1 -0
- package/dist/server/handlers/revenue-attribution.d.ts +3 -0
- package/dist/server/handlers/revenue-attribution.d.ts.map +1 -0
- package/dist/server/handlers/revenue-attribution.js +45 -0
- package/dist/server/handlers/revenue-attribution.js.map +1 -0
- package/dist/server/handlers/runtime-app-server-ws.d.ts +10 -0
- package/dist/server/handlers/runtime-app-server-ws.d.ts.map +1 -0
- package/dist/server/handlers/runtime-app-server-ws.js +206 -0
- package/dist/server/handlers/runtime-app-server-ws.js.map +1 -0
- package/dist/server/handlers/session-artifacts.js +2 -2
- package/dist/server/handlers/session-artifacts.js.map +1 -1
- package/dist/server/handlers/session-attachments.js +3 -3
- package/dist/server/handlers/session-attachments.js.map +1 -1
- package/dist/server/handlers/session-timeline.d.ts +11 -0
- package/dist/server/handlers/session-timeline.d.ts.map +1 -0
- package/dist/server/handlers/session-timeline.js +77 -0
- package/dist/server/handlers/session-timeline.js.map +1 -0
- package/dist/server/handlers/sessions.d.ts +11 -0
- package/dist/server/handlers/sessions.d.ts.map +1 -1
- package/dist/server/handlers/sessions.js +68 -100
- package/dist/server/handlers/sessions.js.map +1 -1
- package/dist/server/handlers/traces.d.ts +3 -0
- package/dist/server/handlers/traces.d.ts.map +1 -0
- package/dist/server/handlers/traces.js +60 -0
- package/dist/server/handlers/traces.js.map +1 -0
- package/dist/server/handlers/usage-analytics.d.ts +3 -0
- package/dist/server/handlers/usage-analytics.d.ts.map +1 -0
- package/dist/server/handlers/usage-analytics.js +40 -0
- package/dist/server/handlers/usage-analytics.js.map +1 -0
- package/dist/server/handlers/workspace-config.d.ts +3 -0
- package/dist/server/handlers/workspace-config.d.ts.map +1 -0
- package/dist/server/handlers/workspace-config.js +62 -0
- package/dist/server/handlers/workspace-config.js.map +1 -0
- package/dist/server/headless-in-process-host.d.ts +8 -1
- package/dist/server/headless-in-process-host.d.ts.map +1 -1
- package/dist/server/headless-in-process-host.js +6 -0
- package/dist/server/headless-in-process-host.js.map +1 -1
- package/dist/server/headless-runtime-service.d.ts +99 -1
- package/dist/server/headless-runtime-service.d.ts.map +1 -1
- package/dist/server/headless-runtime-service.js +286 -23
- package/dist/server/headless-runtime-service.js.map +1 -1
- package/dist/server/hosted-session-manager.d.ts +103 -0
- package/dist/server/hosted-session-manager.d.ts.map +1 -0
- package/dist/server/hosted-session-manager.js +629 -0
- package/dist/server/hosted-session-manager.js.map +1 -0
- package/dist/server/pending-request-payload.d.ts +4 -0
- package/dist/server/pending-request-payload.d.ts.map +1 -0
- package/dist/server/pending-request-payload.js +107 -0
- package/dist/server/pending-request-payload.js.map +1 -0
- package/dist/server/request-context.d.ts +4 -0
- package/dist/server/request-context.d.ts.map +1 -1
- package/dist/server/request-context.js +9 -0
- package/dist/server/request-context.js.map +1 -1
- package/dist/server/routes.d.ts.map +1 -1
- package/dist/server/routes.js +149 -1
- package/dist/server/routes.js.map +1 -1
- package/dist/server/runtime-ws-access.d.ts +16 -0
- package/dist/server/runtime-ws-access.d.ts.map +1 -0
- package/dist/server/runtime-ws-access.js +21 -0
- package/dist/server/runtime-ws-access.js.map +1 -0
- package/dist/server/server-middlewares.d.ts +1 -1
- package/dist/server/server-middlewares.d.ts.map +1 -1
- package/dist/server/server-middlewares.js +35 -27
- package/dist/server/server-middlewares.js.map +1 -1
- package/dist/server/server-request-manager.d.ts +8 -27
- package/dist/server/server-request-manager.d.ts.map +1 -1
- package/dist/server/server-request-manager.js +7 -0
- package/dist/server/server-request-manager.js.map +1 -1
- package/dist/server/server-utils.d.ts +2 -1
- package/dist/server/server-utils.d.ts.map +1 -1
- package/dist/server/server-utils.js +11 -1
- package/dist/server/server-utils.js.map +1 -1
- package/dist/server/session-event-env.d.ts +2 -0
- package/dist/server/session-event-env.d.ts.map +1 -0
- package/dist/server/session-event-env.js +8 -0
- package/dist/server/session-event-env.js.map +1 -0
- package/dist/server/session-initialization.d.ts +25 -4
- package/dist/server/session-initialization.d.ts.map +1 -1
- package/dist/server/session-initialization.js +22 -5
- package/dist/server/session-initialization.js.map +1 -1
- package/dist/server/session-scope.d.ts +4 -0
- package/dist/server/session-scope.d.ts.map +1 -1
- package/dist/server/session-scope.js +44 -4
- package/dist/server/session-scope.js.map +1 -1
- package/dist/server/session-timeline.d.ts +13 -0
- package/dist/server/session-timeline.d.ts.map +1 -0
- package/dist/server/session-timeline.js +566 -0
- package/dist/server/session-timeline.js.map +1 -0
- package/dist/services/compliance/controls.d.ts +6 -0
- package/dist/services/compliance/controls.d.ts.map +1 -0
- package/dist/services/compliance/controls.js +113 -0
- package/dist/services/compliance/controls.js.map +1 -0
- package/dist/services/compliance/index.d.ts +6 -0
- package/dist/services/compliance/index.d.ts.map +1 -0
- package/dist/services/compliance/index.js +5 -0
- package/dist/services/compliance/index.js.map +1 -0
- package/dist/services/compliance/normalize.d.ts +23 -0
- package/dist/services/compliance/normalize.d.ts.map +1 -0
- package/dist/services/compliance/normalize.js +226 -0
- package/dist/services/compliance/normalize.js.map +1 -0
- package/dist/services/compliance/recorder.d.ts +22 -0
- package/dist/services/compliance/recorder.d.ts.map +1 -0
- package/dist/services/compliance/recorder.js +89 -0
- package/dist/services/compliance/recorder.js.map +1 -0
- package/dist/services/compliance/service.d.ts +24 -0
- package/dist/services/compliance/service.d.ts.map +1 -0
- package/dist/services/compliance/service.js +426 -0
- package/dist/services/compliance/service.js.map +1 -0
- package/dist/services/compliance/types.d.ts +185 -0
- package/dist/services/compliance/types.d.ts.map +1 -0
- package/dist/services/compliance/types.js +2 -0
- package/dist/services/compliance/types.js.map +1 -0
- package/dist/services/intelligent-router/index.d.ts +5 -0
- package/dist/services/intelligent-router/index.d.ts.map +1 -0
- package/dist/services/intelligent-router/index.js +5 -0
- package/dist/services/intelligent-router/index.js.map +1 -0
- package/dist/services/intelligent-router/normalize.d.ts +9 -0
- package/dist/services/intelligent-router/normalize.d.ts.map +1 -0
- package/dist/services/intelligent-router/normalize.js +169 -0
- package/dist/services/intelligent-router/normalize.js.map +1 -0
- package/dist/services/intelligent-router/recorder.d.ts +24 -0
- package/dist/services/intelligent-router/recorder.d.ts.map +1 -0
- package/dist/services/intelligent-router/recorder.js +98 -0
- package/dist/services/intelligent-router/recorder.js.map +1 -0
- package/dist/services/intelligent-router/service.d.ts +22 -0
- package/dist/services/intelligent-router/service.d.ts.map +1 -0
- package/dist/services/intelligent-router/service.js +328 -0
- package/dist/services/intelligent-router/service.js.map +1 -0
- package/dist/services/intelligent-router/types.d.ts +98 -0
- package/dist/services/intelligent-router/types.d.ts.map +1 -0
- package/dist/services/intelligent-router/types.js +7 -0
- package/dist/services/intelligent-router/types.js.map +1 -0
- package/dist/services/revenue-attribution/index.d.ts +4 -0
- package/dist/services/revenue-attribution/index.d.ts.map +1 -0
- package/dist/services/revenue-attribution/index.js +4 -0
- package/dist/services/revenue-attribution/index.js.map +1 -0
- package/dist/services/revenue-attribution/normalize.d.ts +13 -0
- package/dist/services/revenue-attribution/normalize.d.ts.map +1 -0
- package/dist/services/revenue-attribution/normalize.js +155 -0
- package/dist/services/revenue-attribution/normalize.js.map +1 -0
- package/dist/services/revenue-attribution/service.d.ts +21 -0
- package/dist/services/revenue-attribution/service.d.ts.map +1 -0
- package/dist/services/revenue-attribution/service.js +248 -0
- package/dist/services/revenue-attribution/service.js.map +1 -0
- package/dist/services/revenue-attribution/types.d.ts +96 -0
- package/dist/services/revenue-attribution/types.d.ts.map +1 -0
- package/dist/services/revenue-attribution/types.js +7 -0
- package/dist/services/revenue-attribution/types.js.map +1 -0
- package/dist/services/traces/index.d.ts +5 -0
- package/dist/services/traces/index.d.ts.map +1 -0
- package/dist/services/traces/index.js +4 -0
- package/dist/services/traces/index.js.map +1 -0
- package/dist/services/traces/normalize.d.ts +20 -0
- package/dist/services/traces/normalize.d.ts.map +1 -0
- package/dist/services/traces/normalize.js +261 -0
- package/dist/services/traces/normalize.js.map +1 -0
- package/dist/services/traces/otel.d.ts +3 -0
- package/dist/services/traces/otel.d.ts.map +1 -0
- package/dist/services/traces/otel.js +173 -0
- package/dist/services/traces/otel.js.map +1 -0
- package/dist/services/traces/service.d.ts +17 -0
- package/dist/services/traces/service.d.ts.map +1 -0
- package/dist/services/traces/service.js +197 -0
- package/dist/services/traces/service.js.map +1 -0
- package/dist/services/traces/types.d.ts +130 -0
- package/dist/services/traces/types.d.ts.map +1 -0
- package/dist/services/traces/types.js +8 -0
- package/dist/services/traces/types.js.map +1 -0
- package/dist/services/usage-analytics/aggregation.d.ts +18 -0
- package/dist/services/usage-analytics/aggregation.d.ts.map +1 -0
- package/dist/services/usage-analytics/aggregation.js +130 -0
- package/dist/services/usage-analytics/aggregation.js.map +1 -0
- package/dist/services/usage-analytics/index.d.ts +5 -0
- package/dist/services/usage-analytics/index.d.ts.map +1 -0
- package/dist/services/usage-analytics/index.js +4 -0
- package/dist/services/usage-analytics/index.js.map +1 -0
- package/dist/services/usage-analytics/recorder.d.ts +16 -0
- package/dist/services/usage-analytics/recorder.d.ts.map +1 -0
- package/dist/services/usage-analytics/recorder.js +128 -0
- package/dist/services/usage-analytics/recorder.js.map +1 -0
- package/dist/services/usage-analytics/service.d.ts +15 -0
- package/dist/services/usage-analytics/service.d.ts.map +1 -0
- package/dist/services/usage-analytics/service.js +210 -0
- package/dist/services/usage-analytics/service.js.map +1 -0
- package/dist/services/usage-analytics/types.d.ts +80 -0
- package/dist/services/usage-analytics/types.d.ts.map +1 -0
- package/dist/services/usage-analytics/types.js +2 -0
- package/dist/services/usage-analytics/types.js.map +1 -0
- package/dist/services/workspace-config/index.d.ts +6 -0
- package/dist/services/workspace-config/index.d.ts.map +1 -0
- package/dist/services/workspace-config/index.js +5 -0
- package/dist/services/workspace-config/index.js.map +1 -0
- package/dist/services/workspace-config/middleware.d.ts +5 -0
- package/dist/services/workspace-config/middleware.d.ts.map +1 -0
- package/dist/services/workspace-config/middleware.js +98 -0
- package/dist/services/workspace-config/middleware.js.map +1 -0
- package/dist/services/workspace-config/normalize.d.ts +17 -0
- package/dist/services/workspace-config/normalize.d.ts.map +1 -0
- package/dist/services/workspace-config/normalize.js +148 -0
- package/dist/services/workspace-config/normalize.js.map +1 -0
- package/dist/services/workspace-config/policy.d.ts +16 -0
- package/dist/services/workspace-config/policy.d.ts.map +1 -0
- package/dist/services/workspace-config/policy.js +77 -0
- package/dist/services/workspace-config/policy.js.map +1 -0
- package/dist/services/workspace-config/service.d.ts +20 -0
- package/dist/services/workspace-config/service.d.ts.map +1 -0
- package/dist/services/workspace-config/service.js +162 -0
- package/dist/services/workspace-config/service.js.map +1 -0
- package/dist/services/workspace-config/types.d.ts +71 -0
- package/dist/services/workspace-config/types.d.ts.map +1 -0
- package/dist/services/workspace-config/types.js +2 -0
- package/dist/services/workspace-config/types.js.map +1 -0
- package/dist/session/manager.d.ts.map +1 -1
- package/dist/session/manager.js +10 -0
- package/dist/session/manager.js.map +1 -1
- package/dist/session/migration.d.ts.map +1 -1
- package/dist/session/migration.js +2 -1
- package/dist/session/migration.js.map +1 -1
- package/dist/session/session-memory.d.ts.map +1 -1
- package/dist/session/session-memory.js +7 -1
- package/dist/session/session-memory.js.map +1 -1
- package/dist/session/types.d.ts +1 -2
- package/dist/session/types.d.ts.map +1 -1
- package/dist/session/types.js +1 -22
- package/dist/session/types.js.map +1 -1
- package/dist/session/wire-format.d.ts +7 -0
- package/dist/session/wire-format.d.ts.map +1 -0
- package/dist/session/wire-format.generated.d.ts +95 -0
- package/dist/session/wire-format.generated.d.ts.map +1 -0
- package/dist/session/wire-format.generated.js +111 -0
- package/dist/session/wire-format.generated.js.map +1 -0
- package/dist/session/wire-format.js +145 -0
- package/dist/session/wire-format.js.map +1 -0
- package/dist/shared-memory/client.d.ts.map +1 -1
- package/dist/shared-memory/client.js +22 -22
- package/dist/shared-memory/client.js.map +1 -1
- package/dist/skills/artifact-metadata.d.ts +16 -0
- package/dist/skills/artifact-metadata.d.ts.map +1 -0
- package/dist/skills/artifact-metadata.js +86 -0
- package/dist/skills/artifact-metadata.js.map +1 -0
- package/dist/skills/loader.d.ts +2 -2
- package/dist/skills/loader.d.ts.map +1 -1
- package/dist/skills/loader.js +1 -0
- package/dist/skills/loader.js.map +1 -1
- package/dist/skills/service-client.d.ts +42 -0
- package/dist/skills/service-client.d.ts.map +1 -0
- package/dist/skills/service-client.js +258 -0
- package/dist/skills/service-client.js.map +1 -0
- package/dist/skills/tool.d.ts +3 -0
- package/dist/skills/tool.d.ts.map +1 -1
- package/dist/skills/tool.js +67 -5
- package/dist/skills/tool.js.map +1 -1
- package/dist/telemetry/index.d.ts +4 -0
- package/dist/telemetry/index.d.ts.map +1 -1
- package/dist/telemetry/index.js +5 -0
- package/dist/telemetry/index.js.map +1 -1
- package/dist/telemetry/maestro-event-bus.d.ts +440 -0
- package/dist/telemetry/maestro-event-bus.d.ts.map +1 -0
- package/dist/telemetry/maestro-event-bus.js +784 -0
- package/dist/telemetry/maestro-event-bus.js.map +1 -0
- package/dist/telemetry/maestro-event-catalog.d.ts +48 -0
- package/dist/telemetry/maestro-event-catalog.d.ts.map +1 -0
- package/dist/telemetry/maestro-event-catalog.js +69 -0
- package/dist/telemetry/maestro-event-catalog.js.map +1 -0
- package/dist/telemetry/maestro-platform-replay-fixture.d.ts +24 -0
- package/dist/telemetry/maestro-platform-replay-fixture.d.ts.map +1 -0
- package/dist/telemetry/maestro-platform-replay-fixture.js +400 -0
- package/dist/telemetry/maestro-platform-replay-fixture.js.map +1 -0
- package/dist/telemetry/maestro-publisher-conformance-fixture.d.ts +29 -0
- package/dist/telemetry/maestro-publisher-conformance-fixture.d.ts.map +1 -0
- package/dist/telemetry/maestro-publisher-conformance-fixture.js +240 -0
- package/dist/telemetry/maestro-publisher-conformance-fixture.js.map +1 -0
- package/dist/telemetry/meter-service-client.d.ts +0 -33
- package/dist/telemetry/meter-service-client.d.ts.map +1 -1
- package/dist/telemetry/meter-service-client.js +22 -50
- package/dist/telemetry/meter-service-client.js.map +1 -1
- package/dist/telemetry/turn-tracker.d.ts.map +1 -1
- package/dist/telemetry/turn-tracker.js +5 -5
- package/dist/telemetry/turn-tracker.js.map +1 -1
- package/dist/telemetry/wide-events.d.ts +8 -0
- package/dist/telemetry/wide-events.d.ts.map +1 -1
- package/dist/telemetry/wide-events.js +28 -0
- package/dist/telemetry/wide-events.js.map +1 -1
- package/dist/telemetry.d.ts +1 -1
- package/dist/telemetry.d.ts.map +1 -1
- package/dist/telemetry.js +14 -4
- package/dist/telemetry.js.map +1 -1
- package/dist/timeline/redaction.d.ts +5 -0
- package/dist/timeline/redaction.d.ts.map +1 -0
- package/dist/timeline/redaction.js +119 -0
- package/dist/timeline/redaction.js.map +1 -0
- package/dist/tools/ask-user.d.ts +26 -0
- package/dist/tools/ask-user.d.ts.map +1 -1
- package/dist/tools/ask-user.js +33 -1
- package/dist/tools/ask-user.js.map +1 -1
- package/dist/tools/background/task-types.d.ts +1 -1
- package/dist/tools/edit.d.ts +2 -0
- package/dist/tools/edit.d.ts.map +1 -1
- package/dist/tools/edit.js +27 -7
- package/dist/tools/edit.js.map +1 -1
- package/dist/tools/index.d.ts +9 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/pipeline.d.ts.map +1 -1
- package/dist/tools/pipeline.js +16 -7
- package/dist/tools/pipeline.js.map +1 -1
- package/dist/tools/write.d.ts +2 -0
- package/dist/tools/write.d.ts.map +1 -1
- package/dist/tools/write.js +24 -6
- package/dist/tools/write.js.map +1 -1
- package/dist/tracking/cost-tracker.d.ts +15 -12
- package/dist/tracking/cost-tracker.d.ts.map +1 -1
- package/dist/tracking/cost-tracker.js +29 -40
- package/dist/tracking/cost-tracker.js.map +1 -1
- package/dist/utils/checkpoint-profiler.d.ts +29 -0
- package/dist/utils/checkpoint-profiler.d.ts.map +1 -0
- package/dist/utils/checkpoint-profiler.js +118 -0
- package/dist/utils/checkpoint-profiler.js.map +1 -0
- package/dist/utils/downstream-http.d.ts +21 -0
- package/dist/utils/downstream-http.d.ts.map +1 -0
- package/dist/utils/downstream-http.js +151 -0
- package/dist/utils/downstream-http.js.map +1 -0
- package/dist/utils/downstream.d.ts +18 -0
- package/dist/utils/downstream.d.ts.map +1 -0
- package/dist/utils/downstream.js +47 -0
- package/dist/utils/downstream.js.map +1 -0
- package/dist/utils/logger.d.ts +3 -1
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js +12 -1
- package/dist/utils/logger.js.map +1 -1
- package/dist/utils/oauth-http.d.ts +8 -0
- package/dist/utils/oauth-http.d.ts.map +1 -0
- package/dist/utils/oauth-http.js +41 -0
- package/dist/utils/oauth-http.js.map +1 -0
- package/dist/utils/path-utils.d.ts +2 -0
- package/dist/utils/path-utils.d.ts.map +1 -0
- package/dist/utils/path-utils.js +12 -0
- package/dist/utils/path-utils.js.map +1 -0
- package/dist/utils/path-validation.d.ts +1 -1
- package/dist/utils/path-validation.d.ts.map +1 -1
- package/dist/utils/path-validation.js +3 -3
- package/dist/utils/path-validation.js.map +1 -1
- package/dist/version.json +2 -2
- package/dist/web-server.d.ts +7 -1
- package/dist/web-server.d.ts.map +1 -1
- package/dist/web-server.js +117 -15
- package/dist/web-server.js.map +1 -1
- package/dist/webhooks/delivery.d.ts.map +1 -1
- package/dist/webhooks/delivery.js +9 -12
- package/dist/webhooks/delivery.js.map +1 -1
- package/node_modules/@bufbuild/protobuf/dist/cjs/descriptors.d.ts +12 -5
- package/node_modules/@bufbuild/protobuf/dist/cjs/from-binary.js +7 -7
- package/node_modules/@bufbuild/protobuf/dist/cjs/from-json.d.ts +1 -1
- package/node_modules/@bufbuild/protobuf/dist/cjs/from-json.js +1 -1
- package/node_modules/@bufbuild/protobuf/dist/cjs/reflect/path.d.ts +1 -1
- package/node_modules/@bufbuild/protobuf/dist/cjs/registry.js +24 -1
- package/node_modules/@bufbuild/protobuf/dist/cjs/to-json.d.ts +1 -1
- package/node_modules/@bufbuild/protobuf/dist/cjs/to-json.js +9 -10
- package/node_modules/@bufbuild/protobuf/dist/cjs/types.d.ts +1 -1
- package/node_modules/@bufbuild/protobuf/dist/cjs/wire/binary-encoding.d.ts +9 -7
- package/node_modules/@bufbuild/protobuf/dist/cjs/wire/binary-encoding.js +18 -8
- package/node_modules/@bufbuild/protobuf/dist/cjs/wire/text-encoding.d.ts +4 -2
- package/node_modules/@bufbuild/protobuf/dist/cjs/wire/text-encoding.js +8 -1
- package/node_modules/@bufbuild/protobuf/dist/cjs/wkt/gen/google/protobuf/api_pb.d.ts +1 -1
- package/node_modules/@bufbuild/protobuf/dist/cjs/wkt/gen/google/protobuf/compiler/plugin_pb.d.ts +2 -2
- package/node_modules/@bufbuild/protobuf/dist/cjs/wkt/gen/google/protobuf/descriptor_pb.d.ts +37 -23
- package/node_modules/@bufbuild/protobuf/dist/cjs/wkt/gen/google/protobuf/descriptor_pb.js +1 -1
- package/node_modules/@bufbuild/protobuf/dist/cjs/wkt/gen/google/protobuf/field_mask_pb.d.ts +32 -36
- package/node_modules/@bufbuild/protobuf/dist/cjs/wkt/gen/google/protobuf/go_features_pb.d.ts +65 -0
- package/node_modules/@bufbuild/protobuf/dist/cjs/wkt/gen/google/protobuf/go_features_pb.js +38 -2
- package/node_modules/@bufbuild/protobuf/dist/cjs/wkt/gen/google/protobuf/timestamp_pb.d.ts +5 -5
- package/node_modules/@bufbuild/protobuf/dist/cjs/wkt/gen/google/protobuf/type_pb.d.ts +3 -3
- package/node_modules/@bufbuild/protobuf/dist/cjs/wkt/wrappers.d.ts +10 -0
- package/node_modules/@bufbuild/protobuf/dist/cjs/wkt/wrappers.js +24 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/descriptors.d.ts +12 -5
- package/node_modules/@bufbuild/protobuf/dist/esm/from-binary.js +7 -7
- package/node_modules/@bufbuild/protobuf/dist/esm/from-json.d.ts +1 -1
- package/node_modules/@bufbuild/protobuf/dist/esm/from-json.js +2 -2
- package/node_modules/@bufbuild/protobuf/dist/esm/reflect/path.d.ts +1 -1
- package/node_modules/@bufbuild/protobuf/dist/esm/registry.js +24 -1
- package/node_modules/@bufbuild/protobuf/dist/esm/to-json.d.ts +1 -1
- package/node_modules/@bufbuild/protobuf/dist/esm/to-json.js +10 -11
- package/node_modules/@bufbuild/protobuf/dist/esm/types.d.ts +1 -1
- package/node_modules/@bufbuild/protobuf/dist/esm/wire/binary-encoding.d.ts +9 -7
- package/node_modules/@bufbuild/protobuf/dist/esm/wire/binary-encoding.js +18 -8
- package/node_modules/@bufbuild/protobuf/dist/esm/wire/text-encoding.d.ts +4 -2
- package/node_modules/@bufbuild/protobuf/dist/esm/wire/text-encoding.js +8 -1
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/api_pb.d.ts +1 -1
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/compiler/plugin_pb.d.ts +2 -2
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/descriptor_pb.d.ts +37 -23
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/descriptor_pb.js +1 -1
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/field_mask_pb.d.ts +32 -36
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/go_features_pb.d.ts +65 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/go_features_pb.js +37 -1
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/timestamp_pb.d.ts +5 -5
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/type_pb.d.ts +3 -3
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/wrappers.d.ts +10 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/wrappers.js +23 -0
- package/node_modules/@bufbuild/protobuf/package.json +1 -1
- package/node_modules/@evalops/contracts/dist/headless-protocol-schemas.generated.d.ts +305 -2
- package/node_modules/@evalops/contracts/dist/headless-protocol-schemas.generated.d.ts.map +1 -1
- package/node_modules/@evalops/contracts/dist/headless-protocol-schemas.generated.js +34 -4
- package/node_modules/@evalops/contracts/dist/headless-protocol-schemas.generated.js.map +1 -1
- package/node_modules/@evalops/contracts/dist/index.d.ts +88 -0
- package/node_modules/@evalops/contracts/dist/index.d.ts.map +1 -1
- package/node_modules/@evalops/contracts/dist/index.js +2 -0
- package/node_modules/@evalops/contracts/dist/index.js.map +1 -1
- package/node_modules/@evalops/contracts/dist/proto/maestro/v1/headless_pb.d.ts +77 -77
- package/node_modules/@evalops/contracts/dist/proto/maestro/v1/headless_pb.d.ts.map +1 -1
- package/node_modules/@evalops/contracts/dist/proto/maestro/v1/headless_pb.js +1 -1
- package/node_modules/@evalops/contracts/dist/proto/maestro/v1/headless_pb.js.map +1 -1
- package/node_modules/@evalops/contracts/dist/runtime-app-server.d.ts +182 -0
- package/node_modules/@evalops/contracts/dist/runtime-app-server.d.ts.map +1 -0
- package/node_modules/@evalops/contracts/dist/runtime-app-server.js +83 -0
- package/node_modules/@evalops/contracts/dist/runtime-app-server.js.map +1 -0
- package/node_modules/@evalops/contracts/dist/runtime-server-request.d.ts +133 -0
- package/node_modules/@evalops/contracts/dist/runtime-server-request.d.ts.map +1 -0
- package/node_modules/@evalops/contracts/dist/runtime-server-request.js +68 -0
- package/node_modules/@evalops/contracts/dist/runtime-server-request.js.map +1 -0
- package/node_modules/@evalops/contracts/dist/schemas.d.ts +178 -0
- package/node_modules/@evalops/contracts/dist/schemas.d.ts.map +1 -1
- package/node_modules/@evalops/contracts/dist/schemas.js +165 -0
- package/node_modules/@evalops/contracts/dist/schemas.js.map +1 -1
- package/node_modules/@evalops/contracts/dist/typebox-utils.d.ts +2 -0
- package/node_modules/@evalops/contracts/dist/typebox-utils.d.ts.map +1 -0
- package/node_modules/@evalops/contracts/dist/typebox-utils.js +5 -0
- package/node_modules/@evalops/contracts/dist/typebox-utils.js.map +1 -0
- package/node_modules/@evalops/contracts/dist/validators.d.ts +4 -1
- package/node_modules/@evalops/contracts/dist/validators.d.ts.map +1 -1
- package/node_modules/@evalops/contracts/dist/validators.js +4 -1
- package/node_modules/@evalops/contracts/dist/validators.js.map +1 -1
- package/node_modules/@evalops/contracts/package.json +1 -1
- package/node_modules/@evalops/tui/package.json +1 -1
- package/node_modules/string-width/index.js +93 -9
- package/node_modules/string-width/package.json +1 -1
- package/package.json +32 -25
- package/dist/cli-tui/commands/grouped/auth-commands.d.ts.map +0 -1
- package/dist/cli-tui/commands/grouped/auth-commands.js.map +0 -1
- package/dist/cli-tui/commands/grouped/config-commands.d.ts.map +0 -1
- package/dist/cli-tui/commands/grouped/config-commands.js.map +0 -1
- package/dist/cli-tui/commands/grouped/diag-commands.d.ts.map +0 -1
- package/dist/cli-tui/commands/grouped/diag-commands.js.map +0 -1
- package/dist/cli-tui/commands/grouped/git-commands.d.ts.map +0 -1
- package/dist/cli-tui/commands/grouped/git-commands.js.map +0 -1
- package/dist/cli-tui/commands/grouped/index.d.ts.map +0 -1
- package/dist/cli-tui/commands/grouped/index.js.map +0 -1
- package/dist/cli-tui/commands/grouped/safety-commands.d.ts.map +0 -1
- package/dist/cli-tui/commands/grouped/safety-commands.js.map +0 -1
- package/dist/cli-tui/commands/grouped/session-commands.d.ts.map +0 -1
- package/dist/cli-tui/commands/grouped/session-commands.js.map +0 -1
- package/dist/cli-tui/commands/grouped/tools-commands.d.ts.map +0 -1
- package/dist/cli-tui/commands/grouped/tools-commands.js.map +0 -1
- package/dist/cli-tui/commands/grouped/ui-commands.d.ts.map +0 -1
- package/dist/cli-tui/commands/grouped/ui-commands.js.map +0 -1
- package/dist/cli-tui/commands/grouped/undo-commands.d.ts.map +0 -1
- package/dist/cli-tui/commands/grouped/undo-commands.js.map +0 -1
- package/dist/cli-tui/commands/grouped/usage-commands.d.ts.map +0 -1
- package/dist/cli-tui/commands/grouped/usage-commands.js.map +0 -1
- package/dist/cli-tui/commands/grouped/utils.d.ts.map +0 -1
- package/dist/cli-tui/commands/grouped/utils.js.map +0 -1
- package/dist/cli-tui/commands/grouped-command-handlers.d.ts.map +0 -1
- package/dist/cli-tui/commands/grouped-command-handlers.js +0 -135
- package/dist/cli-tui/commands/grouped-command-handlers.js.map +0 -1
- package/dist/cli-tui/tui-renderer/grouped-handlers-wiring.d.ts +0 -78
- package/dist/cli-tui/tui-renderer/grouped-handlers-wiring.d.ts.map +0 -1
- package/dist/cli-tui/tui-renderer/grouped-handlers-wiring.js +0 -129
- package/dist/cli-tui/tui-renderer/grouped-handlers-wiring.js.map +0 -1
- package/node_modules/@evalops/memory/dist/client.d.ts +0 -94
- package/node_modules/@evalops/memory/dist/client.js +0 -503
- package/node_modules/@evalops/memory/gen/proto/dist/memory/v1/memory_pb.d.ts +0 -608
- package/node_modules/@evalops/memory/gen/proto/dist/memory/v1/memory_pb.js +0 -187
- package/node_modules/@evalops/memory/package.json +0 -26
- /package/dist/cli-tui/commands/{grouped → subcommands}/usage-commands.d.ts +0 -0
|
@@ -1,11 +1,57 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { stat } from "node:fs/promises";
|
|
2
|
+
import { isDatabaseConfigured, testConnection } from "../../db/client.js";
|
|
3
|
+
import { CRITICAL_DATABASE_TABLES, checkCriticalTables, } from "../../db/health.js";
|
|
2
4
|
import { sendJson } from "../server-utils.js";
|
|
3
|
-
export async function handleReadyz(req, res, cors) {
|
|
4
|
-
const result = await runHealthChecks();
|
|
5
|
+
export async function handleReadyz(req, res, cors, hostedRunner) {
|
|
6
|
+
const result = await runHealthChecks({ hostedRunner });
|
|
5
7
|
const httpStatus = result.status === "unhealthy" ? 503 : 200;
|
|
6
8
|
sendJson(res, httpStatus, result, cors, req);
|
|
7
9
|
}
|
|
8
|
-
export async function
|
|
10
|
+
export async function checkHostedRunnerReadiness(hostedRunner) {
|
|
11
|
+
const base = {
|
|
12
|
+
runnerSessionId: hostedRunner.runnerSessionId,
|
|
13
|
+
ownerInstanceId: hostedRunner.ownerInstanceId,
|
|
14
|
+
workspaceRoot: hostedRunner.workspaceRoot,
|
|
15
|
+
...(hostedRunner.snapshotRoot
|
|
16
|
+
? { snapshotRoot: hostedRunner.snapshotRoot }
|
|
17
|
+
: {}),
|
|
18
|
+
workspaceId: hostedRunner.workspaceId,
|
|
19
|
+
agentRunId: hostedRunner.agentRunId,
|
|
20
|
+
maestroSessionId: hostedRunner.activeMaestroSessionId ??
|
|
21
|
+
hostedRunner.configuredMaestroSessionId,
|
|
22
|
+
...(hostedRunner.lastDrain
|
|
23
|
+
? { lastDrain: { ...hostedRunner.lastDrain } }
|
|
24
|
+
: {}),
|
|
25
|
+
};
|
|
26
|
+
if (hostedRunner.draining) {
|
|
27
|
+
return {
|
|
28
|
+
...base,
|
|
29
|
+
status: "draining",
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
try {
|
|
33
|
+
const stats = await stat(hostedRunner.workspaceRoot);
|
|
34
|
+
if (!stats.isDirectory()) {
|
|
35
|
+
return {
|
|
36
|
+
...base,
|
|
37
|
+
status: "unavailable",
|
|
38
|
+
error: "workspace root is not a directory",
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
...base,
|
|
43
|
+
status: "ready",
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
return {
|
|
48
|
+
...base,
|
|
49
|
+
status: "unavailable",
|
|
50
|
+
error: error instanceof Error ? error.message : String(error),
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
export async function runHealthChecks(options = {}) {
|
|
9
55
|
const checks = {
|
|
10
56
|
database: { status: "unconfigured" },
|
|
11
57
|
};
|
|
@@ -15,22 +61,50 @@ export async function runHealthChecks() {
|
|
|
15
61
|
checks.database.status = "unconfigured";
|
|
16
62
|
// unconfigured is acceptable - some deployments don't use enterprise features
|
|
17
63
|
}
|
|
18
|
-
else if (!isDbAvailable()) {
|
|
19
|
-
checks.database.status = "down";
|
|
20
|
-
overallStatus = "degraded";
|
|
21
|
-
}
|
|
22
64
|
else {
|
|
23
65
|
const start = performance.now();
|
|
24
66
|
const connected = await testConnection();
|
|
25
67
|
checks.database.latencyMs = Math.round(performance.now() - start);
|
|
26
68
|
if (connected) {
|
|
27
69
|
checks.database.status = "up";
|
|
70
|
+
try {
|
|
71
|
+
const tableChecks = await checkCriticalTables();
|
|
72
|
+
const missing = tableChecks.flatMap((table) => {
|
|
73
|
+
if (!table.exists)
|
|
74
|
+
return [table.name];
|
|
75
|
+
return (table.missingColumns ?? []).map((column) => `${table.name}.${column}`);
|
|
76
|
+
});
|
|
77
|
+
checks.database.criticalTables = {
|
|
78
|
+
status: missing.length > 0 ? "missing" : "ok",
|
|
79
|
+
checked: tableChecks.map((table) => table.name),
|
|
80
|
+
missing,
|
|
81
|
+
};
|
|
82
|
+
if (missing.length > 0) {
|
|
83
|
+
overallStatus = "unhealthy";
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
checks.database.criticalTables = {
|
|
88
|
+
status: "error",
|
|
89
|
+
checked: [...CRITICAL_DATABASE_TABLES],
|
|
90
|
+
missing: [...CRITICAL_DATABASE_TABLES],
|
|
91
|
+
error: error instanceof Error ? error.message : String(error),
|
|
92
|
+
};
|
|
93
|
+
overallStatus = "unhealthy";
|
|
94
|
+
}
|
|
28
95
|
}
|
|
29
96
|
else {
|
|
30
97
|
checks.database.status = "down";
|
|
31
98
|
overallStatus = "degraded";
|
|
32
99
|
}
|
|
33
100
|
}
|
|
101
|
+
if (options.hostedRunner) {
|
|
102
|
+
const hostedRunnerCheck = await checkHostedRunnerReadiness(options.hostedRunner);
|
|
103
|
+
checks.hostedRunner = hostedRunnerCheck;
|
|
104
|
+
if (hostedRunnerCheck.status !== "ready") {
|
|
105
|
+
overallStatus = "unhealthy";
|
|
106
|
+
}
|
|
107
|
+
}
|
|
34
108
|
return {
|
|
35
109
|
status: overallStatus,
|
|
36
110
|
checks,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"health.js","sourceRoot":"","sources":["../../../src/server/handlers/health.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"health.js","sourceRoot":"","sources":["../../../src/server/handlers/health.ts"],"names":[],"mappings":"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","sourcesContent":["import { stat } from \"node:fs/promises\";\nimport type { IncomingMessage, ServerResponse } from \"node:http\";\nimport { isDatabaseConfigured, testConnection } from \"../../db/client.js\";\nimport {\n\tCRITICAL_DATABASE_TABLES,\n\tcheckCriticalTables,\n} from \"../../db/health.js\";\nimport type { HostedRunnerContext } from \"../app-context.js\";\nimport { sendJson } from \"../server-utils.js\";\n\nexport interface HealthCheckResult {\n\tstatus: \"healthy\" | \"degraded\" | \"unhealthy\";\n\tchecks: {\n\t\tdatabase: {\n\t\t\tstatus: \"up\" | \"down\" | \"unconfigured\";\n\t\t\tlatencyMs?: number;\n\t\t\tcriticalTables?: {\n\t\t\t\tstatus: \"ok\" | \"missing\" | \"error\";\n\t\t\t\tchecked: string[];\n\t\t\t\tmissing: string[];\n\t\t\t\terror?: string;\n\t\t\t};\n\t\t};\n\t\thostedRunner?: {\n\t\t\tstatus: \"ready\" | \"draining\" | \"unavailable\";\n\t\t\trunnerSessionId: string;\n\t\t\townerInstanceId?: string;\n\t\t\tworkspaceRoot: string;\n\t\t\tsnapshotRoot?: string;\n\t\t\tworkspaceId?: string;\n\t\t\tagentRunId?: string;\n\t\t\tmaestroSessionId?: string;\n\t\t\tlastDrain?: {\n\t\t\t\tstatus: string;\n\t\t\t\tmanifestPath: string;\n\t\t\t\tdrainedAt: string;\n\t\t\t\treason?: string;\n\t\t\t\trequestedBy?: string;\n\t\t\t};\n\t\t\terror?: string;\n\t\t};\n\t};\n\ttimestamp: number;\n}\n\nexport type HostedRunnerHealthCheck = NonNullable<\n\tHealthCheckResult[\"checks\"][\"hostedRunner\"]\n>;\n\nexport async function handleReadyz(\n\treq: IncomingMessage,\n\tres: ServerResponse,\n\tcors: Record<string, string>,\n\thostedRunner?: HostedRunnerContext,\n): Promise<void> {\n\tconst result = await runHealthChecks({ hostedRunner });\n\n\tconst httpStatus = result.status === \"unhealthy\" ? 503 : 200;\n\tsendJson(res, httpStatus, result, cors, req);\n}\n\nexport async function checkHostedRunnerReadiness(\n\thostedRunner: HostedRunnerContext,\n): Promise<HostedRunnerHealthCheck> {\n\tconst base = {\n\t\trunnerSessionId: hostedRunner.runnerSessionId,\n\t\townerInstanceId: hostedRunner.ownerInstanceId,\n\t\tworkspaceRoot: hostedRunner.workspaceRoot,\n\t\t...(hostedRunner.snapshotRoot\n\t\t\t? { snapshotRoot: hostedRunner.snapshotRoot }\n\t\t\t: {}),\n\t\tworkspaceId: hostedRunner.workspaceId,\n\t\tagentRunId: hostedRunner.agentRunId,\n\t\tmaestroSessionId:\n\t\t\thostedRunner.activeMaestroSessionId ??\n\t\t\thostedRunner.configuredMaestroSessionId,\n\t\t...(hostedRunner.lastDrain\n\t\t\t? { lastDrain: { ...hostedRunner.lastDrain } }\n\t\t\t: {}),\n\t};\n\tif (hostedRunner.draining) {\n\t\treturn {\n\t\t\t...base,\n\t\t\tstatus: \"draining\",\n\t\t};\n\t}\n\ttry {\n\t\tconst stats = await stat(hostedRunner.workspaceRoot);\n\t\tif (!stats.isDirectory()) {\n\t\t\treturn {\n\t\t\t\t...base,\n\t\t\t\tstatus: \"unavailable\",\n\t\t\t\terror: \"workspace root is not a directory\",\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\t...base,\n\t\t\tstatus: \"ready\",\n\t\t};\n\t} catch (error) {\n\t\treturn {\n\t\t\t...base,\n\t\t\tstatus: \"unavailable\",\n\t\t\terror: error instanceof Error ? error.message : String(error),\n\t\t};\n\t}\n}\n\nexport async function runHealthChecks(\n\toptions: {\n\t\thostedRunner?: HostedRunnerContext;\n\t} = {},\n): Promise<HealthCheckResult> {\n\tconst checks: HealthCheckResult[\"checks\"] = {\n\t\tdatabase: { status: \"unconfigured\" },\n\t};\n\n\tlet overallStatus: HealthCheckResult[\"status\"] = \"healthy\";\n\n\t// Database check\n\tif (!isDatabaseConfigured()) {\n\t\tchecks.database.status = \"unconfigured\";\n\t\t// unconfigured is acceptable - some deployments don't use enterprise features\n\t} else {\n\t\tconst start = performance.now();\n\t\tconst connected = await testConnection();\n\t\tchecks.database.latencyMs = Math.round(performance.now() - start);\n\n\t\tif (connected) {\n\t\t\tchecks.database.status = \"up\";\n\t\t\ttry {\n\t\t\t\tconst tableChecks = await checkCriticalTables();\n\t\t\t\tconst missing = tableChecks.flatMap((table) => {\n\t\t\t\t\tif (!table.exists) return [table.name];\n\t\t\t\t\treturn (table.missingColumns ?? []).map(\n\t\t\t\t\t\t(column) => `${table.name}.${column}`,\n\t\t\t\t\t);\n\t\t\t\t});\n\t\t\t\tchecks.database.criticalTables = {\n\t\t\t\t\tstatus: missing.length > 0 ? \"missing\" : \"ok\",\n\t\t\t\t\tchecked: tableChecks.map((table) => table.name),\n\t\t\t\t\tmissing,\n\t\t\t\t};\n\t\t\t\tif (missing.length > 0) {\n\t\t\t\t\toverallStatus = \"unhealthy\";\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tchecks.database.criticalTables = {\n\t\t\t\t\tstatus: \"error\",\n\t\t\t\t\tchecked: [...CRITICAL_DATABASE_TABLES],\n\t\t\t\t\tmissing: [...CRITICAL_DATABASE_TABLES],\n\t\t\t\t\terror: error instanceof Error ? error.message : String(error),\n\t\t\t\t};\n\t\t\t\toverallStatus = \"unhealthy\";\n\t\t\t}\n\t\t} else {\n\t\t\tchecks.database.status = \"down\";\n\t\t\toverallStatus = \"degraded\";\n\t\t}\n\t}\n\n\tif (options.hostedRunner) {\n\t\tconst hostedRunnerCheck = await checkHostedRunnerReadiness(\n\t\t\toptions.hostedRunner,\n\t\t);\n\t\tchecks.hostedRunner = hostedRunnerCheck;\n\t\tif (hostedRunnerCheck.status !== \"ready\") {\n\t\t\toverallStatus = \"unhealthy\";\n\t\t}\n\t}\n\n\treturn {\n\t\tstatus: overallStatus,\n\t\tchecks,\n\t\ttimestamp: Date.now(),\n\t};\n}\n"]}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import type { IncomingMessage, ServerResponse } from "node:http";
|
|
2
|
+
import type { HostedRunnerContext, WebServerContext } from "../app-context.js";
|
|
3
|
+
import type { HeadlessRuntimeSnapshot } from "../headless-runtime-service.js";
|
|
4
|
+
export declare const HOSTED_RUNNER_DRAIN_PATH = "/.well-known/evalops/remote-runner/drain";
|
|
5
|
+
export declare const HOSTED_RUNNER_DRAIN_PROTOCOL_VERSION = "evalops.remote-runner.drain.v1";
|
|
6
|
+
export declare const HOSTED_RUNNER_SNAPSHOT_MANIFEST_VERSION = "evalops.remote-runner.snapshot-manifest.v1";
|
|
7
|
+
export declare const HOSTED_RUNNER_RETENTION_POLICY_VERSION = "evalops.remote-runner.retention.v1";
|
|
8
|
+
export declare enum HostedRunnerDrainStatusValue {
|
|
9
|
+
Drained = "drained",
|
|
10
|
+
Interrupted = "interrupted"
|
|
11
|
+
}
|
|
12
|
+
export declare enum HostedRunnerRuntimeFlushStatusValue {
|
|
13
|
+
Completed = "completed",
|
|
14
|
+
Failed = "failed",
|
|
15
|
+
Skipped = "skipped"
|
|
16
|
+
}
|
|
17
|
+
export declare enum HostedRunnerWorkspaceExportPathTypeValue {
|
|
18
|
+
File = "file",
|
|
19
|
+
Directory = "directory",
|
|
20
|
+
Other = "other"
|
|
21
|
+
}
|
|
22
|
+
export declare enum HostedRunnerWorkspaceExportModeValue {
|
|
23
|
+
LocalPathContract = "local_path_contract"
|
|
24
|
+
}
|
|
25
|
+
export declare enum HostedRunnerDrainReasonValue {
|
|
26
|
+
KubernetesPreStop = "kubernetes_prestop",
|
|
27
|
+
ProcessShutdown = "process_shutdown"
|
|
28
|
+
}
|
|
29
|
+
export declare enum HostedRunnerDrainRequestedByValue {
|
|
30
|
+
KubernetesPreStop = "kubernetes_prestop",
|
|
31
|
+
MaestroWebServer = "maestro_web_server"
|
|
32
|
+
}
|
|
33
|
+
export type HostedRunnerDrainStatus = HostedRunnerDrainStatusValue;
|
|
34
|
+
export type HostedRunnerRuntimeFlushStatus = HostedRunnerRuntimeFlushStatusValue;
|
|
35
|
+
export type HostedRunnerWorkspaceExportPathType = HostedRunnerWorkspaceExportPathTypeValue;
|
|
36
|
+
export type HostedRunnerWorkspaceExportMode = HostedRunnerWorkspaceExportModeValue;
|
|
37
|
+
export type HostedRunnerDrainReason = HostedRunnerDrainReasonValue | string;
|
|
38
|
+
export type HostedRunnerDrainRequestedBy = HostedRunnerDrainRequestedByValue | string;
|
|
39
|
+
export interface HostedRunnerRetentionPolicy {
|
|
40
|
+
policy_version: typeof HOSTED_RUNNER_RETENTION_POLICY_VERSION;
|
|
41
|
+
managed_by: "platform";
|
|
42
|
+
visibility: {
|
|
43
|
+
control_plane_metadata: "operator";
|
|
44
|
+
workspace_export: "tenant";
|
|
45
|
+
runtime_snapshot: "internal";
|
|
46
|
+
runtime_logs: "operator";
|
|
47
|
+
};
|
|
48
|
+
redaction: {
|
|
49
|
+
required_before_external_persistence: Array<"runtime_snapshot" | "runtime_logs">;
|
|
50
|
+
forbidden_plaintext: Array<"provider_credentials" | "tool_secrets" | "attach_tokens" | "artifact_access_tokens" | "raw_environment">;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
export interface HostedRunnerDrainInput {
|
|
54
|
+
reason?: HostedRunnerDrainReason;
|
|
55
|
+
requestedBy?: HostedRunnerDrainRequestedBy;
|
|
56
|
+
exportPaths?: string[];
|
|
57
|
+
}
|
|
58
|
+
export interface HostedRunnerRuntimeDrainResult {
|
|
59
|
+
sessionId: string;
|
|
60
|
+
sessionFile?: string;
|
|
61
|
+
protocolVersion?: string;
|
|
62
|
+
cursor?: number;
|
|
63
|
+
snapshot?: HeadlessRuntimeSnapshot;
|
|
64
|
+
}
|
|
65
|
+
export interface HostedRunnerWorkspaceExportPath {
|
|
66
|
+
input: string;
|
|
67
|
+
path: string;
|
|
68
|
+
relative_path: string;
|
|
69
|
+
type: HostedRunnerWorkspaceExportPathType;
|
|
70
|
+
}
|
|
71
|
+
export interface HostedRunnerSnapshotManifest {
|
|
72
|
+
protocol_version: typeof HOSTED_RUNNER_SNAPSHOT_MANIFEST_VERSION;
|
|
73
|
+
runner_session_id: string;
|
|
74
|
+
workspace_id?: string;
|
|
75
|
+
agent_run_id?: string;
|
|
76
|
+
maestro_session_id: string;
|
|
77
|
+
reason?: string;
|
|
78
|
+
requested_by?: string;
|
|
79
|
+
created_at: string;
|
|
80
|
+
workspace_root: string;
|
|
81
|
+
runtime: {
|
|
82
|
+
flush_status: HostedRunnerRuntimeFlushStatus;
|
|
83
|
+
error?: string;
|
|
84
|
+
session_id: string;
|
|
85
|
+
session_file?: string;
|
|
86
|
+
protocol_version?: string;
|
|
87
|
+
cursor?: number;
|
|
88
|
+
};
|
|
89
|
+
workspace_export: {
|
|
90
|
+
mode: HostedRunnerWorkspaceExportMode;
|
|
91
|
+
paths: HostedRunnerWorkspaceExportPath[];
|
|
92
|
+
};
|
|
93
|
+
snapshot: HeadlessRuntimeSnapshot;
|
|
94
|
+
retention_policy: HostedRunnerRetentionPolicy;
|
|
95
|
+
git?: {
|
|
96
|
+
commit?: string;
|
|
97
|
+
branch?: string;
|
|
98
|
+
dirty?: boolean;
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
export interface HostedRunnerDrainResult {
|
|
102
|
+
status: HostedRunnerDrainStatus;
|
|
103
|
+
runner_session_id: string;
|
|
104
|
+
reason?: string;
|
|
105
|
+
requested_by?: string;
|
|
106
|
+
manifest_path: string;
|
|
107
|
+
manifest: HostedRunnerSnapshotManifest;
|
|
108
|
+
}
|
|
109
|
+
export interface DrainHostedRunnerOptions {
|
|
110
|
+
hostedRunner?: HostedRunnerContext;
|
|
111
|
+
drainRuntime?: (sessionId: string) => Promise<HostedRunnerRuntimeDrainResult | null>;
|
|
112
|
+
now?: () => Date;
|
|
113
|
+
}
|
|
114
|
+
interface HostedRunnerDrainRuntimeContext {
|
|
115
|
+
hostedRunner?: HostedRunnerContext;
|
|
116
|
+
headlessRuntimeService: Pick<WebServerContext["headlessRuntimeService"], "getRuntimeBySessionId">;
|
|
117
|
+
}
|
|
118
|
+
export interface DrainHostedRunnerForShutdownOptions {
|
|
119
|
+
now?: () => Date;
|
|
120
|
+
reason?: HostedRunnerDrainReason;
|
|
121
|
+
requestedBy?: HostedRunnerDrainRequestedBy;
|
|
122
|
+
}
|
|
123
|
+
export declare function parseHostedRunnerDrainInput(body: unknown): HostedRunnerDrainInput;
|
|
124
|
+
export declare function drainHostedRunner(input: HostedRunnerDrainInput, options: DrainHostedRunnerOptions): Promise<HostedRunnerDrainResult | null>;
|
|
125
|
+
export declare function drainHostedRunnerForShutdown(context: HostedRunnerDrainRuntimeContext, options?: DrainHostedRunnerForShutdownOptions): Promise<HostedRunnerDrainResult | null>;
|
|
126
|
+
export declare function handleHostedRunnerDrain(req: IncomingMessage, res: ServerResponse, context: WebServerContext): Promise<void>;
|
|
127
|
+
export {};
|
|
128
|
+
//# sourceMappingURL=hosted-runner-drain.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hosted-runner-drain.d.ts","sourceRoot":"","sources":["../../../src/server/handlers/hosted-runner-drain.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
import { execFile } from "node:child_process";
|
|
2
|
+
import { mkdir, realpath, stat, writeFile } from "node:fs/promises";
|
|
3
|
+
import { isAbsolute, join, relative, resolve } from "node:path";
|
|
4
|
+
import { promisify } from "node:util";
|
|
5
|
+
import { HEADLESS_PROTOCOL_VERSION, createHeadlessRuntimeState, } from "../../cli/headless-protocol.js";
|
|
6
|
+
import { ApiError, readJsonBody, sendJson } from "../server-utils.js";
|
|
7
|
+
const execFileAsync = promisify(execFile);
|
|
8
|
+
export const HOSTED_RUNNER_DRAIN_PATH = "/.well-known/evalops/remote-runner/drain";
|
|
9
|
+
export const HOSTED_RUNNER_DRAIN_PROTOCOL_VERSION = "evalops.remote-runner.drain.v1";
|
|
10
|
+
export const HOSTED_RUNNER_SNAPSHOT_MANIFEST_VERSION = "evalops.remote-runner.snapshot-manifest.v1";
|
|
11
|
+
export const HOSTED_RUNNER_RETENTION_POLICY_VERSION = "evalops.remote-runner.retention.v1";
|
|
12
|
+
export var HostedRunnerDrainStatusValue;
|
|
13
|
+
(function (HostedRunnerDrainStatusValue) {
|
|
14
|
+
HostedRunnerDrainStatusValue["Drained"] = "drained";
|
|
15
|
+
HostedRunnerDrainStatusValue["Interrupted"] = "interrupted";
|
|
16
|
+
})(HostedRunnerDrainStatusValue || (HostedRunnerDrainStatusValue = {}));
|
|
17
|
+
export var HostedRunnerRuntimeFlushStatusValue;
|
|
18
|
+
(function (HostedRunnerRuntimeFlushStatusValue) {
|
|
19
|
+
HostedRunnerRuntimeFlushStatusValue["Completed"] = "completed";
|
|
20
|
+
HostedRunnerRuntimeFlushStatusValue["Failed"] = "failed";
|
|
21
|
+
HostedRunnerRuntimeFlushStatusValue["Skipped"] = "skipped";
|
|
22
|
+
})(HostedRunnerRuntimeFlushStatusValue || (HostedRunnerRuntimeFlushStatusValue = {}));
|
|
23
|
+
export var HostedRunnerWorkspaceExportPathTypeValue;
|
|
24
|
+
(function (HostedRunnerWorkspaceExportPathTypeValue) {
|
|
25
|
+
HostedRunnerWorkspaceExportPathTypeValue["File"] = "file";
|
|
26
|
+
HostedRunnerWorkspaceExportPathTypeValue["Directory"] = "directory";
|
|
27
|
+
HostedRunnerWorkspaceExportPathTypeValue["Other"] = "other";
|
|
28
|
+
})(HostedRunnerWorkspaceExportPathTypeValue || (HostedRunnerWorkspaceExportPathTypeValue = {}));
|
|
29
|
+
export var HostedRunnerWorkspaceExportModeValue;
|
|
30
|
+
(function (HostedRunnerWorkspaceExportModeValue) {
|
|
31
|
+
HostedRunnerWorkspaceExportModeValue["LocalPathContract"] = "local_path_contract";
|
|
32
|
+
})(HostedRunnerWorkspaceExportModeValue || (HostedRunnerWorkspaceExportModeValue = {}));
|
|
33
|
+
export var HostedRunnerDrainReasonValue;
|
|
34
|
+
(function (HostedRunnerDrainReasonValue) {
|
|
35
|
+
HostedRunnerDrainReasonValue["KubernetesPreStop"] = "kubernetes_prestop";
|
|
36
|
+
HostedRunnerDrainReasonValue["ProcessShutdown"] = "process_shutdown";
|
|
37
|
+
})(HostedRunnerDrainReasonValue || (HostedRunnerDrainReasonValue = {}));
|
|
38
|
+
export var HostedRunnerDrainRequestedByValue;
|
|
39
|
+
(function (HostedRunnerDrainRequestedByValue) {
|
|
40
|
+
HostedRunnerDrainRequestedByValue["KubernetesPreStop"] = "kubernetes_prestop";
|
|
41
|
+
HostedRunnerDrainRequestedByValue["MaestroWebServer"] = "maestro_web_server";
|
|
42
|
+
})(HostedRunnerDrainRequestedByValue || (HostedRunnerDrainRequestedByValue = {}));
|
|
43
|
+
function getString(value, field) {
|
|
44
|
+
if (value === undefined || value === null) {
|
|
45
|
+
return undefined;
|
|
46
|
+
}
|
|
47
|
+
if (typeof value !== "string") {
|
|
48
|
+
throw new ApiError(400, `${field} must be a string`);
|
|
49
|
+
}
|
|
50
|
+
const trimmed = value.trim();
|
|
51
|
+
return trimmed || undefined;
|
|
52
|
+
}
|
|
53
|
+
function getStringArray(value, field) {
|
|
54
|
+
if (value === undefined || value === null) {
|
|
55
|
+
return undefined;
|
|
56
|
+
}
|
|
57
|
+
if (!Array.isArray(value)) {
|
|
58
|
+
throw new ApiError(400, `${field} must be an array of strings`);
|
|
59
|
+
}
|
|
60
|
+
const strings = value.map((entry, index) => {
|
|
61
|
+
if (typeof entry !== "string" || !entry.trim()) {
|
|
62
|
+
throw new ApiError(400, `${field}[${index}] must be a non-empty string`);
|
|
63
|
+
}
|
|
64
|
+
if (entry.includes("\0")) {
|
|
65
|
+
throw new ApiError(400, `${field}[${index}] contains a null byte`);
|
|
66
|
+
}
|
|
67
|
+
return entry.trim();
|
|
68
|
+
});
|
|
69
|
+
return strings.length ? strings : undefined;
|
|
70
|
+
}
|
|
71
|
+
export function parseHostedRunnerDrainInput(body) {
|
|
72
|
+
if (body === undefined || body === null) {
|
|
73
|
+
return {};
|
|
74
|
+
}
|
|
75
|
+
if (typeof body !== "object" || Array.isArray(body)) {
|
|
76
|
+
throw new ApiError(400, "Drain payload must be a JSON object");
|
|
77
|
+
}
|
|
78
|
+
const record = body;
|
|
79
|
+
return {
|
|
80
|
+
reason: getString(record.reason, "reason") ??
|
|
81
|
+
getString(record.stop_reason, "stop_reason"),
|
|
82
|
+
requestedBy: getString(record.requested_by, "requested_by") ??
|
|
83
|
+
getString(record.requestedBy, "requestedBy"),
|
|
84
|
+
exportPaths: getStringArray(record.export_paths, "export_paths") ??
|
|
85
|
+
getStringArray(record.exportPaths, "exportPaths"),
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
function isWithinPath(root, target) {
|
|
89
|
+
const rel = relative(root, target);
|
|
90
|
+
return rel === "" || (!rel.startsWith("..") && !isAbsolute(rel));
|
|
91
|
+
}
|
|
92
|
+
function safeManifestFileName(runnerSessionId, requestedAt) {
|
|
93
|
+
const safeSession = runnerSessionId.replace(/[^A-Za-z0-9_.-]/g, "_");
|
|
94
|
+
const safeTimestamp = requestedAt.replace(/[^A-Za-z0-9_.-]/g, "_");
|
|
95
|
+
return `${safeSession}-${safeTimestamp}.json`;
|
|
96
|
+
}
|
|
97
|
+
async function resolveWorkspaceRoot(hostedRunner) {
|
|
98
|
+
try {
|
|
99
|
+
const workspaceRoot = await realpath(hostedRunner.workspaceRoot);
|
|
100
|
+
const stats = await stat(workspaceRoot);
|
|
101
|
+
if (!stats.isDirectory()) {
|
|
102
|
+
throw new ApiError(503, "Hosted runner workspace root is not a directory");
|
|
103
|
+
}
|
|
104
|
+
return workspaceRoot;
|
|
105
|
+
}
|
|
106
|
+
catch (error) {
|
|
107
|
+
if (error instanceof ApiError) {
|
|
108
|
+
throw error;
|
|
109
|
+
}
|
|
110
|
+
throw new ApiError(503, `Hosted runner workspace root is unavailable: ${error instanceof Error ? error.message : String(error)}`);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
async function resolveWorkspaceExportPaths(workspaceRoot, exportPaths) {
|
|
114
|
+
const requested = exportPaths?.length ? exportPaths : ["."];
|
|
115
|
+
const paths = [];
|
|
116
|
+
for (const input of requested) {
|
|
117
|
+
const logicalPath = isAbsolute(input)
|
|
118
|
+
? resolve(input)
|
|
119
|
+
: resolve(workspaceRoot, input);
|
|
120
|
+
let realPath;
|
|
121
|
+
try {
|
|
122
|
+
realPath = await realpath(logicalPath);
|
|
123
|
+
}
|
|
124
|
+
catch (error) {
|
|
125
|
+
throw new ApiError(400, `Export path is unavailable: ${input} (${error instanceof Error ? error.message : String(error)})`);
|
|
126
|
+
}
|
|
127
|
+
if (!isWithinPath(workspaceRoot, realPath)) {
|
|
128
|
+
throw new ApiError(400, `Export path escapes hosted runner workspace root: ${input}`);
|
|
129
|
+
}
|
|
130
|
+
const pathStat = await stat(realPath);
|
|
131
|
+
paths.push({
|
|
132
|
+
input,
|
|
133
|
+
path: realPath,
|
|
134
|
+
relative_path: relative(workspaceRoot, realPath) || ".",
|
|
135
|
+
type: pathStat.isDirectory()
|
|
136
|
+
? HostedRunnerWorkspaceExportPathTypeValue.Directory
|
|
137
|
+
: pathStat.isFile()
|
|
138
|
+
? HostedRunnerWorkspaceExportPathTypeValue.File
|
|
139
|
+
: HostedRunnerWorkspaceExportPathTypeValue.Other,
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
return paths;
|
|
143
|
+
}
|
|
144
|
+
async function gitOutput(workspaceRoot, args) {
|
|
145
|
+
try {
|
|
146
|
+
const { stdout } = await execFileAsync("git", ["-C", workspaceRoot, ...args], {
|
|
147
|
+
encoding: "utf8",
|
|
148
|
+
timeout: 1000,
|
|
149
|
+
});
|
|
150
|
+
const output = stdout.trim();
|
|
151
|
+
return output || undefined;
|
|
152
|
+
}
|
|
153
|
+
catch {
|
|
154
|
+
return undefined;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
async function collectGitState(workspaceRoot) {
|
|
158
|
+
const [commit, branch, status] = await Promise.all([
|
|
159
|
+
gitOutput(workspaceRoot, ["rev-parse", "HEAD"]),
|
|
160
|
+
gitOutput(workspaceRoot, ["rev-parse", "--abbrev-ref", "HEAD"]),
|
|
161
|
+
gitOutput(workspaceRoot, ["status", "--porcelain"]),
|
|
162
|
+
]);
|
|
163
|
+
if (!commit && !branch && status === undefined) {
|
|
164
|
+
return undefined;
|
|
165
|
+
}
|
|
166
|
+
return {
|
|
167
|
+
...(commit ? { commit } : {}),
|
|
168
|
+
...(branch && branch !== "HEAD" ? { branch } : {}),
|
|
169
|
+
dirty: Boolean(status),
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
function buildHostedRunnerSnapshot(sessionId, workspaceRoot, runtime) {
|
|
173
|
+
const state = createHeadlessRuntimeState();
|
|
174
|
+
state.protocol_version =
|
|
175
|
+
runtime.protocol_version ?? HEADLESS_PROTOCOL_VERSION;
|
|
176
|
+
state.session_id = sessionId;
|
|
177
|
+
state.cwd = workspaceRoot;
|
|
178
|
+
state.provider = "typescript";
|
|
179
|
+
state.model = "typescript-hosted-runner";
|
|
180
|
+
state.is_ready =
|
|
181
|
+
runtime.flush_status === HostedRunnerRuntimeFlushStatusValue.Completed;
|
|
182
|
+
state.last_status =
|
|
183
|
+
runtime.flush_status === HostedRunnerRuntimeFlushStatusValue.Completed
|
|
184
|
+
? "Drained"
|
|
185
|
+
: runtime.flush_status === HostedRunnerRuntimeFlushStatusValue.Failed
|
|
186
|
+
? "Drain interrupted before runtime flush completed"
|
|
187
|
+
: "Drain skipped: no runtime activity was available";
|
|
188
|
+
if (runtime.error) {
|
|
189
|
+
state.last_error = runtime.error;
|
|
190
|
+
state.last_error_type = "protocol";
|
|
191
|
+
}
|
|
192
|
+
return {
|
|
193
|
+
protocolVersion: runtime.protocol_version ?? HEADLESS_PROTOCOL_VERSION,
|
|
194
|
+
session_id: sessionId,
|
|
195
|
+
cursor: runtime.cursor ?? 0,
|
|
196
|
+
last_init: null,
|
|
197
|
+
state,
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
function buildHostedRunnerRetentionPolicy() {
|
|
201
|
+
return {
|
|
202
|
+
policy_version: HOSTED_RUNNER_RETENTION_POLICY_VERSION,
|
|
203
|
+
managed_by: "platform",
|
|
204
|
+
visibility: {
|
|
205
|
+
control_plane_metadata: "operator",
|
|
206
|
+
workspace_export: "tenant",
|
|
207
|
+
runtime_snapshot: "internal",
|
|
208
|
+
runtime_logs: "operator",
|
|
209
|
+
},
|
|
210
|
+
redaction: {
|
|
211
|
+
required_before_external_persistence: [
|
|
212
|
+
"runtime_snapshot",
|
|
213
|
+
"runtime_logs",
|
|
214
|
+
],
|
|
215
|
+
forbidden_plaintext: [
|
|
216
|
+
"provider_credentials",
|
|
217
|
+
"tool_secrets",
|
|
218
|
+
"attach_tokens",
|
|
219
|
+
"artifact_access_tokens",
|
|
220
|
+
"raw_environment",
|
|
221
|
+
],
|
|
222
|
+
},
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
export async function drainHostedRunner(input, options) {
|
|
226
|
+
const hostedRunner = options.hostedRunner;
|
|
227
|
+
if (!hostedRunner?.enabled || !hostedRunner.runnerSessionId) {
|
|
228
|
+
return null;
|
|
229
|
+
}
|
|
230
|
+
hostedRunner.draining = true;
|
|
231
|
+
const requestedAt = (options.now?.() ?? new Date()).toISOString();
|
|
232
|
+
const workspaceRoot = await resolveWorkspaceRoot(hostedRunner);
|
|
233
|
+
const snapshotRoot = resolve(workspaceRoot, hostedRunner.snapshotRoot ?? ".maestro/runner-snapshots");
|
|
234
|
+
const exportPaths = await resolveWorkspaceExportPaths(workspaceRoot, input.exportPaths);
|
|
235
|
+
const activeSessionId = hostedRunner.activeMaestroSessionId ??
|
|
236
|
+
hostedRunner.configuredMaestroSessionId;
|
|
237
|
+
const maestroSessionId = activeSessionId ?? hostedRunner.runnerSessionId;
|
|
238
|
+
let status = HostedRunnerDrainStatusValue.Drained;
|
|
239
|
+
let runtime = {
|
|
240
|
+
flush_status: HostedRunnerRuntimeFlushStatusValue.Skipped,
|
|
241
|
+
session_id: maestroSessionId,
|
|
242
|
+
};
|
|
243
|
+
let runtimeSnapshot;
|
|
244
|
+
if (activeSessionId && options.drainRuntime) {
|
|
245
|
+
try {
|
|
246
|
+
const runtimeResult = await options.drainRuntime(activeSessionId);
|
|
247
|
+
const runtimeProtocolVersion = runtimeResult?.protocolVersion ??
|
|
248
|
+
runtimeResult?.snapshot?.protocolVersion;
|
|
249
|
+
const runtimeCursor = runtimeResult?.cursor ?? runtimeResult?.snapshot?.cursor;
|
|
250
|
+
runtime = runtimeResult
|
|
251
|
+
? {
|
|
252
|
+
flush_status: HostedRunnerRuntimeFlushStatusValue.Completed,
|
|
253
|
+
session_id: runtimeResult.sessionId,
|
|
254
|
+
...(runtimeResult.sessionFile
|
|
255
|
+
? { session_file: runtimeResult.sessionFile }
|
|
256
|
+
: {}),
|
|
257
|
+
...(runtimeProtocolVersion
|
|
258
|
+
? { protocol_version: runtimeProtocolVersion }
|
|
259
|
+
: {}),
|
|
260
|
+
...(runtimeCursor !== undefined ? { cursor: runtimeCursor } : {}),
|
|
261
|
+
}
|
|
262
|
+
: {
|
|
263
|
+
flush_status: HostedRunnerRuntimeFlushStatusValue.Skipped,
|
|
264
|
+
session_id: activeSessionId,
|
|
265
|
+
};
|
|
266
|
+
runtimeSnapshot = runtimeResult?.snapshot;
|
|
267
|
+
}
|
|
268
|
+
catch (error) {
|
|
269
|
+
status = HostedRunnerDrainStatusValue.Interrupted;
|
|
270
|
+
runtime = {
|
|
271
|
+
flush_status: HostedRunnerRuntimeFlushStatusValue.Failed,
|
|
272
|
+
session_id: activeSessionId,
|
|
273
|
+
error: error instanceof Error ? error.message : String(error),
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
await mkdir(snapshotRoot, { recursive: true });
|
|
278
|
+
const snapshotPath = join(snapshotRoot, safeManifestFileName(hostedRunner.runnerSessionId, requestedAt));
|
|
279
|
+
const git = await collectGitState(workspaceRoot);
|
|
280
|
+
const snapshot = runtimeSnapshot ??
|
|
281
|
+
buildHostedRunnerSnapshot(maestroSessionId, workspaceRoot, runtime);
|
|
282
|
+
const manifest = {
|
|
283
|
+
protocol_version: HOSTED_RUNNER_SNAPSHOT_MANIFEST_VERSION,
|
|
284
|
+
runner_session_id: hostedRunner.runnerSessionId,
|
|
285
|
+
...(hostedRunner.workspaceId
|
|
286
|
+
? { workspace_id: hostedRunner.workspaceId }
|
|
287
|
+
: {}),
|
|
288
|
+
...(hostedRunner.agentRunId
|
|
289
|
+
? { agent_run_id: hostedRunner.agentRunId }
|
|
290
|
+
: {}),
|
|
291
|
+
maestro_session_id: maestroSessionId,
|
|
292
|
+
...(input.reason ? { reason: input.reason } : {}),
|
|
293
|
+
...(input.requestedBy ? { requested_by: input.requestedBy } : {}),
|
|
294
|
+
created_at: requestedAt,
|
|
295
|
+
workspace_root: workspaceRoot,
|
|
296
|
+
runtime,
|
|
297
|
+
workspace_export: {
|
|
298
|
+
mode: HostedRunnerWorkspaceExportModeValue.LocalPathContract,
|
|
299
|
+
paths: exportPaths,
|
|
300
|
+
},
|
|
301
|
+
snapshot,
|
|
302
|
+
retention_policy: buildHostedRunnerRetentionPolicy(),
|
|
303
|
+
...(git ? { git } : {}),
|
|
304
|
+
};
|
|
305
|
+
await writeFile(snapshotPath, `${JSON.stringify(manifest, null, 2)}\n`, "utf8");
|
|
306
|
+
hostedRunner.lastDrain = {
|
|
307
|
+
status,
|
|
308
|
+
manifestPath: snapshotPath,
|
|
309
|
+
drainedAt: requestedAt,
|
|
310
|
+
...(input.reason ? { reason: input.reason } : {}),
|
|
311
|
+
...(input.requestedBy ? { requestedBy: input.requestedBy } : {}),
|
|
312
|
+
};
|
|
313
|
+
return {
|
|
314
|
+
status,
|
|
315
|
+
runner_session_id: hostedRunner.runnerSessionId,
|
|
316
|
+
...(input.reason ? { reason: input.reason } : {}),
|
|
317
|
+
...(input.requestedBy ? { requested_by: input.requestedBy } : {}),
|
|
318
|
+
manifest_path: snapshotPath,
|
|
319
|
+
manifest,
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
async function drainActiveRuntime(context, sessionId) {
|
|
323
|
+
const runtime = context.headlessRuntimeService.getRuntimeBySessionId(sessionId);
|
|
324
|
+
if (!runtime) {
|
|
325
|
+
return null;
|
|
326
|
+
}
|
|
327
|
+
const snapshot = runtime.getSnapshot();
|
|
328
|
+
const sessionFile = runtime.getSessionFile();
|
|
329
|
+
await runtime.dispose();
|
|
330
|
+
return {
|
|
331
|
+
sessionId: snapshot.session_id,
|
|
332
|
+
sessionFile,
|
|
333
|
+
protocolVersion: snapshot.protocolVersion,
|
|
334
|
+
cursor: snapshot.cursor,
|
|
335
|
+
snapshot,
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
export async function drainHostedRunnerForShutdown(context, options = {}) {
|
|
339
|
+
return drainHostedRunner({
|
|
340
|
+
reason: options.reason ?? HostedRunnerDrainReasonValue.ProcessShutdown,
|
|
341
|
+
requestedBy: options.requestedBy ??
|
|
342
|
+
HostedRunnerDrainRequestedByValue.MaestroWebServer,
|
|
343
|
+
}, {
|
|
344
|
+
hostedRunner: context.hostedRunner,
|
|
345
|
+
drainRuntime: (sessionId) => drainActiveRuntime(context, sessionId),
|
|
346
|
+
now: options.now,
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
export async function handleHostedRunnerDrain(req, res, context) {
|
|
350
|
+
res.setHeader("Cache-Control", "no-store");
|
|
351
|
+
const body = await readJsonBody(req, 64_000);
|
|
352
|
+
const input = parseHostedRunnerDrainInput(body);
|
|
353
|
+
const result = await drainHostedRunner(input, {
|
|
354
|
+
hostedRunner: context.hostedRunner,
|
|
355
|
+
drainRuntime: (sessionId) => drainActiveRuntime(context, sessionId),
|
|
356
|
+
});
|
|
357
|
+
if (!result) {
|
|
358
|
+
sendJson(res, 404, {
|
|
359
|
+
error: "hosted runner drain unavailable",
|
|
360
|
+
}, context.corsHeaders, req);
|
|
361
|
+
return;
|
|
362
|
+
}
|
|
363
|
+
sendJson(res, result.status === HostedRunnerDrainStatusValue.Interrupted ? 503 : 200, {
|
|
364
|
+
protocol_version: HOSTED_RUNNER_DRAIN_PROTOCOL_VERSION,
|
|
365
|
+
status: result.status,
|
|
366
|
+
runner_session_id: result.runner_session_id,
|
|
367
|
+
requested_by: result.requested_by,
|
|
368
|
+
reason: result.reason,
|
|
369
|
+
manifest_path: result.manifest_path,
|
|
370
|
+
manifest: result.manifest,
|
|
371
|
+
}, context.corsHeaders, req);
|
|
372
|
+
}
|
|
373
|
+
//# sourceMappingURL=hosted-runner-drain.js.map
|