@codexhost/cli-darwin-x64 0.16.0 → 0.17.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/README.md +2 -2
- package/THIRD_PARTY_NOTICES.txt +6 -2
- package/app/codexhost-distribution.json +1 -1
- package/app/console-server.mjs +59 -21
- package/app/console-web.js +49 -18
- package/app/desktop-controller.mjs +554 -34
- package/app/host-runtime.mjs +3436 -1846
- package/app/plugins/antigravity/plugin.mjs +39 -3
- package/app/plugins/claude-code/plugin.mjs +16 -7
- package/app/plugins/codebuddy/plugin.mjs +14 -1
- package/app/plugins/codex-usage/plugin.mjs +4 -1
- package/app/plugins/copilot/plugin.mjs +4 -1
- package/app/plugins/cursor-cli/plugin.mjs +13 -6
- package/app/plugins/deepseek-harness/plugin.mjs +463 -47
- package/app/plugins/devin/assets/icon.svg +1 -0
- package/app/plugins/devin/manifest.json +30 -0
- package/app/plugins/devin/plugin.mjs +23363 -0
- package/app/plugins/enabled.json +2 -0
- package/app/plugins/grok/plugin.mjs +476 -392
- package/app/plugins/hermes/plugin.mjs +457 -197
- package/app/plugins/kimi-code/plugin.mjs +4 -1
- package/app/plugins/kiro-cli/plugin.mjs +4 -1
- package/app/plugins/omp/plugin.mjs +4 -1
- package/app/plugins/opencode/plugin.mjs +4 -1
- package/app/plugins/pi/plugin.mjs +1464 -412
- package/app/plugins/qoder/plugin.mjs +9528 -8655
- package/app/plugins/qoder-cn/plugin.mjs +9528 -8655
- package/app/plugins/qwen-code/assets/icon.svg +1 -0
- package/app/plugins/qwen-code/manifest.json +29 -0
- package/app/plugins/qwen-code/plugin.mjs +29298 -0
- package/app/plugins/workbuddy/plugin.mjs +14 -1
- package/app/plugins/zcode/plugin.mjs +4 -1
- package/app/renderer-extension.js +510 -114
- package/bin/codexhost +0 -0
- package/libexec/codexhost-shim +0 -0
- package/libexec/codexhost-updater +0 -0
- package/licenses/Qwen-Code-SDK-LICENSE.txt +203 -0
- package/package.json +2 -2
|
@@ -603,7 +603,7 @@ async function readGrokCredentials(environment) {
|
|
|
603
603
|
}
|
|
604
604
|
|
|
605
605
|
// dist/grok-adapter.js
|
|
606
|
-
import
|
|
606
|
+
import path16 from "node:path";
|
|
607
607
|
|
|
608
608
|
// ../../../node_modules/zod/v4/classic/external.js
|
|
609
609
|
var external_exports = {};
|
|
@@ -1371,10 +1371,10 @@ function mergeDefs(...defs) {
|
|
|
1371
1371
|
function cloneDef(schema) {
|
|
1372
1372
|
return mergeDefs(schema._zod.def);
|
|
1373
1373
|
}
|
|
1374
|
-
function getElementAtPath(obj,
|
|
1375
|
-
if (!
|
|
1374
|
+
function getElementAtPath(obj, path17) {
|
|
1375
|
+
if (!path17)
|
|
1376
1376
|
return obj;
|
|
1377
|
-
return
|
|
1377
|
+
return path17.reduce((acc, key) => acc?.[key], obj);
|
|
1378
1378
|
}
|
|
1379
1379
|
function promiseAllObject(promisesObj) {
|
|
1380
1380
|
const keys = Object.keys(promisesObj);
|
|
@@ -1783,11 +1783,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
1783
1783
|
}
|
|
1784
1784
|
return false;
|
|
1785
1785
|
}
|
|
1786
|
-
function prefixIssues(
|
|
1786
|
+
function prefixIssues(path17, issues) {
|
|
1787
1787
|
return issues.map((iss) => {
|
|
1788
1788
|
var _a3;
|
|
1789
1789
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
1790
|
-
iss.path.unshift(
|
|
1790
|
+
iss.path.unshift(path17);
|
|
1791
1791
|
return iss;
|
|
1792
1792
|
});
|
|
1793
1793
|
}
|
|
@@ -1934,16 +1934,16 @@ function flattenError(error53, mapper = (issue2) => issue2.message) {
|
|
|
1934
1934
|
}
|
|
1935
1935
|
function formatError(error53, mapper = (issue2) => issue2.message) {
|
|
1936
1936
|
const fieldErrors = { _errors: [] };
|
|
1937
|
-
const processError = (error54,
|
|
1937
|
+
const processError = (error54, path17 = []) => {
|
|
1938
1938
|
for (const issue2 of error54.issues) {
|
|
1939
1939
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
1940
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
1940
|
+
issue2.errors.map((issues) => processError({ issues }, [...path17, ...issue2.path]));
|
|
1941
1941
|
} else if (issue2.code === "invalid_key") {
|
|
1942
|
-
processError({ issues: issue2.issues }, [...
|
|
1942
|
+
processError({ issues: issue2.issues }, [...path17, ...issue2.path]);
|
|
1943
1943
|
} else if (issue2.code === "invalid_element") {
|
|
1944
|
-
processError({ issues: issue2.issues }, [...
|
|
1944
|
+
processError({ issues: issue2.issues }, [...path17, ...issue2.path]);
|
|
1945
1945
|
} else {
|
|
1946
|
-
const fullpath = [...
|
|
1946
|
+
const fullpath = [...path17, ...issue2.path];
|
|
1947
1947
|
if (fullpath.length === 0) {
|
|
1948
1948
|
fieldErrors._errors.push(mapper(issue2));
|
|
1949
1949
|
} else {
|
|
@@ -1970,17 +1970,17 @@ function formatError(error53, mapper = (issue2) => issue2.message) {
|
|
|
1970
1970
|
}
|
|
1971
1971
|
function treeifyError(error53, mapper = (issue2) => issue2.message) {
|
|
1972
1972
|
const result = { errors: [] };
|
|
1973
|
-
const processError = (error54,
|
|
1973
|
+
const processError = (error54, path17 = []) => {
|
|
1974
1974
|
var _a3, _b;
|
|
1975
1975
|
for (const issue2 of error54.issues) {
|
|
1976
1976
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
1977
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
1977
|
+
issue2.errors.map((issues) => processError({ issues }, [...path17, ...issue2.path]));
|
|
1978
1978
|
} else if (issue2.code === "invalid_key") {
|
|
1979
|
-
processError({ issues: issue2.issues }, [...
|
|
1979
|
+
processError({ issues: issue2.issues }, [...path17, ...issue2.path]);
|
|
1980
1980
|
} else if (issue2.code === "invalid_element") {
|
|
1981
|
-
processError({ issues: issue2.issues }, [...
|
|
1981
|
+
processError({ issues: issue2.issues }, [...path17, ...issue2.path]);
|
|
1982
1982
|
} else {
|
|
1983
|
-
const fullpath = [...
|
|
1983
|
+
const fullpath = [...path17, ...issue2.path];
|
|
1984
1984
|
if (fullpath.length === 0) {
|
|
1985
1985
|
result.errors.push(mapper(issue2));
|
|
1986
1986
|
continue;
|
|
@@ -2012,8 +2012,8 @@ function treeifyError(error53, mapper = (issue2) => issue2.message) {
|
|
|
2012
2012
|
}
|
|
2013
2013
|
function toDotPath(_path) {
|
|
2014
2014
|
const segs = [];
|
|
2015
|
-
const
|
|
2016
|
-
for (const seg of
|
|
2015
|
+
const path17 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
2016
|
+
for (const seg of path17) {
|
|
2017
2017
|
if (typeof seg === "number")
|
|
2018
2018
|
segs.push(`[${seg}]`);
|
|
2019
2019
|
else if (typeof seg === "symbol")
|
|
@@ -14705,13 +14705,13 @@ function resolveRef(ref, ctx) {
|
|
|
14705
14705
|
if (!ref.startsWith("#")) {
|
|
14706
14706
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
14707
14707
|
}
|
|
14708
|
-
const
|
|
14709
|
-
if (
|
|
14708
|
+
const path17 = ref.slice(1).split("/").filter(Boolean);
|
|
14709
|
+
if (path17.length === 0) {
|
|
14710
14710
|
return ctx.rootSchema;
|
|
14711
14711
|
}
|
|
14712
14712
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
14713
|
-
if (
|
|
14714
|
-
const key =
|
|
14713
|
+
if (path17[0] === defsKey) {
|
|
14714
|
+
const key = path17[1];
|
|
14715
14715
|
if (!key || !ctx.defs[key]) {
|
|
14716
14716
|
throw new Error(`Reference not found: ${ref}`);
|
|
14717
14717
|
}
|
|
@@ -16165,7 +16165,10 @@ var harnessPluginRouteSchema = external_exports.object({
|
|
|
16165
16165
|
harnessId: harnessPluginIdSchema,
|
|
16166
16166
|
model: harnessModelRefSchema.optional(),
|
|
16167
16167
|
thinkingOptionId: harnessThinkingOptionIdSchema.optional(),
|
|
16168
|
-
permissionModeId: harnessPermissionModeIdSchema.optional()
|
|
16168
|
+
permissionModeId: harnessPermissionModeIdSchema.optional(),
|
|
16169
|
+
/** A draft prewarm create: stays unsubmitted until the user's first Turn.
|
|
16170
|
+
* Desktop forwards only the Model of a main-process prewarm to thread/start. */
|
|
16171
|
+
prewarm: external_exports.literal(true).optional()
|
|
16169
16172
|
}).strict();
|
|
16170
16173
|
|
|
16171
16174
|
// ../../shared-contracts/dist/harness-launch-settings.js
|
|
@@ -16974,11 +16977,371 @@ function mergeLiveHarnessCommands(builtIns, idPrefix, live, exclusions = {}) {
|
|
|
16974
16977
|
return harnessCommandCatalogSchema.parse({ commands: [...builtIns.commands, ...dynamic] });
|
|
16975
16978
|
}
|
|
16976
16979
|
|
|
16980
|
+
// ../../harness-adapter/dist/local-media-markdown.js
|
|
16981
|
+
import { existsSync, statSync } from "node:fs";
|
|
16982
|
+
import path7 from "node:path";
|
|
16983
|
+
import { fileURLToPath } from "node:url";
|
|
16984
|
+
var MEDIA_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
16985
|
+
".aac",
|
|
16986
|
+
".gif",
|
|
16987
|
+
".jpeg",
|
|
16988
|
+
".jpg",
|
|
16989
|
+
".m4a",
|
|
16990
|
+
".m4v",
|
|
16991
|
+
".mov",
|
|
16992
|
+
".mp3",
|
|
16993
|
+
".mp4",
|
|
16994
|
+
".ogg",
|
|
16995
|
+
".png",
|
|
16996
|
+
".svg",
|
|
16997
|
+
".wav",
|
|
16998
|
+
".webm",
|
|
16999
|
+
".webp"
|
|
17000
|
+
]);
|
|
17001
|
+
function rewriteLocalMediaMarkdown(text, roots, options = {}) {
|
|
17002
|
+
return projectLocalMedia(text, roots, options.exists ?? mediaFileExists, options.holdIncomplete === true, options.relativeImagesOnly === true).text;
|
|
17003
|
+
}
|
|
17004
|
+
var LocalMediaMarkdownStream = class {
|
|
17005
|
+
#roots;
|
|
17006
|
+
#exists;
|
|
17007
|
+
#relativeImagesOnly;
|
|
17008
|
+
#native = "";
|
|
17009
|
+
#text = "";
|
|
17010
|
+
/** Native text length represented by `#text`; the rest is held. */
|
|
17011
|
+
#consumed = 0;
|
|
17012
|
+
#verbatim = false;
|
|
17013
|
+
constructor(roots, exists = mediaFileExists, options = {}) {
|
|
17014
|
+
this.#roots = [...roots];
|
|
17015
|
+
this.#relativeImagesOnly = options.relativeImagesOnly === true;
|
|
17016
|
+
const known = /* @__PURE__ */ new Map();
|
|
17017
|
+
this.#exists = (absolutePath) => {
|
|
17018
|
+
let found = known.get(absolutePath);
|
|
17019
|
+
if (found === void 0) {
|
|
17020
|
+
found = exists(absolutePath);
|
|
17021
|
+
known.set(absolutePath, found);
|
|
17022
|
+
}
|
|
17023
|
+
return found;
|
|
17024
|
+
};
|
|
17025
|
+
}
|
|
17026
|
+
/** Projected text published so far: every returned delta, concatenated. */
|
|
17027
|
+
get text() {
|
|
17028
|
+
return this.#text;
|
|
17029
|
+
}
|
|
17030
|
+
/** Add native text and return the projected text it makes publishable, possibly empty. */
|
|
17031
|
+
append(text) {
|
|
17032
|
+
this.#native += text;
|
|
17033
|
+
return this.#advance(true);
|
|
17034
|
+
}
|
|
17035
|
+
/** Return the projected text still held at the end of the stream. */
|
|
17036
|
+
flush() {
|
|
17037
|
+
return this.#advance(false);
|
|
17038
|
+
}
|
|
17039
|
+
#advance(holdIncomplete) {
|
|
17040
|
+
const next = this.#verbatim ? void 0 : projectLocalMedia(this.#native, this.#roots, this.#exists, holdIncomplete, this.#relativeImagesOnly);
|
|
17041
|
+
let delta;
|
|
17042
|
+
if (next?.text.startsWith(this.#text)) {
|
|
17043
|
+
delta = next.text.slice(this.#text.length);
|
|
17044
|
+
this.#consumed = next.consumed;
|
|
17045
|
+
} else {
|
|
17046
|
+
this.#verbatim = true;
|
|
17047
|
+
delta = this.#native.slice(this.#consumed);
|
|
17048
|
+
this.#consumed = this.#native.length;
|
|
17049
|
+
}
|
|
17050
|
+
this.#text += delta;
|
|
17051
|
+
return delta;
|
|
17052
|
+
}
|
|
17053
|
+
};
|
|
17054
|
+
function projectLocalMedia(text, roots, exists, holdIncomplete, relativeImagesOnly) {
|
|
17055
|
+
let output = "";
|
|
17056
|
+
let index = 0;
|
|
17057
|
+
let fence = null;
|
|
17058
|
+
while (index < text.length) {
|
|
17059
|
+
if (fence) {
|
|
17060
|
+
const close = closingFenceEnd(text, index, fence.marker, fence.length);
|
|
17061
|
+
if (close === -1)
|
|
17062
|
+
break;
|
|
17063
|
+
output += text.slice(index, close);
|
|
17064
|
+
index = close;
|
|
17065
|
+
fence = null;
|
|
17066
|
+
continue;
|
|
17067
|
+
}
|
|
17068
|
+
const next = earliestIndex([
|
|
17069
|
+
text.indexOf("![", index),
|
|
17070
|
+
text.indexOf("`", index),
|
|
17071
|
+
indexOfLineStartTilde(text, index)
|
|
17072
|
+
]);
|
|
17073
|
+
if (next === -1)
|
|
17074
|
+
break;
|
|
17075
|
+
output += text.slice(index, next);
|
|
17076
|
+
index = next;
|
|
17077
|
+
const marker = text[next];
|
|
17078
|
+
let markerLength = 1;
|
|
17079
|
+
if (marker === "`" || marker === "~") {
|
|
17080
|
+
let runEnd = next;
|
|
17081
|
+
while (text[runEnd] === marker)
|
|
17082
|
+
runEnd += 1;
|
|
17083
|
+
markerLength = runEnd - next;
|
|
17084
|
+
if (runEnd === text.length && holdIncomplete) {
|
|
17085
|
+
return { text: output, consumed: next };
|
|
17086
|
+
}
|
|
17087
|
+
if (runEnd - next >= 3) {
|
|
17088
|
+
const kind = fenceLineKind(text, next);
|
|
17089
|
+
if (kind === "opaque")
|
|
17090
|
+
break;
|
|
17091
|
+
if (kind === "flat") {
|
|
17092
|
+
fence = { marker, length: runEnd - next };
|
|
17093
|
+
output += text.slice(next, runEnd);
|
|
17094
|
+
index = runEnd;
|
|
17095
|
+
continue;
|
|
17096
|
+
}
|
|
17097
|
+
}
|
|
17098
|
+
if (marker === "~") {
|
|
17099
|
+
output += text.slice(next, runEnd);
|
|
17100
|
+
index = runEnd;
|
|
17101
|
+
continue;
|
|
17102
|
+
}
|
|
17103
|
+
}
|
|
17104
|
+
if (text.startsWith("![", next)) {
|
|
17105
|
+
const image = parseMarkdownImage(text, next);
|
|
17106
|
+
if (image.kind === "text") {
|
|
17107
|
+
output += text.slice(next, image.end);
|
|
17108
|
+
index = image.end;
|
|
17109
|
+
continue;
|
|
17110
|
+
}
|
|
17111
|
+
if (image.kind === "open") {
|
|
17112
|
+
if (!holdIncomplete)
|
|
17113
|
+
break;
|
|
17114
|
+
return { text: output + text.slice(next, image.holdFrom), consumed: image.holdFrom };
|
|
17115
|
+
}
|
|
17116
|
+
const resolved2 = relativeImagesOnly && /^(?:[\\/]|[a-z][a-z\d+.-]*:)/i.test(image.destination.trim()) ? null : resolveLocalMediaPath(image.destination, roots, exists);
|
|
17117
|
+
output += resolved2 === null ? text.slice(next, image.end) : text.slice(next, image.destinationStart) + markdownDestination(resolved2, image.bracketed) + text.slice(image.destinationEnd, image.end);
|
|
17118
|
+
index = image.end;
|
|
17119
|
+
continue;
|
|
17120
|
+
}
|
|
17121
|
+
const code = parseInlineCode(text, next, markerLength);
|
|
17122
|
+
if (code.kind !== "code" || holdIncomplete && code.end === text.length) {
|
|
17123
|
+
if (holdIncomplete && code.kind !== "text")
|
|
17124
|
+
return { text: output, consumed: next };
|
|
17125
|
+
output += text.slice(next, next + markerLength);
|
|
17126
|
+
index = next + markerLength;
|
|
17127
|
+
continue;
|
|
17128
|
+
}
|
|
17129
|
+
const resolved = relativeImagesOnly || markerLength !== 1 || /[\r\n]/u.test(code.content) ? null : resolveLocalMediaPath(code.content, roots, exists);
|
|
17130
|
+
output += resolved === null ? text.slice(next, code.end) : mediaMarkdownImage(resolved);
|
|
17131
|
+
index = code.end;
|
|
17132
|
+
}
|
|
17133
|
+
return { text: output + text.slice(index), consumed: text.length };
|
|
17134
|
+
}
|
|
17135
|
+
function fenceLineKind(text, index) {
|
|
17136
|
+
const prefix = text.slice(text.lastIndexOf("\n", index - 1) + 1, index);
|
|
17137
|
+
if (prefix === "")
|
|
17138
|
+
return "flat";
|
|
17139
|
+
let remaining = prefix.replace(/^[ \t]+/u, "");
|
|
17140
|
+
while (remaining) {
|
|
17141
|
+
const marker = /^(?:>|(?:[-+*]|\d{1,9}[.)])(?=[ \t]))[ \t]*/u.exec(remaining);
|
|
17142
|
+
if (!marker)
|
|
17143
|
+
return null;
|
|
17144
|
+
remaining = remaining.slice(marker[0].length);
|
|
17145
|
+
}
|
|
17146
|
+
return "opaque";
|
|
17147
|
+
}
|
|
17148
|
+
function indexOfLineStartTilde(text, start) {
|
|
17149
|
+
for (let tilde = text.indexOf("~", start); tilde !== -1; tilde = text.indexOf("~", tilde + 1)) {
|
|
17150
|
+
if (fenceLineKind(text, tilde) !== null)
|
|
17151
|
+
return tilde;
|
|
17152
|
+
}
|
|
17153
|
+
return -1;
|
|
17154
|
+
}
|
|
17155
|
+
function closingFenceEnd(text, start, marker, length) {
|
|
17156
|
+
const closing = new RegExp(`^ {0,3}${marker === "`" ? "`" : "~"}{${length},}[ \\t]*\\r?$`, "u");
|
|
17157
|
+
let lineStart = text.indexOf("\n", start);
|
|
17158
|
+
while (lineStart !== -1) {
|
|
17159
|
+
lineStart += 1;
|
|
17160
|
+
const newline2 = text.indexOf("\n", lineStart);
|
|
17161
|
+
const lineEnd = newline2 === -1 ? text.length : newline2;
|
|
17162
|
+
if (closing.test(text.slice(lineStart, lineEnd)))
|
|
17163
|
+
return lineEnd;
|
|
17164
|
+
lineStart = newline2;
|
|
17165
|
+
}
|
|
17166
|
+
return -1;
|
|
17167
|
+
}
|
|
17168
|
+
function earliestIndex(candidates) {
|
|
17169
|
+
let next = -1;
|
|
17170
|
+
for (const candidate of candidates) {
|
|
17171
|
+
if (candidate === -1)
|
|
17172
|
+
continue;
|
|
17173
|
+
if (next === -1 || candidate < next)
|
|
17174
|
+
next = candidate;
|
|
17175
|
+
}
|
|
17176
|
+
return next;
|
|
17177
|
+
}
|
|
17178
|
+
function parseInlineCode(text, start, length) {
|
|
17179
|
+
let index = start + length;
|
|
17180
|
+
while (index < text.length) {
|
|
17181
|
+
const tick = text.indexOf("`", index);
|
|
17182
|
+
if (/\n[^\S\n]*\n/u.test(text.slice(index, tick < 0 ? text.length : tick))) {
|
|
17183
|
+
return { kind: "text" };
|
|
17184
|
+
}
|
|
17185
|
+
if (tick === -1)
|
|
17186
|
+
break;
|
|
17187
|
+
let end = tick + 1;
|
|
17188
|
+
while (text[end] === "`")
|
|
17189
|
+
end += 1;
|
|
17190
|
+
if (end - tick === length) {
|
|
17191
|
+
return { kind: "code", content: text.slice(start + length, tick), end };
|
|
17192
|
+
}
|
|
17193
|
+
index = end;
|
|
17194
|
+
}
|
|
17195
|
+
return { kind: "open" };
|
|
17196
|
+
}
|
|
17197
|
+
function parseMarkdownImage(text, start) {
|
|
17198
|
+
const openLabel = { kind: "open", holdFrom: start + 2 };
|
|
17199
|
+
let index = start + 2;
|
|
17200
|
+
while (index < text.length) {
|
|
17201
|
+
const character = text[index];
|
|
17202
|
+
if (character === "\n")
|
|
17203
|
+
return { kind: "text", end: start + 1 };
|
|
17204
|
+
if (character === "\\") {
|
|
17205
|
+
index += 2;
|
|
17206
|
+
continue;
|
|
17207
|
+
}
|
|
17208
|
+
if (character === "]")
|
|
17209
|
+
break;
|
|
17210
|
+
index += 1;
|
|
17211
|
+
}
|
|
17212
|
+
if (index + 1 >= text.length)
|
|
17213
|
+
return openLabel;
|
|
17214
|
+
if (text[index + 1] !== "(")
|
|
17215
|
+
return { kind: "text", end: start + 1 };
|
|
17216
|
+
const destinationStart = index + 2;
|
|
17217
|
+
const open = { kind: "open", holdFrom: destinationStart };
|
|
17218
|
+
const malformed = { kind: "text", end: destinationStart };
|
|
17219
|
+
index = skipBlanks(text, destinationStart);
|
|
17220
|
+
if (index >= text.length)
|
|
17221
|
+
return open;
|
|
17222
|
+
let destination;
|
|
17223
|
+
let destinationEnd;
|
|
17224
|
+
let bracketed = false;
|
|
17225
|
+
if (text[index] === "<") {
|
|
17226
|
+
bracketed = true;
|
|
17227
|
+
let close = index + 1;
|
|
17228
|
+
while (close < text.length && text[close] !== ">" && text[close] !== "\n")
|
|
17229
|
+
close += 1;
|
|
17230
|
+
if (close >= text.length)
|
|
17231
|
+
return open;
|
|
17232
|
+
if (text[close] === "\n")
|
|
17233
|
+
return malformed;
|
|
17234
|
+
destination = text.slice(index + 1, close);
|
|
17235
|
+
destinationEnd = close + 1;
|
|
17236
|
+
index = destinationEnd;
|
|
17237
|
+
} else {
|
|
17238
|
+
const begin = index;
|
|
17239
|
+
while (index < text.length) {
|
|
17240
|
+
const character = text[index];
|
|
17241
|
+
if (character === "\n" || character === " " || character === " " || character === ")")
|
|
17242
|
+
break;
|
|
17243
|
+
index += character === "\\" ? 2 : 1;
|
|
17244
|
+
}
|
|
17245
|
+
if (index >= text.length)
|
|
17246
|
+
return open;
|
|
17247
|
+
destination = unescapeMarkdown(text.slice(begin, index));
|
|
17248
|
+
destinationEnd = index;
|
|
17249
|
+
}
|
|
17250
|
+
index = skipBlanks(text, index);
|
|
17251
|
+
if (index >= text.length)
|
|
17252
|
+
return open;
|
|
17253
|
+
const opener = text[index];
|
|
17254
|
+
if (opener === '"' || opener === "'" || opener === "(") {
|
|
17255
|
+
const closer = opener === "(" ? ")" : opener;
|
|
17256
|
+
index += 1;
|
|
17257
|
+
while (index < text.length && text[index] !== closer && text[index] !== "\n")
|
|
17258
|
+
index += 1;
|
|
17259
|
+
if (index >= text.length)
|
|
17260
|
+
return open;
|
|
17261
|
+
if (text[index] === "\n")
|
|
17262
|
+
return malformed;
|
|
17263
|
+
index = skipBlanks(text, index + 1);
|
|
17264
|
+
if (index >= text.length)
|
|
17265
|
+
return open;
|
|
17266
|
+
}
|
|
17267
|
+
if (text[index] !== ")")
|
|
17268
|
+
return malformed;
|
|
17269
|
+
return {
|
|
17270
|
+
kind: "image",
|
|
17271
|
+
destination,
|
|
17272
|
+
destinationStart,
|
|
17273
|
+
destinationEnd,
|
|
17274
|
+
end: index + 1,
|
|
17275
|
+
bracketed
|
|
17276
|
+
};
|
|
17277
|
+
}
|
|
17278
|
+
function skipBlanks(text, start) {
|
|
17279
|
+
let index = start;
|
|
17280
|
+
while (text[index] === " " || text[index] === " ")
|
|
17281
|
+
index += 1;
|
|
17282
|
+
return index;
|
|
17283
|
+
}
|
|
17284
|
+
function mediaMarkdownImage(absolutePath) {
|
|
17285
|
+
const name = path7.basename(absolutePath).replaceAll("]", "\\]");
|
|
17286
|
+
return `})`;
|
|
17287
|
+
}
|
|
17288
|
+
function markdownDestination(absolutePath, bracketed) {
|
|
17289
|
+
const encoded = absolutePath.replaceAll("%", "%2525");
|
|
17290
|
+
const destination = /^[A-Za-z]:\\/.test(encoded) ? encoded.replaceAll("\\", "/") : encoded.replaceAll("\\", "\\\\");
|
|
17291
|
+
return bracketed || /[\s()]/.test(destination) ? `<${destination}>` : destination;
|
|
17292
|
+
}
|
|
17293
|
+
function unescapeMarkdown(value) {
|
|
17294
|
+
return value.replace(/\\([\\()])/g, "$1");
|
|
17295
|
+
}
|
|
17296
|
+
function resolveLocalMediaPath(raw, roots, exists = mediaFileExists) {
|
|
17297
|
+
const trimmed = raw.trim();
|
|
17298
|
+
if (trimmed.length === 0 || isRemoteMediaUrl(trimmed))
|
|
17299
|
+
return null;
|
|
17300
|
+
const stripped = stripFileUrl(trimmed);
|
|
17301
|
+
if (stripped === null)
|
|
17302
|
+
return null;
|
|
17303
|
+
if (isAbsoluteMediaPath(stripped)) {
|
|
17304
|
+
const absolute = path7.resolve(stripped);
|
|
17305
|
+
return hasMediaExtension(absolute) && exists(absolute) ? absolute : null;
|
|
17306
|
+
}
|
|
17307
|
+
for (const root of roots) {
|
|
17308
|
+
const absolute = path7.resolve(root, stripped);
|
|
17309
|
+
if (hasMediaExtension(absolute) && exists(absolute))
|
|
17310
|
+
return absolute;
|
|
17311
|
+
}
|
|
17312
|
+
return null;
|
|
17313
|
+
}
|
|
17314
|
+
function isRemoteMediaUrl(value) {
|
|
17315
|
+
return /^(?:https?:|data:|app:|blob:)/i.test(value);
|
|
17316
|
+
}
|
|
17317
|
+
function stripFileUrl(value) {
|
|
17318
|
+
if (!value.toLowerCase().startsWith("file:"))
|
|
17319
|
+
return value;
|
|
17320
|
+
try {
|
|
17321
|
+
return fileURLToPath(value);
|
|
17322
|
+
} catch {
|
|
17323
|
+
return null;
|
|
17324
|
+
}
|
|
17325
|
+
}
|
|
17326
|
+
function isAbsoluteMediaPath(value) {
|
|
17327
|
+
return path7.isAbsolute(value) || /^[a-zA-Z]:[\\/]/.test(value);
|
|
17328
|
+
}
|
|
17329
|
+
function hasMediaExtension(value) {
|
|
17330
|
+
return MEDIA_EXTENSIONS.has(path7.extname(value).toLowerCase());
|
|
17331
|
+
}
|
|
17332
|
+
function mediaFileExists(absolutePath) {
|
|
17333
|
+
try {
|
|
17334
|
+
return existsSync(absolutePath) && statSync(absolutePath).isFile();
|
|
17335
|
+
} catch {
|
|
17336
|
+
return false;
|
|
17337
|
+
}
|
|
17338
|
+
}
|
|
17339
|
+
|
|
16977
17340
|
// dist/acp-transport.js
|
|
16978
17341
|
import { spawn, spawnSync } from "node:child_process";
|
|
16979
17342
|
import { readdir, readFile as readFile3 } from "node:fs/promises";
|
|
16980
17343
|
import os5 from "node:os";
|
|
16981
|
-
import
|
|
17344
|
+
import path13 from "node:path";
|
|
16982
17345
|
import { Readable, Writable } from "node:stream";
|
|
16983
17346
|
|
|
16984
17347
|
// ../../../node_modules/@agentclientprotocol/sdk/dist/schema/index.js
|
|
@@ -21166,8 +21529,8 @@ function parseGrokAvailableCommands(value) {
|
|
|
21166
21529
|
});
|
|
21167
21530
|
}
|
|
21168
21531
|
function isGrokSkill(command) {
|
|
21169
|
-
const
|
|
21170
|
-
return typeof
|
|
21532
|
+
const path17 = command.meta?.path;
|
|
21533
|
+
return typeof path17 === "string" && /(^|[\\/])SKILL\.md$/u.test(path17) || typeof command.meta?.qualifiedName === "string";
|
|
21171
21534
|
}
|
|
21172
21535
|
function grokLiveCommands(native) {
|
|
21173
21536
|
return native.map((command) => ({
|
|
@@ -21178,7 +21541,7 @@ function grokLiveCommands(native) {
|
|
|
21178
21541
|
}
|
|
21179
21542
|
|
|
21180
21543
|
// dist/command.js
|
|
21181
|
-
import
|
|
21544
|
+
import path8 from "node:path";
|
|
21182
21545
|
var GrokExecutableError = class extends Error {
|
|
21183
21546
|
code = "GROK_NOT_FOUND";
|
|
21184
21547
|
};
|
|
@@ -21207,7 +21570,7 @@ function resolveGrokExecutable(input = {}) {
|
|
|
21207
21570
|
});
|
|
21208
21571
|
if (!resolution)
|
|
21209
21572
|
throw new GrokExecutableError("Grok CLI is not installed");
|
|
21210
|
-
return targetPath(platform).isAbsolute(resolution.executable) ? resolution.executable :
|
|
21573
|
+
return targetPath(platform).isAbsolute(resolution.executable) ? resolution.executable : path8.resolve(resolution.executable);
|
|
21211
21574
|
}
|
|
21212
21575
|
function grokInvocation(command, platform = process.platform, modelId) {
|
|
21213
21576
|
const arguments_ = ["agent", "--no-leader"];
|
|
@@ -21220,11 +21583,11 @@ function grokInvocation(command, platform = process.platform, modelId) {
|
|
|
21220
21583
|
|
|
21221
21584
|
// dist/grok-fork.js
|
|
21222
21585
|
import { isDeepStrictEqual } from "node:util";
|
|
21223
|
-
import
|
|
21586
|
+
import path11 from "node:path";
|
|
21224
21587
|
|
|
21225
21588
|
// dist/grok-file-change.js
|
|
21226
21589
|
import { Buffer as Buffer2 } from "node:buffer";
|
|
21227
|
-
import
|
|
21590
|
+
import path9 from "node:path";
|
|
21228
21591
|
|
|
21229
21592
|
// ../../../node_modules/diff/libesm/diff/base.js
|
|
21230
21593
|
var Diff = class {
|
|
@@ -21326,16 +21689,16 @@ var Diff = class {
|
|
|
21326
21689
|
}
|
|
21327
21690
|
}
|
|
21328
21691
|
}
|
|
21329
|
-
addToPath(
|
|
21330
|
-
const last =
|
|
21692
|
+
addToPath(path17, added, removed, oldPosInc, options) {
|
|
21693
|
+
const last = path17.lastComponent;
|
|
21331
21694
|
if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) {
|
|
21332
21695
|
return {
|
|
21333
|
-
oldPos:
|
|
21696
|
+
oldPos: path17.oldPos + oldPosInc,
|
|
21334
21697
|
lastComponent: { count: last.count + 1, added, removed, previousComponent: last.previousComponent }
|
|
21335
21698
|
};
|
|
21336
21699
|
} else {
|
|
21337
21700
|
return {
|
|
21338
|
-
oldPos:
|
|
21701
|
+
oldPos: path17.oldPos + oldPosInc,
|
|
21339
21702
|
lastComponent: { count: 1, added, removed, previousComponent: last }
|
|
21340
21703
|
};
|
|
21341
21704
|
}
|
|
@@ -21648,13 +22011,13 @@ function isRecord5(value) {
|
|
|
21648
22011
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
21649
22012
|
}
|
|
21650
22013
|
function validAbsolutePath(value) {
|
|
21651
|
-
return typeof value === "string" &&
|
|
22014
|
+
return typeof value === "string" && path9.isAbsolute(value) && value.trim().length > 0 && !value.includes("\0") && !value.includes("\n") && !value.includes("\r");
|
|
21652
22015
|
}
|
|
21653
22016
|
function displayPath(nativePath, cwd) {
|
|
21654
|
-
const resolvedCwd =
|
|
21655
|
-
const resolvedPath =
|
|
21656
|
-
const relative =
|
|
21657
|
-
const inside = relative.length > 0 && relative !== ".." && !relative.startsWith(`..${
|
|
22017
|
+
const resolvedCwd = path9.resolve(cwd);
|
|
22018
|
+
const resolvedPath = path9.resolve(nativePath);
|
|
22019
|
+
const relative = path9.relative(resolvedCwd, resolvedPath);
|
|
22020
|
+
const inside = relative.length > 0 && relative !== ".." && !relative.startsWith(`..${path9.sep}`);
|
|
21658
22021
|
const selected = inside ? relative : resolvedPath;
|
|
21659
22022
|
const normalized = selected.replaceAll("\\", "/");
|
|
21660
22023
|
if (normalized.length === 0 || normalized === ".")
|
|
@@ -21715,299 +22078,19 @@ function projectGrokFileChanges(content, cwd, textLimit = DEFAULT_GROK_FILE_CHAN
|
|
|
21715
22078
|
}
|
|
21716
22079
|
|
|
21717
22080
|
// dist/local-media-markdown.js
|
|
21718
|
-
import { existsSync, statSync } from "node:fs";
|
|
21719
22081
|
import os4 from "node:os";
|
|
21720
|
-
import
|
|
21721
|
-
var MEDIA_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
21722
|
-
".aac",
|
|
21723
|
-
".gif",
|
|
21724
|
-
".jpeg",
|
|
21725
|
-
".jpg",
|
|
21726
|
-
".m4a",
|
|
21727
|
-
".m4v",
|
|
21728
|
-
".mov",
|
|
21729
|
-
".mp3",
|
|
21730
|
-
".mp4",
|
|
21731
|
-
".ogg",
|
|
21732
|
-
".png",
|
|
21733
|
-
".svg",
|
|
21734
|
-
".wav",
|
|
21735
|
-
".webm",
|
|
21736
|
-
".webp"
|
|
21737
|
-
]);
|
|
22082
|
+
import path10 from "node:path";
|
|
21738
22083
|
function grokMediaResolveRoots(cwd, sessionDirectory) {
|
|
21739
|
-
const roots = [
|
|
22084
|
+
const roots = [path10.resolve(cwd)];
|
|
21740
22085
|
if (sessionDirectory) {
|
|
21741
|
-
const session =
|
|
21742
|
-
roots.push(session,
|
|
22086
|
+
const session = path10.resolve(sessionDirectory);
|
|
22087
|
+
roots.push(session, path10.join(session, "videos"), path10.join(session, "images"));
|
|
21743
22088
|
}
|
|
21744
22089
|
const home = process.env.HOME ?? process.env.USERPROFILE ?? os4.homedir();
|
|
21745
22090
|
if (home)
|
|
21746
|
-
roots.push(
|
|
22091
|
+
roots.push(path10.join(home, "Downloads"));
|
|
21747
22092
|
return roots;
|
|
21748
22093
|
}
|
|
21749
|
-
function rewriteLocalMediaMarkdown(text, roots, options = {}) {
|
|
21750
|
-
const exists = options.exists ?? mediaFileExists;
|
|
21751
|
-
const holdIncomplete = options.holdIncomplete === true;
|
|
21752
|
-
let output = "";
|
|
21753
|
-
let index = 0;
|
|
21754
|
-
let fence = false;
|
|
21755
|
-
while (index < text.length) {
|
|
21756
|
-
if (fence) {
|
|
21757
|
-
const fenceEnd = text.indexOf("```", index);
|
|
21758
|
-
if (fenceEnd === -1) {
|
|
21759
|
-
output += text.slice(index);
|
|
21760
|
-
break;
|
|
21761
|
-
}
|
|
21762
|
-
output += text.slice(index, fenceEnd + 3);
|
|
21763
|
-
index = fenceEnd + 3;
|
|
21764
|
-
fence = false;
|
|
21765
|
-
continue;
|
|
21766
|
-
}
|
|
21767
|
-
const fenceStart = text.indexOf("```", index);
|
|
21768
|
-
const imageStart = text.indexOf("![", index);
|
|
21769
|
-
const tickStart = indexOfInlineTick(text, index);
|
|
21770
|
-
const next = earliestIndex([fenceStart, imageStart, tickStart]);
|
|
21771
|
-
if (next === -1) {
|
|
21772
|
-
output += text.slice(index);
|
|
21773
|
-
break;
|
|
21774
|
-
}
|
|
21775
|
-
output += text.slice(index, next);
|
|
21776
|
-
if (next === fenceStart) {
|
|
21777
|
-
output += "```";
|
|
21778
|
-
index = fenceStart + 3;
|
|
21779
|
-
fence = true;
|
|
21780
|
-
continue;
|
|
21781
|
-
}
|
|
21782
|
-
if (next === imageStart) {
|
|
21783
|
-
const parsed = parseMarkdownImage(text, imageStart);
|
|
21784
|
-
if (!parsed) {
|
|
21785
|
-
output += "!";
|
|
21786
|
-
index = imageStart + 1;
|
|
21787
|
-
continue;
|
|
21788
|
-
}
|
|
21789
|
-
if (!parsed.closed) {
|
|
21790
|
-
output += holdIncomplete ? text.slice(imageStart, parsed.destinationStart) : text.slice(imageStart);
|
|
21791
|
-
break;
|
|
21792
|
-
}
|
|
21793
|
-
const resolved2 = resolveLocalMediaPath(parsed.destination, roots, exists);
|
|
21794
|
-
output += text.slice(imageStart, parsed.destinationStart) + formatMarkdownDestination(resolved2 ?? parsed.destination, parsed.bracketed) + text.slice(parsed.destinationEnd, parsed.end);
|
|
21795
|
-
index = parsed.end;
|
|
21796
|
-
continue;
|
|
21797
|
-
}
|
|
21798
|
-
const inline = parseInlineCode(text, tickStart);
|
|
21799
|
-
if (!inline.closed) {
|
|
21800
|
-
if (!holdIncomplete)
|
|
21801
|
-
output += text.slice(tickStart);
|
|
21802
|
-
break;
|
|
21803
|
-
}
|
|
21804
|
-
const resolved = resolveLocalMediaPath(inline.content, roots, exists);
|
|
21805
|
-
output += resolved ? mediaMarkdownImage(resolved) : text.slice(tickStart, inline.end);
|
|
21806
|
-
index = inline.end;
|
|
21807
|
-
}
|
|
21808
|
-
return output;
|
|
21809
|
-
}
|
|
21810
|
-
function indexOfInlineTick(text, start) {
|
|
21811
|
-
let index = start;
|
|
21812
|
-
while (index < text.length) {
|
|
21813
|
-
const tick = text.indexOf("`", index);
|
|
21814
|
-
if (tick === -1)
|
|
21815
|
-
return -1;
|
|
21816
|
-
if (text.startsWith("```", tick)) {
|
|
21817
|
-
index = tick + 3;
|
|
21818
|
-
continue;
|
|
21819
|
-
}
|
|
21820
|
-
return tick;
|
|
21821
|
-
}
|
|
21822
|
-
return -1;
|
|
21823
|
-
}
|
|
21824
|
-
function earliestIndex(candidates) {
|
|
21825
|
-
let next = -1;
|
|
21826
|
-
for (const candidate of candidates) {
|
|
21827
|
-
if (candidate === -1)
|
|
21828
|
-
continue;
|
|
21829
|
-
if (next === -1 || candidate < next)
|
|
21830
|
-
next = candidate;
|
|
21831
|
-
}
|
|
21832
|
-
return next;
|
|
21833
|
-
}
|
|
21834
|
-
function parseInlineCode(text, start) {
|
|
21835
|
-
let index = start + 1;
|
|
21836
|
-
while (index < text.length) {
|
|
21837
|
-
const character = text[index];
|
|
21838
|
-
if (character === "\n")
|
|
21839
|
-
return { closed: false, content: text.slice(start + 1, index), end: index };
|
|
21840
|
-
if (character === "`")
|
|
21841
|
-
return { closed: true, content: text.slice(start + 1, index), end: index + 1 };
|
|
21842
|
-
index += 1;
|
|
21843
|
-
}
|
|
21844
|
-
return { closed: false, content: text.slice(start + 1), end: text.length };
|
|
21845
|
-
}
|
|
21846
|
-
function mediaMarkdownImage(absolutePath) {
|
|
21847
|
-
const name = path9.basename(absolutePath).replaceAll("]", "\\]");
|
|
21848
|
-
return `})`;
|
|
21849
|
-
}
|
|
21850
|
-
function parseMarkdownImage(text, start) {
|
|
21851
|
-
if (text.slice(start, start + 2) !== "![")
|
|
21852
|
-
return null;
|
|
21853
|
-
let index = start + 2;
|
|
21854
|
-
while (index < text.length) {
|
|
21855
|
-
const character = text[index];
|
|
21856
|
-
if (character === "\n")
|
|
21857
|
-
return null;
|
|
21858
|
-
if (character === "\\" && index + 1 < text.length) {
|
|
21859
|
-
index += 2;
|
|
21860
|
-
continue;
|
|
21861
|
-
}
|
|
21862
|
-
if (character === "]")
|
|
21863
|
-
break;
|
|
21864
|
-
index += 1;
|
|
21865
|
-
}
|
|
21866
|
-
if (text[index] !== "]" || text[index + 1] !== "(")
|
|
21867
|
-
return null;
|
|
21868
|
-
const destinationStart = index + 2;
|
|
21869
|
-
index = destinationStart;
|
|
21870
|
-
while (text[index] === " " || text[index] === " ")
|
|
21871
|
-
index += 1;
|
|
21872
|
-
if (index >= text.length) {
|
|
21873
|
-
return {
|
|
21874
|
-
closed: false,
|
|
21875
|
-
destination: "",
|
|
21876
|
-
destinationStart,
|
|
21877
|
-
destinationEnd: index,
|
|
21878
|
-
end: text.length,
|
|
21879
|
-
bracketed: false
|
|
21880
|
-
};
|
|
21881
|
-
}
|
|
21882
|
-
let destination;
|
|
21883
|
-
let destinationEnd;
|
|
21884
|
-
let bracketed = false;
|
|
21885
|
-
if (text[index] === "<") {
|
|
21886
|
-
bracketed = true;
|
|
21887
|
-
const close = text.indexOf(">", index + 1);
|
|
21888
|
-
if (close === -1 || text.slice(index, close).includes("\n")) {
|
|
21889
|
-
return {
|
|
21890
|
-
closed: false,
|
|
21891
|
-
destination: text.slice(index + 1),
|
|
21892
|
-
destinationStart,
|
|
21893
|
-
destinationEnd: text.length,
|
|
21894
|
-
end: text.length,
|
|
21895
|
-
bracketed: true
|
|
21896
|
-
};
|
|
21897
|
-
}
|
|
21898
|
-
destination = text.slice(index + 1, close);
|
|
21899
|
-
destinationEnd = close + 1;
|
|
21900
|
-
index = destinationEnd;
|
|
21901
|
-
} else {
|
|
21902
|
-
const begin = index;
|
|
21903
|
-
while (index < text.length) {
|
|
21904
|
-
const character = text[index];
|
|
21905
|
-
if (character === "\n" || character === " " || character === " " || character === ")")
|
|
21906
|
-
break;
|
|
21907
|
-
if (character === "\\" && index + 1 < text.length) {
|
|
21908
|
-
index += 2;
|
|
21909
|
-
continue;
|
|
21910
|
-
}
|
|
21911
|
-
index += 1;
|
|
21912
|
-
}
|
|
21913
|
-
destination = unescapeMarkdown(text.slice(begin, index));
|
|
21914
|
-
destinationEnd = index;
|
|
21915
|
-
}
|
|
21916
|
-
while (text[index] === " " || text[index] === " ")
|
|
21917
|
-
index += 1;
|
|
21918
|
-
if (text[index] === '"' || text[index] === "'" || text[index] === "(") {
|
|
21919
|
-
const closer = text[index] === "(" ? ")" : text[index];
|
|
21920
|
-
index += 1;
|
|
21921
|
-
while (index < text.length && text[index] !== closer && text[index] !== "\n")
|
|
21922
|
-
index += 1;
|
|
21923
|
-
if (text[index] !== closer) {
|
|
21924
|
-
return {
|
|
21925
|
-
closed: false,
|
|
21926
|
-
destination,
|
|
21927
|
-
destinationStart,
|
|
21928
|
-
destinationEnd,
|
|
21929
|
-
end: text.length,
|
|
21930
|
-
bracketed
|
|
21931
|
-
};
|
|
21932
|
-
}
|
|
21933
|
-
index += 1;
|
|
21934
|
-
while (text[index] === " " || text[index] === " ")
|
|
21935
|
-
index += 1;
|
|
21936
|
-
}
|
|
21937
|
-
if (text[index] !== ")") {
|
|
21938
|
-
return {
|
|
21939
|
-
closed: false,
|
|
21940
|
-
destination,
|
|
21941
|
-
destinationStart,
|
|
21942
|
-
destinationEnd,
|
|
21943
|
-
end: text.length,
|
|
21944
|
-
bracketed
|
|
21945
|
-
};
|
|
21946
|
-
}
|
|
21947
|
-
return {
|
|
21948
|
-
closed: true,
|
|
21949
|
-
destination,
|
|
21950
|
-
destinationStart,
|
|
21951
|
-
destinationEnd,
|
|
21952
|
-
end: index + 1,
|
|
21953
|
-
bracketed
|
|
21954
|
-
};
|
|
21955
|
-
}
|
|
21956
|
-
function formatMarkdownDestination(destination, bracketed) {
|
|
21957
|
-
if (bracketed || /[\s()]/.test(destination))
|
|
21958
|
-
return `<${destination}>`;
|
|
21959
|
-
return destination.replaceAll(" ", "%20");
|
|
21960
|
-
}
|
|
21961
|
-
function unescapeMarkdown(value) {
|
|
21962
|
-
return value.replace(/\\([\\()])/g, "$1");
|
|
21963
|
-
}
|
|
21964
|
-
function resolveLocalMediaPath(raw, roots, exists = mediaFileExists) {
|
|
21965
|
-
const trimmed = raw.trim();
|
|
21966
|
-
if (trimmed.length === 0 || isRemoteMediaUrl(trimmed))
|
|
21967
|
-
return null;
|
|
21968
|
-
const stripped = stripFileUrl(trimmed);
|
|
21969
|
-
if (!hasMediaExtension(stripped))
|
|
21970
|
-
return null;
|
|
21971
|
-
if (isAbsoluteMediaPath(stripped)) {
|
|
21972
|
-
const absolute = path9.resolve(stripped);
|
|
21973
|
-
return exists(absolute) ? absolute : null;
|
|
21974
|
-
}
|
|
21975
|
-
for (const root of roots) {
|
|
21976
|
-
const absolute = path9.resolve(root, stripped);
|
|
21977
|
-
if (exists(absolute))
|
|
21978
|
-
return absolute;
|
|
21979
|
-
}
|
|
21980
|
-
return null;
|
|
21981
|
-
}
|
|
21982
|
-
function isRemoteMediaUrl(value) {
|
|
21983
|
-
return /^(?:https?:|data:|app:|blob:)/i.test(value);
|
|
21984
|
-
}
|
|
21985
|
-
function stripFileUrl(value) {
|
|
21986
|
-
if (!value.toLowerCase().startsWith("file:"))
|
|
21987
|
-
return value;
|
|
21988
|
-
try {
|
|
21989
|
-
const url2 = new URL(value);
|
|
21990
|
-
if (url2.protocol !== "file:")
|
|
21991
|
-
return value;
|
|
21992
|
-
return decodeURIComponent(url2.pathname);
|
|
21993
|
-
} catch {
|
|
21994
|
-
return value.replace(/^file:\/\//i, "");
|
|
21995
|
-
}
|
|
21996
|
-
}
|
|
21997
|
-
function isAbsoluteMediaPath(value) {
|
|
21998
|
-
return path9.isAbsolute(value) || /^[a-zA-Z]:[\\/]/.test(value);
|
|
21999
|
-
}
|
|
22000
|
-
function hasMediaExtension(value) {
|
|
22001
|
-
const pathname = value.split(/[?#]/, 1)[0] ?? value;
|
|
22002
|
-
return MEDIA_EXTENSIONS.has(path9.extname(pathname).toLowerCase());
|
|
22003
|
-
}
|
|
22004
|
-
function mediaFileExists(absolutePath) {
|
|
22005
|
-
try {
|
|
22006
|
-
return existsSync(absolutePath) && statSync(absolutePath).isFile();
|
|
22007
|
-
} catch {
|
|
22008
|
-
return false;
|
|
22009
|
-
}
|
|
22010
|
-
}
|
|
22011
22094
|
|
|
22012
22095
|
// dist/grok-tool-output.js
|
|
22013
22096
|
var DEFAULT_GROK_TOOL_OUTPUT_LIMIT = 64e3;
|
|
@@ -23008,11 +23091,11 @@ function parseGrokForkResponse(value) {
|
|
|
23008
23091
|
}
|
|
23009
23092
|
function projectRelativePath(value, cwds) {
|
|
23010
23093
|
const normalized = value.replaceAll("\\", "/");
|
|
23011
|
-
if (!
|
|
23094
|
+
if (!path11.isAbsolute(value))
|
|
23012
23095
|
return normalized;
|
|
23013
23096
|
for (const cwd of cwds) {
|
|
23014
|
-
const relative =
|
|
23015
|
-
if (relative.length > 0 && relative !== ".." && !relative.startsWith(`..${
|
|
23097
|
+
const relative = path11.relative(path11.resolve(cwd), path11.resolve(value));
|
|
23098
|
+
if (relative.length > 0 && relative !== ".." && !relative.startsWith(`..${path11.sep}`)) {
|
|
23016
23099
|
return relative.replaceAll("\\", "/");
|
|
23017
23100
|
}
|
|
23018
23101
|
}
|
|
@@ -23077,8 +23160,8 @@ async function forkGrokSession(input) {
|
|
|
23077
23160
|
error: error51("sessionNotFound", "Grok Native Session is unavailable")
|
|
23078
23161
|
};
|
|
23079
23162
|
}
|
|
23080
|
-
const sourceCwd =
|
|
23081
|
-
const targetCwd =
|
|
23163
|
+
const sourceCwd = path11.resolve(located.cwd);
|
|
23164
|
+
const targetCwd = path11.resolve(input.cwd);
|
|
23082
23165
|
const source = await readSnapshot({ ...input, cwd: sourceCwd }, sourceRef.data.nativeSessionId);
|
|
23083
23166
|
if (!source.ok)
|
|
23084
23167
|
return source;
|
|
@@ -23261,7 +23344,7 @@ function parseGrokCompactResult(value, cancelled = false) {
|
|
|
23261
23344
|
}
|
|
23262
23345
|
|
|
23263
23346
|
// dist/grok-rewind.js
|
|
23264
|
-
import
|
|
23347
|
+
import path12 from "node:path";
|
|
23265
23348
|
var GROK_REWIND_EXECUTE_METHOD = "_x.ai/rewind/execute";
|
|
23266
23349
|
function error52(code, message, retryable = false) {
|
|
23267
23350
|
return { code, message, retryable };
|
|
@@ -23334,8 +23417,8 @@ async function rewindGrokLastTurn(input) {
|
|
|
23334
23417
|
error: error52("sessionNotFound", "Grok Native Session is unavailable")
|
|
23335
23418
|
};
|
|
23336
23419
|
}
|
|
23337
|
-
const sourceCwd =
|
|
23338
|
-
const targetCwd =
|
|
23420
|
+
const sourceCwd = path12.resolve(located.cwd);
|
|
23421
|
+
const targetCwd = path12.resolve(input.cwd);
|
|
23339
23422
|
if (sourceCwd !== targetCwd) {
|
|
23340
23423
|
return {
|
|
23341
23424
|
ok: false,
|
|
@@ -23714,8 +23797,14 @@ function signalProcessTree(child, signal) {
|
|
|
23714
23797
|
try {
|
|
23715
23798
|
process.kill(-child.pid, signal);
|
|
23716
23799
|
} catch (error53) {
|
|
23717
|
-
if (!isRecord13(error53) || error53.code
|
|
23718
|
-
|
|
23800
|
+
if (!isRecord13(error53) || error53.code === "ESRCH")
|
|
23801
|
+
return;
|
|
23802
|
+
try {
|
|
23803
|
+
child.kill(signal);
|
|
23804
|
+
} catch (fallback) {
|
|
23805
|
+
if (!isRecord13(fallback) || fallback.code !== "ESRCH")
|
|
23806
|
+
throw fallback;
|
|
23807
|
+
}
|
|
23719
23808
|
}
|
|
23720
23809
|
}
|
|
23721
23810
|
function transportEvent(update, metadata) {
|
|
@@ -23809,13 +23898,13 @@ function transportEvent(update, metadata) {
|
|
|
23809
23898
|
function grokHomeDir(options) {
|
|
23810
23899
|
const environment = { ...process.env, ...options.environment };
|
|
23811
23900
|
const home = environment.HOME ?? environment.USERPROFILE ?? os5.homedir();
|
|
23812
|
-
return environment.GROK_HOME ??
|
|
23901
|
+
return environment.GROK_HOME ?? path13.join(home, ".grok");
|
|
23813
23902
|
}
|
|
23814
23903
|
function grokNativeSessionDirectory(options, sessionId) {
|
|
23815
|
-
return
|
|
23904
|
+
return path13.join(grokHomeDir(options), "sessions", encodeURIComponent(path13.resolve(options.cwd)), sessionId);
|
|
23816
23905
|
}
|
|
23817
23906
|
function nativeSessionFile(options, sessionId, fileName) {
|
|
23818
|
-
return
|
|
23907
|
+
return path13.join(grokNativeSessionDirectory(options, sessionId), fileName);
|
|
23819
23908
|
}
|
|
23820
23909
|
function nativeHistoryPath(options, sessionId) {
|
|
23821
23910
|
return nativeSessionFile(options, sessionId, "updates.jsonl");
|
|
@@ -23835,7 +23924,7 @@ async function locateGrokNativeSession(options, sessionId) {
|
|
|
23835
23924
|
return null;
|
|
23836
23925
|
let entries;
|
|
23837
23926
|
try {
|
|
23838
|
-
entries = await readdir(
|
|
23927
|
+
entries = await readdir(path13.join(grokHomeDir(options), "sessions"), { withFileTypes: true });
|
|
23839
23928
|
} catch (error53) {
|
|
23840
23929
|
if (isMissingFile(error53))
|
|
23841
23930
|
return null;
|
|
@@ -23849,7 +23938,7 @@ async function locateGrokNativeSession(options, sessionId) {
|
|
|
23849
23938
|
continue;
|
|
23850
23939
|
let summaryRaw;
|
|
23851
23940
|
try {
|
|
23852
|
-
summaryRaw = await readFile3(
|
|
23941
|
+
summaryRaw = await readFile3(path13.join(grokHomeDir(options), "sessions", entry.name, sessionId, "summary.json"), "utf8");
|
|
23853
23942
|
} catch (error53) {
|
|
23854
23943
|
if (isMissingFile(error53) || isRecord13(error53) && error53.code === "ENOTDIR")
|
|
23855
23944
|
continue;
|
|
@@ -23866,8 +23955,8 @@ async function locateGrokNativeSession(options, sessionId) {
|
|
|
23866
23955
|
if (!isRecord13(parsed))
|
|
23867
23956
|
continue;
|
|
23868
23957
|
const info = parsed.info;
|
|
23869
|
-
const cwd = isRecord13(info) && typeof info.cwd === "string" && info.cwd.length > 0 ?
|
|
23870
|
-
const sourceWorkspaceDir = typeof parsed.source_workspace_dir === "string" && parsed.source_workspace_dir.length > 0 ?
|
|
23958
|
+
const cwd = isRecord13(info) && typeof info.cwd === "string" && info.cwd.length > 0 ? path13.resolve(info.cwd) : path13.resolve(decodeURIComponent(entry.name));
|
|
23959
|
+
const sourceWorkspaceDir = typeof parsed.source_workspace_dir === "string" && parsed.source_workspace_dir.length > 0 ? path13.resolve(parsed.source_workspace_dir) : void 0;
|
|
23871
23960
|
matches.push({
|
|
23872
23961
|
cwd,
|
|
23873
23962
|
...sourceWorkspaceDir ? { sourceWorkspaceDir } : {}
|
|
@@ -23877,7 +23966,7 @@ async function locateGrokNativeSession(options, sessionId) {
|
|
|
23877
23966
|
}
|
|
23878
23967
|
async function readGrokNativeHistory(options, sessionId) {
|
|
23879
23968
|
try {
|
|
23880
|
-
return parseNativeHistory(await readFile3(nativeHistoryPath({ ...options, cwd:
|
|
23969
|
+
return parseNativeHistory(await readFile3(nativeHistoryPath({ ...options, cwd: path13.resolve(options.cwd) }, sessionId), "utf8"), sessionId);
|
|
23881
23970
|
} catch (error53) {
|
|
23882
23971
|
if (isMissingFile(error53))
|
|
23883
23972
|
return [];
|
|
@@ -24376,7 +24465,7 @@ var GrokAcpTransport = class {
|
|
|
24376
24465
|
// dist/session-import.js
|
|
24377
24466
|
import { createReadStream as createReadStream2 } from "node:fs";
|
|
24378
24467
|
import { opendir as opendir2, readFile as readFile4, stat } from "node:fs/promises";
|
|
24379
|
-
import
|
|
24468
|
+
import path14 from "node:path";
|
|
24380
24469
|
import { createInterface as createInterface2 } from "node:readline";
|
|
24381
24470
|
|
|
24382
24471
|
// ../../harness-adapter/dist/session-import.js
|
|
@@ -24597,7 +24686,7 @@ var GrokSessionImport = class {
|
|
|
24597
24686
|
const active = /* @__PURE__ */ new Set();
|
|
24598
24687
|
let entries;
|
|
24599
24688
|
try {
|
|
24600
|
-
entries = await readJson(
|
|
24689
|
+
entries = await readJson(path14.join(this.#home(), "active_sessions.json"), signal);
|
|
24601
24690
|
} catch (error53) {
|
|
24602
24691
|
signal.throwIfAborted();
|
|
24603
24692
|
if (isStorageAccessError(error53))
|
|
@@ -24614,7 +24703,7 @@ var GrokSessionImport = class {
|
|
|
24614
24703
|
}
|
|
24615
24704
|
/** Session ID to every directory claiming it. Enumerated links are not followed. */
|
|
24616
24705
|
async #sessionDirectories(signal) {
|
|
24617
|
-
const root =
|
|
24706
|
+
const root = path14.join(this.#home(), "sessions");
|
|
24618
24707
|
const found = /* @__PURE__ */ new Map();
|
|
24619
24708
|
const info = await optionalLstat(root);
|
|
24620
24709
|
if (!info)
|
|
@@ -24625,7 +24714,7 @@ var GrokSessionImport = class {
|
|
|
24625
24714
|
signal.throwIfAborted();
|
|
24626
24715
|
if (!workspace.isDirectory())
|
|
24627
24716
|
continue;
|
|
24628
|
-
const workspaceDirectory =
|
|
24717
|
+
const workspaceDirectory = path14.join(root, workspace.name);
|
|
24629
24718
|
const sessions = await opendir2(workspaceDirectory).catch((error53) => {
|
|
24630
24719
|
if (isMissingFileError(error53))
|
|
24631
24720
|
return null;
|
|
@@ -24638,7 +24727,7 @@ var GrokSessionImport = class {
|
|
|
24638
24727
|
if (!session.isDirectory())
|
|
24639
24728
|
continue;
|
|
24640
24729
|
const directories = found.get(session.name) ?? [];
|
|
24641
|
-
directories.push(
|
|
24730
|
+
directories.push(path14.join(workspaceDirectory, session.name));
|
|
24642
24731
|
found.set(session.name, directories);
|
|
24643
24732
|
}
|
|
24644
24733
|
}
|
|
@@ -24646,10 +24735,10 @@ var GrokSessionImport = class {
|
|
|
24646
24735
|
}
|
|
24647
24736
|
async #candidate(sessionDirectory, active, signal) {
|
|
24648
24737
|
signal.throwIfAborted();
|
|
24649
|
-
const nativeSessionId =
|
|
24738
|
+
const nativeSessionId = path14.basename(sessionDirectory);
|
|
24650
24739
|
const files = [
|
|
24651
|
-
|
|
24652
|
-
|
|
24740
|
+
path14.join(sessionDirectory, "summary.json"),
|
|
24741
|
+
path14.join(sessionDirectory, "updates.jsonl")
|
|
24653
24742
|
];
|
|
24654
24743
|
return readStableFiles(files, async ([summaryInfo, updates]) => {
|
|
24655
24744
|
if (!summaryInfo?.isFile() || !updates?.isFile() || summaryInfo.size > MAX_METADATA_BYTES)
|
|
@@ -24661,10 +24750,10 @@ var GrokSessionImport = class {
|
|
|
24661
24750
|
if (typeof summary.session_kind === "string" && SUBAGENT_SESSION_KINDS.has(summary.session_kind))
|
|
24662
24751
|
return null;
|
|
24663
24752
|
const nativeCwd = summary.info.cwd;
|
|
24664
|
-
if (typeof nativeCwd !== "string" || !
|
|
24753
|
+
if (typeof nativeCwd !== "string" || !path14.isAbsolute(nativeCwd) || nativeCwd.includes("\0"))
|
|
24665
24754
|
return null;
|
|
24666
|
-
const cwd =
|
|
24667
|
-
if (encodeURIComponent(cwd) !==
|
|
24755
|
+
const cwd = path14.resolve(nativeCwd);
|
|
24756
|
+
if (encodeURIComponent(cwd) !== path14.basename(path14.dirname(sessionDirectory)))
|
|
24668
24757
|
return null;
|
|
24669
24758
|
if (!(await stat(cwd)).isDirectory())
|
|
24670
24759
|
return null;
|
|
@@ -24986,9 +25075,17 @@ function stateForGrokModel(modelState, nativeState, model2 = modelState.currentM
|
|
|
24986
25075
|
// dist/grok-credits.js
|
|
24987
25076
|
import { readFile as readFile5 } from "node:fs/promises";
|
|
24988
25077
|
import os6 from "node:os";
|
|
24989
|
-
import
|
|
25078
|
+
import path15 from "node:path";
|
|
24990
25079
|
var GROK_CREDITS_ENDPOINT = "https://cli-chat-proxy.grok.com/v1/billing?format=credits";
|
|
25080
|
+
var GROK_SETTINGS_ENDPOINT = "https://cli-chat-proxy.grok.com/v1/settings";
|
|
24991
25081
|
var REQUEST_TIMEOUT_MS = 15e3;
|
|
25082
|
+
var PLAN_TIMEOUT_MS = 2e3;
|
|
25083
|
+
function parseGrokPlan(value) {
|
|
25084
|
+
if (!isRecord16(value) || typeof value.subscription_tier_display !== "string")
|
|
25085
|
+
return void 0;
|
|
25086
|
+
const plan = value.subscription_tier_display.trim();
|
|
25087
|
+
return plan && plan.length <= 128 && !/[\u0000-\u001f\u007f]/u.test(plan) ? plan : void 0;
|
|
25088
|
+
}
|
|
24992
25089
|
function isRecord16(value) {
|
|
24993
25090
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
24994
25091
|
}
|
|
@@ -25006,7 +25103,7 @@ function nonNegativeCentValue(value) {
|
|
|
25006
25103
|
return amount;
|
|
25007
25104
|
}
|
|
25008
25105
|
function grokHome2(environment) {
|
|
25009
|
-
return environment.GROK_HOME ??
|
|
25106
|
+
return environment.GROK_HOME ?? path15.join(environment.HOME ?? environment.USERPROFILE ?? os6.homedir(), ".grok");
|
|
25010
25107
|
}
|
|
25011
25108
|
function periodTypeFrom(value) {
|
|
25012
25109
|
if (typeof value !== "string")
|
|
@@ -25098,26 +25195,30 @@ async function fetchGrokAccount(input = {}) {
|
|
|
25098
25195
|
if ([environment.XAI_API_KEY, environment.GROK_API_KEY, environment.GROK_TOKEN].some((value) => value?.trim()))
|
|
25099
25196
|
return null;
|
|
25100
25197
|
const now = input.now ?? /* @__PURE__ */ new Date();
|
|
25101
|
-
const authPath =
|
|
25198
|
+
const authPath = path15.join(grokHome2(environment), "auth.json");
|
|
25102
25199
|
const raw = input.readAuthFile ? await input.readAuthFile(authPath) : await readFile5(authPath, "utf8");
|
|
25103
25200
|
const token = selectAccessToken(JSON.parse(raw), now);
|
|
25104
25201
|
if (!token)
|
|
25105
25202
|
return null;
|
|
25106
25203
|
const fetchImpl = input.fetch ?? fetch;
|
|
25107
|
-
const
|
|
25204
|
+
const request = (url2, timeoutMs) => fetchImpl(url2, {
|
|
25108
25205
|
method: "GET",
|
|
25109
25206
|
headers: {
|
|
25110
25207
|
Authorization: `Bearer ${token.key}`,
|
|
25111
25208
|
"x-xai-token-auth": "xai-grok-cli",
|
|
25112
25209
|
Accept: "application/json"
|
|
25113
25210
|
},
|
|
25114
|
-
signal: input.signal ? AbortSignal.any([input.signal, AbortSignal.timeout(
|
|
25211
|
+
signal: input.signal ? AbortSignal.any([input.signal, AbortSignal.timeout(timeoutMs)]) : AbortSignal.timeout(timeoutMs)
|
|
25115
25212
|
});
|
|
25213
|
+
const credits = request(GROK_CREDITS_ENDPOINT, REQUEST_TIMEOUT_MS);
|
|
25214
|
+
const plan = input.includePlan === false ? Promise.resolve(void 0) : request(GROK_SETTINGS_ENDPOINT, input.planTimeoutMs ?? PLAN_TIMEOUT_MS).then(async (response2) => response2.ok ? parseGrokPlan(await response2.json()) : void 0).catch(() => void 0);
|
|
25215
|
+
const response = await credits;
|
|
25116
25216
|
if (!response.ok)
|
|
25117
25217
|
return null;
|
|
25118
25218
|
const snapshot = parseGrokCreditsResponse(await response.json(), now.toISOString());
|
|
25119
25219
|
if (!snapshot)
|
|
25120
25220
|
return null;
|
|
25221
|
+
const planName = await plan;
|
|
25121
25222
|
return {
|
|
25122
25223
|
credits: {
|
|
25123
25224
|
usedPercent: snapshot.usedPercent,
|
|
@@ -25126,14 +25227,15 @@ async function fetchGrokAccount(input = {}) {
|
|
|
25126
25227
|
...snapshot.productUsage ? { productUsage: [...snapshot.productUsage] } : {}
|
|
25127
25228
|
},
|
|
25128
25229
|
...token.email ? { email: token.email } : {},
|
|
25129
|
-
...token.label ? { label: token.label } : {}
|
|
25230
|
+
...token.label ? { label: token.label } : {},
|
|
25231
|
+
...planName ? { plan: planName } : {}
|
|
25130
25232
|
};
|
|
25131
25233
|
} catch {
|
|
25132
25234
|
return null;
|
|
25133
25235
|
}
|
|
25134
25236
|
}
|
|
25135
25237
|
async function fetchGrokCredits(input = {}) {
|
|
25136
|
-
const account = await fetchGrokAccount(input);
|
|
25238
|
+
const account = await fetchGrokAccount({ ...input, includePlan: false });
|
|
25137
25239
|
if (!account?.credits)
|
|
25138
25240
|
return null;
|
|
25139
25241
|
const { credits } = account;
|
|
@@ -25642,8 +25744,7 @@ var GrokHarnessSession = class {
|
|
|
25642
25744
|
usage: new GrokTurnUsage(this.#usage, this.#snapshot.turns.length === 0),
|
|
25643
25745
|
agent: null,
|
|
25644
25746
|
agentMessageId: null,
|
|
25645
|
-
|
|
25646
|
-
projectedAgentText: "",
|
|
25747
|
+
agentMedia: null,
|
|
25647
25748
|
reasoning: null,
|
|
25648
25749
|
reasoningMessageId: null,
|
|
25649
25750
|
compactionItem: null,
|
|
@@ -25732,8 +25833,7 @@ var GrokHarnessSession = class {
|
|
|
25732
25833
|
questions: new GrokQuestions(command.turnId, this.#randomUUID, (output) => this.#channel.emit(output)),
|
|
25733
25834
|
agent: null,
|
|
25734
25835
|
agentMessageId: null,
|
|
25735
|
-
|
|
25736
|
-
projectedAgentText: "",
|
|
25836
|
+
agentMedia: null,
|
|
25737
25837
|
reasoning: null,
|
|
25738
25838
|
reasoningMessageId: null,
|
|
25739
25839
|
compactionItem: null,
|
|
@@ -26086,19 +26186,16 @@ var GrokHarnessSession = class {
|
|
|
26086
26186
|
itemId: hostItemIdSchema.parse(this.#randomUUID()),
|
|
26087
26187
|
text: ""
|
|
26088
26188
|
};
|
|
26089
|
-
active.
|
|
26090
|
-
active.projectedAgentText = "";
|
|
26189
|
+
active.agentMedia = new LocalMediaMarkdownStream(this.#mediaRoots);
|
|
26091
26190
|
this.#event({ type: "item.started", turnId: active.command.turnId, item: active.agent });
|
|
26092
26191
|
}
|
|
26093
|
-
active.
|
|
26094
|
-
|
|
26095
|
-
|
|
26096
|
-
|
|
26097
|
-
|
|
26098
|
-
if (delta.length === 0)
|
|
26192
|
+
const delta = active.agentMedia?.append(text) ?? "";
|
|
26193
|
+
this.#publishAgent(active, delta);
|
|
26194
|
+
}
|
|
26195
|
+
#publishAgent(active, delta) {
|
|
26196
|
+
if (!active.agent || !active.agentMedia || !delta)
|
|
26099
26197
|
return;
|
|
26100
|
-
active.
|
|
26101
|
-
active.agent = { ...active.agent, text: active.projectedAgentText };
|
|
26198
|
+
active.agent = { ...active.agent, text: active.agentMedia.text };
|
|
26102
26199
|
this.#event({
|
|
26103
26200
|
type: "item.updated",
|
|
26104
26201
|
turnId: active.command.turnId,
|
|
@@ -26319,25 +26416,12 @@ var GrokHarnessSession = class {
|
|
|
26319
26416
|
}
|
|
26320
26417
|
#completeAgent(active, outcome) {
|
|
26321
26418
|
const item = active.agent;
|
|
26322
|
-
if (item && active.
|
|
26323
|
-
|
|
26324
|
-
const delta = flushed.startsWith(item.text) ? flushed.slice(item.text.length) : "";
|
|
26325
|
-
if (delta.length > 0) {
|
|
26326
|
-
active.projectedAgentText = flushed;
|
|
26327
|
-
active.agent = { ...item, text: flushed };
|
|
26328
|
-
this.#event({
|
|
26329
|
-
type: "item.updated",
|
|
26330
|
-
turnId: active.command.turnId,
|
|
26331
|
-
itemId: item.itemId,
|
|
26332
|
-
update: { type: "text.append", text: delta }
|
|
26333
|
-
});
|
|
26334
|
-
}
|
|
26335
|
-
}
|
|
26419
|
+
if (item && active.agentMedia)
|
|
26420
|
+
this.#publishAgent(active, active.agentMedia.flush());
|
|
26336
26421
|
const completed = active.agent ?? item;
|
|
26337
26422
|
active.agent = null;
|
|
26338
26423
|
active.agentMessageId = null;
|
|
26339
|
-
active.
|
|
26340
|
-
active.projectedAgentText = "";
|
|
26424
|
+
active.agentMedia = null;
|
|
26341
26425
|
if (completed)
|
|
26342
26426
|
this.#completeItem(active, completed, outcome);
|
|
26343
26427
|
}
|
|
@@ -26587,7 +26671,7 @@ var GrokAdapter = class {
|
|
|
26587
26671
|
async inspect(input = {}) {
|
|
26588
26672
|
if (this.#closePromise)
|
|
26589
26673
|
return { status: "unavailable", error: invalidState("Grok Adapter is closed") };
|
|
26590
|
-
const cwd =
|
|
26674
|
+
const cwd = path16.resolve(input.cwd ?? process.cwd());
|
|
26591
26675
|
if (!input.refresh) {
|
|
26592
26676
|
const cached2 = this.#inspectionCache.get(cwd);
|
|
26593
26677
|
if (cached2)
|
|
@@ -26649,7 +26733,7 @@ var GrokAdapter = class {
|
|
|
26649
26733
|
}
|
|
26650
26734
|
};
|
|
26651
26735
|
}
|
|
26652
|
-
const cwd =
|
|
26736
|
+
const cwd = path16.resolve(input.cwd);
|
|
26653
26737
|
const parsedRef = input.kind === "resume" ? nativeSessionRefSchema.safeParse(input.nativeRef) : null;
|
|
26654
26738
|
if (parsedRef && (!parsedRef.success || parsedRef.data.harnessId !== this.harnessId)) {
|
|
26655
26739
|
return {
|