nolo-cli 0.8.0-alpha.6 → 0.8.0-alpha.7

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 (174) hide show
  1. package/_executeModel-XIGO7HW5.js +198 -0
  2. package/action-PAXRPJJF.js +27 -0
  3. package/addContentAction-CZVWF3QZ.js +25 -0
  4. package/addDialogAgentAction-CCIDTPHC.js +67 -0
  5. package/agentDeleteCommand-47B24JYG.js +323 -0
  6. package/agentEmailCommands-D4FC6OZJ.js +621 -0
  7. package/agentListCommands-UFET7CC4.js +219 -0
  8. package/agentMachineCommands-LH7QDQPP.js +421 -0
  9. package/agentPullCommand-O2MTUAFR.js +122 -0
  10. package/agentRecordCommands-CWS2B5IA.js +89 -0
  11. package/agentRunCommand-3FRPISLG.js +102 -0
  12. package/agentRunControl-K4VKNEHF.js +57 -0
  13. package/agentRuntimeLocal-JNQQC2WG.js +99 -0
  14. package/agentSlice-XDFSELFJ.js +41 -0
  15. package/authCommand-WXMD3IPR.js +574 -0
  16. package/authCommands-X74AFDTC.js +26 -0
  17. package/chunk-2EISRLRC.js +238 -0
  18. package/chunk-2FTTDCD4.js +675 -0
  19. package/chunk-2JHWPW5B.js +2127 -0
  20. package/chunk-2LMT6K6N.js +171 -0
  21. package/chunk-2MALU52L.js +51 -0
  22. package/chunk-364VYAX2.js +19 -0
  23. package/chunk-3ASDTTEI.js +1774 -0
  24. package/chunk-3EUW3WEO.js +8 -0
  25. package/chunk-3LY4F7SV.js +9293 -0
  26. package/chunk-4CQLVGRV.js +50 -0
  27. package/chunk-4IJYA27C.js +342 -0
  28. package/chunk-4SN6J65J.js +38 -0
  29. package/chunk-4VNS5WPM.js +42 -0
  30. package/chunk-543C7RDK.js +562 -0
  31. package/chunk-572EKYLF.js +792 -0
  32. package/chunk-5MIDPSSK.js +206 -0
  33. package/chunk-5MMAK75Q.js +15 -0
  34. package/chunk-5XH3NZ4T.js +3631 -0
  35. package/chunk-63W5N6P3.js +150 -0
  36. package/chunk-6HYVJV7B.js +102 -0
  37. package/chunk-6PWWWMI7.js +628 -0
  38. package/chunk-6WD3OOJS.js +20 -0
  39. package/chunk-A3X4Y7MO.js +4294 -0
  40. package/chunk-AR7ZSGDI.js +929 -0
  41. package/chunk-ATNTHIZI.js +13 -0
  42. package/chunk-AUGHVUFE.js +69 -0
  43. package/chunk-AVMKZHBC.js +85 -0
  44. package/chunk-AZPCASRE.js +36 -0
  45. package/chunk-B76D3JJK.js +1447 -0
  46. package/chunk-BR2WP3DF.js +548 -0
  47. package/chunk-BSTNFPHD.js +231 -0
  48. package/chunk-CF2WZF4N.js +134 -0
  49. package/chunk-CF7PE763.js +10 -0
  50. package/chunk-CKOJQDKR.js +198 -0
  51. package/chunk-CM54RSSA.js +206 -0
  52. package/chunk-CWMSB67P.js +34 -0
  53. package/chunk-DA2OEKS6.js +27 -0
  54. package/chunk-DFFIZ25G.js +30 -0
  55. package/chunk-DWLEOOGR.js +8 -0
  56. package/chunk-DZ3XJVET.js +231 -0
  57. package/chunk-E5HMHIKL.js +222 -0
  58. package/chunk-EHLHSX7R.js +1433 -0
  59. package/chunk-ELRRLDWI.js +478 -0
  60. package/chunk-EYEEHCU4.js +3066 -0
  61. package/chunk-G3SUCT4W.js +8 -0
  62. package/chunk-G5H7RNFL.js +807 -0
  63. package/chunk-GAKEBQD6.js +30 -0
  64. package/chunk-GBRG75BQ.js +86 -0
  65. package/chunk-GEKCOPTN.js +190 -0
  66. package/chunk-H2RMRZJE.js +113 -0
  67. package/chunk-H33743XH.js +25 -0
  68. package/chunk-HEIIIZBX.js +104 -0
  69. package/chunk-HNMXYYJR.js +12 -0
  70. package/chunk-IAXBCTTE.js +175 -0
  71. package/chunk-IDZTNRP2.js +85 -0
  72. package/chunk-IECI4YHR.js +421 -0
  73. package/chunk-ISNCLGUZ.js +146 -0
  74. package/chunk-IYQV26RA.js +138 -0
  75. package/chunk-JBTJAPUF.js +35 -0
  76. package/chunk-JZPBVBIY.js +94 -0
  77. package/chunk-KK6SWS5B.js +1078 -0
  78. package/chunk-KQHGZWSV.js +63 -0
  79. package/chunk-KTI2WDDG.js +24674 -0
  80. package/chunk-KUG52IAP.js +8 -0
  81. package/chunk-KX6YBIHG.js +8 -0
  82. package/chunk-LCBAMY2M.js +60 -0
  83. package/chunk-LM25IZBJ.js +902 -0
  84. package/chunk-LM6IYQ3F.js +16 -0
  85. package/chunk-M76ECQRD.js +13658 -0
  86. package/chunk-MRC4Q34M.js +188 -0
  87. package/chunk-NE3E3XJ2.js +936 -0
  88. package/chunk-NXZGF7F7.js +2878 -0
  89. package/chunk-OF5H3QWS.js +300 -0
  90. package/chunk-OLZBQWZU.js +6 -0
  91. package/chunk-OVGXXUVI.js +91 -0
  92. package/chunk-OWOHNGCN.js +50 -0
  93. package/chunk-PN7AFLOK.js +3401 -0
  94. package/chunk-QSJ3HFEF.js +8 -0
  95. package/chunk-QYXLLLGL.js +4519 -0
  96. package/chunk-ROWQEJRP.js +139 -0
  97. package/chunk-S7Z2HMCN.js +25 -0
  98. package/chunk-SL3EPWB4.js +1949 -0
  99. package/chunk-TDIQFT2F.js +301 -0
  100. package/chunk-TILFE6LV.js +381 -0
  101. package/chunk-U4TRT5V4.js +246 -0
  102. package/chunk-U6VC4MU4.js +8 -0
  103. package/chunk-UAD2WT54.js +64 -0
  104. package/chunk-USZDUWOV.js +191 -0
  105. package/chunk-USZMK5UT.js +105 -0
  106. package/chunk-UVPF33PW.js +46995 -0
  107. package/chunk-V2F4OGYM.js +9013 -0
  108. package/chunk-VEJLAVTC.js +2052 -0
  109. package/chunk-VF4K2QE6.js +21 -0
  110. package/chunk-VHBWHNVT.js +59 -0
  111. package/chunk-VIDPVFP3.js +20 -0
  112. package/chunk-VP4WJWKW.js +8882 -0
  113. package/chunk-VQ2AJRGD.js +148 -0
  114. package/chunk-W4NVOSFF.js +37 -0
  115. package/chunk-WWC7I6TA.js +8 -0
  116. package/chunk-X7W4TNB4.js +1550 -0
  117. package/chunk-XDVAYP26.js +537 -0
  118. package/chunk-XKIMRZO2.js +221 -0
  119. package/chunk-Y5GCAMGP.js +9 -0
  120. package/chunk-YD43KPCK.js +360 -0
  121. package/chunk-YIJFUVKA.js +34 -0
  122. package/chunk-Z4NR32XR.js +50 -0
  123. package/chunk-ZNFJWEN4.js +56 -0
  124. package/cliExecutor-DNE7TCC4.js +36 -0
  125. package/clipboardy-BVE3LVEH.js +12001 -0
  126. package/createAgentAutomationAction-3QTGNYJC.js +864 -0
  127. package/createDialogAction-5YX3ARBK.js +52 -0
  128. package/createPageAction-EQNQQRCW.js +169 -0
  129. package/db-HCJ5PRB5.js +271 -0
  130. package/dbSlice-C4UJLRZP.js +59 -0
  131. package/deleteFile-4SKGPHOZ.js +41 -0
  132. package/dialogCommands-AOQS23FV.js +59 -0
  133. package/dialogSlice-GZE3NCMC.js +146 -0
  134. package/docCreateCommands-GVOQVJON.js +215 -0
  135. package/docDeleteCommands-GEB7YAUZ.js +176 -0
  136. package/docReadCommands-XYKI2DF2.js +129 -0
  137. package/docStore-MLM5AME5.js +96 -0
  138. package/docUpdateCommands-4L3RAMHZ.js +313 -0
  139. package/fetchMessages-JOCYIFKL.js +16 -0
  140. package/getPricing-PWPJ6MNV.js +30 -0
  141. package/handleSendMessageAction-WG2GKTGZ.js +183 -0
  142. package/index.js +188 -113035
  143. package/localDialogRead-D3BELSTF.js +26 -0
  144. package/localFirstLog-DHNOY2NA.js +19 -0
  145. package/localRuntimeAuthority-TEGCOWX4.js +471 -0
  146. package/localRuntimeDb-LGDF6FQP.js +12 -0
  147. package/machineCommands-ZNXKLH6Q.js +774 -0
  148. package/machineInfo-M6KB6HZN.js +10 -0
  149. package/machineWsRunDispatch-7WRG6HNV.js +105 -0
  150. package/memoryCommands-O4MIPIWQ.js +476 -0
  151. package/models-XLEOET3E.js +9 -0
  152. package/offlineMarxistsAgentCommand-BCPJITJL.js +242 -0
  153. package/package.json +3 -25
  154. package/read-RIJCIVKX.js +17 -0
  155. package/readDocTool-GZD2N3LO.js +16 -0
  156. package/readlineWorkspace-AQURUDN4.js +5357 -0
  157. package/removeDialogAgentAction-CXLST3N6.js +72 -0
  158. package/runAgentClientLoop-VQUEKGA5.js +288 -0
  159. package/runtimeDoctorCommands-LRHLPDRC.js +289 -0
  160. package/setDialogExtraReferencesAction-LP6VYGU7.js +59 -0
  161. package/setPrimaryDialogAgentAction-D3GGH23T.js +79 -0
  162. package/settingSlice-J4I3Z5H7.js +198 -0
  163. package/skillSummaryMarker-42HKSXYY.js +9 -0
  164. package/slateToRenderMarkdown-Y5IYN73U.js +7 -0
  165. package/slateUtils-2M7MUTWX.js +19 -0
  166. package/spaceCommands-R2RXD5UY.js +450 -0
  167. package/spaceSlice-5UT4JNIN.js +145 -0
  168. package/streamAgentChatTurn-NRWSQKFN.js +4503 -0
  169. package/tableCommands-66XEWHAK.js +1286 -0
  170. package/toolApiClient-QI3YBNWB.js +26 -0
  171. package/tools-TNMUDDRK.js +83 -0
  172. package/understanding-HCSFPE7R.js +318 -0
  173. package/updateCommands-VOSPKXFF.js +31 -0
  174. package/updateDialogTitleAction-IXOKAVX3.js +185 -0
@@ -0,0 +1,206 @@
1
+ // packages/agent-runtime/modelLayerOverride.ts
2
+ var MODEL_LAYER_KEYS = [
3
+ "provider",
4
+ "model",
5
+ "apiSource",
6
+ "cliProvider",
7
+ "useServerProxy",
8
+ "apiKey",
9
+ "apiKeyRef",
10
+ "apiKeyHeader",
11
+ "customProviderUrl",
12
+ "credentialRef",
13
+ "credentialSynced",
14
+ "temperature",
15
+ "top_p",
16
+ "frequency_penalty",
17
+ "presence_penalty",
18
+ "max_tokens",
19
+ "reasoning_effort",
20
+ "enableThinking",
21
+ "thinkingBudget"
22
+ ];
23
+ function mergeReferences(base, extra) {
24
+ const safeBase = Array.isArray(base) ? base : [];
25
+ const safeExtra = Array.isArray(extra) ? extra : [];
26
+ const seen = /* @__PURE__ */ new Set();
27
+ const merged = [];
28
+ for (const item of [...safeBase, ...safeExtra]) {
29
+ const key = item?.dbKey;
30
+ if (key && seen.has(key)) continue;
31
+ if (key) seen.add(key);
32
+ if (item) merged.push(item);
33
+ }
34
+ return merged;
35
+ }
36
+ var asNonEmptyString = (value) => typeof value === "string" && value.trim().length > 0;
37
+ function buildModelLayerOverride(agent) {
38
+ if (!agent || !asNonEmptyString(agent.provider) || !asNonEmptyString(agent.model)) {
39
+ return null;
40
+ }
41
+ const override = {
42
+ provider: agent.provider,
43
+ model: agent.model
44
+ };
45
+ for (const key of MODEL_LAYER_KEYS) {
46
+ if (key === "provider" || key === "model") continue;
47
+ const value = agent[key];
48
+ if (value !== void 0) {
49
+ override[key] = value;
50
+ }
51
+ }
52
+ if (Array.isArray(agent.references) && agent.references.length > 0) {
53
+ override.references = agent.references;
54
+ }
55
+ return override;
56
+ }
57
+ function applyModelLayerOverride(base, override) {
58
+ const next = { ...base };
59
+ for (const key of MODEL_LAYER_KEYS) {
60
+ delete next[key];
61
+ }
62
+ for (const key of MODEL_LAYER_KEYS) {
63
+ const value = override[key];
64
+ if (value !== void 0) {
65
+ next[key] = value;
66
+ }
67
+ }
68
+ const merged = mergeReferences(
69
+ base.references,
70
+ override.references
71
+ );
72
+ if (merged.length > 0) {
73
+ next.references = merged;
74
+ } else {
75
+ delete next.references;
76
+ }
77
+ return next;
78
+ }
79
+
80
+ // packages/agent-runtime/turnContext.ts
81
+ var DEFAULT_RECENT_CONTENT_LIMIT = 10;
82
+ var asTrimmed = (value) => typeof value === "string" ? value.trim() : "";
83
+ var asFiniteNumber = (value) => typeof value === "number" && Number.isFinite(value) ? value : 0;
84
+ var spaceRecordKey = (spaceId) => spaceId.startsWith("space-") ? spaceId : `space-${spaceId}`;
85
+ var makeLayer = (id, content, cacheScope = "turn") => ({ id, owner: "runtime", cacheScope, content });
86
+ var renderSpaceStructure = (spaceRecord, recentLimit) => {
87
+ const categories = spaceRecord.categories ?? {};
88
+ const validCategories = Object.entries(categories).filter((entry) => entry[1] !== null).sort(
89
+ (a, b) => asFiniteNumber(a[1].order) - asFiniteNumber(b[1].order)
90
+ );
91
+ const categoryNameById = /* @__PURE__ */ new Map();
92
+ let struct = "Directory Structure (Categories):\n";
93
+ if (validCategories.length === 0) struct += "(No categories defined)\n";
94
+ validCategories.forEach(([id, category]) => {
95
+ const name = asTrimmed(category.name) || id;
96
+ categoryNameById.set(id, name);
97
+ struct += `- ${name} (ID: ${id})
98
+ `;
99
+ });
100
+ const contents = spaceRecord.contents ?? {};
101
+ const recentContents = recentLimit > 0 ? Object.values(contents).filter((content) => content !== null).sort(
102
+ (a, b) => asFiniteNumber(b.updatedAt) - asFiniteNumber(a.updatedAt)
103
+ ).slice(0, recentLimit) : [];
104
+ if (recentContents.length > 0) {
105
+ struct += `
106
+ Recent Contents (Top ${recentLimit}):
107
+ `;
108
+ recentContents.forEach((content) => {
109
+ const categoryId = asTrimmed(content.categoryId);
110
+ const categoryName = categoryId ? categoryNameById.get(categoryId) || "Unknown" : "Uncategorized";
111
+ struct += `- [${asTrimmed(content.type) || "content"}] ${asTrimmed(content.title)} (Category: ${categoryName}, dbKey: ${asTrimmed(content.contentKey)})
112
+ `;
113
+ });
114
+ }
115
+ return struct;
116
+ };
117
+ var buildSpaceContextLayer = async (args) => {
118
+ const spaceId = asTrimmed(args.spaceId);
119
+ if (!spaceId) return null;
120
+ const recentLimit = args.recentContentLimit ?? DEFAULT_RECENT_CONTENT_LIMIT;
121
+ let spaceRecord = null;
122
+ let readError = null;
123
+ try {
124
+ spaceRecord = await args.source.readRecord(spaceRecordKey(spaceId));
125
+ } catch (error) {
126
+ readError = error instanceof Error ? error.message : String(error);
127
+ }
128
+ if (!spaceRecord) {
129
+ return makeLayer(
130
+ "space-context",
131
+ [
132
+ "--- \u5F53\u524D\u7A7A\u95F4\uFF08Space\uFF09---",
133
+ `\u672C\u5BF9\u8BDD\u8BB0\u5F55\u58F0\u660E\u5C5E\u4E8E Space ${spaceId}\uFF0C\u4F46\u5F53\u524D\u65E0\u6CD5\u8BFB\u53D6\u8BE5 Space \u7684\u6570\u636E${readError ? `\uFF08${readError}\uFF09` : "\uFF08\u8BB0\u5F55\u4E0D\u5B58\u5728\u6216\u4E0D\u53EF\u8FBE\uFF09"}\u3002`,
134
+ "\u5982\u88AB\u95EE\u53CA\uFF0C\u8BF7\u5982\u5B9E\u8BF4\u660E\u300C\u5BF9\u8BDD\u5C5E\u4E8E\u8BE5 Space \u4F46\u6682\u65F6\u8BFB\u4E0D\u5230\u7A7A\u95F4\u8BE6\u60C5\u300D\uFF0C\u4E0D\u8981\u58F0\u79F0\u5BF9\u8BDD\u4E0D\u5C5E\u4E8E\u4EFB\u4F55\u7A7A\u95F4\u3002"
135
+ ].join("\n")
136
+ );
137
+ }
138
+ const name = asTrimmed(spaceRecord.name);
139
+ const description = asTrimmed(spaceRecord.description);
140
+ const structure = renderSpaceStructure(spaceRecord, recentLimit);
141
+ return makeLayer(
142
+ "space-context",
143
+ [
144
+ "--- \u5F53\u524D\u7A7A\u95F4\uFF08Space\uFF09---",
145
+ "\u672C\u5BF9\u8BDD\u5C5E\u4E8E\u4EE5\u4E0B Space\uFF1A",
146
+ `Space Title: ${name || spaceId}`,
147
+ `Space ID: ${spaceId}`,
148
+ `Description: ${description || "N/A"}`,
149
+ "",
150
+ structure.trimEnd()
151
+ ].join("\n")
152
+ );
153
+ };
154
+ var buildSkillDiscoveryLayer = (skills, boundFolder) => {
155
+ if (skills.length === 0) return null;
156
+ const lines = [
157
+ "--- \u53EF\u7528\u6280\u80FD\uFF08Skills\uFF09---",
158
+ `\u5DE5\u4F5C\u533A ${boundFolder} \u4E2D\u53D1\u73B0\u4E86 ${skills.length} \u4E2A\u6280\u80FD\uFF08SKILL.md\uFF09\uFF1A`,
159
+ "\u6A21\u578B\u53EF\u6309\u9700\u7528 readFile \u8BFB\u53D6\u4EE5\u4E0B\u6587\u4EF6\u83B7\u53D6\u8BE6\u7EC6\u6307\u4EE4\uFF1A",
160
+ "",
161
+ ...skills.map(
162
+ (s) => `- ${s.name}: ${s.description}
163
+ path: ${s.relativePath}`
164
+ )
165
+ ];
166
+ return makeLayer("skill-discovery", lines.join("\n"));
167
+ };
168
+ var buildLinkedSpacesSection = async (args) => {
169
+ const ids = (args.linkedSpaceIds ?? []).filter(
170
+ (id) => typeof id === "string" && id.trim() !== ""
171
+ );
172
+ if (ids.length === 0) return null;
173
+ const lines = [];
174
+ for (const rawId of ids) {
175
+ const spaceId = asTrimmed(rawId);
176
+ let spaceData = null;
177
+ try {
178
+ spaceData = await args.source.readRecord(spaceRecordKey(spaceId));
179
+ } catch {
180
+ spaceData = null;
181
+ }
182
+ if (spaceData) {
183
+ const name = asTrimmed(spaceData.name) || spaceId;
184
+ const desc = asTrimmed(spaceData.description);
185
+ lines.push(`- ${name} (ID: ${spaceId})${desc ? `: ${desc}` : ""}`);
186
+ } else {
187
+ lines.push(`- [\u65E0\u6CD5\u8BBF\u95EE] ${spaceId}`);
188
+ }
189
+ }
190
+ if (lines.length === 0) return null;
191
+ return [
192
+ "--- \u5173\u8054\u7A7A\u95F4 (Linked Spaces) ---",
193
+ "\u4EE5\u4E0B\u662F Agent \u53EF\u8BBF\u95EE\u7684\u5176\u4ED6\u5DE5\u4F5C\u7A7A\u95F4\uFF08\u7C97\u7565\u4E0A\u4E0B\u6587\uFF09\uFF1A",
194
+ lines.join("\n"),
195
+ "",
196
+ "\u63D0\u793A\uFF1A\u5982\u9700\u67E5\u8BE2\u8FD9\u4E9B\u7A7A\u95F4\u7684\u8BE6\u7EC6\u5185\u5BB9\uFF0C\u53EF\u4F7F\u7528 read \u5DE5\u5177\u914D\u5408\u5BF9\u5E94\u7684 dbKey\u3002"
197
+ ].join("\n");
198
+ };
199
+
200
+ export {
201
+ buildModelLayerOverride,
202
+ applyModelLayerOverride,
203
+ buildSpaceContextLayer,
204
+ buildSkillDiscoveryLayer,
205
+ buildLinkedSpacesSection
206
+ };
@@ -0,0 +1,34 @@
1
+ // packages/ai/llm/imagePricing.ts
2
+ var DEFAULT_IMAGE_SIZE = "1K";
3
+ var DEFAULT_IMAGE_QUALITY = "medium";
4
+ var hasEstimateForSize = (tokenEstimates, size) => typeof tokenEstimates[size] !== "undefined";
5
+ var resolveTokenEstimate = (estimate, requestedQuality) => {
6
+ if (typeof estimate === "number") return estimate;
7
+ if (!estimate) return void 0;
8
+ const quality = requestedQuality && typeof estimate[requestedQuality] === "number" ? requestedQuality : DEFAULT_IMAGE_QUALITY;
9
+ return estimate[quality];
10
+ };
11
+ var getApproxPricePerImage = (model, requestedSize, requestedQuality) => {
12
+ if (!model) return void 0;
13
+ if (typeof model.pricePerImage === "number") {
14
+ return model.pricePerImage;
15
+ }
16
+ if (typeof model.imageTokenPricePerMillion !== "number") {
17
+ return void 0;
18
+ }
19
+ const tokenEstimates = model.imageOutputTokenEstimateBySize;
20
+ if (!tokenEstimates) return void 0;
21
+ const resolvedSize = requestedSize && hasEstimateForSize(tokenEstimates, requestedSize) ? requestedSize : DEFAULT_IMAGE_SIZE;
22
+ const outputTokens = resolveTokenEstimate(
23
+ tokenEstimates[resolvedSize],
24
+ requestedQuality
25
+ );
26
+ if (typeof outputTokens !== "number") {
27
+ return void 0;
28
+ }
29
+ return model.imageTokenPricePerMillion * outputTokens / 1e6;
30
+ };
31
+
32
+ export {
33
+ getApproxPricePerImage
34
+ };
@@ -0,0 +1,27 @@
1
+ // packages/agent-runtime/staleReplayGuard.ts
2
+ var wrapHistoricalSummaryWithReplayGuard = (summary) => {
3
+ const trimmed = summary.trim();
4
+ if (!trimmed) return "";
5
+ return [
6
+ "\u3010\u5386\u53F2\u53C2\u8003\uFF0C\u975E\u6D3B\u6307\u4EE4\u3011",
7
+ "\u4EE5\u4E0B\u662F\u5148\u524D\u5BF9\u8BDD\u7684\u51BB\u7ED3\u6458\u8981\uFF0C\u4E0D\u662F\u5F53\u524D\u4F1A\u8BDD\u7684\u6D3B\u6307\u4EE4\u3002",
8
+ "\u5176\u4E2D\u7684\u4EFB\u52A1\u63CF\u8FF0\u3001skill \u8C03\u7528\u3001ARGUMENTS \u8F7D\u8377\u9ED8\u8BA4\u5DF2\u8FC7\u671F\uFF08STALE-BY-DEFAULT\uFF09\uFF0C",
9
+ "\u5728\u6CA1\u6709\u5F53\u524D\u4F1A\u8BDD\u663E\u5F0F\u7528\u6237\u8BF7\u6C42\u65F6\u4E0D\u5F97\u91CD\u65B0\u6267\u884C\uFF1B\u6267\u884C\u524D\u5148\u5BF9\u7167\u5B9E\u9645\u5DE5\u4F5C\u72B6\u6001\u786E\u8BA4\u3002",
10
+ "",
11
+ "--- \u5386\u53F2\u6458\u8981\u5F00\u59CB ---",
12
+ trimmed,
13
+ "--- \u5386\u53F2\u6458\u8981\u7ED3\u675F ---"
14
+ ].join("\n");
15
+ };
16
+
17
+ // packages/agent-runtime/memoryUseGuidance.ts
18
+ var MEMORY_USE_GUIDANCE = `--- \u8BB0\u5FC6\u4F7F\u7528\u65B9\u5F0F ---
19
+ - \u8BB0\u5FC6\u662F\u4E2A\u6027\u5316\u589E\u5F3A\u5C42\uFF1B\u5F53\u524D\u8F93\u5165/\u5BF9\u8BDD/\u7CFB\u7EDF\u89C4\u5219/Agent prompt/skill/\u7528\u6237\u5168\u5C40\u504F\u597D\u90FD\u4F18\u5148\u4E8E\u5B83\u3002\u5F53\u524D\u8F93\u5165\u7ED9\u51FA\u65B0\u8BED\u8A00\u3001\u6280\u672F\u6808\u3001\u6570\u503C\u3001\u7EA6\u675F\u6216\u660E\u786E\u8986\u76D6\u65E7\u504F\u597D\u65F6\uFF0C\u91C7\u7528\u5F53\u524D\u8F93\u5165\uFF0C\u4E0D\u8981\u628A\u65E7\u8BB0\u5FC6\u5F53\u66F4\u9AD8\u771F\u503C\u3002
20
+ - \u8BB0\u5FC6\u542B\u7528\u6237\u8EAB\u4EFD/\u79F0\u547C/\u5173\u7CFB/\u957F\u671F\u504F\u597D/\u9879\u76EE\u80CC\u666F\u65F6\uFF0C\u76F8\u5173\u5904\u81EA\u7136\u4F53\u73B0\uFF08\u5F00\u573A\u79F0\u547C\u3001\u4E0A\u4E0B\u6587\u786E\u8BA4\u3001\u56DE\u7B54\u7ED3\u6784\u3001\u53D6\u820D\u6807\u51C6\uFF09\uFF0C\u4E0D\u8981\u6BCF\u53E5\u673A\u68B0\u79F0\u547C\u7528\u6237\u3002
21
+ - \u201C\u4E0A\u6B21/\u7EE7\u7EED/\u8FD9\u4E2A\u9879\u76EE\u201D\u7B49\u6307\u4EE3\u4F18\u5148\u6309\u5F53\u524D dialog/space/project/agent/sourceDialog \u7B49 KV \u8DEF\u5F84\u548C\u65F6\u95F4\u7EBF\u5B9A\u4F4D\uFF0C\u4E0D\u8981\u53EA\u6309\u8BED\u4E49\u76F8\u4F3C\u5EA6\u635E\u4E00\u6761\u3002
22
+ - \u63A8\u65AD\u578B\u8BB0\u5FC6\u53EA\u7528\u4E8E\u628A\u63E1\u8BED\u6C14\u3001\u72B6\u6001\u548C\u672A\u5B8C\u6210\u4E8B\u9879\uFF0C\u4E0D\u8981\u8BF4\u6210\u201C\u4F60\u660E\u786E\u544A\u8BC9\u8FC7\u6211\u201D\u6216\u5F53\u6210\u7528\u6237\u5DF2\u6388\u6743\u4FDD\u5B58\u7684\u4E8B\u5B9E\u3002\u51B2\u7A81\u6216\u573A\u666F\u4E0D\u660E\u65F6\u8BF4\u660E\u4F9D\u636E\u6216\u7B80\u77ED\u786E\u8BA4\uFF0C\u4E0D\u8981\u786C\u5957\u3002`;
23
+
24
+ export {
25
+ wrapHistoricalSummaryWithReplayGuard,
26
+ MEMORY_USE_GUIDANCE
27
+ };
@@ -0,0 +1,30 @@
1
+ // packages/core/prefix.ts
2
+ var extractKeyPart = (key, index) => {
3
+ const parts = key.split("-");
4
+ if (index < 2) {
5
+ return parts[index];
6
+ }
7
+ return parts.slice(index).join("-");
8
+ };
9
+ var extractUserId = (key) => {
10
+ const parts = key.split("-");
11
+ if (parts.length === 2) {
12
+ return parts[0];
13
+ }
14
+ if (parts[0] === "user" && parts[1] === "pref" && parts.length >= 3) {
15
+ return parts[2];
16
+ }
17
+ return extractKeyPart(key, 1);
18
+ };
19
+ var extractCustomId = (key) => {
20
+ if (key.startsWith("dialog-") && !key.includes("-msg-")) {
21
+ const lastDash = key.lastIndexOf("-");
22
+ return lastDash >= 0 ? key.slice(lastDash + 1) : key;
23
+ }
24
+ return extractKeyPart(key, 2);
25
+ };
26
+
27
+ export {
28
+ extractUserId,
29
+ extractCustomId
30
+ };
@@ -0,0 +1,8 @@
1
+ // packages/core/compactWhitespace.ts
2
+ function compactWhitespace(value) {
3
+ return value.replace(/\s+/g, " ").trim();
4
+ }
5
+
6
+ export {
7
+ compactWhitespace
8
+ };
@@ -0,0 +1,231 @@
1
+ import {
2
+ LOCAL_CODEX_AGENT_KEY,
3
+ isLocalCliAgentKey,
4
+ resolveCliAgentKeyInput
5
+ } from "./chunk-VHBWHNVT.js";
6
+ import {
7
+ DEFAULT_NOLO_SERVER_URL
8
+ } from "./chunk-OLZBQWZU.js";
9
+ import {
10
+ asTrimmedLowercaseString
11
+ } from "./chunk-QSJ3HFEF.js";
12
+ import {
13
+ normalizeServerOrigin
14
+ } from "./chunk-CF7PE763.js";
15
+
16
+ // packages/cli/agentRunArgs.ts
17
+ import { readFileSync } from "node:fs";
18
+ function readFlagValue(args, flag) {
19
+ const index = args.indexOf(flag);
20
+ if (index < 0) return void 0;
21
+ return args[index + 1];
22
+ }
23
+ function readRepeatedFlagValues(args, flag) {
24
+ const values = [];
25
+ for (let index = 0; index < args.length; index += 1) {
26
+ if (args[index] === flag && args[index + 1]) {
27
+ values.push(args[index + 1]);
28
+ index += 1;
29
+ }
30
+ }
31
+ return values;
32
+ }
33
+ function runtimeModeFromArgs(args) {
34
+ if (args.includes("--local")) return "local";
35
+ if (args.includes("--server")) return "server";
36
+ if (args.includes("--auto")) return "auto";
37
+ return void 0;
38
+ }
39
+ function isFullstackCodingAgentRef(raw, resolved) {
40
+ const normalized = asTrimmedLowercaseString(raw);
41
+ return normalized === "fullstack" || normalized === "full-stack" || normalized === "nolo-fullstack" || normalized === "\u5168\u6808" || normalized === "nolo \u5168\u6808\u5DE5\u7A0B\u5E08" || resolved === "fullstack";
42
+ }
43
+ function parsePositiveInteger(value) {
44
+ if (!value) return void 0;
45
+ const parsed = Number(value);
46
+ if (!Number.isFinite(parsed) || parsed <= 0) return void 0;
47
+ return Math.floor(parsed);
48
+ }
49
+ function parseSubjectRef(raw) {
50
+ const value = raw.trim();
51
+ if (!value) return null;
52
+ const firstColon = value.indexOf(":");
53
+ if (firstColon <= 0 || firstColon === value.length - 1) return null;
54
+ const kind = value.slice(0, firstColon).trim();
55
+ const rest = value.slice(firstColon + 1).trim();
56
+ const lastColon = rest.lastIndexOf(":");
57
+ const id = lastColon > 0 ? rest.slice(0, lastColon).trim() : rest;
58
+ const role = lastColon > 0 ? rest.slice(lastColon + 1).trim() : "";
59
+ if (!kind || !id) return null;
60
+ return { kind, id, ...role ? { role } : {} };
61
+ }
62
+ var VALUELESS_FLAGS = {
63
+ "--local": true,
64
+ "--server": true,
65
+ "--auto": true,
66
+ "--dangerously-allow-shell": true,
67
+ "--trace-tools": true,
68
+ "--bg": true,
69
+ "--no-stream": true,
70
+ "--debug": true,
71
+ "--ephemeral": true,
72
+ "--memory-only": true
73
+ };
74
+ function isValuelessFlag(arg) {
75
+ return Object.prototype.hasOwnProperty.call(VALUELESS_FLAGS, arg);
76
+ }
77
+ function positionalArgs(args) {
78
+ const values = [];
79
+ for (let index = 0; index < args.length; index += 1) {
80
+ const arg = args[index];
81
+ if (isValuelessFlag(arg)) continue;
82
+ if (arg.startsWith("--")) {
83
+ index += 1;
84
+ continue;
85
+ }
86
+ values.push(arg);
87
+ }
88
+ return values;
89
+ }
90
+ function resolveRawAgentInput(args, commandPath) {
91
+ const positional = positionalArgs(args);
92
+ const isNoLogin = (commandPath?.join(" ") === "run" || commandPath?.join(" ") === "chat") && !readFlagValue(args, "--agent");
93
+ return readFlagValue(args, "--agent") ?? (isNoLogin ? LOCAL_CODEX_AGENT_KEY : positional[0]);
94
+ }
95
+ function parseDialogReference(rawInput) {
96
+ const normalized = rawInput.trim();
97
+ if (normalized.startsWith("dialog-")) {
98
+ const parts = normalized.split("-");
99
+ return {
100
+ dialogKey: normalized,
101
+ dialogId: parts.at(-1) ?? normalized
102
+ };
103
+ }
104
+ const dialogMatch = normalized.match(/dialog-([a-zA-Z0-9]+)-([a-zA-Z0-9]+)/);
105
+ if (dialogMatch) {
106
+ return {
107
+ dialogKey: `dialog-${dialogMatch[1]}-${dialogMatch[2]}`,
108
+ dialogId: dialogMatch[2]
109
+ };
110
+ }
111
+ return {
112
+ dialogId: normalized
113
+ };
114
+ }
115
+ function resolveServerUrl(env) {
116
+ return normalizeServerOrigin(
117
+ env.NOLO_SERVER || env.BASE_URL || DEFAULT_NOLO_SERVER_URL
118
+ );
119
+ }
120
+ function buildLocalRunEnv(args) {
121
+ void args.allowShell;
122
+ return {
123
+ ...args.env
124
+ };
125
+ }
126
+ function writeUsage(output, commandPath) {
127
+ const commandName = commandPath?.join(" ");
128
+ if (commandName === "run") {
129
+ output.write(
130
+ "Usage: nolo run <message> [--cwd <path>] [--timeout-ms <n>] [--events jsonl]\n nolo run --msg <message> [--cwd <path>] [--image <url-or-path>] [--timeout-ms <n>]\nRuns local Codex in the current workspace; no Nolo login required.\n"
131
+ );
132
+ return;
133
+ }
134
+ if (commandName === "chat") {
135
+ output.write(
136
+ "Usage: nolo chat <message> [--cwd <path>] [--events jsonl]\n nolo chat --agent <agent> (--msg <message>|--msg-file <path>) [--local|--server|--auto]\nWithout --agent, this uses local Codex in the current workspace; no Nolo login required.\n"
137
+ );
138
+ return;
139
+ }
140
+ output.write(
141
+ "Usage: nolo agent run <agent> <message> [--local|--server|--auto] [--ephemeral|--memory-only] [--continue <dialogId>] [--cwd <path>]\n nolo agent run --agent <agent> (--msg <message>|--msg-file <path>) [--image <url-or-path>] [--space <spaceId>] [--category <name>] [--inherit-from-dialog <dialog>] [--parent-dialog <dialog>] [--subject-dialog <dialog>] [--subject-ref <kind:id[:role]>] [--task-row-dbkey <key>] [--allowed-child-agent <agent>] [--fallback-agent <agent>] (suggestions for agent to decide on quota) [--allowed-tool <tool>] [--blocked-tool <tool>] [--bg] [--timeout-ms <n>] [--events jsonl] [--no-stream] [--skill <dbKey-or-md-path>]\n"
142
+ );
143
+ }
144
+ function parseAgentRunArgs(args, options = {}) {
145
+ const positional = positionalArgs(args);
146
+ const isNoLoginRunShorthand = (options.commandPath?.join(" ") === "run" || options.commandPath?.join(" ") === "chat") && !readFlagValue(args, "--agent");
147
+ const rawAgentKey = readFlagValue(args, "--agent") ?? (isNoLoginRunShorthand ? LOCAL_CODEX_AGENT_KEY : positional[0]);
148
+ const agentKey = rawAgentKey ? resolveCliAgentKeyInput(rawAgentKey) : void 0;
149
+ const explicitMsg = readFlagValue(args, "--msg");
150
+ const msgFile = readFlagValue(args, "--msg-file");
151
+ const fileMessage = msgFile ? (options.readTextFile ?? ((path) => readFileSync(path, "utf8")))(msgFile) : void 0;
152
+ const rawMessage = explicitMsg ?? fileMessage ?? positional.slice(isNoLoginRunShorthand ? 0 : 1).join(" ");
153
+ if (!agentKey || !rawMessage.trim()) return null;
154
+ const message = rawMessage.trim();
155
+ const runtimeMode = runtimeModeFromArgs(args);
156
+ const continueDialogId = readFlagValue(args, "--continue") ?? readFlagValue(args, "--dialog");
157
+ const spaceId = readFlagValue(args, "--space");
158
+ const category = readFlagValue(args, "--category");
159
+ const inheritedFromDialog = readFlagValue(args, "--inherit-from-dialog");
160
+ const subjectDialog = readFlagValue(args, "--subject-dialog") ?? readFlagValue(args, "--reference-dialog");
161
+ const subjectDialogKey = subjectDialog?.trim();
162
+ const subjectRefs = readRepeatedFlagValues(args, "--subject-ref").map(parseSubjectRef).filter((ref) => Boolean(ref));
163
+ const allowedChildAgentKeys = readRepeatedFlagValues(args, "--allowed-child-agent").map((value) => resolveCliAgentKeyInput(value.trim())).filter(Boolean);
164
+ const fallbackAgentKeys = readRepeatedFlagValues(args, "--fallback-agent").map((value) => resolveCliAgentKeyInput(value.trim())).filter(Boolean);
165
+ const allowedToolNames = readRepeatedFlagValues(args, "--allowed-tool").map((value) => value.trim()).filter(Boolean);
166
+ const cwd = readFlagValue(args, "--cwd");
167
+ const timeoutMs = parsePositiveInteger(readFlagValue(args, "--timeout-ms"));
168
+ const rawEventsMode = readFlagValue(args, "--events");
169
+ const eventsMode = rawEventsMode === "jsonl" ? "jsonl" : void 0;
170
+ const inheritedRef = inheritedFromDialog ? parseDialogReference(inheritedFromDialog) : void 0;
171
+ const explicitLocalCliAgentDefault = isLocalCliAgentKey(agentKey) && runtimeMode !== "server";
172
+ const explicitParentDialog = readFlagValue(args, "--parent-dialog");
173
+ const parentDialogRef = explicitParentDialog ? parseDialogReference(explicitParentDialog) : void 0;
174
+ const blockedToolNames = readRepeatedFlagValues(args, "--blocked-tool").map((value) => value.trim()).filter(Boolean);
175
+ const imageUrls = [
176
+ ...readRepeatedFlagValues(args, "--image"),
177
+ ...readRepeatedFlagValues(args, "--image-url")
178
+ ];
179
+ const fullstackLocalWorkspaceDefault = isFullstackCodingAgentRef(rawAgentKey, agentKey) && runtimeMode !== "server";
180
+ const ephemeral = args.includes("--ephemeral") || args.includes("--memory-only");
181
+ const workflowRef = readFlagValue(args, "--workflow");
182
+ const skillRefs = readRepeatedFlagValues(args, "--skill").map((v) => v.trim()).filter(Boolean);
183
+ const taskRowDbKey = readFlagValue(args, "--task-row-dbkey");
184
+ const artifactIds = readFlagValue(args, "--artifact-ids")?.split(",").map((item) => item.trim()).filter(Boolean);
185
+ return {
186
+ agentKey,
187
+ message,
188
+ imageUrls,
189
+ allowShell: args.includes("--dangerously-allow-shell") || fullstackLocalWorkspaceDefault || explicitLocalCliAgentDefault,
190
+ traceTools: args.includes("--trace-tools"),
191
+ ephemeral,
192
+ ...eventsMode ? { eventsMode } : {},
193
+ injectFeatureWorktreeInstruction: fullstackLocalWorkspaceDefault,
194
+ ...workflowRef ? { workflowRef } : {},
195
+ ...skillRefs.length ? { skillRefs } : {},
196
+ ...taskRowDbKey ? {
197
+ taskEvidence: {
198
+ rowDbKey: taskRowDbKey,
199
+ ...artifactIds?.length ? { artifactIds } : {}
200
+ }
201
+ } : {},
202
+ ...runtimeMode ? { runtimeMode } : fullstackLocalWorkspaceDefault || explicitLocalCliAgentDefault || args.includes("--dangerously-allow-shell") ? { runtimeMode: "local" } : {},
203
+ background: args.includes("--bg"),
204
+ noStream: args.includes("--no-stream"),
205
+ ...continueDialogId ? { continueDialogId } : {},
206
+ ...!continueDialogId && spaceId ? { spaceId } : {},
207
+ ...category ? { category } : {},
208
+ ...inheritedRef?.dialogKey ? { inheritedFromDialogKey: inheritedRef.dialogKey } : {},
209
+ ...parentDialogRef?.dialogId || inheritedRef?.dialogId ? { parentDialogId: parentDialogRef?.dialogId ?? inheritedRef?.dialogId } : {},
210
+ ...parentDialogRef?.dialogId ? { parentWakeOnTerminal: true } : {},
211
+ ...subjectDialogKey ? { subjectDialogKey } : {},
212
+ ...subjectRefs.length ? { subjectRefs } : {},
213
+ ...allowedChildAgentKeys.length ? { allowedChildAgentKeys } : {},
214
+ ...fallbackAgentKeys.length ? { fallbackAgentKeys } : {},
215
+ ...allowedToolNames.length ? { allowedToolNames } : {},
216
+ ...cwd ? { cwd } : {},
217
+ ...blockedToolNames.length ? { blockedToolNames } : {},
218
+ ...typeof timeoutMs === "number" ? { timeoutMs } : {}
219
+ };
220
+ }
221
+
222
+ export {
223
+ readFlagValue,
224
+ isFullstackCodingAgentRef,
225
+ positionalArgs,
226
+ resolveRawAgentInput,
227
+ resolveServerUrl,
228
+ buildLocalRunEnv,
229
+ writeUsage,
230
+ parseAgentRunArgs
231
+ };