nolo-cli 0.8.0-alpha.14 → 0.8.0-alpha.19

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 (98) hide show
  1. package/README.md +1 -1
  2. package/{_executeModel-KBMAUV6G.js → _executeModel-BOMQGOZC.js} +33 -30
  3. package/{action-SQGI5JY5.js → action-AEHDRQHP.js} +4 -4
  4. package/{addContentAction-ZX2PUS3X.js → addContentAction-OL5YQ6LW.js} +3 -3
  5. package/{addDialogAgentAction-ULADQX2Q.js → addDialogAgentAction-XU5Y2E2X.js} +2 -2
  6. package/{agentDeleteCommand-GNVYHOGZ.js → agentDeleteCommand-5DD2IM3J.js} +12 -11
  7. package/{agentEmailCommands-QETL62SU.js → agentEmailCommands-SE7MBTAG.js} +35 -32
  8. package/{agentListCommands-FM4OWXYT.js → agentListCommands-I6KZYCIG.js} +13 -12
  9. package/{agentMachineCommands-LDHJBWQO.js → agentMachineCommands-SBYN6EXT.js} +13 -12
  10. package/{agentRecordCommands-UW76EZ25.js → agentRecordCommands-F74NBFOZ.js} +35 -32
  11. package/{agentRunCommand-UFBOW4ZF.js → agentRunCommand-3DGDK4Y3.js} +41 -36
  12. package/{agentRuntimeLocal-XL5PLRJV.js → agentRuntimeLocal-ZYEIPTY4.js} +9 -8
  13. package/{agentSlice-2IBSFH4O.js → agentSlice-XEH6Y334.js} +3 -3
  14. package/{authCommand-PXFX6JDT.js → authCommand-EB5JSOX5.js} +3 -3
  15. package/{authCommands-356AYWEK.js → authCommands-XPEHTKSM.js} +2 -2
  16. package/{chunk-QTFSBLCF.js → chunk-2BIV3FMX.js} +25 -236
  17. package/{chunk-ZDXZSXYQ.js → chunk-2NNJ6S5U.js} +1 -1
  18. package/{chunk-6A3LI5TZ.js → chunk-2T2C6CNY.js} +2 -2
  19. package/{chunk-2IRF4LEX.js → chunk-4NDK6NWB.js} +87 -114
  20. package/{chunk-SRLZ7IVA.js → chunk-4P2MDGKS.js} +78 -211
  21. package/{chunk-MXLQWBVM.js → chunk-4QEWT7KD.js} +33 -3
  22. package/{chunk-DSNONPGW.js → chunk-5KLGBAAR.js} +1 -1
  23. package/{chunk-6CBN7GGH.js → chunk-64AAZRGY.js} +4 -4
  24. package/{chunk-QKRUUZCL.js → chunk-6RSAUKSQ.js} +24 -13
  25. package/{chunk-TWPGVS2U.js → chunk-7DAJ4AI4.js} +2 -2
  26. package/{chunk-RLCFUU46.js → chunk-7KCUSYT2.js} +4 -10
  27. package/chunk-AFON4QUU.js +112 -0
  28. package/chunk-AGFH73SK.js +239 -0
  29. package/{chunk-572EKYLF.js → chunk-BBYVOSU2.js} +1 -1
  30. package/{chunk-2MALU52L.js → chunk-C3RUNRHT.js} +1 -1
  31. package/{chunk-SL35K7AH.js → chunk-C4FTUXVF.js} +2 -82
  32. package/{chunk-JRPR5M4O.js → chunk-C77B4AFC.js} +2 -2
  33. package/{chunk-USZMK5UT.js → chunk-DCOA4QSN.js} +1 -1
  34. package/{chunk-BKPVTIEK.js → chunk-FVYY6MCS.js} +3 -3
  35. package/{chunk-3TZDXYSF.js → chunk-HNW7IJSK.js} +1 -1
  36. package/{chunk-B6DFDN4R.js → chunk-IEKTE4JQ.js} +2 -2
  37. package/{chunk-BR2WP3DF.js → chunk-IWX4UW2E.js} +9 -9
  38. package/{chunk-MMRAIO5Y.js → chunk-IX4C5TCO.js} +3 -3
  39. package/{chunk-6XKX2N2E.js → chunk-JRCUAPXX.js} +1 -1
  40. package/{chunk-XDVAYP26.js → chunk-JRKKFRAV.js} +1 -1
  41. package/{chunk-V2AISYMA.js → chunk-KPSWSDUF.js} +2 -2
  42. package/chunk-LTRXGFMS.js +83 -0
  43. package/{chunk-PCWC3JTN.js → chunk-MTU75CZ2.js} +1 -1
  44. package/{chunk-DGFWICQJ.js → chunk-N54XAP77.js} +1 -1
  45. package/{chunk-SACYB45H.js → chunk-O2ZNTTET.js} +5 -5
  46. package/{chunk-SH2CFQOH.js → chunk-O4BU24WZ.js} +2 -181
  47. package/{chunk-PFUCDPUH.js → chunk-OFM4S5P3.js} +13 -13
  48. package/{chunk-VH4YK6KZ.js → chunk-OI54SUZ7.js} +6 -6
  49. package/{chunk-QO4YO77G.js → chunk-OZNNTJM7.js} +2 -2
  50. package/{chunk-DG7AAAR3.js → chunk-P3PKED2I.js} +62 -2
  51. package/{chunk-JW43YCM5.js → chunk-PY4NLIAF.js} +1 -1
  52. package/{chunk-7IPLJUYC.js → chunk-RL776AGR.js} +1 -1
  53. package/{chunk-EQHI2AR3.js → chunk-RM7KF6OT.js} +41 -22
  54. package/{chunk-RJKDVL4L.js → chunk-SDJDLO5W.js} +2 -2
  55. package/{chunk-RTZFUR3V.js → chunk-SHAFJ4TI.js} +3 -3
  56. package/{chunk-YYUCRDOK.js → chunk-SOTZ6RDN.js} +1 -1
  57. package/chunk-VC6OZXO5.js +298 -0
  58. package/{chunk-EXTIQUCI.js → chunk-VVX233PH.js} +1 -1
  59. package/{chunk-ZQ2UM4KG.js → chunk-WZSRQNQG.js} +1 -292
  60. package/{chunk-Q2YZULBH.js → chunk-XENYHRUE.js} +1 -1
  61. package/{chunk-VQ2AJRGD.js → chunk-YPRZSPF3.js} +1 -1
  62. package/{chunk-I6DI7SGU.js → chunk-YRG2GO6E.js} +222 -63
  63. package/{cliExecutor-DNE7TCC4.js → cliExecutor-K3F7DMRO.js} +2 -2
  64. package/{createAgentAutomationAction-CSWOQOY5.js → createAgentAutomationAction-MBUL3ALA.js} +12 -12
  65. package/{createDialogAction-6VWL2TDI.js → createDialogAction-3JLD4VED.js} +16 -15
  66. package/{createPageAction-INRC4MH2.js → createPageAction-Z2AOWGIW.js} +17 -16
  67. package/{dbSlice-TO2TSMWM.js → dbSlice-LSKJDY2R.js} +2 -2
  68. package/{dialogCommands-DWSE4PMW.js → dialogCommands-4IX4XIZE.js} +14 -13
  69. package/{dialogSlice-CELFVS3F.js → dialogSlice-NRQ5WIJO.js} +12 -12
  70. package/{docCreateCommands-UFJL5PUM.js → docCreateCommands-SIL3NPGT.js} +14 -12
  71. package/{docDeleteCommands-XHEIBAB2.js → docDeleteCommands-7IOMLUS4.js} +16 -14
  72. package/{docReadCommands-PEDIC2CW.js → docReadCommands-FNFXUA5L.js} +14 -12
  73. package/{docStore-Q5AFYT6G.js → docStore-DBFNPMHU.js} +13 -13
  74. package/{docUpdateCommands-WBRODQ7P.js → docUpdateCommands-X2HNDVUC.js} +14 -12
  75. package/{fetchMessages-U6ZHN56A.js → fetchMessages-KTNM7QAR.js} +2 -2
  76. package/{getPricing-PWPJ6MNV.js → getPricing-3E6UNPKL.js} +3 -3
  77. package/{handleSendMessageAction-PPIGKCBQ.js → handleSendMessageAction-G3WLT6I7.js} +12 -12
  78. package/index.js +45 -45
  79. package/{localDialogRead-Z5UTAJPU.js → localDialogRead-2VRI24F4.js} +1 -1
  80. package/{machineCommands-3D7JMHUP.js → machineCommands-GPEWO27H.js} +37 -34
  81. package/{machineWsRunDispatch-PA5BR4AX.js → machineWsRunDispatch-2LSYCV4S.js} +34 -31
  82. package/{models-XLEOET3E.js → models-4OPOOLFS.js} +2 -2
  83. package/package.json +3 -2
  84. package/{readlineWorkspace-7WPA5OUS.js → readlineWorkspace-UL4LXWHX.js} +252 -78
  85. package/{removeDialogAgentAction-3MUQGFZX.js → removeDialogAgentAction-U3CP2M2H.js} +4 -4
  86. package/{runAgentClientLoop-DRAXPP6R.js → runAgentClientLoop-KKV7BWWC.js} +27 -24
  87. package/{setDialogExtraReferencesAction-MXHX2HPK.js → setDialogExtraReferencesAction-S7GUFLTN.js} +2 -2
  88. package/{setPrimaryDialogAgentAction-7DLDZHDT.js → setPrimaryDialogAgentAction-5SF7G5OS.js} +4 -4
  89. package/{settingSlice-PNLASZGI.js → settingSlice-EXYZ5EFP.js} +3 -3
  90. package/skillDiscovery-UGSQGX2U.js +16 -0
  91. package/{spaceCommands-ORSFAWEY.js → spaceCommands-E7VOF4LO.js} +16 -19
  92. package/{spaceSlice-5F2CDP2O.js → spaceSlice-KIDVQWOV.js} +16 -14
  93. package/{streamAgentChatTurn-ROOB5RLM.js → streamAgentChatTurn-YQH6ZGE6.js} +41 -36
  94. package/{tools-BAWXW4F6.js → tools-5C7OGJEW.js} +21 -19
  95. package/{tuiSummaryLlmCaller-JSI4GL6W.js → tuiSummaryLlmCaller-RV3THLZF.js} +4 -4
  96. package/{understanding-GQKNDDWM.js → understanding-3CUQQ6SV.js} +3 -3
  97. package/{updateDialogTitleAction-KJM65IGF.js → updateDialogTitleAction-JHAVYVIP.js} +12 -12
  98. package/{chunk-X7W4TNB4.js → chunk-CMKUBIGW.js} +3 -3
@@ -1,3 +1,6 @@
1
+ import {
2
+ resolveMachineId
3
+ } from "./chunk-6HYVJV7B.js";
1
4
  import {
2
5
  createRunActivityTracker,
3
6
  finalizeRunRecord,
@@ -16,57 +19,50 @@ import {
16
19
  createCliCallAgentToolExecutor,
17
20
  createCliLocalRuntimeAdapter,
18
21
  isBuiltinNoloAgentRef
19
- } from "./chunk-EQHI2AR3.js";
22
+ } from "./chunk-RM7KF6OT.js";
20
23
  import {
21
24
  getReadableCliDb
22
25
  } from "./chunk-W4NVOSFF.js";
23
26
  import {
24
27
  readDbRecord,
25
28
  resolveAgentRecordFromHybridStore
26
- } from "./chunk-RJKDVL4L.js";
29
+ } from "./chunk-SDJDLO5W.js";
27
30
  import {
28
31
  normalizeAgentHandle
29
- } from "./chunk-DGFWICQJ.js";
32
+ } from "./chunk-N54XAP77.js";
30
33
  import {
31
34
  NOLO_PROJECT_MANAGER_AGENT_KEY,
32
35
  isLocalCliAgentKey
33
36
  } from "./chunk-VHBWHNVT.js";
34
37
  import {
35
38
  applyModelLayerOverride,
36
- buildMemoryOverlayLayer,
37
- buildMemoryUseGuidanceLayer,
38
- buildModelLayerOverride,
39
- buildSkillDiscoveryLayer
40
- } from "./chunk-SL35K7AH.js";
39
+ buildModelLayerOverride
40
+ } from "./chunk-LTRXGFMS.js";
41
41
  import {
42
42
  CliProviderQuotaError
43
- } from "./chunk-X7W4TNB4.js";
44
- import {
45
- resolveMachineId
46
- } from "./chunk-6HYVJV7B.js";
43
+ } from "./chunk-CMKUBIGW.js";
47
44
  import {
48
45
  isGatewayHttpStatus
49
46
  } from "./chunk-GAKEBQD6.js";
50
47
  import {
51
48
  buildMemorySubjectsForAgent,
52
49
  resolveAgentMemoryPolicy
53
- } from "./chunk-VH4YK6KZ.js";
50
+ } from "./chunk-OI54SUZ7.js";
54
51
  import {
55
- load,
56
52
  parseExternalSkillMarkdown,
57
53
  parseSkillDocProtocol
58
- } from "./chunk-ZQ2UM4KG.js";
54
+ } from "./chunk-VC6OZXO5.js";
59
55
  import {
60
56
  touchMemoryItemsInDb
61
- } from "./chunk-3TZDXYSF.js";
57
+ } from "./chunk-HNW7IJSK.js";
62
58
  import {
63
59
  chooseMemoryOwners,
64
60
  loadMemoryCandidatesFromDb
65
- } from "./chunk-Q2YZULBH.js";
61
+ } from "./chunk-XENYHRUE.js";
66
62
  import {
67
63
  getModelContextWindow,
68
64
  parseUiAskChoiceContent
69
- } from "./chunk-SRLZ7IVA.js";
65
+ } from "./chunk-4P2MDGKS.js";
70
66
  import {
71
67
  readPipeText,
72
68
  spawnProcess
@@ -74,10 +70,17 @@ import {
74
70
  import {
75
71
  resolveAuthToken
76
72
  } from "./chunk-ISNCLGUZ.js";
73
+ import {
74
+ buildSkillDiscoveryContextBlock
75
+ } from "./chunk-AFON4QUU.js";
76
+ import {
77
+ buildMemoryOverlayLayer,
78
+ buildMemoryUseGuidanceLayer
79
+ } from "./chunk-C4FTUXVF.js";
77
80
  import {
78
81
  buildPlatformChatCompletionRequest,
79
82
  parsePlatformChatCompletionData
80
- } from "./chunk-DSNONPGW.js";
83
+ } from "./chunk-5KLGBAAR.js";
81
84
  import {
82
85
  resolveAgentRuntimeConfigFromRecord
83
86
  } from "./chunk-TILFE6LV.js";
@@ -86,16 +89,16 @@ import {
86
89
  LOCAL_TURN_ABORTED_CODE,
87
90
  readActionGate,
88
91
  readCommandActionGatePayload
89
- } from "./chunk-MXLQWBVM.js";
92
+ } from "./chunk-4QEWT7KD.js";
90
93
  import {
91
94
  resolvePlatformChatCompletionsEndpoint
92
- } from "./chunk-XDVAYP26.js";
95
+ } from "./chunk-JRKKFRAV.js";
93
96
  import {
94
97
  clipCompactText
95
98
  } from "./chunk-5MMAK75Q.js";
96
99
  import {
97
100
  findModelConfig
98
- } from "./chunk-572EKYLF.js";
101
+ } from "./chunk-BBYVOSU2.js";
99
102
  import {
100
103
  compactWhitespace
101
104
  } from "./chunk-DWLEOOGR.js";
@@ -108,9 +111,6 @@ import {
108
111
  import {
109
112
  parsePositiveFiniteNumberOrFallback
110
113
  } from "./chunk-Y5GCAMGP.js";
111
- import {
112
- require_index_umd
113
- } from "./chunk-SH2CFQOH.js";
114
114
  import {
115
115
  asTrimmedLowercaseString
116
116
  } from "./chunk-QSJ3HFEF.js";
@@ -129,9 +129,6 @@ import {
129
129
  import {
130
130
  asOptionalTrimmedString
131
131
  } from "./chunk-G3SUCT4W.js";
132
- import {
133
- __toESM
134
- } from "./chunk-4VNS5WPM.js";
135
132
 
136
133
  // packages/cli/client/tokenUsage.ts
137
134
  var PROVIDER_LOOKUP_ORDER = [
@@ -1789,7 +1786,9 @@ var TOOL_LABELS = {
1789
1786
  // Web
1790
1787
  fetchWebpage: { en: "Fetch page", zh: "\u6293\u53D6\u7F51\u9875" },
1791
1788
  readPage: { en: "Read page", zh: "\u8BFB\u53D6\u7F51\u9875" },
1792
- exaSearch: { en: "Web search", zh: "\u8054\u7F51\u641C\u7D22" }
1789
+ exaSearch: { en: "Web search", zh: "\u8054\u7F51\u641C\u7D22" },
1790
+ // Skill loading
1791
+ loadSkill: { en: "Used Skill", zh: "\u4F7F\u7528\u6280\u80FD" }
1793
1792
  };
1794
1793
  function toolLabel(name) {
1795
1794
  return TOOL_LABELS[name]?.[currentLocale] ?? name;
@@ -2084,6 +2083,16 @@ function formatFetchTreeBlockForCli(items, colorEnabled) {
2084
2083
  return `${headerLine}${treeLines}
2085
2084
  `;
2086
2085
  }
2086
+ function resolveLoadSkillName(event) {
2087
+ const metaName = typeof event.metadata?.name === "string" ? event.metadata.name : void 0;
2088
+ if (metaName) return metaName;
2089
+ const argName = event.argumentsPreview?.trim();
2090
+ if (argName && !argName.startsWith("{")) return argName;
2091
+ const content = typeof event.content === "string" ? event.content : "";
2092
+ const match = content.match(/Skill "([^"]+)" loaded inline/);
2093
+ if (match?.[1]) return match[1];
2094
+ return argName || "skill";
2095
+ }
2087
2096
  function formatCompactToolLine(event, pending, colorEnabled) {
2088
2097
  const toolName = event.toolName || pending?.toolName || "tool";
2089
2098
  if (isReadToolName(toolName) && event.type === "tool-result") {
@@ -2112,6 +2121,28 @@ function formatCompactToolLine(event, pending, colorEnabled) {
2112
2121
  const message = clip(event.message ?? t("toolFailed"), 96);
2113
2122
  return formatToolTraceLine(`\u25B8 ${label} \u2717 ${message}`, colorEnabled, "error");
2114
2123
  }
2124
+ if (event.type === "tool-result" && toolName === "loadSkill") {
2125
+ const skillName = resolveLoadSkillName(event);
2126
+ const content = typeof event.content === "string" ? event.content : "";
2127
+ const failed2 = /^Skill\s+"[^"]*"\s+not found/.test(content) || isFailedToolResult(event);
2128
+ if (failed2) {
2129
+ const message = clip(content.split("\n")[0] || t("toolFailed"), 96);
2130
+ return formatToolTraceLine(`\u25B8 Used Skill (${skillName}) \u2717 ${message}`, colorEnabled, "error");
2131
+ }
2132
+ const resultLine = `Skill "${skillName}" loaded inline. Follow its instructions.`;
2133
+ if (!colorEnabled) {
2134
+ return `\u25CF Used Skill (${skillName})
2135
+ ${resultLine}
2136
+ `;
2137
+ }
2138
+ const bullet = themeText("\u25CF", "success", true);
2139
+ const labelPart = themeText("Used Skill", "muted", true);
2140
+ const namePart = themeText(`(${skillName})`, "chrome", true);
2141
+ const detail = themeText(` ${resultLine}`, "muted", true);
2142
+ return `${bullet} ${labelPart} ${namePart}
2143
+ ${detail}
2144
+ `;
2145
+ }
2115
2146
  if (event.type === "tool-result" && (event.toolName === "ui_ask_choice" || event.metadata?.uiAskChoice)) {
2116
2147
  const block = formatUiAskChoiceBlock(event, colorEnabled);
2117
2148
  if (block) return block;
@@ -2793,9 +2824,9 @@ function isKnownServerPlatformAgent(options) {
2793
2824
  }
2794
2825
 
2795
2826
  // packages/cli/client/agentRun.ts
2796
- var import_ulid = __toESM(require_index_umd(), 1);
2827
+ import { ulid } from "ulid";
2797
2828
  async function loadRunLocalAgentTurn() {
2798
- const { runLocalAgentTurn } = await import("./agentRuntimeLocal-XL5PLRJV.js");
2829
+ const { runLocalAgentTurn } = await import("./agentRuntimeLocal-ZYEIPTY4.js");
2799
2830
  return runLocalAgentTurn;
2800
2831
  }
2801
2832
  async function resolveCurrentMachineId(options) {
@@ -3191,9 +3222,9 @@ async function runLocalAgentTurnForCli(options, settings) {
3191
3222
  ...options.parentWakeOnTerminal ? { parentWakeOnTerminal: true } : {},
3192
3223
  ...options.parentDialogId ? { parentThreadId: options.parentDialogId } : {}
3193
3224
  } : void 0;
3194
- const currentDialogId = options.continueDialogId ?? (0, import_ulid.ulid)();
3225
+ const currentDialogId = options.continueDialogId ?? ulid();
3195
3226
  const runChildTurn = async (input) => {
3196
- const { runLocalAgentTurn } = await import("./agentRuntimeLocal-XL5PLRJV.js");
3227
+ const { runLocalAgentTurn } = await import("./agentRuntimeLocal-ZYEIPTY4.js");
3197
3228
  return runLocalAgentTurn(input);
3198
3229
  };
3199
3230
  const createFreshChildBaseAdapter = () => {
@@ -3381,8 +3412,8 @@ async function runAgentTurn(options) {
3381
3412
  }
3382
3413
 
3383
3414
  // packages/cli/agentRunCommand.ts
3384
- import { existsSync as existsSync3, readFileSync as readFileSync3 } from "node:fs";
3385
- import { join as join3 } from "node:path";
3415
+ import { existsSync as existsSync2, readFileSync as readFileSync2 } from "node:fs";
3416
+ import { join as join2 } from "node:path";
3386
3417
 
3387
3418
  // packages/agent-runtime/quickChatIntentCore.ts
3388
3419
  var INTENT_MODEL = "deepseek-v4-flash";
@@ -3574,72 +3605,15 @@ async function classifyCliAutoRoute(text, options) {
3574
3605
  }
3575
3606
  }
3576
3607
 
3577
- // packages/agent-runtime/skillDiscovery.ts
3578
- import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
3579
- import { join } from "node:path";
3580
- var SKILL_SCAN_DIRS = [".agents/skills", "docs/skills"];
3581
- var MAX_DISCOVERED_SKILLS = 50;
3582
- function parseSkillFrontmatter(filePath) {
3583
- try {
3584
- const content = readFileSync(filePath, "utf8").slice(0, 2048);
3585
- const fmMatch = content.match(/^---\n([\s\S]*?)\n---/);
3586
- if (!fmMatch) return {};
3587
- const fm = load(fmMatch[1]);
3588
- if (!fm || typeof fm !== "object") return {};
3589
- const name = typeof fm.name === "string" ? fm.name : void 0;
3590
- const rawDesc = fm.description;
3591
- const description = typeof rawDesc === "string" ? rawDesc : rawDesc == null ? void 0 : String(rawDesc);
3592
- const sanitize = (s) => s?.trim().replace(/^["']|["']$/g, "").replace(/[\n\r]+/g, " ").slice(0, 200);
3593
- return { name: sanitize(name), description: sanitize(description) };
3594
- } catch {
3595
- return {};
3596
- }
3597
- }
3598
- function discoverSkills(cwd) {
3599
- const skills = [];
3600
- for (const dir of SKILL_SCAN_DIRS) {
3601
- if (skills.length >= MAX_DISCOVERED_SKILLS) break;
3602
- const absDir = join(cwd, dir);
3603
- if (!existsSync(absDir) || !statSync(absDir).isDirectory()) continue;
3604
- try {
3605
- for (const entry of readdirSync(absDir)) {
3606
- if (skills.length >= MAX_DISCOVERED_SKILLS) break;
3607
- const skillMdPath = join(absDir, entry, "SKILL.md");
3608
- if (existsSync(skillMdPath)) {
3609
- const { name, description } = parseSkillFrontmatter(skillMdPath);
3610
- skills.push({ name: name ?? entry, description: description ?? "", relativePath: join(dir, entry, "SKILL.md") });
3611
- continue;
3612
- }
3613
- if (dir === "docs/skills" && entry.endsWith(".md")) {
3614
- const flatPath = join(absDir, entry);
3615
- const { name, description } = parseSkillFrontmatter(flatPath);
3616
- skills.push({ name: name ?? entry.replace(/\.md$/, ""), description: description ?? "", relativePath: join(dir, entry) });
3617
- }
3618
- }
3619
- } catch {
3620
- }
3621
- }
3622
- return skills;
3623
- }
3624
- function buildSkillDiscoveryContextBlock(cwd) {
3625
- try {
3626
- const discovered = discoverSkills(cwd);
3627
- const layer = buildSkillDiscoveryLayer(discovered, cwd);
3628
- return layer?.content ?? null;
3629
- } catch {
3630
- return null;
3631
- }
3632
- }
3633
-
3634
3608
  // packages/cli/agentRunPrompts.ts
3635
- import { existsSync as existsSync2, readFileSync as readFileSync2, readdirSync as readdirSync2, statSync as statSync2 } from "node:fs";
3636
- import { dirname, extname, isAbsolute, join as join2, relative as relativePath, resolve, sep } from "node:path";
3609
+ import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
3610
+ import { dirname, extname, isAbsolute, join, relative as relativePath, resolve, sep } from "node:path";
3637
3611
  function workflowRefToCandidatePath(cwd, ref) {
3638
3612
  const normalized = ref.trim();
3639
3613
  if (!normalized) return "";
3640
3614
  if (normalized.endsWith(".md") || normalized.includes("/") || normalized.includes("\\")) {
3641
3615
  const directPath = resolve(cwd, normalized);
3642
- if (existsSync2(directPath)) return directPath;
3616
+ if (existsSync(directPath)) return directPath;
3643
3617
  }
3644
3618
  const fileName = normalized.replace(/[^a-zA-Z0-9一-鿿]+/g, "-").replace(/^-+|-+$/g, "");
3645
3619
  return resolve(cwd, "docs", "workflows", `${fileName}.md`);
@@ -3653,26 +3627,26 @@ function skillRefToCandidatePath(cwd, ref) {
3653
3627
  if (!normalized) return "";
3654
3628
  if (normalized.endsWith(".md") || normalized.includes("/") || normalized.includes("\\")) {
3655
3629
  const directPath = resolve(cwd, normalized);
3656
- if (existsSync2(directPath)) return directPath;
3630
+ if (existsSync(directPath)) return directPath;
3657
3631
  }
3658
3632
  const fileName = normalized.replace(/[^a-zA-Z0-9一-鿿]+/g, "-").replace(/^-+|-+$/g, "");
3659
3633
  for (const dir of SKILL_SEARCH_DIRS) {
3660
3634
  if (dir === "docs/skills") {
3661
3635
  const flatPath = resolve(cwd, dir, `${fileName}.md`);
3662
- if (existsSync2(flatPath)) return flatPath;
3636
+ if (existsSync(flatPath)) return flatPath;
3663
3637
  } else {
3664
3638
  const skillMdPath = resolve(cwd, dir, fileName, "SKILL.md");
3665
- if (existsSync2(skillMdPath)) return skillMdPath;
3639
+ if (existsSync(skillMdPath)) return skillMdPath;
3666
3640
  }
3667
3641
  }
3668
3642
  return resolve(cwd, "docs", "skills", `${fileName}.md`);
3669
3643
  }
3670
3644
  async function resolveWorkflowReference(ref, cwd = process.cwd()) {
3671
3645
  const path = workflowRefToCandidatePath(cwd, ref);
3672
- if (!path || !existsSync2(path)) {
3646
+ if (!path || !existsSync(path)) {
3673
3647
  throw new Error(`Workflow reference not found: ${ref}`);
3674
3648
  }
3675
- const markdown = readFileSync2(path, "utf8");
3649
+ const markdown = readFileSync(path, "utf8");
3676
3650
  const parsed = parseSkillDocProtocol(markdown);
3677
3651
  return {
3678
3652
  ref,
@@ -3689,8 +3663,8 @@ function inlineRelativeRefs(body, skillDir) {
3689
3663
  const absPath = resolve(skillDir, cleaned);
3690
3664
  const relative = relativePath(normalizedSkillDir, absPath);
3691
3665
  if (relative.startsWith("..") || isAbsolute(relative)) return match;
3692
- if (!existsSync2(absPath) || !absPath.endsWith(".md")) return match;
3693
- const refContent = readFileSync2(absPath, "utf8");
3666
+ if (!existsSync(absPath) || !absPath.endsWith(".md")) return match;
3667
+ const refContent = readFileSync(absPath, "utf8");
3694
3668
  return `
3695
3669
 
3696
3670
  ### ${label}
@@ -3701,9 +3675,9 @@ ${refContent}
3701
3675
  });
3702
3676
  }
3703
3677
  function listSkillScripts(skillDir) {
3704
- const scriptsDir = join2(skillDir, "scripts");
3705
- if (!existsSync2(scriptsDir) || !statSync2(scriptsDir).isDirectory()) return null;
3706
- const entries = readdirSync2(scriptsDir).filter((e) => !e.startsWith("."));
3678
+ const scriptsDir = join(skillDir, "scripts");
3679
+ if (!existsSync(scriptsDir) || !statSync(scriptsDir).isDirectory()) return null;
3680
+ const entries = readdirSync(scriptsDir).filter((e) => !e.startsWith("."));
3707
3681
  if (entries.length === 0) return null;
3708
3682
  return [
3709
3683
  "",
@@ -3729,10 +3703,10 @@ async function resolveSkillReference(ref, options = {}) {
3729
3703
  } else {
3730
3704
  const cwd = options.cwd ?? process.cwd();
3731
3705
  const path = skillRefToCandidatePath(cwd, ref);
3732
- if (!path || !existsSync2(path)) {
3706
+ if (!path || !existsSync(path)) {
3733
3707
  throw new Error(`Skill reference not found: ${ref}`);
3734
3708
  }
3735
- markdown = readFileSync2(path, "utf8");
3709
+ markdown = readFileSync(path, "utf8");
3736
3710
  filePath = path;
3737
3711
  skillDir = dirname(path);
3738
3712
  }
@@ -3823,8 +3797,8 @@ function prependSubjectDialogMarker(message, subjectDialogKey) {
3823
3797
  function normalizeCliImageInput(input) {
3824
3798
  if (/^(https?:|data:|file:)/i.test(input)) return input;
3825
3799
  const absolutePath = resolve(input);
3826
- if (!existsSync2(absolutePath)) return input;
3827
- const base64 = readFileSync2(absolutePath).toString("base64");
3800
+ if (!existsSync(absolutePath)) return input;
3801
+ const base64 = readFileSync(absolutePath).toString("base64");
3828
3802
  return `data:${imageMimeTypeForPath(absolutePath)};base64,${base64}`;
3829
3803
  }
3830
3804
  function imageMimeTypeForPath(path) {
@@ -4473,10 +4447,10 @@ async function runAgentRunCommand(args, deps) {
4473
4447
  const extraContextBlocks = [];
4474
4448
  const AGENTS_MD_MAX = 8192;
4475
4449
  for (const name of ["AGENTS.md", "CLAUDE.md"]) {
4476
- const agentsMdPath = join3(cliCwd, name);
4477
- if (existsSync3(agentsMdPath)) {
4450
+ const agentsMdPath = join2(cliCwd, name);
4451
+ if (existsSync2(agentsMdPath)) {
4478
4452
  try {
4479
- let mdContent = readFileSync3(agentsMdPath, "utf8").trim();
4453
+ let mdContent = readFileSync2(agentsMdPath, "utf8").trim();
4480
4454
  if (!mdContent) continue;
4481
4455
  if (Buffer.byteLength(mdContent, "utf8") > AGENTS_MD_MAX) {
4482
4456
  mdContent = Buffer.from(mdContent, "utf8").subarray(0, AGENTS_MD_MAX).toString("utf8") + "\n\n<!-- AGENTS.md truncated -->";
@@ -4496,7 +4470,7 @@ ${mdContent}`);
4496
4470
  let memoryPromptBlock = null;
4497
4471
  if (!deps.memoryRecallDisabled) {
4498
4472
  const memoryServerUrl = resolveServerUrl(env);
4499
- const memoryAuthToken = resolveAuthToken(env);
4473
+ const memoryAuthToken = resolveAuthToken(args, env);
4500
4474
  const memoryAgentKey = effectiveAgentKey;
4501
4475
  const memorySpaceId = parsed.spaceId ?? void 0;
4502
4476
  try {
@@ -4738,7 +4712,6 @@ export {
4738
4712
  CLI_IMAGE_AGENT_KEY,
4739
4713
  CLI_AUTO_TIER_AGENT_KEY_TABLE,
4740
4714
  classifyCliAutoRoute,
4741
- buildSkillDiscoveryContextBlock,
4742
4715
  resolveWorkflowReference,
4743
4716
  resolveSkillReference,
4744
4717
  buildSkillContextBlocks,