nolo-cli 0.8.0-alpha.2 → 0.8.0-alpha.21

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 (188) hide show
  1. package/README.md +1 -1
  2. package/_executeModel-42U3VOVZ.js +205 -0
  3. package/action-TLI3V62L.js +28 -0
  4. package/addContentAction-57RSIIMR.js +26 -0
  5. package/addDialogAgentAction-G3VWEA6E.js +68 -0
  6. package/agentDeleteCommand-5DD2IM3J.js +327 -0
  7. package/agentEmailCommands-6FACJBU4.js +628 -0
  8. package/agentListCommands-I6KZYCIG.js +223 -0
  9. package/agentMachineCommands-VKLIGMZA.js +425 -0
  10. package/agentPullCommand-O2MTUAFR.js +122 -0
  11. package/agentRecordCommands-7TZICYDT.js +96 -0
  12. package/agentRunCommand-L4OM23KV.js +114 -0
  13. package/agentRunControl-K4VKNEHF.js +57 -0
  14. package/agentRuntimeLocal-ZYEIPTY4.js +104 -0
  15. package/agentSlice-BX7GXSNO.js +42 -0
  16. package/authCommand-EB5JSOX5.js +581 -0
  17. package/authCommands-XPEHTKSM.js +35 -0
  18. package/chunk-25LCXTML.js +175 -0
  19. package/chunk-2ECQG4YX.js +22296 -0
  20. package/chunk-2FTTDCD4.js +675 -0
  21. package/chunk-2JCXITPK.js +1078 -0
  22. package/chunk-3ASDTTEI.js +1774 -0
  23. package/chunk-3EUW3WEO.js +8 -0
  24. package/chunk-3LY4F7SV.js +9293 -0
  25. package/chunk-4CQLVGRV.js +50 -0
  26. package/chunk-4IJYA27C.js +342 -0
  27. package/chunk-4O3CARJ4.js +231 -0
  28. package/chunk-4QEWT7KD.js +933 -0
  29. package/chunk-4SN6J65J.js +38 -0
  30. package/chunk-4VNS5WPM.js +42 -0
  31. package/chunk-4XENYTF5.js +222 -0
  32. package/chunk-4ZDM73SD.js +34 -0
  33. package/chunk-5CS33IBL.js +301 -0
  34. package/chunk-5EFXE3O7.js +138 -0
  35. package/chunk-5KLGBAAR.js +386 -0
  36. package/chunk-5MIDPSSK.js +206 -0
  37. package/chunk-5MMAK75Q.js +15 -0
  38. package/chunk-63W5N6P3.js +150 -0
  39. package/chunk-6HYVJV7B.js +102 -0
  40. package/chunk-6KHNO3SK.js +1948 -0
  41. package/chunk-6WD3OOJS.js +20 -0
  42. package/chunk-7DAJ4AI4.js +191 -0
  43. package/chunk-7GNGZRLZ.js +1939 -0
  44. package/chunk-7KCUSYT2.js +354 -0
  45. package/chunk-7U44LYTR.js +238 -0
  46. package/chunk-AFON4QUU.js +112 -0
  47. package/chunk-AGFH73SK.js +239 -0
  48. package/chunk-AL2KDGR2.js +27339 -0
  49. package/chunk-AS4PVWA4.js +221 -0
  50. package/chunk-ATNTHIZI.js +13 -0
  51. package/chunk-AVMKZHBC.js +85 -0
  52. package/chunk-AZPCASRE.js +36 -0
  53. package/chunk-BBYVOSU2.js +792 -0
  54. package/chunk-C3RUNRHT.js +51 -0
  55. package/chunk-C4FTUXVF.js +146 -0
  56. package/chunk-CF2WZF4N.js +134 -0
  57. package/chunk-CF7PE763.js +10 -0
  58. package/chunk-CKOJQDKR.js +198 -0
  59. package/chunk-CMKUBIGW.js +1550 -0
  60. package/chunk-CWMSB67P.js +34 -0
  61. package/chunk-DCOA4QSN.js +105 -0
  62. package/chunk-DFFIZ25G.js +30 -0
  63. package/chunk-DSZUWUYB.js +478 -0
  64. package/chunk-DWLEOOGR.js +8 -0
  65. package/chunk-DZ3XJVET.js +231 -0
  66. package/chunk-EHLHSX7R.js +1433 -0
  67. package/chunk-ENOG22KJ.js +939 -0
  68. package/chunk-FSO5B7GH.js +171 -0
  69. package/chunk-FVYY6MCS.js +1447 -0
  70. package/chunk-G3SUCT4W.js +8 -0
  71. package/chunk-GAKEBQD6.js +30 -0
  72. package/chunk-GBRG75BQ.js +86 -0
  73. package/chunk-GU3PEVGZ.js +4723 -0
  74. package/chunk-H33743XH.js +25 -0
  75. package/chunk-HNMXYYJR.js +12 -0
  76. package/chunk-HNW7IJSK.js +71 -0
  77. package/chunk-I42VC5KR.js +15 -0
  78. package/chunk-I6XMPTMR.js +113 -0
  79. package/chunk-IDZTNRP2.js +85 -0
  80. package/chunk-ISNCLGUZ.js +146 -0
  81. package/chunk-IWX4UW2E.js +548 -0
  82. package/chunk-JBTJAPUF.js +35 -0
  83. package/chunk-JEXVIMYZ.js +55 -0
  84. package/chunk-JRKKFRAV.js +537 -0
  85. package/chunk-JZPBVBIY.js +94 -0
  86. package/chunk-KKY4B2Q2.js +21 -0
  87. package/chunk-KQHGZWSV.js +63 -0
  88. package/chunk-KUG52IAP.js +8 -0
  89. package/chunk-KX6YBIHG.js +8 -0
  90. package/chunk-LCBAMY2M.js +60 -0
  91. package/chunk-LM6IYQ3F.js +16 -0
  92. package/chunk-LTRXGFMS.js +83 -0
  93. package/chunk-M76ECQRD.js +13658 -0
  94. package/chunk-MRC4Q34M.js +188 -0
  95. package/chunk-MTU75CZ2.js +91 -0
  96. package/chunk-N54XAP77.js +19 -0
  97. package/chunk-O2ZNTTET.js +3272 -0
  98. package/chunk-O4BU24WZ.js +3212 -0
  99. package/chunk-OLZBQWZU.js +6 -0
  100. package/chunk-OOSFSFMA.js +271 -0
  101. package/chunk-OPZYGHUC.js +89 -0
  102. package/chunk-OWOHNGCN.js +50 -0
  103. package/chunk-P3PKED2I.js +962 -0
  104. package/chunk-QSJ3HFEF.js +8 -0
  105. package/chunk-RCSJFQPB.js +9036 -0
  106. package/chunk-RL776AGR.js +190 -0
  107. package/chunk-ROWQEJRP.js +139 -0
  108. package/chunk-S7Z2HMCN.js +25 -0
  109. package/chunk-SDJDLO5W.js +628 -0
  110. package/chunk-SOTZ6RDN.js +69 -0
  111. package/chunk-TILFE6LV.js +381 -0
  112. package/chunk-U4TRT5V4.js +246 -0
  113. package/chunk-U6VC4MU4.js +8 -0
  114. package/chunk-UAD2WT54.js +64 -0
  115. package/chunk-UB6SN4NJ.js +421 -0
  116. package/chunk-URUUZLPA.js +807 -0
  117. package/chunk-UTLZINAP.js +3066 -0
  118. package/chunk-VC6OZXO5.js +298 -0
  119. package/chunk-VF4K2QE6.js +21 -0
  120. package/chunk-VHBWHNVT.js +59 -0
  121. package/chunk-VIDPVFP3.js +20 -0
  122. package/chunk-VP4WJWKW.js +8882 -0
  123. package/chunk-VUW5FBDB.js +573 -0
  124. package/chunk-VVX233PH.js +482 -0
  125. package/chunk-VX3SXJ3N.js +2052 -0
  126. package/chunk-W4NVOSFF.js +37 -0
  127. package/chunk-WWC7I6TA.js +8 -0
  128. package/chunk-WZSRQNQG.js +2587 -0
  129. package/chunk-XBUBEFNX.js +34 -0
  130. package/chunk-XENYHRUE.js +104 -0
  131. package/chunk-Y5GCAMGP.js +9 -0
  132. package/chunk-YPRZSPF3.js +148 -0
  133. package/chunk-Z4NR32XR.js +50 -0
  134. package/chunk-ZNFJWEN4.js +56 -0
  135. package/cliExecutor-K3F7DMRO.js +36 -0
  136. package/clipboardy-BVE3LVEH.js +12001 -0
  137. package/createAgentAutomationAction-RJF3N2QY.js +866 -0
  138. package/createDialogAction-DRSPS6CE.js +55 -0
  139. package/createPageAction-6B2WMNO3.js +172 -0
  140. package/db-HCJ5PRB5.js +271 -0
  141. package/dbSlice-Q3TM2FJV.js +60 -0
  142. package/deleteFile-OW53A6BX.js +41 -0
  143. package/dialogCommands-4IX4XIZE.js +63 -0
  144. package/dialogSlice-3M7KX2TX.js +148 -0
  145. package/docCreateCommands-SIL3NPGT.js +220 -0
  146. package/docDeleteCommands-7IOMLUS4.js +181 -0
  147. package/docReadCommands-FNFXUA5L.js +134 -0
  148. package/docStore-SV7E34D4.js +98 -0
  149. package/docUpdateCommands-X2HNDVUC.js +318 -0
  150. package/fetchMessages-KTNM7QAR.js +17 -0
  151. package/getPricing-3E6UNPKL.js +30 -0
  152. package/handleSendMessageAction-JYETO5RZ.js +185 -0
  153. package/index.js +188 -112958
  154. package/lib-FYYBQIXS.js +19839 -0
  155. package/localDialogRead-2VRI24F4.js +26 -0
  156. package/localFirstLog-DHNOY2NA.js +19 -0
  157. package/localRuntimeAuthority-TEGCOWX4.js +471 -0
  158. package/localRuntimeDb-LGDF6FQP.js +12 -0
  159. package/machineCommands-RIO3RP5Q.js +781 -0
  160. package/machineInfo-M6KB6HZN.js +10 -0
  161. package/machineWsRunDispatch-W7UYLGB5.js +112 -0
  162. package/memoryCommands-O4MIPIWQ.js +476 -0
  163. package/models-4OPOOLFS.js +9 -0
  164. package/offlineMarxistsAgentCommand-BCPJITJL.js +242 -0
  165. package/package.json +4 -24
  166. package/read-GW7ZEI23.js +17 -0
  167. package/readDocTool-HUFU6OCT.js +16 -0
  168. package/readlineWorkspace-27JR7WPW.js +5682 -0
  169. package/removeDialogAgentAction-CXKR4NJI.js +73 -0
  170. package/runAgentClientLoop-HZFAPJHS.js +293 -0
  171. package/runtimeDoctorCommands-LRHLPDRC.js +289 -0
  172. package/setDialogExtraReferencesAction-6RKUSXHX.js +60 -0
  173. package/setPrimaryDialogAgentAction-T3UTBEFG.js +80 -0
  174. package/settingSlice-IVKXJXMG.js +199 -0
  175. package/skillDiscovery-UGSQGX2U.js +16 -0
  176. package/skillSummaryMarker-42HKSXYY.js +9 -0
  177. package/slateToRenderMarkdown-Y5IYN73U.js +7 -0
  178. package/slateUtils-2M7MUTWX.js +19 -0
  179. package/spaceCommands-E7VOF4LO.js +450 -0
  180. package/spaceSlice-TSVROA5U.js +149 -0
  181. package/streamAgentChatTurn-3C5RQZJF.js +4510 -0
  182. package/tableCommands-O7O2LBEG.js +1286 -0
  183. package/toolApiClient-QI3YBNWB.js +26 -0
  184. package/tools-EQDEKR6N.js +87 -0
  185. package/tuiSummaryLlmCaller-RV3THLZF.js +78 -0
  186. package/understanding-3CUQQ6SV.js +271 -0
  187. package/updateCommands-VOSPKXFF.js +31 -0
  188. package/updateDialogTitleAction-3XV7VWSZ.js +188 -0
@@ -0,0 +1,98 @@
1
+ import {
2
+ applyExternalDocUpdate,
3
+ createDocState,
4
+ getDocField,
5
+ getDocHasPendingChanges,
6
+ getDocIsInitialized,
7
+ getDocIsReadOnly,
8
+ getDocPageKey,
9
+ getDocState,
10
+ getSnapshot,
11
+ initDocState,
12
+ previewDocState,
13
+ resetDocState,
14
+ resetDocStoreForTests,
15
+ resetJustSavedStatus,
16
+ saveDocState,
17
+ setDocFocusContext,
18
+ setReadOnlyDoc,
19
+ subscribe,
20
+ toggleReadOnlyDoc,
21
+ updateDocTags,
22
+ updateIconDoc,
23
+ updateSlateDoc,
24
+ updateTitleDoc,
25
+ useDocField,
26
+ useDocState
27
+ } from "./chunk-UB6SN4NJ.js";
28
+ import "./chunk-2ECQG4YX.js";
29
+ import "./chunk-4ZDM73SD.js";
30
+ import "./chunk-MRC4Q34M.js";
31
+ import "./chunk-MTU75CZ2.js";
32
+ import "./chunk-CWMSB67P.js";
33
+ import "./chunk-VUW5FBDB.js";
34
+ import "./chunk-5EFXE3O7.js";
35
+ import "./chunk-Z4NR32XR.js";
36
+ import "./chunk-M76ECQRD.js";
37
+ import "./chunk-SOTZ6RDN.js";
38
+ import "./chunk-I6XMPTMR.js";
39
+ import "./chunk-UAD2WT54.js";
40
+ import "./chunk-DCOA4QSN.js";
41
+ import "./chunk-5MMAK75Q.js";
42
+ import "./chunk-BBYVOSU2.js";
43
+ import "./chunk-5CS33IBL.js";
44
+ import "./chunk-JZPBVBIY.js";
45
+ import "./chunk-IWX4UW2E.js";
46
+ import "./chunk-DFFIZ25G.js";
47
+ import "./chunk-3ASDTTEI.js";
48
+ import "./chunk-DWLEOOGR.js";
49
+ import "./chunk-HNMXYYJR.js";
50
+ import "./chunk-VX3SXJ3N.js";
51
+ import "./chunk-Y5GCAMGP.js";
52
+ import "./chunk-URUUZLPA.js";
53
+ import "./chunk-AZPCASRE.js";
54
+ import "./chunk-7U44LYTR.js";
55
+ import "./chunk-KX6YBIHG.js";
56
+ import "./chunk-O4BU24WZ.js";
57
+ import "./chunk-I42VC5KR.js";
58
+ import "./chunk-WWC7I6TA.js";
59
+ import "./chunk-QSJ3HFEF.js";
60
+ import "./chunk-DSZUWUYB.js";
61
+ import "./chunk-UTLZINAP.js";
62
+ import "./chunk-OOSFSFMA.js";
63
+ import "./chunk-GBRG75BQ.js";
64
+ import "./chunk-4SN6J65J.js";
65
+ import "./chunk-LCBAMY2M.js";
66
+ import "./chunk-3EUW3WEO.js";
67
+ import "./chunk-U6VC4MU4.js";
68
+ import "./chunk-CF7PE763.js";
69
+ import "./chunk-G3SUCT4W.js";
70
+ import "./chunk-KUG52IAP.js";
71
+ import "./chunk-4VNS5WPM.js";
72
+ export {
73
+ applyExternalDocUpdate,
74
+ createDocState,
75
+ getDocField,
76
+ getDocHasPendingChanges,
77
+ getDocIsInitialized,
78
+ getDocIsReadOnly,
79
+ getDocPageKey,
80
+ getDocState,
81
+ getSnapshot,
82
+ initDocState,
83
+ previewDocState,
84
+ resetDocState,
85
+ resetDocStoreForTests,
86
+ resetJustSavedStatus,
87
+ saveDocState,
88
+ setDocFocusContext,
89
+ setReadOnlyDoc,
90
+ subscribe,
91
+ toggleReadOnlyDoc,
92
+ updateDocTags,
93
+ updateIconDoc,
94
+ updateSlateDoc,
95
+ updateTitleDoc,
96
+ useDocField,
97
+ useDocState
98
+ };
@@ -0,0 +1,318 @@
1
+ import {
2
+ findPotentialSecrets,
3
+ formatSecretFindings
4
+ } from "./chunk-S7Z2HMCN.js";
5
+ import {
6
+ buildPageKey,
7
+ buildPageRecord,
8
+ buildSkillPageKey,
9
+ buildSkillPageRecord,
10
+ buildSkillSummaryForRecord,
11
+ hasFlag,
12
+ hasHelpArg,
13
+ parseJsonArg,
14
+ readBodyArg,
15
+ readPageRecord,
16
+ readTitle,
17
+ requireTokenUser,
18
+ resolveDocKind,
19
+ resolveWriteTargets,
20
+ writePageRecord
21
+ } from "./chunk-7KCUSYT2.js";
22
+ import "./chunk-SDJDLO5W.js";
23
+ import "./chunk-N54XAP77.js";
24
+ import "./chunk-VHBWHNVT.js";
25
+ import "./chunk-VF4K2QE6.js";
26
+ import {
27
+ parseSkillDocProtocol,
28
+ resolvePageSkillMetadata
29
+ } from "./chunk-VC6OZXO5.js";
30
+ import "./chunk-UAD2WT54.js";
31
+ import "./chunk-IDZTNRP2.js";
32
+ import {
33
+ readOption
34
+ } from "./chunk-ISNCLGUZ.js";
35
+ import "./chunk-OLZBQWZU.js";
36
+ import "./chunk-WZSRQNQG.js";
37
+ import "./chunk-O2ZNTTET.js";
38
+ import "./chunk-5KLGBAAR.js";
39
+ import "./chunk-ZNFJWEN4.js";
40
+ import "./chunk-TILFE6LV.js";
41
+ import "./chunk-4QEWT7KD.js";
42
+ import "./chunk-OPZYGHUC.js";
43
+ import "./chunk-AGFH73SK.js";
44
+ import "./chunk-JRKKFRAV.js";
45
+ import "./chunk-P3PKED2I.js";
46
+ import "./chunk-5MMAK75Q.js";
47
+ import "./chunk-BBYVOSU2.js";
48
+ import "./chunk-5CS33IBL.js";
49
+ import "./chunk-JZPBVBIY.js";
50
+ import "./chunk-IWX4UW2E.js";
51
+ import "./chunk-DWLEOOGR.js";
52
+ import "./chunk-HNMXYYJR.js";
53
+ import "./chunk-KX6YBIHG.js";
54
+ import "./chunk-O4BU24WZ.js";
55
+ import "./chunk-I42VC5KR.js";
56
+ import "./chunk-WWC7I6TA.js";
57
+ import "./chunk-QSJ3HFEF.js";
58
+ import "./chunk-4SN6J65J.js";
59
+ import "./chunk-LCBAMY2M.js";
60
+ import "./chunk-3EUW3WEO.js";
61
+ import "./chunk-U6VC4MU4.js";
62
+ import "./chunk-CF7PE763.js";
63
+ import "./chunk-G3SUCT4W.js";
64
+ import "./chunk-KUG52IAP.js";
65
+ import "./chunk-4VNS5WPM.js";
66
+
67
+ // packages/cli/docUpdateCommands.ts
68
+ function printDocUpdateUsage(output) {
69
+ output.write(`Usage:
70
+ nolo doc update (--id <pageId> | --key <pageKey>) [--title ...] [--body ... | --body-file path] [--space ...]
71
+
72
+ Options:
73
+ --id <pageId> Page id (without user prefix).
74
+ --key <pageKey> Full dbKey, e.g. page-<userId>-<pageId>.
75
+ --title <text> New title.
76
+ --description <text> New page description stored in meta.
77
+ --body <text> New page body.
78
+ --body-file <path> Read body from file.
79
+ --space <spaceId> Move/attach the page to this space.
80
+ --sync local,main,us Choose write targets. Values may also be full URLs.
81
+ --local-only Write only to the local server target.
82
+ --no-local Exclude local targets when --sync includes them.
83
+ --dry-run Build and validate without writing.
84
+ --json Print machine-readable JSON.
85
+ --allow-secrets Allow bodies that look like credentials.
86
+ --server <url> Default write target when --sync is omitted.
87
+ --token <jwt> Auth token. Required for writes.
88
+ `);
89
+ }
90
+ function printSkillDocUpdateUsage(output) {
91
+ output.write(`Usage:
92
+ nolo skill-doc update (--id <skillId> | --key <pageKey>) [--title ...] [--description ...] [--body ... | --body-file path]
93
+
94
+ Options:
95
+ --id <skillId> Skill id (without user prefix).
96
+ --key <pageKey> Full dbKey, e.g. page-<userId>-<skillId>.
97
+ --title <text> New page title. Also renames the skill unless --name is given.
98
+ --name <text> New skill name only, leaving the page title untouched.
99
+ The name is the skill's identity that other docs
100
+ reference, so prefer this over --title when you only
101
+ want a nicer title.
102
+ --description <text> New skill description.
103
+ --body <text> New skill body.
104
+ --body-file <path> Read body from file.
105
+ --space <spaceId> Move/attach the skill page to this space.
106
+ --tools '["readDoc"]' Replace tool names this skill expects.
107
+ --required-skills '["skill-a"]' Replace required skill references.
108
+ --recommended-skills '["skill-b"]' Replace recommended skill references.
109
+ --preferred-agents '["agent-key"]' Replace preferred agent keys.
110
+ --trigger-mode explicit|required|recommended
111
+ --budget-tier low|medium|high
112
+ --prompt-patch <text>
113
+ --sync local,main,us Choose write targets. Values may also be full URLs.
114
+ --local-only Write only to the local server target.
115
+ --no-local Exclude local targets when --sync includes them.
116
+ --dry-run Build and validate without writing.
117
+ --json Print machine-readable JSON.
118
+ --allow-secrets Allow bodies that look like credentials.
119
+ --token <jwt> Auth token. Required for writes.
120
+
121
+ Promotion:
122
+ If the target is a plain page whose body already contains a valid
123
+ <!-- skill-config ... --> block, this command adopts it: the block is parsed,
124
+ normalized and written back into record.meta (kind="skill" + skillConfig),
125
+ keeping the same dbKey. Use --dry-run first to preview.
126
+ `);
127
+ }
128
+ async function resolveExistingRecord(args) {
129
+ for (const serverUrl of args.targets) {
130
+ try {
131
+ const record = await readPageRecord({
132
+ authToken: args.authToken,
133
+ dbKey: args.dbKey,
134
+ serverUrl
135
+ });
136
+ if (record) {
137
+ return { record, serverUrl };
138
+ }
139
+ } catch {
140
+ }
141
+ }
142
+ throw new Error(`doc not found on any target: ${args.dbKey}`);
143
+ }
144
+ async function runUpdateCommand(args, deps, options) {
145
+ if (hasHelpArg(args)) {
146
+ options.usage(process.stdout);
147
+ return 0;
148
+ }
149
+ const explicitId = readOption(args, "--id");
150
+ const explicitKey = readOption(args, "--key");
151
+ if (!explicitId && !explicitKey) {
152
+ options.usage(process.stderr);
153
+ return 1;
154
+ }
155
+ const docKind = resolveDocKind(args, options.defaultKind);
156
+ const shouldDryRun = hasFlag(args, "--dry-run");
157
+ const shouldOutputJson = hasFlag(args, "--json");
158
+ const allowSecrets = hasFlag(args, "--allow-secrets");
159
+ const { authToken, userId } = requireTokenUser(args, deps.env, shouldDryRun);
160
+ const targets = resolveWriteTargets(args, deps.env);
161
+ if (!targets.length) {
162
+ throw new Error("No write targets resolved. Check --sync / --local-only / --no-local.");
163
+ }
164
+ const dbKey = explicitKey ?? (docKind === "skill" ? buildSkillPageKey(userId, explicitId) : buildPageKey(userId, explicitId));
165
+ const { record: existing } = await resolveExistingRecord({ authToken, dbKey, targets });
166
+ const existingSkillMeta = resolvePageSkillMetadata(existing);
167
+ const metaKindIsSkill = existing?.meta?.kind === "skill";
168
+ const bodyDeclaresSkill = Boolean(existingSkillMeta?.skillConfig);
169
+ if (docKind === "page" && (metaKindIsSkill || bodyDeclaresSkill)) {
170
+ throw new Error(`Target page is a skill doc. Use nolo skill-doc update --key ${dbKey}`);
171
+ }
172
+ if (docKind === "skill" && !metaKindIsSkill && !bodyDeclaresSkill) {
173
+ throw new Error(
174
+ `Target page is not a skill doc and its body has no valid skill-config block. Use nolo doc update --key ${dbKey}`
175
+ );
176
+ }
177
+ const isPromotion = docKind === "skill" && !metaKindIsSkill && bodyDeclaresSkill;
178
+ const explicitTitle = readTitle(args);
179
+ const title = explicitTitle ?? existing?.title;
180
+ if (!title) {
181
+ throw new Error(`doc has no title and none was provided: ${dbKey}`);
182
+ }
183
+ const newSpaceId = readOption(args, "--space");
184
+ const spaceId = newSpaceId !== void 0 ? newSpaceId : existing?.spaceId ?? null;
185
+ let record;
186
+ let skillSummary;
187
+ if (docKind === "skill") {
188
+ const meta = existingSkillMeta;
189
+ const currentConfig = meta?.skillConfig;
190
+ if (!currentConfig) {
191
+ throw new Error(`existing skill doc is missing skillConfig: ${dbKey}`);
192
+ }
193
+ const parsed = parseSkillDocProtocol(existing?.content ?? "", meta);
194
+ const description = readOption(args, "--description") ?? currentConfig.description;
195
+ const explicitName = readOption(args, "--name");
196
+ if (explicitName !== void 0 && !explicitName.trim()) {
197
+ throw new Error("--name cannot be empty. Omit it to keep the current skill name.");
198
+ }
199
+ const body = readBodyArg(args, parsed.content ?? "");
200
+ const secretFindings = findPotentialSecrets(body);
201
+ if (secretFindings.length && !allowSecrets) {
202
+ throw new Error(
203
+ [
204
+ "Document body appears to contain credentials or secrets. Pass --allow-secrets to write it anyway.",
205
+ formatSecretFindings(secretFindings)
206
+ ].join("\n")
207
+ );
208
+ }
209
+ const mergedConfig = {
210
+ ...currentConfig,
211
+ // The skill's `name` is its identity (other docs reference it), while the
212
+ // page title is prose. They coincide for docs created via skill-doc create,
213
+ // but diverge when promoting a page. --name targets the identity alone, so
214
+ // a doc can get a readable title without breaking references; without it,
215
+ // only an explicit --title renames.
216
+ name: explicitName ?? explicitTitle ?? currentConfig.name ?? title,
217
+ description,
218
+ ...parseJsonArg(readOption(args, "--tools"), currentConfig.toolNames ?? []).length ? { toolNames: parseJsonArg(readOption(args, "--tools"), currentConfig.toolNames ?? []) } : {},
219
+ ...parseJsonArg(readOption(args, "--required-skills"), currentConfig.requiredSkills ?? []).length ? { requiredSkills: parseJsonArg(readOption(args, "--required-skills"), currentConfig.requiredSkills ?? []) } : {},
220
+ ...parseJsonArg(readOption(args, "--recommended-skills"), currentConfig.recommendedSkills ?? []).length ? { recommendedSkills: parseJsonArg(readOption(args, "--recommended-skills"), currentConfig.recommendedSkills ?? []) } : {},
221
+ ...parseJsonArg(readOption(args, "--preferred-agents"), currentConfig.preferredAgents ?? []).length ? { preferredAgents: parseJsonArg(readOption(args, "--preferred-agents"), currentConfig.preferredAgents ?? []) } : {},
222
+ ...readOption(args, "--trigger-mode") ? { triggerMode: readOption(args, "--trigger-mode") } : {},
223
+ ...readOption(args, "--budget-tier") ? { budgetTier: readOption(args, "--budget-tier") } : {},
224
+ ...readOption(args, "--prompt-patch") !== void 0 ? { promptPatch: readOption(args, "--prompt-patch") } : {}
225
+ };
226
+ const skillId = typeof existing?.id === "string" ? existing.id : dbKey.split("-").pop();
227
+ record = buildSkillPageRecord({
228
+ dbKey,
229
+ skillId,
230
+ title,
231
+ spaceId,
232
+ body,
233
+ skillConfig: mergedConfig,
234
+ evalConfig: meta?.evalConfig,
235
+ workflowConfig: meta?.workflowConfig,
236
+ existing
237
+ });
238
+ skillSummary = buildSkillSummaryForRecord(record) ?? void 0;
239
+ } else {
240
+ const description = readOption(args, "--description") ?? existing?.meta?.description ?? "";
241
+ const body = readBodyArg(args, typeof existing?.content === "string" ? existing.content : "");
242
+ const secretFindings = findPotentialSecrets(body);
243
+ if (secretFindings.length && !allowSecrets) {
244
+ throw new Error(
245
+ [
246
+ "Document body appears to contain credentials or secrets. Pass --allow-secrets to write it anyway.",
247
+ formatSecretFindings(secretFindings)
248
+ ].join("\n")
249
+ );
250
+ }
251
+ const pageId = typeof existing?.id === "string" ? existing.id : dbKey.split("-").pop();
252
+ record = buildPageRecord({
253
+ dbKey,
254
+ pageId,
255
+ title,
256
+ spaceId,
257
+ content: body,
258
+ existing,
259
+ meta: description ? { description } : void 0
260
+ });
261
+ }
262
+ const summary = {
263
+ dryRun: shouldDryRun,
264
+ kind: docKind,
265
+ promotedFromPage: isPromotion,
266
+ title,
267
+ dbKey,
268
+ userId,
269
+ spaceId,
270
+ syncTargets: targets,
271
+ writtenTargets: []
272
+ };
273
+ if (!shouldDryRun) {
274
+ for (const serverUrl of targets) {
275
+ await writePageRecord({
276
+ authToken,
277
+ dbKey,
278
+ record,
279
+ serverUrl,
280
+ spaceId,
281
+ title,
282
+ userId,
283
+ skillSummary
284
+ });
285
+ summary.writtenTargets.push(serverUrl);
286
+ }
287
+ }
288
+ if (shouldOutputJson) {
289
+ process.stdout.write(`${JSON.stringify(summary, null, 2)}
290
+ `);
291
+ } else if (shouldDryRun) {
292
+ process.stdout.write(`dry-run ok${isPromotion ? " (promote page -> skill)" : ""}: ${dbKey}
293
+ `);
294
+ } else if (isPromotion) {
295
+ process.stdout.write(`promoted page to skill: ${dbKey}
296
+ `);
297
+ } else {
298
+ process.stdout.write(`updated ${docKind}: ${dbKey}
299
+ `);
300
+ }
301
+ return 0;
302
+ }
303
+ async function runDocUpdateCommand(args, deps) {
304
+ return runUpdateCommand(args, deps, {
305
+ defaultKind: "page",
306
+ usage: printDocUpdateUsage
307
+ });
308
+ }
309
+ async function runSkillDocUpdateCommand(args, deps) {
310
+ return runUpdateCommand(args, deps, {
311
+ defaultKind: "skill",
312
+ usage: printSkillDocUpdateUsage
313
+ });
314
+ }
315
+ export {
316
+ runDocUpdateCommand,
317
+ runSkillDocUpdateCommand
318
+ };
@@ -0,0 +1,17 @@
1
+ import {
2
+ fetchMessages,
3
+ isUnboundedMessageLimit
4
+ } from "./chunk-SOTZ6RDN.js";
5
+ import "./chunk-O4BU24WZ.js";
6
+ import "./chunk-I42VC5KR.js";
7
+ import "./chunk-WWC7I6TA.js";
8
+ import "./chunk-GBRG75BQ.js";
9
+ import "./chunk-3EUW3WEO.js";
10
+ import "./chunk-U6VC4MU4.js";
11
+ import "./chunk-G3SUCT4W.js";
12
+ import "./chunk-KUG52IAP.js";
13
+ import "./chunk-4VNS5WPM.js";
14
+ export {
15
+ fetchMessages,
16
+ isUnboundedMessageLimit
17
+ };
@@ -0,0 +1,30 @@
1
+ import {
2
+ formatCompactTurnPrice,
3
+ formatModelCostPerMillion,
4
+ formatPriceAmount,
5
+ getAgentPriceHint,
6
+ getFinalPrice,
7
+ getModelPricing,
8
+ getModelPricingForModel,
9
+ getPrices,
10
+ hasExplicitAgentPricing
11
+ } from "./chunk-YPRZSPF3.js";
12
+ import "./chunk-VIDPVFP3.js";
13
+ import "./chunk-CWMSB67P.js";
14
+ import "./chunk-BBYVOSU2.js";
15
+ import "./chunk-IWX4UW2E.js";
16
+ import "./chunk-WWC7I6TA.js";
17
+ import "./chunk-QSJ3HFEF.js";
18
+ import "./chunk-U6VC4MU4.js";
19
+ import "./chunk-4VNS5WPM.js";
20
+ export {
21
+ formatCompactTurnPrice,
22
+ formatModelCostPerMillion,
23
+ formatPriceAmount,
24
+ getAgentPriceHint,
25
+ getFinalPrice,
26
+ getModelPricing,
27
+ getModelPricingForModel,
28
+ getPrices,
29
+ hasExplicitAgentPricing
30
+ };
@@ -0,0 +1,185 @@
1
+ import {
2
+ messageStreamEnd,
3
+ prepareAndPersistUserMessage,
4
+ resolveHandleSendMessageContext
5
+ } from "./chunk-2ECQG4YX.js";
6
+ import "./chunk-4ZDM73SD.js";
7
+ import "./chunk-MRC4Q34M.js";
8
+ import "./chunk-MTU75CZ2.js";
9
+ import "./chunk-CWMSB67P.js";
10
+ import {
11
+ streamAgentChatTurn
12
+ } from "./chunk-VUW5FBDB.js";
13
+ import "./chunk-5EFXE3O7.js";
14
+ import "./chunk-Z4NR32XR.js";
15
+ import "./chunk-M76ECQRD.js";
16
+ import "./chunk-SOTZ6RDN.js";
17
+ import "./chunk-I6XMPTMR.js";
18
+ import "./chunk-UAD2WT54.js";
19
+ import "./chunk-DCOA4QSN.js";
20
+ import "./chunk-5MMAK75Q.js";
21
+ import "./chunk-BBYVOSU2.js";
22
+ import "./chunk-5CS33IBL.js";
23
+ import "./chunk-JZPBVBIY.js";
24
+ import "./chunk-IWX4UW2E.js";
25
+ import {
26
+ extractCustomId
27
+ } from "./chunk-DFFIZ25G.js";
28
+ import {
29
+ getActiveDialogKey
30
+ } from "./chunk-3ASDTTEI.js";
31
+ import "./chunk-DWLEOOGR.js";
32
+ import "./chunk-HNMXYYJR.js";
33
+ import "./chunk-VX3SXJ3N.js";
34
+ import "./chunk-Y5GCAMGP.js";
35
+ import {
36
+ readAndWait,
37
+ selectById
38
+ } from "./chunk-URUUZLPA.js";
39
+ import "./chunk-AZPCASRE.js";
40
+ import "./chunk-7U44LYTR.js";
41
+ import "./chunk-KX6YBIHG.js";
42
+ import {
43
+ createDialogMessageKeyAndId
44
+ } from "./chunk-O4BU24WZ.js";
45
+ import "./chunk-I42VC5KR.js";
46
+ import "./chunk-WWC7I6TA.js";
47
+ import "./chunk-QSJ3HFEF.js";
48
+ import "./chunk-DSZUWUYB.js";
49
+ import "./chunk-UTLZINAP.js";
50
+ import "./chunk-OOSFSFMA.js";
51
+ import "./chunk-GBRG75BQ.js";
52
+ import "./chunk-4SN6J65J.js";
53
+ import "./chunk-LCBAMY2M.js";
54
+ import "./chunk-3EUW3WEO.js";
55
+ import "./chunk-U6VC4MU4.js";
56
+ import "./chunk-CF7PE763.js";
57
+ import "./chunk-G3SUCT4W.js";
58
+ import "./chunk-KUG52IAP.js";
59
+ import "./chunk-4VNS5WPM.js";
60
+
61
+ // packages/chat/dialog/actions/handleSendMessageAction.ts
62
+ var getDialogConfig = (state, dialogKey) => {
63
+ const resolvedDialogKey = dialogKey ?? getActiveDialogKey();
64
+ if (!resolvedDialogKey) return null;
65
+ const dialog = selectById(state, resolvedDialogKey);
66
+ return dialog ?? null;
67
+ };
68
+ var ensureDialogConfig = async (dispatch, getState, dialogKey) => {
69
+ const state = getState();
70
+ const resolvedDialogKey = dialogKey ?? getActiveDialogKey();
71
+ if (!resolvedDialogKey) return null;
72
+ try {
73
+ const existingDialog = getDialogConfig(state, resolvedDialogKey);
74
+ if (existingDialog && Array.isArray(existingDialog.cybots) && existingDialog.cybots.length > 0) {
75
+ return existingDialog;
76
+ }
77
+ const persistedDialog = await dispatch(readAndWait(resolvedDialogKey)).unwrap();
78
+ if (persistedDialog) return persistedDialog;
79
+ return existingDialog;
80
+ } catch {
81
+ return getDialogConfig(getState(), resolvedDialogKey);
82
+ }
83
+ };
84
+ var logQuickChatPerfStage = (startedAt, stage, details = {}) => {
85
+ if (!startedAt) return;
86
+ const now = typeof performance !== "undefined" ? performance.now() : Date.now();
87
+ console.info("[QuickChatPerf]", {
88
+ stage,
89
+ elapsedMs: now - startedAt,
90
+ ...typeof performance !== "undefined" ? { atMs: now } : {},
91
+ ...details
92
+ });
93
+ };
94
+ var finalizeQuickChatStreamStartupFailure = async (dispatch, dialogConfig, agentKey) => {
95
+ const dialogKey = dialogConfig.dbKey;
96
+ const dialogId = dialogConfig.id ?? (dialogKey ? extractCustomId(dialogKey) : "");
97
+ const { key: msgKey, messageId } = createDialogMessageKeyAndId(dialogId);
98
+ await dispatch(
99
+ messageStreamEnd({
100
+ finalContentBuffer: [
101
+ {
102
+ type: "text",
103
+ text: "[\u9519\u8BEF: \u672A\u80FD\u542F\u52A8\u6A21\u578B\u56DE\u590D\uFF0C\u8BF7\u91CD\u8BD5\u3002]"
104
+ }
105
+ ],
106
+ totalUsage: null,
107
+ msgKey,
108
+ agentConfig: {
109
+ dbKey: agentKey
110
+ },
111
+ dialogId,
112
+ dialogKey: dialogKey ?? "",
113
+ messageId,
114
+ reasoningBuffer: ""
115
+ })
116
+ ).unwrap?.();
117
+ };
118
+ var handleSendMessageAction = async (args, { dispatch, getState, rejectWithValue }) => {
119
+ try {
120
+ logQuickChatPerfStage(args.quickChatPerfStartedAt, "handle-send-message-entered", {
121
+ dialogKey: args.dialogKey ?? null
122
+ });
123
+ const dialogConfig = await ensureDialogConfig(dispatch, getState, args.dialogKey);
124
+ if (!dialogConfig) {
125
+ throw new Error(
126
+ "handleSendMessage: Dialog configuration is missing."
127
+ );
128
+ }
129
+ logQuickChatPerfStage(args.quickChatPerfStartedAt, "handle-send-message-dialog-ready", {
130
+ dialogKey: dialogConfig.dbKey,
131
+ cybotCount: dialogConfig.cybots?.length ?? 0
132
+ });
133
+ await dispatch(
134
+ prepareAndPersistUserMessage({
135
+ userInput: args.userInput,
136
+ dialogConfig
137
+ })
138
+ ).unwrap();
139
+ logQuickChatPerfStage(args.quickChatPerfStartedAt, "handle-send-message-user-persisted", {
140
+ dialogKey: dialogConfig.dbKey
141
+ });
142
+ const { agentKeyToUse, effectiveRuntimeOptions } = resolveHandleSendMessageContext({
143
+ dialogConfig,
144
+ targetAgentKey: args.targetAgentKey,
145
+ runtimeOptions: args.runtimeOptions
146
+ });
147
+ if (!agentKeyToUse) {
148
+ return;
149
+ }
150
+ const streamResult = await dispatch(
151
+ streamAgentChatTurn({
152
+ agentKey: agentKeyToUse,
153
+ userInput: args.userInput,
154
+ dialogKey: dialogConfig.dbKey,
155
+ parentMessageId: void 0,
156
+ runtimeOptions: effectiveRuntimeOptions,
157
+ quickChatPerfStartedAt: args.quickChatPerfStartedAt
158
+ })
159
+ ).unwrap();
160
+ if (args.quickChatPerfStartedAt && streamResult === void 0) {
161
+ logQuickChatPerfStage(args.quickChatPerfStartedAt, "handle-send-message-stream-empty", {
162
+ dialogKey: dialogConfig.dbKey,
163
+ agentKey: agentKeyToUse
164
+ });
165
+ await finalizeQuickChatStreamStartupFailure(
166
+ dispatch,
167
+ dialogConfig,
168
+ agentKeyToUse
169
+ );
170
+ return;
171
+ }
172
+ logQuickChatPerfStage(args.quickChatPerfStartedAt, "handle-send-message-stream-finished", {
173
+ dialogKey: dialogConfig.dbKey,
174
+ agentKey: agentKeyToUse
175
+ });
176
+ return;
177
+ } catch (error) {
178
+ console.error("handleSendMessage failed:", error);
179
+ const errorMessage = error instanceof Error ? error.message : typeof error === "string" ? error : error?.message || error?.error || String(error);
180
+ return rejectWithValue(errorMessage);
181
+ }
182
+ };
183
+ export {
184
+ handleSendMessageAction
185
+ };