dsh-agy-link 0.4.98 → 0.4.100
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/CHANGELOG.md +28 -0
- package/dist/client.js +103 -15
- package/dist/index.js +205 -54
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.100 (2026-11-02)
|
|
4
|
+
|
|
5
|
+
### English
|
|
6
|
+
|
|
7
|
+
- **Fix(host): stop dropping reasoning text on tool turns; debounce the negative thought cache.** (thanks @Ronnoc, #65)
|
|
8
|
+
- With `--input-format stream-json`, thought text is written asynchronously to agy's SQLite DB, so on turns that immediately call a tool the initial `text` step often found `null`, and `cache.checkedSteps` then cached that miss for 5 minutes — the model's thoughts never surfaced. The cache miss skip is now a 500 ms debounce, pending thought steps are retried when tool steps arrive, and `flushBannerOnlyThoughts()` appends late-arriving prose to the reasoning block before a tool cut / result envelope closes it. Also resolves conversation DB dirs from the real HOME for isolated pool accounts.
|
|
9
|
+
|
|
10
|
+
### 中文
|
|
11
|
+
|
|
12
|
+
- **修复(host):工具轮不再丢弃思考正文;负缓存改为短去抖。**(感谢 @Ronnoc,#65)
|
|
13
|
+
- `--input-format stream-json` 下思考正文异步写入 agy 的 SQLite,若回合立即调用工具,初始 `text` 步骤常读不到(null),而 `cache.checkedSteps` 会把这次未命中缓存 5 分钟,导致思考内容永远不显示。现未命中跳过改为 500ms 去抖、工具步骤到来时重试待定思考步骤,并在工具切分/结果信封关闭前用 `flushBannerOnlyThoughts()` 补写迟到的正文;同时支持从真实 HOME 解析池账号的会话 DB 目录。
|
|
14
|
+
|
|
15
|
+
**Full Changelog**: https://github.com/amlyczz/dsh-agy-link/compare/v0.4.99...v0.4.100
|
|
16
|
+
|
|
17
|
+
## 0.4.99 (2026-10-31)
|
|
18
|
+
|
|
19
|
+
### English
|
|
20
|
+
|
|
21
|
+
- **Feat(toolview): unwrap Antigravity MCP meta-tools into native terminal/search cards.** (thanks @Ronnoc, #64)
|
|
22
|
+
- External MCP tools are dispatched by agy through meta-tools (`call_mcp_tool` / `callMcpTool` / `mcp__<server>__<tool>`), so every MCP call previously rendered as one repetitive `call_mcp_tool` card with raw JSON. Host mirror presenters and Client toolviews now unwrap the inner invocation: terminal-ish tools (`ops_bash`, `sh`, `shell`, …) become native Terminal cards (`$ cmd`, cwd, exit code, timeout), glob/grep become Search cards, and other MCP tools show as `<server>: <tool>`. MCP text envelopes (`{content:[{type:'text',text}]}`) are cleaned. Adds tests (588+ passing).
|
|
23
|
+
|
|
24
|
+
### 中文
|
|
25
|
+
|
|
26
|
+
- **新增(toolview):把 Antigravity 的 MCP 元工具拆包为原生终端/搜索卡片。**(感谢 @Ronnoc,#64)
|
|
27
|
+
- 外部 MCP 工具由 agy 经元工具(`call_mcp_tool` 等)调度,此前所有 MCP 调用都退化成一个重复的 `call_mcp_tool` 原始 JSON 卡片。现 Host 镜像 Presenter 与 Client Toolview 都会拆包内层调用:终端类(`ops_bash`/`sh`/`shell`…)渲染为原生终端卡片(`$ cmd`、cwd、退出码、超时),glob/grep 渲染为搜索卡片,其它 MCP 显示 `<server>: <tool>`;并清理 MCP 文本信封。补充测试(588+ 通过)。
|
|
28
|
+
|
|
29
|
+
**Full Changelog**: https://github.com/amlyczz/dsh-agy-link/compare/v0.4.98...v0.4.99
|
|
30
|
+
|
|
3
31
|
## 0.4.98 (2026-10-30)
|
|
4
32
|
|
|
5
33
|
### English
|
package/dist/client.js
CHANGED
|
@@ -1760,10 +1760,50 @@ window.__ModuleLoader__.load({
|
|
|
1760
1760
|
return null;
|
|
1761
1761
|
}
|
|
1762
1762
|
}
|
|
1763
|
+
function cleanString(val) {
|
|
1764
|
+
if (typeof val !== "string") return "";
|
|
1765
|
+
let s = val.trim();
|
|
1766
|
+
if (s.startsWith("\"") && s.endsWith("\"") || s.startsWith("'") && s.endsWith("'")) s = s.slice(1, -1).trim();
|
|
1767
|
+
return s;
|
|
1768
|
+
}
|
|
1769
|
+
function parseInnerArgs(raw) {
|
|
1770
|
+
if (raw === void 0 || raw === null) return {};
|
|
1771
|
+
if (typeof raw === "object" && !Array.isArray(raw)) return raw;
|
|
1772
|
+
if (typeof raw === "string") {
|
|
1773
|
+
let s = raw.trim();
|
|
1774
|
+
if (s.startsWith("\"") && s.endsWith("\"") || s.startsWith("'") && s.endsWith("'")) try {
|
|
1775
|
+
const unquoted = JSON.parse(s);
|
|
1776
|
+
if (typeof unquoted === "string") s = unquoted.trim();
|
|
1777
|
+
} catch {}
|
|
1778
|
+
try {
|
|
1779
|
+
const parsed = JSON.parse(s);
|
|
1780
|
+
if (typeof parsed === "object" && parsed !== null && !Array.isArray(parsed)) return parsed;
|
|
1781
|
+
return { value: parsed };
|
|
1782
|
+
} catch {
|
|
1783
|
+
return { value: raw };
|
|
1784
|
+
}
|
|
1785
|
+
}
|
|
1786
|
+
return { value: raw };
|
|
1787
|
+
}
|
|
1788
|
+
function cleanResultText(text) {
|
|
1789
|
+
const trimmed = text.trim();
|
|
1790
|
+
if (trimmed.startsWith("{") && trimmed.endsWith("}")) try {
|
|
1791
|
+
const obj = JSON.parse(trimmed);
|
|
1792
|
+
if (Array.isArray(obj?.content)) {
|
|
1793
|
+
const parts = [];
|
|
1794
|
+
for (const item of obj.content) {
|
|
1795
|
+
const blk = item;
|
|
1796
|
+
if (blk?.type === "text" && typeof blk.text === "string") parts.push(blk.text);
|
|
1797
|
+
}
|
|
1798
|
+
if (parts.length > 0) return parts.join("\n");
|
|
1799
|
+
}
|
|
1800
|
+
} catch {}
|
|
1801
|
+
return text;
|
|
1802
|
+
}
|
|
1763
1803
|
function mirrorInfo(block) {
|
|
1764
1804
|
const a = parseArgs(block);
|
|
1765
1805
|
if (a === null) return null;
|
|
1766
|
-
|
|
1806
|
+
let tool = typeof a.tool === "string" ? a.tool : "";
|
|
1767
1807
|
if (tool === "") return null;
|
|
1768
1808
|
let input = {};
|
|
1769
1809
|
const raw = a.input;
|
|
@@ -1775,9 +1815,27 @@ window.__ModuleLoader__.load({
|
|
|
1775
1815
|
} catch {
|
|
1776
1816
|
input = { value: raw };
|
|
1777
1817
|
}
|
|
1818
|
+
let server = typeof a.server === "string" && a.server !== "" ? cleanString(a.server) : void 0;
|
|
1819
|
+
if (/^(call_mcp_tool|callMcpTool|call_mcp|mcp_call)$/i.test(tool)) {
|
|
1820
|
+
const s = pick(input, "ServerName", "server_name", "serverName", "server");
|
|
1821
|
+
if (s) server = cleanString(s);
|
|
1822
|
+
const innerTool = pick(input, "ToolName", "tool_name", "toolName", "name", "tool");
|
|
1823
|
+
const rawInner = input.Arguments ?? input.arguments ?? input.args ?? input.parameters ?? input.params ?? input.input;
|
|
1824
|
+
if (innerTool) {
|
|
1825
|
+
tool = cleanString(innerTool);
|
|
1826
|
+
input = parseInnerArgs(rawInner);
|
|
1827
|
+
}
|
|
1828
|
+
} else if (tool.startsWith("mcp__")) {
|
|
1829
|
+
const parts = tool.slice(5).split("__");
|
|
1830
|
+
if (parts.length >= 2) {
|
|
1831
|
+
server = parts[0];
|
|
1832
|
+
tool = parts.slice(1).join("__");
|
|
1833
|
+
}
|
|
1834
|
+
}
|
|
1778
1835
|
return {
|
|
1779
1836
|
tool,
|
|
1780
|
-
input
|
|
1837
|
+
input,
|
|
1838
|
+
...server ? { server } : {}
|
|
1781
1839
|
};
|
|
1782
1840
|
}
|
|
1783
1841
|
function pick(input, ...keys) {
|
|
@@ -1797,7 +1855,7 @@ window.__ModuleLoader__.load({
|
|
|
1797
1855
|
if (!Array.isArray(settled.content)) return "";
|
|
1798
1856
|
const parts = [];
|
|
1799
1857
|
for (const b of settled.content) if (b && typeof b === "object" && b.type === "text" && typeof b.text === "string") parts.push(b.text);
|
|
1800
|
-
return parts.join("\n");
|
|
1858
|
+
return cleanResultText(parts.join("\n"));
|
|
1801
1859
|
}
|
|
1802
1860
|
function isSettled(block) {
|
|
1803
1861
|
return block.kind === "tool-result" || "content" in block;
|
|
@@ -1809,7 +1867,10 @@ window.__ModuleLoader__.load({
|
|
|
1809
1867
|
const TERMINAL_TOOLS = /* @__PURE__ */ new Set([
|
|
1810
1868
|
"run_command",
|
|
1811
1869
|
"bash",
|
|
1812
|
-
"execute_command"
|
|
1870
|
+
"execute_command",
|
|
1871
|
+
"ops_bash",
|
|
1872
|
+
"sh",
|
|
1873
|
+
"shell"
|
|
1813
1874
|
]);
|
|
1814
1875
|
const DIFF_TOOLS = /* @__PURE__ */ new Set([
|
|
1815
1876
|
"replace_file_content",
|
|
@@ -1829,9 +1890,11 @@ window.__ModuleLoader__.load({
|
|
|
1829
1890
|
const SEARCH_TOOLS = /* @__PURE__ */ new Set([
|
|
1830
1891
|
"find_by_name",
|
|
1831
1892
|
"glob",
|
|
1893
|
+
"ops_glob",
|
|
1832
1894
|
"search_files",
|
|
1833
1895
|
"grep_search",
|
|
1834
1896
|
"search",
|
|
1897
|
+
"ops_grep",
|
|
1835
1898
|
"search_file_content",
|
|
1836
1899
|
"grep",
|
|
1837
1900
|
"search_web",
|
|
@@ -1867,10 +1930,12 @@ window.__ModuleLoader__.load({
|
|
|
1867
1930
|
if (QUESTION_TOOLS.has(tool)) {
|
|
1868
1931
|
const questionsRaw = input.questions ?? input.Questions;
|
|
1869
1932
|
const questions = Array.isArray(questionsRaw) ? questionsRaw : [];
|
|
1933
|
+
const qTitle = questions[0]?.question ?? desc ?? "Ask Question";
|
|
1870
1934
|
return {
|
|
1871
1935
|
kind: "question",
|
|
1872
1936
|
tool,
|
|
1873
|
-
|
|
1937
|
+
server: info.server,
|
|
1938
|
+
title: qTitle,
|
|
1874
1939
|
output: out,
|
|
1875
1940
|
questions,
|
|
1876
1941
|
raw: parsedArgsRaw(block)
|
|
@@ -1883,6 +1948,7 @@ window.__ModuleLoader__.load({
|
|
|
1883
1948
|
return {
|
|
1884
1949
|
kind: "image",
|
|
1885
1950
|
tool,
|
|
1951
|
+
server: info.server,
|
|
1886
1952
|
title: desc ?? `Generate Image · ${name}`,
|
|
1887
1953
|
prompt,
|
|
1888
1954
|
imageName: name,
|
|
@@ -1892,12 +1958,14 @@ window.__ModuleLoader__.load({
|
|
|
1892
1958
|
};
|
|
1893
1959
|
}
|
|
1894
1960
|
if (TERMINAL_TOOLS.has(tool)) {
|
|
1895
|
-
const command = pick(input, "CommandLine", "command_line", "command", "cmd", "Cmd") ?? JSON.stringify(input);
|
|
1896
|
-
const cwdVal = pick(input, "Cwd", "cwd", "WorkingDirectory", "working_directory") ?? cwd;
|
|
1961
|
+
const command = pick(input, "CommandLine", "command_line", "command", "cmd", "Cmd") ?? (desc && desc.startsWith("$ ") ? desc.replace(/\s*·\s*.*$/, "").replace(/^\$\s*/, "") : void 0) ?? JSON.stringify(input);
|
|
1962
|
+
const cwdVal = pick(input, "Cwd", "cwd", "WorkingDirectory", "working_directory", "workdir", "WorkDir") ?? cwd;
|
|
1963
|
+
const rowTitle = desc !== void 0 && !desc.startsWith("$ ") && desc !== command ? desc + " · " + command : command;
|
|
1897
1964
|
return {
|
|
1898
1965
|
kind: "terminal",
|
|
1899
1966
|
tool,
|
|
1900
|
-
|
|
1967
|
+
server: info.server,
|
|
1968
|
+
title: rowTitle,
|
|
1901
1969
|
command,
|
|
1902
1970
|
...cwdVal !== void 0 ? { cwd: cwdVal } : {},
|
|
1903
1971
|
output: out
|
|
@@ -1910,10 +1978,12 @@ window.__ModuleLoader__.load({
|
|
|
1910
1978
|
const newText = pick(input, "ReplacementContent", "replacement_content", "new_string", "newText", "content", "NewString", "NewText", "Content", "replacementContent", "CodeContent", "code_content", "contents", "FileContents", "codeContent") ?? "";
|
|
1911
1979
|
const action = tool === "write_to_file" || tool === "write_file" || tool === "create_file" ? "Write" : "Edit";
|
|
1912
1980
|
const isGenericDesc = desc !== void 0 && /^(file edit|editing file|write file|writing file|file write|edit file|editing|writing|file create|creating file)$/i.test(desc.trim());
|
|
1981
|
+
const title = desc !== void 0 && !isGenericDesc && !desc.includes(path) ? `${action} ${path} · ${desc}` : `${action} ${path}`;
|
|
1913
1982
|
return {
|
|
1914
1983
|
kind: "diff",
|
|
1915
1984
|
tool,
|
|
1916
|
-
|
|
1985
|
+
server: info.server,
|
|
1986
|
+
title,
|
|
1917
1987
|
path: rawPath,
|
|
1918
1988
|
oldText,
|
|
1919
1989
|
newText,
|
|
@@ -1928,6 +1998,7 @@ window.__ModuleLoader__.load({
|
|
|
1928
1998
|
return {
|
|
1929
1999
|
kind: isImg ? "image" : "read",
|
|
1930
2000
|
tool,
|
|
2001
|
+
server: info.server,
|
|
1931
2002
|
title: desc ? `${desc} · ${path}` : path !== "" ? "Read " + path : "Read",
|
|
1932
2003
|
path,
|
|
1933
2004
|
output: out,
|
|
@@ -1942,10 +2013,12 @@ window.__ModuleLoader__.load({
|
|
|
1942
2013
|
};
|
|
1943
2014
|
}
|
|
1944
2015
|
if (SEARCH_TOOLS.has(tool)) {
|
|
1945
|
-
const
|
|
2016
|
+
const rawPat = input.query ?? input.Query ?? input.pattern ?? input.Pattern ?? input.regex ?? input.Regex ?? input.QueryString;
|
|
2017
|
+
const q = Array.isArray(rawPat) ? rawPat.join(", ") : typeof rawPat === "string" ? rawPat : pick(input, "query", "Query", "pattern", "Pattern", "regex", "Regex", "QueryString") ?? "";
|
|
1946
2018
|
return {
|
|
1947
2019
|
kind: "search",
|
|
1948
2020
|
tool,
|
|
2021
|
+
server: info.server,
|
|
1949
2022
|
title: desc ?? (q !== "" ? "Search " + q : "Search"),
|
|
1950
2023
|
output: out
|
|
1951
2024
|
};
|
|
@@ -1955,6 +2028,7 @@ window.__ModuleLoader__.load({
|
|
|
1955
2028
|
return {
|
|
1956
2029
|
kind: "list",
|
|
1957
2030
|
tool,
|
|
2031
|
+
server: info.server,
|
|
1958
2032
|
title: desc ?? (path !== "" ? "List " + path : "List directory"),
|
|
1959
2033
|
output: out
|
|
1960
2034
|
};
|
|
@@ -1964,14 +2038,18 @@ window.__ModuleLoader__.load({
|
|
|
1964
2038
|
return {
|
|
1965
2039
|
kind: "delete",
|
|
1966
2040
|
tool,
|
|
2041
|
+
server: info.server,
|
|
1967
2042
|
title: desc ?? "Delete " + path,
|
|
1968
2043
|
output: out
|
|
1969
2044
|
};
|
|
1970
2045
|
}
|
|
2046
|
+
const defaultTitle = info.server ? `${info.server}: ${tool}` : tool !== "" ? tool : "agy_tool";
|
|
2047
|
+
const title = desc ?? defaultTitle;
|
|
1971
2048
|
return {
|
|
1972
2049
|
kind: "generic",
|
|
1973
2050
|
tool,
|
|
1974
|
-
|
|
2051
|
+
server: info.server,
|
|
2052
|
+
title,
|
|
1975
2053
|
output: out,
|
|
1976
2054
|
raw: parsedArgsRaw(block)
|
|
1977
2055
|
};
|
|
@@ -2030,7 +2108,9 @@ window.__ModuleLoader__.load({
|
|
|
2030
2108
|
case "delete": return tr(t, "tv.delete", "Delete");
|
|
2031
2109
|
case "question": return tr(t, "tv.question", "Question");
|
|
2032
2110
|
case "image": return tr(t, "tv.image", "Image");
|
|
2033
|
-
default:
|
|
2111
|
+
default:
|
|
2112
|
+
if (model.tool && model.tool !== "agy_tool") return model.server ? `${model.server}: ${model.tool}` : model.tool.replace(/_/g, " ");
|
|
2113
|
+
return tr(t, "tv.tool", "Tool");
|
|
2034
2114
|
}
|
|
2035
2115
|
}
|
|
2036
2116
|
function displaySummary(model, cwd, home) {
|
|
@@ -2044,6 +2124,7 @@ window.__ModuleLoader__.load({
|
|
|
2044
2124
|
if (model.kind === "list") return model.title.replace(/^List\s*(directory\s*)?/i, "") || model.title;
|
|
2045
2125
|
if (model.kind === "question") return model.title;
|
|
2046
2126
|
if (model.kind === "image") return model.prompt || model.title;
|
|
2127
|
+
if (model.server && model.title.startsWith(`${model.server}: `)) return model.title.slice(model.server.length + 2);
|
|
2047
2128
|
return model.title;
|
|
2048
2129
|
}
|
|
2049
2130
|
function diffStat(model) {
|
|
@@ -2282,7 +2363,7 @@ window.__ModuleLoader__.load({
|
|
|
2282
2363
|
default: {
|
|
2283
2364
|
const copyText = model.output !== void 0 && model.output !== "" ? model.output : model.raw ?? "";
|
|
2284
2365
|
const rawBody = model.output !== void 0 && model.output !== "" ? trimTrailingBlankLines(model.output) : model.raw !== void 0 && model.raw !== "" ? clip(model.raw, 4e3) : tr(t, "tv.noDetail", "(no detail)");
|
|
2285
|
-
return h("div", { className: "agy-tv-card" }, h("div", { className: "agy-tv-card-header" }, h("div", { className: "agy-tv-card-header-left" }, IconCodeOutline16(13), h("span", { className: "agy-tv-card-path" }, model.tool || "Tool")), h(CopyButton, {
|
|
2366
|
+
return h("div", { className: "agy-tv-card" }, h("div", { className: "agy-tv-card-header" }, h("div", { className: "agy-tv-card-header-left" }, IconCodeOutline16(13), h("span", { className: "agy-tv-card-path" }, model.server ? `${model.server}: ${model.tool}` : model.title || model.tool || "Tool")), h(CopyButton, {
|
|
2286
2367
|
text: copyText,
|
|
2287
2368
|
t
|
|
2288
2369
|
})), h("pre", { className: "agy-tv-card-content" }, clip(rawBody, 16e3)), inspectNode);
|
|
@@ -2476,8 +2557,14 @@ window.__ModuleLoader__.load({
|
|
|
2476
2557
|
function AgyRunCodeToolView(props) {
|
|
2477
2558
|
const typed = props;
|
|
2478
2559
|
const block = typed?.block;
|
|
2479
|
-
const
|
|
2560
|
+
const raw = block !== void 0 ? parsedArgsRaw(block) : "{}";
|
|
2561
|
+
const mirror = parseAgyMirrorFromCode(raw);
|
|
2480
2562
|
if (mirror === null) return AgyCodeToolView(typed);
|
|
2563
|
+
let description;
|
|
2564
|
+
try {
|
|
2565
|
+
const parsed = JSON.parse(raw);
|
|
2566
|
+
if (typeof parsed?.description === "string" && parsed.description !== "") description = parsed.description;
|
|
2567
|
+
} catch {}
|
|
2481
2568
|
return AgyMirrorToolView({
|
|
2482
2569
|
block: {
|
|
2483
2570
|
...block,
|
|
@@ -2487,7 +2574,8 @@ window.__ModuleLoader__.load({
|
|
|
2487
2574
|
argsRaw: JSON.stringify({
|
|
2488
2575
|
run: mirror.run,
|
|
2489
2576
|
step: mirror.step,
|
|
2490
|
-
...mirror.tool !== void 0 ? { tool: mirror.tool } : {}
|
|
2577
|
+
...mirror.tool !== void 0 ? { tool: mirror.tool } : {},
|
|
2578
|
+
...description !== void 0 ? { input: { description } } : {}
|
|
2491
2579
|
})
|
|
2492
2580
|
}
|
|
2493
2581
|
},
|
package/dist/index.js
CHANGED
|
@@ -1147,8 +1147,11 @@ function buildMirrorRunCode(runId, eventIndex, toolName, brief) {
|
|
|
1147
1147
|
};
|
|
1148
1148
|
}
|
|
1149
1149
|
/** Short human preview for a recorded tool step (used in Code Mode titles). */
|
|
1150
|
-
function toolStepBrief(toolName, args) {
|
|
1151
|
-
const
|
|
1150
|
+
function toolStepBrief(toolName, args, server) {
|
|
1151
|
+
const unwrapped = unwrapMcpTool(toolName, args);
|
|
1152
|
+
const effTool = unwrapped.tool;
|
|
1153
|
+
const a = unwrapped.input;
|
|
1154
|
+
const effServer = server ?? unwrapped.server;
|
|
1152
1155
|
const pickStr = (...keys) => {
|
|
1153
1156
|
for (const k of keys) {
|
|
1154
1157
|
const v = a[k];
|
|
@@ -1156,39 +1159,43 @@ function toolStepBrief(toolName, args) {
|
|
|
1156
1159
|
}
|
|
1157
1160
|
return "";
|
|
1158
1161
|
};
|
|
1159
|
-
if (
|
|
1162
|
+
if (effTool === "run_command" || effTool === "execute_command" || effTool === "ops_bash" || effTool === "bash" || effTool === "sh" || effTool === "shell") {
|
|
1160
1163
|
const cmd = pickStr("CommandLine", "command_line", "Command", "command", "Cmd", "cmd");
|
|
1161
1164
|
return cmd !== "" ? "$ " + cmd.slice(0, 80) : "run command";
|
|
1162
1165
|
}
|
|
1163
|
-
if (
|
|
1164
|
-
if (
|
|
1165
|
-
if (
|
|
1166
|
-
if (
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1166
|
+
if (effTool === "view_file" || effTool === "read_file" || effTool === "read") return "read " + (pickStr("AbsolutePath", "absolute_path", "Path", "path", "TargetFile", "File") || "file");
|
|
1167
|
+
if (effTool === "write_to_file" || effTool === "create_file" || effTool === "write_file") return "write " + (pickStr("TargetFile", "target_file", "Path", "path", "AbsolutePath", "File") || "file");
|
|
1168
|
+
if (effTool === "replace_file_content" || effTool === "edit_file" || effTool === "edit") return "edit " + (pickStr("TargetFile", "target_file", "Path", "path", "AbsolutePath", "File") || "file");
|
|
1169
|
+
if (effTool === "grep_search" || effTool === "search" || effTool === "ops_grep" || effTool === "ops_glob" || effTool === "glob" || effTool === "find_by_name" || effTool === "search_files" || effTool === "search_file_content" || effTool === "grep") {
|
|
1170
|
+
const rawPat = a.pattern ?? a.Pattern ?? a.query ?? a.Query ?? a.SearchPattern;
|
|
1171
|
+
const pat = Array.isArray(rawPat) ? rawPat.join(", ") : typeof rawPat === "string" ? rawPat.trim() : "";
|
|
1172
|
+
return pat !== "" ? "search " + pat.slice(0, 80) : "search";
|
|
1173
|
+
}
|
|
1174
|
+
if (effTool === "search_web" || effTool === "web_search") return "search web " + (pickStr("query", "Query", "search_query", "q") || "");
|
|
1175
|
+
if (effTool === "read_url_content" || effTool === "web_fetch" || effTool === "fetch_web_page") return "fetch " + (pickStr("Url", "url", "target_url", "targetUrl") || "url");
|
|
1176
|
+
if (effTool === "list_dir" || effTool === "list_directory" || effTool === "ls") return "ls " + (pickStr("DirectoryPath", "directory_path", "Path", "path", "AbsolutePath") || ".");
|
|
1177
|
+
if (effTool === "manage_task") {
|
|
1171
1178
|
const action = pickStr("Action", "action") || "manage";
|
|
1172
1179
|
const id = pickStr("TaskId", "taskId", "task_id");
|
|
1173
1180
|
return id !== "" ? "task " + action + " " + id : "task " + action;
|
|
1174
1181
|
}
|
|
1175
|
-
if (
|
|
1182
|
+
if (effTool === "schedule") {
|
|
1176
1183
|
const prompt = pickStr("Prompt", "prompt");
|
|
1177
1184
|
const cron = pickStr("CronExpression", "cron_expression");
|
|
1178
1185
|
const dur = pickStr("DurationSeconds", "duration_seconds");
|
|
1179
1186
|
const timing = cron ? "cron " + cron : dur ? dur + "s" : "";
|
|
1180
1187
|
return timing ? "schedule " + timing : prompt ? "schedule " + prompt.slice(0, 40) : "schedule";
|
|
1181
1188
|
}
|
|
1182
|
-
if (
|
|
1189
|
+
if (effTool === "invoke_subagent") {
|
|
1183
1190
|
const subs = a.Subagents ?? a.subagents;
|
|
1184
1191
|
const firstRole = Array.isArray(subs) && subs.length > 0 && typeof subs[0].Role === "string" ? subs[0].Role : "";
|
|
1185
1192
|
return firstRole ? "subagent: " + firstRole : "invoke subagent";
|
|
1186
1193
|
}
|
|
1187
|
-
if (
|
|
1194
|
+
if (effTool === "send_message") {
|
|
1188
1195
|
const recipient = pickStr("Recipient", "recipient", "to");
|
|
1189
1196
|
return recipient ? "msg " + recipient : "send message";
|
|
1190
1197
|
}
|
|
1191
|
-
return
|
|
1198
|
+
return effServer ? effServer + ": " + effTool : effTool;
|
|
1192
1199
|
}
|
|
1193
1200
|
/** agy serializes some tool args as a JSON string; presenters get an object. */
|
|
1194
1201
|
function toolInput(args) {
|
|
@@ -1203,6 +1210,77 @@ function toolInput(args) {
|
|
|
1203
1210
|
}
|
|
1204
1211
|
return { value: raw };
|
|
1205
1212
|
}
|
|
1213
|
+
function cleanString(val) {
|
|
1214
|
+
if (typeof val !== "string") return "";
|
|
1215
|
+
let s = val.trim();
|
|
1216
|
+
if (s.startsWith("\"") && s.endsWith("\"") || s.startsWith("'") && s.endsWith("'")) s = s.slice(1, -1).trim();
|
|
1217
|
+
return s;
|
|
1218
|
+
}
|
|
1219
|
+
function parseInnerArgs(raw) {
|
|
1220
|
+
if (raw === void 0 || raw === null) return {};
|
|
1221
|
+
if (typeof raw === "object" && !Array.isArray(raw)) return raw;
|
|
1222
|
+
if (typeof raw === "string") {
|
|
1223
|
+
let s = raw.trim();
|
|
1224
|
+
if (s.startsWith("\"") && s.endsWith("\"") || s.startsWith("'") && s.endsWith("'")) try {
|
|
1225
|
+
const unquoted = JSON.parse(s);
|
|
1226
|
+
if (typeof unquoted === "string") s = unquoted.trim();
|
|
1227
|
+
} catch {}
|
|
1228
|
+
try {
|
|
1229
|
+
const parsed = JSON.parse(s);
|
|
1230
|
+
if (typeof parsed === "object" && parsed !== null && !Array.isArray(parsed)) return parsed;
|
|
1231
|
+
return { value: parsed };
|
|
1232
|
+
} catch {
|
|
1233
|
+
return { value: raw };
|
|
1234
|
+
}
|
|
1235
|
+
}
|
|
1236
|
+
return { value: raw };
|
|
1237
|
+
}
|
|
1238
|
+
function unwrapMcpTool(toolName, rawArgs) {
|
|
1239
|
+
const input = toolInput({ input: rawArgs });
|
|
1240
|
+
if (/^(call_mcp_tool|callMcpTool|call_mcp|mcp_call)$/i.test(toolName)) {
|
|
1241
|
+
const server = cleanString(pick$1(input, "ServerName", "server_name", "serverName", "server"));
|
|
1242
|
+
const innerTool = cleanString(pick$1(input, "ToolName", "tool_name", "toolName", "name", "tool"));
|
|
1243
|
+
const innerInput = parseInnerArgs(input.Arguments ?? input.arguments ?? input.args ?? input.parameters ?? input.params ?? input.input);
|
|
1244
|
+
if (innerTool !== "") return {
|
|
1245
|
+
tool: innerTool,
|
|
1246
|
+
input: innerInput,
|
|
1247
|
+
...server !== "" ? { server } : {},
|
|
1248
|
+
isMcp: true
|
|
1249
|
+
};
|
|
1250
|
+
}
|
|
1251
|
+
if (toolName.startsWith("mcp__")) {
|
|
1252
|
+
const parts = toolName.slice(5).split("__");
|
|
1253
|
+
if (parts.length >= 2) {
|
|
1254
|
+
const server = parts[0];
|
|
1255
|
+
return {
|
|
1256
|
+
tool: parts.slice(1).join("__"),
|
|
1257
|
+
input,
|
|
1258
|
+
...server ? { server } : {},
|
|
1259
|
+
isMcp: true
|
|
1260
|
+
};
|
|
1261
|
+
}
|
|
1262
|
+
}
|
|
1263
|
+
return {
|
|
1264
|
+
tool: toolName,
|
|
1265
|
+
input,
|
|
1266
|
+
isMcp: false
|
|
1267
|
+
};
|
|
1268
|
+
}
|
|
1269
|
+
function cleanResultText(text) {
|
|
1270
|
+
const trimmed = text.trim();
|
|
1271
|
+
if (trimmed.startsWith("{") && trimmed.endsWith("}")) try {
|
|
1272
|
+
const obj = JSON.parse(trimmed);
|
|
1273
|
+
if (Array.isArray(obj?.content)) {
|
|
1274
|
+
const parts = [];
|
|
1275
|
+
for (const item of obj.content) {
|
|
1276
|
+
const blk = item;
|
|
1277
|
+
if (blk?.type === "text" && typeof blk.text === "string") parts.push(blk.text);
|
|
1278
|
+
}
|
|
1279
|
+
if (parts.length > 0) return parts.join("\n");
|
|
1280
|
+
}
|
|
1281
|
+
} catch {}
|
|
1282
|
+
return text;
|
|
1283
|
+
}
|
|
1206
1284
|
/**
|
|
1207
1285
|
* agy serializes tool args with PascalCase keys (CommandLine, AbsolutePath,
|
|
1208
1286
|
* SearchDirectory, TargetFile, TargetContent, ReplacementContent, CodeContent…);
|
|
@@ -1219,15 +1297,20 @@ function pick$1(input, ...keys) {
|
|
|
1219
1297
|
/** Native pending-card projection for one mirrored agy tool call. */
|
|
1220
1298
|
function presentMirrorCall(args) {
|
|
1221
1299
|
const a = args;
|
|
1222
|
-
const
|
|
1223
|
-
const
|
|
1300
|
+
const unwrapped = unwrapMcpTool(typeof a?.tool === "string" ? a.tool : "", a?.input);
|
|
1301
|
+
const name = unwrapped.tool;
|
|
1302
|
+
const input = unwrapped.input;
|
|
1303
|
+
const server = typeof a?.server === "string" && a.server !== "" ? a.server : unwrapped.server;
|
|
1224
1304
|
switch (name) {
|
|
1225
1305
|
case "run_command":
|
|
1226
1306
|
case "bash":
|
|
1227
|
-
case "execute_command":
|
|
1307
|
+
case "execute_command":
|
|
1308
|
+
case "ops_bash":
|
|
1309
|
+
case "sh":
|
|
1310
|
+
case "shell": {
|
|
1228
1311
|
const command = pick$1(input, "CommandLine", "command_line", "command", "cmd", "Cmd") ?? JSON.stringify(input);
|
|
1229
1312
|
const desc = pick$1(input, "Description", "description", "toolAction", "toolSummary");
|
|
1230
|
-
const cwd = pick$1(input, "Cwd", "cwd", "WorkingDirectory", "working_directory");
|
|
1313
|
+
const cwd = pick$1(input, "Cwd", "cwd", "WorkingDirectory", "working_directory", "workdir", "WorkDir");
|
|
1231
1314
|
return {
|
|
1232
1315
|
card: "terminal",
|
|
1233
1316
|
title: command,
|
|
@@ -1291,8 +1374,10 @@ function presentMirrorCall(args) {
|
|
|
1291
1374
|
}
|
|
1292
1375
|
case "find_by_name":
|
|
1293
1376
|
case "glob":
|
|
1377
|
+
case "ops_glob":
|
|
1294
1378
|
case "search_files": {
|
|
1295
|
-
const
|
|
1379
|
+
const rawPat = input.pattern ?? input.Pattern ?? input.query ?? input.Query ?? input.regex ?? input.Regex ?? input.QueryString;
|
|
1380
|
+
const q = Array.isArray(rawPat) ? rawPat.join(", ") : typeof rawPat === "string" ? rawPat : pick$1(input, "pattern", "Pattern", "query", "Query", "regex", "Regex", "QueryString") ?? "";
|
|
1296
1381
|
return {
|
|
1297
1382
|
card: "generic",
|
|
1298
1383
|
title: pick$1(input, "Description", "description", "toolAction", "toolSummary") ?? (q !== "" ? "Search " + q : "Search"),
|
|
@@ -1301,9 +1386,11 @@ function presentMirrorCall(args) {
|
|
|
1301
1386
|
}
|
|
1302
1387
|
case "grep_search":
|
|
1303
1388
|
case "search":
|
|
1389
|
+
case "ops_grep":
|
|
1304
1390
|
case "search_file_content":
|
|
1305
1391
|
case "grep": {
|
|
1306
|
-
const
|
|
1392
|
+
const rawPat = input.query ?? input.Query ?? input.pattern ?? input.Pattern ?? input.regex ?? input.Regex ?? input.QueryString;
|
|
1393
|
+
const q = Array.isArray(rawPat) ? rawPat.join(", ") : typeof rawPat === "string" ? rawPat : pick$1(input, "query", "Query", "pattern", "Pattern", "regex", "Regex", "QueryString") ?? "";
|
|
1307
1394
|
return {
|
|
1308
1395
|
card: "generic",
|
|
1309
1396
|
title: pick$1(input, "Description", "description", "toolAction", "toolSummary") ?? (q !== "" ? "Search " + q : "Search"),
|
|
@@ -1408,26 +1495,33 @@ function presentMirrorCall(args) {
|
|
|
1408
1495
|
title: prompt ? `Generate Image: ${prompt}` : "Generate Image"
|
|
1409
1496
|
};
|
|
1410
1497
|
}
|
|
1411
|
-
default:
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1498
|
+
default: {
|
|
1499
|
+
const desc = pick$1(input, "Description", "description", "toolAction", "toolSummary");
|
|
1500
|
+
const fallbackTitle = server ? `${server}: ${name}` : name !== "" ? name : "agy tool";
|
|
1501
|
+
return {
|
|
1502
|
+
card: "generic",
|
|
1503
|
+
title: desc ?? fallbackTitle,
|
|
1504
|
+
rawInput: input
|
|
1505
|
+
};
|
|
1506
|
+
}
|
|
1416
1507
|
}
|
|
1417
1508
|
}
|
|
1418
1509
|
/** Native completed-card projection for one mirrored agy tool call. */
|
|
1419
1510
|
function presentMirrorResult(args, result) {
|
|
1420
1511
|
const a = args;
|
|
1421
|
-
const name = typeof a?.tool === "string" ? a.tool : "";
|
|
1422
|
-
const text = resultText$1(result.content);
|
|
1512
|
+
const name = unwrapMcpTool(typeof a?.tool === "string" ? a.tool : "", a?.input).tool;
|
|
1513
|
+
const text = cleanResultText(resultText$1(result.content));
|
|
1423
1514
|
switch (name) {
|
|
1424
1515
|
case "run_command":
|
|
1425
1516
|
case "bash":
|
|
1426
|
-
case "execute_command":
|
|
1517
|
+
case "execute_command":
|
|
1518
|
+
case "ops_bash":
|
|
1519
|
+
case "sh":
|
|
1520
|
+
case "shell": {
|
|
1427
1521
|
let exitCode;
|
|
1428
|
-
const m = /The command exited with code (\d+)/i.exec(text);
|
|
1522
|
+
const m = /The command exited with code (\d+)/i.exec(text) ?? /\[exit code (\d+)\]/i.exec(text);
|
|
1429
1523
|
if (m && m[1]) exitCode = parseInt(m[1], 10);
|
|
1430
|
-
else if (result.isError) exitCode = 1;
|
|
1524
|
+
else if (/\[command timed out/i.test(text) || result.isError) exitCode = 1;
|
|
1431
1525
|
return {
|
|
1432
1526
|
card: "terminal",
|
|
1433
1527
|
output: text,
|
|
@@ -1486,15 +1580,24 @@ function recordingUnavailable(step, toolName, input, reason) {
|
|
|
1486
1580
|
}
|
|
1487
1581
|
function defineAgyMirrorTool(deps) {
|
|
1488
1582
|
const enrichArgs = (args) => {
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1583
|
+
let tool = typeof args.tool === "string" ? args.tool : "";
|
|
1584
|
+
let input = args.input;
|
|
1585
|
+
let server = typeof args.server === "string" ? args.server : void 0;
|
|
1586
|
+
if (tool === "" || /^(call_mcp_tool|callMcpTool|call_mcp|mcp_call)$/i.test(tool)) {
|
|
1587
|
+
const runId = typeof args.run === "string" ? args.run : "";
|
|
1588
|
+
const step = typeof args.step === "number" ? args.step : -1;
|
|
1589
|
+
const t = deps.runs.get(runId)?.toolEventAt(step) ?? null;
|
|
1590
|
+
if (t !== null) {
|
|
1591
|
+
if (tool === "") tool = t.name;
|
|
1592
|
+
input ??= t.args;
|
|
1593
|
+
}
|
|
1594
|
+
}
|
|
1595
|
+
const unwrapped = unwrapMcpTool(tool, input);
|
|
1494
1596
|
return {
|
|
1495
1597
|
...args,
|
|
1496
|
-
tool:
|
|
1497
|
-
|
|
1598
|
+
tool: unwrapped.tool,
|
|
1599
|
+
input: unwrapped.input,
|
|
1600
|
+
...unwrapped.server ? { server: unwrapped.server } : server ? { server } : {}
|
|
1498
1601
|
};
|
|
1499
1602
|
};
|
|
1500
1603
|
return defineTool({
|
|
@@ -1796,6 +1899,7 @@ var EventMapper = class {
|
|
|
1796
1899
|
* banner and the entry is consumed.
|
|
1797
1900
|
*/
|
|
1798
1901
|
bannerOnlyShown = /* @__PURE__ */ new Set();
|
|
1902
|
+
bannerOnlyIndices = /* @__PURE__ */ new Map();
|
|
1799
1903
|
bannerOnlyThinkingEmitted = false;
|
|
1800
1904
|
sawTextStep;
|
|
1801
1905
|
finished = false;
|
|
@@ -1870,7 +1974,10 @@ var EventMapper = class {
|
|
|
1870
1974
|
const hasText = text !== void 0 && text.trim() !== "";
|
|
1871
1975
|
if (!hasText && !allowBannerOnly) return;
|
|
1872
1976
|
const bannerAlreadyShown = this.bannerOnlyShown.has(stepKey);
|
|
1873
|
-
if (hasText)
|
|
1977
|
+
if (hasText) {
|
|
1978
|
+
this.bannerOnlyShown.delete(stepKey);
|
|
1979
|
+
this.bannerOnlyIndices.delete(stepKey);
|
|
1980
|
+
} else this.bannerOnlyIndices.set(stepKey, absIndex);
|
|
1874
1981
|
yield* this.ensureBlock("reasoning");
|
|
1875
1982
|
const banner = thoughtTokens > 0 ? "[agy · " + thoughtTokens + " tokens]" : "[agy]";
|
|
1876
1983
|
const combined = !hasText ? `${banner}\n` : bannerAlreadyShown ? `${text.trim()}\n` : `${banner} ${text.trim()}\n`;
|
|
@@ -1882,10 +1989,27 @@ var EventMapper = class {
|
|
|
1882
1989
|
* it mints the mirror callId and is what continuation detection parses
|
|
1883
1990
|
* back out of the DSH message list.
|
|
1884
1991
|
*/
|
|
1992
|
+
/**
|
|
1993
|
+
* Flush any thinking prose that resolved in the DB after its banner-only
|
|
1994
|
+
* placeholder already streamed (e.g. tool-heavy steps where thoughts resolved
|
|
1995
|
+
* during tool execution).
|
|
1996
|
+
*/
|
|
1997
|
+
*flushBannerOnlyThoughts() {
|
|
1998
|
+
if (this.bannerOnlyShown.size === 0) return;
|
|
1999
|
+
for (const [stepKey, absIdx] of Array.from(this.bannerOnlyIndices.entries())) {
|
|
2000
|
+
if (!this.bannerOnlyShown.has(stepKey)) continue;
|
|
2001
|
+
const text = this.opts.resolvedThoughts?.get(absIdx);
|
|
2002
|
+
if (text !== void 0 && text.trim() !== "") {
|
|
2003
|
+
yield* this.emitThinking(stepKey, absIdx, 0);
|
|
2004
|
+
this.bannerOnlyIndices.delete(stepKey);
|
|
2005
|
+
}
|
|
2006
|
+
}
|
|
2007
|
+
}
|
|
1885
2008
|
*map(ev, absIndex) {
|
|
1886
2009
|
if (this.finished) return;
|
|
1887
2010
|
if (ev.kind === "init") return;
|
|
1888
2011
|
if (ev.kind === "garbage") return;
|
|
2012
|
+
yield* this.flushBannerOnlyThoughts();
|
|
1889
2013
|
if (ev.kind === "step") {
|
|
1890
2014
|
if (ev.usage) this.opts.usage?.noteStepUsage(ev.usage);
|
|
1891
2015
|
if (ev.stepKind === "text") {
|
|
@@ -1962,7 +2086,9 @@ var EventMapper = class {
|
|
|
1962
2086
|
if (this.opts.cutOnTool && !this.finished && ev.state === "ACTIVE" && !this.pendingAnnounced.has(ev.stepKey)) {
|
|
1963
2087
|
this.pendingAnnounced.add(ev.stepKey);
|
|
1964
2088
|
yield* this.ensureBlock("reasoning");
|
|
1965
|
-
const
|
|
2089
|
+
const unwrapped = unwrapMcpTool(ev.tool.name, ev.tool.args);
|
|
2090
|
+
const label = unwrapped.server ? `${unwrapped.tool} (${unwrapped.server})` : unwrapped.tool;
|
|
2091
|
+
const d = this.appendDelta("[agy tool running: " + label + " — the result card streams when it finishes]\n");
|
|
1966
2092
|
if (d) yield d;
|
|
1967
2093
|
}
|
|
1968
2094
|
return;
|
|
@@ -1970,6 +2096,7 @@ var EventMapper = class {
|
|
|
1970
2096
|
if (this.announcedTools.has(ev.stepKey)) return;
|
|
1971
2097
|
this.announcedTools.add(ev.stepKey);
|
|
1972
2098
|
if (!this.opts.cutOnTool) return;
|
|
2099
|
+
yield* this.flushBannerOnlyThoughts();
|
|
1973
2100
|
const close = this.closeOpen();
|
|
1974
2101
|
if (close) yield close;
|
|
1975
2102
|
const idx = this.blockIdx;
|
|
@@ -1980,11 +2107,14 @@ var EventMapper = class {
|
|
|
1980
2107
|
...fullArgs,
|
|
1981
2108
|
...typeof ev.tool.args === "object" ? ev.tool.args : {}
|
|
1982
2109
|
} : ev.tool.args;
|
|
1983
|
-
const
|
|
2110
|
+
const unwrapped = unwrapMcpTool(ev.tool.name, effectiveArgs);
|
|
2111
|
+
const brief = toolStepBrief(unwrapped.tool, unwrapped.input, unwrapped.server);
|
|
2112
|
+
const argumentsJson = useCode ? JSON.stringify(buildMirrorRunCode(this.opts.runId, absIndex, unwrapped.tool, brief)) : JSON.stringify({
|
|
1984
2113
|
run: this.opts.runId,
|
|
1985
2114
|
step: absIndex,
|
|
1986
|
-
tool:
|
|
1987
|
-
...
|
|
2115
|
+
tool: unwrapped.tool,
|
|
2116
|
+
...unwrapped.server !== void 0 ? { server: unwrapped.server } : {},
|
|
2117
|
+
...unwrapped.input !== void 0 ? { input: unwrapped.input } : {}
|
|
1988
2118
|
});
|
|
1989
2119
|
const rawCallId = mirrorCallId(this.opts.runId, absIndex);
|
|
1990
2120
|
const assignedCallId = rememberToolCallId(this.toolCallStates, rawCallId, toolName);
|
|
@@ -2038,6 +2168,7 @@ var EventMapper = class {
|
|
|
2038
2168
|
const d = this.appendDelta(ev.response);
|
|
2039
2169
|
if (d) yield d;
|
|
2040
2170
|
}
|
|
2171
|
+
yield* this.flushBannerOnlyThoughts();
|
|
2041
2172
|
const close = this.closeOpen();
|
|
2042
2173
|
if (close) yield close;
|
|
2043
2174
|
yield {
|
|
@@ -29620,11 +29751,13 @@ function conversationsDirCandidates(accountHome) {
|
|
|
29620
29751
|
if (gch !== void 0 && gch !== "") push(join(gch, "antigravity-cli", "conversations"));
|
|
29621
29752
|
push(AGY_DB_DIR);
|
|
29622
29753
|
push(join(homedir(), ".gemini", "antigravity-cli", "conversations"));
|
|
29623
|
-
const
|
|
29624
|
-
|
|
29625
|
-
|
|
29754
|
+
const realHome = process.env.USERPROFILE || process.env.HOME || homedir();
|
|
29755
|
+
const poolBases = [join(homedir(), ".dsh", "agy-accounts")];
|
|
29756
|
+
if (realHome && realHome !== homedir()) poolBases.push(join(realHome, ".dsh", "agy-accounts"));
|
|
29757
|
+
for (const pb of poolBases) try {
|
|
29758
|
+
for (const ent of readdirSync(pb)) {
|
|
29626
29759
|
if (ent.startsWith(".")) continue;
|
|
29627
|
-
push(join(
|
|
29760
|
+
push(join(pb, ent, ".gemini", "antigravity-cli", "conversations"));
|
|
29628
29761
|
}
|
|
29629
29762
|
} catch {}
|
|
29630
29763
|
return dirs;
|
|
@@ -30105,7 +30238,7 @@ async function readFullToolArgs(conversationId, stepIndex, accountHome) {
|
|
|
30105
30238
|
if (cache?.conversationId === conversationId && cache.loaded && now - cacheTime < MAX_CACHE_AGE_MS) {
|
|
30106
30239
|
const cached = cache.steps.get(stepIndex);
|
|
30107
30240
|
if (cached !== void 0) return cached;
|
|
30108
|
-
if (cache.checkedSteps.has(stepIndex)) return null;
|
|
30241
|
+
if (cache.checkedSteps.has(stepIndex) && now - cacheTime < 500) return null;
|
|
30109
30242
|
}
|
|
30110
30243
|
await loadCached(conversationId, accountHome);
|
|
30111
30244
|
return cache?.steps.get(stepIndex) ?? null;
|
|
@@ -30121,7 +30254,7 @@ async function readStepThoughts(conversationId, stepIndex, accountHome) {
|
|
|
30121
30254
|
if (cache?.conversationId === conversationId && cache.loaded && now - cacheTime < MAX_CACHE_AGE_MS) {
|
|
30122
30255
|
const cached = cache.thoughts.get(stepIndex);
|
|
30123
30256
|
if (cached !== void 0) return cached;
|
|
30124
|
-
if (cache.checkedSteps.has(stepIndex)) return null;
|
|
30257
|
+
if (cache.checkedSteps.has(stepIndex) && now - cacheTime < 500) return null;
|
|
30125
30258
|
}
|
|
30126
30259
|
await loadCached(conversationId, accountHome);
|
|
30127
30260
|
return cache?.thoughts.get(stepIndex) ?? null;
|
|
@@ -31759,13 +31892,14 @@ var AgyAdapter = class AgyAdapter extends LlmAdapter {
|
|
|
31759
31892
|
supportsPlanExit
|
|
31760
31893
|
});
|
|
31761
31894
|
let i = from;
|
|
31895
|
+
const pendingThoughtSteps = /* @__PURE__ */ new Map();
|
|
31762
31896
|
try {
|
|
31763
31897
|
for await (const ev of rec.eventsFrom(from)) {
|
|
31764
31898
|
if (abortedLocally || signal?.aborted) break;
|
|
31765
31899
|
const recordedThought = rec.getThoughts(i);
|
|
31766
31900
|
if (recordedThought !== void 0) resolvedThoughts.set(i, recordedThought);
|
|
31767
31901
|
else if (ev.kind === "step") {
|
|
31768
|
-
const rawObj = ev.raw && typeof ev.raw === "object" ? ev.raw : null;
|
|
31902
|
+
const rawObj = "raw" in ev && ev.raw && typeof ev.raw === "object" ? ev.raw : null;
|
|
31769
31903
|
const stepUpdate = rawObj?.step_update && typeof rawObj.step_update === "object" ? rawObj.step_update : null;
|
|
31770
31904
|
const activeConvId = rec.conversationId ?? (typeof rawObj?.conversation_id === "string" ? rawObj.conversation_id : null) ?? (typeof stepUpdate?.conversation_id === "string" ? stepUpdate.conversation_id : null);
|
|
31771
31905
|
const stepIdx = parseInt(ev.stepKey, 10);
|
|
@@ -31782,11 +31916,27 @@ var AgyAdapter = class AgyAdapter extends LlmAdapter {
|
|
|
31782
31916
|
if (th !== null && th.trim() !== "") {
|
|
31783
31917
|
resolvedThoughts.set(i, th);
|
|
31784
31918
|
rec.setThoughts(i, th);
|
|
31785
|
-
}
|
|
31919
|
+
} else if ((ev.usage?.thinking_tokens ?? 0) > 0 || ev.stepKind === "thinking") pendingThoughtSteps.set(i, ev.stepKey);
|
|
31786
31920
|
} catch {}
|
|
31787
31921
|
}
|
|
31922
|
+
if (pendingThoughtSteps.size > 0) {
|
|
31923
|
+
const rawObj = "raw" in ev && ev.raw && typeof ev.raw === "object" ? ev.raw : null;
|
|
31924
|
+
const stepUpdate = rawObj?.step_update && typeof rawObj.step_update === "object" ? rawObj.step_update : null;
|
|
31925
|
+
const activeConvId = rec.conversationId ?? (typeof rawObj?.conversation_id === "string" ? rawObj.conversation_id : null) ?? (typeof stepUpdate?.conversation_id === "string" ? stepUpdate.conversation_id : null);
|
|
31926
|
+
if (activeConvId !== null) for (const [prevI, prevStepKey] of Array.from(pendingThoughtSteps.entries())) {
|
|
31927
|
+
const prevStepIdx = parseInt(prevStepKey, 10);
|
|
31928
|
+
if (Number.isFinite(prevStepIdx)) try {
|
|
31929
|
+
const th = await readStepThoughts(activeConvId, prevStepIdx, rec.accountHome);
|
|
31930
|
+
if (th !== null && th.trim() !== "") {
|
|
31931
|
+
resolvedThoughts.set(prevI, th);
|
|
31932
|
+
rec.setThoughts(prevI, th);
|
|
31933
|
+
pendingThoughtSteps.delete(prevI);
|
|
31934
|
+
}
|
|
31935
|
+
} catch {}
|
|
31936
|
+
}
|
|
31937
|
+
}
|
|
31788
31938
|
if (ev.kind === "step" && ev.stepKind === "tool" && ev.tool) {
|
|
31789
|
-
const rawObj = ev.raw && typeof ev.raw === "object" ? ev.raw : null;
|
|
31939
|
+
const rawObj = "raw" in ev && ev.raw && typeof ev.raw === "object" ? ev.raw : null;
|
|
31790
31940
|
const stepUpdate = rawObj?.step_update && typeof rawObj.step_update === "object" ? rawObj.step_update : null;
|
|
31791
31941
|
const activeConvId = rec.conversationId ?? (typeof rawObj?.conversation_id === "string" ? rawObj.conversation_id : null) ?? (typeof stepUpdate?.conversation_id === "string" ? stepUpdate.conversation_id : null);
|
|
31792
31942
|
const stepIdx = parseInt(ev.stepKey, 10);
|
|
@@ -31801,9 +31951,10 @@ var AgyAdapter = class AgyAdapter extends LlmAdapter {
|
|
|
31801
31951
|
rec.setFullArgs(i, full.args);
|
|
31802
31952
|
}
|
|
31803
31953
|
} catch {}
|
|
31804
|
-
const
|
|
31954
|
+
const unwrapped = unwrapMcpTool(ev.tool.name, resolved.get(i) ?? ev.tool.args);
|
|
31955
|
+
const toolName = unwrapped.tool;
|
|
31805
31956
|
if (toolName === "write_to_file" || toolName === "write_file" || toolName === "create_file") {
|
|
31806
|
-
const currentArgs =
|
|
31957
|
+
const currentArgs = unwrapped.input;
|
|
31807
31958
|
const targetFile = currentArgs.TargetFile ?? currentArgs.target_file ?? currentArgs.path ?? currentArgs.AbsolutePath;
|
|
31808
31959
|
if (targetFile && typeof targetFile === "string" && !currentArgs.oldText && !currentArgs.old_string && !currentArgs.TargetContent) {
|
|
31809
31960
|
const head = getGitHeadContent(targetFile);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-agy-link",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.100",
|
|
4
4
|
"description": "Google Antigravity (agy CLI) models for DeepSeek Harness — stream Gemini/Claude/GPT-OSS subscriptions into DSH with thinking, tool activity, token usage and in-GUI Google OAuth login.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|