nolo-cli 0.228.0-alpha.1 → 0.228.0-alpha.2

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 (81) hide show
  1. package/{_executeModel-WZKT6XEU.js → _executeModel-VYCHHZVT.js} +18 -16
  2. package/{agentDeleteCommand-PZWRHNXY.js → agentDeleteCommand-QWQKT54A.js} +24 -22
  3. package/{agentEmailCommands-QTKMEICX.js → agentEmailCommands-EISMBIRE.js} +24 -22
  4. package/{agentListCommands-GUGMORTK.js → agentListCommands-4WLG32IW.js} +23 -415
  5. package/{agentMachineCommands-7QGICJLM.js → agentMachineCommands-DC6NKWTU.js} +12 -11
  6. package/{agentRecordCommands-SLLADS5C.js → agentRecordCommands-IZYUVHME.js} +24 -22
  7. package/{agentRunCommand-OFQLOF5Y.js → agentRunCommand-QM7ETUTX.js} +25 -23
  8. package/{agentRuntimeLocal-TU4LA353.js → agentRuntimeLocal-HOXKWCYO.js} +9 -8
  9. package/{agentSlice-L4SBGWTB.js → agentSlice-UG76KEBH.js} +1 -1
  10. package/{appDeleteCommands-JWP3XPUA.js → appDeleteCommands-WWCC6WA5.js} +13 -12
  11. package/{appDeployCommands-6E4TQCWI.js → appDeployCommands-AU4IUN33.js} +13 -12
  12. package/{appDeployStatusCommands-ALU4SADG.js → appDeployStatusCommands-STUW7WXL.js} +13 -12
  13. package/{appGetCommands-JEY4L6L4.js → appGetCommands-BGTLIQ4K.js} +13 -12
  14. package/{appListCommands-PCAVHU7M.js → appListCommands-CUCPRUXW.js} +13 -12
  15. package/{authCommand-CGRIIOOV.js → authCommand-OZ2KTP4Z.js} +2 -2
  16. package/{chunk-JUSHVFNF.js → chunk-3QIYD3VM.js} +414 -342
  17. package/{chunk-H6L2NFHY.js → chunk-3VZLEKV2.js} +2 -2
  18. package/{chunk-3P54D2E4.js → chunk-42OKN2LI.js} +1 -1
  19. package/{chunk-EXJK7TQO.js → chunk-45CAVC35.js} +43 -288
  20. package/{chunk-SMJEXX2S.js → chunk-4QYJPWHH.js} +2 -2
  21. package/{chunk-Q3IVPFVO.js → chunk-5YMA6DDZ.js} +1 -1
  22. package/{chunk-R3NEQZ53.js → chunk-7BCG67EI.js} +8 -8
  23. package/{chunk-CYWNWA77.js → chunk-7FEP5USX.js} +6 -3
  24. package/{chunk-GACR7H6T.js → chunk-CNMY2XM6.js} +2 -2
  25. package/{chunk-STJ6LSQE.js → chunk-DLXMMTGM.js} +82 -21
  26. package/{chunk-MDZWUD3R.js → chunk-EGHP7KOY.js} +3 -3
  27. package/{chunk-AGYPUBFW.js → chunk-FPBJM2BW.js} +4 -1
  28. package/{chunk-IXG6YXQM.js → chunk-GAYNXB6T.js} +51 -40
  29. package/{chunk-XJPLSAPJ.js → chunk-HF7BLF3F.js} +2 -2
  30. package/{chunk-GYS5FUYR.js → chunk-HXB4VDGK.js} +1 -1
  31. package/{chunk-BNMPUQW6.js → chunk-JQZRSXS5.js} +23 -23
  32. package/{chunk-VSYTM22R.js → chunk-LYD6C7OU.js} +2 -2
  33. package/{chunk-QBZCGP34.js → chunk-M3OZRQNH.js} +1 -1
  34. package/{chunk-DDC6P6EH.js → chunk-MJI3UAXN.js} +34 -10
  35. package/{chunk-RYOLWYBK.js → chunk-MNEZUL5S.js} +16 -1
  36. package/{chunk-GOCSSER3.js → chunk-MZG5CETE.js} +2 -2
  37. package/{chunk-QCB42576.js → chunk-OJ45MEEI.js} +1 -1
  38. package/{chunk-UE2EVEYS.js → chunk-OTKSESZR.js} +2 -2
  39. package/{chunk-NHY322ZU.js → chunk-RRDRQOEC.js} +508 -2
  40. package/{chunk-2MCB7CD7.js → chunk-TCZ2VJZQ.js} +3 -3
  41. package/{chunk-D6YNCNM6.js → chunk-TQEKUOTI.js} +2 -2
  42. package/{chunk-2NPD3FTX.js → chunk-U2HBB7RS.js} +14 -14
  43. package/{chunk-AUAJTAFM.js → chunk-VQ5N5GSV.js} +1 -1
  44. package/{chunk-K67C2JUC.js → chunk-WCFFRBL5.js} +3 -3
  45. package/{chunk-GPOV42YM.js → chunk-WFDNADFX.js} +1 -1
  46. package/chunk-WFGNWWJI.js +326 -0
  47. package/{chunk-OYU2MA5S.js → chunk-X3E6EHJW.js} +9 -8
  48. package/{chunk-GUXZK7SE.js → chunk-XAG3FWBE.js} +11 -0
  49. package/{chunk-OG6MQOQG.js → chunk-XFXFPUO7.js} +2 -2
  50. package/{chunk-UWAIJOF2.js → chunk-XTJKU3Z4.js} +4 -4
  51. package/{chunk-IAAIUH64.js → chunk-YVFH2MFB.js} +3 -3
  52. package/{chunk-TGNIKIHR.js → chunk-ZEVQHCLM.js} +1 -1
  53. package/{cliLocalAgentRecordReader-M3F76NIP.js → cliLocalAgentRecordReader-H3HYQRRR.js} +11 -10
  54. package/{commandRegistry-ZLWHQVAI.js → commandRegistry-FVYPE2IN.js} +47 -47
  55. package/{contentThunks-4ZX2TO7C.js → contentThunks-GNFPG32S.js} +3 -3
  56. package/{createAgentAutomationAction-L4CYUZJG.js → createAgentAutomationAction-PB4QIFQ4.js} +3 -3
  57. package/{createDialogAction-QTU2R2Q3.js → createDialogAction-EVTOPY7A.js} +4 -4
  58. package/{createPageAction-F3GJTHW2.js → createPageAction-2UYF2IDZ.js} +4 -4
  59. package/{dialogCommands-NRLCOPJR.js → dialogCommands-6SZD4TYP.js} +13 -12
  60. package/{dialogSlice-P2S4LXQD.js → dialogSlice-5EQ2A6LY.js} +2 -2
  61. package/{docCreateCommands-YJRDA3RX.js → docCreateCommands-25E6PGN3.js} +12 -11
  62. package/{docDeleteCommands-A5QIHZNF.js → docDeleteCommands-F7ZVGEHW.js} +13 -12
  63. package/{docReadCommands-CF2LTMYH.js → docReadCommands-JY2E5XEN.js} +12 -11
  64. package/{docStore-6O7NYL6A.js → docStore-OKKIKLT3.js} +1 -1
  65. package/{docUpdateCommands-QRKV4ZXE.js → docUpdateCommands-OZ4CUSIQ.js} +12 -11
  66. package/{handleSendMessageAction-7IHLR37A.js → handleSendMessageAction-LNT7SZND.js} +12 -11
  67. package/{hostCredentialCreate-VNCQUAFT.js → hostCredentialCreate-XUU2CSHI.js} +24 -22
  68. package/index.js +3 -3
  69. package/{localRuntimeAdapter-FOWVNMIK.js → localRuntimeAdapter-IBSTMSX7.js} +23 -21
  70. package/{machineCommands-ZGC3J4JB.js → machineCommands-HSQHDHOT.js} +41 -24
  71. package/{machineWsRunDispatch-KK5U4M3G.js → machineWsRunDispatch-L6H7J66T.js} +24 -22
  72. package/package.json +1 -1
  73. package/{projectArchive-7ZDYBXAX.js → projectArchive-FQO654Z3.js} +4 -4
  74. package/{readlineWorkspace-YHT4SX2C.js → readlineWorkspace-7U272DSA.js} +36 -33
  75. package/{runAgentClientLoop-H4ED5V3K.js → runAgentClientLoop-AF4JQIJ7.js} +16 -14
  76. package/{skillDiscovery-I37M5KJC.js → skillDiscovery-BHHPCUHZ.js} +3 -3
  77. package/{spaceCommands-MEH3HJBC.js → spaceCommands-5VNWMDBE.js} +12 -11
  78. package/{streamAgentChatTurn-ZXPOXU33.js → streamAgentChatTurn-YSPEFY4K.js} +24 -21
  79. package/{tools-2MRWA2PP.js → tools-M35PTIFB.js} +11 -9
  80. package/{updateDialogTitleAction-RZ3KZSGQ.js → updateDialogTitleAction-IMIRJRQQ.js} +3 -3
  81. package/chunk-2WZXXAQD.js +0 -57
@@ -2,7 +2,7 @@ import {
2
2
  DEVIN_CONNECT_URL,
3
3
  parseSseDataLineJson,
4
4
  parseSseDataLineObject
5
- } from "./chunk-2NPD3FTX.js";
5
+ } from "./chunk-U2HBB7RS.js";
6
6
  import {
7
7
  EXECUTION_BACKEND_KINDS
8
8
  } from "./chunk-PWTNI4N7.js";
@@ -30,15 +30,10 @@ import {
30
30
  evaluateRequestBudget,
31
31
  hasImageInRuntimeMessages,
32
32
  stripImagePartsFromMessages
33
- } from "./chunk-GUXZK7SE.js";
33
+ } from "./chunk-XAG3FWBE.js";
34
34
  import {
35
35
  resolveToolExecutionContract
36
36
  } from "./chunk-LKA64WH4.js";
37
- import {
38
- clipToolText,
39
- resolveHistoricalToolContentCap,
40
- resolveToolOutputProfile
41
- } from "./chunk-2WZXXAQD.js";
42
37
  import {
43
38
  resolveAgentImageInputSupport,
44
39
  resolveToolImagePolicy
@@ -79,7 +74,7 @@ import {
79
74
  hashStablePrefixContent,
80
75
  resolveResponseGuidelines,
81
76
  resolveToolGuidedSections
82
- } from "./chunk-AGYPUBFW.js";
77
+ } from "./chunk-FPBJM2BW.js";
83
78
  import {
84
79
  classifyUnparsableToolArgs,
85
80
  collectStablePromptPrefix,
@@ -131,13 +126,27 @@ import {
131
126
  parseNoloWorkspaceToolArguments,
132
127
  readTextStreamUpToChars,
133
128
  resolveNoloDialogInput
134
- } from "./chunk-RYOLWYBK.js";
129
+ } from "./chunk-MNEZUL5S.js";
135
130
  import {
136
131
  applyToolSurfaceConstraints
137
132
  } from "./chunk-VS276URX.js";
138
133
  import {
139
134
  isQuotaExhaustedError
140
135
  } from "./chunk-TLE77UJ5.js";
136
+ import {
137
+ PROJECT_INSTRUCTION_MAX_BYTES,
138
+ PROJECT_INSTRUCTION_MAX_CHARS,
139
+ SECRET_PATTERNS,
140
+ clipToolText,
141
+ hasPotentialSecrets,
142
+ isCompleteInstructionOutput,
143
+ resolveHistoricalToolContentCap,
144
+ resolveToolOutputProfile,
145
+ sanitizeToolOutputContent,
146
+ sanitizeToolOutputText,
147
+ scrubObjectSecrets,
148
+ scrubSecrets
149
+ } from "./chunk-WFGNWWJI.js";
141
150
  import {
142
151
  isAgentSkillDisabled
143
152
  } from "./chunk-FJSNBZXR.js";
@@ -251,11 +260,13 @@ import {
251
260
  asOptionalPositiveFiniteNumber
252
261
  } from "./chunk-U6VC4MU4.js";
253
262
  import {
263
+ buildAgentsMdLayer,
264
+ buildAgentsMdLayerHeader,
254
265
  buildDialogSummaryLayer
255
- } from "./chunk-3P54D2E4.js";
266
+ } from "./chunk-42OKN2LI.js";
256
267
  import {
257
268
  buildUserResponseLanguageContext
258
- } from "./chunk-BNMPUQW6.js";
269
+ } from "./chunk-JQZRSXS5.js";
259
270
  import {
260
271
  buildProviderAuthHeaders,
261
272
  buildProviderExecutionPlan
@@ -5582,8 +5593,8 @@ var runPromiseExitWith = (context3) => {
5582
5593
  const runFork3 = runForkWith(context3);
5583
5594
  return (effect, options) => {
5584
5595
  const fiber3 = runFork3(effect, options);
5585
- return new Promise((resolve6) => {
5586
- fiber3.addObserver((exit3) => resolve6(exit3));
5596
+ return new Promise((resolve7) => {
5597
+ fiber3.addObserver((exit3) => resolve7(exit3));
5587
5598
  });
5588
5599
  };
5589
5600
  };
@@ -12806,8 +12817,8 @@ var toReadableStreamWith = /* @__PURE__ */ dual((args2) => isStream(args2[0]), (
12806
12817
  }
12807
12818
  },
12808
12819
  pull() {
12809
- return new Promise((resolve6) => {
12810
- currentResolve = resolve6;
12820
+ return new Promise((resolve7) => {
12821
+ currentResolve = resolve7;
12811
12822
  latch.openUnsafe();
12812
12823
  });
12813
12824
  },
@@ -13341,255 +13352,6 @@ function sanitizeToolCallPairing(messages) {
13341
13352
  return output;
13342
13353
  }
13343
13354
 
13344
- // packages/agent-runtime/secretScrubber.ts
13345
- var SECRET_PATTERNS = [
13346
- // 1. PEM 私钥块(高危硬拦截)
13347
- {
13348
- kind: "PRIVATE_KEY",
13349
- placeholder: "[REDACTED:PRIVATE_KEY]",
13350
- regex: /-----BEGIN (?:[A-Z0-9 ]+)?PRIVATE KEY-----[\s\S]+?-----END (?:[A-Z0-9 ]+)?PRIVATE KEY-----/g
13351
- },
13352
- // 2. Anthropic API Key (sk-ant-...)
13353
- {
13354
- kind: "ANTHROPIC_KEY",
13355
- placeholder: "[REDACTED:ANTHROPIC_KEY]",
13356
- regex: /\bsk-ant-[a-zA-Z0-9_\-]{20,}\b/g
13357
- },
13358
- // 3. OpenAI / DeepSeek / 通用 API Key (sk-...)
13359
- {
13360
- kind: "API_KEY",
13361
- placeholder: "[REDACTED:API_KEY]",
13362
- regex: /\bsk-[a-zA-Z0-9_\-]{24,}\b/g
13363
- },
13364
- // 3b. BigModel / 智谱(GLM)API Key:32 位 hex + "." + 16 位字母数字
13365
- // (2026-11 实证:这类 key 没有任何可辨识前缀,此前漏在清洗与入路隔离之外,
13366
- // 用户贴进对话后明文直接进了 prompt / 历史 / 工具日志。)
13367
- {
13368
- kind: "BIGMODEL_KEY",
13369
- placeholder: "[REDACTED:BIGMODEL_KEY]",
13370
- regex: /\b[0-9a-fA-F]{32}\.[A-Za-z0-9]{16}\b/g
13371
- },
13372
- // 4. GitHub 访问令牌 (ghp_..., gho_..., github_pat_...)
13373
- {
13374
- kind: "GITHUB_TOKEN",
13375
- placeholder: "[REDACTED:GITHUB_TOKEN]",
13376
- regex: /\b(?:gh[pousr]_[a-zA-Z0-9]{30,}|github_pat_[a-zA-Z0-9_]{40,})\b/g
13377
- },
13378
- // 5. Bearer Token (JWT / Authorization Bearer)
13379
- {
13380
- kind: "BEARER_TOKEN",
13381
- placeholder: "Bearer [REDACTED:BEARER_TOKEN]",
13382
- regex: /\bBearer\s+[a-zA-Z0-9_\-\.]{25,}\b/gi
13383
- },
13384
- // 6. 常见环境变量或配置中的密码赋值 (PASSWORD=..., PASSWD=...)
13385
- {
13386
- kind: "PASSWORD",
13387
- placeholder: "$1=[REDACTED:PASSWORD]",
13388
- regex: /\b((?:DB_|DATABASE_|ADMIN_|ROOT_|MYSQL_|POSTGRES_)?(?:PASSWORD|PASSWD|SECRET_KEY))\s*=\s*['"]?([^\s'"]{4,})['"]?/gi
13389
- }
13390
- ];
13391
- var QUICK_PROBE_SUBSTRINGS = [
13392
- "sk-",
13393
- "ghp_",
13394
- "gho_",
13395
- "ghu_",
13396
- "ghs_",
13397
- "ghr_",
13398
- "github_pat_",
13399
- "PRIVATE KEY",
13400
- "Bearer ",
13401
- "bearer ",
13402
- "PASSWORD",
13403
- "password",
13404
- "PASSWD",
13405
- "SECRET_KEY"
13406
- ];
13407
- var UNPREFIXED_PROBE_REGEX = /\b[0-9a-fA-F]{32}\.[A-Za-z0-9]{16}\b/;
13408
- function hasPotentialSecrets(text2) {
13409
- if (typeof text2 !== "string" || text2.length === 0) return false;
13410
- if (QUICK_PROBE_SUBSTRINGS.some((probe) => text2.includes(probe))) return true;
13411
- return UNPREFIXED_PROBE_REGEX.test(text2);
13412
- }
13413
- function scrubSecrets(text2) {
13414
- if (typeof text2 !== "string" || text2.length === 0) {
13415
- return { cleaned: text2, redactedCount: 0, matchedKinds: [] };
13416
- }
13417
- if (!hasPotentialSecrets(text2)) {
13418
- return { cleaned: text2, redactedCount: 0, matchedKinds: [] };
13419
- }
13420
- let cleaned = text2;
13421
- let redactedCount = 0;
13422
- const matchedKinds = [];
13423
- for (const pattern of SECRET_PATTERNS) {
13424
- pattern.regex.lastIndex = 0;
13425
- const matches = cleaned.match(pattern.regex);
13426
- if (matches && matches.length > 0) {
13427
- redactedCount += matches.length;
13428
- if (!matchedKinds.includes(pattern.kind)) {
13429
- matchedKinds.push(pattern.kind);
13430
- }
13431
- cleaned = cleaned.replace(pattern.regex, pattern.placeholder);
13432
- }
13433
- }
13434
- return { cleaned, redactedCount, matchedKinds };
13435
- }
13436
- function scrubObjectSecrets(val) {
13437
- if (val === null || val === void 0) return val;
13438
- if (typeof val === "string") {
13439
- return scrubSecrets(val).cleaned;
13440
- }
13441
- if (Array.isArray(val)) {
13442
- return val.map((item) => scrubObjectSecrets(item));
13443
- }
13444
- if (typeof val === "object") {
13445
- if (val instanceof Date || val instanceof RegExp) return val;
13446
- const result4 = {};
13447
- for (const [k, v] of Object.entries(val)) {
13448
- result4[k] = scrubObjectSecrets(v);
13449
- }
13450
- return result4;
13451
- }
13452
- return val;
13453
- }
13454
-
13455
- // packages/agent-runtime/toolOutputSanitizer.ts
13456
- var SANITIZE_REPLACEMENT_CHAR = "\uFFFD";
13457
- var MAX_CONTROL_SEQUENCE_CHARS = 256;
13458
- var ESC = 27;
13459
- var BEL = 7;
13460
- var LINE_FEED = 10;
13461
- var TAB = 9;
13462
- var DEL = 127;
13463
- var C1_DCS = 144;
13464
- var C1_SOS = 152;
13465
- var C1_CSI = 155;
13466
- var C1_ST = 156;
13467
- var C1_OSC = 157;
13468
- var C1_PM = 158;
13469
- var C1_APC = 159;
13470
- var HIGH_SURROGATE_MIN = 55296;
13471
- var HIGH_SURROGATE_MAX = 56319;
13472
- var LOW_SURROGATE_MIN = 56320;
13473
- var LOW_SURROGATE_MAX = 57343;
13474
- var NEEDS_SANITIZE_RE = new RegExp("[\\u0000-\\u0008\\u000b-\\u001f\\u007f-\\u009f]|\\p{Cs}", "u");
13475
- function isC1Introducer(code) {
13476
- return code === C1_CSI || code === C1_OSC || code === C1_DCS || code === C1_SOS || code === C1_PM || code === C1_APC;
13477
- }
13478
- var UNTERMINATED_SEQUENCE = -1;
13479
- function skipCsiBody(text2, start, limit) {
13480
- let i = start;
13481
- while (i < limit) {
13482
- const code = text2.charCodeAt(i);
13483
- if (code >= 64 && code <= 126) return i + 1;
13484
- if (code >= 32 && code <= 63) {
13485
- i += 1;
13486
- continue;
13487
- }
13488
- return i;
13489
- }
13490
- return UNTERMINATED_SEQUENCE;
13491
- }
13492
- function skipControlStringBody(text2, start, limit) {
13493
- const length = text2.length;
13494
- let i = start;
13495
- while (i < limit) {
13496
- const code = text2.charCodeAt(i);
13497
- if (code === BEL || code === C1_ST) return i + 1;
13498
- if (code === ESC && i + 1 < length && text2.charCodeAt(i + 1) === 92) {
13499
- return Math.min(i + 2, limit);
13500
- }
13501
- i += 1;
13502
- }
13503
- return UNTERMINATED_SEQUENCE;
13504
- }
13505
- function skipEscapeSequence(text2, escIndex) {
13506
- const length = text2.length;
13507
- const limit = Math.min(length, escIndex + MAX_CONTROL_SEQUENCE_CHARS);
13508
- const leadIndex = escIndex + 1;
13509
- if (leadIndex >= length) return leadIndex;
13510
- const lead = text2.charCodeAt(leadIndex);
13511
- if (lead === 91) {
13512
- const csiEnd = skipCsiBody(text2, leadIndex + 1, limit);
13513
- return csiEnd === UNTERMINATED_SEQUENCE ? escIndex + 1 : csiEnd;
13514
- }
13515
- if (lead === 93 || lead === 80 || lead === 88 || lead === 94 || lead === 95) {
13516
- const stringEnd = skipControlStringBody(text2, leadIndex + 1, limit);
13517
- return stringEnd === UNTERMINATED_SEQUENCE ? escIndex + 1 : stringEnd;
13518
- }
13519
- let j = leadIndex;
13520
- while (j < limit && text2.charCodeAt(j) >= 32 && text2.charCodeAt(j) <= 47) {
13521
- j += 1;
13522
- }
13523
- if (j < limit) {
13524
- const final = text2.charCodeAt(j);
13525
- if (final >= 48 && final <= 126) return j + 1;
13526
- }
13527
- return escIndex + 1;
13528
- }
13529
- function skipC1Sequence(text2, index) {
13530
- const limit = Math.min(text2.length, index + MAX_CONTROL_SEQUENCE_CHARS);
13531
- const code = text2.charCodeAt(index);
13532
- const bodyEnd = code === C1_CSI ? skipCsiBody(text2, index + 1, limit) : skipControlStringBody(text2, index + 1, limit);
13533
- return bodyEnd === UNTERMINATED_SEQUENCE ? index + 1 : bodyEnd;
13534
- }
13535
- function sanitizeToolOutputText(text2) {
13536
- if (typeof text2 !== "string" || text2.length === 0) return text2;
13537
- if (!NEEDS_SANITIZE_RE.test(text2)) return text2;
13538
- const out = [];
13539
- const length = text2.length;
13540
- let plainStart = 0;
13541
- let i = 0;
13542
- const dropRange = (end3) => {
13543
- if (plainStart < i) out.push(text2.slice(plainStart, i));
13544
- i = end3;
13545
- plainStart = end3;
13546
- };
13547
- while (i < length) {
13548
- const code = text2.charCodeAt(i);
13549
- if (code === LINE_FEED || code === TAB) {
13550
- i += 1;
13551
- continue;
13552
- }
13553
- if (code === ESC) {
13554
- dropRange(skipEscapeSequence(text2, i));
13555
- continue;
13556
- }
13557
- if (isC1Introducer(code)) {
13558
- dropRange(skipC1Sequence(text2, i));
13559
- continue;
13560
- }
13561
- if (code < 32 || code === DEL || code >= 128 && code <= 159) {
13562
- dropRange(i + 1);
13563
- continue;
13564
- }
13565
- if (code >= HIGH_SURROGATE_MIN && code <= HIGH_SURROGATE_MAX) {
13566
- const low = text2.charCodeAt(i + 1);
13567
- if (low >= LOW_SURROGATE_MIN && low <= LOW_SURROGATE_MAX) {
13568
- i += 2;
13569
- continue;
13570
- }
13571
- if (plainStart < i) out.push(text2.slice(plainStart, i));
13572
- out.push(SANITIZE_REPLACEMENT_CHAR);
13573
- i += 1;
13574
- plainStart = i;
13575
- continue;
13576
- }
13577
- if (code >= LOW_SURROGATE_MIN && code <= LOW_SURROGATE_MAX) {
13578
- if (plainStart < i) out.push(text2.slice(plainStart, i));
13579
- out.push(SANITIZE_REPLACEMENT_CHAR);
13580
- i += 1;
13581
- plainStart = i;
13582
- continue;
13583
- }
13584
- i += 1;
13585
- }
13586
- if (plainStart < length) out.push(text2.slice(plainStart));
13587
- return out.join("");
13588
- }
13589
- function sanitizeToolOutputContent(content) {
13590
- return typeof content === "string" ? sanitizeToolOutputText(content) : content;
13591
- }
13592
-
13593
13355
  // packages/agent-runtime/providerMessageProjection.ts
13594
13356
  var TOOL_DURATION_METADATA_KEY = "toolExecMs";
13595
13357
  var OBSERVATION_ONLY_METADATA_KEYS = /* @__PURE__ */ new Set([
@@ -13736,6 +13498,7 @@ function projectToolContentForProvider(args2) {
13736
13498
  const content = typeof rawContent === "string" ? sanitizeToolOutputText(rawContent) : rawContent;
13737
13499
  if (typeof content !== "string") return content;
13738
13500
  if (isSpilledToolOutput(content)) return content;
13501
+ if (isCompleteInstructionOutput(args2.toolName, args2.metadata, content)) return content;
13739
13502
  const metadataText = compactToolMetadata(args2.metadata);
13740
13503
  const embeddedMetadataIndex = metadataText ? content.indexOf("\n\n[tool metadata]\n") : -1;
13741
13504
  const contentForProjection = embeddedMetadataIndex >= 0 ? content.slice(0, embeddedMetadataIndex) : content;
@@ -15067,12 +14830,255 @@ async function invokeCapability(capabilityOrName, input, ctx = {}) {
15067
14830
  }
15068
14831
 
15069
14832
  // packages/agent-runtime/localWorkspaceTools.ts
15070
- import { existsSync as existsSync2 } from "node:fs";
14833
+ import { existsSync as existsSync3 } from "node:fs";
15071
14834
  import { createHash as createHash3 } from "node:crypto";
15072
14835
 
14836
+ // packages/agent-runtime/agentsMd.ts
14837
+ import { existsSync, readFileSync } from "node:fs";
14838
+ import { resolve } from "node:path";
14839
+ var AGENTS_MD_MAX_BYTES = 8192;
14840
+ var AGENTS_MD_MARKER_RESERVE_BYTES = 512;
14841
+ var AGENTS_MD_CANDIDATES = ["AGENTS.md", "CLAUDE.md"];
14842
+ function truncateAgentsMdContent(content, maxBytes = AGENTS_MD_MAX_BYTES) {
14843
+ const buf = Buffer.from(content, "utf8");
14844
+ if (buf.byteLength <= maxBytes) {
14845
+ return content;
14846
+ }
14847
+ let boundary = Math.min(maxBytes, buf.byteLength);
14848
+ while (boundary > 0 && boundary < buf.byteLength && (buf[boundary] & 192) === 128) {
14849
+ boundary--;
14850
+ }
14851
+ const boundarySlice = buf.subarray(0, boundary).toString("utf8");
14852
+ const slice = buf.subarray(0, maxBytes);
14853
+ const lastNewline = slice.lastIndexOf(10);
14854
+ if (lastNewline > 0) {
14855
+ const lineCandidate = slice.subarray(0, lastNewline).toString("utf8");
14856
+ const lineBytes = Buffer.byteLength(lineCandidate, "utf8");
14857
+ const boundaryBytes = Buffer.byteLength(boundarySlice, "utf8");
14858
+ if (lineCandidate.trim().length > 0 && lineBytes * 2 >= boundaryBytes) {
14859
+ return lineCandidate.replace(/\r$/, "");
14860
+ }
14861
+ }
14862
+ return boundarySlice.replace(/\r$/, "");
14863
+ }
14864
+ var AGENTS_MD_SUMMARY_MAX_BYTES = 3072;
14865
+ var AGENTS_MD_SUMMARY_ITEM_MAX_CHARS = 120;
14866
+ var AGENTS_MD_SUMMARY_PRIORITY_KEYWORDS = [
14867
+ "review",
14868
+ "\u8BC4\u5BA1",
14869
+ "commit",
14870
+ "\u63D0\u4EA4",
14871
+ "worktree",
14872
+ "\u6D4B\u8BD5",
14873
+ "typecheck",
14874
+ "\u7C7B\u578B\u68C0\u67E5",
14875
+ "push",
14876
+ "\u53D1\u5E03",
14877
+ "\u6587\u6863\u843D\u4F4D",
14878
+ "\u5220\u9664",
14879
+ "\u6D3E\u53D1"
14880
+ ];
14881
+ var AGENTS_MD_SUMMARY_POINTER_INSTRUCTION = "\u7528 readFile \u8BFB\u5168\u6587\uFF1A%REL%\uFF08cwd\uFF09/ %PATH%\n\u4EC5\u7D22\u5F15\uFF1A\u63D0\u4EA4/\u8BC4\u5BA1\u95E8\u7981\u3001worktree \u9694\u79BB\u3001\u6D4B\u8BD5/typecheck\u3001\u6587\u6863\u843D\u4F4D\u3001\u5220\u9664\u3001push/\u53D1\u5E03\u524D\uFF0C**\u5FC5\u987B\u5148 readFile \u8BFB\u5168\u6587\u518D\u6267\u884C**\u3002\n\u8DEF\u5F84\uFF1A%REL% \u76F8\u5BF9 cwd\uFF1Bmachine:<id>/\u6C99\u76D2\u6267\u884C\u9762 cwd \u7531\u5176\u51B3\u5B9A\uFF0C\u8BFB\u4E0D\u5230\u8BA9\u5BBF\u4E3B\u6CE8\u5165\u6216\u7528\u7EDD\u5BF9\u8DEF\u5F84\u3002";
14882
+ var AGENTS_MD_SUMMARY_DELETE_REFERENCE = "- \u5220\u9664/\u4E0D\u53EF\u9006\u64CD\u4F5C\uFF1A\u9075\u5B88\u7CFB\u7EDF\u63D0\u793A\u7684\u5220\u9664\u7EA2\u7EBF\uFF08\u5148\u5448\u73B0\u5B8C\u6574\u5F85\u5220\u6E05\u5355\u5E76\u83B7\u7528\u6237\u660E\u786E\u786E\u8BA4\uFF0C\u7981\u6B62\u5148\u5220\u540E\u62A5\u3001\u7981\u6B62\u6A21\u7CCA\u5B9A\u4F4D\uFF09\uFF0C\u4ED3\u5E93\u82E5\u6709\u9644\u52A0\u5220\u9664\u89C4\u5219\u89C1\u5B8C\u6574\u6587\u4EF6\u3002";
14883
+ var clipToChars = (text2, maxChars) => text2.length <= maxChars ? text2 : `${text2.slice(0, maxChars).trimEnd()}\u2026`;
14884
+ var parseAgentsMdItem = (body) => {
14885
+ const bold = /^\*\*(.+?)\*\*/.exec(body);
14886
+ if (bold) {
14887
+ return {
14888
+ label: bold[1].trim().replace(/[::]$/, ""),
14889
+ rest: body.slice(bold[0].length).replace(/^[::\s]+/, "")
14890
+ };
14891
+ }
14892
+ const firstClause = body.split(/[::]/)[0];
14893
+ return {
14894
+ label: clipToChars(firstClause.trim(), 40),
14895
+ rest: body.slice(firstClause.length).replace(/^[::\s]+/, "")
14896
+ };
14897
+ };
14898
+ var AGENTS_MD_COMMAND_TOKEN_PREFIX = /^(bunx?|npx|node|npm|pnpm|yarn|git|gh|tsc|deno)\b\s/;
14899
+ var extractAgentsMdCommandTokens = (body) => {
14900
+ const tokens = [];
14901
+ const seen = /* @__PURE__ */ new Set();
14902
+ for (const match7 of body.matchAll(/`([^`\n]+)`/g)) {
14903
+ const raw = match7[1];
14904
+ if (!AGENTS_MD_COMMAND_TOKEN_PREFIX.test(raw)) continue;
14905
+ if (seen.has(raw)) continue;
14906
+ seen.add(raw);
14907
+ tokens.push(raw);
14908
+ }
14909
+ return tokens;
14910
+ };
14911
+ var buildAgentsMdItemGist = (firstSentence, bulletBody) => {
14912
+ const max4 = AGENTS_MD_SUMMARY_ITEM_MAX_CHARS;
14913
+ const clipped = clipToChars(firstSentence, max4);
14914
+ const missing = extractAgentsMdCommandTokens(bulletBody).filter(
14915
+ (token) => !clipped.includes(token)
14916
+ );
14917
+ if (missing.length === 0) return clipped;
14918
+ let tail = "";
14919
+ for (const token of missing) {
14920
+ const candidate = tail ? `${tail} \`${token}\`` : `\`${token}\``;
14921
+ if (candidate.length > max4) continue;
14922
+ tail = candidate;
14923
+ }
14924
+ if (!tail) return clipped;
14925
+ const room = max4 - tail.length - 2;
14926
+ const head3 = room > 0 ? clipToChars(firstSentence, room) : "";
14927
+ return head3 ? `${head3} ${tail}` : tail;
14928
+ };
14929
+ var priorityOf = (label) => {
14930
+ const lowered = label.toLowerCase();
14931
+ for (let i = 0; i < AGENTS_MD_SUMMARY_PRIORITY_KEYWORDS.length; i += 1) {
14932
+ if (lowered.includes(AGENTS_MD_SUMMARY_PRIORITY_KEYWORDS[i].toLowerCase())) {
14933
+ return i;
14934
+ }
14935
+ }
14936
+ return -1;
14937
+ };
14938
+ var collectAgentsMdSummaryItems = (content) => {
14939
+ const items = [];
14940
+ const seen = /* @__PURE__ */ new Set();
14941
+ let section = null;
14942
+ for (const rawLine of content.split(/\r?\n/)) {
14943
+ const line = rawLine.trim();
14944
+ if (!line) continue;
14945
+ const heading = /^#{2,3}\s+(.+)$/.exec(line);
14946
+ if (heading) {
14947
+ section = heading[1].trim();
14948
+ continue;
14949
+ }
14950
+ if (line.startsWith("#") || line.startsWith("<") || line.startsWith("<!--")) {
14951
+ continue;
14952
+ }
14953
+ const bullet = /^[-*]\s+(.+)$/.exec(line);
14954
+ if (!bullet) continue;
14955
+ const { label, rest } = parseAgentsMdItem(bullet[1]);
14956
+ if (!label || seen.has(label)) continue;
14957
+ seen.add(label);
14958
+ const firstSentence = rest.split("\u3002")[0].trim();
14959
+ items.push({
14960
+ section,
14961
+ label,
14962
+ gist: buildAgentsMdItemGist(firstSentence, bullet[1]),
14963
+ priority: priorityOf(label)
14964
+ });
14965
+ }
14966
+ return items;
14967
+ };
14968
+ function buildAgentsMdSummaryBody(content, filePath, options = {}) {
14969
+ const budgetBytes = options.budgetBytes ?? AGENTS_MD_SUMMARY_MAX_BYTES;
14970
+ const items = collectAgentsMdSummaryItems(content);
14971
+ if (items.length === 0) return null;
14972
+ const relativePath = options.fileName ?? "AGENTS.md";
14973
+ const pointer = AGENTS_MD_SUMMARY_POINTER_INSTRUCTION.replaceAll(
14974
+ "%REL%",
14975
+ relativePath
14976
+ ).replaceAll("%PATH%", filePath);
14977
+ const head3 = `${pointer}
14978
+ ${AGENTS_MD_SUMMARY_DELETE_REFERENCE}
14979
+ `;
14980
+ if (Buffer.byteLength(head3, "utf8") > budgetBytes) return null;
14981
+ const candidates = [
14982
+ ...items.filter((item) => item.priority >= 0).sort((a, b) => a.priority - b.priority),
14983
+ ...items.filter((item) => item.priority < 0)
14984
+ ];
14985
+ const noteBlock = `
14986
+ \u2026\uFF08\u7D22\u5F15\u5DF2\u622A\u65AD\uFF0C\u5176\u4F59\u951A\u70B9\u89C1\u5B8C\u6574\u6587\u4EF6\uFF09`;
14987
+ const noteBytes = Buffer.byteLength(noteBlock, "utf8");
14988
+ let used = Buffer.byteLength(head3, "utf8");
14989
+ const admitted = [];
14990
+ const seenSections = /* @__PURE__ */ new Set();
14991
+ let truncated = false;
14992
+ for (const item of candidates) {
14993
+ const line = item.gist ? `- ${item.label}\uFF1A${item.gist}` : `- ${item.label}`;
14994
+ const headingCost = item.section && !seenSections.has(item.section) ? Buffer.byteLength(`
14995
+ ## ${item.section}`, "utf8") : 0;
14996
+ const cost = headingCost + Buffer.byteLength(`
14997
+ ${line}`, "utf8");
14998
+ if (used + cost + noteBytes > budgetBytes) {
14999
+ truncated = true;
15000
+ continue;
15001
+ }
15002
+ used += cost;
15003
+ if (item.section) seenSections.add(item.section);
15004
+ admitted.push(item);
15005
+ }
15006
+ const groupOrder = [];
15007
+ for (const item of admitted) {
15008
+ if (!groupOrder.includes(item.section)) groupOrder.push(item.section);
15009
+ }
15010
+ const frozen = [];
15011
+ for (const section of groupOrder) {
15012
+ for (const item of admitted) {
15013
+ if (item.section !== section) continue;
15014
+ frozen.push({
15015
+ section,
15016
+ line: item.gist ? `- ${item.label}\uFF1A${item.gist}` : `- ${item.label}`
15017
+ });
15018
+ }
15019
+ }
15020
+ if (admitted.length === 0) return null;
15021
+ return `${head3}${renderSummarySections(frozen)}${truncated ? noteBlock : ""}`;
15022
+ }
15023
+ var renderSummarySections = (entries) => {
15024
+ let rendered = "";
15025
+ let currentSection = null;
15026
+ for (const entry of entries) {
15027
+ if (entry.section && entry.section !== currentSection) {
15028
+ rendered += `
15029
+ ## ${entry.section}`;
15030
+ currentSection = entry.section;
15031
+ }
15032
+ rendered += `
15033
+ ${entry.line}`;
15034
+ }
15035
+ return rendered;
15036
+ };
15037
+ function readAgentsMdLayerFromDisk(cwd) {
15038
+ for (const name of AGENTS_MD_CANDIDATES) {
15039
+ const filePath = resolve(cwd, name);
15040
+ if (!existsSync(filePath)) continue;
15041
+ try {
15042
+ const raw = readFileSync(filePath, "utf8");
15043
+ const content = raw.trim();
15044
+ if (!content) continue;
15045
+ const totalBytes = Buffer.byteLength(raw, "utf8");
15046
+ const trimmedBytes = Buffer.byteLength(content, "utf8");
15047
+ const headerBytes = Buffer.byteLength(buildAgentsMdLayerHeader(name), "utf8");
15048
+ if (headerBytes + trimmedBytes <= AGENTS_MD_MAX_BYTES) {
15049
+ return buildAgentsMdLayer(content, name);
15050
+ }
15051
+ const summaryBody = buildAgentsMdSummaryBody(content, filePath, {
15052
+ // 正文预算 = 摘要上限 − 块头部:buildAgentsMdLayer 会再拼一次头部,
15053
+ // 因此「头部 + 正文」才等于最终注入字节,不得超过摘要上限。
15054
+ budgetBytes: AGENTS_MD_SUMMARY_MAX_BYTES - headerBytes,
15055
+ fileName: name
15056
+ });
15057
+ if (summaryBody) return buildAgentsMdLayer(summaryBody, name);
15058
+ const buildMarker = (omitted2, withPath) => {
15059
+ const pathPart = withPath ? `\u5B8C\u6574\u6587\u4EF6\uFF1A${filePath}` : `\u5B8C\u6574\u6587\u4EF6\uFF1A\u5DE5\u4F5C\u533A\u6839\u76EE\u5F55\u7684 ${name}`;
15060
+ return `<!-- AGENTS.md truncated: \u539F\u6587\u4EF6 ${totalBytes} \u5B57\u8282\uFF0C\u6CE8\u5165\u9884\u7B97 ${AGENTS_MD_MAX_BYTES} \u5B57\u8282\uFF0C\u5DF2\u7701\u7565 ${omitted2} \u5B57\u8282\uFF08\u4E0A\u6587\u53EF\u80FD\u7F3A\u5C11\u6587\u4EF6\u672B\u5C3E\u7684 commit/review \u95E8\u7981\u7EC6\u5219\uFF0C\u63D0\u4EA4/\u8BC4\u5BA1\u524D\u8BF7\u8BFB\u5B8C\u6574\u6587\u4EF6\uFF09\u3002${pathPart} -->`;
15061
+ };
15062
+ const bodyBudget = AGENTS_MD_MAX_BYTES - AGENTS_MD_MARKER_RESERVE_BYTES - 2 - headerBytes;
15063
+ const body = truncateAgentsMdContent(content, bodyBudget);
15064
+ const bodyBytes = Buffer.byteLength(body, "utf8");
15065
+ const omitted = Math.max(0, totalBytes - bodyBytes);
15066
+ let marker = buildMarker(omitted, true);
15067
+ if (Buffer.byteLength(marker, "utf8") > AGENTS_MD_MARKER_RESERVE_BYTES) {
15068
+ marker = buildMarker(omitted, false);
15069
+ }
15070
+ return buildAgentsMdLayer(`${body}
15071
+
15072
+ ${marker}`, name);
15073
+ } catch {
15074
+ }
15075
+ }
15076
+ return null;
15077
+ }
15078
+
15073
15079
  // packages/agent-runtime/visualRenderer.node.ts
15074
15080
  import { createRequire } from "node:module";
15075
- import { existsSync } from "node:fs";
15081
+ import { existsSync as existsSync2 } from "node:fs";
15076
15082
  import { realpath, stat, readFile } from "node:fs/promises";
15077
15083
  import { isAbsolute, relative, win32 } from "node:path";
15078
15084
  import { fileURLToPath, pathToFileURL } from "node:url";
@@ -15125,7 +15131,7 @@ var VisualRenderSemaphore = class {
15125
15131
  active = 0;
15126
15132
  queue = [];
15127
15133
  async run(task) {
15128
- if (this.active >= this.limit) await new Promise((resolve6) => this.queue.push(resolve6));
15134
+ if (this.active >= this.limit) await new Promise((resolve7) => this.queue.push(resolve7));
15129
15135
  else this.active++;
15130
15136
  try {
15131
15137
  return await task();
@@ -15143,7 +15149,7 @@ function visualRendererCapability() {
15143
15149
  if (process.env.NOLO_VISUAL_RENDERER_DISABLED === "1") return { available: false, reasonCode: "disabled", reason: "Platform renderer disabled by NOLO_VISUAL_RENDERER_DISABLED=1 on this runtime host." };
15144
15150
  try {
15145
15151
  const { chromium } = require2("playwright");
15146
- const executablePath = [chromium.executablePath(), resolveExecutableOnPath("google-chrome"), resolveExecutableOnPath("chromium"), resolveExecutableOnPath("chromium-browser")].find((path) => !!path && existsSync(path));
15152
+ const executablePath = [chromium.executablePath(), resolveExecutableOnPath("google-chrome"), resolveExecutableOnPath("chromium"), resolveExecutableOnPath("chromium-browser")].find((path) => !!path && existsSync2(path));
15147
15153
  if (!executablePath) return { available: false, reasonCode: "missing-browser", reason: "No Chromium renderer installed. Install Playwright Chromium (playwright install chromium) or system Chromium/Google Chrome on the runtime host." };
15148
15154
  return { available: true, chromium, executablePath };
15149
15155
  } catch {
@@ -15319,7 +15325,7 @@ finally:
15319
15325
  pass
15320
15326
  bus.signal_unsubscribe(subscription)
15321
15327
  `;
15322
- var capturePortalScreenshot = (signal) => new Promise((resolve6, reject) => {
15328
+ var capturePortalScreenshot = (signal) => new Promise((resolve7, reject) => {
15323
15329
  const child = spawn("/usr/bin/python3", ["-c", PORTAL_SCRIPT], { stdio: ["ignore", "pipe", "pipe"] });
15324
15330
  let stdout = "";
15325
15331
  let stderr = "";
@@ -15340,7 +15346,7 @@ var capturePortalScreenshot = (signal) => new Promise((resolve6, reject) => {
15340
15346
  if (signal.aborted) return reject(new Error("portal capture timeout"));
15341
15347
  if (code !== 0) return reject(new Error(stderr.trim() || `portal helper exited ${code}`));
15342
15348
  try {
15343
- resolve6(JSON.parse(stdout));
15349
+ resolve7(JSON.parse(stdout));
15344
15350
  } catch {
15345
15351
  reject(new Error("invalid portal response"));
15346
15352
  }
@@ -15352,7 +15358,7 @@ function createHostWindowCapture(options = {}) {
15352
15358
  let active = 0;
15353
15359
  const waiters = [];
15354
15360
  function acquire(signal) {
15355
- return new Promise((resolve6, reject) => {
15361
+ return new Promise((resolve7, reject) => {
15356
15362
  const abort = () => {
15357
15363
  const index = waiters.indexOf(start);
15358
15364
  if (index >= 0) waiters.splice(index, 1);
@@ -15361,7 +15367,7 @@ function createHostWindowCapture(options = {}) {
15361
15367
  const start = () => {
15362
15368
  signal.removeEventListener("abort", abort);
15363
15369
  active++;
15364
- resolve6();
15370
+ resolve7();
15365
15371
  };
15366
15372
  if (signal.aborted) return abort();
15367
15373
  if (active < concurrency) start();
@@ -15419,7 +15425,7 @@ var captureHostWindow = createHostWindowCapture();
15419
15425
  // packages/agent-runtime/localWorkspaceTools.ts
15420
15426
  import { lstat as lstat2, readdir as readdir2, readFile as readFile4, realpath as realpath3, stat as stat4 } from "node:fs/promises";
15421
15427
  import { homedir } from "node:os";
15422
- import { dirname as dirname2, relative as relative4, resolve as resolve4, sep as sep2 } from "node:path";
15428
+ import { dirname as dirname2, relative as relative4, resolve as resolve5, sep as sep2 } from "node:path";
15423
15429
  import { spawn as spawnChildProcess2 } from "node:child_process";
15424
15430
 
15425
15431
  // packages/agent-runtime/runResultReadProjection.ts
@@ -15502,12 +15508,12 @@ function isLineRangeCovered(request3, covered) {
15502
15508
 
15503
15509
  // packages/agent-runtime/fileTextSearch.ts
15504
15510
  import { readdir, readFile as readFile3, stat as stat3 } from "node:fs/promises";
15505
- import { basename as basename2, relative as relative2, resolve as resolve2 } from "node:path";
15511
+ import { basename as basename2, relative as relative2, resolve as resolve3 } from "node:path";
15506
15512
  import { spawn as spawnChildProcess } from "node:child_process";
15507
15513
 
15508
15514
  // packages/agent-runtime/gitignore.ts
15509
15515
  import { readFile as readFile2, stat as stat2 } from "node:fs/promises";
15510
- import { resolve } from "node:path";
15516
+ import { resolve as resolve2 } from "node:path";
15511
15517
  function isIgnorableFsError(err) {
15512
15518
  if (err && typeof err === "object" && "code" in err) {
15513
15519
  const code = err.code;
@@ -15518,7 +15524,7 @@ function isIgnorableFsError(err) {
15518
15524
  async function readRootGitignorePatterns(workspaceRoot) {
15519
15525
  let content;
15520
15526
  try {
15521
- content = await readFile2(resolve(workspaceRoot, ".gitignore"), "utf8");
15527
+ content = await readFile2(resolve2(workspaceRoot, ".gitignore"), "utf8");
15522
15528
  } catch (err) {
15523
15529
  if (isIgnorableFsError(err)) return [];
15524
15530
  throw err;
@@ -15532,7 +15538,7 @@ async function readRootGitignorePatterns(workspaceRoot) {
15532
15538
  }
15533
15539
  async function hasRootGitignore(workspaceRoot) {
15534
15540
  try {
15535
- await stat2(resolve(workspaceRoot, ".gitignore"));
15541
+ await stat2(resolve2(workspaceRoot, ".gitignore"));
15536
15542
  return true;
15537
15543
  } catch (err) {
15538
15544
  if (isIgnorableFsError(err)) return false;
@@ -15603,7 +15609,7 @@ function parseMatches(root, output) {
15603
15609
  const records = [];
15604
15610
  const pattern = /(?:^|\n)([^\0\n]+)\0(\d+):(.*?)(?=\n[^\0\n]+\0|$)/gs;
15605
15611
  for (const match7 of output.matchAll(pattern)) {
15606
- records.push({ file: resolve2(root, match7[1] ?? ""), line: Number(match7[2]), text: (match7[3] ?? "").replace(/\n$/, "") });
15612
+ records.push({ file: resolve3(root, match7[1] ?? ""), line: Number(match7[2]), text: (match7[3] ?? "").replace(/\n$/, "") });
15607
15613
  }
15608
15614
  return records;
15609
15615
  }
@@ -15661,7 +15667,7 @@ async function jsSearch(o, targetPath) {
15661
15667
  } else {
15662
15668
  const walk = async (dir) => {
15663
15669
  for (const e of await readdir(dir, { withFileTypes: true })) {
15664
- const f = resolve2(dir, e.name), rel = pathFor(o.root, f);
15670
+ const f = resolve3(dir, e.name), rel = pathFor(o.root, f);
15665
15671
  if (e.isDirectory()) {
15666
15672
  if (!excludes.some((p) => globMatch(p, rel))) await walk(f);
15667
15673
  } else if (e.isFile() && !excludes.some((p) => globMatch(p, rel)) && !isIgnored(rel) && (!o.include || globMatch(o.include, rel))) {
@@ -15710,7 +15716,7 @@ var COMMAND_ENGINES = [
15710
15716
  { engine: "grep", binaryOption: "resolveGrepBinary", binaryName: "grep", argsKey: "grep" }
15711
15717
  ];
15712
15718
  async function searchFileTextMatches(o) {
15713
- const targetPath = resolve2(o.root, o.target || ".");
15719
+ const targetPath = resolve3(o.root, o.target || ".");
15714
15720
  const targetStat = await stat3(targetPath).catch(() => null);
15715
15721
  if (!targetStat) return { matches: [], totalMatches: 0, truncated: false, engine: "js" };
15716
15722
  if (targetStat.isFile()) return jsSearch(o, targetPath);
@@ -15779,7 +15785,7 @@ function resolveCleanupReport(evidence, previousStatus) {
15779
15785
  }
15780
15786
  var TERMINAL_EVENT_TYPES = /* @__PURE__ */ new Set(["exited", "killed"]);
15781
15787
  function defaultSleep(ms) {
15782
- return new Promise((resolve6) => setTimeout(resolve6, ms));
15788
+ return new Promise((resolve7) => setTimeout(resolve7, ms));
15783
15789
  }
15784
15790
  function defaultSignalSender(pid, signal) {
15785
15791
  process.kill(pid, signal);
@@ -16070,14 +16076,20 @@ function buildReadWorkspaceParameters() {
16070
16076
  type: "object",
16071
16077
  properties: {
16072
16078
  path,
16079
+ files: {
16080
+ type: "array",
16081
+ minItems: 1,
16082
+ maxItems: 8,
16083
+ description: "Batch of files with optional individual line ranges; mutually exclusive with path. One shared output budget applies.",
16084
+ items: { type: "object", properties: { path, lines, force }, required: ["path"], additionalProperties: false }
16085
+ },
16073
16086
  lines,
16074
16087
  force,
16075
16088
  raw: {
16076
16089
  type: "boolean",
16077
16090
  description: "Read original bytes including full runtime acceptance observations in *.result.md. Default compacts only machine observations; report text and physical line numbers are unchanged."
16078
16091
  }
16079
- },
16080
- required: ["path"]
16092
+ }
16081
16093
  };
16082
16094
  }
16083
16095
  function buildReadWorkspaceFileTool() {
@@ -16400,9 +16412,9 @@ function filterDeclaredWorkspaceToolNames(args2) {
16400
16412
  // packages/agent-runtime/workspacePathGuard.ts
16401
16413
  import { constants as fsConstants } from "node:fs";
16402
16414
  import { lstat, mkdir, open, readlink, realpath as realpath2 } from "node:fs/promises";
16403
- import { basename as basename3, dirname, isAbsolute as isAbsolute2, join as join2, relative as relative3, resolve as resolve3, sep } from "node:path";
16415
+ import { basename as basename3, dirname, isAbsolute as isAbsolute2, join as join2, relative as relative3, resolve as resolve4, sep } from "node:path";
16404
16416
  function isPathInsideRoot(root, targetPath) {
16405
- const rel = relative3(resolve3(root), resolve3(targetPath));
16417
+ const rel = relative3(resolve4(root), resolve4(targetPath));
16406
16418
  return rel === "" || rel !== ".." && !rel.startsWith(`..${sep}`) && !isAbsolute2(rel);
16407
16419
  }
16408
16420
  function isNotFoundError(error) {
@@ -16411,7 +16423,7 @@ function isNotFoundError(error) {
16411
16423
  }
16412
16424
  async function realpathAllowMissing(targetPath) {
16413
16425
  const tail = [];
16414
- let current = resolve3(targetPath);
16426
+ let current = resolve4(targetPath);
16415
16427
  for (; ; ) {
16416
16428
  try {
16417
16429
  const real = await realpath2(current);
@@ -16430,8 +16442,8 @@ async function realpathAllowMissing(targetPath) {
16430
16442
  }
16431
16443
  async function resolveWorkspaceSafePath(args2) {
16432
16444
  const requested = args2.requestedPath ?? args2.targetPath;
16433
- const lexicalRoot = resolve3(args2.workspaceRoot);
16434
- const targetPath = resolve3(args2.targetPath);
16445
+ const lexicalRoot = resolve4(args2.workspaceRoot);
16446
+ const targetPath = resolve4(args2.targetPath);
16435
16447
  const lexicalInside = args2.lexicalInside ?? isPathInsideRoot(lexicalRoot, targetPath);
16436
16448
  const [physicalRoot, resolved] = await Promise.all([
16437
16449
  realpath2(lexicalRoot).catch(() => null),
@@ -16587,7 +16599,7 @@ async function openPinnedDirectory(dirPath, guard) {
16587
16599
  }
16588
16600
  async function createMissingDirectoryChain(guard) {
16589
16601
  const missing = [];
16590
- let existing = resolve3(guard.path);
16602
+ let existing = resolve4(guard.path);
16591
16603
  for (; ; ) {
16592
16604
  try {
16593
16605
  await lstat(existing);
@@ -17065,7 +17077,7 @@ function resolveRipgrepBinary(env = process.env) {
17065
17077
  const fromEnv = asOptionalTrimmedString(env.NOLO_BUNDLED_RG);
17066
17078
  if (fromEnv) {
17067
17079
  try {
17068
- if (existsSync2(fromEnv)) return fromEnv;
17080
+ if (existsSync3(fromEnv)) return fromEnv;
17069
17081
  } catch {
17070
17082
  }
17071
17083
  }
@@ -17086,14 +17098,14 @@ async function resolveRuntimeOwnedSpillPath(targetPath) {
17086
17098
  }
17087
17099
  function expandHomePath(requestedPath) {
17088
17100
  if (requestedPath === "~") return homedir();
17089
- if (requestedPath.startsWith("~/")) return resolve4(homedir(), requestedPath.slice(2));
17101
+ if (requestedPath.startsWith("~/")) return resolve5(homedir(), requestedPath.slice(2));
17090
17102
  return requestedPath;
17091
17103
  }
17092
17104
  function resolveRequestedWorkspacePath(workspaceRoot, requestedPath) {
17093
- return resolve4(resolve4(workspaceRoot), expandHomePath(requestedPath));
17105
+ return resolve5(resolve5(workspaceRoot), expandHomePath(requestedPath));
17094
17106
  }
17095
17107
  async function resolveLocalWorkspaceToolApproval(args2) {
17096
- const workspaceRoot = resolve4(args2.workspaceRoot);
17108
+ const workspaceRoot = resolve5(args2.workspaceRoot);
17097
17109
  const targetPath = resolveRequestedWorkspacePath(workspaceRoot, args2.requestedPath);
17098
17110
  const insideWorkspace = isPathInsideWorkspace({ workspaceRoot, targetPath });
17099
17111
  const guard = await resolveWorkspaceSafePath({
@@ -17190,6 +17202,53 @@ var READ_FILE_LEDGER_MAX_RECORDS = 64;
17190
17202
  var READ_FILE_LEDGER_MAX_KEYS = 256;
17191
17203
  async function readFileTool(args2) {
17192
17204
  const parsed = parseWorkspaceToolArguments(args2.call.arguments);
17205
+ if (parsed.files !== void 0 && !args2.batchItem) {
17206
+ if (!Array.isArray(parsed.files) || parsed.files.length < 1 || parsed.files.length > 8 || pickFirstAlias(parsed, PATH_FIELD_ALIASES) !== void 0) {
17207
+ return { content: "[readFile] Supply either path or files (1\u20138 items), not both.", metadata: { status: "invalid-arguments" } };
17208
+ }
17209
+ if (parsed.files.some((file) => !file || typeof file !== "object" || typeof file.path !== "string" || !file.path || file.path.length > 512 || file.lines !== void 0 && typeof file.lines !== "string")) {
17210
+ return { content: "[readFile] Each batch item requires a path (maximum 512 characters) and optional string lines.", metadata: { status: "invalid-arguments" } };
17211
+ }
17212
+ const items = parsed.files.map((item) => ({ path: item.path, status: "not-delivered" }));
17213
+ const budget = resolveHistoricalToolContentCap("readFile", 0);
17214
+ const batchStartLedger = args2.readLedger ? new Map([...args2.readLedger].map(([key, entry2]) => [key, { ...entry2, records: [...entry2.records] }])) : void 0;
17215
+ for (let i = 0; i < parsed.files.length; i++) {
17216
+ const file = parsed.files[i];
17217
+ if (!file || typeof file !== "object" || typeof file.path !== "string" || !file.path || file.lines !== void 0 && typeof file.lines !== "string") {
17218
+ items[i] = { ...items[i], status: "invalid-arguments" };
17219
+ continue;
17220
+ }
17221
+ const trialLedger = args2.readLedger ? new Map([...args2.readLedger].map(([key, entry2]) => [key, { ...entry2, records: [...entry2.records] }])) : void 0;
17222
+ try {
17223
+ const result4 = await readFileTool({ ...args2, batchItem: true, readLedger: trialLedger, call: { ...args2.call, arguments: JSON.stringify(file) } });
17224
+ const metadata2 = result4.metadata ?? {};
17225
+ const candidate = { path: file.path, status: metadata2.deduped ? "already-delivered" : metadata2.status === "invalid-arguments" ? "invalid-arguments" : metadata2.truncatedByCharLimit || metadata2.partialLine ? "partial" : "complete", content: result4.content, ...metadata2 };
17226
+ const previous = items[i];
17227
+ items[i] = candidate;
17228
+ const formatted = formatToolMessageContent({ toolName: "readFile", content: JSON.stringify(items), metadata: { batch: true, items: items.map(({ path, status, startLine, endLine }) => ({ path, status, startLine, endLine })) } });
17229
+ if (formatted.length > budget) {
17230
+ items[i] = previous;
17231
+ continue;
17232
+ }
17233
+ if (args2.readLedger && trialLedger) {
17234
+ args2.readLedger.clear();
17235
+ for (const [key, value] of trialLedger) args2.readLedger.set(key, value);
17236
+ }
17237
+ } catch {
17238
+ items[i] = { path: file.path, status: "error" };
17239
+ }
17240
+ }
17241
+ const batchContent = JSON.stringify(items);
17242
+ const batchMetadata = { batch: true, items: items.map(({ path, status, startLine, endLine }) => ({ path, status, startLine, endLine })) };
17243
+ if (formatToolMessageContent({ toolName: "readFile", content: batchContent, metadata: batchMetadata }).length > budget) {
17244
+ if (args2.readLedger && batchStartLedger) {
17245
+ args2.readLedger.clear();
17246
+ for (const [key, value] of batchStartLedger) args2.readLedger.set(key, value);
17247
+ }
17248
+ return { content: "[readFile] Batch request exceeds the shared delivery budget; no content delivered. Use fewer or shorter paths.", metadata: { status: "batch-limit-exceeded" } };
17249
+ }
17250
+ return { content: batchContent, metadata: batchMetadata };
17251
+ }
17193
17252
  const requestedPath = requireWorkspaceToolPath(parsed);
17194
17253
  const parsedSlice = readFileSliceArgs(parsed);
17195
17254
  if (parsedSlice.error) {
@@ -17216,13 +17275,24 @@ async function readFileTool(args2) {
17216
17275
  ...sliceArgs
17217
17276
  });
17218
17277
  const relativePath = normalizeWorkspaceRelativePath({
17219
- workspaceRoot: resolve4(args2.workspaceRoot),
17278
+ workspaceRoot: resolve5(args2.workspaceRoot),
17220
17279
  targetPath: absolutePath
17221
17280
  });
17222
- const cap = resolveHistoricalToolContentCap("readFile", 0);
17281
+ const instructionPath = AGENTS_MD_CANDIDATES.some((name) => absolutePath === resolve5(args2.workspaceRoot, name));
17282
+ const instructionLimit = PROJECT_INSTRUCTION_MAX_BYTES;
17283
+ const instructionOversized = Buffer.byteLength(content) > instructionLimit || countLines(content) > TOOL_OUTPUT_SPILL_LINES;
17284
+ const instruction = !args2.batchItem && instructionPath && !instructionOversized;
17285
+ if (!args2.batchItem && instructionPath && instructionOversized && Object.keys(sliceArgs).length === 0) {
17286
+ return {
17287
+ content: `[readFile] Project instruction exceeds the delivery limit (${instructionLimit} bytes or ${TOOL_OUTPUT_SPILL_LINES} lines); no content delivered. Continue with lines="1-" to inspect the first bounded range.`,
17288
+ metadata: { path: relativePath, status: "instruction-limit-exceeded", truncated: true, totalBytes: Buffer.byteLength(originalContent) }
17289
+ };
17290
+ }
17291
+ const cap = instruction ? PROJECT_INSTRUCTION_MAX_CHARS : resolveHistoricalToolContentCap("readFile", 0);
17223
17292
  const selectedLines = splitTextLines(sliced.content);
17224
17293
  const makeMetadata = (body, endLine, windowed2, partialLine) => ({
17225
17294
  path: relativePath,
17295
+ ...instruction ? { projectInstruction: true } : {},
17226
17296
  bytes: Buffer.byteLength(body),
17227
17297
  totalBytes: Buffer.byteLength(originalContent),
17228
17298
  ...projection.projected ? {
@@ -17234,6 +17304,7 @@ async function readFileTool(args2) {
17234
17304
  ...partialLine ? { partialLine: true } : { endLine },
17235
17305
  totalLines: sliced.totalLines,
17236
17306
  truncated: sliced.truncated || windowed2,
17307
+ ...scrubSecrets(sanitizeToolOutputText(body)).cleaned !== body ? { contentSanitized: true } : {},
17237
17308
  ...windowed2 ? { truncatedByByteLimit: true, truncatedByCharLimit: true } : {},
17238
17309
  ...sliceArgs.maxLines ? { maxLines: sliceArgs.maxLines } : {},
17239
17310
  ...sliceArgs.tailLines ? { tailLines: sliceArgs.tailLines } : {},
@@ -17286,7 +17357,7 @@ async function readFileTool(args2) {
17286
17357
  ledger?.delete(relativePath);
17287
17358
  }
17288
17359
  if (!force && entry && ledger && !oversizedLine) {
17289
- const retainedCap = resolveHistoricalToolContentCap("readFile", 0);
17360
+ const retainedCap = instructionPath && !instructionOversized ? PROJECT_INSTRUCTION_MAX_CHARS : resolveHistoricalToolContentCap("readFile", 0);
17290
17361
  const retained = filterRetainedLedgerRecords(entry.records, retainedCap);
17291
17362
  if (retained.length > 0 && isLineRangeCovered(deliveredRange, retained)) {
17292
17363
  ledger.delete(relativePath);
@@ -17345,7 +17416,7 @@ async function writeFileTool(args2) {
17345
17416
  await ensureGuardedParentDirectory({ workspaceRoot: args2.workspaceRoot, fileApproval: approval });
17346
17417
  await writeGuardApprovedFile(approval, content);
17347
17418
  const relativePath = normalizeWorkspaceRelativePath({
17348
- workspaceRoot: resolve4(args2.workspaceRoot),
17419
+ workspaceRoot: resolve5(args2.workspaceRoot),
17349
17420
  targetPath: absolutePath
17350
17421
  });
17351
17422
  const activity = extractActivity(parsed);
@@ -17468,7 +17539,7 @@ ${hint}` : "")
17468
17539
  }
17469
17540
  await writeGuardApprovedFile(approval, nextContent);
17470
17541
  const relativePath = normalizeWorkspaceRelativePath({
17471
- workspaceRoot: resolve4(args2.workspaceRoot),
17542
+ workspaceRoot: resolve5(args2.workspaceRoot),
17472
17543
  targetPath: absolutePath
17473
17544
  });
17474
17545
  const activity = extractActivity(parsed);
@@ -17508,7 +17579,7 @@ async function listWorkspaceEntries(args2) {
17508
17579
  const names = (await readdir2(dirPath)).sort((left, right) => left.localeCompare(right));
17509
17580
  for (const name of names) {
17510
17581
  if (truncated) break;
17511
- const absolutePath = resolve4(dirPath, name);
17582
+ const absolutePath = resolve5(dirPath, name);
17512
17583
  const info = await stat4(absolutePath);
17513
17584
  const relativePath = relative4(args2.dirPath, absolutePath) || ".";
17514
17585
  const isDirectory = info.isDirectory();
@@ -17537,7 +17608,7 @@ async function internalSearchWorkspace(args2) {
17537
17608
  allowRuntimeOwnedSpill: true,
17538
17609
  ...args2.confirmExternalFileAccess ? { confirmExternalFileAccess: args2.confirmExternalFileAccess } : {}
17539
17610
  });
17540
- const workspaceRoot = resolve4(args2.workspaceRoot);
17611
+ const workspaceRoot = resolve5(args2.workspaceRoot);
17541
17612
  const inside = isPathInsideWorkspace({ workspaceRoot, targetPath: searchPath });
17542
17613
  const result4 = await searchFileTextMatches({
17543
17614
  root: inside ? workspaceRoot : searchPath,
@@ -17617,7 +17688,7 @@ async function globFilesTool(args2) {
17617
17688
  ...args2.confirmExternalFileAccess ? { confirmExternalFileAccess: args2.confirmExternalFileAccess } : {}
17618
17689
  });
17619
17690
  const relativeSearchPath = normalizeWorkspaceRelativePath({
17620
- workspaceRoot: resolve4(args2.workspaceRoot),
17691
+ workspaceRoot: resolve5(args2.workspaceRoot),
17621
17692
  targetPath: searchPath
17622
17693
  });
17623
17694
  const pathPrefix = relativeSearchPath === "." ? "" : `${relativeSearchPath.replace(/\/+$/, "")}/`;
@@ -17914,7 +17985,7 @@ async function launchProcessTool(args2) {
17914
17985
  ];
17915
17986
  const detached = process.platform !== "win32";
17916
17987
  const proc = spawnChildProcess2(cmdArgs[0] ?? "", cmdArgs.slice(1), {
17917
- cwd: resolve4(args2.workspaceRoot),
17988
+ cwd: resolve5(args2.workspaceRoot),
17918
17989
  stdio: ["ignore", "pipe", "pipe"],
17919
17990
  detached,
17920
17991
  windowsHide: true
@@ -18238,12 +18309,12 @@ function createLocalWorkspaceToolExecutors(args2) {
18238
18309
  images: results2.flatMap((result4) => result4.images ?? [])
18239
18310
  };
18240
18311
  },
18241
- readFile: (call) => readFileTool({
18312
+ readFile: Object.assign((call) => readFileTool({
18242
18313
  call,
18243
18314
  workspaceRoot: args2.workspaceRoot,
18244
18315
  ...readFileLedger ? { readLedger: readFileLedger } : {},
18245
18316
  ...fileAccess
18246
- }),
18317
+ }), { resetReadLedger: () => readFileLedger?.clear() }),
18247
18318
  writeFile: (call) => writeFileTool({
18248
18319
  call,
18249
18320
  workspaceRoot: args2.workspaceRoot,
@@ -19815,7 +19886,7 @@ async function maybeAutoCompactLocalHistory(args2) {
19815
19886
  primaryElapsedMs = Date.now() - compactionT0;
19816
19887
  logCompactionTiming("provider-error", {});
19817
19888
  emitPhase({ kind: "compaction-retry", attempt: attempt + 1, maxAttempts });
19818
- await new Promise((resolve6, reject) => {
19889
+ await new Promise((resolve7, reject) => {
19819
19890
  const signal = requestController.signal;
19820
19891
  const cancel = () => {
19821
19892
  clearTimeout(timer);
@@ -19824,7 +19895,7 @@ async function maybeAutoCompactLocalHistory(args2) {
19824
19895
  };
19825
19896
  const timer = setTimeout(() => {
19826
19897
  signal.removeEventListener("abort", cancel);
19827
- resolve6();
19898
+ resolve7();
19828
19899
  }, delayMs);
19829
19900
  signal.addEventListener("abort", cancel, { once: true });
19830
19901
  if (signal.aborted) cancel();
@@ -19838,16 +19909,16 @@ async function maybeAutoCompactLocalHistory(args2) {
19838
19909
  (error) => ({ kind: "provider-error", error })
19839
19910
  );
19840
19911
  const guards = [];
19841
- if (timeoutMs) guards.push(new Promise((resolve6) => {
19912
+ if (timeoutMs) guards.push(new Promise((resolve7) => {
19842
19913
  timeoutHandle = setTimeout(() => {
19843
19914
  requestController.abort(new DOMException("Summary deadline exceeded", "TimeoutError"));
19844
- resolve6({ kind: "timeout" });
19915
+ resolve7({ kind: "timeout" });
19845
19916
  }, timeoutMs);
19846
19917
  }));
19847
- if (args2.abortSignal) guards.push(new Promise((resolve6) => {
19918
+ if (args2.abortSignal) guards.push(new Promise((resolve7) => {
19848
19919
  abortListener = () => {
19849
19920
  requestController.abort(args2.abortSignal?.reason);
19850
- resolve6({ kind: "aborted" });
19921
+ resolve7({ kind: "aborted" });
19851
19922
  };
19852
19923
  args2.abortSignal?.addEventListener("abort", abortListener, { once: true });
19853
19924
  if (args2.abortSignal?.aborted) abortListener();
@@ -20867,6 +20938,7 @@ async function runLocalAgentTurn(input) {
20867
20938
  },
20868
20939
  replaceWorkingView: (next) => {
20869
20940
  transcript.replaceWorkingHistory(next);
20941
+ input.adapter.onWorkingHistoryReplaced?.();
20870
20942
  summaryProjectedPhase = contextPhase("summary-projected", next);
20871
20943
  },
20872
20944
  contextReferenceResolver: input.adapter.host === "cli" ? input.contextReferenceResolver : void 0,
@@ -22594,12 +22666,12 @@ function rethrowBrokerError(op, _error) {
22594
22666
  }
22595
22667
  function createDefaultSecurityRunner(securityBin = DEFAULT_SECURITY_BIN) {
22596
22668
  return function defaultSecurityRunner(input) {
22597
- return new Promise((resolve6) => {
22669
+ return new Promise((resolve7) => {
22598
22670
  let settled = false;
22599
22671
  const finish = (result4) => {
22600
22672
  if (settled) return;
22601
22673
  settled = true;
22602
- resolve6(result4);
22674
+ resolve7(result4);
22603
22675
  };
22604
22676
  let child;
22605
22677
  try {
@@ -22926,12 +22998,12 @@ function parseGetSecretFromStdout(stdout) {
22926
22998
  return parsed.secret;
22927
22999
  }
22928
23000
  function spawnShell(bin, args2, stdin) {
22929
- return new Promise((resolve6) => {
23001
+ return new Promise((resolve7) => {
22930
23002
  let settled = false;
22931
23003
  const finish = (result4) => {
22932
23004
  if (settled) return;
22933
23005
  settled = true;
22934
- resolve6(result4);
23006
+ resolve7(result4);
22935
23007
  };
22936
23008
  let child;
22937
23009
  try {
@@ -23090,14 +23162,14 @@ function brokerFailure(op) {
23090
23162
  throw new Error(`credential_broker_${op}_failed`);
23091
23163
  }
23092
23164
  function createDefaultSecretToolRunner(secretToolBin = DEFAULT_SECRET_TOOL_BIN) {
23093
- return (input) => new Promise((resolve6) => {
23165
+ return (input) => new Promise((resolve7) => {
23094
23166
  let stdout = "";
23095
23167
  let stderr = "";
23096
23168
  let settled = false;
23097
23169
  const finish = (result4) => {
23098
23170
  if (settled) return;
23099
23171
  settled = true;
23100
- resolve6(result4);
23172
+ resolve7(result4);
23101
23173
  };
23102
23174
  let child;
23103
23175
  try {
@@ -23744,11 +23816,11 @@ var E_ALREADY_LOCKED = new Error("mutex already locked");
23744
23816
  var E_CANCELED = new Error("request for lock canceled");
23745
23817
  var __awaiter$2 = function(thisArg, _arguments, P, generator) {
23746
23818
  function adopt(value) {
23747
- return value instanceof P ? value : new P(function(resolve6) {
23748
- resolve6(value);
23819
+ return value instanceof P ? value : new P(function(resolve7) {
23820
+ resolve7(value);
23749
23821
  });
23750
23822
  }
23751
- return new (P || (P = Promise))(function(resolve6, reject) {
23823
+ return new (P || (P = Promise))(function(resolve7, reject) {
23752
23824
  function fulfilled(value) {
23753
23825
  try {
23754
23826
  step(generator.next(value));
@@ -23764,7 +23836,7 @@ var __awaiter$2 = function(thisArg, _arguments, P, generator) {
23764
23836
  }
23765
23837
  }
23766
23838
  function step(result4) {
23767
- result4.done ? resolve6(result4.value) : adopt(result4.value).then(fulfilled, rejected);
23839
+ result4.done ? resolve7(result4.value) : adopt(result4.value).then(fulfilled, rejected);
23768
23840
  }
23769
23841
  step((generator = generator.apply(thisArg, _arguments || [])).next());
23770
23842
  });
@@ -23779,8 +23851,8 @@ var Semaphore = class {
23779
23851
  acquire(weight = 1, priority = 0) {
23780
23852
  if (weight <= 0)
23781
23853
  throw new Error(`invalid weight ${weight}: must be positive`);
23782
- return new Promise((resolve6, reject) => {
23783
- const task = { resolve: resolve6, reject, weight, priority };
23854
+ return new Promise((resolve7, reject) => {
23855
+ const task = { resolve: resolve7, reject, weight, priority };
23784
23856
  const i = findIndexFromEnd(this._queue, (other) => priority <= other.priority);
23785
23857
  if (i === -1 && weight <= this._value) {
23786
23858
  this._dispatchItem(task);
@@ -23805,10 +23877,10 @@ var Semaphore = class {
23805
23877
  if (this._couldLockImmediately(weight, priority)) {
23806
23878
  return Promise.resolve();
23807
23879
  } else {
23808
- return new Promise((resolve6) => {
23880
+ return new Promise((resolve7) => {
23809
23881
  if (!this._weightedWaiters[weight - 1])
23810
23882
  this._weightedWaiters[weight - 1] = [];
23811
- insertSorted(this._weightedWaiters[weight - 1], { resolve: resolve6, priority });
23883
+ insertSorted(this._weightedWaiters[weight - 1], { resolve: resolve7, priority });
23812
23884
  });
23813
23885
  }
23814
23886
  }
@@ -23891,11 +23963,11 @@ function findIndexFromEnd(a, predicate) {
23891
23963
  }
23892
23964
  var __awaiter$1 = function(thisArg, _arguments, P, generator) {
23893
23965
  function adopt(value) {
23894
- return value instanceof P ? value : new P(function(resolve6) {
23895
- resolve6(value);
23966
+ return value instanceof P ? value : new P(function(resolve7) {
23967
+ resolve7(value);
23896
23968
  });
23897
23969
  }
23898
- return new (P || (P = Promise))(function(resolve6, reject) {
23970
+ return new (P || (P = Promise))(function(resolve7, reject) {
23899
23971
  function fulfilled(value) {
23900
23972
  try {
23901
23973
  step(generator.next(value));
@@ -23911,7 +23983,7 @@ var __awaiter$1 = function(thisArg, _arguments, P, generator) {
23911
23983
  }
23912
23984
  }
23913
23985
  function step(result4) {
23914
- result4.done ? resolve6(result4.value) : adopt(result4.value).then(fulfilled, rejected);
23986
+ result4.done ? resolve7(result4.value) : adopt(result4.value).then(fulfilled, rejected);
23915
23987
  }
23916
23988
  step((generator = generator.apply(thisArg, _arguments || [])).next());
23917
23989
  });
@@ -24075,7 +24147,7 @@ async function saveCliPendingUserMessages(args2) {
24075
24147
  if (ops.length) await args2.store.batch(ops);
24076
24148
  }
24077
24149
  async function readCliPendingUserMessages(store, dialogId) {
24078
- const { readDialogMessageRecords } = await import("./cliLocalAgentRecordReader-M3F76NIP.js");
24150
+ const { readDialogMessageRecords } = await import("./cliLocalAgentRecordReader-H3HYQRRR.js");
24079
24151
  const rows = await readDialogMessageRecords({ store, dialogId });
24080
24152
  const uncertain = rows.filter(({ record: record2 }) => record2.metadata?.cliBatchPhase === "requested" && !record2.metadata?.cliBatchResolution);
24081
24153
  const recovery = uncertain.length ? {
@@ -24290,7 +24362,7 @@ function buildLoadSkillExecutor(args2) {
24290
24362
  metadata: { loadSkill: true, resolved: false }
24291
24363
  };
24292
24364
  }
24293
- const { resolveSkillByName } = await import("./skillDiscovery-I37M5KJC.js");
24365
+ const { resolveSkillByName } = await import("./skillDiscovery-BHHPCUHZ.js");
24294
24366
  const resolved = resolveSkillByName(args2.cwd, name);
24295
24367
  if (!resolved) {
24296
24368
  const { resolveBuiltinSkillByName } = await import("./builtinSkillRegistry-BAE2LDXF.js");
@@ -24320,8 +24392,8 @@ ${builtin.content}`,
24320
24392
  };
24321
24393
  }
24322
24394
  try {
24323
- const { readFileSync } = await import("node:fs");
24324
- const body = readFileSync(resolved, "utf8");
24395
+ const { readFileSync: readFileSync2 } = await import("node:fs");
24396
+ const body = readFileSync2(resolved, "utf8");
24325
24397
  return {
24326
24398
  content: `Skill "${name}" loaded inline. Follow its instructions.
24327
24399
 
@@ -24397,8 +24469,8 @@ ${builtin.content}`,
24397
24469
  return reject("project requires projectBinding and relativePath only.");
24398
24470
  }
24399
24471
  try {
24400
- const { realpathSync, statSync, readFileSync } = await import("node:fs");
24401
- const { resolve: resolve6, relative: relative6, isAbsolute: isAbsolute5, basename: basename4, sep: sep3 } = await import("node:path");
24472
+ const { realpathSync, statSync, readFileSync: readFileSync2 } = await import("node:fs");
24473
+ const { resolve: resolve7, relative: relative6, isAbsolute: isAbsolute5, basename: basename4, sep: sep3 } = await import("node:path");
24402
24474
  const inside = (root, target) => {
24403
24475
  const rel = relative6(root, target);
24404
24476
  return rel !== "" && rel !== ".." && !rel.startsWith(`..${sep3}`) && !isAbsolute5(rel);
@@ -24410,8 +24482,8 @@ ${builtin.content}`,
24410
24482
  if (isAbsolute5(parsed.relativePath) || basename4(parsed.relativePath) !== "SKILL.md") {
24411
24483
  return reject("relativePath must reference a project SKILL.md.");
24412
24484
  }
24413
- const skillsRoot = resolve6(realCwd, ".agents", "skills");
24414
- const candidate = resolve6(realCwd, parsed.relativePath);
24485
+ const skillsRoot = resolve7(realCwd, ".agents", "skills");
24486
+ const candidate = resolve7(realCwd, parsed.relativePath);
24415
24487
  if (!inside(skillsRoot, candidate)) return reject("path is outside cwd/.agents/skills/.");
24416
24488
  const realRoot = realpathSync(skillsRoot);
24417
24489
  const realPath = realpathSync(candidate);
@@ -24419,7 +24491,7 @@ ${builtin.content}`,
24419
24491
  return reject("skill path escapes cwd/.agents/skills/ or is not SKILL.md.");
24420
24492
  }
24421
24493
  if (!statSync(realPath).isFile()) return reject("SKILL.md is not a file.");
24422
- const body = readFileSync(realPath, "utf8");
24494
+ const body = readFileSync2(realPath, "utf8");
24423
24495
  return {
24424
24496
  content: `Skill "${parsed.relativePath}" loaded inline. Follow its instructions.
24425
24497
 
@@ -24438,7 +24510,7 @@ ${body}`,
24438
24510
  }
24439
24511
  }
24440
24512
  async function formatUnknownSkillMessage(cwd, requestedName) {
24441
- const { discoverSkills } = await import("./skillDiscovery-I37M5KJC.js");
24513
+ const { discoverSkills } = await import("./skillDiscovery-BHHPCUHZ.js");
24442
24514
  let available = [];
24443
24515
  try {
24444
24516
  available = discoverSkills(cwd).map((s) => s.name);
@@ -25010,11 +25082,11 @@ function createDevinProvider(options) {
25010
25082
  }
25011
25083
 
25012
25084
  // packages/agent-runtime/executionLeaseValidation.ts
25013
- import { isAbsolute as isAbsolute4, relative as relative5, resolve as resolve5 } from "node:path";
25085
+ import { isAbsolute as isAbsolute4, relative as relative5, resolve as resolve6 } from "node:path";
25014
25086
  function withinRoot(root, child) {
25015
25087
  if (!isAbsolute4(root) || !isAbsolute4(child)) return false;
25016
- const canonicalRoot = resolve5(root);
25017
- const canonicalChild = resolve5(child);
25088
+ const canonicalRoot = resolve6(root);
25089
+ const canonicalChild = resolve6(child);
25018
25090
  const suffix = relative5(canonicalRoot, canonicalChild);
25019
25091
  return suffix === "" || suffix !== ".." && !suffix.startsWith("../") && !suffix.startsWith("..\\") && !isAbsolute4(suffix);
25020
25092
  }
@@ -25086,9 +25158,9 @@ export {
25086
25158
  Duration_exports,
25087
25159
  Exit_exports,
25088
25160
  Effect_exports,
25089
- scrubSecrets,
25090
25161
  isDestructiveShellCommand,
25091
25162
  evaluateShellCommandPolicy,
25163
+ readAgentsMdLayerFromDisk,
25092
25164
  filterRetainedLedgerRecords,
25093
25165
  isLineRangeCovered,
25094
25166
  runTaskStop,