From 6b359301eb84c258085c309e16cee5792cdd4f25 Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Fri, 20 Nov 2026 16:14:36 -0800 Subject: [PATCH 1/4] chore(mothership): take the remaining contracts from the worker and drop the Go contract generators The Go copilot is being removed from the mothership repo. The eight contracts Sim generated from its JSON (stream, billing protocol, vfs snapshot, trace and metric names) are now worker-owned TypeScript copied in by the worker's contracts:sync, so the eight json2ts sync scripts and the mship:generate umbrella go. The base tool catalog moves to the worker's packages/contracts, and mship-tools:generate reads it there. --- .agents/skills/ship/SKILL.md | 2 +- .../generated/billing-protocol-v1.ts | 96 +- .../lib/mothership/generated/metrics-v1.ts | 131 +- .../generated/mothership-stream-v1.ts | 873 +++--- .../mothership/generated/tool-catalog-v1.ts | 2 +- .../mothership/generated/tool-schemas-v1.ts | 2 +- .../generated/trace-attribute-values-v1.ts | 682 ++-- .../generated/trace-attributes-v1.ts | 2736 ++++++++--------- .../mothership/generated/trace-events-v1.ts | 95 +- .../mothership/generated/trace-spans-v1.ts | 371 ++- .../mothership/generated/vfs-snapshot-v1.ts | 126 +- package.json | 18 - scripts/generate-mship-contracts.ts | 147 - scripts/run-audits.ts | 3 +- scripts/sync-billing-protocol-contract.ts | 306 -- scripts/sync-metrics-contract.ts | 142 - scripts/sync-mothership-stream-contract.ts | 75 - scripts/sync-tool-catalog.ts | 10 +- .../sync-trace-attribute-values-contract.ts | 149 - scripts/sync-trace-attributes-contract.ts | 156 - scripts/sync-trace-events-contract.ts | 125 - scripts/sync-trace-spans-contract.ts | 143 - scripts/sync-vfs-snapshot-contract.ts | 46 - 23 files changed, 2543 insertions(+), 3893 deletions(-) delete mode 100644 scripts/generate-mship-contracts.ts delete mode 100644 scripts/sync-billing-protocol-contract.ts delete mode 100644 scripts/sync-metrics-contract.ts delete mode 100644 scripts/sync-mothership-stream-contract.ts delete mode 100644 scripts/sync-trace-attribute-values-contract.ts delete mode 100644 scripts/sync-trace-attributes-contract.ts delete mode 100644 scripts/sync-trace-events-contract.ts delete mode 100644 scripts/sync-trace-spans-contract.ts delete mode 100644 scripts/sync-vfs-snapshot-contract.ts diff --git a/.agents/skills/ship/SKILL.md b/.agents/skills/ship/SKILL.md index 442067f291b..3e5ba535133 100644 --- a/.agents/skills/ship/SKILL.md +++ b/.agents/skills/ship/SKILL.md @@ -59,7 +59,7 @@ When the user runs `/ship`: ``` Then `git status --short` to see what regenerated — those files must be staged in step 7 alongside your own changes. - **Do NOT blanket-run the domain generators here.** `mship:generate` (`generate-mship-contracts.ts`) is an **umbrella** that drives all nine mothership contract generators (`mship-contracts`, `billing-protocol-contract`, `mship-tools`, the four `trace-*`, `metrics-contract`, `vfs-snapshot-contract`) and biome-formats `apps/sim/lib/mothership/generated/` — never run it *and* its constituents (they write the same files and corrupt each other in parallel), and never run it on an ordinary ship: it reads an **external** copilot-contract source that isn't checked out in most worktrees, so it hard-fails with `ENOENT` and would abort ship for an unrelated reason. `generate:pi-model-catalog` (under `apps/sim`) likewise regenerates from the installed Pi package, not repo source. `scripts/generate-docs.ts` rewrites the integration docs and client-safe catalog; run it when this PR changes their block/icon/landing-content inputs or when `check:integration-catalog` reports drift, then review its broad generated diff. Only when **this PR's diff actually touches** a domain generator's input do you regenerate it deliberately and run its matching `:check` (`bun run mship:check` / the individual `*:check`) — with the external source present. + **Do NOT blanket-run the domain generators here.** `mship-tools:generate` merges Sim's tool contracts into the base tool catalog in the **external** Mothership worker checkout (`../copilot/worker/packages/contracts/tool-catalog-v1.json`), which most worktrees lack, so it hard-fails with `ENOENT` and would abort ship for an unrelated reason. The other mothership contracts in `apps/sim/lib/mothership/generated/` are copied in by the worker's `contracts:sync`, never generated here. `generate:pi-model-catalog` (under `apps/sim`) likewise regenerates from the installed Pi package, not repo source. `scripts/generate-docs.ts` rewrites the integration docs and client-safe catalog; run it when this PR changes their block/icon/landing-content inputs or when `check:integration-catalog` reports drift, then review its broad generated diff. Only when **this PR's diff actually touches** a domain generator's input do you regenerate it deliberately and run its matching `:check` (e.g. `bun run mship-tools:check`) — with the external source present. **Phase B — run lint + every audit CI enforces, in parallel, and abort ship if any fails.** Before running the commands, compare this list with `.github/workflows/checks.yml`; when CI adds an audit, run it and update this skill instead of trusting a stale snapshot. The env-flag audit is currently an inline workflow block rather than a package script: when `apps/sim/lib/core/config/env-flags.ts` changed, run that current workflow block verbatim instead of copying a second version into this skill. Run `bun run lint` first (it autofixes formatting and mutates files, so don't parallelize it with the read-only audits), then run the base-sensitive block-registry check, then fan the independent audits out and collect exit codes: ```bash diff --git a/apps/sim/lib/mothership/generated/billing-protocol-v1.ts b/apps/sim/lib/mothership/generated/billing-protocol-v1.ts index 493785411f1..0e798fd2de8 100644 --- a/apps/sim/lib/mothership/generated/billing-protocol-v1.ts +++ b/apps/sim/lib/mothership/generated/billing-protocol-v1.ts @@ -1,81 +1,75 @@ -/** - * AUTO-GENERATED FILE. DO NOT EDIT. - * - * Source: copilot/copilot/contracts/billing-protocol-v1.schema.json - * Regenerate with: bun run billing-protocol-contract:generate - */ +// GENERATED — do not edit. Source of truth: mothership worker packages/contracts/src/billing-protocol-v1.ts +// Regenerate with `bun run contracts:sync` in the worker. + +// The trusted Sim-to-worker billing protocol: header names, protocol modes, bounds, safe +// API-key denials, and callback and analytics outcomes. export const BILLING_PROTOCOL_HEADERS = { - accountDecision: 'x-sim-billing-account-decision', - attribution: 'x-sim-billing-attribution', - protocol: 'x-sim-billing-protocol', - requestId: 'x-sim-billing-request-id', -} as const + accountDecision: "x-sim-billing-account-decision", + attribution: "x-sim-billing-attribution", + protocol: "x-sim-billing-protocol", + requestId: "x-sim-billing-request-id", +} as const; -export const BILLING_ACCOUNT_DECISION_HEADER = BILLING_PROTOCOL_HEADERS.accountDecision -export const BILLING_ATTRIBUTION_HEADER = BILLING_PROTOCOL_HEADERS.attribution -export const COPILOT_BILLING_PROTOCOL_HEADER = BILLING_PROTOCOL_HEADERS.protocol -export const BILLING_REQUEST_ID_HEADER = BILLING_PROTOCOL_HEADERS.requestId +export const BILLING_ACCOUNT_DECISION_HEADER = BILLING_PROTOCOL_HEADERS.accountDecision; +export const BILLING_ATTRIBUTION_HEADER = BILLING_PROTOCOL_HEADERS.attribution; +export const COPILOT_BILLING_PROTOCOL_HEADER = BILLING_PROTOCOL_HEADERS.protocol; +export const BILLING_REQUEST_ID_HEADER = BILLING_PROTOCOL_HEADERS.requestId; export const COPILOT_BILLING_PROTOCOL = { - attributed: 'attribution-v1', - direct: 'direct-v1', - legacy: 'legacy-v0', -} as const + attributed: "attribution-v1", + direct: "direct-v1", + legacy: "legacy-v0", +} as const; -export type CopilotBillingProtocol = - (typeof COPILOT_BILLING_PROTOCOL)[keyof typeof COPILOT_BILLING_PROTOCOL] +export type CopilotBillingProtocol = (typeof COPILOT_BILLING_PROTOCOL)[keyof typeof COPILOT_BILLING_PROTOCOL]; export const COPILOT_BILLING_PROTOCOL_VALUES = [ COPILOT_BILLING_PROTOCOL.attributed, COPILOT_BILLING_PROTOCOL.direct, COPILOT_BILLING_PROTOCOL.legacy, -] as const +] as const; export const COPILOT_VALIDATION_PURPOSE = { - newTurn: 'new-turn', - continuation: 'continuation', - cancellation: 'cancellation', -} as const + newTurn: "new-turn", + continuation: "continuation", + cancellation: "cancellation", +} as const; -export const COPILOT_VALIDATION_PURPOSE_VALUES = [ - 'new-turn', - 'continuation', - 'cancellation', -] as const +export const COPILOT_VALIDATION_PURPOSE_VALUES = ["new-turn", "continuation", "cancellation"] as const; -export type CopilotValidationPurpose = (typeof COPILOT_VALIDATION_PURPOSE_VALUES)[number] +export type CopilotValidationPurpose = (typeof COPILOT_VALIDATION_PURPOSE_VALUES)[number]; -export const BILLING_ATTRIBUTION_HEADER_MAX_BYTES = 8192 -export const BILLING_ACCOUNT_DECISION_HEADER_MAX_BYTES = 2048 +export const BILLING_ATTRIBUTION_HEADER_MAX_BYTES = 8192; +export const BILLING_ACCOUNT_DECISION_HEADER_MAX_BYTES = 2048; export const BILLING_CALLBACK_OUTCOME = { billingContextMismatch: { - code: 'BILLING_CONTEXT_MISMATCH', - message: 'Idempotency key is already bound to a different billing context', + code: "BILLING_CONTEXT_MISMATCH", + message: "Idempotency key is already bound to a different billing context", }, billingPeriodElapsed: { - code: 'BILLING_PERIOD_ELAPSED', - message: 'Billing period has elapsed; reconciliation required', + code: "BILLING_PERIOD_ELAPSED", + message: "Billing period has elapsed; reconciliation required", }, billingUserNotFound: { - code: 'BILLING_USER_NOT_FOUND', - message: 'Billing user no longer exists; reconciliation required', + code: "BILLING_USER_NOT_FOUND", + message: "Billing user no longer exists; reconciliation required", }, duplicateBillingEvent: { - code: 'DUPLICATE_BILLING_EVENT', - message: 'Duplicate request: cumulative cost already recorded', + code: "DUPLICATE_BILLING_EVENT", + message: "Duplicate request: cumulative cost already recorded", }, -} as const +} as const; export const BillingAnalyticsOutcome = { - DeadLettered: 'dead_lettered', - Duplicate: 'duplicate', - NotBillable: 'not_billable', - RetriesExhausted: 'retries_exhausted', - Success: 'success', - Unknown: 'unknown', -} as const + DeadLettered: "dead_lettered", + Duplicate: "duplicate", + NotBillable: "not_billable", + RetriesExhausted: "retries_exhausted", + Success: "success", + Unknown: "unknown", +} as const; export type BillingAnalyticsOutcomeValue = - (typeof BillingAnalyticsOutcome)[keyof typeof BillingAnalyticsOutcome] + (typeof BillingAnalyticsOutcome)[keyof typeof BillingAnalyticsOutcome]; diff --git a/apps/sim/lib/mothership/generated/metrics-v1.ts b/apps/sim/lib/mothership/generated/metrics-v1.ts index 027979197fa..edf31d9b3cc 100644 --- a/apps/sim/lib/mothership/generated/metrics-v1.ts +++ b/apps/sim/lib/mothership/generated/metrics-v1.ts @@ -1,76 +1,67 @@ -// AUTO-GENERATED FILE. DO NOT EDIT. -// -// Source: copilot/copilot/contracts/metrics-v1.schema.json -// Regenerate with: bun run metrics-contract:generate -// -// Canonical mothership OTel metric names. Call sites should reference -// `Metric.` (e.g. `Metric.CopilotToolDuration`) rather than raw -// string literals, so the Go-side contract is the single source of truth and -// typos become compile errors. -// -// NAMES ONLY. Label keys and histogram bucket boundaries are NOT in this -// contract — Go owns the label-cardinality allowlist and the shared bucket -// constant, and the Sim emitter MUST mirror those by hand so the Go∪Sim metric -// union is queryable as one series set. +// GENERATED — do not edit. Source of truth: mothership worker packages/contracts/src/metrics-v1.ts +// Regenerate with `bun run contracts:sync` in the worker. + +// Canonical mothership OTel metric names Sim emits. Names only: label keys and histogram +// buckets are the emitter's. export const Metric = { - CopilotBillingLongContextCount: 'copilot.billing.long_context.count', - CopilotCacheAttempted: 'copilot.cache.attempted', - CopilotCacheHit: 'copilot.cache.hit', - CopilotCacheWrite: 'copilot.cache.write', - CopilotChatBlobBytes: 'copilot.chat.blob.bytes', - CopilotChatBlobCount: 'copilot.chat.blob.count', - CopilotDegradedCount: 'copilot.degraded.count', - CopilotFileReadDuration: 'copilot.file.read.duration', - CopilotFileReadSize: 'copilot.file.read.size', - CopilotMessagesSerializeDuration: 'copilot.messages.serialize.duration', - CopilotOptionsEmittedCount: 'copilot.options.emitted.count', - CopilotPromptComponentChars: 'copilot.prompt.component.chars', - CopilotRequestCount: 'copilot.request.count', - CopilotRequestDuration: 'copilot.request.duration', - CopilotToolCalls: 'copilot.tool.calls', - CopilotToolDuration: 'copilot.tool.duration', - CopilotVfsDelta: 'copilot.vfs.delta', - CopilotVfsMaterializeDuration: 'copilot.vfs.materialize.duration', - GenAiClientCacheTokenUsage: 'gen_ai.client.cache.token.usage', - GenAiClientTokenUsage: 'gen_ai.client.token.usage', - LlmClientCompactions: 'llm.client.compactions', - LlmClientContextTokens: 'llm.client.context_tokens', - LlmClientErrors: 'llm.client.errors', - LlmClientOutputCutoff: 'llm.client.output_cutoff', - LlmClientStreamDuration: 'llm.client.stream.duration', - LlmClientTimeToFirstToken: 'llm.client.time_to_first_token', -} as const + CopilotBillingLongContextCount: "copilot.billing.long_context.count", + CopilotCacheAttempted: "copilot.cache.attempted", + CopilotCacheHit: "copilot.cache.hit", + CopilotCacheWrite: "copilot.cache.write", + CopilotChatBlobBytes: "copilot.chat.blob.bytes", + CopilotChatBlobCount: "copilot.chat.blob.count", + CopilotDegradedCount: "copilot.degraded.count", + CopilotFileReadDuration: "copilot.file.read.duration", + CopilotFileReadSize: "copilot.file.read.size", + CopilotMessagesSerializeDuration: "copilot.messages.serialize.duration", + CopilotOptionsEmittedCount: "copilot.options.emitted.count", + CopilotPromptComponentChars: "copilot.prompt.component.chars", + CopilotRequestCount: "copilot.request.count", + CopilotRequestDuration: "copilot.request.duration", + CopilotToolCalls: "copilot.tool.calls", + CopilotToolDuration: "copilot.tool.duration", + CopilotVfsDelta: "copilot.vfs.delta", + CopilotVfsMaterializeDuration: "copilot.vfs.materialize.duration", + GenAiClientCacheTokenUsage: "gen_ai.client.cache.token.usage", + GenAiClientTokenUsage: "gen_ai.client.token.usage", + LlmClientCompactions: "llm.client.compactions", + LlmClientContextTokens: "llm.client.context_tokens", + LlmClientErrors: "llm.client.errors", + LlmClientOutputCutoff: "llm.client.output_cutoff", + LlmClientStreamDuration: "llm.client.stream.duration", + LlmClientTimeToFirstToken: "llm.client.time_to_first_token", +} as const; -export type MetricKey = keyof typeof Metric -export type MetricValue = (typeof Metric)[MetricKey] +export type MetricKey = keyof typeof Metric; +export type MetricValue = (typeof Metric)[MetricKey]; /** Readonly sorted list of every canonical mothership metric name. */ export const MetricValues: readonly MetricValue[] = [ - 'copilot.billing.long_context.count', - 'copilot.cache.attempted', - 'copilot.cache.hit', - 'copilot.cache.write', - 'copilot.chat.blob.bytes', - 'copilot.chat.blob.count', - 'copilot.degraded.count', - 'copilot.file.read.duration', - 'copilot.file.read.size', - 'copilot.messages.serialize.duration', - 'copilot.options.emitted.count', - 'copilot.prompt.component.chars', - 'copilot.request.count', - 'copilot.request.duration', - 'copilot.tool.calls', - 'copilot.tool.duration', - 'copilot.vfs.delta', - 'copilot.vfs.materialize.duration', - 'gen_ai.client.cache.token.usage', - 'gen_ai.client.token.usage', - 'llm.client.compactions', - 'llm.client.context_tokens', - 'llm.client.errors', - 'llm.client.output_cutoff', - 'llm.client.stream.duration', - 'llm.client.time_to_first_token', -] as const + "copilot.billing.long_context.count", + "copilot.cache.attempted", + "copilot.cache.hit", + "copilot.cache.write", + "copilot.chat.blob.bytes", + "copilot.chat.blob.count", + "copilot.degraded.count", + "copilot.file.read.duration", + "copilot.file.read.size", + "copilot.messages.serialize.duration", + "copilot.options.emitted.count", + "copilot.prompt.component.chars", + "copilot.request.count", + "copilot.request.duration", + "copilot.tool.calls", + "copilot.tool.duration", + "copilot.vfs.delta", + "copilot.vfs.materialize.duration", + "gen_ai.client.cache.token.usage", + "gen_ai.client.token.usage", + "llm.client.compactions", + "llm.client.context_tokens", + "llm.client.errors", + "llm.client.output_cutoff", + "llm.client.stream.duration", + "llm.client.time_to_first_token", +] as const; diff --git a/apps/sim/lib/mothership/generated/mothership-stream-v1.ts b/apps/sim/lib/mothership/generated/mothership-stream-v1.ts index 2889f7cc1c1..2ce8f5b596b 100644 --- a/apps/sim/lib/mothership/generated/mothership-stream-v1.ts +++ b/apps/sim/lib/mothership/generated/mothership-stream-v1.ts @@ -1,8 +1,12 @@ -// AUTO-GENERATED FILE. DO NOT EDIT. -// +// GENERATED — do not edit. Source of truth: mothership worker packages/contracts/src/mothership-stream-v1.ts +// Regenerate with `bun run contracts:sync` in the worker. + +// The mothership-stream-v1 SSE envelope taxonomy Sim parses. The worker writes the shared +// StreamEnvelope shell in protocol.ts; this file is the full v1 event vocabulary Sim's +// stream readers are typed against. /** - * Shared execution-oriented mothership stream contract from Go to Sim. + * Shared execution-oriented mothership stream contract from the worker to Sim. */ export type MothershipStreamV1EventEnvelope = | MothershipStreamV1SessionStartEventEnvelope @@ -27,598 +31,593 @@ export type MothershipStreamV1EventEnvelope = | MothershipStreamV1TaskArmedEventEnvelope | MothershipStreamV1TaskDeliveredEventEnvelope | MothershipStreamV1ErrorEventEnvelope - | MothershipStreamV1CompleteEventEnvelope -export type MothershipStreamV1TextChannel = 'assistant' | 'thinking' -export type MothershipStreamV1ToolExecutor = 'go' | 'sim' | 'client' -export type MothershipStreamV1ToolMode = 'sync' | 'async' + | MothershipStreamV1CompleteEventEnvelope; +export type MothershipStreamV1TextChannel = "assistant" | "thinking"; +export type MothershipStreamV1ToolExecutor = "go" | "sim" | "client"; +export type MothershipStreamV1ToolMode = "sync" | "async"; export type MothershipStreamV1ToolStatus = - | 'generating' - | 'awaiting_approval' - | 'executing' - | 'success' - | 'error' - | 'cancelled' - | 'skipped' - | 'rejected' -export type MothershipStreamV1CompletionStatus = 'complete' | 'error' | 'cancelled' + | "generating" + | "awaiting_approval" + | "executing" + | "success" + | "error" + | "cancelled" + | "skipped" + | "rejected"; +export type MothershipStreamV1CompletionStatus = "complete" | "error" | "cancelled"; export interface MothershipStreamV1SessionStartEventEnvelope { - payload: MothershipStreamV1SessionStartPayload - scope?: MothershipStreamV1StreamScope - seq: number - stream: MothershipStreamV1StreamRef - trace?: MothershipStreamV1Trace - ts: string - type: 'session' - v: 1 + payload: MothershipStreamV1SessionStartPayload; + scope?: MothershipStreamV1StreamScope; + seq: number; + stream: MothershipStreamV1StreamRef; + trace?: MothershipStreamV1Trace; + ts: string; + type: "session"; + v: 1; } export interface MothershipStreamV1SessionStartPayload { - data?: MothershipStreamV1SessionStartData - kind: 'start' + data?: MothershipStreamV1SessionStartData; + kind: "start"; } export interface MothershipStreamV1SessionStartData { - responseId?: string + responseId?: string; } export interface MothershipStreamV1StreamScope { - agentId?: string - lane: 'subagent' - parentSpanId?: string - parentToolCallId?: string - spanId?: string + agentId?: string; + lane: "subagent"; + parentSpanId?: string; + parentToolCallId?: string; + spanId?: string; } export interface MothershipStreamV1StreamRef { - chatId?: string - cursor?: string - streamId: string + chatId?: string; + cursor?: string; + streamId: string; } export interface MothershipStreamV1Trace { /** - * OTel trace ID from the first Go ingress. May differ from requestId when Sim assigns the canonical request identity. + * OTel trace ID from the first worker ingress. May differ from requestId when Sim assigns the canonical request identity. */ - goTraceId?: string - requestId: string - spanId?: string + goTraceId?: string; + requestId: string; + spanId?: string; } export interface MothershipStreamV1SessionChatEventEnvelope { - payload: MothershipStreamV1SessionChatPayload - scope?: MothershipStreamV1StreamScope - seq: number - stream: MothershipStreamV1StreamRef - trace?: MothershipStreamV1Trace - ts: string - type: 'session' - v: 1 + payload: MothershipStreamV1SessionChatPayload; + scope?: MothershipStreamV1StreamScope; + seq: number; + stream: MothershipStreamV1StreamRef; + trace?: MothershipStreamV1Trace; + ts: string; + type: "session"; + v: 1; } export interface MothershipStreamV1SessionChatPayload { - chatId: string - kind: 'chat' + chatId: string; + kind: "chat"; } export interface MothershipStreamV1SessionTitleEventEnvelope { - payload: MothershipStreamV1SessionTitlePayload - scope?: MothershipStreamV1StreamScope - seq: number - stream: MothershipStreamV1StreamRef - trace?: MothershipStreamV1Trace - ts: string - type: 'session' - v: 1 + payload: MothershipStreamV1SessionTitlePayload; + scope?: MothershipStreamV1StreamScope; + seq: number; + stream: MothershipStreamV1StreamRef; + trace?: MothershipStreamV1Trace; + ts: string; + type: "session"; + v: 1; } export interface MothershipStreamV1SessionTitlePayload { - kind: 'title' - title: string + kind: "title"; + title: string; } export interface MothershipStreamV1SessionTraceEventEnvelope { - payload: MothershipStreamV1SessionTracePayload - scope?: MothershipStreamV1StreamScope - seq: number - stream: MothershipStreamV1StreamRef - trace?: MothershipStreamV1Trace - ts: string - type: 'session' - v: 1 + payload: MothershipStreamV1SessionTracePayload; + scope?: MothershipStreamV1StreamScope; + seq: number; + stream: MothershipStreamV1StreamRef; + trace?: MothershipStreamV1Trace; + ts: string; + type: "session"; + v: 1; } export interface MothershipStreamV1SessionTracePayload { - kind: 'trace' - requestId: string - spanId?: string + kind: "trace"; + requestId: string; + spanId?: string; } export interface MothershipStreamV1TextEventEnvelope { - payload: MothershipStreamV1TextPayload - scope?: MothershipStreamV1StreamScope - seq: number - stream: MothershipStreamV1StreamRef - trace?: MothershipStreamV1Trace - ts: string - type: 'text' - v: 1 + payload: MothershipStreamV1TextPayload; + scope?: MothershipStreamV1StreamScope; + seq: number; + stream: MothershipStreamV1StreamRef; + trace?: MothershipStreamV1Trace; + ts: string; + type: "text"; + v: 1; } export interface MothershipStreamV1TextPayload { - channel: MothershipStreamV1TextChannel - text: string + channel: MothershipStreamV1TextChannel; + text: string; } export interface MothershipStreamV1ToolCallEventEnvelope { - payload: MothershipStreamV1ToolCallDescriptor - scope?: MothershipStreamV1StreamScope - seq: number - stream: MothershipStreamV1StreamRef - trace?: MothershipStreamV1Trace - ts: string - type: 'tool' - v: 1 + payload: MothershipStreamV1ToolCallDescriptor; + scope?: MothershipStreamV1StreamScope; + seq: number; + stream: MothershipStreamV1StreamRef; + trace?: MothershipStreamV1Trace; + ts: string; + type: "tool"; + v: 1; } export interface MothershipStreamV1ToolCallDescriptor { - activityDescription?: string - arguments?: MothershipStreamV1AdditionalPropertiesMap - execName?: string - executor: MothershipStreamV1ToolExecutor - mode: MothershipStreamV1ToolMode - partial?: boolean - phase: 'call' - status?: MothershipStreamV1ToolStatus - toolCallId: string - toolName: string - ui?: MothershipStreamV1ToolUI + activityDescription?: string; + arguments?: MothershipStreamV1AdditionalPropertiesMap; + execName?: string; + executor: MothershipStreamV1ToolExecutor; + mode: MothershipStreamV1ToolMode; + partial?: boolean; + phase: "call"; + status?: MothershipStreamV1ToolStatus; + toolCallId: string; + toolName: string; + ui?: MothershipStreamV1ToolUI; } export interface MothershipStreamV1AdditionalPropertiesMap { - [k: string]: unknown + [k: string]: unknown; } export interface MothershipStreamV1ToolUI { - clientExecutable?: boolean - hidden?: boolean - inbandOwned?: boolean - internal?: boolean - simExecutable?: boolean + clientExecutable?: boolean; + hidden?: boolean; + inbandOwned?: boolean; + internal?: boolean; + simExecutable?: boolean; } export interface MothershipStreamV1ToolArgsDeltaEventEnvelope { - payload: MothershipStreamV1ToolArgsDeltaPayload - scope?: MothershipStreamV1StreamScope - seq: number - stream: MothershipStreamV1StreamRef - trace?: MothershipStreamV1Trace - ts: string - type: 'tool' - v: 1 + payload: MothershipStreamV1ToolArgsDeltaPayload; + scope?: MothershipStreamV1StreamScope; + seq: number; + stream: MothershipStreamV1StreamRef; + trace?: MothershipStreamV1Trace; + ts: string; + type: "tool"; + v: 1; } export interface MothershipStreamV1ToolArgsDeltaPayload { - argumentsDelta: string - executor: MothershipStreamV1ToolExecutor - mode: MothershipStreamV1ToolMode - phase: 'args_delta' - toolCallId: string - toolName: string + argumentsDelta: string; + executor: MothershipStreamV1ToolExecutor; + mode: MothershipStreamV1ToolMode; + phase: "args_delta"; + toolCallId: string; + toolName: string; } export interface MothershipStreamV1ToolResultEventEnvelope { - payload: MothershipStreamV1ToolResultPayload - scope?: MothershipStreamV1StreamScope - seq: number - stream: MothershipStreamV1StreamRef - trace?: MothershipStreamV1Trace - ts: string - type: 'tool' - v: 1 + payload: MothershipStreamV1ToolResultPayload; + scope?: MothershipStreamV1StreamScope; + seq: number; + stream: MothershipStreamV1StreamRef; + trace?: MothershipStreamV1Trace; + ts: string; + type: "tool"; + v: 1; } export interface MothershipStreamV1ToolResultPayload { - error?: string - executor: MothershipStreamV1ToolExecutor - mode: MothershipStreamV1ToolMode - output?: unknown - phase: 'result' - status?: MothershipStreamV1ToolStatus - success: boolean - toolCallId: string - toolName: string + error?: string; + executor: MothershipStreamV1ToolExecutor; + mode: MothershipStreamV1ToolMode; + output?: unknown; + phase: "result"; + status?: MothershipStreamV1ToolStatus; + success: boolean; + toolCallId: string; + toolName: string; } export interface MothershipStreamV1SubagentSpanStartEventEnvelope { - payload: MothershipStreamV1SubagentSpanStartPayload - scope?: MothershipStreamV1StreamScope - seq: number - stream: MothershipStreamV1StreamRef - trace?: MothershipStreamV1Trace - ts: string - type: 'span' - v: 1 + payload: MothershipStreamV1SubagentSpanStartPayload; + scope?: MothershipStreamV1StreamScope; + seq: number; + stream: MothershipStreamV1StreamRef; + trace?: MothershipStreamV1Trace; + ts: string; + type: "span"; + v: 1; } export interface MothershipStreamV1SubagentSpanStartPayload { - agent?: string - data?: unknown - event: 'start' - kind: 'subagent' + agent?: string; + data?: unknown; + event: "start"; + kind: "subagent"; } export interface MothershipStreamV1SubagentSpanEndEventEnvelope { - payload: MothershipStreamV1SubagentSpanEndPayload - scope?: MothershipStreamV1StreamScope - seq: number - stream: MothershipStreamV1StreamRef - trace?: MothershipStreamV1Trace - ts: string - type: 'span' - v: 1 + payload: MothershipStreamV1SubagentSpanEndPayload; + scope?: MothershipStreamV1StreamScope; + seq: number; + stream: MothershipStreamV1StreamRef; + trace?: MothershipStreamV1Trace; + ts: string; + type: "span"; + v: 1; } export interface MothershipStreamV1SubagentSpanEndPayload { - agent?: string - data?: unknown - event: 'end' - kind: 'subagent' + agent?: string; + data?: unknown; + event: "end"; + kind: "subagent"; } export interface MothershipStreamV1StructuredResultSpanEventEnvelope { - payload: MothershipStreamV1StructuredResultSpanPayload - scope?: MothershipStreamV1StreamScope - seq: number - stream: MothershipStreamV1StreamRef - trace?: MothershipStreamV1Trace - ts: string - type: 'span' - v: 1 + payload: MothershipStreamV1StructuredResultSpanPayload; + scope?: MothershipStreamV1StreamScope; + seq: number; + stream: MothershipStreamV1StreamRef; + trace?: MothershipStreamV1Trace; + ts: string; + type: "span"; + v: 1; } export interface MothershipStreamV1StructuredResultSpanPayload { - agent?: string - data?: unknown - kind: 'structured_result' + agent?: string; + data?: unknown; + kind: "structured_result"; } export interface MothershipStreamV1SubagentResultSpanEventEnvelope { - payload: MothershipStreamV1SubagentResultSpanPayload - scope?: MothershipStreamV1StreamScope - seq: number - stream: MothershipStreamV1StreamRef - trace?: MothershipStreamV1Trace - ts: string - type: 'span' - v: 1 + payload: MothershipStreamV1SubagentResultSpanPayload; + scope?: MothershipStreamV1StreamScope; + seq: number; + stream: MothershipStreamV1StreamRef; + trace?: MothershipStreamV1Trace; + ts: string; + type: "span"; + v: 1; } export interface MothershipStreamV1SubagentResultSpanPayload { - agent?: string - data?: unknown - kind: 'subagent_result' + agent?: string; + data?: unknown; + kind: "subagent_result"; } export interface MothershipStreamV1ResourceUpsertEventEnvelope { - payload: MothershipStreamV1ResourceUpsertPayload - scope?: MothershipStreamV1StreamScope - seq: number - stream: MothershipStreamV1StreamRef - trace?: MothershipStreamV1Trace - ts: string - type: 'resource' - v: 1 + payload: MothershipStreamV1ResourceUpsertPayload; + scope?: MothershipStreamV1StreamScope; + seq: number; + stream: MothershipStreamV1StreamRef; + trace?: MothershipStreamV1Trace; + ts: string; + type: "resource"; + v: 1; } export interface MothershipStreamV1ResourceUpsertPayload { - op: 'upsert' - resource: MothershipStreamV1ResourceDescriptor + op: "upsert"; + resource: MothershipStreamV1ResourceDescriptor; } export interface MothershipStreamV1ResourceDescriptor { - clearViewId?: boolean - id: string - title?: string - type: string - viewId?: string + clearViewId?: boolean; + id: string; + title?: string; + type: string; + viewId?: string; } export interface MothershipStreamV1ResourceRemoveEventEnvelope { - payload: MothershipStreamV1ResourceRemovePayload - scope?: MothershipStreamV1StreamScope - seq: number - stream: MothershipStreamV1StreamRef - trace?: MothershipStreamV1Trace - ts: string - type: 'resource' - v: 1 + payload: MothershipStreamV1ResourceRemovePayload; + scope?: MothershipStreamV1StreamScope; + seq: number; + stream: MothershipStreamV1StreamRef; + trace?: MothershipStreamV1Trace; + ts: string; + type: "resource"; + v: 1; } export interface MothershipStreamV1ResourceRemovePayload { - op: 'remove' - resource: MothershipStreamV1ResourceDescriptor + op: "remove"; + resource: MothershipStreamV1ResourceDescriptor; } export interface MothershipStreamV1CheckpointPauseEventEnvelope { - payload: MothershipStreamV1CheckpointPausePayload - scope?: MothershipStreamV1StreamScope - seq: number - stream: MothershipStreamV1StreamRef - trace?: MothershipStreamV1Trace - ts: string - type: 'run' - v: 1 + payload: MothershipStreamV1CheckpointPausePayload; + scope?: MothershipStreamV1StreamScope; + seq: number; + stream: MothershipStreamV1StreamRef; + trace?: MothershipStreamV1Trace; + ts: string; + type: "run"; + v: 1; } export interface MothershipStreamV1CheckpointPausePayload { - checkpointId: string - executionId: string - frames?: MothershipStreamV1CheckpointPauseFrame[] - kind: 'checkpoint_pause' - pendingToolCallIds: string[] - runId: string + checkpointId: string; + executionId: string; + frames?: MothershipStreamV1CheckpointPauseFrame[]; + kind: "checkpoint_pause"; + pendingToolCallIds: string[]; + runId: string; } export interface MothershipStreamV1CheckpointPauseFrame { - checkpointId?: string - parentToolCallId: string - parentToolName: string - pendingToolIds: string[] + checkpointId?: string; + parentToolCallId: string; + parentToolName: string; + pendingToolIds: string[]; } export interface MothershipStreamV1RunResumedEventEnvelope { - payload: MothershipStreamV1RunResumedPayload - scope?: MothershipStreamV1StreamScope - seq: number - stream: MothershipStreamV1StreamRef - trace?: MothershipStreamV1Trace - ts: string - type: 'run' - v: 1 + payload: MothershipStreamV1RunResumedPayload; + scope?: MothershipStreamV1StreamScope; + seq: number; + stream: MothershipStreamV1StreamRef; + trace?: MothershipStreamV1Trace; + ts: string; + type: "run"; + v: 1; } export interface MothershipStreamV1RunResumedPayload { - kind: 'resumed' + kind: "resumed"; } export interface MothershipStreamV1CompactionStartEventEnvelope { - payload: MothershipStreamV1CompactionStartPayload - scope?: MothershipStreamV1StreamScope - seq: number - stream: MothershipStreamV1StreamRef - trace?: MothershipStreamV1Trace - ts: string - type: 'run' - v: 1 + payload: MothershipStreamV1CompactionStartPayload; + scope?: MothershipStreamV1StreamScope; + seq: number; + stream: MothershipStreamV1StreamRef; + trace?: MothershipStreamV1Trace; + ts: string; + type: "run"; + v: 1; } export interface MothershipStreamV1CompactionStartPayload { - kind: 'compaction_start' + kind: "compaction_start"; } export interface MothershipStreamV1CompactionDoneEventEnvelope { - payload: MothershipStreamV1CompactionDonePayload - scope?: MothershipStreamV1StreamScope - seq: number - stream: MothershipStreamV1StreamRef - trace?: MothershipStreamV1Trace - ts: string - type: 'run' - v: 1 + payload: MothershipStreamV1CompactionDonePayload; + scope?: MothershipStreamV1StreamScope; + seq: number; + stream: MothershipStreamV1StreamRef; + trace?: MothershipStreamV1Trace; + ts: string; + type: "run"; + v: 1; } export interface MothershipStreamV1CompactionDonePayload { - data?: MothershipStreamV1CompactionDoneData - kind: 'compaction_done' + data?: MothershipStreamV1CompactionDoneData; + kind: "compaction_done"; } export interface MothershipStreamV1CompactionDoneData { - summary_chars: number + summary_chars: number; } export interface MothershipStreamV1SteeringAppliedEventEnvelope { - payload: MothershipStreamV1SteeringAppliedPayload - scope?: MothershipStreamV1StreamScope - seq: number - stream: MothershipStreamV1StreamRef - trace?: MothershipStreamV1Trace - ts: string - type: 'run' - v: 1 + payload: MothershipStreamV1SteeringAppliedPayload; + scope?: MothershipStreamV1StreamScope; + seq: number; + stream: MothershipStreamV1StreamRef; + trace?: MothershipStreamV1Trace; + ts: string; + type: "run"; + v: 1; } export interface MothershipStreamV1SteeringAppliedPayload { - content?: string - eventSeq?: number - kind: 'steering_applied' - messageId?: string - mode?: 'deferred' | 'interrupt' - steeringId: string - textOffset?: number + content?: string; + eventSeq?: number; + kind: "steering_applied"; + messageId?: string; + mode?: "deferred" | "interrupt"; + steeringId: string; + textOffset?: number; } export interface MothershipStreamV1TaskArmedEventEnvelope { - payload: MothershipStreamV1TaskArmedPayload - scope?: MothershipStreamV1StreamScope - seq: number - stream: MothershipStreamV1StreamRef - trace?: MothershipStreamV1Trace - ts: string - type: 'run' - v: 1 + payload: MothershipStreamV1TaskArmedPayload; + scope?: MothershipStreamV1StreamScope; + seq: number; + stream: MothershipStreamV1StreamRef; + trace?: MothershipStreamV1Trace; + ts: string; + type: "run"; + v: 1; } export interface MothershipStreamV1TaskArmedPayload { - kind: 'task_armed' - note: string - target: {} - taskId: string - taskKind: 'timer' | 'workflow_run' + kind: "task_armed"; + note: string; + target: Record; + taskId: string; + taskKind: "timer" | "workflow_run"; } export interface MothershipStreamV1TaskDeliveredEventEnvelope { - payload: MothershipStreamV1TaskDeliveredPayload - scope?: MothershipStreamV1StreamScope - seq: number - stream: MothershipStreamV1StreamRef - trace?: MothershipStreamV1Trace - ts: string - type: 'run' - v: 1 + payload: MothershipStreamV1TaskDeliveredPayload; + scope?: MothershipStreamV1StreamScope; + seq: number; + stream: MothershipStreamV1StreamRef; + trace?: MothershipStreamV1Trace; + ts: string; + type: "run"; + v: 1; } export interface MothershipStreamV1TaskDeliveredPayload { - kind: 'task_delivered' - status: 'completed' | 'failed' | 'stopped' | 'expired' - summary: string - taskId: string + kind: "task_delivered"; + status: "completed" | "failed" | "stopped" | "expired"; + summary: string; + taskId: string; } export interface MothershipStreamV1ErrorEventEnvelope { - payload: MothershipStreamV1ErrorPayload - scope?: MothershipStreamV1StreamScope - seq: number - stream: MothershipStreamV1StreamRef - trace?: MothershipStreamV1Trace - ts: string - type: 'error' - v: 1 + payload: MothershipStreamV1ErrorPayload; + scope?: MothershipStreamV1StreamScope; + seq: number; + stream: MothershipStreamV1StreamRef; + trace?: MothershipStreamV1Trace; + ts: string; + type: "error"; + v: 1; } export interface MothershipStreamV1ErrorPayload { - code?: string - data?: unknown - displayMessage?: string - error?: string - message: string - provider?: string + code?: string; + data?: unknown; + displayMessage?: string; + error?: string; + message: string; + provider?: string; } export interface MothershipStreamV1CompleteEventEnvelope { - payload: MothershipStreamV1CompletePayload - scope?: MothershipStreamV1StreamScope - seq: number - stream: MothershipStreamV1StreamRef - trace?: MothershipStreamV1Trace - ts: string - type: 'complete' - v: 1 + payload: MothershipStreamV1CompletePayload; + scope?: MothershipStreamV1StreamScope; + seq: number; + stream: MothershipStreamV1StreamRef; + trace?: MothershipStreamV1Trace; + ts: string; + type: "complete"; + v: 1; } export interface MothershipStreamV1CompletePayload { - cost?: MothershipStreamV1CostData - reason?: string - response?: unknown - status: MothershipStreamV1CompletionStatus - usage?: MothershipStreamV1UsageData + cost?: MothershipStreamV1CostData; + reason?: string; + response?: unknown; + status: MothershipStreamV1CompletionStatus; + usage?: MothershipStreamV1UsageData; } export interface MothershipStreamV1CostData { - input?: number - output?: number - total?: number + input?: number; + output?: number; + total?: number; } export interface MothershipStreamV1UsageData { - cache_creation_input_tokens?: number - cache_read_input_tokens?: number - input_tokens?: number - model?: string - output_tokens?: number - total_tokens?: number + cache_creation_input_tokens?: number; + cache_read_input_tokens?: number; + input_tokens?: number; + model?: string; + output_tokens?: number; + total_tokens?: number; } export type MothershipStreamV1AsyncToolRecordStatus = - | 'pending' - | 'running' - | 'completed' - | 'failed' - | 'cancelled' - | 'delivered' + | "pending" + | "running" + | "completed" + | "failed" + | "cancelled" + | "delivered"; export const MothershipStreamV1AsyncToolRecordStatus = { - pending: 'pending', - running: 'running', - completed: 'completed', - failed: 'failed', - cancelled: 'cancelled', - delivered: 'delivered', -} as const + pending: "pending", + running: "running", + completed: "completed", + failed: "failed", + cancelled: "cancelled", + delivered: "delivered", +} as const; export const MothershipStreamV1CompletionStatus = { - complete: 'complete', - error: 'error', - cancelled: 'cancelled', -} as const + complete: "complete", + error: "error", + cancelled: "cancelled", +} as const; export type MothershipStreamV1EventType = - | 'session' - | 'text' - | 'tool' - | 'span' - | 'resource' - | 'run' - | 'error' - | 'complete' + | "session" + | "text" + | "tool" + | "span" + | "resource" + | "run" + | "error" + | "complete"; export const MothershipStreamV1EventType = { - session: 'session', - text: 'text', - tool: 'tool', - span: 'span', - resource: 'resource', - run: 'run', - error: 'error', - complete: 'complete', -} as const + session: "session", + text: "text", + tool: "tool", + span: "span", + resource: "resource", + run: "run", + error: "error", + complete: "complete", +} as const; -export type MothershipStreamV1ResourceOp = 'upsert' | 'remove' +export type MothershipStreamV1ResourceOp = "upsert" | "remove"; export const MothershipStreamV1ResourceOp = { - upsert: 'upsert', - remove: 'remove', -} as const + upsert: "upsert", + remove: "remove", +} as const; export type MothershipStreamV1RunKind = - | 'checkpoint_pause' - | 'resumed' - | 'compaction_start' - | 'compaction_done' - | 'steering_applied' - | 'task_armed' - | 'task_delivered' + | "checkpoint_pause" + | "resumed" + | "compaction_start" + | "compaction_done" + | "steering_applied" + | "task_armed" + | "task_delivered"; export const MothershipStreamV1RunKind = { - checkpoint_pause: 'checkpoint_pause', - resumed: 'resumed', - compaction_start: 'compaction_start', - compaction_done: 'compaction_done', - steering_applied: 'steering_applied', - task_armed: 'task_armed', - task_delivered: 'task_delivered', -} as const + checkpoint_pause: "checkpoint_pause", + resumed: "resumed", + compaction_start: "compaction_start", + compaction_done: "compaction_done", + steering_applied: "steering_applied", + task_armed: "task_armed", + task_delivered: "task_delivered", +} as const; -export type MothershipStreamV1SessionKind = 'trace' | 'chat' | 'title' | 'start' +export type MothershipStreamV1SessionKind = "trace" | "chat" | "title" | "start"; export const MothershipStreamV1SessionKind = { - trace: 'trace', - chat: 'chat', - title: 'title', - start: 'start', -} as const + trace: "trace", + chat: "chat", + title: "title", + start: "start", +} as const; -export type MothershipStreamV1SpanKind = 'subagent' +export type MothershipStreamV1SpanKind = "subagent"; export const MothershipStreamV1SpanKind = { - subagent: 'subagent', -} as const + subagent: "subagent", +} as const; -export type MothershipStreamV1SpanLifecycleEvent = 'start' | 'end' +export type MothershipStreamV1SpanLifecycleEvent = "start" | "end"; export const MothershipStreamV1SpanLifecycleEvent = { - start: 'start', - end: 'end', -} as const + start: "start", + end: "end", +} as const; -export type MothershipStreamV1SpanPayloadKind = 'subagent' | 'structured_result' | 'subagent_result' +export type MothershipStreamV1SpanPayloadKind = "subagent" | "structured_result" | "subagent_result"; export const MothershipStreamV1SpanPayloadKind = { - subagent: 'subagent', - structured_result: 'structured_result', - subagent_result: 'subagent_result', -} as const + subagent: "subagent", + structured_result: "structured_result", + subagent_result: "subagent_result", +} as const; export const MothershipStreamV1TextChannel = { - assistant: 'assistant', - thinking: 'thinking', -} as const + assistant: "assistant", + thinking: "thinking", +} as const; export const MothershipStreamV1ToolExecutor = { - go: 'go', - sim: 'sim', - client: 'client', -} as const + go: "go", + sim: "sim", + client: "client", +} as const; export const MothershipStreamV1ToolMode = { - sync: 'sync', - async: 'async', -} as const + sync: "sync", + async: "async", +} as const; -export type MothershipStreamV1ToolOutcome = - | 'success' - | 'error' - | 'cancelled' - | 'skipped' - | 'rejected' +export type MothershipStreamV1ToolOutcome = "success" | "error" | "cancelled" | "skipped" | "rejected"; export const MothershipStreamV1ToolOutcome = { - success: 'success', - error: 'error', - cancelled: 'cancelled', - skipped: 'skipped', - rejected: 'rejected', -} as const + success: "success", + error: "error", + cancelled: "cancelled", + skipped: "skipped", + rejected: "rejected", +} as const; -export type MothershipStreamV1ToolPhase = 'call' | 'args_delta' | 'result' +export type MothershipStreamV1ToolPhase = "call" | "args_delta" | "result"; export const MothershipStreamV1ToolPhase = { - call: 'call', - args_delta: 'args_delta', - result: 'result', -} as const + call: "call", + args_delta: "args_delta", + result: "result", +} as const; export const MothershipStreamV1ToolStatus = { - generating: 'generating', - awaiting_approval: 'awaiting_approval', - executing: 'executing', - success: 'success', - error: 'error', - cancelled: 'cancelled', - skipped: 'skipped', - rejected: 'rejected', -} as const + generating: "generating", + awaiting_approval: "awaiting_approval", + executing: "executing", + success: "success", + error: "error", + cancelled: "cancelled", + skipped: "skipped", + rejected: "rejected", +} as const; diff --git a/apps/sim/lib/mothership/generated/tool-catalog-v1.ts b/apps/sim/lib/mothership/generated/tool-catalog-v1.ts index f600f7d40e9..ec4f84594f9 100644 --- a/apps/sim/lib/mothership/generated/tool-catalog-v1.ts +++ b/apps/sim/lib/mothership/generated/tool-catalog-v1.ts @@ -1,5 +1,5 @@ // AUTO-GENERATED FILE. DO NOT EDIT. -// Generated from copilot/contracts/tool-catalog-v1.json with Sim-owned Assistant input contracts +// Generated from the Mothership worker packages/contracts/tool-catalog-v1.json with Sim-owned Assistant input contracts // export interface ToolCatalogEntry { diff --git a/apps/sim/lib/mothership/generated/tool-schemas-v1.ts b/apps/sim/lib/mothership/generated/tool-schemas-v1.ts index cc43ea75bd8..7a93ed0e320 100644 --- a/apps/sim/lib/mothership/generated/tool-schemas-v1.ts +++ b/apps/sim/lib/mothership/generated/tool-schemas-v1.ts @@ -1,5 +1,5 @@ // AUTO-GENERATED FILE. DO NOT EDIT. -// Generated from copilot/contracts/tool-catalog-v1.json with Sim-owned Assistant input contracts +// Generated from the Mothership worker packages/contracts/tool-catalog-v1.json with Sim-owned Assistant input contracts // export type JsonSchema = unknown diff --git a/apps/sim/lib/mothership/generated/trace-attribute-values-v1.ts b/apps/sim/lib/mothership/generated/trace-attribute-values-v1.ts index c7312321dc3..e873df7d6e7 100644 --- a/apps/sim/lib/mothership/generated/trace-attribute-values-v1.ts +++ b/apps/sim/lib/mothership/generated/trace-attribute-values-v1.ts @@ -1,457 +1,447 @@ -// AUTO-GENERATED FILE. DO NOT EDIT. -// -// Source: copilot/copilot/contracts/trace-attribute-values-v1.schema.json -// Regenerate with: bun run trace-attribute-values-contract:generate -// -// Canonical closed-set value vocabularies for mothership OTel -// attributes. Call sites should reference e.g. -// `CopilotRequestCancelReason.ExplicitStop` rather than the raw -// string literal, so typos become compile errors and the Go contract -// remains the single source of truth. +// GENERATED — do not edit. Source of truth: mothership worker packages/contracts/src/trace-attribute-values-v1.ts +// Regenerate with `bun run contracts:sync` in the worker. + +// Closed-set value vocabularies for the attributes in trace-attributes-v1.ts. Call sites +// reference e.g. `CopilotRequestCancelReason.ExplicitStop` rather than raw strings. export const AbortBackend = { - InProcess: 'in_process', - Redis: 'redis', -} as const + InProcess: "in_process", + Redis: "redis", +} as const; -export type AbortBackendKey = keyof typeof AbortBackend -export type AbortBackendValue = (typeof AbortBackend)[AbortBackendKey] +export type AbortBackendKey = keyof typeof AbortBackend; +export type AbortBackendValue = (typeof AbortBackend)[AbortBackendKey]; export const AbortRedisResult = { - Error: 'error', - Miss: 'miss', - Ok: 'ok', - Slow: 'slow', -} as const + Error: "error", + Miss: "miss", + Ok: "ok", + Slow: "slow", +} as const; -export type AbortRedisResultKey = keyof typeof AbortRedisResult -export type AbortRedisResultValue = (typeof AbortRedisResult)[AbortRedisResultKey] +export type AbortRedisResultKey = keyof typeof AbortRedisResult; +export type AbortRedisResultValue = (typeof AbortRedisResult)[AbortRedisResultKey]; export const AuthKeyMatch = { - None: 'none', - User: 'user', -} as const + None: "none", + User: "user", +} as const; -export type AuthKeyMatchKey = keyof typeof AuthKeyMatch -export type AuthKeyMatchValue = (typeof AuthKeyMatch)[AuthKeyMatchKey] +export type AuthKeyMatchKey = keyof typeof AuthKeyMatch; +export type AuthKeyMatchValue = (typeof AuthKeyMatch)[AuthKeyMatchKey]; export const BillingFlushOutcome = { - CheckpointAlreadyClaimed: 'checkpoint_already_claimed', - CheckpointLoadFailed: 'checkpoint_load_failed', - Flushed: 'flushed', - NoCheckpoint: 'no_checkpoint', - NoSnapshot: 'no_snapshot', - SkippedUnconfigured: 'skipped_unconfigured', -} as const + CheckpointAlreadyClaimed: "checkpoint_already_claimed", + CheckpointLoadFailed: "checkpoint_load_failed", + Flushed: "flushed", + NoCheckpoint: "no_checkpoint", + NoSnapshot: "no_snapshot", + SkippedUnconfigured: "skipped_unconfigured", +} as const; -export type BillingFlushOutcomeKey = keyof typeof BillingFlushOutcome -export type BillingFlushOutcomeValue = (typeof BillingFlushOutcome)[BillingFlushOutcomeKey] +export type BillingFlushOutcomeKey = keyof typeof BillingFlushOutcome; +export type BillingFlushOutcomeValue = (typeof BillingFlushOutcome)[BillingFlushOutcomeKey]; export const BillingRouteOutcome = { - AuthFailed: 'auth_failed', - Billed: 'billed', - BillingDisabled: 'billing_disabled', - DuplicateIdempotencyKey: 'duplicate_idempotency_key', - InternalError: 'internal_error', - InvalidBody: 'invalid_body', - ReconciliationRequired: 'reconciliation_required', -} as const - -export type BillingRouteOutcomeKey = keyof typeof BillingRouteOutcome -export type BillingRouteOutcomeValue = (typeof BillingRouteOutcome)[BillingRouteOutcomeKey] + AuthFailed: "auth_failed", + Billed: "billed", + BillingDisabled: "billing_disabled", + DuplicateIdempotencyKey: "duplicate_idempotency_key", + InternalError: "internal_error", + InvalidBody: "invalid_body", + ReconciliationRequired: "reconciliation_required", +} as const; + +export type BillingRouteOutcomeKey = keyof typeof BillingRouteOutcome; +export type BillingRouteOutcomeValue = (typeof BillingRouteOutcome)[BillingRouteOutcomeKey]; export const ContextBudgetSource = { - Model: 'model', - PricingBoundary: 'pricing_boundary', -} as const + Model: "model", + PricingBoundary: "pricing_boundary", +} as const; -export type ContextBudgetSourceKey = keyof typeof ContextBudgetSource -export type ContextBudgetSourceValue = (typeof ContextBudgetSource)[ContextBudgetSourceKey] +export type ContextBudgetSourceKey = keyof typeof ContextBudgetSource; +export type ContextBudgetSourceValue = (typeof ContextBudgetSource)[ContextBudgetSourceKey]; export const CopilotAbortOutcome = { - BadRequest: 'bad_request', - FallbackPersistFailed: 'fallback_persist_failed', - ForceReleased: 'force_released', - MissingMessageId: 'missing_message_id', - MissingStreamId: 'missing_stream_id', - NoChatId: 'no_chat_id', - Ok: 'ok', - SettleTimeout: 'settle_timeout', - Settled: 'settled', - Unauthorized: 'unauthorized', -} as const - -export type CopilotAbortOutcomeKey = keyof typeof CopilotAbortOutcome -export type CopilotAbortOutcomeValue = (typeof CopilotAbortOutcome)[CopilotAbortOutcomeKey] + BadRequest: "bad_request", + FallbackPersistFailed: "fallback_persist_failed", + ForceReleased: "force_released", + MissingMessageId: "missing_message_id", + MissingStreamId: "missing_stream_id", + NoChatId: "no_chat_id", + Ok: "ok", + SettleTimeout: "settle_timeout", + Settled: "settled", + Unauthorized: "unauthorized", +} as const; + +export type CopilotAbortOutcomeKey = keyof typeof CopilotAbortOutcome; +export type CopilotAbortOutcomeValue = (typeof CopilotAbortOutcome)[CopilotAbortOutcomeKey]; export const CopilotBranchKind = { - Workflow: 'workflow', - Workspace: 'workspace', -} as const + Workflow: "workflow", + Workspace: "workspace", +} as const; -export type CopilotBranchKindKey = keyof typeof CopilotBranchKind -export type CopilotBranchKindValue = (typeof CopilotBranchKind)[CopilotBranchKindKey] +export type CopilotBranchKindKey = keyof typeof CopilotBranchKind; +export type CopilotBranchKindValue = (typeof CopilotBranchKind)[CopilotBranchKindKey]; export const CopilotChatFinalizeOutcome = { - AppendedAssistant: 'appended_assistant', - AssistantAlreadyPersisted: 'assistant_already_persisted', - ClearedStreamMarkerOnly: 'cleared_stream_marker_only', - StaleUserMessage: 'stale_user_message', -} as const + AppendedAssistant: "appended_assistant", + AssistantAlreadyPersisted: "assistant_already_persisted", + ClearedStreamMarkerOnly: "cleared_stream_marker_only", + StaleUserMessage: "stale_user_message", +} as const; -export type CopilotChatFinalizeOutcomeKey = keyof typeof CopilotChatFinalizeOutcome +export type CopilotChatFinalizeOutcomeKey = keyof typeof CopilotChatFinalizeOutcome; export type CopilotChatFinalizeOutcomeValue = - (typeof CopilotChatFinalizeOutcome)[CopilotChatFinalizeOutcomeKey] + (typeof CopilotChatFinalizeOutcome)[CopilotChatFinalizeOutcomeKey]; export const CopilotChatPersistOutcome = { - Appended: 'appended', - ChatNotFound: 'chat_not_found', -} as const + Appended: "appended", + ChatNotFound: "chat_not_found", +} as const; -export type CopilotChatPersistOutcomeKey = keyof typeof CopilotChatPersistOutcome -export type CopilotChatPersistOutcomeValue = - (typeof CopilotChatPersistOutcome)[CopilotChatPersistOutcomeKey] +export type CopilotChatPersistOutcomeKey = keyof typeof CopilotChatPersistOutcome; +export type CopilotChatPersistOutcomeValue = (typeof CopilotChatPersistOutcome)[CopilotChatPersistOutcomeKey]; export const CopilotConfirmOutcome = { - Delivered: 'delivered', - Forbidden: 'forbidden', - InternalError: 'internal_error', - RunNotFound: 'run_not_found', - ToolCallNotFound: 'tool_call_not_found', - Unauthorized: 'unauthorized', - UpdateFailed: 'update_failed', - ValidationError: 'validation_error', -} as const - -export type CopilotConfirmOutcomeKey = keyof typeof CopilotConfirmOutcome -export type CopilotConfirmOutcomeValue = (typeof CopilotConfirmOutcome)[CopilotConfirmOutcomeKey] + Delivered: "delivered", + Forbidden: "forbidden", + InternalError: "internal_error", + RunNotFound: "run_not_found", + ToolCallNotFound: "tool_call_not_found", + Unauthorized: "unauthorized", + UpdateFailed: "update_failed", + ValidationError: "validation_error", +} as const; + +export type CopilotConfirmOutcomeKey = keyof typeof CopilotConfirmOutcome; +export type CopilotConfirmOutcomeValue = (typeof CopilotConfirmOutcome)[CopilotConfirmOutcomeKey]; export const CopilotDegradedReason = { - BindingRejected: 'binding_rejected', - ClientPickupTimeout: 'client_pickup_timeout', - MissingToolResult: 'missing_tool_result', - StreamDeadBeforeDispatch: 'stream_dead_before_dispatch', -} as const + BindingRejected: "binding_rejected", + ClientPickupTimeout: "client_pickup_timeout", + MissingToolResult: "missing_tool_result", + StreamDeadBeforeDispatch: "stream_dead_before_dispatch", +} as const; -export type CopilotDegradedReasonKey = keyof typeof CopilotDegradedReason -export type CopilotDegradedReasonValue = (typeof CopilotDegradedReason)[CopilotDegradedReasonKey] +export type CopilotDegradedReasonKey = keyof typeof CopilotDegradedReason; +export type CopilotDegradedReasonValue = (typeof CopilotDegradedReason)[CopilotDegradedReasonKey]; export const CopilotFinalizeOutcome = { - Aborted: 'aborted', - Error: 'error', - Success: 'success', -} as const + Aborted: "aborted", + Error: "error", + Success: "success", +} as const; -export type CopilotFinalizeOutcomeKey = keyof typeof CopilotFinalizeOutcome -export type CopilotFinalizeOutcomeValue = (typeof CopilotFinalizeOutcome)[CopilotFinalizeOutcomeKey] +export type CopilotFinalizeOutcomeKey = keyof typeof CopilotFinalizeOutcome; +export type CopilotFinalizeOutcomeValue = (typeof CopilotFinalizeOutcome)[CopilotFinalizeOutcomeKey]; export const CopilotLeg = { - SimToGo: 'sim_to_go', -} as const + SimToGo: "sim_to_go", +} as const; -export type CopilotLegKey = keyof typeof CopilotLeg -export type CopilotLegValue = (typeof CopilotLeg)[CopilotLegKey] +export type CopilotLegKey = keyof typeof CopilotLeg; +export type CopilotLegValue = (typeof CopilotLeg)[CopilotLegKey]; export const CopilotOutputFileOutcome = { - Failed: 'failed', - Uploaded: 'uploaded', -} as const + Failed: "failed", + Uploaded: "uploaded", +} as const; -export type CopilotOutputFileOutcomeKey = keyof typeof CopilotOutputFileOutcome -export type CopilotOutputFileOutcomeValue = - (typeof CopilotOutputFileOutcome)[CopilotOutputFileOutcomeKey] +export type CopilotOutputFileOutcomeKey = keyof typeof CopilotOutputFileOutcome; +export type CopilotOutputFileOutcomeValue = (typeof CopilotOutputFileOutcome)[CopilotOutputFileOutcomeKey]; export const CopilotRecoveryOutcome = { - GapDetected: 'gap_detected', - InRange: 'in_range', -} as const + GapDetected: "gap_detected", + InRange: "in_range", +} as const; -export type CopilotRecoveryOutcomeKey = keyof typeof CopilotRecoveryOutcome -export type CopilotRecoveryOutcomeValue = (typeof CopilotRecoveryOutcome)[CopilotRecoveryOutcomeKey] +export type CopilotRecoveryOutcomeKey = keyof typeof CopilotRecoveryOutcome; +export type CopilotRecoveryOutcomeValue = (typeof CopilotRecoveryOutcome)[CopilotRecoveryOutcomeKey]; export const CopilotRequestCancelReason = { - ClientDisconnect: 'client_disconnect', - ExplicitStop: 'explicit_stop', - Timeout: 'timeout', - Unknown: 'unknown', -} as const + ClientDisconnect: "client_disconnect", + ExplicitStop: "explicit_stop", + Timeout: "timeout", + Unknown: "unknown", +} as const; -export type CopilotRequestCancelReasonKey = keyof typeof CopilotRequestCancelReason +export type CopilotRequestCancelReasonKey = keyof typeof CopilotRequestCancelReason; export type CopilotRequestCancelReasonValue = - (typeof CopilotRequestCancelReason)[CopilotRequestCancelReasonKey] + (typeof CopilotRequestCancelReason)[CopilotRequestCancelReasonKey]; export const CopilotResourcesOp = { - Delete: 'delete', - None: 'none', - Upsert: 'upsert', -} as const + Delete: "delete", + None: "none", + Upsert: "upsert", +} as const; -export type CopilotResourcesOpKey = keyof typeof CopilotResourcesOp -export type CopilotResourcesOpValue = (typeof CopilotResourcesOp)[CopilotResourcesOpKey] +export type CopilotResourcesOpKey = keyof typeof CopilotResourcesOp; +export type CopilotResourcesOpValue = (typeof CopilotResourcesOp)[CopilotResourcesOpKey]; export const CopilotResumeOutcome = { - BatchDelivered: 'batch_delivered', - ClientDisconnected: 'client_disconnected', - EndedWithoutTerminal: 'ended_without_terminal', - StreamNotFound: 'stream_not_found', - TerminalDelivered: 'terminal_delivered', -} as const + BatchDelivered: "batch_delivered", + ClientDisconnected: "client_disconnected", + EndedWithoutTerminal: "ended_without_terminal", + StreamNotFound: "stream_not_found", + TerminalDelivered: "terminal_delivered", +} as const; -export type CopilotResumeOutcomeKey = keyof typeof CopilotResumeOutcome -export type CopilotResumeOutcomeValue = (typeof CopilotResumeOutcome)[CopilotResumeOutcomeKey] +export type CopilotResumeOutcomeKey = keyof typeof CopilotResumeOutcome; +export type CopilotResumeOutcomeValue = (typeof CopilotResumeOutcome)[CopilotResumeOutcomeKey]; export const CopilotSseCloseReason = { - Aborted: 'aborted', - BackendError: 'backend_error', - BillingLimit: 'billing_limit', - ClosedNoTerminal: 'closed_no_terminal', - Error: 'error', - Terminal: 'terminal', - Timeout: 'timeout', -} as const - -export type CopilotSseCloseReasonKey = keyof typeof CopilotSseCloseReason -export type CopilotSseCloseReasonValue = (typeof CopilotSseCloseReason)[CopilotSseCloseReasonKey] + Aborted: "aborted", + BackendError: "backend_error", + BillingLimit: "billing_limit", + ClosedNoTerminal: "closed_no_terminal", + Error: "error", + Terminal: "terminal", + Timeout: "timeout", +} as const; + +export type CopilotSseCloseReasonKey = keyof typeof CopilotSseCloseReason; +export type CopilotSseCloseReasonValue = (typeof CopilotSseCloseReason)[CopilotSseCloseReasonKey]; export const CopilotSteerOutcome = { - BadRequest: 'bad_request', - MissingContent: 'missing_content', - MissingMessageId: 'missing_message_id', - NoActiveTurn: 'no_active_turn', - QueueFull: 'queue_full', - Queued: 'queued', -} as const + BadRequest: "bad_request", + MissingContent: "missing_content", + MissingMessageId: "missing_message_id", + NoActiveTurn: "no_active_turn", + QueueFull: "queue_full", + Queued: "queued", +} as const; -export type CopilotSteerOutcomeKey = keyof typeof CopilotSteerOutcome -export type CopilotSteerOutcomeValue = (typeof CopilotSteerOutcome)[CopilotSteerOutcomeKey] +export type CopilotSteerOutcomeKey = keyof typeof CopilotSteerOutcome; +export type CopilotSteerOutcomeValue = (typeof CopilotSteerOutcome)[CopilotSteerOutcomeKey]; export const CopilotStopOutcome = { - ChatNotFound: 'chat_not_found', - InternalError: 'internal_error', - NoMatchingRow: 'no_matching_row', - Persisted: 'persisted', - Unauthorized: 'unauthorized', - ValidationError: 'validation_error', -} as const + ChatNotFound: "chat_not_found", + InternalError: "internal_error", + NoMatchingRow: "no_matching_row", + Persisted: "persisted", + Unauthorized: "unauthorized", + ValidationError: "validation_error", +} as const; -export type CopilotStopOutcomeKey = keyof typeof CopilotStopOutcome -export type CopilotStopOutcomeValue = (typeof CopilotStopOutcome)[CopilotStopOutcomeKey] +export type CopilotStopOutcomeKey = keyof typeof CopilotStopOutcome; +export type CopilotStopOutcomeValue = (typeof CopilotStopOutcome)[CopilotStopOutcomeKey]; export const CopilotSurface = { - Copilot: 'copilot', - Mothership: 'mothership', -} as const + Copilot: "copilot", + Mothership: "mothership", +} as const; -export type CopilotSurfaceKey = keyof typeof CopilotSurface -export type CopilotSurfaceValue = (typeof CopilotSurface)[CopilotSurfaceKey] +export type CopilotSurfaceKey = keyof typeof CopilotSurface; +export type CopilotSurfaceValue = (typeof CopilotSurface)[CopilotSurfaceKey]; export const CopilotTableOutcome = { - EmptyContent: 'empty_content', - EmptyRows: 'empty_rows', - Failed: 'failed', - Imported: 'imported', - InvalidJsonShape: 'invalid_json_shape', - InvalidShape: 'invalid_shape', - RowLimitExceeded: 'row_limit_exceeded', - TableNotFound: 'table_not_found', - Wrote: 'wrote', -} as const - -export type CopilotTableOutcomeKey = keyof typeof CopilotTableOutcome -export type CopilotTableOutcomeValue = (typeof CopilotTableOutcome)[CopilotTableOutcomeKey] + EmptyContent: "empty_content", + EmptyRows: "empty_rows", + Failed: "failed", + Imported: "imported", + InvalidJsonShape: "invalid_json_shape", + InvalidShape: "invalid_shape", + RowLimitExceeded: "row_limit_exceeded", + TableNotFound: "table_not_found", + Wrote: "wrote", +} as const; + +export type CopilotTableOutcomeKey = keyof typeof CopilotTableOutcome; +export type CopilotTableOutcomeValue = (typeof CopilotTableOutcome)[CopilotTableOutcomeKey]; export const CopilotTableSourceFormat = { - Csv: 'csv', - Json: 'json', -} as const + Csv: "csv", + Json: "json", +} as const; -export type CopilotTableSourceFormatKey = keyof typeof CopilotTableSourceFormat -export type CopilotTableSourceFormatValue = - (typeof CopilotTableSourceFormat)[CopilotTableSourceFormatKey] +export type CopilotTableSourceFormatKey = keyof typeof CopilotTableSourceFormat; +export type CopilotTableSourceFormatValue = (typeof CopilotTableSourceFormat)[CopilotTableSourceFormatKey]; export const CopilotTransport = { - Batch: 'batch', - Headless: 'headless', - Stream: 'stream', -} as const + Batch: "batch", + Headless: "headless", + Stream: "stream", +} as const; -export type CopilotTransportKey = keyof typeof CopilotTransport -export type CopilotTransportValue = (typeof CopilotTransport)[CopilotTransportKey] +export type CopilotTransportKey = keyof typeof CopilotTransport; +export type CopilotTransportValue = (typeof CopilotTransport)[CopilotTransportKey]; export const CopilotValidateOutcome = { - InternalAuthFailed: 'internal_auth_failed', - InternalError: 'internal_error', - InvalidBody: 'invalid_body', - Ok: 'ok', - UsageExceeded: 'usage_exceeded', - UserNotFound: 'user_not_found', -} as const + InternalAuthFailed: "internal_auth_failed", + InternalError: "internal_error", + InvalidBody: "invalid_body", + Ok: "ok", + UsageExceeded: "usage_exceeded", + UserNotFound: "user_not_found", +} as const; -export type CopilotValidateOutcomeKey = keyof typeof CopilotValidateOutcome -export type CopilotValidateOutcomeValue = (typeof CopilotValidateOutcome)[CopilotValidateOutcomeKey] +export type CopilotValidateOutcomeKey = keyof typeof CopilotValidateOutcome; +export type CopilotValidateOutcomeValue = (typeof CopilotValidateOutcome)[CopilotValidateOutcomeKey]; export const CopilotVfsOutcome = { - PassthroughFitsBudget: 'passthrough_fits_budget', - PassthroughNoMetadata: 'passthrough_no_metadata', - PassthroughNoSharp: 'passthrough_no_sharp', - RejectedNoMetadata: 'rejected_no_metadata', - RejectedNoSharp: 'rejected_no_sharp', - RejectedTooLargeAfterResize: 'rejected_too_large_after_resize', - Resized: 'resized', -} as const - -export type CopilotVfsOutcomeKey = keyof typeof CopilotVfsOutcome -export type CopilotVfsOutcomeValue = (typeof CopilotVfsOutcome)[CopilotVfsOutcomeKey] + PassthroughFitsBudget: "passthrough_fits_budget", + PassthroughNoMetadata: "passthrough_no_metadata", + PassthroughNoSharp: "passthrough_no_sharp", + RejectedNoMetadata: "rejected_no_metadata", + RejectedNoSharp: "rejected_no_sharp", + RejectedTooLargeAfterResize: "rejected_too_large_after_resize", + Resized: "resized", +} as const; + +export type CopilotVfsOutcomeKey = keyof typeof CopilotVfsOutcome; +export type CopilotVfsOutcomeValue = (typeof CopilotVfsOutcome)[CopilotVfsOutcomeKey]; export const CopilotVfsReadOutcome = { - BinaryPlaceholder: 'binary_placeholder', - DocumentParsed: 'document_parsed', - DocumentTooLarge: 'document_too_large', - ImagePrepared: 'image_prepared', - ImageTooLarge: 'image_too_large', - ParseFailed: 'parse_failed', - ReadFailed: 'read_failed', - TextRead: 'text_read', - TextTooLarge: 'text_too_large', -} as const - -export type CopilotVfsReadOutcomeKey = keyof typeof CopilotVfsReadOutcome -export type CopilotVfsReadOutcomeValue = (typeof CopilotVfsReadOutcome)[CopilotVfsReadOutcomeKey] + BinaryPlaceholder: "binary_placeholder", + DocumentParsed: "document_parsed", + DocumentTooLarge: "document_too_large", + ImagePrepared: "image_prepared", + ImageTooLarge: "image_too_large", + ParseFailed: "parse_failed", + ReadFailed: "read_failed", + TextRead: "text_read", + TextTooLarge: "text_too_large", +} as const; + +export type CopilotVfsReadOutcomeKey = keyof typeof CopilotVfsReadOutcome; +export type CopilotVfsReadOutcomeValue = (typeof CopilotVfsReadOutcome)[CopilotVfsReadOutcomeKey]; export const CopilotVfsReadPath = { - Binary: 'binary', - Image: 'image', - ParseableDocument: 'parseable_document', - Text: 'text', -} as const + Binary: "binary", + Image: "image", + ParseableDocument: "parseable_document", + Text: "text", +} as const; -export type CopilotVfsReadPathKey = keyof typeof CopilotVfsReadPath -export type CopilotVfsReadPathValue = (typeof CopilotVfsReadPath)[CopilotVfsReadPathKey] +export type CopilotVfsReadPathKey = keyof typeof CopilotVfsReadPath; +export type CopilotVfsReadPathValue = (typeof CopilotVfsReadPath)[CopilotVfsReadPathKey]; export const LlmErrorStage = { - BuildRequest: 'build_request', - Decode: 'decode', - HttpBuild: 'http_build', - HttpStatus: 'http_status', - Invoke: 'invoke', - MarshalRequest: 'marshal_request', - StreamClose: 'stream_close', -} as const - -export type LlmErrorStageKey = keyof typeof LlmErrorStage -export type LlmErrorStageValue = (typeof LlmErrorStage)[LlmErrorStageKey] + BuildRequest: "build_request", + Decode: "decode", + HttpBuild: "http_build", + HttpStatus: "http_status", + Invoke: "invoke", + MarshalRequest: "marshal_request", + StreamClose: "stream_close", +} as const; + +export type LlmErrorStageKey = keyof typeof LlmErrorStage; +export type LlmErrorStageValue = (typeof LlmErrorStage)[LlmErrorStageKey]; export const PromptComponent = { - ActiveSkills: 'active_skills', - AgentGuidance: 'agent_guidance', - Capabilities: 'capabilities', - Credentials: 'credentials', - DesktopContext: 'desktop_context', - ExternalTools: 'external_tools', - Files: 'files', - History: 'history', - Override: 'override', - PermissionsContext: 'permissions_context', - Persona: 'persona', - Policies: 'policies', - RuntimeTail: 'runtime_tail', - SessionContext: 'session_context', - SkillsIndex: 'skills_index', - SpawnContext: 'spawn_context', - Steering: 'steering', - SubagentDocs: 'subagent_docs', - SubagentRegistry: 'subagent_registry', - TaggedResources: 'tagged_resources', - TimeContext: 'time_context', - ToolDocs: 'tool_docs', - ToolResults: 'tool_results', - ToolsWire: 'tools_wire', - Vfs: 'vfs', - WorkflowContext: 'workflow_context', - WorkspaceGuide: 'workspace_guide', - WorkspaceInventory: 'workspace_inventory', -} as const - -export type PromptComponentKey = keyof typeof PromptComponent -export type PromptComponentValue = (typeof PromptComponent)[PromptComponentKey] + ActiveSkills: "active_skills", + AgentGuidance: "agent_guidance", + Capabilities: "capabilities", + Credentials: "credentials", + DesktopContext: "desktop_context", + ExternalTools: "external_tools", + Files: "files", + History: "history", + Override: "override", + PermissionsContext: "permissions_context", + Persona: "persona", + Policies: "policies", + RuntimeTail: "runtime_tail", + SessionContext: "session_context", + SkillsIndex: "skills_index", + SpawnContext: "spawn_context", + Steering: "steering", + SubagentDocs: "subagent_docs", + SubagentRegistry: "subagent_registry", + TaggedResources: "tagged_resources", + TimeContext: "time_context", + ToolDocs: "tool_docs", + ToolResults: "tool_results", + ToolsWire: "tools_wire", + Vfs: "vfs", + WorkflowContext: "workflow_context", + WorkspaceGuide: "workspace_guide", + WorkspaceInventory: "workspace_inventory", +} as const; + +export type PromptComponentKey = keyof typeof PromptComponent; +export type PromptComponentValue = (typeof PromptComponent)[PromptComponentKey]; export const RateLimitOutcome = { - Allowed: 'allowed', - IncrError: 'incr_error', - Limited: 'limited', -} as const + Allowed: "allowed", + IncrError: "incr_error", + Limited: "limited", +} as const; -export type RateLimitOutcomeKey = keyof typeof RateLimitOutcome -export type RateLimitOutcomeValue = (typeof RateLimitOutcome)[RateLimitOutcomeKey] +export type RateLimitOutcomeKey = keyof typeof RateLimitOutcome; +export type RateLimitOutcomeValue = (typeof RateLimitOutcome)[RateLimitOutcomeKey]; export const SubagentExecutionPhase = { - Continuation: 'continuation', - Initial: 'initial', -} as const + Continuation: "continuation", + Initial: "initial", +} as const; -export type SubagentExecutionPhaseKey = keyof typeof SubagentExecutionPhase -export type SubagentExecutionPhaseValue = (typeof SubagentExecutionPhase)[SubagentExecutionPhaseKey] +export type SubagentExecutionPhaseKey = keyof typeof SubagentExecutionPhase; +export type SubagentExecutionPhaseValue = (typeof SubagentExecutionPhase)[SubagentExecutionPhaseKey]; export const SubagentSessionOperation = { - Ephemeral: 'ephemeral', - New: 'new', - Resume: 'resume', -} as const + Ephemeral: "ephemeral", + New: "new", + Resume: "resume", +} as const; -export type SubagentSessionOperationKey = keyof typeof SubagentSessionOperation -export type SubagentSessionOperationValue = - (typeof SubagentSessionOperation)[SubagentSessionOperationKey] +export type SubagentSessionOperationKey = keyof typeof SubagentSessionOperation; +export type SubagentSessionOperationValue = (typeof SubagentSessionOperation)[SubagentSessionOperationKey]; export const SubagentSessionPersistenceOutcome = { - Deferred: 'deferred', - Failed: 'failed', - NotApplicable: 'not_applicable', - NotAttempted: 'not_attempted', - Succeeded: 'succeeded', -} as const - -export type SubagentSessionPersistenceOutcomeKey = keyof typeof SubagentSessionPersistenceOutcome + Deferred: "deferred", + Failed: "failed", + NotApplicable: "not_applicable", + NotAttempted: "not_attempted", + Succeeded: "succeeded", +} as const; + +export type SubagentSessionPersistenceOutcomeKey = keyof typeof SubagentSessionPersistenceOutcome; export type SubagentSessionPersistenceOutcomeValue = - (typeof SubagentSessionPersistenceOutcome)[SubagentSessionPersistenceOutcomeKey] + (typeof SubagentSessionPersistenceOutcome)[SubagentSessionPersistenceOutcomeKey]; export const ToolAsyncWaiterResolution = { - ContextCancelled: 'context_cancelled', - Poll: 'poll', - Pubsub: 'pubsub', - StoredAfterClose: 'stored_after_close', - StoredBeforeSubscribe: 'stored_before_subscribe', - StoredPostSubscribe: 'stored_post_subscribe', - SubscriptionClosed: 'subscription_closed', - Unknown: 'unknown', -} as const - -export type ToolAsyncWaiterResolutionKey = keyof typeof ToolAsyncWaiterResolution -export type ToolAsyncWaiterResolutionValue = - (typeof ToolAsyncWaiterResolution)[ToolAsyncWaiterResolutionKey] + ContextCancelled: "context_cancelled", + Poll: "poll", + Pubsub: "pubsub", + StoredAfterClose: "stored_after_close", + StoredBeforeSubscribe: "stored_before_subscribe", + StoredPostSubscribe: "stored_post_subscribe", + SubscriptionClosed: "subscription_closed", + Unknown: "unknown", +} as const; + +export type ToolAsyncWaiterResolutionKey = keyof typeof ToolAsyncWaiterResolution; +export type ToolAsyncWaiterResolutionValue = (typeof ToolAsyncWaiterResolution)[ToolAsyncWaiterResolutionKey]; export const ToolErrorKind = { - Dispatch: 'dispatch', - NotFound: 'not_found', -} as const + Dispatch: "dispatch", + NotFound: "not_found", +} as const; -export type ToolErrorKindKey = keyof typeof ToolErrorKind -export type ToolErrorKindValue = (typeof ToolErrorKind)[ToolErrorKindKey] +export type ToolErrorKindKey = keyof typeof ToolErrorKind; +export type ToolErrorKindValue = (typeof ToolErrorKind)[ToolErrorKindKey]; export const ToolExecutor = { - Client: 'client', - Go: 'go', - Sim: 'sim', -} as const + Client: "client", + Go: "go", + Sim: "sim", +} as const; -export type ToolExecutorKey = keyof typeof ToolExecutor -export type ToolExecutorValue = (typeof ToolExecutor)[ToolExecutorKey] +export type ToolExecutorKey = keyof typeof ToolExecutor; +export type ToolExecutorValue = (typeof ToolExecutor)[ToolExecutorKey]; export const ToolStoreStatus = { - Cancelled: 'cancelled', - Completed: 'completed', - Failed: 'failed', - Pending: 'pending', -} as const - -export type ToolStoreStatusKey = keyof typeof ToolStoreStatus -export type ToolStoreStatusValue = (typeof ToolStoreStatus)[ToolStoreStatusKey] + Cancelled: "cancelled", + Completed: "completed", + Failed: "failed", + Pending: "pending", +} as const; + +export type ToolStoreStatusKey = keyof typeof ToolStoreStatus; +export type ToolStoreStatusValue = (typeof ToolStoreStatus)[ToolStoreStatusKey]; diff --git a/apps/sim/lib/mothership/generated/trace-attributes-v1.ts b/apps/sim/lib/mothership/generated/trace-attributes-v1.ts index df4a808f809..15c3331dacf 100644 --- a/apps/sim/lib/mothership/generated/trace-attributes-v1.ts +++ b/apps/sim/lib/mothership/generated/trace-attributes-v1.ts @@ -1,1387 +1,1373 @@ -// AUTO-GENERATED FILE. DO NOT EDIT. -// -// Source: copilot/copilot/contracts/trace-attributes-v1.schema.json -// Regenerate with: bun run trace-attributes-contract:generate -// -// Canonical custom mothership OTel span attribute keys. Call sites -// should reference `TraceAttr.` (e.g. -// `TraceAttr.ChatId`, `TraceAttr.ToolCallId`) rather than raw -// string literals, so the Go-side contract is the single source of -// truth and typos become compile errors. -// -// For OTel semantic-convention keys (`http.*`, `db.*`, -// `gen_ai.*`, `net.*`, `messaging.*`, `service.*`, -// `deployment.environment`), import from -// `@opentelemetry/semantic-conventions` directly — those are owned -// by the upstream OTel spec, not by this contract. +// GENERATED — do not edit. Source of truth: mothership worker packages/contracts/src/trace-attributes-v1.ts +// Regenerate with `bun run contracts:sync` in the worker. + +// Canonical custom mothership OTel span attribute keys Sim emits. Call sites reference +// `TraceAttr.` rather than raw strings so typos are compile errors. OTel +// semantic-convention keys (`http.*`, `db.*`, `gen_ai.*`, ...) come from +// `@opentelemetry/semantic-conventions`, not here. export const TraceAttr = { - AbortBackend: 'abort.backend', - AbortFound: 'abort.found', - AbortRedisResult: 'abort.redis_result', - AnalyticsAborted: 'analytics.aborted', - AnalyticsBilledCacheReadCost: 'analytics.billed_cache_read_cost', - AnalyticsBilledCacheWriteCost: 'analytics.billed_cache_write_cost', - AnalyticsBilledInputCost: 'analytics.billed_input_cost', - AnalyticsBilledOutputCost: 'analytics.billed_output_cost', - AnalyticsBilledTotalCost: 'analytics.billed_total_cost', - AnalyticsCacheAttemptedRequests: 'analytics.cache_attempted_requests', - AnalyticsCacheHitRequests: 'analytics.cache_hit_requests', - AnalyticsCacheReadTokens: 'analytics.cache_read_tokens', - AnalyticsCacheWriteRequests: 'analytics.cache_write_requests', - AnalyticsCacheWriteTokens: 'analytics.cache_write_tokens', - AnalyticsCustomerType: 'analytics.customer_type', - AnalyticsDurationMs: 'analytics.duration_ms', - AnalyticsError: 'analytics.error', - AnalyticsInputTokens: 'analytics.input_tokens', - AnalyticsModel: 'analytics.model', - AnalyticsOutputTokens: 'analytics.output_tokens', - AnalyticsProvider: 'analytics.provider', - AnalyticsRawCacheReadCost: 'analytics.raw_cache_read_cost', - AnalyticsRawCacheWriteCost: 'analytics.raw_cache_write_cost', - AnalyticsRawInputCost: 'analytics.raw_input_cost', - AnalyticsRawOutputCost: 'analytics.raw_output_cost', - AnalyticsRawTotalCost: 'analytics.raw_total_cost', - AnalyticsSource: 'analytics.source', - AnalyticsToolCallCount: 'analytics.tool_call_count', - ApiKeyId: 'api_key.id', - ApiKeyName: 'api_key.name', - AuthIncomingInternal: 'auth.incoming_internal', - AuthKeyMatch: 'auth.key.match', - AuthKeyPreview: 'auth.key.preview', - AuthKeySource: 'auth.key.source', - AuthKeyType: 'auth.key.type', - AuthProvider: 'auth.provider', - AuthValidateStatusCode: 'auth.validate.status_code', - AwsRegion: 'aws.region', - BillingAttempts: 'billing.attempts', - BillingByok: 'billing.byok', - BillingChangeType: 'billing.change_type', - BillingCostInputUsd: 'billing.cost.input_usd', - BillingCostOutputUsd: 'billing.cost.output_usd', - BillingCostTotalUsd: 'billing.cost.total_usd', - BillingCostUsd: 'billing.cost_usd', - BillingCustomerType: 'billing.customer_type', - BillingDuplicate: 'billing.duplicate', - BillingDurationMs: 'billing.duration_ms', - BillingHasIdempotencyKey: 'billing.has_idempotency_key', - BillingIdempotencyKey: 'billing.idempotency_key', - BillingInterval: 'billing.interval', - BillingIsMcp: 'billing.is_mcp', - BillingLlmCost: 'billing.llm_cost', - BillingLongContext: 'billing.long_context', - BillingNewPlan: 'billing.new_plan', - BillingOutcome: 'billing.outcome', - BillingPlan: 'billing.plan', - BillingPreviousPlan: 'billing.previous_plan', - BillingServiceCharges: 'billing.service_charges', - BillingSource: 'billing.source', - BillingTotalCost: 'billing.total_cost', - BillingUsageCurrent: 'billing.usage.current', - BillingUsageExceeded: 'billing.usage.exceeded', - BillingUsageLimit: 'billing.usage.limit', - BlockId: 'block.id', - BlockName: 'block.name', - BlockType: 'block.type', - ChatActiveMessagesBytes: 'chat.active_messages_bytes', - ChatActiveMessagesCount: 'chat.active_messages_count', - ChatAppendBytes: 'chat.append_bytes', - ChatAppendCount: 'chat.append_count', - ChatArtifactKeys: 'chat.artifact_keys', - ChatArtifactsBytes: 'chat.artifacts_bytes', - ChatAuthType: 'chat.auth_type', - ChatBlobOp: 'chat.blob.op', - ChatBlobSite: 'chat.blob.site', - ChatBlobBytesOffloaded: 'chat.blob_bytes_offloaded', - ChatBlobBytesResolved: 'chat.blob_bytes_resolved', - ChatBlobsOffloaded: 'chat.blobs_offloaded', - ChatBlobsResolved: 'chat.blobs_resolved', - ChatContextCount: 'chat.context_count', - ChatContextUsage: 'chat.context_usage', - ChatContinuationMessagesBefore: 'chat.continuation.messages_before', - ChatContinuationToolResultBytes: 'chat.continuation.tool_result_bytes', - ChatContinuationToolResultFailure: 'chat.continuation.tool_result_failure', - ChatContinuationToolResultSuccess: 'chat.continuation.tool_result_success', - ChatContinuationToolResults: 'chat.continuation.tool_results', - ChatContinuationTotalToolCalls: 'chat.continuation.total_tool_calls', - ChatExistingMessageCount: 'chat.existing_message_count', - ChatFileAttachmentCount: 'chat.file_attachment_count', - ChatFinalizeOutcome: 'chat.finalize.outcome', - ChatFound: 'chat.found', - ChatHasAssistantMessage: 'chat.has_assistant_message', - ChatHasOutputConfigs: 'chat.has_output_configs', - ChatId: 'chat.id', - ChatMessageBytes: 'chat.message_bytes', - ChatMessagesAfter: 'chat.messages_after', - ChatMessagesBytes: 'chat.messages_bytes', - ChatMessagesCount: 'chat.messages_count', - ChatPersistOutcome: 'chat.persist.outcome', - ChatPreexisting: 'chat.preexisting', - ChatRollbackIndex: 'chat.rollback_index', - ChatTokensUsed: 'chat.tokens_used', - ChatType: 'chat.type', - ChatUserMessageId: 'chat.user_message_id', - CheckpointAge: 'checkpoint.age', - CheckpointAttemptsBytes: 'checkpoint.attempts_bytes', - CheckpointBytesAssistantToolUse: 'checkpoint.bytes.assistant_tool_use', - CheckpointBytesCurrentMessages: 'checkpoint.bytes.current_messages', - CheckpointBytesImmediateResults: 'checkpoint.bytes.immediate_results', - CheckpointBytesPendingToolCalls: 'checkpoint.bytes.pending_tool_calls', - CheckpointBytesProviderRequest: 'checkpoint.bytes.provider_request', - CheckpointBytesRequestContext: 'checkpoint.bytes.request_context', - CheckpointBytesToolUsage: 'checkpoint.bytes.tool_usage', - CheckpointCachedCredentialsBytes: 'checkpoint.cached_credentials_bytes', - CheckpointClaimed: 'checkpoint.claimed', - CheckpointClaimedNow: 'checkpoint.claimed_now', - CheckpointCompletedBytes: 'checkpoint.completed_bytes', - CheckpointCompletedSteps: 'checkpoint.completed_steps', - CheckpointCurrentMessages: 'checkpoint.current_messages', - CheckpointDecisionsBytes: 'checkpoint.decisions_bytes', - CheckpointFound: 'checkpoint.found', - CheckpointFrames: 'checkpoint.frames', - CheckpointId: 'checkpoint.id', - CheckpointImmediateResults: 'checkpoint.immediate_results', - CheckpointMessageId: 'checkpoint.message_id', - CheckpointPendingBytes: 'checkpoint.pending_bytes', - CheckpointPendingSteps: 'checkpoint.pending_steps', - CheckpointPendingToolCount: 'checkpoint.pending_tool_count', - CheckpointRows: 'checkpoint.rows', - CheckpointTaskId: 'checkpoint.task_id', - CheckpointTotalToolCalls: 'checkpoint.total_tool_calls', - CheckpointWorkflowSnapshotBytes: 'checkpoint.workflow_snapshot_bytes', - ClientVersion: 'client.version', - ConditionId: 'condition.id', - ConditionName: 'condition.name', - ConditionResult: 'condition.result', - ContextReduceBudgetChars: 'context.reduce.budget_chars', - ContextReduceBudgetSource: 'context.reduce.budget_source', - ContextReduceCaller: 'context.reduce.caller', - ContextReduceDidReduce: 'context.reduce.did_reduce', - ContextReduceInputChars: 'context.reduce.input_chars', - ContextReduceInputMessages: 'context.reduce.input_messages', - ContextReduceOutcome: 'context.reduce.outcome', - ContextReduceOutputChars: 'context.reduce.output_chars', - ContextReduceOutputMessages: 'context.reduce.output_messages', - ContextReduced: 'context.reduced', - ContextSummarizeInputChars: 'context.summarize.input_chars', - ContextSummarizeOutputChars: 'context.summarize.output_chars', - ContextTransformCaller: 'context.transform.caller', - ContextTransformCharsIn: 'context.transform.chars_in', - ContextTransformCharsOut: 'context.transform.chars_out', - ContextTransformDropCount: 'context.transform.drop_count', - ContextTransformDrops: 'context.transform.drops', - ContextTransformMessagesIn: 'context.transform.messages_in', - ContextTransformMessagesOut: 'context.transform.messages_out', - ContextTransformStage: 'context.transform.stage', - CopilotAbortControllerFired: 'copilot.abort.controller_fired', - CopilotAbortGoMarkerOk: 'copilot.abort.go_marker_ok', - CopilotAbortLocalAborted: 'copilot.abort.local_aborted', - CopilotAbortMarkerWritten: 'copilot.abort.marker_written', - CopilotAbortOutcome: 'copilot.abort.outcome', - CopilotAbortUnknownReason: 'copilot.abort.unknown_reason', - CopilotAsyncSubagentAgent: 'copilot.async_subagent.agent', - CopilotAsyncSubagentCount: 'copilot.async_subagent.count', - CopilotAsyncSubagentDeltaChars: 'copilot.async_subagent.delta_chars', - CopilotAsyncSubagentId: 'copilot.async_subagent.id', - CopilotAsyncSubagentReminders: 'copilot.async_subagent.reminders', - CopilotAsyncSubagentSleptMs: 'copilot.async_subagent.slept_ms', - CopilotAsyncSubagentStatus: 'copilot.async_subagent.status', - CopilotAsyncSubagentWaitMode: 'copilot.async_subagent.wait_mode', - CopilotAsyncSubagentWakeReason: 'copilot.async_subagent.wake_reason', - CopilotAsyncToolClaimedBy: 'copilot.async_tool.claimed_by', - CopilotAsyncToolHasError: 'copilot.async_tool.has_error', - CopilotAsyncToolIdsCount: 'copilot.async_tool.ids_count', - CopilotAsyncToolPermissionDecision: 'copilot.async_tool.permission_decision', - CopilotAsyncToolStatus: 'copilot.async_tool.status', - CopilotAsyncToolWorkerId: 'copilot.async_tool.worker_id', - CopilotBranchKind: 'copilot.branch.kind', - CopilotChatIsNew: 'copilot.chat.is_new', - CopilotCheckpointPendingToolCallId: 'copilot.checkpoint.pending_tool_call_id', - CopilotCommandsCount: 'copilot.commands.count', - CopilotConfirmOutcome: 'copilot.confirm.outcome', - CopilotContextsCount: 'copilot.contexts.count', - CopilotDegradedReason: 'copilot.degraded.reason', - CopilotExecutionId: 'copilot.execution.id', - CopilotFileAttachmentsCount: 'copilot.file_attachments.count', - CopilotFinalizeOutcome: 'copilot.finalize.outcome', - CopilotInterruptedPriorStream: 'copilot.interrupted_prior_stream', - CopilotLeg: 'copilot.leg', - CopilotMode: 'copilot.mode', - CopilotOperation: 'copilot.operation', - CopilotOutputFileBytes: 'copilot.output_file.bytes', - CopilotOutputFileFormat: 'copilot.output_file.format', - CopilotOutputFileId: 'copilot.output_file.id', - CopilotOutputFileMimeType: 'copilot.output_file.mime_type', - CopilotOutputFileMode: 'copilot.output_file.mode', - CopilotOutputFileName: 'copilot.output_file.name', - CopilotOutputFileOutcome: 'copilot.output_file.outcome', - CopilotOutputFilePath: 'copilot.output_file.path', - CopilotOutputFileSandboxPath: 'copilot.output_file.sandbox_path', - CopilotPendingStreamWaitMs: 'copilot.pending_stream.wait_ms', - CopilotPrefetch: 'copilot.prefetch', - CopilotPublisherClientDisconnected: 'copilot.publisher.client_disconnected', - CopilotPublisherSawComplete: 'copilot.publisher.saw_complete', - CopilotRecoveryLatestSeq: 'copilot.recovery.latest_seq', - CopilotRecoveryOldestSeq: 'copilot.recovery.oldest_seq', - CopilotRecoveryOutcome: 'copilot.recovery.outcome', - CopilotRecoveryRequestedAfterSeq: 'copilot.recovery.requested_after_seq', - CopilotRequestCancelReason: 'copilot.request.cancel_reason', - CopilotRequestOutcome: 'copilot.request.outcome', - CopilotRequestWillRetryOnStreamError: 'copilot.request.will_retry_on_stream_error', - CopilotResourceAttachmentsCount: 'copilot.resource_attachments.count', - CopilotResourcesAborted: 'copilot.resources.aborted', - CopilotResourcesOp: 'copilot.resources.op', - CopilotResourcesRemovedCount: 'copilot.resources.removed_count', - CopilotResourcesUpsertedCount: 'copilot.resources.upserted_count', - CopilotResultContentBlocks: 'copilot.result.content_blocks', - CopilotResultContentLength: 'copilot.result.content_length', - CopilotResultToolCalls: 'copilot.result.tool_calls', - CopilotResumeAfterCursor: 'copilot.resume.after_cursor', - CopilotResumeDurationMs: 'copilot.resume.duration_ms', - CopilotResumeEventCount: 'copilot.resume.event_count', - CopilotResumeOutcome: 'copilot.resume.outcome', - CopilotResumePollIterations: 'copilot.resume.poll_iterations', - CopilotResumePreviewSessionCount: 'copilot.resume.preview_session_count', - CopilotRoute: 'copilot.route', - CopilotRunAgent: 'copilot.run.agent', - CopilotRunHasCompletedAt: 'copilot.run.has_completed_at', - CopilotRunHasError: 'copilot.run.has_error', - CopilotRunModel: 'copilot.run.model', - CopilotRunParentId: 'copilot.run.parent_id', - CopilotRunProvider: 'copilot.run.provider', - CopilotRunStatus: 'copilot.run.status', - CopilotSseBytesReceived: 'copilot.sse.bytes_received', - CopilotSseChunksReceived: 'copilot.sse.chunks_received', - CopilotSseCloseReason: 'copilot.sse.close_reason', - CopilotSseEventsComplete: 'copilot.sse.events.complete', - CopilotSseEventsError: 'copilot.sse.events.error', - CopilotSseEventsReceived: 'copilot.sse.events.received', - CopilotSseEventsResource: 'copilot.sse.events.resource', - CopilotSseEventsRun: 'copilot.sse.events.run', - CopilotSseEventsSession: 'copilot.sse.events.session', - CopilotSseEventsSpan: 'copilot.sse.events.span', - CopilotSseEventsText: 'copilot.sse.events.text', - CopilotSseEventsTool: 'copilot.sse.events.tool', - CopilotSseExpectedTerminal: 'copilot.sse.expected_terminal', - CopilotSseFirstEventMs: 'copilot.sse.first_event_ms', - CopilotSseLongestDispatchMs: 'copilot.sse.longest_dispatch_ms', - CopilotSseLongestInboundGapMs: 'copilot.sse.longest_inbound_gap_ms', - CopilotSseTerminalEventMissing: 'copilot.sse.terminal_event_missing', - CopilotSseTerminalEventSeen: 'copilot.sse.terminal_event_seen', - CopilotSseTotalDispatchMs: 'copilot.sse.total_dispatch_ms', - CopilotSteerOutcome: 'copilot.steer.outcome', - CopilotSteeringContentChars: 'copilot.steering.content_chars', - CopilotSteeringEntries: 'copilot.steering.entries', - CopilotSteeringMode: 'copilot.steering.mode', - CopilotSteeringSalvagedChars: 'copilot.steering.salvaged_chars', - CopilotStopAppendedAssistant: 'copilot.stop.appended_assistant', - CopilotStopBlocksCount: 'copilot.stop.blocks_count', - CopilotStopContentLength: 'copilot.stop.content_length', - CopilotStopOutcome: 'copilot.stop.outcome', - CopilotStream: 'copilot.stream', - CopilotSurface: 'copilot.surface', - CopilotTableId: 'copilot.table.id', - CopilotTableOutcome: 'copilot.table.outcome', - CopilotTableRowCount: 'copilot.table.row_count', - CopilotTableSourceContentBytes: 'copilot.table.source.content_bytes', - CopilotTableSourceFormat: 'copilot.table.source.format', - CopilotTableSourcePath: 'copilot.table.source.path', - CopilotTraceSpanCount: 'copilot.trace.span_count', - CopilotTransport: 'copilot.transport', - CopilotUserMessagePreview: 'copilot.user.message_preview', - CopilotValidateOutcome: 'copilot.validate.outcome', - CopilotVfsDeltaOutcome: 'copilot.vfs.delta.outcome', - CopilotVfsFileExtension: 'copilot.vfs.file.extension', - CopilotVfsFileMediaType: 'copilot.vfs.file.media_type', - CopilotVfsFileName: 'copilot.vfs.file.name', - CopilotVfsFileSizeBytes: 'copilot.vfs.file.size_bytes', - CopilotVfsHasAlpha: 'copilot.vfs.has_alpha', - CopilotVfsInputBytes: 'copilot.vfs.input.bytes', - CopilotVfsInputHeight: 'copilot.vfs.input.height', - CopilotVfsInputMediaTypeClaimed: 'copilot.vfs.input.media_type_claimed', - CopilotVfsInputMediaTypeDetected: 'copilot.vfs.input.media_type_detected', - CopilotVfsInputWidth: 'copilot.vfs.input.width', - CopilotVfsMaterializeFileCount: 'copilot.vfs.materialize.file_count', - CopilotVfsMaterializePhaseMs: 'copilot.vfs.materialize.phase_ms', - CopilotVfsMetadataFailed: 'copilot.vfs.metadata.failed', - CopilotVfsOutcome: 'copilot.vfs.outcome', - CopilotVfsOutputBytes: 'copilot.vfs.output.bytes', - CopilotVfsOutputMediaType: 'copilot.vfs.output.media_type', - CopilotVfsPhase: 'copilot.vfs.phase', - CopilotVfsReadImageResized: 'copilot.vfs.read.image.resized', - CopilotVfsReadOutcome: 'copilot.vfs.read.outcome', - CopilotVfsReadOutputBytes: 'copilot.vfs.read.output.bytes', - CopilotVfsReadOutputLines: 'copilot.vfs.read.output.lines', - CopilotVfsReadOutputMediaType: 'copilot.vfs.read.output.media_type', - CopilotVfsReadPath: 'copilot.vfs.read.path', - CopilotVfsResizeAttempts: 'copilot.vfs.resize.attempts', - CopilotVfsResizeChosenDimension: 'copilot.vfs.resize.chosen_dimension', - CopilotVfsResizeChosenQuality: 'copilot.vfs.resize.chosen_quality', - CopilotVfsResizeDimension: 'copilot.vfs.resize.dimension', - CopilotVfsResizeFitsBudget: 'copilot.vfs.resize.fits_budget', - CopilotVfsResizeOutputBytes: 'copilot.vfs.resize.output_bytes', - CopilotVfsResizeQuality: 'copilot.vfs.resize.quality', - CopilotVfsResized: 'copilot.vfs.resized', - CopilotVfsSharpLoadFailed: 'copilot.vfs.sharp.load_failed', - CostDefaultCost: 'cost.default_cost', - CredentialSetId: 'credential_set.id', - CredentialSetName: 'credential_set.name', - DbOperation: 'db.operation', - DbSqlTable: 'db.sql.table', - DbSystem: 'db.system', - DeploymentEnvironment: 'deployment.environment', - DeploymentVersion: 'deployment.version', - DocumentFileSize: 'document.file_size', - DocumentMimeType: 'document.mime_type', - DocumentsCount: 'documents.count', - DocumentsUploadType: 'documents.upload_type', - Error: 'error', - ErrorCode: 'error.code', - ErrorInternal: 'error.internal', - ErrorMessage: 'error.message', - ErrorType: 'error.type', - EventName: 'event.name', - EventTimestamp: 'event.timestamp', - ExecutionBlocksExecuted: 'execution.blocks_executed', - ExecutionDurationMs: 'execution.duration_ms', - ExecutionErrorMessage: 'execution.error_message', - ExecutionHasErrors: 'execution.has_errors', - ExecutionStatus: 'execution.status', - ExecutionTotalCost: 'execution.total_cost', - ExecutionTrigger: 'execution.trigger', - FunctionExecutionTimeMs: 'function.execution_time_ms', - FunctionId: 'function.id', - FunctionName: 'function.name', - GenAiAgentId: 'gen_ai.agent.id', - GenAiAgentName: 'gen_ai.agent.name', - GenAiCacheOutcome: 'gen_ai.cache.outcome', - GenAiCacheTokenType: 'gen_ai.cache.token.type', - GenAiCostInput: 'gen_ai.cost.input', - GenAiCostOutput: 'gen_ai.cost.output', - GenAiCostTotal: 'gen_ai.cost.total', - GenAiInputMessages: 'gen_ai.input.messages', - GenAiOperationName: 'gen_ai.operation.name', - GenAiOutputMessages: 'gen_ai.output.messages', - GenAiProviderName: 'gen_ai.provider.name', - GenAiRequestAssistantMessages: 'gen_ai.request.assistant_messages', - GenAiRequestCacheableSystemBlocks: 'gen_ai.request.cacheable_system_blocks', - GenAiRequestContentBlocks: 'gen_ai.request.content_blocks', - GenAiRequestHasCacheControl: 'gen_ai.request.has_cache_control', - GenAiRequestImageBlocks: 'gen_ai.request.image_blocks', - GenAiRequestImageDataBytes: 'gen_ai.request.image_data_bytes', - GenAiRequestMaxMessageBlocks: 'gen_ai.request.max_message_blocks', - GenAiRequestMessagesCount: 'gen_ai.request.messages.count', - GenAiRequestModel: 'gen_ai.request.model', - GenAiRequestPromptCacheBreakpointCreated: 'gen_ai.request.prompt_cache.breakpoint.created', + AbortBackend: "abort.backend", + AbortFound: "abort.found", + AbortRedisResult: "abort.redis_result", + AnalyticsAborted: "analytics.aborted", + AnalyticsBilledCacheReadCost: "analytics.billed_cache_read_cost", + AnalyticsBilledCacheWriteCost: "analytics.billed_cache_write_cost", + AnalyticsBilledInputCost: "analytics.billed_input_cost", + AnalyticsBilledOutputCost: "analytics.billed_output_cost", + AnalyticsBilledTotalCost: "analytics.billed_total_cost", + AnalyticsCacheAttemptedRequests: "analytics.cache_attempted_requests", + AnalyticsCacheHitRequests: "analytics.cache_hit_requests", + AnalyticsCacheReadTokens: "analytics.cache_read_tokens", + AnalyticsCacheWriteRequests: "analytics.cache_write_requests", + AnalyticsCacheWriteTokens: "analytics.cache_write_tokens", + AnalyticsCustomerType: "analytics.customer_type", + AnalyticsDurationMs: "analytics.duration_ms", + AnalyticsError: "analytics.error", + AnalyticsInputTokens: "analytics.input_tokens", + AnalyticsModel: "analytics.model", + AnalyticsOutputTokens: "analytics.output_tokens", + AnalyticsProvider: "analytics.provider", + AnalyticsRawCacheReadCost: "analytics.raw_cache_read_cost", + AnalyticsRawCacheWriteCost: "analytics.raw_cache_write_cost", + AnalyticsRawInputCost: "analytics.raw_input_cost", + AnalyticsRawOutputCost: "analytics.raw_output_cost", + AnalyticsRawTotalCost: "analytics.raw_total_cost", + AnalyticsSource: "analytics.source", + AnalyticsToolCallCount: "analytics.tool_call_count", + ApiKeyId: "api_key.id", + ApiKeyName: "api_key.name", + AuthIncomingInternal: "auth.incoming_internal", + AuthKeyMatch: "auth.key.match", + AuthKeyPreview: "auth.key.preview", + AuthKeySource: "auth.key.source", + AuthKeyType: "auth.key.type", + AuthProvider: "auth.provider", + AuthValidateStatusCode: "auth.validate.status_code", + AwsRegion: "aws.region", + BillingAttempts: "billing.attempts", + BillingByok: "billing.byok", + BillingChangeType: "billing.change_type", + BillingCostInputUsd: "billing.cost.input_usd", + BillingCostOutputUsd: "billing.cost.output_usd", + BillingCostTotalUsd: "billing.cost.total_usd", + BillingCostUsd: "billing.cost_usd", + BillingCustomerType: "billing.customer_type", + BillingDuplicate: "billing.duplicate", + BillingDurationMs: "billing.duration_ms", + BillingHasIdempotencyKey: "billing.has_idempotency_key", + BillingIdempotencyKey: "billing.idempotency_key", + BillingInterval: "billing.interval", + BillingIsMcp: "billing.is_mcp", + BillingLlmCost: "billing.llm_cost", + BillingLongContext: "billing.long_context", + BillingNewPlan: "billing.new_plan", + BillingOutcome: "billing.outcome", + BillingPlan: "billing.plan", + BillingPreviousPlan: "billing.previous_plan", + BillingServiceCharges: "billing.service_charges", + BillingSource: "billing.source", + BillingTotalCost: "billing.total_cost", + BillingUsageCurrent: "billing.usage.current", + BillingUsageExceeded: "billing.usage.exceeded", + BillingUsageLimit: "billing.usage.limit", + BlockId: "block.id", + BlockName: "block.name", + BlockType: "block.type", + ChatActiveMessagesBytes: "chat.active_messages_bytes", + ChatActiveMessagesCount: "chat.active_messages_count", + ChatAppendBytes: "chat.append_bytes", + ChatAppendCount: "chat.append_count", + ChatArtifactKeys: "chat.artifact_keys", + ChatArtifactsBytes: "chat.artifacts_bytes", + ChatAuthType: "chat.auth_type", + ChatBlobOp: "chat.blob.op", + ChatBlobSite: "chat.blob.site", + ChatBlobBytesOffloaded: "chat.blob_bytes_offloaded", + ChatBlobBytesResolved: "chat.blob_bytes_resolved", + ChatBlobsOffloaded: "chat.blobs_offloaded", + ChatBlobsResolved: "chat.blobs_resolved", + ChatContextCount: "chat.context_count", + ChatContextUsage: "chat.context_usage", + ChatContinuationMessagesBefore: "chat.continuation.messages_before", + ChatContinuationToolResultBytes: "chat.continuation.tool_result_bytes", + ChatContinuationToolResultFailure: "chat.continuation.tool_result_failure", + ChatContinuationToolResultSuccess: "chat.continuation.tool_result_success", + ChatContinuationToolResults: "chat.continuation.tool_results", + ChatContinuationTotalToolCalls: "chat.continuation.total_tool_calls", + ChatExistingMessageCount: "chat.existing_message_count", + ChatFileAttachmentCount: "chat.file_attachment_count", + ChatFinalizeOutcome: "chat.finalize.outcome", + ChatFound: "chat.found", + ChatHasAssistantMessage: "chat.has_assistant_message", + ChatHasOutputConfigs: "chat.has_output_configs", + ChatId: "chat.id", + ChatMessageBytes: "chat.message_bytes", + ChatMessagesAfter: "chat.messages_after", + ChatMessagesBytes: "chat.messages_bytes", + ChatMessagesCount: "chat.messages_count", + ChatPersistOutcome: "chat.persist.outcome", + ChatPreexisting: "chat.preexisting", + ChatRollbackIndex: "chat.rollback_index", + ChatTokensUsed: "chat.tokens_used", + ChatType: "chat.type", + ChatUserMessageId: "chat.user_message_id", + CheckpointAge: "checkpoint.age", + CheckpointAttemptsBytes: "checkpoint.attempts_bytes", + CheckpointBytesAssistantToolUse: "checkpoint.bytes.assistant_tool_use", + CheckpointBytesCurrentMessages: "checkpoint.bytes.current_messages", + CheckpointBytesImmediateResults: "checkpoint.bytes.immediate_results", + CheckpointBytesPendingToolCalls: "checkpoint.bytes.pending_tool_calls", + CheckpointBytesProviderRequest: "checkpoint.bytes.provider_request", + CheckpointBytesRequestContext: "checkpoint.bytes.request_context", + CheckpointBytesToolUsage: "checkpoint.bytes.tool_usage", + CheckpointCachedCredentialsBytes: "checkpoint.cached_credentials_bytes", + CheckpointClaimed: "checkpoint.claimed", + CheckpointClaimedNow: "checkpoint.claimed_now", + CheckpointCompletedBytes: "checkpoint.completed_bytes", + CheckpointCompletedSteps: "checkpoint.completed_steps", + CheckpointCurrentMessages: "checkpoint.current_messages", + CheckpointDecisionsBytes: "checkpoint.decisions_bytes", + CheckpointFound: "checkpoint.found", + CheckpointFrames: "checkpoint.frames", + CheckpointId: "checkpoint.id", + CheckpointImmediateResults: "checkpoint.immediate_results", + CheckpointMessageId: "checkpoint.message_id", + CheckpointPendingBytes: "checkpoint.pending_bytes", + CheckpointPendingSteps: "checkpoint.pending_steps", + CheckpointPendingToolCount: "checkpoint.pending_tool_count", + CheckpointRows: "checkpoint.rows", + CheckpointTaskId: "checkpoint.task_id", + CheckpointTotalToolCalls: "checkpoint.total_tool_calls", + CheckpointWorkflowSnapshotBytes: "checkpoint.workflow_snapshot_bytes", + ClientVersion: "client.version", + ConditionId: "condition.id", + ConditionName: "condition.name", + ConditionResult: "condition.result", + ContextReduceBudgetChars: "context.reduce.budget_chars", + ContextReduceBudgetSource: "context.reduce.budget_source", + ContextReduceCaller: "context.reduce.caller", + ContextReduceDidReduce: "context.reduce.did_reduce", + ContextReduceInputChars: "context.reduce.input_chars", + ContextReduceInputMessages: "context.reduce.input_messages", + ContextReduceOutcome: "context.reduce.outcome", + ContextReduceOutputChars: "context.reduce.output_chars", + ContextReduceOutputMessages: "context.reduce.output_messages", + ContextReduced: "context.reduced", + ContextSummarizeInputChars: "context.summarize.input_chars", + ContextSummarizeOutputChars: "context.summarize.output_chars", + ContextTransformCaller: "context.transform.caller", + ContextTransformCharsIn: "context.transform.chars_in", + ContextTransformCharsOut: "context.transform.chars_out", + ContextTransformDropCount: "context.transform.drop_count", + ContextTransformDrops: "context.transform.drops", + ContextTransformMessagesIn: "context.transform.messages_in", + ContextTransformMessagesOut: "context.transform.messages_out", + ContextTransformStage: "context.transform.stage", + CopilotAbortControllerFired: "copilot.abort.controller_fired", + CopilotAbortGoMarkerOk: "copilot.abort.go_marker_ok", + CopilotAbortLocalAborted: "copilot.abort.local_aborted", + CopilotAbortMarkerWritten: "copilot.abort.marker_written", + CopilotAbortOutcome: "copilot.abort.outcome", + CopilotAbortUnknownReason: "copilot.abort.unknown_reason", + CopilotAsyncSubagentAgent: "copilot.async_subagent.agent", + CopilotAsyncSubagentCount: "copilot.async_subagent.count", + CopilotAsyncSubagentDeltaChars: "copilot.async_subagent.delta_chars", + CopilotAsyncSubagentId: "copilot.async_subagent.id", + CopilotAsyncSubagentReminders: "copilot.async_subagent.reminders", + CopilotAsyncSubagentSleptMs: "copilot.async_subagent.slept_ms", + CopilotAsyncSubagentStatus: "copilot.async_subagent.status", + CopilotAsyncSubagentWaitMode: "copilot.async_subagent.wait_mode", + CopilotAsyncSubagentWakeReason: "copilot.async_subagent.wake_reason", + CopilotAsyncToolClaimedBy: "copilot.async_tool.claimed_by", + CopilotAsyncToolHasError: "copilot.async_tool.has_error", + CopilotAsyncToolIdsCount: "copilot.async_tool.ids_count", + CopilotAsyncToolPermissionDecision: "copilot.async_tool.permission_decision", + CopilotAsyncToolStatus: "copilot.async_tool.status", + CopilotAsyncToolWorkerId: "copilot.async_tool.worker_id", + CopilotBranchKind: "copilot.branch.kind", + CopilotChatIsNew: "copilot.chat.is_new", + CopilotCheckpointPendingToolCallId: "copilot.checkpoint.pending_tool_call_id", + CopilotCommandsCount: "copilot.commands.count", + CopilotConfirmOutcome: "copilot.confirm.outcome", + CopilotContextsCount: "copilot.contexts.count", + CopilotDegradedReason: "copilot.degraded.reason", + CopilotExecutionId: "copilot.execution.id", + CopilotFileAttachmentsCount: "copilot.file_attachments.count", + CopilotFinalizeOutcome: "copilot.finalize.outcome", + CopilotInterruptedPriorStream: "copilot.interrupted_prior_stream", + CopilotLeg: "copilot.leg", + CopilotMode: "copilot.mode", + CopilotOperation: "copilot.operation", + CopilotOutputFileBytes: "copilot.output_file.bytes", + CopilotOutputFileFormat: "copilot.output_file.format", + CopilotOutputFileId: "copilot.output_file.id", + CopilotOutputFileMimeType: "copilot.output_file.mime_type", + CopilotOutputFileMode: "copilot.output_file.mode", + CopilotOutputFileName: "copilot.output_file.name", + CopilotOutputFileOutcome: "copilot.output_file.outcome", + CopilotOutputFilePath: "copilot.output_file.path", + CopilotOutputFileSandboxPath: "copilot.output_file.sandbox_path", + CopilotPendingStreamWaitMs: "copilot.pending_stream.wait_ms", + CopilotPrefetch: "copilot.prefetch", + CopilotPublisherClientDisconnected: "copilot.publisher.client_disconnected", + CopilotPublisherSawComplete: "copilot.publisher.saw_complete", + CopilotRecoveryLatestSeq: "copilot.recovery.latest_seq", + CopilotRecoveryOldestSeq: "copilot.recovery.oldest_seq", + CopilotRecoveryOutcome: "copilot.recovery.outcome", + CopilotRecoveryRequestedAfterSeq: "copilot.recovery.requested_after_seq", + CopilotRequestCancelReason: "copilot.request.cancel_reason", + CopilotRequestOutcome: "copilot.request.outcome", + CopilotRequestWillRetryOnStreamError: "copilot.request.will_retry_on_stream_error", + CopilotResourceAttachmentsCount: "copilot.resource_attachments.count", + CopilotResourcesAborted: "copilot.resources.aborted", + CopilotResourcesOp: "copilot.resources.op", + CopilotResourcesRemovedCount: "copilot.resources.removed_count", + CopilotResourcesUpsertedCount: "copilot.resources.upserted_count", + CopilotResultContentBlocks: "copilot.result.content_blocks", + CopilotResultContentLength: "copilot.result.content_length", + CopilotResultToolCalls: "copilot.result.tool_calls", + CopilotResumeAfterCursor: "copilot.resume.after_cursor", + CopilotResumeDurationMs: "copilot.resume.duration_ms", + CopilotResumeEventCount: "copilot.resume.event_count", + CopilotResumeOutcome: "copilot.resume.outcome", + CopilotResumePollIterations: "copilot.resume.poll_iterations", + CopilotResumePreviewSessionCount: "copilot.resume.preview_session_count", + CopilotRoute: "copilot.route", + CopilotRunAgent: "copilot.run.agent", + CopilotRunHasCompletedAt: "copilot.run.has_completed_at", + CopilotRunHasError: "copilot.run.has_error", + CopilotRunModel: "copilot.run.model", + CopilotRunParentId: "copilot.run.parent_id", + CopilotRunProvider: "copilot.run.provider", + CopilotRunStatus: "copilot.run.status", + CopilotSseBytesReceived: "copilot.sse.bytes_received", + CopilotSseChunksReceived: "copilot.sse.chunks_received", + CopilotSseCloseReason: "copilot.sse.close_reason", + CopilotSseEventsComplete: "copilot.sse.events.complete", + CopilotSseEventsError: "copilot.sse.events.error", + CopilotSseEventsReceived: "copilot.sse.events.received", + CopilotSseEventsResource: "copilot.sse.events.resource", + CopilotSseEventsRun: "copilot.sse.events.run", + CopilotSseEventsSession: "copilot.sse.events.session", + CopilotSseEventsSpan: "copilot.sse.events.span", + CopilotSseEventsText: "copilot.sse.events.text", + CopilotSseEventsTool: "copilot.sse.events.tool", + CopilotSseExpectedTerminal: "copilot.sse.expected_terminal", + CopilotSseFirstEventMs: "copilot.sse.first_event_ms", + CopilotSseLongestDispatchMs: "copilot.sse.longest_dispatch_ms", + CopilotSseLongestInboundGapMs: "copilot.sse.longest_inbound_gap_ms", + CopilotSseTerminalEventMissing: "copilot.sse.terminal_event_missing", + CopilotSseTerminalEventSeen: "copilot.sse.terminal_event_seen", + CopilotSseTotalDispatchMs: "copilot.sse.total_dispatch_ms", + CopilotSteerOutcome: "copilot.steer.outcome", + CopilotSteeringContentChars: "copilot.steering.content_chars", + CopilotSteeringEntries: "copilot.steering.entries", + CopilotSteeringMode: "copilot.steering.mode", + CopilotSteeringSalvagedChars: "copilot.steering.salvaged_chars", + CopilotStopAppendedAssistant: "copilot.stop.appended_assistant", + CopilotStopBlocksCount: "copilot.stop.blocks_count", + CopilotStopContentLength: "copilot.stop.content_length", + CopilotStopOutcome: "copilot.stop.outcome", + CopilotStream: "copilot.stream", + CopilotSurface: "copilot.surface", + CopilotTableId: "copilot.table.id", + CopilotTableOutcome: "copilot.table.outcome", + CopilotTableRowCount: "copilot.table.row_count", + CopilotTableSourceContentBytes: "copilot.table.source.content_bytes", + CopilotTableSourceFormat: "copilot.table.source.format", + CopilotTableSourcePath: "copilot.table.source.path", + CopilotTraceSpanCount: "copilot.trace.span_count", + CopilotTransport: "copilot.transport", + CopilotUserMessagePreview: "copilot.user.message_preview", + CopilotValidateOutcome: "copilot.validate.outcome", + CopilotVfsDeltaOutcome: "copilot.vfs.delta.outcome", + CopilotVfsFileExtension: "copilot.vfs.file.extension", + CopilotVfsFileMediaType: "copilot.vfs.file.media_type", + CopilotVfsFileName: "copilot.vfs.file.name", + CopilotVfsFileSizeBytes: "copilot.vfs.file.size_bytes", + CopilotVfsHasAlpha: "copilot.vfs.has_alpha", + CopilotVfsInputBytes: "copilot.vfs.input.bytes", + CopilotVfsInputHeight: "copilot.vfs.input.height", + CopilotVfsInputMediaTypeClaimed: "copilot.vfs.input.media_type_claimed", + CopilotVfsInputMediaTypeDetected: "copilot.vfs.input.media_type_detected", + CopilotVfsInputWidth: "copilot.vfs.input.width", + CopilotVfsMaterializeFileCount: "copilot.vfs.materialize.file_count", + CopilotVfsMaterializePhaseMs: "copilot.vfs.materialize.phase_ms", + CopilotVfsMetadataFailed: "copilot.vfs.metadata.failed", + CopilotVfsOutcome: "copilot.vfs.outcome", + CopilotVfsOutputBytes: "copilot.vfs.output.bytes", + CopilotVfsOutputMediaType: "copilot.vfs.output.media_type", + CopilotVfsPhase: "copilot.vfs.phase", + CopilotVfsReadImageResized: "copilot.vfs.read.image.resized", + CopilotVfsReadOutcome: "copilot.vfs.read.outcome", + CopilotVfsReadOutputBytes: "copilot.vfs.read.output.bytes", + CopilotVfsReadOutputLines: "copilot.vfs.read.output.lines", + CopilotVfsReadOutputMediaType: "copilot.vfs.read.output.media_type", + CopilotVfsReadPath: "copilot.vfs.read.path", + CopilotVfsResizeAttempts: "copilot.vfs.resize.attempts", + CopilotVfsResizeChosenDimension: "copilot.vfs.resize.chosen_dimension", + CopilotVfsResizeChosenQuality: "copilot.vfs.resize.chosen_quality", + CopilotVfsResizeDimension: "copilot.vfs.resize.dimension", + CopilotVfsResizeFitsBudget: "copilot.vfs.resize.fits_budget", + CopilotVfsResizeOutputBytes: "copilot.vfs.resize.output_bytes", + CopilotVfsResizeQuality: "copilot.vfs.resize.quality", + CopilotVfsResized: "copilot.vfs.resized", + CopilotVfsSharpLoadFailed: "copilot.vfs.sharp.load_failed", + CostDefaultCost: "cost.default_cost", + CredentialSetId: "credential_set.id", + CredentialSetName: "credential_set.name", + DbOperation: "db.operation", + DbSqlTable: "db.sql.table", + DbSystem: "db.system", + DeploymentEnvironment: "deployment.environment", + DeploymentVersion: "deployment.version", + DocumentFileSize: "document.file_size", + DocumentMimeType: "document.mime_type", + DocumentsCount: "documents.count", + DocumentsUploadType: "documents.upload_type", + Error: "error", + ErrorCode: "error.code", + ErrorInternal: "error.internal", + ErrorMessage: "error.message", + ErrorType: "error.type", + EventName: "event.name", + EventTimestamp: "event.timestamp", + ExecutionBlocksExecuted: "execution.blocks_executed", + ExecutionDurationMs: "execution.duration_ms", + ExecutionErrorMessage: "execution.error_message", + ExecutionHasErrors: "execution.has_errors", + ExecutionStatus: "execution.status", + ExecutionTotalCost: "execution.total_cost", + ExecutionTrigger: "execution.trigger", + FunctionExecutionTimeMs: "function.execution_time_ms", + FunctionId: "function.id", + FunctionName: "function.name", + GenAiAgentId: "gen_ai.agent.id", + GenAiAgentName: "gen_ai.agent.name", + GenAiCacheOutcome: "gen_ai.cache.outcome", + GenAiCacheTokenType: "gen_ai.cache.token.type", + GenAiCostInput: "gen_ai.cost.input", + GenAiCostOutput: "gen_ai.cost.output", + GenAiCostTotal: "gen_ai.cost.total", + GenAiInputMessages: "gen_ai.input.messages", + GenAiOperationName: "gen_ai.operation.name", + GenAiOutputMessages: "gen_ai.output.messages", + GenAiProviderName: "gen_ai.provider.name", + GenAiRequestAssistantMessages: "gen_ai.request.assistant_messages", + GenAiRequestCacheableSystemBlocks: "gen_ai.request.cacheable_system_blocks", + GenAiRequestContentBlocks: "gen_ai.request.content_blocks", + GenAiRequestHasCacheControl: "gen_ai.request.has_cache_control", + GenAiRequestImageBlocks: "gen_ai.request.image_blocks", + GenAiRequestImageDataBytes: "gen_ai.request.image_data_bytes", + GenAiRequestMaxMessageBlocks: "gen_ai.request.max_message_blocks", + GenAiRequestMessagesCount: "gen_ai.request.messages.count", + GenAiRequestModel: "gen_ai.request.model", + GenAiRequestPromptCacheBreakpointCreated: "gen_ai.request.prompt_cache.breakpoint.created", GenAiRequestPromptCacheBreakpointDynamicWriteSuppressReason: - 'gen_ai.request.prompt_cache.breakpoint.dynamic_write_suppress_reason', + "gen_ai.request.prompt_cache.breakpoint.dynamic_write_suppress_reason", GenAiRequestPromptCacheBreakpointDynamicWriteSuppressed: - 'gen_ai.request.prompt_cache.breakpoint.dynamic_write_suppressed', - GenAiRequestPromptCacheBreakpointEligible: 'gen_ai.request.prompt_cache.breakpoint.eligible', - GenAiRequestPromptCacheBreakpointKind: 'gen_ai.request.prompt_cache.breakpoint.kind', - GenAiRequestPromptCacheBreakpointMinimumTokens: - 'gen_ai.request.prompt_cache.breakpoint.minimum_tokens', + "gen_ai.request.prompt_cache.breakpoint.dynamic_write_suppressed", + GenAiRequestPromptCacheBreakpointEligible: "gen_ai.request.prompt_cache.breakpoint.eligible", + GenAiRequestPromptCacheBreakpointKind: "gen_ai.request.prompt_cache.breakpoint.kind", + GenAiRequestPromptCacheBreakpointMinimumTokens: "gen_ai.request.prompt_cache.breakpoint.minimum_tokens", GenAiRequestPromptCacheBreakpointPrefixTokensEstimated: - 'gen_ai.request.prompt_cache.breakpoint.prefix_tokens_estimated', + "gen_ai.request.prompt_cache.breakpoint.prefix_tokens_estimated", GenAiRequestPromptCacheBreakpointPreviousBoundaryTokens: - 'gen_ai.request.prompt_cache.breakpoint.previous_boundary_tokens', - GenAiRequestPromptCacheBreakpointSection: 'gen_ai.request.prompt_cache.breakpoint.section', - GenAiRequestPromptCacheBreakpointSkipReason: 'gen_ai.request.prompt_cache.breakpoint.skip_reason', - GenAiRequestPromptCacheBreakpointTargetIndex: - 'gen_ai.request.prompt_cache.breakpoint.target_index', - GenAiRequestPromptCacheBreakpointTargetRole: 'gen_ai.request.prompt_cache.breakpoint.target_role', - GenAiRequestPromptCacheBreakpointTargetType: 'gen_ai.request.prompt_cache.breakpoint.target_type', - GenAiRequestPromptCacheBreakpointThresholdTokens: - 'gen_ai.request.prompt_cache.breakpoint.threshold_tokens', - GenAiRequestPromptCacheBreakpointTtl: 'gen_ai.request.prompt_cache.breakpoint.ttl', - GenAiRequestPromptCacheBreakpointsCount: 'gen_ai.request.prompt_cache.breakpoints.count', - GenAiRequestPromptCacheBreakpointsCreated: 'gen_ai.request.prompt_cache.breakpoints.created', - GenAiRequestPromptCacheDynamicMinimumTokens: 'gen_ai.request.prompt_cache.dynamic.minimum_tokens', + "gen_ai.request.prompt_cache.breakpoint.previous_boundary_tokens", + GenAiRequestPromptCacheBreakpointSection: "gen_ai.request.prompt_cache.breakpoint.section", + GenAiRequestPromptCacheBreakpointSkipReason: "gen_ai.request.prompt_cache.breakpoint.skip_reason", + GenAiRequestPromptCacheBreakpointTargetIndex: "gen_ai.request.prompt_cache.breakpoint.target_index", + GenAiRequestPromptCacheBreakpointTargetRole: "gen_ai.request.prompt_cache.breakpoint.target_role", + GenAiRequestPromptCacheBreakpointTargetType: "gen_ai.request.prompt_cache.breakpoint.target_type", + GenAiRequestPromptCacheBreakpointThresholdTokens: "gen_ai.request.prompt_cache.breakpoint.threshold_tokens", + GenAiRequestPromptCacheBreakpointTtl: "gen_ai.request.prompt_cache.breakpoint.ttl", + GenAiRequestPromptCacheBreakpointsCount: "gen_ai.request.prompt_cache.breakpoints.count", + GenAiRequestPromptCacheBreakpointsCreated: "gen_ai.request.prompt_cache.breakpoints.created", + GenAiRequestPromptCacheDynamicMinimumTokens: "gen_ai.request.prompt_cache.dynamic.minimum_tokens", GenAiRequestPromptCacheDynamicPrefixTokensEstimated: - 'gen_ai.request.prompt_cache.dynamic.prefix_tokens_estimated', + "gen_ai.request.prompt_cache.dynamic.prefix_tokens_estimated", GenAiRequestPromptCacheDynamicPreviousBoundaryTokens: - 'gen_ai.request.prompt_cache.dynamic.previous_boundary_tokens', - GenAiRequestPromptCacheDynamicSkipReason: 'gen_ai.request.prompt_cache.dynamic.skip_reason', - GenAiRequestPromptCacheDynamicTargetType: 'gen_ai.request.prompt_cache.dynamic.target_type', - GenAiRequestPromptCacheDynamicThresholdTokens: - 'gen_ai.request.prompt_cache.dynamic.threshold_tokens', - GenAiRequestPromptCacheDynamicTtl: 'gen_ai.request.prompt_cache.dynamic.ttl', - GenAiRequestPromptCacheDynamicUserEligible: 'gen_ai.request.prompt_cache.dynamic_user_eligible', - GenAiRequestPromptCacheDynamicUserSkipReason: - 'gen_ai.request.prompt_cache.dynamic_user_skip_reason', - GenAiRequestPromptCacheStaticTtl: 'gen_ai.request.prompt_cache.static.ttl', - GenAiRequestPromptCacheStaticSystem: 'gen_ai.request.prompt_cache.static_system', - GenAiRequestPromptCacheStaticTools: 'gen_ai.request.prompt_cache.static_tools', - GenAiRequestRuntimeContextChars: 'gen_ai.request.runtime_context_chars', - GenAiRequestRuntimeContextMessages: 'gen_ai.request.runtime_context_messages', - GenAiRequestSystemBlocks: 'gen_ai.request.system_blocks', - GenAiRequestSystemChars: 'gen_ai.request.system_chars', - GenAiRequestTextBlocks: 'gen_ai.request.text_blocks', - GenAiRequestToolResultBlocks: 'gen_ai.request.tool_result_blocks', - GenAiRequestToolUseBlocks: 'gen_ai.request.tool_use_blocks', - GenAiRequestToolsCount: 'gen_ai.request.tools.count', - GenAiRequestUserMessages: 'gen_ai.request.user_messages', - GenAiResponseFinishReasons: 'gen_ai.response.finish_reasons', - GenAiResponseModel: 'gen_ai.response.model', - GenAiStreamPhaseTextBytes: 'gen_ai.stream.phase.text.bytes', - GenAiStreamPhaseTextChunks: 'gen_ai.stream.phase.text.chunks', - GenAiStreamPhaseTextFirstMs: 'gen_ai.stream.phase.text.first_ms', - GenAiStreamPhaseTextMs: 'gen_ai.stream.phase.text.ms', - GenAiStreamPhaseThinkingBytes: 'gen_ai.stream.phase.thinking.bytes', - GenAiStreamPhaseThinkingChunks: 'gen_ai.stream.phase.thinking.chunks', - GenAiStreamPhaseThinkingFirstMs: 'gen_ai.stream.phase.thinking.first_ms', - GenAiStreamPhaseThinkingMs: 'gen_ai.stream.phase.thinking.ms', - GenAiStreamPhaseToolArgsBytes: 'gen_ai.stream.phase.tool_args.bytes', - GenAiStreamPhaseToolArgsChunks: 'gen_ai.stream.phase.tool_args.chunks', - GenAiStreamPhaseToolArgsFirstMs: 'gen_ai.stream.phase.tool_args.first_ms', - GenAiStreamPhaseToolArgsMs: 'gen_ai.stream.phase.tool_args.ms', - GenAiSystem: 'gen_ai.system', - GenAiThinkingBlocksCaptured: 'gen_ai.thinking.blocks_captured', - GenAiThinkingRedactedBlocks: 'gen_ai.thinking.redacted_blocks', - GenAiTokenType: 'gen_ai.token.type', - GenAiToolName: 'gen_ai.tool.name', - GenAiUsageCacheCreationInputTokens: 'gen_ai.usage.cache_creation.input_tokens', - GenAiUsageCacheCreationTokens: 'gen_ai.usage.cache_creation_tokens', - GenAiUsageCacheReadInputTokens: 'gen_ai.usage.cache_read.input_tokens', - GenAiUsageCacheReadTokens: 'gen_ai.usage.cache_read_tokens', - GenAiUsageContextTokens: 'gen_ai.usage.context_tokens', - GenAiUsageInputTokens: 'gen_ai.usage.input_tokens', - GenAiUsageOutputTokens: 'gen_ai.usage.output_tokens', - GenAiUsageThinkingTokens: 'gen_ai.usage.thinking_tokens', - GenAiUsageTotalTokens: 'gen_ai.usage.total_tokens', - GenAiWorkflowId: 'gen_ai.workflow.id', - GenAiWorkflowName: 'gen_ai.workflow.name', - HostedKeyEnvVar: 'hosted_key.env_var', - HttpHost: 'http.host', - HttpMethod: 'http.method', - HttpPath: 'http.path', - HttpRemoteAddr: 'http.remote_addr', - HttpRequestContentLength: 'http.request.content_length', - HttpResponseBodyBytes: 'http.response.body_bytes', - HttpResponseContentLength: 'http.response.content_length', - HttpResponseHeadersMs: 'http.response.headers_ms', - HttpResponseTotalMs: 'http.response.total_ms', - HttpRoute: 'http.route', - HttpServerDurationMs: 'http.server.duration_ms', - HttpStatusCode: 'http.status_code', - HttpTarget: 'http.target', - HttpUrl: 'http.url', - HttpUserAgent: 'http.user_agent', - InvitationRole: 'invitation.role', - LlmBackend: 'llm.backend', - LlmCompactionPause: 'llm.compaction.pause', - LlmErrorStage: 'llm.error_stage', - LlmProtocol: 'llm.protocol', - LlmRequestBodyBytes: 'llm.request.body_bytes', - LlmRequestCompactionTrigger: 'llm.request.compaction_trigger', - LlmStreamBytes: 'llm.stream.bytes', - LlmStreamChunks: 'llm.stream.chunks', - LlmStreamFirstChunkBytes: 'llm.stream.first_chunk_bytes', - LlmStreamFirstChunkMs: 'llm.stream.first_chunk_ms', - LlmStreamFirstTokenMs: 'llm.stream.first_token_ms', - LlmStreamOpenMs: 'llm.stream.open_ms', - LlmStreamTotalMs: 'llm.stream.total_ms', - LockAcquired: 'lock.acquired', - LockBackend: 'lock.backend', - LockTimedOut: 'lock.timed_out', - LockTimeoutMs: 'lock.timeout_ms', - LoopId: 'loop.id', - LoopIterations: 'loop.iterations', - LoopName: 'loop.name', - ManageKnowledgeBaseId: 'manage_knowledge_base.id', - ManageKnowledgeBaseName: 'manage_knowledge_base.name', - McpExecutionStatus: 'mcp.execution_status', - McpServerId: 'mcp.server_id', - McpServerName: 'mcp.server_name', - McpToolName: 'mcp.tool_name', - McpTransport: 'mcp.transport', - MemberRole: 'member.role', - MemoryContentBytes: 'memory.content_bytes', - MemoryFound: 'memory.found', - MemoryPath: 'memory.path', - MemoryRowCount: 'memory.row_count', - MessageId: 'message.id', - MessagesDeserializeMs: 'messages.deserialize_ms', - MessagesSerializeOp: 'messages.serialize.op', - MessagesSerializeSite: 'messages.serialize.site', - MessagesSerializeMs: 'messages.serialize_ms', - MessagingDestinationName: 'messaging.destination.name', - MessagingSystem: 'messaging.system', - ModelDurationMs: 'model.duration_ms', - ModelId: 'model.id', - ModelName: 'model.name', - MothershipOrigin: 'mothership.origin', - NetPeerName: 'net.peer.name', - OauthProvider: 'oauth.provider', - ParallelBranches: 'parallel.branches', - ParallelId: 'parallel.id', - ParallelName: 'parallel.name', - PrefsToolCount: 'prefs.tool_count', - ProcessingChunkSize: 'processing.chunk_size', - ProcessingRecipe: 'processing.recipe', - PromptCacheableBlocks: 'prompt.cacheable_blocks', - PromptComponent: 'prompt.component', - PromptRegionFilesChars: 'prompt.region.files_chars', - PromptRegionFilesCount: 'prompt.region.files_count', - PromptRegionHistoryChars: 'prompt.region.history_chars', - PromptRegionHistoryMessages: 'prompt.region.history_messages', - PromptRegionRuntimeTailChars: 'prompt.region.runtime_tail_chars', - PromptRegionSteeringChars: 'prompt.region.steering_chars', - PromptRegionToolResultsChars: 'prompt.region.tool_results_chars', - PromptRegionVfsChars: 'prompt.region.vfs_chars', - PromptRegionVfsMessages: 'prompt.region.vfs_messages', - PromptRuntimeActiveSkillsChars: 'prompt.runtime.active_skills_chars', - PromptRuntimeTaggedResourcesChars: 'prompt.runtime.tagged_resources_chars', - PromptSectionAgentGuidanceChars: 'prompt.section.agent_guidance_chars', - PromptSectionCapabilitiesChars: 'prompt.section.capabilities_chars', - PromptSectionCredentialsChars: 'prompt.section.credentials_chars', - PromptSectionOverrideChars: 'prompt.section.override_chars', - PromptSectionPersonaChars: 'prompt.section.persona_chars', - PromptSectionPoliciesChars: 'prompt.section.policies_chars', - PromptSectionSkillsIndexChars: 'prompt.section.skills_index_chars', - PromptSectionSpawnContextChars: 'prompt.section.spawn_context_chars', - PromptSectionSubagentDocsChars: 'prompt.section.subagent_docs_chars', - PromptSectionToolDocsChars: 'prompt.section.tool_docs_chars', - PromptSectionWorkspaceGuideChars: 'prompt.section.workspace_guide_chars', - PromptSectionWorkspaceInventoryChars: 'prompt.section.workspace_inventory_chars', - PromptSet: 'prompt.set', - PromptSite: 'prompt.site', - PromptSystemBlocks: 'prompt.system_blocks', - PromptSystemChars: 'prompt.system_chars', - PromptToolsWireChars: 'prompt.tools.wire_chars', - PromptToolsWireCount: 'prompt.tools.wire_count', - ProviderId: 'provider.id', - RateLimitAttempt: 'rate_limit.attempt', - RateLimitCount: 'rate_limit.count', - RateLimitDelayMs: 'rate_limit.delay_ms', - RateLimitLimit: 'rate_limit.limit', - RateLimitMaxRetries: 'rate_limit.max_retries', - RateLimitOutcome: 'rate_limit.outcome', - RateLimitRetryAfterMs: 'rate_limit.retry_after_ms', - RequestGoTraceId: 'request.go_trace_id', - RequestId: 'request.id', - RequiredVersion: 'required.version', - ResumeRequestBodyBytes: 'resume.request.body_bytes', - ResumeResultsCount: 'resume.results.count', - ResumeResultsDataBytes: 'resume.results.data_bytes', - ResumeResultsFailureCount: 'resume.results.failure_count', - ResumeResultsSuccessCount: 'resume.results.success_count', - RouterBackendName: 'router.backend_name', - RouterConfigVersion: 'router.config_version', - RouterId: 'router.id', - RouterName: 'router.name', - RouterRouteReason: 'router.route_reason', - RouterSelectedBackend: 'router.selected_backend', - RouterSelectedPath: 'router.selected_path', - RunId: 'run.id', - SearchResultsCount: 'search.results_count', - ServerAddress: 'server.address', - ServiceInstanceId: 'service.instance.id', - ServiceName: 'service.name', - ServiceNamespace: 'service.namespace', - ServiceVersion: 'service.version', - SettleCompleted: 'settle.completed', - SettleTimeoutMs: 'settle.timeout_ms', - SettleWaitMs: 'settle.wait_ms', - SimOperation: 'sim.operation', - SimRequestId: 'sim.request_id', - SpanDurationMs: 'span.duration_ms', - SpanStatus: 'span.status', - SpanType: 'span.type', - StreamId: 'stream.id', - SubagentDepth: 'subagent.depth', - SubagentEscalationApplied: 'subagent.escalation.applied', - SubagentEscalationPriorCalls: 'subagent.escalation.prior_calls', - SubagentEscalationRequested: 'subagent.escalation.requested', - SubagentExecutionPhase: 'subagent.execution.phase', - SubagentId: 'subagent.id', - SubagentNested: 'subagent.nested', - SubagentOutcomeContentBytes: 'subagent.outcome.content_bytes', - SubagentOutcomeError: 'subagent.outcome.error', - SubagentOutcomeFirstChunkMs: 'subagent.outcome.first_chunk_ms', - SubagentOutcomeLlmRounds: 'subagent.outcome.llm_rounds', - SubagentOutcomeStructuredType: 'subagent.outcome.structured_type', - SubagentOutcomeSuccess: 'subagent.outcome.success', - SubagentOutcomeToolCallCount: 'subagent.outcome.tool_call_count', - SubagentParentAgentId: 'subagent.parent_agent_id', - SubagentRouteManifestMissing: 'subagent.route.manifest_missing', - SubagentSessionId: 'subagent.session.id', - SubagentSessionOperation: 'subagent.session.operation', - SubagentSessionPersistenceOutcome: 'subagent.session.persistence_outcome', - SubagentSessionRevision: 'subagent.session.revision', - SubagentSessionRunId: 'subagent.session.run_id', - SubagentSessionTitle: 'subagent.session.title', - SubagentToolCallId: 'subagent.tool_call_id', - TaskAge: 'task.age', - TaskDecisionCount: 'task.decision_count', - TaskErrorCount: 'task.error_count', - TaskFound: 'task.found', - TaskId: 'task.id', - TaskListLimit: 'task.list_limit', - TaskRows: 'task.rows', - TaskStatus: 'task.status', - TaskStepCount: 'task.step_count', - TelemetrySdkLanguage: 'telemetry.sdk.language', - TelemetrySdkName: 'telemetry.sdk.name', - TelemetrySdkVersion: 'telemetry.sdk.version', - TemplateId: 'template.id', - TemplateName: 'template.name', - ThrottleReason: 'throttle.reason', - ToolArgsBytes: 'tool.args.bytes', - ToolArgsCount: 'tool.args.count', - ToolArgsPreview: 'tool.args.preview', - ToolAsyncWaiterPollCount: 'tool.async_waiter.poll_count', - ToolAsyncWaiterPubsubDeliveries: 'tool.async_waiter.pubsub_deliveries', - ToolAsyncWaiterResolution: 'tool.async_waiter.resolution', - ToolCallId: 'tool.call_id', - ToolClientCount: 'tool.client.count', - ToolClientExecutable: 'tool.client_executable', - ToolCompletionReceived: 'tool.completion.received', - ToolConfirmationStatus: 'tool.confirmation.status', - ToolDeferredCount: 'tool.deferred.count', - ToolDurationMs: 'tool.duration_ms', - ToolErrorKind: 'tool.error_kind', - ToolExecutor: 'tool.executor', - ToolExternalService: 'tool.external.service', - ToolId: 'tool.id', - ToolLoadedCount: 'tool.loaded.count', - ToolName: 'tool.name', - ToolOutcome: 'tool.outcome', - ToolOutcomeMessage: 'tool.outcome.message', - ToolParentSpan: 'tool.parent_span', - ToolPayloadBytes: 'tool.payload.bytes', - ToolResultArtifact: 'tool.result.artifact', - ToolResultBytes: 'tool.result.bytes', - ToolResultSuccess: 'tool.result.success', - ToolScheduled: 'tool.scheduled', - ToolStatus: 'tool.status', - ToolStatusCode: 'tool.status_code', - ToolStoreStatus: 'tool.store_status', - ToolSync: 'tool.sync', - ToolTimeoutMs: 'tool.timeout_ms', - ToolVisibleCount: 'tool.visible.count', - ToolVisibleNames: 'tool.visible.names', - TraceAborted: 'trace.aborted', - TraceBilledTotalCost: 'trace.billed_total_cost', - TraceCacheAttemptedRequests: 'trace.cache_attempted_requests', - TraceCacheHitRequests: 'trace.cache_hit_requests', - TraceCacheReadTokens: 'trace.cache_read_tokens', - TraceCacheWriteRequests: 'trace.cache_write_requests', - TraceCacheWriteTokens: 'trace.cache_write_tokens', - TraceDurationMs: 'trace.duration_ms', - TraceError: 'trace.error', - TraceGoId: 'trace.go_id', - TraceInputTokens: 'trace.input_tokens', - TraceModel: 'trace.model', - TraceOutcome: 'trace.outcome', - TraceOutputTokens: 'trace.output_tokens', - TraceProvider: 'trace.provider', - TraceRawTotalCost: 'trace.raw_total_cost', - TraceSpanCount: 'trace.span_count', - TraceToolCallCount: 'trace.tool_call_count', - UserAuthMethod: 'user.auth_method', - UserAuthProvider: 'user.auth_provider', - UserEmail: 'user.email', - UserId: 'user.id', - WebhookId: 'webhook.id', - WebhookProvider: 'webhook.provider', - WebhookTriggerSuccess: 'webhook.trigger_success', - WorkflowBlockTypes: 'workflow.block_types', - WorkflowBlocksCount: 'workflow.blocks_count', - WorkflowCreatedId: 'workflow.created_id', - WorkflowDurationMs: 'workflow.duration_ms', - WorkflowEdgesCount: 'workflow.edges_count', - WorkflowHasFolder: 'workflow.has_folder', - WorkflowHasWorkspace: 'workflow.has_workspace', - WorkflowId: 'workflow.id', - WorkflowLoopsCount: 'workflow.loops_count', - WorkflowName: 'workflow.name', - WorkflowNewId: 'workflow.new_id', - WorkflowParallelsCount: 'workflow.parallels_count', - WorkflowSourceId: 'workflow.source_id', - WorkflowTrigger: 'workflow.trigger', - WorkspaceId: 'workspace.id', - WorkspaceName: 'workspace.name', -} as const + "gen_ai.request.prompt_cache.dynamic.previous_boundary_tokens", + GenAiRequestPromptCacheDynamicSkipReason: "gen_ai.request.prompt_cache.dynamic.skip_reason", + GenAiRequestPromptCacheDynamicTargetType: "gen_ai.request.prompt_cache.dynamic.target_type", + GenAiRequestPromptCacheDynamicThresholdTokens: "gen_ai.request.prompt_cache.dynamic.threshold_tokens", + GenAiRequestPromptCacheDynamicTtl: "gen_ai.request.prompt_cache.dynamic.ttl", + GenAiRequestPromptCacheDynamicUserEligible: "gen_ai.request.prompt_cache.dynamic_user_eligible", + GenAiRequestPromptCacheDynamicUserSkipReason: "gen_ai.request.prompt_cache.dynamic_user_skip_reason", + GenAiRequestPromptCacheStaticTtl: "gen_ai.request.prompt_cache.static.ttl", + GenAiRequestPromptCacheStaticSystem: "gen_ai.request.prompt_cache.static_system", + GenAiRequestPromptCacheStaticTools: "gen_ai.request.prompt_cache.static_tools", + GenAiRequestRuntimeContextChars: "gen_ai.request.runtime_context_chars", + GenAiRequestRuntimeContextMessages: "gen_ai.request.runtime_context_messages", + GenAiRequestSystemBlocks: "gen_ai.request.system_blocks", + GenAiRequestSystemChars: "gen_ai.request.system_chars", + GenAiRequestTextBlocks: "gen_ai.request.text_blocks", + GenAiRequestToolResultBlocks: "gen_ai.request.tool_result_blocks", + GenAiRequestToolUseBlocks: "gen_ai.request.tool_use_blocks", + GenAiRequestToolsCount: "gen_ai.request.tools.count", + GenAiRequestUserMessages: "gen_ai.request.user_messages", + GenAiResponseFinishReasons: "gen_ai.response.finish_reasons", + GenAiResponseModel: "gen_ai.response.model", + GenAiStreamPhaseTextBytes: "gen_ai.stream.phase.text.bytes", + GenAiStreamPhaseTextChunks: "gen_ai.stream.phase.text.chunks", + GenAiStreamPhaseTextFirstMs: "gen_ai.stream.phase.text.first_ms", + GenAiStreamPhaseTextMs: "gen_ai.stream.phase.text.ms", + GenAiStreamPhaseThinkingBytes: "gen_ai.stream.phase.thinking.bytes", + GenAiStreamPhaseThinkingChunks: "gen_ai.stream.phase.thinking.chunks", + GenAiStreamPhaseThinkingFirstMs: "gen_ai.stream.phase.thinking.first_ms", + GenAiStreamPhaseThinkingMs: "gen_ai.stream.phase.thinking.ms", + GenAiStreamPhaseToolArgsBytes: "gen_ai.stream.phase.tool_args.bytes", + GenAiStreamPhaseToolArgsChunks: "gen_ai.stream.phase.tool_args.chunks", + GenAiStreamPhaseToolArgsFirstMs: "gen_ai.stream.phase.tool_args.first_ms", + GenAiStreamPhaseToolArgsMs: "gen_ai.stream.phase.tool_args.ms", + GenAiSystem: "gen_ai.system", + GenAiThinkingBlocksCaptured: "gen_ai.thinking.blocks_captured", + GenAiThinkingRedactedBlocks: "gen_ai.thinking.redacted_blocks", + GenAiTokenType: "gen_ai.token.type", + GenAiToolName: "gen_ai.tool.name", + GenAiUsageCacheCreationInputTokens: "gen_ai.usage.cache_creation.input_tokens", + GenAiUsageCacheCreationTokens: "gen_ai.usage.cache_creation_tokens", + GenAiUsageCacheReadInputTokens: "gen_ai.usage.cache_read.input_tokens", + GenAiUsageCacheReadTokens: "gen_ai.usage.cache_read_tokens", + GenAiUsageContextTokens: "gen_ai.usage.context_tokens", + GenAiUsageInputTokens: "gen_ai.usage.input_tokens", + GenAiUsageOutputTokens: "gen_ai.usage.output_tokens", + GenAiUsageThinkingTokens: "gen_ai.usage.thinking_tokens", + GenAiUsageTotalTokens: "gen_ai.usage.total_tokens", + GenAiWorkflowId: "gen_ai.workflow.id", + GenAiWorkflowName: "gen_ai.workflow.name", + HostedKeyEnvVar: "hosted_key.env_var", + HttpHost: "http.host", + HttpMethod: "http.method", + HttpPath: "http.path", + HttpRemoteAddr: "http.remote_addr", + HttpRequestContentLength: "http.request.content_length", + HttpResponseBodyBytes: "http.response.body_bytes", + HttpResponseContentLength: "http.response.content_length", + HttpResponseHeadersMs: "http.response.headers_ms", + HttpResponseTotalMs: "http.response.total_ms", + HttpRoute: "http.route", + HttpServerDurationMs: "http.server.duration_ms", + HttpStatusCode: "http.status_code", + HttpTarget: "http.target", + HttpUrl: "http.url", + HttpUserAgent: "http.user_agent", + InvitationRole: "invitation.role", + LlmBackend: "llm.backend", + LlmCompactionPause: "llm.compaction.pause", + LlmErrorStage: "llm.error_stage", + LlmProtocol: "llm.protocol", + LlmRequestBodyBytes: "llm.request.body_bytes", + LlmRequestCompactionTrigger: "llm.request.compaction_trigger", + LlmStreamBytes: "llm.stream.bytes", + LlmStreamChunks: "llm.stream.chunks", + LlmStreamFirstChunkBytes: "llm.stream.first_chunk_bytes", + LlmStreamFirstChunkMs: "llm.stream.first_chunk_ms", + LlmStreamFirstTokenMs: "llm.stream.first_token_ms", + LlmStreamOpenMs: "llm.stream.open_ms", + LlmStreamTotalMs: "llm.stream.total_ms", + LockAcquired: "lock.acquired", + LockBackend: "lock.backend", + LockTimedOut: "lock.timed_out", + LockTimeoutMs: "lock.timeout_ms", + LoopId: "loop.id", + LoopIterations: "loop.iterations", + LoopName: "loop.name", + ManageKnowledgeBaseId: "manage_knowledge_base.id", + ManageKnowledgeBaseName: "manage_knowledge_base.name", + McpExecutionStatus: "mcp.execution_status", + McpServerId: "mcp.server_id", + McpServerName: "mcp.server_name", + McpToolName: "mcp.tool_name", + McpTransport: "mcp.transport", + MemberRole: "member.role", + MemoryContentBytes: "memory.content_bytes", + MemoryFound: "memory.found", + MemoryPath: "memory.path", + MemoryRowCount: "memory.row_count", + MessageId: "message.id", + MessagesDeserializeMs: "messages.deserialize_ms", + MessagesSerializeOp: "messages.serialize.op", + MessagesSerializeSite: "messages.serialize.site", + MessagesSerializeMs: "messages.serialize_ms", + MessagingDestinationName: "messaging.destination.name", + MessagingSystem: "messaging.system", + ModelDurationMs: "model.duration_ms", + ModelId: "model.id", + ModelName: "model.name", + MothershipOrigin: "mothership.origin", + NetPeerName: "net.peer.name", + OauthProvider: "oauth.provider", + ParallelBranches: "parallel.branches", + ParallelId: "parallel.id", + ParallelName: "parallel.name", + PrefsToolCount: "prefs.tool_count", + ProcessingChunkSize: "processing.chunk_size", + ProcessingRecipe: "processing.recipe", + PromptCacheableBlocks: "prompt.cacheable_blocks", + PromptComponent: "prompt.component", + PromptRegionFilesChars: "prompt.region.files_chars", + PromptRegionFilesCount: "prompt.region.files_count", + PromptRegionHistoryChars: "prompt.region.history_chars", + PromptRegionHistoryMessages: "prompt.region.history_messages", + PromptRegionRuntimeTailChars: "prompt.region.runtime_tail_chars", + PromptRegionSteeringChars: "prompt.region.steering_chars", + PromptRegionToolResultsChars: "prompt.region.tool_results_chars", + PromptRegionVfsChars: "prompt.region.vfs_chars", + PromptRegionVfsMessages: "prompt.region.vfs_messages", + PromptRuntimeActiveSkillsChars: "prompt.runtime.active_skills_chars", + PromptRuntimeTaggedResourcesChars: "prompt.runtime.tagged_resources_chars", + PromptSectionAgentGuidanceChars: "prompt.section.agent_guidance_chars", + PromptSectionCapabilitiesChars: "prompt.section.capabilities_chars", + PromptSectionCredentialsChars: "prompt.section.credentials_chars", + PromptSectionOverrideChars: "prompt.section.override_chars", + PromptSectionPersonaChars: "prompt.section.persona_chars", + PromptSectionPoliciesChars: "prompt.section.policies_chars", + PromptSectionSkillsIndexChars: "prompt.section.skills_index_chars", + PromptSectionSpawnContextChars: "prompt.section.spawn_context_chars", + PromptSectionSubagentDocsChars: "prompt.section.subagent_docs_chars", + PromptSectionToolDocsChars: "prompt.section.tool_docs_chars", + PromptSectionWorkspaceGuideChars: "prompt.section.workspace_guide_chars", + PromptSectionWorkspaceInventoryChars: "prompt.section.workspace_inventory_chars", + PromptSet: "prompt.set", + PromptSite: "prompt.site", + PromptSystemBlocks: "prompt.system_blocks", + PromptSystemChars: "prompt.system_chars", + PromptToolsWireChars: "prompt.tools.wire_chars", + PromptToolsWireCount: "prompt.tools.wire_count", + ProviderId: "provider.id", + RateLimitAttempt: "rate_limit.attempt", + RateLimitCount: "rate_limit.count", + RateLimitDelayMs: "rate_limit.delay_ms", + RateLimitLimit: "rate_limit.limit", + RateLimitMaxRetries: "rate_limit.max_retries", + RateLimitOutcome: "rate_limit.outcome", + RateLimitRetryAfterMs: "rate_limit.retry_after_ms", + RequestGoTraceId: "request.go_trace_id", + RequestId: "request.id", + RequiredVersion: "required.version", + ResumeRequestBodyBytes: "resume.request.body_bytes", + ResumeResultsCount: "resume.results.count", + ResumeResultsDataBytes: "resume.results.data_bytes", + ResumeResultsFailureCount: "resume.results.failure_count", + ResumeResultsSuccessCount: "resume.results.success_count", + RouterBackendName: "router.backend_name", + RouterConfigVersion: "router.config_version", + RouterId: "router.id", + RouterName: "router.name", + RouterRouteReason: "router.route_reason", + RouterSelectedBackend: "router.selected_backend", + RouterSelectedPath: "router.selected_path", + RunId: "run.id", + SearchResultsCount: "search.results_count", + ServerAddress: "server.address", + ServiceInstanceId: "service.instance.id", + ServiceName: "service.name", + ServiceNamespace: "service.namespace", + ServiceVersion: "service.version", + SettleCompleted: "settle.completed", + SettleTimeoutMs: "settle.timeout_ms", + SettleWaitMs: "settle.wait_ms", + SimOperation: "sim.operation", + SimRequestId: "sim.request_id", + SpanDurationMs: "span.duration_ms", + SpanStatus: "span.status", + SpanType: "span.type", + StreamId: "stream.id", + SubagentDepth: "subagent.depth", + SubagentEscalationApplied: "subagent.escalation.applied", + SubagentEscalationPriorCalls: "subagent.escalation.prior_calls", + SubagentEscalationRequested: "subagent.escalation.requested", + SubagentExecutionPhase: "subagent.execution.phase", + SubagentId: "subagent.id", + SubagentNested: "subagent.nested", + SubagentOutcomeContentBytes: "subagent.outcome.content_bytes", + SubagentOutcomeError: "subagent.outcome.error", + SubagentOutcomeFirstChunkMs: "subagent.outcome.first_chunk_ms", + SubagentOutcomeLlmRounds: "subagent.outcome.llm_rounds", + SubagentOutcomeStructuredType: "subagent.outcome.structured_type", + SubagentOutcomeSuccess: "subagent.outcome.success", + SubagentOutcomeToolCallCount: "subagent.outcome.tool_call_count", + SubagentParentAgentId: "subagent.parent_agent_id", + SubagentRouteManifestMissing: "subagent.route.manifest_missing", + SubagentSessionId: "subagent.session.id", + SubagentSessionOperation: "subagent.session.operation", + SubagentSessionPersistenceOutcome: "subagent.session.persistence_outcome", + SubagentSessionRevision: "subagent.session.revision", + SubagentSessionRunId: "subagent.session.run_id", + SubagentSessionTitle: "subagent.session.title", + SubagentToolCallId: "subagent.tool_call_id", + TaskAge: "task.age", + TaskDecisionCount: "task.decision_count", + TaskErrorCount: "task.error_count", + TaskFound: "task.found", + TaskId: "task.id", + TaskListLimit: "task.list_limit", + TaskRows: "task.rows", + TaskStatus: "task.status", + TaskStepCount: "task.step_count", + TelemetrySdkLanguage: "telemetry.sdk.language", + TelemetrySdkName: "telemetry.sdk.name", + TelemetrySdkVersion: "telemetry.sdk.version", + TemplateId: "template.id", + TemplateName: "template.name", + ThrottleReason: "throttle.reason", + ToolArgsBytes: "tool.args.bytes", + ToolArgsCount: "tool.args.count", + ToolArgsPreview: "tool.args.preview", + ToolAsyncWaiterPollCount: "tool.async_waiter.poll_count", + ToolAsyncWaiterPubsubDeliveries: "tool.async_waiter.pubsub_deliveries", + ToolAsyncWaiterResolution: "tool.async_waiter.resolution", + ToolCallId: "tool.call_id", + ToolClientCount: "tool.client.count", + ToolClientExecutable: "tool.client_executable", + ToolCompletionReceived: "tool.completion.received", + ToolConfirmationStatus: "tool.confirmation.status", + ToolDeferredCount: "tool.deferred.count", + ToolDurationMs: "tool.duration_ms", + ToolErrorKind: "tool.error_kind", + ToolExecutor: "tool.executor", + ToolExternalService: "tool.external.service", + ToolId: "tool.id", + ToolLoadedCount: "tool.loaded.count", + ToolName: "tool.name", + ToolOutcome: "tool.outcome", + ToolOutcomeMessage: "tool.outcome.message", + ToolParentSpan: "tool.parent_span", + ToolPayloadBytes: "tool.payload.bytes", + ToolResultArtifact: "tool.result.artifact", + ToolResultBytes: "tool.result.bytes", + ToolResultSuccess: "tool.result.success", + ToolScheduled: "tool.scheduled", + ToolStatus: "tool.status", + ToolStatusCode: "tool.status_code", + ToolStoreStatus: "tool.store_status", + ToolSync: "tool.sync", + ToolTimeoutMs: "tool.timeout_ms", + ToolVisibleCount: "tool.visible.count", + ToolVisibleNames: "tool.visible.names", + TraceAborted: "trace.aborted", + TraceBilledTotalCost: "trace.billed_total_cost", + TraceCacheAttemptedRequests: "trace.cache_attempted_requests", + TraceCacheHitRequests: "trace.cache_hit_requests", + TraceCacheReadTokens: "trace.cache_read_tokens", + TraceCacheWriteRequests: "trace.cache_write_requests", + TraceCacheWriteTokens: "trace.cache_write_tokens", + TraceDurationMs: "trace.duration_ms", + TraceError: "trace.error", + TraceGoId: "trace.go_id", + TraceInputTokens: "trace.input_tokens", + TraceModel: "trace.model", + TraceOutcome: "trace.outcome", + TraceOutputTokens: "trace.output_tokens", + TraceProvider: "trace.provider", + TraceRawTotalCost: "trace.raw_total_cost", + TraceSpanCount: "trace.span_count", + TraceToolCallCount: "trace.tool_call_count", + UserAuthMethod: "user.auth_method", + UserAuthProvider: "user.auth_provider", + UserEmail: "user.email", + UserId: "user.id", + WebhookId: "webhook.id", + WebhookProvider: "webhook.provider", + WebhookTriggerSuccess: "webhook.trigger_success", + WorkflowBlockTypes: "workflow.block_types", + WorkflowBlocksCount: "workflow.blocks_count", + WorkflowCreatedId: "workflow.created_id", + WorkflowDurationMs: "workflow.duration_ms", + WorkflowEdgesCount: "workflow.edges_count", + WorkflowHasFolder: "workflow.has_folder", + WorkflowHasWorkspace: "workflow.has_workspace", + WorkflowId: "workflow.id", + WorkflowLoopsCount: "workflow.loops_count", + WorkflowName: "workflow.name", + WorkflowNewId: "workflow.new_id", + WorkflowParallelsCount: "workflow.parallels_count", + WorkflowSourceId: "workflow.source_id", + WorkflowTrigger: "workflow.trigger", + WorkspaceId: "workspace.id", + WorkspaceName: "workspace.name", +} as const; -export type TraceAttrKey = keyof typeof TraceAttr -export type TraceAttrValue = (typeof TraceAttr)[TraceAttrKey] +export type TraceAttrKey = keyof typeof TraceAttr; +export type TraceAttrValue = (typeof TraceAttr)[TraceAttrKey]; /** Readonly sorted list of every canonical custom attribute key. */ export const TraceAttrValues: readonly TraceAttrValue[] = [ - 'abort.backend', - 'abort.found', - 'abort.redis_result', - 'analytics.aborted', - 'analytics.billed_cache_read_cost', - 'analytics.billed_cache_write_cost', - 'analytics.billed_input_cost', - 'analytics.billed_output_cost', - 'analytics.billed_total_cost', - 'analytics.cache_attempted_requests', - 'analytics.cache_hit_requests', - 'analytics.cache_read_tokens', - 'analytics.cache_write_requests', - 'analytics.cache_write_tokens', - 'analytics.customer_type', - 'analytics.duration_ms', - 'analytics.error', - 'analytics.input_tokens', - 'analytics.model', - 'analytics.output_tokens', - 'analytics.provider', - 'analytics.raw_cache_read_cost', - 'analytics.raw_cache_write_cost', - 'analytics.raw_input_cost', - 'analytics.raw_output_cost', - 'analytics.raw_total_cost', - 'analytics.source', - 'analytics.tool_call_count', - 'api_key.id', - 'api_key.name', - 'auth.incoming_internal', - 'auth.key.match', - 'auth.key.preview', - 'auth.key.source', - 'auth.key.type', - 'auth.provider', - 'auth.validate.status_code', - 'aws.region', - 'billing.attempts', - 'billing.byok', - 'billing.change_type', - 'billing.cost.input_usd', - 'billing.cost.output_usd', - 'billing.cost.total_usd', - 'billing.cost_usd', - 'billing.customer_type', - 'billing.duplicate', - 'billing.duration_ms', - 'billing.has_idempotency_key', - 'billing.idempotency_key', - 'billing.interval', - 'billing.is_mcp', - 'billing.llm_cost', - 'billing.long_context', - 'billing.new_plan', - 'billing.outcome', - 'billing.plan', - 'billing.previous_plan', - 'billing.service_charges', - 'billing.source', - 'billing.total_cost', - 'billing.usage.current', - 'billing.usage.exceeded', - 'billing.usage.limit', - 'block.id', - 'block.name', - 'block.type', - 'chat.active_messages_bytes', - 'chat.active_messages_count', - 'chat.append_bytes', - 'chat.append_count', - 'chat.artifact_keys', - 'chat.artifacts_bytes', - 'chat.auth_type', - 'chat.blob.op', - 'chat.blob.site', - 'chat.blob_bytes_offloaded', - 'chat.blob_bytes_resolved', - 'chat.blobs_offloaded', - 'chat.blobs_resolved', - 'chat.context_count', - 'chat.context_usage', - 'chat.continuation.messages_before', - 'chat.continuation.tool_result_bytes', - 'chat.continuation.tool_result_failure', - 'chat.continuation.tool_result_success', - 'chat.continuation.tool_results', - 'chat.continuation.total_tool_calls', - 'chat.existing_message_count', - 'chat.file_attachment_count', - 'chat.finalize.outcome', - 'chat.found', - 'chat.has_assistant_message', - 'chat.has_output_configs', - 'chat.id', - 'chat.message_bytes', - 'chat.messages_after', - 'chat.messages_bytes', - 'chat.messages_count', - 'chat.persist.outcome', - 'chat.preexisting', - 'chat.rollback_index', - 'chat.tokens_used', - 'chat.type', - 'chat.user_message_id', - 'checkpoint.age', - 'checkpoint.attempts_bytes', - 'checkpoint.bytes.assistant_tool_use', - 'checkpoint.bytes.current_messages', - 'checkpoint.bytes.immediate_results', - 'checkpoint.bytes.pending_tool_calls', - 'checkpoint.bytes.provider_request', - 'checkpoint.bytes.request_context', - 'checkpoint.bytes.tool_usage', - 'checkpoint.cached_credentials_bytes', - 'checkpoint.claimed', - 'checkpoint.claimed_now', - 'checkpoint.completed_bytes', - 'checkpoint.completed_steps', - 'checkpoint.current_messages', - 'checkpoint.decisions_bytes', - 'checkpoint.found', - 'checkpoint.frames', - 'checkpoint.id', - 'checkpoint.immediate_results', - 'checkpoint.message_id', - 'checkpoint.pending_bytes', - 'checkpoint.pending_steps', - 'checkpoint.pending_tool_count', - 'checkpoint.rows', - 'checkpoint.task_id', - 'checkpoint.total_tool_calls', - 'checkpoint.workflow_snapshot_bytes', - 'client.version', - 'condition.id', - 'condition.name', - 'condition.result', - 'context.reduce.budget_chars', - 'context.reduce.budget_source', - 'context.reduce.caller', - 'context.reduce.did_reduce', - 'context.reduce.input_chars', - 'context.reduce.input_messages', - 'context.reduce.outcome', - 'context.reduce.output_chars', - 'context.reduce.output_messages', - 'context.reduced', - 'context.summarize.input_chars', - 'context.summarize.output_chars', - 'context.transform.caller', - 'context.transform.chars_in', - 'context.transform.chars_out', - 'context.transform.drop_count', - 'context.transform.drops', - 'context.transform.messages_in', - 'context.transform.messages_out', - 'context.transform.stage', - 'copilot.abort.controller_fired', - 'copilot.abort.go_marker_ok', - 'copilot.abort.local_aborted', - 'copilot.abort.marker_written', - 'copilot.abort.outcome', - 'copilot.abort.unknown_reason', - 'copilot.async_subagent.agent', - 'copilot.async_subagent.count', - 'copilot.async_subagent.delta_chars', - 'copilot.async_subagent.id', - 'copilot.async_subagent.reminders', - 'copilot.async_subagent.slept_ms', - 'copilot.async_subagent.status', - 'copilot.async_subagent.wait_mode', - 'copilot.async_subagent.wake_reason', - 'copilot.async_tool.claimed_by', - 'copilot.async_tool.has_error', - 'copilot.async_tool.ids_count', - 'copilot.async_tool.permission_decision', - 'copilot.async_tool.status', - 'copilot.async_tool.worker_id', - 'copilot.branch.kind', - 'copilot.chat.is_new', - 'copilot.checkpoint.pending_tool_call_id', - 'copilot.commands.count', - 'copilot.confirm.outcome', - 'copilot.contexts.count', - 'copilot.degraded.reason', - 'copilot.execution.id', - 'copilot.file_attachments.count', - 'copilot.finalize.outcome', - 'copilot.interrupted_prior_stream', - 'copilot.leg', - 'copilot.mode', - 'copilot.operation', - 'copilot.output_file.bytes', - 'copilot.output_file.format', - 'copilot.output_file.id', - 'copilot.output_file.mime_type', - 'copilot.output_file.mode', - 'copilot.output_file.name', - 'copilot.output_file.outcome', - 'copilot.output_file.path', - 'copilot.output_file.sandbox_path', - 'copilot.pending_stream.wait_ms', - 'copilot.prefetch', - 'copilot.publisher.client_disconnected', - 'copilot.publisher.saw_complete', - 'copilot.recovery.latest_seq', - 'copilot.recovery.oldest_seq', - 'copilot.recovery.outcome', - 'copilot.recovery.requested_after_seq', - 'copilot.request.cancel_reason', - 'copilot.request.outcome', - 'copilot.request.will_retry_on_stream_error', - 'copilot.resource_attachments.count', - 'copilot.resources.aborted', - 'copilot.resources.op', - 'copilot.resources.removed_count', - 'copilot.resources.upserted_count', - 'copilot.result.content_blocks', - 'copilot.result.content_length', - 'copilot.result.tool_calls', - 'copilot.resume.after_cursor', - 'copilot.resume.duration_ms', - 'copilot.resume.event_count', - 'copilot.resume.outcome', - 'copilot.resume.poll_iterations', - 'copilot.resume.preview_session_count', - 'copilot.route', - 'copilot.run.agent', - 'copilot.run.has_completed_at', - 'copilot.run.has_error', - 'copilot.run.model', - 'copilot.run.parent_id', - 'copilot.run.provider', - 'copilot.run.status', - 'copilot.sse.bytes_received', - 'copilot.sse.chunks_received', - 'copilot.sse.close_reason', - 'copilot.sse.events.complete', - 'copilot.sse.events.error', - 'copilot.sse.events.received', - 'copilot.sse.events.resource', - 'copilot.sse.events.run', - 'copilot.sse.events.session', - 'copilot.sse.events.span', - 'copilot.sse.events.text', - 'copilot.sse.events.tool', - 'copilot.sse.expected_terminal', - 'copilot.sse.first_event_ms', - 'copilot.sse.longest_dispatch_ms', - 'copilot.sse.longest_inbound_gap_ms', - 'copilot.sse.terminal_event_missing', - 'copilot.sse.terminal_event_seen', - 'copilot.sse.total_dispatch_ms', - 'copilot.steer.outcome', - 'copilot.steering.content_chars', - 'copilot.steering.entries', - 'copilot.steering.mode', - 'copilot.steering.salvaged_chars', - 'copilot.stop.appended_assistant', - 'copilot.stop.blocks_count', - 'copilot.stop.content_length', - 'copilot.stop.outcome', - 'copilot.stream', - 'copilot.surface', - 'copilot.table.id', - 'copilot.table.outcome', - 'copilot.table.row_count', - 'copilot.table.source.content_bytes', - 'copilot.table.source.format', - 'copilot.table.source.path', - 'copilot.trace.span_count', - 'copilot.transport', - 'copilot.user.message_preview', - 'copilot.validate.outcome', - 'copilot.vfs.delta.outcome', - 'copilot.vfs.file.extension', - 'copilot.vfs.file.media_type', - 'copilot.vfs.file.name', - 'copilot.vfs.file.size_bytes', - 'copilot.vfs.has_alpha', - 'copilot.vfs.input.bytes', - 'copilot.vfs.input.height', - 'copilot.vfs.input.media_type_claimed', - 'copilot.vfs.input.media_type_detected', - 'copilot.vfs.input.width', - 'copilot.vfs.materialize.file_count', - 'copilot.vfs.materialize.phase_ms', - 'copilot.vfs.metadata.failed', - 'copilot.vfs.outcome', - 'copilot.vfs.output.bytes', - 'copilot.vfs.output.media_type', - 'copilot.vfs.phase', - 'copilot.vfs.read.image.resized', - 'copilot.vfs.read.outcome', - 'copilot.vfs.read.output.bytes', - 'copilot.vfs.read.output.lines', - 'copilot.vfs.read.output.media_type', - 'copilot.vfs.read.path', - 'copilot.vfs.resize.attempts', - 'copilot.vfs.resize.chosen_dimension', - 'copilot.vfs.resize.chosen_quality', - 'copilot.vfs.resize.dimension', - 'copilot.vfs.resize.fits_budget', - 'copilot.vfs.resize.output_bytes', - 'copilot.vfs.resize.quality', - 'copilot.vfs.resized', - 'copilot.vfs.sharp.load_failed', - 'cost.default_cost', - 'credential_set.id', - 'credential_set.name', - 'db.operation', - 'db.sql.table', - 'db.system', - 'deployment.environment', - 'deployment.version', - 'document.file_size', - 'document.mime_type', - 'documents.count', - 'documents.upload_type', - 'error', - 'error.code', - 'error.internal', - 'error.message', - 'error.type', - 'event.name', - 'event.timestamp', - 'execution.blocks_executed', - 'execution.duration_ms', - 'execution.error_message', - 'execution.has_errors', - 'execution.status', - 'execution.total_cost', - 'execution.trigger', - 'function.execution_time_ms', - 'function.id', - 'function.name', - 'gen_ai.agent.id', - 'gen_ai.agent.name', - 'gen_ai.cache.outcome', - 'gen_ai.cache.token.type', - 'gen_ai.cost.input', - 'gen_ai.cost.output', - 'gen_ai.cost.total', - 'gen_ai.input.messages', - 'gen_ai.operation.name', - 'gen_ai.output.messages', - 'gen_ai.provider.name', - 'gen_ai.request.assistant_messages', - 'gen_ai.request.cacheable_system_blocks', - 'gen_ai.request.content_blocks', - 'gen_ai.request.has_cache_control', - 'gen_ai.request.image_blocks', - 'gen_ai.request.image_data_bytes', - 'gen_ai.request.max_message_blocks', - 'gen_ai.request.messages.count', - 'gen_ai.request.model', - 'gen_ai.request.prompt_cache.breakpoint.created', - 'gen_ai.request.prompt_cache.breakpoint.dynamic_write_suppress_reason', - 'gen_ai.request.prompt_cache.breakpoint.dynamic_write_suppressed', - 'gen_ai.request.prompt_cache.breakpoint.eligible', - 'gen_ai.request.prompt_cache.breakpoint.kind', - 'gen_ai.request.prompt_cache.breakpoint.minimum_tokens', - 'gen_ai.request.prompt_cache.breakpoint.prefix_tokens_estimated', - 'gen_ai.request.prompt_cache.breakpoint.previous_boundary_tokens', - 'gen_ai.request.prompt_cache.breakpoint.section', - 'gen_ai.request.prompt_cache.breakpoint.skip_reason', - 'gen_ai.request.prompt_cache.breakpoint.target_index', - 'gen_ai.request.prompt_cache.breakpoint.target_role', - 'gen_ai.request.prompt_cache.breakpoint.target_type', - 'gen_ai.request.prompt_cache.breakpoint.threshold_tokens', - 'gen_ai.request.prompt_cache.breakpoint.ttl', - 'gen_ai.request.prompt_cache.breakpoints.count', - 'gen_ai.request.prompt_cache.breakpoints.created', - 'gen_ai.request.prompt_cache.dynamic.minimum_tokens', - 'gen_ai.request.prompt_cache.dynamic.prefix_tokens_estimated', - 'gen_ai.request.prompt_cache.dynamic.previous_boundary_tokens', - 'gen_ai.request.prompt_cache.dynamic.skip_reason', - 'gen_ai.request.prompt_cache.dynamic.target_type', - 'gen_ai.request.prompt_cache.dynamic.threshold_tokens', - 'gen_ai.request.prompt_cache.dynamic.ttl', - 'gen_ai.request.prompt_cache.dynamic_user_eligible', - 'gen_ai.request.prompt_cache.dynamic_user_skip_reason', - 'gen_ai.request.prompt_cache.static.ttl', - 'gen_ai.request.prompt_cache.static_system', - 'gen_ai.request.prompt_cache.static_tools', - 'gen_ai.request.runtime_context_chars', - 'gen_ai.request.runtime_context_messages', - 'gen_ai.request.system_blocks', - 'gen_ai.request.system_chars', - 'gen_ai.request.text_blocks', - 'gen_ai.request.tool_result_blocks', - 'gen_ai.request.tool_use_blocks', - 'gen_ai.request.tools.count', - 'gen_ai.request.user_messages', - 'gen_ai.response.finish_reasons', - 'gen_ai.response.model', - 'gen_ai.stream.phase.text.bytes', - 'gen_ai.stream.phase.text.chunks', - 'gen_ai.stream.phase.text.first_ms', - 'gen_ai.stream.phase.text.ms', - 'gen_ai.stream.phase.thinking.bytes', - 'gen_ai.stream.phase.thinking.chunks', - 'gen_ai.stream.phase.thinking.first_ms', - 'gen_ai.stream.phase.thinking.ms', - 'gen_ai.stream.phase.tool_args.bytes', - 'gen_ai.stream.phase.tool_args.chunks', - 'gen_ai.stream.phase.tool_args.first_ms', - 'gen_ai.stream.phase.tool_args.ms', - 'gen_ai.system', - 'gen_ai.thinking.blocks_captured', - 'gen_ai.thinking.redacted_blocks', - 'gen_ai.token.type', - 'gen_ai.tool.name', - 'gen_ai.usage.cache_creation.input_tokens', - 'gen_ai.usage.cache_creation_tokens', - 'gen_ai.usage.cache_read.input_tokens', - 'gen_ai.usage.cache_read_tokens', - 'gen_ai.usage.context_tokens', - 'gen_ai.usage.input_tokens', - 'gen_ai.usage.output_tokens', - 'gen_ai.usage.thinking_tokens', - 'gen_ai.usage.total_tokens', - 'gen_ai.workflow.id', - 'gen_ai.workflow.name', - 'hosted_key.env_var', - 'http.host', - 'http.method', - 'http.path', - 'http.remote_addr', - 'http.request.content_length', - 'http.response.body_bytes', - 'http.response.content_length', - 'http.response.headers_ms', - 'http.response.total_ms', - 'http.route', - 'http.server.duration_ms', - 'http.status_code', - 'http.target', - 'http.url', - 'http.user_agent', - 'invitation.role', - 'llm.backend', - 'llm.compaction.pause', - 'llm.error_stage', - 'llm.protocol', - 'llm.request.body_bytes', - 'llm.request.compaction_trigger', - 'llm.stream.bytes', - 'llm.stream.chunks', - 'llm.stream.first_chunk_bytes', - 'llm.stream.first_chunk_ms', - 'llm.stream.first_token_ms', - 'llm.stream.open_ms', - 'llm.stream.total_ms', - 'lock.acquired', - 'lock.backend', - 'lock.timed_out', - 'lock.timeout_ms', - 'loop.id', - 'loop.iterations', - 'loop.name', - 'manage_knowledge_base.id', - 'manage_knowledge_base.name', - 'mcp.execution_status', - 'mcp.server_id', - 'mcp.server_name', - 'mcp.tool_name', - 'mcp.transport', - 'member.role', - 'memory.content_bytes', - 'memory.found', - 'memory.path', - 'memory.row_count', - 'message.id', - 'messages.deserialize_ms', - 'messages.serialize.op', - 'messages.serialize.site', - 'messages.serialize_ms', - 'messaging.destination.name', - 'messaging.system', - 'model.duration_ms', - 'model.id', - 'model.name', - 'mothership.origin', - 'net.peer.name', - 'oauth.provider', - 'parallel.branches', - 'parallel.id', - 'parallel.name', - 'prefs.tool_count', - 'processing.chunk_size', - 'processing.recipe', - 'prompt.cacheable_blocks', - 'prompt.component', - 'prompt.region.files_chars', - 'prompt.region.files_count', - 'prompt.region.history_chars', - 'prompt.region.history_messages', - 'prompt.region.runtime_tail_chars', - 'prompt.region.steering_chars', - 'prompt.region.tool_results_chars', - 'prompt.region.vfs_chars', - 'prompt.region.vfs_messages', - 'prompt.runtime.active_skills_chars', - 'prompt.runtime.tagged_resources_chars', - 'prompt.section.agent_guidance_chars', - 'prompt.section.capabilities_chars', - 'prompt.section.credentials_chars', - 'prompt.section.override_chars', - 'prompt.section.persona_chars', - 'prompt.section.policies_chars', - 'prompt.section.skills_index_chars', - 'prompt.section.spawn_context_chars', - 'prompt.section.subagent_docs_chars', - 'prompt.section.tool_docs_chars', - 'prompt.section.workspace_guide_chars', - 'prompt.section.workspace_inventory_chars', - 'prompt.set', - 'prompt.site', - 'prompt.system_blocks', - 'prompt.system_chars', - 'prompt.tools.wire_chars', - 'prompt.tools.wire_count', - 'provider.id', - 'rate_limit.attempt', - 'rate_limit.count', - 'rate_limit.delay_ms', - 'rate_limit.limit', - 'rate_limit.max_retries', - 'rate_limit.outcome', - 'rate_limit.retry_after_ms', - 'request.go_trace_id', - 'request.id', - 'required.version', - 'resume.request.body_bytes', - 'resume.results.count', - 'resume.results.data_bytes', - 'resume.results.failure_count', - 'resume.results.success_count', - 'router.backend_name', - 'router.config_version', - 'router.id', - 'router.name', - 'router.route_reason', - 'router.selected_backend', - 'router.selected_path', - 'run.id', - 'search.results_count', - 'server.address', - 'service.instance.id', - 'service.name', - 'service.namespace', - 'service.version', - 'settle.completed', - 'settle.timeout_ms', - 'settle.wait_ms', - 'sim.operation', - 'sim.request_id', - 'span.duration_ms', - 'span.status', - 'span.type', - 'stream.id', - 'subagent.depth', - 'subagent.escalation.applied', - 'subagent.escalation.prior_calls', - 'subagent.escalation.requested', - 'subagent.execution.phase', - 'subagent.id', - 'subagent.nested', - 'subagent.outcome.content_bytes', - 'subagent.outcome.error', - 'subagent.outcome.first_chunk_ms', - 'subagent.outcome.llm_rounds', - 'subagent.outcome.structured_type', - 'subagent.outcome.success', - 'subagent.outcome.tool_call_count', - 'subagent.parent_agent_id', - 'subagent.route.manifest_missing', - 'subagent.session.id', - 'subagent.session.operation', - 'subagent.session.persistence_outcome', - 'subagent.session.revision', - 'subagent.session.run_id', - 'subagent.session.title', - 'subagent.tool_call_id', - 'task.age', - 'task.decision_count', - 'task.error_count', - 'task.found', - 'task.id', - 'task.list_limit', - 'task.rows', - 'task.status', - 'task.step_count', - 'telemetry.sdk.language', - 'telemetry.sdk.name', - 'telemetry.sdk.version', - 'template.id', - 'template.name', - 'throttle.reason', - 'tool.args.bytes', - 'tool.args.count', - 'tool.args.preview', - 'tool.async_waiter.poll_count', - 'tool.async_waiter.pubsub_deliveries', - 'tool.async_waiter.resolution', - 'tool.call_id', - 'tool.client.count', - 'tool.client_executable', - 'tool.completion.received', - 'tool.confirmation.status', - 'tool.deferred.count', - 'tool.duration_ms', - 'tool.error_kind', - 'tool.executor', - 'tool.external.service', - 'tool.id', - 'tool.loaded.count', - 'tool.name', - 'tool.outcome', - 'tool.outcome.message', - 'tool.parent_span', - 'tool.payload.bytes', - 'tool.result.artifact', - 'tool.result.bytes', - 'tool.result.success', - 'tool.scheduled', - 'tool.status', - 'tool.status_code', - 'tool.store_status', - 'tool.sync', - 'tool.timeout_ms', - 'tool.visible.count', - 'tool.visible.names', - 'trace.aborted', - 'trace.billed_total_cost', - 'trace.cache_attempted_requests', - 'trace.cache_hit_requests', - 'trace.cache_read_tokens', - 'trace.cache_write_requests', - 'trace.cache_write_tokens', - 'trace.duration_ms', - 'trace.error', - 'trace.go_id', - 'trace.input_tokens', - 'trace.model', - 'trace.outcome', - 'trace.output_tokens', - 'trace.provider', - 'trace.raw_total_cost', - 'trace.span_count', - 'trace.tool_call_count', - 'user.auth_method', - 'user.auth_provider', - 'user.email', - 'user.id', - 'webhook.id', - 'webhook.provider', - 'webhook.trigger_success', - 'workflow.block_types', - 'workflow.blocks_count', - 'workflow.created_id', - 'workflow.duration_ms', - 'workflow.edges_count', - 'workflow.has_folder', - 'workflow.has_workspace', - 'workflow.id', - 'workflow.loops_count', - 'workflow.name', - 'workflow.new_id', - 'workflow.parallels_count', - 'workflow.source_id', - 'workflow.trigger', - 'workspace.id', - 'workspace.name', -] as const + "abort.backend", + "abort.found", + "abort.redis_result", + "analytics.aborted", + "analytics.billed_cache_read_cost", + "analytics.billed_cache_write_cost", + "analytics.billed_input_cost", + "analytics.billed_output_cost", + "analytics.billed_total_cost", + "analytics.cache_attempted_requests", + "analytics.cache_hit_requests", + "analytics.cache_read_tokens", + "analytics.cache_write_requests", + "analytics.cache_write_tokens", + "analytics.customer_type", + "analytics.duration_ms", + "analytics.error", + "analytics.input_tokens", + "analytics.model", + "analytics.output_tokens", + "analytics.provider", + "analytics.raw_cache_read_cost", + "analytics.raw_cache_write_cost", + "analytics.raw_input_cost", + "analytics.raw_output_cost", + "analytics.raw_total_cost", + "analytics.source", + "analytics.tool_call_count", + "api_key.id", + "api_key.name", + "auth.incoming_internal", + "auth.key.match", + "auth.key.preview", + "auth.key.source", + "auth.key.type", + "auth.provider", + "auth.validate.status_code", + "aws.region", + "billing.attempts", + "billing.byok", + "billing.change_type", + "billing.cost.input_usd", + "billing.cost.output_usd", + "billing.cost.total_usd", + "billing.cost_usd", + "billing.customer_type", + "billing.duplicate", + "billing.duration_ms", + "billing.has_idempotency_key", + "billing.idempotency_key", + "billing.interval", + "billing.is_mcp", + "billing.llm_cost", + "billing.long_context", + "billing.new_plan", + "billing.outcome", + "billing.plan", + "billing.previous_plan", + "billing.service_charges", + "billing.source", + "billing.total_cost", + "billing.usage.current", + "billing.usage.exceeded", + "billing.usage.limit", + "block.id", + "block.name", + "block.type", + "chat.active_messages_bytes", + "chat.active_messages_count", + "chat.append_bytes", + "chat.append_count", + "chat.artifact_keys", + "chat.artifacts_bytes", + "chat.auth_type", + "chat.blob.op", + "chat.blob.site", + "chat.blob_bytes_offloaded", + "chat.blob_bytes_resolved", + "chat.blobs_offloaded", + "chat.blobs_resolved", + "chat.context_count", + "chat.context_usage", + "chat.continuation.messages_before", + "chat.continuation.tool_result_bytes", + "chat.continuation.tool_result_failure", + "chat.continuation.tool_result_success", + "chat.continuation.tool_results", + "chat.continuation.total_tool_calls", + "chat.existing_message_count", + "chat.file_attachment_count", + "chat.finalize.outcome", + "chat.found", + "chat.has_assistant_message", + "chat.has_output_configs", + "chat.id", + "chat.message_bytes", + "chat.messages_after", + "chat.messages_bytes", + "chat.messages_count", + "chat.persist.outcome", + "chat.preexisting", + "chat.rollback_index", + "chat.tokens_used", + "chat.type", + "chat.user_message_id", + "checkpoint.age", + "checkpoint.attempts_bytes", + "checkpoint.bytes.assistant_tool_use", + "checkpoint.bytes.current_messages", + "checkpoint.bytes.immediate_results", + "checkpoint.bytes.pending_tool_calls", + "checkpoint.bytes.provider_request", + "checkpoint.bytes.request_context", + "checkpoint.bytes.tool_usage", + "checkpoint.cached_credentials_bytes", + "checkpoint.claimed", + "checkpoint.claimed_now", + "checkpoint.completed_bytes", + "checkpoint.completed_steps", + "checkpoint.current_messages", + "checkpoint.decisions_bytes", + "checkpoint.found", + "checkpoint.frames", + "checkpoint.id", + "checkpoint.immediate_results", + "checkpoint.message_id", + "checkpoint.pending_bytes", + "checkpoint.pending_steps", + "checkpoint.pending_tool_count", + "checkpoint.rows", + "checkpoint.task_id", + "checkpoint.total_tool_calls", + "checkpoint.workflow_snapshot_bytes", + "client.version", + "condition.id", + "condition.name", + "condition.result", + "context.reduce.budget_chars", + "context.reduce.budget_source", + "context.reduce.caller", + "context.reduce.did_reduce", + "context.reduce.input_chars", + "context.reduce.input_messages", + "context.reduce.outcome", + "context.reduce.output_chars", + "context.reduce.output_messages", + "context.reduced", + "context.summarize.input_chars", + "context.summarize.output_chars", + "context.transform.caller", + "context.transform.chars_in", + "context.transform.chars_out", + "context.transform.drop_count", + "context.transform.drops", + "context.transform.messages_in", + "context.transform.messages_out", + "context.transform.stage", + "copilot.abort.controller_fired", + "copilot.abort.go_marker_ok", + "copilot.abort.local_aborted", + "copilot.abort.marker_written", + "copilot.abort.outcome", + "copilot.abort.unknown_reason", + "copilot.async_subagent.agent", + "copilot.async_subagent.count", + "copilot.async_subagent.delta_chars", + "copilot.async_subagent.id", + "copilot.async_subagent.reminders", + "copilot.async_subagent.slept_ms", + "copilot.async_subagent.status", + "copilot.async_subagent.wait_mode", + "copilot.async_subagent.wake_reason", + "copilot.async_tool.claimed_by", + "copilot.async_tool.has_error", + "copilot.async_tool.ids_count", + "copilot.async_tool.permission_decision", + "copilot.async_tool.status", + "copilot.async_tool.worker_id", + "copilot.branch.kind", + "copilot.chat.is_new", + "copilot.checkpoint.pending_tool_call_id", + "copilot.commands.count", + "copilot.confirm.outcome", + "copilot.contexts.count", + "copilot.degraded.reason", + "copilot.execution.id", + "copilot.file_attachments.count", + "copilot.finalize.outcome", + "copilot.interrupted_prior_stream", + "copilot.leg", + "copilot.mode", + "copilot.operation", + "copilot.output_file.bytes", + "copilot.output_file.format", + "copilot.output_file.id", + "copilot.output_file.mime_type", + "copilot.output_file.mode", + "copilot.output_file.name", + "copilot.output_file.outcome", + "copilot.output_file.path", + "copilot.output_file.sandbox_path", + "copilot.pending_stream.wait_ms", + "copilot.prefetch", + "copilot.publisher.client_disconnected", + "copilot.publisher.saw_complete", + "copilot.recovery.latest_seq", + "copilot.recovery.oldest_seq", + "copilot.recovery.outcome", + "copilot.recovery.requested_after_seq", + "copilot.request.cancel_reason", + "copilot.request.outcome", + "copilot.request.will_retry_on_stream_error", + "copilot.resource_attachments.count", + "copilot.resources.aborted", + "copilot.resources.op", + "copilot.resources.removed_count", + "copilot.resources.upserted_count", + "copilot.result.content_blocks", + "copilot.result.content_length", + "copilot.result.tool_calls", + "copilot.resume.after_cursor", + "copilot.resume.duration_ms", + "copilot.resume.event_count", + "copilot.resume.outcome", + "copilot.resume.poll_iterations", + "copilot.resume.preview_session_count", + "copilot.route", + "copilot.run.agent", + "copilot.run.has_completed_at", + "copilot.run.has_error", + "copilot.run.model", + "copilot.run.parent_id", + "copilot.run.provider", + "copilot.run.status", + "copilot.sse.bytes_received", + "copilot.sse.chunks_received", + "copilot.sse.close_reason", + "copilot.sse.events.complete", + "copilot.sse.events.error", + "copilot.sse.events.received", + "copilot.sse.events.resource", + "copilot.sse.events.run", + "copilot.sse.events.session", + "copilot.sse.events.span", + "copilot.sse.events.text", + "copilot.sse.events.tool", + "copilot.sse.expected_terminal", + "copilot.sse.first_event_ms", + "copilot.sse.longest_dispatch_ms", + "copilot.sse.longest_inbound_gap_ms", + "copilot.sse.terminal_event_missing", + "copilot.sse.terminal_event_seen", + "copilot.sse.total_dispatch_ms", + "copilot.steer.outcome", + "copilot.steering.content_chars", + "copilot.steering.entries", + "copilot.steering.mode", + "copilot.steering.salvaged_chars", + "copilot.stop.appended_assistant", + "copilot.stop.blocks_count", + "copilot.stop.content_length", + "copilot.stop.outcome", + "copilot.stream", + "copilot.surface", + "copilot.table.id", + "copilot.table.outcome", + "copilot.table.row_count", + "copilot.table.source.content_bytes", + "copilot.table.source.format", + "copilot.table.source.path", + "copilot.trace.span_count", + "copilot.transport", + "copilot.user.message_preview", + "copilot.validate.outcome", + "copilot.vfs.delta.outcome", + "copilot.vfs.file.extension", + "copilot.vfs.file.media_type", + "copilot.vfs.file.name", + "copilot.vfs.file.size_bytes", + "copilot.vfs.has_alpha", + "copilot.vfs.input.bytes", + "copilot.vfs.input.height", + "copilot.vfs.input.media_type_claimed", + "copilot.vfs.input.media_type_detected", + "copilot.vfs.input.width", + "copilot.vfs.materialize.file_count", + "copilot.vfs.materialize.phase_ms", + "copilot.vfs.metadata.failed", + "copilot.vfs.outcome", + "copilot.vfs.output.bytes", + "copilot.vfs.output.media_type", + "copilot.vfs.phase", + "copilot.vfs.read.image.resized", + "copilot.vfs.read.outcome", + "copilot.vfs.read.output.bytes", + "copilot.vfs.read.output.lines", + "copilot.vfs.read.output.media_type", + "copilot.vfs.read.path", + "copilot.vfs.resize.attempts", + "copilot.vfs.resize.chosen_dimension", + "copilot.vfs.resize.chosen_quality", + "copilot.vfs.resize.dimension", + "copilot.vfs.resize.fits_budget", + "copilot.vfs.resize.output_bytes", + "copilot.vfs.resize.quality", + "copilot.vfs.resized", + "copilot.vfs.sharp.load_failed", + "cost.default_cost", + "credential_set.id", + "credential_set.name", + "db.operation", + "db.sql.table", + "db.system", + "deployment.environment", + "deployment.version", + "document.file_size", + "document.mime_type", + "documents.count", + "documents.upload_type", + "error", + "error.code", + "error.internal", + "error.message", + "error.type", + "event.name", + "event.timestamp", + "execution.blocks_executed", + "execution.duration_ms", + "execution.error_message", + "execution.has_errors", + "execution.status", + "execution.total_cost", + "execution.trigger", + "function.execution_time_ms", + "function.id", + "function.name", + "gen_ai.agent.id", + "gen_ai.agent.name", + "gen_ai.cache.outcome", + "gen_ai.cache.token.type", + "gen_ai.cost.input", + "gen_ai.cost.output", + "gen_ai.cost.total", + "gen_ai.input.messages", + "gen_ai.operation.name", + "gen_ai.output.messages", + "gen_ai.provider.name", + "gen_ai.request.assistant_messages", + "gen_ai.request.cacheable_system_blocks", + "gen_ai.request.content_blocks", + "gen_ai.request.has_cache_control", + "gen_ai.request.image_blocks", + "gen_ai.request.image_data_bytes", + "gen_ai.request.max_message_blocks", + "gen_ai.request.messages.count", + "gen_ai.request.model", + "gen_ai.request.prompt_cache.breakpoint.created", + "gen_ai.request.prompt_cache.breakpoint.dynamic_write_suppress_reason", + "gen_ai.request.prompt_cache.breakpoint.dynamic_write_suppressed", + "gen_ai.request.prompt_cache.breakpoint.eligible", + "gen_ai.request.prompt_cache.breakpoint.kind", + "gen_ai.request.prompt_cache.breakpoint.minimum_tokens", + "gen_ai.request.prompt_cache.breakpoint.prefix_tokens_estimated", + "gen_ai.request.prompt_cache.breakpoint.previous_boundary_tokens", + "gen_ai.request.prompt_cache.breakpoint.section", + "gen_ai.request.prompt_cache.breakpoint.skip_reason", + "gen_ai.request.prompt_cache.breakpoint.target_index", + "gen_ai.request.prompt_cache.breakpoint.target_role", + "gen_ai.request.prompt_cache.breakpoint.target_type", + "gen_ai.request.prompt_cache.breakpoint.threshold_tokens", + "gen_ai.request.prompt_cache.breakpoint.ttl", + "gen_ai.request.prompt_cache.breakpoints.count", + "gen_ai.request.prompt_cache.breakpoints.created", + "gen_ai.request.prompt_cache.dynamic.minimum_tokens", + "gen_ai.request.prompt_cache.dynamic.prefix_tokens_estimated", + "gen_ai.request.prompt_cache.dynamic.previous_boundary_tokens", + "gen_ai.request.prompt_cache.dynamic.skip_reason", + "gen_ai.request.prompt_cache.dynamic.target_type", + "gen_ai.request.prompt_cache.dynamic.threshold_tokens", + "gen_ai.request.prompt_cache.dynamic.ttl", + "gen_ai.request.prompt_cache.dynamic_user_eligible", + "gen_ai.request.prompt_cache.dynamic_user_skip_reason", + "gen_ai.request.prompt_cache.static.ttl", + "gen_ai.request.prompt_cache.static_system", + "gen_ai.request.prompt_cache.static_tools", + "gen_ai.request.runtime_context_chars", + "gen_ai.request.runtime_context_messages", + "gen_ai.request.system_blocks", + "gen_ai.request.system_chars", + "gen_ai.request.text_blocks", + "gen_ai.request.tool_result_blocks", + "gen_ai.request.tool_use_blocks", + "gen_ai.request.tools.count", + "gen_ai.request.user_messages", + "gen_ai.response.finish_reasons", + "gen_ai.response.model", + "gen_ai.stream.phase.text.bytes", + "gen_ai.stream.phase.text.chunks", + "gen_ai.stream.phase.text.first_ms", + "gen_ai.stream.phase.text.ms", + "gen_ai.stream.phase.thinking.bytes", + "gen_ai.stream.phase.thinking.chunks", + "gen_ai.stream.phase.thinking.first_ms", + "gen_ai.stream.phase.thinking.ms", + "gen_ai.stream.phase.tool_args.bytes", + "gen_ai.stream.phase.tool_args.chunks", + "gen_ai.stream.phase.tool_args.first_ms", + "gen_ai.stream.phase.tool_args.ms", + "gen_ai.system", + "gen_ai.thinking.blocks_captured", + "gen_ai.thinking.redacted_blocks", + "gen_ai.token.type", + "gen_ai.tool.name", + "gen_ai.usage.cache_creation.input_tokens", + "gen_ai.usage.cache_creation_tokens", + "gen_ai.usage.cache_read.input_tokens", + "gen_ai.usage.cache_read_tokens", + "gen_ai.usage.context_tokens", + "gen_ai.usage.input_tokens", + "gen_ai.usage.output_tokens", + "gen_ai.usage.thinking_tokens", + "gen_ai.usage.total_tokens", + "gen_ai.workflow.id", + "gen_ai.workflow.name", + "hosted_key.env_var", + "http.host", + "http.method", + "http.path", + "http.remote_addr", + "http.request.content_length", + "http.response.body_bytes", + "http.response.content_length", + "http.response.headers_ms", + "http.response.total_ms", + "http.route", + "http.server.duration_ms", + "http.status_code", + "http.target", + "http.url", + "http.user_agent", + "invitation.role", + "llm.backend", + "llm.compaction.pause", + "llm.error_stage", + "llm.protocol", + "llm.request.body_bytes", + "llm.request.compaction_trigger", + "llm.stream.bytes", + "llm.stream.chunks", + "llm.stream.first_chunk_bytes", + "llm.stream.first_chunk_ms", + "llm.stream.first_token_ms", + "llm.stream.open_ms", + "llm.stream.total_ms", + "lock.acquired", + "lock.backend", + "lock.timed_out", + "lock.timeout_ms", + "loop.id", + "loop.iterations", + "loop.name", + "manage_knowledge_base.id", + "manage_knowledge_base.name", + "mcp.execution_status", + "mcp.server_id", + "mcp.server_name", + "mcp.tool_name", + "mcp.transport", + "member.role", + "memory.content_bytes", + "memory.found", + "memory.path", + "memory.row_count", + "message.id", + "messages.deserialize_ms", + "messages.serialize.op", + "messages.serialize.site", + "messages.serialize_ms", + "messaging.destination.name", + "messaging.system", + "model.duration_ms", + "model.id", + "model.name", + "mothership.origin", + "net.peer.name", + "oauth.provider", + "parallel.branches", + "parallel.id", + "parallel.name", + "prefs.tool_count", + "processing.chunk_size", + "processing.recipe", + "prompt.cacheable_blocks", + "prompt.component", + "prompt.region.files_chars", + "prompt.region.files_count", + "prompt.region.history_chars", + "prompt.region.history_messages", + "prompt.region.runtime_tail_chars", + "prompt.region.steering_chars", + "prompt.region.tool_results_chars", + "prompt.region.vfs_chars", + "prompt.region.vfs_messages", + "prompt.runtime.active_skills_chars", + "prompt.runtime.tagged_resources_chars", + "prompt.section.agent_guidance_chars", + "prompt.section.capabilities_chars", + "prompt.section.credentials_chars", + "prompt.section.override_chars", + "prompt.section.persona_chars", + "prompt.section.policies_chars", + "prompt.section.skills_index_chars", + "prompt.section.spawn_context_chars", + "prompt.section.subagent_docs_chars", + "prompt.section.tool_docs_chars", + "prompt.section.workspace_guide_chars", + "prompt.section.workspace_inventory_chars", + "prompt.set", + "prompt.site", + "prompt.system_blocks", + "prompt.system_chars", + "prompt.tools.wire_chars", + "prompt.tools.wire_count", + "provider.id", + "rate_limit.attempt", + "rate_limit.count", + "rate_limit.delay_ms", + "rate_limit.limit", + "rate_limit.max_retries", + "rate_limit.outcome", + "rate_limit.retry_after_ms", + "request.go_trace_id", + "request.id", + "required.version", + "resume.request.body_bytes", + "resume.results.count", + "resume.results.data_bytes", + "resume.results.failure_count", + "resume.results.success_count", + "router.backend_name", + "router.config_version", + "router.id", + "router.name", + "router.route_reason", + "router.selected_backend", + "router.selected_path", + "run.id", + "search.results_count", + "server.address", + "service.instance.id", + "service.name", + "service.namespace", + "service.version", + "settle.completed", + "settle.timeout_ms", + "settle.wait_ms", + "sim.operation", + "sim.request_id", + "span.duration_ms", + "span.status", + "span.type", + "stream.id", + "subagent.depth", + "subagent.escalation.applied", + "subagent.escalation.prior_calls", + "subagent.escalation.requested", + "subagent.execution.phase", + "subagent.id", + "subagent.nested", + "subagent.outcome.content_bytes", + "subagent.outcome.error", + "subagent.outcome.first_chunk_ms", + "subagent.outcome.llm_rounds", + "subagent.outcome.structured_type", + "subagent.outcome.success", + "subagent.outcome.tool_call_count", + "subagent.parent_agent_id", + "subagent.route.manifest_missing", + "subagent.session.id", + "subagent.session.operation", + "subagent.session.persistence_outcome", + "subagent.session.revision", + "subagent.session.run_id", + "subagent.session.title", + "subagent.tool_call_id", + "task.age", + "task.decision_count", + "task.error_count", + "task.found", + "task.id", + "task.list_limit", + "task.rows", + "task.status", + "task.step_count", + "telemetry.sdk.language", + "telemetry.sdk.name", + "telemetry.sdk.version", + "template.id", + "template.name", + "throttle.reason", + "tool.args.bytes", + "tool.args.count", + "tool.args.preview", + "tool.async_waiter.poll_count", + "tool.async_waiter.pubsub_deliveries", + "tool.async_waiter.resolution", + "tool.call_id", + "tool.client.count", + "tool.client_executable", + "tool.completion.received", + "tool.confirmation.status", + "tool.deferred.count", + "tool.duration_ms", + "tool.error_kind", + "tool.executor", + "tool.external.service", + "tool.id", + "tool.loaded.count", + "tool.name", + "tool.outcome", + "tool.outcome.message", + "tool.parent_span", + "tool.payload.bytes", + "tool.result.artifact", + "tool.result.bytes", + "tool.result.success", + "tool.scheduled", + "tool.status", + "tool.status_code", + "tool.store_status", + "tool.sync", + "tool.timeout_ms", + "tool.visible.count", + "tool.visible.names", + "trace.aborted", + "trace.billed_total_cost", + "trace.cache_attempted_requests", + "trace.cache_hit_requests", + "trace.cache_read_tokens", + "trace.cache_write_requests", + "trace.cache_write_tokens", + "trace.duration_ms", + "trace.error", + "trace.go_id", + "trace.input_tokens", + "trace.model", + "trace.outcome", + "trace.output_tokens", + "trace.provider", + "trace.raw_total_cost", + "trace.span_count", + "trace.tool_call_count", + "user.auth_method", + "user.auth_provider", + "user.email", + "user.id", + "webhook.id", + "webhook.provider", + "webhook.trigger_success", + "workflow.block_types", + "workflow.blocks_count", + "workflow.created_id", + "workflow.duration_ms", + "workflow.edges_count", + "workflow.has_folder", + "workflow.has_workspace", + "workflow.id", + "workflow.loops_count", + "workflow.name", + "workflow.new_id", + "workflow.parallels_count", + "workflow.source_id", + "workflow.trigger", + "workspace.id", + "workspace.name", +] as const; diff --git a/apps/sim/lib/mothership/generated/trace-events-v1.ts b/apps/sim/lib/mothership/generated/trace-events-v1.ts index 348712485d7..c94f4994824 100644 --- a/apps/sim/lib/mothership/generated/trace-events-v1.ts +++ b/apps/sim/lib/mothership/generated/trace-events-v1.ts @@ -1,56 +1,51 @@ -// AUTO-GENERATED FILE. DO NOT EDIT. -// -// Source: copilot/copilot/contracts/trace-events-v1.schema.json -// Regenerate with: bun run trace-events-contract:generate -// -// Canonical mothership OTel span event names. Call sites should -// reference `TraceEvent.` (e.g. -// `TraceEvent.RequestCancelled`) rather than raw string literals, -// so the Go-side contract is the single source of truth and typos -// become compile errors. +// GENERATED — do not edit. Source of truth: mothership worker packages/contracts/src/trace-events-v1.ts +// Regenerate with `bun run contracts:sync` in the worker. + +// Canonical mothership OTel span event names Sim emits. Call sites reference +// `TraceEvent.` rather than raw strings so typos are compile errors. export const TraceEvent = { - ContextTransform: 'context.transform', - CopilotDbTransactionBodyComplete: 'copilot.db.transaction.body_complete', - CopilotDbTransactionReady: 'copilot.db.transaction.ready', - CopilotOutputFileError: 'copilot.output_file.error', - CopilotSseFirstEvent: 'copilot.sse.first_event', - CopilotSseIdleGapExceeded: 'copilot.sse.idle_gap_exceeded', - CopilotSseTerminalEventReceived: 'copilot.sse.terminal_event_received', - CopilotTableError: 'copilot.table.error', - CopilotVfsParseFailed: 'copilot.vfs.parse_failed', - CopilotVfsResizeAttempt: 'copilot.vfs.resize_attempt', - CopilotVfsResizeAttemptFailed: 'copilot.vfs.resize_attempt_failed', - GenAiPromptCacheBreakpoint: 'gen_ai.prompt_cache.breakpoint', - LlmInvokeSent: 'llm.invoke.sent', - LlmStreamFirstChunk: 'llm.stream.first_chunk', - LlmStreamOpened: 'llm.stream.opened', - PgNotifyFailed: 'pg_notify_failed', - RedisSubscribed: 'redis.subscribed', - RequestCancelled: 'request.cancelled', -} as const + ContextTransform: "context.transform", + CopilotDbTransactionBodyComplete: "copilot.db.transaction.body_complete", + CopilotDbTransactionReady: "copilot.db.transaction.ready", + CopilotOutputFileError: "copilot.output_file.error", + CopilotSseFirstEvent: "copilot.sse.first_event", + CopilotSseIdleGapExceeded: "copilot.sse.idle_gap_exceeded", + CopilotSseTerminalEventReceived: "copilot.sse.terminal_event_received", + CopilotTableError: "copilot.table.error", + CopilotVfsParseFailed: "copilot.vfs.parse_failed", + CopilotVfsResizeAttempt: "copilot.vfs.resize_attempt", + CopilotVfsResizeAttemptFailed: "copilot.vfs.resize_attempt_failed", + GenAiPromptCacheBreakpoint: "gen_ai.prompt_cache.breakpoint", + LlmInvokeSent: "llm.invoke.sent", + LlmStreamFirstChunk: "llm.stream.first_chunk", + LlmStreamOpened: "llm.stream.opened", + PgNotifyFailed: "pg_notify_failed", + RedisSubscribed: "redis.subscribed", + RequestCancelled: "request.cancelled", +} as const; -export type TraceEventKey = keyof typeof TraceEvent -export type TraceEventValue = (typeof TraceEvent)[TraceEventKey] +export type TraceEventKey = keyof typeof TraceEvent; +export type TraceEventValue = (typeof TraceEvent)[TraceEventKey]; /** Readonly sorted list of every canonical event name. */ export const TraceEventValues: readonly TraceEventValue[] = [ - 'context.transform', - 'copilot.db.transaction.body_complete', - 'copilot.db.transaction.ready', - 'copilot.output_file.error', - 'copilot.sse.first_event', - 'copilot.sse.idle_gap_exceeded', - 'copilot.sse.terminal_event_received', - 'copilot.table.error', - 'copilot.vfs.parse_failed', - 'copilot.vfs.resize_attempt', - 'copilot.vfs.resize_attempt_failed', - 'gen_ai.prompt_cache.breakpoint', - 'llm.invoke.sent', - 'llm.stream.first_chunk', - 'llm.stream.opened', - 'pg_notify_failed', - 'redis.subscribed', - 'request.cancelled', -] as const + "context.transform", + "copilot.db.transaction.body_complete", + "copilot.db.transaction.ready", + "copilot.output_file.error", + "copilot.sse.first_event", + "copilot.sse.idle_gap_exceeded", + "copilot.sse.terminal_event_received", + "copilot.table.error", + "copilot.vfs.parse_failed", + "copilot.vfs.resize_attempt", + "copilot.vfs.resize_attempt_failed", + "gen_ai.prompt_cache.breakpoint", + "llm.invoke.sent", + "llm.stream.first_chunk", + "llm.stream.opened", + "pg_notify_failed", + "redis.subscribed", + "request.cancelled", +] as const; diff --git a/apps/sim/lib/mothership/generated/trace-spans-v1.ts b/apps/sim/lib/mothership/generated/trace-spans-v1.ts index 872c1799ab7..642b3a30a52 100644 --- a/apps/sim/lib/mothership/generated/trace-spans-v1.ts +++ b/apps/sim/lib/mothership/generated/trace-spans-v1.ts @@ -1,193 +1,190 @@ -// AUTO-GENERATED FILE. DO NOT EDIT. -// -// Source: copilot/copilot/contracts/trace-spans-v1.schema.json -// Regenerate with: bun run trace-spans-contract:generate -// -// Canonical mothership OTel span names. Call sites should reference -// `TraceSpan.` (e.g. `TraceSpan.CopilotVfsReadFile`) -// rather than raw string literals, so the Go-side contract is the -// single source of truth and typos become compile errors. +// GENERATED — do not edit. Source of truth: mothership worker packages/contracts/src/trace-spans-v1.ts +// Regenerate with `bun run contracts:sync` in the worker. + +// Canonical mothership OTel span names Sim emits. Call sites reference +// `TraceSpan.` rather than raw strings so typos are compile errors. The +// worker's own span names live in telemetry.ts. export const TraceSpan = { - AsyncToolStoreSet: 'async_tool_store.set', - AuthRateLimitRecord: 'auth.rate_limit.record', - AuthValidateKey: 'auth.validate_key', - ChatAsyncSubagentRun: 'chat.async_subagent.run', - ChatAsyncSubagentShutdown: 'chat.async_subagent.shutdown', - ChatAsyncSubagentSpawn: 'chat.async_subagent.spawn', - ChatContinueWithToolResults: 'chat.continue_with_tool_results', - ChatExplicitAbortConsume: 'chat.explicit_abort.consume', - ChatExplicitAbortFlushPausedBilling: 'chat.explicit_abort.flush_paused_billing', - ChatExplicitAbortHandle: 'chat.explicit_abort.handle', - ChatExplicitAbortMark: 'chat.explicit_abort.mark', - ChatExplicitAbortPeek: 'chat.explicit_abort.peek', - ChatGateAcquire: 'chat.gate.acquire', - ChatOrchestrateInterrupt: 'chat.orchestrate.interrupt', - ChatOrchestrateSteer: 'chat.orchestrate.steer', - ChatOrchestrateTail: 'chat.orchestrate.tail', - ChatOrchestrateWait: 'chat.orchestrate.wait', - ChatPersistAfterDone: 'chat.persist_after_done', - ChatSetup: 'chat.setup', - ContextReduce: 'context.reduce', - ContextSummarizeChunk: 'context.summarize_chunk', - CopilotAnalyticsFlush: 'copilot.analytics.flush', - CopilotAnalyticsSaveRequest: 'copilot.analytics.save_request', - CopilotAnalyticsUpdateBilling: 'copilot.analytics.update_billing', - CopilotAsyncRunsClaimCompleted: 'copilot.async_runs.claim_completed', - CopilotAsyncRunsCreateRunCheckpoint: 'copilot.async_runs.create_run_checkpoint', - CopilotAsyncRunsCreateRunSegment: 'copilot.async_runs.create_run_segment', - CopilotAsyncRunsGetAsyncToolCall: 'copilot.async_runs.get_async_tool_call', - CopilotAsyncRunsGetLatestForExecution: 'copilot.async_runs.get_latest_for_execution', - CopilotAsyncRunsGetLatestForStream: 'copilot.async_runs.get_latest_for_stream', - CopilotAsyncRunsGetMany: 'copilot.async_runs.get_many', - CopilotAsyncRunsGetRunSegment: 'copilot.async_runs.get_run_segment', - CopilotAsyncRunsListForRun: 'copilot.async_runs.list_for_run', - CopilotAsyncRunsMarkAsyncToolStatus: 'copilot.async_runs.mark_async_tool_status', - CopilotAsyncRunsReleaseClaim: 'copilot.async_runs.release_claim', - CopilotAsyncRunsUpdateRunStatus: 'copilot.async_runs.update_run_status', - CopilotAsyncRunsUpsertAsyncToolCall: 'copilot.async_runs.upsert_async_tool_call', - CopilotAuthValidateApiKey: 'copilot.auth.validate_api_key', - CopilotBillingUpdateCost: 'copilot.billing.update_cost', - CopilotChatAbortActiveStream: 'copilot.chat.abort_active_stream', - CopilotChatAbortStream: 'copilot.chat.abort_stream', - CopilotChatAbortWaitSettle: 'copilot.chat.abort_wait_settle', - CopilotChatAcquirePendingStreamLock: 'copilot.chat.acquire_pending_stream_lock', - CopilotChatBuildExecutionContext: 'copilot.chat.build_execution_context', - CopilotChatBuildPayload: 'copilot.chat.build_payload', - CopilotChatBuildWorkspaceContext: 'copilot.chat.build_workspace_context', - CopilotChatFinalizeAssistantTurn: 'copilot.chat.finalize_assistant_turn', - CopilotChatPersistUserMessage: 'copilot.chat.persist_user_message', - CopilotChatResolveAgentContexts: 'copilot.chat.resolve_agent_contexts', - CopilotChatResolveBranch: 'copilot.chat.resolve_branch', - CopilotChatResolveOrCreateChat: 'copilot.chat.resolve_or_create_chat', - CopilotChatSteerStream: 'copilot.chat.steer_stream', - CopilotChatStopStream: 'copilot.chat.stop_stream', - CopilotCliCurate: 'copilot.cli.curate', - CopilotCliHttpHeaders: 'copilot.cli.http_headers', - CopilotCliIdentity: 'copilot.cli.identity', - CopilotCliInvoke: 'copilot.cli.invoke', - CopilotCliSink: 'copilot.cli.sink', - CopilotConfirmToolResult: 'copilot.confirm.tool_result', - CopilotDbQuery: 'copilot.db.query', - CopilotDbTransaction: 'copilot.db.transaction', - CopilotFinalizeStream: 'copilot.finalize_stream', - CopilotRecoveryCheckReplayGap: 'copilot.recovery.check_replay_gap', - CopilotResumeRequest: 'copilot.resume.request', - CopilotSseReadLoop: 'copilot.sse.read_loop', - CopilotSubagentExecute: 'copilot.subagent.execute', - CopilotToolResultCommit: 'copilot.tool.result_commit', - CopilotToolRuntime: 'copilot.tool.runtime', - CopilotToolWaitForClientResult: 'copilot.tool.wait_for_client_result', - CopilotToolWaitForPermission: 'copilot.tool.wait_for_permission', - CopilotToolPermissionDecide: 'copilot.tool_permission.decide', - CopilotToolsExecuteInband: 'copilot.tools.execute_inband', - CopilotToolsHandleResourceSideEffects: 'copilot.tools.handle_resource_side_effects', - CopilotToolsWriteCsvToTable: 'copilot.tools.write_csv_to_table', - CopilotToolsWriteOutputFile: 'copilot.tools.write_output_file', - CopilotToolsWriteOutputTable: 'copilot.tools.write_output_table', - CopilotVfsMaterialize: 'copilot.vfs.materialize', - CopilotVfsPrepareImage: 'copilot.vfs.prepare_image', - CopilotVfsReadFile: 'copilot.vfs.read_file', - GenAiAgentExecute: 'gen_ai.agent.execute', - LlmStream: 'llm.stream', - ProviderRouterRoute: 'provider.router.route', - SimExecuteTool: 'sim.execute_tool', - SimUpdateCost: 'sim.update_cost', - SimValidateApiKey: 'sim.validate_api_key', - ToolAsyncWaiterWait: 'tool.async_waiter.wait', - ToolExecute: 'tool.execute', -} as const + AsyncToolStoreSet: "async_tool_store.set", + AuthRateLimitRecord: "auth.rate_limit.record", + AuthValidateKey: "auth.validate_key", + ChatAsyncSubagentRun: "chat.async_subagent.run", + ChatAsyncSubagentShutdown: "chat.async_subagent.shutdown", + ChatAsyncSubagentSpawn: "chat.async_subagent.spawn", + ChatContinueWithToolResults: "chat.continue_with_tool_results", + ChatExplicitAbortConsume: "chat.explicit_abort.consume", + ChatExplicitAbortFlushPausedBilling: "chat.explicit_abort.flush_paused_billing", + ChatExplicitAbortHandle: "chat.explicit_abort.handle", + ChatExplicitAbortMark: "chat.explicit_abort.mark", + ChatExplicitAbortPeek: "chat.explicit_abort.peek", + ChatGateAcquire: "chat.gate.acquire", + ChatOrchestrateInterrupt: "chat.orchestrate.interrupt", + ChatOrchestrateSteer: "chat.orchestrate.steer", + ChatOrchestrateTail: "chat.orchestrate.tail", + ChatOrchestrateWait: "chat.orchestrate.wait", + ChatPersistAfterDone: "chat.persist_after_done", + ChatSetup: "chat.setup", + ContextReduce: "context.reduce", + ContextSummarizeChunk: "context.summarize_chunk", + CopilotAnalyticsFlush: "copilot.analytics.flush", + CopilotAnalyticsSaveRequest: "copilot.analytics.save_request", + CopilotAnalyticsUpdateBilling: "copilot.analytics.update_billing", + CopilotAsyncRunsClaimCompleted: "copilot.async_runs.claim_completed", + CopilotAsyncRunsCreateRunCheckpoint: "copilot.async_runs.create_run_checkpoint", + CopilotAsyncRunsCreateRunSegment: "copilot.async_runs.create_run_segment", + CopilotAsyncRunsGetAsyncToolCall: "copilot.async_runs.get_async_tool_call", + CopilotAsyncRunsGetLatestForExecution: "copilot.async_runs.get_latest_for_execution", + CopilotAsyncRunsGetLatestForStream: "copilot.async_runs.get_latest_for_stream", + CopilotAsyncRunsGetMany: "copilot.async_runs.get_many", + CopilotAsyncRunsGetRunSegment: "copilot.async_runs.get_run_segment", + CopilotAsyncRunsListForRun: "copilot.async_runs.list_for_run", + CopilotAsyncRunsMarkAsyncToolStatus: "copilot.async_runs.mark_async_tool_status", + CopilotAsyncRunsReleaseClaim: "copilot.async_runs.release_claim", + CopilotAsyncRunsUpdateRunStatus: "copilot.async_runs.update_run_status", + CopilotAsyncRunsUpsertAsyncToolCall: "copilot.async_runs.upsert_async_tool_call", + CopilotAuthValidateApiKey: "copilot.auth.validate_api_key", + CopilotBillingUpdateCost: "copilot.billing.update_cost", + CopilotChatAbortActiveStream: "copilot.chat.abort_active_stream", + CopilotChatAbortStream: "copilot.chat.abort_stream", + CopilotChatAbortWaitSettle: "copilot.chat.abort_wait_settle", + CopilotChatAcquirePendingStreamLock: "copilot.chat.acquire_pending_stream_lock", + CopilotChatBuildExecutionContext: "copilot.chat.build_execution_context", + CopilotChatBuildPayload: "copilot.chat.build_payload", + CopilotChatBuildWorkspaceContext: "copilot.chat.build_workspace_context", + CopilotChatFinalizeAssistantTurn: "copilot.chat.finalize_assistant_turn", + CopilotChatPersistUserMessage: "copilot.chat.persist_user_message", + CopilotChatResolveAgentContexts: "copilot.chat.resolve_agent_contexts", + CopilotChatResolveBranch: "copilot.chat.resolve_branch", + CopilotChatResolveOrCreateChat: "copilot.chat.resolve_or_create_chat", + CopilotChatSteerStream: "copilot.chat.steer_stream", + CopilotChatStopStream: "copilot.chat.stop_stream", + CopilotCliCurate: "copilot.cli.curate", + CopilotCliHttpHeaders: "copilot.cli.http_headers", + CopilotCliIdentity: "copilot.cli.identity", + CopilotCliInvoke: "copilot.cli.invoke", + CopilotCliSink: "copilot.cli.sink", + CopilotConfirmToolResult: "copilot.confirm.tool_result", + CopilotDbQuery: "copilot.db.query", + CopilotDbTransaction: "copilot.db.transaction", + CopilotFinalizeStream: "copilot.finalize_stream", + CopilotRecoveryCheckReplayGap: "copilot.recovery.check_replay_gap", + CopilotResumeRequest: "copilot.resume.request", + CopilotSseReadLoop: "copilot.sse.read_loop", + CopilotSubagentExecute: "copilot.subagent.execute", + CopilotToolResultCommit: "copilot.tool.result_commit", + CopilotToolRuntime: "copilot.tool.runtime", + CopilotToolWaitForClientResult: "copilot.tool.wait_for_client_result", + CopilotToolWaitForPermission: "copilot.tool.wait_for_permission", + CopilotToolPermissionDecide: "copilot.tool_permission.decide", + CopilotToolsExecuteInband: "copilot.tools.execute_inband", + CopilotToolsHandleResourceSideEffects: "copilot.tools.handle_resource_side_effects", + CopilotToolsWriteCsvToTable: "copilot.tools.write_csv_to_table", + CopilotToolsWriteOutputFile: "copilot.tools.write_output_file", + CopilotToolsWriteOutputTable: "copilot.tools.write_output_table", + CopilotVfsMaterialize: "copilot.vfs.materialize", + CopilotVfsPrepareImage: "copilot.vfs.prepare_image", + CopilotVfsReadFile: "copilot.vfs.read_file", + GenAiAgentExecute: "gen_ai.agent.execute", + LlmStream: "llm.stream", + ProviderRouterRoute: "provider.router.route", + SimExecuteTool: "sim.execute_tool", + SimUpdateCost: "sim.update_cost", + SimValidateApiKey: "sim.validate_api_key", + ToolAsyncWaiterWait: "tool.async_waiter.wait", + ToolExecute: "tool.execute", +} as const; -export type TraceSpanKey = keyof typeof TraceSpan -export type TraceSpanValue = (typeof TraceSpan)[TraceSpanKey] +export type TraceSpanKey = keyof typeof TraceSpan; +export type TraceSpanValue = (typeof TraceSpan)[TraceSpanKey]; /** Readonly sorted list of every canonical span name. */ export const TraceSpanValues: readonly TraceSpanValue[] = [ - 'async_tool_store.set', - 'auth.rate_limit.record', - 'auth.validate_key', - 'chat.async_subagent.run', - 'chat.async_subagent.shutdown', - 'chat.async_subagent.spawn', - 'chat.continue_with_tool_results', - 'chat.explicit_abort.consume', - 'chat.explicit_abort.flush_paused_billing', - 'chat.explicit_abort.handle', - 'chat.explicit_abort.mark', - 'chat.explicit_abort.peek', - 'chat.gate.acquire', - 'chat.orchestrate.interrupt', - 'chat.orchestrate.steer', - 'chat.orchestrate.tail', - 'chat.orchestrate.wait', - 'chat.persist_after_done', - 'chat.setup', - 'context.reduce', - 'context.summarize_chunk', - 'copilot.analytics.flush', - 'copilot.analytics.save_request', - 'copilot.analytics.update_billing', - 'copilot.async_runs.claim_completed', - 'copilot.async_runs.create_run_checkpoint', - 'copilot.async_runs.create_run_segment', - 'copilot.async_runs.get_async_tool_call', - 'copilot.async_runs.get_latest_for_execution', - 'copilot.async_runs.get_latest_for_stream', - 'copilot.async_runs.get_many', - 'copilot.async_runs.get_run_segment', - 'copilot.async_runs.list_for_run', - 'copilot.async_runs.mark_async_tool_status', - 'copilot.async_runs.release_claim', - 'copilot.async_runs.update_run_status', - 'copilot.async_runs.upsert_async_tool_call', - 'copilot.auth.validate_api_key', - 'copilot.billing.update_cost', - 'copilot.chat.abort_active_stream', - 'copilot.chat.abort_stream', - 'copilot.chat.abort_wait_settle', - 'copilot.chat.acquire_pending_stream_lock', - 'copilot.chat.build_execution_context', - 'copilot.chat.build_payload', - 'copilot.chat.build_workspace_context', - 'copilot.chat.finalize_assistant_turn', - 'copilot.chat.persist_user_message', - 'copilot.chat.resolve_agent_contexts', - 'copilot.chat.resolve_branch', - 'copilot.chat.resolve_or_create_chat', - 'copilot.chat.steer_stream', - 'copilot.chat.stop_stream', - 'copilot.cli.curate', - 'copilot.cli.http_headers', - 'copilot.cli.identity', - 'copilot.cli.invoke', - 'copilot.cli.sink', - 'copilot.confirm.tool_result', - 'copilot.db.query', - 'copilot.db.transaction', - 'copilot.finalize_stream', - 'copilot.recovery.check_replay_gap', - 'copilot.resume.request', - 'copilot.sse.read_loop', - 'copilot.subagent.execute', - 'copilot.tool.result_commit', - 'copilot.tool.runtime', - 'copilot.tool.wait_for_client_result', - 'copilot.tool.wait_for_permission', - 'copilot.tool_permission.decide', - 'copilot.tools.execute_inband', - 'copilot.tools.handle_resource_side_effects', - 'copilot.tools.write_csv_to_table', - 'copilot.tools.write_output_file', - 'copilot.tools.write_output_table', - 'copilot.vfs.materialize', - 'copilot.vfs.prepare_image', - 'copilot.vfs.read_file', - 'gen_ai.agent.execute', - 'llm.stream', - 'provider.router.route', - 'sim.execute_tool', - 'sim.update_cost', - 'sim.validate_api_key', - 'tool.async_waiter.wait', - 'tool.execute', -] as const + "async_tool_store.set", + "auth.rate_limit.record", + "auth.validate_key", + "chat.async_subagent.run", + "chat.async_subagent.shutdown", + "chat.async_subagent.spawn", + "chat.continue_with_tool_results", + "chat.explicit_abort.consume", + "chat.explicit_abort.flush_paused_billing", + "chat.explicit_abort.handle", + "chat.explicit_abort.mark", + "chat.explicit_abort.peek", + "chat.gate.acquire", + "chat.orchestrate.interrupt", + "chat.orchestrate.steer", + "chat.orchestrate.tail", + "chat.orchestrate.wait", + "chat.persist_after_done", + "chat.setup", + "context.reduce", + "context.summarize_chunk", + "copilot.analytics.flush", + "copilot.analytics.save_request", + "copilot.analytics.update_billing", + "copilot.async_runs.claim_completed", + "copilot.async_runs.create_run_checkpoint", + "copilot.async_runs.create_run_segment", + "copilot.async_runs.get_async_tool_call", + "copilot.async_runs.get_latest_for_execution", + "copilot.async_runs.get_latest_for_stream", + "copilot.async_runs.get_many", + "copilot.async_runs.get_run_segment", + "copilot.async_runs.list_for_run", + "copilot.async_runs.mark_async_tool_status", + "copilot.async_runs.release_claim", + "copilot.async_runs.update_run_status", + "copilot.async_runs.upsert_async_tool_call", + "copilot.auth.validate_api_key", + "copilot.billing.update_cost", + "copilot.chat.abort_active_stream", + "copilot.chat.abort_stream", + "copilot.chat.abort_wait_settle", + "copilot.chat.acquire_pending_stream_lock", + "copilot.chat.build_execution_context", + "copilot.chat.build_payload", + "copilot.chat.build_workspace_context", + "copilot.chat.finalize_assistant_turn", + "copilot.chat.persist_user_message", + "copilot.chat.resolve_agent_contexts", + "copilot.chat.resolve_branch", + "copilot.chat.resolve_or_create_chat", + "copilot.chat.steer_stream", + "copilot.chat.stop_stream", + "copilot.cli.curate", + "copilot.cli.http_headers", + "copilot.cli.identity", + "copilot.cli.invoke", + "copilot.cli.sink", + "copilot.confirm.tool_result", + "copilot.db.query", + "copilot.db.transaction", + "copilot.finalize_stream", + "copilot.recovery.check_replay_gap", + "copilot.resume.request", + "copilot.sse.read_loop", + "copilot.subagent.execute", + "copilot.tool.result_commit", + "copilot.tool.runtime", + "copilot.tool.wait_for_client_result", + "copilot.tool.wait_for_permission", + "copilot.tool_permission.decide", + "copilot.tools.execute_inband", + "copilot.tools.handle_resource_side_effects", + "copilot.tools.write_csv_to_table", + "copilot.tools.write_output_file", + "copilot.tools.write_output_table", + "copilot.vfs.materialize", + "copilot.vfs.prepare_image", + "copilot.vfs.read_file", + "gen_ai.agent.execute", + "llm.stream", + "provider.router.route", + "sim.execute_tool", + "sim.update_cost", + "sim.validate_api_key", + "tool.async_waiter.wait", + "tool.execute", +] as const; diff --git a/apps/sim/lib/mothership/generated/vfs-snapshot-v1.ts b/apps/sim/lib/mothership/generated/vfs-snapshot-v1.ts index 6559a690ca7..0728a87159b 100644 --- a/apps/sim/lib/mothership/generated/vfs-snapshot-v1.ts +++ b/apps/sim/lib/mothership/generated/vfs-snapshot-v1.ts @@ -1,139 +1,141 @@ -// AUTO-GENERATED FILE. DO NOT EDIT. -// +// GENERATED — do not edit. Source of truth: mothership worker packages/contracts/src/vfs-snapshot-v1.ts +// Regenerate with `bun run contracts:sync` in the worker. + +// The structured workspace inventory snapshot Sim sends with each chat request. /** - * Structured workspace inventory snapshot Sim sends to Go; Go diffs successive snapshots into baseline+delta messages. + * Structured workspace inventory snapshot Sim sends to the worker, which diffs successive snapshots into baseline+delta messages. */ export interface VfsSnapshotV1 { - customBlocks?: VfsSnapshotV1CustomBlock[] - customTools?: VfsSnapshotV1NamedResource[] - envVars?: string[] - files?: VfsSnapshotV1File[] - integrations?: VfsSnapshotV1Integration[] - knowledgeBases?: VfsSnapshotV1KnowledgeBase[] - mcpServers?: VfsSnapshotV1McpServer[] - members?: VfsSnapshotV1Member[] - sandboxes?: VfsSnapshotV1Sandbox[] - skills?: VfsSnapshotV1Skill[] - tables?: VfsSnapshotV1Table[] - workflows?: VfsSnapshotV1Workflow[] - workspace?: VfsSnapshotV1Workspace + customBlocks?: VfsSnapshotV1CustomBlock[]; + customTools?: VfsSnapshotV1NamedResource[]; + envVars?: string[]; + files?: VfsSnapshotV1File[]; + integrations?: VfsSnapshotV1Integration[]; + knowledgeBases?: VfsSnapshotV1KnowledgeBase[]; + mcpServers?: VfsSnapshotV1McpServer[]; + members?: VfsSnapshotV1Member[]; + sandboxes?: VfsSnapshotV1Sandbox[]; + skills?: VfsSnapshotV1Skill[]; + tables?: VfsSnapshotV1Table[]; + workflows?: VfsSnapshotV1Workflow[]; + workspace?: VfsSnapshotV1Workspace; } /** * This interface was referenced by `VfsSnapshotV1`'s JSON-Schema * via the `definition` "VfsSnapshotV1CustomBlock". */ export interface VfsSnapshotV1CustomBlock { - description?: string - name: string - type: string + description?: string; + name: string; + type: string; } /** * This interface was referenced by `VfsSnapshotV1`'s JSON-Schema * via the `definition` "VfsSnapshotV1NamedResource". */ export interface VfsSnapshotV1NamedResource { - id: string - name: string + id: string; + name: string; } /** * This interface was referenced by `VfsSnapshotV1`'s JSON-Schema * via the `definition` "VfsSnapshotV1File". */ export interface VfsSnapshotV1File { - folderPath?: string - id: string - name: string - path: string - size?: number - type?: string + folderPath?: string; + id: string; + name: string; + path: string; + size?: number; + type?: string; } /** * This interface was referenced by `VfsSnapshotV1`'s JSON-Schema * via the `definition` "VfsSnapshotV1Integration". */ export interface VfsSnapshotV1Integration { - displayName?: string - id: string - providerId: string - role?: string + displayName?: string; + id: string; + providerId: string; + role?: string; } /** * This interface was referenced by `VfsSnapshotV1`'s JSON-Schema * via the `definition` "VfsSnapshotV1KnowledgeBase". */ export interface VfsSnapshotV1KnowledgeBase { - connectorTypes?: string[] - description?: string - id: string - name: string + connectorTypes?: string[]; + description?: string; + id: string; + name: string; } /** * This interface was referenced by `VfsSnapshotV1`'s JSON-Schema * via the `definition` "VfsSnapshotV1McpServer". */ export interface VfsSnapshotV1McpServer { - enabled?: boolean - id: string - name: string - url?: string + enabled?: boolean; + id: string; + name: string; + url?: string; } /** * This interface was referenced by `VfsSnapshotV1`'s JSON-Schema * via the `definition` "VfsSnapshotV1Member". */ export interface VfsSnapshotV1Member { - email: string - name?: string - permissionType?: string + email: string; + name?: string; + permissionType?: string; } /** * This interface was referenced by `VfsSnapshotV1`'s JSON-Schema * via the `definition` "VfsSnapshotV1Sandbox". */ export interface VfsSnapshotV1Sandbox { - cliTools?: string[] - dependencies?: string[] - id: string - language: string - name: string - systemPackages?: string[] + cliTools?: string[]; + dependencies?: string[]; + id: string; + language: string; + name: string; + systemPackages?: string[]; } /** * This interface was referenced by `VfsSnapshotV1`'s JSON-Schema * via the `definition` "VfsSnapshotV1Skill". */ export interface VfsSnapshotV1Skill { - description?: string - id: string - name: string + description?: string; + id: string; + name: string; } /** * This interface was referenced by `VfsSnapshotV1`'s JSON-Schema * via the `definition` "VfsSnapshotV1Table". */ export interface VfsSnapshotV1Table { - description?: string - id: string - name: string + description?: string; + id: string; + name: string; } /** * This interface was referenced by `VfsSnapshotV1`'s JSON-Schema * via the `definition` "VfsSnapshotV1Workflow". */ export interface VfsSnapshotV1Workflow { - folderPath?: string - id: string - isDeployed?: boolean - name: string - path: string + folderPath?: string; + id: string; + isDeployed?: boolean; + name: string; + path: string; } /** * This interface was referenced by `VfsSnapshotV1`'s JSON-Schema * via the `definition` "VfsSnapshotV1Workspace". */ export interface VfsSnapshotV1Workspace { - id: string - name: string - ownerId?: string + id: string; + name: string; + ownerId?: string; } diff --git a/package.json b/package.json index 724c6f04ee4..10c9449d99c 100644 --- a/package.json +++ b/package.json @@ -97,10 +97,6 @@ "check:source-conventions": "bun run scripts/check-source-conventions.ts", "check:test-types": "bun run scripts/check-test-types.ts", "desktop-bridge-contract:update": "bun run scripts/check-desktop-bridge-contract.ts --update", - "mship-contracts:generate": "bun run scripts/sync-mothership-stream-contract.ts", - "mship-contracts:check": "bun run scripts/sync-mothership-stream-contract.ts --check", - "billing-protocol-contract:generate": "bun run scripts/sync-billing-protocol-contract.ts", - "billing-protocol-contract:check": "bun run scripts/sync-billing-protocol-contract.ts --check", "generate:tool-metadata": "bun run scripts/sync-tool-metadata.ts", "check:tool-metadata": "bun run scripts/sync-tool-metadata.ts --check", "generate:sdk-names": "bun run apps/sim/scripts/generate-sdk-names.ts", @@ -117,22 +113,8 @@ "check:integration-catalog": "bun run scripts/check-integration-catalog.ts", "mship-tools:generate": "bun run scripts/sync-tool-catalog.ts", "mship-tools:check": "bun run scripts/sync-tool-catalog.ts --check", - "trace-spans-contract:generate": "bun run scripts/sync-trace-spans-contract.ts", - "trace-spans-contract:check": "bun run scripts/sync-trace-spans-contract.ts --check", - "trace-attributes-contract:generate": "bun run scripts/sync-trace-attributes-contract.ts", - "trace-attributes-contract:check": "bun run scripts/sync-trace-attributes-contract.ts --check", - "trace-attribute-values-contract:generate": "bun run scripts/sync-trace-attribute-values-contract.ts", - "trace-attribute-values-contract:check": "bun run scripts/sync-trace-attribute-values-contract.ts --check", - "trace-events-contract:generate": "bun run scripts/sync-trace-events-contract.ts", - "trace-events-contract:check": "bun run scripts/sync-trace-events-contract.ts --check", - "metrics-contract:generate": "bun run scripts/sync-metrics-contract.ts", - "metrics-contract:check": "bun run scripts/sync-metrics-contract.ts --check", - "vfs-snapshot-contract:generate": "bun run scripts/sync-vfs-snapshot-contract.ts", - "vfs-snapshot-contract:check": "bun run scripts/sync-vfs-snapshot-contract.ts --check", "generate:docs-manifest": "bun run scripts/sync-docs-manifest.ts", "check:docs-manifest": "bun run scripts/sync-docs-manifest.ts --check", - "mship:generate": "bun run scripts/generate-mship-contracts.ts", - "mship:check": "bun run scripts/generate-mship-contracts.ts --check", "library:covers": "bun run scripts/generate-library-covers.tsx", "library:covers:check": "bun run scripts/generate-library-covers.tsx --check", "skills:sync": "bun run scripts/sync-skills.ts", diff --git a/scripts/generate-mship-contracts.ts b/scripts/generate-mship-contracts.ts deleted file mode 100644 index 96b31ff9794..00000000000 --- a/scripts/generate-mship-contracts.ts +++ /dev/null @@ -1,147 +0,0 @@ -#!/usr/bin/env bun -// Drive every mothership contract generator, then biome-format the -// outputs so the committed files match what biome produces on commit -// (avoids the stale-drift that comes from comparing raw json2ts output -// against biome-formatted source). -// -// `--check` regenerates into a temp directory, formats identically, -// and compares against the committed files — same semantics as the -// old per-script `--check`, but accounts for post-generate formatting. - -import { spawnSync } from 'node:child_process' -import { readFileSync, unlinkSync, writeFileSync } from 'node:fs' -import { dirname, join, resolve } from 'node:path' -import { fileURLToPath } from 'node:url' - -const ROOT = resolve(dirname(fileURLToPath(import.meta.url)), '..') - -const GENERATORS = [ - 'scripts/sync-mothership-stream-contract.ts', - 'scripts/sync-billing-protocol-contract.ts', - 'scripts/sync-tool-catalog.ts', - 'scripts/sync-trace-spans-contract.ts', - 'scripts/sync-trace-attributes-contract.ts', - 'scripts/sync-trace-attribute-values-contract.ts', - 'scripts/sync-trace-events-contract.ts', - 'scripts/sync-metrics-contract.ts', - 'scripts/sync-vfs-snapshot-contract.ts', -] - -// Generated files under this path. We biome-format this whole dir on -// each generate (and the temp copy on each check). -const GENERATED_DIR = 'apps/sim/lib/mothership/generated' - -// `tool-schemas-v1.ts` goes through biome's `--unsafe` bracket-quote -// fixer which reformats every key of TOOL_RUNTIME_SCHEMAS. Strip it -// from the format pass so generator output stays stable on both sides. -const FORMAT_EXCLUDE = new Set(['tool-schemas-v1.ts']) - -function run(cmd: string[], cwd: string, env: NodeJS.ProcessEnv = process.env): void { - const result = spawnSync(cmd[0], cmd.slice(1), { - cwd, - env, - stdio: 'inherit', - }) - if (result.status !== 0) { - process.exit(result.status ?? 1) - } -} - -function runGenerators(outputOverride?: string): void { - const env = { ...process.env } - for (const script of GENERATORS) { - const args = ['bun', 'run', script] - if (outputOverride) { - // Individual scripts don't accept a custom output dir; for - // --check we generate in place and snapshot before/after via - // git-index comparison (see runCheck). - } - run(args, ROOT, env) - } -} - -function formatGenerated(dir: string): void { - // biome.json excludes the generated dir, and `biome check` on excluded paths - // exits nonzero with "No files were processed" — each sync script already - // formats its own output through a neutral stdin path, so this batch pass is - // a per-file re-check that must not consult the ignore list. - const files = readdirNoThrow(dir).filter((f) => !FORMAT_EXCLUDE.has(f) && f.endsWith('.ts')) - if (files.length === 0) return - const paths = files.map((f) => join(dir, f)) - run( - [ - 'bunx', - 'biome', - 'check', - '--write', - '--files-ignore-unknown=true', - ...paths, - '--no-errors-on-unmatched', - ], - ROOT - ) -} - -function readdirNoThrow(dir: string): string[] { - try { - // Bun has fs.readdirSync available as a CommonJS import - const fs = require('node:fs') as typeof import('node:fs') - return fs.readdirSync(dir) - } catch { - return [] - } -} - -function runCheck(): void { - const targetDir = resolve(ROOT, GENERATED_DIR) - // Snapshot current committed state - const committed: Record = {} - for (const f of readdirNoThrow(targetDir)) { - if (!f.endsWith('.ts')) continue - committed[f] = readFileSync(join(targetDir, f), 'utf8') - } - - // Regenerate in place + format, then diff against the snapshot - runGenerators() - formatGenerated(targetDir) - - const stale: string[] = [] - const generated = readdirNoThrow(targetDir).filter((f) => f.endsWith('.ts')) - const generatedSet = new Set(generated) - for (const [name, oldContent] of Object.entries(committed)) { - if (FORMAT_EXCLUDE.has(name)) continue - if (!generatedSet.has(name)) { - stale.push(name) - continue - } - const newContent = readFileSync(join(targetDir, name), 'utf8') - if (newContent !== oldContent) stale.push(name) - } - for (const name of generated) { - if (!(name in committed)) stale.push(name) - } - - // Restore the committed state regardless of outcome (--check is readonly). - for (const [name, content] of Object.entries(committed)) { - writeFileSync(join(targetDir, name), content, 'utf8') - } - for (const name of generated) { - if (!(name in committed)) unlinkSync(join(targetDir, name)) - } - - if (stale.length > 0) { - console.error(`Generated contracts are stale: ${stale.join(', ')}. Run: bun run mship:generate`) - process.exit(1) - } - console.log('All generated contracts up to date.') -} - -function runGenerate(): void { - runGenerators() - formatGenerated(resolve(ROOT, GENERATED_DIR)) - console.log('Generated + formatted mothership contracts.') -} - -const checkOnly = process.argv.includes('--check') -if (checkOnly) runCheck() -else runGenerate() diff --git a/scripts/run-audits.ts b/scripts/run-audits.ts index 2f926145a78..ee23508621e 100644 --- a/scripts/run-audits.ts +++ b/scripts/run-audits.ts @@ -13,8 +13,7 @@ * * Generated-artifact checks follow the same rule: name the pair `generate:` / `check:` * and the check runs here. The suffix form `:check` is reserved for checks this job cannot - * run: the mothership contracts (`mship*`, `trace-*`, `metrics`, `vfs`, `billing-protocol`) - * need the sibling copilot repo, `images:check` renders the Helm chart (it runs in + * run: the mothership tool catalog (`mship-tools:check`) needs the sibling copilot repo, `images:check` renders the Helm chart (it runs in * `.github/workflows/helm.yml`), and `library:covers:check` is only deterministic per machine. */ import path from 'node:path' diff --git a/scripts/sync-billing-protocol-contract.ts b/scripts/sync-billing-protocol-contract.ts deleted file mode 100644 index cb964391d2a..00000000000 --- a/scripts/sync-billing-protocol-contract.ts +++ /dev/null @@ -1,306 +0,0 @@ -import { mkdir, readFile, writeFile } from 'node:fs/promises' -import { dirname, resolve } from 'node:path' -import { fileURLToPath } from 'node:url' -import { formatGeneratedSource } from './format-generated-source' - -const SCRIPT_DIR = dirname(fileURLToPath(import.meta.url)) -const ROOT = resolve(SCRIPT_DIR, '..') -const DEFAULT_CONTRACT_PATH = resolve( - ROOT, - '../copilot/copilot/contracts/billing-protocol-v1.schema.json' -) -const OUTPUT_PATH = resolve(ROOT, 'apps/sim/lib/mothership/generated/billing-protocol-v1.ts') - -type SchemaNode = Record - -interface NamedPair { - name: string - code: string - message: string -} - -function schemaDefinitions(schema: SchemaNode): Record { - const value = schema.$defs - if (!value || typeof value !== 'object' || Array.isArray(value)) { - throw new Error('billing-protocol-v1.schema.json is missing $defs') - } - return value as Record -} - -function schemaDefinition(definitions: Record, name: string): SchemaNode { - const value = definitions[name] - if (!value) { - throw new Error(`billing-protocol-v1.schema.json is missing $defs.${name}`) - } - return value -} - -function resolveNode(definitions: Record, node: SchemaNode): SchemaNode { - const ref = node.$ref - if (typeof ref !== 'string') return node - const prefix = '#/$defs/' - if (!ref.startsWith(prefix)) { - throw new Error(`Unsupported billing protocol schema reference: ${ref}`) - } - return schemaDefinition(definitions, ref.slice(prefix.length)) -} - -function objectProperties(node: SchemaNode, context: string): Record { - const properties = node.properties - if (!properties || typeof properties !== 'object' || Array.isArray(properties)) { - throw new Error(`${context} is missing object properties`) - } - return properties as Record -} - -function stringEnum(node: SchemaNode, context: string): string[] { - const values = node.enum - if (!Array.isArray(values) || !values.every((value) => typeof value === 'string')) { - throw new Error(`${context} must be a string enum`) - } - return values as string[] -} - -function singletonString( - definitions: Record, - node: SchemaNode, - context: string -): string { - const values = stringEnum(resolveNode(definitions, node), context) - if (values.length !== 1) { - throw new Error(`${context} must contain exactly one value`) - } - return values[0] -} - -function singletonNumber( - definitions: Record, - node: SchemaNode, - context: string -): number { - const resolved = resolveNode(definitions, node) - const values = resolved.enum - if (!Array.isArray(values) || values.length !== 1 || typeof values[0] !== 'number') { - throw new Error(`${context} must contain exactly one numeric value`) - } - return values[0] -} - -function namedPairs(definitions: Record, definitionName: string): NamedPair[] { - const collection = schemaDefinition(definitions, definitionName) - return Object.entries(objectProperties(collection, definitionName)) - .map(([name, pairNode]) => { - const pair = resolveNode(definitions, pairNode) - const properties = objectProperties(pair, `${definitionName}.${name}`) - if (!properties.code || !properties.message) { - throw new Error(`${definitionName}.${name} must contain code and message`) - } - return { - name, - code: singletonString(definitions, properties.code, `${definitionName}.${name}.code`), - message: singletonString( - definitions, - properties.message, - `${definitionName}.${name}.message` - ), - } - }) - .sort((left, right) => left.name.localeCompare(right.name)) -} - -function pascalCase(value: string): string { - const parts = value.split(/[^A-Za-z0-9]+/).filter(Boolean) - if (parts.length === 0) { - throw new Error(`Cannot derive an identifier from ${JSON.stringify(value)}`) - } - const identifier = parts - .map((part) => part.charAt(0).toUpperCase() + part.slice(1).toLowerCase()) - .join('') - if (/^[0-9]/.test(identifier)) { - throw new Error(`Derived identifier starts with a digit: ${identifier}`) - } - return identifier -} - -function renderRecord(entries: Array<{ name: string; value: string }>, indent = ' '): string { - return entries.map(({ name, value }) => `${indent}${name}: ${JSON.stringify(value)},`).join('\n') -} - -function renderPairs(entries: NamedPair[]): string { - return entries - .map( - ({ name, code, message }) => ` ${name}: { - code: ${JSON.stringify(code)}, - message: ${JSON.stringify(message)}, - },` - ) - .join('\n') -} - -function render(schema: SchemaNode): string { - const definitions = schemaDefinitions(schema) - const headerProperties = objectProperties( - schemaDefinition(definitions, 'BillingProtocolV1Headers'), - 'BillingProtocolV1Headers' - ) - const headers = { - accountDecision: singletonString( - definitions, - headerProperties.accountDecision, - 'BillingProtocolV1Headers.accountDecision' - ), - attribution: singletonString( - definitions, - headerProperties.attribution, - 'BillingProtocolV1Headers.attribution' - ), - protocol: singletonString( - definitions, - headerProperties.protocol, - 'BillingProtocolV1Headers.protocol' - ), - requestId: singletonString( - definitions, - headerProperties.requestId, - 'BillingProtocolV1Headers.requestId' - ), - } - - const protocolValues = stringEnum( - schemaDefinition(definitions, 'BillingProtocol'), - 'BillingProtocol' - ) - const requiredProtocols = ['attribution-v1', 'direct-v1', 'legacy-v0'] as const - for (const protocol of requiredProtocols) { - if (!protocolValues.includes(protocol)) { - throw new Error(`BillingProtocol is missing ${protocol}`) - } - } - if (protocolValues.length !== requiredProtocols.length) { - throw new Error(`BillingProtocol contains unsupported values: ${protocolValues.join(', ')}`) - } - - const limitProperties = objectProperties( - schemaDefinition(definitions, 'BillingProtocolV1Limits'), - 'BillingProtocolV1Limits' - ) - const attributionHeaderMaxBytes = singletonNumber( - definitions, - limitProperties.attributionHeaderMaxBytes, - 'BillingProtocolV1Limits.attributionHeaderMaxBytes' - ) - const accountDecisionHeaderMaxBytes = singletonNumber( - definitions, - limitProperties.accountDecisionHeaderMaxBytes, - 'BillingProtocolV1Limits.accountDecisionHeaderMaxBytes' - ) - const callbackOutcomes = namedPairs(definitions, 'BillingProtocolV1CallbackOutcomes') - const validationPurposes = stringEnum( - schemaDefinition(definitions, 'CopilotValidationPurpose'), - 'CopilotValidationPurpose' - ) - const analyticsOutcomes = stringEnum( - schemaDefinition(definitions, 'BillingAnalyticsOutcome'), - 'BillingAnalyticsOutcome' - ) - .slice() - .sort() - - return `/** - * AUTO-GENERATED FILE. DO NOT EDIT. - * - * Source: copilot/copilot/contracts/billing-protocol-v1.schema.json - * Regenerate with: bun run billing-protocol-contract:generate - */ - -export const BILLING_PROTOCOL_HEADERS = { -${renderRecord([ - { name: 'accountDecision', value: headers.accountDecision }, - { name: 'attribution', value: headers.attribution }, - { name: 'protocol', value: headers.protocol }, - { name: 'requestId', value: headers.requestId }, -])} -} as const; - -export const BILLING_ACCOUNT_DECISION_HEADER = BILLING_PROTOCOL_HEADERS.accountDecision; -export const BILLING_ATTRIBUTION_HEADER = BILLING_PROTOCOL_HEADERS.attribution; -export const COPILOT_BILLING_PROTOCOL_HEADER = BILLING_PROTOCOL_HEADERS.protocol; -export const BILLING_REQUEST_ID_HEADER = BILLING_PROTOCOL_HEADERS.requestId; - -export const COPILOT_BILLING_PROTOCOL = { - attributed: "attribution-v1", - direct: "direct-v1", - legacy: "legacy-v0", -} as const; - -export type CopilotBillingProtocol = - (typeof COPILOT_BILLING_PROTOCOL)[keyof typeof COPILOT_BILLING_PROTOCOL]; - -export const COPILOT_BILLING_PROTOCOL_VALUES = [ - COPILOT_BILLING_PROTOCOL.attributed, - COPILOT_BILLING_PROTOCOL.direct, - COPILOT_BILLING_PROTOCOL.legacy, -] as const; - -export const COPILOT_VALIDATION_PURPOSE = { -${renderRecord( - validationPurposes.map((value) => { - const name = pascalCase(value) - return { name: name.charAt(0).toLowerCase() + name.slice(1), value } - }) -)} -} as const; - -export const COPILOT_VALIDATION_PURPOSE_VALUES = [ -${validationPurposes.map((value) => ` ${JSON.stringify(value)},`).join('\n')} -] as const; - -export type CopilotValidationPurpose = - (typeof COPILOT_VALIDATION_PURPOSE_VALUES)[number]; - -export const BILLING_ATTRIBUTION_HEADER_MAX_BYTES = ${attributionHeaderMaxBytes}; -export const BILLING_ACCOUNT_DECISION_HEADER_MAX_BYTES = ${accountDecisionHeaderMaxBytes}; - -export const BILLING_CALLBACK_OUTCOME = { -${renderPairs(callbackOutcomes)} -} as const; - -export const BillingAnalyticsOutcome = { -${renderRecord(analyticsOutcomes.map((value) => ({ name: pascalCase(value), value })))} -} as const; - -export type BillingAnalyticsOutcomeValue = - (typeof BillingAnalyticsOutcome)[keyof typeof BillingAnalyticsOutcome]; -` -} - -async function main() { - const checkOnly = process.argv.includes('--check') - const inputArg = process.argv.find((argument) => argument.startsWith('--input=')) - const inputPath = inputArg - ? resolve(ROOT, inputArg.slice('--input='.length)) - : DEFAULT_CONTRACT_PATH - - const schema = JSON.parse(await readFile(inputPath, 'utf8')) as SchemaNode - const rendered = formatGeneratedSource(render(schema), OUTPUT_PATH, ROOT) - - if (checkOnly) { - const existing = await readFile(OUTPUT_PATH, 'utf8').catch(() => null) - if (existing !== rendered) { - throw new Error( - 'Generated billing protocol contract is stale. Run: bun run billing-protocol-contract:generate' - ) - } - console.log('Billing protocol contract is up to date.') - return - } - - await mkdir(dirname(OUTPUT_PATH), { recursive: true }) - await writeFile(OUTPUT_PATH, rendered, 'utf8') - console.log(`Generated billing protocol types -> ${OUTPUT_PATH}`) -} - -main().catch((error) => { - console.error(error) - process.exit(1) -}) diff --git a/scripts/sync-metrics-contract.ts b/scripts/sync-metrics-contract.ts deleted file mode 100644 index 3398fa57412..00000000000 --- a/scripts/sync-metrics-contract.ts +++ /dev/null @@ -1,142 +0,0 @@ -import { mkdir, readFile, writeFile } from 'node:fs/promises' -import { dirname, resolve } from 'node:path' -import { fileURLToPath } from 'node:url' -import { formatGeneratedSource } from './format-generated-source' - -/** - * Generate `apps/sim/lib/mothership/generated/metrics-v1.ts` from the Go-side - * `contracts/metrics-v1.schema.json` contract. - * - * The contract is a single-enum JSON Schema listing every canonical mothership - * OTel METRIC name. Go and Sim BOTH emit mothership metrics (the agent loop in - * Go; server-side tool/VFS/file instrumentation in Sim), so both sides MUST - * emit identical metric names for `histogram_quantile(sum by (le) …)` over the - * Go∪Sim union to be valid. We emit: - * - A `Metric` const object keyed by PascalCase identifier whose values are - * the exact wire names, so call sites read `meter.createHistogram( - * Metric.CopilotToolDuration)` instead of a raw string literal. - * - A `MetricKey` / `MetricValue` union pair. - * - A sorted `MetricValues` readonly array for tests/enumeration. - * - * Label allowlists and histogram bucket boundaries are NOT encoded in the - * schema (name-only). The Go side owns the label-cardinality allowlist - * (contracts/metrics_v1.go) and the shared bucket constant - * (internal/telemetry/metrics.go); the Sim emitter MUST use the identical - * label keys and bucket boundaries by hand. - * - * This is the metric-name twin of `sync-trace-attributes-contract.ts`; the two - * share the enum-extraction + PascalCase + collision-detection pattern. - */ -const SCRIPT_DIR = dirname(fileURLToPath(import.meta.url)) -const ROOT = resolve(SCRIPT_DIR, '..') -const DEFAULT_CONTRACT_PATH = resolve(ROOT, '../copilot/copilot/contracts/metrics-v1.schema.json') -const OUTPUT_PATH = resolve(ROOT, 'apps/sim/lib/mothership/generated/metrics-v1.ts') - -function extractMetricNames(schema: Record): string[] { - const defs = (schema.$defs ?? {}) as Record - const nameDef = defs.MetricsV1Name - if ( - !nameDef || - typeof nameDef !== 'object' || - !Array.isArray((nameDef as Record).enum) - ) { - throw new Error('metrics-v1.schema.json is missing $defs.MetricsV1Name.enum') - } - const enumValues = (nameDef as Record).enum as unknown[] - if (!enumValues.every((v) => typeof v === 'string')) { - throw new Error('MetricsV1Name enum must be string-only') - } - return (enumValues as string[]).slice().sort() -} - -/** - * Convert a wire metric name like `copilot.request.duration` into an - * identifier-safe PascalCase key like `CopilotRequestDuration`. Same algorithm - * as the trace-attributes sync script so readers learn one and reuse it. - */ -function toIdentifier(name: string): string { - const parts = name.split(/[^A-Za-z0-9]+/).filter(Boolean) - if (parts.length === 0) { - throw new Error(`Cannot derive identifier for metric name: ${name}`) - } - const ident = parts.map((p) => p.charAt(0).toUpperCase() + p.slice(1).toLowerCase()).join('') - if (/^[0-9]/.test(ident)) { - throw new Error(`Derived identifier "${ident}" for metric "${name}" starts with a digit`) - } - return ident -} - -function render(metricNames: string[]): string { - const pairs = metricNames.map((name) => ({ name, ident: toIdentifier(name) })) - - const seen = new Map() - for (const p of pairs) { - const prev = seen.get(p.ident) - if (prev && prev !== p.name) { - throw new Error(`Identifier collision: "${prev}" and "${p.name}" both map to "${p.ident}"`) - } - seen.set(p.ident, p.name) - } - - const constLines = pairs.map((p) => ` ${p.ident}: ${JSON.stringify(p.name)},`).join('\n') - const arrayEntries = metricNames.map((n) => ` ${JSON.stringify(n)},`).join('\n') - - return `// AUTO-GENERATED FILE. DO NOT EDIT. -// -// Source: copilot/copilot/contracts/metrics-v1.schema.json -// Regenerate with: bun run metrics-contract:generate -// -// Canonical mothership OTel metric names. Call sites should reference -// \`Metric.\` (e.g. \`Metric.CopilotToolDuration\`) rather than raw -// string literals, so the Go-side contract is the single source of truth and -// typos become compile errors. -// -// NAMES ONLY. Label keys and histogram bucket boundaries are NOT in this -// contract — Go owns the label-cardinality allowlist and the shared bucket -// constant, and the Sim emitter MUST mirror those by hand so the Go∪Sim metric -// union is queryable as one series set. - -export const Metric = { -${constLines} -} as const; - -export type MetricKey = keyof typeof Metric; -export type MetricValue = (typeof Metric)[MetricKey]; - -/** Readonly sorted list of every canonical mothership metric name. */ -export const MetricValues: readonly MetricValue[] = [ -${arrayEntries} -] as const; -` -} - -async function main() { - const checkOnly = process.argv.includes('--check') - const inputArg = process.argv.find((a) => a.startsWith('--input=')) - const inputPath = inputArg - ? resolve(ROOT, inputArg.slice('--input='.length)) - : DEFAULT_CONTRACT_PATH - - const raw = await readFile(inputPath, 'utf8') - const schema = JSON.parse(raw) - const metricNames = extractMetricNames(schema) - const rendered = formatGeneratedSource(render(metricNames), OUTPUT_PATH, ROOT) - - if (checkOnly) { - const existing = await readFile(OUTPUT_PATH, 'utf8').catch(() => null) - if (existing !== rendered) { - throw new Error('Generated metrics contract is stale. Run: bun run metrics-contract:generate') - } - console.log('Metrics contract is up to date.') - return - } - - await mkdir(dirname(OUTPUT_PATH), { recursive: true }) - await writeFile(OUTPUT_PATH, rendered, 'utf8') - console.log(`Generated metrics types -> ${OUTPUT_PATH}`) -} - -main().catch((err) => { - console.error(err) - process.exit(1) -}) diff --git a/scripts/sync-mothership-stream-contract.ts b/scripts/sync-mothership-stream-contract.ts deleted file mode 100644 index 849b22cb9d0..00000000000 --- a/scripts/sync-mothership-stream-contract.ts +++ /dev/null @@ -1,75 +0,0 @@ -import { mkdir, readFile, writeFile } from 'node:fs/promises' -import { dirname, resolve } from 'node:path' -import { fileURLToPath } from 'node:url' -import { compile } from 'json-schema-to-typescript' -import { formatGeneratedSource } from './format-generated-source' - -const SCRIPT_DIR = dirname(fileURLToPath(import.meta.url)) -const ROOT = resolve(SCRIPT_DIR, '..') -const DEFAULT_CONTRACT_PATH = resolve( - ROOT, - '../copilot/copilot/contracts/mothership-stream-v1.schema.json' -) -const OUTPUT_PATH = resolve(ROOT, 'apps/sim/lib/mothership/generated/mothership-stream-v1.ts') -function generateRuntimeConstants(schema: Record, existingTypes: string): string { - const defs = (schema.$defs ?? schema.definitions ?? {}) as Record - const lines: string[] = [] - - for (const [name, def] of Object.entries(defs)) { - if (!def || typeof def !== 'object') continue - const defObj = def as Record - const enumValues = defObj.enum - if (!Array.isArray(enumValues) || enumValues.length === 0) continue - if (!enumValues.every((v) => typeof v === 'string')) continue - - const typeAlias = (enumValues as string[]).map((v) => JSON.stringify(v)).join(' | ') - const entries = (enumValues as string[]) - .map((v) => ` ${JSON.stringify(v)}: ${JSON.stringify(v)}`) - .join(',\n') - - if (!existingTypes.includes(`export type ${name} =`)) { - lines.push(`export type ${name} = ${typeAlias}\n`) - } - - lines.push(`export const ${name} = {\n${entries},\n} as const;\n`) - } - - return lines.join('\n') -} - -async function main() { - const checkOnly = process.argv.includes('--check') - const inputPathArg = process.argv.find((arg) => arg.startsWith('--input=')) - const inputPath = inputPathArg - ? resolve(ROOT, inputPathArg.slice('--input='.length)) - : DEFAULT_CONTRACT_PATH - - const raw = await readFile(inputPath, 'utf8') - const schema = JSON.parse(raw) - const types = await compile(schema, 'MothershipStreamV1EventEnvelope', { - bannerComment: '// AUTO-GENERATED FILE. DO NOT EDIT.\n//', - unreachableDefinitions: true, - additionalProperties: false, - }) - - const constants = generateRuntimeConstants(schema, types) - const rendered = formatGeneratedSource( - constants ? `${types}\n${constants}\n` : types, - OUTPUT_PATH, - ROOT - ) - if (checkOnly) { - const existing = await readFile(OUTPUT_PATH, 'utf8').catch(() => null) - if (existing !== rendered) { - throw new Error( - `Generated mothership stream contract is stale. Run: bun run mship-contracts:generate` - ) - } - return - } - - await mkdir(dirname(OUTPUT_PATH), { recursive: true }) - await writeFile(OUTPUT_PATH, rendered, 'utf8') -} - -await main() diff --git a/scripts/sync-tool-catalog.ts b/scripts/sync-tool-catalog.ts index b80266a2bf4..ca3ef8c95c1 100644 --- a/scripts/sync-tool-catalog.ts +++ b/scripts/sync-tool-catalog.ts @@ -8,7 +8,11 @@ import { formatGeneratedSource } from './format-generated-source' const SCRIPT_DIR = dirname(fileURLToPath(import.meta.url)) const ROOT = resolve(SCRIPT_DIR, '..') -const DEFAULT_CATALOG_PATH = resolve(ROOT, '../copilot/copilot/contracts/tool-catalog-v1.json') +/** The base catalog is owned by the Mothership worker (D115 there); Sim merges its own tools in. */ +const DEFAULT_CATALOG_PATH = resolve( + ROOT, + '../copilot/worker/packages/contracts/tool-catalog-v1.json' +) const OUTPUT_PATH = resolve(ROOT, 'apps/sim/lib/mothership/generated/tool-catalog-v1.ts') const RUNTIME_SCHEMA_OUTPUT_PATH = resolve( ROOT, @@ -75,7 +79,7 @@ function inferTSType(values: unknown[]): string { function renderRuntimeSchemaModule(catalog: { tools: Record[] }): string { const lines: string[] = [ '// AUTO-GENERATED FILE. DO NOT EDIT.', - '// Generated from copilot/contracts/tool-catalog-v1.json with Sim-owned Assistant input contracts', + '// Generated from the Mothership worker packages/contracts/tool-catalog-v1.json with Sim-owned Assistant input contracts', '//', '', 'export type JsonSchema = unknown', @@ -169,7 +173,7 @@ async function main() { const lines: string[] = [ '// AUTO-GENERATED FILE. DO NOT EDIT.', - '// Generated from copilot/contracts/tool-catalog-v1.json with Sim-owned Assistant input contracts', + '// Generated from the Mothership worker packages/contracts/tool-catalog-v1.json with Sim-owned Assistant input contracts', '//', '', iface, diff --git a/scripts/sync-trace-attribute-values-contract.ts b/scripts/sync-trace-attribute-values-contract.ts deleted file mode 100644 index 566668586f0..00000000000 --- a/scripts/sync-trace-attribute-values-contract.ts +++ /dev/null @@ -1,149 +0,0 @@ -import { mkdir, readFile, writeFile } from 'node:fs/promises' -import { dirname, resolve } from 'node:path' -import { fileURLToPath } from 'node:url' -import { formatGeneratedSource } from './format-generated-source' - -/** - * Generate `apps/sim/lib/mothership/generated/trace-attribute-values-v1.ts` - * from the Go-side `contracts/trace-attribute-values-v1.schema.json` - * contract. - * - * Unlike span-names / attribute-keys / event-names (each of which is a - * single enum), this contract carries MULTIPLE enums — one per span - * attribute whose value set is closed. The schema's `$defs` holds one - * definition per enum (e.g. `CopilotRequestCancelReason`, - * `CopilotAbortOutcome`, …). For each $def we emit a TS `as const` - * object named after the Go type, so call sites read as: - * - * span.setAttribute( - * TraceAttr.CopilotRequestCancelReason, - * CopilotRequestCancelReason.ExplicitStop, - * ) - * - * Skipped $defs: anything that doesn't have a string-only `enum` - * array. That filters out wrapper structs the reflector adds - * incidentally (e.g. `TraceAttributeValuesV1AllDefs`). - */ -const SCRIPT_DIR = dirname(fileURLToPath(import.meta.url)) -const ROOT = resolve(SCRIPT_DIR, '..') -const DEFAULT_CONTRACT_PATH = resolve( - ROOT, - '../copilot/copilot/contracts/trace-attribute-values-v1.schema.json' -) -const OUTPUT_PATH = resolve(ROOT, 'apps/sim/lib/mothership/generated/trace-attribute-values-v1.ts') - -interface ExtractedEnum { - /** The Go type name — becomes the TS const + type name. */ - name: string - /** The value strings, sorted for diff stability. */ - values: string[] -} - -function extractEnums(schema: Record): ExtractedEnum[] { - const defs = (schema.$defs ?? {}) as Record - const out: ExtractedEnum[] = [] - for (const [name, def] of Object.entries(defs)) { - if (!def || typeof def !== 'object') continue - const enumValues = (def as Record).enum - if (!Array.isArray(enumValues)) continue - if (!enumValues.every((v) => typeof v === 'string')) continue - out.push({ name, values: (enumValues as string[]).slice().sort() }) - } - out.sort((a, b) => a.name.localeCompare(b.name)) - return out -} - -/** - * PascalCase identifier for a wire enum value. Mirrors the algorithm - * used by the span-names + attribute-keys scripts, so - * `explicit_stop` -> `ExplicitStop`, matching what a reader would - * guess from Go's exported constants. - */ -function toValueIdent(value: string): string { - const parts = value.split(/[^A-Za-z0-9]+/).filter(Boolean) - if (parts.length === 0) { - throw new Error(`Cannot derive identifier for enum value: ${value}`) - } - const ident = parts.map((p) => p.charAt(0).toUpperCase() + p.slice(1).toLowerCase()).join('') - if (/^[0-9]/.test(ident)) { - throw new Error(`Derived identifier "${ident}" for value "${value}" starts with a digit`) - } - return ident -} - -function renderEnum(e: ExtractedEnum): string { - const seen = new Map() - const lines = e.values.map((v) => { - const ident = toValueIdent(v) - const prev = seen.get(ident) - if (prev && prev !== v) { - throw new Error( - `Enum ${e.name}: identifier collision — "${prev}" and "${v}" both map to "${ident}"` - ) - } - seen.set(ident, v) - return ` ${ident}: ${JSON.stringify(v)},` - }) - - return `export const ${e.name} = { -${lines.join('\n')} -} as const; - -export type ${e.name}Key = keyof typeof ${e.name}; -export type ${e.name}Value = (typeof ${e.name})[${e.name}Key];` -} - -function render(enums: ExtractedEnum[]): string { - const body = enums.map(renderEnum).join('\n\n') - return `// AUTO-GENERATED FILE. DO NOT EDIT. -// -// Source: copilot/copilot/contracts/trace-attribute-values-v1.schema.json -// Regenerate with: bun run trace-attribute-values-contract:generate -// -// Canonical closed-set value vocabularies for mothership OTel -// attributes. Call sites should reference e.g. -// \`CopilotRequestCancelReason.ExplicitStop\` rather than the raw -// string literal, so typos become compile errors and the Go contract -// remains the single source of truth. - -${body} -` -} - -async function main() { - const checkOnly = process.argv.includes('--check') - const inputArg = process.argv.find((a) => a.startsWith('--input=')) - const inputPath = inputArg - ? resolve(ROOT, inputArg.slice('--input='.length)) - : DEFAULT_CONTRACT_PATH - - const raw = await readFile(inputPath, 'utf8') - const schema = JSON.parse(raw) - const enums = extractEnums(schema) - if (enums.length === 0) { - throw new Error( - 'No enum $defs found in trace-attribute-values-v1.schema.json — did you add the Go type to TraceAttributeValuesV1AllDefs?' - ) - } - const rendered = formatGeneratedSource(render(enums), OUTPUT_PATH, ROOT) - - if (checkOnly) { - const existing = await readFile(OUTPUT_PATH, 'utf8').catch(() => null) - if (existing !== rendered) { - throw new Error( - 'Generated trace attribute values contract is stale. Run: bun run trace-attribute-values-contract:generate' - ) - } - console.log('Trace attribute values contract is up to date.') - return - } - - await mkdir(dirname(OUTPUT_PATH), { recursive: true }) - await writeFile(OUTPUT_PATH, rendered, 'utf8') - console.log(`Generated trace attribute values types -> ${OUTPUT_PATH}`) -} - -main().catch((err) => { - console.error(err) - process.exit(1) -}) diff --git a/scripts/sync-trace-attributes-contract.ts b/scripts/sync-trace-attributes-contract.ts deleted file mode 100644 index cce544553de..00000000000 --- a/scripts/sync-trace-attributes-contract.ts +++ /dev/null @@ -1,156 +0,0 @@ -import { mkdir, readFile, writeFile } from 'node:fs/promises' -import { dirname, resolve } from 'node:path' -import { fileURLToPath } from 'node:url' -import { formatGeneratedSource } from './format-generated-source' - -/** - * Generate `apps/sim/lib/mothership/generated/trace-attributes-v1.ts` - * from the Go-side `contracts/trace-attributes-v1.schema.json` - * contract. - * - * The contract is a single-enum JSON Schema listing every CUSTOM - * (non-OTel-semconv) span attribute key used in mothership. We emit: - * - A `TraceAttr` const object keyed by PascalCase identifier whose - * values are the exact wire strings, so call sites look like - * `span.setAttribute(TraceAttr.ChatId, …)` instead of the raw - * `span.setAttribute('chat.id', …)`. - * - A `TraceAttrKey` union and a `TraceAttrValue` union type so - * helpers that take an attribute key are well-typed. - * - A sorted `TraceAttrValues` readonly array for tests/enumeration. - * - * This is the attribute-key twin of `sync-trace-spans-contract.ts` - * (span names). The two files share the enum-extraction + identifier - * PascalCase + collision-detection pattern so a reader who understands - * one understands both. - * - * For OTel semantic-convention keys (e.g. `http.request.method`, - * `db.system`, `gen_ai.system`, `messaging.*`, `net.*`, - * `service.name`, `deployment.environment`), import from - * `@opentelemetry/semantic-conventions` directly — they live in the - * upstream package, not in this contract. - */ -const SCRIPT_DIR = dirname(fileURLToPath(import.meta.url)) -const ROOT = resolve(SCRIPT_DIR, '..') -const DEFAULT_CONTRACT_PATH = resolve( - ROOT, - '../copilot/copilot/contracts/trace-attributes-v1.schema.json' -) -const OUTPUT_PATH = resolve(ROOT, 'apps/sim/lib/mothership/generated/trace-attributes-v1.ts') - -function extractAttrKeys(schema: Record): string[] { - const defs = (schema.$defs ?? {}) as Record - const nameDef = defs.TraceAttributesV1Name - if ( - !nameDef || - typeof nameDef !== 'object' || - !Array.isArray((nameDef as Record).enum) - ) { - throw new Error('trace-attributes-v1.schema.json is missing $defs.TraceAttributesV1Name.enum') - } - const enumValues = (nameDef as Record).enum as unknown[] - if (!enumValues.every((v) => typeof v === 'string')) { - throw new Error('TraceAttributesV1Name enum must be string-only') - } - return (enumValues as string[]).slice().sort() -} - -/** - * Convert a wire attribute key like `copilot.vfs.input.media_type_claimed` - * into an identifier-safe PascalCase key like - * `CopilotVfsInputMediaTypeClaimed`. - * - * Same algorithm as the span-name sync script so readers can learn one - * and reuse it. - */ -function toIdentifier(name: string): string { - const parts = name.split(/[^A-Za-z0-9]+/).filter(Boolean) - if (parts.length === 0) { - throw new Error(`Cannot derive identifier for attribute key: ${name}`) - } - const ident = parts.map((p) => p.charAt(0).toUpperCase() + p.slice(1).toLowerCase()).join('') - if (/^[0-9]/.test(ident)) { - throw new Error(`Derived identifier "${ident}" for attribute "${name}" starts with a digit`) - } - return ident -} - -function render(attrKeys: string[]): string { - const pairs = attrKeys.map((name) => ({ name, ident: toIdentifier(name) })) - - // Identifier collisions silently override earlier keys and break - // type safety — fail loudly instead. - const seen = new Map() - for (const p of pairs) { - const prev = seen.get(p.ident) - if (prev && prev !== p.name) { - throw new Error(`Identifier collision: "${prev}" and "${p.name}" both map to "${p.ident}"`) - } - seen.set(p.ident, p.name) - } - - const constLines = pairs.map((p) => ` ${p.ident}: ${JSON.stringify(p.name)},`).join('\n') - const arrayEntries = attrKeys.map((n) => ` ${JSON.stringify(n)},`).join('\n') - - return `// AUTO-GENERATED FILE. DO NOT EDIT. -// -// Source: copilot/copilot/contracts/trace-attributes-v1.schema.json -// Regenerate with: bun run trace-attributes-contract:generate -// -// Canonical custom mothership OTel span attribute keys. Call sites -// should reference \`TraceAttr.\` (e.g. -// \`TraceAttr.ChatId\`, \`TraceAttr.ToolCallId\`) rather than raw -// string literals, so the Go-side contract is the single source of -// truth and typos become compile errors. -// -// For OTel semantic-convention keys (\`http.*\`, \`db.*\`, -// \`gen_ai.*\`, \`net.*\`, \`messaging.*\`, \`service.*\`, -// \`deployment.environment\`), import from -// \`@opentelemetry/semantic-conventions\` directly — those are owned -// by the upstream OTel spec, not by this contract. - -export const TraceAttr = { -${constLines} -} as const; - -export type TraceAttrKey = keyof typeof TraceAttr; -export type TraceAttrValue = (typeof TraceAttr)[TraceAttrKey]; - -/** Readonly sorted list of every canonical custom attribute key. */ -export const TraceAttrValues: readonly TraceAttrValue[] = [ -${arrayEntries} -] as const; -` -} - -async function main() { - const checkOnly = process.argv.includes('--check') - const inputArg = process.argv.find((a) => a.startsWith('--input=')) - const inputPath = inputArg - ? resolve(ROOT, inputArg.slice('--input='.length)) - : DEFAULT_CONTRACT_PATH - - const raw = await readFile(inputPath, 'utf8') - const schema = JSON.parse(raw) - const attrKeys = extractAttrKeys(schema) - const rendered = formatGeneratedSource(render(attrKeys), OUTPUT_PATH, ROOT) - - if (checkOnly) { - const existing = await readFile(OUTPUT_PATH, 'utf8').catch(() => null) - if (existing !== rendered) { - throw new Error( - 'Generated trace attributes contract is stale. Run: bun run trace-attributes-contract:generate' - ) - } - console.log('Trace attributes contract is up to date.') - return - } - - await mkdir(dirname(OUTPUT_PATH), { recursive: true }) - await writeFile(OUTPUT_PATH, rendered, 'utf8') - console.log(`Generated trace attributes types -> ${OUTPUT_PATH}`) -} - -main().catch((err) => { - console.error(err) - process.exit(1) -}) diff --git a/scripts/sync-trace-events-contract.ts b/scripts/sync-trace-events-contract.ts deleted file mode 100644 index 9ba4e9ab422..00000000000 --- a/scripts/sync-trace-events-contract.ts +++ /dev/null @@ -1,125 +0,0 @@ -import { mkdir, readFile, writeFile } from 'node:fs/promises' -import { dirname, resolve } from 'node:path' -import { fileURLToPath } from 'node:url' -import { formatGeneratedSource } from './format-generated-source' - -/** - * Generate `apps/sim/lib/mothership/generated/trace-events-v1.ts` from - * the Go-side `contracts/trace-events-v1.schema.json` contract. - * - * Mirrors the span-names + attribute-keys sync scripts exactly — the - * only difference is the $defs key (`TraceEventsV1Name`), the output - * path, and the generated const name (`TraceEvent`). Keeping the - * scripts structurally identical means a reader who understands one - * understands all three, and drift between them gets caught - * immediately in code review. - */ -const SCRIPT_DIR = dirname(fileURLToPath(import.meta.url)) -const ROOT = resolve(SCRIPT_DIR, '..') -const DEFAULT_CONTRACT_PATH = resolve( - ROOT, - '../copilot/copilot/contracts/trace-events-v1.schema.json' -) -const OUTPUT_PATH = resolve(ROOT, 'apps/sim/lib/mothership/generated/trace-events-v1.ts') - -function extractEventNames(schema: Record): string[] { - const defs = (schema.$defs ?? {}) as Record - const nameDef = defs.TraceEventsV1Name - if ( - !nameDef || - typeof nameDef !== 'object' || - !Array.isArray((nameDef as Record).enum) - ) { - throw new Error('trace-events-v1.schema.json is missing $defs.TraceEventsV1Name.enum') - } - const enumValues = (nameDef as Record).enum as unknown[] - if (!enumValues.every((v) => typeof v === 'string')) { - throw new Error('TraceEventsV1Name enum must be string-only') - } - return (enumValues as string[]).slice().sort() -} - -function toIdentifier(name: string): string { - const parts = name.split(/[^A-Za-z0-9]+/).filter(Boolean) - if (parts.length === 0) { - throw new Error(`Cannot derive identifier for event name: ${name}`) - } - const ident = parts.map((p) => p.charAt(0).toUpperCase() + p.slice(1).toLowerCase()).join('') - if (/^[0-9]/.test(ident)) { - throw new Error(`Derived identifier "${ident}" for event "${name}" starts with a digit`) - } - return ident -} - -function render(eventNames: string[]): string { - const pairs = eventNames.map((name) => ({ name, ident: toIdentifier(name) })) - - const seen = new Map() - for (const p of pairs) { - const prev = seen.get(p.ident) - if (prev && prev !== p.name) { - throw new Error(`Identifier collision: "${prev}" and "${p.name}" both map to "${p.ident}"`) - } - seen.set(p.ident, p.name) - } - - const constLines = pairs.map((p) => ` ${p.ident}: ${JSON.stringify(p.name)},`).join('\n') - const arrayEntries = eventNames.map((n) => ` ${JSON.stringify(n)},`).join('\n') - - return `// AUTO-GENERATED FILE. DO NOT EDIT. -// -// Source: copilot/copilot/contracts/trace-events-v1.schema.json -// Regenerate with: bun run trace-events-contract:generate -// -// Canonical mothership OTel span event names. Call sites should -// reference \`TraceEvent.\` (e.g. -// \`TraceEvent.RequestCancelled\`) rather than raw string literals, -// so the Go-side contract is the single source of truth and typos -// become compile errors. - -export const TraceEvent = { -${constLines} -} as const; - -export type TraceEventKey = keyof typeof TraceEvent; -export type TraceEventValue = (typeof TraceEvent)[TraceEventKey]; - -/** Readonly sorted list of every canonical event name. */ -export const TraceEventValues: readonly TraceEventValue[] = [ -${arrayEntries} -] as const; -` -} - -async function main() { - const checkOnly = process.argv.includes('--check') - const inputArg = process.argv.find((a) => a.startsWith('--input=')) - const inputPath = inputArg - ? resolve(ROOT, inputArg.slice('--input='.length)) - : DEFAULT_CONTRACT_PATH - - const raw = await readFile(inputPath, 'utf8') - const schema = JSON.parse(raw) - const eventNames = extractEventNames(schema) - const rendered = formatGeneratedSource(render(eventNames), OUTPUT_PATH, ROOT) - - if (checkOnly) { - const existing = await readFile(OUTPUT_PATH, 'utf8').catch(() => null) - if (existing !== rendered) { - throw new Error( - 'Generated trace events contract is stale. Run: bun run trace-events-contract:generate' - ) - } - console.log('Trace events contract is up to date.') - return - } - - await mkdir(dirname(OUTPUT_PATH), { recursive: true }) - await writeFile(OUTPUT_PATH, rendered, 'utf8') - console.log(`Generated trace events types -> ${OUTPUT_PATH}`) -} - -main().catch((err) => { - console.error(err) - process.exit(1) -}) diff --git a/scripts/sync-trace-spans-contract.ts b/scripts/sync-trace-spans-contract.ts deleted file mode 100644 index d6e4fe1ad9e..00000000000 --- a/scripts/sync-trace-spans-contract.ts +++ /dev/null @@ -1,143 +0,0 @@ -import { mkdir, readFile, writeFile } from 'node:fs/promises' -import { dirname, resolve } from 'node:path' -import { fileURLToPath } from 'node:url' -import { formatGeneratedSource } from './format-generated-source' - -/** - * Generate `apps/sim/lib/mothership/generated/trace-spans-v1.ts` from the - * Go-side `contracts/trace-spans-v1.schema.json` contract. - * - * The contract is a single-enum JSON Schema. We emit: - * - A `TraceSpansV1Name` const object (key-as-value) for ergonomic - * access: `TraceSpansV1Name['copilot.vfs.read_file']`. - * - A `TraceSpansV1NameValue` union type. - * - A sorted `TraceSpansV1Names` readonly array (useful for tests that - * verify coverage, and for tooling that wants to enumerate names). - * - * We deliberately do NOT pass through `json-schema-to-typescript` — - * it would generate a noisy `TraceSpansV1` object type for the wrapper - * that drives reflection; the wrapper type has no runtime use on the Sim - * side and would obscure the actual enum. - */ -const SCRIPT_DIR = dirname(fileURLToPath(import.meta.url)) -const ROOT = resolve(SCRIPT_DIR, '..') -const DEFAULT_CONTRACT_PATH = resolve( - ROOT, - '../copilot/copilot/contracts/trace-spans-v1.schema.json' -) -const OUTPUT_PATH = resolve(ROOT, 'apps/sim/lib/mothership/generated/trace-spans-v1.ts') - -function extractSpanNames(schema: Record): string[] { - const defs = (schema.$defs ?? {}) as Record - const nameDef = defs.TraceSpansV1Name - if ( - !nameDef || - typeof nameDef !== 'object' || - !Array.isArray((nameDef as Record).enum) - ) { - throw new Error('trace-spans-v1.schema.json is missing $defs.TraceSpansV1Name.enum') - } - const enumValues = (nameDef as Record).enum as unknown[] - if (!enumValues.every((v) => typeof v === 'string')) { - throw new Error('TraceSpansV1Name enum must be string-only') - } - return (enumValues as string[]).slice().sort() -} - -/** - * Convert a wire name like "copilot.recovery.check_replay_gap" into an - * identifier-safe PascalCase key like "CopilotRecoveryCheckReplayGap", - * so call sites read as `TraceSpan.CopilotRecoveryCheckReplayGap` - * instead of `TraceSpan["copilot.recovery.check_replay_gap"]`. - * - * Splits on `.`, `_`, and non-alphanumeric characters; capitalizes each - * part; collapses. Strict mapping (not a best-effort heuristic), so the - * same input always produces the same identifier. - */ -function toIdentifier(name: string): string { - const parts = name.split(/[^A-Za-z0-9]+/).filter(Boolean) - if (parts.length === 0) { - throw new Error(`Cannot derive identifier for span name: ${name}`) - } - const ident = parts.map((p) => p.charAt(0).toUpperCase() + p.slice(1).toLowerCase()).join('') - // Safety: identifiers may not start with a digit. - if (/^[0-9]/.test(ident)) { - throw new Error(`Derived identifier "${ident}" for span "${name}" starts with a digit`) - } - return ident -} - -function render(spanNames: string[]): string { - const pairs = spanNames.map((name) => ({ name, ident: toIdentifier(name) })) - - // Guard against collisions: if two wire names ever collapse to the - // same PascalCase identifier, we want a clear build failure, not a - // silent override. - const seen = new Map() - for (const p of pairs) { - const prev = seen.get(p.ident) - if (prev && prev !== p.name) { - throw new Error(`Identifier collision: "${prev}" and "${p.name}" both map to "${p.ident}"`) - } - seen.set(p.ident, p.name) - } - - const constLines = pairs.map((p) => ` ${p.ident}: ${JSON.stringify(p.name)},`).join('\n') - const arrayEntries = spanNames.map((n) => ` ${JSON.stringify(n)},`).join('\n') - - return `// AUTO-GENERATED FILE. DO NOT EDIT. -// -// Source: copilot/copilot/contracts/trace-spans-v1.schema.json -// Regenerate with: bun run trace-spans-contract:generate -// -// Canonical mothership OTel span names. Call sites should reference -// \`TraceSpan.\` (e.g. \`TraceSpan.CopilotVfsReadFile\`) -// rather than raw string literals, so the Go-side contract is the -// single source of truth and typos become compile errors. - -export const TraceSpan = { -${constLines} -} as const; - -export type TraceSpanKey = keyof typeof TraceSpan; -export type TraceSpanValue = (typeof TraceSpan)[TraceSpanKey]; - -/** Readonly sorted list of every canonical span name. */ -export const TraceSpanValues: readonly TraceSpanValue[] = [ -${arrayEntries} -] as const; -` -} - -async function main() { - const checkOnly = process.argv.includes('--check') - const inputArg = process.argv.find((a) => a.startsWith('--input=')) - const inputPath = inputArg - ? resolve(ROOT, inputArg.slice('--input='.length)) - : DEFAULT_CONTRACT_PATH - - const raw = await readFile(inputPath, 'utf8') - const schema = JSON.parse(raw) - const spanNames = extractSpanNames(schema) - const rendered = formatGeneratedSource(render(spanNames), OUTPUT_PATH, ROOT) - - if (checkOnly) { - const existing = await readFile(OUTPUT_PATH, 'utf8').catch(() => null) - if (existing !== rendered) { - throw new Error( - 'Generated trace spans contract is stale. Run: bun run trace-spans-contract:generate' - ) - } - console.log('Trace spans contract is up to date.') - return - } - - await mkdir(dirname(OUTPUT_PATH), { recursive: true }) - await writeFile(OUTPUT_PATH, rendered, 'utf8') - console.log(`Generated trace spans types -> ${OUTPUT_PATH}`) -} - -main().catch((err) => { - console.error(err) - process.exit(1) -}) diff --git a/scripts/sync-vfs-snapshot-contract.ts b/scripts/sync-vfs-snapshot-contract.ts deleted file mode 100644 index 139b193a5fd..00000000000 --- a/scripts/sync-vfs-snapshot-contract.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { mkdir, readFile, writeFile } from 'node:fs/promises' -import { dirname, resolve } from 'node:path' -import { fileURLToPath } from 'node:url' -import { compile } from 'json-schema-to-typescript' -import { formatGeneratedSource } from './format-generated-source' - -const SCRIPT_DIR = dirname(fileURLToPath(import.meta.url)) -const ROOT = resolve(SCRIPT_DIR, '..') -// Matches the sibling sync scripts' canonical layout. In a repo where the Go -// service lives at `mothership/copilot`, pass `--input=` (e.g. -// `--input=../mothership/copilot/contracts/vfs-snapshot-v1.schema.json`). -const DEFAULT_CONTRACT_PATH = resolve( - ROOT, - '../copilot/copilot/contracts/vfs-snapshot-v1.schema.json' -) -const OUTPUT_PATH = resolve(ROOT, 'apps/sim/lib/mothership/generated/vfs-snapshot-v1.ts') - -async function main() { - const checkOnly = process.argv.includes('--check') - const inputPathArg = process.argv.find((arg) => arg.startsWith('--input=')) - const inputPath = inputPathArg - ? resolve(ROOT, inputPathArg.slice('--input='.length)) - : DEFAULT_CONTRACT_PATH - - const raw = await readFile(inputPath, 'utf8') - const schema = JSON.parse(raw) - const types = await compile(schema, 'VfsSnapshotV1', { - bannerComment: '// AUTO-GENERATED FILE. DO NOT EDIT.\n//', - unreachableDefinitions: true, - additionalProperties: false, - }) - const rendered = formatGeneratedSource(types, OUTPUT_PATH, ROOT) - - if (checkOnly) { - const existing = await readFile(OUTPUT_PATH, 'utf8').catch(() => null) - if (existing !== rendered) { - throw new Error('Generated vfs snapshot contract is stale. Run: bun run mship:generate') - } - return - } - - await mkdir(dirname(OUTPUT_PATH), { recursive: true }) - await writeFile(OUTPUT_PATH, rendered, 'utf8') -} - -await main() From 4ac688b882418633ed322ad01113964375dda607 Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Fri, 20 Nov 2026 16:23:41 -0800 Subject: [PATCH 2/4] chore(mothership): point the pi sandbox note at the moved mothership sandbox --- apps/sim/scripts/pi-sandbox-packages.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/sim/scripts/pi-sandbox-packages.ts b/apps/sim/scripts/pi-sandbox-packages.ts index d4a9f52b5b2..b67cc4eb68b 100644 --- a/apps/sim/scripts/pi-sandbox-packages.ts +++ b/apps/sim/scripts/pi-sandbox-packages.ts @@ -9,7 +9,7 @@ * renderer is the drift that makes a failover fail at the worst moment. * * The copilot repo holds the equivalent lists for the shell and doc sandboxes - * (`copilot/scripts/sandbox/packages.ts`); the Pi image lives here because Sim + * (`sandbox/packages.ts`); the Pi image lives here because Sim * owns the Pi block. */ From 45ce934bc447471971f4a0a6e4e79f6da45461a0 Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Fri, 20 Nov 2026 16:29:00 -0800 Subject: [PATCH 3/4] chore(mothership): drop the unused json2ts dependency and keep the ship note's catalog path a placeholder --- .agents/skills/ship/SKILL.md | 2 +- bun.lock | 15 --------------- package.json | 1 - 3 files changed, 1 insertion(+), 17 deletions(-) diff --git a/.agents/skills/ship/SKILL.md b/.agents/skills/ship/SKILL.md index 3e5ba535133..119a5ee218b 100644 --- a/.agents/skills/ship/SKILL.md +++ b/.agents/skills/ship/SKILL.md @@ -59,7 +59,7 @@ When the user runs `/ship`: ``` Then `git status --short` to see what regenerated — those files must be staged in step 7 alongside your own changes. - **Do NOT blanket-run the domain generators here.** `mship-tools:generate` merges Sim's tool contracts into the base tool catalog in the **external** Mothership worker checkout (`../copilot/worker/packages/contracts/tool-catalog-v1.json`), which most worktrees lack, so it hard-fails with `ENOENT` and would abort ship for an unrelated reason. The other mothership contracts in `apps/sim/lib/mothership/generated/` are copied in by the worker's `contracts:sync`, never generated here. `generate:pi-model-catalog` (under `apps/sim`) likewise regenerates from the installed Pi package, not repo source. `scripts/generate-docs.ts` rewrites the integration docs and client-safe catalog; run it when this PR changes their block/icon/landing-content inputs or when `check:integration-catalog` reports drift, then review its broad generated diff. Only when **this PR's diff actually touches** a domain generator's input do you regenerate it deliberately and run its matching `:check` (e.g. `bun run mship-tools:check`) — with the external source present. + **Do NOT blanket-run the domain generators here.** `mship-tools:generate` merges Sim's tool contracts into the base tool catalog in the **external** Mothership worker checkout (`/worker/packages/contracts/tool-catalog-v1.json`), which most worktrees lack, so it hard-fails with `ENOENT` and would abort ship for an unrelated reason. The other mothership contracts in `apps/sim/lib/mothership/generated/` are copied in by the worker's `contracts:sync`, never generated here. `generate:pi-model-catalog` (under `apps/sim`) likewise regenerates from the installed Pi package, not repo source. `scripts/generate-docs.ts` rewrites the integration docs and client-safe catalog; run it when this PR changes their block/icon/landing-content inputs or when `check:integration-catalog` reports drift, then review its broad generated diff. Only when **this PR's diff actually touches** a domain generator's input do you regenerate it deliberately and run its matching `:check` (e.g. `bun run mship-tools:check`) — with the external source present. **Phase B — run lint + every audit CI enforces, in parallel, and abort ship if any fails.** Before running the commands, compare this list with `.github/workflows/checks.yml`; when CI adds an audit, run it and update this skill instead of trusting a stale snapshot. The env-flag audit is currently an inline workflow block rather than a package script: when `apps/sim/lib/core/config/env-flags.ts` changed, run that current workflow block verbatim instead of copying a second version into this skill. Run `bun run lint` first (it autofixes formatting and mutates files, so don't parallelize it with the read-only audits), then run the base-sensitive block-registry check, then fan the independent audits out and collect exit codes: ```bash diff --git a/bun.lock b/bun.lock index 0b9ed5900a3..79802077575 100644 --- a/bun.lock +++ b/bun.lock @@ -21,7 +21,6 @@ "glob": "13.0.6", "gray-matter": "4.0.3", "husky": "9.1.7", - "json-schema-to-typescript": "15.0.4", "knip": "6.44.1", "lint-staged": "16.4.0", "opentype.js": "1.3.4", @@ -1089,8 +1088,6 @@ "@anthropic-ai/sdk": ["@anthropic-ai/sdk@0.115.0", "", { "dependencies": { "json-schema-to-ts": "^3.1.1", "standardwebhooks": "^1.0.0" }, "peerDependencies": { "zod": "^3.25.0 || ^4.0.0" }, "optionalPeers": ["zod"], "bin": { "anthropic-ai-sdk": "bin/cli" } }, "sha512-BJrFIVyjNuU8lfDyIJTvlRYzgQg+zEl78BxE7fq8esULsGz9IRQvGtW5spq3tydmtjQb/GFdooKGdGsetpx+lQ=="], - "@apidevtools/json-schema-ref-parser": ["@apidevtools/json-schema-ref-parser@11.9.3", "", { "dependencies": { "@jsdevtools/ono": "^7.1.3", "@types/json-schema": "^7.0.15", "js-yaml": "^4.1.0" } }, "sha512-60vepv88RwcJtSHrD6MjIL6Ta3SOYbgfnkHb+ppAVK+o9mXprRtulx7VlRl3lN3bbvysAfCS7WMVfhUYemB0IQ=="], - "@asamuzakjp/css-color": ["@asamuzakjp/css-color@3.2.0", "", { "dependencies": { "@csstools/css-calc": "^2.1.3", "@csstools/css-color-parser": "^3.0.9", "@csstools/css-parser-algorithms": "^3.0.4", "@csstools/css-tokenizer": "^3.0.3", "lru-cache": "^10.4.3" } }, "sha512-K1A6z8tS3XsmCMM86xoWdn7Fkdn9m6RSVtocUrJYIwZnFVkng/PvkEoWtOWmP+Scc6saYWHWZYbndEEXxl24jw=="], "@authenio/xml-encryption": ["@authenio/xml-encryption@2.0.2", "", { "dependencies": { "@xmldom/xmldom": "^0.8.6", "escape-html": "^1.0.3", "xpath": "0.0.32" } }, "sha512-cTlrKttbrRHEw3W+0/I609A2Matj5JQaRvfLtEIGZvlN0RaPi+3ANsMeqAyCAVlH/lUIW2tmtBlSMni74lcXeg=="], @@ -1597,8 +1594,6 @@ "@js-sdsl/ordered-map": ["@js-sdsl/ordered-map@4.4.2", "", {}, "sha512-iUKgm52T8HOE/makSxjqoWhe95ZJA1/G1sYsGev2JDKUSS14KAgg1LHb+Ba+IPow0xflbnSkOsZcO08C7w1gYw=="], - "@jsdevtools/ono": ["@jsdevtools/ono@7.1.3", "", {}, "sha512-4JQNk+3mVzK3xh2rqd6RB4J46qUR19azEHBneZyTZM+c456qOrbbM/5xcR8huNCCcbVt7+UmizG6GuUvPvKUYg=="], - "@jsonhero/path": ["@jsonhero/path@1.0.21", "", {}, "sha512-gVUDj/92acpVoJwsVJ/RuWOaHyG4oFzn898WNGQItLCTQ+hOaVlEaImhwE1WqOTf+l3dGOUkbSiVKlb3q1hd1Q=="], "@linear/sdk": ["@linear/sdk@97.1.0", "", { "dependencies": { "@graphql-typed-document-node/core": "^3.2.0" } }, "sha512-HPk0zY8+SAOEoUEPxZZgqTU7xpNJ5BYcN3grngaWsesecaGMUrn2bzhmWtsQ0jOtTvLImZKHxgiL3hqEjb6oig=="], @@ -2459,12 +2454,8 @@ "@types/jsdom": ["@types/jsdom@21.1.7", "", { "dependencies": { "@types/node": "*", "@types/tough-cookie": "*", "parse5": "^7.0.0" } }, "sha512-yOriVnggzrnQ3a9OKOCxaVuSug3w3/SbOj5i7VwXWZEyUNl3bLF9V3MfxGbZKuwqJOQyRfqXyROBB1CoZLFWzA=="], - "@types/json-schema": ["@types/json-schema@7.0.15", "", {}, "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA=="], - "@types/keyv": ["@types/keyv@3.1.4", "", { "dependencies": { "@types/node": "*" } }, "sha512-BQ5aZNSCpj7D6K2ksrRCTmKRLEpnPvWDiLPfoGyhZ++8YtiK9d/3DBKPJgry359X/P1PfruyYwvnvwFjuEiEIg=="], - "@types/lodash": ["@types/lodash@4.17.24", "", {}, "sha512-gIW7lQLZbue7lRSWEFql49QJJWThrTFFeIMJdp3eH4tKoxm1OvEPg02rm4wCCSHS0cL3/Fizimb35b7k8atwsQ=="], - "@types/mdast": ["@types/mdast@4.0.4", "", { "dependencies": { "@types/unist": "*" } }, "sha512-kGaNbPh1k7AFzgpud/gMdvIm5xuECykRR+JnWKQno9TAXVa6WIVCGTPvYGekIDL4uwCZQSYbUxNBSb1aUo79oA=="], "@types/mdx": ["@types/mdx@2.0.14", "", {}, "sha512-T48PeuJtvLosNTPVhfnIp3i/n3a4g4Bad7YCq5k64D4u7NwDrAotikQ+5+sjtUvBmxCMlbo3dVL+C2dP0rWHzg=="], @@ -3489,12 +3480,8 @@ "is-extendable": ["is-extendable@0.1.1", "", {}, "sha512-5BMULNob1vgFX6EjQw5izWDxrecWK9AM72rugNr0TFldMOi0fj6Jk+zeKIt0xGj4cEfQIJth4w3OKWOJ4f+AFw=="], - "is-extglob": ["is-extglob@2.1.1", "", {}, "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ=="], - "is-fullwidth-code-point": ["is-fullwidth-code-point@3.0.0", "", {}, "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg=="], - "is-glob": ["is-glob@4.0.3", "", { "dependencies": { "is-extglob": "^2.1.1" } }, "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg=="], - "is-hexadecimal": ["is-hexadecimal@2.0.1", "", {}, "sha512-DgZQp241c8oO6cA1SbTEWiXeoxV42vlcJxgH+B3hi1AiqqKruZR3ZGF8In3fj4+/y/7rHvlOZLZtgJ/4ttYGZg=="], "is-in-ssh": ["is-in-ssh@1.0.0", "", {}, "sha512-jYa6Q9rH90kR1vKB6NM7qqd1mge3Fx4Dhw5TVlK1MUBqhEOuCagrEHMevNuCcbECmXZ0ThXkRm+Ymr51HwEPAw=="], @@ -3561,8 +3548,6 @@ "json-schema-to-ts": ["json-schema-to-ts@3.1.1", "", { "dependencies": { "@babel/runtime": "^7.18.3", "ts-algebra": "^2.0.0" } }, "sha512-+DWg8jCJG2TEnpy7kOm/7/AxaYoaRbjVB4LFZLySZlWn8exGs3A4OLJR966cVvU26N7X9TWxl+Jsw7dzAqKT6g=="], - "json-schema-to-typescript": ["json-schema-to-typescript@15.0.4", "", { "dependencies": { "@apidevtools/json-schema-ref-parser": "^11.5.5", "@types/json-schema": "^7.0.15", "@types/lodash": "^4.17.7", "is-glob": "^4.0.3", "js-yaml": "^4.1.0", "lodash": "^4.17.21", "minimist": "^1.2.8", "prettier": "^3.2.5", "tinyglobby": "^0.2.9" }, "bin": { "json2ts": "dist/src/cli.js" } }, "sha512-Su9oK8DR4xCmDsLlyvadkXzX6+GGXJpbhwoLtOGArAG61dvbW4YQmSEno2y66ahpIdmLMg6YUf/QHLgiwvkrHQ=="], - "json-schema-traverse": ["json-schema-traverse@1.0.0", "", {}, "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug=="], "json-schema-typed": ["json-schema-typed@8.0.2", "", {}, "sha512-fQhoXdcvc3V28x7C7BMs4P5+kNlgUURe2jmUT1T//oBRMDrqy1QPelJimwZGo7Hg9VPV3EQV5Bnq4hbFy2vetA=="], diff --git a/package.json b/package.json index 10c9449d99c..05f2d676768 100644 --- a/package.json +++ b/package.json @@ -195,7 +195,6 @@ "glob": "13.0.6", "gray-matter": "4.0.3", "husky": "9.1.7", - "json-schema-to-typescript": "15.0.4", "knip": "6.44.1", "lint-staged": "16.4.0", "opentype.js": "1.3.4", From 915d82c9e8e6fe64dea5d72df4392b02c9800ff2 Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Fri, 20 Nov 2026 16:42:24 -0800 Subject: [PATCH 4/4] fix(mothership): type the auto-model router call from the worker's model-router contract The worker now serves POST /api/model-router again (mothership D116); only the Go service did, so every sim-auto block has fallen back to its default model since the cutover. The resolver takes its request and response types from the synced contract instead of a hand-kept copy. --- apps/sim/lib/model-router/resolve.ts | 27 +++---- .../lib/mothership/generated/model-router.ts | 71 +++++++++++++++++++ 2 files changed, 79 insertions(+), 19 deletions(-) create mode 100644 apps/sim/lib/mothership/generated/model-router.ts diff --git a/apps/sim/lib/model-router/resolve.ts b/apps/sim/lib/model-router/resolve.ts index 44ab35727d6..44f032bfa81 100644 --- a/apps/sim/lib/model-router/resolve.ts +++ b/apps/sim/lib/model-router/resolve.ts @@ -3,6 +3,11 @@ import { createLogger } from '@sim/logger' import { getErrorMessage } from '@sim/utils/errors' import { env } from '@/lib/core/config/env' import { getCostMultiplier, isHosted } from '@/lib/core/config/env-flags' +import type { + ModelRouterRequest, + ModelRouterResponse, + ModelRouterUsage, +} from '@/lib/mothership/generated/model-router' import { fetchGo } from '@/lib/mothership/request/go/fetch' import { getMothershipBaseURL } from '@/lib/mothership/server/agent-url' import { validateModelProvider } from '@/ee/access-control/utils/permission-check' @@ -100,22 +105,6 @@ export interface AutoRoutingSignals { approxInputTokens: number } -/** Mirrors mothership's model-router-v1 response usage block. */ -interface ModelRouterUsage { - model: string - inputTokens: number - cachedInputTokens: number - outputTokens: number - cost: number -} - -interface ModelRouterResponse { - choice?: string - decidedBy?: string - usage?: ModelRouterUsage - billable?: boolean -} - export interface AutoRoutingResult { model: string tier: AutoTierId | null @@ -219,7 +208,7 @@ async function callModelRouter( signals: AutoRoutingSignals, ctx: ExecutionContext, blockId: string -): Promise { +): Promise | null> { const baseURL = await getMothershipBaseURL({ userId: ctx.userId ?? '' }) const res = await fetchGo(`${baseURL}/api/model-router`, { @@ -244,7 +233,7 @@ async function callModelRouter( workflowId: ctx.workflowId, blockId, executionId: ctx.executionId, - }), + } satisfies ModelRouterRequest), signal: AbortSignal.timeout(MODEL_ROUTER_TIMEOUT_MS), spanName: 'sim → go /api/model-router', operation: 'model_router', @@ -254,7 +243,7 @@ async function callModelRouter( logger.warn('Model router returned non-OK status', { status: res.status }) return null } - return (await res.json().catch(() => null)) as ModelRouterResponse | null + return (await res.json().catch(() => null)) as Partial | null } /** diff --git a/apps/sim/lib/mothership/generated/model-router.ts b/apps/sim/lib/mothership/generated/model-router.ts new file mode 100644 index 00000000000..27fa5425a51 --- /dev/null +++ b/apps/sim/lib/mothership/generated/model-router.ts @@ -0,0 +1,71 @@ +// GENERATED — do not edit. Source of truth: mothership worker packages/contracts/src/model-router.ts +// Regenerate with `bun run contracts:sync` in the worker. + +import { z } from "zod"; + +/** + * POST /api/model-router: the stateless classifier Sim calls before running a block whose model + * is "auto". Sim sends compact signals about the pending task and its ordered candidates; the + * worker answers with one candidate id. Sim owns what the ids mean and which model serves each. + * Internal-key only: customer keys never reach it. + */ +export const ModelRouterCandidate = z.strictObject({ + /** The token the classifier answers with, e.g. "1". */ + id: z.string().trim().min(1).max(32).regex(/^\S+$/, "a candidate id is a single token"), + /** One line saying when this candidate fits. */ + hint: z.string().max(500), +}); +export type ModelRouterCandidate = z.infer; + +/** Signals, never payloads: the text fields are excerpts of untrusted user content. */ +export const ModelRouterSignals = z.strictObject({ + systemPrompt: z.string().optional(), + lastMessage: z.string().optional(), + messageCount: z.number().int().nonnegative().optional(), + toolNames: z.array(z.string()).optional(), + hasMedia: z.boolean().optional(), + hasResponseFormat: z.boolean().optional(), + approxInputTokens: z.number().int().nonnegative().optional(), +}); +export type ModelRouterSignals = z.infer; + +export const ModelRouterRequest = z.strictObject({ + signals: ModelRouterSignals, + /** Ascending by capability and cost; ties break toward the later candidate. */ + candidates: z + .array(ModelRouterCandidate) + .min(2) + .max(8) + .refine( + (candidates) => new Set(candidates.map((c) => c.id.toLowerCase())).size === candidates.length, + "candidate ids must be unique", + ), + /** Attribution for metering only; never part of the decision. */ + workspaceId: z.string().max(200).optional(), + userId: z.string().max(200).optional(), + workflowId: z.string().max(200).optional(), + blockId: z.string().max(200).optional(), + executionId: z.string().max(200).optional(), +}); +export type ModelRouterRequest = z.infer; + +/** "llm": the classifier named a candidate. "fallback": it did not, so the upper-middle + * candidate was chosen; the call still ran and its usage is still reported. */ +export type ModelRouterDecidedBy = "llm" | "fallback"; + +/** The classifier call's own usage and list-price cost in USD, priced from the worker's catalog. */ +export interface ModelRouterUsage { + model: string; + inputTokens: number; + cachedInputTokens: number; + outputTokens: number; + cost: number; +} + +export interface ModelRouterResponse { + choice: string; + decidedBy: ModelRouterDecidedBy; + usage: ModelRouterUsage; + /** Whether Sim charges the user for this call. Sim treats a missing or false value as no. */ + billable: boolean; +}