@copilotkit/runtime 2.0.0-rc.18 → 2.0.0-rc.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent/index.cjs.map +1 -1
- package/dist/agent/index.mjs.map +1 -1
- package/dist/runtime/core/fetch-handler.cjs.map +1 -1
- package/dist/runtime/core/fetch-handler.mjs.map +1 -1
- package/dist/runtime/core/package-info.cjs +1 -1
- package/dist/runtime/core/package-info.mjs +1 -1
- package/dist/runtime/handlers/handle-connect.cjs.map +1 -1
- package/dist/runtime/handlers/handle-connect.mjs.map +1 -1
- package/dist/runtime/handlers/handle-run.cjs.map +1 -1
- package/dist/runtime/handlers/handle-run.mjs.map +1 -1
- package/dist/runtime/handlers/intelligence/run.cjs.map +1 -1
- package/dist/runtime/handlers/intelligence/run.mjs.map +1 -1
- package/dist/runtime/handlers/intelligence/threads.cjs.map +1 -1
- package/dist/runtime/handlers/intelligence/threads.mjs.map +1 -1
- package/dist/runtime/handlers/shared/resolve-intelligence-user.cjs +1 -1
- package/dist/runtime/handlers/shared/resolve-intelligence-user.cjs.map +1 -1
- package/dist/runtime/handlers/shared/resolve-intelligence-user.mjs +1 -1
- package/dist/runtime/handlers/shared/resolve-intelligence-user.mjs.map +1 -1
- package/dist/runtime/handlers/shared/sse-response.cjs +72 -63
- package/dist/runtime/handlers/shared/sse-response.cjs.map +1 -1
- package/dist/runtime/handlers/shared/sse-response.mjs +72 -63
- package/dist/runtime/handlers/shared/sse-response.mjs.map +1 -1
- package/dist/runtime/intelligence-platform/skill-registry/registry.cjs +22 -19
- package/dist/runtime/intelligence-platform/skill-registry/registry.cjs.map +1 -1
- package/dist/runtime/intelligence-platform/skill-registry/registry.d.cts.map +1 -1
- package/dist/runtime/intelligence-platform/skill-registry/registry.d.mts.map +1 -1
- package/dist/runtime/intelligence-platform/skill-registry/registry.mjs +22 -19
- package/dist/runtime/intelligence-platform/skill-registry/registry.mjs.map +1 -1
- package/dist/runtime/telemetry/instance-created.cjs +7 -9
- package/dist/runtime/telemetry/instance-created.cjs.map +1 -1
- package/dist/runtime/telemetry/instance-created.mjs +7 -9
- package/dist/runtime/telemetry/instance-created.mjs.map +1 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.cjs","names":["SkillDeliveryError","#config","#inFlight","#snapshot","#blocked","#lastCheckedAt","#refresh","#lastError","#stale","invalidSnapshot","validateSnapshot","#debug","#sources","#multiple","resolveRegistryConfig","#parts","sha256Hex"],"sources":["../../../../src/runtime/intelligence-platform/skill-registry/registry.ts"],"sourcesContent":["import type { CopilotKitIntelligence } from \"../client\";\nimport type {\n GetLearnedSkillsSnapshotRequest,\n LearnedSkillsSnapshotResult,\n} from \"../learned-skills\";\nimport { resolveRegistryConfig } from \"./config\";\nimport type { SingleContainerConfig, SkillRegistryOptions } from \"./config\";\nimport { SkillDeliveryError, invalidSnapshot } from \"./errors\";\nimport type { SkillDeliveryErrorCode } from \"./errors\";\nimport { sha256Hex } from \"../../core/web-crypto\";\nimport { validateSnapshot } from \"./snapshot\";\nimport type { VerifiedSnapshot } from \"./snapshot\";\n\nexport interface SkillRegistryStatus {\n /** Present only for the explicit containers interface. */\n readonly containers?: readonly (SkillRegistryStatus & {\n readonly id: string;\n })[];\n readonly initialized: boolean;\n readonly revision?: string;\n readonly mode: \"latest\" | \"pinned\";\n /** ISO 8601 timestamp of the last successful 200 or matching 304 check. */\n readonly lastCheckedAt?: string;\n readonly stale: boolean;\n readonly lastError?: Readonly<{\n code: SkillDeliveryErrorCode;\n message: string;\n retryable: boolean;\n }>;\n}\n\nfunction transient(error: SkillDeliveryError): boolean {\n return [\n \"NETWORK_ERROR\",\n \"TIMEOUT\",\n \"INVALID_SNAPSHOT\",\n \"UNSUPPORTED_SERVER\",\n ].includes(error.code);\n}\nfunction deliveryError(error: unknown): SkillDeliveryError {\n if (error instanceof SkillDeliveryError) return error;\n return new SkillDeliveryError(\n error instanceof Error && error.name === \"TimeoutError\"\n ? \"TIMEOUT\"\n : \"NETWORK_ERROR\",\n true,\n error,\n );\n}\n\n/** Internal registry shared by framework adapters; public API is framework-native. */\nclass SingleContainerRegistry {\n readonly #config: SingleContainerConfig;\n #snapshot?: VerifiedSnapshot;\n #inFlight?: Promise<VerifiedSnapshot>;\n #lastCheckedAt?: number;\n #stale = false;\n #lastError?: SkillDeliveryError;\n #blocked?: SkillDeliveryError;\n\n constructor(\n config: SingleContainerConfig,\n private readonly fetchSnapshot = (\n request: GetLearnedSkillsSnapshotRequest,\n ) => config.client.getLearnedSkillsSnapshot(request),\n ) {\n this.#config = config;\n }\n\n async initialize(): Promise<void> {\n await this.acquireSnapshot();\n }\n\n /** Capture exactly one immutable snapshot before model work begins. */\n acquireSnapshot(): Promise<VerifiedSnapshot> {\n if (this.#inFlight) return this.#inFlight;\n if (\n this.#snapshot &&\n !this.#blocked &&\n this.#lastCheckedAt !== undefined &&\n Date.now() - this.#lastCheckedAt < this.#config.freshnessWindowMs\n ) {\n return Promise.resolve(this.#snapshot);\n }\n // Defer work one microtask so reentrant and concurrent callers observe the\n // same promise before an injected client can start its request.\n this.#inFlight = Promise.resolve()\n .then(() => this.#refresh())\n .finally(() => {\n this.#inFlight = undefined;\n });\n return this.#inFlight;\n }\n\n get status(): SkillRegistryStatus {\n const error = this.#lastError;\n return Object.freeze({\n initialized: this.#snapshot !== undefined,\n ...(this.#snapshot ? { revision: this.#snapshot.revision } : {}),\n mode: this.#config.revision === undefined ? \"latest\" : \"pinned\",\n ...(this.#lastCheckedAt !== undefined\n ? { lastCheckedAt: new Date(this.#lastCheckedAt).toISOString() }\n : {}),\n stale: this.#stale,\n ...(error\n ? {\n lastError: Object.freeze({\n code: error.code,\n message: error.message,\n retryable: error.retryable,\n }),\n }\n : {}),\n });\n }\n\n async #refresh(): Promise<VerifiedSnapshot> {\n const startedAt = Date.now();\n const controller = new AbortController();\n let timer: ReturnType<typeof setTimeout> | undefined;\n const deadline = new Promise<never>((_, reject) => {\n timer = setTimeout(() => {\n const error = new SkillDeliveryError(\"TIMEOUT\", true);\n controller.abort(error);\n // Give a canonical client that already received denial headers one\n // event-loop turn to report that denial before the watchdog wins.\n timer = setTimeout(() => reject(error), 0);\n }, this.#config.requestTimeoutMs);\n });\n const replacement = async (): Promise<VerifiedSnapshot> => {\n const response = await this.fetchSnapshot({\n containerId: this.#config.containerId,\n ...(this.#config.revision !== undefined\n ? { revision: this.#config.revision }\n : {}),\n ...(this.#snapshot ? { ifNoneMatch: this.#snapshot.etag } : {}),\n signal: controller.signal,\n });\n controller.signal.throwIfAborted();\n if (!response || typeof response !== \"object\") throw invalidSnapshot();\n if (response.status === \"unchanged\") {\n if (\n !this.#snapshot ||\n response.etag !== this.#snapshot.etag ||\n response.revision !== this.#snapshot.revision\n )\n throw invalidSnapshot();\n return this.#snapshot;\n }\n if (\n this.#config.revision !== undefined &&\n response.revision !== this.#config.revision\n )\n throw invalidSnapshot();\n return validateSnapshot(response, controller.signal);\n };\n try {\n const snapshot = await Promise.race([replacement(), deadline]);\n // An abandoned parse never writes registry state: only the winning\n // complete replacement reaches this assignment.\n this.#snapshot = snapshot;\n this.#lastCheckedAt = Date.now();\n this.#stale = false;\n this.#lastError = undefined;\n this.#blocked = undefined;\n this.#debug(\"refresh-success\", startedAt);\n return snapshot;\n } catch (cause) {\n const error = deliveryError(cause);\n if (!transient(error)) {\n this.#blocked = error;\n this.#stale = false;\n this.#lastError = error;\n this.#debug(\"refresh-denied\", startedAt, error.code);\n throw error;\n }\n // A later unreachable server cannot undo an already confirmed denial.\n if (this.#blocked) {\n this.#lastError = this.#blocked;\n this.#debug(\"refresh-failed\", startedAt, error.code);\n throw this.#blocked;\n }\n this.#lastError = error;\n this.#stale = this.#snapshot !== undefined;\n this.#debug(\"refresh-failed\", startedAt, error.code);\n if (this.#snapshot) return this.#snapshot;\n throw error;\n } finally {\n if (timer !== undefined) clearTimeout(timer);\n }\n }\n\n #debug(\n event: string,\n startedAt: number,\n errorCode?: SkillDeliveryErrorCode,\n ): void {\n if (!this.#config.debug) return;\n console.debug(\"CopilotKit learned skills\", {\n event,\n containerId: this.#config.containerId,\n revision: this.#snapshot?.revision,\n durationMs: Date.now() - startedAt,\n ...(errorCode ? { errorCode } : {}),\n });\n }\n}\n\n/** Coalesce refreshes from this registry into one request in the next microtask. */\nfunction batchLoader(client: CopilotKitIntelligence) {\n let pending: {\n request: GetLearnedSkillsSnapshotRequest;\n resolve: (value: LearnedSkillsSnapshotResult) => void;\n reject: (error: unknown) => void;\n }[] = [];\n return (\n request: GetLearnedSkillsSnapshotRequest,\n ): Promise<LearnedSkillsSnapshotResult> =>\n new Promise((resolve, reject) => {\n pending.push({ request, resolve, reject });\n if (pending.length !== 1) return;\n queueMicrotask(async () => {\n const batch = pending;\n pending = [];\n try {\n const results = await client.getLearnedSkillsSnapshots({\n containers: batch.map(\n ({ request: { signal: _signal, ...source } }) => source,\n ),\n signal: batch[0].request.signal,\n });\n if (\n !Array.isArray(results) ||\n results.length !== batch.length ||\n results.some(\n (result, index) =>\n result?.containerId !== batch[index].request.containerId,\n )\n )\n throw invalidSnapshot();\n for (let index = 0; index < batch.length; index++) {\n const result = results[index];\n if (result.status === \"error\") batch[index].reject(result.error);\n else batch[index].resolve(result);\n }\n } catch (error) {\n for (const item of batch) item.reject(error);\n }\n });\n });\n}\n\n/** Compose independent container caches into one immutable invocation snapshot. */\nexport class SkillRegistry {\n readonly #sources: readonly {\n readonly id: string;\n readonly registry: SingleContainerRegistry;\n }[];\n readonly #multiple: boolean;\n #snapshot?: VerifiedSnapshot;\n #parts?: readonly VerifiedSnapshot[];\n #inFlight?: Promise<VerifiedSnapshot>;\n\n constructor(options: SkillRegistryOptions = {}) {\n const config = resolveRegistryConfig(options);\n this.#multiple = config.containers !== undefined;\n const fetchBatch = batchLoader(config.client);\n this.#sources =\n config.containers !== undefined\n ? config.containers.map(({ id, revision }) => ({\n id,\n registry: new SingleContainerRegistry(\n Object.freeze({\n client: config.client,\n freshnessWindowMs: config.freshnessWindowMs,\n requestTimeoutMs: config.requestTimeoutMs,\n debug: config.debug,\n containerId: id,\n ...(revision !== undefined ? { revision } : {}),\n }),\n fetchBatch,\n ),\n }))\n : [\n {\n id: config.containerId!,\n registry: new SingleContainerRegistry({\n client: config.client,\n containerId: config.containerId!,\n revision: config.revision,\n freshnessWindowMs: config.freshnessWindowMs,\n requestTimeoutMs: config.requestTimeoutMs,\n debug: config.debug,\n }),\n },\n ];\n }\n\n /** Load every configured container before agent initialization completes. */\n async initialize(): Promise<void> {\n await this.acquireSnapshot();\n }\n\n /** Capture every container once; a failed source cannot yield a partial catalog. */\n acquireSnapshot(): Promise<VerifiedSnapshot> {\n if (!this.#multiple) return this.#sources[0].registry.acquireSnapshot();\n if (this.#inFlight) return this.#inFlight;\n this.#inFlight = Promise.all(\n this.#sources.map(({ registry }) => registry.acquireSnapshot()),\n )\n .then(async (parts) => {\n if (\n this.#snapshot &&\n parts.every((part, index) => part === this.#parts?.[index])\n ) {\n return this.#snapshot;\n }\n const identity = await sha256Hex(\n JSON.stringify(\n parts.map((part, index) => [\n this.#sources[index].id,\n part.revision,\n part.etag,\n ]),\n ),\n );\n const skills = Object.freeze(\n parts.flatMap((part, index) =>\n part.skills.map((skill) =>\n Object.freeze({\n ...skill,\n name: `${encodeURIComponent(this.#sources[index].id)}/${skill.name}`,\n }),\n ),\n ),\n );\n this.#parts = parts;\n this.#snapshot = Object.freeze({\n revision: `multi:${identity}`,\n etag: `\"${identity}\"`,\n skills,\n });\n return this.#snapshot;\n })\n .finally(() => {\n this.#inFlight = undefined;\n });\n return this.#inFlight;\n }\n\n /** Report each container's real revision; no aggregate server revision exists. */\n get status(): SkillRegistryStatus {\n if (!this.#multiple) return this.#sources[0].registry.status;\n const containers = Object.freeze(\n this.#sources.map(({ id, registry }) =>\n Object.freeze({ id, ...registry.status }),\n ),\n );\n const error =\n containers.find(\n (source) => source.lastError && !source.lastError.retryable,\n )?.lastError ?? containers.find((source) => source.lastError)?.lastError;\n const timestamps = containers.map((source) => source.lastCheckedAt);\n return Object.freeze({\n initialized: this.#snapshot !== undefined,\n mode: containers.every((source) => source.mode === \"pinned\")\n ? \"pinned\"\n : \"latest\",\n stale: containers.some((source) => source.stale),\n ...(timestamps.every((timestamp) => timestamp !== undefined)\n ? { lastCheckedAt: [...timestamps].sort()[0] }\n : {}),\n ...(error ? { lastError: error } : {}),\n containers,\n });\n }\n}\n"],"mappings":";;;;;;;AA+BA,SAAS,UAAU,OAAoC;AACrD,QAAO;EACL;EACA;EACA;EACA;EACD,CAAC,SAAS,MAAM,KAAK;;AAExB,SAAS,cAAc,OAAoC;AACzD,KAAI,iBAAiBA,0CAAoB,QAAO;AAChD,QAAO,IAAIA,0CACT,iBAAiB,SAAS,MAAM,SAAS,iBACrC,YACA,iBACJ,MACA,MACD;;;AAIH,IAAM,0BAAN,MAA8B;CAC5B,CAASC;CACT;CACA;CACA;CACA,SAAS;CACT;CACA;CAEA,YACE,QACA,AAAiB,iBACf,YACG,OAAO,OAAO,yBAAyB,QAAQ,EACpD;EAHiB;AAIjB,QAAKA,SAAU;;CAGjB,MAAM,aAA4B;AAChC,QAAM,KAAK,iBAAiB;;;CAI9B,kBAA6C;AAC3C,MAAI,MAAKC,SAAW,QAAO,MAAKA;AAChC,MACE,MAAKC,YACL,CAAC,MAAKC,WACN,MAAKC,kBAAmB,UACxB,KAAK,KAAK,GAAG,MAAKA,gBAAiB,MAAKJ,OAAQ,kBAEhD,QAAO,QAAQ,QAAQ,MAAKE,SAAU;AAIxC,QAAKD,WAAY,QAAQ,SAAS,CAC/B,WAAW,MAAKI,SAAU,CAAC,CAC3B,cAAc;AACb,SAAKJ,WAAY;IACjB;AACJ,SAAO,MAAKA;;CAGd,IAAI,SAA8B;EAChC,MAAM,QAAQ,MAAKK;AACnB,SAAO,OAAO,OAAO;GACnB,aAAa,MAAKJ,aAAc;GAChC,GAAI,MAAKA,WAAY,EAAE,UAAU,MAAKA,SAAU,UAAU,GAAG,EAAE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OAAO,UAAU,EAAE;EACjE,MAAM,aAAa,WAAW,KAAK,WAAW,OAAO,cAAc;AACnE,SAAO,OAAO,OAAO;GACnB,aAAa,MAAKT,aAAc;GAChC,MAAM,WAAW,OAAO,WAAW,OAAO,SAAS,SAAS,GACxD,WACA;GACJ,OAAO,WAAW,MAAM,WAAW,OAAO,MAAM;GAChD,GAAI,WAAW,OAAO,cAAc,cAAc,OAAU,GACxD,EAAE,eAAe,CAAC,GAAG,WAAW,CAAC,MAAM,CAAC,IAAI,GAC5C,EAAE;GACN,GAAI,QAAQ,EAAE,WAAW,OAAO,GAAG,EAAE;GACrC;GACD,CAAC"}
|
|
1
|
+
{"version":3,"file":"registry.cjs","names":["SkillDeliveryError","#config","#inFlight","#snapshot","#blocked","#lastCheckedAt","#refresh","#lastError","#stale","invalidSnapshot","validateSnapshot","#debug","#sources","#multiple","resolveRegistryConfig","#parts","sha256Hex"],"sources":["../../../../src/runtime/intelligence-platform/skill-registry/registry.ts"],"sourcesContent":["import type { CopilotKitIntelligence } from \"../client\";\nimport type {\n GetLearnedSkillsSnapshotRequest,\n LearnedSkillsSnapshotResult,\n} from \"../learned-skills\";\nimport { resolveRegistryConfig } from \"./config\";\nimport type { SingleContainerConfig, SkillRegistryOptions } from \"./config\";\nimport { SkillDeliveryError, invalidSnapshot } from \"./errors\";\nimport type { SkillDeliveryErrorCode } from \"./errors\";\nimport { sha256Hex } from \"../../core/web-crypto\";\nimport { validateSnapshot } from \"./snapshot\";\nimport type { VerifiedSnapshot } from \"./snapshot\";\n\nexport interface SkillRegistryStatus {\n /** Present only for the explicit containers interface. */\n readonly containers?: readonly (SkillRegistryStatus & {\n readonly id: string;\n })[];\n readonly initialized: boolean;\n readonly revision?: string;\n readonly mode: \"latest\" | \"pinned\";\n /** ISO 8601 timestamp of the last successful 200 or matching 304 check. */\n readonly lastCheckedAt?: string;\n readonly stale: boolean;\n readonly lastError?: Readonly<{\n code: SkillDeliveryErrorCode;\n message: string;\n retryable: boolean;\n }>;\n}\n\nfunction transient(error: SkillDeliveryError): boolean {\n return [\n \"NETWORK_ERROR\",\n \"TIMEOUT\",\n \"INVALID_SNAPSHOT\",\n \"UNSUPPORTED_SERVER\",\n ].includes(error.code);\n}\nfunction deliveryError(error: unknown): SkillDeliveryError {\n if (error instanceof SkillDeliveryError) return error;\n return new SkillDeliveryError(\n error instanceof Error && error.name === \"TimeoutError\"\n ? \"TIMEOUT\"\n : \"NETWORK_ERROR\",\n true,\n error,\n );\n}\n\n/** Internal registry shared by framework adapters; public API is framework-native. */\nclass SingleContainerRegistry {\n readonly #config: SingleContainerConfig;\n #snapshot?: VerifiedSnapshot;\n #inFlight?: Promise<VerifiedSnapshot>;\n #lastCheckedAt?: number;\n #stale = false;\n #lastError?: SkillDeliveryError;\n #blocked?: SkillDeliveryError;\n\n constructor(\n config: SingleContainerConfig,\n private readonly fetchSnapshot = (\n request: GetLearnedSkillsSnapshotRequest,\n ) => config.client.getLearnedSkillsSnapshot(request),\n ) {\n this.#config = config;\n }\n\n async initialize(): Promise<void> {\n await this.acquireSnapshot();\n }\n\n /** Capture exactly one immutable snapshot before model work begins. */\n acquireSnapshot(): Promise<VerifiedSnapshot> {\n if (this.#inFlight !== undefined) return this.#inFlight;\n if (\n this.#snapshot &&\n !this.#blocked &&\n this.#lastCheckedAt !== undefined &&\n Date.now() - this.#lastCheckedAt < this.#config.freshnessWindowMs\n ) {\n return Promise.resolve(this.#snapshot);\n }\n // Defer work one microtask so reentrant and concurrent callers observe the\n // same promise before an injected client can start its request.\n this.#inFlight = Promise.resolve()\n .then(() => this.#refresh())\n .finally(() => {\n this.#inFlight = undefined;\n });\n return this.#inFlight;\n }\n\n get status(): SkillRegistryStatus {\n const error = this.#lastError;\n return Object.freeze({\n initialized: this.#snapshot !== undefined,\n ...(this.#snapshot ? { revision: this.#snapshot.revision } : {}),\n mode: this.#config.revision === undefined ? \"latest\" : \"pinned\",\n ...(this.#lastCheckedAt !== undefined\n ? { lastCheckedAt: new Date(this.#lastCheckedAt).toISOString() }\n : {}),\n stale: this.#stale,\n ...(error\n ? {\n lastError: Object.freeze({\n code: error.code,\n message: error.message,\n retryable: error.retryable,\n }),\n }\n : {}),\n });\n }\n\n async #refresh(): Promise<VerifiedSnapshot> {\n const startedAt = Date.now();\n const controller = new AbortController();\n let timer: ReturnType<typeof setTimeout> | undefined;\n const deadline = new Promise<never>((_, reject) => {\n timer = setTimeout(() => {\n const error = new SkillDeliveryError(\"TIMEOUT\", true);\n controller.abort(error);\n // Give a canonical client that already received denial headers one\n // event-loop turn to report that denial before the watchdog wins.\n timer = setTimeout(() => reject(error), 0);\n }, this.#config.requestTimeoutMs);\n });\n const replacement = async (): Promise<VerifiedSnapshot> => {\n const response = await this.fetchSnapshot({\n containerId: this.#config.containerId,\n ...(this.#config.revision !== undefined\n ? { revision: this.#config.revision }\n : {}),\n ...(this.#snapshot ? { ifNoneMatch: this.#snapshot.etag } : {}),\n signal: controller.signal,\n });\n controller.signal.throwIfAborted();\n if (!response || typeof response !== \"object\") throw invalidSnapshot();\n if (response.status === \"unchanged\") {\n if (\n !this.#snapshot ||\n response.etag !== this.#snapshot.etag ||\n response.revision !== this.#snapshot.revision\n )\n throw invalidSnapshot();\n return this.#snapshot;\n }\n if (\n this.#config.revision !== undefined &&\n response.revision !== this.#config.revision\n )\n throw invalidSnapshot();\n return validateSnapshot(response, controller.signal);\n };\n try {\n const snapshot = await Promise.race([replacement(), deadline]);\n // An abandoned parse never writes registry state: only the winning\n // complete replacement reaches this assignment.\n this.#snapshot = snapshot;\n this.#lastCheckedAt = Date.now();\n this.#stale = false;\n this.#lastError = undefined;\n this.#blocked = undefined;\n this.#debug(\"refresh-success\", startedAt);\n return snapshot;\n } catch (cause) {\n const error = deliveryError(cause);\n if (!transient(error)) {\n this.#blocked = error;\n this.#stale = false;\n this.#lastError = error;\n this.#debug(\"refresh-denied\", startedAt, error.code);\n throw error;\n }\n // A later unreachable server cannot undo an already confirmed denial.\n if (this.#blocked) {\n this.#lastError = this.#blocked;\n this.#debug(\"refresh-failed\", startedAt, error.code);\n throw this.#blocked;\n }\n this.#lastError = error;\n this.#stale = this.#snapshot !== undefined;\n this.#debug(\"refresh-failed\", startedAt, error.code);\n if (this.#snapshot) return this.#snapshot;\n throw error;\n } finally {\n if (timer !== undefined) clearTimeout(timer);\n }\n }\n\n #debug(\n event: string,\n startedAt: number,\n errorCode?: SkillDeliveryErrorCode,\n ): void {\n if (!this.#config.debug) return;\n console.debug(\"CopilotKit learned skills\", {\n event,\n containerId: this.#config.containerId,\n revision: this.#snapshot?.revision,\n durationMs: Date.now() - startedAt,\n ...(errorCode ? { errorCode } : {}),\n });\n }\n}\n\n/** Coalesce refreshes from this registry into one request in the next microtask. */\nfunction batchLoader(client: CopilotKitIntelligence) {\n let pending: {\n request: GetLearnedSkillsSnapshotRequest;\n resolve: (value: LearnedSkillsSnapshotResult) => void;\n reject: (error: unknown) => void;\n }[] = [];\n // Rejects each pending request itself, so it never rejects.\n const flush = async () => {\n const batch = pending;\n pending = [];\n try {\n const results = await client.getLearnedSkillsSnapshots({\n containers: batch.map(\n ({ request: { signal: _signal, ...source } }) => source,\n ),\n signal: batch[0].request.signal,\n });\n if (\n !Array.isArray(results) ||\n results.length !== batch.length ||\n results.some(\n (result, index) =>\n result?.containerId !== batch[index].request.containerId,\n )\n )\n throw invalidSnapshot();\n for (let index = 0; index < batch.length; index++) {\n const result = results[index];\n if (result.status === \"error\") batch[index].reject(result.error);\n else batch[index].resolve(result);\n }\n } catch (error) {\n for (const item of batch) item.reject(error);\n }\n };\n return (\n request: GetLearnedSkillsSnapshotRequest,\n ): Promise<LearnedSkillsSnapshotResult> =>\n new Promise((resolve, reject) => {\n pending.push({ request, resolve, reject });\n if (pending.length !== 1) return;\n queueMicrotask(() => {\n void flush();\n });\n });\n}\n\n/** Compose independent container caches into one immutable invocation snapshot. */\nexport class SkillRegistry {\n readonly #sources: readonly {\n readonly id: string;\n readonly registry: SingleContainerRegistry;\n }[];\n readonly #multiple: boolean;\n #snapshot?: VerifiedSnapshot;\n #parts?: readonly VerifiedSnapshot[];\n #inFlight?: Promise<VerifiedSnapshot>;\n\n constructor(options: SkillRegistryOptions = {}) {\n const config = resolveRegistryConfig(options);\n this.#multiple = config.containers !== undefined;\n const fetchBatch = batchLoader(config.client);\n this.#sources =\n config.containers !== undefined\n ? config.containers.map(({ id, revision }) => ({\n id,\n registry: new SingleContainerRegistry(\n Object.freeze({\n client: config.client,\n freshnessWindowMs: config.freshnessWindowMs,\n requestTimeoutMs: config.requestTimeoutMs,\n debug: config.debug,\n containerId: id,\n ...(revision !== undefined ? { revision } : {}),\n }),\n fetchBatch,\n ),\n }))\n : [\n {\n id: config.containerId!,\n registry: new SingleContainerRegistry({\n client: config.client,\n containerId: config.containerId!,\n revision: config.revision,\n freshnessWindowMs: config.freshnessWindowMs,\n requestTimeoutMs: config.requestTimeoutMs,\n debug: config.debug,\n }),\n },\n ];\n }\n\n /** Load every configured container before agent initialization completes. */\n async initialize(): Promise<void> {\n await this.acquireSnapshot();\n }\n\n /** Capture every container once; a failed source cannot yield a partial catalog. */\n acquireSnapshot(): Promise<VerifiedSnapshot> {\n if (!this.#multiple) return this.#sources[0].registry.acquireSnapshot();\n if (this.#inFlight !== undefined) return this.#inFlight;\n this.#inFlight = Promise.all(\n this.#sources.map(({ registry }) => registry.acquireSnapshot()),\n )\n .then(async (parts) => {\n if (\n this.#snapshot &&\n parts.every((part, index) => part === this.#parts?.[index])\n ) {\n return this.#snapshot;\n }\n const identity = await sha256Hex(\n JSON.stringify(\n parts.map((part, index) => [\n this.#sources[index].id,\n part.revision,\n part.etag,\n ]),\n ),\n );\n const skills = Object.freeze(\n parts.flatMap((part, index) =>\n part.skills.map((skill) =>\n Object.freeze({\n ...skill,\n name: `${encodeURIComponent(this.#sources[index].id)}/${skill.name}`,\n }),\n ),\n ),\n );\n this.#parts = parts;\n this.#snapshot = Object.freeze({\n revision: `multi:${identity}`,\n etag: `\"${identity}\"`,\n skills,\n });\n return this.#snapshot;\n })\n .finally(() => {\n this.#inFlight = undefined;\n });\n return this.#inFlight;\n }\n\n /** Report each container's real revision; no aggregate server revision exists. */\n get status(): SkillRegistryStatus {\n if (!this.#multiple) return this.#sources[0].registry.status;\n const containers = Object.freeze(\n this.#sources.map(({ id, registry }) =>\n Object.freeze({ id, ...registry.status }),\n ),\n );\n const error =\n containers.find(\n (source) => source.lastError && !source.lastError.retryable,\n )?.lastError ?? containers.find((source) => source.lastError)?.lastError;\n const timestamps = containers.map((source) => source.lastCheckedAt);\n return Object.freeze({\n initialized: this.#snapshot !== undefined,\n mode: containers.every((source) => source.mode === \"pinned\")\n ? \"pinned\"\n : \"latest\",\n stale: containers.some((source) => source.stale),\n ...(timestamps.every((timestamp) => timestamp !== undefined)\n ? { lastCheckedAt: [...timestamps].sort()[0] }\n : {}),\n ...(error ? { lastError: error } : {}),\n containers,\n });\n }\n}\n"],"mappings":";;;;;;;AA+BA,SAAS,UAAU,OAAoC;AACrD,QAAO;EACL;EACA;EACA;EACA;EACD,CAAC,SAAS,MAAM,KAAK;;AAExB,SAAS,cAAc,OAAoC;AACzD,KAAI,iBAAiBA,0CAAoB,QAAO;AAChD,QAAO,IAAIA,0CACT,iBAAiB,SAAS,MAAM,SAAS,iBACrC,YACA,iBACJ,MACA,MACD;;;AAIH,IAAM,0BAAN,MAA8B;CAC5B,CAASC;CACT;CACA;CACA;CACA,SAAS;CACT;CACA;CAEA,YACE,QACA,AAAiB,iBACf,YACG,OAAO,OAAO,yBAAyB,QAAQ,EACpD;EAHiB;AAIjB,QAAKA,SAAU;;CAGjB,MAAM,aAA4B;AAChC,QAAM,KAAK,iBAAiB;;;CAI9B,kBAA6C;AAC3C,MAAI,MAAKC,aAAc,OAAW,QAAO,MAAKA;AAC9C,MACE,MAAKC,YACL,CAAC,MAAKC,WACN,MAAKC,kBAAmB,UACxB,KAAK,KAAK,GAAG,MAAKA,gBAAiB,MAAKJ,OAAQ,kBAEhD,QAAO,QAAQ,QAAQ,MAAK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,WAAY;IACjB;AACJ,SAAO,MAAKA;;;CAId,IAAI,SAA8B;AAChC,MAAI,CAAC,MAAKW,SAAW,QAAO,MAAKD,QAAS,GAAG,SAAS;EACtD,MAAM,aAAa,OAAO,OACxB,MAAKA,QAAS,KAAK,EAAE,IAAI,eACvB,OAAO,OAAO;GAAE;GAAI,GAAG,SAAS;GAAQ,CAAC,CAC1C,CACF;EACD,MAAM,QACJ,WAAW,MACR,WAAW,OAAO,aAAa,CAAC,OAAO,UAAU,UACnD,EAAE,aAAa,WAAW,MAAM,WAAW,OAAO,UAAU,EAAE;EACjE,MAAM,aAAa,WAAW,KAAK,WAAW,OAAO,cAAc;AACnE,SAAO,OAAO,OAAO;GACnB,aAAa,MAAKT,aAAc;GAChC,MAAM,WAAW,OAAO,WAAW,OAAO,SAAS,SAAS,GACxD,WACA;GACJ,OAAO,WAAW,MAAM,WAAW,OAAO,MAAM;GAChD,GAAI,WAAW,OAAO,cAAc,cAAc,OAAU,GACxD,EAAE,eAAe,CAAC,GAAG,WAAW,CAAC,MAAM,CAAC,IAAI,GAC5C,EAAE;GACN,GAAI,QAAQ,EAAE,WAAW,OAAO,GAAG,EAAE;GACrC;GACD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.cts","names":[],"sources":["../../../../src/runtime/intelligence-platform/skill-registry/registry.ts"],"mappings":";;;;;UAaiB,mBAAA;;WAEN,UAAA,aAAuB,mBAAA;IAAA,SACrB,EAAA;EAAA;EAAA,SAEF,WAAA;EAAA,SACA,QAAA;EAAA,SACA,IAAA;EAIoB;EAAA,SAFpB,aAAA;EAAA,SACA,KAAA;EAAA,SACA,SAAA,GAAY,QAAA;IACnB,IAAA,EAAM,sBAAA;IACN,OAAA;IACA,SAAA;EAAA;AAAA;;
|
|
1
|
+
{"version":3,"file":"registry.d.cts","names":[],"sources":["../../../../src/runtime/intelligence-platform/skill-registry/registry.ts"],"mappings":";;;;;UAaiB,mBAAA;;WAEN,UAAA,aAAuB,mBAAA;IAAA,SACrB,EAAA;EAAA;EAAA,SAEF,WAAA;EAAA,SACA,QAAA;EAAA,SACA,IAAA;EAIoB;EAAA,SAFpB,aAAA;EAAA,SACA,KAAA;EAAA,SACA,SAAA,GAAY,QAAA;IACnB,IAAA,EAAM,sBAAA;IACN,OAAA;IACA,SAAA;EAAA;AAAA;;cAsOS,aAAA;EAAA;cAUC,OAAA,GAAS,oBAAA;EAlPb;EAsRF,UAAA,CAAA,GAAc,OAAA;EApRlB;EAyRF,eAAA,CAAA,GAAmB,OAAA,CAAQ,gBAAA;EAzRhB;EAAA,IAwUP,MAAA,CAAA,GAAU,mBAAA;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.mts","names":[],"sources":["../../../../src/runtime/intelligence-platform/skill-registry/registry.ts"],"mappings":";;;;;UAaiB,mBAAA;;WAEN,UAAA,aAAuB,mBAAA;IAAA,SACrB,EAAA;EAAA;EAAA,SAEF,WAAA;EAAA,SACA,QAAA;EAAA,SACA,IAAA;EAIoB;EAAA,SAFpB,aAAA;EAAA,SACA,KAAA;EAAA,SACA,SAAA,GAAY,QAAA;IACnB,IAAA,EAAM,sBAAA;IACN,OAAA;IACA,SAAA;EAAA;AAAA;;
|
|
1
|
+
{"version":3,"file":"registry.d.mts","names":[],"sources":["../../../../src/runtime/intelligence-platform/skill-registry/registry.ts"],"mappings":";;;;;UAaiB,mBAAA;;WAEN,UAAA,aAAuB,mBAAA;IAAA,SACrB,EAAA;EAAA;EAAA,SAEF,WAAA;EAAA,SACA,QAAA;EAAA,SACA,IAAA;EAIoB;EAAA,SAFpB,aAAA;EAAA,SACA,KAAA;EAAA,SACA,SAAA,GAAY,QAAA;IACnB,IAAA,EAAM,sBAAA;IACN,OAAA;IACA,SAAA;EAAA;AAAA;;cAsOS,aAAA;EAAA;cAUC,OAAA,GAAS,oBAAA;EAlPb;EAsRF,UAAA,CAAA,GAAc,OAAA;EApRlB;EAyRF,eAAA,CAAA,GAAmB,OAAA,CAAQ,gBAAA;EAzRhB;EAAA,IAwUP,MAAA,CAAA,GAAU,mBAAA;AAAA"}
|
|
@@ -35,7 +35,7 @@ var SingleContainerRegistry = class {
|
|
|
35
35
|
}
|
|
36
36
|
/** Capture exactly one immutable snapshot before model work begins. */
|
|
37
37
|
acquireSnapshot() {
|
|
38
|
-
if (this.#inFlight) return this.#inFlight;
|
|
38
|
+
if (this.#inFlight !== void 0) return this.#inFlight;
|
|
39
39
|
if (this.#snapshot && !this.#blocked && this.#lastCheckedAt !== void 0 && Date.now() - this.#lastCheckedAt < this.#config.freshnessWindowMs) return Promise.resolve(this.#snapshot);
|
|
40
40
|
this.#inFlight = Promise.resolve().then(() => this.#refresh()).finally(() => {
|
|
41
41
|
this.#inFlight = void 0;
|
|
@@ -130,6 +130,24 @@ var SingleContainerRegistry = class {
|
|
|
130
130
|
/** Coalesce refreshes from this registry into one request in the next microtask. */
|
|
131
131
|
function batchLoader(client) {
|
|
132
132
|
let pending = [];
|
|
133
|
+
const flush = async () => {
|
|
134
|
+
const batch = pending;
|
|
135
|
+
pending = [];
|
|
136
|
+
try {
|
|
137
|
+
const results = await client.getLearnedSkillsSnapshots({
|
|
138
|
+
containers: batch.map(({ request: { signal: _signal, ...source } }) => source),
|
|
139
|
+
signal: batch[0].request.signal
|
|
140
|
+
});
|
|
141
|
+
if (!Array.isArray(results) || results.length !== batch.length || results.some((result, index) => result?.containerId !== batch[index].request.containerId)) throw invalidSnapshot();
|
|
142
|
+
for (let index = 0; index < batch.length; index++) {
|
|
143
|
+
const result = results[index];
|
|
144
|
+
if (result.status === "error") batch[index].reject(result.error);
|
|
145
|
+
else batch[index].resolve(result);
|
|
146
|
+
}
|
|
147
|
+
} catch (error) {
|
|
148
|
+
for (const item of batch) item.reject(error);
|
|
149
|
+
}
|
|
150
|
+
};
|
|
133
151
|
return (request) => new Promise((resolve, reject) => {
|
|
134
152
|
pending.push({
|
|
135
153
|
request,
|
|
@@ -137,23 +155,8 @@ function batchLoader(client) {
|
|
|
137
155
|
reject
|
|
138
156
|
});
|
|
139
157
|
if (pending.length !== 1) return;
|
|
140
|
-
queueMicrotask(
|
|
141
|
-
|
|
142
|
-
pending = [];
|
|
143
|
-
try {
|
|
144
|
-
const results = await client.getLearnedSkillsSnapshots({
|
|
145
|
-
containers: batch.map(({ request: { signal: _signal, ...source } }) => source),
|
|
146
|
-
signal: batch[0].request.signal
|
|
147
|
-
});
|
|
148
|
-
if (!Array.isArray(results) || results.length !== batch.length || results.some((result, index) => result?.containerId !== batch[index].request.containerId)) throw invalidSnapshot();
|
|
149
|
-
for (let index = 0; index < batch.length; index++) {
|
|
150
|
-
const result = results[index];
|
|
151
|
-
if (result.status === "error") batch[index].reject(result.error);
|
|
152
|
-
else batch[index].resolve(result);
|
|
153
|
-
}
|
|
154
|
-
} catch (error) {
|
|
155
|
-
for (const item of batch) item.reject(error);
|
|
156
|
-
}
|
|
158
|
+
queueMicrotask(() => {
|
|
159
|
+
flush();
|
|
157
160
|
});
|
|
158
161
|
});
|
|
159
162
|
}
|
|
@@ -197,7 +200,7 @@ var SkillRegistry = class {
|
|
|
197
200
|
/** Capture every container once; a failed source cannot yield a partial catalog. */
|
|
198
201
|
acquireSnapshot() {
|
|
199
202
|
if (!this.#multiple) return this.#sources[0].registry.acquireSnapshot();
|
|
200
|
-
if (this.#inFlight) return this.#inFlight;
|
|
203
|
+
if (this.#inFlight !== void 0) return this.#inFlight;
|
|
201
204
|
this.#inFlight = Promise.all(this.#sources.map(({ registry }) => registry.acquireSnapshot())).then(async (parts) => {
|
|
202
205
|
if (this.#snapshot && parts.every((part, index) => part === this.#parts?.[index])) return this.#snapshot;
|
|
203
206
|
const identity = await sha256Hex(JSON.stringify(parts.map((part, index) => [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.mjs","names":["SkillDeliveryError","#config","#inFlight","#snapshot","#blocked","#lastCheckedAt","#refresh","#lastError","#stale","#debug","#sources","#multiple","#parts"],"sources":["../../../../src/runtime/intelligence-platform/skill-registry/registry.ts"],"sourcesContent":["import type { CopilotKitIntelligence } from \"../client\";\nimport type {\n GetLearnedSkillsSnapshotRequest,\n LearnedSkillsSnapshotResult,\n} from \"../learned-skills\";\nimport { resolveRegistryConfig } from \"./config\";\nimport type { SingleContainerConfig, SkillRegistryOptions } from \"./config\";\nimport { SkillDeliveryError, invalidSnapshot } from \"./errors\";\nimport type { SkillDeliveryErrorCode } from \"./errors\";\nimport { sha256Hex } from \"../../core/web-crypto\";\nimport { validateSnapshot } from \"./snapshot\";\nimport type { VerifiedSnapshot } from \"./snapshot\";\n\nexport interface SkillRegistryStatus {\n /** Present only for the explicit containers interface. */\n readonly containers?: readonly (SkillRegistryStatus & {\n readonly id: string;\n })[];\n readonly initialized: boolean;\n readonly revision?: string;\n readonly mode: \"latest\" | \"pinned\";\n /** ISO 8601 timestamp of the last successful 200 or matching 304 check. */\n readonly lastCheckedAt?: string;\n readonly stale: boolean;\n readonly lastError?: Readonly<{\n code: SkillDeliveryErrorCode;\n message: string;\n retryable: boolean;\n }>;\n}\n\nfunction transient(error: SkillDeliveryError): boolean {\n return [\n \"NETWORK_ERROR\",\n \"TIMEOUT\",\n \"INVALID_SNAPSHOT\",\n \"UNSUPPORTED_SERVER\",\n ].includes(error.code);\n}\nfunction deliveryError(error: unknown): SkillDeliveryError {\n if (error instanceof SkillDeliveryError) return error;\n return new SkillDeliveryError(\n error instanceof Error && error.name === \"TimeoutError\"\n ? \"TIMEOUT\"\n : \"NETWORK_ERROR\",\n true,\n error,\n );\n}\n\n/** Internal registry shared by framework adapters; public API is framework-native. */\nclass SingleContainerRegistry {\n readonly #config: SingleContainerConfig;\n #snapshot?: VerifiedSnapshot;\n #inFlight?: Promise<VerifiedSnapshot>;\n #lastCheckedAt?: number;\n #stale = false;\n #lastError?: SkillDeliveryError;\n #blocked?: SkillDeliveryError;\n\n constructor(\n config: SingleContainerConfig,\n private readonly fetchSnapshot = (\n request: GetLearnedSkillsSnapshotRequest,\n ) => config.client.getLearnedSkillsSnapshot(request),\n ) {\n this.#config = config;\n }\n\n async initialize(): Promise<void> {\n await this.acquireSnapshot();\n }\n\n /** Capture exactly one immutable snapshot before model work begins. */\n acquireSnapshot(): Promise<VerifiedSnapshot> {\n if (this.#inFlight) return this.#inFlight;\n if (\n this.#snapshot &&\n !this.#blocked &&\n this.#lastCheckedAt !== undefined &&\n Date.now() - this.#lastCheckedAt < this.#config.freshnessWindowMs\n ) {\n return Promise.resolve(this.#snapshot);\n }\n // Defer work one microtask so reentrant and concurrent callers observe the\n // same promise before an injected client can start its request.\n this.#inFlight = Promise.resolve()\n .then(() => this.#refresh())\n .finally(() => {\n this.#inFlight = undefined;\n });\n return this.#inFlight;\n }\n\n get status(): SkillRegistryStatus {\n const error = this.#lastError;\n return Object.freeze({\n initialized: this.#snapshot !== undefined,\n ...(this.#snapshot ? { revision: this.#snapshot.revision } : {}),\n mode: this.#config.revision === undefined ? \"latest\" : \"pinned\",\n ...(this.#lastCheckedAt !== undefined\n ? { lastCheckedAt: new Date(this.#lastCheckedAt).toISOString() }\n : {}),\n stale: this.#stale,\n ...(error\n ? {\n lastError: Object.freeze({\n code: error.code,\n message: error.message,\n retryable: error.retryable,\n }),\n }\n : {}),\n });\n }\n\n async #refresh(): Promise<VerifiedSnapshot> {\n const startedAt = Date.now();\n const controller = new AbortController();\n let timer: ReturnType<typeof setTimeout> | undefined;\n const deadline = new Promise<never>((_, reject) => {\n timer = setTimeout(() => {\n const error = new SkillDeliveryError(\"TIMEOUT\", true);\n controller.abort(error);\n // Give a canonical client that already received denial headers one\n // event-loop turn to report that denial before the watchdog wins.\n timer = setTimeout(() => reject(error), 0);\n }, this.#config.requestTimeoutMs);\n });\n const replacement = async (): Promise<VerifiedSnapshot> => {\n const response = await this.fetchSnapshot({\n containerId: this.#config.containerId,\n ...(this.#config.revision !== undefined\n ? { revision: this.#config.revision }\n : {}),\n ...(this.#snapshot ? { ifNoneMatch: this.#snapshot.etag } : {}),\n signal: controller.signal,\n });\n controller.signal.throwIfAborted();\n if (!response || typeof response !== \"object\") throw invalidSnapshot();\n if (response.status === \"unchanged\") {\n if (\n !this.#snapshot ||\n response.etag !== this.#snapshot.etag ||\n response.revision !== this.#snapshot.revision\n )\n throw invalidSnapshot();\n return this.#snapshot;\n }\n if (\n this.#config.revision !== undefined &&\n response.revision !== this.#config.revision\n )\n throw invalidSnapshot();\n return validateSnapshot(response, controller.signal);\n };\n try {\n const snapshot = await Promise.race([replacement(), deadline]);\n // An abandoned parse never writes registry state: only the winning\n // complete replacement reaches this assignment.\n this.#snapshot = snapshot;\n this.#lastCheckedAt = Date.now();\n this.#stale = false;\n this.#lastError = undefined;\n this.#blocked = undefined;\n this.#debug(\"refresh-success\", startedAt);\n return snapshot;\n } catch (cause) {\n const error = deliveryError(cause);\n if (!transient(error)) {\n this.#blocked = error;\n this.#stale = false;\n this.#lastError = error;\n this.#debug(\"refresh-denied\", startedAt, error.code);\n throw error;\n }\n // A later unreachable server cannot undo an already confirmed denial.\n if (this.#blocked) {\n this.#lastError = this.#blocked;\n this.#debug(\"refresh-failed\", startedAt, error.code);\n throw this.#blocked;\n }\n this.#lastError = error;\n this.#stale = this.#snapshot !== undefined;\n this.#debug(\"refresh-failed\", startedAt, error.code);\n if (this.#snapshot) return this.#snapshot;\n throw error;\n } finally {\n if (timer !== undefined) clearTimeout(timer);\n }\n }\n\n #debug(\n event: string,\n startedAt: number,\n errorCode?: SkillDeliveryErrorCode,\n ): void {\n if (!this.#config.debug) return;\n console.debug(\"CopilotKit learned skills\", {\n event,\n containerId: this.#config.containerId,\n revision: this.#snapshot?.revision,\n durationMs: Date.now() - startedAt,\n ...(errorCode ? { errorCode } : {}),\n });\n }\n}\n\n/** Coalesce refreshes from this registry into one request in the next microtask. */\nfunction batchLoader(client: CopilotKitIntelligence) {\n let pending: {\n request: GetLearnedSkillsSnapshotRequest;\n resolve: (value: LearnedSkillsSnapshotResult) => void;\n reject: (error: unknown) => void;\n }[] = [];\n return (\n request: GetLearnedSkillsSnapshotRequest,\n ): Promise<LearnedSkillsSnapshotResult> =>\n new Promise((resolve, reject) => {\n pending.push({ request, resolve, reject });\n if (pending.length !== 1) return;\n queueMicrotask(async () => {\n const batch = pending;\n pending = [];\n try {\n const results = await client.getLearnedSkillsSnapshots({\n containers: batch.map(\n ({ request: { signal: _signal, ...source } }) => source,\n ),\n signal: batch[0].request.signal,\n });\n if (\n !Array.isArray(results) ||\n results.length !== batch.length ||\n results.some(\n (result, index) =>\n result?.containerId !== batch[index].request.containerId,\n )\n )\n throw invalidSnapshot();\n for (let index = 0; index < batch.length; index++) {\n const result = results[index];\n if (result.status === \"error\") batch[index].reject(result.error);\n else batch[index].resolve(result);\n }\n } catch (error) {\n for (const item of batch) item.reject(error);\n }\n });\n });\n}\n\n/** Compose independent container caches into one immutable invocation snapshot. */\nexport class SkillRegistry {\n readonly #sources: readonly {\n readonly id: string;\n readonly registry: SingleContainerRegistry;\n }[];\n readonly #multiple: boolean;\n #snapshot?: VerifiedSnapshot;\n #parts?: readonly VerifiedSnapshot[];\n #inFlight?: Promise<VerifiedSnapshot>;\n\n constructor(options: SkillRegistryOptions = {}) {\n const config = resolveRegistryConfig(options);\n this.#multiple = config.containers !== undefined;\n const fetchBatch = batchLoader(config.client);\n this.#sources =\n config.containers !== undefined\n ? config.containers.map(({ id, revision }) => ({\n id,\n registry: new SingleContainerRegistry(\n Object.freeze({\n client: config.client,\n freshnessWindowMs: config.freshnessWindowMs,\n requestTimeoutMs: config.requestTimeoutMs,\n debug: config.debug,\n containerId: id,\n ...(revision !== undefined ? { revision } : {}),\n }),\n fetchBatch,\n ),\n }))\n : [\n {\n id: config.containerId!,\n registry: new SingleContainerRegistry({\n client: config.client,\n containerId: config.containerId!,\n revision: config.revision,\n freshnessWindowMs: config.freshnessWindowMs,\n requestTimeoutMs: config.requestTimeoutMs,\n debug: config.debug,\n }),\n },\n ];\n }\n\n /** Load every configured container before agent initialization completes. */\n async initialize(): Promise<void> {\n await this.acquireSnapshot();\n }\n\n /** Capture every container once; a failed source cannot yield a partial catalog. */\n acquireSnapshot(): Promise<VerifiedSnapshot> {\n if (!this.#multiple) return this.#sources[0].registry.acquireSnapshot();\n if (this.#inFlight) return this.#inFlight;\n this.#inFlight = Promise.all(\n this.#sources.map(({ registry }) => registry.acquireSnapshot()),\n )\n .then(async (parts) => {\n if (\n this.#snapshot &&\n parts.every((part, index) => part === this.#parts?.[index])\n ) {\n return this.#snapshot;\n }\n const identity = await sha256Hex(\n JSON.stringify(\n parts.map((part, index) => [\n this.#sources[index].id,\n part.revision,\n part.etag,\n ]),\n ),\n );\n const skills = Object.freeze(\n parts.flatMap((part, index) =>\n part.skills.map((skill) =>\n Object.freeze({\n ...skill,\n name: `${encodeURIComponent(this.#sources[index].id)}/${skill.name}`,\n }),\n ),\n ),\n );\n this.#parts = parts;\n this.#snapshot = Object.freeze({\n revision: `multi:${identity}`,\n etag: `\"${identity}\"`,\n skills,\n });\n return this.#snapshot;\n })\n .finally(() => {\n this.#inFlight = undefined;\n });\n return this.#inFlight;\n }\n\n /** Report each container's real revision; no aggregate server revision exists. */\n get status(): SkillRegistryStatus {\n if (!this.#multiple) return this.#sources[0].registry.status;\n const containers = Object.freeze(\n this.#sources.map(({ id, registry }) =>\n Object.freeze({ id, ...registry.status }),\n ),\n );\n const error =\n containers.find(\n (source) => source.lastError && !source.lastError.retryable,\n )?.lastError ?? containers.find((source) => source.lastError)?.lastError;\n const timestamps = containers.map((source) => source.lastCheckedAt);\n return Object.freeze({\n initialized: this.#snapshot !== undefined,\n mode: containers.every((source) => source.mode === \"pinned\")\n ? \"pinned\"\n : \"latest\",\n stale: containers.some((source) => source.stale),\n ...(timestamps.every((timestamp) => timestamp !== undefined)\n ? { lastCheckedAt: [...timestamps].sort()[0] }\n : {}),\n ...(error ? { lastError: error } : {}),\n containers,\n });\n }\n}\n"],"mappings":";;;;;;;AA+BA,SAAS,UAAU,OAAoC;AACrD,QAAO;EACL;EACA;EACA;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,EAAE,WAAW,OAAO,GAAG,EAAE;GACrC;GACD,CAAC"}
|
|
1
|
+
{"version":3,"file":"registry.mjs","names":["SkillDeliveryError","#config","#inFlight","#snapshot","#blocked","#lastCheckedAt","#refresh","#lastError","#stale","#debug","#sources","#multiple","#parts"],"sources":["../../../../src/runtime/intelligence-platform/skill-registry/registry.ts"],"sourcesContent":["import type { CopilotKitIntelligence } from \"../client\";\nimport type {\n GetLearnedSkillsSnapshotRequest,\n LearnedSkillsSnapshotResult,\n} from \"../learned-skills\";\nimport { resolveRegistryConfig } from \"./config\";\nimport type { SingleContainerConfig, SkillRegistryOptions } from \"./config\";\nimport { SkillDeliveryError, invalidSnapshot } from \"./errors\";\nimport type { SkillDeliveryErrorCode } from \"./errors\";\nimport { sha256Hex } from \"../../core/web-crypto\";\nimport { validateSnapshot } from \"./snapshot\";\nimport type { VerifiedSnapshot } from \"./snapshot\";\n\nexport interface SkillRegistryStatus {\n /** Present only for the explicit containers interface. */\n readonly containers?: readonly (SkillRegistryStatus & {\n readonly id: string;\n })[];\n readonly initialized: boolean;\n readonly revision?: string;\n readonly mode: \"latest\" | \"pinned\";\n /** ISO 8601 timestamp of the last successful 200 or matching 304 check. */\n readonly lastCheckedAt?: string;\n readonly stale: boolean;\n readonly lastError?: Readonly<{\n code: SkillDeliveryErrorCode;\n message: string;\n retryable: boolean;\n }>;\n}\n\nfunction transient(error: SkillDeliveryError): boolean {\n return [\n \"NETWORK_ERROR\",\n \"TIMEOUT\",\n \"INVALID_SNAPSHOT\",\n \"UNSUPPORTED_SERVER\",\n ].includes(error.code);\n}\nfunction deliveryError(error: unknown): SkillDeliveryError {\n if (error instanceof SkillDeliveryError) return error;\n return new SkillDeliveryError(\n error instanceof Error && error.name === \"TimeoutError\"\n ? \"TIMEOUT\"\n : \"NETWORK_ERROR\",\n true,\n error,\n );\n}\n\n/** Internal registry shared by framework adapters; public API is framework-native. */\nclass SingleContainerRegistry {\n readonly #config: SingleContainerConfig;\n #snapshot?: VerifiedSnapshot;\n #inFlight?: Promise<VerifiedSnapshot>;\n #lastCheckedAt?: number;\n #stale = false;\n #lastError?: SkillDeliveryError;\n #blocked?: SkillDeliveryError;\n\n constructor(\n config: SingleContainerConfig,\n private readonly fetchSnapshot = (\n request: GetLearnedSkillsSnapshotRequest,\n ) => config.client.getLearnedSkillsSnapshot(request),\n ) {\n this.#config = config;\n }\n\n async initialize(): Promise<void> {\n await this.acquireSnapshot();\n }\n\n /** Capture exactly one immutable snapshot before model work begins. */\n acquireSnapshot(): Promise<VerifiedSnapshot> {\n if (this.#inFlight !== undefined) return this.#inFlight;\n if (\n this.#snapshot &&\n !this.#blocked &&\n this.#lastCheckedAt !== undefined &&\n Date.now() - this.#lastCheckedAt < this.#config.freshnessWindowMs\n ) {\n return Promise.resolve(this.#snapshot);\n }\n // Defer work one microtask so reentrant and concurrent callers observe the\n // same promise before an injected client can start its request.\n this.#inFlight = Promise.resolve()\n .then(() => this.#refresh())\n .finally(() => {\n this.#inFlight = undefined;\n });\n return this.#inFlight;\n }\n\n get status(): SkillRegistryStatus {\n const error = this.#lastError;\n return Object.freeze({\n initialized: this.#snapshot !== undefined,\n ...(this.#snapshot ? { revision: this.#snapshot.revision } : {}),\n mode: this.#config.revision === undefined ? \"latest\" : \"pinned\",\n ...(this.#lastCheckedAt !== undefined\n ? { lastCheckedAt: new Date(this.#lastCheckedAt).toISOString() }\n : {}),\n stale: this.#stale,\n ...(error\n ? {\n lastError: Object.freeze({\n code: error.code,\n message: error.message,\n retryable: error.retryable,\n }),\n }\n : {}),\n });\n }\n\n async #refresh(): Promise<VerifiedSnapshot> {\n const startedAt = Date.now();\n const controller = new AbortController();\n let timer: ReturnType<typeof setTimeout> | undefined;\n const deadline = new Promise<never>((_, reject) => {\n timer = setTimeout(() => {\n const error = new SkillDeliveryError(\"TIMEOUT\", true);\n controller.abort(error);\n // Give a canonical client that already received denial headers one\n // event-loop turn to report that denial before the watchdog wins.\n timer = setTimeout(() => reject(error), 0);\n }, this.#config.requestTimeoutMs);\n });\n const replacement = async (): Promise<VerifiedSnapshot> => {\n const response = await this.fetchSnapshot({\n containerId: this.#config.containerId,\n ...(this.#config.revision !== undefined\n ? { revision: this.#config.revision }\n : {}),\n ...(this.#snapshot ? { ifNoneMatch: this.#snapshot.etag } : {}),\n signal: controller.signal,\n });\n controller.signal.throwIfAborted();\n if (!response || typeof response !== \"object\") throw invalidSnapshot();\n if (response.status === \"unchanged\") {\n if (\n !this.#snapshot ||\n response.etag !== this.#snapshot.etag ||\n response.revision !== this.#snapshot.revision\n )\n throw invalidSnapshot();\n return this.#snapshot;\n }\n if (\n this.#config.revision !== undefined &&\n response.revision !== this.#config.revision\n )\n throw invalidSnapshot();\n return validateSnapshot(response, controller.signal);\n };\n try {\n const snapshot = await Promise.race([replacement(), deadline]);\n // An abandoned parse never writes registry state: only the winning\n // complete replacement reaches this assignment.\n this.#snapshot = snapshot;\n this.#lastCheckedAt = Date.now();\n this.#stale = false;\n this.#lastError = undefined;\n this.#blocked = undefined;\n this.#debug(\"refresh-success\", startedAt);\n return snapshot;\n } catch (cause) {\n const error = deliveryError(cause);\n if (!transient(error)) {\n this.#blocked = error;\n this.#stale = false;\n this.#lastError = error;\n this.#debug(\"refresh-denied\", startedAt, error.code);\n throw error;\n }\n // A later unreachable server cannot undo an already confirmed denial.\n if (this.#blocked) {\n this.#lastError = this.#blocked;\n this.#debug(\"refresh-failed\", startedAt, error.code);\n throw this.#blocked;\n }\n this.#lastError = error;\n this.#stale = this.#snapshot !== undefined;\n this.#debug(\"refresh-failed\", startedAt, error.code);\n if (this.#snapshot) return this.#snapshot;\n throw error;\n } finally {\n if (timer !== undefined) clearTimeout(timer);\n }\n }\n\n #debug(\n event: string,\n startedAt: number,\n errorCode?: SkillDeliveryErrorCode,\n ): void {\n if (!this.#config.debug) return;\n console.debug(\"CopilotKit learned skills\", {\n event,\n containerId: this.#config.containerId,\n revision: this.#snapshot?.revision,\n durationMs: Date.now() - startedAt,\n ...(errorCode ? { errorCode } : {}),\n });\n }\n}\n\n/** Coalesce refreshes from this registry into one request in the next microtask. */\nfunction batchLoader(client: CopilotKitIntelligence) {\n let pending: {\n request: GetLearnedSkillsSnapshotRequest;\n resolve: (value: LearnedSkillsSnapshotResult) => void;\n reject: (error: unknown) => void;\n }[] = [];\n // Rejects each pending request itself, so it never rejects.\n const flush = async () => {\n const batch = pending;\n pending = [];\n try {\n const results = await client.getLearnedSkillsSnapshots({\n containers: batch.map(\n ({ request: { signal: _signal, ...source } }) => source,\n ),\n signal: batch[0].request.signal,\n });\n if (\n !Array.isArray(results) ||\n results.length !== batch.length ||\n results.some(\n (result, index) =>\n result?.containerId !== batch[index].request.containerId,\n )\n )\n throw invalidSnapshot();\n for (let index = 0; index < batch.length; index++) {\n const result = results[index];\n if (result.status === \"error\") batch[index].reject(result.error);\n else batch[index].resolve(result);\n }\n } catch (error) {\n for (const item of batch) item.reject(error);\n }\n };\n return (\n request: GetLearnedSkillsSnapshotRequest,\n ): Promise<LearnedSkillsSnapshotResult> =>\n new Promise((resolve, reject) => {\n pending.push({ request, resolve, reject });\n if (pending.length !== 1) return;\n queueMicrotask(() => {\n void flush();\n });\n });\n}\n\n/** Compose independent container caches into one immutable invocation snapshot. */\nexport class SkillRegistry {\n readonly #sources: readonly {\n readonly id: string;\n readonly registry: SingleContainerRegistry;\n }[];\n readonly #multiple: boolean;\n #snapshot?: VerifiedSnapshot;\n #parts?: readonly VerifiedSnapshot[];\n #inFlight?: Promise<VerifiedSnapshot>;\n\n constructor(options: SkillRegistryOptions = {}) {\n const config = resolveRegistryConfig(options);\n this.#multiple = config.containers !== undefined;\n const fetchBatch = batchLoader(config.client);\n this.#sources =\n config.containers !== undefined\n ? config.containers.map(({ id, revision }) => ({\n id,\n registry: new SingleContainerRegistry(\n Object.freeze({\n client: config.client,\n freshnessWindowMs: config.freshnessWindowMs,\n requestTimeoutMs: config.requestTimeoutMs,\n debug: config.debug,\n containerId: id,\n ...(revision !== undefined ? { revision } : {}),\n }),\n fetchBatch,\n ),\n }))\n : [\n {\n id: config.containerId!,\n registry: new SingleContainerRegistry({\n client: config.client,\n containerId: config.containerId!,\n revision: config.revision,\n freshnessWindowMs: config.freshnessWindowMs,\n requestTimeoutMs: config.requestTimeoutMs,\n debug: config.debug,\n }),\n },\n ];\n }\n\n /** Load every configured container before agent initialization completes. */\n async initialize(): Promise<void> {\n await this.acquireSnapshot();\n }\n\n /** Capture every container once; a failed source cannot yield a partial catalog. */\n acquireSnapshot(): Promise<VerifiedSnapshot> {\n if (!this.#multiple) return this.#sources[0].registry.acquireSnapshot();\n if (this.#inFlight !== undefined) return this.#inFlight;\n this.#inFlight = Promise.all(\n this.#sources.map(({ registry }) => registry.acquireSnapshot()),\n )\n .then(async (parts) => {\n if (\n this.#snapshot &&\n parts.every((part, index) => part === this.#parts?.[index])\n ) {\n return this.#snapshot;\n }\n const identity = await sha256Hex(\n JSON.stringify(\n parts.map((part, index) => [\n this.#sources[index].id,\n part.revision,\n part.etag,\n ]),\n ),\n );\n const skills = Object.freeze(\n parts.flatMap((part, index) =>\n part.skills.map((skill) =>\n Object.freeze({\n ...skill,\n name: `${encodeURIComponent(this.#sources[index].id)}/${skill.name}`,\n }),\n ),\n ),\n );\n this.#parts = parts;\n this.#snapshot = Object.freeze({\n revision: `multi:${identity}`,\n etag: `\"${identity}\"`,\n skills,\n });\n return this.#snapshot;\n })\n .finally(() => {\n this.#inFlight = undefined;\n });\n return this.#inFlight;\n }\n\n /** Report each container's real revision; no aggregate server revision exists. */\n get status(): SkillRegistryStatus {\n if (!this.#multiple) return this.#sources[0].registry.status;\n const containers = Object.freeze(\n this.#sources.map(({ id, registry }) =>\n Object.freeze({ id, ...registry.status }),\n ),\n );\n const error =\n containers.find(\n (source) => source.lastError && !source.lastError.retryable,\n )?.lastError ?? containers.find((source) => source.lastError)?.lastError;\n const timestamps = containers.map((source) => source.lastCheckedAt);\n return Object.freeze({\n initialized: this.#snapshot !== undefined,\n mode: containers.every((source) => source.mode === \"pinned\")\n ? \"pinned\"\n : \"latest\",\n stale: containers.some((source) => source.stale),\n ...(timestamps.every((timestamp) => timestamp !== undefined)\n ? { lastCheckedAt: [...timestamps].sort()[0] }\n : {}),\n ...(error ? { lastError: error } : {}),\n containers,\n });\n }\n}\n"],"mappings":";;;;;;;AA+BA,SAAS,UAAU,OAAoC;AACrD,QAAO;EACL;EACA;EACA;EACA;EACD,CAAC,SAAS,MAAM,KAAK;;AAExB,SAAS,cAAc,OAAoC;AACzD,KAAI,iBAAiBA,mBAAoB,QAAO;AAChD,QAAO,IAAIA,mBACT,iBAAiB,SAAS,MAAM,SAAS,iBACrC,YACA,iBACJ,MACA,MACD;;;AAIH,IAAM,0BAAN,MAA8B;CAC5B,CAASC;CACT;CACA;CACA;CACA,SAAS;CACT;CACA;CAEA,YACE,QACA,AAAiB,iBACf,YACG,OAAO,OAAO,yBAAyB,QAAQ,EACpD;EAHiB;AAIjB,QAAKA,SAAU;;CAGjB,MAAM,aAA4B;AAChC,QAAM,KAAK,iBAAiB;;;CAI9B,kBAA6C;AAC3C,MAAI,MAAKC,aAAc,OAAW,QAAO,MAAKA;AAC9C,MACE,MAAKC,YACL,CAAC,MAAKC,WACN,MAAKC,kBAAmB,UACxB,KAAK,KAAK,GAAG,MAAKA,gBAAiB,MAAKJ,OAAQ,kBAEhD,QAAO,QAAQ,QAAQ,MAAKE,SAAU;AAIxC,QAAKD,WAAY,QAAQ,SAAS,CAC/B,WAAW,MAAKI,SAAU,CAAC,CAC3B,cAAc;AACb,SAAKJ,WAAY;IACjB;AACJ,SAAO,MAAKA;;CAGd,IAAI,SAA8B;EAChC,MAAM,QAAQ,MAAKK;AACnB,SAAO,OAAO,OAAO;GACnB,aAAa,MAAKJ,aAAc;GAChC,GAAI,MAAKA,WAAY,EAAE,UAAU,MAAKA,SAAU,UAAU,GAAG,EAAE;GAC/D,MAAM,MAAKF,OAAQ,aAAa,SAAY,WAAW;GACvD,GAAI,MAAKI,kBAAmB,SACxB,EAAE,eAAe,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,cAAc;AACnE,SAAO,OAAO,OAAO;GACnB,aAAa,MAAKP,aAAc;GAChC,MAAM,WAAW,OAAO,WAAW,OAAO,SAAS,SAAS,GACxD,WACA;GACJ,OAAO,WAAW,MAAM,WAAW,OAAO,MAAM;GAChD,GAAI,WAAW,OAAO,cAAc,cAAc,OAAU,GACxD,EAAE,eAAe,CAAC,GAAG,WAAW,CAAC,MAAM,CAAC,IAAI,GAC5C,EAAE;GACN,GAAI,QAAQ,EAAE,WAAW,OAAO,GAAG,EAAE;GACrC;GACD,CAAC"}
|
|
@@ -18,15 +18,13 @@ const require_telemetry_client = require('./telemetry-client.cjs');
|
|
|
18
18
|
function fireInstanceCreatedTelemetry({ runtime }) {
|
|
19
19
|
const agentsPromise = typeof runtime.agents === "function" ? Promise.resolve(null) : Promise.resolve(runtime.agents);
|
|
20
20
|
const runtimeTelemetry = runtime.telemetry ?? require_telemetry_client.default;
|
|
21
|
-
agentsPromise.then((agents) => {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
});
|
|
29
|
-
}).catch(() => {});
|
|
21
|
+
agentsPromise.then((agents) => runtimeTelemetry.capture("oss.runtime.instance_created", {
|
|
22
|
+
actionsAmount: 0,
|
|
23
|
+
endpointTypes: [],
|
|
24
|
+
endpointsAmount: 0,
|
|
25
|
+
agentsAmount: agents ? Object.keys(agents).length : null,
|
|
26
|
+
"cloud.api_key_provided": false
|
|
27
|
+
})).catch(() => {});
|
|
30
28
|
}
|
|
31
29
|
|
|
32
30
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instance-created.cjs","names":["telemetry"],"sources":["../../../src/runtime/telemetry/instance-created.ts"],"sourcesContent":["import { telemetry } from \".\";\nimport type { CopilotRuntimeLike } from \"../core/runtime\";\n\n/**\n * Fire the `oss.runtime.instance_created` telemetry event for a v2 runtime\n * handler. Called once per handler factory invocation (not per request).\n *\n * v2 does not have a concept of remote endpoints or standalone actions, so\n * those counts are 0 / []. `cloud.api_key_provided` is false at this level\n * because in v2 the cloud public key arrives per-request via the\n * `x-copilotcloud-public-api-key` header — not at handler creation time.\n * See `handlers/handle-run.ts` for the per-request event that DOES carry\n * the key when present.\n *\n * Errors resolving agents are swallowed — telemetry must never break\n * runtime setup.\n */\nexport function fireInstanceCreatedTelemetry({\n runtime,\n}: {\n runtime: CopilotRuntimeLike;\n}): void {\n // agents can be a static Record, a Promise, or a per-request factory.\n // Factory configs cannot be resolved at handler-creation time (no Request\n // context), so report agentsAmount as null in that case.\n const agentsPromise =\n typeof runtime.agents === \"function\"\n ? Promise.resolve<Record<string, unknown> | null>(null)\n : Promise.resolve(runtime.agents);\n const runtimeTelemetry = runtime.telemetry ?? telemetry;\n\n agentsPromise\n .then((agents)
|
|
1
|
+
{"version":3,"file":"instance-created.cjs","names":["telemetry"],"sources":["../../../src/runtime/telemetry/instance-created.ts"],"sourcesContent":["import { telemetry } from \".\";\nimport type { CopilotRuntimeLike } from \"../core/runtime\";\n\n/**\n * Fire the `oss.runtime.instance_created` telemetry event for a v2 runtime\n * handler. Called once per handler factory invocation (not per request).\n *\n * v2 does not have a concept of remote endpoints or standalone actions, so\n * those counts are 0 / []. `cloud.api_key_provided` is false at this level\n * because in v2 the cloud public key arrives per-request via the\n * `x-copilotcloud-public-api-key` header — not at handler creation time.\n * See `handlers/handle-run.ts` for the per-request event that DOES carry\n * the key when present.\n *\n * Errors resolving agents are swallowed — telemetry must never break\n * runtime setup.\n */\nexport function fireInstanceCreatedTelemetry({\n runtime,\n}: {\n runtime: CopilotRuntimeLike;\n}): void {\n // agents can be a static Record, a Promise, or a per-request factory.\n // Factory configs cannot be resolved at handler-creation time (no Request\n // context), so report agentsAmount as null in that case.\n const agentsPromise =\n typeof runtime.agents === \"function\"\n ? Promise.resolve<Record<string, unknown> | null>(null)\n : Promise.resolve(runtime.agents);\n const runtimeTelemetry = runtime.telemetry ?? telemetry;\n\n agentsPromise\n .then((agents) =>\n runtimeTelemetry.capture(\"oss.runtime.instance_created\", {\n actionsAmount: 0,\n endpointTypes: [],\n endpointsAmount: 0,\n agentsAmount: agents ? Object.keys(agents).length : null,\n \"cloud.api_key_provided\": false,\n }),\n )\n .catch(() => {\n // Swallow — telemetry must not break runtime creation.\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAiBA,SAAgB,6BAA6B,EAC3C,WAGO;CAIP,MAAM,gBACJ,OAAO,QAAQ,WAAW,aACtB,QAAQ,QAAwC,KAAK,GACrD,QAAQ,QAAQ,QAAQ,OAAO;CACrC,MAAM,mBAAmB,QAAQ,aAAaA;AAE9C,eACG,MAAM,WACL,iBAAiB,QAAQ,gCAAgC;EACvD,eAAe;EACf,eAAe,EAAE;EACjB,iBAAiB;EACjB,cAAc,SAAS,OAAO,KAAK,OAAO,CAAC,SAAS;EACpD,0BAA0B;EAC3B,CAAC,CACH,CACA,YAAY,GAEX"}
|
|
@@ -18,15 +18,13 @@ import telemetry from "./telemetry-client.mjs";
|
|
|
18
18
|
function fireInstanceCreatedTelemetry({ runtime }) {
|
|
19
19
|
const agentsPromise = typeof runtime.agents === "function" ? Promise.resolve(null) : Promise.resolve(runtime.agents);
|
|
20
20
|
const runtimeTelemetry = runtime.telemetry ?? telemetry;
|
|
21
|
-
agentsPromise.then((agents) => {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
});
|
|
29
|
-
}).catch(() => {});
|
|
21
|
+
agentsPromise.then((agents) => runtimeTelemetry.capture("oss.runtime.instance_created", {
|
|
22
|
+
actionsAmount: 0,
|
|
23
|
+
endpointTypes: [],
|
|
24
|
+
endpointsAmount: 0,
|
|
25
|
+
agentsAmount: agents ? Object.keys(agents).length : null,
|
|
26
|
+
"cloud.api_key_provided": false
|
|
27
|
+
})).catch(() => {});
|
|
30
28
|
}
|
|
31
29
|
|
|
32
30
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instance-created.mjs","names":[],"sources":["../../../src/runtime/telemetry/instance-created.ts"],"sourcesContent":["import { telemetry } from \".\";\nimport type { CopilotRuntimeLike } from \"../core/runtime\";\n\n/**\n * Fire the `oss.runtime.instance_created` telemetry event for a v2 runtime\n * handler. Called once per handler factory invocation (not per request).\n *\n * v2 does not have a concept of remote endpoints or standalone actions, so\n * those counts are 0 / []. `cloud.api_key_provided` is false at this level\n * because in v2 the cloud public key arrives per-request via the\n * `x-copilotcloud-public-api-key` header — not at handler creation time.\n * See `handlers/handle-run.ts` for the per-request event that DOES carry\n * the key when present.\n *\n * Errors resolving agents are swallowed — telemetry must never break\n * runtime setup.\n */\nexport function fireInstanceCreatedTelemetry({\n runtime,\n}: {\n runtime: CopilotRuntimeLike;\n}): void {\n // agents can be a static Record, a Promise, or a per-request factory.\n // Factory configs cannot be resolved at handler-creation time (no Request\n // context), so report agentsAmount as null in that case.\n const agentsPromise =\n typeof runtime.agents === \"function\"\n ? Promise.resolve<Record<string, unknown> | null>(null)\n : Promise.resolve(runtime.agents);\n const runtimeTelemetry = runtime.telemetry ?? telemetry;\n\n agentsPromise\n .then((agents)
|
|
1
|
+
{"version":3,"file":"instance-created.mjs","names":[],"sources":["../../../src/runtime/telemetry/instance-created.ts"],"sourcesContent":["import { telemetry } from \".\";\nimport type { CopilotRuntimeLike } from \"../core/runtime\";\n\n/**\n * Fire the `oss.runtime.instance_created` telemetry event for a v2 runtime\n * handler. Called once per handler factory invocation (not per request).\n *\n * v2 does not have a concept of remote endpoints or standalone actions, so\n * those counts are 0 / []. `cloud.api_key_provided` is false at this level\n * because in v2 the cloud public key arrives per-request via the\n * `x-copilotcloud-public-api-key` header — not at handler creation time.\n * See `handlers/handle-run.ts` for the per-request event that DOES carry\n * the key when present.\n *\n * Errors resolving agents are swallowed — telemetry must never break\n * runtime setup.\n */\nexport function fireInstanceCreatedTelemetry({\n runtime,\n}: {\n runtime: CopilotRuntimeLike;\n}): void {\n // agents can be a static Record, a Promise, or a per-request factory.\n // Factory configs cannot be resolved at handler-creation time (no Request\n // context), so report agentsAmount as null in that case.\n const agentsPromise =\n typeof runtime.agents === \"function\"\n ? Promise.resolve<Record<string, unknown> | null>(null)\n : Promise.resolve(runtime.agents);\n const runtimeTelemetry = runtime.telemetry ?? telemetry;\n\n agentsPromise\n .then((agents) =>\n runtimeTelemetry.capture(\"oss.runtime.instance_created\", {\n actionsAmount: 0,\n endpointTypes: [],\n endpointsAmount: 0,\n agentsAmount: agents ? Object.keys(agents).length : null,\n \"cloud.api_key_provided\": false,\n }),\n )\n .catch(() => {\n // Swallow — telemetry must not break runtime creation.\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAiBA,SAAgB,6BAA6B,EAC3C,WAGO;CAIP,MAAM,gBACJ,OAAO,QAAQ,WAAW,aACtB,QAAQ,QAAwC,KAAK,GACrD,QAAQ,QAAQ,QAAQ,OAAO;CACrC,MAAM,mBAAmB,QAAQ,aAAa;AAE9C,eACG,MAAM,WACL,iBAAiB,QAAQ,gCAAgC;EACvD,eAAe;EACf,eAAe,EAAE;EACjB,iBAAiB;EACjB,cAAc,SAAS,OAAO,KAAK,OAAO,CAAC,SAAS;EACpD,0BAA0B;EAC3B,CAAC,CACH,CACA,YAAY,GAEX"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@copilotkit/runtime",
|
|
3
|
-
"version": "2.0.0-rc.
|
|
3
|
+
"version": "2.0.0-rc.19",
|
|
4
4
|
"private": false,
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"@ai-sdk/openai": "^3.0.36",
|
|
66
66
|
"@cfworker/json-schema": "^4.1.1",
|
|
67
67
|
"@copilotkit/license-verifier": "~0.5.0",
|
|
68
|
-
"@copilotkit/shared": "2.0.0-rc.
|
|
68
|
+
"@copilotkit/shared": "2.0.0-rc.19",
|
|
69
69
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
70
70
|
"@remix-run/node-fetch-server": "^0.13.0",
|
|
71
71
|
"ai": "^6.0.104",
|
|
@@ -73,8 +73,8 @@
|
|
|
73
73
|
"phoenix": "^1.8.4",
|
|
74
74
|
"rxjs": "7.8.1",
|
|
75
75
|
"zod": "^4.2.0",
|
|
76
|
-
"@copilotkit/channels-
|
|
77
|
-
"@copilotkit/channels-
|
|
76
|
+
"@copilotkit/channels-intelligence": "^0.12.0",
|
|
77
|
+
"@copilotkit/channels-core": "^0.12.0"
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
80
|
"@copilotkit/aimock": "latest",
|