@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
|
@@ -0,0 +1,515 @@
|
|
|
1
|
+
import { gatherMaestroSessionFactsContext, } from "./cerebro-facts-client.js";
|
|
2
|
+
import { postPlatformConnect, resolvePlatformServiceConfig, trimString, } from "./client.js";
|
|
3
|
+
import { PLATFORM_CONNECT_METHODS, PLATFORM_CONNECT_SERVICES, platformConnectMethodPath, platformConnectServicePath, } from "./core-services.js";
|
|
4
|
+
const DEFAULT_TIMEOUT_MS = 2_000;
|
|
5
|
+
const DEFAULT_MAX_ATTEMPTS = 2;
|
|
6
|
+
const HANDLE_TRIGGER_PATH = platformConnectMethodPath(PLATFORM_CONNECT_METHODS.agentRuntime.handleTrigger);
|
|
7
|
+
const CLAIM_NEXT_RUN_PATH = platformConnectMethodPath(PLATFORM_CONNECT_METHODS.agentRuntime.claimNextRun);
|
|
8
|
+
const RECORD_RUN_STEP_PATH = platformConnectMethodPath(PLATFORM_CONNECT_METHODS.agentRuntime.recordRunStep);
|
|
9
|
+
const WAIT_RUN_PATH = platformConnectMethodPath(PLATFORM_CONNECT_METHODS.agentRuntime.waitRun);
|
|
10
|
+
const RESUME_RUN_PATH = platformConnectMethodPath(PLATFORM_CONNECT_METHODS.agentRuntime.resumeRun);
|
|
11
|
+
const COMPLETE_RUN_PATH = platformConnectMethodPath(PLATFORM_CONNECT_METHODS.agentRuntime.completeRun);
|
|
12
|
+
const FAIL_RUN_PATH = platformConnectMethodPath(PLATFORM_CONNECT_METHODS.agentRuntime.failRun);
|
|
13
|
+
const GET_RUN_PATH = platformConnectMethodPath(PLATFORM_CONNECT_METHODS.agentRuntime.getRun);
|
|
14
|
+
const LIST_RUN_EVENTS_PATH = platformConnectMethodPath(PLATFORM_CONNECT_METHODS.agentRuntime.listRunEvents);
|
|
15
|
+
function isAbortError(error) {
|
|
16
|
+
return error instanceof Error && error.name === "AbortError";
|
|
17
|
+
}
|
|
18
|
+
const AGENT_RUNTIME_BASE_URL_ENV_VARS = [
|
|
19
|
+
"MAESTRO_AGENT_RUNTIME_SERVICE_URL",
|
|
20
|
+
"AGENT_RUNTIME_SERVICE_URL",
|
|
21
|
+
];
|
|
22
|
+
const AGENT_RUNTIME_TOKEN_ENV_VARS = [
|
|
23
|
+
"MAESTRO_AGENT_RUNTIME_SERVICE_TOKEN",
|
|
24
|
+
"AGENT_RUNTIME_SERVICE_TOKEN",
|
|
25
|
+
"MAESTRO_EVALOPS_ACCESS_TOKEN",
|
|
26
|
+
"EVALOPS_TOKEN",
|
|
27
|
+
];
|
|
28
|
+
const AGENT_RUNTIME_ORGANIZATION_ENV_VARS = [
|
|
29
|
+
"MAESTRO_AGENT_RUNTIME_ORG_ID",
|
|
30
|
+
"AGENT_RUNTIME_ORGANIZATION_ID",
|
|
31
|
+
"MAESTRO_EVALOPS_ORG_ID",
|
|
32
|
+
"EVALOPS_ORGANIZATION_ID",
|
|
33
|
+
"MAESTRO_ENTERPRISE_ORG_ID",
|
|
34
|
+
];
|
|
35
|
+
const AGENT_RUNTIME_WORKSPACE_ENV_VARS = [
|
|
36
|
+
"MAESTRO_AGENT_RUNTIME_WORKSPACE_ID",
|
|
37
|
+
"AGENT_RUNTIME_WORKSPACE_ID",
|
|
38
|
+
"MAESTRO_WORKSPACE_ID",
|
|
39
|
+
"EVALOPS_WORKSPACE_ID",
|
|
40
|
+
];
|
|
41
|
+
const AGENT_RUNTIME_TIMEOUT_ENV_VARS = [
|
|
42
|
+
"MAESTRO_AGENT_RUNTIME_TIMEOUT_MS",
|
|
43
|
+
"AGENT_RUNTIME_SERVICE_TIMEOUT_MS",
|
|
44
|
+
];
|
|
45
|
+
const AGENT_RUNTIME_MAX_ATTEMPTS_ENV_VARS = [
|
|
46
|
+
"MAESTRO_AGENT_RUNTIME_MAX_ATTEMPTS",
|
|
47
|
+
"AGENT_RUNTIME_SERVICE_MAX_ATTEMPTS",
|
|
48
|
+
];
|
|
49
|
+
const AGENT_RUNTIME_BASE_URL_SUFFIXES = [
|
|
50
|
+
HANDLE_TRIGGER_PATH,
|
|
51
|
+
platformConnectServicePath(PLATFORM_CONNECT_SERVICES.agentRuntime),
|
|
52
|
+
];
|
|
53
|
+
export var PlatformSurfaceValue;
|
|
54
|
+
(function (PlatformSurfaceValue) {
|
|
55
|
+
PlatformSurfaceValue["Maestro"] = "SURFACE_MAESTRO";
|
|
56
|
+
})(PlatformSurfaceValue || (PlatformSurfaceValue = {}));
|
|
57
|
+
export var PlatformRuntimeChannelKindValue;
|
|
58
|
+
(function (PlatformRuntimeChannelKindValue) {
|
|
59
|
+
PlatformRuntimeChannelKindValue["Api"] = "RUNTIME_CHANNEL_KIND_API";
|
|
60
|
+
})(PlatformRuntimeChannelKindValue || (PlatformRuntimeChannelKindValue = {}));
|
|
61
|
+
export var PlatformRuntimeTriggerKindValue;
|
|
62
|
+
(function (PlatformRuntimeTriggerKindValue) {
|
|
63
|
+
PlatformRuntimeTriggerKindValue["Api"] = "RUNTIME_TRIGGER_KIND_API";
|
|
64
|
+
})(PlatformRuntimeTriggerKindValue || (PlatformRuntimeTriggerKindValue = {}));
|
|
65
|
+
export var PlatformRuntimeEventTypeValue;
|
|
66
|
+
(function (PlatformRuntimeEventTypeValue) {
|
|
67
|
+
PlatformRuntimeEventTypeValue["TriggerAccepted"] = "RUNTIME_EVENT_TYPE_TRIGGER_ACCEPTED";
|
|
68
|
+
PlatformRuntimeEventTypeValue["RunClaimed"] = "RUNTIME_EVENT_TYPE_RUN_CLAIMED";
|
|
69
|
+
PlatformRuntimeEventTypeValue["StepRecorded"] = "RUNTIME_EVENT_TYPE_STEP_RECORDED";
|
|
70
|
+
PlatformRuntimeEventTypeValue["RunWaiting"] = "RUNTIME_EVENT_TYPE_RUN_WAITING";
|
|
71
|
+
PlatformRuntimeEventTypeValue["RunResumed"] = "RUNTIME_EVENT_TYPE_RUN_RESUMED";
|
|
72
|
+
PlatformRuntimeEventTypeValue["RunSucceeded"] = "RUNTIME_EVENT_TYPE_RUN_SUCCEEDED";
|
|
73
|
+
PlatformRuntimeEventTypeValue["RunFailed"] = "RUNTIME_EVENT_TYPE_RUN_FAILED";
|
|
74
|
+
})(PlatformRuntimeEventTypeValue || (PlatformRuntimeEventTypeValue = {}));
|
|
75
|
+
export var PlatformAgentRunStateValue;
|
|
76
|
+
(function (PlatformAgentRunStateValue) {
|
|
77
|
+
PlatformAgentRunStateValue["Accepted"] = "AGENT_RUN_STATE_ACCEPTED";
|
|
78
|
+
PlatformAgentRunStateValue["Queued"] = "AGENT_RUN_STATE_QUEUED";
|
|
79
|
+
PlatformAgentRunStateValue["Running"] = "AGENT_RUN_STATE_RUNNING";
|
|
80
|
+
PlatformAgentRunStateValue["Waiting"] = "AGENT_RUN_STATE_WAITING";
|
|
81
|
+
PlatformAgentRunStateValue["Succeeded"] = "AGENT_RUN_STATE_SUCCEEDED";
|
|
82
|
+
PlatformAgentRunStateValue["Failed"] = "AGENT_RUN_STATE_FAILED";
|
|
83
|
+
PlatformAgentRunStateValue["Cancelled"] = "AGENT_RUN_STATE_CANCELLED";
|
|
84
|
+
})(PlatformAgentRunStateValue || (PlatformAgentRunStateValue = {}));
|
|
85
|
+
export var PlatformAgentRunStepKindValue;
|
|
86
|
+
(function (PlatformAgentRunStepKindValue) {
|
|
87
|
+
PlatformAgentRunStepKindValue["ModelCall"] = "AGENT_RUN_STEP_KIND_MODEL_CALL";
|
|
88
|
+
PlatformAgentRunStepKindValue["ToolCallIntent"] = "AGENT_RUN_STEP_KIND_TOOL_CALL_INTENT";
|
|
89
|
+
PlatformAgentRunStepKindValue["ToolResult"] = "AGENT_RUN_STEP_KIND_TOOL_RESULT";
|
|
90
|
+
PlatformAgentRunStepKindValue["ApprovalWait"] = "AGENT_RUN_STEP_KIND_APPROVAL_WAIT";
|
|
91
|
+
PlatformAgentRunStepKindValue["Error"] = "AGENT_RUN_STEP_KIND_ERROR";
|
|
92
|
+
PlatformAgentRunStepKindValue["System"] = "AGENT_RUN_STEP_KIND_SYSTEM";
|
|
93
|
+
})(PlatformAgentRunStepKindValue || (PlatformAgentRunStepKindValue = {}));
|
|
94
|
+
export var PlatformAgentRunStepStateValue;
|
|
95
|
+
(function (PlatformAgentRunStepStateValue) {
|
|
96
|
+
PlatformAgentRunStepStateValue["Pending"] = "AGENT_RUN_STEP_STATE_PENDING";
|
|
97
|
+
PlatformAgentRunStepStateValue["Running"] = "AGENT_RUN_STEP_STATE_RUNNING";
|
|
98
|
+
PlatformAgentRunStepStateValue["Waiting"] = "AGENT_RUN_STEP_STATE_WAITING";
|
|
99
|
+
PlatformAgentRunStepStateValue["Succeeded"] = "AGENT_RUN_STEP_STATE_SUCCEEDED";
|
|
100
|
+
PlatformAgentRunStepStateValue["Failed"] = "AGENT_RUN_STEP_STATE_FAILED";
|
|
101
|
+
PlatformAgentRunStepStateValue["Cancelled"] = "AGENT_RUN_STEP_STATE_CANCELLED";
|
|
102
|
+
PlatformAgentRunStepStateValue["Skipped"] = "AGENT_RUN_STEP_STATE_SKIPPED";
|
|
103
|
+
})(PlatformAgentRunStepStateValue || (PlatformAgentRunStepStateValue = {}));
|
|
104
|
+
export var PlatformAgentRunWaitTypeValue;
|
|
105
|
+
(function (PlatformAgentRunWaitTypeValue) {
|
|
106
|
+
PlatformAgentRunWaitTypeValue["Approval"] = "AGENT_RUN_WAIT_TYPE_APPROVAL";
|
|
107
|
+
PlatformAgentRunWaitTypeValue["Input"] = "AGENT_RUN_WAIT_TYPE_INPUT";
|
|
108
|
+
PlatformAgentRunWaitTypeValue["Event"] = "AGENT_RUN_WAIT_TYPE_EVENT";
|
|
109
|
+
PlatformAgentRunWaitTypeValue["Timer"] = "AGENT_RUN_WAIT_TYPE_TIMER";
|
|
110
|
+
})(PlatformAgentRunWaitTypeValue || (PlatformAgentRunWaitTypeValue = {}));
|
|
111
|
+
export var MaestroAgentRuntimeSourceEventType;
|
|
112
|
+
(function (MaestroAgentRuntimeSourceEventType) {
|
|
113
|
+
MaestroAgentRuntimeSourceEventType["SessionStarted"] = "maestro.session_started";
|
|
114
|
+
})(MaestroAgentRuntimeSourceEventType || (MaestroAgentRuntimeSourceEventType = {}));
|
|
115
|
+
function pickString(record, ...names) {
|
|
116
|
+
for (const name of names) {
|
|
117
|
+
const value = record?.[name];
|
|
118
|
+
if (typeof value === "string" && value.trim().length > 0) {
|
|
119
|
+
return value;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return undefined;
|
|
123
|
+
}
|
|
124
|
+
function pickRecord(record, ...names) {
|
|
125
|
+
for (const name of names) {
|
|
126
|
+
const value = record?.[name];
|
|
127
|
+
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
128
|
+
return value;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return undefined;
|
|
132
|
+
}
|
|
133
|
+
function pickArray(record, ...names) {
|
|
134
|
+
for (const name of names) {
|
|
135
|
+
const value = record?.[name];
|
|
136
|
+
if (Array.isArray(value)) {
|
|
137
|
+
return value;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return undefined;
|
|
141
|
+
}
|
|
142
|
+
function pickBoolean(record, ...names) {
|
|
143
|
+
for (const name of names) {
|
|
144
|
+
const value = record?.[name];
|
|
145
|
+
if (typeof value === "boolean") {
|
|
146
|
+
return value;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
return false;
|
|
150
|
+
}
|
|
151
|
+
function pickNumber(record, ...names) {
|
|
152
|
+
for (const name of names) {
|
|
153
|
+
const value = record?.[name];
|
|
154
|
+
if (isFiniteNumber(value)) {
|
|
155
|
+
return value;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
return undefined;
|
|
159
|
+
}
|
|
160
|
+
function isFiniteNumber(value) {
|
|
161
|
+
return typeof value === "number" && Number.isFinite(value);
|
|
162
|
+
}
|
|
163
|
+
function normalizeLinkage(value) {
|
|
164
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
165
|
+
return undefined;
|
|
166
|
+
}
|
|
167
|
+
const linkage = value;
|
|
168
|
+
return {
|
|
169
|
+
runId: pickString(linkage, "runId", "run_id"),
|
|
170
|
+
workspaceId: pickString(linkage, "workspaceId", "workspace_id"),
|
|
171
|
+
agentId: pickString(linkage, "agentId", "agent_id"),
|
|
172
|
+
objectiveId: pickString(linkage, "objectiveId", "objective_id"),
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
function compactStringRecord(record) {
|
|
176
|
+
const compacted = Object.fromEntries(Object.entries(record).filter((entry) => typeof entry[1] === "string" && entry[1].length > 0));
|
|
177
|
+
return Object.keys(compacted).length > 0 ? compacted : undefined;
|
|
178
|
+
}
|
|
179
|
+
function normalizeLease(value) {
|
|
180
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
181
|
+
return undefined;
|
|
182
|
+
}
|
|
183
|
+
const record = value;
|
|
184
|
+
return {
|
|
185
|
+
id: pickString(record, "id"),
|
|
186
|
+
token: pickString(record, "token"),
|
|
187
|
+
workerId: pickString(record, "workerId", "worker_id"),
|
|
188
|
+
workerQueue: pickString(record, "workerQueue", "worker_queue"),
|
|
189
|
+
expiresAt: pickString(record, "expiresAt", "expires_at"),
|
|
190
|
+
heartbeatAt: pickString(record, "heartbeatAt", "heartbeat_at"),
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
function normalizeStep(value) {
|
|
194
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
195
|
+
return undefined;
|
|
196
|
+
}
|
|
197
|
+
const record = value;
|
|
198
|
+
return {
|
|
199
|
+
id: pickString(record, "id"),
|
|
200
|
+
name: pickString(record, "name"),
|
|
201
|
+
stepKind: pickString(record, "stepKind", "step_kind", "kind"),
|
|
202
|
+
state: pickString(record, "state"),
|
|
203
|
+
attempt: pickNumber(record, "attempt"),
|
|
204
|
+
input: pickRecord(record, "input"),
|
|
205
|
+
output: pickRecord(record, "output"),
|
|
206
|
+
errorMessage: pickString(record, "errorMessage", "error_message"),
|
|
207
|
+
checkpointId: pickString(record, "checkpointId", "checkpoint_id"),
|
|
208
|
+
startedAt: pickString(record, "startedAt", "started_at"),
|
|
209
|
+
endedAt: pickString(record, "endedAt", "ended_at"),
|
|
210
|
+
linkage: normalizeLinkage(record.linkage),
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
function normalizeCheckpoint(value) {
|
|
214
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
215
|
+
return undefined;
|
|
216
|
+
}
|
|
217
|
+
const record = value;
|
|
218
|
+
return {
|
|
219
|
+
id: pickString(record, "id"),
|
|
220
|
+
stepId: pickString(record, "stepId", "step_id"),
|
|
221
|
+
sequence: pickNumber(record, "sequence"),
|
|
222
|
+
resumeToken: pickString(record, "resumeToken", "resume_token"),
|
|
223
|
+
payload: pickRecord(record, "payload"),
|
|
224
|
+
createdAt: pickString(record, "createdAt", "created_at"),
|
|
225
|
+
linkage: normalizeLinkage(record.linkage),
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
function normalizeWait(value) {
|
|
229
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
230
|
+
return undefined;
|
|
231
|
+
}
|
|
232
|
+
const record = value;
|
|
233
|
+
return {
|
|
234
|
+
id: pickString(record, "id"),
|
|
235
|
+
stepId: pickString(record, "stepId", "step_id"),
|
|
236
|
+
type: pickString(record, "type"),
|
|
237
|
+
externalRef: pickString(record, "externalRef", "external_ref"),
|
|
238
|
+
reason: pickString(record, "reason"),
|
|
239
|
+
payload: pickRecord(record, "payload"),
|
|
240
|
+
createdAt: pickString(record, "createdAt", "created_at"),
|
|
241
|
+
resumeAfter: pickString(record, "resumeAfter", "resume_after"),
|
|
242
|
+
expiresAt: pickString(record, "expiresAt", "expires_at"),
|
|
243
|
+
resolvedAt: pickString(record, "resolvedAt", "resolved_at"),
|
|
244
|
+
resolvedByEventId: pickString(record, "resolvedByEventId", "resolved_by_event_id"),
|
|
245
|
+
linkage: normalizeLinkage(record.linkage),
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
function normalizeRun(value) {
|
|
249
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
250
|
+
return undefined;
|
|
251
|
+
}
|
|
252
|
+
const record = value;
|
|
253
|
+
const id = pickString(record, "id");
|
|
254
|
+
if (!id) {
|
|
255
|
+
return undefined;
|
|
256
|
+
}
|
|
257
|
+
return {
|
|
258
|
+
id,
|
|
259
|
+
state: pickString(record, "state"),
|
|
260
|
+
lease: normalizeLease(record.lease),
|
|
261
|
+
steps: pickArray(record, "steps")
|
|
262
|
+
?.map(normalizeStep)
|
|
263
|
+
.filter((step) => Boolean(step)),
|
|
264
|
+
waits: pickArray(record, "waits")
|
|
265
|
+
?.map(normalizeWait)
|
|
266
|
+
.filter((wait) => Boolean(wait)),
|
|
267
|
+
latestCheckpoint: normalizeCheckpoint(record.latestCheckpoint ?? record.latest_checkpoint),
|
|
268
|
+
linkage: normalizeLinkage(record.linkage),
|
|
269
|
+
createdAt: pickString(record, "createdAt", "created_at"),
|
|
270
|
+
updatedAt: pickString(record, "updatedAt", "updated_at"),
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
function normalizeEvent(value) {
|
|
274
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
275
|
+
return undefined;
|
|
276
|
+
}
|
|
277
|
+
const record = value;
|
|
278
|
+
return {
|
|
279
|
+
id: pickString(record, "id"),
|
|
280
|
+
runId: pickString(record, "runId", "run_id"),
|
|
281
|
+
sequence: pickNumber(record, "sequence"),
|
|
282
|
+
type: pickString(record, "type"),
|
|
283
|
+
message: pickString(record, "message"),
|
|
284
|
+
stepId: pickString(record, "stepId", "step_id"),
|
|
285
|
+
waitId: pickString(record, "waitId", "wait_id"),
|
|
286
|
+
checkpointId: pickString(record, "checkpointId", "checkpoint_id"),
|
|
287
|
+
attributes: pickRecord(record, "attributes"),
|
|
288
|
+
occurredAt: pickString(record, "occurredAt", "occurred_at"),
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
function normalizeHandleTriggerResponse(payload) {
|
|
292
|
+
return {
|
|
293
|
+
run: normalizeRequiredRun(payload),
|
|
294
|
+
events: normalizeEvents(payload),
|
|
295
|
+
idempotentReplay: pickBoolean(payload, "idempotentReplay", "idempotent_replay"),
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
function normalizeRequiredRun(payload) {
|
|
299
|
+
const run = normalizeRun(payload.run);
|
|
300
|
+
if (!run) {
|
|
301
|
+
throw new Error("agent runtime service returned no run");
|
|
302
|
+
}
|
|
303
|
+
return run;
|
|
304
|
+
}
|
|
305
|
+
function normalizeEvents(payload) {
|
|
306
|
+
return (pickArray(payload, "events")
|
|
307
|
+
?.map(normalizeEvent)
|
|
308
|
+
.filter((event) => Boolean(event)) ?? []);
|
|
309
|
+
}
|
|
310
|
+
async function postAgentRuntimeOperation(path, body, options) {
|
|
311
|
+
const config = options?.config ?? (await resolveAgentRuntimeServiceConfig());
|
|
312
|
+
if (!config) {
|
|
313
|
+
throw new Error("agent runtime service is not configured");
|
|
314
|
+
}
|
|
315
|
+
const response = await postPlatformConnect(config, path, body, {
|
|
316
|
+
serviceName: "agent runtime service",
|
|
317
|
+
failureMode: "optional",
|
|
318
|
+
timeoutMs: config.timeoutMs,
|
|
319
|
+
maxAttempts: config.maxAttempts,
|
|
320
|
+
signal: options?.signal,
|
|
321
|
+
});
|
|
322
|
+
if (!response.ok) {
|
|
323
|
+
const text = await response.text();
|
|
324
|
+
throw new Error(`agent runtime service returned ${response.status}: ${text || response.statusText}`);
|
|
325
|
+
}
|
|
326
|
+
return (await response.json());
|
|
327
|
+
}
|
|
328
|
+
export async function resolveAgentRuntimeServiceConfig() {
|
|
329
|
+
return await resolvePlatformServiceConfig({
|
|
330
|
+
baseUrlEnvVars: AGENT_RUNTIME_BASE_URL_ENV_VARS,
|
|
331
|
+
tokenEnvVars: AGENT_RUNTIME_TOKEN_ENV_VARS,
|
|
332
|
+
organizationEnvVars: AGENT_RUNTIME_ORGANIZATION_ENV_VARS,
|
|
333
|
+
workspaceEnvVars: AGENT_RUNTIME_WORKSPACE_ENV_VARS,
|
|
334
|
+
timeoutEnvVars: AGENT_RUNTIME_TIMEOUT_ENV_VARS,
|
|
335
|
+
maxAttemptsEnvVars: AGENT_RUNTIME_MAX_ATTEMPTS_ENV_VARS,
|
|
336
|
+
baseUrlSuffixes: AGENT_RUNTIME_BASE_URL_SUFFIXES,
|
|
337
|
+
defaultTimeoutMs: DEFAULT_TIMEOUT_MS,
|
|
338
|
+
defaultMaxAttempts: DEFAULT_MAX_ATTEMPTS,
|
|
339
|
+
requireOrganizationId: true,
|
|
340
|
+
requireToken: true,
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
export function buildMaestroSessionRuntimeTrigger(input, fallbackWorkspaceId) {
|
|
344
|
+
const workspaceId = trimString(input.workspaceId) ?? trimString(fallbackWorkspaceId);
|
|
345
|
+
const sessionId = trimString(input.sessionId);
|
|
346
|
+
if (!workspaceId || !sessionId) {
|
|
347
|
+
return null;
|
|
348
|
+
}
|
|
349
|
+
const agentId = trimString(input.agentId) ?? "maestro";
|
|
350
|
+
const channelId = `maestro-session:${sessionId}`;
|
|
351
|
+
const idempotencyKey = trimString(input.idempotencyKey) ??
|
|
352
|
+
["maestro-session", workspaceId, sessionId].join(":");
|
|
353
|
+
const correlationId = trimString(input.correlationId) ?? ["maestro-session", sessionId].join(":");
|
|
354
|
+
const actorId = trimString(input.actorId);
|
|
355
|
+
return {
|
|
356
|
+
workspaceId,
|
|
357
|
+
agentId,
|
|
358
|
+
channelId,
|
|
359
|
+
idempotencyKey,
|
|
360
|
+
sourceEventId: trimString(input.sourceEventId) ?? idempotencyKey,
|
|
361
|
+
sourceEventType: MaestroAgentRuntimeSourceEventType.SessionStarted,
|
|
362
|
+
...(actorId ? { actorId } : {}),
|
|
363
|
+
correlationId,
|
|
364
|
+
surfaceType: PlatformSurfaceValue.Maestro,
|
|
365
|
+
channelContext: {
|
|
366
|
+
channelKind: PlatformRuntimeChannelKindValue.Api,
|
|
367
|
+
providerWorkspaceId: workspaceId,
|
|
368
|
+
channelId,
|
|
369
|
+
threadId: sessionId,
|
|
370
|
+
...(actorId ? { actorId } : {}),
|
|
371
|
+
attributes: compactStringRecord({
|
|
372
|
+
route: "maestro_session",
|
|
373
|
+
maestro_session_id: sessionId,
|
|
374
|
+
source: "maestro",
|
|
375
|
+
}),
|
|
376
|
+
},
|
|
377
|
+
triggerKind: PlatformRuntimeTriggerKindValue.Api,
|
|
378
|
+
payload: {
|
|
379
|
+
maestroSessionId: sessionId,
|
|
380
|
+
...(input.metadata ? { metadata: input.metadata } : {}),
|
|
381
|
+
...(input.factsContext ? { facts_context: input.factsContext } : {}),
|
|
382
|
+
},
|
|
383
|
+
};
|
|
384
|
+
}
|
|
385
|
+
export async function handleAgentRuntimeTrigger(trigger, options) {
|
|
386
|
+
return normalizeHandleTriggerResponse(await postAgentRuntimeOperation(HANDLE_TRIGGER_PATH, { trigger }, options));
|
|
387
|
+
}
|
|
388
|
+
export async function claimNextAgentRuntimeRun(input, options) {
|
|
389
|
+
const payload = await postAgentRuntimeOperation(CLAIM_NEXT_RUN_PATH, {
|
|
390
|
+
workerId: input.workerId,
|
|
391
|
+
...(input.workerQueue ? { workerQueue: input.workerQueue } : {}),
|
|
392
|
+
...(isFiniteNumber(input.leaseSeconds)
|
|
393
|
+
? { leaseSeconds: input.leaseSeconds }
|
|
394
|
+
: {}),
|
|
395
|
+
}, options);
|
|
396
|
+
return {
|
|
397
|
+
run: normalizeRequiredRun(payload),
|
|
398
|
+
lease: normalizeLease(payload.lease),
|
|
399
|
+
events: normalizeEvents(payload),
|
|
400
|
+
};
|
|
401
|
+
}
|
|
402
|
+
export async function recordAgentRuntimeRunStep(input, options) {
|
|
403
|
+
const payload = await postAgentRuntimeOperation(RECORD_RUN_STEP_PATH, {
|
|
404
|
+
runId: input.runId,
|
|
405
|
+
leaseToken: input.leaseToken,
|
|
406
|
+
step: input.step,
|
|
407
|
+
}, options);
|
|
408
|
+
return {
|
|
409
|
+
run: normalizeRequiredRun(payload),
|
|
410
|
+
step: normalizeStep(payload.step),
|
|
411
|
+
event: normalizeEvent(payload.event),
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
export async function waitAgentRuntimeRun(input, options) {
|
|
415
|
+
const payload = await postAgentRuntimeOperation(WAIT_RUN_PATH, {
|
|
416
|
+
runId: input.runId,
|
|
417
|
+
leaseToken: input.leaseToken,
|
|
418
|
+
wait: input.wait,
|
|
419
|
+
...(input.checkpoint ? { checkpoint: input.checkpoint } : {}),
|
|
420
|
+
}, options);
|
|
421
|
+
return {
|
|
422
|
+
run: normalizeRequiredRun(payload),
|
|
423
|
+
wait: normalizeWait(payload.wait),
|
|
424
|
+
checkpoint: normalizeCheckpoint(payload.checkpoint),
|
|
425
|
+
event: normalizeEvent(payload.event),
|
|
426
|
+
};
|
|
427
|
+
}
|
|
428
|
+
export async function resumeAgentRuntimeRun(input, options) {
|
|
429
|
+
const payload = await postAgentRuntimeOperation(RESUME_RUN_PATH, {
|
|
430
|
+
runId: input.runId,
|
|
431
|
+
waitId: input.waitId,
|
|
432
|
+
...(input.resumeEventId ? { resumeEventId: input.resumeEventId } : {}),
|
|
433
|
+
...(input.payload ? { payload: input.payload } : {}),
|
|
434
|
+
}, options);
|
|
435
|
+
return {
|
|
436
|
+
run: normalizeRequiredRun(payload),
|
|
437
|
+
event: normalizeEvent(payload.event),
|
|
438
|
+
};
|
|
439
|
+
}
|
|
440
|
+
export async function completeAgentRuntimeRun(input, options) {
|
|
441
|
+
const payload = await postAgentRuntimeOperation(COMPLETE_RUN_PATH, {
|
|
442
|
+
runId: input.runId,
|
|
443
|
+
leaseToken: input.leaseToken,
|
|
444
|
+
...(input.result ? { result: input.result } : {}),
|
|
445
|
+
...(input.checkpoint ? { checkpoint: input.checkpoint } : {}),
|
|
446
|
+
}, options);
|
|
447
|
+
return {
|
|
448
|
+
run: normalizeRequiredRun(payload),
|
|
449
|
+
checkpoint: normalizeCheckpoint(payload.checkpoint),
|
|
450
|
+
event: normalizeEvent(payload.event),
|
|
451
|
+
};
|
|
452
|
+
}
|
|
453
|
+
export async function failAgentRuntimeRun(input, options) {
|
|
454
|
+
const payload = await postAgentRuntimeOperation(FAIL_RUN_PATH, {
|
|
455
|
+
runId: input.runId,
|
|
456
|
+
leaseToken: input.leaseToken,
|
|
457
|
+
errorMessage: input.errorMessage,
|
|
458
|
+
...(typeof input.retryable === "boolean"
|
|
459
|
+
? { retryable: input.retryable }
|
|
460
|
+
: {}),
|
|
461
|
+
...(isFiniteNumber(input.retryDelaySeconds)
|
|
462
|
+
? { retryDelaySeconds: input.retryDelaySeconds }
|
|
463
|
+
: {}),
|
|
464
|
+
}, options);
|
|
465
|
+
return {
|
|
466
|
+
run: normalizeRequiredRun(payload),
|
|
467
|
+
event: normalizeEvent(payload.event),
|
|
468
|
+
};
|
|
469
|
+
}
|
|
470
|
+
export async function getAgentRuntimeRun(input, options) {
|
|
471
|
+
const payload = await postAgentRuntimeOperation(GET_RUN_PATH, { id: input.runId }, options);
|
|
472
|
+
return { run: normalizeRequiredRun(payload) };
|
|
473
|
+
}
|
|
474
|
+
export async function listAgentRuntimeRunEvents(input, options) {
|
|
475
|
+
const payload = await postAgentRuntimeOperation(LIST_RUN_EVENTS_PATH, { runId: input.runId }, options);
|
|
476
|
+
return { events: normalizeEvents(payload) };
|
|
477
|
+
}
|
|
478
|
+
export async function recordMaestroSessionRuntimeTrigger(input, options) {
|
|
479
|
+
const config = options?.config ?? (await resolveAgentRuntimeServiceConfig());
|
|
480
|
+
if (!config) {
|
|
481
|
+
return null;
|
|
482
|
+
}
|
|
483
|
+
let factsContext = input.factsContext;
|
|
484
|
+
if (!factsContext) {
|
|
485
|
+
try {
|
|
486
|
+
factsContext = await gatherMaestroSessionFactsContext({
|
|
487
|
+
...input,
|
|
488
|
+
workspaceId: input.workspaceId ?? config.workspaceId,
|
|
489
|
+
}, { signal: options?.signal });
|
|
490
|
+
}
|
|
491
|
+
catch (error) {
|
|
492
|
+
if (isAbortError(error)) {
|
|
493
|
+
throw error;
|
|
494
|
+
}
|
|
495
|
+
factsContext = undefined;
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
const trigger = buildMaestroSessionRuntimeTrigger({ ...input, factsContext }, config.workspaceId);
|
|
499
|
+
if (!trigger) {
|
|
500
|
+
return null;
|
|
501
|
+
}
|
|
502
|
+
try {
|
|
503
|
+
return await handleAgentRuntimeTrigger(trigger, {
|
|
504
|
+
config,
|
|
505
|
+
signal: options?.signal,
|
|
506
|
+
});
|
|
507
|
+
}
|
|
508
|
+
catch (error) {
|
|
509
|
+
if (isAbortError(error)) {
|
|
510
|
+
throw error;
|
|
511
|
+
}
|
|
512
|
+
return null;
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
//# sourceMappingURL=agent-runtime-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-runtime-client.js","sourceRoot":"","sources":["../../src/platform/agent-runtime-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,gCAAgC,GAChC,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAEN,mBAAmB,EACnB,4BAA4B,EAC5B,UAAU,GACV,MAAM,aAAa,CAAC;AACrB,OAAO,EACN,wBAAwB,EACxB,yBAAyB,EACzB,yBAAyB,EACzB,0BAA0B,GAC1B,MAAM,oBAAoB,CAAC;AAE5B,MAAM,kBAAkB,GAAG,KAAK,CAAC;AACjC,MAAM,oBAAoB,GAAG,CAAC,CAAC;AAE/B,MAAM,mBAAmB,GAAG,yBAAyB,CACpD,wBAAwB,CAAC,YAAY,CAAC,aAAa,CACnD,CAAC;AACF,MAAM,mBAAmB,GAAG,yBAAyB,CACpD,wBAAwB,CAAC,YAAY,CAAC,YAAY,CAClD,CAAC;AACF,MAAM,oBAAoB,GAAG,yBAAyB,CACrD,wBAAwB,CAAC,YAAY,CAAC,aAAa,CACnD,CAAC;AACF,MAAM,aAAa,GAAG,yBAAyB,CAC9C,wBAAwB,CAAC,YAAY,CAAC,OAAO,CAC7C,CAAC;AACF,MAAM,eAAe,GAAG,yBAAyB,CAChD,wBAAwB,CAAC,YAAY,CAAC,SAAS,CAC/C,CAAC;AACF,MAAM,iBAAiB,GAAG,yBAAyB,CAClD,wBAAwB,CAAC,YAAY,CAAC,WAAW,CACjD,CAAC;AACF,MAAM,aAAa,GAAG,yBAAyB,CAC9C,wBAAwB,CAAC,YAAY,CAAC,OAAO,CAC7C,CAAC;AACF,MAAM,YAAY,GAAG,yBAAyB,CAC7C,wBAAwB,CAAC,YAAY,CAAC,MAAM,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,GAAG,OAAO,EAAE,MAAM,IAAI,CAAC,MAAM,gCAAgC,EAAE,CAAC,CAAC;IAC7E,IAAI,CAAC,MAAM,EAAE,CAAC;QACb,OAAO,IAAI,CAAC;IACb,CAAC;IACD,IAAI,YAAY,GAAG,KAAK,CAAC,YAAY,CAAC;IACtC,IAAI,CAAC,YAAY,EAAE,CAAC;QACnB,IAAI,CAAC;YACJ,YAAY,GAAG,MAAM,gCAAgC,CACpD;gBACC,GAAG,KAAK;gBACR,WAAW,EAAE,KAAK,CAAC,WAAW,IAAI,MAAM,CAAC,WAAW;aACpD,EACD,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,CAC3B,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,IAAI,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC;gBACzB,MAAM,KAAK,CAAC;YACb,CAAC;YACD,YAAY,GAAG,SAAS,CAAC;QAC1B,CAAC;IACF,CAAC;IACD,MAAM,OAAO,GAAG,iCAAiC,CAChD,EAAE,GAAG,KAAK,EAAE,YAAY,EAAE,EAC1B,MAAM,CAAC,WAAW,CAClB,CAAC;IACF,IAAI,CAAC,OAAO,EAAE,CAAC;QACd,OAAO,IAAI,CAAC;IACb,CAAC;IACD,IAAI,CAAC;QACJ,OAAO,MAAM,yBAAyB,CAAC,OAAO,EAAE;YAC/C,MAAM;YACN,MAAM,EAAE,OAAO,EAAE,MAAM;SACvB,CAAC,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,IAAI,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC;YACzB,MAAM,KAAK,CAAC;QACb,CAAC;QACD,OAAO,IAAI,CAAC;IACb,CAAC;AACF,CAAC","sourcesContent":["import {\n\ttype MaestroFactsContext,\n\tgatherMaestroSessionFactsContext,\n} from \"./cerebro-facts-client.js\";\nimport {\n\ttype PlatformServiceConfig,\n\tpostPlatformConnect,\n\tresolvePlatformServiceConfig,\n\ttrimString,\n} from \"./client.js\";\nimport {\n\tPLATFORM_CONNECT_METHODS,\n\tPLATFORM_CONNECT_SERVICES,\n\tplatformConnectMethodPath,\n\tplatformConnectServicePath,\n} from \"./core-services.js\";\n\nconst DEFAULT_TIMEOUT_MS = 2_000;\nconst DEFAULT_MAX_ATTEMPTS = 2;\n\nconst HANDLE_TRIGGER_PATH = platformConnectMethodPath(\n\tPLATFORM_CONNECT_METHODS.agentRuntime.handleTrigger,\n);\nconst CLAIM_NEXT_RUN_PATH = platformConnectMethodPath(\n\tPLATFORM_CONNECT_METHODS.agentRuntime.claimNextRun,\n);\nconst RECORD_RUN_STEP_PATH = platformConnectMethodPath(\n\tPLATFORM_CONNECT_METHODS.agentRuntime.recordRunStep,\n);\nconst WAIT_RUN_PATH = platformConnectMethodPath(\n\tPLATFORM_CONNECT_METHODS.agentRuntime.waitRun,\n);\nconst RESUME_RUN_PATH = platformConnectMethodPath(\n\tPLATFORM_CONNECT_METHODS.agentRuntime.resumeRun,\n);\nconst COMPLETE_RUN_PATH = platformConnectMethodPath(\n\tPLATFORM_CONNECT_METHODS.agentRuntime.completeRun,\n);\nconst FAIL_RUN_PATH = platformConnectMethodPath(\n\tPLATFORM_CONNECT_METHODS.agentRuntime.failRun,\n);\nconst GET_RUN_PATH = platformConnectMethodPath(\n\tPLATFORM_CONNECT_METHODS.agentRuntime.getRun,\n);\nconst LIST_RUN_EVENTS_PATH = platformConnectMethodPath(\n\tPLATFORM_CONNECT_METHODS.agentRuntime.listRunEvents,\n);\n\nfunction isAbortError(error: unknown): boolean {\n\treturn error instanceof Error && error.name === \"AbortError\";\n}\n\nconst AGENT_RUNTIME_BASE_URL_ENV_VARS = [\n\t\"MAESTRO_AGENT_RUNTIME_SERVICE_URL\",\n\t\"AGENT_RUNTIME_SERVICE_URL\",\n] as const;\n\nconst AGENT_RUNTIME_TOKEN_ENV_VARS = [\n\t\"MAESTRO_AGENT_RUNTIME_SERVICE_TOKEN\",\n\t\"AGENT_RUNTIME_SERVICE_TOKEN\",\n\t\"MAESTRO_EVALOPS_ACCESS_TOKEN\",\n\t\"EVALOPS_TOKEN\",\n] as const;\n\nconst AGENT_RUNTIME_ORGANIZATION_ENV_VARS = [\n\t\"MAESTRO_AGENT_RUNTIME_ORG_ID\",\n\t\"AGENT_RUNTIME_ORGANIZATION_ID\",\n\t\"MAESTRO_EVALOPS_ORG_ID\",\n\t\"EVALOPS_ORGANIZATION_ID\",\n\t\"MAESTRO_ENTERPRISE_ORG_ID\",\n] as const;\n\nconst AGENT_RUNTIME_WORKSPACE_ENV_VARS = [\n\t\"MAESTRO_AGENT_RUNTIME_WORKSPACE_ID\",\n\t\"AGENT_RUNTIME_WORKSPACE_ID\",\n\t\"MAESTRO_WORKSPACE_ID\",\n\t\"EVALOPS_WORKSPACE_ID\",\n] as const;\n\nconst AGENT_RUNTIME_TIMEOUT_ENV_VARS = [\n\t\"MAESTRO_AGENT_RUNTIME_TIMEOUT_MS\",\n\t\"AGENT_RUNTIME_SERVICE_TIMEOUT_MS\",\n] as const;\n\nconst AGENT_RUNTIME_MAX_ATTEMPTS_ENV_VARS = [\n\t\"MAESTRO_AGENT_RUNTIME_MAX_ATTEMPTS\",\n\t\"AGENT_RUNTIME_SERVICE_MAX_ATTEMPTS\",\n] as const;\n\nconst AGENT_RUNTIME_BASE_URL_SUFFIXES = [\n\tHANDLE_TRIGGER_PATH,\n\tplatformConnectServicePath(PLATFORM_CONNECT_SERVICES.agentRuntime),\n] as const;\n\nexport enum PlatformSurfaceValue {\n\tMaestro = \"SURFACE_MAESTRO\",\n}\n\nexport enum PlatformRuntimeChannelKindValue {\n\tApi = \"RUNTIME_CHANNEL_KIND_API\",\n}\n\nexport enum PlatformRuntimeTriggerKindValue {\n\tApi = \"RUNTIME_TRIGGER_KIND_API\",\n}\n\nexport enum PlatformRuntimeEventTypeValue {\n\tTriggerAccepted = \"RUNTIME_EVENT_TYPE_TRIGGER_ACCEPTED\",\n\tRunClaimed = \"RUNTIME_EVENT_TYPE_RUN_CLAIMED\",\n\tStepRecorded = \"RUNTIME_EVENT_TYPE_STEP_RECORDED\",\n\tRunWaiting = \"RUNTIME_EVENT_TYPE_RUN_WAITING\",\n\tRunResumed = \"RUNTIME_EVENT_TYPE_RUN_RESUMED\",\n\tRunSucceeded = \"RUNTIME_EVENT_TYPE_RUN_SUCCEEDED\",\n\tRunFailed = \"RUNTIME_EVENT_TYPE_RUN_FAILED\",\n}\n\nexport enum PlatformAgentRunStateValue {\n\tAccepted = \"AGENT_RUN_STATE_ACCEPTED\",\n\tQueued = \"AGENT_RUN_STATE_QUEUED\",\n\tRunning = \"AGENT_RUN_STATE_RUNNING\",\n\tWaiting = \"AGENT_RUN_STATE_WAITING\",\n\tSucceeded = \"AGENT_RUN_STATE_SUCCEEDED\",\n\tFailed = \"AGENT_RUN_STATE_FAILED\",\n\tCancelled = \"AGENT_RUN_STATE_CANCELLED\",\n}\n\nexport enum PlatformAgentRunStepKindValue {\n\tModelCall = \"AGENT_RUN_STEP_KIND_MODEL_CALL\",\n\tToolCallIntent = \"AGENT_RUN_STEP_KIND_TOOL_CALL_INTENT\",\n\tToolResult = \"AGENT_RUN_STEP_KIND_TOOL_RESULT\",\n\tApprovalWait = \"AGENT_RUN_STEP_KIND_APPROVAL_WAIT\",\n\tError = \"AGENT_RUN_STEP_KIND_ERROR\",\n\tSystem = \"AGENT_RUN_STEP_KIND_SYSTEM\",\n}\n\nexport enum PlatformAgentRunStepStateValue {\n\tPending = \"AGENT_RUN_STEP_STATE_PENDING\",\n\tRunning = \"AGENT_RUN_STEP_STATE_RUNNING\",\n\tWaiting = \"AGENT_RUN_STEP_STATE_WAITING\",\n\tSucceeded = \"AGENT_RUN_STEP_STATE_SUCCEEDED\",\n\tFailed = \"AGENT_RUN_STEP_STATE_FAILED\",\n\tCancelled = \"AGENT_RUN_STEP_STATE_CANCELLED\",\n\tSkipped = \"AGENT_RUN_STEP_STATE_SKIPPED\",\n}\n\nexport enum PlatformAgentRunWaitTypeValue {\n\tApproval = \"AGENT_RUN_WAIT_TYPE_APPROVAL\",\n\tInput = \"AGENT_RUN_WAIT_TYPE_INPUT\",\n\tEvent = \"AGENT_RUN_WAIT_TYPE_EVENT\",\n\tTimer = \"AGENT_RUN_WAIT_TYPE_TIMER\",\n}\n\nexport enum MaestroAgentRuntimeSourceEventType {\n\tSessionStarted = \"maestro.session_started\",\n}\n\nexport interface PlatformRuntimeChannelContext {\n\tchannelKind: PlatformRuntimeChannelKindValue;\n\tproviderWorkspaceId?: string;\n\tchannelId: string;\n\tthreadId?: string;\n\tactorId?: string;\n\tattributes?: Record<string, string>;\n}\n\nexport interface PlatformAgentRuntimeTrigger {\n\tworkspaceId: string;\n\tagentId: string;\n\tchannelId: string;\n\tidempotencyKey: string;\n\tsourceEventId?: string;\n\tsourceEventType: MaestroAgentRuntimeSourceEventType | string;\n\tactorId?: string;\n\tcorrelationId?: string;\n\tpayload?: Record<string, unknown>;\n\tsurfaceType: PlatformSurfaceValue;\n\tchannelContext: PlatformRuntimeChannelContext;\n\ttriggerKind: PlatformRuntimeTriggerKindValue;\n}\n\nexport interface PlatformAgentRun {\n\tid: string;\n\tstate?: PlatformAgentRunStateValue | string;\n\tlease?: PlatformAgentRunLease;\n\tsteps?: PlatformAgentRunStep[];\n\twaits?: PlatformAgentRunWait[];\n\tlatestCheckpoint?: PlatformAgentRunCheckpoint;\n\tlinkage?: {\n\t\trunId?: string;\n\t\tworkspaceId?: string;\n\t\tagentId?: string;\n\t\tobjectiveId?: string;\n\t};\n\tcreatedAt?: string;\n\tupdatedAt?: string;\n}\n\nexport interface PlatformRuntimeEvent {\n\tid?: string;\n\trunId?: string;\n\tsequence?: number;\n\ttype?: string;\n\tmessage?: string;\n\tstepId?: string;\n\twaitId?: string;\n\tcheckpointId?: string;\n\tattributes?: Record<string, unknown>;\n\toccurredAt?: string;\n}\n\nexport interface PlatformAgentRuntimeHandleTriggerResult {\n\trun: PlatformAgentRun;\n\tevents: PlatformRuntimeEvent[];\n\tidempotentReplay: boolean;\n}\n\nexport interface PlatformAgentRunLease {\n\tid?: string;\n\ttoken?: string;\n\tworkerId?: string;\n\tworkerQueue?: string;\n\texpiresAt?: string;\n\theartbeatAt?: string;\n}\n\nexport interface PlatformAgentRunStep {\n\tid?: string;\n\tname?: string;\n\tstepKind?: PlatformAgentRunStepKindValue | string;\n\tstate?: PlatformAgentRunStepStateValue | string;\n\tattempt?: number;\n\tinput?: Record<string, unknown>;\n\toutput?: Record<string, unknown>;\n\terrorMessage?: string;\n\tcheckpointId?: string;\n\tstartedAt?: string;\n\tendedAt?: string;\n\tlinkage?: PlatformAgentRun[\"linkage\"];\n}\n\nexport interface PlatformAgentRunCheckpoint {\n\tid?: string;\n\tstepId?: string;\n\tsequence?: number;\n\tresumeToken?: string;\n\tpayload?: Record<string, unknown>;\n\tcreatedAt?: string;\n\tlinkage?: PlatformAgentRun[\"linkage\"];\n}\n\nexport interface PlatformAgentRunWait {\n\tid?: string;\n\tstepId?: string;\n\ttype?: PlatformAgentRunWaitTypeValue | string;\n\texternalRef?: string;\n\treason?: string;\n\tpayload?: Record<string, unknown>;\n\tcreatedAt?: string;\n\tresumeAfter?: string;\n\texpiresAt?: string;\n\tresolvedAt?: string;\n\tresolvedByEventId?: string;\n\tlinkage?: PlatformAgentRun[\"linkage\"];\n}\n\nexport interface PlatformAgentRuntimeClaimNextRunInput {\n\tworkerId: string;\n\tworkerQueue?: string;\n\tleaseSeconds?: number;\n}\n\nexport interface PlatformAgentRuntimeClaimNextRunResult {\n\trun: PlatformAgentRun;\n\tlease?: PlatformAgentRunLease;\n\tevents: PlatformRuntimeEvent[];\n}\n\nexport interface PlatformAgentRuntimeRecordRunStepInput {\n\trunId: string;\n\tleaseToken: string;\n\tstep: PlatformAgentRunStep;\n}\n\nexport interface PlatformAgentRuntimeRecordRunStepResult {\n\trun: PlatformAgentRun;\n\tstep?: PlatformAgentRunStep;\n\tevent?: PlatformRuntimeEvent;\n}\n\nexport interface PlatformAgentRuntimeWaitRunInput {\n\trunId: string;\n\tleaseToken: string;\n\twait: PlatformAgentRunWait;\n\tcheckpoint?: PlatformAgentRunCheckpoint;\n}\n\nexport interface PlatformAgentRuntimeWaitRunResult {\n\trun: PlatformAgentRun;\n\twait?: PlatformAgentRunWait;\n\tcheckpoint?: PlatformAgentRunCheckpoint;\n\tevent?: PlatformRuntimeEvent;\n}\n\nexport interface PlatformAgentRuntimeResumeRunInput {\n\trunId: string;\n\twaitId: string;\n\tresumeEventId?: string;\n\tpayload?: Record<string, unknown>;\n}\n\nexport interface PlatformAgentRuntimeRunEventResult {\n\trun: PlatformAgentRun;\n\tevent?: PlatformRuntimeEvent;\n}\n\nexport interface PlatformAgentRuntimeCompleteRunInput {\n\trunId: string;\n\tleaseToken: string;\n\tresult?: Record<string, unknown>;\n\tcheckpoint?: PlatformAgentRunCheckpoint;\n}\n\nexport interface PlatformAgentRuntimeCompleteRunResult {\n\trun: PlatformAgentRun;\n\tcheckpoint?: PlatformAgentRunCheckpoint;\n\tevent?: PlatformRuntimeEvent;\n}\n\nexport interface PlatformAgentRuntimeFailRunInput {\n\trunId: string;\n\tleaseToken: string;\n\terrorMessage: string;\n\tretryable?: boolean;\n\tretryDelaySeconds?: number;\n}\n\nexport interface PlatformAgentRuntimeGetRunInput {\n\trunId: string;\n}\n\nexport interface PlatformAgentRuntimeListRunEventsInput {\n\trunId: string;\n}\n\nexport interface PlatformAgentRuntimeListRunEventsResult {\n\tevents: PlatformRuntimeEvent[];\n}\n\nexport interface MaestroSessionRuntimeTriggerInput {\n\tworkspaceId?: string;\n\tsessionId: string;\n\tagentId?: string;\n\tactorId?: string;\n\tcorrelationId?: string;\n\tsourceEventId?: string;\n\tidempotencyKey?: string;\n\tfactsQuery?: string;\n\tfactsContext?: MaestroFactsContext;\n\tmetadata?: Record<string, unknown>;\n}\n\nfunction pickString(\n\trecord: Record<string, unknown> | undefined,\n\t...names: string[]\n): string | undefined {\n\tfor (const name of names) {\n\t\tconst value = record?.[name];\n\t\tif (typeof value === \"string\" && value.trim().length > 0) {\n\t\t\treturn value;\n\t\t}\n\t}\n\treturn undefined;\n}\n\nfunction pickRecord(\n\trecord: Record<string, unknown> | undefined,\n\t...names: string[]\n): Record<string, unknown> | undefined {\n\tfor (const name of names) {\n\t\tconst value = record?.[name];\n\t\tif (value && typeof value === \"object\" && !Array.isArray(value)) {\n\t\t\treturn value as Record<string, unknown>;\n\t\t}\n\t}\n\treturn undefined;\n}\n\nfunction pickArray(\n\trecord: Record<string, unknown> | undefined,\n\t...names: string[]\n): unknown[] | undefined {\n\tfor (const name of names) {\n\t\tconst value = record?.[name];\n\t\tif (Array.isArray(value)) {\n\t\t\treturn value;\n\t\t}\n\t}\n\treturn undefined;\n}\n\nfunction pickBoolean(\n\trecord: Record<string, unknown> | undefined,\n\t...names: string[]\n): boolean {\n\tfor (const name of names) {\n\t\tconst value = record?.[name];\n\t\tif (typeof value === \"boolean\") {\n\t\t\treturn value;\n\t\t}\n\t}\n\treturn false;\n}\n\nfunction pickNumber(\n\trecord: Record<string, unknown> | undefined,\n\t...names: string[]\n): number | undefined {\n\tfor (const name of names) {\n\t\tconst value = record?.[name];\n\t\tif (isFiniteNumber(value)) {\n\t\t\treturn value;\n\t\t}\n\t}\n\treturn undefined;\n}\n\nfunction isFiniteNumber(value: unknown): value is number {\n\treturn typeof value === \"number\" && Number.isFinite(value);\n}\n\nfunction normalizeLinkage(\n\tvalue: unknown,\n): PlatformAgentRun[\"linkage\"] | undefined {\n\tif (!value || typeof value !== \"object\" || Array.isArray(value)) {\n\t\treturn undefined;\n\t}\n\tconst linkage = value as Record<string, unknown>;\n\treturn {\n\t\trunId: pickString(linkage, \"runId\", \"run_id\"),\n\t\tworkspaceId: pickString(linkage, \"workspaceId\", \"workspace_id\"),\n\t\tagentId: pickString(linkage, \"agentId\", \"agent_id\"),\n\t\tobjectiveId: pickString(linkage, \"objectiveId\", \"objective_id\"),\n\t};\n}\n\nfunction compactStringRecord(\n\trecord: Record<string, string | undefined>,\n): Record<string, string> | undefined {\n\tconst compacted = Object.fromEntries(\n\t\tObject.entries(record).filter(\n\t\t\t(entry): entry is [string, string] =>\n\t\t\t\ttypeof entry[1] === \"string\" && entry[1].length > 0,\n\t\t),\n\t);\n\treturn Object.keys(compacted).length > 0 ? compacted : undefined;\n}\n\nfunction normalizeLease(value: unknown): PlatformAgentRunLease | undefined {\n\tif (!value || typeof value !== \"object\" || Array.isArray(value)) {\n\t\treturn undefined;\n\t}\n\tconst record = value as Record<string, unknown>;\n\treturn {\n\t\tid: pickString(record, \"id\"),\n\t\ttoken: pickString(record, \"token\"),\n\t\tworkerId: pickString(record, \"workerId\", \"worker_id\"),\n\t\tworkerQueue: pickString(record, \"workerQueue\", \"worker_queue\"),\n\t\texpiresAt: pickString(record, \"expiresAt\", \"expires_at\"),\n\t\theartbeatAt: pickString(record, \"heartbeatAt\", \"heartbeat_at\"),\n\t};\n}\n\nfunction normalizeStep(value: unknown): PlatformAgentRunStep | undefined {\n\tif (!value || typeof value !== \"object\" || Array.isArray(value)) {\n\t\treturn undefined;\n\t}\n\tconst record = value as Record<string, unknown>;\n\treturn {\n\t\tid: pickString(record, \"id\"),\n\t\tname: pickString(record, \"name\"),\n\t\tstepKind: pickString(record, \"stepKind\", \"step_kind\", \"kind\"),\n\t\tstate: pickString(record, \"state\"),\n\t\tattempt: pickNumber(record, \"attempt\"),\n\t\tinput: pickRecord(record, \"input\"),\n\t\toutput: pickRecord(record, \"output\"),\n\t\terrorMessage: pickString(record, \"errorMessage\", \"error_message\"),\n\t\tcheckpointId: pickString(record, \"checkpointId\", \"checkpoint_id\"),\n\t\tstartedAt: pickString(record, \"startedAt\", \"started_at\"),\n\t\tendedAt: pickString(record, \"endedAt\", \"ended_at\"),\n\t\tlinkage: normalizeLinkage(record.linkage),\n\t};\n}\n\nfunction normalizeCheckpoint(\n\tvalue: unknown,\n): PlatformAgentRunCheckpoint | undefined {\n\tif (!value || typeof value !== \"object\" || Array.isArray(value)) {\n\t\treturn undefined;\n\t}\n\tconst record = value as Record<string, unknown>;\n\treturn {\n\t\tid: pickString(record, \"id\"),\n\t\tstepId: pickString(record, \"stepId\", \"step_id\"),\n\t\tsequence: pickNumber(record, \"sequence\"),\n\t\tresumeToken: pickString(record, \"resumeToken\", \"resume_token\"),\n\t\tpayload: pickRecord(record, \"payload\"),\n\t\tcreatedAt: pickString(record, \"createdAt\", \"created_at\"),\n\t\tlinkage: normalizeLinkage(record.linkage),\n\t};\n}\n\nfunction normalizeWait(value: unknown): PlatformAgentRunWait | undefined {\n\tif (!value || typeof value !== \"object\" || Array.isArray(value)) {\n\t\treturn undefined;\n\t}\n\tconst record = value as Record<string, unknown>;\n\treturn {\n\t\tid: pickString(record, \"id\"),\n\t\tstepId: pickString(record, \"stepId\", \"step_id\"),\n\t\ttype: pickString(record, \"type\"),\n\t\texternalRef: pickString(record, \"externalRef\", \"external_ref\"),\n\t\treason: pickString(record, \"reason\"),\n\t\tpayload: pickRecord(record, \"payload\"),\n\t\tcreatedAt: pickString(record, \"createdAt\", \"created_at\"),\n\t\tresumeAfter: pickString(record, \"resumeAfter\", \"resume_after\"),\n\t\texpiresAt: pickString(record, \"expiresAt\", \"expires_at\"),\n\t\tresolvedAt: pickString(record, \"resolvedAt\", \"resolved_at\"),\n\t\tresolvedByEventId: pickString(\n\t\t\trecord,\n\t\t\t\"resolvedByEventId\",\n\t\t\t\"resolved_by_event_id\",\n\t\t),\n\t\tlinkage: normalizeLinkage(record.linkage),\n\t};\n}\n\nfunction normalizeRun(value: unknown): PlatformAgentRun | undefined {\n\tif (!value || typeof value !== \"object\" || Array.isArray(value)) {\n\t\treturn undefined;\n\t}\n\tconst record = value as Record<string, unknown>;\n\tconst id = pickString(record, \"id\");\n\tif (!id) {\n\t\treturn undefined;\n\t}\n\treturn {\n\t\tid,\n\t\tstate: pickString(record, \"state\"),\n\t\tlease: normalizeLease(record.lease),\n\t\tsteps: pickArray(record, \"steps\")\n\t\t\t?.map(normalizeStep)\n\t\t\t.filter((step): step is PlatformAgentRunStep => Boolean(step)),\n\t\twaits: pickArray(record, \"waits\")\n\t\t\t?.map(normalizeWait)\n\t\t\t.filter((wait): wait is PlatformAgentRunWait => Boolean(wait)),\n\t\tlatestCheckpoint: normalizeCheckpoint(\n\t\t\trecord.latestCheckpoint ?? record.latest_checkpoint,\n\t\t),\n\t\tlinkage: normalizeLinkage(record.linkage),\n\t\tcreatedAt: pickString(record, \"createdAt\", \"created_at\"),\n\t\tupdatedAt: pickString(record, \"updatedAt\", \"updated_at\"),\n\t};\n}\n\nfunction normalizeEvent(value: unknown): PlatformRuntimeEvent | undefined {\n\tif (!value || typeof value !== \"object\" || Array.isArray(value)) {\n\t\treturn undefined;\n\t}\n\tconst record = value as Record<string, unknown>;\n\treturn {\n\t\tid: pickString(record, \"id\"),\n\t\trunId: pickString(record, \"runId\", \"run_id\"),\n\t\tsequence: pickNumber(record, \"sequence\"),\n\t\ttype: pickString(record, \"type\"),\n\t\tmessage: pickString(record, \"message\"),\n\t\tstepId: pickString(record, \"stepId\", \"step_id\"),\n\t\twaitId: pickString(record, \"waitId\", \"wait_id\"),\n\t\tcheckpointId: pickString(record, \"checkpointId\", \"checkpoint_id\"),\n\t\tattributes: pickRecord(record, \"attributes\"),\n\t\toccurredAt: pickString(record, \"occurredAt\", \"occurred_at\"),\n\t};\n}\n\nfunction normalizeHandleTriggerResponse(\n\tpayload: Record<string, unknown>,\n): PlatformAgentRuntimeHandleTriggerResult {\n\treturn {\n\t\trun: normalizeRequiredRun(payload),\n\t\tevents: normalizeEvents(payload),\n\t\tidempotentReplay: pickBoolean(\n\t\t\tpayload,\n\t\t\t\"idempotentReplay\",\n\t\t\t\"idempotent_replay\",\n\t\t),\n\t};\n}\n\nfunction normalizeRequiredRun(\n\tpayload: Record<string, unknown>,\n): PlatformAgentRun {\n\tconst run = normalizeRun(payload.run);\n\tif (!run) {\n\t\tthrow new Error(\"agent runtime service returned no run\");\n\t}\n\treturn run;\n}\n\nfunction normalizeEvents(\n\tpayload: Record<string, unknown>,\n): PlatformRuntimeEvent[] {\n\treturn (\n\t\tpickArray(payload, \"events\")\n\t\t\t?.map(normalizeEvent)\n\t\t\t.filter((event): event is PlatformRuntimeEvent => Boolean(event)) ?? []\n\t);\n}\n\nasync function postAgentRuntimeOperation(\n\tpath: string,\n\tbody: Record<string, unknown>,\n\toptions?: {\n\t\tconfig?: PlatformServiceConfig;\n\t\tsignal?: AbortSignal;\n\t},\n): Promise<Record<string, unknown>> {\n\tconst config = options?.config ?? (await resolveAgentRuntimeServiceConfig());\n\tif (!config) {\n\t\tthrow new Error(\"agent runtime service is not configured\");\n\t}\n\tconst response = await postPlatformConnect(config, path, body, {\n\t\tserviceName: \"agent runtime service\",\n\t\tfailureMode: \"optional\",\n\t\ttimeoutMs: config.timeoutMs,\n\t\tmaxAttempts: config.maxAttempts,\n\t\tsignal: options?.signal,\n\t});\n\tif (!response.ok) {\n\t\tconst text = await response.text();\n\t\tthrow new Error(\n\t\t\t`agent runtime service returned ${response.status}: ${text || response.statusText}`,\n\t\t);\n\t}\n\treturn (await response.json()) as Record<string, unknown>;\n}\n\nexport async function resolveAgentRuntimeServiceConfig(): Promise<PlatformServiceConfig | null> {\n\treturn await resolvePlatformServiceConfig({\n\t\tbaseUrlEnvVars: AGENT_RUNTIME_BASE_URL_ENV_VARS,\n\t\ttokenEnvVars: AGENT_RUNTIME_TOKEN_ENV_VARS,\n\t\torganizationEnvVars: AGENT_RUNTIME_ORGANIZATION_ENV_VARS,\n\t\tworkspaceEnvVars: AGENT_RUNTIME_WORKSPACE_ENV_VARS,\n\t\ttimeoutEnvVars: AGENT_RUNTIME_TIMEOUT_ENV_VARS,\n\t\tmaxAttemptsEnvVars: AGENT_RUNTIME_MAX_ATTEMPTS_ENV_VARS,\n\t\tbaseUrlSuffixes: AGENT_RUNTIME_BASE_URL_SUFFIXES,\n\t\tdefaultTimeoutMs: DEFAULT_TIMEOUT_MS,\n\t\tdefaultMaxAttempts: DEFAULT_MAX_ATTEMPTS,\n\t\trequireOrganizationId: true,\n\t\trequireToken: true,\n\t});\n}\n\nexport function buildMaestroSessionRuntimeTrigger(\n\tinput: MaestroSessionRuntimeTriggerInput,\n\tfallbackWorkspaceId?: string,\n): PlatformAgentRuntimeTrigger | null {\n\tconst workspaceId =\n\t\ttrimString(input.workspaceId) ?? trimString(fallbackWorkspaceId);\n\tconst sessionId = trimString(input.sessionId);\n\tif (!workspaceId || !sessionId) {\n\t\treturn null;\n\t}\n\tconst agentId = trimString(input.agentId) ?? \"maestro\";\n\tconst channelId = `maestro-session:${sessionId}`;\n\tconst idempotencyKey =\n\t\ttrimString(input.idempotencyKey) ??\n\t\t[\"maestro-session\", workspaceId, sessionId].join(\":\");\n\tconst correlationId =\n\t\ttrimString(input.correlationId) ?? [\"maestro-session\", sessionId].join(\":\");\n\tconst actorId = trimString(input.actorId);\n\treturn {\n\t\tworkspaceId,\n\t\tagentId,\n\t\tchannelId,\n\t\tidempotencyKey,\n\t\tsourceEventId: trimString(input.sourceEventId) ?? idempotencyKey,\n\t\tsourceEventType: MaestroAgentRuntimeSourceEventType.SessionStarted,\n\t\t...(actorId ? { actorId } : {}),\n\t\tcorrelationId,\n\t\tsurfaceType: PlatformSurfaceValue.Maestro,\n\t\tchannelContext: {\n\t\t\tchannelKind: PlatformRuntimeChannelKindValue.Api,\n\t\t\tproviderWorkspaceId: workspaceId,\n\t\t\tchannelId,\n\t\t\tthreadId: sessionId,\n\t\t\t...(actorId ? { actorId } : {}),\n\t\t\tattributes: compactStringRecord({\n\t\t\t\troute: \"maestro_session\",\n\t\t\t\tmaestro_session_id: sessionId,\n\t\t\t\tsource: \"maestro\",\n\t\t\t}),\n\t\t},\n\t\ttriggerKind: PlatformRuntimeTriggerKindValue.Api,\n\t\tpayload: {\n\t\t\tmaestroSessionId: sessionId,\n\t\t\t...(input.metadata ? { metadata: input.metadata } : {}),\n\t\t\t...(input.factsContext ? { facts_context: input.factsContext } : {}),\n\t\t},\n\t};\n}\n\nexport async function handleAgentRuntimeTrigger(\n\ttrigger: PlatformAgentRuntimeTrigger,\n\toptions?: {\n\t\tconfig?: PlatformServiceConfig;\n\t\tsignal?: AbortSignal;\n\t},\n): Promise<PlatformAgentRuntimeHandleTriggerResult> {\n\treturn normalizeHandleTriggerResponse(\n\t\tawait postAgentRuntimeOperation(HANDLE_TRIGGER_PATH, { trigger }, options),\n\t);\n}\n\nexport async function claimNextAgentRuntimeRun(\n\tinput: PlatformAgentRuntimeClaimNextRunInput,\n\toptions?: {\n\t\tconfig?: PlatformServiceConfig;\n\t\tsignal?: AbortSignal;\n\t},\n): Promise<PlatformAgentRuntimeClaimNextRunResult> {\n\tconst payload = await postAgentRuntimeOperation(\n\t\tCLAIM_NEXT_RUN_PATH,\n\t\t{\n\t\t\tworkerId: input.workerId,\n\t\t\t...(input.workerQueue ? { workerQueue: input.workerQueue } : {}),\n\t\t\t...(isFiniteNumber(input.leaseSeconds)\n\t\t\t\t? { leaseSeconds: input.leaseSeconds }\n\t\t\t\t: {}),\n\t\t},\n\t\toptions,\n\t);\n\treturn {\n\t\trun: normalizeRequiredRun(payload),\n\t\tlease: normalizeLease(payload.lease),\n\t\tevents: normalizeEvents(payload),\n\t};\n}\n\nexport async function recordAgentRuntimeRunStep(\n\tinput: PlatformAgentRuntimeRecordRunStepInput,\n\toptions?: {\n\t\tconfig?: PlatformServiceConfig;\n\t\tsignal?: AbortSignal;\n\t},\n): Promise<PlatformAgentRuntimeRecordRunStepResult> {\n\tconst payload = await postAgentRuntimeOperation(\n\t\tRECORD_RUN_STEP_PATH,\n\t\t{\n\t\t\trunId: input.runId,\n\t\t\tleaseToken: input.leaseToken,\n\t\t\tstep: input.step,\n\t\t},\n\t\toptions,\n\t);\n\treturn {\n\t\trun: normalizeRequiredRun(payload),\n\t\tstep: normalizeStep(payload.step),\n\t\tevent: normalizeEvent(payload.event),\n\t};\n}\n\nexport async function waitAgentRuntimeRun(\n\tinput: PlatformAgentRuntimeWaitRunInput,\n\toptions?: {\n\t\tconfig?: PlatformServiceConfig;\n\t\tsignal?: AbortSignal;\n\t},\n): Promise<PlatformAgentRuntimeWaitRunResult> {\n\tconst payload = await postAgentRuntimeOperation(\n\t\tWAIT_RUN_PATH,\n\t\t{\n\t\t\trunId: input.runId,\n\t\t\tleaseToken: input.leaseToken,\n\t\t\twait: input.wait,\n\t\t\t...(input.checkpoint ? { checkpoint: input.checkpoint } : {}),\n\t\t},\n\t\toptions,\n\t);\n\treturn {\n\t\trun: normalizeRequiredRun(payload),\n\t\twait: normalizeWait(payload.wait),\n\t\tcheckpoint: normalizeCheckpoint(payload.checkpoint),\n\t\tevent: normalizeEvent(payload.event),\n\t};\n}\n\nexport async function resumeAgentRuntimeRun(\n\tinput: PlatformAgentRuntimeResumeRunInput,\n\toptions?: {\n\t\tconfig?: PlatformServiceConfig;\n\t\tsignal?: AbortSignal;\n\t},\n): Promise<PlatformAgentRuntimeRunEventResult> {\n\tconst payload = await postAgentRuntimeOperation(\n\t\tRESUME_RUN_PATH,\n\t\t{\n\t\t\trunId: input.runId,\n\t\t\twaitId: input.waitId,\n\t\t\t...(input.resumeEventId ? { resumeEventId: input.resumeEventId } : {}),\n\t\t\t...(input.payload ? { payload: input.payload } : {}),\n\t\t},\n\t\toptions,\n\t);\n\treturn {\n\t\trun: normalizeRequiredRun(payload),\n\t\tevent: normalizeEvent(payload.event),\n\t};\n}\n\nexport async function completeAgentRuntimeRun(\n\tinput: PlatformAgentRuntimeCompleteRunInput,\n\toptions?: {\n\t\tconfig?: PlatformServiceConfig;\n\t\tsignal?: AbortSignal;\n\t},\n): Promise<PlatformAgentRuntimeCompleteRunResult> {\n\tconst payload = await postAgentRuntimeOperation(\n\t\tCOMPLETE_RUN_PATH,\n\t\t{\n\t\t\trunId: input.runId,\n\t\t\tleaseToken: input.leaseToken,\n\t\t\t...(input.result ? { result: input.result } : {}),\n\t\t\t...(input.checkpoint ? { checkpoint: input.checkpoint } : {}),\n\t\t},\n\t\toptions,\n\t);\n\treturn {\n\t\trun: normalizeRequiredRun(payload),\n\t\tcheckpoint: normalizeCheckpoint(payload.checkpoint),\n\t\tevent: normalizeEvent(payload.event),\n\t};\n}\n\nexport async function failAgentRuntimeRun(\n\tinput: PlatformAgentRuntimeFailRunInput,\n\toptions?: {\n\t\tconfig?: PlatformServiceConfig;\n\t\tsignal?: AbortSignal;\n\t},\n): Promise<PlatformAgentRuntimeRunEventResult> {\n\tconst payload = await postAgentRuntimeOperation(\n\t\tFAIL_RUN_PATH,\n\t\t{\n\t\t\trunId: input.runId,\n\t\t\tleaseToken: input.leaseToken,\n\t\t\terrorMessage: input.errorMessage,\n\t\t\t...(typeof input.retryable === \"boolean\"\n\t\t\t\t? { retryable: input.retryable }\n\t\t\t\t: {}),\n\t\t\t...(isFiniteNumber(input.retryDelaySeconds)\n\t\t\t\t? { retryDelaySeconds: input.retryDelaySeconds }\n\t\t\t\t: {}),\n\t\t},\n\t\toptions,\n\t);\n\treturn {\n\t\trun: normalizeRequiredRun(payload),\n\t\tevent: normalizeEvent(payload.event),\n\t};\n}\n\nexport async function getAgentRuntimeRun(\n\tinput: PlatformAgentRuntimeGetRunInput,\n\toptions?: {\n\t\tconfig?: PlatformServiceConfig;\n\t\tsignal?: AbortSignal;\n\t},\n): Promise<PlatformAgentRuntimeRunEventResult> {\n\tconst payload = await postAgentRuntimeOperation(\n\t\tGET_RUN_PATH,\n\t\t{ id: input.runId },\n\t\toptions,\n\t);\n\treturn { run: normalizeRequiredRun(payload) };\n}\n\nexport async function listAgentRuntimeRunEvents(\n\tinput: PlatformAgentRuntimeListRunEventsInput,\n\toptions?: {\n\t\tconfig?: PlatformServiceConfig;\n\t\tsignal?: AbortSignal;\n\t},\n): Promise<PlatformAgentRuntimeListRunEventsResult> {\n\tconst payload = await postAgentRuntimeOperation(\n\t\tLIST_RUN_EVENTS_PATH,\n\t\t{ runId: input.runId },\n\t\toptions,\n\t);\n\treturn { events: normalizeEvents(payload) };\n}\n\nexport async function recordMaestroSessionRuntimeTrigger(\n\tinput: MaestroSessionRuntimeTriggerInput,\n\toptions?: {\n\t\tconfig?: PlatformServiceConfig;\n\t\tsignal?: AbortSignal;\n\t},\n): Promise<PlatformAgentRuntimeHandleTriggerResult | null> {\n\tconst config = options?.config ?? (await resolveAgentRuntimeServiceConfig());\n\tif (!config) {\n\t\treturn null;\n\t}\n\tlet factsContext = input.factsContext;\n\tif (!factsContext) {\n\t\ttry {\n\t\t\tfactsContext = await gatherMaestroSessionFactsContext(\n\t\t\t\t{\n\t\t\t\t\t...input,\n\t\t\t\t\tworkspaceId: input.workspaceId ?? config.workspaceId,\n\t\t\t\t},\n\t\t\t\t{ signal: options?.signal },\n\t\t\t);\n\t\t} catch (error) {\n\t\t\tif (isAbortError(error)) {\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t\tfactsContext = undefined;\n\t\t}\n\t}\n\tconst trigger = buildMaestroSessionRuntimeTrigger(\n\t\t{ ...input, factsContext },\n\t\tconfig.workspaceId,\n\t);\n\tif (!trigger) {\n\t\treturn null;\n\t}\n\ttry {\n\t\treturn await handleAgentRuntimeTrigger(trigger, {\n\t\t\tconfig,\n\t\t\tsignal: options?.signal,\n\t\t});\n\t} catch (error) {\n\t\tif (isAbortError(error)) {\n\t\t\tthrow error;\n\t\t}\n\t\treturn null;\n\t}\n}\n"]}
|