@eddyskywalker/dsh-chatgpt-subscription 0.99.1 → 1.0.1
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/README.md +2 -1
- package/lib/client.js +1565 -581
- package/lib/client.js.map +1 -1
- package/lib/codemode.js +107 -3
- package/lib/index.js +3409 -932
- package/lib/{preset-sync-CF9xlG1l.js → preset-sync-DWOAwSyl.js} +5 -4
- package/lib/reverse-board.js +1726 -0
- package/lib/{tool-result-pruner-Ds--y6hJ.js → tool-result-pruner-ClgRVOph.js} +4 -3
- package/lib/tool-result-pruner.js +1 -1
- package/lib/types/client/common/ModelChecklist.d.ts +3 -3
- package/lib/types/client/common/ModelChecklist.d.ts.map +1 -1
- package/lib/types/client/common/format.d.ts +10 -0
- package/lib/types/client/common/format.d.ts.map +1 -1
- package/lib/types/client/features/progress-updates/locales.d.ts +11 -5
- package/lib/types/client/features/progress-updates/locales.d.ts.map +1 -1
- package/lib/types/client/features/progress-updates/settings-binding.d.ts +3 -1
- package/lib/types/client/features/progress-updates/settings-binding.d.ts.map +1 -1
- package/lib/types/client/features/progress-updates/settings-section.d.ts +2 -0
- package/lib/types/client/features/progress-updates/settings-section.d.ts.map +1 -1
- package/lib/types/client/hub/brand-icons.d.ts +1 -1
- package/lib/types/client/hub/brand-icons.d.ts.map +1 -1
- package/lib/types/client/hub/providers.d.ts.map +1 -1
- package/lib/types/client/index.d.ts +2 -0
- package/lib/types/client/index.d.ts.map +1 -1
- package/lib/types/client/locales-ru/claude-api.d.ts.map +1 -1
- package/lib/types/client/locales-ru/claude.d.ts.map +1 -1
- package/lib/types/client/locales-ru/hub.d.ts.map +1 -1
- package/lib/types/client/locales-ru/index.d.ts.map +1 -1
- package/lib/types/client/locales-ru/kimi-code.d.ts.map +1 -1
- package/lib/types/client/locales-ru/progress-updates.d.ts.map +1 -1
- package/lib/types/client/locales-ru/sub2api.d.ts +3 -0
- package/lib/types/client/locales-ru/sub2api.d.ts.map +1 -0
- package/lib/types/client/providers/claude/ClaudeSection.d.ts.map +1 -1
- package/lib/types/client/providers/claude/locales.d.ts +8 -2
- package/lib/types/client/providers/claude/locales.d.ts.map +1 -1
- package/lib/types/client/providers/claude/useClaudeSection.d.ts +1 -0
- package/lib/types/client/providers/claude/useClaudeSection.d.ts.map +1 -1
- package/lib/types/client/providers/claude-api/ClaudeApiSection.d.ts.map +1 -1
- package/lib/types/client/providers/claude-api/locales.d.ts +5 -1
- package/lib/types/client/providers/claude-api/locales.d.ts.map +1 -1
- package/lib/types/client/providers/claude-api/useClaudeApiSection.d.ts +1 -0
- package/lib/types/client/providers/claude-api/useClaudeApiSection.d.ts.map +1 -1
- package/lib/types/client/providers/codex-chatgpt/CodexSubscriptionSection.d.ts.map +1 -1
- package/lib/types/client/providers/codex-chatgpt/locales.d.ts +5 -3
- package/lib/types/client/providers/codex-chatgpt/locales.d.ts.map +1 -1
- package/lib/types/client/providers/codex-chatgpt/styles.d.ts.map +1 -1
- package/lib/types/client/providers/command-code/CommandCodeSection.d.ts.map +1 -1
- package/lib/types/client/providers/command-code/locales.d.ts +2 -2
- package/lib/types/client/providers/glm-coding-plan/GlmCodingPlanSection.d.ts.map +1 -1
- package/lib/types/client/providers/kimi-code/KimiCodeSection.d.ts.map +1 -1
- package/lib/types/client/providers/kimi-code/locales.d.ts +8 -2
- package/lib/types/client/providers/kimi-code/locales.d.ts.map +1 -1
- package/lib/types/client/providers/minimax-code/MinimaxCodeSection.d.ts.map +1 -1
- package/lib/types/client/providers/opencode-zen/useZenSection.d.ts +1 -0
- package/lib/types/client/providers/opencode-zen/useZenSection.d.ts.map +1 -1
- package/lib/types/client/providers/relayone/locales.d.ts +12 -12
- package/lib/types/client/providers/step-code/StepCodeSection.d.ts.map +1 -1
- package/lib/types/client/providers/sub2api/Sub2ApiSection.d.ts +7 -0
- package/lib/types/client/providers/sub2api/Sub2ApiSection.d.ts.map +1 -0
- package/lib/types/client/providers/sub2api/locales.d.ts +212 -0
- package/lib/types/client/providers/sub2api/locales.d.ts.map +1 -0
- package/lib/types/client/providers/sub2api/styles.d.ts +3 -0
- package/lib/types/client/providers/sub2api/styles.d.ts.map +1 -0
- package/lib/types/compat.d.ts +1 -1
- package/lib/types/compat.d.ts.map +1 -1
- package/lib/types/entries/reverse-board.d.ts +6 -0
- package/lib/types/entries/reverse-board.d.ts.map +1 -0
- package/lib/types/entries/tool-result-pruner.d.ts.map +1 -1
- package/lib/types/host/common/i18n/zh.d.ts +1 -1
- package/lib/types/host/common/model-request-control.d.ts +1 -1
- package/lib/types/host/common/model-request-control.d.ts.map +1 -1
- package/lib/types/host/common/prompt-cache-policy.d.ts.map +1 -1
- package/lib/types/host/common/request-diagnostics.d.ts +1 -1
- package/lib/types/host/common/request-diagnostics.d.ts.map +1 -1
- package/lib/types/host/providers/claude/routes.d.ts.map +1 -1
- package/lib/types/host/providers/claude/token-store.d.ts +3 -0
- package/lib/types/host/providers/claude/token-store.d.ts.map +1 -1
- package/lib/types/host/providers/claude-api/routes.d.ts.map +1 -1
- package/lib/types/host/providers/claude-api/token-store.d.ts +3 -0
- package/lib/types/host/providers/claude-api/token-store.d.ts.map +1 -1
- package/lib/types/host/providers/kimi-code/cache-wait.d.ts +12 -0
- package/lib/types/host/providers/kimi-code/cache-wait.d.ts.map +1 -1
- package/lib/types/host/providers/kimi-code/routes.d.ts.map +1 -1
- package/lib/types/host/providers/kimi-code/token-store.d.ts +4 -0
- package/lib/types/host/providers/kimi-code/token-store.d.ts.map +1 -1
- package/lib/types/host/providers/relayone/types.d.ts +1 -1
- package/lib/types/host/providers/relayone/types.d.ts.map +1 -1
- package/lib/types/host/providers/sub2api/account-pool.d.ts +34 -0
- package/lib/types/host/providers/sub2api/account-pool.d.ts.map +1 -0
- package/lib/types/host/providers/sub2api/adapter.d.ts +59 -0
- package/lib/types/host/providers/sub2api/adapter.d.ts.map +1 -0
- package/lib/types/host/providers/sub2api/cache-stats.d.ts +19 -0
- package/lib/types/host/providers/sub2api/cache-stats.d.ts.map +1 -0
- package/lib/types/host/providers/sub2api/client.d.ts +6 -0
- package/lib/types/host/providers/sub2api/client.d.ts.map +1 -0
- package/lib/types/host/providers/sub2api/mapper-gemini.d.ts +10 -0
- package/lib/types/host/providers/sub2api/mapper-gemini.d.ts.map +1 -0
- package/lib/types/host/providers/sub2api/mapper-messages.d.ts +14 -0
- package/lib/types/host/providers/sub2api/mapper-messages.d.ts.map +1 -0
- package/lib/types/host/providers/sub2api/mapper-responses.d.ts +7 -0
- package/lib/types/host/providers/sub2api/mapper-responses.d.ts.map +1 -0
- package/lib/types/host/providers/sub2api/mapper.d.ts +34 -0
- package/lib/types/host/providers/sub2api/mapper.d.ts.map +1 -0
- package/lib/types/host/providers/sub2api/model-catalog.d.ts +72 -0
- package/lib/types/host/providers/sub2api/model-catalog.d.ts.map +1 -0
- package/lib/types/host/providers/sub2api/remote-compaction.d.ts +32 -0
- package/lib/types/host/providers/sub2api/remote-compaction.d.ts.map +1 -0
- package/lib/types/host/providers/sub2api/routes.d.ts +16 -0
- package/lib/types/host/providers/sub2api/routes.d.ts.map +1 -0
- package/lib/types/host/providers/sub2api/token-store.d.ts +43 -0
- package/lib/types/host/providers/sub2api/token-store.d.ts.map +1 -0
- package/lib/types/host/providers/sub2api/types.d.ts +14 -0
- package/lib/types/host/providers/sub2api/types.d.ts.map +1 -0
- package/lib/types/host/runtime/advisor/catalog-route.d.ts +20 -0
- package/lib/types/host/runtime/advisor/catalog-route.d.ts.map +1 -0
- package/lib/types/host/runtime/advisor/index.d.ts.map +1 -1
- package/lib/types/host/runtime/advisor/selection-store.d.ts +9 -1
- package/lib/types/host/runtime/advisor/selection-store.d.ts.map +1 -1
- package/lib/types/host/runtime/codemode/transport.d.ts +5 -0
- package/lib/types/host/runtime/codemode/transport.d.ts.map +1 -1
- package/lib/types/host/runtime/compact-after-turn/index.d.ts +15 -0
- package/lib/types/host/runtime/compact-after-turn/index.d.ts.map +1 -1
- package/lib/types/host/runtime/compaction-gate.d.ts +67 -0
- package/lib/types/host/runtime/compaction-gate.d.ts.map +1 -0
- package/lib/types/host/runtime/deepseek-v41-flash/state-anchor.d.ts +8 -0
- package/lib/types/host/runtime/deepseek-v41-flash/state-anchor.d.ts.map +1 -1
- package/lib/types/host/runtime/guards/compaction-policy-guard.d.ts +1 -0
- package/lib/types/host/runtime/guards/compaction-policy-guard.d.ts.map +1 -1
- package/lib/types/host/runtime/guards/ptc-sdk-cache-guard.d.ts.map +1 -1
- package/lib/types/host/runtime/guards/timeline-cache-guard.d.ts.map +1 -1
- 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/host/runtime/presets/agent-preset.d.ts +10 -25
- package/lib/types/host/runtime/presets/agent-preset.d.ts.map +1 -1
- package/lib/types/host/runtime/presets/preset-sync.d.ts +2 -0
- package/lib/types/host/runtime/presets/preset-sync.d.ts.map +1 -1
- package/lib/types/host/runtime/presets/reverse-persona.d.ts +3 -0
- package/lib/types/host/runtime/presets/reverse-persona.d.ts.map +1 -0
- package/lib/types/host/runtime/reverse/frontier.d.ts +10 -0
- package/lib/types/host/runtime/reverse/frontier.d.ts.map +1 -0
- package/lib/types/host/runtime/reverse/ids.d.ts +8 -0
- package/lib/types/host/runtime/reverse/ids.d.ts.map +1 -0
- package/lib/types/host/runtime/reverse/index.d.ts +20 -0
- package/lib/types/host/runtime/reverse/index.d.ts.map +1 -0
- package/lib/types/host/runtime/reverse/indexer.d.ts +9 -0
- package/lib/types/host/runtime/reverse/indexer.d.ts.map +1 -0
- package/lib/types/host/runtime/reverse/policy.d.ts +5 -0
- package/lib/types/host/runtime/reverse/policy.d.ts.map +1 -0
- package/lib/types/host/runtime/reverse/route-policy.d.ts +10 -0
- package/lib/types/host/runtime/reverse/route-policy.d.ts.map +1 -0
- package/lib/types/host/runtime/reverse/store.d.ts +91 -0
- package/lib/types/host/runtime/reverse/store.d.ts.map +1 -0
- package/lib/types/host/runtime/reverse/templates.d.ts +10 -0
- package/lib/types/host/runtime/reverse/templates.d.ts.map +1 -0
- package/lib/types/host/runtime/reverse/tool.d.ts +25 -0
- package/lib/types/host/runtime/reverse/tool.d.ts.map +1 -0
- package/lib/types/host/runtime/reverse/types.d.ts +182 -0
- package/lib/types/host/runtime/reverse/types.d.ts.map +1 -0
- package/lib/types/index.d.ts +13 -0
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/shared/claude-api-contracts.d.ts +2 -0
- package/lib/types/shared/claude-api-contracts.d.ts.map +1 -1
- package/lib/types/shared/claude-contracts.d.ts +3 -0
- package/lib/types/shared/claude-contracts.d.ts.map +1 -1
- package/lib/types/shared/contracts.d.ts +1 -1
- package/lib/types/shared/contracts.d.ts.map +1 -1
- package/lib/types/shared/kimi-code-contracts.d.ts +3 -0
- package/lib/types/shared/kimi-code-contracts.d.ts.map +1 -1
- package/lib/types/shared/relayone-contracts.d.ts +2 -2
- package/lib/types/shared/relayone-contracts.d.ts.map +1 -1
- package/lib/types/shared/sub2api-contracts.d.ts +103 -0
- package/lib/types/shared/sub2api-contracts.d.ts.map +1 -0
- package/package.json +6 -2
- package/presets/reverse/README.md +30 -0
- package/presets/reverse/agent.cordis.yml +228 -0
- package/presets/reverse/preset.yml +3 -0
- package/presets/team/README.md +0 -72
- package/presets/team/agent.cordis.yml +0 -414
- package/presets/team/preset.yml +0 -3
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-DWOAwSyl.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";
|
|
@@ -1337,6 +1337,15 @@ function createTransportDefinition(host, rules) {
|
|
|
1337
1337
|
return [...inspection.blocks];
|
|
1338
1338
|
},
|
|
1339
1339
|
presentCall(args) {
|
|
1340
|
+
const directShell = directShellCallOf(args);
|
|
1341
|
+
if (directShell !== void 0) {
|
|
1342
|
+
const command = stringOf(directShell.record["command"]) ?? "";
|
|
1343
|
+
return {
|
|
1344
|
+
card: "generic",
|
|
1345
|
+
title: directShell.description ?? descriptionFromCode(command),
|
|
1346
|
+
kind: "execute"
|
|
1347
|
+
};
|
|
1348
|
+
}
|
|
1340
1349
|
try {
|
|
1341
1350
|
const input = readArguments(args);
|
|
1342
1351
|
return {
|
|
@@ -1350,7 +1359,8 @@ function createTransportDefinition(host, rules) {
|
|
|
1350
1359
|
}
|
|
1351
1360
|
},
|
|
1352
1361
|
async execute(args, exec) {
|
|
1353
|
-
const
|
|
1362
|
+
const directShell = directShellCallOf(args);
|
|
1363
|
+
const input = directShell === void 0 ? readArguments(args) : readShellArguments(directShell);
|
|
1354
1364
|
const runtime = host.runtime();
|
|
1355
1365
|
if (runtime === void 0) throw new CodemodeContextUnavailableError("codemode: no PTC runtime is mounted (ctx.ptcRuntime); the program transport is unavailable");
|
|
1356
1366
|
if (input.timeoutMs !== void 0 && runtime.timeout !== void 0 === false && isStrictTimeoutUnsupported(runtime)) throw new CodemodeArgsError("timeoutMs is not available for this PTC runtime");
|
|
@@ -1359,6 +1369,12 @@ function createTransportDefinition(host, rules) {
|
|
|
1359
1369
|
const prevalidatedEscalation = hasRawEscalation && runtime.sandboxMode !== void 0 ? validateEscalationArgs(input.rawSandboxPermissions, input.rawJustification) : void 0;
|
|
1360
1370
|
await host.awaitPredecessors?.(exec.agent, exec.signal);
|
|
1361
1371
|
const catalog = host.catalog(exec.agent, exec.toolStep ?? exec.toolSet);
|
|
1372
|
+
let code = input.code;
|
|
1373
|
+
if (directShell !== void 0) {
|
|
1374
|
+
const shell = shellToolOf(catalog);
|
|
1375
|
+
if (shell === void 0) throw missingCodeError(directShell.record, directShell.raw);
|
|
1376
|
+
code = shellProgramFor(shell, directShell.record);
|
|
1377
|
+
}
|
|
1362
1378
|
const runController = new AbortController();
|
|
1363
1379
|
const onOuterAbort = () => {
|
|
1364
1380
|
runController.abort(exec.signal.reason);
|
|
@@ -1505,7 +1521,7 @@ function createTransportDefinition(host, rules) {
|
|
|
1505
1521
|
controller: runController,
|
|
1506
1522
|
signal: nestedSignal
|
|
1507
1523
|
}) ?? (() => {});
|
|
1508
|
-
const sanitizedCode = sanitizeReplTopLevelReturn(
|
|
1524
|
+
const sanitizedCode = sanitizeReplTopLevelReturn(code, runtime.programFormat, runtime.language);
|
|
1509
1525
|
const attempt = async () => {
|
|
1510
1526
|
deferredProgramImages.length = 0;
|
|
1511
1527
|
const authority = await host.runAuthority?.(exec.agent, nestedSignal);
|
|
@@ -1894,6 +1910,27 @@ const CODE_KEYS = Object.freeze([
|
|
|
1894
1910
|
"program_source",
|
|
1895
1911
|
"programSource"
|
|
1896
1912
|
]);
|
|
1913
|
+
/** 模型把 Shell 工具入参直接发给 `code_run` 时可能出现的键。 */
|
|
1914
|
+
const SHELL_ARG_KEYS = /* @__PURE__ */ new Set([
|
|
1915
|
+
"command",
|
|
1916
|
+
"workdir",
|
|
1917
|
+
"cwd",
|
|
1918
|
+
"workingDirectory",
|
|
1919
|
+
"working_directory",
|
|
1920
|
+
"timeoutMs",
|
|
1921
|
+
"timeout_ms",
|
|
1922
|
+
"run_in_background",
|
|
1923
|
+
"runInBackground",
|
|
1924
|
+
"description",
|
|
1925
|
+
"desc",
|
|
1926
|
+
"summary"
|
|
1927
|
+
]);
|
|
1928
|
+
/** 可接住直接 Shell 调用的工具名;顺序即同场竞争时的优先级。 */
|
|
1929
|
+
const SHELL_TOOL_NAMES = Object.freeze([
|
|
1930
|
+
"win_bash",
|
|
1931
|
+
"bash",
|
|
1932
|
+
"pwsh"
|
|
1933
|
+
]);
|
|
1897
1934
|
/** 模型把「先汇报再执行」写成一次调用时,简报落在 `progress_update` 的那两个键上。 */
|
|
1898
1935
|
const NARRATION_TITLE_KEY = "title";
|
|
1899
1936
|
/** 见 {@link NARRATION_TITLE_KEY}。 */
|
|
@@ -1993,6 +2030,73 @@ function missingCodeError(record, raw) {
|
|
|
1993
2030
|
const keys = Object.keys(record);
|
|
1994
2031
|
return new CodemodeArgsError("codemode: invalid code: expected a non-empty string" + (keys.length === 0 ? "" : " (received keys: " + keys.join(", ") + (raw.trim().length > 0 ? "; raw: " + excerpt(raw) : "") + "; pass program source in \"code\")"));
|
|
1995
2032
|
}
|
|
2033
|
+
/**
|
|
2034
|
+
* 认出「Shell 工具参数被直接发进 code_run」的形态。
|
|
2035
|
+
*
|
|
2036
|
+
* 审计(session-4ad29c19 turn 后期,约 37 万 token):模型连续 11 次把
|
|
2037
|
+
* `description`/`command`/`workdir` 直接发给 `code_run`,即使错误已要求程序源码,
|
|
2038
|
+
* 下一步仍重复同一形状。这里只接受字段集合完全吻合、且可选键类型正确的壳状参数;
|
|
2039
|
+
* 多一个陌生键就交给原来的拒绝路径,绝不把畸形对象猜成命令。
|
|
2040
|
+
*
|
|
2041
|
+
* @param args - 工具收到的原始参数。
|
|
2042
|
+
* @returns 壳状调用;不像时返回 `undefined`。
|
|
2043
|
+
*/
|
|
2044
|
+
function directShellCallOf(args) {
|
|
2045
|
+
let parsed;
|
|
2046
|
+
try {
|
|
2047
|
+
parsed = parseArguments(args);
|
|
2048
|
+
} catch {
|
|
2049
|
+
return;
|
|
2050
|
+
}
|
|
2051
|
+
const record = parsed.record;
|
|
2052
|
+
if (codeOf(record) !== void 0) return void 0;
|
|
2053
|
+
if (stringOf(record["command"]) === void 0) return void 0;
|
|
2054
|
+
const keys = Object.keys(record);
|
|
2055
|
+
if (keys.length === 0 || keys.some((key) => !SHELL_ARG_KEYS.has(key))) return void 0;
|
|
2056
|
+
for (const key of [
|
|
2057
|
+
"workdir",
|
|
2058
|
+
"cwd",
|
|
2059
|
+
"workingDirectory",
|
|
2060
|
+
"working_directory"
|
|
2061
|
+
]) if (record[key] !== void 0 && typeof record[key] !== "string") return void 0;
|
|
2062
|
+
for (const key of ["timeoutMs", "timeout_ms"]) {
|
|
2063
|
+
const value = record[key];
|
|
2064
|
+
if (value !== void 0 && (typeof value !== "number" || !Number.isFinite(value) || value <= 0)) return void 0;
|
|
2065
|
+
}
|
|
2066
|
+
for (const key of ["run_in_background", "runInBackground"]) if (record[key] !== void 0 && typeof record[key] !== "boolean") return void 0;
|
|
2067
|
+
const description = stringOf(record["description"])?.trim() ?? stringOf(record["desc"])?.trim() ?? stringOf(record["summary"])?.trim();
|
|
2068
|
+
return {
|
|
2069
|
+
record,
|
|
2070
|
+
...description === void 0 ? {} : { description },
|
|
2071
|
+
raw: parsed.raw
|
|
2072
|
+
};
|
|
2073
|
+
}
|
|
2074
|
+
/** 在工具清单里挑一个能承接 Shell 参数的工具。 */
|
|
2075
|
+
function shellToolOf(catalog) {
|
|
2076
|
+
for (const name of SHELL_TOOL_NAMES) {
|
|
2077
|
+
const entry = catalog.find((candidate) => candidate.name === name);
|
|
2078
|
+
if (entry !== void 0) return entry;
|
|
2079
|
+
}
|
|
2080
|
+
}
|
|
2081
|
+
/** 把壳状参数包成一条调用真实 Shell 工具的程序。 */
|
|
2082
|
+
function shellProgramFor(entry, record) {
|
|
2083
|
+
const workdir = record["workdir"] ?? record["cwd"] ?? record["workingDirectory"] ?? record["working_directory"];
|
|
2084
|
+
const timeoutMs = record["timeoutMs"] ?? record["timeout_ms"];
|
|
2085
|
+
const runInBackground = record["run_in_background"] ?? record["runInBackground"];
|
|
2086
|
+
const args = { command: record["command"] };
|
|
2087
|
+
if (workdir !== void 0) args["workdir"] = workdir;
|
|
2088
|
+
if (timeoutMs !== void 0) args["timeoutMs"] = timeoutMs;
|
|
2089
|
+
if (runInBackground !== void 0) args["run_in_background"] = runInBackground;
|
|
2090
|
+
return "return await tools." + entry.name + "(" + JSON.stringify(args) + ")";
|
|
2091
|
+
}
|
|
2092
|
+
/** 把壳状调用读成程序传输的标题(真正源码要等工具清单才能生成)。 */
|
|
2093
|
+
function readShellArguments(direct) {
|
|
2094
|
+
const command = stringOf(direct.record["command"]) ?? "";
|
|
2095
|
+
return {
|
|
2096
|
+
code: "",
|
|
2097
|
+
description: direct.description ?? descriptionFromCode(command)
|
|
2098
|
+
};
|
|
2099
|
+
}
|
|
1996
2100
|
/** 一段文本像不像程序源码(模型把源码直接发成字符串时判这个)。 */
|
|
1997
2101
|
function looksLikeProgram(text) {
|
|
1998
2102
|
return text.includes("\n") || /\b(await|return|const|let|function|import|console\.)\b/.test(text);
|