@pellux/goodvibes-sdk 0.21.30 → 0.21.34
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
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OBS-15: AsyncLocalStorage-based correlation context for request/session/turn/run scoping.
|
|
3
|
+
*
|
|
4
|
+
* Seed at HTTP entry points and session/turn creation so downstream events can
|
|
5
|
+
* automatically attach the correct IDs without explicit threading.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* ```ts
|
|
9
|
+
* // Seed at HTTP request entry:
|
|
10
|
+
* correlationCtx.run({ requestId: crypto.randomUUID() }, () => handler(req));
|
|
11
|
+
*
|
|
12
|
+
* // Read anywhere downstream:
|
|
13
|
+
* const { requestId, sessionId } = getCorrelationContext();
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
17
|
+
/** Correlation identifiers propagated via AsyncLocalStorage. */
|
|
18
|
+
export interface CorrelationContext {
|
|
19
|
+
/** HTTP request ID — seeded by the HTTP listener on every inbound request. */
|
|
20
|
+
readonly requestId?: string;
|
|
21
|
+
/** Session ID — seeded when a session starts or resumes. */
|
|
22
|
+
readonly sessionId?: string;
|
|
23
|
+
/** Run ID — seeded when a run (multi-turn conversation) begins. */
|
|
24
|
+
readonly runId?: string;
|
|
25
|
+
/** Turn ID — seeded when a turn starts within a run. */
|
|
26
|
+
readonly turnId?: string;
|
|
27
|
+
}
|
|
28
|
+
/** The singleton AsyncLocalStorage instance for correlation context. */
|
|
29
|
+
export declare const correlationCtx: AsyncLocalStorage<CorrelationContext>;
|
|
30
|
+
/**
|
|
31
|
+
* Get the current correlation context, or an empty object if none is active.
|
|
32
|
+
* Safe to call from anywhere — returns {} when no context is running.
|
|
33
|
+
*/
|
|
34
|
+
export declare function getCorrelationContext(): Readonly<CorrelationContext>;
|
|
35
|
+
/**
|
|
36
|
+
* Run a function within a new correlation context that inherits the current
|
|
37
|
+
* context and overrides the provided fields.
|
|
38
|
+
*/
|
|
39
|
+
export declare function withCorrelation<T>(overrides: Partial<CorrelationContext>, fn: () => T): T;
|
|
40
|
+
/**
|
|
41
|
+
* Run an async function within a new correlation context.
|
|
42
|
+
*/
|
|
43
|
+
export declare function withCorrelationAsync<T>(overrides: Partial<CorrelationContext>, fn: () => Promise<T>): Promise<T>;
|
|
44
|
+
//# sourceMappingURL=correlation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"correlation.d.ts","sourceRoot":"","sources":["../../../../src/_internal/platform/runtime/correlation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD,gEAAgE;AAChE,MAAM,WAAW,kBAAkB;IACjC,8EAA8E;IAC9E,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,4DAA4D;IAC5D,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,mEAAmE;IACnE,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,wDAAwD;IACxD,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,wEAAwE;AACxE,eAAO,MAAM,cAAc,uCAA8C,CAAC;AAE1E;;;GAGG;AACH,wBAAgB,qBAAqB,IAAI,QAAQ,CAAC,kBAAkB,CAAC,CAEpE;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAC/B,SAAS,EAAE,OAAO,CAAC,kBAAkB,CAAC,EACtC,EAAE,EAAE,MAAM,CAAC,GACV,CAAC,CAGH;AAED;;GAEG;AACH,wBAAsB,oBAAoB,CAAC,CAAC,EAC1C,SAAS,EAAE,OAAO,CAAC,kBAAkB,CAAC,EACtC,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GACnB,OAAO,CAAC,CAAC,CAAC,CAGZ"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OBS-15: AsyncLocalStorage-based correlation context for request/session/turn/run scoping.
|
|
3
|
+
*
|
|
4
|
+
* Seed at HTTP entry points and session/turn creation so downstream events can
|
|
5
|
+
* automatically attach the correct IDs without explicit threading.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* ```ts
|
|
9
|
+
* // Seed at HTTP request entry:
|
|
10
|
+
* correlationCtx.run({ requestId: crypto.randomUUID() }, () => handler(req));
|
|
11
|
+
*
|
|
12
|
+
* // Read anywhere downstream:
|
|
13
|
+
* const { requestId, sessionId } = getCorrelationContext();
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
17
|
+
/** The singleton AsyncLocalStorage instance for correlation context. */
|
|
18
|
+
export const correlationCtx = new AsyncLocalStorage();
|
|
19
|
+
/**
|
|
20
|
+
* Get the current correlation context, or an empty object if none is active.
|
|
21
|
+
* Safe to call from anywhere — returns {} when no context is running.
|
|
22
|
+
*/
|
|
23
|
+
export function getCorrelationContext() {
|
|
24
|
+
return correlationCtx.getStore() ?? {};
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Run a function within a new correlation context that inherits the current
|
|
28
|
+
* context and overrides the provided fields.
|
|
29
|
+
*/
|
|
30
|
+
export function withCorrelation(overrides, fn) {
|
|
31
|
+
const current = correlationCtx.getStore() ?? {};
|
|
32
|
+
return correlationCtx.run({ ...current, ...overrides }, fn);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Run an async function within a new correlation context.
|
|
36
|
+
*/
|
|
37
|
+
export async function withCorrelationAsync(overrides, fn) {
|
|
38
|
+
const current = correlationCtx.getStore() ?? {};
|
|
39
|
+
return correlationCtx.run({ ...current, ...overrides }, fn);
|
|
40
|
+
}
|
|
@@ -28,4 +28,36 @@ export declare function emitTokenBlocked(bus: RuntimeEventBus, ctx: EmitterConte
|
|
|
28
28
|
label: string;
|
|
29
29
|
reason: 'scope_violation' | 'rotation_overdue' | 'scope_violation_and_rotation_overdue';
|
|
30
30
|
}): void;
|
|
31
|
+
/** Emit AUTH_SUCCEEDED when a user authenticates successfully. Never include credential values. */
|
|
32
|
+
export declare function emitAuthSucceeded(bus: RuntimeEventBus, ctx: EmitterContext, data: {
|
|
33
|
+
username: string;
|
|
34
|
+
sessionId: string;
|
|
35
|
+
clientIp: string;
|
|
36
|
+
method: 'password' | 'cookie' | 'token';
|
|
37
|
+
}): void;
|
|
38
|
+
/** Emit AUTH_FAILED when an authentication attempt fails. Never include credential values. */
|
|
39
|
+
export declare function emitAuthFailed(bus: RuntimeEventBus, ctx: EmitterContext, data: {
|
|
40
|
+
usernameAttempted: string;
|
|
41
|
+
clientIp: string;
|
|
42
|
+
reason: 'invalid_credentials' | 'rate_limited' | 'session_expired' | 'origin_denied' | 'unknown';
|
|
43
|
+
}): void;
|
|
44
|
+
/** Emit COMPANION_PAIR_REQUESTED when a pairing request is initiated. */
|
|
45
|
+
export declare function emitCompanionPairRequested(bus: RuntimeEventBus, ctx: EmitterContext, data: {
|
|
46
|
+
clientIp: string;
|
|
47
|
+
}): void;
|
|
48
|
+
/** Emit COMPANION_PAIR_VERIFIED when a companion pairing is verified. */
|
|
49
|
+
export declare function emitCompanionPairVerified(bus: RuntimeEventBus, ctx: EmitterContext, data: {
|
|
50
|
+
tokenId: string;
|
|
51
|
+
clientIp: string;
|
|
52
|
+
}): void;
|
|
53
|
+
/** Emit COMPANION_TOKEN_ROTATED when a companion token is rotated. */
|
|
54
|
+
export declare function emitCompanionTokenRotated(bus: RuntimeEventBus, ctx: EmitterContext, data: {
|
|
55
|
+
newTokenId: string;
|
|
56
|
+
clientIp: string;
|
|
57
|
+
}): void;
|
|
58
|
+
/** Emit COMPANION_TOKEN_REVOKED when a companion token is revoked. */
|
|
59
|
+
export declare function emitCompanionTokenRevoked(bus: RuntimeEventBus, ctx: EmitterContext, data: {
|
|
60
|
+
clientIp: string;
|
|
61
|
+
reason?: string;
|
|
62
|
+
}): void;
|
|
31
63
|
//# sourceMappingURL=security.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"security.d.ts","sourceRoot":"","sources":["../../../../../src/_internal/platform/runtime/emitters/security.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAE1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAUjD,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,IAAI,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,EAAE,CAAA;CAAE,GACjF,IAAI,CAEN;AAED,wBAAgB,wBAAwB,CACtC,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,IAAI,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACzF,IAAI,CAEN;AAED,wBAAgB,wBAAwB,CACtC,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,IAAI,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACxF,IAAI,CAEN;AAED,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,IAAI,EAAE;IACJ,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,iBAAiB,GAAG,kBAAkB,GAAG,sCAAsC,CAAC;CACzF,GACA,IAAI,CAEN"}
|
|
1
|
+
{"version":3,"file":"security.d.ts","sourceRoot":"","sources":["../../../../../src/_internal/platform/runtime/emitters/security.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAo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,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,UAAU,GAAG,QAAQ,GAAG,OAAO,CAAA;CAAE,GACvG,IAAI,CAEN;AAED,8FAA8F;AAC9F,wBAAgB,cAAc,CAC5B,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,IAAI,EAAE;IACJ,iBAAiB,EAAE,MAAM,CAAC;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,qBAAqB,GAAG,cAAc,GAAG,iBAAiB,GAAG,eAAe,GAAG,SAAS,CAAC;CAClG,GACA,IAAI,CAEN;AAID,yEAAyE;AACzE,wBAAgB,0BAA0B,CACxC,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,IAAI,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,GACzB,IAAI,CAEN;AAED,yEAAyE;AACzE,wBAAgB,yBAAyB,CACvC,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,IAAI,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GAC1C,IAAI,CAEN;AAED,sEAAsE;AACtE,wBAAgB,yBAAyB,CACvC,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,IAAI,EAAE;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GAC7C,IAAI,CAEN;AAED,sEAAsE;AACtE,wBAAgB,yBAAyB,CACvC,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,IAAI,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GAC1C,IAAI,CAEN"}
|
|
@@ -17,3 +17,29 @@ export function emitTokenRotationExpired(bus, ctx, data) {
|
|
|
17
17
|
export function emitTokenBlocked(bus, ctx, data) {
|
|
18
18
|
bus.emit('security', securityEvent('TOKEN_BLOCKED', data, ctx));
|
|
19
19
|
}
|
|
20
|
+
// ── Auth audit emitters (OBS-02) ────────────────────────────────────────────
|
|
21
|
+
/** Emit AUTH_SUCCEEDED when a user authenticates successfully. Never include credential values. */
|
|
22
|
+
export function emitAuthSucceeded(bus, ctx, data) {
|
|
23
|
+
bus.emit('security', securityEvent('AUTH_SUCCEEDED', data, ctx));
|
|
24
|
+
}
|
|
25
|
+
/** Emit AUTH_FAILED when an authentication attempt fails. Never include credential values. */
|
|
26
|
+
export function emitAuthFailed(bus, ctx, data) {
|
|
27
|
+
bus.emit('security', securityEvent('AUTH_FAILED', data, ctx));
|
|
28
|
+
}
|
|
29
|
+
// ── Companion pairing emitters (OBS-21) ──────────────────────────────────
|
|
30
|
+
/** Emit COMPANION_PAIR_REQUESTED when a pairing request is initiated. */
|
|
31
|
+
export function emitCompanionPairRequested(bus, ctx, data) {
|
|
32
|
+
bus.emit('security', securityEvent('COMPANION_PAIR_REQUESTED', data, ctx));
|
|
33
|
+
}
|
|
34
|
+
/** Emit COMPANION_PAIR_VERIFIED when a companion pairing is verified. */
|
|
35
|
+
export function emitCompanionPairVerified(bus, ctx, data) {
|
|
36
|
+
bus.emit('security', securityEvent('COMPANION_PAIR_VERIFIED', data, ctx));
|
|
37
|
+
}
|
|
38
|
+
/** Emit COMPANION_TOKEN_ROTATED when a companion token is rotated. */
|
|
39
|
+
export function emitCompanionTokenRotated(bus, ctx, data) {
|
|
40
|
+
bus.emit('security', securityEvent('COMPANION_TOKEN_ROTATED', data, ctx));
|
|
41
|
+
}
|
|
42
|
+
/** Emit COMPANION_TOKEN_REVOKED when a companion token is revoked. */
|
|
43
|
+
export function emitCompanionTokenRevoked(bus, ctx, data) {
|
|
44
|
+
bus.emit('security', securityEvent('COMPANION_TOKEN_REVOKED', data, ctx));
|
|
45
|
+
}
|
|
@@ -45,13 +45,22 @@ export declare function emitToolPosthooked(bus: RuntimeEventBus, ctx: EmitterCon
|
|
|
45
45
|
turnId: string;
|
|
46
46
|
tool: string;
|
|
47
47
|
}): void;
|
|
48
|
+
/**
|
|
49
|
+
* Convert any tool result (ToolResult, SyntheticToolResult, etc.) to a ToolResultSummary
|
|
50
|
+
* for safe emission in the event stream. Never leaks raw output; provides kind, byteSize, preview.
|
|
51
|
+
*/
|
|
52
|
+
export declare function toToolResultSummary(result: {
|
|
53
|
+
success?: boolean;
|
|
54
|
+
output?: string;
|
|
55
|
+
error?: string;
|
|
56
|
+
}): import('../events/tools.js').ToolResultSummary;
|
|
48
57
|
/** Emit TOOL_SUCCEEDED when a tool call completes successfully. */
|
|
49
58
|
export declare function emitToolSucceeded(bus: RuntimeEventBus, ctx: EmitterContext, data: {
|
|
50
59
|
callId: string;
|
|
51
60
|
turnId: string;
|
|
52
61
|
tool: string;
|
|
53
62
|
durationMs: number;
|
|
54
|
-
result?:
|
|
63
|
+
result?: import('../events/tools.js').ToolResultSummary;
|
|
55
64
|
}): void;
|
|
56
65
|
/** Emit TOOL_FAILED when a tool call fails. */
|
|
57
66
|
export declare function emitToolFailed(bus: RuntimeEventBus, ctx: EmitterContext, data: {
|
|
@@ -60,7 +69,7 @@ export declare function emitToolFailed(bus: RuntimeEventBus, ctx: EmitterContext
|
|
|
60
69
|
tool: string;
|
|
61
70
|
error: string;
|
|
62
71
|
durationMs: number;
|
|
63
|
-
result?:
|
|
72
|
+
result?: import('../events/tools.js').ToolResultSummary;
|
|
64
73
|
}): void;
|
|
65
74
|
/** Emit TOOL_RECONCILED when unresolved tool calls are synthesized. */
|
|
66
75
|
export declare function emitToolReconciled(bus: RuntimeEventBus, ctx: EmitterContext, data: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../../../src/_internal/platform/runtime/emitters/tools.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC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|
@@ -30,6 +30,33 @@ export function emitToolMapped(bus, ctx, data) {
|
|
|
30
30
|
export function emitToolPosthooked(bus, ctx, data) {
|
|
31
31
|
bus.emit('tools', createEventEnvelope('TOOL_POSTHOOKED', { type: 'TOOL_POSTHOOKED', ...data }, ctx));
|
|
32
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Convert any tool result (ToolResult, SyntheticToolResult, etc.) to a ToolResultSummary
|
|
35
|
+
* for safe emission in the event stream. Never leaks raw output; provides kind, byteSize, preview.
|
|
36
|
+
*/
|
|
37
|
+
export function toToolResultSummary(result) {
|
|
38
|
+
if (!result.success) {
|
|
39
|
+
const errStr = result.error ?? 'unknown error';
|
|
40
|
+
return {
|
|
41
|
+
kind: 'error',
|
|
42
|
+
byteSize: errStr.length,
|
|
43
|
+
preview: errStr.slice(0, 100),
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
const output = result.output ?? '';
|
|
47
|
+
let kind;
|
|
48
|
+
let preview;
|
|
49
|
+
try {
|
|
50
|
+
JSON.parse(output);
|
|
51
|
+
kind = 'json';
|
|
52
|
+
preview = output.slice(0, 100);
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
kind = 'text';
|
|
56
|
+
preview = output.slice(0, 100);
|
|
57
|
+
}
|
|
58
|
+
return { kind, byteSize: output.length, preview };
|
|
59
|
+
}
|
|
33
60
|
/** Emit TOOL_SUCCEEDED when a tool call completes successfully. */
|
|
34
61
|
export function emitToolSucceeded(bus, ctx, data) {
|
|
35
62
|
bus.emit('tools', createEventEnvelope('TOOL_SUCCEEDED', { type: 'TOOL_SUCCEEDED', ...data }, ctx));
|
|
@@ -40,4 +40,31 @@ export declare function emitTransportTerminalFailure(bus: RuntimeEventBus, ctx:
|
|
|
40
40
|
transportId: string;
|
|
41
41
|
error: string;
|
|
42
42
|
}): void;
|
|
43
|
+
/** OBS-18: Emit TRANSPORT_RETRY_SCHEDULED when a retry is queued with backoff. */
|
|
44
|
+
export declare function emitTransportRetryScheduled(bus: RuntimeEventBus, ctx: EmitterContext, data: {
|
|
45
|
+
transportId: string;
|
|
46
|
+
attempt: number;
|
|
47
|
+
maxAttempts: number;
|
|
48
|
+
backoffMs: number;
|
|
49
|
+
reason: string;
|
|
50
|
+
}): void;
|
|
51
|
+
/** OBS-18: Emit TRANSPORT_RETRY_EXECUTED when a retry attempt is fired. */
|
|
52
|
+
export declare function emitTransportRetryExecuted(bus: RuntimeEventBus, ctx: EmitterContext, data: {
|
|
53
|
+
transportId: string;
|
|
54
|
+
attempt: number;
|
|
55
|
+
maxAttempts: number;
|
|
56
|
+
}): void;
|
|
57
|
+
/** OBS-19: Emit STREAM_SUBSCRIBER_CONNECTED when an SSE subscriber connects. */
|
|
58
|
+
export declare function emitStreamSubscriberConnected(bus: RuntimeEventBus, ctx: EmitterContext, data: {
|
|
59
|
+
streamId: string;
|
|
60
|
+
subscriberId: string;
|
|
61
|
+
streamType: string;
|
|
62
|
+
}): void;
|
|
63
|
+
/** OBS-19: Emit STREAM_SUBSCRIBER_DISCONNECTED when an SSE subscriber disconnects. */
|
|
64
|
+
export declare function emitStreamSubscriberDisconnected(bus: RuntimeEventBus, ctx: EmitterContext, data: {
|
|
65
|
+
streamId: string;
|
|
66
|
+
subscriberId: string;
|
|
67
|
+
streamType: string;
|
|
68
|
+
reason?: string;
|
|
69
|
+
}): void;
|
|
43
70
|
//# sourceMappingURL=transport.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../../../../src/_internal/platform/runtime/emitters/transport.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../../../../src/_internal/platform/runtime/emitters/transport.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE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,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GACpF,IAAI,CAEN"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Transport emitters — typed emission wrappers for TransportEvent domain.
|
|
3
3
|
*/
|
|
4
4
|
import { createEventEnvelope } from '../events/envelope.js';
|
|
5
|
+
import { transportRetriesTotal } from '../metrics.js';
|
|
5
6
|
/** Emit TRANSPORT_INITIALIZING when the transport layer starts. */
|
|
6
7
|
export function emitTransportInitializing(bus, ctx, data) {
|
|
7
8
|
bus.emit('transport', createEventEnvelope('TRANSPORT_INITIALIZING', { type: 'TRANSPORT_INITIALIZING', ...data }, ctx));
|
|
@@ -34,3 +35,21 @@ export function emitTransportDisconnected(bus, ctx, data) {
|
|
|
34
35
|
export function emitTransportTerminalFailure(bus, ctx, data) {
|
|
35
36
|
bus.emit('transport', createEventEnvelope('TRANSPORT_TERMINAL_FAILURE', { type: 'TRANSPORT_TERMINAL_FAILURE', ...data }, ctx));
|
|
36
37
|
}
|
|
38
|
+
/** OBS-18: Emit TRANSPORT_RETRY_SCHEDULED when a retry is queued with backoff. */
|
|
39
|
+
export function emitTransportRetryScheduled(bus, ctx, data) {
|
|
40
|
+
transportRetriesTotal.add(1, { transport_type: data.transportId, reason: data.reason });
|
|
41
|
+
bus.emit('transport', createEventEnvelope('TRANSPORT_RETRY_SCHEDULED', { type: 'TRANSPORT_RETRY_SCHEDULED', ...data }, ctx));
|
|
42
|
+
}
|
|
43
|
+
/** OBS-18: Emit TRANSPORT_RETRY_EXECUTED when a retry attempt is fired. */
|
|
44
|
+
export function emitTransportRetryExecuted(bus, ctx, data) {
|
|
45
|
+
transportRetriesTotal.add(1, { transport_type: data.transportId });
|
|
46
|
+
bus.emit('transport', createEventEnvelope('TRANSPORT_RETRY_EXECUTED', { type: 'TRANSPORT_RETRY_EXECUTED', ...data }, ctx));
|
|
47
|
+
}
|
|
48
|
+
/** OBS-19: Emit STREAM_SUBSCRIBER_CONNECTED when an SSE subscriber connects. */
|
|
49
|
+
export function emitStreamSubscriberConnected(bus, ctx, data) {
|
|
50
|
+
bus.emit('transport', createEventEnvelope('STREAM_SUBSCRIBER_CONNECTED', { type: 'STREAM_SUBSCRIBER_CONNECTED', ...data }, ctx));
|
|
51
|
+
}
|
|
52
|
+
/** OBS-19: Emit STREAM_SUBSCRIBER_DISCONNECTED when an SSE subscriber disconnects. */
|
|
53
|
+
export function emitStreamSubscriberDisconnected(bus, ctx, data) {
|
|
54
|
+
bus.emit('transport', createEventEnvelope('STREAM_SUBSCRIBER_DISCONNECTED', { type: 'STREAM_SUBSCRIBER_DISCONNECTED', ...data }, ctx));
|
|
55
|
+
}
|
|
@@ -32,17 +32,38 @@ export declare function emitStreamDelta(bus: RuntimeEventBus, ctx: EmitterContex
|
|
|
32
32
|
export declare function emitStreamEnd(bus: RuntimeEventBus, ctx: EmitterContext, data: {
|
|
33
33
|
turnId: string;
|
|
34
34
|
}): void;
|
|
35
|
+
/** OBS-04: Emit LLM_REQUEST_STARTED when a provider chat request is about to be dispatched. */
|
|
36
|
+
export declare function emitLlmRequestStarted(bus: RuntimeEventBus, ctx: EmitterContext, data: {
|
|
37
|
+
turnId: string;
|
|
38
|
+
provider: string;
|
|
39
|
+
model: string;
|
|
40
|
+
promptSummary: {
|
|
41
|
+
length: number;
|
|
42
|
+
sha256: string;
|
|
43
|
+
first100chars: string;
|
|
44
|
+
} | string;
|
|
45
|
+
}): void;
|
|
35
46
|
/** Emit LLM_RESPONSE_RECEIVED when a provider chat call completes within a turn iteration. */
|
|
36
47
|
export declare function emitLlmResponseReceived(bus: RuntimeEventBus, ctx: EmitterContext, data: {
|
|
37
48
|
turnId: string;
|
|
38
49
|
provider: string;
|
|
39
50
|
model: string;
|
|
40
|
-
|
|
51
|
+
contentSummary: {
|
|
52
|
+
length: number;
|
|
53
|
+
sha256: string;
|
|
54
|
+
first100chars: string;
|
|
55
|
+
} | string;
|
|
41
56
|
toolCallCount: number;
|
|
42
57
|
inputTokens: number;
|
|
43
58
|
outputTokens: number;
|
|
44
59
|
cacheReadTokens?: number;
|
|
45
60
|
cacheWriteTokens?: number;
|
|
61
|
+
/** OBS-04 enrichments */
|
|
62
|
+
durationMs?: number;
|
|
63
|
+
retries?: number;
|
|
64
|
+
costUsdCents?: number;
|
|
65
|
+
finishReason?: string;
|
|
66
|
+
providerRequestId?: string;
|
|
46
67
|
}): void;
|
|
47
68
|
/** Emit TOOL_BATCH_READY when a set of tool calls is ready for execution. */
|
|
48
69
|
export declare function emitToolBatchReady(bus: RuntimeEventBus, ctx: EmitterContext, data: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"turn.d.ts","sourceRoot":"","sources":["../../../../../src/_internal/platform/runtime/emitters/turn.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"turn.d.ts","sourceRoot":"","sources":["../../../../../src/_internal/platform/runtime/emitters/turn.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAEpE,2DAA2D;AAC3D,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,IAAI,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GACvC,IAAI,CAEN;AAED,oDAAoD;AACpD,wBAAgB,eAAe,CAC7B,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,IAAI,EAAE;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,GACvB,IAAI,CAEN;AAED,sDAAsD;AACtD,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,IAA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AAM,CAAC;IACjB,UAAU,EAAE,WAAW,GAAG,gBAAgB,CAAC;CAC5C,GACA,IAAI,CAEN;AAED,2CAA2C;AAC3C,wBAAgB,aAAa,CAC3B,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,IAAI,EAAE;IACJ,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EACN,kBAAkB,GAClB,kBAAkB,GAClB,oBAAoB,GACpB,gBAAgB,GAChB,aAAa,GACb,2BAA2B,GAC3B,kBAAkB,CAAC;CACxB,GACA,IAAI,CAEN;AAED,mDAAmD;AACnD,wBAAgB,cAAc,CAC5B,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,IAAI,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,WAAW,CAAA;CAAE,GACjE,IAAI,CAEN"}
|
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
* Turn emitters — typed emission wrappers for TurnEvent domain.
|
|
3
3
|
*
|
|
4
4
|
* Import and call these instead of emitting raw strings.
|
|
5
|
+
*
|
|
6
|
+
* Note: raw prompt/response content is carried on the event bus as-is so
|
|
7
|
+
* internal consumers (conversation reducer, reply pipeline, stream UI) can
|
|
8
|
+
* render and advance state. OBS-06 redaction happens at the telemetry
|
|
9
|
+
* boundary (TelemetryApiService) where events become externally observable.
|
|
5
10
|
*/
|
|
6
11
|
import { createEventEnvelope } from '../events/envelope.js';
|
|
7
12
|
/** Emit TURN_SUBMITTED when a user prompt is submitted. */
|
|
@@ -28,6 +33,10 @@ export function emitStreamDelta(bus, ctx, data) {
|
|
|
28
33
|
export function emitStreamEnd(bus, ctx, data) {
|
|
29
34
|
bus.emit('turn', createEventEnvelope('STREAM_END', { type: 'STREAM_END', ...data }, ctx));
|
|
30
35
|
}
|
|
36
|
+
/** OBS-04: Emit LLM_REQUEST_STARTED when a provider chat request is about to be dispatched. */
|
|
37
|
+
export function emitLlmRequestStarted(bus, ctx, data) {
|
|
38
|
+
bus.emit('turn', createEventEnvelope('LLM_REQUEST_STARTED', { type: 'LLM_REQUEST_STARTED', ...data }, ctx));
|
|
39
|
+
}
|
|
31
40
|
/** Emit LLM_RESPONSE_RECEIVED when a provider chat call completes within a turn iteration. */
|
|
32
41
|
export function emitLlmResponseReceived(bus, ctx, data) {
|
|
33
42
|
bus.emit('turn', createEventEnvelope('LLM_RESPONSE_RECEIVED', { type: 'LLM_RESPONSE_RECEIVED', ...data }, ctx));
|
|
@@ -36,6 +36,26 @@ export { SURFACE_KINDS } from './surfaces.js';
|
|
|
36
36
|
export type { KnowledgeEvent, KnowledgeEventType } from './knowledge.js';
|
|
37
37
|
/** Listener callback receiving a fully-formed envelope. */
|
|
38
38
|
export type EnvelopeListener<T extends AnyRuntimeEvent = AnyRuntimeEvent> = (envelope: RuntimeEventEnvelope<T['type'], T>) => void;
|
|
39
|
+
/**
|
|
40
|
+
* Maximum listeners per channel before a potential memory leak warning is emitted.
|
|
41
|
+
*
|
|
42
|
+
* 100 is a generous threshold for a single event type or domain; normal usage
|
|
43
|
+
* rarely exceeds single-digit listeners. Exceeding this strongly suggests a
|
|
44
|
+
* subscriber is being registered without a corresponding unsubscribe.
|
|
45
|
+
*/
|
|
46
|
+
export declare const MAX_LISTENERS = 100;
|
|
47
|
+
/**
|
|
48
|
+
* Options accepted by the RuntimeEventBus constructor.
|
|
49
|
+
*/
|
|
50
|
+
export interface RuntimeEventBusOptions {
|
|
51
|
+
/**
|
|
52
|
+
* Override the maximum number of listeners per channel.
|
|
53
|
+
* Defaults to MAX_LISTENERS (100).
|
|
54
|
+
* Values above zero are accepted; the cap is applied per event-type channel
|
|
55
|
+
* and per domain channel independently.
|
|
56
|
+
*/
|
|
57
|
+
maxListeners?: number;
|
|
58
|
+
}
|
|
39
59
|
/**
|
|
40
60
|
* RuntimeEventBus — typed event bus for domain-structured runtime events.
|
|
41
61
|
*
|
|
@@ -53,6 +73,13 @@ export declare class RuntimeEventBus {
|
|
|
53
73
|
private readonly _listeners;
|
|
54
74
|
/** Per-domain listener sets. Keyed by RuntimeEventDomain. */
|
|
55
75
|
private readonly _domainListeners;
|
|
76
|
+
/** Effective listener cap for this instance. */
|
|
77
|
+
private readonly _maxListeners;
|
|
78
|
+
/** Track per-listener error counts for misbehaving-listener dedup. */
|
|
79
|
+
private readonly _listenerErrorCounts;
|
|
80
|
+
/** Number of errors a listener must throw before OPS_LISTENER_MISBEHAVING is emitted. */
|
|
81
|
+
private static readonly _MISBEHAVE_DEDUP_THRESHOLD;
|
|
82
|
+
constructor(opts?: RuntimeEventBusOptions);
|
|
56
83
|
/**
|
|
57
84
|
* Subscribe to a specific event type.
|
|
58
85
|
*
|
|
@@ -88,6 +115,24 @@ export declare class RuntimeEventBus {
|
|
|
88
115
|
* @param envelope - The fully-formed envelope to dispatch.
|
|
89
116
|
*/
|
|
90
117
|
emit<D extends RuntimeEventDomain>(domain: D, envelope: RuntimeEventEnvelope<DomainEventMap[D]['type'], DomainEventMap[D]>): void;
|
|
118
|
+
/**
|
|
119
|
+
* Record a listener error: increment metrics, update error count, emit
|
|
120
|
+
* OPS_LISTENER_MISBEHAVING once the dedup threshold is reached, and log.
|
|
121
|
+
*
|
|
122
|
+
* @param listener - The misbehaving listener function.
|
|
123
|
+
* @param eventType - The event type that triggered the listener.
|
|
124
|
+
* @param err - The thrown value caught from the listener.
|
|
125
|
+
* @param domain - Optional domain name, present when the listener was a domain subscriber.
|
|
126
|
+
*/
|
|
127
|
+
private _recordListenerError;
|
|
128
|
+
/**
|
|
129
|
+
* Directly dispatch an OPS_LISTENER_MISBEHAVING envelope to any registered
|
|
130
|
+
* OPS_LISTENER_MISBEHAVING and 'ops' domain listeners.
|
|
131
|
+
*
|
|
132
|
+
* Bypasses emit() to avoid potential recursion: a listener watching for
|
|
133
|
+
* misbehaving events itself misbehaving would otherwise cause infinite loops.
|
|
134
|
+
*/
|
|
135
|
+
private _emitListenerMisbehaving;
|
|
91
136
|
private _off;
|
|
92
137
|
private _offDomain;
|
|
93
138
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/_internal/platform/runtime/events/index.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/_internal/platform/runtime/events/index.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAE1D,OAAO,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAK3F,YAAY,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAC3E,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,YAAY,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACnE,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1D,YAAY,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACvE,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3D,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3D,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC9D,YAAY,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACvE,YAAY,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAChH,YAAY,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC5H,YAAY,EAAE,YA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