@copilotkit/runtime 1.64.2-canary.rc-1 → 1.64.2
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/package.cjs +1 -1
- package/dist/runtime/package.mjs +1 -1
- package/dist/v2/runtime/core/channel-activation-config.cjs +5 -2
- package/dist/v2/runtime/core/channel-activation-config.cjs.map +1 -1
- package/dist/v2/runtime/core/channel-activation-config.d.cts +13 -0
- package/dist/v2/runtime/core/channel-activation-config.d.cts.map +1 -1
- package/dist/v2/runtime/core/channel-activation-config.d.mts +13 -0
- package/dist/v2/runtime/core/channel-activation-config.d.mts.map +1 -1
- package/dist/v2/runtime/core/channel-activation-config.mjs +5 -2
- package/dist/v2/runtime/core/channel-activation-config.mjs.map +1 -1
- package/dist/v2/runtime/core/channel-manager.cjs +257 -20
- package/dist/v2/runtime/core/channel-manager.cjs.map +1 -1
- package/dist/v2/runtime/core/channel-manager.d.cts +9 -5
- package/dist/v2/runtime/core/channel-manager.d.cts.map +1 -1
- package/dist/v2/runtime/core/channel-manager.d.mts +9 -5
- package/dist/v2/runtime/core/channel-manager.d.mts.map +1 -1
- package/dist/v2/runtime/core/channel-manager.mjs +257 -20
- package/dist/v2/runtime/core/channel-manager.mjs.map +1 -1
- package/dist/v2/runtime/core/fetch-handler.cjs +4 -0
- package/dist/v2/runtime/core/fetch-handler.cjs.map +1 -1
- package/dist/v2/runtime/core/fetch-handler.d.cts +5 -0
- package/dist/v2/runtime/core/fetch-handler.d.cts.map +1 -1
- package/dist/v2/runtime/core/fetch-handler.d.mts +5 -0
- package/dist/v2/runtime/core/fetch-handler.d.mts.map +1 -1
- package/dist/v2/runtime/core/fetch-handler.mjs +4 -0
- package/dist/v2/runtime/core/fetch-handler.mjs.map +1 -1
- package/dist/v2/runtime/endpoints/auto-start-channels.cjs +47 -0
- package/dist/v2/runtime/endpoints/auto-start-channels.cjs.map +1 -0
- package/dist/v2/runtime/endpoints/auto-start-channels.mjs +46 -0
- package/dist/v2/runtime/endpoints/auto-start-channels.mjs.map +1 -0
- package/dist/v2/runtime/endpoints/express.cjs +2 -0
- package/dist/v2/runtime/endpoints/express.cjs.map +1 -1
- package/dist/v2/runtime/endpoints/express.d.cts +9 -8
- package/dist/v2/runtime/endpoints/express.d.cts.map +1 -1
- package/dist/v2/runtime/endpoints/express.d.mts +9 -8
- package/dist/v2/runtime/endpoints/express.d.mts.map +1 -1
- package/dist/v2/runtime/endpoints/express.mjs +2 -0
- package/dist/v2/runtime/endpoints/express.mjs.map +1 -1
- package/dist/v2/runtime/endpoints/hono.cjs.map +1 -1
- package/dist/v2/runtime/endpoints/hono.d.cts +14 -5
- package/dist/v2/runtime/endpoints/hono.d.cts.map +1 -1
- package/dist/v2/runtime/endpoints/hono.d.mts +14 -5
- package/dist/v2/runtime/endpoints/hono.d.mts.map +1 -1
- package/dist/v2/runtime/endpoints/hono.mjs.map +1 -1
- package/dist/v2/runtime/endpoints/node.cjs +2 -0
- package/dist/v2/runtime/endpoints/node.cjs.map +1 -1
- package/dist/v2/runtime/endpoints/node.d.cts +23 -13
- package/dist/v2/runtime/endpoints/node.d.cts.map +1 -1
- package/dist/v2/runtime/endpoints/node.d.mts +23 -13
- package/dist/v2/runtime/endpoints/node.d.mts.map +1 -1
- package/dist/v2/runtime/endpoints/node.mjs +2 -0
- package/dist/v2/runtime/endpoints/node.mjs.map +1 -1
- package/dist/v2/runtime/intelligence-platform/client.cjs +33 -2
- package/dist/v2/runtime/intelligence-platform/client.cjs.map +1 -1
- package/dist/v2/runtime/intelligence-platform/client.d.cts +14 -3
- package/dist/v2/runtime/intelligence-platform/client.d.cts.map +1 -1
- package/dist/v2/runtime/intelligence-platform/client.d.mts +14 -3
- package/dist/v2/runtime/intelligence-platform/client.d.mts.map +1 -1
- package/dist/v2/runtime/intelligence-platform/client.mjs +33 -2
- package/dist/v2/runtime/intelligence-platform/client.mjs.map +1 -1
- package/dist/v2/runtime/runner/agent-runner.cjs.map +1 -1
- package/dist/v2/runtime/runner/agent-runner.d.cts +4 -0
- package/dist/v2/runtime/runner/agent-runner.d.cts.map +1 -1
- package/dist/v2/runtime/runner/agent-runner.d.mts +4 -0
- package/dist/v2/runtime/runner/agent-runner.d.mts.map +1 -1
- package/dist/v2/runtime/runner/agent-runner.mjs.map +1 -1
- package/dist/v2/runtime/runner/in-memory.cjs +3 -5
- package/dist/v2/runtime/runner/in-memory.cjs.map +1 -1
- package/dist/v2/runtime/runner/in-memory.d.cts.map +1 -1
- package/dist/v2/runtime/runner/in-memory.d.mts.map +1 -1
- package/dist/v2/runtime/runner/in-memory.mjs +3 -5
- package/dist/v2/runtime/runner/in-memory.mjs.map +1 -1
- package/dist/v2/runtime/runner/intelligence.cjs +38 -31
- package/dist/v2/runtime/runner/intelligence.cjs.map +1 -1
- package/dist/v2/runtime/runner/intelligence.d.cts.map +1 -1
- package/dist/v2/runtime/runner/intelligence.d.mts.map +1 -1
- package/dist/v2/runtime/runner/intelligence.mjs +38 -31
- package/dist/v2/runtime/runner/intelligence.mjs.map +1 -1
- package/package.json +5 -5
package/dist/package.cjs
CHANGED
|
@@ -5,7 +5,7 @@ const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
|
5
5
|
var require_package = /* @__PURE__ */ require_runtime.__commonJSMin(((exports, module) => {
|
|
6
6
|
module.exports = {
|
|
7
7
|
"name": "@copilotkit/runtime",
|
|
8
|
-
"version": "1.64.2
|
|
8
|
+
"version": "1.64.2",
|
|
9
9
|
"private": false,
|
|
10
10
|
"keywords": [
|
|
11
11
|
"ai",
|
package/dist/runtime/package.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import { __commonJSMin } from "../_virtual/_rolldown/runtime.mjs";
|
|
|
5
5
|
var require_package = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
6
6
|
module.exports = {
|
|
7
7
|
"name": "@copilotkit/runtime",
|
|
8
|
-
"version": "1.64.2
|
|
8
|
+
"version": "1.64.2",
|
|
9
9
|
"private": false,
|
|
10
10
|
"keywords": [
|
|
11
11
|
"ai",
|
|
@@ -41,7 +41,8 @@ function parseProjectIdFromApiKey(apiKey) {
|
|
|
41
41
|
* @param args.intelligence - The Intelligence runtime client to pull the
|
|
42
42
|
* runner websocket URL and auth token from.
|
|
43
43
|
* @param args.channel - The Channel being activated. Must have a `name`; its
|
|
44
|
-
* per-Channel `provider` selects the managed adapter declared to the gateway
|
|
44
|
+
* per-Channel `provider` selects the managed adapter declared to the gateway,
|
|
45
|
+
* and `showToolStatus` optionally overrides managed tool-call visibility.
|
|
45
46
|
* @param args.runtimeInstanceId - Identifier for the activating runtime
|
|
46
47
|
* instance, passed through unchanged.
|
|
47
48
|
* @returns The resolved {@link ChannelActivationConfig}.
|
|
@@ -71,7 +72,7 @@ function deriveChannelActivationConfig(args) {
|
|
|
71
72
|
const { intelligence, channel, runtimeInstanceId } = args;
|
|
72
73
|
if (!channel.name) throw new ChannelConfigError("Channel is missing a `name` — pass createChannel({ name }) to activate it.");
|
|
73
74
|
const channelName = channel.name;
|
|
74
|
-
const wsUrl = intelligence.ɵ
|
|
75
|
+
const wsUrl = intelligence.ɵgetChannelsWsUrl();
|
|
75
76
|
const apiUrl = intelligence.ɵgetApiUrl();
|
|
76
77
|
const apiKey = intelligence.ɵgetRunnerAuthToken();
|
|
77
78
|
const projectId = parseProjectIdFromApiKey(apiKey);
|
|
@@ -83,6 +84,8 @@ function deriveChannelActivationConfig(args) {
|
|
|
83
84
|
projectId,
|
|
84
85
|
channelName,
|
|
85
86
|
adapter: trimmedProvider ? trimmedProvider : "slack",
|
|
87
|
+
...channel.showToolStatus !== void 0 ? { showToolStatus: channel.showToolStatus } : {},
|
|
88
|
+
...channel.replyContinuation !== void 0 ? { replyContinuation: channel.replyContinuation } : {},
|
|
86
89
|
runtimeInstanceId
|
|
87
90
|
};
|
|
88
91
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"channel-activation-config.cjs","names":[],"sources":["../../../../src/v2/runtime/core/channel-activation-config.ts"],"sourcesContent":["import type { CopilotKitIntelligence } from \"../intelligence-platform\";\n// Type-only: @copilotkit/channels is pure-ESM, so a value import would break this\n// package's CJS output (see `runtime.ts` for the same constraint).\nimport type { Channel } from \"@copilotkit/channels\";\n\n/**\n * Error thrown when a Channel activation config cannot be derived — either the\n * Intelligence API key does not carry a project id in the expected\n * `cpk-{projectId}_...` format, or the {@link Channel} is missing a `name`.\n */\nexport class ChannelConfigError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"ChannelConfigError\";\n }\n}\n\n/**\n * Resolved configuration needed to activate a single Channel against a\n * running Intelligence runtime instance.\n */\nexport interface ChannelActivationConfig {\n /** Intelligence runner websocket URL the Channel connects to. */\n wsUrl: string;\n /** Intelligence API key used to authenticate the runner connection. */\n apiKey: string;\n /** Intelligence app-api HTTP base URL (`intelligence.ɵgetApiUrl()`), forwarded\n * to the transport so the managed realtime path enables file/history parity\n * (those are HTTP-only). Without it, Channels started by the normal runtime\n * handler run with no history and no file support (OSS-476). */\n apiUrl: string;\n /** Project id parsed from {@link apiKey}. */\n projectId: number;\n /** The Channel's declared name (`createChannel({ name })`). */\n channelName: string;\n /**\n * The managed provider this Channel declares to the Intelligence gateway on\n * join, resolved from the Channel's per-Channel `provider` (e.g. `\"slack\"` or\n * `\"teams\"`), defaulting to `\"slack\"`. Named `adapter` because that is the\n * field the gateway's join payload expects; the gateway resolves the actual\n * connection for the declared provider.\n */\n adapter: string;\n /** Identifier for the runtime instance activating this Channel. */\n runtimeInstanceId: string;\n}\n\n/** Matches the `cpk-{projectId}_...` Intelligence API key format. */\nconst API_KEY_PROJECT_ID_PATTERN = /^cpk-(\\d+)_/;\n\n/**\n * Parse the project id embedded in an Intelligence API key.\n *\n * Intelligence API keys are formatted `cpk-{projectId}_{rest}` — this\n * extracts and numerically parses the `{projectId}` segment.\n *\n * @param apiKey - The Intelligence API key to parse.\n * @returns The parsed, strictly-positive, safe-integer project id.\n * @throws {ChannelConfigError} If `apiKey` does not match the expected\n * `cpk-{projectId}_...` format — a wrong/missing prefix or an absent project\n * id segment all fail the same match — or if the parsed project id is not a\n * strictly-positive safe integer.\n */\nexport function parseProjectIdFromApiKey(apiKey: string): number {\n const match = API_KEY_PROJECT_ID_PATTERN.exec(apiKey);\n if (!match) {\n // The whole API key is a `cpk-…` secret — everything after the fixed `cpk-`\n // namespace is sensitive, so a fixed-width slice (e.g. `apiKey.slice(0, 8)`)\n // would echo secret bytes for a `cpk-_short_long`-shaped key. This message is\n // logged and surfaced through `ready()`'s AggregateError, so echo NONE of the\n // key value; name only the expected format to aid diagnosis.\n throw new ChannelConfigError(\n `Could not parse a project id from the Intelligence API key — expected the ` +\n `\"cpk-{projectId}_...\" format (the key value is omitted here to avoid ` +\n `leaking secret material).`,\n );\n }\n const projectId = Number(match[1]);\n // Validate the parser's OWN output: `cpk-0_...` matches the pattern but a\n // non-positive project id would otherwise fail deep inside the launcher's\n // `assertValidChannelRealtimeScope` (which requires a positive projectId).\n // A very long digit run also matches `\\d+` but loses precision (or overflows\n // to Infinity) once coerced to `Number`, so it must be rejected too even\n // though it is `> 0` — `Number.isSafeInteger` catches both. This is the\n // parser guarding its own contract, not a channel-name replica, so it\n // belongs here. Reuse the same redaction: never echo the key value.\n if (!Number.isSafeInteger(projectId) || projectId <= 0) {\n throw new ChannelConfigError(\n `Parsed an invalid project id (${projectId}) from the Intelligence API ` +\n `key — the project id in \"cpk-{projectId}_...\" must be a positive safe ` +\n `integer (the key value is omitted here to avoid leaking secret material).`,\n );\n }\n return projectId;\n}\n\n/**\n * Derive the {@link ChannelActivationConfig} needed to activate `channel`\n * against the given Intelligence runtime configuration.\n *\n * @param args.intelligence - The Intelligence runtime client to pull the\n * runner websocket URL and auth token from.\n * @param args.channel - The Channel being activated. Must have a `name`; its\n * per-Channel `provider` selects the managed adapter declared to the gateway.\n * @param args.runtimeInstanceId - Identifier for the activating runtime\n * instance, passed through unchanged.\n * @returns The resolved {@link ChannelActivationConfig}.\n * @throws {ChannelConfigError} If the Intelligence API key does not carry a\n * parseable, strictly-positive project id, or if `channel.name` is\n * missing/empty.\n *\n * The managed provider is a PER-CHANNEL choice read from `channel.provider`, so\n * one runtime can activate a Slack-backed Channel and a Teams-backed Channel\n * side by side. When `channel.provider` is unset the config adapter defaults to\n * `\"slack\"` — an explicit, documented default, not a silent global. The SDK\n * only DECLARES this provider to the Intelligence gateway on join; the gateway\n * resolves the actual connection and is the authority on which providers it\n * accepts (it accepts only `\"slack\"` today — Teams gateway support is tracked\n * in OSS-450).\n *\n * The Channel-name FORMAT rules (lowercase kebab-case, 3–64 chars) and the\n * reserved-name rule are NOT re-checked here. Their single source of truth is\n * the `@copilotkit/channels-intelligence` launcher\n * (`assertValidChannelRealtimeScope` + `assertValidChannelNames`), which\n * validates them at activation; a malformed name surfaces as a logged `error`\n * status via {@link ChannelManager.ready} rather than an up-front throw. An\n * empty/missing name is still rejected here because that is this config's own\n * precondition (it has no name to forward at all), not a downstream replica.\n */\nexport function deriveChannelActivationConfig(args: {\n intelligence: CopilotKitIntelligence;\n channel: Channel;\n runtimeInstanceId: string;\n}): ChannelActivationConfig {\n const { intelligence, channel, runtimeInstanceId } = args;\n\n if (!channel.name) {\n throw new ChannelConfigError(\n \"Channel is missing a `name` — pass createChannel({ name }) to activate it.\",\n );\n }\n\n const channelName = channel.name;\n\n const wsUrl = intelligence.ɵ
|
|
1
|
+
{"version":3,"file":"channel-activation-config.cjs","names":[],"sources":["../../../../src/v2/runtime/core/channel-activation-config.ts"],"sourcesContent":["import type { CopilotKitIntelligence } from \"../intelligence-platform\";\n// Type-only: @copilotkit/channels is pure-ESM, so a value import would break this\n// package's CJS output (see `runtime.ts` for the same constraint).\nimport type { Channel, ReplyContinuationOptions } from \"@copilotkit/channels\";\n\n/**\n * Error thrown when a Channel activation config cannot be derived — either the\n * Intelligence API key does not carry a project id in the expected\n * `cpk-{projectId}_...` format, or the {@link Channel} is missing a `name`.\n */\nexport class ChannelConfigError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"ChannelConfigError\";\n }\n}\n\n/**\n * Resolved configuration needed to activate a single Channel against a\n * running Intelligence runtime instance.\n */\nexport interface ChannelActivationConfig {\n /** Intelligence runner websocket URL the Channel connects to. */\n wsUrl: string;\n /** Intelligence API key used to authenticate the runner connection. */\n apiKey: string;\n /** Intelligence app-api HTTP base URL (`intelligence.ɵgetApiUrl()`), forwarded\n * to the transport so the managed realtime path enables file/history parity\n * (those are HTTP-only). Without it, Channels started by the normal runtime\n * handler run with no history and no file support (OSS-476). */\n apiUrl: string;\n /** Project id parsed from {@link apiKey}. */\n projectId: number;\n /** The Channel's declared name (`createChannel({ name })`). */\n channelName: string;\n /**\n * The managed provider this Channel declares to the Intelligence gateway on\n * join, resolved from the Channel's per-Channel `provider` (e.g. `\"slack\"` or\n * `\"teams\"`), defaulting to `\"slack\"`. Named `adapter` because that is the\n * field the gateway's join payload expects; the gateway resolves the actual\n * connection for the declared provider.\n */\n adapter: string;\n /**\n * Optional per-Channel override for visible managed tool-call progress.\n * Unset Slack routes default to hidden; other providers retain their existing\n * default.\n */\n showToolStatus?: boolean;\n /**\n * Optional per-Channel tuning for splitting a long reply across continuation\n * messages. Unset leaves the provider renderer's defaults in place.\n */\n replyContinuation?: ReplyContinuationOptions;\n /** Identifier for the runtime instance activating this Channel. */\n runtimeInstanceId: string;\n}\n\n/** Matches the `cpk-{projectId}_...` Intelligence API key format. */\nconst API_KEY_PROJECT_ID_PATTERN = /^cpk-(\\d+)_/;\n\n/**\n * Parse the project id embedded in an Intelligence API key.\n *\n * Intelligence API keys are formatted `cpk-{projectId}_{rest}` — this\n * extracts and numerically parses the `{projectId}` segment.\n *\n * @param apiKey - The Intelligence API key to parse.\n * @returns The parsed, strictly-positive, safe-integer project id.\n * @throws {ChannelConfigError} If `apiKey` does not match the expected\n * `cpk-{projectId}_...` format — a wrong/missing prefix or an absent project\n * id segment all fail the same match — or if the parsed project id is not a\n * strictly-positive safe integer.\n */\nexport function parseProjectIdFromApiKey(apiKey: string): number {\n const match = API_KEY_PROJECT_ID_PATTERN.exec(apiKey);\n if (!match) {\n // The whole API key is a `cpk-…` secret — everything after the fixed `cpk-`\n // namespace is sensitive, so a fixed-width slice (e.g. `apiKey.slice(0, 8)`)\n // would echo secret bytes for a `cpk-_short_long`-shaped key. This message is\n // logged and surfaced through `ready()`'s AggregateError, so echo NONE of the\n // key value; name only the expected format to aid diagnosis.\n throw new ChannelConfigError(\n `Could not parse a project id from the Intelligence API key — expected the ` +\n `\"cpk-{projectId}_...\" format (the key value is omitted here to avoid ` +\n `leaking secret material).`,\n );\n }\n const projectId = Number(match[1]);\n // Validate the parser's OWN output: `cpk-0_...` matches the pattern but a\n // non-positive project id would otherwise fail deep inside the launcher's\n // `assertValidChannelRealtimeScope` (which requires a positive projectId).\n // A very long digit run also matches `\\d+` but loses precision (or overflows\n // to Infinity) once coerced to `Number`, so it must be rejected too even\n // though it is `> 0` — `Number.isSafeInteger` catches both. This is the\n // parser guarding its own contract, not a channel-name replica, so it\n // belongs here. Reuse the same redaction: never echo the key value.\n if (!Number.isSafeInteger(projectId) || projectId <= 0) {\n throw new ChannelConfigError(\n `Parsed an invalid project id (${projectId}) from the Intelligence API ` +\n `key — the project id in \"cpk-{projectId}_...\" must be a positive safe ` +\n `integer (the key value is omitted here to avoid leaking secret material).`,\n );\n }\n return projectId;\n}\n\n/**\n * Derive the {@link ChannelActivationConfig} needed to activate `channel`\n * against the given Intelligence runtime configuration.\n *\n * @param args.intelligence - The Intelligence runtime client to pull the\n * runner websocket URL and auth token from.\n * @param args.channel - The Channel being activated. Must have a `name`; its\n * per-Channel `provider` selects the managed adapter declared to the gateway,\n * and `showToolStatus` optionally overrides managed tool-call visibility.\n * @param args.runtimeInstanceId - Identifier for the activating runtime\n * instance, passed through unchanged.\n * @returns The resolved {@link ChannelActivationConfig}.\n * @throws {ChannelConfigError} If the Intelligence API key does not carry a\n * parseable, strictly-positive project id, or if `channel.name` is\n * missing/empty.\n *\n * The managed provider is a PER-CHANNEL choice read from `channel.provider`, so\n * one runtime can activate a Slack-backed Channel and a Teams-backed Channel\n * side by side. When `channel.provider` is unset the config adapter defaults to\n * `\"slack\"` — an explicit, documented default, not a silent global. The SDK\n * only DECLARES this provider to the Intelligence gateway on join; the gateway\n * resolves the actual connection and is the authority on which providers it\n * accepts (it accepts only `\"slack\"` today — Teams gateway support is tracked\n * in OSS-450).\n *\n * The Channel-name FORMAT rules (lowercase kebab-case, 3–64 chars) and the\n * reserved-name rule are NOT re-checked here. Their single source of truth is\n * the `@copilotkit/channels-intelligence` launcher\n * (`assertValidChannelRealtimeScope` + `assertValidChannelNames`), which\n * validates them at activation; a malformed name surfaces as a logged `error`\n * status via {@link ChannelManager.ready} rather than an up-front throw. An\n * empty/missing name is still rejected here because that is this config's own\n * precondition (it has no name to forward at all), not a downstream replica.\n */\nexport function deriveChannelActivationConfig(args: {\n intelligence: CopilotKitIntelligence;\n channel: Channel;\n runtimeInstanceId: string;\n}): ChannelActivationConfig {\n const { intelligence, channel, runtimeInstanceId } = args;\n\n if (!channel.name) {\n throw new ChannelConfigError(\n \"Channel is missing a `name` — pass createChannel({ name }) to activate it.\",\n );\n }\n\n const channelName = channel.name;\n\n const wsUrl = intelligence.ɵgetChannelsWsUrl();\n const apiUrl = intelligence.ɵgetApiUrl();\n const apiKey = intelligence.ɵgetRunnerAuthToken();\n const projectId = parseProjectIdFromApiKey(apiKey);\n\n // Resolve the managed adapter declared to the gateway from the Channel's OWN\n // `provider` — a per-Channel choice, not a manager-wide default. When\n // `provider` is unset the adapter is the documented default `\"slack\"`; set\n // `createChannel({ provider: \"teams\" })` to declare Teams instead. The value\n // is trimmed so a padded runtime value (one that bypassed the typed union)\n // resolves to its bare provider rather than being forwarded with whitespace,\n // and a blank/whitespace-only provider falls back to `\"slack\"` (`??` alone\n // would keep `\"\"`).\n const trimmedProvider = channel.provider?.trim();\n\n return {\n wsUrl,\n apiUrl,\n apiKey,\n projectId,\n channelName,\n adapter: trimmedProvider ? trimmedProvider : \"slack\",\n ...(channel.showToolStatus !== undefined\n ? { showToolStatus: channel.showToolStatus }\n : {}),\n ...(channel.replyContinuation !== undefined\n ? { replyContinuation: channel.replyContinuation }\n : {}),\n runtimeInstanceId,\n };\n}\n"],"mappings":";;;;;;;;AAUA,IAAa,qBAAb,cAAwC,MAAM;CAC5C,YAAY,SAAiB;AAC3B,QAAM,QAAQ;AACd,OAAK,OAAO;;;;AA8ChB,MAAM,6BAA6B;;;;;;;;;;;;;;AAenC,SAAgB,yBAAyB,QAAwB;CAC/D,MAAM,QAAQ,2BAA2B,KAAK,OAAO;AACrD,KAAI,CAAC,MAMH,OAAM,IAAI,mBACR,6KAGD;CAEH,MAAM,YAAY,OAAO,MAAM,GAAG;AASlC,KAAI,CAAC,OAAO,cAAc,UAAU,IAAI,aAAa,EACnD,OAAM,IAAI,mBACR,iCAAiC,UAAU,6KAG5C;AAEH,QAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCT,SAAgB,8BAA8B,MAIlB;CAC1B,MAAM,EAAE,cAAc,SAAS,sBAAsB;AAErD,KAAI,CAAC,QAAQ,KACX,OAAM,IAAI,mBACR,6EACD;CAGH,MAAM,cAAc,QAAQ;CAE5B,MAAM,QAAQ,aAAa,mBAAmB;CAC9C,MAAM,SAAS,aAAa,YAAY;CACxC,MAAM,SAAS,aAAa,qBAAqB;CACjD,MAAM,YAAY,yBAAyB,OAAO;CAUlD,MAAM,kBAAkB,QAAQ,UAAU,MAAM;AAEhD,QAAO;EACL;EACA;EACA;EACA;EACA;EACA,SAAS,kBAAkB,kBAAkB;EAC7C,GAAI,QAAQ,mBAAmB,SAC3B,EAAE,gBAAgB,QAAQ,gBAAgB,GAC1C,EAAE;EACN,GAAI,QAAQ,sBAAsB,SAC9B,EAAE,mBAAmB,QAAQ,mBAAmB,GAChD,EAAE;EACN;EACD"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
require("reflect-metadata");
|
|
2
|
+
import { index_d_exports } from "../../../channels/dist/index.cjs";
|
|
3
|
+
|
|
2
4
|
//#region src/v2/runtime/core/channel-activation-config.d.ts
|
|
3
5
|
/**
|
|
4
6
|
* Resolved configuration needed to activate a single Channel against a
|
|
@@ -26,6 +28,17 @@ interface ChannelActivationConfig {
|
|
|
26
28
|
* connection for the declared provider.
|
|
27
29
|
*/
|
|
28
30
|
adapter: string;
|
|
31
|
+
/**
|
|
32
|
+
* Optional per-Channel override for visible managed tool-call progress.
|
|
33
|
+
* Unset Slack routes default to hidden; other providers retain their existing
|
|
34
|
+
* default.
|
|
35
|
+
*/
|
|
36
|
+
showToolStatus?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Optional per-Channel tuning for splitting a long reply across continuation
|
|
39
|
+
* messages. Unset leaves the provider renderer's defaults in place.
|
|
40
|
+
*/
|
|
41
|
+
replyContinuation?: index_d_exports.ReplyContinuationOptions;
|
|
29
42
|
/** Identifier for the runtime instance activating this Channel. */
|
|
30
43
|
runtimeInstanceId: string;
|
|
31
44
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"channel-activation-config.d.cts","names":[],"sources":["../../../../src/v2/runtime/core/channel-activation-config.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"channel-activation-config.d.cts","names":[],"sources":["../../../../src/v2/runtime/core/channel-activation-config.ts"],"mappings":";;;;;;;;UAqBiB,uBAAA;EAgCK;EA9BpB,KAAA;EAgCiB;EA9BjB,MAAA;;;;;EAKA,MAAA;;EAEA,SAAA;;EAEA,WAAA;;;;;;;;EAQA,OAAA;;;;;;EAMA,cAAA;;;;;EAKA,iBAAA,GAAoB,eAAA,CAAA,wBAAA;;EAEpB,iBAAA;AAAA"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import "reflect-metadata";
|
|
2
|
+
import { index_d_exports } from "../../../channels/dist/index.mjs";
|
|
3
|
+
|
|
2
4
|
//#region src/v2/runtime/core/channel-activation-config.d.ts
|
|
3
5
|
/**
|
|
4
6
|
* Resolved configuration needed to activate a single Channel against a
|
|
@@ -26,6 +28,17 @@ interface ChannelActivationConfig {
|
|
|
26
28
|
* connection for the declared provider.
|
|
27
29
|
*/
|
|
28
30
|
adapter: string;
|
|
31
|
+
/**
|
|
32
|
+
* Optional per-Channel override for visible managed tool-call progress.
|
|
33
|
+
* Unset Slack routes default to hidden; other providers retain their existing
|
|
34
|
+
* default.
|
|
35
|
+
*/
|
|
36
|
+
showToolStatus?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Optional per-Channel tuning for splitting a long reply across continuation
|
|
39
|
+
* messages. Unset leaves the provider renderer's defaults in place.
|
|
40
|
+
*/
|
|
41
|
+
replyContinuation?: index_d_exports.ReplyContinuationOptions;
|
|
29
42
|
/** Identifier for the runtime instance activating this Channel. */
|
|
30
43
|
runtimeInstanceId: string;
|
|
31
44
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"channel-activation-config.d.mts","names":[],"sources":["../../../../src/v2/runtime/core/channel-activation-config.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"channel-activation-config.d.mts","names":[],"sources":["../../../../src/v2/runtime/core/channel-activation-config.ts"],"mappings":";;;;;;;;UAqBiB,uBAAA;EAgCK;EA9BpB,KAAA;EAgCiB;EA9BjB,MAAA;;;;;EAKA,MAAA;;EAEA,SAAA;;EAEA,WAAA;;;;;;;;EAQA,OAAA;;;;;;EAMA,cAAA;;;;;EAKA,iBAAA,GAAoB,eAAA,CAAA,wBAAA;;EAEpB,iBAAA;AAAA"}
|
|
@@ -40,7 +40,8 @@ function parseProjectIdFromApiKey(apiKey) {
|
|
|
40
40
|
* @param args.intelligence - The Intelligence runtime client to pull the
|
|
41
41
|
* runner websocket URL and auth token from.
|
|
42
42
|
* @param args.channel - The Channel being activated. Must have a `name`; its
|
|
43
|
-
* per-Channel `provider` selects the managed adapter declared to the gateway
|
|
43
|
+
* per-Channel `provider` selects the managed adapter declared to the gateway,
|
|
44
|
+
* and `showToolStatus` optionally overrides managed tool-call visibility.
|
|
44
45
|
* @param args.runtimeInstanceId - Identifier for the activating runtime
|
|
45
46
|
* instance, passed through unchanged.
|
|
46
47
|
* @returns The resolved {@link ChannelActivationConfig}.
|
|
@@ -70,7 +71,7 @@ function deriveChannelActivationConfig(args) {
|
|
|
70
71
|
const { intelligence, channel, runtimeInstanceId } = args;
|
|
71
72
|
if (!channel.name) throw new ChannelConfigError("Channel is missing a `name` — pass createChannel({ name }) to activate it.");
|
|
72
73
|
const channelName = channel.name;
|
|
73
|
-
const wsUrl = intelligence.ɵ
|
|
74
|
+
const wsUrl = intelligence.ɵgetChannelsWsUrl();
|
|
74
75
|
const apiUrl = intelligence.ɵgetApiUrl();
|
|
75
76
|
const apiKey = intelligence.ɵgetRunnerAuthToken();
|
|
76
77
|
const projectId = parseProjectIdFromApiKey(apiKey);
|
|
@@ -82,6 +83,8 @@ function deriveChannelActivationConfig(args) {
|
|
|
82
83
|
projectId,
|
|
83
84
|
channelName,
|
|
84
85
|
adapter: trimmedProvider ? trimmedProvider : "slack",
|
|
86
|
+
...channel.showToolStatus !== void 0 ? { showToolStatus: channel.showToolStatus } : {},
|
|
87
|
+
...channel.replyContinuation !== void 0 ? { replyContinuation: channel.replyContinuation } : {},
|
|
85
88
|
runtimeInstanceId
|
|
86
89
|
};
|
|
87
90
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"channel-activation-config.mjs","names":[],"sources":["../../../../src/v2/runtime/core/channel-activation-config.ts"],"sourcesContent":["import type { CopilotKitIntelligence } from \"../intelligence-platform\";\n// Type-only: @copilotkit/channels is pure-ESM, so a value import would break this\n// package's CJS output (see `runtime.ts` for the same constraint).\nimport type { Channel } from \"@copilotkit/channels\";\n\n/**\n * Error thrown when a Channel activation config cannot be derived — either the\n * Intelligence API key does not carry a project id in the expected\n * `cpk-{projectId}_...` format, or the {@link Channel} is missing a `name`.\n */\nexport class ChannelConfigError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"ChannelConfigError\";\n }\n}\n\n/**\n * Resolved configuration needed to activate a single Channel against a\n * running Intelligence runtime instance.\n */\nexport interface ChannelActivationConfig {\n /** Intelligence runner websocket URL the Channel connects to. */\n wsUrl: string;\n /** Intelligence API key used to authenticate the runner connection. */\n apiKey: string;\n /** Intelligence app-api HTTP base URL (`intelligence.ɵgetApiUrl()`), forwarded\n * to the transport so the managed realtime path enables file/history parity\n * (those are HTTP-only). Without it, Channels started by the normal runtime\n * handler run with no history and no file support (OSS-476). */\n apiUrl: string;\n /** Project id parsed from {@link apiKey}. */\n projectId: number;\n /** The Channel's declared name (`createChannel({ name })`). */\n channelName: string;\n /**\n * The managed provider this Channel declares to the Intelligence gateway on\n * join, resolved from the Channel's per-Channel `provider` (e.g. `\"slack\"` or\n * `\"teams\"`), defaulting to `\"slack\"`. Named `adapter` because that is the\n * field the gateway's join payload expects; the gateway resolves the actual\n * connection for the declared provider.\n */\n adapter: string;\n /** Identifier for the runtime instance activating this Channel. */\n runtimeInstanceId: string;\n}\n\n/** Matches the `cpk-{projectId}_...` Intelligence API key format. */\nconst API_KEY_PROJECT_ID_PATTERN = /^cpk-(\\d+)_/;\n\n/**\n * Parse the project id embedded in an Intelligence API key.\n *\n * Intelligence API keys are formatted `cpk-{projectId}_{rest}` — this\n * extracts and numerically parses the `{projectId}` segment.\n *\n * @param apiKey - The Intelligence API key to parse.\n * @returns The parsed, strictly-positive, safe-integer project id.\n * @throws {ChannelConfigError} If `apiKey` does not match the expected\n * `cpk-{projectId}_...` format — a wrong/missing prefix or an absent project\n * id segment all fail the same match — or if the parsed project id is not a\n * strictly-positive safe integer.\n */\nexport function parseProjectIdFromApiKey(apiKey: string): number {\n const match = API_KEY_PROJECT_ID_PATTERN.exec(apiKey);\n if (!match) {\n // The whole API key is a `cpk-…` secret — everything after the fixed `cpk-`\n // namespace is sensitive, so a fixed-width slice (e.g. `apiKey.slice(0, 8)`)\n // would echo secret bytes for a `cpk-_short_long`-shaped key. This message is\n // logged and surfaced through `ready()`'s AggregateError, so echo NONE of the\n // key value; name only the expected format to aid diagnosis.\n throw new ChannelConfigError(\n `Could not parse a project id from the Intelligence API key — expected the ` +\n `\"cpk-{projectId}_...\" format (the key value is omitted here to avoid ` +\n `leaking secret material).`,\n );\n }\n const projectId = Number(match[1]);\n // Validate the parser's OWN output: `cpk-0_...` matches the pattern but a\n // non-positive project id would otherwise fail deep inside the launcher's\n // `assertValidChannelRealtimeScope` (which requires a positive projectId).\n // A very long digit run also matches `\\d+` but loses precision (or overflows\n // to Infinity) once coerced to `Number`, so it must be rejected too even\n // though it is `> 0` — `Number.isSafeInteger` catches both. This is the\n // parser guarding its own contract, not a channel-name replica, so it\n // belongs here. Reuse the same redaction: never echo the key value.\n if (!Number.isSafeInteger(projectId) || projectId <= 0) {\n throw new ChannelConfigError(\n `Parsed an invalid project id (${projectId}) from the Intelligence API ` +\n `key — the project id in \"cpk-{projectId}_...\" must be a positive safe ` +\n `integer (the key value is omitted here to avoid leaking secret material).`,\n );\n }\n return projectId;\n}\n\n/**\n * Derive the {@link ChannelActivationConfig} needed to activate `channel`\n * against the given Intelligence runtime configuration.\n *\n * @param args.intelligence - The Intelligence runtime client to pull the\n * runner websocket URL and auth token from.\n * @param args.channel - The Channel being activated. Must have a `name`; its\n * per-Channel `provider` selects the managed adapter declared to the gateway.\n * @param args.runtimeInstanceId - Identifier for the activating runtime\n * instance, passed through unchanged.\n * @returns The resolved {@link ChannelActivationConfig}.\n * @throws {ChannelConfigError} If the Intelligence API key does not carry a\n * parseable, strictly-positive project id, or if `channel.name` is\n * missing/empty.\n *\n * The managed provider is a PER-CHANNEL choice read from `channel.provider`, so\n * one runtime can activate a Slack-backed Channel and a Teams-backed Channel\n * side by side. When `channel.provider` is unset the config adapter defaults to\n * `\"slack\"` — an explicit, documented default, not a silent global. The SDK\n * only DECLARES this provider to the Intelligence gateway on join; the gateway\n * resolves the actual connection and is the authority on which providers it\n * accepts (it accepts only `\"slack\"` today — Teams gateway support is tracked\n * in OSS-450).\n *\n * The Channel-name FORMAT rules (lowercase kebab-case, 3–64 chars) and the\n * reserved-name rule are NOT re-checked here. Their single source of truth is\n * the `@copilotkit/channels-intelligence` launcher\n * (`assertValidChannelRealtimeScope` + `assertValidChannelNames`), which\n * validates them at activation; a malformed name surfaces as a logged `error`\n * status via {@link ChannelManager.ready} rather than an up-front throw. An\n * empty/missing name is still rejected here because that is this config's own\n * precondition (it has no name to forward at all), not a downstream replica.\n */\nexport function deriveChannelActivationConfig(args: {\n intelligence: CopilotKitIntelligence;\n channel: Channel;\n runtimeInstanceId: string;\n}): ChannelActivationConfig {\n const { intelligence, channel, runtimeInstanceId } = args;\n\n if (!channel.name) {\n throw new ChannelConfigError(\n \"Channel is missing a `name` — pass createChannel({ name }) to activate it.\",\n );\n }\n\n const channelName = channel.name;\n\n const wsUrl = intelligence.ɵ
|
|
1
|
+
{"version":3,"file":"channel-activation-config.mjs","names":[],"sources":["../../../../src/v2/runtime/core/channel-activation-config.ts"],"sourcesContent":["import type { CopilotKitIntelligence } from \"../intelligence-platform\";\n// Type-only: @copilotkit/channels is pure-ESM, so a value import would break this\n// package's CJS output (see `runtime.ts` for the same constraint).\nimport type { Channel, ReplyContinuationOptions } from \"@copilotkit/channels\";\n\n/**\n * Error thrown when a Channel activation config cannot be derived — either the\n * Intelligence API key does not carry a project id in the expected\n * `cpk-{projectId}_...` format, or the {@link Channel} is missing a `name`.\n */\nexport class ChannelConfigError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"ChannelConfigError\";\n }\n}\n\n/**\n * Resolved configuration needed to activate a single Channel against a\n * running Intelligence runtime instance.\n */\nexport interface ChannelActivationConfig {\n /** Intelligence runner websocket URL the Channel connects to. */\n wsUrl: string;\n /** Intelligence API key used to authenticate the runner connection. */\n apiKey: string;\n /** Intelligence app-api HTTP base URL (`intelligence.ɵgetApiUrl()`), forwarded\n * to the transport so the managed realtime path enables file/history parity\n * (those are HTTP-only). Without it, Channels started by the normal runtime\n * handler run with no history and no file support (OSS-476). */\n apiUrl: string;\n /** Project id parsed from {@link apiKey}. */\n projectId: number;\n /** The Channel's declared name (`createChannel({ name })`). */\n channelName: string;\n /**\n * The managed provider this Channel declares to the Intelligence gateway on\n * join, resolved from the Channel's per-Channel `provider` (e.g. `\"slack\"` or\n * `\"teams\"`), defaulting to `\"slack\"`. Named `adapter` because that is the\n * field the gateway's join payload expects; the gateway resolves the actual\n * connection for the declared provider.\n */\n adapter: string;\n /**\n * Optional per-Channel override for visible managed tool-call progress.\n * Unset Slack routes default to hidden; other providers retain their existing\n * default.\n */\n showToolStatus?: boolean;\n /**\n * Optional per-Channel tuning for splitting a long reply across continuation\n * messages. Unset leaves the provider renderer's defaults in place.\n */\n replyContinuation?: ReplyContinuationOptions;\n /** Identifier for the runtime instance activating this Channel. */\n runtimeInstanceId: string;\n}\n\n/** Matches the `cpk-{projectId}_...` Intelligence API key format. */\nconst API_KEY_PROJECT_ID_PATTERN = /^cpk-(\\d+)_/;\n\n/**\n * Parse the project id embedded in an Intelligence API key.\n *\n * Intelligence API keys are formatted `cpk-{projectId}_{rest}` — this\n * extracts and numerically parses the `{projectId}` segment.\n *\n * @param apiKey - The Intelligence API key to parse.\n * @returns The parsed, strictly-positive, safe-integer project id.\n * @throws {ChannelConfigError} If `apiKey` does not match the expected\n * `cpk-{projectId}_...` format — a wrong/missing prefix or an absent project\n * id segment all fail the same match — or if the parsed project id is not a\n * strictly-positive safe integer.\n */\nexport function parseProjectIdFromApiKey(apiKey: string): number {\n const match = API_KEY_PROJECT_ID_PATTERN.exec(apiKey);\n if (!match) {\n // The whole API key is a `cpk-…` secret — everything after the fixed `cpk-`\n // namespace is sensitive, so a fixed-width slice (e.g. `apiKey.slice(0, 8)`)\n // would echo secret bytes for a `cpk-_short_long`-shaped key. This message is\n // logged and surfaced through `ready()`'s AggregateError, so echo NONE of the\n // key value; name only the expected format to aid diagnosis.\n throw new ChannelConfigError(\n `Could not parse a project id from the Intelligence API key — expected the ` +\n `\"cpk-{projectId}_...\" format (the key value is omitted here to avoid ` +\n `leaking secret material).`,\n );\n }\n const projectId = Number(match[1]);\n // Validate the parser's OWN output: `cpk-0_...` matches the pattern but a\n // non-positive project id would otherwise fail deep inside the launcher's\n // `assertValidChannelRealtimeScope` (which requires a positive projectId).\n // A very long digit run also matches `\\d+` but loses precision (or overflows\n // to Infinity) once coerced to `Number`, so it must be rejected too even\n // though it is `> 0` — `Number.isSafeInteger` catches both. This is the\n // parser guarding its own contract, not a channel-name replica, so it\n // belongs here. Reuse the same redaction: never echo the key value.\n if (!Number.isSafeInteger(projectId) || projectId <= 0) {\n throw new ChannelConfigError(\n `Parsed an invalid project id (${projectId}) from the Intelligence API ` +\n `key — the project id in \"cpk-{projectId}_...\" must be a positive safe ` +\n `integer (the key value is omitted here to avoid leaking secret material).`,\n );\n }\n return projectId;\n}\n\n/**\n * Derive the {@link ChannelActivationConfig} needed to activate `channel`\n * against the given Intelligence runtime configuration.\n *\n * @param args.intelligence - The Intelligence runtime client to pull the\n * runner websocket URL and auth token from.\n * @param args.channel - The Channel being activated. Must have a `name`; its\n * per-Channel `provider` selects the managed adapter declared to the gateway,\n * and `showToolStatus` optionally overrides managed tool-call visibility.\n * @param args.runtimeInstanceId - Identifier for the activating runtime\n * instance, passed through unchanged.\n * @returns The resolved {@link ChannelActivationConfig}.\n * @throws {ChannelConfigError} If the Intelligence API key does not carry a\n * parseable, strictly-positive project id, or if `channel.name` is\n * missing/empty.\n *\n * The managed provider is a PER-CHANNEL choice read from `channel.provider`, so\n * one runtime can activate a Slack-backed Channel and a Teams-backed Channel\n * side by side. When `channel.provider` is unset the config adapter defaults to\n * `\"slack\"` — an explicit, documented default, not a silent global. The SDK\n * only DECLARES this provider to the Intelligence gateway on join; the gateway\n * resolves the actual connection and is the authority on which providers it\n * accepts (it accepts only `\"slack\"` today — Teams gateway support is tracked\n * in OSS-450).\n *\n * The Channel-name FORMAT rules (lowercase kebab-case, 3–64 chars) and the\n * reserved-name rule are NOT re-checked here. Their single source of truth is\n * the `@copilotkit/channels-intelligence` launcher\n * (`assertValidChannelRealtimeScope` + `assertValidChannelNames`), which\n * validates them at activation; a malformed name surfaces as a logged `error`\n * status via {@link ChannelManager.ready} rather than an up-front throw. An\n * empty/missing name is still rejected here because that is this config's own\n * precondition (it has no name to forward at all), not a downstream replica.\n */\nexport function deriveChannelActivationConfig(args: {\n intelligence: CopilotKitIntelligence;\n channel: Channel;\n runtimeInstanceId: string;\n}): ChannelActivationConfig {\n const { intelligence, channel, runtimeInstanceId } = args;\n\n if (!channel.name) {\n throw new ChannelConfigError(\n \"Channel is missing a `name` — pass createChannel({ name }) to activate it.\",\n );\n }\n\n const channelName = channel.name;\n\n const wsUrl = intelligence.ɵgetChannelsWsUrl();\n const apiUrl = intelligence.ɵgetApiUrl();\n const apiKey = intelligence.ɵgetRunnerAuthToken();\n const projectId = parseProjectIdFromApiKey(apiKey);\n\n // Resolve the managed adapter declared to the gateway from the Channel's OWN\n // `provider` — a per-Channel choice, not a manager-wide default. When\n // `provider` is unset the adapter is the documented default `\"slack\"`; set\n // `createChannel({ provider: \"teams\" })` to declare Teams instead. The value\n // is trimmed so a padded runtime value (one that bypassed the typed union)\n // resolves to its bare provider rather than being forwarded with whitespace,\n // and a blank/whitespace-only provider falls back to `\"slack\"` (`??` alone\n // would keep `\"\"`).\n const trimmedProvider = channel.provider?.trim();\n\n return {\n wsUrl,\n apiUrl,\n apiKey,\n projectId,\n channelName,\n adapter: trimmedProvider ? trimmedProvider : \"slack\",\n ...(channel.showToolStatus !== undefined\n ? { showToolStatus: channel.showToolStatus }\n : {}),\n ...(channel.replyContinuation !== undefined\n ? { replyContinuation: channel.replyContinuation }\n : {}),\n runtimeInstanceId,\n };\n}\n"],"mappings":";;;;;;;AAUA,IAAa,qBAAb,cAAwC,MAAM;CAC5C,YAAY,SAAiB;AAC3B,QAAM,QAAQ;AACd,OAAK,OAAO;;;;AA8ChB,MAAM,6BAA6B;;;;;;;;;;;;;;AAenC,SAAgB,yBAAyB,QAAwB;CAC/D,MAAM,QAAQ,2BAA2B,KAAK,OAAO;AACrD,KAAI,CAAC,MAMH,OAAM,IAAI,mBACR,6KAGD;CAEH,MAAM,YAAY,OAAO,MAAM,GAAG;AASlC,KAAI,CAAC,OAAO,cAAc,UAAU,IAAI,aAAa,EACnD,OAAM,IAAI,mBACR,iCAAiC,UAAU,6KAG5C;AAEH,QAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCT,SAAgB,8BAA8B,MAIlB;CAC1B,MAAM,EAAE,cAAc,SAAS,sBAAsB;AAErD,KAAI,CAAC,QAAQ,KACX,OAAM,IAAI,mBACR,6EACD;CAGH,MAAM,cAAc,QAAQ;CAE5B,MAAM,QAAQ,aAAa,mBAAmB;CAC9C,MAAM,SAAS,aAAa,YAAY;CACxC,MAAM,SAAS,aAAa,qBAAqB;CACjD,MAAM,YAAY,yBAAyB,OAAO;CAUlD,MAAM,kBAAkB,QAAQ,UAAU,MAAM;AAEhD,QAAO;EACL;EACA;EACA;EACA;EACA;EACA,SAAS,kBAAkB,kBAAkB;EAC7C,GAAI,QAAQ,mBAAmB,SAC3B,EAAE,gBAAgB,QAAQ,gBAAgB,GAC1C,EAAE;EACN,GAAI,QAAQ,sBAAsB,SAC9B,EAAE,mBAAmB,QAAQ,mBAAmB,GAChD,EAAE;EACN;EACD"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
require("reflect-metadata");
|
|
2
2
|
const require_runtime = require('../../../_virtual/_rolldown/runtime.cjs');
|
|
3
3
|
const require_channel_activation_config = require('./channel-activation-config.cjs');
|
|
4
|
+
let rxjs = require("rxjs");
|
|
4
5
|
let node_crypto = require("node:crypto");
|
|
6
|
+
let _ag_ui_client = require("@ag-ui/client");
|
|
5
7
|
|
|
6
8
|
//#region src/v2/runtime/core/channel-manager.ts
|
|
7
9
|
/**
|
|
@@ -46,7 +48,7 @@ const CHANNELS_INTELLIGENCE_SPECIFIER = "@copilotkit/channels-intelligence";
|
|
|
46
48
|
* transport-level drop diagnostics are not silent in the managed path.
|
|
47
49
|
* @returns The launcher's {@link ChannelsHandle}.
|
|
48
50
|
*/
|
|
49
|
-
async function defaultActivateChannel(config, channel, importChannelsIntelligence = () => import(CHANNELS_INTELLIGENCE_SPECIFIER), log) {
|
|
51
|
+
async function defaultActivateChannel(config, channel, importChannelsIntelligence = () => import(CHANNELS_INTELLIGENCE_SPECIFIER), log, services) {
|
|
50
52
|
let mod;
|
|
51
53
|
try {
|
|
52
54
|
mod = await importChannelsIntelligence();
|
|
@@ -54,6 +56,7 @@ async function defaultActivateChannel(config, channel, importChannelsIntelligenc
|
|
|
54
56
|
if (isModuleNotFound(err)) throw new Error("Managed Channels require '@copilotkit/channels-intelligence' to be installed. Add it to your app's dependencies.", { cause: err });
|
|
55
57
|
throw err;
|
|
56
58
|
}
|
|
59
|
+
if (!services) throw new Error("Managed Channels require the runtime AgentRunner and Intelligence client");
|
|
57
60
|
return mod.startChannelsOverRealtimeGateway([channel], {
|
|
58
61
|
wsUrl: config.wsUrl,
|
|
59
62
|
apiKey: config.apiKey,
|
|
@@ -63,10 +66,202 @@ async function defaultActivateChannel(config, channel, importChannelsIntelligenc
|
|
|
63
66
|
},
|
|
64
67
|
runtimeInstanceId: config.runtimeInstanceId,
|
|
65
68
|
adapter: config.adapter,
|
|
69
|
+
...config.showToolStatus !== void 0 ? { showToolStatus: config.showToolStatus } : {},
|
|
70
|
+
...config.replyContinuation !== void 0 ? { replyContinuation: config.replyContinuation } : {},
|
|
66
71
|
appApiBaseUrl: config.apiUrl,
|
|
67
|
-
...log ? { log } : {}
|
|
72
|
+
...log ? { log } : {},
|
|
73
|
+
runCanonical: (args) => runCanonicalChannelAgent(services.runner, services.intelligence, services.lockTtlSeconds ?? 20, services.lockHeartbeatIntervalSeconds ?? 15, args, services.lockKeyPrefix),
|
|
74
|
+
loadHistory: async ({ deliveryId, threadId, appUserId }) => {
|
|
75
|
+
const history = await services.intelligence.getThreadMessages({
|
|
76
|
+
threadId,
|
|
77
|
+
userId: appUserId,
|
|
78
|
+
channelDeliveryId: deliveryId
|
|
79
|
+
});
|
|
80
|
+
return Promise.all(history.messages.map((message) => toAgentMessage(message, services.intelligence)));
|
|
81
|
+
}
|
|
68
82
|
});
|
|
69
83
|
}
|
|
84
|
+
/** One outer agent that lets the standard runner own the whole local tool loop. */
|
|
85
|
+
var ChannelOuterAgent = class extends _ag_ui_client.AbstractAgent {
|
|
86
|
+
constructor(inner, canonicalThreadId, executeLoop) {
|
|
87
|
+
super({
|
|
88
|
+
threadId: inner.threadId,
|
|
89
|
+
initialMessages: inner.messages,
|
|
90
|
+
initialState: inner.state,
|
|
91
|
+
...inner.agentId ? { agentId: inner.agentId } : {}
|
|
92
|
+
});
|
|
93
|
+
this.inner = inner;
|
|
94
|
+
this.canonicalThreadId = canonicalThreadId;
|
|
95
|
+
this.executeLoop = executeLoop;
|
|
96
|
+
}
|
|
97
|
+
run() {
|
|
98
|
+
return rxjs.EMPTY;
|
|
99
|
+
}
|
|
100
|
+
async runAgent(parameters, subscriber) {
|
|
101
|
+
if (!parameters?.runId) throw new Error("Canonical Channel run requires a runId");
|
|
102
|
+
return {
|
|
103
|
+
result: await this.executeLoop(subscriber ?? {}, {
|
|
104
|
+
threadId: this.canonicalThreadId,
|
|
105
|
+
runId: parameters.runId
|
|
106
|
+
}),
|
|
107
|
+
newMessages: []
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
abortRun() {
|
|
111
|
+
this.inner.abortRun();
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
/** Drive one public Channel run through the runtime's existing AgentRunner. */
|
|
115
|
+
async function runCanonicalChannelAgent(runner, intelligence, lockTtlSeconds, lockHeartbeatIntervalSeconds, args, lockKeyPrefix) {
|
|
116
|
+
const lock = await intelligence.ɵacquireThreadLock({
|
|
117
|
+
threadId: args.threadId,
|
|
118
|
+
runId: args.runId,
|
|
119
|
+
userId: args.userId,
|
|
120
|
+
agentId: args.agentId,
|
|
121
|
+
channelDeliveryId: args.deliveryId,
|
|
122
|
+
ttlSeconds: lockTtlSeconds,
|
|
123
|
+
...lockKeyPrefix !== void 0 ? { lockKeyPrefix } : {}
|
|
124
|
+
});
|
|
125
|
+
const canonicalThreadId = lock.threadId;
|
|
126
|
+
const canonicalRunId = lock.runId;
|
|
127
|
+
let result = {
|
|
128
|
+
iterations: 0,
|
|
129
|
+
interrupted: false
|
|
130
|
+
};
|
|
131
|
+
const outer = new ChannelOuterAgent(args.agent, canonicalThreadId, async (subscriber, canonicalRun) => {
|
|
132
|
+
result = await args.execute(subscriber, canonicalRun);
|
|
133
|
+
return result;
|
|
134
|
+
});
|
|
135
|
+
let stopPromise;
|
|
136
|
+
let heartbeatError;
|
|
137
|
+
let heartbeatTimer;
|
|
138
|
+
const stopCanonicalRun = () => {
|
|
139
|
+
stopPromise ??= Promise.resolve().then(() => runner.stop({
|
|
140
|
+
threadId: canonicalThreadId,
|
|
141
|
+
runId: canonicalRunId
|
|
142
|
+
})).catch(() => false);
|
|
143
|
+
};
|
|
144
|
+
const abortCanonicalRun = () => {
|
|
145
|
+
try {
|
|
146
|
+
args.agent.abortRun();
|
|
147
|
+
} catch {}
|
|
148
|
+
stopCanonicalRun();
|
|
149
|
+
};
|
|
150
|
+
args.signal?.addEventListener("abort", abortCanonicalRun, { once: true });
|
|
151
|
+
heartbeatTimer = setInterval(() => {
|
|
152
|
+
intelligence.ɵrenewThreadLock({
|
|
153
|
+
threadId: canonicalThreadId,
|
|
154
|
+
runId: canonicalRunId,
|
|
155
|
+
ttlSeconds: lockTtlSeconds,
|
|
156
|
+
...lockKeyPrefix !== void 0 ? { lockKeyPrefix } : {}
|
|
157
|
+
}).catch((error) => {
|
|
158
|
+
if (heartbeatTimer === void 0) return;
|
|
159
|
+
clearInterval(heartbeatTimer);
|
|
160
|
+
heartbeatTimer = void 0;
|
|
161
|
+
heartbeatError = error;
|
|
162
|
+
try {
|
|
163
|
+
args.agent.abortRun();
|
|
164
|
+
} catch {}
|
|
165
|
+
stopCanonicalRun();
|
|
166
|
+
});
|
|
167
|
+
}, lockHeartbeatIntervalSeconds * 1e3);
|
|
168
|
+
heartbeatTimer.unref?.();
|
|
169
|
+
try {
|
|
170
|
+
await new Promise((resolve, reject) => {
|
|
171
|
+
let terminalError;
|
|
172
|
+
runner.run({
|
|
173
|
+
threadId: canonicalThreadId,
|
|
174
|
+
agent: outer,
|
|
175
|
+
input: {
|
|
176
|
+
threadId: canonicalThreadId,
|
|
177
|
+
runId: canonicalRunId,
|
|
178
|
+
messages: args.agent.messages,
|
|
179
|
+
state: args.agent.state,
|
|
180
|
+
tools: [...args.tools],
|
|
181
|
+
context: [...args.context],
|
|
182
|
+
forwardedProps: void 0
|
|
183
|
+
},
|
|
184
|
+
persistedInputMessages: args.persistedInputMessages
|
|
185
|
+
}).subscribe({
|
|
186
|
+
next: (event) => {
|
|
187
|
+
if (event.type !== _ag_ui_client.EventType.RUN_ERROR || terminalError) return;
|
|
188
|
+
const message = "message" in event && typeof event.message === "string" ? event.message : "Canonical Channel agent run failed";
|
|
189
|
+
terminalError = new Error(message);
|
|
190
|
+
terminalError.name = "ChannelCanonicalRunError";
|
|
191
|
+
if ("code" in event && typeof event.code === "string" && event.code.length > 0) terminalError.code = event.code;
|
|
192
|
+
},
|
|
193
|
+
error: reject,
|
|
194
|
+
complete: () => {
|
|
195
|
+
if (terminalError) reject(terminalError);
|
|
196
|
+
else resolve();
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
if (args.signal?.aborted) abortCanonicalRun();
|
|
200
|
+
});
|
|
201
|
+
} finally {
|
|
202
|
+
args.signal?.removeEventListener("abort", abortCanonicalRun);
|
|
203
|
+
if (heartbeatTimer !== void 0) {
|
|
204
|
+
clearInterval(heartbeatTimer);
|
|
205
|
+
heartbeatTimer = void 0;
|
|
206
|
+
}
|
|
207
|
+
await intelligence.ɵcleanupThreadLock({
|
|
208
|
+
threadId: canonicalThreadId,
|
|
209
|
+
runId: canonicalRunId
|
|
210
|
+
}).catch(() => void 0);
|
|
211
|
+
}
|
|
212
|
+
if (heartbeatError !== void 0) {
|
|
213
|
+
await stopPromise;
|
|
214
|
+
throw heartbeatError;
|
|
215
|
+
}
|
|
216
|
+
return result;
|
|
217
|
+
}
|
|
218
|
+
/** Convert canonical Intelligence history into AG-UI messages. */
|
|
219
|
+
async function toAgentMessage(message, intelligence) {
|
|
220
|
+
const content = await hydrateManagedContent(message.content, intelligence);
|
|
221
|
+
return {
|
|
222
|
+
id: message.id,
|
|
223
|
+
role: message.role,
|
|
224
|
+
content: content ?? "",
|
|
225
|
+
...message.activityType ? { activityType: message.activityType } : {},
|
|
226
|
+
...message.toolCalls ? { toolCalls: message.toolCalls.map((call) => ({
|
|
227
|
+
id: call.id,
|
|
228
|
+
type: "function",
|
|
229
|
+
function: {
|
|
230
|
+
name: call.name,
|
|
231
|
+
arguments: call.args
|
|
232
|
+
}
|
|
233
|
+
})) } : {},
|
|
234
|
+
...message.toolCallId ? { toolCallId: message.toolCallId } : {}
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
/** Resolves managed asset references only at the authorized Runtime boundary. */
|
|
238
|
+
async function hydrateManagedContent(content, intelligence) {
|
|
239
|
+
if (Array.isArray(content)) return Promise.all(content.map(async (part) => {
|
|
240
|
+
if (typeof part !== "object" || part === null || !("source" in part) || typeof part.source !== "object" || part.source === null || !("value" in part.source) || typeof part.source.value !== "string" || !part.source.value.startsWith("cpki-asset://")) return part;
|
|
241
|
+
const assetId = part.source.value.slice(13);
|
|
242
|
+
const asset = await intelligence.ɵgetManagedChannelAsset(assetId);
|
|
243
|
+
return {
|
|
244
|
+
...part,
|
|
245
|
+
source: {
|
|
246
|
+
type: "data",
|
|
247
|
+
value: Buffer.from(asset.bytes).toString("base64"),
|
|
248
|
+
mimeType: asset.mimeType ?? ("mimeType" in part.source && typeof part.source.mimeType === "string" ? part.source.mimeType : "application/octet-stream")
|
|
249
|
+
}
|
|
250
|
+
};
|
|
251
|
+
}));
|
|
252
|
+
if (typeof content === "object" && content !== null && "assetId" in content && typeof content.assetId === "string") {
|
|
253
|
+
const asset = await intelligence.ɵgetManagedChannelAsset(content.assetId);
|
|
254
|
+
return {
|
|
255
|
+
...content,
|
|
256
|
+
source: {
|
|
257
|
+
type: "data",
|
|
258
|
+
value: Buffer.from(asset.bytes).toString("base64"),
|
|
259
|
+
mimeType: asset.mimeType ?? ("mimeType" in content && typeof content.mimeType === "string" ? content.mimeType : "application/octet-stream")
|
|
260
|
+
}
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
return content;
|
|
264
|
+
}
|
|
70
265
|
/** Whether `err` signals a missing managed provider rather than a hard failure. */
|
|
71
266
|
function isSetupRequired(err) {
|
|
72
267
|
return err instanceof ChannelSetupRequiredError || typeof err === "object" && err !== null && err.code === "SETUP_REQUIRED";
|
|
@@ -84,6 +279,8 @@ function isModuleNotFound(err) {
|
|
|
84
279
|
}
|
|
85
280
|
/** Default deadline (ms) for a single `handle.stop()` during teardown. */
|
|
86
281
|
const DEFAULT_STOP_HANDLE_TIMEOUT_MS = 5e3;
|
|
282
|
+
/** Default cadence (ms) for the "still down" log while a session is dropped. */
|
|
283
|
+
const DEFAULT_RECONNECT_LOG_INTERVAL_MS = 3e4;
|
|
87
284
|
/**
|
|
88
285
|
* Reject with `timeoutMessage` after `timeoutMs` if `inner` has not settled,
|
|
89
286
|
* otherwise pass `inner` through. When `timeoutMs` is undefined, `inner` is
|
|
@@ -126,15 +323,12 @@ function withTimeout(inner, timeoutMs, timeoutMessage) {
|
|
|
126
323
|
* and {@link ready} rather than thrown.
|
|
127
324
|
*
|
|
128
325
|
* Reconnection is NOT handled here — it is delegated to the Phoenix connection
|
|
129
|
-
* layer that backs the launcher. When a managed socket drops, Phoenix's
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
* redundant AND broken: re-invoking the engine on an already-started `Channel`
|
|
136
|
-
* throws in `channel.addAdapter` (started=true). The manager therefore never
|
|
137
|
-
* re-activates on a drop.
|
|
326
|
+
* layer that backs the launcher. When a managed control socket drops, Phoenix's
|
|
327
|
+
* `Socket` reconnects and rejoins with the same Runtime declaration. Active
|
|
328
|
+
* deliveries request fresh one-use join tokens through that control link. A
|
|
329
|
+
* re-activation here would be both redundant AND broken: re-invoking the engine
|
|
330
|
+
* on an already-started `Channel` throws in `channel.addAdapter` (started=true).
|
|
331
|
+
* The manager therefore never re-activates on a drop.
|
|
138
332
|
*
|
|
139
333
|
* It DOES, however, reflect real connection health through the session's
|
|
140
334
|
* `onStateChange` observer so {@link ChannelManager.status} stays honest rather
|
|
@@ -149,11 +343,22 @@ var ChannelManager = class {
|
|
|
149
343
|
this.activated = false;
|
|
150
344
|
this.stopped = false;
|
|
151
345
|
this.intelligence = args.intelligence;
|
|
346
|
+
this.runner = args.runner;
|
|
347
|
+
this.lockTtlSeconds = args.lockTtlSeconds ?? 20;
|
|
348
|
+
this.lockHeartbeatIntervalSeconds = args.lockHeartbeatIntervalSeconds ?? 15;
|
|
349
|
+
this.lockKeyPrefix = args.lockKeyPrefix;
|
|
152
350
|
this.channels = args.channels;
|
|
153
351
|
this.log = args.log;
|
|
154
|
-
this.activateChannel = args.activateChannel ?? ((config, channel) => defaultActivateChannel(config, channel, void 0, this.log
|
|
352
|
+
this.activateChannel = args.activateChannel ?? ((config, channel) => defaultActivateChannel(config, channel, void 0, this.log, this.runner ? {
|
|
353
|
+
runner: this.runner,
|
|
354
|
+
intelligence: this.intelligence,
|
|
355
|
+
lockTtlSeconds: this.lockTtlSeconds,
|
|
356
|
+
lockHeartbeatIntervalSeconds: this.lockHeartbeatIntervalSeconds,
|
|
357
|
+
...this.lockKeyPrefix !== void 0 ? { lockKeyPrefix: this.lockKeyPrefix } : {}
|
|
358
|
+
} : void 0));
|
|
155
359
|
this.mintRuntimeInstanceId = args.mintRuntimeInstanceId ?? (() => `rti_${(0, node_crypto.randomUUID)().replace(/-/g, "")}`);
|
|
156
360
|
this.stopHandleTimeoutMs = args.stopHandleTimeoutMs ?? DEFAULT_STOP_HANDLE_TIMEOUT_MS;
|
|
361
|
+
this.reconnectLogIntervalMs = args.reconnectLogIntervalMs ?? DEFAULT_RECONNECT_LOG_INTERVAL_MS;
|
|
157
362
|
}
|
|
158
363
|
/**
|
|
159
364
|
* Start activation of every declared Channel (lazy + idempotent). Mints a
|
|
@@ -411,8 +616,7 @@ var ChannelManager = class {
|
|
|
411
616
|
*
|
|
412
617
|
* - `reconnecting` → status `reconnecting` (dropped, Phoenix retrying);
|
|
413
618
|
* - `online` → status `online` (rejoined, sendable again);
|
|
414
|
-
* - `gave_up` → status `error` (dead after the bounded reconnect window)
|
|
415
|
-
* - `fenced` → status `error` immediately (another activation superseded it).
|
|
619
|
+
* - `gave_up` → status `error` (dead after the bounded reconnect window).
|
|
416
620
|
*
|
|
417
621
|
* Makes NO re-activation — reconnection is delegated to the Phoenix connection
|
|
418
622
|
* layer (see {@link ChannelManager}), which auto-rejoins under the persistent
|
|
@@ -424,23 +628,55 @@ var ChannelManager = class {
|
|
|
424
628
|
* @param entry - The Channel's activation entry.
|
|
425
629
|
*/
|
|
426
630
|
registerConnectionObserver(name, entry) {
|
|
427
|
-
entry.handle?.onStateChange?.((state) => {
|
|
631
|
+
entry.handle?.onStateChange?.((state, detail) => {
|
|
428
632
|
if (this.stopped || entry.status === "stopped") return;
|
|
633
|
+
const cause = detail?.reason ?? detail?.code;
|
|
634
|
+
const because = cause !== void 0 ? ` — ${cause}` : "";
|
|
429
635
|
if (state === "reconnecting") {
|
|
430
636
|
entry.status = "reconnecting";
|
|
431
|
-
|
|
637
|
+
entry.downSince ??= Date.now();
|
|
638
|
+
this.log?.(`channel "${name}" managed session dropped; reconnecting (Phoenix auto-rejoin)${because}`);
|
|
639
|
+
this.startReconnectLog(name, entry);
|
|
432
640
|
} else if (state === "online") {
|
|
433
641
|
entry.status = "online";
|
|
642
|
+
this.clearReconnectLog(entry);
|
|
643
|
+
entry.downSince = void 0;
|
|
434
644
|
this.log?.(`channel "${name}" managed session back online`);
|
|
435
645
|
} else if (state === "gave_up") {
|
|
436
646
|
entry.status = "error";
|
|
437
|
-
this.log?.(`channel "${name}" managed session gave up reconnecting; marking error`);
|
|
438
|
-
} else {
|
|
439
|
-
entry.status = "error";
|
|
440
|
-
this.log?.(`channel "${name}" managed session was generation-fenced by a replacement; marking error`);
|
|
647
|
+
this.log?.(`channel "${name}" managed session gave up reconnecting after ${this.downFor(entry)}; marking error (still retrying — a successful rejoin restores online)${because}`);
|
|
441
648
|
}
|
|
442
649
|
});
|
|
443
650
|
}
|
|
651
|
+
/** Rendered downtime for this outage episode (`"45s"`), or `"unknown"`. */
|
|
652
|
+
downFor(entry) {
|
|
653
|
+
return entry.downSince === void 0 ? "unknown" : `${Math.round((Date.now() - entry.downSince) / 1e3)}s`;
|
|
654
|
+
}
|
|
655
|
+
/**
|
|
656
|
+
* Repeat a "still down" line for as long as this outage lasts. Runs THROUGH
|
|
657
|
+
* `gave_up` on purpose: that transition is where the old behavior went quiet,
|
|
658
|
+
* and an operator watching a silent process cannot tell a dead bot from an
|
|
659
|
+
* idle one.
|
|
660
|
+
*/
|
|
661
|
+
startReconnectLog(name, entry) {
|
|
662
|
+
if (entry.reconnectLogTimer !== void 0) return;
|
|
663
|
+
const timer = setInterval(() => {
|
|
664
|
+
if (this.stopped || entry.status === "stopped") {
|
|
665
|
+
this.clearReconnectLog(entry);
|
|
666
|
+
return;
|
|
667
|
+
}
|
|
668
|
+
this.log?.(`channel "${name}" managed session still down after ${this.downFor(entry)}; Phoenix is retrying`);
|
|
669
|
+
}, this.reconnectLogIntervalMs);
|
|
670
|
+
timer.unref?.();
|
|
671
|
+
entry.reconnectLogTimer = timer;
|
|
672
|
+
}
|
|
673
|
+
/** Stop this entry's "still down" repeat, if one is running. */
|
|
674
|
+
clearReconnectLog(entry) {
|
|
675
|
+
if (entry.reconnectLogTimer !== void 0) {
|
|
676
|
+
clearInterval(entry.reconnectLogTimer);
|
|
677
|
+
entry.reconnectLogTimer = void 0;
|
|
678
|
+
}
|
|
679
|
+
}
|
|
444
680
|
/**
|
|
445
681
|
* Drive a single entry to its terminal `stopped` state, tearing down its
|
|
446
682
|
* handle AT MOST ONCE. Idempotent: it always sets `status = "stopped"`, and
|
|
@@ -478,6 +714,7 @@ var ChannelManager = class {
|
|
|
478
714
|
*/
|
|
479
715
|
async stopEntry(entry) {
|
|
480
716
|
entry.status = "stopped";
|
|
717
|
+
this.clearReconnectLog(entry);
|
|
481
718
|
if (entry.handle && !entry.handleStopped) {
|
|
482
719
|
entry.handleStopped = true;
|
|
483
720
|
const handle = entry.handle;
|