nolo-cli 0.7.0 → 0.8.0-alpha.11
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.
- package/_executeModel-GPU2276G.js +198 -0
- package/action-PAXRPJJF.js +27 -0
- package/addContentAction-CZVWF3QZ.js +25 -0
- package/addDialogAgentAction-CCIDTPHC.js +67 -0
- package/agentDeleteCommand-4ZZFM6AT.js +323 -0
- package/agentEmailCommands-C4FIVQYV.js +621 -0
- package/agentListCommands-VQAKVNEX.js +219 -0
- package/agentMachineCommands-ONFDXZUQ.js +421 -0
- package/agentPullCommand-O2MTUAFR.js +122 -0
- package/agentRecordCommands-QANUGHLK.js +89 -0
- package/agentRunCommand-A3OSRB5Q.js +102 -0
- package/agentRunControl-K4VKNEHF.js +57 -0
- package/agentRuntimeLocal-62ZB2ODP.js +99 -0
- package/agentSlice-GCGLVR2N.js +41 -0
- package/authCommand-WXMD3IPR.js +574 -0
- package/authCommands-X74AFDTC.js +26 -0
- package/chunk-2EISRLRC.js +238 -0
- package/chunk-2FTTDCD4.js +675 -0
- package/chunk-2MALU52L.js +51 -0
- package/chunk-2UZXR7WO.js +3631 -0
- package/chunk-3ASDTTEI.js +1774 -0
- package/chunk-3EUW3WEO.js +8 -0
- package/chunk-3LY4F7SV.js +9293 -0
- package/chunk-4CQLVGRV.js +50 -0
- package/chunk-4IJYA27C.js +342 -0
- package/chunk-4SN6J65J.js +38 -0
- package/chunk-4VNS5WPM.js +42 -0
- package/chunk-53DNV5AT.js +421 -0
- package/chunk-572EKYLF.js +792 -0
- package/chunk-5MIDPSSK.js +206 -0
- package/chunk-5MMAK75Q.js +15 -0
- package/chunk-63W5N6P3.js +150 -0
- package/chunk-6B7G54GE.js +1078 -0
- package/chunk-6HYVJV7B.js +102 -0
- package/chunk-6WD3OOJS.js +20 -0
- package/chunk-7OC5VCLW.js +929 -0
- package/chunk-7YLKNMOM.js +562 -0
- package/chunk-ATNTHIZI.js +13 -0
- package/chunk-AUGHVUFE.js +69 -0
- package/chunk-AVMKZHBC.js +85 -0
- package/chunk-AZPCASRE.js +36 -0
- package/chunk-BR2WP3DF.js +548 -0
- package/chunk-BSTNFPHD.js +231 -0
- package/chunk-CF2WZF4N.js +134 -0
- package/chunk-CF7PE763.js +10 -0
- package/chunk-CJH2VTEU.js +360 -0
- package/chunk-CKOJQDKR.js +198 -0
- package/chunk-CM54RSSA.js +206 -0
- package/chunk-CQAHS7YO.js +4300 -0
- package/chunk-CWMSB67P.js +34 -0
- package/chunk-DFFIZ25G.js +30 -0
- package/chunk-DWLEOOGR.js +8 -0
- package/chunk-DZ3XJVET.js +231 -0
- package/chunk-EHLHSX7R.js +1433 -0
- package/chunk-ELRRLDWI.js +478 -0
- package/chunk-EYEEHCU4.js +3066 -0
- package/chunk-F6QQI5YI.js +19 -0
- package/chunk-G3SUCT4W.js +8 -0
- package/chunk-G5H7RNFL.js +807 -0
- package/chunk-GAKEBQD6.js +30 -0
- package/chunk-GBRG75BQ.js +86 -0
- package/chunk-GCMRDRCQ.js +190 -0
- package/chunk-GGUO4FKF.js +27158 -0
- package/chunk-GGXABIPP.js +628 -0
- package/chunk-H2RMRZJE.js +113 -0
- package/chunk-H33743XH.js +25 -0
- package/chunk-HEIIIZBX.js +104 -0
- package/chunk-HNMXYYJR.js +12 -0
- package/chunk-I3D64LRJ.js +1447 -0
- package/chunk-IAXBCTTE.js +175 -0
- package/chunk-IDZTNRP2.js +85 -0
- package/chunk-ISNCLGUZ.js +146 -0
- package/chunk-IYQV26RA.js +138 -0
- package/chunk-J4576WMJ.js +91 -0
- package/chunk-J5KV47ZW.js +222 -0
- package/chunk-JBTJAPUF.js +35 -0
- package/chunk-JZPBVBIY.js +94 -0
- package/chunk-KB7YFGL6.js +34 -0
- package/chunk-KKY4B2Q2.js +21 -0
- package/chunk-KQHGZWSV.js +63 -0
- package/chunk-KUG52IAP.js +8 -0
- package/chunk-KX6YBIHG.js +8 -0
- package/chunk-LAWBMYBC.js +171 -0
- package/chunk-LCBAMY2M.js +60 -0
- package/chunk-LM25IZBJ.js +902 -0
- package/chunk-LM6IYQ3F.js +16 -0
- package/chunk-M76ECQRD.js +13658 -0
- package/chunk-MRC4Q34M.js +188 -0
- package/chunk-NXZGF7F7.js +2878 -0
- package/chunk-OF5H3QWS.js +300 -0
- package/chunk-OLZBQWZU.js +6 -0
- package/chunk-OWOHNGCN.js +50 -0
- package/chunk-PN7AFLOK.js +3401 -0
- package/chunk-QR5IPGT3.js +24674 -0
- package/chunk-QSJ3HFEF.js +8 -0
- package/chunk-QYXLLLGL.js +4519 -0
- package/chunk-R2HXWML7.js +1949 -0
- package/chunk-ROWQEJRP.js +139 -0
- package/chunk-S7Z2HMCN.js +25 -0
- package/chunk-SYOF5TAS.js +962 -0
- package/chunk-TDIQFT2F.js +301 -0
- package/chunk-TILFE6LV.js +381 -0
- package/chunk-TZNCFAUP.js +2157 -0
- package/chunk-U4TRT5V4.js +246 -0
- package/chunk-U6VC4MU4.js +8 -0
- package/chunk-UAD2WT54.js +64 -0
- package/chunk-USZMK5UT.js +105 -0
- package/chunk-VEJLAVTC.js +2052 -0
- package/chunk-VF4K2QE6.js +21 -0
- package/chunk-VHBWHNVT.js +59 -0
- package/chunk-VIDPVFP3.js +20 -0
- package/chunk-VP4WJWKW.js +8882 -0
- package/chunk-VQ2AJRGD.js +148 -0
- package/chunk-W4NVOSFF.js +37 -0
- package/chunk-WWC7I6TA.js +8 -0
- package/chunk-X7W4TNB4.js +1550 -0
- package/chunk-XBIUN5CR.js +191 -0
- package/chunk-XDVAYP26.js +537 -0
- package/chunk-XKIMRZO2.js +221 -0
- package/chunk-Y5GCAMGP.js +9 -0
- package/chunk-YOUZDXU7.js +9013 -0
- package/chunk-Z4NR32XR.js +50 -0
- package/chunk-ZNFJWEN4.js +56 -0
- package/cliExecutor-DNE7TCC4.js +36 -0
- package/clipboardy-BVE3LVEH.js +12001 -0
- package/createAgentAutomationAction-537X433B.js +864 -0
- package/createDialogAction-YUD4RKBS.js +52 -0
- package/createPageAction-KJMFHL4C.js +169 -0
- package/db-HCJ5PRB5.js +271 -0
- package/dbSlice-C4UJLRZP.js +59 -0
- package/deleteFile-4SKGPHOZ.js +41 -0
- package/dialogCommands-H74KJKHC.js +59 -0
- package/dialogSlice-ETSD4YWS.js +146 -0
- package/docCreateCommands-ADUSU34K.js +215 -0
- package/docDeleteCommands-ZXV3S5OS.js +176 -0
- package/docReadCommands-YYYI6LT7.js +129 -0
- package/docStore-ZBF5DDKR.js +96 -0
- package/docUpdateCommands-7MGJ3BYA.js +313 -0
- package/fetchMessages-JOCYIFKL.js +16 -0
- package/getPricing-PWPJ6MNV.js +30 -0
- package/handleSendMessageAction-MGKI62Y6.js +183 -0
- package/index.js +184 -112288
- package/lib-FYYBQIXS.js +19839 -0
- package/localDialogRead-D3BELSTF.js +26 -0
- package/localFirstLog-DHNOY2NA.js +19 -0
- package/localRuntimeAuthority-TEGCOWX4.js +471 -0
- package/localRuntimeDb-LGDF6FQP.js +12 -0
- package/machineCommands-RMTMN7VQ.js +774 -0
- package/machineInfo-M6KB6HZN.js +10 -0
- package/machineWsRunDispatch-UIP355FN.js +105 -0
- package/memoryCommands-O4MIPIWQ.js +476 -0
- package/models-XLEOET3E.js +9 -0
- package/offlineMarxistsAgentCommand-BCPJITJL.js +242 -0
- package/package.json +3 -25
- package/read-RIJCIVKX.js +17 -0
- package/readDocTool-GZD2N3LO.js +16 -0
- package/readlineWorkspace-CRNQRZ6D.js +5374 -0
- package/removeDialogAgentAction-CXLST3N6.js +72 -0
- package/runAgentClientLoop-2S334SGA.js +288 -0
- package/runtimeDoctorCommands-LRHLPDRC.js +289 -0
- package/setDialogExtraReferencesAction-LP6VYGU7.js +59 -0
- package/setPrimaryDialogAgentAction-D3GGH23T.js +79 -0
- package/settingSlice-J4I3Z5H7.js +198 -0
- package/skillSummaryMarker-42HKSXYY.js +9 -0
- package/slateToRenderMarkdown-Y5IYN73U.js +7 -0
- package/slateUtils-2M7MUTWX.js +19 -0
- package/spaceCommands-NDEWMFZJ.js +450 -0
- package/spaceSlice-RLB6RTHO.js +145 -0
- package/streamAgentChatTurn-Y2TTYPBD.js +4503 -0
- package/tableCommands-GOFP7QKA.js +1286 -0
- package/toolApiClient-QI3YBNWB.js +26 -0
- package/tools-YZYLY2ZQ.js +83 -0
- package/understanding-HCSFPE7R.js +318 -0
- package/updateCommands-VOSPKXFF.js +31 -0
- package/updateDialogTitleAction-LQV6QLBW.js +185 -0
|
@@ -0,0 +1,96 @@
|
|
|
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-53DNV5AT.js";
|
|
28
|
+
import "./chunk-QR5IPGT3.js";
|
|
29
|
+
import "./chunk-MRC4Q34M.js";
|
|
30
|
+
import "./chunk-J4576WMJ.js";
|
|
31
|
+
import "./chunk-CWMSB67P.js";
|
|
32
|
+
import "./chunk-7YLKNMOM.js";
|
|
33
|
+
import "./chunk-IYQV26RA.js";
|
|
34
|
+
import "./chunk-Z4NR32XR.js";
|
|
35
|
+
import "./chunk-M76ECQRD.js";
|
|
36
|
+
import "./chunk-AUGHVUFE.js";
|
|
37
|
+
import "./chunk-H2RMRZJE.js";
|
|
38
|
+
import "./chunk-UAD2WT54.js";
|
|
39
|
+
import "./chunk-USZMK5UT.js";
|
|
40
|
+
import "./chunk-5MMAK75Q.js";
|
|
41
|
+
import "./chunk-572EKYLF.js";
|
|
42
|
+
import "./chunk-TDIQFT2F.js";
|
|
43
|
+
import "./chunk-JZPBVBIY.js";
|
|
44
|
+
import "./chunk-BR2WP3DF.js";
|
|
45
|
+
import "./chunk-DFFIZ25G.js";
|
|
46
|
+
import "./chunk-3ASDTTEI.js";
|
|
47
|
+
import "./chunk-DWLEOOGR.js";
|
|
48
|
+
import "./chunk-HNMXYYJR.js";
|
|
49
|
+
import "./chunk-VEJLAVTC.js";
|
|
50
|
+
import "./chunk-Y5GCAMGP.js";
|
|
51
|
+
import "./chunk-G5H7RNFL.js";
|
|
52
|
+
import "./chunk-AZPCASRE.js";
|
|
53
|
+
import "./chunk-2EISRLRC.js";
|
|
54
|
+
import "./chunk-KX6YBIHG.js";
|
|
55
|
+
import "./chunk-PN7AFLOK.js";
|
|
56
|
+
import "./chunk-WWC7I6TA.js";
|
|
57
|
+
import "./chunk-QSJ3HFEF.js";
|
|
58
|
+
import "./chunk-ELRRLDWI.js";
|
|
59
|
+
import "./chunk-EYEEHCU4.js";
|
|
60
|
+
import "./chunk-QYXLLLGL.js";
|
|
61
|
+
import "./chunk-GBRG75BQ.js";
|
|
62
|
+
import "./chunk-4SN6J65J.js";
|
|
63
|
+
import "./chunk-LCBAMY2M.js";
|
|
64
|
+
import "./chunk-3EUW3WEO.js";
|
|
65
|
+
import "./chunk-U6VC4MU4.js";
|
|
66
|
+
import "./chunk-CF7PE763.js";
|
|
67
|
+
import "./chunk-G3SUCT4W.js";
|
|
68
|
+
import "./chunk-KUG52IAP.js";
|
|
69
|
+
import "./chunk-4VNS5WPM.js";
|
|
70
|
+
export {
|
|
71
|
+
applyExternalDocUpdate,
|
|
72
|
+
createDocState,
|
|
73
|
+
getDocField,
|
|
74
|
+
getDocHasPendingChanges,
|
|
75
|
+
getDocIsInitialized,
|
|
76
|
+
getDocIsReadOnly,
|
|
77
|
+
getDocPageKey,
|
|
78
|
+
getDocState,
|
|
79
|
+
getSnapshot,
|
|
80
|
+
initDocState,
|
|
81
|
+
previewDocState,
|
|
82
|
+
resetDocState,
|
|
83
|
+
resetDocStoreForTests,
|
|
84
|
+
resetJustSavedStatus,
|
|
85
|
+
saveDocState,
|
|
86
|
+
setDocFocusContext,
|
|
87
|
+
setReadOnlyDoc,
|
|
88
|
+
subscribe,
|
|
89
|
+
toggleReadOnlyDoc,
|
|
90
|
+
updateDocTags,
|
|
91
|
+
updateIconDoc,
|
|
92
|
+
updateSlateDoc,
|
|
93
|
+
updateTitleDoc,
|
|
94
|
+
useDocField,
|
|
95
|
+
useDocState
|
|
96
|
+
};
|
|
@@ -0,0 +1,313 @@
|
|
|
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-CJH2VTEU.js";
|
|
22
|
+
import "./chunk-GGXABIPP.js";
|
|
23
|
+
import "./chunk-F6QQI5YI.js";
|
|
24
|
+
import "./chunk-VHBWHNVT.js";
|
|
25
|
+
import "./chunk-VF4K2QE6.js";
|
|
26
|
+
import {
|
|
27
|
+
parseSkillDocProtocol,
|
|
28
|
+
resolvePageSkillMetadata
|
|
29
|
+
} from "./chunk-NXZGF7F7.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-2UZXR7WO.js";
|
|
37
|
+
import "./chunk-ZNFJWEN4.js";
|
|
38
|
+
import "./chunk-TILFE6LV.js";
|
|
39
|
+
import "./chunk-SYOF5TAS.js";
|
|
40
|
+
import "./chunk-XDVAYP26.js";
|
|
41
|
+
import "./chunk-LM25IZBJ.js";
|
|
42
|
+
import "./chunk-5MMAK75Q.js";
|
|
43
|
+
import "./chunk-572EKYLF.js";
|
|
44
|
+
import "./chunk-TDIQFT2F.js";
|
|
45
|
+
import "./chunk-JZPBVBIY.js";
|
|
46
|
+
import "./chunk-BR2WP3DF.js";
|
|
47
|
+
import "./chunk-DWLEOOGR.js";
|
|
48
|
+
import "./chunk-HNMXYYJR.js";
|
|
49
|
+
import "./chunk-KX6YBIHG.js";
|
|
50
|
+
import "./chunk-PN7AFLOK.js";
|
|
51
|
+
import "./chunk-WWC7I6TA.js";
|
|
52
|
+
import "./chunk-QSJ3HFEF.js";
|
|
53
|
+
import "./chunk-4SN6J65J.js";
|
|
54
|
+
import "./chunk-LCBAMY2M.js";
|
|
55
|
+
import "./chunk-3EUW3WEO.js";
|
|
56
|
+
import "./chunk-U6VC4MU4.js";
|
|
57
|
+
import "./chunk-CF7PE763.js";
|
|
58
|
+
import "./chunk-G3SUCT4W.js";
|
|
59
|
+
import "./chunk-KUG52IAP.js";
|
|
60
|
+
import "./chunk-4VNS5WPM.js";
|
|
61
|
+
|
|
62
|
+
// packages/cli/docUpdateCommands.ts
|
|
63
|
+
function printDocUpdateUsage(output) {
|
|
64
|
+
output.write(`Usage:
|
|
65
|
+
nolo doc update (--id <pageId> | --key <pageKey>) [--title ...] [--body ... | --body-file path] [--space ...]
|
|
66
|
+
|
|
67
|
+
Options:
|
|
68
|
+
--id <pageId> Page id (without user prefix).
|
|
69
|
+
--key <pageKey> Full dbKey, e.g. page-<userId>-<pageId>.
|
|
70
|
+
--title <text> New title.
|
|
71
|
+
--description <text> New page description stored in meta.
|
|
72
|
+
--body <text> New page body.
|
|
73
|
+
--body-file <path> Read body from file.
|
|
74
|
+
--space <spaceId> Move/attach the page to this space.
|
|
75
|
+
--sync local,main,us Choose write targets. Values may also be full URLs.
|
|
76
|
+
--local-only Write only to the local server target.
|
|
77
|
+
--no-local Exclude local targets when --sync includes them.
|
|
78
|
+
--dry-run Build and validate without writing.
|
|
79
|
+
--json Print machine-readable JSON.
|
|
80
|
+
--allow-secrets Allow bodies that look like credentials.
|
|
81
|
+
--server <url> Default write target when --sync is omitted.
|
|
82
|
+
--token <jwt> Auth token. Required for writes.
|
|
83
|
+
`);
|
|
84
|
+
}
|
|
85
|
+
function printSkillDocUpdateUsage(output) {
|
|
86
|
+
output.write(`Usage:
|
|
87
|
+
nolo skill-doc update (--id <skillId> | --key <pageKey>) [--title ...] [--description ...] [--body ... | --body-file path]
|
|
88
|
+
|
|
89
|
+
Options:
|
|
90
|
+
--id <skillId> Skill id (without user prefix).
|
|
91
|
+
--key <pageKey> Full dbKey, e.g. page-<userId>-<skillId>.
|
|
92
|
+
--title <text> New page title. Also renames the skill unless --name is given.
|
|
93
|
+
--name <text> New skill name only, leaving the page title untouched.
|
|
94
|
+
The name is the skill's identity that other docs
|
|
95
|
+
reference, so prefer this over --title when you only
|
|
96
|
+
want a nicer title.
|
|
97
|
+
--description <text> New skill description.
|
|
98
|
+
--body <text> New skill body.
|
|
99
|
+
--body-file <path> Read body from file.
|
|
100
|
+
--space <spaceId> Move/attach the skill page to this space.
|
|
101
|
+
--tools '["readDoc"]' Replace tool names this skill expects.
|
|
102
|
+
--required-skills '["skill-a"]' Replace required skill references.
|
|
103
|
+
--recommended-skills '["skill-b"]' Replace recommended skill references.
|
|
104
|
+
--preferred-agents '["agent-key"]' Replace preferred agent keys.
|
|
105
|
+
--trigger-mode explicit|required|recommended
|
|
106
|
+
--budget-tier low|medium|high
|
|
107
|
+
--prompt-patch <text>
|
|
108
|
+
--sync local,main,us Choose write targets. Values may also be full URLs.
|
|
109
|
+
--local-only Write only to the local server target.
|
|
110
|
+
--no-local Exclude local targets when --sync includes them.
|
|
111
|
+
--dry-run Build and validate without writing.
|
|
112
|
+
--json Print machine-readable JSON.
|
|
113
|
+
--allow-secrets Allow bodies that look like credentials.
|
|
114
|
+
--token <jwt> Auth token. Required for writes.
|
|
115
|
+
|
|
116
|
+
Promotion:
|
|
117
|
+
If the target is a plain page whose body already contains a valid
|
|
118
|
+
<!-- skill-config ... --> block, this command adopts it: the block is parsed,
|
|
119
|
+
normalized and written back into record.meta (kind="skill" + skillConfig),
|
|
120
|
+
keeping the same dbKey. Use --dry-run first to preview.
|
|
121
|
+
`);
|
|
122
|
+
}
|
|
123
|
+
async function resolveExistingRecord(args) {
|
|
124
|
+
for (const serverUrl of args.targets) {
|
|
125
|
+
try {
|
|
126
|
+
const record = await readPageRecord({
|
|
127
|
+
authToken: args.authToken,
|
|
128
|
+
dbKey: args.dbKey,
|
|
129
|
+
serverUrl
|
|
130
|
+
});
|
|
131
|
+
if (record) {
|
|
132
|
+
return { record, serverUrl };
|
|
133
|
+
}
|
|
134
|
+
} catch {
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
throw new Error(`doc not found on any target: ${args.dbKey}`);
|
|
138
|
+
}
|
|
139
|
+
async function runUpdateCommand(args, deps, options) {
|
|
140
|
+
if (hasHelpArg(args)) {
|
|
141
|
+
options.usage(process.stdout);
|
|
142
|
+
return 0;
|
|
143
|
+
}
|
|
144
|
+
const explicitId = readOption(args, "--id");
|
|
145
|
+
const explicitKey = readOption(args, "--key");
|
|
146
|
+
if (!explicitId && !explicitKey) {
|
|
147
|
+
options.usage(process.stderr);
|
|
148
|
+
return 1;
|
|
149
|
+
}
|
|
150
|
+
const docKind = resolveDocKind(args, options.defaultKind);
|
|
151
|
+
const shouldDryRun = hasFlag(args, "--dry-run");
|
|
152
|
+
const shouldOutputJson = hasFlag(args, "--json");
|
|
153
|
+
const allowSecrets = hasFlag(args, "--allow-secrets");
|
|
154
|
+
const { authToken, userId } = requireTokenUser(args, deps.env, shouldDryRun);
|
|
155
|
+
const targets = resolveWriteTargets(args, deps.env);
|
|
156
|
+
if (!targets.length) {
|
|
157
|
+
throw new Error("No write targets resolved. Check --sync / --local-only / --no-local.");
|
|
158
|
+
}
|
|
159
|
+
const dbKey = explicitKey ?? (docKind === "skill" ? buildSkillPageKey(userId, explicitId) : buildPageKey(userId, explicitId));
|
|
160
|
+
const { record: existing } = await resolveExistingRecord({ authToken, dbKey, targets });
|
|
161
|
+
const existingSkillMeta = resolvePageSkillMetadata(existing);
|
|
162
|
+
const metaKindIsSkill = existing?.meta?.kind === "skill";
|
|
163
|
+
const bodyDeclaresSkill = Boolean(existingSkillMeta?.skillConfig);
|
|
164
|
+
if (docKind === "page" && (metaKindIsSkill || bodyDeclaresSkill)) {
|
|
165
|
+
throw new Error(`Target page is a skill doc. Use nolo skill-doc update --key ${dbKey}`);
|
|
166
|
+
}
|
|
167
|
+
if (docKind === "skill" && !metaKindIsSkill && !bodyDeclaresSkill) {
|
|
168
|
+
throw new Error(
|
|
169
|
+
`Target page is not a skill doc and its body has no valid skill-config block. Use nolo doc update --key ${dbKey}`
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
const isPromotion = docKind === "skill" && !metaKindIsSkill && bodyDeclaresSkill;
|
|
173
|
+
const explicitTitle = readTitle(args);
|
|
174
|
+
const title = explicitTitle ?? existing?.title;
|
|
175
|
+
if (!title) {
|
|
176
|
+
throw new Error(`doc has no title and none was provided: ${dbKey}`);
|
|
177
|
+
}
|
|
178
|
+
const newSpaceId = readOption(args, "--space");
|
|
179
|
+
const spaceId = newSpaceId !== void 0 ? newSpaceId : existing?.spaceId ?? null;
|
|
180
|
+
let record;
|
|
181
|
+
let skillSummary;
|
|
182
|
+
if (docKind === "skill") {
|
|
183
|
+
const meta = existingSkillMeta;
|
|
184
|
+
const currentConfig = meta?.skillConfig;
|
|
185
|
+
if (!currentConfig) {
|
|
186
|
+
throw new Error(`existing skill doc is missing skillConfig: ${dbKey}`);
|
|
187
|
+
}
|
|
188
|
+
const parsed = parseSkillDocProtocol(existing?.content ?? "", meta);
|
|
189
|
+
const description = readOption(args, "--description") ?? currentConfig.description;
|
|
190
|
+
const explicitName = readOption(args, "--name");
|
|
191
|
+
if (explicitName !== void 0 && !explicitName.trim()) {
|
|
192
|
+
throw new Error("--name cannot be empty. Omit it to keep the current skill name.");
|
|
193
|
+
}
|
|
194
|
+
const body = readBodyArg(args, parsed.content ?? "");
|
|
195
|
+
const secretFindings = findPotentialSecrets(body);
|
|
196
|
+
if (secretFindings.length && !allowSecrets) {
|
|
197
|
+
throw new Error(
|
|
198
|
+
[
|
|
199
|
+
"Document body appears to contain credentials or secrets. Pass --allow-secrets to write it anyway.",
|
|
200
|
+
formatSecretFindings(secretFindings)
|
|
201
|
+
].join("\n")
|
|
202
|
+
);
|
|
203
|
+
}
|
|
204
|
+
const mergedConfig = {
|
|
205
|
+
...currentConfig,
|
|
206
|
+
// The skill's `name` is its identity (other docs reference it), while the
|
|
207
|
+
// page title is prose. They coincide for docs created via skill-doc create,
|
|
208
|
+
// but diverge when promoting a page. --name targets the identity alone, so
|
|
209
|
+
// a doc can get a readable title without breaking references; without it,
|
|
210
|
+
// only an explicit --title renames.
|
|
211
|
+
name: explicitName ?? explicitTitle ?? currentConfig.name ?? title,
|
|
212
|
+
description,
|
|
213
|
+
...parseJsonArg(readOption(args, "--tools"), currentConfig.toolNames ?? []).length ? { toolNames: parseJsonArg(readOption(args, "--tools"), currentConfig.toolNames ?? []) } : {},
|
|
214
|
+
...parseJsonArg(readOption(args, "--required-skills"), currentConfig.requiredSkills ?? []).length ? { requiredSkills: parseJsonArg(readOption(args, "--required-skills"), currentConfig.requiredSkills ?? []) } : {},
|
|
215
|
+
...parseJsonArg(readOption(args, "--recommended-skills"), currentConfig.recommendedSkills ?? []).length ? { recommendedSkills: parseJsonArg(readOption(args, "--recommended-skills"), currentConfig.recommendedSkills ?? []) } : {},
|
|
216
|
+
...parseJsonArg(readOption(args, "--preferred-agents"), currentConfig.preferredAgents ?? []).length ? { preferredAgents: parseJsonArg(readOption(args, "--preferred-agents"), currentConfig.preferredAgents ?? []) } : {},
|
|
217
|
+
...readOption(args, "--trigger-mode") ? { triggerMode: readOption(args, "--trigger-mode") } : {},
|
|
218
|
+
...readOption(args, "--budget-tier") ? { budgetTier: readOption(args, "--budget-tier") } : {},
|
|
219
|
+
...readOption(args, "--prompt-patch") !== void 0 ? { promptPatch: readOption(args, "--prompt-patch") } : {}
|
|
220
|
+
};
|
|
221
|
+
const skillId = typeof existing?.id === "string" ? existing.id : dbKey.split("-").pop();
|
|
222
|
+
record = buildSkillPageRecord({
|
|
223
|
+
dbKey,
|
|
224
|
+
skillId,
|
|
225
|
+
title,
|
|
226
|
+
spaceId,
|
|
227
|
+
body,
|
|
228
|
+
skillConfig: mergedConfig,
|
|
229
|
+
evalConfig: meta?.evalConfig,
|
|
230
|
+
workflowConfig: meta?.workflowConfig,
|
|
231
|
+
existing
|
|
232
|
+
});
|
|
233
|
+
skillSummary = buildSkillSummaryForRecord(record) ?? void 0;
|
|
234
|
+
} else {
|
|
235
|
+
const description = readOption(args, "--description") ?? existing?.meta?.description ?? "";
|
|
236
|
+
const body = readBodyArg(args, typeof existing?.content === "string" ? existing.content : "");
|
|
237
|
+
const secretFindings = findPotentialSecrets(body);
|
|
238
|
+
if (secretFindings.length && !allowSecrets) {
|
|
239
|
+
throw new Error(
|
|
240
|
+
[
|
|
241
|
+
"Document body appears to contain credentials or secrets. Pass --allow-secrets to write it anyway.",
|
|
242
|
+
formatSecretFindings(secretFindings)
|
|
243
|
+
].join("\n")
|
|
244
|
+
);
|
|
245
|
+
}
|
|
246
|
+
const pageId = typeof existing?.id === "string" ? existing.id : dbKey.split("-").pop();
|
|
247
|
+
record = buildPageRecord({
|
|
248
|
+
dbKey,
|
|
249
|
+
pageId,
|
|
250
|
+
title,
|
|
251
|
+
spaceId,
|
|
252
|
+
content: body,
|
|
253
|
+
existing,
|
|
254
|
+
meta: description ? { description } : void 0
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
const summary = {
|
|
258
|
+
dryRun: shouldDryRun,
|
|
259
|
+
kind: docKind,
|
|
260
|
+
promotedFromPage: isPromotion,
|
|
261
|
+
title,
|
|
262
|
+
dbKey,
|
|
263
|
+
userId,
|
|
264
|
+
spaceId,
|
|
265
|
+
syncTargets: targets,
|
|
266
|
+
writtenTargets: []
|
|
267
|
+
};
|
|
268
|
+
if (!shouldDryRun) {
|
|
269
|
+
for (const serverUrl of targets) {
|
|
270
|
+
await writePageRecord({
|
|
271
|
+
authToken,
|
|
272
|
+
dbKey,
|
|
273
|
+
record,
|
|
274
|
+
serverUrl,
|
|
275
|
+
spaceId,
|
|
276
|
+
title,
|
|
277
|
+
userId,
|
|
278
|
+
skillSummary
|
|
279
|
+
});
|
|
280
|
+
summary.writtenTargets.push(serverUrl);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
if (shouldOutputJson) {
|
|
284
|
+
process.stdout.write(`${JSON.stringify(summary, null, 2)}
|
|
285
|
+
`);
|
|
286
|
+
} else if (shouldDryRun) {
|
|
287
|
+
process.stdout.write(`dry-run ok${isPromotion ? " (promote page -> skill)" : ""}: ${dbKey}
|
|
288
|
+
`);
|
|
289
|
+
} else if (isPromotion) {
|
|
290
|
+
process.stdout.write(`promoted page to skill: ${dbKey}
|
|
291
|
+
`);
|
|
292
|
+
} else {
|
|
293
|
+
process.stdout.write(`updated ${docKind}: ${dbKey}
|
|
294
|
+
`);
|
|
295
|
+
}
|
|
296
|
+
return 0;
|
|
297
|
+
}
|
|
298
|
+
async function runDocUpdateCommand(args, deps) {
|
|
299
|
+
return runUpdateCommand(args, deps, {
|
|
300
|
+
defaultKind: "page",
|
|
301
|
+
usage: printDocUpdateUsage
|
|
302
|
+
});
|
|
303
|
+
}
|
|
304
|
+
async function runSkillDocUpdateCommand(args, deps) {
|
|
305
|
+
return runUpdateCommand(args, deps, {
|
|
306
|
+
defaultKind: "skill",
|
|
307
|
+
usage: printSkillDocUpdateUsage
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
export {
|
|
311
|
+
runDocUpdateCommand,
|
|
312
|
+
runSkillDocUpdateCommand
|
|
313
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {
|
|
2
|
+
fetchMessages,
|
|
3
|
+
isUnboundedMessageLimit
|
|
4
|
+
} from "./chunk-AUGHVUFE.js";
|
|
5
|
+
import "./chunk-PN7AFLOK.js";
|
|
6
|
+
import "./chunk-WWC7I6TA.js";
|
|
7
|
+
import "./chunk-GBRG75BQ.js";
|
|
8
|
+
import "./chunk-3EUW3WEO.js";
|
|
9
|
+
import "./chunk-U6VC4MU4.js";
|
|
10
|
+
import "./chunk-G3SUCT4W.js";
|
|
11
|
+
import "./chunk-KUG52IAP.js";
|
|
12
|
+
import "./chunk-4VNS5WPM.js";
|
|
13
|
+
export {
|
|
14
|
+
fetchMessages,
|
|
15
|
+
isUnboundedMessageLimit
|
|
16
|
+
};
|
|
@@ -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-VQ2AJRGD.js";
|
|
12
|
+
import "./chunk-VIDPVFP3.js";
|
|
13
|
+
import "./chunk-CWMSB67P.js";
|
|
14
|
+
import "./chunk-572EKYLF.js";
|
|
15
|
+
import "./chunk-BR2WP3DF.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,183 @@
|
|
|
1
|
+
import {
|
|
2
|
+
messageStreamEnd,
|
|
3
|
+
prepareAndPersistUserMessage,
|
|
4
|
+
resolveHandleSendMessageContext
|
|
5
|
+
} from "./chunk-QR5IPGT3.js";
|
|
6
|
+
import "./chunk-MRC4Q34M.js";
|
|
7
|
+
import "./chunk-J4576WMJ.js";
|
|
8
|
+
import "./chunk-CWMSB67P.js";
|
|
9
|
+
import {
|
|
10
|
+
streamAgentChatTurn
|
|
11
|
+
} from "./chunk-7YLKNMOM.js";
|
|
12
|
+
import "./chunk-IYQV26RA.js";
|
|
13
|
+
import "./chunk-Z4NR32XR.js";
|
|
14
|
+
import "./chunk-M76ECQRD.js";
|
|
15
|
+
import "./chunk-AUGHVUFE.js";
|
|
16
|
+
import "./chunk-H2RMRZJE.js";
|
|
17
|
+
import "./chunk-UAD2WT54.js";
|
|
18
|
+
import "./chunk-USZMK5UT.js";
|
|
19
|
+
import "./chunk-5MMAK75Q.js";
|
|
20
|
+
import "./chunk-572EKYLF.js";
|
|
21
|
+
import "./chunk-TDIQFT2F.js";
|
|
22
|
+
import "./chunk-JZPBVBIY.js";
|
|
23
|
+
import "./chunk-BR2WP3DF.js";
|
|
24
|
+
import {
|
|
25
|
+
extractCustomId
|
|
26
|
+
} from "./chunk-DFFIZ25G.js";
|
|
27
|
+
import {
|
|
28
|
+
getActiveDialogKey
|
|
29
|
+
} from "./chunk-3ASDTTEI.js";
|
|
30
|
+
import "./chunk-DWLEOOGR.js";
|
|
31
|
+
import "./chunk-HNMXYYJR.js";
|
|
32
|
+
import "./chunk-VEJLAVTC.js";
|
|
33
|
+
import "./chunk-Y5GCAMGP.js";
|
|
34
|
+
import {
|
|
35
|
+
readAndWait,
|
|
36
|
+
selectById
|
|
37
|
+
} from "./chunk-G5H7RNFL.js";
|
|
38
|
+
import "./chunk-AZPCASRE.js";
|
|
39
|
+
import "./chunk-2EISRLRC.js";
|
|
40
|
+
import "./chunk-KX6YBIHG.js";
|
|
41
|
+
import {
|
|
42
|
+
createDialogMessageKeyAndId
|
|
43
|
+
} from "./chunk-PN7AFLOK.js";
|
|
44
|
+
import "./chunk-WWC7I6TA.js";
|
|
45
|
+
import "./chunk-QSJ3HFEF.js";
|
|
46
|
+
import "./chunk-ELRRLDWI.js";
|
|
47
|
+
import "./chunk-EYEEHCU4.js";
|
|
48
|
+
import "./chunk-QYXLLLGL.js";
|
|
49
|
+
import "./chunk-GBRG75BQ.js";
|
|
50
|
+
import "./chunk-4SN6J65J.js";
|
|
51
|
+
import "./chunk-LCBAMY2M.js";
|
|
52
|
+
import "./chunk-3EUW3WEO.js";
|
|
53
|
+
import "./chunk-U6VC4MU4.js";
|
|
54
|
+
import "./chunk-CF7PE763.js";
|
|
55
|
+
import "./chunk-G3SUCT4W.js";
|
|
56
|
+
import "./chunk-KUG52IAP.js";
|
|
57
|
+
import "./chunk-4VNS5WPM.js";
|
|
58
|
+
|
|
59
|
+
// packages/chat/dialog/actions/handleSendMessageAction.ts
|
|
60
|
+
var getDialogConfig = (state, dialogKey) => {
|
|
61
|
+
const resolvedDialogKey = dialogKey ?? getActiveDialogKey();
|
|
62
|
+
if (!resolvedDialogKey) return null;
|
|
63
|
+
const dialog = selectById(state, resolvedDialogKey);
|
|
64
|
+
return dialog ?? null;
|
|
65
|
+
};
|
|
66
|
+
var ensureDialogConfig = async (dispatch, getState, dialogKey) => {
|
|
67
|
+
const state = getState();
|
|
68
|
+
const resolvedDialogKey = dialogKey ?? getActiveDialogKey();
|
|
69
|
+
if (!resolvedDialogKey) return null;
|
|
70
|
+
try {
|
|
71
|
+
const existingDialog = getDialogConfig(state, resolvedDialogKey);
|
|
72
|
+
if (existingDialog && Array.isArray(existingDialog.cybots) && existingDialog.cybots.length > 0) {
|
|
73
|
+
return existingDialog;
|
|
74
|
+
}
|
|
75
|
+
const persistedDialog = await dispatch(readAndWait(resolvedDialogKey)).unwrap();
|
|
76
|
+
if (persistedDialog) return persistedDialog;
|
|
77
|
+
return existingDialog;
|
|
78
|
+
} catch {
|
|
79
|
+
return getDialogConfig(getState(), resolvedDialogKey);
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
var logQuickChatPerfStage = (startedAt, stage, details = {}) => {
|
|
83
|
+
if (!startedAt) return;
|
|
84
|
+
const now = typeof performance !== "undefined" ? performance.now() : Date.now();
|
|
85
|
+
console.info("[QuickChatPerf]", {
|
|
86
|
+
stage,
|
|
87
|
+
elapsedMs: now - startedAt,
|
|
88
|
+
...typeof performance !== "undefined" ? { atMs: now } : {},
|
|
89
|
+
...details
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
var finalizeQuickChatStreamStartupFailure = async (dispatch, dialogConfig, agentKey) => {
|
|
93
|
+
const dialogKey = dialogConfig.dbKey;
|
|
94
|
+
const dialogId = dialogConfig.id ?? (dialogKey ? extractCustomId(dialogKey) : "");
|
|
95
|
+
const { key: msgKey, messageId } = createDialogMessageKeyAndId(dialogId);
|
|
96
|
+
await dispatch(
|
|
97
|
+
messageStreamEnd({
|
|
98
|
+
finalContentBuffer: [
|
|
99
|
+
{
|
|
100
|
+
type: "text",
|
|
101
|
+
text: "[\u9519\u8BEF: \u672A\u80FD\u542F\u52A8\u6A21\u578B\u56DE\u590D\uFF0C\u8BF7\u91CD\u8BD5\u3002]"
|
|
102
|
+
}
|
|
103
|
+
],
|
|
104
|
+
totalUsage: null,
|
|
105
|
+
msgKey,
|
|
106
|
+
agentConfig: {
|
|
107
|
+
dbKey: agentKey
|
|
108
|
+
},
|
|
109
|
+
dialogId,
|
|
110
|
+
dialogKey: dialogKey ?? "",
|
|
111
|
+
messageId,
|
|
112
|
+
reasoningBuffer: ""
|
|
113
|
+
})
|
|
114
|
+
).unwrap?.();
|
|
115
|
+
};
|
|
116
|
+
var handleSendMessageAction = async (args, { dispatch, getState, rejectWithValue }) => {
|
|
117
|
+
try {
|
|
118
|
+
logQuickChatPerfStage(args.quickChatPerfStartedAt, "handle-send-message-entered", {
|
|
119
|
+
dialogKey: args.dialogKey ?? null
|
|
120
|
+
});
|
|
121
|
+
const dialogConfig = await ensureDialogConfig(dispatch, getState, args.dialogKey);
|
|
122
|
+
if (!dialogConfig) {
|
|
123
|
+
throw new Error(
|
|
124
|
+
"handleSendMessage: Dialog configuration is missing."
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
logQuickChatPerfStage(args.quickChatPerfStartedAt, "handle-send-message-dialog-ready", {
|
|
128
|
+
dialogKey: dialogConfig.dbKey,
|
|
129
|
+
cybotCount: dialogConfig.cybots?.length ?? 0
|
|
130
|
+
});
|
|
131
|
+
await dispatch(
|
|
132
|
+
prepareAndPersistUserMessage({
|
|
133
|
+
userInput: args.userInput,
|
|
134
|
+
dialogConfig
|
|
135
|
+
})
|
|
136
|
+
).unwrap();
|
|
137
|
+
logQuickChatPerfStage(args.quickChatPerfStartedAt, "handle-send-message-user-persisted", {
|
|
138
|
+
dialogKey: dialogConfig.dbKey
|
|
139
|
+
});
|
|
140
|
+
const { agentKeyToUse, effectiveRuntimeOptions } = resolveHandleSendMessageContext({
|
|
141
|
+
dialogConfig,
|
|
142
|
+
targetAgentKey: args.targetAgentKey,
|
|
143
|
+
runtimeOptions: args.runtimeOptions
|
|
144
|
+
});
|
|
145
|
+
if (!agentKeyToUse) {
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
const streamResult = await dispatch(
|
|
149
|
+
streamAgentChatTurn({
|
|
150
|
+
agentKey: agentKeyToUse,
|
|
151
|
+
userInput: args.userInput,
|
|
152
|
+
dialogKey: dialogConfig.dbKey,
|
|
153
|
+
parentMessageId: void 0,
|
|
154
|
+
runtimeOptions: effectiveRuntimeOptions,
|
|
155
|
+
quickChatPerfStartedAt: args.quickChatPerfStartedAt
|
|
156
|
+
})
|
|
157
|
+
).unwrap();
|
|
158
|
+
if (args.quickChatPerfStartedAt && streamResult === void 0) {
|
|
159
|
+
logQuickChatPerfStage(args.quickChatPerfStartedAt, "handle-send-message-stream-empty", {
|
|
160
|
+
dialogKey: dialogConfig.dbKey,
|
|
161
|
+
agentKey: agentKeyToUse
|
|
162
|
+
});
|
|
163
|
+
await finalizeQuickChatStreamStartupFailure(
|
|
164
|
+
dispatch,
|
|
165
|
+
dialogConfig,
|
|
166
|
+
agentKeyToUse
|
|
167
|
+
);
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
logQuickChatPerfStage(args.quickChatPerfStartedAt, "handle-send-message-stream-finished", {
|
|
171
|
+
dialogKey: dialogConfig.dbKey,
|
|
172
|
+
agentKey: agentKeyToUse
|
|
173
|
+
});
|
|
174
|
+
return;
|
|
175
|
+
} catch (error) {
|
|
176
|
+
console.error("handleSendMessage failed:", error);
|
|
177
|
+
const errorMessage = error instanceof Error ? error.message : typeof error === "string" ? error : error?.message || error?.error || String(error);
|
|
178
|
+
return rejectWithValue(errorMessage);
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
export {
|
|
182
|
+
handleSendMessageAction
|
|
183
|
+
};
|