nolo-cli 0.6.1 → 0.8.0-alpha.10

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 (175) hide show
  1. package/_executeModel-CPDNUUQV.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-OSUMJMZM.js +323 -0
  6. package/agentEmailCommands-OQTJIPQU.js +621 -0
  7. package/agentListCommands-FATQEUYT.js +219 -0
  8. package/agentMachineCommands-6LZWF4GL.js +421 -0
  9. package/agentPullCommand-O2MTUAFR.js +122 -0
  10. package/agentRecordCommands-TIHFU65Z.js +89 -0
  11. package/agentRunCommand-R64Y3HCH.js +102 -0
  12. package/agentRunControl-K4VKNEHF.js +57 -0
  13. package/agentRuntimeLocal-6PIWAHLQ.js +99 -0
  14. package/agentSlice-TP4VARJF.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-2MALU52L.js +51 -0
  20. package/chunk-2TPUKEU7.js +1078 -0
  21. package/chunk-3ASDTTEI.js +1774 -0
  22. package/chunk-3EUW3WEO.js +8 -0
  23. package/chunk-3LY4F7SV.js +9293 -0
  24. package/chunk-4CQLVGRV.js +50 -0
  25. package/chunk-4IJYA27C.js +342 -0
  26. package/chunk-4SN6J65J.js +38 -0
  27. package/chunk-4VNS5WPM.js +42 -0
  28. package/chunk-572EKYLF.js +792 -0
  29. package/chunk-5MIDPSSK.js +206 -0
  30. package/chunk-5MMAK75Q.js +15 -0
  31. package/chunk-5VV37AT4.js +222 -0
  32. package/chunk-63W5N6P3.js +150 -0
  33. package/chunk-6A5EF6IR.js +929 -0
  34. package/chunk-6HYVJV7B.js +102 -0
  35. package/chunk-6P2WX5IA.js +3631 -0
  36. package/chunk-6WD3OOJS.js +20 -0
  37. package/chunk-ATNTHIZI.js +13 -0
  38. package/chunk-AUGHVUFE.js +69 -0
  39. package/chunk-AVMKZHBC.js +85 -0
  40. package/chunk-AZPCASRE.js +36 -0
  41. package/chunk-BNMT7YY5.js +34 -0
  42. package/chunk-BR2WP3DF.js +548 -0
  43. package/chunk-BSTNFPHD.js +231 -0
  44. package/chunk-BU4OPIXC.js +171 -0
  45. package/chunk-CF2WZF4N.js +134 -0
  46. package/chunk-CF7PE763.js +10 -0
  47. package/chunk-CKOJQDKR.js +198 -0
  48. package/chunk-CM54RSSA.js +206 -0
  49. package/chunk-CWMSB67P.js +34 -0
  50. package/chunk-DA2OEKS6.js +27 -0
  51. package/chunk-DFFIZ25G.js +30 -0
  52. package/chunk-DWLEOOGR.js +8 -0
  53. package/chunk-DZ3XJVET.js +231 -0
  54. package/chunk-EHLHSX7R.js +1433 -0
  55. package/chunk-ELRRLDWI.js +478 -0
  56. package/chunk-EYEEHCU4.js +3066 -0
  57. package/chunk-FQZWM5YX.js +628 -0
  58. package/chunk-G3SUCT4W.js +8 -0
  59. package/chunk-G5H7RNFL.js +807 -0
  60. package/chunk-GAKEBQD6.js +30 -0
  61. package/chunk-GBRG75BQ.js +86 -0
  62. package/chunk-H2RMRZJE.js +113 -0
  63. package/chunk-H33743XH.js +25 -0
  64. package/chunk-HD63YREL.js +19 -0
  65. package/chunk-HEIIIZBX.js +104 -0
  66. package/chunk-HNMXYYJR.js +12 -0
  67. package/chunk-HOMYP7GZ.js +2152 -0
  68. package/chunk-HZFOMJRA.js +4300 -0
  69. package/chunk-IAXBCTTE.js +175 -0
  70. package/chunk-IDZTNRP2.js +85 -0
  71. package/chunk-IHHA5Y2S.js +9013 -0
  72. package/chunk-ISNCLGUZ.js +146 -0
  73. package/chunk-IYQV26RA.js +138 -0
  74. package/chunk-J4576WMJ.js +91 -0
  75. package/chunk-JBTJAPUF.js +35 -0
  76. package/chunk-JZPBVBIY.js +94 -0
  77. package/chunk-KQHGZWSV.js +63 -0
  78. package/chunk-KUG52IAP.js +8 -0
  79. package/chunk-KX6YBIHG.js +8 -0
  80. package/chunk-LCBAMY2M.js +60 -0
  81. package/chunk-LM25IZBJ.js +902 -0
  82. package/chunk-LM6IYQ3F.js +16 -0
  83. package/chunk-M76ECQRD.js +13658 -0
  84. package/chunk-MRC4Q34M.js +188 -0
  85. package/chunk-NEMRK4EK.js +944 -0
  86. package/chunk-NXZGF7F7.js +2878 -0
  87. package/chunk-OF5H3QWS.js +300 -0
  88. package/chunk-OLZBQWZU.js +6 -0
  89. package/chunk-OOYVBFM7.js +191 -0
  90. package/chunk-OWOHNGCN.js +50 -0
  91. package/chunk-PN7AFLOK.js +3401 -0
  92. package/chunk-POCFIDGQ.js +562 -0
  93. package/chunk-Q6WACBKB.js +1949 -0
  94. package/chunk-QFV2OAIM.js +421 -0
  95. package/chunk-QJ6V2NIN.js +1447 -0
  96. package/chunk-QSJ3HFEF.js +8 -0
  97. package/chunk-QUWDTOUP.js +190 -0
  98. package/chunk-QYXLLLGL.js +4519 -0
  99. package/chunk-ROWQEJRP.js +139 -0
  100. package/chunk-S7Z2HMCN.js +25 -0
  101. package/chunk-TDIQFT2F.js +301 -0
  102. package/chunk-TILFE6LV.js +381 -0
  103. package/chunk-TKOUBWBO.js +24674 -0
  104. package/chunk-TYH5JE6N.js +27158 -0
  105. package/chunk-U4TRT5V4.js +246 -0
  106. package/chunk-U6VC4MU4.js +8 -0
  107. package/chunk-UAD2WT54.js +64 -0
  108. package/chunk-USZMK5UT.js +105 -0
  109. package/chunk-VEJLAVTC.js +2052 -0
  110. package/chunk-VF4K2QE6.js +21 -0
  111. package/chunk-VHBWHNVT.js +59 -0
  112. package/chunk-VIDPVFP3.js +20 -0
  113. package/chunk-VP4WJWKW.js +8882 -0
  114. package/chunk-VQ2AJRGD.js +148 -0
  115. package/chunk-W4NVOSFF.js +37 -0
  116. package/chunk-WWC7I6TA.js +8 -0
  117. package/chunk-X7W4TNB4.js +1550 -0
  118. package/chunk-XDVAYP26.js +537 -0
  119. package/chunk-XKIMRZO2.js +221 -0
  120. package/chunk-Y5GCAMGP.js +9 -0
  121. package/chunk-YWPXYBY7.js +360 -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-KLKS2HGU.js +864 -0
  127. package/createDialogAction-Z33JMBF5.js +52 -0
  128. package/createPageAction-AQVNOAAI.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-W5PD6MZU.js +59 -0
  133. package/dialogSlice-RBJYVSAR.js +146 -0
  134. package/docCreateCommands-MM34S4Z3.js +215 -0
  135. package/docDeleteCommands-JJTU722V.js +176 -0
  136. package/docReadCommands-GLYDMCTU.js +129 -0
  137. package/docStore-5TYME4DO.js +96 -0
  138. package/docUpdateCommands-ZCGQ7URR.js +313 -0
  139. package/fetchMessages-JOCYIFKL.js +16 -0
  140. package/getPricing-PWPJ6MNV.js +30 -0
  141. package/handleSendMessageAction-KA2MRW6E.js +183 -0
  142. package/index.js +184 -112254
  143. package/lib-FYYBQIXS.js +19839 -0
  144. package/localDialogRead-D3BELSTF.js +26 -0
  145. package/localFirstLog-DHNOY2NA.js +19 -0
  146. package/localRuntimeAuthority-TEGCOWX4.js +471 -0
  147. package/localRuntimeDb-LGDF6FQP.js +12 -0
  148. package/machineCommands-ZB5WUSPF.js +774 -0
  149. package/machineInfo-M6KB6HZN.js +10 -0
  150. package/machineWsRunDispatch-GWCAPPCM.js +105 -0
  151. package/memoryCommands-O4MIPIWQ.js +476 -0
  152. package/models-XLEOET3E.js +9 -0
  153. package/offlineMarxistsAgentCommand-BCPJITJL.js +242 -0
  154. package/package.json +3 -25
  155. package/read-RIJCIVKX.js +17 -0
  156. package/readDocTool-GZD2N3LO.js +16 -0
  157. package/readlineWorkspace-FEDY44AA.js +5357 -0
  158. package/removeDialogAgentAction-CXLST3N6.js +72 -0
  159. package/runAgentClientLoop-W4NKE64V.js +288 -0
  160. package/runtimeDoctorCommands-LRHLPDRC.js +289 -0
  161. package/setDialogExtraReferencesAction-LP6VYGU7.js +59 -0
  162. package/setPrimaryDialogAgentAction-D3GGH23T.js +79 -0
  163. package/settingSlice-J4I3Z5H7.js +198 -0
  164. package/skillSummaryMarker-42HKSXYY.js +9 -0
  165. package/slateToRenderMarkdown-Y5IYN73U.js +7 -0
  166. package/slateUtils-2M7MUTWX.js +19 -0
  167. package/spaceCommands-LC4FDAKE.js +450 -0
  168. package/spaceSlice-32XOGBEF.js +145 -0
  169. package/streamAgentChatTurn-YQW32AQH.js +4503 -0
  170. package/tableCommands-GOFP7QKA.js +1286 -0
  171. package/toolApiClient-QI3YBNWB.js +26 -0
  172. package/tools-XGTFRYD7.js +83 -0
  173. package/understanding-HCSFPE7R.js +318 -0
  174. package/updateCommands-VOSPKXFF.js +31 -0
  175. package/updateDialogTitleAction-4LHQDNHQ.js +185 -0
@@ -0,0 +1,20 @@
1
+ // packages/cli/levelLazyShim.mjs
2
+ import { createRequire } from "node:module";
3
+ var _require = createRequire(import.meta.url);
4
+ var _RealLevel;
5
+ function ensureLevel() {
6
+ if (!_RealLevel) {
7
+ _RealLevel = _require("level").Level;
8
+ }
9
+ return _RealLevel;
10
+ }
11
+ var Level = class {
12
+ constructor(...args) {
13
+ const RealLevel = ensureLevel();
14
+ return new RealLevel(...args);
15
+ }
16
+ };
17
+
18
+ export {
19
+ Level
20
+ };
@@ -0,0 +1,13 @@
1
+ // packages/ai/agent/cliPrompt.ts
2
+ function buildCliPrompt(systemPrompt, taskPrompt) {
3
+ if (!systemPrompt?.trim()) return taskPrompt;
4
+ return `[\u89D2\u8272\u8BBE\u5B9A]
5
+ ${systemPrompt.trim()}
6
+
7
+ [\u5F53\u524D\u4EFB\u52A1]
8
+ ${taskPrompt.trim()}`;
9
+ }
10
+
11
+ export {
12
+ buildCliPrompt
13
+ };
@@ -0,0 +1,69 @@
1
+ import {
2
+ dialogMessageRange
3
+ } from "./chunk-PN7AFLOK.js";
4
+ import {
5
+ isTombstoneRecord
6
+ } from "./chunk-GBRG75BQ.js";
7
+ import {
8
+ isRecord
9
+ } from "./chunk-KUG52IAP.js";
10
+
11
+ // packages/chat/messages/fetchMessages.ts
12
+ function isUnboundedMessageLimit(limit) {
13
+ return limit == null || !Number.isFinite(limit) || limit <= 0;
14
+ }
15
+ var fetchMessages = async (db, dialogId, options = {}) => {
16
+ const {
17
+ limit,
18
+ beforeKey = null,
19
+ throwOnError = false,
20
+ includeDeleted = false
21
+ } = options;
22
+ if (!dialogId || typeof dialogId !== "string") {
23
+ const errorMsg = "fetchMessages: dialogId \u5FC5\u987B\u662F\u4E00\u4E2A\u975E\u7A7A\u5B57\u7B26\u4E32";
24
+ if (throwOnError) throw new Error(errorMsg);
25
+ console.error(errorMsg);
26
+ return [];
27
+ }
28
+ const messages = [];
29
+ const { start, end } = dialogMessageRange(dialogId);
30
+ const iteratorOptions = {
31
+ // TODO: 替换为具体的迭代器选项类型
32
+ gte: start,
33
+ reverse: true,
34
+ // 总是从新到旧获取
35
+ // 默认不限条数;仅在显式正数 limit 时分页(load older)。
36
+ ...isUnboundedMessageLimit(limit) ? {} : { limit: Math.floor(limit) }
37
+ };
38
+ if (beforeKey) {
39
+ iteratorOptions.lt = beforeKey;
40
+ } else {
41
+ iteratorOptions.lte = end;
42
+ }
43
+ try {
44
+ let iterator = db.iterator(iteratorOptions);
45
+ if (iterator && typeof iterator.then === "function") {
46
+ iterator = await iterator;
47
+ }
48
+ let count = 0;
49
+ for await (const [key, value] of iterator) {
50
+ count++;
51
+ if (!includeDeleted && isTombstoneRecord(value)) {
52
+ continue;
53
+ }
54
+ if (isRecord(value) && value.id && value.createdAt) {
55
+ messages.push({ ...value, _key: key });
56
+ }
57
+ }
58
+ return messages;
59
+ } catch (error) {
60
+ console.error(`fetchMessages: \u83B7\u53D6\u5BF9\u8BDD ${dialogId} \u6D88\u606F\u5931\u8D25:`, error);
61
+ if (throwOnError) throw error;
62
+ return [];
63
+ }
64
+ };
65
+
66
+ export {
67
+ isUnboundedMessageLimit,
68
+ fetchMessages
69
+ };
@@ -0,0 +1,85 @@
1
+ import {
2
+ isGatewayHttpStatus,
3
+ parseRetryAfterHeaderMs
4
+ } from "./chunk-GAKEBQD6.js";
5
+ import {
6
+ asTrimmedLowercaseString
7
+ } from "./chunk-QSJ3HFEF.js";
8
+
9
+ // packages/cli/connectorWebSocketTarget.ts
10
+ var ConnectorWebSocketAuthError = class extends Error {
11
+ code;
12
+ constructor(message, code = "CONNECTOR_AUTH_FAILED") {
13
+ super(message);
14
+ this.name = "ConnectorWebSocketAuthError";
15
+ this.code = code;
16
+ }
17
+ };
18
+ function isConnectorWebSocketAuthError(error) {
19
+ return error instanceof ConnectorWebSocketAuthError;
20
+ }
21
+ var ConnectorWebSocketRetryableError = class extends Error {
22
+ reason;
23
+ retryAfterMs;
24
+ constructor(message, options = {}) {
25
+ super(message);
26
+ this.name = "ConnectorWebSocketRetryableError";
27
+ this.reason = options.reason ?? "retryable";
28
+ this.retryAfterMs = options.retryAfterMs;
29
+ }
30
+ };
31
+ function isConnectorWebSocketRetryableError(error) {
32
+ return error instanceof ConnectorWebSocketRetryableError;
33
+ }
34
+ function parseRetryAfterMs(response, bodyRetryAfterMs) {
35
+ const headerDelayMs = parseRetryAfterHeaderMs(response.headers.get("Retry-After"));
36
+ if (headerDelayMs != null) return headerDelayMs;
37
+ const parsed = Number(bodyRetryAfterMs);
38
+ return Number.isFinite(parsed) && parsed >= 0 ? Math.round(parsed) : void 0;
39
+ }
40
+ async function resolveConnectorWebSocketTarget(input) {
41
+ const directWsUrl = new URL(input.serverUrl);
42
+ directWsUrl.protocol = directWsUrl.protocol === "https:" ? "wss:" : "ws:";
43
+ directWsUrl.pathname = "/api/connector/ws";
44
+ directWsUrl.search = "";
45
+ directWsUrl.searchParams.set("machineId", input.machineId);
46
+ const connectorSurface = asTrimmedLowercaseString(input.connectorSurface);
47
+ if (connectorSurface) {
48
+ directWsUrl.searchParams.set("connectorSurface", connectorSurface);
49
+ }
50
+ const probeUrl = new URL(input.serverUrl);
51
+ probeUrl.pathname = "/api/connector/ws";
52
+ probeUrl.search = directWsUrl.search;
53
+ const response = await (input.fetchImpl ?? fetch)(probeUrl, {
54
+ headers: input.headers
55
+ }).catch(() => null);
56
+ if (response && (response.status === 401 || response.status === 403)) {
57
+ const json2 = await response.json().catch(() => null);
58
+ const code = typeof json2?.code === "string" ? json2.code : "CONNECTOR_AUTH_FAILED";
59
+ const message = typeof json2?.error === "string" ? json2.error : `Connector auth failed with HTTP ${response.status}`;
60
+ throw new ConnectorWebSocketAuthError(`${code}: ${message}`, code);
61
+ }
62
+ if (response && !response.ok) {
63
+ const json2 = await response.clone().json().catch(() => null);
64
+ const retryable = json2?.retryable === true || json2?.reason === "core_draining" || isGatewayHttpStatus(response.status);
65
+ if (retryable) {
66
+ const reason = typeof json2?.reason === "string" ? json2.reason : "retryable";
67
+ const message = typeof json2?.error === "string" ? json2.error : `Connector websocket unavailable with HTTP ${response.status}`;
68
+ throw new ConnectorWebSocketRetryableError(message, {
69
+ reason,
70
+ retryAfterMs: parseRetryAfterMs(response, json2?.retryAfterMs)
71
+ });
72
+ }
73
+ }
74
+ if (!response || !response.ok) {
75
+ return directWsUrl.toString();
76
+ }
77
+ const json = await response.json().catch(() => null);
78
+ return typeof json?.wsUrl === "string" && json.wsUrl ? json.wsUrl : directWsUrl.toString();
79
+ }
80
+
81
+ export {
82
+ isConnectorWebSocketAuthError,
83
+ isConnectorWebSocketRetryableError,
84
+ resolveConnectorWebSocketTarget
85
+ };
@@ -0,0 +1,36 @@
1
+ // packages/app/utils/fileUtils.ts
2
+ var fileConstructor = typeof globalThis !== "undefined" && typeof globalThis.File === "function" ? globalThis.File : void 0;
3
+ var isImageMimeType = (value) => typeof value === "string" && value.toLowerCase().startsWith("image/");
4
+ var IMAGE_FILE_NAME_RE = /\.(avif|bmp|gif|heic|heif|ico|jpe?g|png|svg|tiff?|webp)$/i;
5
+ var VIDEO_FILE_NAME_RE = /\.(avi|m4v|mkv|mov|mp4|mpeg|mpg|webm)$/i;
6
+ var AUDIO_FILE_NAME_RE = /\.(aac|flac|m4a|mp3|ogg|wav|weba)$/i;
7
+ var DOCUMENT_FILE_NAME_RE = /\.(csv|doc|docx|md|odt|pdf|ppt|pptx|rtf|txt|xls|xlsx)$/i;
8
+ var isImageFileName = (value) => typeof value === "string" && IMAGE_FILE_NAME_RE.test(value.trim());
9
+ var isVideoMimeType = (value) => typeof value === "string" && value.toLowerCase().startsWith("video/");
10
+ var isAudioMimeType = (value) => typeof value === "string" && value.toLowerCase().startsWith("audio/");
11
+ var isPdfMimeType = (value) => typeof value === "string" && value.toLowerCase() === "application/pdf";
12
+ var isDocumentMimeType = (value) => {
13
+ if (typeof value !== "string") return false;
14
+ const normalized = value.toLowerCase();
15
+ return isPdfMimeType(normalized) || normalized === "text/plain" || normalized === "text/markdown" || normalized === "text/csv" || normalized === "application/msword" || normalized === "application/vnd.openxmlformats-officedocument.wordprocessingml.document" || normalized === "application/vnd.ms-powerpoint" || normalized === "application/vnd.openxmlformats-officedocument.presentationml.presentation" || normalized === "application/vnd.ms-excel" || normalized === "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" || normalized === "application/rtf" || normalized === "application/vnd.oasis.opendocument.text";
16
+ };
17
+ var resolveFileCategory = ({
18
+ mimeType,
19
+ fileName
20
+ }) => {
21
+ if (isImageMimeType(mimeType) || isImageFileName(fileName)) return "image";
22
+ if (isVideoMimeType(mimeType) || typeof fileName === "string" && VIDEO_FILE_NAME_RE.test(fileName.trim())) {
23
+ return "video";
24
+ }
25
+ if (isAudioMimeType(mimeType) || typeof fileName === "string" && AUDIO_FILE_NAME_RE.test(fileName.trim())) {
26
+ return "audio";
27
+ }
28
+ if (isDocumentMimeType(mimeType) || typeof fileName === "string" && DOCUMENT_FILE_NAME_RE.test(fileName.trim())) {
29
+ return "document";
30
+ }
31
+ return "other";
32
+ };
33
+
34
+ export {
35
+ resolveFileCategory
36
+ };
@@ -0,0 +1,34 @@
1
+ import {
2
+ fetchReferenceContents,
3
+ resolveReferenceAssets
4
+ } from "./chunk-HOMYP7GZ.js";
5
+
6
+ // packages/ai/agent/fetchAgentContexts.ts
7
+ async function fetchAgentContexts(references, dispatch) {
8
+ if (!Array.isArray(references)) {
9
+ return { botInstructionsContext: "", botKnowledgeContext: "" };
10
+ }
11
+ const { references: normalizedRefs, contentByKey } = await resolveReferenceAssets(references, dispatch);
12
+ const instructionKeys = /* @__PURE__ */ new Set();
13
+ const knowledgeKeys = /* @__PURE__ */ new Set();
14
+ normalizedRefs.forEach((ref) => {
15
+ if (!ref.dbKey) return;
16
+ ref.type === "instruction" ? instructionKeys.add(ref.dbKey) : knowledgeKeys.add(ref.dbKey);
17
+ });
18
+ const [instructionsMap, knowledgeMap] = await Promise.all([
19
+ fetchReferenceContents(Array.from(instructionKeys), dispatch, {
20
+ preloaded: contentByKey
21
+ }),
22
+ fetchReferenceContents(Array.from(knowledgeKeys), dispatch, {
23
+ preloaded: contentByKey
24
+ })
25
+ ]);
26
+ return {
27
+ botInstructionsContext: Array.from(instructionsMap.values()).join(""),
28
+ botKnowledgeContext: Array.from(knowledgeMap.values()).join("")
29
+ };
30
+ }
31
+
32
+ export {
33
+ fetchAgentContexts
34
+ };