@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
|
@@ -4,9 +4,274 @@
|
|
|
4
4
|
* This module contains types and functions shared between openai.ts and
|
|
5
5
|
* openai-responses-sdk.ts to avoid circular dependencies.
|
|
6
6
|
*/
|
|
7
|
+
import { isRecord } from "./tool-arguments.js";
|
|
7
8
|
// =============================================================================
|
|
8
9
|
// Utility Functions
|
|
9
10
|
// =============================================================================
|
|
11
|
+
const EMPTY_TOOL_PARAMETERS_SCHEMA = {
|
|
12
|
+
type: "object",
|
|
13
|
+
properties: {},
|
|
14
|
+
additionalProperties: true,
|
|
15
|
+
};
|
|
16
|
+
const TOP_LEVEL_UNION_KEYS = ["anyOf", "oneOf", "allOf"];
|
|
17
|
+
function canonicalizeSchema(value) {
|
|
18
|
+
if (Array.isArray(value)) {
|
|
19
|
+
return value.map((entry) => canonicalizeSchema(entry));
|
|
20
|
+
}
|
|
21
|
+
if (!isRecord(value)) {
|
|
22
|
+
return value;
|
|
23
|
+
}
|
|
24
|
+
return Object.fromEntries(Object.entries(value)
|
|
25
|
+
.filter(([, entryValue]) => entryValue !== undefined)
|
|
26
|
+
.sort(([leftKey], [rightKey]) => leftKey.localeCompare(rightKey))
|
|
27
|
+
.map(([entryKey, entryValue]) => [
|
|
28
|
+
entryKey,
|
|
29
|
+
canonicalizeSchema(entryValue),
|
|
30
|
+
]));
|
|
31
|
+
}
|
|
32
|
+
function schemasAreEqual(left, right) {
|
|
33
|
+
return (JSON.stringify(canonicalizeSchema(left)) ===
|
|
34
|
+
JSON.stringify(canonicalizeSchema(right)));
|
|
35
|
+
}
|
|
36
|
+
function enumLikeValues(schema) {
|
|
37
|
+
if (schema.const !== undefined) {
|
|
38
|
+
return [schema.const];
|
|
39
|
+
}
|
|
40
|
+
if (Array.isArray(schema.enum)) {
|
|
41
|
+
return schema.enum;
|
|
42
|
+
}
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
function mergeCompatibleObjectSchemas(left, right) {
|
|
46
|
+
const annotationKeys = new Set([
|
|
47
|
+
"$comment",
|
|
48
|
+
"default",
|
|
49
|
+
"deprecated",
|
|
50
|
+
"description",
|
|
51
|
+
"examples",
|
|
52
|
+
"readOnly",
|
|
53
|
+
"title",
|
|
54
|
+
"writeOnly",
|
|
55
|
+
]);
|
|
56
|
+
const lowerBoundKeys = new Set([
|
|
57
|
+
"minimum",
|
|
58
|
+
"exclusiveMinimum",
|
|
59
|
+
"minLength",
|
|
60
|
+
"minItems",
|
|
61
|
+
"minProperties",
|
|
62
|
+
]);
|
|
63
|
+
const upperBoundKeys = new Set([
|
|
64
|
+
"maximum",
|
|
65
|
+
"exclusiveMaximum",
|
|
66
|
+
"maxLength",
|
|
67
|
+
"maxItems",
|
|
68
|
+
"maxProperties",
|
|
69
|
+
]);
|
|
70
|
+
const merged = { ...left };
|
|
71
|
+
for (const [key, value] of Object.entries(right)) {
|
|
72
|
+
const existing = merged[key];
|
|
73
|
+
if (existing === undefined || schemasAreEqual(existing, value)) {
|
|
74
|
+
merged[key] = value;
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
if (annotationKeys.has(key)) {
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
if (typeof existing === "number" && typeof value === "number") {
|
|
81
|
+
if (lowerBoundKeys.has(key)) {
|
|
82
|
+
merged[key] = Math.max(existing, value);
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
if (upperBoundKeys.has(key)) {
|
|
86
|
+
merged[key] = Math.min(existing, value);
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return undefined;
|
|
91
|
+
}
|
|
92
|
+
return merged;
|
|
93
|
+
}
|
|
94
|
+
function mergeSharedObjectSchemaConstraints(left, right, enumValues) {
|
|
95
|
+
const merged = {};
|
|
96
|
+
for (const [key, value] of Object.entries(left)) {
|
|
97
|
+
if (right[key] !== undefined && schemasAreEqual(value, right[key])) {
|
|
98
|
+
merged[key] = value;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
const primitiveTypes = new Set(enumValues
|
|
102
|
+
.map((value) => (value === null ? "null" : typeof value))
|
|
103
|
+
.filter((value) => ["boolean", "number", "string"].includes(value)));
|
|
104
|
+
if (primitiveTypes.size === 1) {
|
|
105
|
+
const [primitiveType] = [...primitiveTypes];
|
|
106
|
+
if (left.type === primitiveType || right.type === primitiveType) {
|
|
107
|
+
merged.type = primitiveType;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return merged;
|
|
111
|
+
}
|
|
112
|
+
function mergeObjectVariants(variants, requiredMode) {
|
|
113
|
+
if (variants.length === 0 || !variants.every(isRecord))
|
|
114
|
+
return undefined;
|
|
115
|
+
if (!variants.every((variant) => variant.type === "object"))
|
|
116
|
+
return undefined;
|
|
117
|
+
const mergedProperties = {};
|
|
118
|
+
const requiredCounts = new Map();
|
|
119
|
+
for (const variant of variants) {
|
|
120
|
+
const properties = isRecord(variant.properties) ? variant.properties : {};
|
|
121
|
+
for (const [propertyName, propertySchema] of Object.entries(properties)) {
|
|
122
|
+
const current = mergedProperties[propertyName];
|
|
123
|
+
if (current === undefined) {
|
|
124
|
+
mergedProperties[propertyName] = propertySchema;
|
|
125
|
+
continue;
|
|
126
|
+
}
|
|
127
|
+
if (schemasAreEqual(current, propertySchema)) {
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
if (isRecord(current) && isRecord(propertySchema)) {
|
|
131
|
+
const currentValues = enumLikeValues(current);
|
|
132
|
+
const incomingValues = enumLikeValues(propertySchema);
|
|
133
|
+
if (currentValues && incomingValues) {
|
|
134
|
+
const { const: _const, enum: _enum, ...currentWithoutDiscriminator } = current;
|
|
135
|
+
const { const: _incomingConst, enum: _incomingEnum, ...incomingWithoutDiscriminator } = propertySchema;
|
|
136
|
+
const enumValues = requiredMode === "union"
|
|
137
|
+
? currentValues.filter((value) => incomingValues.includes(value))
|
|
138
|
+
: [...new Set([...currentValues, ...incomingValues])];
|
|
139
|
+
if (requiredMode === "union" && enumValues.length === 0) {
|
|
140
|
+
return undefined;
|
|
141
|
+
}
|
|
142
|
+
const mergedSchema = requiredMode === "union"
|
|
143
|
+
? (mergeCompatibleObjectSchemas(currentWithoutDiscriminator, incomingWithoutDiscriminator) ?? currentWithoutDiscriminator)
|
|
144
|
+
: mergeSharedObjectSchemaConstraints(currentWithoutDiscriminator, incomingWithoutDiscriminator, enumValues);
|
|
145
|
+
mergedProperties[propertyName] = {
|
|
146
|
+
...mergedSchema,
|
|
147
|
+
...(enumValues.length > 0 ? { enum: enumValues } : {}),
|
|
148
|
+
};
|
|
149
|
+
continue;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
if (requiredMode === "union" &&
|
|
153
|
+
isRecord(current) &&
|
|
154
|
+
isRecord(propertySchema)) {
|
|
155
|
+
mergedProperties[propertyName] =
|
|
156
|
+
mergeCompatibleObjectSchemas(current, propertySchema) ?? {};
|
|
157
|
+
continue;
|
|
158
|
+
}
|
|
159
|
+
mergedProperties[propertyName] = {};
|
|
160
|
+
}
|
|
161
|
+
const required = Array.isArray(variant.required) ? variant.required : [];
|
|
162
|
+
for (const propertyName of required) {
|
|
163
|
+
if (typeof propertyName === "string") {
|
|
164
|
+
requiredCounts.set(propertyName, (requiredCounts.get(propertyName) ?? 0) + 1);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
const required = [...requiredCounts.entries()].reduce((acc, [propertyName, count]) => {
|
|
169
|
+
if (count > 0)
|
|
170
|
+
acc.union.push(propertyName);
|
|
171
|
+
if (count === variants.length)
|
|
172
|
+
acc.intersection.push(propertyName);
|
|
173
|
+
return acc;
|
|
174
|
+
}, { intersection: [], union: [] });
|
|
175
|
+
const requiredFields = requiredMode === "union" || required.intersection.length === 0
|
|
176
|
+
? required.union
|
|
177
|
+
: required.intersection;
|
|
178
|
+
return {
|
|
179
|
+
type: "object",
|
|
180
|
+
properties: mergedProperties,
|
|
181
|
+
...(requiredFields.length > 0 ? { required: requiredFields } : {}),
|
|
182
|
+
additionalProperties: false,
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
function mergeRootObjectConstraints(schema, merged) {
|
|
186
|
+
if (schema.type !== "object")
|
|
187
|
+
return merged;
|
|
188
|
+
const rootProperties = isRecord(schema.properties) ? schema.properties : {};
|
|
189
|
+
const mergedProperties = isRecord(merged.properties) ? merged.properties : {};
|
|
190
|
+
const properties = { ...rootProperties };
|
|
191
|
+
for (const [propertyName, propertySchema] of Object.entries(mergedProperties)) {
|
|
192
|
+
const rootPropertySchema = properties[propertyName];
|
|
193
|
+
if (rootPropertySchema === undefined) {
|
|
194
|
+
properties[propertyName] = propertySchema;
|
|
195
|
+
continue;
|
|
196
|
+
}
|
|
197
|
+
if (schemasAreEqual(rootPropertySchema, propertySchema)) {
|
|
198
|
+
continue;
|
|
199
|
+
}
|
|
200
|
+
if (isRecord(rootPropertySchema) && isRecord(propertySchema)) {
|
|
201
|
+
const compatible = mergeCompatibleObjectSchemas(rootPropertySchema, propertySchema);
|
|
202
|
+
if (!compatible)
|
|
203
|
+
return undefined;
|
|
204
|
+
properties[propertyName] = compatible;
|
|
205
|
+
continue;
|
|
206
|
+
}
|
|
207
|
+
return undefined;
|
|
208
|
+
}
|
|
209
|
+
const required = [
|
|
210
|
+
...new Set([
|
|
211
|
+
...(Array.isArray(schema.required) ? schema.required : []),
|
|
212
|
+
...(Array.isArray(merged.required) ? merged.required : []),
|
|
213
|
+
].filter((propertyName) => typeof propertyName === "string")),
|
|
214
|
+
];
|
|
215
|
+
return {
|
|
216
|
+
...merged,
|
|
217
|
+
properties,
|
|
218
|
+
...(schema.additionalProperties !== undefined
|
|
219
|
+
? { additionalProperties: schema.additionalProperties }
|
|
220
|
+
: {}),
|
|
221
|
+
...(required.length > 0 ? { required } : {}),
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
function hasBranchOnlyRequiredFields(variants) {
|
|
225
|
+
if (variants.length === 0 || !variants.every(isRecord))
|
|
226
|
+
return false;
|
|
227
|
+
const requiredCounts = new Map();
|
|
228
|
+
for (const variant of variants) {
|
|
229
|
+
const required = Array.isArray(variant.required) ? variant.required : [];
|
|
230
|
+
for (const propertyName of required) {
|
|
231
|
+
if (typeof propertyName === "string") {
|
|
232
|
+
requiredCounts.set(propertyName, (requiredCounts.get(propertyName) ?? 0) + 1);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
return [...requiredCounts.values()].some((count) => count < variants.length);
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Ensures tool parameter schemas satisfy OpenAI-compatible function calling.
|
|
240
|
+
*
|
|
241
|
+
* Some local TypeBox schemas, especially top-level unions, serialize without a
|
|
242
|
+
* top-level `type`. OpenAI-compatible gateways reject those as `type: None`.
|
|
243
|
+
* Keep the original schema constraints, but make the top-level object contract
|
|
244
|
+
* explicit before sending it over the wire.
|
|
245
|
+
*/
|
|
246
|
+
export function normalizeOpenAIToolParameters(parameters) {
|
|
247
|
+
if (!parameters ||
|
|
248
|
+
typeof parameters !== "object" ||
|
|
249
|
+
Array.isArray(parameters)) {
|
|
250
|
+
return { ...EMPTY_TOOL_PARAMETERS_SCHEMA };
|
|
251
|
+
}
|
|
252
|
+
const schema = parameters;
|
|
253
|
+
const topLevelUnionKey = TOP_LEVEL_UNION_KEYS.find((key) => Array.isArray(schema[key]));
|
|
254
|
+
if (topLevelUnionKey) {
|
|
255
|
+
const merged = mergeObjectVariants(schema[topLevelUnionKey], topLevelUnionKey === "allOf" ? "union" : "intersection");
|
|
256
|
+
if (!merged)
|
|
257
|
+
return { ...EMPTY_TOOL_PARAMETERS_SCHEMA };
|
|
258
|
+
return (mergeRootObjectConstraints(schema, merged) ?? {
|
|
259
|
+
...EMPTY_TOOL_PARAMETERS_SCHEMA,
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
if (schema.type === "object") {
|
|
263
|
+
return schema;
|
|
264
|
+
}
|
|
265
|
+
if (schema.type === undefined &&
|
|
266
|
+
!schema.enum &&
|
|
267
|
+
!schema.not &&
|
|
268
|
+
!schema.oneOf &&
|
|
269
|
+
!schema.anyOf &&
|
|
270
|
+
!schema.allOf) {
|
|
271
|
+
return { ...schema, type: "object" };
|
|
272
|
+
}
|
|
273
|
+
return { ...EMPTY_TOOL_PARAMETERS_SCHEMA };
|
|
274
|
+
}
|
|
10
275
|
/**
|
|
11
276
|
* Filters tools for Responses API compatibility.
|
|
12
277
|
*
|
|
@@ -18,14 +283,38 @@
|
|
|
18
283
|
* @returns Filtered array of compatible tools
|
|
19
284
|
*/
|
|
20
285
|
export function filterResponsesApiTools(tools) {
|
|
286
|
+
const hasUnsupportedTopLevelUnion = (params) => {
|
|
287
|
+
if (!isRecord(params))
|
|
288
|
+
return false;
|
|
289
|
+
const topLevelUnionKey = TOP_LEVEL_UNION_KEYS.find((key) => Array.isArray(params[key]));
|
|
290
|
+
if (!topLevelUnionKey)
|
|
291
|
+
return false;
|
|
292
|
+
if ((topLevelUnionKey === "anyOf" || topLevelUnionKey === "oneOf") &&
|
|
293
|
+
hasBranchOnlyRequiredFields(params[topLevelUnionKey])) {
|
|
294
|
+
return true;
|
|
295
|
+
}
|
|
296
|
+
return (mergeObjectVariants(params[topLevelUnionKey], topLevelUnionKey === "allOf" ? "union" : "intersection") === undefined);
|
|
297
|
+
};
|
|
21
298
|
const hasIncompatibleSchema = (params) => {
|
|
22
299
|
if (!params || typeof params !== "object")
|
|
23
300
|
return false;
|
|
24
301
|
const p = params;
|
|
25
302
|
return !!(p.oneOf || p.anyOf || p.allOf || p.enum || p.not);
|
|
26
303
|
};
|
|
27
|
-
|
|
304
|
+
const hasUnsupportedTopLevelKeyword = (params) => {
|
|
305
|
+
if (!isRecord(params))
|
|
306
|
+
return false;
|
|
307
|
+
return params.enum !== undefined || params.not !== undefined;
|
|
308
|
+
};
|
|
309
|
+
return tools
|
|
310
|
+
.filter((tool) => tool.name &&
|
|
28
311
|
tool.name.trim() !== "" &&
|
|
29
|
-
!
|
|
312
|
+
!hasUnsupportedTopLevelKeyword(tool.parameters) &&
|
|
313
|
+
!hasUnsupportedTopLevelUnion(tool.parameters))
|
|
314
|
+
.map((tool) => ({
|
|
315
|
+
...tool,
|
|
316
|
+
parameters: normalizeOpenAIToolParameters(tool.parameters),
|
|
317
|
+
}))
|
|
318
|
+
.filter((tool) => !hasIncompatibleSchema(tool.parameters));
|
|
30
319
|
}
|
|
31
320
|
//# sourceMappingURL=openai-shared.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openai-shared.js","sourceRoot":"","sources":["../../../src/agent/providers/openai-shared.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AA2FH,gFAAgF;AAChF,oBAAoB;AACpB,gFAAgF;AAEhF;;;;;;;;;GASG;AACH,MAAM,UAAU,uBAAuB,CACtC,KAAwE;IAExE,MAAM,qBAAqB,GAAG,CAAC,MAAe,EAAW,EAAE;QAC1D,IAAI,CAAC,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ;YAAE,OAAO,KAAK,CAAC;QACxD,MAAM,CAAC,GAAG,MAAiC,CAAC;QAC5C,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;IAC7D,CAAC,CAAC;IAEF,OAAO,KAAK,CAAC,MAAM,CAClB,CAAC,IAAI,EAAE,EAAE,CACR,IAAI,CAAC,IAAI;QACT,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE;QACvB,CAAC,qBAAqB,CAAC,IAAI,CAAC,UAAU,CAAC,CACxC,CAAC;AACH,CAAC","sourcesContent":["/**\n * Shared types and utilities for OpenAI providers\n *\n * This module contains types and functions shared between openai.ts and\n * openai-responses-sdk.ts to avoid circular dependencies.\n */\n\nimport type { ReasoningEffort, StreamOptions } from \"../types.js\";\n\n// =============================================================================\n// OpenAI API Types\n// =============================================================================\n\n/**\n * Tool choice configuration for OpenAI APIs.\n * Controls how the model selects which tools to use.\n */\nexport type OpenAIToolChoice =\n\t| \"auto\"\n\t| \"none\"\n\t| \"required\"\n\t| { type: \"function\"; function: { name: string } };\n\n/**\n * Response format options for structured outputs.\n * - `json_object`: Guarantees valid JSON output (legacy JSON mode)\n * - `json_schema`: Guarantees output matching a specific schema (Structured Outputs)\n *\n * Note: The format differs between APIs:\n * - Chat Completions API: `response_format: { type: \"json_schema\", json_schema: {...} }`\n * - Responses API: `text: { format: { type: \"json_schema\", name, schema, ... } }`\n *\n * This type represents the unified format; the provider handles the translation.\n *\n * @see https://platform.openai.com/docs/guides/structured-outputs\n */\nexport type OpenAIResponseFormat =\n\t| { type: \"json_object\" }\n\t| { type: \"text\" }\n\t| {\n\t\t\ttype: \"json_schema\";\n\t\t\tjson_schema: {\n\t\t\t\tname: string;\n\t\t\t\tschema: object;\n\t\t\t\tstrict?: boolean;\n\t\t\t\tdescription?: string;\n\t\t\t};\n\t };\n\n/**\n * Options for OpenAI-compatible API calls.\n */\nexport interface OpenAIOptions extends StreamOptions {\n\treasoningEffort?: ReasoningEffort;\n\t/** Controls the level of reasoning summary for Responses API. */\n\treasoningSummary?: \"auto\" | \"detailed\" | \"concise\" | null;\n\t/**\n\t * Controls how the model uses tools.\n\t * - \"auto\": Model decides (default)\n\t * - \"none\": Disable tool use\n\t * - \"required\": Must use at least one tool\n\t * - { type: \"function\", function: { name: \"...\" } }: Force specific tool\n\t */\n\ttoolChoice?: OpenAIToolChoice;\n\t/**\n\t * Response format for structured outputs.\n\t * - `{ type: \"json_object\" }`: Guarantees valid JSON output\n\t * - `{ type: \"json_schema\", json_schema: { name, schema, strict? } }`: Guarantees output matching schema\n\t *\n\t * @see https://platform.openai.com/docs/guides/structured-outputs\n\t */\n\tresponseFormat?: OpenAIResponseFormat;\n}\n\n// =============================================================================\n// Responses API Types\n// =============================================================================\n\n/**\n * Content part for Responses API input messages.\n * User messages use input_text, assistant messages use output_text.\n */\nexport type ResponsesInputTextPart = { type: \"input_text\"; text: string };\nexport type ResponsesOutputTextPart = { type: \"output_text\"; text: string };\nexport type ResponsesContentPart =\n\t| ResponsesInputTextPart\n\t| ResponsesOutputTextPart;\n\n/**\n * Message format for Responses API input array.\n */\nexport interface ResponsesInputMessage {\n\trole: \"user\" | \"assistant\" | \"system\" | \"developer\";\n\tcontent: ResponsesContentPart[];\n}\n\n// =============================================================================\n// Utility Functions\n// =============================================================================\n\n/**\n * Filters tools for Responses API compatibility.\n *\n * The Responses API has stricter requirements than Chat Completions:\n * - Tool names must be non-empty\n * - Parameters schema cannot have oneOf/anyOf/allOf/enum/not at top level\n *\n * @param tools - Array of agent tools\n * @returns Filtered array of compatible tools\n */\nexport function filterResponsesApiTools(\n\ttools: Array<{ name: string; description: string; parameters: unknown }>,\n): Array<{ name: string; description: string; parameters: unknown }> {\n\tconst hasIncompatibleSchema = (params: unknown): boolean => {\n\t\tif (!params || typeof params !== \"object\") return false;\n\t\tconst p = params as Record<string, unknown>;\n\t\treturn !!(p.oneOf || p.anyOf || p.allOf || p.enum || p.not);\n\t};\n\n\treturn tools.filter(\n\t\t(tool) =>\n\t\t\ttool.name &&\n\t\t\ttool.name.trim() !== \"\" &&\n\t\t\t!hasIncompatibleSchema(tool.parameters),\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"openai-shared.js","sourceRoot":"","sources":["../../../src/agent/providers/openai-shared.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAyF/C,gFAAgF;AAChF,oBAAoB;AACpB,gFAAgF;AAEhF,MAAM,4BAA4B,GAAG;IACpC,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE,EAAE;IACd,oBAAoB,EAAE,IAAI;CACjB,CAAC;AAEX,MAAM,oBAAoB,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAU,CAAC;AAElE,SAAS,kBAAkB,CAAC,KAAc;IACzC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1B,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC;IACxD,CAAC;IACD,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QACtB,OAAO,KAAK,CAAC;IACd,CAAC;IAED,OAAO,MAAM,CAAC,WAAW,CACxB,MAAM,CAAC,OAAO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T,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE;QACvB,CAAC,6BAA6B,CAAC,IAAI,CAAC,UAAU,CAAC;QAC/C,CAAC,2BAA2B,CAAC,IAAI,CAAC,UAAU,CAAC,CAC9C;SACA,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QACf,GAAG,IAAI;QACP,UAAU,EAAE,6BAA6B,CAAC,IAAI,CAAC,UAAU,CAAC;KAC1D,CAAC,CAAC;SACF,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,qBAAqB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;AAC7D,CAAC","sourcesContent":["/**\n * Shared types and utilities for OpenAI providers\n *\n * This module contains types and functions shared between openai.ts and\n * openai-responses-sdk.ts to avoid circular dependencies.\n */\n\nimport type { ReasoningEffort, StreamOptions } from \"../types.js\";\nimport { isRecord } from \"./tool-arguments.js\";\n\n// =============================================================================\n// OpenAI API Types\n// =============================================================================\n\n/**\n * Tool choice configuration for OpenAI APIs.\n * Controls how the model selects which tools to use.\n */\nexport type OpenAIToolChoice =\n\t| \"auto\"\n\t| \"none\"\n\t| \"required\"\n\t| { type: \"function\"; function: { name: string } };\n\n/**\n * Response format options for structured outputs.\n * - `json_object`: Guarantees valid JSON output (legacy JSON mode)\n * - `json_schema`: Guarantees output matching a specific schema (Structured Outputs)\n *\n * Note: The format differs between APIs:\n * - Chat Completions API: `response_format: { type: \"json_schema\", json_schema: {...} }`\n * - Responses API: `text: { format: { type: \"json_schema\", name, schema, ... } }`\n *\n * This type represents the unified format; the provider handles the translation.\n *\n * @see https://platform.openai.com/docs/guides/structured-outputs\n */\nexport type OpenAIResponseFormat =\n\t| { type: \"json_object\" }\n\t| { type: \"text\" }\n\t| {\n\t\t\ttype: \"json_schema\";\n\t\t\tjson_schema: {\n\t\t\t\tname: string;\n\t\t\t\tschema: object;\n\t\t\t\tstrict?: boolean;\n\t\t\t\tdescription?: string;\n\t\t\t};\n\t };\n\n/**\n * Options for OpenAI-compatible API calls.\n */\nexport interface OpenAIOptions extends StreamOptions {\n\treasoningEffort?: ReasoningEffort;\n\t/** Controls the level of reasoning summary for Responses API. */\n\treasoningSummary?: \"auto\" | \"detailed\" | \"concise\" | null;\n\t/**\n\t * Controls how the model uses tools.\n\t * - \"auto\": Model decides (default)\n\t * - \"none\": Disable tool use\n\t * - \"required\": Must use at least one tool\n\t * - { type: \"function\", function: { name: \"...\" } }: Force specific tool\n\t */\n\ttoolChoice?: OpenAIToolChoice;\n\t/**\n\t * Response format for structured outputs.\n\t * - `{ type: \"json_object\" }`: Guarantees valid JSON output\n\t * - `{ type: \"json_schema\", json_schema: { name, schema, strict? } }`: Guarantees output matching schema\n\t *\n\t * @see https://platform.openai.com/docs/guides/structured-outputs\n\t */\n\tresponseFormat?: OpenAIResponseFormat;\n}\n\n// =============================================================================\n// Responses API Types\n// =============================================================================\n\n/**\n * Content part for Responses API input messages.\n * User messages use input_text, assistant messages use output_text.\n */\nexport type ResponsesInputTextPart = { type: \"input_text\"; text: string };\nexport type ResponsesOutputTextPart = { type: \"output_text\"; text: string };\nexport type ResponsesContentPart =\n\t| ResponsesInputTextPart\n\t| ResponsesOutputTextPart;\n\n/**\n * Message format for Responses API input array.\n */\nexport interface ResponsesInputMessage {\n\trole: \"user\" | \"assistant\" | \"system\" | \"developer\";\n\tcontent: ResponsesContentPart[];\n}\n\n// =============================================================================\n// Utility Functions\n// =============================================================================\n\nconst EMPTY_TOOL_PARAMETERS_SCHEMA = {\n\ttype: \"object\",\n\tproperties: {},\n\tadditionalProperties: true,\n} as const;\n\nconst TOP_LEVEL_UNION_KEYS = [\"anyOf\", \"oneOf\", \"allOf\"] as const;\n\nfunction canonicalizeSchema(value: unknown): unknown {\n\tif (Array.isArray(value)) {\n\t\treturn value.map((entry) => canonicalizeSchema(entry));\n\t}\n\tif (!isRecord(value)) {\n\t\treturn value;\n\t}\n\n\treturn Object.fromEntries(\n\t\tObject.entries(value)\n\t\t\t.filter(([, entryValue]) => entryValue !== undefined)\n\t\t\t.sort(([leftKey], [rightKey]) => leftKey.localeCompare(rightKey))\n\t\t\t.map(([entryKey, entryValue]) => [\n\t\t\t\tentryKey,\n\t\t\t\tcanonicalizeSchema(entryValue),\n\t\t\t]),\n\t);\n}\n\nfunction schemasAreEqual(left: unknown, right: unknown): boolean {\n\treturn (\n\t\tJSON.stringify(canonicalizeSchema(left)) ===\n\t\tJSON.stringify(canonicalizeSchema(right))\n\t);\n}\n\nfunction enumLikeValues(\n\tschema: Record<string, unknown>,\n): unknown[] | undefined {\n\tif (schema.const !== undefined) {\n\t\treturn [schema.const];\n\t}\n\tif (Array.isArray(schema.enum)) {\n\t\treturn schema.enum;\n\t}\n\treturn undefined;\n}\n\nfunction mergeCompatibleObjectSchemas(\n\tleft: Record<string, unknown>,\n\tright: Record<string, unknown>,\n): Record<string, unknown> | undefined {\n\tconst annotationKeys = new Set([\n\t\t\"$comment\",\n\t\t\"default\",\n\t\t\"deprecated\",\n\t\t\"description\",\n\t\t\"examples\",\n\t\t\"readOnly\",\n\t\t\"title\",\n\t\t\"writeOnly\",\n\t]);\n\tconst lowerBoundKeys = new Set([\n\t\t\"minimum\",\n\t\t\"exclusiveMinimum\",\n\t\t\"minLength\",\n\t\t\"minItems\",\n\t\t\"minProperties\",\n\t]);\n\tconst upperBoundKeys = new Set([\n\t\t\"maximum\",\n\t\t\"exclusiveMaximum\",\n\t\t\"maxLength\",\n\t\t\"maxItems\",\n\t\t\"maxProperties\",\n\t]);\n\tconst merged: Record<string, unknown> = { ...left };\n\tfor (const [key, value] of Object.entries(right)) {\n\t\tconst existing = merged[key];\n\t\tif (existing === undefined || schemasAreEqual(existing, value)) {\n\t\t\tmerged[key] = value;\n\t\t\tcontinue;\n\t\t}\n\t\tif (annotationKeys.has(key)) {\n\t\t\tcontinue;\n\t\t}\n\t\tif (typeof existing === \"number\" && typeof value === \"number\") {\n\t\t\tif (lowerBoundKeys.has(key)) {\n\t\t\t\tmerged[key] = Math.max(existing, value);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (upperBoundKeys.has(key)) {\n\t\t\t\tmerged[key] = Math.min(existing, value);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\t\treturn undefined;\n\t}\n\treturn merged;\n}\n\nfunction mergeSharedObjectSchemaConstraints(\n\tleft: Record<string, unknown>,\n\tright: Record<string, unknown>,\n\tenumValues: unknown[],\n): Record<string, unknown> {\n\tconst merged: Record<string, unknown> = {};\n\tfor (const [key, value] of Object.entries(left)) {\n\t\tif (right[key] !== undefined && schemasAreEqual(value, right[key])) {\n\t\t\tmerged[key] = value;\n\t\t}\n\t}\n\tconst primitiveTypes = new Set(\n\t\tenumValues\n\t\t\t.map((value) => (value === null ? \"null\" : typeof value))\n\t\t\t.filter((value) => [\"boolean\", \"number\", \"string\"].includes(value)),\n\t);\n\tif (primitiveTypes.size === 1) {\n\t\tconst [primitiveType] = [...primitiveTypes];\n\t\tif (left.type === primitiveType || right.type === primitiveType) {\n\t\t\tmerged.type = primitiveType;\n\t\t}\n\t}\n\treturn merged;\n}\n\nfunction mergeObjectVariants(\n\tvariants: unknown[],\n\trequiredMode: \"intersection\" | \"union\",\n): Record<string, unknown> | undefined {\n\tif (variants.length === 0 || !variants.every(isRecord)) return undefined;\n\tif (!variants.every((variant) => variant.type === \"object\")) return undefined;\n\n\tconst mergedProperties: Record<string, unknown> = {};\n\tconst requiredCounts = new Map<string, number>();\n\n\tfor (const variant of variants) {\n\t\tconst properties = isRecord(variant.properties) ? variant.properties : {};\n\t\tfor (const [propertyName, propertySchema] of Object.entries(properties)) {\n\t\t\tconst current = mergedProperties[propertyName];\n\t\t\tif (current === undefined) {\n\t\t\t\tmergedProperties[propertyName] = propertySchema;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (schemasAreEqual(current, propertySchema)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (isRecord(current) && isRecord(propertySchema)) {\n\t\t\t\tconst currentValues = enumLikeValues(current);\n\t\t\t\tconst incomingValues = enumLikeValues(propertySchema);\n\t\t\t\tif (currentValues && incomingValues) {\n\t\t\t\t\tconst {\n\t\t\t\t\t\tconst: _const,\n\t\t\t\t\t\tenum: _enum,\n\t\t\t\t\t\t...currentWithoutDiscriminator\n\t\t\t\t\t} = current;\n\t\t\t\t\tconst {\n\t\t\t\t\t\tconst: _incomingConst,\n\t\t\t\t\t\tenum: _incomingEnum,\n\t\t\t\t\t\t...incomingWithoutDiscriminator\n\t\t\t\t\t} = propertySchema;\n\t\t\t\t\tconst enumValues =\n\t\t\t\t\t\trequiredMode === \"union\"\n\t\t\t\t\t\t\t? currentValues.filter((value) => incomingValues.includes(value))\n\t\t\t\t\t\t\t: [...new Set([...currentValues, ...incomingValues])];\n\t\t\t\t\tif (requiredMode === \"union\" && enumValues.length === 0) {\n\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t}\n\t\t\t\t\tconst mergedSchema =\n\t\t\t\t\t\trequiredMode === \"union\"\n\t\t\t\t\t\t\t? (mergeCompatibleObjectSchemas(\n\t\t\t\t\t\t\t\t\tcurrentWithoutDiscriminator,\n\t\t\t\t\t\t\t\t\tincomingWithoutDiscriminator,\n\t\t\t\t\t\t\t\t) ?? currentWithoutDiscriminator)\n\t\t\t\t\t\t\t: mergeSharedObjectSchemaConstraints(\n\t\t\t\t\t\t\t\t\tcurrentWithoutDiscriminator,\n\t\t\t\t\t\t\t\t\tincomingWithoutDiscriminator,\n\t\t\t\t\t\t\t\t\tenumValues,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\tmergedProperties[propertyName] = {\n\t\t\t\t\t\t...mergedSchema,\n\t\t\t\t\t\t...(enumValues.length > 0 ? { enum: enumValues } : {}),\n\t\t\t\t\t};\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\trequiredMode === \"union\" &&\n\t\t\t\tisRecord(current) &&\n\t\t\t\tisRecord(propertySchema)\n\t\t\t) {\n\t\t\t\tmergedProperties[propertyName] =\n\t\t\t\t\tmergeCompatibleObjectSchemas(current, propertySchema) ?? {};\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tmergedProperties[propertyName] = {};\n\t\t}\n\n\t\tconst required = Array.isArray(variant.required) ? variant.required : [];\n\t\tfor (const propertyName of required) {\n\t\t\tif (typeof propertyName === \"string\") {\n\t\t\t\trequiredCounts.set(\n\t\t\t\t\tpropertyName,\n\t\t\t\t\t(requiredCounts.get(propertyName) ?? 0) + 1,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tconst required = [...requiredCounts.entries()].reduce(\n\t\t(acc, [propertyName, count]) => {\n\t\t\tif (count > 0) acc.union.push(propertyName);\n\t\t\tif (count === variants.length) acc.intersection.push(propertyName);\n\t\t\treturn acc;\n\t\t},\n\t\t{ intersection: [] as string[], union: [] as string[] },\n\t);\n\tconst requiredFields =\n\t\trequiredMode === \"union\" || required.intersection.length === 0\n\t\t\t? required.union\n\t\t\t: required.intersection;\n\n\treturn {\n\t\ttype: \"object\",\n\t\tproperties: mergedProperties,\n\t\t...(requiredFields.length > 0 ? { required: requiredFields } : {}),\n\t\tadditionalProperties: false,\n\t};\n}\n\nfunction mergeRootObjectConstraints(\n\tschema: Record<string, unknown>,\n\tmerged: Record<string, unknown>,\n): Record<string, unknown> | undefined {\n\tif (schema.type !== \"object\") return merged;\n\n\tconst rootProperties = isRecord(schema.properties) ? schema.properties : {};\n\tconst mergedProperties = isRecord(merged.properties) ? merged.properties : {};\n\tconst properties: Record<string, unknown> = { ...rootProperties };\n\tfor (const [propertyName, propertySchema] of Object.entries(\n\t\tmergedProperties,\n\t)) {\n\t\tconst rootPropertySchema = properties[propertyName];\n\t\tif (rootPropertySchema === undefined) {\n\t\t\tproperties[propertyName] = propertySchema;\n\t\t\tcontinue;\n\t\t}\n\t\tif (schemasAreEqual(rootPropertySchema, propertySchema)) {\n\t\t\tcontinue;\n\t\t}\n\t\tif (isRecord(rootPropertySchema) && isRecord(propertySchema)) {\n\t\t\tconst compatible = mergeCompatibleObjectSchemas(\n\t\t\t\trootPropertySchema,\n\t\t\t\tpropertySchema,\n\t\t\t);\n\t\t\tif (!compatible) return undefined;\n\t\t\tproperties[propertyName] = compatible;\n\t\t\tcontinue;\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tconst required = [\n\t\t...new Set(\n\t\t\t[\n\t\t\t\t...(Array.isArray(schema.required) ? schema.required : []),\n\t\t\t\t...(Array.isArray(merged.required) ? merged.required : []),\n\t\t\t].filter(\n\t\t\t\t(propertyName): propertyName is string =>\n\t\t\t\t\ttypeof propertyName === \"string\",\n\t\t\t),\n\t\t),\n\t];\n\n\treturn {\n\t\t...merged,\n\t\tproperties,\n\t\t...(schema.additionalProperties !== undefined\n\t\t\t? { additionalProperties: schema.additionalProperties }\n\t\t\t: {}),\n\t\t...(required.length > 0 ? { required } : {}),\n\t};\n}\n\nfunction hasBranchOnlyRequiredFields(variants: unknown[]): boolean {\n\tif (variants.length === 0 || !variants.every(isRecord)) return false;\n\n\tconst requiredCounts = new Map<string, number>();\n\tfor (const variant of variants) {\n\t\tconst required = Array.isArray(variant.required) ? variant.required : [];\n\t\tfor (const propertyName of required) {\n\t\t\tif (typeof propertyName === \"string\") {\n\t\t\t\trequiredCounts.set(\n\t\t\t\t\tpropertyName,\n\t\t\t\t\t(requiredCounts.get(propertyName) ?? 0) + 1,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn [...requiredCounts.values()].some((count) => count < variants.length);\n}\n\n/**\n * Ensures tool parameter schemas satisfy OpenAI-compatible function calling.\n *\n * Some local TypeBox schemas, especially top-level unions, serialize without a\n * top-level `type`. OpenAI-compatible gateways reject those as `type: None`.\n * Keep the original schema constraints, but make the top-level object contract\n * explicit before sending it over the wire.\n */\nexport function normalizeOpenAIToolParameters(\n\tparameters: unknown,\n): Record<string, unknown> {\n\tif (\n\t\t!parameters ||\n\t\ttypeof parameters !== \"object\" ||\n\t\tArray.isArray(parameters)\n\t) {\n\t\treturn { ...EMPTY_TOOL_PARAMETERS_SCHEMA };\n\t}\n\n\tconst schema = parameters as Record<string, unknown>;\n\tconst topLevelUnionKey = TOP_LEVEL_UNION_KEYS.find((key) =>\n\t\tArray.isArray(schema[key]),\n\t);\n\tif (topLevelUnionKey) {\n\t\tconst merged = mergeObjectVariants(\n\t\t\tschema[topLevelUnionKey] as unknown[],\n\t\t\ttopLevelUnionKey === \"allOf\" ? \"union\" : \"intersection\",\n\t\t);\n\t\tif (!merged) return { ...EMPTY_TOOL_PARAMETERS_SCHEMA };\n\t\treturn (\n\t\t\tmergeRootObjectConstraints(schema, merged) ?? {\n\t\t\t\t...EMPTY_TOOL_PARAMETERS_SCHEMA,\n\t\t\t}\n\t\t);\n\t}\n\n\tif (schema.type === \"object\") {\n\t\treturn schema;\n\t}\n\n\tif (\n\t\tschema.type === undefined &&\n\t\t!schema.enum &&\n\t\t!schema.not &&\n\t\t!schema.oneOf &&\n\t\t!schema.anyOf &&\n\t\t!schema.allOf\n\t) {\n\t\treturn { ...schema, type: \"object\" };\n\t}\n\n\treturn { ...EMPTY_TOOL_PARAMETERS_SCHEMA };\n}\n\n/**\n * Filters tools for Responses API compatibility.\n *\n * The Responses API has stricter requirements than Chat Completions:\n * - Tool names must be non-empty\n * - Parameters schema cannot have oneOf/anyOf/allOf/enum/not at top level\n *\n * @param tools - Array of agent tools\n * @returns Filtered array of compatible tools\n */\nexport function filterResponsesApiTools<\n\tT extends { name: string; description: string; parameters: unknown },\n>(\n\ttools: T[],\n): Array<Omit<T, \"parameters\"> & { parameters: Record<string, unknown> }> {\n\tconst hasUnsupportedTopLevelUnion = (params: unknown): boolean => {\n\t\tif (!isRecord(params)) return false;\n\t\tconst topLevelUnionKey = TOP_LEVEL_UNION_KEYS.find((key) =>\n\t\t\tArray.isArray(params[key]),\n\t\t);\n\t\tif (!topLevelUnionKey) return false;\n\t\tif (\n\t\t\t(topLevelUnionKey === \"anyOf\" || topLevelUnionKey === \"oneOf\") &&\n\t\t\thasBranchOnlyRequiredFields(params[topLevelUnionKey] as unknown[])\n\t\t) {\n\t\t\treturn true;\n\t\t}\n\t\treturn (\n\t\t\tmergeObjectVariants(\n\t\t\t\tparams[topLevelUnionKey] as unknown[],\n\t\t\t\ttopLevelUnionKey === \"allOf\" ? \"union\" : \"intersection\",\n\t\t\t) === undefined\n\t\t);\n\t};\n\n\tconst hasIncompatibleSchema = (params: unknown): boolean => {\n\t\tif (!params || typeof params !== \"object\") return false;\n\t\tconst p = params as Record<string, unknown>;\n\t\treturn !!(p.oneOf || p.anyOf || p.allOf || p.enum || p.not);\n\t};\n\n\tconst hasUnsupportedTopLevelKeyword = (params: unknown): boolean => {\n\t\tif (!isRecord(params)) return false;\n\t\treturn params.enum !== undefined || params.not !== undefined;\n\t};\n\n\treturn tools\n\t\t.filter(\n\t\t\t(tool) =>\n\t\t\t\ttool.name &&\n\t\t\t\ttool.name.trim() !== \"\" &&\n\t\t\t\t!hasUnsupportedTopLevelKeyword(tool.parameters) &&\n\t\t\t\t!hasUnsupportedTopLevelUnion(tool.parameters),\n\t\t)\n\t\t.map((tool) => ({\n\t\t\t...tool,\n\t\t\tparameters: normalizeOpenAIToolParameters(tool.parameters),\n\t\t}))\n\t\t.filter((tool) => !hasIncompatibleSchema(tool.parameters));\n}\n"]}
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
* @module agent/providers/openai
|
|
93
93
|
*/
|
|
94
94
|
import type { Api, AssistantMessageEvent, Context, Model } from "../types.js";
|
|
95
|
-
export { filterResponsesApiTools } from "./openai-shared.js";
|
|
95
|
+
export { filterResponsesApiTools, normalizeOpenAIToolParameters, } from "./openai-shared.js";
|
|
96
96
|
export type { OpenAIOptions, OpenAIResponseFormat, OpenAIToolChoice, ResponsesContentPart, ResponsesInputMessage, ResponsesInputTextPart, ResponsesOutputTextPart, } from "./openai-shared.js";
|
|
97
97
|
import type { OpenAIOptions } from "./openai-shared.js";
|
|
98
98
|
interface OpenAICompat {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openai.d.ts","sourceRoot":"","sources":["../../../src/agent/providers/openai.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4FG;AAWH,OAAO,KAAK,EACX,GAAG,EAEH,qBAAqB,EACrB,OAAO,EAEP,KAAK,EAGL,MAAM,aAAa,CAAC;AAIrB,OAAO,
|
|
1
|
+
{"version":3,"file":"openai.d.ts","sourceRoot":"","sources":["../../../src/agent/providers/openai.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4FG;AAWH,OAAO,KAAK,EACX,GAAG,EAEH,qBAAqB,EACrB,OAAO,EAEP,KAAK,EAGL,MAAM,aAAa,CAAC;AAIrB,OAAO,EACN,uBAAuB,EACvB,6BAA6B,GAC7B,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EACX,aAAa,EACb,oBAAoB,EACpB,gBAAgB,EAChB,oBAAoB,EACpB,qBAAqB,EACrB,sBAAsB,EACtB,uBAAuB,GACvB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EACX,aAAa,EAGb,MAAM,oBAAoB,CAAC;AAe5B,UAAU,YAAY;IACrB,aAAa,EAAE,OAAO,CAAC;IACvB,qBAAqB,EAAE,OAAO,CAAC;IAC/B,uBAAuB,EAAE,OAAO,CAAC;IACjC,oBAAoB,EAAE,OAAO,CAAC;IAC9B,6EAA6E;IAC7E,oBAAoB,EAAE,OAAO,CAAC;IAC9B,cAAc,EAAE,YAAY,GAAG,uBAAuB,CAAC;IACvD,sBAAsB,EAAE,OAAO,CAAC;IAChC,gCAAgC,EAAE,OAAO,CAAC;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AAO,CAAC,CAozBtD"}
|
|
@@ -99,7 +99,8 @@ import { createLogger } from "../../utils/logger.js";
|
|
|
99
99
|
import { mapThinkingLevelToOpenAIEffort } from "../thinking-level-mapper.js";
|
|
100
100
|
const logger = createLogger("agent:providers:openai");
|
|
101
101
|
import { streamResponsesApiSdk } from "./openai-responses-sdk.js";
|
|
102
|
-
export { filterResponsesApiTools } from "./openai-shared.js";
|
|
102
|
+
export { filterResponsesApiTools, normalizeOpenAIToolParameters, } from "./openai-shared.js";
|
|
103
|
+
import { filterResponsesApiTools } from "./openai-shared.js";
|
|
103
104
|
import { sanitizeSurrogates } from "./sanitize-unicode.js";
|
|
104
105
|
import { createToolArgumentNormalizer, describeValueType, isRecord, } from "./tool-arguments.js";
|
|
105
106
|
import { transformMessages } from "./transform-messages.js";
|
|
@@ -565,31 +566,58 @@ export async function* streamOpenAI(model, context, options) {
|
|
|
565
566
|
requestBody.max_completion_tokens = maxTokens;
|
|
566
567
|
}
|
|
567
568
|
if (context.tools && context.tools.length > 0) {
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
569
|
+
const validTools = filterResponsesApiTools(context.tools);
|
|
570
|
+
if (validTools.length < context.tools.length) {
|
|
571
|
+
const filtered = context.tools.filter((t) => !validTools.some((v) => v.name === t.name));
|
|
572
|
+
logger.warn("Some tools filtered out due to OpenAI-compatible schema limitations", {
|
|
573
|
+
filteredTools: filtered.map((t) => t.name),
|
|
574
|
+
reason: "OpenAI-compatible tool schemas cannot preserve lossy top-level unions",
|
|
575
|
+
});
|
|
576
|
+
}
|
|
577
|
+
if (validTools.length > 0) {
|
|
578
|
+
requestBody.tools = validTools.map((tool, idx, arr) => {
|
|
579
|
+
const toolDef = {
|
|
580
|
+
type: "function",
|
|
581
|
+
function: {
|
|
582
|
+
name: tool.name,
|
|
583
|
+
description: tool.description,
|
|
584
|
+
parameters: tool.parameters,
|
|
585
|
+
},
|
|
586
|
+
};
|
|
587
|
+
// Apply cache_control to last tool for OpenRouter with Claude
|
|
588
|
+
if (compat.supportsCacheControl &&
|
|
589
|
+
idx === arr.length - 1 &&
|
|
590
|
+
cacheAppliedCount < maxCacheItems) {
|
|
591
|
+
toolDef.cache_control = { type: "ephemeral" };
|
|
592
|
+
cacheAppliedCount++;
|
|
593
|
+
}
|
|
594
|
+
return toolDef;
|
|
595
|
+
});
|
|
596
|
+
}
|
|
597
|
+
else if (hasToolHistory(context.messages)) {
|
|
598
|
+
requestBody.tools = [];
|
|
599
|
+
}
|
|
586
600
|
}
|
|
587
601
|
else if (hasToolHistory(context.messages)) {
|
|
588
602
|
requestBody.tools = [];
|
|
589
603
|
}
|
|
590
604
|
// Set tool_choice if specified
|
|
591
605
|
if (options.toolChoice && requestBody.tools && requestBody.tools.length > 0) {
|
|
592
|
-
|
|
606
|
+
if (typeof options.toolChoice === "object" &&
|
|
607
|
+
options.toolChoice.type === "function") {
|
|
608
|
+
const toolName = options.toolChoice.function.name;
|
|
609
|
+
if (requestBody.tools.some((tool) => tool.function.name === toolName)) {
|
|
610
|
+
requestBody.tool_choice = options.toolChoice;
|
|
611
|
+
}
|
|
612
|
+
else {
|
|
613
|
+
logger.warn("Dropping tool_choice for filtered OpenAI-compatible tool", {
|
|
614
|
+
toolName,
|
|
615
|
+
});
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
else {
|
|
619
|
+
requestBody.tool_choice = options.toolChoice;
|
|
620
|
+
}
|
|
593
621
|
}
|
|
594
622
|
if (options.temperature !== undefined) {
|
|
595
623
|
requestBody.temperature = options.temperature;
|