@evalops/maestro 0.10.8 → 0.10.10
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 +28 -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 +69 -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/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 +36 -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 +41771 -22892
- 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/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 +122 -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 +83 -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 +73 -14
- 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,253 @@
|
|
|
1
|
+
import { refreshRemoteConnection, registerRemoteConnection, revokeRemoteConnection, setRemoteSourceOfTruthPolicy, } from "../connectors/service-client.js";
|
|
2
|
+
import { loadOAuthCredentials, saveOAuthCredentials, } from "./storage.js";
|
|
3
|
+
const CONNECTOR_PROVIDER_BY_OAUTH_PROVIDER = {
|
|
4
|
+
anthropic: "x-evalops:anthropic",
|
|
5
|
+
"github-copilot": "github",
|
|
6
|
+
"google-antigravity": "google",
|
|
7
|
+
"google-gemini-cli": "google",
|
|
8
|
+
openai: "x-evalops:openai",
|
|
9
|
+
"openai-codex": "x-evalops:openai",
|
|
10
|
+
};
|
|
11
|
+
const DISPLAY_NAME_BY_OAUTH_PROVIDER = {
|
|
12
|
+
anthropic: "Anthropic OAuth",
|
|
13
|
+
"github-copilot": "GitHub Copilot OAuth",
|
|
14
|
+
"google-antigravity": "Google Antigravity OAuth",
|
|
15
|
+
"google-gemini-cli": "Google Gemini CLI OAuth",
|
|
16
|
+
openai: "OpenAI OAuth",
|
|
17
|
+
"openai-codex": "OpenAI Codex OAuth",
|
|
18
|
+
};
|
|
19
|
+
export const CONNECTOR_SOURCE_OF_TRUTH_AREAS = [
|
|
20
|
+
"analytics",
|
|
21
|
+
"billing",
|
|
22
|
+
"crm",
|
|
23
|
+
"hris",
|
|
24
|
+
"support",
|
|
25
|
+
];
|
|
26
|
+
const SOURCE_OF_TRUTH_METADATA_KEYS = [
|
|
27
|
+
"connectorSourceOfTruthArea",
|
|
28
|
+
"connectorSourceOfTruthFallbackConnectionId",
|
|
29
|
+
"connectorSourceOfTruthPrimaryConnectionId",
|
|
30
|
+
"connectorSourceOfTruthWorkspaceId",
|
|
31
|
+
"sourceOfTruthArea",
|
|
32
|
+
"sourceOfTruthFallbackConnectionId",
|
|
33
|
+
];
|
|
34
|
+
function isConnectorOAuthProvider(provider) {
|
|
35
|
+
return Object.prototype.hasOwnProperty.call(CONNECTOR_PROVIDER_BY_OAUTH_PROVIDER, provider);
|
|
36
|
+
}
|
|
37
|
+
function supportedConnectorOAuthProviders() {
|
|
38
|
+
return Object.keys(CONNECTOR_PROVIDER_BY_OAUTH_PROVIDER).sort().join(", ");
|
|
39
|
+
}
|
|
40
|
+
function trimString(value) {
|
|
41
|
+
const trimmed = value?.trim();
|
|
42
|
+
return trimmed ? trimmed : undefined;
|
|
43
|
+
}
|
|
44
|
+
export function normalizeConnectorSourceOfTruthArea(area) {
|
|
45
|
+
const normalized = area
|
|
46
|
+
.trim()
|
|
47
|
+
.toLowerCase()
|
|
48
|
+
.replace(/^source_of_truth_area_/u, "")
|
|
49
|
+
.replace(/^source-of-truth-area-/u, "")
|
|
50
|
+
.replaceAll("_", "-");
|
|
51
|
+
for (const candidate of CONNECTOR_SOURCE_OF_TRUTH_AREAS) {
|
|
52
|
+
if (candidate === normalized ||
|
|
53
|
+
candidate.replaceAll("_", "-") === normalized) {
|
|
54
|
+
return candidate;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
function isRecord(value) {
|
|
60
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
61
|
+
}
|
|
62
|
+
function getMetadataString(metadata, key) {
|
|
63
|
+
const value = metadata?.[key];
|
|
64
|
+
return typeof value === "string" && value.trim().length > 0
|
|
65
|
+
? value.trim()
|
|
66
|
+
: undefined;
|
|
67
|
+
}
|
|
68
|
+
function getMetadataStringArray(metadata, key) {
|
|
69
|
+
const value = metadata?.[key];
|
|
70
|
+
if (!Array.isArray(value)) {
|
|
71
|
+
return undefined;
|
|
72
|
+
}
|
|
73
|
+
const entries = value
|
|
74
|
+
.filter((entry) => typeof entry === "string")
|
|
75
|
+
.map((entry) => entry.trim())
|
|
76
|
+
.filter((entry) => entry.length > 0);
|
|
77
|
+
return entries.length > 0 ? entries : undefined;
|
|
78
|
+
}
|
|
79
|
+
function getMetadataStringMap(metadata, key) {
|
|
80
|
+
const value = metadata?.[key];
|
|
81
|
+
if (!isRecord(value)) {
|
|
82
|
+
return undefined;
|
|
83
|
+
}
|
|
84
|
+
const entries = Object.entries(value)
|
|
85
|
+
.map(([entryKey, entryValue]) => [
|
|
86
|
+
entryKey.trim(),
|
|
87
|
+
typeof entryValue === "string" ? entryValue.trim() : "",
|
|
88
|
+
])
|
|
89
|
+
.filter(([entryKey, entryValue]) => entryKey && entryValue);
|
|
90
|
+
return entries.length > 0 ? Object.fromEntries(entries) : undefined;
|
|
91
|
+
}
|
|
92
|
+
function mergeConnectionMetadata(credentials, connection, providerId) {
|
|
93
|
+
if (!connection) {
|
|
94
|
+
return credentials;
|
|
95
|
+
}
|
|
96
|
+
return {
|
|
97
|
+
...credentials,
|
|
98
|
+
metadata: {
|
|
99
|
+
...credentials.metadata,
|
|
100
|
+
connectorConnectionId: connection.id,
|
|
101
|
+
connectorHealthStatus: connection.healthStatus,
|
|
102
|
+
connectorProviderId: connection.providerId || providerId,
|
|
103
|
+
connectorUpdatedAt: connection.updatedAt,
|
|
104
|
+
connectorWorkspaceId: connection.workspaceId,
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
function getSourceOfTruthArea(metadata) {
|
|
109
|
+
return (getMetadataString(metadata, "connectorSourceOfTruthArea") ??
|
|
110
|
+
getMetadataString(metadata, "sourceOfTruthArea"));
|
|
111
|
+
}
|
|
112
|
+
function getSourceOfTruthFallbackConnectionId(metadata) {
|
|
113
|
+
return (getMetadataString(metadata, "connectorSourceOfTruthFallbackConnectionId") ??
|
|
114
|
+
getMetadataString(metadata, "sourceOfTruthFallbackConnectionId"));
|
|
115
|
+
}
|
|
116
|
+
function mergeSourceOfTruthPolicyMetadata(credentials, policy) {
|
|
117
|
+
if (!policy) {
|
|
118
|
+
return credentials;
|
|
119
|
+
}
|
|
120
|
+
return {
|
|
121
|
+
...credentials,
|
|
122
|
+
metadata: {
|
|
123
|
+
...credentials.metadata,
|
|
124
|
+
connectorSourceOfTruthArea: policy.area,
|
|
125
|
+
connectorSourceOfTruthPrimaryConnectionId: policy.primaryConnectionId,
|
|
126
|
+
connectorSourceOfTruthWorkspaceId: policy.workspaceId,
|
|
127
|
+
...(policy.fallbackConnectionId
|
|
128
|
+
? {
|
|
129
|
+
connectorSourceOfTruthFallbackConnectionId: policy.fallbackConnectionId,
|
|
130
|
+
}
|
|
131
|
+
: {}),
|
|
132
|
+
},
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
async function syncSourceOfTruthPolicy(credentials, connection) {
|
|
136
|
+
if (!connection) {
|
|
137
|
+
return credentials;
|
|
138
|
+
}
|
|
139
|
+
const area = getSourceOfTruthArea(credentials.metadata);
|
|
140
|
+
if (!area) {
|
|
141
|
+
return credentials;
|
|
142
|
+
}
|
|
143
|
+
const policy = await setRemoteSourceOfTruthPolicy({
|
|
144
|
+
workspaceId: connection.workspaceId,
|
|
145
|
+
area,
|
|
146
|
+
primaryConnectionId: connection.id,
|
|
147
|
+
fallbackConnectionId: getSourceOfTruthFallbackConnectionId(credentials.metadata),
|
|
148
|
+
});
|
|
149
|
+
return mergeSourceOfTruthPolicyMetadata(credentials, policy);
|
|
150
|
+
}
|
|
151
|
+
export async function syncOAuthProviderConnection(provider, credentials) {
|
|
152
|
+
if (!isConnectorOAuthProvider(provider)) {
|
|
153
|
+
return credentials;
|
|
154
|
+
}
|
|
155
|
+
const providerId = CONNECTOR_PROVIDER_BY_OAUTH_PROVIDER[provider];
|
|
156
|
+
const connectionId = getMetadataString(credentials.metadata, "connectorConnectionId");
|
|
157
|
+
if (connectionId) {
|
|
158
|
+
const connection = await refreshRemoteConnection(connectionId);
|
|
159
|
+
return syncSourceOfTruthPolicy(mergeConnectionMetadata(credentials, connection, providerId), connection);
|
|
160
|
+
}
|
|
161
|
+
const connection = await registerRemoteConnection({
|
|
162
|
+
providerId,
|
|
163
|
+
displayName: DISPLAY_NAME_BY_OAUTH_PROVIDER[provider],
|
|
164
|
+
authType: "AUTH_TYPE_OAUTH2",
|
|
165
|
+
scopes: getMetadataStringArray(credentials.metadata, "scopes"),
|
|
166
|
+
credentials: getMetadataStringMap(credentials.metadata, "connectorCredentialRefs"),
|
|
167
|
+
});
|
|
168
|
+
return syncSourceOfTruthPolicy(mergeConnectionMetadata(credentials, connection, providerId), connection);
|
|
169
|
+
}
|
|
170
|
+
export async function syncStoredOAuthProviderConnection(provider) {
|
|
171
|
+
if (!isConnectorOAuthProvider(provider)) {
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
const credentials = loadOAuthCredentials(provider);
|
|
175
|
+
if (!credentials) {
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
const synced = await syncOAuthProviderConnection(provider, credentials);
|
|
179
|
+
if (synced !== credentials) {
|
|
180
|
+
saveOAuthCredentials(provider, synced);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
export async function configureOAuthProviderSourceOfTruthPolicy(provider, input) {
|
|
184
|
+
if (!isConnectorOAuthProvider(provider)) {
|
|
185
|
+
throw new Error(`Unsupported OAuth connector provider: ${provider}. Supported providers: ${supportedConnectorOAuthProviders()}`);
|
|
186
|
+
}
|
|
187
|
+
const credentials = loadOAuthCredentials(provider);
|
|
188
|
+
if (!credentials) {
|
|
189
|
+
throw new Error(`No OAuth credentials found for ${provider}`);
|
|
190
|
+
}
|
|
191
|
+
const area = normalizeConnectorSourceOfTruthArea(input.area);
|
|
192
|
+
if (!area) {
|
|
193
|
+
throw new Error(`Unsupported source-of-truth area: ${input.area}. Valid areas: ${CONNECTOR_SOURCE_OF_TRUTH_AREAS.join(", ")}`);
|
|
194
|
+
}
|
|
195
|
+
const metadata = { ...credentials.metadata };
|
|
196
|
+
metadata.connectorSourceOfTruthArea = area;
|
|
197
|
+
delete metadata.sourceOfTruthArea;
|
|
198
|
+
delete metadata.sourceOfTruthFallbackConnectionId;
|
|
199
|
+
delete metadata.connectorSourceOfTruthPrimaryConnectionId;
|
|
200
|
+
delete metadata.connectorSourceOfTruthWorkspaceId;
|
|
201
|
+
const fallbackConnectionId = trimString(input.fallbackConnectionId);
|
|
202
|
+
if (fallbackConnectionId) {
|
|
203
|
+
metadata.connectorSourceOfTruthFallbackConnectionId = fallbackConnectionId;
|
|
204
|
+
}
|
|
205
|
+
else {
|
|
206
|
+
delete metadata.connectorSourceOfTruthFallbackConnectionId;
|
|
207
|
+
}
|
|
208
|
+
saveOAuthCredentials(provider, { ...credentials, metadata });
|
|
209
|
+
await syncStoredOAuthProviderConnection(provider);
|
|
210
|
+
const synced = loadOAuthCredentials(provider) ?? { ...credentials, metadata };
|
|
211
|
+
const syncedMetadata = synced.metadata ?? {};
|
|
212
|
+
const connectorConnectionId = getMetadataString(syncedMetadata, "connectorConnectionId");
|
|
213
|
+
const primaryConnectionId = getMetadataString(syncedMetadata, "connectorSourceOfTruthPrimaryConnectionId");
|
|
214
|
+
const workspaceId = getMetadataString(syncedMetadata, "connectorSourceOfTruthWorkspaceId");
|
|
215
|
+
return {
|
|
216
|
+
provider,
|
|
217
|
+
area,
|
|
218
|
+
...(fallbackConnectionId ? { fallbackConnectionId } : {}),
|
|
219
|
+
...(connectorConnectionId ? { connectorConnectionId } : {}),
|
|
220
|
+
...(primaryConnectionId ? { primaryConnectionId } : {}),
|
|
221
|
+
...(workspaceId ? { workspaceId } : {}),
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
export function clearOAuthProviderSourceOfTruthPolicy(provider) {
|
|
225
|
+
if (!isConnectorOAuthProvider(provider)) {
|
|
226
|
+
throw new Error(`Unsupported OAuth connector provider: ${provider}. Supported providers: ${supportedConnectorOAuthProviders()}`);
|
|
227
|
+
}
|
|
228
|
+
const credentials = loadOAuthCredentials(provider);
|
|
229
|
+
if (!credentials) {
|
|
230
|
+
throw new Error(`No OAuth credentials found for ${provider}`);
|
|
231
|
+
}
|
|
232
|
+
const metadata = { ...credentials.metadata };
|
|
233
|
+
const hadPolicyMetadata = SOURCE_OF_TRUTH_METADATA_KEYS.some((key) => key in metadata);
|
|
234
|
+
if (!hadPolicyMetadata) {
|
|
235
|
+
return false;
|
|
236
|
+
}
|
|
237
|
+
for (const key of SOURCE_OF_TRUTH_METADATA_KEYS) {
|
|
238
|
+
delete metadata[key];
|
|
239
|
+
}
|
|
240
|
+
saveOAuthCredentials(provider, { ...credentials, metadata });
|
|
241
|
+
return hadPolicyMetadata;
|
|
242
|
+
}
|
|
243
|
+
export async function revokeOAuthProviderConnection(provider, credentials) {
|
|
244
|
+
if (!isConnectorOAuthProvider(provider)) {
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
const connectionId = getMetadataString(credentials?.metadata, "connectorConnectionId");
|
|
248
|
+
if (!connectionId) {
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
await revokeRemoteConnection(connectionId);
|
|
252
|
+
}
|
|
253
|
+
//# sourceMappingURL=connectors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connectors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YAAY,EAAE,CAAC;QACnB,OAAO;IACR,CAAC;IACD,MAAM,sBAAsB,CAAC,YAAY,CAAC,CAAC;AAC5C,CAAC","sourcesContent":["import {\n\ttype RemoteConnectorConnection,\n\ttype RemoteSourceOfTruthPolicy,\n\trefreshRemoteConnection,\n\tregisterRemoteConnection,\n\trevokeRemoteConnection,\n\tsetRemoteSourceOfTruthPolicy,\n} from \"../connectors/service-client.js\";\nimport type { SupportedOAuthProvider } from \"./index.js\";\nimport {\n\ttype OAuthCredentials,\n\tloadOAuthCredentials,\n\tsaveOAuthCredentials,\n} from \"./storage.js\";\n\ntype ConnectorOAuthProvider = Exclude<SupportedOAuthProvider, \"evalops\">;\n\nconst CONNECTOR_PROVIDER_BY_OAUTH_PROVIDER: Record<\n\tConnectorOAuthProvider,\n\tstring\n> = {\n\tanthropic: \"x-evalops:anthropic\",\n\t\"github-copilot\": \"github\",\n\t\"google-antigravity\": \"google\",\n\t\"google-gemini-cli\": \"google\",\n\topenai: \"x-evalops:openai\",\n\t\"openai-codex\": \"x-evalops:openai\",\n};\n\nconst DISPLAY_NAME_BY_OAUTH_PROVIDER: Record<ConnectorOAuthProvider, string> = {\n\tanthropic: \"Anthropic OAuth\",\n\t\"github-copilot\": \"GitHub Copilot OAuth\",\n\t\"google-antigravity\": \"Google Antigravity OAuth\",\n\t\"google-gemini-cli\": \"Google Gemini CLI OAuth\",\n\topenai: \"OpenAI OAuth\",\n\t\"openai-codex\": \"OpenAI Codex OAuth\",\n};\n\nexport const CONNECTOR_SOURCE_OF_TRUTH_AREAS = [\n\t\"analytics\",\n\t\"billing\",\n\t\"crm\",\n\t\"hris\",\n\t\"support\",\n] as const;\n\nexport type ConnectorSourceOfTruthArea =\n\t(typeof CONNECTOR_SOURCE_OF_TRUTH_AREAS)[number];\n\nexport interface ConfigureOAuthProviderSourceOfTruthPolicyInput {\n\tarea: string;\n\tfallbackConnectionId?: string;\n}\n\nexport interface ConfiguredOAuthProviderSourceOfTruthPolicy {\n\tprovider: ConnectorOAuthProvider;\n\tarea: ConnectorSourceOfTruthArea;\n\tfallbackConnectionId?: string;\n\tconnectorConnectionId?: string;\n\tprimaryConnectionId?: string;\n\tworkspaceId?: string;\n}\n\nconst SOURCE_OF_TRUTH_METADATA_KEYS = [\n\t\"connectorSourceOfTruthArea\",\n\t\"connectorSourceOfTruthFallbackConnectionId\",\n\t\"connectorSourceOfTruthPrimaryConnectionId\",\n\t\"connectorSourceOfTruthWorkspaceId\",\n\t\"sourceOfTruthArea\",\n\t\"sourceOfTruthFallbackConnectionId\",\n] as const;\n\nfunction isConnectorOAuthProvider(\n\tprovider: string,\n): provider is ConnectorOAuthProvider {\n\treturn Object.prototype.hasOwnProperty.call(\n\t\tCONNECTOR_PROVIDER_BY_OAUTH_PROVIDER,\n\t\tprovider,\n\t);\n}\n\nfunction supportedConnectorOAuthProviders(): string {\n\treturn Object.keys(CONNECTOR_PROVIDER_BY_OAUTH_PROVIDER).sort().join(\", \");\n}\n\nfunction trimString(value: string | undefined): string | undefined {\n\tconst trimmed = value?.trim();\n\treturn trimmed ? trimmed : undefined;\n}\n\nexport function normalizeConnectorSourceOfTruthArea(\n\tarea: string,\n): ConnectorSourceOfTruthArea | null {\n\tconst normalized = area\n\t\t.trim()\n\t\t.toLowerCase()\n\t\t.replace(/^source_of_truth_area_/u, \"\")\n\t\t.replace(/^source-of-truth-area-/u, \"\")\n\t\t.replaceAll(\"_\", \"-\");\n\tfor (const candidate of CONNECTOR_SOURCE_OF_TRUTH_AREAS) {\n\t\tif (\n\t\t\tcandidate === normalized ||\n\t\t\tcandidate.replaceAll(\"_\", \"-\") === normalized\n\t\t) {\n\t\t\treturn candidate;\n\t\t}\n\t}\n\treturn null;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction getMetadataString(\n\tmetadata: Record<string, unknown> | undefined,\n\tkey: string,\n): string | undefined {\n\tconst value = metadata?.[key];\n\treturn typeof value === \"string\" && value.trim().length > 0\n\t\t? value.trim()\n\t\t: undefined;\n}\n\nfunction getMetadataStringArray(\n\tmetadata: Record<string, unknown> | undefined,\n\tkey: string,\n): string[] | undefined {\n\tconst value = metadata?.[key];\n\tif (!Array.isArray(value)) {\n\t\treturn undefined;\n\t}\n\tconst entries = value\n\t\t.filter((entry): entry is string => typeof entry === \"string\")\n\t\t.map((entry) => entry.trim())\n\t\t.filter((entry) => entry.length > 0);\n\treturn entries.length > 0 ? entries : undefined;\n}\n\nfunction getMetadataStringMap(\n\tmetadata: Record<string, unknown> | undefined,\n\tkey: string,\n): Record<string, string> | undefined {\n\tconst value = metadata?.[key];\n\tif (!isRecord(value)) {\n\t\treturn undefined;\n\t}\n\tconst entries = Object.entries(value)\n\t\t.map(\n\t\t\t([entryKey, entryValue]) =>\n\t\t\t\t[\n\t\t\t\t\tentryKey.trim(),\n\t\t\t\t\ttypeof entryValue === \"string\" ? entryValue.trim() : \"\",\n\t\t\t\t] as const,\n\t\t)\n\t\t.filter(([entryKey, entryValue]) => entryKey && entryValue);\n\treturn entries.length > 0 ? Object.fromEntries(entries) : undefined;\n}\n\nfunction mergeConnectionMetadata(\n\tcredentials: OAuthCredentials,\n\tconnection: RemoteConnectorConnection | null,\n\tproviderId: string,\n): OAuthCredentials {\n\tif (!connection) {\n\t\treturn credentials;\n\t}\n\treturn {\n\t\t...credentials,\n\t\tmetadata: {\n\t\t\t...credentials.metadata,\n\t\t\tconnectorConnectionId: connection.id,\n\t\t\tconnectorHealthStatus: connection.healthStatus,\n\t\t\tconnectorProviderId: connection.providerId || providerId,\n\t\t\tconnectorUpdatedAt: connection.updatedAt,\n\t\t\tconnectorWorkspaceId: connection.workspaceId,\n\t\t},\n\t};\n}\n\nfunction getSourceOfTruthArea(\n\tmetadata: Record<string, unknown> | undefined,\n): string | undefined {\n\treturn (\n\t\tgetMetadataString(metadata, \"connectorSourceOfTruthArea\") ??\n\t\tgetMetadataString(metadata, \"sourceOfTruthArea\")\n\t);\n}\n\nfunction getSourceOfTruthFallbackConnectionId(\n\tmetadata: Record<string, unknown> | undefined,\n): string | undefined {\n\treturn (\n\t\tgetMetadataString(metadata, \"connectorSourceOfTruthFallbackConnectionId\") ??\n\t\tgetMetadataString(metadata, \"sourceOfTruthFallbackConnectionId\")\n\t);\n}\n\nfunction mergeSourceOfTruthPolicyMetadata(\n\tcredentials: OAuthCredentials,\n\tpolicy: RemoteSourceOfTruthPolicy | null,\n): OAuthCredentials {\n\tif (!policy) {\n\t\treturn credentials;\n\t}\n\treturn {\n\t\t...credentials,\n\t\tmetadata: {\n\t\t\t...credentials.metadata,\n\t\t\tconnectorSourceOfTruthArea: policy.area,\n\t\t\tconnectorSourceOfTruthPrimaryConnectionId: policy.primaryConnectionId,\n\t\t\tconnectorSourceOfTruthWorkspaceId: policy.workspaceId,\n\t\t\t...(policy.fallbackConnectionId\n\t\t\t\t? {\n\t\t\t\t\t\tconnectorSourceOfTruthFallbackConnectionId:\n\t\t\t\t\t\t\tpolicy.fallbackConnectionId,\n\t\t\t\t\t}\n\t\t\t\t: {}),\n\t\t},\n\t};\n}\n\nasync function syncSourceOfTruthPolicy(\n\tcredentials: OAuthCredentials,\n\tconnection: RemoteConnectorConnection | null,\n): Promise<OAuthCredentials> {\n\tif (!connection) {\n\t\treturn credentials;\n\t}\n\tconst area = getSourceOfTruthArea(credentials.metadata);\n\tif (!area) {\n\t\treturn credentials;\n\t}\n\n\tconst policy = await setRemoteSourceOfTruthPolicy({\n\t\tworkspaceId: connection.workspaceId,\n\t\tarea,\n\t\tprimaryConnectionId: connection.id,\n\t\tfallbackConnectionId: getSourceOfTruthFallbackConnectionId(\n\t\t\tcredentials.metadata,\n\t\t),\n\t});\n\treturn mergeSourceOfTruthPolicyMetadata(credentials, policy);\n}\n\nexport async function syncOAuthProviderConnection(\n\tprovider: SupportedOAuthProvider,\n\tcredentials: OAuthCredentials,\n): Promise<OAuthCredentials> {\n\tif (!isConnectorOAuthProvider(provider)) {\n\t\treturn credentials;\n\t}\n\n\tconst providerId = CONNECTOR_PROVIDER_BY_OAUTH_PROVIDER[provider];\n\tconst connectionId = getMetadataString(\n\t\tcredentials.metadata,\n\t\t\"connectorConnectionId\",\n\t);\n\tif (connectionId) {\n\t\tconst connection = await refreshRemoteConnection(connectionId);\n\t\treturn syncSourceOfTruthPolicy(\n\t\t\tmergeConnectionMetadata(credentials, connection, providerId),\n\t\t\tconnection,\n\t\t);\n\t}\n\n\tconst connection = await registerRemoteConnection({\n\t\tproviderId,\n\t\tdisplayName: DISPLAY_NAME_BY_OAUTH_PROVIDER[provider],\n\t\tauthType: \"AUTH_TYPE_OAUTH2\",\n\t\tscopes: getMetadataStringArray(credentials.metadata, \"scopes\"),\n\t\tcredentials: getMetadataStringMap(\n\t\t\tcredentials.metadata,\n\t\t\t\"connectorCredentialRefs\",\n\t\t),\n\t});\n\treturn syncSourceOfTruthPolicy(\n\t\tmergeConnectionMetadata(credentials, connection, providerId),\n\t\tconnection,\n\t);\n}\n\nexport async function syncStoredOAuthProviderConnection(\n\tprovider: SupportedOAuthProvider,\n): Promise<void> {\n\tif (!isConnectorOAuthProvider(provider)) {\n\t\treturn;\n\t}\n\tconst credentials = loadOAuthCredentials(provider);\n\tif (!credentials) {\n\t\treturn;\n\t}\n\tconst synced = await syncOAuthProviderConnection(provider, credentials);\n\tif (synced !== credentials) {\n\t\tsaveOAuthCredentials(provider, synced);\n\t}\n}\n\nexport async function configureOAuthProviderSourceOfTruthPolicy(\n\tprovider: string,\n\tinput: ConfigureOAuthProviderSourceOfTruthPolicyInput,\n): Promise<ConfiguredOAuthProviderSourceOfTruthPolicy> {\n\tif (!isConnectorOAuthProvider(provider)) {\n\t\tthrow new Error(\n\t\t\t`Unsupported OAuth connector provider: ${provider}. Supported providers: ${supportedConnectorOAuthProviders()}`,\n\t\t);\n\t}\n\tconst credentials = loadOAuthCredentials(provider);\n\tif (!credentials) {\n\t\tthrow new Error(`No OAuth credentials found for ${provider}`);\n\t}\n\tconst area = normalizeConnectorSourceOfTruthArea(input.area);\n\tif (!area) {\n\t\tthrow new Error(\n\t\t\t`Unsupported source-of-truth area: ${input.area}. Valid areas: ${CONNECTOR_SOURCE_OF_TRUTH_AREAS.join(\", \")}`,\n\t\t);\n\t}\n\n\tconst metadata: Record<string, unknown> = { ...credentials.metadata };\n\tmetadata.connectorSourceOfTruthArea = area;\n\tdelete metadata.sourceOfTruthArea;\n\tdelete metadata.sourceOfTruthFallbackConnectionId;\n\tdelete metadata.connectorSourceOfTruthPrimaryConnectionId;\n\tdelete metadata.connectorSourceOfTruthWorkspaceId;\n\n\tconst fallbackConnectionId = trimString(input.fallbackConnectionId);\n\tif (fallbackConnectionId) {\n\t\tmetadata.connectorSourceOfTruthFallbackConnectionId = fallbackConnectionId;\n\t} else {\n\t\tdelete metadata.connectorSourceOfTruthFallbackConnectionId;\n\t}\n\n\tsaveOAuthCredentials(provider, { ...credentials, metadata });\n\tawait syncStoredOAuthProviderConnection(provider);\n\n\tconst synced = loadOAuthCredentials(provider) ?? { ...credentials, metadata };\n\tconst syncedMetadata = synced.metadata ?? {};\n\tconst connectorConnectionId = getMetadataString(\n\t\tsyncedMetadata,\n\t\t\"connectorConnectionId\",\n\t);\n\tconst primaryConnectionId = getMetadataString(\n\t\tsyncedMetadata,\n\t\t\"connectorSourceOfTruthPrimaryConnectionId\",\n\t);\n\tconst workspaceId = getMetadataString(\n\t\tsyncedMetadata,\n\t\t\"connectorSourceOfTruthWorkspaceId\",\n\t);\n\treturn {\n\t\tprovider,\n\t\tarea,\n\t\t...(fallbackConnectionId ? { fallbackConnectionId } : {}),\n\t\t...(connectorConnectionId ? { connectorConnectionId } : {}),\n\t\t...(primaryConnectionId ? { primaryConnectionId } : {}),\n\t\t...(workspaceId ? { workspaceId } : {}),\n\t};\n}\n\nexport function clearOAuthProviderSourceOfTruthPolicy(\n\tprovider: string,\n): boolean {\n\tif (!isConnectorOAuthProvider(provider)) {\n\t\tthrow new Error(\n\t\t\t`Unsupported OAuth connector provider: ${provider}. Supported providers: ${supportedConnectorOAuthProviders()}`,\n\t\t);\n\t}\n\tconst credentials = loadOAuthCredentials(provider);\n\tif (!credentials) {\n\t\tthrow new Error(`No OAuth credentials found for ${provider}`);\n\t}\n\n\tconst metadata: Record<string, unknown> = { ...credentials.metadata };\n\tconst hadPolicyMetadata = SOURCE_OF_TRUTH_METADATA_KEYS.some(\n\t\t(key) => key in metadata,\n\t);\n\tif (!hadPolicyMetadata) {\n\t\treturn false;\n\t}\n\tfor (const key of SOURCE_OF_TRUTH_METADATA_KEYS) {\n\t\tdelete metadata[key];\n\t}\n\tsaveOAuthCredentials(provider, { ...credentials, metadata });\n\treturn hadPolicyMetadata;\n}\n\nexport async function revokeOAuthProviderConnection(\n\tprovider: SupportedOAuthProvider,\n\tcredentials: OAuthCredentials | null,\n): Promise<void> {\n\tif (!isConnectorOAuthProvider(provider)) {\n\t\treturn;\n\t}\n\tconst connectionId = getMetadataString(\n\t\tcredentials?.metadata,\n\t\t\"connectorConnectionId\",\n\t);\n\tif (!connectionId) {\n\t\treturn;\n\t}\n\tawait revokeRemoteConnection(connectionId);\n}\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface DeviceIdentityStatus {
|
|
2
|
+
available: boolean;
|
|
3
|
+
device_id?: string;
|
|
4
|
+
error?: string;
|
|
5
|
+
key_algorithm?: string;
|
|
6
|
+
key_origin?: string;
|
|
7
|
+
public_key_spki?: string;
|
|
8
|
+
signature?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface DeviceProof {
|
|
11
|
+
challenge_id: string;
|
|
12
|
+
device_id: string;
|
|
13
|
+
signature: string;
|
|
14
|
+
}
|
|
15
|
+
export declare function getDesktopDeviceIdentityStatus(): Promise<DeviceIdentityStatus | null>;
|
|
16
|
+
export declare function buildDesktopDeviceProof(identityBaseUrl: string, purpose: "refresh" | "delegation" | "verify"): Promise<DeviceProof | null>;
|
|
17
|
+
export declare function enrollDesktopDeviceIdentity(identityBaseUrl: string, accessToken: string, appVersion?: string): Promise<string | null>;
|
|
18
|
+
//# sourceMappingURL=device-identity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"device-identity.d.ts","sourceRoot":"","sources":["../../src/oauth/device-identity.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,oBAAoB;IACpC,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,WAAW;IAC3B,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CAClB;AA6ED,wBAAsB,8BAA8B,IAAI,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,CAE3F;AAuDD,wBAAsB,uBAAuB,CAC5C,eAAe,EAAE,MAAM,EACvB,OAAO,EAAE,SAAS,GAAG,YAAY,GAAG,QAAQ,GAC1C,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CAsB7B;AAED,wBAAsB,2BAA2B,CAChD,eAAe,EAAE,MAAM,EACvB,WAAW,EAAE,MAAM,EACnB,UAAU,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CA+DxB"}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
import { constants, access } from "node:fs/promises";
|
|
3
|
+
import { PLATFORM_HTTP_ROUTES } from "../platform/core-services.js";
|
|
4
|
+
import { fetchDownstream } from "../utils/downstream-http.js";
|
|
5
|
+
const DEFAULT_TIMEOUT_MS = 10_000;
|
|
6
|
+
function getHelperPath() {
|
|
7
|
+
const value = process.env.MAESTRO_DEVICE_IDENTITY_HELPER?.trim();
|
|
8
|
+
if (!value) {
|
|
9
|
+
return undefined;
|
|
10
|
+
}
|
|
11
|
+
if (process.platform === "darwin") {
|
|
12
|
+
return value;
|
|
13
|
+
}
|
|
14
|
+
return process.env.NODE_ENV === "test" &&
|
|
15
|
+
process.env.MAESTRO_DEVICE_IDENTITY_ALLOW_TEST_HELPER === "1"
|
|
16
|
+
? value
|
|
17
|
+
: undefined;
|
|
18
|
+
}
|
|
19
|
+
async function helperExists(helperPath) {
|
|
20
|
+
try {
|
|
21
|
+
await access(helperPath, constants.X_OK);
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function isAbortError(error) {
|
|
29
|
+
return error instanceof Error && error.name === "AbortError";
|
|
30
|
+
}
|
|
31
|
+
async function runHelper(request) {
|
|
32
|
+
const helperPath = getHelperPath();
|
|
33
|
+
if (!helperPath || !(await helperExists(helperPath))) {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
return new Promise((resolve) => {
|
|
37
|
+
const child = spawn(helperPath, [], {
|
|
38
|
+
stdio: ["pipe", "pipe", "ignore"],
|
|
39
|
+
env: { ...process.env },
|
|
40
|
+
});
|
|
41
|
+
let stdout = "";
|
|
42
|
+
const timeout = setTimeout(() => {
|
|
43
|
+
child.kill("SIGKILL");
|
|
44
|
+
resolve(null);
|
|
45
|
+
}, DEFAULT_TIMEOUT_MS);
|
|
46
|
+
child.stdout.setEncoding("utf8");
|
|
47
|
+
child.stdout.on("data", (chunk) => {
|
|
48
|
+
stdout += chunk;
|
|
49
|
+
});
|
|
50
|
+
child.on("error", () => {
|
|
51
|
+
clearTimeout(timeout);
|
|
52
|
+
resolve(null);
|
|
53
|
+
});
|
|
54
|
+
child.on("close", () => {
|
|
55
|
+
clearTimeout(timeout);
|
|
56
|
+
try {
|
|
57
|
+
resolve(JSON.parse(stdout));
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
resolve(null);
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
child.stdin.end(JSON.stringify(request));
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
export async function getDesktopDeviceIdentityStatus() {
|
|
67
|
+
return runHelper({ command: "status" });
|
|
68
|
+
}
|
|
69
|
+
async function signDeviceChallenge(challenge) {
|
|
70
|
+
const response = await runHelper({ command: "sign", challenge });
|
|
71
|
+
if (!response?.available || !response.device_id || !response.signature) {
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
return response;
|
|
75
|
+
}
|
|
76
|
+
async function createDeviceChallenge(identityBaseUrl, purpose, deviceId) {
|
|
77
|
+
let response;
|
|
78
|
+
try {
|
|
79
|
+
response = await fetchDownstream(`${identityBaseUrl}${PLATFORM_HTTP_ROUTES.identity.deviceChallenges}`, {
|
|
80
|
+
method: "POST",
|
|
81
|
+
headers: { "Content-Type": "application/json" },
|
|
82
|
+
body: JSON.stringify({
|
|
83
|
+
purpose,
|
|
84
|
+
...(deviceId ? { device_id: deviceId } : {}),
|
|
85
|
+
}),
|
|
86
|
+
}, {
|
|
87
|
+
serviceName: "EvalOps identity service",
|
|
88
|
+
failureMode: "optional",
|
|
89
|
+
timeoutMs: DEFAULT_TIMEOUT_MS,
|
|
90
|
+
maxAttempts: 1,
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
catch (error) {
|
|
94
|
+
if (isAbortError(error)) {
|
|
95
|
+
throw error;
|
|
96
|
+
}
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
if (!response.ok) {
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
try {
|
|
103
|
+
return (await response.json());
|
|
104
|
+
}
|
|
105
|
+
catch (error) {
|
|
106
|
+
if (isAbortError(error)) {
|
|
107
|
+
throw error;
|
|
108
|
+
}
|
|
109
|
+
return null;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
export async function buildDesktopDeviceProof(identityBaseUrl, purpose) {
|
|
113
|
+
const status = await getDesktopDeviceIdentityStatus();
|
|
114
|
+
if (!status?.available || !status.device_id) {
|
|
115
|
+
return null;
|
|
116
|
+
}
|
|
117
|
+
const challenge = await createDeviceChallenge(identityBaseUrl, purpose, status.device_id);
|
|
118
|
+
if (!challenge?.challenge || !challenge.challenge_id) {
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
121
|
+
const signed = await signDeviceChallenge(challenge.challenge);
|
|
122
|
+
if (!signed?.device_id || !signed.signature) {
|
|
123
|
+
return null;
|
|
124
|
+
}
|
|
125
|
+
return {
|
|
126
|
+
challenge_id: challenge.challenge_id,
|
|
127
|
+
device_id: signed.device_id,
|
|
128
|
+
signature: signed.signature,
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
export async function enrollDesktopDeviceIdentity(identityBaseUrl, accessToken, appVersion) {
|
|
132
|
+
const status = await getDesktopDeviceIdentityStatus();
|
|
133
|
+
if (!status?.available || !status.public_key_spki) {
|
|
134
|
+
return null;
|
|
135
|
+
}
|
|
136
|
+
const challenge = await createDeviceChallenge(identityBaseUrl, "enroll");
|
|
137
|
+
if (!challenge?.challenge || !challenge.challenge_id) {
|
|
138
|
+
return null;
|
|
139
|
+
}
|
|
140
|
+
const signed = await signDeviceChallenge(challenge.challenge);
|
|
141
|
+
if (!signed?.device_id || !signed.signature) {
|
|
142
|
+
return null;
|
|
143
|
+
}
|
|
144
|
+
let response;
|
|
145
|
+
try {
|
|
146
|
+
response = await fetchDownstream(`${identityBaseUrl}${PLATFORM_HTTP_ROUTES.identity.devices}`, {
|
|
147
|
+
method: "POST",
|
|
148
|
+
headers: {
|
|
149
|
+
Authorization: `Bearer ${accessToken}`,
|
|
150
|
+
"Content-Type": "application/json",
|
|
151
|
+
},
|
|
152
|
+
body: JSON.stringify({
|
|
153
|
+
app_bundle_id: "com.evalops.composer",
|
|
154
|
+
app_version: appVersion,
|
|
155
|
+
attestation_kind: "none",
|
|
156
|
+
attestation_status: "unverified",
|
|
157
|
+
challenge_id: challenge.challenge_id,
|
|
158
|
+
device_id: signed.device_id,
|
|
159
|
+
key_algorithm: status.key_algorithm ?? "p256_ecdsa_sha256",
|
|
160
|
+
key_origin: status.key_origin ?? "secure_enclave",
|
|
161
|
+
platform: "macos",
|
|
162
|
+
public_key_spki: status.public_key_spki,
|
|
163
|
+
signature: signed.signature,
|
|
164
|
+
}),
|
|
165
|
+
}, {
|
|
166
|
+
serviceName: "EvalOps identity service",
|
|
167
|
+
failureMode: "optional",
|
|
168
|
+
timeoutMs: DEFAULT_TIMEOUT_MS,
|
|
169
|
+
maxAttempts: 1,
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
catch (error) {
|
|
173
|
+
if (isAbortError(error)) {
|
|
174
|
+
throw error;
|
|
175
|
+
}
|
|
176
|
+
return null;
|
|
177
|
+
}
|
|
178
|
+
if (!response.ok) {
|
|
179
|
+
return null;
|
|
180
|
+
}
|
|
181
|
+
let payload;
|
|
182
|
+
try {
|
|
183
|
+
payload = (await response.json());
|
|
184
|
+
}
|
|
185
|
+
catch (error) {
|
|
186
|
+
if (isAbortError(error)) {
|
|
187
|
+
throw error;
|
|
188
|
+
}
|
|
189
|
+
return null;
|
|
190
|
+
}
|
|
191
|
+
return payload.device?.id ?? signed.device_id;
|
|
192
|
+
}
|
|
193
|
+
//# sourceMappingURL=device-identity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"device-identity.js","sourceRoot":"","sources":["../../src/oauth/device-identity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAE9D,MAAM,kBAAkB,GA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,OAA2C,CAAC;IAChD,IAAI,CAAC;QACJ,OAAO,GAAG,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAA2B,CAAC;IAC7D,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;IACD,OAAO,OAAO,CAAC,MAAM,EAAE,EAAE,IAAI,MAAM,CAAC,SAAS,CAAC;AAC/C,CAAC","sourcesContent":["import { spawn } from \"node:child_process\";\nimport { constants, access } from \"node:fs/promises\";\nimport { PLATFORM_HTTP_ROUTES } from \"../platform/core-services.js\";\nimport { fetchDownstream } from \"../utils/downstream-http.js\";\n\nconst DEFAULT_TIMEOUT_MS = 10_000;\n\nexport interface DeviceIdentityStatus {\n\tavailable: boolean;\n\tdevice_id?: string;\n\terror?: string;\n\tkey_algorithm?: string;\n\tkey_origin?: string;\n\tpublic_key_spki?: string;\n\tsignature?: string;\n}\n\nexport interface DeviceProof {\n\tchallenge_id: string;\n\tdevice_id: string;\n\tsignature: string;\n}\n\ninterface DeviceChallengeResponse {\n\tchallenge?: string;\n\tchallenge_id?: string;\n\terror?: string;\n}\n\ninterface RegisterDeviceResponse {\n\tdevice?: { id?: string };\n\terror?: string;\n}\n\nfunction getHelperPath(): string | undefined {\n\tconst value = process.env.MAESTRO_DEVICE_IDENTITY_HELPER?.trim();\n\tif (!value) {\n\t\treturn undefined;\n\t}\n\tif (process.platform === \"darwin\") {\n\t\treturn value;\n\t}\n\treturn process.env.NODE_ENV === \"test\" &&\n\t\tprocess.env.MAESTRO_DEVICE_IDENTITY_ALLOW_TEST_HELPER === \"1\"\n\t\t? value\n\t\t: undefined;\n}\n\nasync function helperExists(helperPath: string): Promise<boolean> {\n\ttry {\n\t\tawait access(helperPath, constants.X_OK);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nfunction isAbortError(error: unknown): boolean {\n\treturn error instanceof Error && error.name === \"AbortError\";\n}\n\nasync function runHelper(\n\trequest: Record<string, unknown>,\n): Promise<DeviceIdentityStatus | null> {\n\tconst helperPath = getHelperPath();\n\tif (!helperPath || !(await helperExists(helperPath))) {\n\t\treturn null;\n\t}\n\treturn new Promise((resolve) => {\n\t\tconst child = spawn(helperPath, [], {\n\t\t\tstdio: [\"pipe\", \"pipe\", \"ignore\"],\n\t\t\tenv: { ...process.env },\n\t\t});\n\t\tlet stdout = \"\";\n\t\tconst timeout = setTimeout(() => {\n\t\t\tchild.kill(\"SIGKILL\");\n\t\t\tresolve(null);\n\t\t}, DEFAULT_TIMEOUT_MS);\n\t\tchild.stdout.setEncoding(\"utf8\");\n\t\tchild.stdout.on(\"data\", (chunk) => {\n\t\t\tstdout += chunk;\n\t\t});\n\t\tchild.on(\"error\", () => {\n\t\t\tclearTimeout(timeout);\n\t\t\tresolve(null);\n\t\t});\n\t\tchild.on(\"close\", () => {\n\t\t\tclearTimeout(timeout);\n\t\t\ttry {\n\t\t\t\tresolve(JSON.parse(stdout) as DeviceIdentityStatus);\n\t\t\t} catch {\n\t\t\t\tresolve(null);\n\t\t\t}\n\t\t});\n\t\tchild.stdin.end(JSON.stringify(request));\n\t});\n}\n\nexport async function getDesktopDeviceIdentityStatus(): Promise<DeviceIdentityStatus | null> {\n\treturn runHelper({ command: \"status\" });\n}\n\nasync function signDeviceChallenge(\n\tchallenge: string,\n): Promise<DeviceIdentityStatus | null> {\n\tconst response = await runHelper({ command: \"sign\", challenge });\n\tif (!response?.available || !response.device_id || !response.signature) {\n\t\treturn null;\n\t}\n\treturn response;\n}\n\nasync function createDeviceChallenge(\n\tidentityBaseUrl: string,\n\tpurpose: string,\n\tdeviceId?: string,\n): Promise<DeviceChallengeResponse | null> {\n\tlet response: Response;\n\ttry {\n\t\tresponse = await fetchDownstream(\n\t\t\t`${identityBaseUrl}${PLATFORM_HTTP_ROUTES.identity.deviceChallenges}`,\n\t\t\t{\n\t\t\t\tmethod: \"POST\",\n\t\t\t\theaders: { \"Content-Type\": \"application/json\" },\n\t\t\t\tbody: JSON.stringify({\n\t\t\t\t\tpurpose,\n\t\t\t\t\t...(deviceId ? { device_id: deviceId } : {}),\n\t\t\t\t}),\n\t\t\t},\n\t\t\t{\n\t\t\t\tserviceName: \"EvalOps identity service\",\n\t\t\t\tfailureMode: \"optional\",\n\t\t\t\ttimeoutMs: DEFAULT_TIMEOUT_MS,\n\t\t\t\tmaxAttempts: 1,\n\t\t\t},\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\tif (!response.ok) {\n\t\treturn null;\n\t}\n\ttry {\n\t\treturn (await response.json()) as DeviceChallengeResponse;\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\nexport async function buildDesktopDeviceProof(\n\tidentityBaseUrl: string,\n\tpurpose: \"refresh\" | \"delegation\" | \"verify\",\n): Promise<DeviceProof | null> {\n\tconst status = await getDesktopDeviceIdentityStatus();\n\tif (!status?.available || !status.device_id) {\n\t\treturn null;\n\t}\n\tconst challenge = await createDeviceChallenge(\n\t\tidentityBaseUrl,\n\t\tpurpose,\n\t\tstatus.device_id,\n\t);\n\tif (!challenge?.challenge || !challenge.challenge_id) {\n\t\treturn null;\n\t}\n\tconst signed = await signDeviceChallenge(challenge.challenge);\n\tif (!signed?.device_id || !signed.signature) {\n\t\treturn null;\n\t}\n\treturn {\n\t\tchallenge_id: challenge.challenge_id,\n\t\tdevice_id: signed.device_id,\n\t\tsignature: signed.signature,\n\t};\n}\n\nexport async function enrollDesktopDeviceIdentity(\n\tidentityBaseUrl: string,\n\taccessToken: string,\n\tappVersion?: string,\n): Promise<string | null> {\n\tconst status = await getDesktopDeviceIdentityStatus();\n\tif (!status?.available || !status.public_key_spki) {\n\t\treturn null;\n\t}\n\tconst challenge = await createDeviceChallenge(identityBaseUrl, \"enroll\");\n\tif (!challenge?.challenge || !challenge.challenge_id) {\n\t\treturn null;\n\t}\n\tconst signed = await signDeviceChallenge(challenge.challenge);\n\tif (!signed?.device_id || !signed.signature) {\n\t\treturn null;\n\t}\n\tlet response: Response;\n\ttry {\n\t\tresponse = await fetchDownstream(\n\t\t\t`${identityBaseUrl}${PLATFORM_HTTP_ROUTES.identity.devices}`,\n\t\t\t{\n\t\t\t\tmethod: \"POST\",\n\t\t\t\theaders: {\n\t\t\t\t\tAuthorization: `Bearer ${accessToken}`,\n\t\t\t\t\t\"Content-Type\": \"application/json\",\n\t\t\t\t},\n\t\t\t\tbody: JSON.stringify({\n\t\t\t\t\tapp_bundle_id: \"com.evalops.composer\",\n\t\t\t\t\tapp_version: appVersion,\n\t\t\t\t\tattestation_kind: \"none\",\n\t\t\t\t\tattestation_status: \"unverified\",\n\t\t\t\t\tchallenge_id: challenge.challenge_id,\n\t\t\t\t\tdevice_id: signed.device_id,\n\t\t\t\t\tkey_algorithm: status.key_algorithm ?? \"p256_ecdsa_sha256\",\n\t\t\t\t\tkey_origin: status.key_origin ?? \"secure_enclave\",\n\t\t\t\t\tplatform: \"macos\",\n\t\t\t\t\tpublic_key_spki: status.public_key_spki,\n\t\t\t\t\tsignature: signed.signature,\n\t\t\t\t}),\n\t\t\t},\n\t\t\t{\n\t\t\t\tserviceName: \"EvalOps identity service\",\n\t\t\t\tfailureMode: \"optional\",\n\t\t\t\ttimeoutMs: DEFAULT_TIMEOUT_MS,\n\t\t\t\tmaxAttempts: 1,\n\t\t\t},\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\tif (!response.ok) {\n\t\treturn null;\n\t}\n\tlet payload: RegisterDeviceResponse | undefined;\n\ttry {\n\t\tpayload = (await response.json()) as RegisterDeviceResponse;\n\t} catch (error) {\n\t\tif (isAbortError(error)) {\n\t\t\tthrow error;\n\t\t}\n\t\treturn null;\n\t}\n\treturn payload.device?.id ?? signed.device_id;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evalops.d.ts","sourceRoot":"","sources":["../../src/oauth/evalops.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"evalops.d.ts","sourceRoot":"","sources":["../../src/oauth/evalops.ts"],"names":[],"mappings":"AAaA,OAAO,EACN,KAAK,gBAAgB,EAGrB,MAAM,cAAc,CAAC;AAwDtB,MAAM,WAAW,kBAAkB;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB;AAWD,MAAM,WAAW,6BAA6B;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,4BAA4B;IAC5C,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,kBAAkB,CAAC;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CAClB;AAmPD,wBAAgB,iCAAiC,CAChD,MAAM,EAAE,IAAI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