@eddyskywalker/dsh-chatgpt-subscription 1.0.1 → 1.1.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 +89 -8
- package/lib/client.js.map +1 -1
- package/lib/codemode.js +33 -5
- package/lib/index.js +454 -62
- package/lib/{preset-sync-DWOAwSyl.js → preset-sync-RBsYhDY3.js} +2 -1
- package/lib/{tool-result-pruner-ClgRVOph.js → tool-result-pruner-DsaDg_l1.js} +2 -1
- package/lib/tool-result-pruner.js +1 -1
- package/lib/types/client/features/progress-updates/settings-section.d.ts +2 -2
- package/lib/types/client/locales-ru/qoder.d.ts.map +1 -1
- package/lib/types/client/providers/qoder/QoderComposerQuota.d.ts.map +1 -1
- package/lib/types/client/providers/qoder/QoderSection.d.ts.map +1 -1
- package/lib/types/client/providers/qoder/locales.d.ts +7 -1
- package/lib/types/client/providers/qoder/locales.d.ts.map +1 -1
- package/lib/types/client/providers/qoder/styles.d.ts.map +1 -1
- package/lib/types/client/providers/qoder/useQoderSection.d.ts +15 -0
- package/lib/types/client/providers/qoder/useQoderSection.d.ts.map +1 -1
- package/lib/types/compat.d.ts +1 -1
- package/lib/types/entries/tool-result-pruner.d.ts.map +1 -1
- package/lib/types/host/providers/antigravity-acp/adapter.d.ts.map +1 -1
- package/lib/types/host/providers/qoder/account-affinity.d.ts +16 -0
- package/lib/types/host/providers/qoder/account-affinity.d.ts.map +1 -0
- package/lib/types/host/providers/qoder/account-pool.d.ts +4 -2
- package/lib/types/host/providers/qoder/account-pool.d.ts.map +1 -1
- package/lib/types/host/providers/qoder/adapter.d.ts +15 -0
- package/lib/types/host/providers/qoder/adapter.d.ts.map +1 -1
- package/lib/types/host/providers/qoder/cache-diagnostics.d.ts +20 -0
- package/lib/types/host/providers/qoder/cache-diagnostics.d.ts.map +1 -0
- package/lib/types/host/providers/qoder/cosy.d.ts +12 -5
- package/lib/types/host/providers/qoder/cosy.d.ts.map +1 -1
- package/lib/types/host/providers/qoder/mapper.d.ts +15 -0
- package/lib/types/host/providers/qoder/mapper.d.ts.map +1 -1
- package/lib/types/host/providers/qoder/model-catalog.d.ts +18 -0
- package/lib/types/host/providers/qoder/model-catalog.d.ts.map +1 -1
- package/lib/types/host/providers/qoder/queue-state.d.ts +8 -1
- package/lib/types/host/providers/qoder/queue-state.d.ts.map +1 -1
- package/lib/types/host/providers/qoder/traffic-guard.d.ts +13 -0
- package/lib/types/host/providers/qoder/traffic-guard.d.ts.map +1 -0
- package/lib/types/host/providers/qoder/types.d.ts +6 -6
- package/lib/types/host/providers/qoder/types.d.ts.map +1 -1
- package/lib/types/host/runtime/codemode/rules.d.ts.map +1 -1
- package/lib/types/host/runtime/codemode/transport.d.ts.map +1 -1
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/shared/advisor-contracts.d.ts +9 -2
- package/lib/types/shared/advisor-contracts.d.ts.map +1 -1
- package/lib/types/shared/qoder-contracts.d.ts +30 -1
- package/lib/types/shared/qoder-contracts.d.ts.map +1 -1
- package/package.json +2 -2
package/lib/codemode.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as PLUGIN_MESSAGE_SOURCE_KIND, t as candidatePackageRoots } from "./preset-sync-
|
|
1
|
+
import { c as PLUGIN_MESSAGE_SOURCE_KIND, t as candidatePackageRoots } from "./preset-sync-RBsYhDY3.js";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import * as dshLlm from "@deepseek-ai/dsh-llm";
|
|
4
4
|
import { HarnessError, createUserMessage } from "@deepseek-ai/dsh-llm";
|
|
@@ -655,6 +655,7 @@ function buildCodemodeSectionText(input) {
|
|
|
655
655
|
!python && retained ? "- Only what you pass to inspect(...values) (or a sole final expression when nothing was inspected) reaches the conversation; every intermediate result stays in the program, so filter and aggregate there. Never write a top-level `return` (an early `return` inside `if` is a SyntaxError in the REPL)." : "- Only what you inspect(...values), return, or console.log reaches the conversation; every intermediate result stays in the program, so filter and aggregate there instead of returning raw payloads.",
|
|
656
656
|
"- File, search, and shell tool results are named-field objects, never bare strings — read the field, not the envelope (`job_list` and `list_agents` are the only bare arrays):",
|
|
657
657
|
" `read` → `{ path, offset, lines: [{ number, text }], totalLines }` · `glob` → `{ root, paths }` · `grep` → `{ matches: [{ path, lineNumber, line }] }` · `edit` → `{ path, before, after }` · `write` → `{ path, operation, before, after }` · `bash` / `pwsh` → foreground `{ kind, cwd, exitCode, stdout: { text, truncated }, stderr: { text, truncated } }` (background/promoted variants also exist) · `win_bash` → `{ exitCode, stdout, stderr }` with plain-string streams · `web_fetch` → `{ url, statusCode, body, truncated }` · `job_output` → `{ text, job }` · `read_image` → `{ path, image }` · `skill` → `{ name, content }` · `subagent` → `{ kind, name }`.",
|
|
658
|
+
"- When a result is marked `truncated: true`, its text is an incomplete prefix: do not `JSON.parse` it as a complete payload; fetch a narrower URL, page the endpoint, or request a smaller representation.",
|
|
658
659
|
python ? "- Read the field: `page[\"lines\"]`, `match[\"text\"]`. Calling `.split()`, `.splitlines()` or `in` on the envelope itself is always wrong." : "- Read the field: `r.lines.map((l) => l.text)`. Calling `.map`, `.filter`, `.split` or `in` on the envelope itself is always wrong.",
|
|
659
660
|
"- Anything not listed above (MCP tools, hidden plugin tools) answers with its **declared output schema**: call `" + describeTool + "({ name })` and read the top-level keys before picking a field. One discovery call is far cheaper than the `TypeError` that loses the whole program.",
|
|
660
661
|
"- Discovery returns whole objects too: `" + listTool + "` answers `{ tools: [{ name, description, namespace }] }`, `" + searchTool + "` answers `{ tools: [{ name, namespace, description, parameters, output? }], fallback? }`, and `" + describeTool + "` answers `{ found, name?, namespace?, description?, parameters?, output? }`.",
|
|
@@ -1047,7 +1048,7 @@ function currentCatalogSnapshot() {
|
|
|
1047
1048
|
/** 传输工具名(与 {@link DEFAULT_RUN_TOOL_NAME} 一致,导出方便测试引用)。 */
|
|
1048
1049
|
const TRANSPORT_TOOL_NAME = "code_run";
|
|
1049
1050
|
const TRANSPORT_TOOL_TIMEOUT_MS = 6e5;
|
|
1050
|
-
const ADVISOR_CALL_PATTERN = /\
|
|
1051
|
+
const ADVISOR_CALL_PATTERN = /\bconsult_advisor\b/;
|
|
1051
1052
|
/** 进展汇报工具名:融合参数里救回来的简报用它补发。 */
|
|
1052
1053
|
const PROGRESS_UPDATE_TOOL = "progress_update";
|
|
1053
1054
|
/** 允许单次提权的目标沙箱模式(对齐 `@deepseek-ai/dsh-sandbox` 的 `ESCALATION_TARGETS`)。 */
|
|
@@ -1565,7 +1566,7 @@ function createTransportDefinition(host, rules) {
|
|
|
1565
1566
|
signal: nestedSignal,
|
|
1566
1567
|
mode: runMode
|
|
1567
1568
|
}) ?? untrackRun;
|
|
1568
|
-
const timeoutMs = input.timeoutMs ?? (ADVISOR_CALL_PATTERN.test(sanitizedCode) ?
|
|
1569
|
+
const timeoutMs = input.timeoutMs ?? (ADVISOR_CALL_PATTERN.test(sanitizedCode) ? 6e5 : void 0);
|
|
1569
1570
|
const request = {
|
|
1570
1571
|
program: sanitizedCode,
|
|
1571
1572
|
bindings: [{
|
|
@@ -1991,12 +1992,20 @@ function topLevelJsonObjects(text) {
|
|
|
1991
1992
|
}
|
|
1992
1993
|
return fragments;
|
|
1993
1994
|
}
|
|
1994
|
-
/**
|
|
1995
|
+
/**
|
|
1996
|
+
* 从一个参数对象里读出程序源码。
|
|
1997
|
+
*
|
|
1998
|
+
* `content` 是模型把「写文件」参数误发进 `code_run` 时最常见的键,但也可能真的是
|
|
1999
|
+
* 文件正文。只有它明显像一段程序时才当源码,否则留给调用方报参数错误,绝不执行
|
|
2000
|
+
* 一段普通文本。
|
|
2001
|
+
*/
|
|
1995
2002
|
function codeOf(record) {
|
|
1996
2003
|
for (const key of CODE_KEYS) {
|
|
1997
2004
|
const value = record[key];
|
|
1998
2005
|
if (typeof value === "string" && value.trim().length > 0) return value;
|
|
1999
2006
|
}
|
|
2007
|
+
const content = record["content"];
|
|
2008
|
+
if (typeof content === "string" && content.trim().length > 0 && looksLikeProgram(content) && /\b(?:tools\.|await\s|inspect\s*\(|return\b|const\b|let\b|import\s)/.test(content)) return content;
|
|
2000
2009
|
}
|
|
2001
2010
|
/** 从一个参数对象里读出进展简报(`title` / `message` 至少有一个)。 */
|
|
2002
2011
|
function narrationOf(record) {
|
|
@@ -2558,10 +2567,15 @@ const SEARCH_PATH_TOOLS = /* @__PURE__ */ new Set(["glob", "grep"]);
|
|
|
2558
2567
|
* @returns 归一化后的参数值。
|
|
2559
2568
|
*/
|
|
2560
2569
|
function normalizeSubCallArgs(entry, value) {
|
|
2570
|
+
if (entry?.name === "apply_patch" && typeof value === "string" && value.trim().length > 0) return { input: value };
|
|
2561
2571
|
if (!isRecord(value)) return value;
|
|
2562
2572
|
const name = entry?.name ?? "";
|
|
2563
|
-
const
|
|
2573
|
+
const rawParameters = isRecord(entry?.parameters) ? entry.parameters : void 0;
|
|
2574
|
+
const nestedProperties = isRecord(rawParameters?.["properties"]) ? rawParameters["properties"] : void 0;
|
|
2575
|
+
const schemaProps = nestedProperties ?? rawParameters;
|
|
2576
|
+
const required = nestedProperties !== void 0 ? Array.isArray(rawParameters?.["required"]) ? rawParameters["required"].filter((key) => typeof key === "string") : void 0 : schemaProps === void 0 ? void 0 : Object.entries(schemaProps).filter(([, spec]) => isRecord(spec) && spec["required"] === true).map(([key]) => key);
|
|
2564
2577
|
const declares = (key) => schemaProps !== void 0 && Object.prototype.hasOwnProperty.call(schemaProps, key);
|
|
2578
|
+
const requires = (key) => required?.includes(key) === true;
|
|
2565
2579
|
const out = { ...value };
|
|
2566
2580
|
const remap = (target, aliases, predicate) => {
|
|
2567
2581
|
if (out[target] !== void 0) return;
|
|
@@ -2585,6 +2599,19 @@ function normalizeSubCallArgs(entry, value) {
|
|
|
2585
2599
|
remap("new_string", ["newString"], isString);
|
|
2586
2600
|
remap("replace_all", ["replaceAll"], isBoolean);
|
|
2587
2601
|
}
|
|
2602
|
+
if (name === "apply_patch" || declares("input")) remap("input", ["patch", "diff"], isString);
|
|
2603
|
+
if (name === "web_search" || declares("queries")) {
|
|
2604
|
+
if (out["queries"] === void 0 && !declares("query")) {
|
|
2605
|
+
const query = out["query"];
|
|
2606
|
+
if (typeof query === "string" && query.trim().length > 0) {
|
|
2607
|
+
out["queries"] = [query];
|
|
2608
|
+
delete out["query"];
|
|
2609
|
+
} else if (Array.isArray(query) && query.every((item) => typeof item === "string")) {
|
|
2610
|
+
out["queries"] = query;
|
|
2611
|
+
delete out["query"];
|
|
2612
|
+
}
|
|
2613
|
+
}
|
|
2614
|
+
}
|
|
2588
2615
|
if (name === "win_bash" || declares("workdir")) {
|
|
2589
2616
|
remap("workdir", [
|
|
2590
2617
|
"cwd",
|
|
@@ -2598,6 +2625,7 @@ function normalizeSubCallArgs(entry, value) {
|
|
|
2598
2625
|
remap("job_id", ["jobId"], isString);
|
|
2599
2626
|
if (name === "job_output" || declares("timeout_ms")) remap("timeout_ms", ["timeoutMs"], isNumber);
|
|
2600
2627
|
}
|
|
2628
|
+
if (requires("description") && out["description"] === void 0 && typeof out["command"] === "string") out["description"] = descriptionFromCode(out["command"]);
|
|
2601
2629
|
return out;
|
|
2602
2630
|
}
|
|
2603
2631
|
/** 一个工具的调用是否可以与兄弟调用重叠(只有明确 true 才算)。 */
|