@pellux/goodvibes-sdk 0.21.30 → 0.21.33
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/dist/_internal/contracts/zod-schemas/accounts.d.ts +9 -9
- package/dist/_internal/contracts/zod-schemas/auth.d.ts +1 -1
- package/dist/_internal/daemon/context.d.ts +1 -0
- package/dist/_internal/daemon/context.d.ts.map +1 -1
- package/dist/_internal/daemon/error-response.js +22 -22
- package/dist/_internal/daemon/integration-route-types.d.ts +2 -1
- package/dist/_internal/daemon/integration-route-types.d.ts.map +1 -1
- package/dist/_internal/daemon/knowledge-routes.js +5 -5
- package/dist/_internal/daemon/media-routes.d.ts.map +1 -1
- package/dist/_internal/daemon/media-routes.js +4 -3
- package/dist/_internal/daemon/operator.d.ts +1 -1
- package/dist/_internal/daemon/operator.d.ts.map +1 -1
- package/dist/_internal/daemon/operator.js +2 -0
- package/dist/_internal/daemon/runtime-route-types.d.ts +2 -1
- package/dist/_internal/daemon/runtime-route-types.d.ts.map +1 -1
- package/dist/_internal/daemon/runtime-routes.d.ts +1 -1
- package/dist/_internal/daemon/runtime-routes.d.ts.map +1 -1
- package/dist/_internal/daemon/runtime-routes.js +1 -0
- package/dist/_internal/daemon/telemetry-routes.d.ts.map +1 -1
- package/dist/_internal/daemon/telemetry-routes.js +13 -12
- package/dist/_internal/errors/daemon-error-contract.d.ts +17 -0
- package/dist/_internal/errors/daemon-error-contract.d.ts.map +1 -1
- package/dist/_internal/errors/daemon-error-contract.js +17 -1
- package/dist/_internal/errors/index.d.ts +2 -1
- package/dist/_internal/errors/index.d.ts.map +1 -1
- package/dist/_internal/errors/index.js +1 -0
- package/dist/_internal/platform/artifacts/store.d.ts.map +1 -1
- package/dist/_internal/platform/artifacts/store.js +2 -1
- package/dist/_internal/platform/automation/scheduler-capacity.d.ts +29 -0
- package/dist/_internal/platform/automation/scheduler-capacity.d.ts.map +1 -0
- package/dist/_internal/platform/automation/scheduler-capacity.js +31 -0
- package/dist/_internal/platform/channels/delivery/shared.d.ts.map +1 -1
- package/dist/_internal/platform/channels/delivery/shared.js +3 -2
- package/dist/_internal/platform/channels/delivery/strategies-bridge.d.ts.map +1 -1
- package/dist/_internal/platform/channels/delivery/strategies-bridge.js +3 -2
- package/dist/_internal/platform/channels/delivery/strategies-core.d.ts.map +1 -1
- package/dist/_internal/platform/channels/delivery/strategies-core.js +5 -4
- package/dist/_internal/platform/channels/delivery/strategies-enterprise.d.ts.map +1 -1
- package/dist/_internal/platform/channels/delivery/strategies-enterprise.js +4 -3
- package/dist/_internal/platform/config/manager.d.ts.map +1 -1
- package/dist/_internal/platform/config/manager.js +2 -1
- package/dist/_internal/platform/config/schema-domain-runtime.d.ts +6 -0
- package/dist/_internal/platform/config/schema-domain-runtime.d.ts.map +1 -1
- package/dist/_internal/platform/config/schema-domain-runtime.js +22 -0
- package/dist/_internal/platform/config/schema-types.d.ts +16 -2
- package/dist/_internal/platform/config/schema-types.d.ts.map +1 -1
- package/dist/_internal/platform/config/schema.d.ts.map +1 -1
- package/dist/_internal/platform/config/schema.js +1 -0
- package/dist/_internal/platform/config/service-registry.d.ts.map +1 -1
- package/dist/_internal/platform/config/service-registry.js +2 -1
- package/dist/_internal/platform/control-plane/gateway-web-ui.d.ts +0 -1
- package/dist/_internal/platform/control-plane/gateway-web-ui.d.ts.map +1 -1
- package/dist/_internal/platform/control-plane/gateway-web-ui.js +7 -6
- package/dist/_internal/platform/control-plane/session-broker.d.ts.map +1 -1
- package/dist/_internal/platform/control-plane/session-broker.js +12 -4
- package/dist/_internal/platform/core/orchestrator-tool-runtime.d.ts.map +1 -1
- package/dist/_internal/platform/core/orchestrator-tool-runtime.js +6 -6
- package/dist/_internal/platform/core/orchestrator-turn-loop.d.ts.map +1 -1
- package/dist/_internal/platform/core/orchestrator-turn-loop.js +10 -2
- package/dist/_internal/platform/daemon/facade-composition.d.ts +4 -131
- package/dist/_internal/platform/daemon/facade-composition.d.ts.map +1 -1
- package/dist/_internal/platform/daemon/facade-composition.js +9 -10
- package/dist/_internal/platform/daemon/facade-types.d.ts +141 -0
- package/dist/_internal/platform/daemon/facade-types.d.ts.map +1 -0
- package/dist/_internal/platform/daemon/facade-types.js +1 -0
- package/dist/_internal/platform/daemon/http/rate-limiter.d.ts +23 -0
- package/dist/_internal/platform/daemon/http/rate-limiter.d.ts.map +1 -0
- package/dist/_internal/platform/daemon/http/rate-limiter.js +71 -0
- package/dist/_internal/platform/daemon/http/router-route-contexts.d.ts.map +1 -1
- package/dist/_internal/platform/daemon/http/router-route-contexts.js +2 -1
- package/dist/_internal/platform/daemon/http/router.d.ts.map +1 -1
- package/dist/_internal/platform/daemon/http/router.js +70 -65
- package/dist/_internal/platform/daemon/http/runtime-route-types.d.ts.map +1 -1
- package/dist/_internal/platform/daemon/http-listener.d.ts +1 -0
- package/dist/_internal/platform/daemon/http-listener.d.ts.map +1 -1
- package/dist/_internal/platform/daemon/http-listener.js +53 -73
- package/dist/_internal/platform/daemon/surface-delivery.d.ts.map +1 -1
- package/dist/_internal/platform/daemon/surface-delivery.js +6 -5
- package/dist/_internal/platform/discovery/mcp-scanner.d.ts.map +1 -1
- package/dist/_internal/platform/discovery/mcp-scanner.js +28 -22
- package/dist/_internal/platform/discovery/scanner.d.ts.map +1 -1
- package/dist/_internal/platform/discovery/scanner.js +38 -22
- package/dist/_internal/platform/export/session-export.d.ts +0 -1
- package/dist/_internal/platform/export/session-export.d.ts.map +1 -1
- package/dist/_internal/platform/export/session-export.js +1 -33
- package/dist/_internal/platform/hooks/runners/http.d.ts.map +1 -1
- package/dist/_internal/platform/hooks/runners/http.js +2 -1
- package/dist/_internal/platform/integrations/delivery.d.ts +3 -1
- package/dist/_internal/platform/integrations/delivery.d.ts.map +1 -1
- package/dist/_internal/platform/integrations/delivery.js +3 -2
- package/dist/_internal/platform/integrations/discord.d.ts.map +1 -1
- package/dist/_internal/platform/integrations/discord.js +6 -5
- package/dist/_internal/platform/integrations/ntfy.d.ts.map +1 -1
- package/dist/_internal/platform/integrations/ntfy.js +3 -2
- package/dist/_internal/platform/integrations/webhooks.d.ts.map +1 -1
- package/dist/_internal/platform/integrations/webhooks.js +2 -1
- package/dist/_internal/platform/intelligence/lsp/binary-downloader.d.ts.map +1 -1
- package/dist/_internal/platform/intelligence/lsp/binary-downloader.js +4 -3
- package/dist/_internal/platform/knowledge/store.d.ts.map +1 -1
- package/dist/_internal/platform/knowledge/store.js +50 -25
- package/dist/_internal/platform/mcp/client.d.ts.map +1 -1
- package/dist/_internal/platform/mcp/client.js +3 -2
- package/dist/_internal/platform/media/builtin-generation-providers.d.ts.map +1 -1
- package/dist/_internal/platform/media/builtin-generation-providers.js +4 -3
- package/dist/_internal/platform/media/builtin-image-understanding.d.ts.map +1 -1
- package/dist/_internal/platform/media/builtin-image-understanding.js +5 -4
- package/dist/_internal/platform/providers/anthropic-compat.d.ts.map +1 -1
- package/dist/_internal/platform/providers/anthropic-compat.js +5 -3
- package/dist/_internal/platform/providers/anthropic.d.ts.map +1 -1
- package/dist/_internal/platform/providers/anthropic.js +10 -7
- package/dist/_internal/platform/providers/builtin-catalog.d.ts.map +1 -1
- package/dist/_internal/platform/providers/builtin-catalog.js +3 -2
- package/dist/_internal/platform/providers/catalogue.d.ts +56 -0
- package/dist/_internal/platform/providers/catalogue.d.ts.map +1 -0
- package/dist/_internal/platform/providers/catalogue.js +111 -0
- package/dist/_internal/platform/providers/context-discovery.d.ts.map +1 -1
- package/dist/_internal/platform/providers/context-discovery.js +2 -1
- package/dist/_internal/platform/providers/credentials.d.ts +12 -0
- package/dist/_internal/platform/providers/credentials.d.ts.map +1 -0
- package/dist/_internal/platform/providers/credentials.js +54 -0
- package/dist/_internal/platform/providers/gemini.d.ts.map +1 -1
- package/dist/_internal/platform/providers/gemini.js +6 -5
- package/dist/_internal/platform/providers/github-copilot.d.ts.map +1 -1
- package/dist/_internal/platform/providers/github-copilot.js +2 -1
- package/dist/_internal/platform/providers/health.d.ts +15 -0
- package/dist/_internal/platform/providers/health.d.ts.map +1 -0
- package/dist/_internal/platform/providers/health.js +32 -0
- package/dist/_internal/platform/providers/llama-cpp.d.ts.map +1 -1
- package/dist/_internal/platform/providers/llama-cpp.js +5 -3
- package/dist/_internal/platform/providers/lm-studio.d.ts.map +1 -1
- package/dist/_internal/platform/providers/lm-studio.js +5 -3
- package/dist/_internal/platform/providers/model-benchmarks.d.ts.map +1 -1
- package/dist/_internal/platform/providers/model-benchmarks.js +2 -1
- package/dist/_internal/platform/providers/model-catalog-cache.d.ts.map +1 -1
- package/dist/_internal/platform/providers/model-catalog-cache.js +2 -1
- package/dist/_internal/platform/providers/model-limits.d.ts.map +1 -1
- package/dist/_internal/platform/providers/model-limits.js +2 -1
- package/dist/_internal/platform/providers/ollama.d.ts.map +1 -1
- package/dist/_internal/platform/providers/ollama.js +5 -3
- package/dist/_internal/platform/providers/openai-codex.d.ts.map +1 -1
- package/dist/_internal/platform/providers/openai-codex.js +4 -2
- package/dist/_internal/platform/providers/openai-compat.d.ts.map +1 -1
- package/dist/_internal/platform/providers/openai-compat.js +3 -2
- package/dist/_internal/platform/providers/provider-not-found-error.d.ts +3 -1
- package/dist/_internal/platform/providers/provider-not-found-error.d.ts.map +1 -1
- package/dist/_internal/platform/providers/provider-not-found-error.js +3 -4
- package/dist/_internal/platform/providers/well-known-endpoints.d.ts +53 -0
- package/dist/_internal/platform/providers/well-known-endpoints.d.ts.map +1 -0
- package/dist/_internal/platform/providers/well-known-endpoints.js +52 -0
- package/dist/_internal/platform/runtime/auth/oauth-core.d.ts.map +1 -1
- package/dist/_internal/platform/runtime/auth/oauth-core.js +2 -1
- package/dist/_internal/platform/runtime/contracts/index.d.ts.map +1 -1
- package/dist/_internal/platform/runtime/contracts/index.js +1 -5
- package/dist/_internal/platform/runtime/contracts/migrations/schemas.d.ts +57 -0
- package/dist/_internal/platform/runtime/contracts/migrations/schemas.d.ts.map +1 -0
- package/dist/_internal/platform/runtime/contracts/migrations/schemas.js +157 -0
- package/dist/_internal/platform/runtime/correlation.d.ts +44 -0
- package/dist/_internal/platform/runtime/correlation.d.ts.map +1 -0
- package/dist/_internal/platform/runtime/correlation.js +40 -0
- package/dist/_internal/platform/runtime/emitters/security.d.ts +32 -0
- package/dist/_internal/platform/runtime/emitters/security.d.ts.map +1 -1
- package/dist/_internal/platform/runtime/emitters/security.js +26 -0
- package/dist/_internal/platform/runtime/emitters/tools.d.ts +11 -2
- package/dist/_internal/platform/runtime/emitters/tools.d.ts.map +1 -1
- package/dist/_internal/platform/runtime/emitters/tools.js +27 -0
- package/dist/_internal/platform/runtime/emitters/transport.d.ts +27 -0
- package/dist/_internal/platform/runtime/emitters/transport.d.ts.map +1 -1
- package/dist/_internal/platform/runtime/emitters/transport.js +19 -0
- package/dist/_internal/platform/runtime/emitters/turn.d.ts +22 -1
- package/dist/_internal/platform/runtime/emitters/turn.d.ts.map +1 -1
- package/dist/_internal/platform/runtime/emitters/turn.js +9 -0
- package/dist/_internal/platform/runtime/events/index.d.ts +45 -0
- package/dist/_internal/platform/runtime/events/index.d.ts.map +1 -1
- package/dist/_internal/platform/runtime/events/index.js +108 -14
- package/dist/_internal/platform/runtime/events/ops.d.ts +8 -0
- package/dist/_internal/platform/runtime/events/ops.d.ts.map +1 -1
- package/dist/_internal/platform/runtime/events/security.d.ts +47 -0
- package/dist/_internal/platform/runtime/events/security.d.ts.map +1 -1
- package/dist/_internal/platform/runtime/events/tools.d.ts +14 -2
- package/dist/_internal/platform/runtime/events/tools.d.ts.map +1 -1
- package/dist/_internal/platform/runtime/events/transport.d.ts +31 -0
- package/dist/_internal/platform/runtime/events/transport.d.ts.map +1 -1
- package/dist/_internal/platform/runtime/events/turn.d.ts +25 -1
- package/dist/_internal/platform/runtime/events/turn.d.ts.map +1 -1
- package/dist/_internal/platform/runtime/events/workspace.d.ts +16 -0
- package/dist/_internal/platform/runtime/events/workspace.d.ts.map +1 -1
- package/dist/_internal/platform/runtime/llm-observability.d.ts +43 -0
- package/dist/_internal/platform/runtime/llm-observability.d.ts.map +1 -0
- package/dist/_internal/platform/runtime/llm-observability.js +107 -0
- package/dist/_internal/platform/runtime/metrics.d.ts +49 -0
- package/dist/_internal/platform/runtime/metrics.d.ts.map +1 -0
- package/dist/_internal/platform/runtime/metrics.js +114 -0
- package/dist/_internal/platform/runtime/ops/control-plane.d.ts +5 -2
- package/dist/_internal/platform/runtime/ops/control-plane.d.ts.map +1 -1
- package/dist/_internal/platform/runtime/ops/control-plane.js +5 -4
- package/dist/_internal/platform/runtime/permissions/divergence-dashboard.d.ts +3 -1
- package/dist/_internal/platform/runtime/permissions/divergence-dashboard.d.ts.map +1 -1
- package/dist/_internal/platform/runtime/permissions/divergence-dashboard.js +3 -2
- package/dist/_internal/platform/runtime/permissions/policy-loader.d.ts +3 -1
- package/dist/_internal/platform/runtime/permissions/policy-loader.d.ts.map +1 -1
- package/dist/_internal/platform/runtime/permissions/policy-loader.js +3 -2
- package/dist/_internal/platform/runtime/permissions/policy-signer.d.ts.map +1 -1
- package/dist/_internal/platform/runtime/permissions/policy-signer.js +7 -2
- package/dist/_internal/platform/runtime/permissions/simulation.d.ts +3 -1
- package/dist/_internal/platform/runtime/permissions/simulation.d.ts.map +1 -1
- package/dist/_internal/platform/runtime/permissions/simulation.js +3 -2
- package/dist/_internal/platform/runtime/remote/transport-contract.d.ts +14 -2
- package/dist/_internal/platform/runtime/remote/transport-contract.d.ts.map +1 -1
- package/dist/_internal/platform/runtime/remote/transport-contract.js +7 -5
- package/dist/_internal/platform/runtime/store/helpers/reducers/sync.d.ts.map +1 -1
- package/dist/_internal/platform/runtime/store/helpers/reducers/sync.js +12 -1
- package/dist/_internal/platform/runtime/tasks/manager.d.ts +7 -3
- package/dist/_internal/platform/runtime/tasks/manager.d.ts.map +1 -1
- package/dist/_internal/platform/runtime/tasks/manager.js +7 -6
- package/dist/_internal/platform/runtime/telemetry/api-helpers.d.ts +14 -0
- package/dist/_internal/platform/runtime/telemetry/api-helpers.d.ts.map +1 -1
- package/dist/_internal/platform/runtime/telemetry/api-helpers.js +59 -0
- package/dist/_internal/platform/runtime/telemetry/api.d.ts.map +1 -1
- package/dist/_internal/platform/runtime/telemetry/api.js +9 -2
- package/dist/_internal/platform/runtime/telemetry/exporters/otlp.d.ts.map +1 -1
- package/dist/_internal/platform/runtime/telemetry/exporters/otlp.js +19 -6
- package/dist/_internal/platform/runtime/telemetry/exporters/queue.d.ts.map +1 -1
- package/dist/_internal/platform/runtime/telemetry/exporters/queue.js +11 -4
- package/dist/_internal/platform/runtime/telemetry/meter.d.ts.map +1 -1
- package/dist/_internal/platform/runtime/telemetry/meter.js +7 -3
- package/dist/_internal/platform/runtime/telemetry/redaction-config.d.ts +9 -0
- package/dist/_internal/platform/runtime/telemetry/redaction-config.d.ts.map +1 -0
- package/dist/_internal/platform/runtime/telemetry/redaction-config.js +52 -0
- package/dist/_internal/platform/runtime/tools/phases/budget.d.ts.map +1 -1
- package/dist/_internal/platform/runtime/tools/phases/budget.js +3 -2
- package/dist/_internal/platform/runtime/transports/daemon-http-client.d.ts.map +1 -1
- package/dist/_internal/platform/runtime/transports/daemon-http-client.js +138 -17
- package/dist/_internal/platform/scheduler/scheduler.d.ts.map +1 -1
- package/dist/_internal/platform/scheduler/scheduler.js +6 -2
- package/dist/_internal/platform/sessions/manager.d.ts.map +1 -1
- package/dist/_internal/platform/sessions/manager.js +6 -2
- package/dist/_internal/platform/state/memory-embedding-http.d.ts.map +1 -1
- package/dist/_internal/platform/state/memory-embedding-http.js +3 -2
- package/dist/_internal/platform/state/project-index.d.ts.map +1 -1
- package/dist/_internal/platform/state/project-index.js +6 -4
- package/dist/_internal/platform/tools/agent/index.d.ts.map +1 -1
- package/dist/_internal/platform/tools/agent/index.js +2 -1
- package/dist/_internal/platform/tools/analyze/git-modes.d.ts.map +1 -1
- package/dist/_internal/platform/tools/analyze/git-modes.js +2 -1
- package/dist/_internal/platform/tools/edit/core.d.ts.map +1 -1
- package/dist/_internal/platform/tools/edit/core.js +2 -1
- package/dist/_internal/platform/tools/exec/runtime.d.ts.map +1 -1
- package/dist/_internal/platform/tools/exec/runtime.js +3 -2
- package/dist/_internal/platform/tools/fetch/runtime.d.ts.map +1 -1
- package/dist/_internal/platform/tools/fetch/runtime.js +4 -2
- package/dist/_internal/platform/tools/read/index.d.ts.map +1 -1
- package/dist/_internal/platform/tools/read/index.js +2 -1
- package/dist/_internal/platform/tools/registry-tool/index.d.ts.map +1 -1
- package/dist/_internal/platform/tools/registry-tool/index.js +2 -1
- package/dist/_internal/platform/tools/state/index.d.ts.map +1 -1
- package/dist/_internal/platform/tools/state/index.js +2 -1
- package/dist/_internal/platform/tools/task/index.d.ts.map +1 -1
- package/dist/_internal/platform/tools/task/index.js +2 -1
- package/dist/_internal/platform/tools/team/index.d.ts.map +1 -1
- package/dist/_internal/platform/tools/team/index.js +2 -1
- package/dist/_internal/platform/tools/web-search/index.d.ts.map +1 -1
- package/dist/_internal/platform/tools/web-search/index.js +2 -1
- package/dist/_internal/platform/tools/worklist/index.d.ts.map +1 -1
- package/dist/_internal/platform/tools/worklist/index.js +2 -1
- package/dist/_internal/platform/types/errors.d.ts +12 -10
- package/dist/_internal/platform/types/errors.d.ts.map +1 -1
- package/dist/_internal/platform/types/errors.js +21 -20
- package/dist/_internal/platform/utils/error-display.d.ts.map +1 -1
- package/dist/_internal/platform/utils/error-display.js +6 -4
- package/dist/_internal/platform/utils/fetch-with-timeout.d.ts +17 -0
- package/dist/_internal/platform/utils/fetch-with-timeout.d.ts.map +1 -1
- package/dist/_internal/platform/utils/fetch-with-timeout.js +59 -0
- package/dist/_internal/platform/utils/record-coerce.d.ts +11 -0
- package/dist/_internal/platform/utils/record-coerce.d.ts.map +1 -0
- package/dist/_internal/platform/utils/record-coerce.js +12 -0
- package/dist/_internal/platform/utils/redaction.js +1 -1
- package/dist/_internal/platform/utils/ring-buffer.d.ts +54 -0
- package/dist/_internal/platform/utils/ring-buffer.d.ts.map +1 -0
- package/dist/_internal/platform/utils/ring-buffer.js +96 -0
- package/dist/_internal/platform/utils/shell-split.d.ts +11 -0
- package/dist/_internal/platform/utils/shell-split.d.ts.map +1 -0
- package/dist/_internal/platform/utils/shell-split.js +83 -0
- package/dist/_internal/platform/version.js +1 -1
- package/dist/_internal/platform/voice/providers/deepgram.d.ts.map +1 -1
- package/dist/_internal/platform/voice/providers/deepgram.js +2 -1
- package/dist/_internal/platform/voice/providers/elevenlabs.d.ts.map +1 -1
- package/dist/_internal/platform/voice/providers/elevenlabs.js +5 -4
- package/dist/_internal/platform/voice/providers/google.d.ts.map +1 -1
- package/dist/_internal/platform/voice/providers/google.js +5 -4
- package/dist/_internal/platform/voice/providers/microsoft.d.ts.map +1 -1
- package/dist/_internal/platform/voice/providers/microsoft.js +2 -1
- package/dist/_internal/platform/voice/providers/openai.d.ts.map +1 -1
- package/dist/_internal/platform/voice/providers/openai.js +4 -3
- package/dist/_internal/platform/voice/providers/shared.d.ts.map +1 -1
- package/dist/_internal/platform/voice/providers/shared.js +2 -1
- package/dist/_internal/platform/voice/providers/vydra.d.ts.map +1 -1
- package/dist/_internal/platform/voice/providers/vydra.js +3 -2
- package/dist/_internal/platform/watchers/registry.d.ts.map +1 -1
- package/dist/_internal/platform/watchers/registry.js +3 -2
- package/dist/_internal/platform/workflow/trigger-executor.d.ts.map +1 -1
- package/dist/_internal/platform/workflow/trigger-executor.js +5 -3
- package/dist/_internal/platform/workspace/daemon-home.d.ts.map +1 -1
- package/dist/_internal/platform/workspace/daemon-home.js +6 -2
- package/dist/_internal/platform/workspace/workspace-swap-manager.d.ts +1 -0
- package/dist/_internal/platform/workspace/workspace-swap-manager.d.ts.map +1 -1
- package/dist/_internal/platform/workspace/workspace-swap-manager.js +14 -2
- package/package.json +1 -1
|
@@ -2,6 +2,7 @@ import { mkdirSync, readFileSync, renameSync, writeFileSync } from 'node:fs';
|
|
|
2
2
|
import { join } from 'node:path';
|
|
3
3
|
import { logger } from '../utils/logger.js';
|
|
4
4
|
import { summarizeError } from '../utils/error-display.js';
|
|
5
|
+
import { instrumentedFetch } from '../utils/fetch-with-timeout.js';
|
|
5
6
|
const ZEROEVAL_URL = 'https://api.zeroeval.com/leaderboard/models/full?justCanonicals=true';
|
|
6
7
|
const FETCH_TIMEOUT_MS = 20_000;
|
|
7
8
|
const CACHE_TTL_MS = 86_400_000;
|
|
@@ -221,7 +222,7 @@ export class BenchmarkStore {
|
|
|
221
222
|
const controller = new AbortController();
|
|
222
223
|
const timer = setTimeout(() => controller.abort(), FETCH_TIMEOUT_MS);
|
|
223
224
|
try {
|
|
224
|
-
const response = await
|
|
225
|
+
const response = await instrumentedFetch(ZEROEVAL_URL, {
|
|
225
226
|
signal: controller.signal,
|
|
226
227
|
headers: { Accept: 'application/json' },
|
|
227
228
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model-catalog-cache.d.ts","sourceRoot":"","sources":["../../../../src/_internal/platform/providers/model-catalog-cache.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"model-catalog-cache.d.ts","sourceRoot":"","sources":["../../../../src/_internal/platform/providers/model-catalog-cache.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAiBvD,UAAU,gBAAgB;IACxB,OAAO,EAAE,CAAC,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,YAAY,EAAE,CAAC;CACxB;AA8BD,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAE5D;AAED,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAE1D;AA4FD,iBAAS,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,gBAAgB,GAAG,IAAI,CAepE;AAED,iBAAS,gBAAgB,CAAC,MAAM,EAAE,YAAY,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAc1F;AAED,iBAAS,mBAAmB,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAE7D;AAED;;;GAGG;AACH,wBAAsB,YAAY,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC,CAqB5D;AAED,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,mBAAmB,GACpB,CAAC"}
|
|
@@ -2,6 +2,7 @@ import fs from 'node:fs';
|
|
|
2
2
|
import { dirname, join } from 'node:path';
|
|
3
3
|
import { logger } from '../utils/logger.js';
|
|
4
4
|
import { summarizeError } from '../utils/error-display.js';
|
|
5
|
+
import { instrumentedFetch } from '../utils/fetch-with-timeout.js';
|
|
5
6
|
const MODELS_DEV_URL = 'https://models.dev/api.json';
|
|
6
7
|
const CATALOG_FETCH_TIMEOUT_MS = 30_000;
|
|
7
8
|
const CATALOG_TTL_MS = 86_400_000; // 24 hours
|
|
@@ -141,7 +142,7 @@ export async function fetchCatalog() {
|
|
|
141
142
|
const controller = new AbortController();
|
|
142
143
|
const timer = setTimeout(() => controller.abort(), CATALOG_FETCH_TIMEOUT_MS);
|
|
143
144
|
try {
|
|
144
|
-
const response = await
|
|
145
|
+
const response = await instrumentedFetch(MODELS_DEV_URL, {
|
|
145
146
|
signal: controller.signal,
|
|
146
147
|
headers: { Accept: 'application/json' },
|
|
147
148
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model-limits.d.ts","sourceRoot":"","sources":["../../../../src/_internal/platform/providers/model-limits.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"model-limits.d.ts","sourceRoot":"","sources":["../../../../src/_internal/platform/providers/model-limits.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AA6ClE,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAED,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEhE;AA6GD,qBAAa,kBAAkB;IAIjB,OAAO,CAAC,QAAQ,CAAC,OAAO;IAHpC,OAAO,CAAC,UAAU,CAAiC;IACnD,OAAO,CAAC,WAAW,CAAiD;gBAEvC,OAAO,EAAE,yBAAyB;IAE/D,OAAO,CAAC,mBAAmB;IAQ3B,OAAO,CAAC,kBAAkB;IA4B1B,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;IAWpG,sBAAsB,CAAC,QAAQ,EAAE,eAAe,GAAG,QAAQ,CAAC,WAAW,CAAC;IAIxE,wBAAwB,CAAC,QAAQ,EAAE,eAAe,GAAG,MAAM;IAc3D,6BAA6B,CAAC,KAAK,EAAE,eAAe,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM;IAK1E,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC;IAiChC,IAAI,IAAI,IAAI;CASb"}
|
|
@@ -2,6 +2,7 @@ import { dirname, join } from 'node:path';
|
|
|
2
2
|
import { mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
3
3
|
import { logger } from '../utils/logger.js';
|
|
4
4
|
import { summarizeError } from '../utils/error-display.js';
|
|
5
|
+
import { instrumentedFetch } from '../utils/fetch-with-timeout.js';
|
|
5
6
|
const OPENROUTER_MODELS_URL = 'https://openrouter.ai/api/v1/models';
|
|
6
7
|
const FETCH_TIMEOUT_MS = 15_000;
|
|
7
8
|
const CACHE_TTL_MS = 86_400_000;
|
|
@@ -49,7 +50,7 @@ async function fetchOpenRouterModels() {
|
|
|
49
50
|
const controller = new AbortController();
|
|
50
51
|
const timer = setTimeout(() => controller.abort(), FETCH_TIMEOUT_MS);
|
|
51
52
|
try {
|
|
52
|
-
const response = await
|
|
53
|
+
const response = await instrumentedFetch(OPENROUTER_MODELS_URL, {
|
|
53
54
|
signal: controller.signal,
|
|
54
55
|
headers: { Accept: 'application/json' },
|
|
55
56
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ollama.d.ts","sourceRoot":"","sources":["../../../../src/_internal/platform/providers/ollama.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ollama.d.ts","sourceRoot":"","sources":["../../../../src/_internal/platform/providers/ollama.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,KAAK,EACV,WAAW,EACX,YAAY,EAEZ,WAAW,EAEX,wBAAwB,EACxB,uBAAuB,EAEvB,uBAAuB,EACvB,2BAA2B,EAC5B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAwB,KAAK,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAMpF,KAAK,WAAW,GAAG,CACjB,KAAK,EAAE,WAAW,GAAG,GAAG,EACxB,IAAI,CAAC,EAAE,WAAW,KACf,OAAO,CAAC,QAAQ,CAAC,CAAC;AAqBvB,MAAM,WAAW,qBAAsB,SAAQ,mBAAmB;IAChE,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,gBAAgB,CAAC,EAAE,WAAW,CAAC;CAChC;AAED,qBAAa,cAAe,YAAW,WAAW;IAChD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC;IAC1B,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAEpD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;IACtC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAS;IACvC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAS;IACxC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAc;IAC1C,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAc;IAC/C,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAoB;gBAEvC,IAAI,EAAE,qBAAqB;IAYvC,YAAY,IAAI,OAAO;IAIjB,IAAI,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC;IAmBhD,KAAK,CAAC,OAAO,EAAE,wBAAwB,GAAG,OAAO,CAAC,uBAAuB,CAAC;IAuC1E,eAAe,CAAC,IAAI,EAAE,2BAA2B,GAAG,OAAO,CAAC,uBAAuB,CAAC;YA4C5E,mBAAmB;CAmGlC"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { withRetry } from '../utils/retry.js';
|
|
2
|
+
import { instrumentedLlmCall } from '../runtime/llm-observability.js';
|
|
2
3
|
import { ProviderError } from '../types/errors.js';
|
|
3
4
|
import { OpenAICompatProvider } from './openai-compat.js';
|
|
4
5
|
import { toOpenAITools } from './tool-formats.js';
|
|
5
6
|
import { summarizeError, toProviderError } from '../utils/error-display.js';
|
|
6
7
|
import { mapOllamaStopReason } from './stop-reason-maps.js';
|
|
8
|
+
import { instrumentedFetch } from '../utils/fetch-with-timeout.js';
|
|
7
9
|
export class OllamaProvider {
|
|
8
10
|
name;
|
|
9
11
|
models;
|
|
@@ -23,14 +25,14 @@ export class OllamaProvider {
|
|
|
23
25
|
this.defaultModel = opts.defaultModel;
|
|
24
26
|
this.nativeChatUrl = deriveOllamaChatUrl(opts.baseURL);
|
|
25
27
|
this.nativeEmbedUrl = deriveOllamaEmbedUrl(opts.baseURL);
|
|
26
|
-
this.nativeFetch = opts.nativeFetch ??
|
|
28
|
+
this.nativeFetch = opts.nativeFetch ?? instrumentedFetch;
|
|
27
29
|
this.fallbackProvider = opts.fallbackProvider ?? new OpenAICompatProvider(opts);
|
|
28
30
|
}
|
|
29
31
|
isConfigured() {
|
|
30
32
|
return this.fallbackProvider.isConfigured?.() ?? true;
|
|
31
33
|
}
|
|
32
34
|
async chat(params) {
|
|
33
|
-
return withRetry(async () => {
|
|
35
|
+
return (await instrumentedLlmCall(() => withRetry(async () => {
|
|
34
36
|
const model = params.model || this.defaultModel;
|
|
35
37
|
if (canUseNativeOllamaChat(params.messages)) {
|
|
36
38
|
try {
|
|
@@ -43,7 +45,7 @@ export class OllamaProvider {
|
|
|
43
45
|
}
|
|
44
46
|
}
|
|
45
47
|
return this.fallbackProvider.chat(params);
|
|
46
|
-
});
|
|
48
|
+
}), { provider: this.name, model: params.model || this.defaultModel })).result;
|
|
47
49
|
}
|
|
48
50
|
async embed(request) {
|
|
49
51
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openai-codex.d.ts","sourceRoot":"","sources":["../../../../src/_internal/platform/providers/openai-codex.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,YAAY,EACZ,WAAW,EAGX,uBAAuB,EACvB,2BAA2B,EAC5B,MAAM,gBAAgB,CAAC;AAMxB,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"openai-codex.d.ts","sourceRoot":"","sources":["../../../../src/_internal/platform/providers/openai-codex.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,YAAY,EACZ,WAAW,EAGX,uBAAuB,EACvB,2BAA2B,EAC5B,MAAM,gBAAgB,CAAC;AAMxB,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AA4ItE,wBAAsB,mBAAmB,CACvC,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,WAAW,GAClB,OAAO,CAAC,YAAY,CAAC,CAgQvB;AAED,qBAAa,mBAAoB,YAAW,WAAW;IAKnD,OAAO,CAAC,QAAQ,CAAC,mBAAmB;IAJtC,QAAQ,CAAC,IAAI,uBAA8B;IAC3C,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,CAAM;gBAGZ,mBAAmB,EAAE,IAAI,CAAC,mBAAmB,EAAE,KAAK,GAAG,kBAAkB,GAAG,oBAAoB,CAAC;IAG9G,IAAI,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC;IAgBhD,eAAe,CAAC,IAAI,EAAE,2BAA2B,GAAG,OAAO,CAAC,uBAAuB,CAAC;CAgC3F"}
|
|
@@ -3,7 +3,9 @@ import { withRetry } from '../utils/retry.js';
|
|
|
3
3
|
import { resolveSubscriptionAccessToken } from '../config/subscription-auth.js';
|
|
4
4
|
import { arch, platform, release } from 'node:os';
|
|
5
5
|
import { toProviderError } from '../utils/error-display.js';
|
|
6
|
+
import { instrumentedLlmCall } from '../runtime/llm-observability.js';
|
|
6
7
|
import { mapCodexStopReason } from './stop-reason-maps.js';
|
|
8
|
+
import { instrumentedFetch } from '../utils/fetch-with-timeout.js';
|
|
7
9
|
const OPENAI_CODEX_BASE_URL = 'https://chatgpt.com/backend-api';
|
|
8
10
|
const OPENAI_CODEX_PROVIDER_NAME = 'openai-subscriber';
|
|
9
11
|
function getOpenAICodexUserAgent() {
|
|
@@ -148,7 +150,7 @@ export async function chatWithOpenAICodex(accessToken, params) {
|
|
|
148
150
|
};
|
|
149
151
|
let response;
|
|
150
152
|
try {
|
|
151
|
-
response = await
|
|
153
|
+
response = await instrumentedFetch(`${OPENAI_CODEX_BASE_URL}/codex/responses`, {
|
|
152
154
|
method: 'POST',
|
|
153
155
|
headers: {
|
|
154
156
|
authorization: `Bearer ${accessToken}`,
|
|
@@ -404,7 +406,7 @@ export class OpenAICodexProvider {
|
|
|
404
406
|
phase: 'auth',
|
|
405
407
|
});
|
|
406
408
|
}
|
|
407
|
-
return chatWithOpenAICodex(accessToken, params);
|
|
409
|
+
return (await instrumentedLlmCall(() => chatWithOpenAICodex(accessToken, params), { provider: this.name, model: params.model ?? '' })).result;
|
|
408
410
|
}
|
|
409
411
|
async describeRuntime(deps) {
|
|
410
412
|
const { buildStandardProviderAuthRoutes } = await import('./runtime-metadata.js');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openai-compat.d.ts","sourceRoot":"","sources":["../../../../src/_internal/platform/providers/openai-compat.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,WAAW,EACX,WAAW,EACX,YAAY,EAEZ,wBAAwB,EACxB,uBAAuB,EACvB,uBAAuB,EACvB,2BAA2B,EAC5B,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"openai-compat.d.ts","sourceRoot":"","sources":["../../../../src/_internal/platform/providers/openai-compat.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,WAAW,EACX,WAAW,EACX,YAAY,EAEZ,wBAAwB,EACxB,uBAAuB,EACvB,uBAAuB,EACvB,2BAA2B,EAC5B,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAa5D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AA0M3D,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAC3C,4EAA4E;IAC5E,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACxC,kEAAkE;IAClE,eAAe,CAAC,EAAE,SAAS,GAAG,YAAY,GAAG,UAAU,GAAG,MAAM,CAAC;IACjE,wFAAwF;IACxF,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAChC,gFAAgF;IAChF,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,iGAAiG;IACjG,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,0EAA0E;IAC1E,gBAAgB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,uEAAuE;IACvE,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5B,+DAA+D;IAC/D,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,+CAA+C;IAC/C,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,sFAAsF;IACtF,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,mEAAmE;IACnE,eAAe,CAAC,EAAE,IAAI,CAAC,eAAe,EAAE,YAAY,CAAC,CAAC;CACvD;AAED;;;;GAIG;AACH,qBAAa,oBAAqB,YAAW,WAAW;IACtD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC;IAC1B,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAEpD,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,cAAc,CAAS;IAC/B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAU;IACrC,OAAO,CAAC,eAAe,CAAiD;IACxE,OAAO,CAAC,eAAe,CAA0B;IACjD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAoB;IAChD,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAoB;IACjD,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAAC,CAAS;IACjD,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAoB;IACrD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAoB;IAC5C,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAS;IACzC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAU;IACzC,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAU;IAC9C,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAS;IAC1C,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAsC;IACtE,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;gBAE1B,IAAI,EAAE,mBAAmB;IAkCrC,YAAY,IAAI,OAAO;IAIjB,IAAI,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC;IA6NhD,KAAK,CAAC,OAAO,EAAE,wBAAwB,GAAG,OAAO,CAAC,uBAAuB,CAAC;IA8B1E,eAAe,CAAC,IAAI,EAAE,2BAA2B,GAAG,OAAO,CAAC,uBAAuB,CAAC;CAiD3F"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import OpenAI from 'openai';
|
|
2
2
|
import { ProviderError } from '../types/errors.js';
|
|
3
3
|
import { withRetry } from '../utils/retry.js';
|
|
4
|
+
import { instrumentedLlmCall } from '../runtime/llm-observability.js';
|
|
4
5
|
import { toOpenAITools, toOpenAIMessages, fromOpenAIToolCalls, extractTextToolCalls, } from './tool-formats.js';
|
|
5
6
|
import { getCacheCapability } from './cache-capability.js';
|
|
6
7
|
import { extractOpenAIStreamTextDelta } from './openai-stream-delta.js';
|
|
@@ -235,7 +236,7 @@ export class OpenAICompatProvider {
|
|
|
235
236
|
}
|
|
236
237
|
async chat(params) {
|
|
237
238
|
const { messages, tools, model, maxTokens, signal, systemPrompt, reasoningEffort, reasoningSummary, onDelta, } = params;
|
|
238
|
-
return withRetry(async () => {
|
|
239
|
+
return (await instrumentedLlmCall(() => withRetry(async () => {
|
|
239
240
|
const allowReasoningStream = this.reasoningFormat !== 'none';
|
|
240
241
|
let responseText = '';
|
|
241
242
|
let inputTokens = 0;
|
|
@@ -419,7 +420,7 @@ export class OpenAICompatProvider {
|
|
|
419
420
|
cacheReadTokens,
|
|
420
421
|
});
|
|
421
422
|
return response;
|
|
422
|
-
});
|
|
423
|
+
}), { provider: this.name, model: model ?? this.defaultModel })).result;
|
|
423
424
|
}
|
|
424
425
|
async embed(request) {
|
|
425
426
|
let response;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { GoodVibesSdkError } from '../../errors/index.js';
|
|
1
2
|
/**
|
|
2
3
|
* Thrown by {@link ProviderRegistry.require} when no provider with the given ID
|
|
3
4
|
* is registered.
|
|
@@ -6,7 +7,8 @@
|
|
|
6
7
|
* so callers can quickly see what is available without having to inspect the
|
|
7
8
|
* registry separately.
|
|
8
9
|
*/
|
|
9
|
-
export declare class ProviderNotFoundError extends
|
|
10
|
+
export declare class ProviderNotFoundError extends GoodVibesSdkError {
|
|
11
|
+
readonly code: 'PROVIDER_NOT_FOUND';
|
|
10
12
|
/** The provider ID that was requested. */
|
|
11
13
|
readonly providerId: string;
|
|
12
14
|
/** Sorted list of currently-registered provider IDs at the time of the error. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider-not-found-error.d.ts","sourceRoot":"","sources":["../../../../src/_internal/platform/providers/provider-not-found-error.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,qBAAa,qBAAsB,SAAQ,
|
|
1
|
+
{"version":3,"file":"provider-not-found-error.d.ts","sourceRoot":"","sources":["../../../../src/_internal/platform/providers/provider-not-found-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE1D;;;;;;;GAOG;AACH,qBAAa,qBAAsB,SAAQ,iBAAiB;IAC1D,SAAiB,IAAI,EAAE,oBAAoB,CAAC;IAC5C,0CAA0C;IAC1C,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,iFAAiF;IACjF,QAAQ,CAAC,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;gBAE7B,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,MAAM,EAAE;CAW7D"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { GoodVibesSdkError } from '../../errors/index.js';
|
|
1
2
|
/**
|
|
2
3
|
* Thrown by {@link ProviderRegistry.require} when no provider with the given ID
|
|
3
4
|
* is registered.
|
|
@@ -6,7 +7,7 @@
|
|
|
6
7
|
* so callers can quickly see what is available without having to inspect the
|
|
7
8
|
* registry separately.
|
|
8
9
|
*/
|
|
9
|
-
export class ProviderNotFoundError extends
|
|
10
|
+
export class ProviderNotFoundError extends GoodVibesSdkError {
|
|
10
11
|
/** The provider ID that was requested. */
|
|
11
12
|
providerId;
|
|
12
13
|
/** Sorted list of currently-registered provider IDs at the time of the error. */
|
|
@@ -14,11 +15,9 @@ export class ProviderNotFoundError extends Error {
|
|
|
14
15
|
constructor(providerId, available) {
|
|
15
16
|
const ids = available.length > 0 ? available.join(', ') : '(none)';
|
|
16
17
|
super(`Provider '${providerId}' is not registered. ` +
|
|
17
|
-
`Available providers: ${ids}
|
|
18
|
+
`Available providers: ${ids}`, { code: 'PROVIDER_NOT_FOUND', category: 'not_found', source: 'provider', recoverable: false });
|
|
18
19
|
this.name = 'ProviderNotFoundError';
|
|
19
20
|
this.providerId = providerId;
|
|
20
21
|
this.availableIds = available;
|
|
21
|
-
// Maintains proper prototype chain for instanceof checks
|
|
22
|
-
Object.setPrototypeOf(this, new.target.prototype);
|
|
23
22
|
}
|
|
24
23
|
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Well-known local LLM service endpoints and ports.
|
|
3
|
+
*
|
|
4
|
+
* These are **fallback defaults** used for zero-config local LLM discovery when
|
|
5
|
+
* no explicit base URL has been provided by the user. They represent the
|
|
6
|
+
* conventional ports that popular local inference servers listen on out of the box.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* - Import the base URL when building a default `baseURL` string literal.
|
|
10
|
+
* - Import the port when doing port-based fingerprinting in the scanner.
|
|
11
|
+
* - Never use these to override a user-supplied config value.
|
|
12
|
+
*
|
|
13
|
+
* @module well-known-endpoints
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Frozen map of well-known local LLM service base URLs.
|
|
17
|
+
*
|
|
18
|
+
* Keys correspond to the canonical service identifier used across the codebase.
|
|
19
|
+
* Values are the bare origin (scheme + host + port, **no trailing slash**).
|
|
20
|
+
* Append a path suffix (e.g. `/v1`) at the call site where the full URL is built.
|
|
21
|
+
*/
|
|
22
|
+
export declare const WELL_KNOWN_LOCAL_ENDPOINTS: Readonly<{
|
|
23
|
+
/** Ollama — default listen address (loopback) */
|
|
24
|
+
readonly ollama: "http://127.0.0.1:11434";
|
|
25
|
+
/** LM Studio — default OpenAI-compat server */
|
|
26
|
+
readonly lmStudio: "http://127.0.0.1:1234";
|
|
27
|
+
/** llama.cpp — default HTTP server */
|
|
28
|
+
readonly llamaCpp: "http://localhost:8080";
|
|
29
|
+
/** LiteLLM — default proxy gateway */
|
|
30
|
+
readonly liteLLM: "http://localhost:4000";
|
|
31
|
+
/** Copilot Proxy — operator-managed local gateway */
|
|
32
|
+
readonly copilotProxy: "http://localhost:3000";
|
|
33
|
+
}>;
|
|
34
|
+
/**
|
|
35
|
+
* Frozen map of well-known local LLM service port numbers.
|
|
36
|
+
*
|
|
37
|
+
* Used by the scanner when fingerprinting discovered servers by port. The full
|
|
38
|
+
* `KNOWN_PORTS` scan list is derived from this plus additional ports for less
|
|
39
|
+
* common services.
|
|
40
|
+
*/
|
|
41
|
+
export declare const WELL_KNOWN_LOCAL_PORTS: Readonly<{
|
|
42
|
+
readonly ollama: 11434;
|
|
43
|
+
readonly lmStudio: 1234;
|
|
44
|
+
readonly llamaCpp: 8080;
|
|
45
|
+
readonly liteLLM: 4000;
|
|
46
|
+
readonly copilotProxy: 3000;
|
|
47
|
+
/** Oobabooga / Text Generation WebUI (common alt port) */
|
|
48
|
+
readonly jan: 1337;
|
|
49
|
+
readonly gpt4all: 4891;
|
|
50
|
+
readonly koboldCpp: 5001;
|
|
51
|
+
readonly aphrodite: 2242;
|
|
52
|
+
}>;
|
|
53
|
+
//# sourceMappingURL=well-known-endpoints.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"well-known-endpoints.d.ts","sourceRoot":"","sources":["../../../../src/_internal/platform/providers/well-known-endpoints.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,0BAA0B;IACrC,iDAAiD;;IAEjD,+CAA+C;;IAE/C,sCAAsC;;IAEtC,sCAAsC;;IAEtC,qDAAqD;;EAE5C,CAAC;AAEZ;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB;;;;;;IAMjC,0DAA0D;;;;;EAKjD,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Well-known local LLM service endpoints and ports.
|
|
3
|
+
*
|
|
4
|
+
* These are **fallback defaults** used for zero-config local LLM discovery when
|
|
5
|
+
* no explicit base URL has been provided by the user. They represent the
|
|
6
|
+
* conventional ports that popular local inference servers listen on out of the box.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* - Import the base URL when building a default `baseURL` string literal.
|
|
10
|
+
* - Import the port when doing port-based fingerprinting in the scanner.
|
|
11
|
+
* - Never use these to override a user-supplied config value.
|
|
12
|
+
*
|
|
13
|
+
* @module well-known-endpoints
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Frozen map of well-known local LLM service base URLs.
|
|
17
|
+
*
|
|
18
|
+
* Keys correspond to the canonical service identifier used across the codebase.
|
|
19
|
+
* Values are the bare origin (scheme + host + port, **no trailing slash**).
|
|
20
|
+
* Append a path suffix (e.g. `/v1`) at the call site where the full URL is built.
|
|
21
|
+
*/
|
|
22
|
+
export const WELL_KNOWN_LOCAL_ENDPOINTS = Object.freeze({
|
|
23
|
+
/** Ollama — default listen address (loopback) */
|
|
24
|
+
ollama: 'http://127.0.0.1:11434',
|
|
25
|
+
/** LM Studio — default OpenAI-compat server */
|
|
26
|
+
lmStudio: 'http://127.0.0.1:1234',
|
|
27
|
+
/** llama.cpp — default HTTP server */
|
|
28
|
+
llamaCpp: 'http://localhost:8080',
|
|
29
|
+
/** LiteLLM — default proxy gateway */
|
|
30
|
+
liteLLM: 'http://localhost:4000',
|
|
31
|
+
/** Copilot Proxy — operator-managed local gateway */
|
|
32
|
+
copilotProxy: 'http://localhost:3000',
|
|
33
|
+
});
|
|
34
|
+
/**
|
|
35
|
+
* Frozen map of well-known local LLM service port numbers.
|
|
36
|
+
*
|
|
37
|
+
* Used by the scanner when fingerprinting discovered servers by port. The full
|
|
38
|
+
* `KNOWN_PORTS` scan list is derived from this plus additional ports for less
|
|
39
|
+
* common services.
|
|
40
|
+
*/
|
|
41
|
+
export const WELL_KNOWN_LOCAL_PORTS = Object.freeze({
|
|
42
|
+
ollama: 11434,
|
|
43
|
+
lmStudio: 1234,
|
|
44
|
+
llamaCpp: 8080,
|
|
45
|
+
liteLLM: 4000,
|
|
46
|
+
copilotProxy: 3000,
|
|
47
|
+
/** Oobabooga / Text Generation WebUI (common alt port) */
|
|
48
|
+
jan: 1337,
|
|
49
|
+
gpt4all: 4891,
|
|
50
|
+
koboldCpp: 5001,
|
|
51
|
+
aphrodite: 2242,
|
|
52
|
+
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth-core.d.ts","sourceRoot":"","sources":["../../../../../src/_internal/platform/runtime/auth/oauth-core.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAGzE,OAAO,KAAK,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"oauth-core.d.ts","sourceRoot":"","sources":["../../../../../src/_internal/platform/runtime/auth/oauth-core.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAGzE,OAAO,KAAK,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAEpF,YAAY,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAEpF,wBAAgB,gBAAgB,CAAC,KAAK,SAAK,GAAG,MAAM,CAEnD;AAED,wBAAgB,kBAAkB,CAAC,KAAK,SAAK,GAAG,MAAM,CAErD;AAED,wBAAsB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAE3E;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,OAAO,GAAG,SAAS,MAAM,EAAE,GAAG,SAAS,CAI5E;AAED,wBAAsB,4BAA4B,CAChD,MAAM,EAAE,mBAAmB,EAC3B,KAAK,CAAC,EAAE;IACN,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC/B,GACA,OAAO,CAAC,eAAe,CAAC,CA4B1B;AA4CD,wBAAsB,8BAA8B,CAClD,MAAM,EAAE,mBAAmB,EAC3B,KAAK,EAAE;IACL,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB,GACA,OAAO,CAAC,iBAAiB,CAAC,CAc5B;AAED,wBAAsB,uBAAuB,CAC3C,MAAM,EAAE,mBAAmB,EAC3B,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,iBAAiB,CAAC,CAc5B;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAa9E"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createSha256Hash, randomBytesBase64url } from './crypto-adapter.js';
|
|
2
|
+
import { instrumentedFetch } from '../../utils/fetch-with-timeout.js';
|
|
2
3
|
export function createOAuthState(bytes = 24) {
|
|
3
4
|
return randomBytesBase64url(bytes);
|
|
4
5
|
}
|
|
@@ -47,7 +48,7 @@ async function exchangeOAuthRequest(url, encoding, payload) {
|
|
|
47
48
|
const body = encoding === 'json'
|
|
48
49
|
? JSON.stringify(payload)
|
|
49
50
|
: new URLSearchParams(Object.entries(payload).map(([key, value]) => [key, String(value)])).toString();
|
|
50
|
-
const response = await
|
|
51
|
+
const response = await instrumentedFetch(url, {
|
|
51
52
|
method: 'POST',
|
|
52
53
|
headers: {
|
|
53
54
|
'Content-Type': encoding === 'json' ? 'application/json' : 'application/x-www-form-urlencoded',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/_internal/platform/runtime/contracts/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,uBAAuB,CAAC;AAEtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/_internal/platform/runtime/contracts/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,uBAAuB,CAAC;AAEtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAYjD;;;;;;;;;;;GAWG;AACH,wBAAgB,sBAAsB,IAAI;IACxC,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,SAAS,EAAE,GAAG,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC;CAC9C,CAsGA"}
|
|
@@ -20,11 +20,7 @@ export * from './version.js';
|
|
|
20
20
|
export * from './validators/index.js';
|
|
21
21
|
import { MigrationRegistry } from './migrations/index.js';
|
|
22
22
|
import { SCHEMA_VERSIONS, MIN_SUPPORTED_VERSIONS } from './version.js';
|
|
23
|
-
import { getRuntimeStateMigrationSteps } from './migrations/
|
|
24
|
-
import { getEventEnvelopeMigrationSteps } from './migrations/event-envelope.js';
|
|
25
|
-
import { getSessionMigrationSteps } from './migrations/session.js';
|
|
26
|
-
import { getPluginManifestMigrationSteps } from './migrations/plugin-manifest.js';
|
|
27
|
-
import { getTaskRecordMigrationSteps } from './migrations/task-record.js';
|
|
23
|
+
import { getRuntimeStateMigrationSteps, getEventEnvelopeMigrationSteps, getSessionMigrationSteps, getPluginManifestMigrationSteps, getTaskRecordMigrationSteps, } from './migrations/schemas.js';
|
|
28
24
|
import { validateRuntimeState } from './validators/runtime-state.js';
|
|
29
25
|
import { validateEventEnvelope } from './validators/event-envelope.js';
|
|
30
26
|
import { validateSession } from './validators/session.js';
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compatibility Contracts — Consolidated Migration Schemas
|
|
3
|
+
*
|
|
4
|
+
* All domain migration steps in one place. Each schema section:
|
|
5
|
+
* - Declares a private `_STEPS` array (MigrationStep[])
|
|
6
|
+
* - Exports a `_VERSION` constant (re-exported from SCHEMA_VERSIONS)
|
|
7
|
+
* - Exports a `get…MigrationSteps()` function for the contract registry
|
|
8
|
+
*
|
|
9
|
+
* Previously split across 5 stub files; consolidated here for DRY.
|
|
10
|
+
* Split back out if any individual contract accumulates > 10 migration steps.
|
|
11
|
+
*
|
|
12
|
+
* All migration functions must be pure — no mutations, no side effects.
|
|
13
|
+
*
|
|
14
|
+
* @module contracts/migrations/schemas
|
|
15
|
+
*/
|
|
16
|
+
import type { MigrationStep } from '../types.js';
|
|
17
|
+
/** The current EventEnvelope schema version (re-exported for convenience). */
|
|
18
|
+
export declare const EVENT_ENVELOPE_VERSION: {
|
|
19
|
+
readonly major: 1;
|
|
20
|
+
readonly minor: 1;
|
|
21
|
+
readonly patch: 0;
|
|
22
|
+
};
|
|
23
|
+
/** Returns all EventEnvelope migration steps. Used by the contract registry. */
|
|
24
|
+
export declare function getEventEnvelopeMigrationSteps(): MigrationStep[];
|
|
25
|
+
/** The current PluginManifest schema version (re-exported for convenience). */
|
|
26
|
+
export declare const PLUGIN_MANIFEST_VERSION: {
|
|
27
|
+
readonly major: 1;
|
|
28
|
+
readonly minor: 0;
|
|
29
|
+
readonly patch: 0;
|
|
30
|
+
};
|
|
31
|
+
/** Returns all PluginManifest migration steps. Used by the contract registry. */
|
|
32
|
+
export declare function getPluginManifestMigrationSteps(): MigrationStep[];
|
|
33
|
+
/** The current RuntimeState schema version (re-exported for convenience). */
|
|
34
|
+
export declare const RUNTIME_STATE_VERSION: {
|
|
35
|
+
readonly major: 1;
|
|
36
|
+
readonly minor: 0;
|
|
37
|
+
readonly patch: 0;
|
|
38
|
+
};
|
|
39
|
+
/** Returns all RuntimeState migration steps. Used by the contract registry. */
|
|
40
|
+
export declare function getRuntimeStateMigrationSteps(): MigrationStep[];
|
|
41
|
+
/** The current Session schema version (re-exported for convenience). */
|
|
42
|
+
export declare const SESSION_VERSION: {
|
|
43
|
+
readonly major: 1;
|
|
44
|
+
readonly minor: 0;
|
|
45
|
+
readonly patch: 0;
|
|
46
|
+
};
|
|
47
|
+
/** Returns all Session migration steps. Used by the contract registry. */
|
|
48
|
+
export declare function getSessionMigrationSteps(): MigrationStep[];
|
|
49
|
+
/** The current TaskRecord schema version (re-exported for convenience). */
|
|
50
|
+
export declare const TASK_RECORD_VERSION: {
|
|
51
|
+
readonly major: 1;
|
|
52
|
+
readonly minor: 0;
|
|
53
|
+
readonly patch: 0;
|
|
54
|
+
};
|
|
55
|
+
/** Returns all TaskRecord migration steps. Used by the contract registry. */
|
|
56
|
+
export declare function getTaskRecordMigrationSteps(): MigrationStep[];
|
|
57
|
+
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../../../src/_internal/platform/runtime/contracts/migrations/schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AA2BjD,8EAA8E;AAC9E,eAAO,MAAM,sBAAsB;;;;CAAgC,CAAC;AAEpE,gFAAgF;AAChF,wBAAgB,8BAA8B,IAAI,aAAa,EAAE,CAEhE;AA0BD,+EAA+E;AAC/E,eAAO,MAAM,uBAAuB;;;;CAAiC,CAAC;AAEtE,iFAAiF;AACjF,wBAAgB,+BAA+B,IAAI,aAAa,EAAE,CAEjE;AA0BD,6EAA6E;AAC7E,eAAO,MAAM,qBAAqB;;;;CAA+B,CAAC;AAElE,+EAA+E;AAC/E,wBAAgB,6BAA6B,IAAI,aAAa,EAAE,CAE/D;AA2BD,wEAAwE;AACxE,eAAO,MAAM,eAAe;;;;CAA0B,CAAC;AAEvD,0EAA0E;AAC1E,wBAAgB,wBAAwB,IAAI,aAAa,EAAE,CAE1D;AA0BD,2EAA2E;AAC3E,eAAO,MAAM,mBAAmB;;;;CAA6B,CAAC;AAE9D,6EAA6E;AAC7E,wBAAgB,2BAA2B,IAAI,aAAa,EAAE,CAE7D"}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compatibility Contracts — Consolidated Migration Schemas
|
|
3
|
+
*
|
|
4
|
+
* All domain migration steps in one place. Each schema section:
|
|
5
|
+
* - Declares a private `_STEPS` array (MigrationStep[])
|
|
6
|
+
* - Exports a `_VERSION` constant (re-exported from SCHEMA_VERSIONS)
|
|
7
|
+
* - Exports a `get…MigrationSteps()` function for the contract registry
|
|
8
|
+
*
|
|
9
|
+
* Previously split across 5 stub files; consolidated here for DRY.
|
|
10
|
+
* Split back out if any individual contract accumulates > 10 migration steps.
|
|
11
|
+
*
|
|
12
|
+
* All migration functions must be pure — no mutations, no side effects.
|
|
13
|
+
*
|
|
14
|
+
* @module contracts/migrations/schemas
|
|
15
|
+
*/
|
|
16
|
+
import { SCHEMA_VERSIONS } from '../version.js';
|
|
17
|
+
// ─── EventEnvelope ────────────────────────────────────────────────────────────
|
|
18
|
+
/**
|
|
19
|
+
* All registered EventEnvelope migration steps.
|
|
20
|
+
*
|
|
21
|
+
* Currently empty — the schema is at its initial version (1.0.0).
|
|
22
|
+
* Future steps must be appended here and registered via the contract registry.
|
|
23
|
+
*
|
|
24
|
+
* Example: if `agentId` becomes required in v1.1.0, a migration step would
|
|
25
|
+
* backfill it with a sentinel value for older persisted envelopes.
|
|
26
|
+
*/
|
|
27
|
+
const EVENT_ENVELOPE_STEPS = [
|
|
28
|
+
// Example structure for future use:
|
|
29
|
+
// {
|
|
30
|
+
// from: { major: 1, minor: 0, patch: 0 },
|
|
31
|
+
// to: { major: 1, minor: 1, patch: 0 },
|
|
32
|
+
// description: 'Backfill missing agentId with null sentinel',
|
|
33
|
+
// migrate: (data: unknown): unknown => {
|
|
34
|
+
// const d = data as Record<string, unknown>;
|
|
35
|
+
// return { ...d, agentId: d['agentId'] ?? null };
|
|
36
|
+
// },
|
|
37
|
+
// },
|
|
38
|
+
];
|
|
39
|
+
/** The current EventEnvelope schema version (re-exported for convenience). */
|
|
40
|
+
export const EVENT_ENVELOPE_VERSION = SCHEMA_VERSIONS.eventEnvelope;
|
|
41
|
+
/** Returns all EventEnvelope migration steps. Used by the contract registry. */
|
|
42
|
+
export function getEventEnvelopeMigrationSteps() {
|
|
43
|
+
return EVENT_ENVELOPE_STEPS;
|
|
44
|
+
}
|
|
45
|
+
// ─── PluginManifest ───────────────────────────────────────────────────────────
|
|
46
|
+
/**
|
|
47
|
+
* All registered PluginManifest migration steps.
|
|
48
|
+
*
|
|
49
|
+
* Currently empty — the schema is at its initial version (1.0.0).
|
|
50
|
+
* Future steps must be appended here and registered via the contract registry.
|
|
51
|
+
*
|
|
52
|
+
* Example: if `capabilities` becomes an explicit array in v1.1.0, a migration
|
|
53
|
+
* step would synthesize it from `registerCommand`/`registerTool` declarations.
|
|
54
|
+
*/
|
|
55
|
+
const PLUGIN_MANIFEST_STEPS = [
|
|
56
|
+
// Example structure for future use:
|
|
57
|
+
// {
|
|
58
|
+
// from: { major: 1, minor: 0, patch: 0 },
|
|
59
|
+
// to: { major: 1, minor: 1, patch: 0 },
|
|
60
|
+
// description: 'Add capabilities array to plugin manifest',
|
|
61
|
+
// migrate: (data: unknown): unknown => {
|
|
62
|
+
// const d = data as Record<string, unknown>;
|
|
63
|
+
// return { ...d, capabilities: d['capabilities'] ?? [] };
|
|
64
|
+
// },
|
|
65
|
+
// },
|
|
66
|
+
];
|
|
67
|
+
/** The current PluginManifest schema version (re-exported for convenience). */
|
|
68
|
+
export const PLUGIN_MANIFEST_VERSION = SCHEMA_VERSIONS.pluginManifest;
|
|
69
|
+
/** Returns all PluginManifest migration steps. Used by the contract registry. */
|
|
70
|
+
export function getPluginManifestMigrationSteps() {
|
|
71
|
+
return PLUGIN_MANIFEST_STEPS;
|
|
72
|
+
}
|
|
73
|
+
// ─── RuntimeState ─────────────────────────────────────────────────────────────
|
|
74
|
+
/**
|
|
75
|
+
* All registered RuntimeState migration steps.
|
|
76
|
+
*
|
|
77
|
+
* Currently empty — the schema is at its initial version (1.0.0).
|
|
78
|
+
* Future steps must be appended here and registered via the contract registry.
|
|
79
|
+
*
|
|
80
|
+
* Example: if `uiSettings` is added in v1.1.0, a step would backfill it with
|
|
81
|
+
* default values for existing persisted snapshots.
|
|
82
|
+
*/
|
|
83
|
+
const RUNTIME_STATE_STEPS = [
|
|
84
|
+
// Example structure for future use:
|
|
85
|
+
// {
|
|
86
|
+
// from: { major: 1, minor: 0, patch: 0 },
|
|
87
|
+
// to: { major: 1, minor: 1, patch: 0 },
|
|
88
|
+
// description: 'Add optional uiSettings field with defaults',
|
|
89
|
+
// migrate: (data: unknown): unknown => {
|
|
90
|
+
// const d = data as Record<string, unknown>;
|
|
91
|
+
// return { ...d, uiSettings: d['uiSettings'] ?? { theme: 'dark' } };
|
|
92
|
+
// },
|
|
93
|
+
// },
|
|
94
|
+
];
|
|
95
|
+
/** The current RuntimeState schema version (re-exported for convenience). */
|
|
96
|
+
export const RUNTIME_STATE_VERSION = SCHEMA_VERSIONS.runtimeState;
|
|
97
|
+
/** Returns all RuntimeState migration steps. Used by the contract registry. */
|
|
98
|
+
export function getRuntimeStateMigrationSteps() {
|
|
99
|
+
return RUNTIME_STATE_STEPS;
|
|
100
|
+
}
|
|
101
|
+
// ─── Session ──────────────────────────────────────────────────────────────────
|
|
102
|
+
/**
|
|
103
|
+
* All registered Session migration steps.
|
|
104
|
+
*
|
|
105
|
+
* Currently empty — the schema is at its initial version (1.0.0).
|
|
106
|
+
* Future steps must be appended here and registered via the contract registry.
|
|
107
|
+
*
|
|
108
|
+
* Example: if session files gain a `tags` array in v1.1.0, a migration step
|
|
109
|
+
* would backfill it as an empty array for existing sessions.
|
|
110
|
+
*/
|
|
111
|
+
const SESSION_STEPS = [
|
|
112
|
+
// Example structure for future use:
|
|
113
|
+
// {
|
|
114
|
+
// from: { major: 1, minor: 0, patch: 0 },
|
|
115
|
+
// to: { major: 1, minor: 1, patch: 0 },
|
|
116
|
+
// description: 'Add empty tags array to session meta',
|
|
117
|
+
// migrate: (data: unknown): unknown => {
|
|
118
|
+
// const d = data as Record<string, unknown>;
|
|
119
|
+
// const meta = d['meta'] as Record<string, unknown>;
|
|
120
|
+
// return { ...d, meta: { ...meta, tags: meta['tags'] ?? [] } };
|
|
121
|
+
// },
|
|
122
|
+
// },
|
|
123
|
+
];
|
|
124
|
+
/** The current Session schema version (re-exported for convenience). */
|
|
125
|
+
export const SESSION_VERSION = SCHEMA_VERSIONS.session;
|
|
126
|
+
/** Returns all Session migration steps. Used by the contract registry. */
|
|
127
|
+
export function getSessionMigrationSteps() {
|
|
128
|
+
return SESSION_STEPS;
|
|
129
|
+
}
|
|
130
|
+
// ─── TaskRecord ───────────────────────────────────────────────────────────────
|
|
131
|
+
/**
|
|
132
|
+
* All registered TaskRecord migration steps.
|
|
133
|
+
*
|
|
134
|
+
* Currently empty — the schema is at its initial version (1.0.0).
|
|
135
|
+
* Future steps must be appended here and registered via the contract registry.
|
|
136
|
+
*
|
|
137
|
+
* Example: if `metadata` map is added to RuntimeTask in v1.1.0, a migration
|
|
138
|
+
* step would backfill it as an empty object for existing persisted records.
|
|
139
|
+
*/
|
|
140
|
+
const TASK_RECORD_STEPS = [
|
|
141
|
+
// Example structure for future use:
|
|
142
|
+
// {
|
|
143
|
+
// from: { major: 1, minor: 0, patch: 0 },
|
|
144
|
+
// to: { major: 1, minor: 1, patch: 0 },
|
|
145
|
+
// description: 'Add metadata object to task records',
|
|
146
|
+
// migrate: (data: unknown): unknown => {
|
|
147
|
+
// const d = data as Record<string, unknown>;
|
|
148
|
+
// return { ...d, metadata: d['metadata'] ?? {} };
|
|
149
|
+
// },
|
|
150
|
+
// },
|
|
151
|
+
];
|
|
152
|
+
/** The current TaskRecord schema version (re-exported for convenience). */
|
|
153
|
+
export const TASK_RECORD_VERSION = SCHEMA_VERSIONS.taskRecord;
|
|
154
|
+
/** Returns all TaskRecord migration steps. Used by the contract registry. */
|
|
155
|
+
export function getTaskRecordMigrationSteps() {
|
|
156
|
+
return TASK_RECORD_STEPS;
|
|
157
|
+
}
|