@evalops/maestro 0.10.8 → 0.10.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/dist/agent/action-approval.d.ts +6 -0
- package/dist/agent/action-approval.d.ts.map +1 -1
- package/dist/agent/action-approval.js.map +1 -1
- package/dist/agent/agent.d.ts +13 -1
- package/dist/agent/agent.d.ts.map +1 -1
- package/dist/agent/agent.js +368 -1
- package/dist/agent/agent.js.map +1 -1
- package/dist/agent/auto-compaction.d.ts +4 -4
- package/dist/agent/auto-compaction.d.ts.map +1 -1
- package/dist/agent/auto-compaction.js.map +1 -1
- package/dist/agent/compaction-cleanup.d.ts +2 -0
- package/dist/agent/compaction-cleanup.d.ts.map +1 -1
- package/dist/agent/compaction-cleanup.js +17 -2
- package/dist/agent/compaction-cleanup.js.map +1 -1
- package/dist/agent/compaction.d.ts +3 -1
- package/dist/agent/compaction.d.ts.map +1 -1
- package/dist/agent/compaction.js +10 -2
- package/dist/agent/compaction.js.map +1 -1
- package/dist/agent/context-manager.d.ts +4 -0
- package/dist/agent/context-manager.d.ts.map +1 -1
- package/dist/agent/context-manager.js +8 -0
- package/dist/agent/context-manager.js.map +1 -1
- package/dist/agent/context-providers.d.ts +2 -0
- package/dist/agent/context-providers.d.ts.map +1 -1
- package/dist/agent/context-providers.js +3 -2
- package/dist/agent/context-providers.js.map +1 -1
- package/dist/agent/providers/google-gemini-cli.js +17 -5
- package/dist/agent/providers/google.js +174 -144
- package/dist/agent/providers/openai-codex-responses.d.ts +4 -0
- package/dist/agent/providers/openai-codex-responses.d.ts.map +1 -0
- package/dist/agent/providers/openai-codex-responses.js +637 -0
- package/dist/agent/providers/openai-codex-responses.js.map +1 -0
- package/dist/agent/providers/openai-codex-session.d.ts +18 -0
- package/dist/agent/providers/openai-codex-session.d.ts.map +1 -0
- package/dist/agent/providers/openai-codex-session.js +53 -0
- package/dist/agent/providers/openai-codex-session.js.map +1 -0
- package/dist/agent/providers/openai-responses-sdk.d.ts.map +1 -1
- package/dist/agent/providers/openai-responses-sdk.js +16 -6
- package/dist/agent/providers/openai-responses-sdk.js.map +1 -1
- package/dist/agent/providers/openai-shared.d.ts +12 -5
- package/dist/agent/providers/openai-shared.d.ts.map +1 -1
- package/dist/agent/providers/openai-shared.js +291 -2
- package/dist/agent/providers/openai-shared.js.map +1 -1
- package/dist/agent/providers/openai.d.ts +1 -1
- package/dist/agent/providers/openai.d.ts.map +1 -1
- package/dist/agent/providers/openai.js +48 -20
- package/dist/agent/providers/openai.js.map +1 -1
- package/dist/agent/providers/vertex.js +7 -0
- package/dist/agent/tracing.d.ts +16 -5
- package/dist/agent/tracing.d.ts.map +1 -1
- package/dist/agent/tracing.js +44 -2
- package/dist/agent/tracing.js.map +1 -1
- package/dist/agent/transport/create-provider-stream.d.ts.map +1 -1
- package/dist/agent/transport/create-provider-stream.js +9 -0
- package/dist/agent/transport/create-provider-stream.js.map +1 -1
- package/dist/agent/transport/tool-execution-bridge.d.ts +86 -0
- package/dist/agent/transport/tool-execution-bridge.d.ts.map +1 -0
- package/dist/agent/transport/tool-execution-bridge.js +665 -0
- package/dist/agent/transport/tool-execution-bridge.js.map +1 -0
- package/dist/agent/transport/tool-execution.d.ts +3 -0
- package/dist/agent/transport/tool-execution.d.ts.map +1 -1
- package/dist/agent/transport/tool-execution.js +16 -1
- package/dist/agent/transport/tool-execution.js.map +1 -1
- package/dist/agent/transport/tool-safety-pipeline.d.ts +7 -1
- package/dist/agent/transport/tool-safety-pipeline.d.ts.map +1 -1
- package/dist/agent/transport/tool-safety-pipeline.js +207 -40
- package/dist/agent/transport/tool-safety-pipeline.js.map +1 -1
- package/dist/agent/transport/tool-update-queue.d.ts +2 -0
- package/dist/agent/transport/tool-update-queue.d.ts.map +1 -1
- package/dist/agent/transport/tool-update-queue.js.map +1 -1
- package/dist/agent/transport.d.ts +3 -0
- package/dist/agent/transport.d.ts.map +1 -1
- package/dist/agent/transport.js +96 -16
- package/dist/agent/transport.js.map +1 -1
- package/dist/agent/types.d.ts +50 -2
- package/dist/agent/types.d.ts.map +1 -1
- package/dist/agent/types.js.map +1 -1
- package/dist/approvals/platform-action-approval.d.ts +32 -0
- package/dist/approvals/platform-action-approval.d.ts.map +1 -0
- package/dist/approvals/platform-action-approval.js +210 -0
- package/dist/approvals/platform-action-approval.js.map +1 -0
- package/dist/approvals/service-client.d.ts +56 -0
- package/dist/approvals/service-client.d.ts.map +1 -0
- package/dist/approvals/service-client.js +316 -0
- package/dist/approvals/service-client.js.map +1 -0
- package/dist/audit/logger.d.ts +4 -4
- package/dist/bootstrap/auth-setup.d.ts +2 -2
- package/dist/bootstrap/auth-setup.d.ts.map +1 -1
- package/dist/bootstrap/auth-setup.js +4 -7
- package/dist/bootstrap/auth-setup.js.map +1 -1
- package/dist/cli/args.d.ts +2 -0
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +29 -0
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/commands/codex.d.ts +2 -0
- package/dist/cli/commands/codex.d.ts.map +1 -0
- package/dist/cli/commands/codex.js +65 -0
- package/dist/cli/commands/codex.js.map +1 -0
- package/dist/cli/commands/config.js +1 -1
- package/dist/cli/commands/config.js.map +1 -1
- package/dist/cli/commands/evalops.d.ts +2 -0
- package/dist/cli/commands/evalops.d.ts.map +1 -0
- package/dist/cli/commands/evalops.js +74 -0
- package/dist/cli/commands/evalops.js.map +1 -0
- package/dist/cli/commands/hosted-runner.d.ts +23 -0
- package/dist/cli/commands/hosted-runner.d.ts.map +1 -0
- package/dist/cli/commands/hosted-runner.js +241 -0
- package/dist/cli/commands/hosted-runner.js.map +1 -0
- package/dist/cli/commands/init.d.ts +4 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +140 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/commands/memory.d.ts.map +1 -1
- package/dist/cli/commands/memory.js +23 -30
- package/dist/cli/commands/memory.js.map +1 -1
- package/dist/cli/commands/remote.d.ts +3 -0
- package/dist/cli/commands/remote.d.ts.map +1 -0
- package/dist/cli/commands/remote.js +631 -0
- package/dist/cli/commands/remote.js.map +1 -0
- package/dist/cli/commands/stats.d.ts +7 -0
- package/dist/cli/commands/stats.d.ts.map +1 -0
- package/dist/cli/commands/stats.js +167 -0
- package/dist/cli/commands/stats.js.map +1 -0
- package/dist/cli/headless-protocol.d.ts +16 -1
- package/dist/cli/headless-protocol.d.ts.map +1 -1
- package/dist/cli/headless-protocol.js +60 -4
- package/dist/cli/headless-protocol.js.map +1 -1
- package/dist/cli/headless.d.ts.map +1 -1
- package/dist/cli/headless.js +1 -0
- package/dist/cli/headless.js.map +1 -1
- package/dist/cli/help.d.ts.map +1 -1
- package/dist/cli/help.js +44 -1
- package/dist/cli/help.js.map +1 -1
- package/dist/cli/jsonl-writer.d.ts.map +1 -1
- package/dist/cli/jsonl-writer.js +19 -6
- package/dist/cli/jsonl-writer.js.map +1 -1
- package/dist/cli-tui/client-tools/client-tool-controller.d.ts.map +1 -1
- package/dist/cli-tui/client-tools/client-tool-controller.js +17 -1
- package/dist/cli-tui/client-tools/client-tool-controller.js.map +1 -1
- package/dist/cli-tui/commands/access-command.js +1 -1
- package/dist/cli-tui/commands/access-command.js.map +1 -1
- package/dist/cli-tui/commands/audit-command.js +1 -1
- package/dist/cli-tui/commands/audit-command.js.map +1 -1
- package/dist/cli-tui/commands/command-catalog.d.ts +29 -0
- package/dist/cli-tui/commands/command-catalog.d.ts.map +1 -0
- package/dist/cli-tui/commands/command-catalog.js +645 -0
- package/dist/cli-tui/commands/command-catalog.js.map +1 -0
- package/dist/cli-tui/commands/command-registry-adapter.d.ts +12 -0
- package/dist/cli-tui/commands/command-registry-adapter.d.ts.map +1 -0
- package/dist/cli-tui/commands/command-registry-adapter.js +120 -0
- package/dist/cli-tui/commands/command-registry-adapter.js.map +1 -0
- package/dist/cli-tui/commands/command-suite-catalog.d.ts +14 -0
- package/dist/cli-tui/commands/command-suite-catalog.d.ts.map +1 -0
- package/dist/cli-tui/commands/command-suite-catalog.js +147 -0
- package/dist/cli-tui/commands/command-suite-catalog.js.map +1 -0
- package/dist/cli-tui/commands/{grouped-command-handlers.d.ts → command-suite-handlers.d.ts} +27 -26
- package/dist/cli-tui/commands/command-suite-handlers.d.ts.map +1 -0
- package/dist/cli-tui/commands/command-suite-handlers.js +110 -0
- package/dist/cli-tui/commands/command-suite-handlers.js.map +1 -0
- package/dist/cli-tui/commands/hotkeys-command.d.ts +1 -1
- package/dist/cli-tui/commands/hotkeys-command.d.ts.map +1 -1
- package/dist/cli-tui/commands/hotkeys-command.js +2 -2
- package/dist/cli-tui/commands/hotkeys-command.js.map +1 -1
- package/dist/cli-tui/commands/limits-command.js +1 -1
- package/dist/cli-tui/commands/limits-command.js.map +1 -1
- package/dist/cli-tui/commands/pii-command.js +1 -1
- package/dist/cli-tui/commands/pii-command.js.map +1 -1
- package/dist/cli-tui/commands/registry.d.ts +1 -1
- package/dist/cli-tui/commands/registry.d.ts.map +1 -1
- package/dist/cli-tui/commands/registry.js +29 -921
- package/dist/cli-tui/commands/registry.js.map +1 -1
- package/dist/cli-tui/commands/{grouped → subcommands}/auth-commands.d.ts +2 -1
- package/dist/cli-tui/commands/subcommands/auth-commands.d.ts.map +1 -0
- package/dist/cli-tui/commands/{grouped → subcommands}/auth-commands.js +22 -6
- package/dist/cli-tui/commands/subcommands/auth-commands.js.map +1 -0
- package/dist/cli-tui/commands/{grouped → subcommands}/config-commands.d.ts +0 -1
- package/dist/cli-tui/commands/subcommands/config-commands.d.ts.map +1 -0
- package/dist/cli-tui/commands/{grouped → subcommands}/config-commands.js +2 -2
- package/dist/cli-tui/commands/subcommands/config-commands.js.map +1 -0
- package/dist/cli-tui/commands/{grouped → subcommands}/diag-commands.d.ts +1 -2
- package/dist/cli-tui/commands/subcommands/diag-commands.d.ts.map +1 -0
- package/dist/cli-tui/commands/{grouped → subcommands}/diag-commands.js +5 -7
- package/dist/cli-tui/commands/subcommands/diag-commands.js.map +1 -0
- package/dist/cli-tui/commands/{grouped → subcommands}/git-commands.d.ts +0 -2
- package/dist/cli-tui/commands/subcommands/git-commands.d.ts.map +1 -0
- package/dist/cli-tui/commands/{grouped → subcommands}/git-commands.js +2 -2
- package/dist/cli-tui/commands/subcommands/git-commands.js.map +1 -0
- package/dist/cli-tui/commands/{grouped → subcommands}/index.d.ts +2 -2
- package/dist/cli-tui/commands/subcommands/index.d.ts.map +1 -0
- package/dist/cli-tui/commands/{grouped → subcommands}/index.js +2 -2
- package/dist/cli-tui/commands/subcommands/index.js.map +1 -0
- package/dist/cli-tui/commands/{grouped → subcommands}/safety-commands.d.ts +0 -1
- package/dist/cli-tui/commands/subcommands/safety-commands.d.ts.map +1 -0
- package/dist/cli-tui/commands/{grouped → subcommands}/safety-commands.js +12 -12
- package/dist/cli-tui/commands/subcommands/safety-commands.js.map +1 -0
- package/dist/cli-tui/commands/{grouped → subcommands}/session-commands.d.ts +1 -2
- package/dist/cli-tui/commands/subcommands/session-commands.d.ts.map +1 -0
- package/dist/cli-tui/commands/{grouped → subcommands}/session-commands.js +3 -3
- package/dist/cli-tui/commands/subcommands/session-commands.js.map +1 -0
- package/dist/cli-tui/commands/{grouped → subcommands}/tools-commands.d.ts +0 -1
- package/dist/cli-tui/commands/subcommands/tools-commands.d.ts.map +1 -0
- package/dist/cli-tui/commands/{grouped → subcommands}/tools-commands.js +2 -2
- package/dist/cli-tui/commands/subcommands/tools-commands.js.map +1 -0
- package/dist/cli-tui/commands/{grouped → subcommands}/ui-commands.d.ts +0 -1
- package/dist/cli-tui/commands/subcommands/ui-commands.d.ts.map +1 -0
- package/dist/cli-tui/commands/{grouped → subcommands}/ui-commands.js +5 -5
- package/dist/cli-tui/commands/subcommands/ui-commands.js.map +1 -0
- package/dist/cli-tui/commands/{grouped → subcommands}/undo-commands.d.ts +1 -2
- package/dist/cli-tui/commands/subcommands/undo-commands.d.ts.map +1 -0
- package/dist/cli-tui/commands/{grouped → subcommands}/undo-commands.js +6 -6
- package/dist/cli-tui/commands/subcommands/undo-commands.js.map +1 -0
- package/dist/cli-tui/commands/subcommands/usage-commands.d.ts.map +1 -0
- package/dist/cli-tui/commands/{grouped → subcommands}/usage-commands.js +2 -2
- package/dist/cli-tui/commands/subcommands/usage-commands.js.map +1 -0
- package/dist/cli-tui/commands/{grouped → subcommands}/utils.d.ts +15 -15
- package/dist/cli-tui/commands/subcommands/utils.d.ts.map +1 -0
- package/dist/cli-tui/commands/{grouped → subcommands}/utils.js +13 -8
- package/dist/cli-tui/commands/subcommands/utils.js.map +1 -0
- package/dist/cli-tui/commands/types.d.ts +3 -3
- package/dist/cli-tui/commands/types.d.ts.map +1 -1
- package/dist/cli-tui/commands/types.js.map +1 -1
- package/dist/cli-tui/editor-view.d.ts +1 -1
- package/dist/cli-tui/editor-view.d.ts.map +1 -1
- package/dist/cli-tui/editor-view.js +1 -1
- package/dist/cli-tui/editor-view.js.map +1 -1
- package/dist/cli-tui/oauth/oauth-flow-controller.d.ts +4 -0
- package/dist/cli-tui/oauth/oauth-flow-controller.d.ts.map +1 -1
- package/dist/cli-tui/oauth/oauth-flow-controller.js +76 -5
- package/dist/cli-tui/oauth/oauth-flow-controller.js.map +1 -1
- package/dist/cli-tui/run/run-controller.d.ts +2 -2
- package/dist/cli-tui/run/run-controller.d.ts.map +1 -1
- package/dist/cli-tui/run/run-controller.js +3 -2
- package/dist/cli-tui/run/run-controller.js.map +1 -1
- package/dist/cli-tui/run/run-shell-command.d.ts.map +1 -1
- package/dist/cli-tui/run/run-shell-command.js +11 -3
- package/dist/cli-tui/run/run-shell-command.js.map +1 -1
- package/dist/cli-tui/run/streaming-shell-command.d.ts.map +1 -1
- package/dist/cli-tui/run/streaming-shell-command.js +11 -3
- package/dist/cli-tui/run/streaming-shell-command.js.map +1 -1
- package/dist/cli-tui/selectors/model-selector.d.ts.map +1 -1
- package/dist/cli-tui/selectors/model-selector.js +1 -0
- package/dist/cli-tui/selectors/model-selector.js.map +1 -1
- package/dist/cli-tui/tui-renderer/agent-event-bridge.d.ts +8 -0
- package/dist/cli-tui/tui-renderer/agent-event-bridge.d.ts.map +1 -1
- package/dist/cli-tui/tui-renderer/agent-event-bridge.js +23 -2
- package/dist/cli-tui/tui-renderer/agent-event-bridge.js.map +1 -1
- package/dist/cli-tui/tui-renderer/command-registry-options.d.ts +3 -3
- package/dist/cli-tui/tui-renderer/command-registry-options.d.ts.map +1 -1
- package/dist/cli-tui/tui-renderer/command-registry-options.js +12 -2
- package/dist/cli-tui/tui-renderer/command-registry-options.js.map +1 -1
- package/dist/cli-tui/tui-renderer/command-suite-wiring.d.ts +32 -0
- package/dist/cli-tui/tui-renderer/command-suite-wiring.d.ts.map +1 -0
- package/dist/cli-tui/tui-renderer/command-suite-wiring.js +108 -0
- package/dist/cli-tui/tui-renderer/command-suite-wiring.js.map +1 -0
- package/dist/cli-tui/tui-renderer/input-controller.d.ts +2 -2
- package/dist/cli-tui/tui-renderer/input-controller.d.ts.map +1 -1
- package/dist/cli-tui/tui-renderer/input-controller.js +2 -2
- package/dist/cli-tui/tui-renderer/input-controller.js.map +1 -1
- package/dist/cli-tui/tui-renderer/ui-state-controller.d.ts +1 -1
- package/dist/cli-tui/tui-renderer/ui-state-controller.js +1 -1
- package/dist/cli-tui/tui-renderer/ui-state-controller.js.map +1 -1
- package/dist/cli-tui/tui-renderer.d.ts +1 -3
- package/dist/cli-tui/tui-renderer.d.ts.map +1 -1
- package/dist/cli-tui/tui-renderer.js +37 -83
- package/dist/cli-tui/tui-renderer.js.map +1 -1
- package/dist/cli-tui/utils/runtime-badges.d.ts +8 -0
- package/dist/cli-tui/utils/runtime-badges.d.ts.map +1 -1
- package/dist/cli-tui/utils/runtime-badges.js +58 -0
- package/dist/cli-tui/utils/runtime-badges.js.map +1 -1
- package/dist/cli.js +42555 -23133
- package/dist/cli.js.map +1 -1
- package/dist/config/env-vars.d.ts +4 -0
- package/dist/config/env-vars.d.ts.map +1 -1
- package/dist/config/env-vars.js +4 -0
- package/dist/config/env-vars.js.map +1 -1
- package/dist/config/feature-flags.d.ts +44 -0
- package/dist/config/feature-flags.d.ts.map +1 -1
- package/dist/config/feature-flags.js +214 -0
- package/dist/config/feature-flags.js.map +1 -1
- package/dist/connectors/service-client.d.ts +98 -0
- package/dist/connectors/service-client.d.ts.map +1 -0
- package/dist/connectors/service-client.js +459 -0
- package/dist/connectors/service-client.js.map +1 -0
- package/dist/conversation/render-model.d.ts.map +1 -1
- package/dist/conversation/render-model.js +53 -3
- package/dist/conversation/render-model.js.map +1 -1
- package/dist/db/health.d.ts +8 -0
- package/dist/db/health.d.ts.map +1 -0
- package/dist/db/health.js +64 -0
- package/dist/db/health.js.map +1 -0
- package/dist/db/migrate.d.ts +301 -0
- package/dist/db/migrate.d.ts.map +1 -1
- package/dist/db/migrate.js +186 -0
- package/dist/db/migrate.js.map +1 -1
- package/dist/db/migrations/0000_initial.sql +308 -0
- package/dist/db/migrations/0001_shared_sessions.sql +18 -0
- package/dist/db/migrations/0002_usage_metrics.sql +28 -0
- package/dist/db/migrations/0003_execution_traces.sql +18 -0
- package/dist/db/migrations/0004_workspace_config.sql +11 -0
- package/dist/db/migrations/0005_revenue_attribution.sql +31 -0
- package/dist/db/migrations/0006_hosted_session_storage.sql +51 -0
- package/dist/db/migrations/0007_reconcile_legacy_audit_hash_cache.sql +24 -0
- package/dist/db/migrations/0008_reconcile_legacy_webhook_deliveries.sql +290 -0
- package/dist/db/migrations/meta/0000_snapshot.json +2438 -0
- package/dist/db/migrations/meta/_journal.json +69 -0
- package/dist/db/schema.d.ts +2232 -844
- package/dist/db/schema.d.ts.map +1 -1
- package/dist/db/schema.js +187 -1
- package/dist/db/schema.js.map +1 -1
- package/dist/evalops/agent-bootstrap.d.ts +73 -0
- package/dist/evalops/agent-bootstrap.d.ts.map +1 -0
- package/dist/evalops/agent-bootstrap.js +380 -0
- package/dist/evalops/agent-bootstrap.js.map +1 -0
- package/dist/export-html.d.ts.map +1 -1
- package/dist/export-html.js +7 -4
- package/dist/export-html.js.map +1 -1
- package/dist/headless/utility-command-manager.d.ts +2 -1
- package/dist/headless/utility-command-manager.d.ts.map +1 -1
- package/dist/headless/utility-command-manager.js +12 -6
- package/dist/headless/utility-command-manager.js.map +1 -1
- package/dist/headless/utility-file-read.d.ts +1 -0
- package/dist/headless/utility-file-read.d.ts.map +1 -1
- package/dist/headless/utility-file-read.js +5 -1
- package/dist/headless/utility-file-read.js.map +1 -1
- package/dist/headless/utility-file-search.d.ts +1 -0
- package/dist/headless/utility-file-search.d.ts.map +1 -1
- package/dist/headless/utility-file-search.js +4 -1
- package/dist/headless/utility-file-search.js.map +1 -1
- package/dist/headless/utility-file-watch-manager.d.ts +2 -1
- package/dist/headless/utility-file-watch-manager.d.ts.map +1 -1
- package/dist/headless/utility-file-watch-manager.js +6 -2
- package/dist/headless/utility-file-watch-manager.js.map +1 -1
- package/dist/headless/workspace-root.d.ts +8 -0
- package/dist/headless/workspace-root.d.ts.map +1 -0
- package/dist/headless/workspace-root.js +74 -0
- package/dist/headless/workspace-root.js.map +1 -0
- package/dist/hooks/notification-hooks.d.ts +5 -0
- package/dist/hooks/notification-hooks.d.ts.map +1 -1
- package/dist/hooks/notification-hooks.js +4 -0
- package/dist/hooks/notification-hooks.js.map +1 -1
- package/dist/lsp/diagnostic-deltas.d.ts +20 -0
- package/dist/lsp/diagnostic-deltas.d.ts.map +1 -0
- package/dist/lsp/diagnostic-deltas.js +92 -0
- package/dist/lsp/diagnostic-deltas.js.map +1 -0
- package/dist/lsp/diagnostic-repair.d.ts +48 -0
- package/dist/lsp/diagnostic-repair.d.ts.map +1 -0
- package/dist/lsp/diagnostic-repair.js +143 -0
- package/dist/lsp/diagnostic-repair.js.map +1 -0
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +127 -37
- package/dist/main.js.map +1 -1
- package/dist/mcp/config.d.ts +4 -2
- package/dist/mcp/config.d.ts.map +1 -1
- package/dist/mcp/config.js +58 -14
- package/dist/mcp/config.js.map +1 -1
- package/dist/mcp/index.d.ts +1 -0
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +1 -0
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/manager.d.ts +1 -0
- package/dist/mcp/manager.d.ts.map +1 -1
- package/dist/mcp/manager.js +1 -0
- package/dist/mcp/manager.js.map +1 -1
- package/dist/mcp/platform-plugin.d.ts +3 -0
- package/dist/mcp/platform-plugin.d.ts.map +1 -0
- package/dist/mcp/platform-plugin.js +117 -0
- package/dist/mcp/platform-plugin.js.map +1 -0
- package/dist/mcp/tool-bridge.d.ts +15 -0
- package/dist/mcp/tool-bridge.d.ts.map +1 -1
- package/dist/mcp/tool-bridge.js +194 -6
- package/dist/mcp/tool-bridge.js.map +1 -1
- package/dist/memory/platform-memory-client.d.ts +130 -0
- package/dist/memory/platform-memory-client.d.ts.map +1 -0
- package/dist/memory/platform-memory-client.js +330 -0
- package/dist/memory/platform-memory-client.js.map +1 -0
- package/dist/memory/service-client.d.ts.map +1 -1
- package/dist/memory/service-client.js +1 -2
- package/dist/memory/service-client.js.map +1 -1
- package/dist/models/builtin.d.ts.map +1 -1
- package/dist/models/builtin.js +137 -0
- package/dist/models/builtin.js.map +1 -1
- package/dist/models/config-loader.d.ts +10 -10
- package/dist/models/config-loader.d.ts.map +1 -1
- package/dist/models/config-loader.js +1 -0
- package/dist/models/config-loader.js.map +1 -1
- package/dist/models/registry.d.ts +1 -0
- package/dist/models/registry.d.ts.map +1 -1
- package/dist/models/registry.js +1 -0
- package/dist/models/registry.js.map +1 -1
- package/dist/oauth/connectors.d.ts +25 -0
- package/dist/oauth/connectors.d.ts.map +1 -0
- package/dist/oauth/connectors.js +253 -0
- package/dist/oauth/connectors.js.map +1 -0
- package/dist/oauth/device-identity.d.ts +18 -0
- package/dist/oauth/device-identity.d.ts.map +1 -0
- package/dist/oauth/device-identity.js +193 -0
- package/dist/oauth/device-identity.js.map +1 -0
- package/dist/oauth/evalops.d.ts.map +1 -1
- package/dist/oauth/evalops.js +74 -15
- package/dist/oauth/evalops.js.map +1 -1
- package/dist/oauth/index.d.ts +1 -1
- package/dist/oauth/index.d.ts.map +1 -1
- package/dist/oauth/index.js +31 -1
- package/dist/oauth/index.js.map +1 -1
- package/dist/oauth/openai-codex.d.ts +16 -0
- package/dist/oauth/openai-codex.d.ts.map +1 -0
- package/dist/oauth/openai-codex.js +300 -0
- package/dist/oauth/openai-codex.js.map +1 -0
- package/dist/opentelemetry.d.ts.map +1 -1
- package/dist/opentelemetry.js +9 -2
- package/dist/opentelemetry.js.map +1 -1
- package/dist/platform/agent-runtime-client.d.ts +279 -0
- package/dist/platform/agent-runtime-client.d.ts.map +1 -0
- package/dist/platform/agent-runtime-client.js +515 -0
- package/dist/platform/agent-runtime-client.js.map +1 -0
- package/dist/platform/cerebro-facts-client.d.ts +56 -0
- package/dist/platform/cerebro-facts-client.d.ts.map +1 -0
- package/dist/platform/cerebro-facts-client.js +297 -0
- package/dist/platform/cerebro-facts-client.js.map +1 -0
- package/dist/platform/client.d.ts +2 -1
- package/dist/platform/client.d.ts.map +1 -1
- package/dist/platform/client.js +9 -26
- package/dist/platform/client.js.map +1 -1
- package/dist/platform/core-services.d.ts +128 -0
- package/dist/platform/core-services.d.ts.map +1 -1
- package/dist/platform/core-services.js +128 -0
- package/dist/platform/core-services.js.map +1 -1
- package/dist/platform/maestro-timeline-client.d.ts +22 -0
- package/dist/platform/maestro-timeline-client.d.ts.map +1 -0
- package/dist/platform/maestro-timeline-client.js +373 -0
- package/dist/platform/maestro-timeline-client.js.map +1 -0
- package/dist/platform/tool-execution-client.d.ts +104 -0
- package/dist/platform/tool-execution-client.d.ts.map +1 -0
- package/dist/platform/tool-execution-client.js +284 -0
- package/dist/platform/tool-execution-client.js.map +1 -0
- package/dist/prompts/service-client.d.ts.map +1 -1
- package/dist/prompts/service-client.js +5 -2
- package/dist/prompts/service-client.js.map +1 -1
- package/dist/providers/anthropic-auth.d.ts.map +1 -1
- package/dist/providers/anthropic-auth.js +8 -6
- package/dist/providers/anthropic-auth.js.map +1 -1
- package/dist/providers/api-keys.d.ts +1 -0
- package/dist/providers/api-keys.d.ts.map +1 -1
- package/dist/providers/api-keys.js +5 -0
- package/dist/providers/api-keys.js.map +1 -1
- package/dist/providers/auth.d.ts +2 -1
- package/dist/providers/auth.d.ts.map +1 -1
- package/dist/providers/auth.js +26 -3
- package/dist/providers/auth.js.map +1 -1
- package/dist/remote-runner/attach-client.d.ts +41 -0
- package/dist/remote-runner/attach-client.d.ts.map +1 -0
- package/dist/remote-runner/attach-client.js +692 -0
- package/dist/remote-runner/attach-client.js.map +1 -0
- package/dist/remote-runner/client.d.ts +205 -0
- package/dist/remote-runner/client.d.ts.map +1 -0
- package/dist/remote-runner/client.js +633 -0
- package/dist/remote-runner/client.js.map +1 -0
- package/dist/safety/action-firewall.d.ts +6 -1
- package/dist/safety/action-firewall.d.ts.map +1 -1
- package/dist/safety/action-firewall.js +62 -26
- package/dist/safety/action-firewall.js.map +1 -1
- package/dist/safety/governance-service-client.d.ts +36 -0
- package/dist/safety/governance-service-client.d.ts.map +1 -0
- package/dist/safety/governance-service-client.js +279 -0
- package/dist/safety/governance-service-client.js.map +1 -0
- package/dist/safety/policy.d.ts +13 -2
- package/dist/safety/policy.d.ts.map +1 -1
- package/dist/safety/policy.js +474 -52
- package/dist/safety/policy.js.map +1 -1
- package/dist/sdk-tools.d.ts +21 -0
- package/dist/sdk-tools.d.ts.map +1 -1
- package/dist/sdk-tools.js +16 -0
- package/dist/sdk-tools.js.map +1 -1
- package/dist/server/app-context.d.ts +25 -0
- package/dist/server/app-context.d.ts.map +1 -1
- package/dist/server/app-context.js.map +1 -1
- package/dist/server/approval-service.d.ts +7 -8
- package/dist/server/approval-service.d.ts.map +1 -1
- package/dist/server/approval-service.js +12 -24
- package/dist/server/approval-service.js.map +1 -1
- package/dist/server/authz.d.ts +23 -2
- package/dist/server/authz.d.ts.map +1 -1
- package/dist/server/authz.js +153 -17
- package/dist/server/authz.js.map +1 -1
- package/dist/server/handlers/approvals.d.ts.map +1 -1
- package/dist/server/handlers/approvals.js +3 -10
- package/dist/server/handlers/approvals.js.map +1 -1
- package/dist/server/handlers/branch.d.ts.map +1 -1
- package/dist/server/handlers/branch.js +29 -20
- package/dist/server/handlers/branch.js.map +1 -1
- package/dist/server/handlers/bridge.d.ts.map +1 -1
- package/dist/server/handlers/bridge.js +3 -2
- package/dist/server/handlers/bridge.js.map +1 -1
- package/dist/server/handlers/chat-ws.d.ts.map +1 -1
- package/dist/server/handlers/chat-ws.js +23 -31
- package/dist/server/handlers/chat-ws.js.map +1 -1
- package/dist/server/handlers/chat.d.ts.map +1 -1
- package/dist/server/handlers/chat.js +105 -46
- package/dist/server/handlers/chat.js.map +1 -1
- package/dist/server/handlers/compliance.d.ts +3 -0
- package/dist/server/handlers/compliance.d.ts.map +1 -0
- package/dist/server/handlers/compliance.js +53 -0
- package/dist/server/handlers/compliance.js.map +1 -0
- package/dist/server/handlers/context.d.ts.map +1 -1
- package/dist/server/handlers/context.js +3 -8
- package/dist/server/handlers/context.js.map +1 -1
- package/dist/server/handlers/fleet.d.ts +4 -0
- package/dist/server/handlers/fleet.d.ts.map +1 -0
- package/dist/server/handlers/fleet.js +9 -0
- package/dist/server/handlers/fleet.js.map +1 -0
- package/dist/server/handlers/headless-sessions.d.ts +4 -0
- package/dist/server/handlers/headless-sessions.d.ts.map +1 -1
- package/dist/server/handlers/headless-sessions.js +168 -3
- package/dist/server/handlers/headless-sessions.js.map +1 -1
- package/dist/server/handlers/health.d.ts +31 -2
- package/dist/server/handlers/health.d.ts.map +1 -1
- package/dist/server/handlers/health.js +82 -8
- package/dist/server/handlers/health.js.map +1 -1
- package/dist/server/handlers/hosted-runner-drain.d.ts +128 -0
- package/dist/server/handlers/hosted-runner-drain.d.ts.map +1 -0
- package/dist/server/handlers/hosted-runner-drain.js +373 -0
- package/dist/server/handlers/hosted-runner-drain.js.map +1 -0
- package/dist/server/handlers/hosted-runner-identity.d.ts +17 -0
- package/dist/server/handlers/hosted-runner-identity.d.ts.map +1 -0
- package/dist/server/handlers/hosted-runner-identity.js +39 -0
- package/dist/server/handlers/hosted-runner-identity.js.map +1 -0
- package/dist/server/handlers/intelligent-router.d.ts +3 -0
- package/dist/server/handlers/intelligent-router.d.ts.map +1 -0
- package/dist/server/handlers/intelligent-router.js +141 -0
- package/dist/server/handlers/intelligent-router.js.map +1 -0
- package/dist/server/handlers/models.d.ts.map +1 -1
- package/dist/server/handlers/models.js +14 -0
- package/dist/server/handlers/models.js.map +1 -1
- package/dist/server/handlers/pending-requests.d.ts +8 -0
- package/dist/server/handlers/pending-requests.d.ts.map +1 -0
- package/dist/server/handlers/pending-requests.js +149 -0
- package/dist/server/handlers/pending-requests.js.map +1 -0
- package/dist/server/handlers/revenue-attribution.d.ts +3 -0
- package/dist/server/handlers/revenue-attribution.d.ts.map +1 -0
- package/dist/server/handlers/revenue-attribution.js +45 -0
- package/dist/server/handlers/revenue-attribution.js.map +1 -0
- package/dist/server/handlers/runtime-app-server-ws.d.ts +10 -0
- package/dist/server/handlers/runtime-app-server-ws.d.ts.map +1 -0
- package/dist/server/handlers/runtime-app-server-ws.js +206 -0
- package/dist/server/handlers/runtime-app-server-ws.js.map +1 -0
- package/dist/server/handlers/session-artifacts.js +2 -2
- package/dist/server/handlers/session-artifacts.js.map +1 -1
- package/dist/server/handlers/session-attachments.js +3 -3
- package/dist/server/handlers/session-attachments.js.map +1 -1
- package/dist/server/handlers/session-timeline.d.ts +11 -0
- package/dist/server/handlers/session-timeline.d.ts.map +1 -0
- package/dist/server/handlers/session-timeline.js +77 -0
- package/dist/server/handlers/session-timeline.js.map +1 -0
- package/dist/server/handlers/sessions.d.ts +11 -0
- package/dist/server/handlers/sessions.d.ts.map +1 -1
- package/dist/server/handlers/sessions.js +68 -100
- package/dist/server/handlers/sessions.js.map +1 -1
- package/dist/server/handlers/traces.d.ts +3 -0
- package/dist/server/handlers/traces.d.ts.map +1 -0
- package/dist/server/handlers/traces.js +60 -0
- package/dist/server/handlers/traces.js.map +1 -0
- package/dist/server/handlers/usage-analytics.d.ts +3 -0
- package/dist/server/handlers/usage-analytics.d.ts.map +1 -0
- package/dist/server/handlers/usage-analytics.js +40 -0
- package/dist/server/handlers/usage-analytics.js.map +1 -0
- package/dist/server/handlers/workspace-config.d.ts +3 -0
- package/dist/server/handlers/workspace-config.d.ts.map +1 -0
- package/dist/server/handlers/workspace-config.js +62 -0
- package/dist/server/handlers/workspace-config.js.map +1 -0
- package/dist/server/headless-in-process-host.d.ts +8 -1
- package/dist/server/headless-in-process-host.d.ts.map +1 -1
- package/dist/server/headless-in-process-host.js +6 -0
- package/dist/server/headless-in-process-host.js.map +1 -1
- package/dist/server/headless-runtime-service.d.ts +99 -1
- package/dist/server/headless-runtime-service.d.ts.map +1 -1
- package/dist/server/headless-runtime-service.js +286 -23
- package/dist/server/headless-runtime-service.js.map +1 -1
- package/dist/server/hosted-session-manager.d.ts +103 -0
- package/dist/server/hosted-session-manager.d.ts.map +1 -0
- package/dist/server/hosted-session-manager.js +629 -0
- package/dist/server/hosted-session-manager.js.map +1 -0
- package/dist/server/pending-request-payload.d.ts +4 -0
- package/dist/server/pending-request-payload.d.ts.map +1 -0
- package/dist/server/pending-request-payload.js +107 -0
- package/dist/server/pending-request-payload.js.map +1 -0
- package/dist/server/request-context.d.ts +4 -0
- package/dist/server/request-context.d.ts.map +1 -1
- package/dist/server/request-context.js +9 -0
- package/dist/server/request-context.js.map +1 -1
- package/dist/server/routes.d.ts.map +1 -1
- package/dist/server/routes.js +149 -1
- package/dist/server/routes.js.map +1 -1
- package/dist/server/runtime-ws-access.d.ts +16 -0
- package/dist/server/runtime-ws-access.d.ts.map +1 -0
- package/dist/server/runtime-ws-access.js +21 -0
- package/dist/server/runtime-ws-access.js.map +1 -0
- package/dist/server/server-middlewares.d.ts +1 -1
- package/dist/server/server-middlewares.d.ts.map +1 -1
- package/dist/server/server-middlewares.js +35 -27
- package/dist/server/server-middlewares.js.map +1 -1
- package/dist/server/server-request-manager.d.ts +8 -27
- package/dist/server/server-request-manager.d.ts.map +1 -1
- package/dist/server/server-request-manager.js +7 -0
- package/dist/server/server-request-manager.js.map +1 -1
- package/dist/server/server-utils.d.ts +2 -1
- package/dist/server/server-utils.d.ts.map +1 -1
- package/dist/server/server-utils.js +11 -1
- package/dist/server/server-utils.js.map +1 -1
- package/dist/server/session-event-env.d.ts +2 -0
- package/dist/server/session-event-env.d.ts.map +1 -0
- package/dist/server/session-event-env.js +8 -0
- package/dist/server/session-event-env.js.map +1 -0
- package/dist/server/session-initialization.d.ts +25 -4
- package/dist/server/session-initialization.d.ts.map +1 -1
- package/dist/server/session-initialization.js +22 -5
- package/dist/server/session-initialization.js.map +1 -1
- package/dist/server/session-scope.d.ts +4 -0
- package/dist/server/session-scope.d.ts.map +1 -1
- package/dist/server/session-scope.js +44 -4
- package/dist/server/session-scope.js.map +1 -1
- package/dist/server/session-timeline.d.ts +13 -0
- package/dist/server/session-timeline.d.ts.map +1 -0
- package/dist/server/session-timeline.js +566 -0
- package/dist/server/session-timeline.js.map +1 -0
- package/dist/services/compliance/controls.d.ts +6 -0
- package/dist/services/compliance/controls.d.ts.map +1 -0
- package/dist/services/compliance/controls.js +113 -0
- package/dist/services/compliance/controls.js.map +1 -0
- package/dist/services/compliance/index.d.ts +6 -0
- package/dist/services/compliance/index.d.ts.map +1 -0
- package/dist/services/compliance/index.js +5 -0
- package/dist/services/compliance/index.js.map +1 -0
- package/dist/services/compliance/normalize.d.ts +23 -0
- package/dist/services/compliance/normalize.d.ts.map +1 -0
- package/dist/services/compliance/normalize.js +226 -0
- package/dist/services/compliance/normalize.js.map +1 -0
- package/dist/services/compliance/recorder.d.ts +22 -0
- package/dist/services/compliance/recorder.d.ts.map +1 -0
- package/dist/services/compliance/recorder.js +89 -0
- package/dist/services/compliance/recorder.js.map +1 -0
- package/dist/services/compliance/service.d.ts +24 -0
- package/dist/services/compliance/service.d.ts.map +1 -0
- package/dist/services/compliance/service.js +426 -0
- package/dist/services/compliance/service.js.map +1 -0
- package/dist/services/compliance/types.d.ts +185 -0
- package/dist/services/compliance/types.d.ts.map +1 -0
- package/dist/services/compliance/types.js +2 -0
- package/dist/services/compliance/types.js.map +1 -0
- package/dist/services/intelligent-router/index.d.ts +5 -0
- package/dist/services/intelligent-router/index.d.ts.map +1 -0
- package/dist/services/intelligent-router/index.js +5 -0
- package/dist/services/intelligent-router/index.js.map +1 -0
- package/dist/services/intelligent-router/normalize.d.ts +9 -0
- package/dist/services/intelligent-router/normalize.d.ts.map +1 -0
- package/dist/services/intelligent-router/normalize.js +169 -0
- package/dist/services/intelligent-router/normalize.js.map +1 -0
- package/dist/services/intelligent-router/recorder.d.ts +24 -0
- package/dist/services/intelligent-router/recorder.d.ts.map +1 -0
- package/dist/services/intelligent-router/recorder.js +98 -0
- package/dist/services/intelligent-router/recorder.js.map +1 -0
- package/dist/services/intelligent-router/service.d.ts +22 -0
- package/dist/services/intelligent-router/service.d.ts.map +1 -0
- package/dist/services/intelligent-router/service.js +328 -0
- package/dist/services/intelligent-router/service.js.map +1 -0
- package/dist/services/intelligent-router/types.d.ts +98 -0
- package/dist/services/intelligent-router/types.d.ts.map +1 -0
- package/dist/services/intelligent-router/types.js +7 -0
- package/dist/services/intelligent-router/types.js.map +1 -0
- package/dist/services/revenue-attribution/index.d.ts +4 -0
- package/dist/services/revenue-attribution/index.d.ts.map +1 -0
- package/dist/services/revenue-attribution/index.js +4 -0
- package/dist/services/revenue-attribution/index.js.map +1 -0
- package/dist/services/revenue-attribution/normalize.d.ts +13 -0
- package/dist/services/revenue-attribution/normalize.d.ts.map +1 -0
- package/dist/services/revenue-attribution/normalize.js +155 -0
- package/dist/services/revenue-attribution/normalize.js.map +1 -0
- package/dist/services/revenue-attribution/service.d.ts +21 -0
- package/dist/services/revenue-attribution/service.d.ts.map +1 -0
- package/dist/services/revenue-attribution/service.js +248 -0
- package/dist/services/revenue-attribution/service.js.map +1 -0
- package/dist/services/revenue-attribution/types.d.ts +96 -0
- package/dist/services/revenue-attribution/types.d.ts.map +1 -0
- package/dist/services/revenue-attribution/types.js +7 -0
- package/dist/services/revenue-attribution/types.js.map +1 -0
- package/dist/services/traces/index.d.ts +5 -0
- package/dist/services/traces/index.d.ts.map +1 -0
- package/dist/services/traces/index.js +4 -0
- package/dist/services/traces/index.js.map +1 -0
- package/dist/services/traces/normalize.d.ts +20 -0
- package/dist/services/traces/normalize.d.ts.map +1 -0
- package/dist/services/traces/normalize.js +261 -0
- package/dist/services/traces/normalize.js.map +1 -0
- package/dist/services/traces/otel.d.ts +3 -0
- package/dist/services/traces/otel.d.ts.map +1 -0
- package/dist/services/traces/otel.js +173 -0
- package/dist/services/traces/otel.js.map +1 -0
- package/dist/services/traces/service.d.ts +17 -0
- package/dist/services/traces/service.d.ts.map +1 -0
- package/dist/services/traces/service.js +197 -0
- package/dist/services/traces/service.js.map +1 -0
- package/dist/services/traces/types.d.ts +130 -0
- package/dist/services/traces/types.d.ts.map +1 -0
- package/dist/services/traces/types.js +8 -0
- package/dist/services/traces/types.js.map +1 -0
- package/dist/services/usage-analytics/aggregation.d.ts +18 -0
- package/dist/services/usage-analytics/aggregation.d.ts.map +1 -0
- package/dist/services/usage-analytics/aggregation.js +130 -0
- package/dist/services/usage-analytics/aggregation.js.map +1 -0
- package/dist/services/usage-analytics/index.d.ts +5 -0
- package/dist/services/usage-analytics/index.d.ts.map +1 -0
- package/dist/services/usage-analytics/index.js +4 -0
- package/dist/services/usage-analytics/index.js.map +1 -0
- package/dist/services/usage-analytics/recorder.d.ts +16 -0
- package/dist/services/usage-analytics/recorder.d.ts.map +1 -0
- package/dist/services/usage-analytics/recorder.js +128 -0
- package/dist/services/usage-analytics/recorder.js.map +1 -0
- package/dist/services/usage-analytics/service.d.ts +15 -0
- package/dist/services/usage-analytics/service.d.ts.map +1 -0
- package/dist/services/usage-analytics/service.js +210 -0
- package/dist/services/usage-analytics/service.js.map +1 -0
- package/dist/services/usage-analytics/types.d.ts +80 -0
- package/dist/services/usage-analytics/types.d.ts.map +1 -0
- package/dist/services/usage-analytics/types.js +2 -0
- package/dist/services/usage-analytics/types.js.map +1 -0
- package/dist/services/workspace-config/index.d.ts +6 -0
- package/dist/services/workspace-config/index.d.ts.map +1 -0
- package/dist/services/workspace-config/index.js +5 -0
- package/dist/services/workspace-config/index.js.map +1 -0
- package/dist/services/workspace-config/middleware.d.ts +5 -0
- package/dist/services/workspace-config/middleware.d.ts.map +1 -0
- package/dist/services/workspace-config/middleware.js +98 -0
- package/dist/services/workspace-config/middleware.js.map +1 -0
- package/dist/services/workspace-config/normalize.d.ts +17 -0
- package/dist/services/workspace-config/normalize.d.ts.map +1 -0
- package/dist/services/workspace-config/normalize.js +148 -0
- package/dist/services/workspace-config/normalize.js.map +1 -0
- package/dist/services/workspace-config/policy.d.ts +16 -0
- package/dist/services/workspace-config/policy.d.ts.map +1 -0
- package/dist/services/workspace-config/policy.js +77 -0
- package/dist/services/workspace-config/policy.js.map +1 -0
- package/dist/services/workspace-config/service.d.ts +20 -0
- package/dist/services/workspace-config/service.d.ts.map +1 -0
- package/dist/services/workspace-config/service.js +162 -0
- package/dist/services/workspace-config/service.js.map +1 -0
- package/dist/services/workspace-config/types.d.ts +71 -0
- package/dist/services/workspace-config/types.d.ts.map +1 -0
- package/dist/services/workspace-config/types.js +2 -0
- package/dist/services/workspace-config/types.js.map +1 -0
- package/dist/session/manager.d.ts.map +1 -1
- package/dist/session/manager.js +10 -0
- package/dist/session/manager.js.map +1 -1
- package/dist/session/migration.d.ts.map +1 -1
- package/dist/session/migration.js +2 -1
- package/dist/session/migration.js.map +1 -1
- package/dist/session/session-memory.d.ts.map +1 -1
- package/dist/session/session-memory.js +7 -1
- package/dist/session/session-memory.js.map +1 -1
- package/dist/session/types.d.ts +1 -2
- package/dist/session/types.d.ts.map +1 -1
- package/dist/session/types.js +1 -22
- package/dist/session/types.js.map +1 -1
- package/dist/session/wire-format.d.ts +7 -0
- package/dist/session/wire-format.d.ts.map +1 -0
- package/dist/session/wire-format.generated.d.ts +95 -0
- package/dist/session/wire-format.generated.d.ts.map +1 -0
- package/dist/session/wire-format.generated.js +111 -0
- package/dist/session/wire-format.generated.js.map +1 -0
- package/dist/session/wire-format.js +145 -0
- package/dist/session/wire-format.js.map +1 -0
- package/dist/shared-memory/client.d.ts.map +1 -1
- package/dist/shared-memory/client.js +22 -22
- package/dist/shared-memory/client.js.map +1 -1
- package/dist/skills/artifact-metadata.d.ts +16 -0
- package/dist/skills/artifact-metadata.d.ts.map +1 -0
- package/dist/skills/artifact-metadata.js +86 -0
- package/dist/skills/artifact-metadata.js.map +1 -0
- package/dist/skills/loader.d.ts +2 -2
- package/dist/skills/loader.d.ts.map +1 -1
- package/dist/skills/loader.js +1 -0
- package/dist/skills/loader.js.map +1 -1
- package/dist/skills/service-client.d.ts +42 -0
- package/dist/skills/service-client.d.ts.map +1 -0
- package/dist/skills/service-client.js +258 -0
- package/dist/skills/service-client.js.map +1 -0
- package/dist/skills/tool.d.ts +3 -0
- package/dist/skills/tool.d.ts.map +1 -1
- package/dist/skills/tool.js +67 -5
- package/dist/skills/tool.js.map +1 -1
- package/dist/telemetry/index.d.ts +4 -0
- package/dist/telemetry/index.d.ts.map +1 -1
- package/dist/telemetry/index.js +5 -0
- package/dist/telemetry/index.js.map +1 -1
- package/dist/telemetry/maestro-event-bus.d.ts +440 -0
- package/dist/telemetry/maestro-event-bus.d.ts.map +1 -0
- package/dist/telemetry/maestro-event-bus.js +784 -0
- package/dist/telemetry/maestro-event-bus.js.map +1 -0
- package/dist/telemetry/maestro-event-catalog.d.ts +48 -0
- package/dist/telemetry/maestro-event-catalog.d.ts.map +1 -0
- package/dist/telemetry/maestro-event-catalog.js +69 -0
- package/dist/telemetry/maestro-event-catalog.js.map +1 -0
- package/dist/telemetry/maestro-platform-replay-fixture.d.ts +24 -0
- package/dist/telemetry/maestro-platform-replay-fixture.d.ts.map +1 -0
- package/dist/telemetry/maestro-platform-replay-fixture.js +400 -0
- package/dist/telemetry/maestro-platform-replay-fixture.js.map +1 -0
- package/dist/telemetry/maestro-publisher-conformance-fixture.d.ts +29 -0
- package/dist/telemetry/maestro-publisher-conformance-fixture.d.ts.map +1 -0
- package/dist/telemetry/maestro-publisher-conformance-fixture.js +240 -0
- package/dist/telemetry/maestro-publisher-conformance-fixture.js.map +1 -0
- package/dist/telemetry/meter-service-client.d.ts +0 -33
- package/dist/telemetry/meter-service-client.d.ts.map +1 -1
- package/dist/telemetry/meter-service-client.js +22 -50
- package/dist/telemetry/meter-service-client.js.map +1 -1
- package/dist/telemetry/turn-tracker.d.ts.map +1 -1
- package/dist/telemetry/turn-tracker.js +5 -5
- package/dist/telemetry/turn-tracker.js.map +1 -1
- package/dist/telemetry/wide-events.d.ts +8 -0
- package/dist/telemetry/wide-events.d.ts.map +1 -1
- package/dist/telemetry/wide-events.js +28 -0
- package/dist/telemetry/wide-events.js.map +1 -1
- package/dist/telemetry.d.ts +1 -1
- package/dist/telemetry.d.ts.map +1 -1
- package/dist/telemetry.js +14 -4
- package/dist/telemetry.js.map +1 -1
- package/dist/timeline/redaction.d.ts +5 -0
- package/dist/timeline/redaction.d.ts.map +1 -0
- package/dist/timeline/redaction.js +119 -0
- package/dist/timeline/redaction.js.map +1 -0
- package/dist/tools/ask-user.d.ts +26 -0
- package/dist/tools/ask-user.d.ts.map +1 -1
- package/dist/tools/ask-user.js +33 -1
- package/dist/tools/ask-user.js.map +1 -1
- package/dist/tools/background/task-types.d.ts +1 -1
- package/dist/tools/edit.d.ts +2 -0
- package/dist/tools/edit.d.ts.map +1 -1
- package/dist/tools/edit.js +27 -7
- package/dist/tools/edit.js.map +1 -1
- package/dist/tools/index.d.ts +9 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/pipeline.d.ts.map +1 -1
- package/dist/tools/pipeline.js +16 -7
- package/dist/tools/pipeline.js.map +1 -1
- package/dist/tools/write.d.ts +2 -0
- package/dist/tools/write.d.ts.map +1 -1
- package/dist/tools/write.js +24 -6
- package/dist/tools/write.js.map +1 -1
- package/dist/tracking/cost-tracker.d.ts +15 -12
- package/dist/tracking/cost-tracker.d.ts.map +1 -1
- package/dist/tracking/cost-tracker.js +29 -40
- package/dist/tracking/cost-tracker.js.map +1 -1
- package/dist/utils/checkpoint-profiler.d.ts +29 -0
- package/dist/utils/checkpoint-profiler.d.ts.map +1 -0
- package/dist/utils/checkpoint-profiler.js +118 -0
- package/dist/utils/checkpoint-profiler.js.map +1 -0
- package/dist/utils/downstream-http.d.ts +21 -0
- package/dist/utils/downstream-http.d.ts.map +1 -0
- package/dist/utils/downstream-http.js +151 -0
- package/dist/utils/downstream-http.js.map +1 -0
- package/dist/utils/downstream.d.ts +18 -0
- package/dist/utils/downstream.d.ts.map +1 -0
- package/dist/utils/downstream.js +47 -0
- package/dist/utils/downstream.js.map +1 -0
- package/dist/utils/logger.d.ts +3 -1
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js +12 -1
- package/dist/utils/logger.js.map +1 -1
- package/dist/utils/oauth-http.d.ts +8 -0
- package/dist/utils/oauth-http.d.ts.map +1 -0
- package/dist/utils/oauth-http.js +41 -0
- package/dist/utils/oauth-http.js.map +1 -0
- package/dist/utils/path-utils.d.ts +2 -0
- package/dist/utils/path-utils.d.ts.map +1 -0
- package/dist/utils/path-utils.js +12 -0
- package/dist/utils/path-utils.js.map +1 -0
- package/dist/utils/path-validation.d.ts +1 -1
- package/dist/utils/path-validation.d.ts.map +1 -1
- package/dist/utils/path-validation.js +3 -3
- package/dist/utils/path-validation.js.map +1 -1
- package/dist/version.json +2 -2
- package/dist/web-server.d.ts +7 -1
- package/dist/web-server.d.ts.map +1 -1
- package/dist/web-server.js +117 -15
- package/dist/web-server.js.map +1 -1
- package/dist/webhooks/delivery.d.ts.map +1 -1
- package/dist/webhooks/delivery.js +9 -12
- package/dist/webhooks/delivery.js.map +1 -1
- package/node_modules/@bufbuild/protobuf/dist/cjs/descriptors.d.ts +12 -5
- package/node_modules/@bufbuild/protobuf/dist/cjs/from-binary.js +7 -7
- package/node_modules/@bufbuild/protobuf/dist/cjs/from-json.d.ts +1 -1
- package/node_modules/@bufbuild/protobuf/dist/cjs/from-json.js +1 -1
- package/node_modules/@bufbuild/protobuf/dist/cjs/reflect/path.d.ts +1 -1
- package/node_modules/@bufbuild/protobuf/dist/cjs/registry.js +24 -1
- package/node_modules/@bufbuild/protobuf/dist/cjs/to-json.d.ts +1 -1
- package/node_modules/@bufbuild/protobuf/dist/cjs/to-json.js +9 -10
- package/node_modules/@bufbuild/protobuf/dist/cjs/types.d.ts +1 -1
- package/node_modules/@bufbuild/protobuf/dist/cjs/wire/binary-encoding.d.ts +9 -7
- package/node_modules/@bufbuild/protobuf/dist/cjs/wire/binary-encoding.js +18 -8
- package/node_modules/@bufbuild/protobuf/dist/cjs/wire/text-encoding.d.ts +4 -2
- package/node_modules/@bufbuild/protobuf/dist/cjs/wire/text-encoding.js +8 -1
- package/node_modules/@bufbuild/protobuf/dist/cjs/wkt/gen/google/protobuf/api_pb.d.ts +1 -1
- package/node_modules/@bufbuild/protobuf/dist/cjs/wkt/gen/google/protobuf/compiler/plugin_pb.d.ts +2 -2
- package/node_modules/@bufbuild/protobuf/dist/cjs/wkt/gen/google/protobuf/descriptor_pb.d.ts +37 -23
- package/node_modules/@bufbuild/protobuf/dist/cjs/wkt/gen/google/protobuf/descriptor_pb.js +1 -1
- package/node_modules/@bufbuild/protobuf/dist/cjs/wkt/gen/google/protobuf/field_mask_pb.d.ts +32 -36
- package/node_modules/@bufbuild/protobuf/dist/cjs/wkt/gen/google/protobuf/go_features_pb.d.ts +65 -0
- package/node_modules/@bufbuild/protobuf/dist/cjs/wkt/gen/google/protobuf/go_features_pb.js +38 -2
- package/node_modules/@bufbuild/protobuf/dist/cjs/wkt/gen/google/protobuf/timestamp_pb.d.ts +5 -5
- package/node_modules/@bufbuild/protobuf/dist/cjs/wkt/gen/google/protobuf/type_pb.d.ts +3 -3
- package/node_modules/@bufbuild/protobuf/dist/cjs/wkt/wrappers.d.ts +10 -0
- package/node_modules/@bufbuild/protobuf/dist/cjs/wkt/wrappers.js +24 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/descriptors.d.ts +12 -5
- package/node_modules/@bufbuild/protobuf/dist/esm/from-binary.js +7 -7
- package/node_modules/@bufbuild/protobuf/dist/esm/from-json.d.ts +1 -1
- package/node_modules/@bufbuild/protobuf/dist/esm/from-json.js +2 -2
- package/node_modules/@bufbuild/protobuf/dist/esm/reflect/path.d.ts +1 -1
- package/node_modules/@bufbuild/protobuf/dist/esm/registry.js +24 -1
- package/node_modules/@bufbuild/protobuf/dist/esm/to-json.d.ts +1 -1
- package/node_modules/@bufbuild/protobuf/dist/esm/to-json.js +10 -11
- package/node_modules/@bufbuild/protobuf/dist/esm/types.d.ts +1 -1
- package/node_modules/@bufbuild/protobuf/dist/esm/wire/binary-encoding.d.ts +9 -7
- package/node_modules/@bufbuild/protobuf/dist/esm/wire/binary-encoding.js +18 -8
- package/node_modules/@bufbuild/protobuf/dist/esm/wire/text-encoding.d.ts +4 -2
- package/node_modules/@bufbuild/protobuf/dist/esm/wire/text-encoding.js +8 -1
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/api_pb.d.ts +1 -1
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/compiler/plugin_pb.d.ts +2 -2
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/descriptor_pb.d.ts +37 -23
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/descriptor_pb.js +1 -1
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/field_mask_pb.d.ts +32 -36
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/go_features_pb.d.ts +65 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/go_features_pb.js +37 -1
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/timestamp_pb.d.ts +5 -5
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/type_pb.d.ts +3 -3
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/wrappers.d.ts +10 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/wrappers.js +23 -0
- package/node_modules/@bufbuild/protobuf/package.json +1 -1
- package/node_modules/@evalops/contracts/dist/headless-protocol-schemas.generated.d.ts +305 -2
- package/node_modules/@evalops/contracts/dist/headless-protocol-schemas.generated.d.ts.map +1 -1
- package/node_modules/@evalops/contracts/dist/headless-protocol-schemas.generated.js +34 -4
- package/node_modules/@evalops/contracts/dist/headless-protocol-schemas.generated.js.map +1 -1
- package/node_modules/@evalops/contracts/dist/index.d.ts +88 -0
- package/node_modules/@evalops/contracts/dist/index.d.ts.map +1 -1
- package/node_modules/@evalops/contracts/dist/index.js +2 -0
- package/node_modules/@evalops/contracts/dist/index.js.map +1 -1
- package/node_modules/@evalops/contracts/dist/proto/maestro/v1/headless_pb.d.ts +77 -77
- package/node_modules/@evalops/contracts/dist/proto/maestro/v1/headless_pb.d.ts.map +1 -1
- package/node_modules/@evalops/contracts/dist/proto/maestro/v1/headless_pb.js +1 -1
- package/node_modules/@evalops/contracts/dist/proto/maestro/v1/headless_pb.js.map +1 -1
- package/node_modules/@evalops/contracts/dist/runtime-app-server.d.ts +182 -0
- package/node_modules/@evalops/contracts/dist/runtime-app-server.d.ts.map +1 -0
- package/node_modules/@evalops/contracts/dist/runtime-app-server.js +83 -0
- package/node_modules/@evalops/contracts/dist/runtime-app-server.js.map +1 -0
- package/node_modules/@evalops/contracts/dist/runtime-server-request.d.ts +133 -0
- package/node_modules/@evalops/contracts/dist/runtime-server-request.d.ts.map +1 -0
- package/node_modules/@evalops/contracts/dist/runtime-server-request.js +68 -0
- package/node_modules/@evalops/contracts/dist/runtime-server-request.js.map +1 -0
- package/node_modules/@evalops/contracts/dist/schemas.d.ts +178 -0
- package/node_modules/@evalops/contracts/dist/schemas.d.ts.map +1 -1
- package/node_modules/@evalops/contracts/dist/schemas.js +165 -0
- package/node_modules/@evalops/contracts/dist/schemas.js.map +1 -1
- package/node_modules/@evalops/contracts/dist/typebox-utils.d.ts +2 -0
- package/node_modules/@evalops/contracts/dist/typebox-utils.d.ts.map +1 -0
- package/node_modules/@evalops/contracts/dist/typebox-utils.js +5 -0
- package/node_modules/@evalops/contracts/dist/typebox-utils.js.map +1 -0
- package/node_modules/@evalops/contracts/dist/validators.d.ts +4 -1
- package/node_modules/@evalops/contracts/dist/validators.d.ts.map +1 -1
- package/node_modules/@evalops/contracts/dist/validators.js +4 -1
- package/node_modules/@evalops/contracts/dist/validators.js.map +1 -1
- package/node_modules/@evalops/contracts/package.json +1 -1
- package/node_modules/@evalops/tui/package.json +1 -1
- package/node_modules/string-width/index.js +93 -9
- package/node_modules/string-width/package.json +1 -1
- package/package.json +32 -25
- package/dist/cli-tui/commands/grouped/auth-commands.d.ts.map +0 -1
- package/dist/cli-tui/commands/grouped/auth-commands.js.map +0 -1
- package/dist/cli-tui/commands/grouped/config-commands.d.ts.map +0 -1
- package/dist/cli-tui/commands/grouped/config-commands.js.map +0 -1
- package/dist/cli-tui/commands/grouped/diag-commands.d.ts.map +0 -1
- package/dist/cli-tui/commands/grouped/diag-commands.js.map +0 -1
- package/dist/cli-tui/commands/grouped/git-commands.d.ts.map +0 -1
- package/dist/cli-tui/commands/grouped/git-commands.js.map +0 -1
- package/dist/cli-tui/commands/grouped/index.d.ts.map +0 -1
- package/dist/cli-tui/commands/grouped/index.js.map +0 -1
- package/dist/cli-tui/commands/grouped/safety-commands.d.ts.map +0 -1
- package/dist/cli-tui/commands/grouped/safety-commands.js.map +0 -1
- package/dist/cli-tui/commands/grouped/session-commands.d.ts.map +0 -1
- package/dist/cli-tui/commands/grouped/session-commands.js.map +0 -1
- package/dist/cli-tui/commands/grouped/tools-commands.d.ts.map +0 -1
- package/dist/cli-tui/commands/grouped/tools-commands.js.map +0 -1
- package/dist/cli-tui/commands/grouped/ui-commands.d.ts.map +0 -1
- package/dist/cli-tui/commands/grouped/ui-commands.js.map +0 -1
- package/dist/cli-tui/commands/grouped/undo-commands.d.ts.map +0 -1
- package/dist/cli-tui/commands/grouped/undo-commands.js.map +0 -1
- package/dist/cli-tui/commands/grouped/usage-commands.d.ts.map +0 -1
- package/dist/cli-tui/commands/grouped/usage-commands.js.map +0 -1
- package/dist/cli-tui/commands/grouped/utils.d.ts.map +0 -1
- package/dist/cli-tui/commands/grouped/utils.js.map +0 -1
- package/dist/cli-tui/commands/grouped-command-handlers.d.ts.map +0 -1
- package/dist/cli-tui/commands/grouped-command-handlers.js +0 -135
- package/dist/cli-tui/commands/grouped-command-handlers.js.map +0 -1
- package/dist/cli-tui/tui-renderer/grouped-handlers-wiring.d.ts +0 -78
- package/dist/cli-tui/tui-renderer/grouped-handlers-wiring.d.ts.map +0 -1
- package/dist/cli-tui/tui-renderer/grouped-handlers-wiring.js +0 -129
- package/dist/cli-tui/tui-renderer/grouped-handlers-wiring.js.map +0 -1
- package/node_modules/@evalops/memory/dist/client.d.ts +0 -94
- package/node_modules/@evalops/memory/dist/client.js +0 -503
- package/node_modules/@evalops/memory/gen/proto/dist/memory/v1/memory_pb.d.ts +0 -608
- package/node_modules/@evalops/memory/gen/proto/dist/memory/v1/memory_pb.js +0 -187
- package/node_modules/@evalops/memory/package.json +0 -26
- /package/dist/cli-tui/commands/{grouped → subcommands}/usage-commands.d.ts +0 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { type DownstreamFailureMode } from "../utils/downstream-http.js";
|
|
2
|
+
type JsonRecord = Record<string, unknown>;
|
|
3
|
+
export interface MaestroFactsContextSummary {
|
|
4
|
+
thingCount: number;
|
|
5
|
+
linkCount: number;
|
|
6
|
+
pathCount: number;
|
|
7
|
+
factCount: number;
|
|
8
|
+
eventCount: number;
|
|
9
|
+
changeCount: number;
|
|
10
|
+
evidenceCount: number;
|
|
11
|
+
watermarkCount: number;
|
|
12
|
+
}
|
|
13
|
+
export interface MaestroFactsContext {
|
|
14
|
+
provider: "cerebro";
|
|
15
|
+
workspaceId: string;
|
|
16
|
+
query: string;
|
|
17
|
+
thingIds: string[];
|
|
18
|
+
linkIds: string[];
|
|
19
|
+
factIds: string[];
|
|
20
|
+
eventIds: string[];
|
|
21
|
+
things: JsonRecord[];
|
|
22
|
+
links: JsonRecord[];
|
|
23
|
+
paths: JsonRecord[];
|
|
24
|
+
facts: JsonRecord[];
|
|
25
|
+
events: JsonRecord[];
|
|
26
|
+
changes: JsonRecord[];
|
|
27
|
+
evidence: JsonRecord[];
|
|
28
|
+
watermarks: JsonRecord[];
|
|
29
|
+
summary: MaestroFactsContextSummary;
|
|
30
|
+
}
|
|
31
|
+
export interface MaestroSessionFactsInput {
|
|
32
|
+
workspaceId?: string;
|
|
33
|
+
sessionId: string;
|
|
34
|
+
actorId?: string;
|
|
35
|
+
factsQuery?: string;
|
|
36
|
+
metadata?: Record<string, unknown>;
|
|
37
|
+
}
|
|
38
|
+
export interface CerebroFactsServiceConfig {
|
|
39
|
+
baseUrl: string;
|
|
40
|
+
token?: string;
|
|
41
|
+
workspaceId?: string;
|
|
42
|
+
timeoutMs: number;
|
|
43
|
+
maxAttempts: number;
|
|
44
|
+
searchLimit: number;
|
|
45
|
+
changeLimit: number;
|
|
46
|
+
fetchImpl?: typeof fetch;
|
|
47
|
+
}
|
|
48
|
+
export declare function buildMaestroSessionFactsQuery(input: MaestroSessionFactsInput): string | undefined;
|
|
49
|
+
export declare function resolveCerebroFactsServiceConfig(): CerebroFactsServiceConfig | null;
|
|
50
|
+
export declare function gatherMaestroSessionFactsContext(input: MaestroSessionFactsInput, options?: {
|
|
51
|
+
config?: CerebroFactsServiceConfig | null;
|
|
52
|
+
signal?: AbortSignal;
|
|
53
|
+
failureMode?: DownstreamFailureMode;
|
|
54
|
+
}): Promise<MaestroFactsContext | undefined>;
|
|
55
|
+
export {};
|
|
56
|
+
//# sourceMappingURL=cerebro-facts-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cerebro-facts-client.d.ts","sourceRoot":"","sources":["../../src/platform/cerebro-facts-client.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,qBAAqB,EAE1B,MAAM,6BAA6B,CAAC;AAUrC,KAAK,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AA2B1C,MAAM,WAAW,0BAA0B;IAC1C,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,mBAAmB;IACnC,QAAQ,EAAE,SAAS,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,MAAM,EAAE,UAAU,EAAE,CAAC;IACrB,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,MAAM,EAAE,UAAU,EAAE,CAAC;IACrB,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,QAAQ,EAAE,UAAU,EAAE,CAAC;IACvB,UAAU,EAAE,UAAU,EAAE,CAAC;IACzB,OAAO,EAAE,0BAA0B,CAAC;CACpC;AAED,MAAM,WAAW,wBAAwB;IACxC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED,MAAM,WAAW,yBAAyB;IACzC,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,KAAK,CAAC;CACzB;AA2LD,wBAAgB,6BAA6B,CAC5C,KAAK,EAAE,wBAAwB,GAC7B,MAAM,GAAG,SAAS,CAYpB;AAED,wBAAgB,gCAAgC,IAAI,yBAAyB,GAAG,IAAI,CA0BnF;AAED,wBAAsB,gCAAgC,CACrD,KAAK,EAAE,wBAAwB,EAC/B,OAAO,CAAC,EAAE;IACT,MAAM,CAAC,EAAE,yBAAyB,GAAG,IAAI,CAAC;IAC1C,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,WAAW,CAAC,EAAE,qBAAqB,CAAC;CACpC,GACC,OAAO,CAAC,mBAAmB,GAAG,SAAS,CAAC,CAgJ1C"}
|
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
import { fetchDownstream, } from "../utils/downstream-http.js";
|
|
2
|
+
import { getEnvValue, normalizeBaseUrl, parsePositiveInt, resolveConfiguredToken, resolveWorkspaceId, trimString, } from "./client.js";
|
|
3
|
+
const DEFAULT_TIMEOUT_MS = 1_500;
|
|
4
|
+
const DEFAULT_MAX_ATTEMPTS = 1;
|
|
5
|
+
const DEFAULT_SEARCH_LIMIT = 5;
|
|
6
|
+
const DEFAULT_CHANGE_LIMIT = 10;
|
|
7
|
+
const CEREBRO_BASE_URL_ENV_VARS = [
|
|
8
|
+
"MAESTRO_CEREBRO_URL",
|
|
9
|
+
"CEREBRO_URL",
|
|
10
|
+
"CEREBRO_SERVICE_URL",
|
|
11
|
+
];
|
|
12
|
+
const CEREBRO_TOKEN_ENV_VARS = [
|
|
13
|
+
"MAESTRO_CEREBRO_TOKEN",
|
|
14
|
+
"CEREBRO_TOKEN",
|
|
15
|
+
"MAESTRO_EVALOPS_ACCESS_TOKEN",
|
|
16
|
+
"EVALOPS_TOKEN",
|
|
17
|
+
];
|
|
18
|
+
const CEREBRO_WORKSPACE_ENV_VARS = [
|
|
19
|
+
"MAESTRO_CEREBRO_WORKSPACE_ID",
|
|
20
|
+
"CEREBRO_WORKSPACE_ID",
|
|
21
|
+
"MAESTRO_AGENT_RUNTIME_WORKSPACE_ID",
|
|
22
|
+
"AGENT_RUNTIME_WORKSPACE_ID",
|
|
23
|
+
"MAESTRO_WORKSPACE_ID",
|
|
24
|
+
"EVALOPS_WORKSPACE_ID",
|
|
25
|
+
];
|
|
26
|
+
const CEREBRO_TIMEOUT_ENV_VARS = [
|
|
27
|
+
"MAESTRO_CEREBRO_TIMEOUT_MS",
|
|
28
|
+
"CEREBRO_TIMEOUT_MS",
|
|
29
|
+
];
|
|
30
|
+
const CEREBRO_MAX_ATTEMPTS_ENV_VARS = [
|
|
31
|
+
"MAESTRO_CEREBRO_MAX_ATTEMPTS",
|
|
32
|
+
"CEREBRO_MAX_ATTEMPTS",
|
|
33
|
+
];
|
|
34
|
+
const CEREBRO_SEARCH_LIMIT_ENV_VARS = [
|
|
35
|
+
"MAESTRO_CEREBRO_SEARCH_LIMIT",
|
|
36
|
+
"CEREBRO_SEARCH_LIMIT",
|
|
37
|
+
];
|
|
38
|
+
const CEREBRO_CHANGE_LIMIT_ENV_VARS = [
|
|
39
|
+
"MAESTRO_CEREBRO_CHANGE_LIMIT",
|
|
40
|
+
"CEREBRO_CHANGE_LIMIT",
|
|
41
|
+
];
|
|
42
|
+
const CEREBRO_SERVICE_PATH = "/cerebro.v1.CerebroService/";
|
|
43
|
+
const CEREBRO_SERVICE_SUFFIX = "/cerebro.v1.CerebroService";
|
|
44
|
+
function jsonRecordArray(value) {
|
|
45
|
+
return Array.isArray(value)
|
|
46
|
+
? value.filter((item) => typeof item === "object" && item !== null && !Array.isArray(item))
|
|
47
|
+
: [];
|
|
48
|
+
}
|
|
49
|
+
function recordId(record) {
|
|
50
|
+
const id = record.id;
|
|
51
|
+
return typeof id === "string" && id.trim().length > 0 ? id : undefined;
|
|
52
|
+
}
|
|
53
|
+
function recordString(record, name) {
|
|
54
|
+
const value = record[name];
|
|
55
|
+
return typeof value === "string" ? value.trim() : "";
|
|
56
|
+
}
|
|
57
|
+
function pushUniqueRecord(records, seen, record) {
|
|
58
|
+
if (!record) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
const id = recordId(record);
|
|
62
|
+
if (id && seen.has(id)) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
if (id) {
|
|
66
|
+
seen.add(id);
|
|
67
|
+
}
|
|
68
|
+
records.push(record);
|
|
69
|
+
}
|
|
70
|
+
function recordStringArray(record, name) {
|
|
71
|
+
const value = record[name];
|
|
72
|
+
return Array.isArray(value)
|
|
73
|
+
? value
|
|
74
|
+
.filter((item) => typeof item === "string" && item.trim().length > 0)
|
|
75
|
+
.map((item) => item.trim())
|
|
76
|
+
: [];
|
|
77
|
+
}
|
|
78
|
+
function pathKey(path) {
|
|
79
|
+
const id = recordId(path);
|
|
80
|
+
if (id) {
|
|
81
|
+
return `id:${id}`;
|
|
82
|
+
}
|
|
83
|
+
const thingIds = recordStringArray(path, "thingIds");
|
|
84
|
+
const linkIds = recordStringArray(path, "linkIds");
|
|
85
|
+
if (thingIds.length === 0 && linkIds.length === 0) {
|
|
86
|
+
return undefined;
|
|
87
|
+
}
|
|
88
|
+
return `${thingIds.join("\u0000")}\u0001${linkIds.join("\u0000")}`;
|
|
89
|
+
}
|
|
90
|
+
function pushUniquePath(paths, seen, path) {
|
|
91
|
+
if (!path) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
const key = pathKey(path);
|
|
95
|
+
if (!key || seen.has(key)) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
seen.add(key);
|
|
99
|
+
paths.push(path);
|
|
100
|
+
}
|
|
101
|
+
function changeKey(change) {
|
|
102
|
+
const id = recordId(change);
|
|
103
|
+
if (id) {
|
|
104
|
+
return `id:${id}`;
|
|
105
|
+
}
|
|
106
|
+
const event = change.event;
|
|
107
|
+
if (typeof event === "object" && event !== null && !Array.isArray(event)) {
|
|
108
|
+
const eventId = recordString(event, "id");
|
|
109
|
+
if (eventId) {
|
|
110
|
+
return `event:${eventId}`;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
const affectedThingIds = recordStringArray(change, "affectedThingIds");
|
|
114
|
+
const whyItMatters = recordString(change, "whyItMatters");
|
|
115
|
+
if (affectedThingIds.length === 0 && !whyItMatters) {
|
|
116
|
+
return undefined;
|
|
117
|
+
}
|
|
118
|
+
return `${affectedThingIds.join("\u0000")}\u0001${whyItMatters}`;
|
|
119
|
+
}
|
|
120
|
+
function pushUniqueChange(changes, seen, change) {
|
|
121
|
+
if (!change) {
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
const key = changeKey(change);
|
|
125
|
+
if (!key || seen.has(key)) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
seen.add(key);
|
|
129
|
+
changes.push(change);
|
|
130
|
+
}
|
|
131
|
+
function isAbortError(error) {
|
|
132
|
+
return error instanceof Error && error.name === "AbortError";
|
|
133
|
+
}
|
|
134
|
+
function pickMetadataString(metadata, ...names) {
|
|
135
|
+
for (const name of names) {
|
|
136
|
+
const value = metadata?.[name];
|
|
137
|
+
if (typeof value === "string" && value.trim().length > 0) {
|
|
138
|
+
return value.trim();
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
return undefined;
|
|
142
|
+
}
|
|
143
|
+
function normalizeCerebroBaseUrl(baseUrl) {
|
|
144
|
+
return normalizeBaseUrl(baseUrl, [CEREBRO_SERVICE_SUFFIX]);
|
|
145
|
+
}
|
|
146
|
+
export function buildMaestroSessionFactsQuery(input) {
|
|
147
|
+
return (trimString(input.factsQuery) ??
|
|
148
|
+
pickMetadataString(input.metadata, "prompt", "objective", "task", "title", "workspace_root"));
|
|
149
|
+
}
|
|
150
|
+
export function resolveCerebroFactsServiceConfig() {
|
|
151
|
+
const baseUrl = getEnvValue(CEREBRO_BASE_URL_ENV_VARS);
|
|
152
|
+
if (!baseUrl) {
|
|
153
|
+
return null;
|
|
154
|
+
}
|
|
155
|
+
return {
|
|
156
|
+
baseUrl: normalizeCerebroBaseUrl(baseUrl),
|
|
157
|
+
token: resolveConfiguredToken(CEREBRO_TOKEN_ENV_VARS),
|
|
158
|
+
workspaceId: resolveWorkspaceId(CEREBRO_WORKSPACE_ENV_VARS),
|
|
159
|
+
timeoutMs: parsePositiveInt(getEnvValue(CEREBRO_TIMEOUT_ENV_VARS), DEFAULT_TIMEOUT_MS),
|
|
160
|
+
maxAttempts: parsePositiveInt(getEnvValue(CEREBRO_MAX_ATTEMPTS_ENV_VARS), DEFAULT_MAX_ATTEMPTS),
|
|
161
|
+
searchLimit: parsePositiveInt(getEnvValue(CEREBRO_SEARCH_LIMIT_ENV_VARS), DEFAULT_SEARCH_LIMIT),
|
|
162
|
+
changeLimit: parsePositiveInt(getEnvValue(CEREBRO_CHANGE_LIMIT_ENV_VARS), DEFAULT_CHANGE_LIMIT),
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
export async function gatherMaestroSessionFactsContext(input, options) {
|
|
166
|
+
const config = options?.config ?? resolveCerebroFactsServiceConfig();
|
|
167
|
+
const workspaceId = trimString(input.workspaceId) ?? config?.workspaceId;
|
|
168
|
+
const query = buildMaestroSessionFactsQuery(input);
|
|
169
|
+
if (!config || !workspaceId || !query) {
|
|
170
|
+
return undefined;
|
|
171
|
+
}
|
|
172
|
+
const things = [];
|
|
173
|
+
const links = [];
|
|
174
|
+
const paths = [];
|
|
175
|
+
const facts = [];
|
|
176
|
+
const events = [];
|
|
177
|
+
const changes = [];
|
|
178
|
+
const evidence = [];
|
|
179
|
+
const watermarks = [];
|
|
180
|
+
const thingIds = new Set();
|
|
181
|
+
const linkIds = new Set();
|
|
182
|
+
const pathIds = new Set();
|
|
183
|
+
const factIds = new Set();
|
|
184
|
+
const eventIds = new Set();
|
|
185
|
+
const changeIds = new Set();
|
|
186
|
+
const evidenceIds = new Set();
|
|
187
|
+
const search = await postCerebro(config, "Search", {
|
|
188
|
+
workspaceId,
|
|
189
|
+
query,
|
|
190
|
+
limit: config.searchLimit,
|
|
191
|
+
includeMap: true,
|
|
192
|
+
}, { signal: options?.signal, failureMode: options?.failureMode });
|
|
193
|
+
for (const thing of jsonRecordArray(search.things)) {
|
|
194
|
+
pushUniqueRecord(things, thingIds, thing);
|
|
195
|
+
}
|
|
196
|
+
for (const link of jsonRecordArray(search.links)) {
|
|
197
|
+
pushUniqueRecord(links, linkIds, link);
|
|
198
|
+
}
|
|
199
|
+
for (const item of jsonRecordArray(search.evidence)) {
|
|
200
|
+
pushUniqueRecord(evidence, evidenceIds, item);
|
|
201
|
+
}
|
|
202
|
+
const mapThingIds = [...thingIds];
|
|
203
|
+
const thingResponses = await Promise.all(mapThingIds.map((thingId) => postCerebro(config, "GetThing", { workspaceId, thingId }, { signal: options?.signal, failureMode: options?.failureMode })));
|
|
204
|
+
for (const response of thingResponses) {
|
|
205
|
+
pushUniqueRecord(things, thingIds, response.thing);
|
|
206
|
+
for (const fact of jsonRecordArray(response.facts)) {
|
|
207
|
+
pushUniqueRecord(facts, factIds, fact);
|
|
208
|
+
}
|
|
209
|
+
for (const event of jsonRecordArray(response.recentEvents)) {
|
|
210
|
+
pushUniqueRecord(events, eventIds, event);
|
|
211
|
+
}
|
|
212
|
+
for (const item of jsonRecordArray(response.evidence)) {
|
|
213
|
+
pushUniqueRecord(evidence, evidenceIds, item);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
const changeThingIds = [...thingIds];
|
|
217
|
+
if (mapThingIds.length > 0) {
|
|
218
|
+
const mapResults = await Promise.allSettled(mapThingIds.map((thingId) => postCerebro(config, "MapThing", { workspaceId, thingId, depth: 1 }, { signal: options?.signal, failureMode: options?.failureMode })));
|
|
219
|
+
for (const result of mapResults) {
|
|
220
|
+
if (result.status === "rejected") {
|
|
221
|
+
if (isAbortError(result.reason)) {
|
|
222
|
+
throw result.reason;
|
|
223
|
+
}
|
|
224
|
+
continue;
|
|
225
|
+
}
|
|
226
|
+
const response = result.value;
|
|
227
|
+
pushUniqueRecord(things, thingIds, response.root);
|
|
228
|
+
for (const thing of jsonRecordArray(response.things)) {
|
|
229
|
+
pushUniqueRecord(things, thingIds, thing);
|
|
230
|
+
}
|
|
231
|
+
for (const link of jsonRecordArray(response.links)) {
|
|
232
|
+
pushUniqueRecord(links, linkIds, link);
|
|
233
|
+
}
|
|
234
|
+
for (const path of jsonRecordArray(response.paths)) {
|
|
235
|
+
pushUniquePath(paths, pathIds, path);
|
|
236
|
+
}
|
|
237
|
+
for (const item of jsonRecordArray(response.evidence)) {
|
|
238
|
+
pushUniqueRecord(evidence, evidenceIds, item);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
if (changeThingIds.length > 0) {
|
|
243
|
+
const response = await postCerebro(config, "ListChanges", { workspaceId, thingIds: changeThingIds, limit: config.changeLimit }, { signal: options?.signal, failureMode: options?.failureMode });
|
|
244
|
+
for (const change of jsonRecordArray(response.changes)) {
|
|
245
|
+
pushUniqueChange(changes, changeIds, change);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
return {
|
|
249
|
+
provider: "cerebro",
|
|
250
|
+
workspaceId,
|
|
251
|
+
query,
|
|
252
|
+
thingIds: [...thingIds],
|
|
253
|
+
linkIds: [...linkIds],
|
|
254
|
+
factIds: [...factIds],
|
|
255
|
+
eventIds: [...eventIds],
|
|
256
|
+
things,
|
|
257
|
+
links,
|
|
258
|
+
paths,
|
|
259
|
+
facts,
|
|
260
|
+
events,
|
|
261
|
+
changes,
|
|
262
|
+
evidence,
|
|
263
|
+
watermarks,
|
|
264
|
+
summary: {
|
|
265
|
+
thingCount: things.length,
|
|
266
|
+
linkCount: links.length,
|
|
267
|
+
pathCount: paths.length,
|
|
268
|
+
factCount: facts.length,
|
|
269
|
+
eventCount: events.length,
|
|
270
|
+
changeCount: changes.length,
|
|
271
|
+
evidenceCount: evidence.length,
|
|
272
|
+
watermarkCount: watermarks.length,
|
|
273
|
+
},
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
async function postCerebro(config, method, body, options) {
|
|
277
|
+
const response = await fetchDownstream(`${config.baseUrl}${CEREBRO_SERVICE_PATH}${method}`, {
|
|
278
|
+
method: "POST",
|
|
279
|
+
headers: {
|
|
280
|
+
"Content-Type": "application/json",
|
|
281
|
+
...(config.token ? { Authorization: `Bearer ${config.token}` } : {}),
|
|
282
|
+
},
|
|
283
|
+
body: JSON.stringify(body),
|
|
284
|
+
signal: options?.signal,
|
|
285
|
+
}, {
|
|
286
|
+
serviceName: "cerebro facts service",
|
|
287
|
+
failureMode: options?.failureMode ?? "optional",
|
|
288
|
+
timeoutMs: config.timeoutMs,
|
|
289
|
+
maxAttempts: config.maxAttempts,
|
|
290
|
+
fetchImpl: config.fetchImpl,
|
|
291
|
+
});
|
|
292
|
+
if (!response.ok) {
|
|
293
|
+
throw new Error(`cerebro facts service returned ${response.status}: ${(await response.text()) || response.statusText}`);
|
|
294
|
+
}
|
|
295
|
+
return (await response.json());
|
|
296
|
+
}
|
|
297
|
+
//# sourceMappingURL=cerebro-facts-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cerebro-facts-client.js","sourceRoot":"","sources":["../../src/platform/cerebro-facts-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,eAAe,GACf,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACN,WAAW,EACX,gBAAgB,EAChB,g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ils/downstream-http.js\";\nimport {\n\tgetEnvValue,\n\tnormalizeBaseUrl,\n\tparsePositiveInt,\n\tresolveConfiguredToken,\n\tresolveWorkspaceId,\n\ttrimString,\n} from \"./client.js\";\n\ntype JsonRecord = Record<string, unknown>;\n\ninterface CerebroSearchResponse {\n\tthings?: JsonRecord[];\n\tlinks?: JsonRecord[];\n\tevidence?: JsonRecord[];\n}\n\ninterface CerebroGetThingResponse {\n\tthing?: JsonRecord;\n\tfacts?: JsonRecord[];\n\trecentEvents?: JsonRecord[];\n\tevidence?: JsonRecord[];\n}\n\ninterface CerebroListChangesResponse {\n\tchanges?: JsonRecord[];\n}\n\ninterface CerebroMapThingResponse {\n\troot?: JsonRecord;\n\tthings?: JsonRecord[];\n\tlinks?: JsonRecord[];\n\tpaths?: JsonRecord[];\n\tevidence?: JsonRecord[];\n}\n\nexport interface MaestroFactsContextSummary {\n\tthingCount: number;\n\tlinkCount: number;\n\tpathCount: number;\n\tfactCount: number;\n\teventCount: number;\n\tchangeCount: number;\n\tevidenceCount: number;\n\twatermarkCount: number;\n}\n\nexport interface MaestroFactsContext {\n\tprovider: \"cerebro\";\n\tworkspaceId: string;\n\tquery: string;\n\tthingIds: string[];\n\tlinkIds: string[];\n\tfactIds: string[];\n\teventIds: string[];\n\tthings: JsonRecord[];\n\tlinks: JsonRecord[];\n\tpaths: JsonRecord[];\n\tfacts: JsonRecord[];\n\tevents: JsonRecord[];\n\tchanges: JsonRecord[];\n\tevidence: JsonRecord[];\n\twatermarks: JsonRecord[];\n\tsummary: MaestroFactsContextSummary;\n}\n\nexport interface MaestroSessionFactsInput {\n\tworkspaceId?: string;\n\tsessionId: string;\n\tactorId?: string;\n\tfactsQuery?: string;\n\tmetadata?: Record<string, unknown>;\n}\n\nexport interface CerebroFactsServiceConfig {\n\tbaseUrl: string;\n\ttoken?: string;\n\tworkspaceId?: string;\n\ttimeoutMs: number;\n\tmaxAttempts: number;\n\tsearchLimit: number;\n\tchangeLimit: number;\n\tfetchImpl?: typeof fetch;\n}\n\nconst DEFAULT_TIMEOUT_MS = 1_500;\nconst DEFAULT_MAX_ATTEMPTS = 1;\nconst DEFAULT_SEARCH_LIMIT = 5;\nconst DEFAULT_CHANGE_LIMIT = 10;\n\nconst CEREBRO_BASE_URL_ENV_VARS = [\n\t\"MAESTRO_CEREBRO_URL\",\n\t\"CEREBRO_URL\",\n\t\"CEREBRO_SERVICE_URL\",\n] as const;\n\nconst CEREBRO_TOKEN_ENV_VARS = [\n\t\"MAESTRO_CEREBRO_TOKEN\",\n\t\"CEREBRO_TOKEN\",\n\t\"MAESTRO_EVALOPS_ACCESS_TOKEN\",\n\t\"EVALOPS_TOKEN\",\n] as const;\n\nconst CEREBRO_WORKSPACE_ENV_VARS = [\n\t\"MAESTRO_CEREBRO_WORKSPACE_ID\",\n\t\"CEREBRO_WORKSPACE_ID\",\n\t\"MAESTRO_AGENT_RUNTIME_WORKSPACE_ID\",\n\t\"AGENT_RUNTIME_WORKSPACE_ID\",\n\t\"MAESTRO_WORKSPACE_ID\",\n\t\"EVALOPS_WORKSPACE_ID\",\n] as const;\n\nconst CEREBRO_TIMEOUT_ENV_VARS = [\n\t\"MAESTRO_CEREBRO_TIMEOUT_MS\",\n\t\"CEREBRO_TIMEOUT_MS\",\n] as const;\n\nconst CEREBRO_MAX_ATTEMPTS_ENV_VARS = [\n\t\"MAESTRO_CEREBRO_MAX_ATTEMPTS\",\n\t\"CEREBRO_MAX_ATTEMPTS\",\n] as const;\n\nconst CEREBRO_SEARCH_LIMIT_ENV_VARS = [\n\t\"MAESTRO_CEREBRO_SEARCH_LIMIT\",\n\t\"CEREBRO_SEARCH_LIMIT\",\n] as const;\n\nconst CEREBRO_CHANGE_LIMIT_ENV_VARS = [\n\t\"MAESTRO_CEREBRO_CHANGE_LIMIT\",\n\t\"CEREBRO_CHANGE_LIMIT\",\n] as const;\n\nconst CEREBRO_SERVICE_PATH = \"/cerebro.v1.CerebroService/\";\nconst CEREBRO_SERVICE_SUFFIX = \"/cerebro.v1.CerebroService\";\n\nfunction jsonRecordArray(value: unknown): JsonRecord[] {\n\treturn Array.isArray(value)\n\t\t? value.filter(\n\t\t\t\t(item): item is JsonRecord =>\n\t\t\t\t\ttypeof item === \"object\" && item !== null && !Array.isArray(item),\n\t\t\t)\n\t\t: [];\n}\n\nfunction recordId(record: JsonRecord): string | undefined {\n\tconst id = record.id;\n\treturn typeof id === \"string\" && id.trim().length > 0 ? id : undefined;\n}\n\nfunction recordString(record: JsonRecord, name: string): string {\n\tconst value = record[name];\n\treturn typeof value === \"string\" ? value.trim() : \"\";\n}\n\nfunction pushUniqueRecord(\n\trecords: JsonRecord[],\n\tseen: Set<string>,\n\trecord: JsonRecord | undefined,\n): void {\n\tif (!record) {\n\t\treturn;\n\t}\n\tconst id = recordId(record);\n\tif (id && seen.has(id)) {\n\t\treturn;\n\t}\n\tif (id) {\n\t\tseen.add(id);\n\t}\n\trecords.push(record);\n}\n\nfunction recordStringArray(record: JsonRecord, name: string): string[] {\n\tconst value = record[name];\n\treturn Array.isArray(value)\n\t\t? value\n\t\t\t\t.filter(\n\t\t\t\t\t(item): item is string =>\n\t\t\t\t\t\ttypeof item === \"string\" && item.trim().length > 0,\n\t\t\t\t)\n\t\t\t\t.map((item) => item.trim())\n\t\t: [];\n}\n\nfunction pathKey(path: JsonRecord): string | undefined {\n\tconst id = recordId(path);\n\tif (id) {\n\t\treturn `id:${id}`;\n\t}\n\tconst thingIds = recordStringArray(path, \"thingIds\");\n\tconst linkIds = recordStringArray(path, \"linkIds\");\n\tif (thingIds.length === 0 && linkIds.length === 0) {\n\t\treturn undefined;\n\t}\n\treturn `${thingIds.join(\"\\u0000\")}\\u0001${linkIds.join(\"\\u0000\")}`;\n}\n\nfunction pushUniquePath(\n\tpaths: JsonRecord[],\n\tseen: Set<string>,\n\tpath: JsonRecord | undefined,\n): void {\n\tif (!path) {\n\t\treturn;\n\t}\n\tconst key = pathKey(path);\n\tif (!key || seen.has(key)) {\n\t\treturn;\n\t}\n\tseen.add(key);\n\tpaths.push(path);\n}\n\nfunction changeKey(change: JsonRecord): string | undefined {\n\tconst id = recordId(change);\n\tif (id) {\n\t\treturn `id:${id}`;\n\t}\n\tconst event = change.event;\n\tif (typeof event === \"object\" && event !== null && !Array.isArray(event)) {\n\t\tconst eventId = recordString(event as JsonRecord, \"id\");\n\t\tif (eventId) {\n\t\t\treturn `event:${eventId}`;\n\t\t}\n\t}\n\tconst affectedThingIds = recordStringArray(change, \"affectedThingIds\");\n\tconst whyItMatters = recordString(change, \"whyItMatters\");\n\tif (affectedThingIds.length === 0 && !whyItMatters) {\n\t\treturn undefined;\n\t}\n\treturn `${affectedThingIds.join(\"\\u0000\")}\\u0001${whyItMatters}`;\n}\n\nfunction pushUniqueChange(\n\tchanges: JsonRecord[],\n\tseen: Set<string>,\n\tchange: JsonRecord | undefined,\n): void {\n\tif (!change) {\n\t\treturn;\n\t}\n\tconst key = changeKey(change);\n\tif (!key || seen.has(key)) {\n\t\treturn;\n\t}\n\tseen.add(key);\n\tchanges.push(change);\n}\n\nfunction isAbortError(error: unknown): boolean {\n\treturn error instanceof Error && error.name === \"AbortError\";\n}\n\nfunction pickMetadataString(\n\tmetadata: Record<string, unknown> | undefined,\n\t...names: string[]\n): string | undefined {\n\tfor (const name of names) {\n\t\tconst value = metadata?.[name];\n\t\tif (typeof value === \"string\" && value.trim().length > 0) {\n\t\t\treturn value.trim();\n\t\t}\n\t}\n\treturn undefined;\n}\n\nfunction normalizeCerebroBaseUrl(baseUrl: string): string {\n\treturn normalizeBaseUrl(baseUrl, [CEREBRO_SERVICE_SUFFIX]);\n}\n\nexport function buildMaestroSessionFactsQuery(\n\tinput: MaestroSessionFactsInput,\n): string | undefined {\n\treturn (\n\t\ttrimString(input.factsQuery) ??\n\t\tpickMetadataString(\n\t\t\tinput.metadata,\n\t\t\t\"prompt\",\n\t\t\t\"objective\",\n\t\t\t\"task\",\n\t\t\t\"title\",\n\t\t\t\"workspace_root\",\n\t\t)\n\t);\n}\n\nexport function resolveCerebroFactsServiceConfig(): CerebroFactsServiceConfig | null {\n\tconst baseUrl = getEnvValue(CEREBRO_BASE_URL_ENV_VARS);\n\tif (!baseUrl) {\n\t\treturn null;\n\t}\n\treturn {\n\t\tbaseUrl: normalizeCerebroBaseUrl(baseUrl),\n\t\ttoken: resolveConfiguredToken(CEREBRO_TOKEN_ENV_VARS),\n\t\tworkspaceId: resolveWorkspaceId(CEREBRO_WORKSPACE_ENV_VARS),\n\t\ttimeoutMs: parsePositiveInt(\n\t\t\tgetEnvValue(CEREBRO_TIMEOUT_ENV_VARS),\n\t\t\tDEFAULT_TIMEOUT_MS,\n\t\t),\n\t\tmaxAttempts: parsePositiveInt(\n\t\t\tgetEnvValue(CEREBRO_MAX_ATTEMPTS_ENV_VARS),\n\t\t\tDEFAULT_MAX_ATTEMPTS,\n\t\t),\n\t\tsearchLimit: parsePositiveInt(\n\t\t\tgetEnvValue(CEREBRO_SEARCH_LIMIT_ENV_VARS),\n\t\t\tDEFAULT_SEARCH_LIMIT,\n\t\t),\n\t\tchangeLimit: parsePositiveInt(\n\t\t\tgetEnvValue(CEREBRO_CHANGE_LIMIT_ENV_VARS),\n\t\t\tDEFAULT_CHANGE_LIMIT,\n\t\t),\n\t};\n}\n\nexport async function gatherMaestroSessionFactsContext(\n\tinput: MaestroSessionFactsInput,\n\toptions?: {\n\t\tconfig?: CerebroFactsServiceConfig | null;\n\t\tsignal?: AbortSignal;\n\t\tfailureMode?: DownstreamFailureMode;\n\t},\n): Promise<MaestroFactsContext | undefined> {\n\tconst config = options?.config ?? resolveCerebroFactsServiceConfig();\n\tconst workspaceId = trimString(input.workspaceId) ?? config?.workspaceId;\n\tconst query = buildMaestroSessionFactsQuery(input);\n\tif (!config || !workspaceId || !query) {\n\t\treturn undefined;\n\t}\n\n\tconst things: JsonRecord[] = [];\n\tconst links: JsonRecord[] = [];\n\tconst paths: JsonRecord[] = [];\n\tconst facts: JsonRecord[] = [];\n\tconst events: JsonRecord[] = [];\n\tconst changes: JsonRecord[] = [];\n\tconst evidence: JsonRecord[] = [];\n\tconst watermarks: JsonRecord[] = [];\n\tconst thingIds = new Set<string>();\n\tconst linkIds = new Set<string>();\n\tconst pathIds = new Set<string>();\n\tconst factIds = new Set<string>();\n\tconst eventIds = new Set<string>();\n\tconst changeIds = new Set<string>();\n\tconst evidenceIds = new Set<string>();\n\n\tconst search = await postCerebro<CerebroSearchResponse>(\n\t\tconfig,\n\t\t\"Search\",\n\t\t{\n\t\t\tworkspaceId,\n\t\t\tquery,\n\t\t\tlimit: config.searchLimit,\n\t\t\tincludeMap: true,\n\t\t},\n\t\t{ signal: options?.signal, failureMode: options?.failureMode },\n\t);\n\tfor (const thing of jsonRecordArray(search.things)) {\n\t\tpushUniqueRecord(things, thingIds, thing);\n\t}\n\tfor (const link of jsonRecordArray(search.links)) {\n\t\tpushUniqueRecord(links, linkIds, link);\n\t}\n\tfor (const item of jsonRecordArray(search.evidence)) {\n\t\tpushUniqueRecord(evidence, evidenceIds, item);\n\t}\n\n\tconst mapThingIds = [...thingIds];\n\tconst thingResponses = await Promise.all(\n\t\tmapThingIds.map((thingId) =>\n\t\t\tpostCerebro<CerebroGetThingResponse>(\n\t\t\t\tconfig,\n\t\t\t\t\"GetThing\",\n\t\t\t\t{ workspaceId, thingId },\n\t\t\t\t{ signal: options?.signal, failureMode: options?.failureMode },\n\t\t\t),\n\t\t),\n\t);\n\tfor (const response of thingResponses) {\n\t\tpushUniqueRecord(things, thingIds, response.thing);\n\t\tfor (const fact of jsonRecordArray(response.facts)) {\n\t\t\tpushUniqueRecord(facts, factIds, fact);\n\t\t}\n\t\tfor (const event of jsonRecordArray(response.recentEvents)) {\n\t\t\tpushUniqueRecord(events, eventIds, event);\n\t\t}\n\t\tfor (const item of jsonRecordArray(response.evidence)) {\n\t\t\tpushUniqueRecord(evidence, evidenceIds, item);\n\t\t}\n\t}\n\n\tconst changeThingIds = [...thingIds];\n\tif (mapThingIds.length > 0) {\n\t\tconst mapResults = await Promise.allSettled(\n\t\t\tmapThingIds.map((thingId) =>\n\t\t\t\tpostCerebro<CerebroMapThingResponse>(\n\t\t\t\t\tconfig,\n\t\t\t\t\t\"MapThing\",\n\t\t\t\t\t{ workspaceId, thingId, depth: 1 },\n\t\t\t\t\t{ signal: options?.signal, failureMode: options?.failureMode },\n\t\t\t\t),\n\t\t\t),\n\t\t);\n\t\tfor (const result of mapResults) {\n\t\t\tif (result.status === \"rejected\") {\n\t\t\t\tif (isAbortError(result.reason)) {\n\t\t\t\t\tthrow result.reason;\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst response = result.value;\n\t\t\tpushUniqueRecord(things, thingIds, response.root);\n\t\t\tfor (const thing of jsonRecordArray(response.things)) {\n\t\t\t\tpushUniqueRecord(things, thingIds, thing);\n\t\t\t}\n\t\t\tfor (const link of jsonRecordArray(response.links)) {\n\t\t\t\tpushUniqueRecord(links, linkIds, link);\n\t\t\t}\n\t\t\tfor (const path of jsonRecordArray(response.paths)) {\n\t\t\t\tpushUniquePath(paths, pathIds, path);\n\t\t\t}\n\t\t\tfor (const item of jsonRecordArray(response.evidence)) {\n\t\t\t\tpushUniqueRecord(evidence, evidenceIds, item);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (changeThingIds.length > 0) {\n\t\tconst response = await postCerebro<CerebroListChangesResponse>(\n\t\t\tconfig,\n\t\t\t\"ListChanges\",\n\t\t\t{ workspaceId, thingIds: changeThingIds, limit: config.changeLimit },\n\t\t\t{ signal: options?.signal, failureMode: options?.failureMode },\n\t\t);\n\t\tfor (const change of jsonRecordArray(response.changes)) {\n\t\t\tpushUniqueChange(changes, changeIds, change);\n\t\t}\n\t}\n\n\treturn {\n\t\tprovider: \"cerebro\",\n\t\tworkspaceId,\n\t\tquery,\n\t\tthingIds: [...thingIds],\n\t\tlinkIds: [...linkIds],\n\t\tfactIds: [...factIds],\n\t\teventIds: [...eventIds],\n\t\tthings,\n\t\tlinks,\n\t\tpaths,\n\t\tfacts,\n\t\tevents,\n\t\tchanges,\n\t\tevidence,\n\t\twatermarks,\n\t\tsummary: {\n\t\t\tthingCount: things.length,\n\t\t\tlinkCount: links.length,\n\t\t\tpathCount: paths.length,\n\t\t\tfactCount: facts.length,\n\t\t\teventCount: events.length,\n\t\t\tchangeCount: changes.length,\n\t\t\tevidenceCount: evidence.length,\n\t\t\twatermarkCount: watermarks.length,\n\t\t},\n\t};\n}\n\nasync function postCerebro<ResponseBody>(\n\tconfig: CerebroFactsServiceConfig,\n\tmethod: string,\n\tbody: JsonRecord,\n\toptions?: {\n\t\tsignal?: AbortSignal;\n\t\tfailureMode?: DownstreamFailureMode;\n\t},\n): Promise<ResponseBody> {\n\tconst response = await fetchDownstream(\n\t\t`${config.baseUrl}${CEREBRO_SERVICE_PATH}${method}`,\n\t\t{\n\t\t\tmethod: \"POST\",\n\t\t\theaders: {\n\t\t\t\t\"Content-Type\": \"application/json\",\n\t\t\t\t...(config.token ? { Authorization: `Bearer ${config.token}` } : {}),\n\t\t\t},\n\t\t\tbody: JSON.stringify(body),\n\t\t\tsignal: options?.signal,\n\t\t},\n\t\t{\n\t\t\tserviceName: \"cerebro facts service\",\n\t\t\tfailureMode: options?.failureMode ?? \"optional\",\n\t\t\ttimeoutMs: config.timeoutMs,\n\t\t\tmaxAttempts: config.maxAttempts,\n\t\t\tfetchImpl: config.fetchImpl,\n\t\t},\n\t);\n\tif (!response.ok) {\n\t\tthrow new Error(\n\t\t\t`cerebro facts service returned ${response.status}: ${\n\t\t\t\t(await response.text()) || response.statusText\n\t\t\t}`,\n\t\t);\n\t}\n\treturn (await response.json()) as ResponseBody;\n}\n"]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type DownstreamFailureMode } from "../utils/downstream-http.js";
|
|
1
2
|
export declare const CONNECT_PROTOCOL_VERSION = "1";
|
|
2
3
|
export declare const DEFAULT_PLATFORM_TIMEOUT_MS = 2000;
|
|
3
4
|
export declare const DEFAULT_PLATFORM_MAX_ATTEMPTS = 2;
|
|
@@ -27,6 +28,7 @@ export interface ResolvePlatformServiceConfigOptions {
|
|
|
27
28
|
}
|
|
28
29
|
export interface PlatformRequestOptions {
|
|
29
30
|
serviceName: string;
|
|
31
|
+
failureMode: DownstreamFailureMode;
|
|
30
32
|
timeoutMs: number;
|
|
31
33
|
maxAttempts?: number;
|
|
32
34
|
signal?: AbortSignal;
|
|
@@ -42,6 +44,5 @@ export declare function resolveConfiguredToken(envVars?: readonly string[]): str
|
|
|
42
44
|
export declare function resolvePlatformToken(envVars?: readonly string[]): Promise<string | undefined>;
|
|
43
45
|
export declare function resolvePlatformServiceConfig(options: ResolvePlatformServiceConfigOptions): Promise<PlatformServiceConfig | null>;
|
|
44
46
|
export declare function buildPlatformConnectHeaders(config: Pick<PlatformServiceConfig, "organizationId" | "token">, extraHeaders?: Record<string, string | undefined>): Record<string, string>;
|
|
45
|
-
export declare function fetchWithRetry(url: string, init: RequestInit, options: PlatformRequestOptions): Promise<Response>;
|
|
46
47
|
export declare function postPlatformConnect(config: PlatformServiceConfig, path: string, body: Record<string, unknown>, options: PlatformRequestOptions, headers?: Record<string, string | undefined>): Promise<Response>;
|
|
47
48
|
//# sourceMappingURL=client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/platform/client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/platform/client.ts"],"names":[],"mappings":"AAEA,OAAO,EACN,KAAK,qBAAqB,EAE1B,MAAM,6BAA6B,CAAC;AAErC,eAAO,MAAM,wBAAwB,MAAM,CAAC;AAC5C,eAAO,MAAM,2BAA2B,OAAQ,CAAC;AACjD,eAAO,MAAM,6BAA6B,IAAI,CAAC;AAE/C,MAAM,WAAW,qBAAqB;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,MAAM,C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oauth/index.js";
|
|
2
2
|
import { loadOAuthCredentials } from "../oauth/storage.js";
|
|
3
|
+
import { fetchDownstream, } from "../utils/downstream-http.js";
|
|
3
4
|
export const CONNECT_PROTOCOL_VERSION = "1";
|
|
4
5
|
export const DEFAULT_PLATFORM_TIMEOUT_MS = 2_000;
|
|
5
6
|
export const DEFAULT_PLATFORM_MAX_ATTEMPTS = 2;
|
|
@@ -117,35 +118,17 @@ export function buildPlatformConnectHeaders(config, extraHeaders) {
|
|
|
117
118
|
...(extraHeaders ?? {}),
|
|
118
119
|
});
|
|
119
120
|
}
|
|
120
|
-
export async function fetchWithRetry(url, init, options) {
|
|
121
|
-
const maxAttempts = Math.max(1, options.maxAttempts ?? 1);
|
|
122
|
-
let lastError;
|
|
123
|
-
for (let attempt = 1; attempt <= maxAttempts; attempt += 1) {
|
|
124
|
-
try {
|
|
125
|
-
const response = await fetch(url, {
|
|
126
|
-
...init,
|
|
127
|
-
signal: options.signal ?? AbortSignal.timeout(Math.max(1, options.timeoutMs)),
|
|
128
|
-
});
|
|
129
|
-
if (response.status < 500 || attempt === maxAttempts) {
|
|
130
|
-
return response;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
catch (error) {
|
|
134
|
-
lastError = error;
|
|
135
|
-
if (attempt === maxAttempts) {
|
|
136
|
-
break;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
throw lastError instanceof Error
|
|
141
|
-
? lastError
|
|
142
|
-
: new Error(`${options.serviceName} request failed`);
|
|
143
|
-
}
|
|
144
121
|
export async function postPlatformConnect(config, path, body, options, headers) {
|
|
145
|
-
return
|
|
122
|
+
return fetchDownstream(`${config.baseUrl}${path}`, {
|
|
146
123
|
method: "POST",
|
|
147
124
|
headers: buildPlatformConnectHeaders(config, headers),
|
|
148
125
|
body: JSON.stringify(body),
|
|
149
|
-
|
|
126
|
+
signal: options.signal,
|
|
127
|
+
}, {
|
|
128
|
+
serviceName: options.serviceName,
|
|
129
|
+
failureMode: options.failureMode,
|
|
130
|
+
timeoutMs: options.timeoutMs,
|
|
131
|
+
maxAttempts: options.maxAttempts,
|
|
132
|
+
});
|
|
150
133
|
}
|
|
151
134
|
//# sourceMappingURL=client.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/platform/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAE3D,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAG,CAAC;AAC5C,MAAM,CAAC,MAAM,2BAA2B,GAAG,KAAK,CAAC;AACjD,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,CAAC;AAmC/C,MAAM,iCAAiC,GAAG;IACzC,2BAA2B;IAC3B,0BAA0B;IAC1B,kBAAkB;CACT,CAAC;AAEX,MAAM,sBAAsB,GAAG;IAC9B,8BAA8B;IAC9B,eAAe;CACN,CAAC;AAEX,MAAM,6BAA6B,GAAG;IACrC,wBAAwB;IACxB,yBAAyB;IACzB,2BAA2B;CAClB,CAAC;AAEX,MAAM,qBAAqB,GAAG;IAC7B,yBAAyB;IACzB,6BAA6B;CACpB,CAAC;AAEX,MAAM,UAAU,UAAU,CAAC,KAAyB;IACnD,MAAM,OAAO,GAAG,KAAK,EAAE,IAAI,EAAE,CAAC;IAC9B,OAAO,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;AACtC,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,KAAwB;IACnD,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QAC1B,MAAM,KAAK,GAAG,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;QAC5C,IAAI,KAAK,EAAE,CAAC;YACX,OAAO,KAAK,CAAC;QACd,CAAC;IACF,CAAC;IACD,OAAO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CAAC;YAClB,IAAI,OAAO,KAAK,WAAW,EAAE,CAAC;gBAC7B,MAAM;YACP,CAAC;QACF,CAAC;IACF,CAAC;IACD,MAAM,SAAS,YAAY,KAAK;QAC/B,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,IAAI,KAAK,CAAC,GAAG,OAAO,CAAC,WAAW,iBAAiB,CAAC,CAAC;AACvD,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACxC,MAA6B,EAC7B,IAAY,EACZ,IAA6B,EAC7B,OAA+B,EAC/B,OAA4C;IAE5C,OAAO,cAAc,CACpB,GAAG,MAAM,CAAC,OAAO,GAAG,IAAI,EAAE,EAC1B;QACC,MAAM,EAAE,MAAM;QACd,OAAO,EAAE,2BAA2B,CAAC,MAAM,EAAE,OAAO,CAAC;QACrD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;KAC1B,EACD,OAAO,CACP,CAAC;AACH,CAAC","sourcesContent":["import { getOAuthToken } from \"../oauth/index.js\";\nimport { loadOAuthCredentials } from \"../oauth/storage.js\";\n\nexport const CONNECT_PROTOCOL_VERSION = \"1\";\nexport const DEFAULT_PLATFORM_TIMEOUT_MS = 2_000;\nexport const DEFAULT_PLATFORM_MAX_ATTEMPTS = 2;\n\nexport interface PlatformServiceConfig {\n\tbaseUrl: string;\n\ttoken?: string;\n\torganizationId?: string;\n\tteamId?: string;\n\tworkspaceId?: string;\n\ttimeoutMs: number;\n\tmaxAttempts: number;\n}\n\nexport interface ResolvePlatformServiceConfigOptions {\n\tbaseUrlEnvVars: readonly string[];\n\ttokenEnvVars?: readonly string[];\n\torganizationEnvVars?: readonly string[];\n\tteamEnvVars?: readonly string[];\n\tworkspaceEnvVars?: readonly string[];\n\ttimeoutEnvVars?: readonly string[];\n\tmaxAttemptsEnvVars?: readonly string[];\n\tbaseUrlSuffixes?: readonly string[];\n\tdefaultTimeoutMs?: number;\n\tdefaultMaxAttempts?: number;\n\trequireBaseUrl?: boolean;\n\trequireOrganizationId?: boolean;\n\trequireToken?: boolean;\n}\n\nexport interface PlatformRequestOptions {\n\tserviceName: string;\n\ttimeoutMs: number;\n\tmaxAttempts?: number;\n\tsignal?: AbortSignal;\n}\n\nconst SHARED_PLATFORM_BASE_URL_ENV_VARS = [\n\t\"MAESTRO_PLATFORM_BASE_URL\",\n\t\"MAESTRO_EVALOPS_BASE_URL\",\n\t\"EVALOPS_BASE_URL\",\n] as const;\n\nconst DEFAULT_TOKEN_ENV_VARS = [\n\t\"MAESTRO_EVALOPS_ACCESS_TOKEN\",\n\t\"EVALOPS_TOKEN\",\n] as const;\n\nconst DEFAULT_ORGANIZATION_ENV_VARS = [\n\t\"MAESTRO_EVALOPS_ORG_ID\",\n\t\"EVALOPS_ORGANIZATION_ID\",\n\t\"MAESTRO_ENTERPRISE_ORG_ID\",\n] as const;\n\nconst DEFAULT_TEAM_ENV_VARS = [\n\t\"MAESTRO_EVALOPS_TEAM_ID\",\n\t\"MAESTRO_LLM_GATEWAY_TEAM_ID\",\n] as const;\n\nexport function trimString(value: string | undefined): string | undefined {\n\tconst trimmed = value?.trim();\n\treturn trimmed ? trimmed : undefined;\n}\n\nexport function getEnvValue(names: readonly string[]): string | undefined {\n\tfor (const name of names) {\n\t\tconst value = trimString(process.env[name]);\n\t\tif (value) {\n\t\t\treturn value;\n\t\t}\n\t}\n\treturn undefined;\n}\n\nexport function parsePositiveInt(\n\tvalue: string | undefined,\n\tfallback: number,\n): number {\n\tconst parsed = Number.parseInt(value ?? \"\", 10);\n\treturn Number.isFinite(parsed) && parsed > 0 ? parsed : fallback;\n}\n\nexport function normalizeBaseUrl(\n\tbaseUrl: string,\n\tsuffixes: readonly string[] = [],\n): string {\n\tlet normalized = baseUrl.trim().replace(/\\/+$/u, \"\");\n\tfor (const suffix of suffixes) {\n\t\tif (normalized.endsWith(suffix)) {\n\t\t\tnormalized = normalized.slice(0, -suffix.length).replace(/\\/+$/u, \"\");\n\t\t}\n\t}\n\treturn normalized;\n}\n\nexport function resolveOrganizationId(\n\tenvVars: readonly string[] = DEFAULT_ORGANIZATION_ENV_VARS,\n): string | undefined {\n\tconst envOrgId = getEnvValue(envVars);\n\tif (envOrgId) {\n\t\treturn envOrgId;\n\t}\n\tconst stored = loadOAuthCredentials(\"evalops\")?.metadata?.organizationId;\n\treturn typeof stored === \"string\" ? trimString(stored) : undefined;\n}\n\nexport function resolveTeamId(\n\tenvVars: readonly string[] = DEFAULT_TEAM_ENV_VARS,\n): string | undefined {\n\treturn getEnvValue(envVars);\n}\n\nexport function resolveWorkspaceId(\n\tenvVars: readonly string[] = DEFAULT_ORGANIZATION_ENV_VARS,\n): string | undefined {\n\treturn getEnvValue(envVars) ?? resolveOrganizationId();\n}\n\nexport function resolveConfiguredToken(\n\tenvVars: readonly string[] = DEFAULT_TOKEN_ENV_VARS,\n): string | undefined {\n\tconst envToken = getEnvValue(envVars);\n\tif (envToken) {\n\t\treturn envToken;\n\t}\n\tconst stored = loadOAuthCredentials(\"evalops\")?.access;\n\treturn typeof stored === \"string\" ? trimString(stored) : undefined;\n}\n\nexport async function resolvePlatformToken(\n\tenvVars: readonly string[] = DEFAULT_TOKEN_ENV_VARS,\n): Promise<string | undefined> {\n\treturn getEnvValue(envVars) ?? (await getOAuthToken(\"evalops\")) ?? undefined;\n}\n\nexport async function resolvePlatformServiceConfig(\n\toptions: ResolvePlatformServiceConfigOptions,\n): Promise<PlatformServiceConfig | null> {\n\tconst baseUrl = getEnvValue([\n\t\t...options.baseUrlEnvVars,\n\t\t...SHARED_PLATFORM_BASE_URL_ENV_VARS,\n\t]);\n\tif (!baseUrl && options.requireBaseUrl !== false) {\n\t\treturn null;\n\t}\n\n\tconst organizationId = resolveOrganizationId(options.organizationEnvVars);\n\tif (!organizationId && options.requireOrganizationId !== false) {\n\t\treturn null;\n\t}\n\n\tconst token = await resolvePlatformToken(options.tokenEnvVars);\n\tif (!token && options.requireToken !== false) {\n\t\treturn null;\n\t}\n\n\tconst workspaceId = options.workspaceEnvVars\n\t\t? resolveWorkspaceId(options.workspaceEnvVars)\n\t\t: organizationId;\n\n\treturn {\n\t\tbaseUrl: normalizeBaseUrl(baseUrl ?? \"\", options.baseUrlSuffixes),\n\t\t...(token ? { token } : {}),\n\t\t...(organizationId ? { organizationId } : {}),\n\t\tteamId: resolveTeamId(options.teamEnvVars),\n\t\t...(workspaceId ? { workspaceId } : {}),\n\t\ttimeoutMs: parsePositiveInt(\n\t\t\tgetEnvValue(options.timeoutEnvVars ?? []),\n\t\t\toptions.defaultTimeoutMs ?? DEFAULT_PLATFORM_TIMEOUT_MS,\n\t\t),\n\t\tmaxAttempts: parsePositiveInt(\n\t\t\tgetEnvValue(options.maxAttemptsEnvVars ?? []),\n\t\t\toptions.defaultMaxAttempts ?? DEFAULT_PLATFORM_MAX_ATTEMPTS,\n\t\t),\n\t};\n}\n\nfunction buildPlatformJsonHeaders(\n\tconfig: Pick<PlatformServiceConfig, \"organizationId\" | \"token\">,\n\textraHeaders?: Record<string, string | undefined>,\n): Record<string, string> {\n\treturn Object.fromEntries(\n\t\tObject.entries({\n\t\t\t...(config.token ? { Authorization: `Bearer ${config.token}` } : {}),\n\t\t\t\"Content-Type\": \"application/json\",\n\t\t\t...(config.organizationId\n\t\t\t\t? { \"X-Organization-ID\": config.organizationId }\n\t\t\t\t: {}),\n\t\t\t...(extraHeaders ?? {}),\n\t\t}).filter(\n\t\t\t(entry): entry is [string, string] =>\n\t\t\t\ttypeof entry[1] === \"string\" && entry[1].trim().length > 0,\n\t\t),\n\t);\n}\n\nexport function buildPlatformConnectHeaders(\n\tconfig: Pick<PlatformServiceConfig, \"organizationId\" | \"token\">,\n\textraHeaders?: Record<string, string | undefined>,\n): Record<string, string> {\n\treturn buildPlatformJsonHeaders(config, {\n\t\t\"Connect-Protocol-Version\": CONNECT_PROTOCOL_VERSION,\n\t\t...(extraHeaders ?? {}),\n\t});\n}\n\nexport async function fetchWithRetry(\n\turl: string,\n\tinit: RequestInit,\n\toptions: PlatformRequestOptions,\n): Promise<Response> {\n\tconst maxAttempts = Math.max(1, options.maxAttempts ?? 1);\n\tlet lastError: unknown;\n\tfor (let attempt = 1; attempt <= maxAttempts; attempt += 1) {\n\t\ttry {\n\t\t\tconst response = await fetch(url, {\n\t\t\t\t...init,\n\t\t\t\tsignal:\n\t\t\t\t\toptions.signal ?? AbortSignal.timeout(Math.max(1, options.timeoutMs)),\n\t\t\t});\n\t\t\tif (response.status < 500 || attempt === maxAttempts) {\n\t\t\t\treturn response;\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tlastError = error;\n\t\t\tif (attempt === maxAttempts) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tthrow lastError instanceof Error\n\t\t? lastError\n\t\t: new Error(`${options.serviceName} request failed`);\n}\n\nexport async function postPlatformConnect(\n\tconfig: PlatformServiceConfig,\n\tpath: string,\n\tbody: Record<string, unknown>,\n\toptions: PlatformRequestOptions,\n\theaders?: Record<string, string | undefined>,\n): Promise<Response> {\n\treturn fetchWithRetry(\n\t\t`${config.baseUrl}${path}`,\n\t\t{\n\t\t\tmethod: \"POST\",\n\t\t\theaders: buildPlatformConnectHeaders(config, headers),\n\t\t\tbody: JSON.stringify(body),\n\t\t},\n\t\toptions,\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/platform/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAEN,eAAe,GACf,MAAM,6BAA6B,CAAC;AAErC,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAG,CAAC;AAC5C,MAAM,CAAC,MAAM,2BAA2B,GAAG,KAAK,CAAC;AACjD,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,CAAC;AAoC/C,MAAM,iCAAiC,GAAG;IACzC,2BAA2B;IAC3B,0BAA0B;IAC1B,kBA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AAY,EACZ,IAA6B,EAC7B,OAA+B,EAC/B,OAA4C;IAE5C,OAAO,eAAe,CACrB,GAAG,MAAM,CAAC,OAAO,GAAG,IAAI,EAAE,EAC1B;QACC,MAAM,EAAE,MAAM;QACd,OAAO,EAAE,2BAA2B,CAAC,MAAM,EAAE,OAAO,CAAC;QACrD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;QAC1B,MAAM,EAAE,OAAO,CAAC,MAAM;KACtB,EACD;QACC,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,WAAW,EAAE,OAAO,CAAC,WAAW;KAChC,CACD,CAAC;AACH,CAAC","sourcesContent":["import { getOAuthToken } from \"../oauth/index.js\";\nimport { loadOAuthCredentials } from \"../oauth/storage.js\";\nimport {\n\ttype DownstreamFailureMode,\n\tfetchDownstream,\n} from \"../utils/downstream-http.js\";\n\nexport const CONNECT_PROTOCOL_VERSION = \"1\";\nexport const DEFAULT_PLATFORM_TIMEOUT_MS = 2_000;\nexport const DEFAULT_PLATFORM_MAX_ATTEMPTS = 2;\n\nexport interface PlatformServiceConfig {\n\tbaseUrl: string;\n\ttoken?: string;\n\torganizationId?: string;\n\tteamId?: string;\n\tworkspaceId?: string;\n\ttimeoutMs: number;\n\tmaxAttempts: number;\n}\n\nexport interface ResolvePlatformServiceConfigOptions {\n\tbaseUrlEnvVars: readonly string[];\n\ttokenEnvVars?: readonly string[];\n\torganizationEnvVars?: readonly string[];\n\tteamEnvVars?: readonly string[];\n\tworkspaceEnvVars?: readonly string[];\n\ttimeoutEnvVars?: readonly string[];\n\tmaxAttemptsEnvVars?: readonly string[];\n\tbaseUrlSuffixes?: readonly string[];\n\tdefaultTimeoutMs?: number;\n\tdefaultMaxAttempts?: number;\n\trequireBaseUrl?: boolean;\n\trequireOrganizationId?: boolean;\n\trequireToken?: boolean;\n}\n\nexport interface PlatformRequestOptions {\n\tserviceName: string;\n\tfailureMode: DownstreamFailureMode;\n\ttimeoutMs: number;\n\tmaxAttempts?: number;\n\tsignal?: AbortSignal;\n}\n\nconst SHARED_PLATFORM_BASE_URL_ENV_VARS = [\n\t\"MAESTRO_PLATFORM_BASE_URL\",\n\t\"MAESTRO_EVALOPS_BASE_URL\",\n\t\"EVALOPS_BASE_URL\",\n] as const;\n\nconst DEFAULT_TOKEN_ENV_VARS = [\n\t\"MAESTRO_EVALOPS_ACCESS_TOKEN\",\n\t\"EVALOPS_TOKEN\",\n] as const;\n\nconst DEFAULT_ORGANIZATION_ENV_VARS = [\n\t\"MAESTRO_EVALOPS_ORG_ID\",\n\t\"EVALOPS_ORGANIZATION_ID\",\n\t\"MAESTRO_ENTERPRISE_ORG_ID\",\n] as const;\n\nconst DEFAULT_TEAM_ENV_VARS = [\n\t\"MAESTRO_EVALOPS_TEAM_ID\",\n\t\"MAESTRO_LLM_GATEWAY_TEAM_ID\",\n] as const;\n\nexport function trimString(value: string | undefined): string | undefined {\n\tconst trimmed = value?.trim();\n\treturn trimmed ? trimmed : undefined;\n}\n\nexport function getEnvValue(names: readonly string[]): string | undefined {\n\tfor (const name of names) {\n\t\tconst value = trimString(process.env[name]);\n\t\tif (value) {\n\t\t\treturn value;\n\t\t}\n\t}\n\treturn undefined;\n}\n\nexport function parsePositiveInt(\n\tvalue: string | undefined,\n\tfallback: number,\n): number {\n\tconst parsed = Number.parseInt(value ?? \"\", 10);\n\treturn Number.isFinite(parsed) && parsed > 0 ? parsed : fallback;\n}\n\nexport function normalizeBaseUrl(\n\tbaseUrl: string,\n\tsuffixes: readonly string[] = [],\n): string {\n\tlet normalized = baseUrl.trim().replace(/\\/+$/u, \"\");\n\tfor (const suffix of suffixes) {\n\t\tif (normalized.endsWith(suffix)) {\n\t\t\tnormalized = normalized.slice(0, -suffix.length).replace(/\\/+$/u, \"\");\n\t\t}\n\t}\n\treturn normalized;\n}\n\nexport function resolveOrganizationId(\n\tenvVars: readonly string[] = DEFAULT_ORGANIZATION_ENV_VARS,\n): string | undefined {\n\tconst envOrgId = getEnvValue(envVars);\n\tif (envOrgId) {\n\t\treturn envOrgId;\n\t}\n\tconst stored = loadOAuthCredentials(\"evalops\")?.metadata?.organizationId;\n\treturn typeof stored === \"string\" ? trimString(stored) : undefined;\n}\n\nexport function resolveTeamId(\n\tenvVars: readonly string[] = DEFAULT_TEAM_ENV_VARS,\n): string | undefined {\n\treturn getEnvValue(envVars);\n}\n\nexport function resolveWorkspaceId(\n\tenvVars: readonly string[] = DEFAULT_ORGANIZATION_ENV_VARS,\n): string | undefined {\n\treturn getEnvValue(envVars) ?? resolveOrganizationId();\n}\n\nexport function resolveConfiguredToken(\n\tenvVars: readonly string[] = DEFAULT_TOKEN_ENV_VARS,\n): string | undefined {\n\tconst envToken = getEnvValue(envVars);\n\tif (envToken) {\n\t\treturn envToken;\n\t}\n\tconst stored = loadOAuthCredentials(\"evalops\")?.access;\n\treturn typeof stored === \"string\" ? trimString(stored) : undefined;\n}\n\nexport async function resolvePlatformToken(\n\tenvVars: readonly string[] = DEFAULT_TOKEN_ENV_VARS,\n): Promise<string | undefined> {\n\treturn getEnvValue(envVars) ?? (await getOAuthToken(\"evalops\")) ?? undefined;\n}\n\nexport async function resolvePlatformServiceConfig(\n\toptions: ResolvePlatformServiceConfigOptions,\n): Promise<PlatformServiceConfig | null> {\n\tconst baseUrl = getEnvValue([\n\t\t...options.baseUrlEnvVars,\n\t\t...SHARED_PLATFORM_BASE_URL_ENV_VARS,\n\t]);\n\tif (!baseUrl && options.requireBaseUrl !== false) {\n\t\treturn null;\n\t}\n\n\tconst organizationId = resolveOrganizationId(options.organizationEnvVars);\n\tif (!organizationId && options.requireOrganizationId !== false) {\n\t\treturn null;\n\t}\n\n\tconst token = await resolvePlatformToken(options.tokenEnvVars);\n\tif (!token && options.requireToken !== false) {\n\t\treturn null;\n\t}\n\n\tconst workspaceId = options.workspaceEnvVars\n\t\t? resolveWorkspaceId(options.workspaceEnvVars)\n\t\t: organizationId;\n\n\treturn {\n\t\tbaseUrl: normalizeBaseUrl(baseUrl ?? \"\", options.baseUrlSuffixes),\n\t\t...(token ? { token } : {}),\n\t\t...(organizationId ? { organizationId } : {}),\n\t\tteamId: resolveTeamId(options.teamEnvVars),\n\t\t...(workspaceId ? { workspaceId } : {}),\n\t\ttimeoutMs: parsePositiveInt(\n\t\t\tgetEnvValue(options.timeoutEnvVars ?? []),\n\t\t\toptions.defaultTimeoutMs ?? DEFAULT_PLATFORM_TIMEOUT_MS,\n\t\t),\n\t\tmaxAttempts: parsePositiveInt(\n\t\t\tgetEnvValue(options.maxAttemptsEnvVars ?? []),\n\t\t\toptions.defaultMaxAttempts ?? DEFAULT_PLATFORM_MAX_ATTEMPTS,\n\t\t),\n\t};\n}\n\nfunction buildPlatformJsonHeaders(\n\tconfig: Pick<PlatformServiceConfig, \"organizationId\" | \"token\">,\n\textraHeaders?: Record<string, string | undefined>,\n): Record<string, string> {\n\treturn Object.fromEntries(\n\t\tObject.entries({\n\t\t\t...(config.token ? { Authorization: `Bearer ${config.token}` } : {}),\n\t\t\t\"Content-Type\": \"application/json\",\n\t\t\t...(config.organizationId\n\t\t\t\t? { \"X-Organization-ID\": config.organizationId }\n\t\t\t\t: {}),\n\t\t\t...(extraHeaders ?? {}),\n\t\t}).filter(\n\t\t\t(entry): entry is [string, string] =>\n\t\t\t\ttypeof entry[1] === \"string\" && entry[1].trim().length > 0,\n\t\t),\n\t);\n}\n\nexport function buildPlatformConnectHeaders(\n\tconfig: Pick<PlatformServiceConfig, \"organizationId\" | \"token\">,\n\textraHeaders?: Record<string, string | undefined>,\n): Record<string, string> {\n\treturn buildPlatformJsonHeaders(config, {\n\t\t\"Connect-Protocol-Version\": CONNECT_PROTOCOL_VERSION,\n\t\t...(extraHeaders ?? {}),\n\t});\n}\n\nexport async function postPlatformConnect(\n\tconfig: PlatformServiceConfig,\n\tpath: string,\n\tbody: Record<string, unknown>,\n\toptions: PlatformRequestOptions,\n\theaders?: Record<string, string | undefined>,\n): Promise<Response> {\n\treturn fetchDownstream(\n\t\t`${config.baseUrl}${path}`,\n\t\t{\n\t\t\tmethod: \"POST\",\n\t\t\theaders: buildPlatformConnectHeaders(config, headers),\n\t\t\tbody: JSON.stringify(body),\n\t\t\tsignal: options.signal,\n\t\t},\n\t\t{\n\t\t\tserviceName: options.serviceName,\n\t\t\tfailureMode: options.failureMode,\n\t\t\ttimeoutMs: options.timeoutMs,\n\t\t\tmaxAttempts: options.maxAttempts,\n\t\t},\n\t);\n}\n"]}
|