@eddyskywalker/dsh-chatgpt-subscription 1.4.0 → 1.5.0
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/lib/client.js +8 -3
- package/lib/client.js.map +1 -1
- package/lib/codemode.js +70 -6
- package/lib/index.js +225 -109
- package/lib/{tool-result-pruner-CuKHwU2R.js → tool-result-pruner-Duw9-Gwo.js} +381 -127
- package/lib/tool-result-pruner.js +1 -1
- package/lib/types/client/locales-ru/grok.d.ts.map +1 -1
- package/lib/types/client/providers/grok/locales.d.ts +3 -1
- package/lib/types/client/providers/grok/locales.d.ts.map +1 -1
- package/lib/types/compat.d.ts +1 -1
- package/lib/types/host/common/model-facts-data.d.ts +4 -0
- package/lib/types/host/common/model-facts-data.d.ts.map +1 -0
- package/lib/types/host/common/model-facts.d.ts +41 -0
- package/lib/types/host/common/model-facts.d.ts.map +1 -0
- package/lib/types/host/common/prompt-cache-policy.d.ts.map +1 -1
- package/lib/types/host/providers/glm-coding-plan/model-catalog.d.ts +9 -11
- package/lib/types/host/providers/glm-coding-plan/model-catalog.d.ts.map +1 -1
- package/lib/types/host/providers/grok/model-catalog.d.ts +5 -1
- package/lib/types/host/providers/grok/model-catalog.d.ts.map +1 -1
- package/lib/types/host/providers/minimax-code/mapper.d.ts.map +1 -1
- package/lib/types/host/providers/minimax-code/model-catalog.d.ts +17 -11
- package/lib/types/host/providers/minimax-code/model-catalog.d.ts.map +1 -1
- package/lib/types/host/providers/qoder/mapper.d.ts +0 -25
- package/lib/types/host/providers/qoder/mapper.d.ts.map +1 -1
- package/lib/types/host/providers/qoder/model-catalog.d.ts.map +1 -1
- package/lib/types/host/providers/step-code/model-catalog.d.ts.map +1 -1
- package/lib/types/host/providers/workbuddy/model-catalog.d.ts.map +1 -1
- package/lib/types/host/runtime/codemode/transport.d.ts +4 -3
- package/lib/types/host/runtime/codemode/transport.d.ts.map +1 -1
- package/lib/types/host/runtime/deepseek-v41-flash/discipline.d.ts.map +1 -1
- package/lib/types/host/runtime/deepseek-v41-flash/index.d.ts +2 -2
- package/lib/types/host/runtime/deepseek-v41-flash/index.d.ts.map +1 -1
- package/lib/types/host/runtime/deepseek-v41-flash/match.d.ts.map +1 -1
- package/lib/types/host/runtime/deepseek-v41-flash/state-anchor.d.ts +4 -0
- package/lib/types/host/runtime/deepseek-v41-flash/state-anchor.d.ts.map +1 -1
- package/lib/types/host/runtime/open-models/identity.d.ts +6 -0
- package/lib/types/host/runtime/open-models/identity.d.ts.map +1 -0
- package/lib/types/host/runtime/open-models/index.d.ts +4 -5
- package/lib/types/host/runtime/open-models/index.d.ts.map +1 -1
- package/lib/types/host/runtime/open-models/profiles.d.ts +10 -22
- package/lib/types/host/runtime/open-models/profiles.d.ts.map +1 -1
- package/lib/types/host/runtime/open-models/state-anchor.d.ts.map +1 -1
- package/lib/types/shared/grok-contracts.d.ts +1 -1
- package/lib/types/shared/grok-contracts.d.ts.map +1 -1
- package/package.json +1 -1
package/lib/codemode.js
CHANGED
|
@@ -1016,9 +1016,10 @@ function createCodemodeRootRegistry(rules, hooks) {
|
|
|
1016
1016
|
* ## 与内核 PTC `run_code` 对齐的使用配置
|
|
1017
1017
|
*
|
|
1018
1018
|
* 1. **运行时感知 Schema**:按 `ptcRuntime` 的语言(TypeScript / Python)、程序形态
|
|
1019
|
-
* (`function-body` / 常驻 REPL
|
|
1020
|
-
*
|
|
1021
|
-
*
|
|
1019
|
+
* (`function-body` / 常驻 REPL)与沙箱支持动态投影描述和参数。模型可见参数为必填的
|
|
1020
|
+
* `code`、可选的 `description` / `timeoutMs`,以及单次提权的 `sandbox_permissions` +
|
|
1021
|
+
* `justification`;只发元数据时返回可恢复的 `missing_code` 回执,不执行程序。
|
|
1022
|
+
* 同一部署下静态恒定,不会扰动前缀缓存。
|
|
1022
1023
|
* 2. **完整子调用调度与上下文转发**:只读并发上限受 `maxParallelSubCalls` 约束,写类调用等待
|
|
1023
1024
|
* 在飞调用排空后独占执行;程序结算时中止悬空请求并等待已启动子调用落盘;子调用产生的图片块、
|
|
1024
1025
|
* `additionalContexts` 与 `concludesTurn` 原样转交给外层步骤。
|
|
@@ -1201,7 +1202,7 @@ function substituteProgramImages(value, images, toProgramImage) {
|
|
|
1201
1202
|
}
|
|
1202
1203
|
function buildFlavor(languageName, execution) {
|
|
1203
1204
|
return {
|
|
1204
|
-
description: `Execute a ${languageName} program against the available tools. Takes
|
|
1205
|
+
description: `Execute a ${languageName} program against the available tools. Takes one required argument: \`code\`, ${execution.programDescription}. Optional \`description\` is a short UI summary; optional \`timeoutMs\` sets the elapsed-time budget for this call. Call tools as \`await tools.name(args)\`. ${execution.outputInstruction} Image-bearing subtool results are attached after the run.`,
|
|
1205
1206
|
codeDescription: execution.codeDescription
|
|
1206
1207
|
};
|
|
1207
1208
|
}
|
|
@@ -1234,7 +1235,7 @@ function escalationGuidance(sandboxMode) {
|
|
|
1234
1235
|
function buildTransportDescription(runtime) {
|
|
1235
1236
|
const flavor = resolveFlavor(runtime);
|
|
1236
1237
|
const instructions = typeof runtime?.executionInstructions === "string" && runtime.executionInstructions.length > 0 ? ` ${runtime.executionInstructions}` : "";
|
|
1237
|
-
return flavor.description + instructions + " Every call must include a non-empty `code` program; `description`
|
|
1238
|
+
return flavor.description + instructions + " Every call must include a non-empty `code` program; `description` and `timeoutMs` are optional metadata and never a substitute. Each program starts in the Session's current directory. Running programs keep their initial directory." + escalationGuidance(runtime?.sandboxMode);
|
|
1238
1239
|
}
|
|
1239
1240
|
function buildTransportParameters(runtime) {
|
|
1240
1241
|
const flavor = resolveFlavor(runtime);
|
|
@@ -1267,7 +1268,7 @@ function buildTransportParameters(runtime) {
|
|
|
1267
1268
|
return {
|
|
1268
1269
|
type: "object",
|
|
1269
1270
|
additionalProperties: false,
|
|
1270
|
-
required: ["code"
|
|
1271
|
+
required: ["code"],
|
|
1271
1272
|
properties
|
|
1272
1273
|
};
|
|
1273
1274
|
}
|
|
@@ -1354,6 +1355,12 @@ function createTransportDefinition(host, rules) {
|
|
|
1354
1355
|
title: directFile.description ?? "Run a file tool",
|
|
1355
1356
|
kind: "execute"
|
|
1356
1357
|
};
|
|
1358
|
+
const metadataOnly = metadataOnlyCallOf(args);
|
|
1359
|
+
if (metadataOnly !== void 0) return {
|
|
1360
|
+
card: "generic",
|
|
1361
|
+
title: metadataOnly.description ?? "code program",
|
|
1362
|
+
kind: "execute"
|
|
1363
|
+
};
|
|
1357
1364
|
try {
|
|
1358
1365
|
const input = readArguments(args);
|
|
1359
1366
|
return {
|
|
@@ -1369,6 +1376,8 @@ function createTransportDefinition(host, rules) {
|
|
|
1369
1376
|
async execute(args, exec) {
|
|
1370
1377
|
const directShell = directShellCallOf(args);
|
|
1371
1378
|
const directFile = directShell === void 0 ? directFileCallOf(args) : void 0;
|
|
1379
|
+
const metadataOnly = directShell === void 0 && directFile === void 0 ? metadataOnlyCallOf(args) : void 0;
|
|
1380
|
+
if (metadataOnly !== void 0) return metadataOnlyOutput(metadataOnly);
|
|
1372
1381
|
const input = directShell !== void 0 ? readShellArguments(directShell) : directFile !== void 0 ? readFileArguments(directFile) : readArguments(args);
|
|
1373
1382
|
const runtime = host.runtime();
|
|
1374
1383
|
if (runtime === void 0) throw new CodemodeContextUnavailableError("codemode: no PTC runtime is mounted (ctx.ptcRuntime); the program transport is unavailable");
|
|
@@ -1975,6 +1984,14 @@ const DIRECT_META_KEYS = /* @__PURE__ */ new Set([
|
|
|
1975
1984
|
const NARRATION_TITLE_KEY = "title";
|
|
1976
1985
|
/** 见 {@link NARRATION_TITLE_KEY}。 */
|
|
1977
1986
|
const NARRATION_MESSAGE_KEY = "message";
|
|
1987
|
+
/** 只有这些字段、没有程序的调用:当作可恢复的缺参,不当执行失败。 */
|
|
1988
|
+
const METADATA_ONLY_KEYS = /* @__PURE__ */ new Set([
|
|
1989
|
+
"description",
|
|
1990
|
+
"desc",
|
|
1991
|
+
"summary",
|
|
1992
|
+
"timeoutMs",
|
|
1993
|
+
"timeout_ms"
|
|
1994
|
+
]);
|
|
1978
1995
|
/** 回显原始参数时最多带多少字符。 */
|
|
1979
1996
|
const RAW_EXCERPT_LIMIT = 120;
|
|
1980
1997
|
/** 一个值是不是普通对象。 */
|
|
@@ -2413,6 +2430,53 @@ function keysOf(fragments) {
|
|
|
2413
2430
|
}
|
|
2414
2431
|
return [...keys];
|
|
2415
2432
|
}
|
|
2433
|
+
/**
|
|
2434
|
+
* 识别「只发了调用元数据、没有程序」的入参。
|
|
2435
|
+
*
|
|
2436
|
+
* 这是模型把 `code_run` 当成计划播报通道时的真实形状(当前会话里 7 次调用只带
|
|
2437
|
+
* `description` + `timeoutMs`)。字段仍然对模型可见,但这条调用不能算执行失败:
|
|
2438
|
+
* 它没有副作用,也没有可运行的程序;返回一条可恢复的 `missing_code` 回执,让模型
|
|
2439
|
+
* 在下一步补上 `code`,而不是在界面上留下一次红色输入错误。
|
|
2440
|
+
*
|
|
2441
|
+
* @param args - 工具收到的原始参数。
|
|
2442
|
+
* @returns 元数据调用;含程序、文件或 Shell 语义时返回 `undefined`。
|
|
2443
|
+
*/
|
|
2444
|
+
function metadataOnlyCallOf(args) {
|
|
2445
|
+
let parsed;
|
|
2446
|
+
try {
|
|
2447
|
+
parsed = parseArguments(args);
|
|
2448
|
+
} catch {
|
|
2449
|
+
return;
|
|
2450
|
+
}
|
|
2451
|
+
const record = parsed.record;
|
|
2452
|
+
if (codeOf(record) !== void 0) return void 0;
|
|
2453
|
+
if (stringOf(record["command"]) !== void 0) return void 0;
|
|
2454
|
+
const keys = Object.keys(record);
|
|
2455
|
+
if (keys.length === 0 || keys.some((key) => !METADATA_ONLY_KEYS.has(key))) return void 0;
|
|
2456
|
+
const description = stringOf(record["description"])?.trim() ?? stringOf(record["desc"])?.trim() ?? stringOf(record["summary"])?.trim();
|
|
2457
|
+
const rawTimeout = record["timeoutMs"] ?? record["timeout_ms"];
|
|
2458
|
+
if (rawTimeout !== void 0 && (typeof rawTimeout !== "number" || !Number.isFinite(rawTimeout) || rawTimeout <= 0)) return void 0;
|
|
2459
|
+
if (description === void 0 && rawTimeout === void 0) return void 0;
|
|
2460
|
+
return {
|
|
2461
|
+
...description === void 0 ? {} : { description },
|
|
2462
|
+
...rawTimeout === void 0 ? {} : { timeoutMs: rawTimeout },
|
|
2463
|
+
keys
|
|
2464
|
+
};
|
|
2465
|
+
}
|
|
2466
|
+
/** 只报元数据、不执行的调用回执:成功返回,但明确标记 `executed: false`。 */
|
|
2467
|
+
function metadataOnlyOutput(call) {
|
|
2468
|
+
return {
|
|
2469
|
+
logs: [],
|
|
2470
|
+
result: {
|
|
2471
|
+
status: "missing_code",
|
|
2472
|
+
executed: false,
|
|
2473
|
+
message: "No program was executed because `code` was missing. `description` and `timeoutMs` are optional metadata; put the actual program in `code` and resend once.",
|
|
2474
|
+
required: ["code"],
|
|
2475
|
+
optional: ["description", "timeoutMs"],
|
|
2476
|
+
receivedKeys: call.keys
|
|
2477
|
+
}
|
|
2478
|
+
};
|
|
2479
|
+
}
|
|
2416
2480
|
/** 校验并读出工具参数。 */
|
|
2417
2481
|
function readArguments(args) {
|
|
2418
2482
|
const parsed = parseArguments(args);
|