@code-yeongyu/senpi-ai 2026.9.13 → 2026.9.15
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/api/devin-agent/discovery.d.ts.map +1 -1
- package/dist/api/devin-agent/discovery.js +5 -11
- package/dist/api/devin-agent/discovery.js.map +1 -1
- package/dist/api/devin-agent.lazy.d.ts +2 -0
- package/dist/api/devin-agent.lazy.d.ts.map +1 -1
- package/dist/api/devin-agent.lazy.js +6 -1
- package/dist/api/devin-agent.lazy.js.map +1 -1
- package/dist/api/openai-codex-responses.d.ts.map +1 -1
- package/dist/api/openai-codex-responses.js +55 -17
- package/dist/api/openai-codex-responses.js.map +1 -1
- package/dist/api/openai-responses-shared.d.ts.map +1 -1
- package/dist/api/openai-responses-shared.js +2 -1
- package/dist/api/openai-responses-shared.js.map +1 -1
- package/dist/api/openai-responses.d.ts +2 -1
- package/dist/api/openai-responses.d.ts.map +1 -1
- package/dist/api/openai-responses.js +9 -0
- package/dist/api/openai-responses.js.map +1 -1
- package/dist/api/responses-completion-grace.d.ts +30 -0
- package/dist/api/responses-completion-grace.d.ts.map +1 -0
- package/dist/api/responses-completion-grace.js +94 -0
- package/dist/api/responses-completion-grace.js.map +1 -0
- package/dist/api/websocket-liveness.d.ts +48 -0
- package/dist/api/websocket-liveness.d.ts.map +1 -0
- package/dist/api/websocket-liveness.js +104 -0
- package/dist/api/websocket-liveness.js.map +1 -0
- package/dist/devin-provider.d.ts +6 -0
- package/dist/devin-provider.d.ts.map +1 -0
- package/dist/devin-provider.js +4 -0
- package/dist/devin-provider.js.map +1 -0
- package/dist/providers/data/.manifest.json +1 -1
- package/dist/providers/data/fireworks.json +1 -1
- package/dist/providers/data/kimi-coding.json +1 -1
- package/dist/providers/data/nvidia.json +1 -1
- package/dist/providers/data/openrouter.json +1 -1
- package/dist/providers/data/qwen-token-plan-cn.json +1 -1
- package/dist/providers/data/together.json +1 -1
- package/dist/providers/data/vercel-ai-gateway.json +1 -1
- package/dist/providers/devin.d.ts.map +1 -1
- package/dist/providers/devin.js +7 -1
- package/dist/providers/devin.js.map +1 -1
- package/dist/providers/devin.models.d.ts.map +1 -1
- package/dist/providers/devin.models.js +6 -1
- package/dist/providers/devin.models.js.map +1 -1
- package/dist/utils/retry.d.ts.map +1 -1
- package/dist/utils/retry.js +7 -3
- package/dist/utils/retry.js.map +1 -1
- package/package.json +10 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../../../src/api/devin-agent/discovery.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EACN,KAAK,iBAAiB,EAKtB,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../../../src/api/devin-agent/discovery.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EACN,KAAK,iBAAiB,EAKtB,MAAM,qBAAqB,CAAC;AAqB7B,MAAM,WAAW,qBAAqB;IACrC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,WAAW,CAAC;CACrB;AAED,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,EAAE,GAAG,SAAS,CAAC,CAwBlH;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,SAAS,iBAAiB,EAAE,EAAE,OAAO,EAAE,MAAM,GAAG,KAAK,CAAC,aAAa,CAAC,EAAE,CAcnH"}
|
|
@@ -23,8 +23,6 @@ const INTERNAL_DISPLAYS = new Set([
|
|
|
23
23
|
* `ChatMessagePrompt.images` (verified live on SWE-1.6 and SWE-1.6 Fast).
|
|
24
24
|
*/
|
|
25
25
|
const IMAGE_BLIND_UIDS = new Set(["swe-1-6", "swe-1-6-fast"]);
|
|
26
|
-
const REASONING_LABEL = /think|thinking|minimal|high|medium|low|xhigh|max|reasoning/i;
|
|
27
|
-
const NO_REASONING_LABEL = /\bno thinking\b/i;
|
|
28
26
|
export async function fetchDevinModels(options) {
|
|
29
27
|
const baseUrl = (options.baseUrl ?? DEVIN_DEFAULT_BASE_URL).replace(/\/+$/, "");
|
|
30
28
|
const controller = new AbortController();
|
|
@@ -83,7 +81,11 @@ function toModel(config, uid, baseUrl, isRouter) {
|
|
|
83
81
|
api: "devin-agent",
|
|
84
82
|
provider: "devin",
|
|
85
83
|
baseUrl,
|
|
86
|
-
|
|
84
|
+
// The catalog's supportsThinking flag (and effort-sounding labels) describe
|
|
85
|
+
// whether the lane produces thinking output, not whether the client may pick
|
|
86
|
+
// a level: Cascade has no request-side thinking field, so the effort baked into
|
|
87
|
+
// the lane uid is the only control and a generic level is never forwarded.
|
|
88
|
+
reasoning: false,
|
|
87
89
|
input: supportsImages ? ["text", "image"] : ["text"],
|
|
88
90
|
cost: costOf(config),
|
|
89
91
|
contextWindow: config.maxTokens > 0 ? config.maxTokens : DEFAULT_CONTEXT_WINDOW,
|
|
@@ -91,14 +93,6 @@ function toModel(config, uid, baseUrl, isRouter) {
|
|
|
91
93
|
...(Object.keys(compat).length > 0 ? { compat } : {}),
|
|
92
94
|
};
|
|
93
95
|
}
|
|
94
|
-
function supportsThinking(config) {
|
|
95
|
-
const features = config.modelInfo?.modelFeatures;
|
|
96
|
-
if (features !== undefined)
|
|
97
|
-
return features.supportsThinking;
|
|
98
|
-
if (NO_REASONING_LABEL.test(config.label))
|
|
99
|
-
return false;
|
|
100
|
-
return REASONING_LABEL.test(config.label);
|
|
101
|
-
}
|
|
102
96
|
/** Per-million rates from the cost dimensions; Devin bills cache writes at the input rate, so cacheWrite stays 0. */
|
|
103
97
|
function costOf(config) {
|
|
104
98
|
const cost = { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discovery.js","sourceRoot":"","sources":["../../../src/api/devin-agent/discovery.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAEN,aAAa,EACb,+BAA+B,EAC/B,gCAAgC,EAChC,kBAAkB,GAClB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,4BAA4B,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAClF,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,MAAM,oBAAoB,GAAG,KAAK,CAAC;AACnC,MAAM,sBAAsB,GAAG,OAAO,CAAC;AACvC,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAElC,sFAAsF;AACtF,MAAM,iBAAiB,GAA+B,IAAI,GAAG,CAAC;IAC7D,aAAa,CAAC,YAAY;IAC1B,aAAa,CAAC,gBAAgB;CAC9B,CAAC,CAAC;AAEH;;;GAGG;AACH,MAAM,gBAAgB,GAAwB,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC,CAAC;AAEnF,MAAM,eAAe,GAAG,6DAA6D,CAAC;AACtF,MAAM,kBAAkB,GAAG,kBAAkB,CAAC;AAS9C,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,OAA8B;IACpE,MAAM,OAAO,GAAG,CAAC,OAAO,CAAC,OAAO,IAAI,sBAAsB,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAChF,MAAM,UAAU,GAAG,IAAI,eAAe,EAAE,CAAC;IACzC,MAAM,OAAO,GAAG,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;IACzC,OAAO,CAAC,MAAM,EAAE,gBAAgB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C,CAAC,CAAC,CAAC;IAC9E,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC;IACxC,OAAO,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;AACxC,CAAC","sourcesContent":["/**\n * Cascade model discovery.\n *\n * `GetCliModelConfigs` is credential-scoped: it reports the models the signed-in\n * account may actually use, which differs per plan and per rollout. A failed or\n * empty response therefore returns undefined so callers KEEP their static seed\n * instead of publishing an empty catalog.\n */\n\nimport type { Model } from \"../../types.ts\";\nimport {\n\ttype ClientModelConfig,\n\tDisplayOption,\n\tGetCliModelConfigsRequestSchema,\n\tGetCliModelConfigsResponseSchema,\n\tModelDimensionKind,\n} from \"./gen/cascade_pb.ts\";\nimport { devinDiscoveryMetadata } from \"./metadata.ts\";\nimport { DEVIN_CLI_MODEL_CONFIGS_PATH, DEVIN_DEFAULT_BASE_URL } from \"./paths.ts\";\nimport { postDevinUnary } from \"./unary.ts\";\n\nconst DISCOVERY_TIMEOUT_MS = 5_000;\nconst DEFAULT_CONTEXT_WINDOW = 200_000;\nconst DEFAULT_MAX_TOKENS = 64_000;\n\n/** Slots requested for parity with the native client but never surfaced as models. */\nconst INTERNAL_DISPLAYS: ReadonlySet<DisplayOption> = new Set([\n\tDisplayOption.QUICK_REVIEW,\n\tDisplayOption.INTERNAL_DEFAULT,\n]);\n\n/**\n * Lanes whose configs advertise image support while the backend silently drops\n * `ChatMessagePrompt.images` (verified live on SWE-1.6 and SWE-1.6 Fast).\n */\nconst IMAGE_BLIND_UIDS: ReadonlySet<string> = new Set([\"swe-1-6\", \"swe-1-6-fast\"]);\n\nconst REASONING_LABEL = /think|thinking|minimal|high|medium|low|xhigh|max|reasoning/i;\nconst NO_REASONING_LABEL = /\\bno thinking\\b/i;\n\nexport interface DevinDiscoveryOptions {\n\tapiKey: string | undefined;\n\tbaseUrl?: string;\n\ttimeoutMs?: number;\n\tsignal?: AbortSignal;\n}\n\nexport async function fetchDevinModels(options: DevinDiscoveryOptions): Promise<Model<\"devin-agent\">[] | undefined> {\n\tconst baseUrl = (options.baseUrl ?? DEVIN_DEFAULT_BASE_URL).replace(/\\/+$/, \"\");\n\tconst controller = new AbortController();\n\tconst onAbort = () => controller.abort();\n\toptions.signal?.addEventListener(\"abort\", onAbort, { once: true });\n\tconst timeout = setTimeout(() => controller.abort(), options.timeoutMs ?? DISCOVERY_TIMEOUT_MS);\n\n\ttry {\n\t\tconst response = await postDevinUnary({\n\t\t\tbaseUrl,\n\t\t\tpath: DEVIN_CLI_MODEL_CONFIGS_PATH,\n\t\t\trequestSchema: GetCliModelConfigsRequestSchema,\n\t\t\trequest: { metadata: devinDiscoveryMetadata(options.apiKey) },\n\t\t\tresponseSchema: GetCliModelConfigsResponseSchema,\n\t\t\tsignal: controller.signal,\n\t\t});\n\t\tconst models = normalizeDevinModels(response.clientModelConfigs, baseUrl);\n\t\treturn models.length > 0 ? models : undefined;\n\t} catch {\n\t\treturn undefined;\n\t} finally {\n\t\tclearTimeout(timeout);\n\t\toptions.signal?.removeEventListener(\"abort\", onAbort);\n\t}\n}\n\nexport function normalizeDevinModels(configs: readonly ClientModelConfig[], baseUrl: string): Model<\"devin-agent\">[] {\n\tconst seen = new Set<string>();\n\tconst models: Model<\"devin-agent\">[] = [];\n\tfor (const config of configs) {\n\t\tif (config.disabled) continue;\n\t\tconst display = config.modelInfo?.displayOption ?? DisplayOption.UNSPECIFIED;\n\t\tif (INTERNAL_DISPLAYS.has(display)) continue;\n\t\tconst uid = config.modelUid.trim();\n\t\tif (!uid || seen.has(uid)) continue;\n\t\tseen.add(uid);\n\t\tconst isRouter = display === DisplayOption.MODEL_ROUTER || config.modelInfo?.isModelRouter === true;\n\t\tmodels.push(toModel(config, uid, baseUrl, isRouter));\n\t}\n\treturn models.sort((a, b) => a.id.localeCompare(b.id));\n}\n\nfunction toModel(config: ClientModelConfig, uid: string, baseUrl: string, isRouter: boolean): Model<\"devin-agent\"> {\n\tconst features = config.modelInfo?.modelFeatures;\n\tconst supportsImages = (features ? features.supportsImages : config.supportsImages) && !IMAGE_BLIND_UIDS.has(uid);\n\tconst maxOutputTokens = config.modelInfo?.maxOutputTokens ?? 0;\n\tconst compat = {\n\t\t...(isRouter ? { modelRouter: true } : {}),\n\t\t...(features?.supportsParallelToolCalls === true ? { supportsParallelToolCalls: true } : {}),\n\t};\n\treturn {\n\t\tid: uid,\n\t\tname: config.label.trim() || uid,\n\t\tapi: \"devin-agent\",\n\t\tprovider: \"devin\",\n\t\tbaseUrl,\n\t\treasoning: supportsThinking(config),\n\t\tinput: supportsImages ? [\"text\", \"image\"] : [\"text\"],\n\t\tcost: costOf(config),\n\t\tcontextWindow: config.maxTokens > 0 ? config.maxTokens : DEFAULT_CONTEXT_WINDOW,\n\t\tmaxTokens: maxOutputTokens > 0 ? maxOutputTokens : DEFAULT_MAX_TOKENS,\n\t\t...(Object.keys(compat).length > 0 ? { compat } : {}),\n\t};\n}\n\nfunction supportsThinking(config: ClientModelConfig): boolean {\n\tconst features = config.modelInfo?.modelFeatures;\n\tif (features !== undefined) return features.supportsThinking;\n\tif (NO_REASONING_LABEL.test(config.label)) return false;\n\treturn REASONING_LABEL.test(config.label);\n}\n\n/** Per-million rates from the cost dimensions; Devin bills cache writes at the input rate, so cacheWrite stays 0. */\nfunction costOf(config: ClientModelConfig): Model<\"devin-agent\">[\"cost\"] {\n\tconst cost = { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 };\n\tfor (const dimension of config.modelDimensions) {\n\t\tif (dimension.kind !== ModelDimensionKind.COST && dimension.kind !== ModelDimensionKind.COST_FUZZY) continue;\n\t\t// Dimension values arrive as protobuf floats (0.1 decodes as 0.10000000149…); round at sub-cent precision.\n\t\tconst perMillion =\n\t\t\tMath.round(((dimension.value * 1_000_000) / denominatorTokens(dimension.denominator)) * 1e6) / 1e6;\n\t\tswitch (dimension.label.trim().toLowerCase()) {\n\t\t\tcase \"input\":\n\t\t\t\tcost.input = perMillion;\n\t\t\t\tbreak;\n\t\t\tcase \"cached input\":\n\t\t\t\tcost.cacheRead = perMillion;\n\t\t\t\tbreak;\n\t\t\tcase \"output\":\n\t\t\t\tcost.output = perMillion;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\t}\n\treturn cost;\n}\n\nconst DENOMINATOR_SCALE: Readonly<Record<string, number>> = { k: 1_000, m: 1_000_000, b: 1_000_000_000 };\n\nfunction denominatorTokens(denominator: string): number {\n\tconst match = /(\\d+(?:\\.\\d+)?)\\s*([kmb])?/i.exec(denominator);\n\tif (!match?.[1]) return 1_000_000;\n\tconst scale = match[2] ? (DENOMINATOR_SCALE[match[2].toLowerCase()] ?? 1) : 1;\n\tconst tokens = Number(match[1]) * scale;\n\treturn tokens > 0 ? tokens : 1_000_000;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"discovery.js","sourceRoot":"","sources":["../../../src/api/devin-agent/discovery.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAEN,aAAa,EACb,+BAA+B,EAC/B,gCAAgC,EAChC,kBAAkB,GAClB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,4BAA4B,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAClF,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,MAAM,oBAAoB,GAAG,KAAK,CAAC;AACnC,MAAM,sBAAsB,GAAG,OAAO,CAAC;AACvC,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAElC,sFAAsF;AACtF,MAAM,iBAAiB,GAA+B,IAAI,GAAG,CAAC;IAC7D,aAAa,CAAC,YAAY;IAC1B,aAAa,CAAC,gBAAgB;CAC9B,CAAC,CAAC;AAEH;;;GAGG;AACH,MAAM,gBAAgB,GAAwB,IAAI,GAAG,CAAC,CAAC,SAAS,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,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9E,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC;IACxC,OAAO,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;AACxC,CAAC","sourcesContent":["/**\n * Cascade model discovery.\n *\n * `GetCliModelConfigs` is credential-scoped: it reports the models the signed-in\n * account may actually use, which differs per plan and per rollout. A failed or\n * empty response therefore returns undefined so callers KEEP their static seed\n * instead of publishing an empty catalog.\n */\n\nimport type { Model } from \"../../types.ts\";\nimport {\n\ttype ClientModelConfig,\n\tDisplayOption,\n\tGetCliModelConfigsRequestSchema,\n\tGetCliModelConfigsResponseSchema,\n\tModelDimensionKind,\n} from \"./gen/cascade_pb.ts\";\nimport { devinDiscoveryMetadata } from \"./metadata.ts\";\nimport { DEVIN_CLI_MODEL_CONFIGS_PATH, DEVIN_DEFAULT_BASE_URL } from \"./paths.ts\";\nimport { postDevinUnary } from \"./unary.ts\";\n\nconst DISCOVERY_TIMEOUT_MS = 5_000;\nconst DEFAULT_CONTEXT_WINDOW = 200_000;\nconst DEFAULT_MAX_TOKENS = 64_000;\n\n/** Slots requested for parity with the native client but never surfaced as models. */\nconst INTERNAL_DISPLAYS: ReadonlySet<DisplayOption> = new Set([\n\tDisplayOption.QUICK_REVIEW,\n\tDisplayOption.INTERNAL_DEFAULT,\n]);\n\n/**\n * Lanes whose configs advertise image support while the backend silently drops\n * `ChatMessagePrompt.images` (verified live on SWE-1.6 and SWE-1.6 Fast).\n */\nconst IMAGE_BLIND_UIDS: ReadonlySet<string> = new Set([\"swe-1-6\", \"swe-1-6-fast\"]);\n\nexport interface DevinDiscoveryOptions {\n\tapiKey: string | undefined;\n\tbaseUrl?: string;\n\ttimeoutMs?: number;\n\tsignal?: AbortSignal;\n}\n\nexport async function fetchDevinModels(options: DevinDiscoveryOptions): Promise<Model<\"devin-agent\">[] | undefined> {\n\tconst baseUrl = (options.baseUrl ?? DEVIN_DEFAULT_BASE_URL).replace(/\\/+$/, \"\");\n\tconst controller = new AbortController();\n\tconst onAbort = () => controller.abort();\n\toptions.signal?.addEventListener(\"abort\", onAbort, { once: true });\n\tconst timeout = setTimeout(() => controller.abort(), options.timeoutMs ?? DISCOVERY_TIMEOUT_MS);\n\n\ttry {\n\t\tconst response = await postDevinUnary({\n\t\t\tbaseUrl,\n\t\t\tpath: DEVIN_CLI_MODEL_CONFIGS_PATH,\n\t\t\trequestSchema: GetCliModelConfigsRequestSchema,\n\t\t\trequest: { metadata: devinDiscoveryMetadata(options.apiKey) },\n\t\t\tresponseSchema: GetCliModelConfigsResponseSchema,\n\t\t\tsignal: controller.signal,\n\t\t});\n\t\tconst models = normalizeDevinModels(response.clientModelConfigs, baseUrl);\n\t\treturn models.length > 0 ? models : undefined;\n\t} catch {\n\t\treturn undefined;\n\t} finally {\n\t\tclearTimeout(timeout);\n\t\toptions.signal?.removeEventListener(\"abort\", onAbort);\n\t}\n}\n\nexport function normalizeDevinModels(configs: readonly ClientModelConfig[], baseUrl: string): Model<\"devin-agent\">[] {\n\tconst seen = new Set<string>();\n\tconst models: Model<\"devin-agent\">[] = [];\n\tfor (const config of configs) {\n\t\tif (config.disabled) continue;\n\t\tconst display = config.modelInfo?.displayOption ?? DisplayOption.UNSPECIFIED;\n\t\tif (INTERNAL_DISPLAYS.has(display)) continue;\n\t\tconst uid = config.modelUid.trim();\n\t\tif (!uid || seen.has(uid)) continue;\n\t\tseen.add(uid);\n\t\tconst isRouter = display === DisplayOption.MODEL_ROUTER || config.modelInfo?.isModelRouter === true;\n\t\tmodels.push(toModel(config, uid, baseUrl, isRouter));\n\t}\n\treturn models.sort((a, b) => a.id.localeCompare(b.id));\n}\n\nfunction toModel(config: ClientModelConfig, uid: string, baseUrl: string, isRouter: boolean): Model<\"devin-agent\"> {\n\tconst features = config.modelInfo?.modelFeatures;\n\tconst supportsImages = (features ? features.supportsImages : config.supportsImages) && !IMAGE_BLIND_UIDS.has(uid);\n\tconst maxOutputTokens = config.modelInfo?.maxOutputTokens ?? 0;\n\tconst compat = {\n\t\t...(isRouter ? { modelRouter: true } : {}),\n\t\t...(features?.supportsParallelToolCalls === true ? { supportsParallelToolCalls: true } : {}),\n\t};\n\treturn {\n\t\tid: uid,\n\t\tname: config.label.trim() || uid,\n\t\tapi: \"devin-agent\",\n\t\tprovider: \"devin\",\n\t\tbaseUrl,\n\t\t// The catalog's supportsThinking flag (and effort-sounding labels) describe\n\t\t// whether the lane produces thinking output, not whether the client may pick\n\t\t// a level: Cascade has no request-side thinking field, so the effort baked into\n\t\t// the lane uid is the only control and a generic level is never forwarded.\n\t\treasoning: false,\n\t\tinput: supportsImages ? [\"text\", \"image\"] : [\"text\"],\n\t\tcost: costOf(config),\n\t\tcontextWindow: config.maxTokens > 0 ? config.maxTokens : DEFAULT_CONTEXT_WINDOW,\n\t\tmaxTokens: maxOutputTokens > 0 ? maxOutputTokens : DEFAULT_MAX_TOKENS,\n\t\t...(Object.keys(compat).length > 0 ? { compat } : {}),\n\t};\n}\n\n/** Per-million rates from the cost dimensions; Devin bills cache writes at the input rate, so cacheWrite stays 0. */\nfunction costOf(config: ClientModelConfig): Model<\"devin-agent\">[\"cost\"] {\n\tconst cost = { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 };\n\tfor (const dimension of config.modelDimensions) {\n\t\tif (dimension.kind !== ModelDimensionKind.COST && dimension.kind !== ModelDimensionKind.COST_FUZZY) continue;\n\t\t// Dimension values arrive as protobuf floats (0.1 decodes as 0.10000000149…); round at sub-cent precision.\n\t\tconst perMillion =\n\t\t\tMath.round(((dimension.value * 1_000_000) / denominatorTokens(dimension.denominator)) * 1e6) / 1e6;\n\t\tswitch (dimension.label.trim().toLowerCase()) {\n\t\t\tcase \"input\":\n\t\t\t\tcost.input = perMillion;\n\t\t\t\tbreak;\n\t\t\tcase \"cached input\":\n\t\t\t\tcost.cacheRead = perMillion;\n\t\t\t\tbreak;\n\t\t\tcase \"output\":\n\t\t\t\tcost.output = perMillion;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\t}\n\treturn cost;\n}\n\nconst DENOMINATOR_SCALE: Readonly<Record<string, number>> = { k: 1_000, m: 1_000_000, b: 1_000_000_000 };\n\nfunction denominatorTokens(denominator: string): number {\n\tconst match = /(\\d+(?:\\.\\d+)?)\\s*([kmb])?/i.exec(denominator);\n\tif (!match?.[1]) return 1_000_000;\n\tconst scale = match[2] ? (DENOMINATOR_SCALE[match[2].toLowerCase()] ?? 1) : 1;\n\tconst tokens = Number(match[1]) * scale;\n\treturn tokens > 0 ? tokens : 1_000_000;\n}\n"]}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { ProviderStreams } from "../types.ts";
|
|
2
|
+
/** Installs the statically bundled implementation in a standalone Bun isolate. */
|
|
3
|
+
export declare function setDevinAgentProviderModule(module: ProviderStreams): void;
|
|
2
4
|
declare const loadDevinAgentModule: () => Promise<ProviderStreams>;
|
|
3
5
|
export declare const devinAgentApi: () => ProviderStreams;
|
|
4
6
|
export { loadDevinAgentModule };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"devin-agent.lazy.d.ts","sourceRoot":"","sources":["../../src/api/devin-agent.lazy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"devin-agent.lazy.d.ts","sourceRoot":"","sources":["../../src/api/devin-agent.lazy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAgBnD,kFAAkF;AAClF,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,eAAe,GAAG,IAAI,CAEzE;AAED,QAAA,MAAM,oBAAoB,QAAa,OAAO,CAAC,eAAe,CACI,CAAC;AAEnE,eAAO,MAAM,aAAa,uBAAsC,CAAC;AACjE,OAAO,EAAE,oBAAoB,EAAE,CAAC"}
|
|
@@ -17,7 +17,12 @@ const importNodeOnlyApi = (specifier) => {
|
|
|
17
17
|
const runtimeSpecifier = import.meta.url.endsWith(".js") ? specifier.replace(/\.ts$/, ".js") : specifier;
|
|
18
18
|
return import(__rewriteRelativeImportExtension(runtimeSpecifier));
|
|
19
19
|
};
|
|
20
|
-
|
|
20
|
+
let devinAgentModuleOverride;
|
|
21
|
+
/** Installs the statically bundled implementation in a standalone Bun isolate. */
|
|
22
|
+
export function setDevinAgentProviderModule(module) {
|
|
23
|
+
devinAgentModuleOverride = module;
|
|
24
|
+
}
|
|
25
|
+
const loadDevinAgentModule = async () => devinAgentModuleOverride ?? importNodeOnlyApi("./devin-agent.ts");
|
|
21
26
|
export const devinAgentApi = () => lazyApi(loadDevinAgentModule);
|
|
22
27
|
export { loadDevinAgentModule };
|
|
23
28
|
//# sourceMappingURL=devin-agent.lazy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"devin-agent.lazy.js","sourceRoot":"","sources":["../../src/api/devin-agent.lazy.ts"],"names":[],"mappings":";;;;;;;;AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC;;;;;GAKG;AACH,MAAM,iBAAiB,GAAG,CAAC,SAAiB,
|
|
1
|
+
{"version":3,"file":"devin-agent.lazy.js","sourceRoot":"","sources":["../../src/api/devin-agent.lazy.ts"],"names":[],"mappings":";;;;;;;;AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC;;;;;GAKG;AACH,MAAM,iBAAiB,GAAG,CAAC,SAAiB,EAA4B,EAAE;IACzE,MAAM,gBAAgB,GAAG,OAAO,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACzG,OAAO,MAAM,kCAAC,gBAAgB,EAAC,CAAC;AACjC,CAAC,CAAC;AAEF,IAAI,wBAAqD,CAAC;AAE1D,kFAAkF;AAClF,MAAM,UAAU,2BAA2B,CAAC,MAAuB;IAClE,wBAAwB,GAAG,MAAM,CAAC;AACnC,CAAC;AAED,MAAM,oBAAoB,GAAG,KAAK,IAA8B,EAAE,CACjE,wBAAwB,IAAI,iBAAiB,CAAC,kBAAkB,CAAC,CAAC;AAEnE,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,EAAE,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC;AACjE,OAAO,EAAE,oBAAoB,EAAE,CAAC","sourcesContent":["import type { ProviderStreams } from \"../types.ts\";\nimport { lazyApi } from \"./lazy.ts\";\n\n/**\n * Loads the devin-agent implementation through a variable specifier so bundlers\n * (browser smoke, Bun compile) cannot follow the import into the Node-only\n * Connect transport. The `.ts`/`.js` rewrite keeps the trick working from both\n * source and built output.\n */\nconst importNodeOnlyApi = (specifier: string): Promise<ProviderStreams> => {\n\tconst runtimeSpecifier = import.meta.url.endsWith(\".js\") ? specifier.replace(/\\.ts$/, \".js\") : specifier;\n\treturn import(runtimeSpecifier);\n};\n\nlet devinAgentModuleOverride: ProviderStreams | undefined;\n\n/** Installs the statically bundled implementation in a standalone Bun isolate. */\nexport function setDevinAgentProviderModule(module: ProviderStreams): void {\n\tdevinAgentModuleOverride = module;\n}\n\nconst loadDevinAgentModule = async (): Promise<ProviderStreams> =>\n\tdevinAgentModuleOverride ?? importNodeOnlyApi(\"./devin-agent.ts\");\n\nexport const devinAgentApi = () => lazyApi(loadDevinAgentModule);\nexport { loadDevinAgentModule };\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openai-codex-responses.d.ts","sourceRoot":"","sources":["../../src/api/openai-codex-responses.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAEX,6BAA6B,EAG7B,MAAM,yCAAyC,C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8B,GAAG,SAAS,CAE/G;AAED,wBAAgB,mCAAmC,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAE5E;AAED,wBAAgB,iCAAiC,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAgB1E"}
|
|
@@ -25,6 +25,7 @@ import { buildCodexReasoning } from "./openai-codex-responses/reasoning.js";
|
|
|
25
25
|
import { applyOpenAICodexCacheAffinityHeaders, clampOpenAIPromptCacheKey } from "./openai-prompt-cache.js";
|
|
26
26
|
import { convertResponsesMessages, convertResponsesTools, processResponsesStream } from "./openai-responses-shared.js";
|
|
27
27
|
import { applyExtraBody, buildBaseOptions, clampMaxForOpenAI, OPENAI_RESPONSES_RESERVED_BODY_KEYS, } from "./simple-options.js";
|
|
28
|
+
import { startWebSocketLiveness } from "./websocket-liveness.js";
|
|
28
29
|
// ============================================================================
|
|
29
30
|
// Configuration
|
|
30
31
|
// ============================================================================
|
|
@@ -682,8 +683,7 @@ export function resetOpenAICodexWebSocketDebugStats(sessionId) {
|
|
|
682
683
|
}
|
|
683
684
|
export function closeOpenAICodexWebSocketSessions(sessionId) {
|
|
684
685
|
const closeEntry = (entry) => {
|
|
685
|
-
|
|
686
|
-
clearTimeout(entry.idleTimer);
|
|
686
|
+
unparkSessionWebSocket(entry);
|
|
687
687
|
closeWebSocketSilently(entry.socket, 1000, "debug_close");
|
|
688
688
|
};
|
|
689
689
|
if (sessionId) {
|
|
@@ -722,6 +722,13 @@ async function getWebSocketConstructor(env) {
|
|
|
722
722
|
url,
|
|
723
723
|
{ ..._opts, ...(proxyUrl ? { proxy: proxyUrl.toString() } : {}) },
|
|
724
724
|
]);
|
|
725
|
+
const innerPing = this.socket.ping;
|
|
726
|
+
if (typeof innerPing === "function") {
|
|
727
|
+
this.ping = (data) => innerPing.call(this.socket, data);
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
get readyState() {
|
|
731
|
+
return getWebSocketReadyState(this.socket);
|
|
725
732
|
}
|
|
726
733
|
close(code, reason) {
|
|
727
734
|
this.socket.close(code, reason);
|
|
@@ -776,20 +783,48 @@ function closeWebSocketSilently(socket, code = 1000, reason = "done") {
|
|
|
776
783
|
}
|
|
777
784
|
catch { }
|
|
778
785
|
}
|
|
779
|
-
function
|
|
786
|
+
function evictSessionWebSocket(sessionId, accountId, entry, reason) {
|
|
787
|
+
unparkSessionWebSocket(entry);
|
|
788
|
+
closeWebSocketSilently(entry.socket, 1000, reason);
|
|
789
|
+
const accountEntries = websocketSessionCache.get(sessionId);
|
|
790
|
+
if (accountEntries?.get(accountId) === entry)
|
|
791
|
+
accountEntries.delete(accountId);
|
|
792
|
+
if (accountEntries?.size === 0)
|
|
793
|
+
websocketSessionCache.delete(sessionId);
|
|
794
|
+
}
|
|
795
|
+
function unparkSessionWebSocket(entry) {
|
|
780
796
|
if (entry.idleTimer) {
|
|
781
797
|
clearTimeout(entry.idleTimer);
|
|
798
|
+
entry.idleTimer = undefined;
|
|
782
799
|
}
|
|
800
|
+
if (entry.parkedCloseListener) {
|
|
801
|
+
entry.socket.removeEventListener("close", entry.parkedCloseListener);
|
|
802
|
+
entry.socket.removeEventListener("error", entry.parkedCloseListener);
|
|
803
|
+
entry.parkedCloseListener = undefined;
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
/**
|
|
807
|
+
* Parks a connection between requests. The idle TTL is the only eviction the
|
|
808
|
+
* cache had; a server or network close while parked must evict immediately,
|
|
809
|
+
* because a WHATWG `send()` on a closed socket discards the frame silently and
|
|
810
|
+
* the next request would then wait out the whole stream-start watchdog.
|
|
811
|
+
*/
|
|
812
|
+
function parkSessionWebSocket(sessionId, accountId, entry) {
|
|
813
|
+
unparkSessionWebSocket(entry);
|
|
814
|
+
entry.busy = false;
|
|
783
815
|
entry.idleTimer = setTimeout(() => {
|
|
784
816
|
if (entry.busy)
|
|
785
817
|
return;
|
|
786
|
-
|
|
787
|
-
const accountEntries = websocketSessionCache.get(sessionId);
|
|
788
|
-
if (accountEntries?.get(accountId) === entry)
|
|
789
|
-
accountEntries.delete(accountId);
|
|
790
|
-
if (accountEntries?.size === 0)
|
|
791
|
-
websocketSessionCache.delete(sessionId);
|
|
818
|
+
evictSessionWebSocket(sessionId, accountId, entry, "idle_timeout");
|
|
792
819
|
}, SESSION_WEBSOCKET_CACHE_TTL_MS);
|
|
820
|
+
const onParkedClose = () => {
|
|
821
|
+
if (entry.busy)
|
|
822
|
+
return;
|
|
823
|
+
evictSessionWebSocket(sessionId, accountId, entry, "parked_close");
|
|
824
|
+
};
|
|
825
|
+
entry.parkedCloseListener = onParkedClose;
|
|
826
|
+
entry.socket.addEventListener("close", onParkedClose);
|
|
827
|
+
entry.socket.addEventListener("error", onParkedClose);
|
|
793
828
|
}
|
|
794
829
|
async function connectWebSocket(url, headers, signal, connectTimeoutMs = DEFAULT_WEBSOCKET_CONNECT_TIMEOUT_MS, env) {
|
|
795
830
|
const WebSocketCtor = await getWebSocketConstructor(env);
|
|
@@ -871,10 +906,7 @@ async function acquireWebSocket(url, headers, sessionId, accountId, signal, conn
|
|
|
871
906
|
let accountEntries = websocketSessionCache.get(sessionId);
|
|
872
907
|
const cached = accountEntries?.get(accountId);
|
|
873
908
|
if (cached) {
|
|
874
|
-
|
|
875
|
-
clearTimeout(cached.idleTimer);
|
|
876
|
-
cached.idleTimer = undefined;
|
|
877
|
-
}
|
|
909
|
+
unparkSessionWebSocket(cached);
|
|
878
910
|
if (!cached.busy && isWebSocketSessionExpired(cached)) {
|
|
879
911
|
closeWebSocketSilently(cached.socket, 1000, "connection_age_limit");
|
|
880
912
|
accountEntries?.delete(accountId);
|
|
@@ -897,8 +929,7 @@ async function acquireWebSocket(url, headers, sessionId, accountId, signal, conn
|
|
|
897
929
|
websocketSessionCache.delete(sessionId);
|
|
898
930
|
return;
|
|
899
931
|
}
|
|
900
|
-
|
|
901
|
-
scheduleSessionWebSocketExpiry(sessionId, accountId, cached);
|
|
932
|
+
parkSessionWebSocket(sessionId, accountId, cached);
|
|
902
933
|
},
|
|
903
934
|
};
|
|
904
935
|
}
|
|
@@ -943,8 +974,7 @@ async function acquireWebSocket(url, headers, sessionId, accountId, signal, conn
|
|
|
943
974
|
websocketSessionCache.delete(sessionId);
|
|
944
975
|
return;
|
|
945
976
|
}
|
|
946
|
-
|
|
947
|
-
scheduleSessionWebSocketExpiry(sessionId, accountId, entry);
|
|
977
|
+
parkSessionWebSocket(sessionId, accountId, entry);
|
|
948
978
|
},
|
|
949
979
|
};
|
|
950
980
|
}
|
|
@@ -1015,7 +1045,14 @@ async function* parseWebSocket(socket, signal, idleTimeoutMs) {
|
|
|
1015
1045
|
pending = null;
|
|
1016
1046
|
resolve();
|
|
1017
1047
|
};
|
|
1048
|
+
const liveness = startWebSocketLiveness(socket, (error) => {
|
|
1049
|
+
failed = error;
|
|
1050
|
+
done = true;
|
|
1051
|
+
closeWebSocketSilently(socket, 1000, "liveness_timeout");
|
|
1052
|
+
wake();
|
|
1053
|
+
});
|
|
1018
1054
|
const onMessage = (event) => {
|
|
1055
|
+
liveness.noteActivity();
|
|
1019
1056
|
void (async () => {
|
|
1020
1057
|
let text = null;
|
|
1021
1058
|
try {
|
|
@@ -1107,6 +1144,7 @@ async function* parseWebSocket(socket, signal, idleTimeoutMs) {
|
|
|
1107
1144
|
}
|
|
1108
1145
|
}
|
|
1109
1146
|
finally {
|
|
1147
|
+
liveness.stop();
|
|
1110
1148
|
socket.removeEventListener("message", onMessage);
|
|
1111
1149
|
socket.removeEventListener("error", onError);
|
|
1112
1150
|
socket.removeEventListener("close", onClose);
|