@liberseek/boft-cli-linux-x64 0.8.5 → 0.8.6

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.
Files changed (39) hide show
  1. package/README.md +2 -2
  2. package/THIRD_PARTY_NOTICES.txt +6 -2
  3. package/app/codexhost-distribution.json +1 -1
  4. package/app/console-server.mjs +70 -20
  5. package/app/console-web.js +61 -18
  6. package/app/desktop-controller.mjs +1142 -69
  7. package/app/host-runtime.mjs +3804 -1949
  8. package/app/plugins/antigravity/plugin.mjs +77 -9
  9. package/app/plugins/claude-code/plugin.mjs +27 -6
  10. package/app/plugins/codebuddy/plugin.mjs +25 -0
  11. package/app/plugins/codex-usage/plugin.mjs +15 -0
  12. package/app/plugins/copilot/plugin.mjs +15 -0
  13. package/app/plugins/cursor-cli/plugin.mjs +43 -8
  14. package/app/plugins/deepseek-harness/plugin.mjs +472 -44
  15. package/app/plugins/devin/assets/icon.svg +1 -0
  16. package/app/plugins/devin/manifest.json +30 -0
  17. package/app/plugins/devin/plugin.mjs +23425 -0
  18. package/app/plugins/enabled.json +2 -0
  19. package/app/plugins/grok/plugin.mjs +470 -387
  20. package/app/plugins/hermes/plugin.mjs +468 -196
  21. package/app/plugins/kimi-code/plugin.mjs +65 -3
  22. package/app/plugins/kiro-cli/plugin.mjs +15 -0
  23. package/app/plugins/muse/plugin.mjs +15 -0
  24. package/app/plugins/omp/plugin.mjs +15 -0
  25. package/app/plugins/opencode/plugin.mjs +15 -0
  26. package/app/plugins/pi/plugin.mjs +1595 -411
  27. package/app/plugins/qoder/plugin.mjs +9539 -8654
  28. package/app/plugins/qoder-cn/plugin.mjs +9539 -8654
  29. package/app/plugins/qwen-code/assets/icon.svg +1 -0
  30. package/app/plugins/qwen-code/manifest.json +29 -0
  31. package/app/plugins/qwen-code/plugin.mjs +29366 -0
  32. package/app/plugins/workbuddy/plugin.mjs +25 -0
  33. package/app/plugins/zcode/plugin.mjs +157 -9
  34. package/app/renderer-extension.js +727 -274
  35. package/bin/boft +0 -0
  36. package/libexec/boft-shim +0 -0
  37. package/libexec/boft-updater +0 -0
  38. package/licenses/Qwen-Code-SDK-LICENSE.txt +203 -0
  39. package/package.json +2 -2
@@ -5018,10 +5018,10 @@ function mergeDefs(...defs) {
5018
5018
  function cloneDef(schema) {
5019
5019
  return mergeDefs(schema._zod.def);
5020
5020
  }
5021
- function getElementAtPath(obj, path9) {
5022
- if (!path9)
5021
+ function getElementAtPath(obj, path11) {
5022
+ if (!path11)
5023
5023
  return obj;
5024
- return path9.reduce((acc, key) => acc?.[key], obj);
5024
+ return path11.reduce((acc, key) => acc?.[key], obj);
5025
5025
  }
5026
5026
  function promiseAllObject(promisesObj) {
5027
5027
  const keys = Object.keys(promisesObj);
@@ -5430,11 +5430,11 @@ function explicitlyAborted(x, startIndex = 0) {
5430
5430
  }
5431
5431
  return false;
5432
5432
  }
5433
- function prefixIssues(path9, issues) {
5433
+ function prefixIssues(path11, issues) {
5434
5434
  return issues.map((iss) => {
5435
5435
  var _a3;
5436
5436
  (_a3 = iss).path ?? (_a3.path = []);
5437
- iss.path.unshift(path9);
5437
+ iss.path.unshift(path11);
5438
5438
  return iss;
5439
5439
  });
5440
5440
  }
@@ -5581,16 +5581,16 @@ function flattenError(error51, mapper = (issue2) => issue2.message) {
5581
5581
  }
5582
5582
  function formatError(error51, mapper = (issue2) => issue2.message) {
5583
5583
  const fieldErrors = { _errors: [] };
5584
- const processError = (error52, path9 = []) => {
5584
+ const processError = (error52, path11 = []) => {
5585
5585
  for (const issue2 of error52.issues) {
5586
5586
  if (issue2.code === "invalid_union" && issue2.errors.length) {
5587
- issue2.errors.map((issues) => processError({ issues }, [...path9, ...issue2.path]));
5587
+ issue2.errors.map((issues) => processError({ issues }, [...path11, ...issue2.path]));
5588
5588
  } else if (issue2.code === "invalid_key") {
5589
- processError({ issues: issue2.issues }, [...path9, ...issue2.path]);
5589
+ processError({ issues: issue2.issues }, [...path11, ...issue2.path]);
5590
5590
  } else if (issue2.code === "invalid_element") {
5591
- processError({ issues: issue2.issues }, [...path9, ...issue2.path]);
5591
+ processError({ issues: issue2.issues }, [...path11, ...issue2.path]);
5592
5592
  } else {
5593
- const fullpath = [...path9, ...issue2.path];
5593
+ const fullpath = [...path11, ...issue2.path];
5594
5594
  if (fullpath.length === 0) {
5595
5595
  fieldErrors._errors.push(mapper(issue2));
5596
5596
  } else {
@@ -5617,17 +5617,17 @@ function formatError(error51, mapper = (issue2) => issue2.message) {
5617
5617
  }
5618
5618
  function treeifyError(error51, mapper = (issue2) => issue2.message) {
5619
5619
  const result = { errors: [] };
5620
- const processError = (error52, path9 = []) => {
5620
+ const processError = (error52, path11 = []) => {
5621
5621
  var _a3, _b;
5622
5622
  for (const issue2 of error52.issues) {
5623
5623
  if (issue2.code === "invalid_union" && issue2.errors.length) {
5624
- issue2.errors.map((issues) => processError({ issues }, [...path9, ...issue2.path]));
5624
+ issue2.errors.map((issues) => processError({ issues }, [...path11, ...issue2.path]));
5625
5625
  } else if (issue2.code === "invalid_key") {
5626
- processError({ issues: issue2.issues }, [...path9, ...issue2.path]);
5626
+ processError({ issues: issue2.issues }, [...path11, ...issue2.path]);
5627
5627
  } else if (issue2.code === "invalid_element") {
5628
- processError({ issues: issue2.issues }, [...path9, ...issue2.path]);
5628
+ processError({ issues: issue2.issues }, [...path11, ...issue2.path]);
5629
5629
  } else {
5630
- const fullpath = [...path9, ...issue2.path];
5630
+ const fullpath = [...path11, ...issue2.path];
5631
5631
  if (fullpath.length === 0) {
5632
5632
  result.errors.push(mapper(issue2));
5633
5633
  continue;
@@ -5659,8 +5659,8 @@ function treeifyError(error51, mapper = (issue2) => issue2.message) {
5659
5659
  }
5660
5660
  function toDotPath(_path) {
5661
5661
  const segs = [];
5662
- const path9 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
5663
- for (const seg of path9) {
5662
+ const path11 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
5663
+ for (const seg of path11) {
5664
5664
  if (typeof seg === "number")
5665
5665
  segs.push(`[${seg}]`);
5666
5666
  else if (typeof seg === "symbol")
@@ -18352,13 +18352,13 @@ function resolveRef(ref, ctx) {
18352
18352
  if (!ref.startsWith("#")) {
18353
18353
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
18354
18354
  }
18355
- const path9 = ref.slice(1).split("/").filter(Boolean);
18356
- if (path9.length === 0) {
18355
+ const path11 = ref.slice(1).split("/").filter(Boolean);
18356
+ if (path11.length === 0) {
18357
18357
  return ctx.rootSchema;
18358
18358
  }
18359
18359
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
18360
- if (path9[0] === defsKey) {
18361
- const key = path9[1];
18360
+ if (path11[0] === defsKey) {
18361
+ const key = path11[1];
18362
18362
  if (!key || !ctx.defs[key]) {
18363
18363
  throw new Error(`Reference not found: ${ref}`);
18364
18364
  }
@@ -19837,6 +19837,21 @@ var threadSteeringInspectParamsSchema = external_exports.object({
19837
19837
  /** The text about to be steered; a Harness command always stops and restarts. */
19838
19838
  text: external_exports.string().optional()
19839
19839
  }).strict();
19840
+ var threadSteeringContextSchema = external_exports.object({
19841
+ kind: external_exports.literal("application"),
19842
+ value: external_exports.string().transform((text, context) => {
19843
+ try {
19844
+ return JSON.parse(text);
19845
+ } catch {
19846
+ context.addIssue({ code: "custom", message: "Invalid steering context JSON" });
19847
+ return external_exports.NEVER;
19848
+ }
19849
+ }).pipe(external_exports.object({
19850
+ expectedTurnId: hostTurnIdSchema,
19851
+ clientUserMessageId: external_exports.string().min(1),
19852
+ delivery: external_exports.enum(["newTurn", "activeTurn"])
19853
+ }).strict())
19854
+ }).strict().transform((context) => context.value);
19840
19855
  var threadSteerDeliverySchema = external_exports.enum(["activeTurn", "newTurn"]);
19841
19856
  var threadSteeringInspectResultSchema = external_exports.object({
19842
19857
  delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
@@ -21006,16 +21021,16 @@ var Diff = class {
21006
21021
  }
21007
21022
  }
21008
21023
  }
21009
- addToPath(path9, added, removed, oldPosInc, options) {
21010
- const last = path9.lastComponent;
21024
+ addToPath(path11, added, removed, oldPosInc, options) {
21025
+ const last = path11.lastComponent;
21011
21026
  if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) {
21012
21027
  return {
21013
- oldPos: path9.oldPos + oldPosInc,
21028
+ oldPos: path11.oldPos + oldPosInc,
21014
21029
  lastComponent: { count: last.count + 1, added, removed, previousComponent: last.previousComponent }
21015
21030
  };
21016
21031
  } else {
21017
21032
  return {
21018
- oldPos: path9.oldPos + oldPosInc,
21033
+ oldPos: path11.oldPos + oldPosInc,
21019
21034
  lastComponent: { count: 1, added, removed, previousComponent: last }
21020
21035
  };
21021
21036
  }
@@ -22932,7 +22947,7 @@ async function probeDeepSeekExecutableGeneration(options = {}, dependencies = {
22932
22947
 
22933
22948
  // dist/modern/deepseek-harness-adapter.js
22934
22949
  import { randomUUID as randomUUID2 } from "node:crypto";
22935
- import path8 from "node:path";
22950
+ import path10 from "node:path";
22936
22951
 
22937
22952
  // dist/modern/catalog.js
22938
22953
  import { Buffer as Buffer3 } from "node:buffer";
@@ -27155,8 +27170,369 @@ function invalidInbox() {
27155
27170
  }
27156
27171
 
27157
27172
  // dist/modern/history.js
27173
+ import path8 from "node:path";
27158
27174
  import { isDeepStrictEqual as isDeepStrictEqual5 } from "node:util";
27159
27175
 
27176
+ // ../../harness-adapter/dist/local-media-markdown.js
27177
+ import { existsSync, statSync as statSync2 } from "node:fs";
27178
+ import path7 from "node:path";
27179
+ import { fileURLToPath } from "node:url";
27180
+ var MEDIA_EXTENSIONS = /* @__PURE__ */ new Set([
27181
+ ".aac",
27182
+ ".gif",
27183
+ ".jpeg",
27184
+ ".jpg",
27185
+ ".m4a",
27186
+ ".m4v",
27187
+ ".mov",
27188
+ ".mp3",
27189
+ ".mp4",
27190
+ ".ogg",
27191
+ ".png",
27192
+ ".svg",
27193
+ ".wav",
27194
+ ".webm",
27195
+ ".webp"
27196
+ ]);
27197
+ function rewriteLocalMediaMarkdown(text, roots, options = {}) {
27198
+ return projectLocalMedia(text, roots, options.exists ?? mediaFileExists, options.holdIncomplete === true, options.relativeImagesOnly === true).text;
27199
+ }
27200
+ var LocalMediaMarkdownStream = class {
27201
+ #roots;
27202
+ #exists;
27203
+ #relativeImagesOnly;
27204
+ #native = "";
27205
+ #text = "";
27206
+ /** Native text length represented by `#text`; the rest is held. */
27207
+ #consumed = 0;
27208
+ #verbatim = false;
27209
+ constructor(roots, exists = mediaFileExists, options = {}) {
27210
+ this.#roots = [...roots];
27211
+ this.#relativeImagesOnly = options.relativeImagesOnly === true;
27212
+ const known = /* @__PURE__ */ new Map();
27213
+ this.#exists = (absolutePath) => {
27214
+ let found = known.get(absolutePath);
27215
+ if (found === void 0) {
27216
+ found = exists(absolutePath);
27217
+ known.set(absolutePath, found);
27218
+ }
27219
+ return found;
27220
+ };
27221
+ }
27222
+ /** Projected text published so far: every returned delta, concatenated. */
27223
+ get text() {
27224
+ return this.#text;
27225
+ }
27226
+ /** Add native text and return the projected text it makes publishable, possibly empty. */
27227
+ append(text) {
27228
+ this.#native += text;
27229
+ return this.#advance(true);
27230
+ }
27231
+ /** Return the projected text still held at the end of the stream. */
27232
+ flush() {
27233
+ return this.#advance(false);
27234
+ }
27235
+ #advance(holdIncomplete) {
27236
+ const next = this.#verbatim ? void 0 : projectLocalMedia(this.#native, this.#roots, this.#exists, holdIncomplete, this.#relativeImagesOnly);
27237
+ let delta;
27238
+ if (next?.text.startsWith(this.#text)) {
27239
+ delta = next.text.slice(this.#text.length);
27240
+ this.#consumed = next.consumed;
27241
+ } else {
27242
+ this.#verbatim = true;
27243
+ delta = this.#native.slice(this.#consumed);
27244
+ this.#consumed = this.#native.length;
27245
+ }
27246
+ this.#text += delta;
27247
+ return delta;
27248
+ }
27249
+ };
27250
+ function projectLocalMedia(text, roots, exists, holdIncomplete, relativeImagesOnly) {
27251
+ let output = "";
27252
+ let index = 0;
27253
+ let fence = null;
27254
+ while (index < text.length) {
27255
+ if (fence) {
27256
+ const close = closingFenceEnd(text, index, fence.marker, fence.length);
27257
+ if (close === -1)
27258
+ break;
27259
+ output += text.slice(index, close);
27260
+ index = close;
27261
+ fence = null;
27262
+ continue;
27263
+ }
27264
+ const next = earliestIndex([
27265
+ text.indexOf("![", index),
27266
+ text.indexOf("`", index),
27267
+ indexOfLineStartTilde(text, index)
27268
+ ]);
27269
+ if (next === -1)
27270
+ break;
27271
+ output += text.slice(index, next);
27272
+ index = next;
27273
+ const marker = text[next];
27274
+ let markerLength = 1;
27275
+ if (marker === "`" || marker === "~") {
27276
+ let runEnd = next;
27277
+ while (text[runEnd] === marker)
27278
+ runEnd += 1;
27279
+ markerLength = runEnd - next;
27280
+ if (runEnd === text.length && holdIncomplete) {
27281
+ return { text: output, consumed: next };
27282
+ }
27283
+ if (runEnd - next >= 3) {
27284
+ const kind = fenceLineKind(text, next);
27285
+ if (kind === "opaque")
27286
+ break;
27287
+ if (kind === "flat") {
27288
+ fence = { marker, length: runEnd - next };
27289
+ output += text.slice(next, runEnd);
27290
+ index = runEnd;
27291
+ continue;
27292
+ }
27293
+ }
27294
+ if (marker === "~") {
27295
+ output += text.slice(next, runEnd);
27296
+ index = runEnd;
27297
+ continue;
27298
+ }
27299
+ }
27300
+ if (text.startsWith("![", next)) {
27301
+ const image = parseMarkdownImage(text, next);
27302
+ if (image.kind === "text") {
27303
+ output += text.slice(next, image.end);
27304
+ index = image.end;
27305
+ continue;
27306
+ }
27307
+ if (image.kind === "open") {
27308
+ if (!holdIncomplete)
27309
+ break;
27310
+ return { text: output + text.slice(next, image.holdFrom), consumed: image.holdFrom };
27311
+ }
27312
+ const resolved2 = relativeImagesOnly && /^(?:[\\/]|[a-z][a-z\d+.-]*:)/i.test(image.destination.trim()) ? null : resolveLocalMediaPath(image.destination, roots, exists);
27313
+ output += resolved2 === null ? text.slice(next, image.end) : text.slice(next, image.destinationStart) + markdownDestination(resolved2, image.bracketed) + text.slice(image.destinationEnd, image.end);
27314
+ index = image.end;
27315
+ continue;
27316
+ }
27317
+ const code = parseInlineCode(text, next, markerLength);
27318
+ if (code.kind !== "code" || holdIncomplete && code.end === text.length) {
27319
+ if (holdIncomplete && code.kind !== "text")
27320
+ return { text: output, consumed: next };
27321
+ output += text.slice(next, next + markerLength);
27322
+ index = next + markerLength;
27323
+ continue;
27324
+ }
27325
+ const resolved = relativeImagesOnly || markerLength !== 1 || /[\r\n]/u.test(code.content) ? null : resolveLocalMediaPath(code.content, roots, exists);
27326
+ output += resolved === null ? text.slice(next, code.end) : mediaMarkdownImage(resolved);
27327
+ index = code.end;
27328
+ }
27329
+ return { text: output + text.slice(index), consumed: text.length };
27330
+ }
27331
+ function fenceLineKind(text, index) {
27332
+ const prefix = text.slice(text.lastIndexOf("\n", index - 1) + 1, index);
27333
+ if (prefix === "")
27334
+ return "flat";
27335
+ let remaining = prefix.replace(/^[ \t]+/u, "");
27336
+ while (remaining) {
27337
+ const marker = /^(?:>|(?:[-+*]|\d{1,9}[.)])(?=[ \t]))[ \t]*/u.exec(remaining);
27338
+ if (!marker)
27339
+ return null;
27340
+ remaining = remaining.slice(marker[0].length);
27341
+ }
27342
+ return "opaque";
27343
+ }
27344
+ function indexOfLineStartTilde(text, start) {
27345
+ for (let tilde = text.indexOf("~", start); tilde !== -1; tilde = text.indexOf("~", tilde + 1)) {
27346
+ if (fenceLineKind(text, tilde) !== null)
27347
+ return tilde;
27348
+ }
27349
+ return -1;
27350
+ }
27351
+ function closingFenceEnd(text, start, marker, length) {
27352
+ const closing = new RegExp(`^ {0,3}${marker === "`" ? "`" : "~"}{${length},}[ \\t]*\\r?$`, "u");
27353
+ let lineStart = text.indexOf("\n", start);
27354
+ while (lineStart !== -1) {
27355
+ lineStart += 1;
27356
+ const newline = text.indexOf("\n", lineStart);
27357
+ const lineEnd = newline === -1 ? text.length : newline;
27358
+ if (closing.test(text.slice(lineStart, lineEnd)))
27359
+ return lineEnd;
27360
+ lineStart = newline;
27361
+ }
27362
+ return -1;
27363
+ }
27364
+ function earliestIndex(candidates) {
27365
+ let next = -1;
27366
+ for (const candidate of candidates) {
27367
+ if (candidate === -1)
27368
+ continue;
27369
+ if (next === -1 || candidate < next)
27370
+ next = candidate;
27371
+ }
27372
+ return next;
27373
+ }
27374
+ function parseInlineCode(text, start, length) {
27375
+ let index = start + length;
27376
+ while (index < text.length) {
27377
+ const tick = text.indexOf("`", index);
27378
+ if (/\n[^\S\n]*\n/u.test(text.slice(index, tick < 0 ? text.length : tick))) {
27379
+ return { kind: "text" };
27380
+ }
27381
+ if (tick === -1)
27382
+ break;
27383
+ let end = tick + 1;
27384
+ while (text[end] === "`")
27385
+ end += 1;
27386
+ if (end - tick === length) {
27387
+ return { kind: "code", content: text.slice(start + length, tick), end };
27388
+ }
27389
+ index = end;
27390
+ }
27391
+ return { kind: "open" };
27392
+ }
27393
+ function parseMarkdownImage(text, start) {
27394
+ const openLabel = { kind: "open", holdFrom: start + 2 };
27395
+ let index = start + 2;
27396
+ while (index < text.length) {
27397
+ const character = text[index];
27398
+ if (character === "\n")
27399
+ return { kind: "text", end: start + 1 };
27400
+ if (character === "\\") {
27401
+ index += 2;
27402
+ continue;
27403
+ }
27404
+ if (character === "]")
27405
+ break;
27406
+ index += 1;
27407
+ }
27408
+ if (index + 1 >= text.length)
27409
+ return openLabel;
27410
+ if (text[index + 1] !== "(")
27411
+ return { kind: "text", end: start + 1 };
27412
+ const destinationStart = index + 2;
27413
+ const open = { kind: "open", holdFrom: destinationStart };
27414
+ const malformed = { kind: "text", end: destinationStart };
27415
+ index = skipBlanks(text, destinationStart);
27416
+ if (index >= text.length)
27417
+ return open;
27418
+ let destination;
27419
+ let destinationEnd;
27420
+ let bracketed = false;
27421
+ if (text[index] === "<") {
27422
+ bracketed = true;
27423
+ let close = index + 1;
27424
+ while (close < text.length && text[close] !== ">" && text[close] !== "\n")
27425
+ close += 1;
27426
+ if (close >= text.length)
27427
+ return open;
27428
+ if (text[close] === "\n")
27429
+ return malformed;
27430
+ destination = text.slice(index + 1, close);
27431
+ destinationEnd = close + 1;
27432
+ index = destinationEnd;
27433
+ } else {
27434
+ const begin = index;
27435
+ while (index < text.length) {
27436
+ const character = text[index];
27437
+ if (character === "\n" || character === " " || character === " " || character === ")")
27438
+ break;
27439
+ index += character === "\\" ? 2 : 1;
27440
+ }
27441
+ if (index >= text.length)
27442
+ return open;
27443
+ destination = unescapeMarkdown(text.slice(begin, index));
27444
+ destinationEnd = index;
27445
+ }
27446
+ index = skipBlanks(text, index);
27447
+ if (index >= text.length)
27448
+ return open;
27449
+ const opener = text[index];
27450
+ if (opener === '"' || opener === "'" || opener === "(") {
27451
+ const closer = opener === "(" ? ")" : opener;
27452
+ index += 1;
27453
+ while (index < text.length && text[index] !== closer && text[index] !== "\n")
27454
+ index += 1;
27455
+ if (index >= text.length)
27456
+ return open;
27457
+ if (text[index] === "\n")
27458
+ return malformed;
27459
+ index = skipBlanks(text, index + 1);
27460
+ if (index >= text.length)
27461
+ return open;
27462
+ }
27463
+ if (text[index] !== ")")
27464
+ return malformed;
27465
+ return {
27466
+ kind: "image",
27467
+ destination,
27468
+ destinationStart,
27469
+ destinationEnd,
27470
+ end: index + 1,
27471
+ bracketed
27472
+ };
27473
+ }
27474
+ function skipBlanks(text, start) {
27475
+ let index = start;
27476
+ while (text[index] === " " || text[index] === " ")
27477
+ index += 1;
27478
+ return index;
27479
+ }
27480
+ function mediaMarkdownImage(absolutePath) {
27481
+ const name = path7.basename(absolutePath).replaceAll("]", "\\]");
27482
+ return `![${name}](${markdownDestination(absolutePath, false)})`;
27483
+ }
27484
+ function markdownDestination(absolutePath, bracketed) {
27485
+ const encoded = absolutePath.replaceAll("%", "%2525");
27486
+ const destination = /^[A-Za-z]:\\/.test(encoded) ? encoded.replaceAll("\\", "/") : encoded.replaceAll("\\", "\\\\");
27487
+ return bracketed || /[\s()]/.test(destination) ? `<${destination}>` : destination;
27488
+ }
27489
+ function unescapeMarkdown(value) {
27490
+ return value.replace(/\\([\\()])/g, "$1");
27491
+ }
27492
+ function resolveLocalMediaPath(raw, roots, exists = mediaFileExists) {
27493
+ const trimmed = raw.trim();
27494
+ if (trimmed.length === 0 || isRemoteMediaUrl(trimmed))
27495
+ return null;
27496
+ const stripped = stripFileUrl(trimmed);
27497
+ if (stripped === null)
27498
+ return null;
27499
+ if (isAbsoluteMediaPath(stripped)) {
27500
+ const absolute = path7.resolve(stripped);
27501
+ return hasMediaExtension(absolute) && exists(absolute) ? absolute : null;
27502
+ }
27503
+ for (const root of roots) {
27504
+ const absolute = path7.resolve(root, stripped);
27505
+ if (hasMediaExtension(absolute) && exists(absolute))
27506
+ return absolute;
27507
+ }
27508
+ return null;
27509
+ }
27510
+ function isRemoteMediaUrl(value) {
27511
+ return /^(?:https?:|data:|app:|blob:)/i.test(value);
27512
+ }
27513
+ function stripFileUrl(value) {
27514
+ if (!value.toLowerCase().startsWith("file:"))
27515
+ return value;
27516
+ try {
27517
+ return fileURLToPath(value);
27518
+ } catch {
27519
+ return null;
27520
+ }
27521
+ }
27522
+ function isAbsoluteMediaPath(value) {
27523
+ return path7.isAbsolute(value) || /^[a-zA-Z]:[\\/]/.test(value);
27524
+ }
27525
+ function hasMediaExtension(value) {
27526
+ return MEDIA_EXTENSIONS.has(path7.extname(value).toLowerCase());
27527
+ }
27528
+ function mediaFileExists(absolutePath) {
27529
+ try {
27530
+ return existsSync(absolutePath) && statSync2(absolutePath).isFile();
27531
+ } catch {
27532
+ return false;
27533
+ }
27534
+ }
27535
+
27160
27536
  // dist/modern/compaction.js
27161
27537
  var MODERN_CONTEXT_PRESSURE_KEY = "contextPressure";
27162
27538
  function modernCompactionOutcome(data) {
@@ -27774,6 +28150,8 @@ function projectModernHistory(input) {
27774
28150
  let effectiveThinkingOptionId = input.fallbackThinkingOptionId;
27775
28151
  let contextWindowTokens;
27776
28152
  let usage = null;
28153
+ let workingDirectory = input.cwd;
28154
+ const media = input.media ?? input.cwd !== void 0;
27777
28155
  const rawUsageByStep = /* @__PURE__ */ new Map();
27778
28156
  const rebuildUsage = () => {
27779
28157
  usage = null;
@@ -27795,6 +28173,7 @@ function projectModernHistory(input) {
27795
28173
  if (!KNOWN_EVENT_TYPES.has(event.type) || !isRecord4(event.data))
27796
28174
  continue;
27797
28175
  const data = event.data;
28176
+ workingDirectory = modernWorkingDirectory(workingDirectory, event);
27798
28177
  switch (event.type) {
27799
28178
  case "turn/start":
27800
28179
  active = {
@@ -27839,8 +28218,9 @@ function projectModernHistory(input) {
27839
28218
  case "assistant/message":
27840
28219
  if (event.surfaceOp === "append") {
27841
28220
  recordSettlementUsage(data, event.seq);
27842
- if (active)
27843
- projectAssistantMessage(active, input.sessionId, data);
28221
+ if (active) {
28222
+ projectAssistantMessage(active, input.sessionId, data, media ? modernMediaRoots(workingDirectory, input.cwd) : void 0);
28223
+ }
27844
28224
  }
27845
28225
  break;
27846
28226
  case "compaction/start":
@@ -27961,7 +28341,21 @@ function modernCheckpointRef(harnessId, sessionId, seq, profile = DEEPSEEK_V4_PR
27961
28341
  function modernItemId(sessionId, key) {
27962
28342
  return hostItemIdSchema.parse(`dsh-modern:${sessionId}:${key}`);
27963
28343
  }
27964
- function projectAssistantMessage(turn, sessionId, data) {
28344
+ function modernWorkingDirectory(current, event) {
28345
+ if (event.type !== "working-directory/change" || !isRecord4(event.data) || typeof event.data.cwd !== "string") {
28346
+ return current;
28347
+ }
28348
+ const next = event.data.cwd;
28349
+ if (path8.isAbsolute(next))
28350
+ return path8.resolve(next);
28351
+ return current === void 0 ? void 0 : path8.resolve(current, next);
28352
+ }
28353
+ function modernMediaRoots(workingDirectory, sessionDirectory) {
28354
+ return [
28355
+ ...new Set([workingDirectory ?? sessionDirectory, sessionDirectory].filter((root) => root !== void 0))
28356
+ ];
28357
+ }
28358
+ function projectAssistantMessage(turn, sessionId, data, mediaRoots) {
27965
28359
  const message = data.message;
27966
28360
  if (Array.isArray(message.content)) {
27967
28361
  for (const block of message.content) {
@@ -27984,7 +28378,7 @@ function projectAssistantMessage(turn, sessionId, data) {
27984
28378
  const item = {
27985
28379
  type: "agentMessage",
27986
28380
  itemId: modernItemId(sessionId, `turn:${turn.turn}:step:${String(data.step)}:assistant`),
27987
- text
28381
+ text: mediaRoots ? rewriteLocalMediaMarkdown(text, mediaRoots) : text
27988
28382
  };
27989
28383
  turn.items.push({ item, outcome: { status: "succeeded" } });
27990
28384
  }
@@ -28803,6 +29197,8 @@ var ModernHarnessSession = class {
28803
29197
  #flushSession;
28804
29198
  #fallbackModel;
28805
29199
  #fallbackThinkingOptionId;
29200
+ #sessionDirectory;
29201
+ #workingDirectory;
28806
29202
  #channel = new HarnessOutputChannel();
28807
29203
  #validator;
28808
29204
  #events;
@@ -28869,8 +29265,12 @@ var ModernHarnessSession = class {
28869
29265
  this.#events = [...options.journal.events];
28870
29266
  this.#historyBytes = journalHistoryBytes(this.#events, this.#maxHistoryBytes);
28871
29267
  this.#validator = new ModernEventValidator(this.#maxEvents, this.#profile);
28872
- for (const event of this.#events)
29268
+ this.#sessionDirectory = options.journal.header.cwd;
29269
+ this.#workingDirectory = this.#sessionDirectory;
29270
+ for (const event of this.#events) {
28873
29271
  this.#validator.accept(event);
29272
+ this.#workingDirectory = modernWorkingDirectory(this.#workingDirectory, event);
29273
+ }
28874
29274
  const projection = projectModernHistory({
28875
29275
  harnessId: this.harnessId,
28876
29276
  sessionId: this.#sessionId,
@@ -28905,12 +29305,18 @@ var ModernHarnessSession = class {
28905
29305
  };
28906
29306
  let resumedAutonomousBuffer;
28907
29307
  if (projection.incompleteTurn) {
29308
+ let workingDirectory = this.#sessionDirectory;
29309
+ const turnStart = this.#events.length - projection.incompleteTurn.events.length;
29310
+ for (const event of this.#events.slice(0, turnStart)) {
29311
+ workingDirectory = modernWorkingDirectory(workingDirectory, event);
29312
+ }
28908
29313
  const buffer = {
28909
29314
  nativeTurn: projection.incompleteTurn.turn,
28910
29315
  events: [...projection.incompleteTurn.events],
28911
29316
  input: [],
28912
29317
  initialResume: true,
28913
29318
  replayed: 0,
29319
+ workingDirectory,
28914
29320
  sawUserMessage: false,
28915
29321
  reachedCorrelationBoundary: false
28916
29322
  };
@@ -28952,7 +29358,7 @@ var ModernHarnessSession = class {
28952
29358
  return Promise.resolve({ ok: false, error: busyError("read history") });
28953
29359
  this.#reading = true;
28954
29360
  try {
28955
- const projection = this.#project();
29361
+ const projection = this.#project(true);
28956
29362
  const configuration = this.#readConfiguration();
28957
29363
  return Promise.resolve({
28958
29364
  ok: true,
@@ -29890,6 +30296,7 @@ ${question.detail}` : question.question;
29890
30296
  this.#validator.accept(event);
29891
30297
  this.#observeAssistantSettlement(event);
29892
30298
  this.#events.push(event);
30299
+ this.#workingDirectory = modernWorkingDirectory(this.#workingDirectory, event);
29893
30300
  this.#meterUsage(event);
29894
30301
  this.#historyBytes += bytes;
29895
30302
  this.#receive(event);
@@ -30015,8 +30422,8 @@ ${question.detail}` : question.question;
30015
30422
  const agent = active.agent;
30016
30423
  if (!agent)
30017
30424
  return;
30018
- agent.text += CANCELLED_ASSISTANT_ATTEMPT_SUFFIX;
30019
- agent.item = { ...agent.item, text: agent.text };
30425
+ this.#flushAgent(active, agent);
30426
+ agent.item = { ...agent.item, text: agent.item.text + CANCELLED_ASSISTANT_ATTEMPT_SUFFIX };
30020
30427
  this.#emit({
30021
30428
  type: "item.updated",
30022
30429
  turnId: active.turnId,
@@ -30140,6 +30547,7 @@ ${question.detail}` : question.question;
30140
30547
  input: [],
30141
30548
  initialResume: false,
30142
30549
  replayed: 0,
30550
+ workingDirectory: this.#workingDirectory,
30143
30551
  sawUserMessage: false,
30144
30552
  reachedCorrelationBoundary: false
30145
30553
  };
@@ -30318,6 +30726,7 @@ ${question.detail}` : question.question;
30318
30726
  while (!this.#closed && buffer.replayed < buffer.events.length) {
30319
30727
  const event = buffer.events[buffer.replayed];
30320
30728
  buffer.replayed += 1;
30729
+ buffer.workingDirectory = modernWorkingDirectory(buffer.workingDirectory, event);
30321
30730
  this.#projectLiveEvent(buffer, event, initialReplay);
30322
30731
  }
30323
30732
  this.#projectAssistantLiveChunks();
@@ -30427,16 +30836,28 @@ ${question.detail}` : question.question;
30427
30836
  itemId: modernItemId(this.#sessionId, `turn:${active.nativeTurn}:step:${step}:${attemptId ? `attempt:${attemptId}:` : ""}assistant`),
30428
30837
  text: ""
30429
30838
  };
30430
- active.agent = { item, text: "" };
30839
+ const buffer = this.#buffer;
30840
+ const workingDirectory = buffer?.active === active ? buffer.workingDirectory : this.#workingDirectory;
30841
+ const roots = modernMediaRoots(workingDirectory, this.#sessionDirectory);
30842
+ active.agent = { item, text: "", media: new LocalMediaMarkdownStream(roots) };
30431
30843
  this.#emit({ type: "item.started", turnId: active.turnId, item });
30432
30844
  }
30433
30845
  active.agent.text += text;
30434
- active.agent.item = { ...active.agent.item, text: active.agent.text };
30846
+ this.#publishAgent(active, active.agent, active.agent.media.append(text));
30847
+ }
30848
+ /** Publish text the media projection held for a trailing construct before the Item ends. */
30849
+ #flushAgent(active, agent) {
30850
+ this.#publishAgent(active, agent, agent.media.flush());
30851
+ }
30852
+ #publishAgent(active, agent, delta) {
30853
+ if (!delta)
30854
+ return;
30855
+ agent.item = { ...agent.item, text: agent.media.text };
30435
30856
  this.#emit({
30436
30857
  type: "item.updated",
30437
30858
  turnId: active.turnId,
30438
- itemId: active.agent.item.itemId,
30439
- update: { type: "text.append", text }
30859
+ itemId: agent.item.itemId,
30860
+ update: { type: "text.append", text: delta }
30440
30861
  });
30441
30862
  }
30442
30863
  #startReasoning(active, step, provisional, attemptId) {
@@ -30544,6 +30965,7 @@ ${question.detail}` : question.question;
30544
30965
  }
30545
30966
  if (!current)
30546
30967
  return;
30968
+ this.#flushAgent(active, current);
30547
30969
  delete active.agent;
30548
30970
  this.#completeItem(active, current.item, { status: "succeeded" });
30549
30971
  }
@@ -30685,9 +31107,10 @@ ${question.detail}` : question.question;
30685
31107
  this.#completeItem(active, item, outcome);
30686
31108
  }
30687
31109
  if (active.agent) {
30688
- const item = active.agent.item;
31110
+ const agent = active.agent;
31111
+ this.#flushAgent(active, agent);
30689
31112
  delete active.agent;
30690
- this.#completeItem(active, item, outcome);
31113
+ this.#completeItem(active, agent.item, outcome);
30691
31114
  }
30692
31115
  for (const tool of active.tools.values())
30693
31116
  this.#completeItem(active, tool.item, outcome);
@@ -30714,12 +31137,17 @@ ${question.detail}` : question.question;
30714
31137
  });
30715
31138
  }
30716
31139
  }
30717
- #project() {
31140
+ /** `media` also resolves local media paths, which only displayed history needs. */
31141
+ #project(media = false) {
30718
31142
  return projectModernHistory({
30719
31143
  harnessId: this.harnessId,
30720
31144
  sessionId: this.#sessionId,
30721
31145
  events: this.#events,
30722
31146
  profile: this.#profile,
31147
+ ...media ? {
31148
+ media: true,
31149
+ ...this.#sessionDirectory !== void 0 ? { cwd: this.#sessionDirectory } : {}
31150
+ } : {},
30723
31151
  ...this.#fallbackModel ? { fallbackModel: this.#fallbackModel } : {},
30724
31152
  ...this.#fallbackThinkingOptionId ? { fallbackThinkingOptionId: this.#fallbackThinkingOptionId } : {},
30725
31153
  toolOutputLimit: this.#toolOutputLimit,
@@ -31304,7 +31732,7 @@ function safeTimerDelay(value, name) {
31304
31732
 
31305
31733
  // dist/modern/session-list.js
31306
31734
  import { Buffer as Buffer5 } from "node:buffer";
31307
- import path7 from "node:path";
31735
+ import path9 from "node:path";
31308
31736
  var MAX_SESSION_LIST_BYTES = 32 * 1024 * 1024;
31309
31737
  var MAX_SESSION_LIST_DEPTH = 64;
31310
31738
  var MAX_SESSION_LIST_NODES = 2e5;
@@ -31424,7 +31852,7 @@ function parseSummary(value) {
31424
31852
  };
31425
31853
  }
31426
31854
  function isCanonicalAbsoluteCwd(value) {
31427
- return value !== void 0 && value.trim().length > 0 && !value.includes("\0") && path7.isAbsolute(value) && path7.resolve(value) === value;
31855
+ return value !== void 0 && value.trim().length > 0 && !value.includes("\0") && path9.isAbsolute(value) && path9.resolve(value) === value;
31428
31856
  }
31429
31857
  function parseModernSessionCandidates(value) {
31430
31858
  assertBoundedJson4(value);
@@ -31622,7 +32050,7 @@ var ModernDeepSeekHarnessAdapter = class {
31622
32050
  let session;
31623
32051
  let forkExpectation;
31624
32052
  try {
31625
- const cwd = path8.resolve(input.cwd);
32053
+ const cwd = path10.resolve(input.cwd);
31626
32054
  let forkInput = input.kind === "fork" ? parseModernForkInput(input, this.#profile) : void 0;
31627
32055
  const rollbackSourceSessionId = input.kind === "rollbackLastTurn" ? modernSessionId(input.sourceRef, "roll back") : void 0;
31628
32056
  let rollbackPlan;