nolo-cli 0.8.0-alpha.2 → 0.8.0-alpha.20
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/README.md +1 -1
- package/_executeModel-WRUCQIV5.js +205 -0
- package/action-R4M4ORGA.js +28 -0
- package/addContentAction-UYFFTEWJ.js +26 -0
- package/addDialogAgentAction-OT4XZAVP.js +68 -0
- package/agentDeleteCommand-5DD2IM3J.js +327 -0
- package/agentEmailCommands-IASM2YBQ.js +628 -0
- package/agentListCommands-I6KZYCIG.js +223 -0
- package/agentMachineCommands-OUP3YQP7.js +425 -0
- package/agentPullCommand-O2MTUAFR.js +122 -0
- package/agentRecordCommands-QKGE2JTA.js +96 -0
- package/agentRunCommand-TVZXUBQ5.js +114 -0
- package/agentRunControl-K4VKNEHF.js +57 -0
- package/agentRuntimeLocal-ZYEIPTY4.js +104 -0
- package/agentSlice-T4PMW7W6.js +42 -0
- package/authCommand-EB5JSOX5.js +581 -0
- package/authCommands-XPEHTKSM.js +35 -0
- package/chunk-2EHX7F5G.js +1948 -0
- package/chunk-2FTTDCD4.js +675 -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-4FBRSEV4.js +573 -0
- package/chunk-4IJYA27C.js +342 -0
- package/chunk-4QEWT7KD.js +933 -0
- package/chunk-4SN6J65J.js +38 -0
- package/chunk-4VNS5WPM.js +42 -0
- package/chunk-4ZDM73SD.js +34 -0
- package/chunk-5CS33IBL.js +301 -0
- package/chunk-5KLGBAAR.js +386 -0
- package/chunk-5MIDPSSK.js +206 -0
- package/chunk-5MMAK75Q.js +15 -0
- package/chunk-5W3VUFOX.js +34 -0
- package/chunk-63W5N6P3.js +150 -0
- package/chunk-6HYVJV7B.js +102 -0
- package/chunk-6WD3OOJS.js +20 -0
- package/chunk-7DAJ4AI4.js +191 -0
- package/chunk-7KCUSYT2.js +354 -0
- package/chunk-7T5PWAZN.js +171 -0
- package/chunk-AFON4QUU.js +112 -0
- package/chunk-AGFH73SK.js +239 -0
- package/chunk-ATNTHIZI.js +13 -0
- package/chunk-AVMKZHBC.js +85 -0
- package/chunk-AZPCASRE.js +36 -0
- package/chunk-BBYVOSU2.js +792 -0
- package/chunk-BCIOM4NZ.js +1078 -0
- package/chunk-C3RUNRHT.js +51 -0
- package/chunk-C4FTUXVF.js +146 -0
- package/chunk-CF2WZF4N.js +134 -0
- package/chunk-CF7PE763.js +10 -0
- package/chunk-CKOJQDKR.js +198 -0
- package/chunk-CMKUBIGW.js +1550 -0
- package/chunk-CWMSB67P.js +34 -0
- package/chunk-DCOA4QSN.js +105 -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-FM5IVZXO.js +4723 -0
- package/chunk-FVYY6MCS.js +1447 -0
- package/chunk-G3SUCT4W.js +8 -0
- package/chunk-GAKEBQD6.js +30 -0
- package/chunk-GBRG75BQ.js +86 -0
- package/chunk-GLYVN7EQ.js +238 -0
- package/chunk-H33743XH.js +25 -0
- package/chunk-HNMXYYJR.js +12 -0
- package/chunk-HNW7IJSK.js +71 -0
- package/chunk-I42VC5KR.js +15 -0
- package/chunk-IDZTNRP2.js +85 -0
- package/chunk-IHBCLYEE.js +22310 -0
- package/chunk-IJGXKGXW.js +421 -0
- package/chunk-ISNCLGUZ.js +146 -0
- package/chunk-IWX4UW2E.js +548 -0
- package/chunk-JBTJAPUF.js +35 -0
- package/chunk-JEXVIMYZ.js +55 -0
- package/chunk-JRKKFRAV.js +537 -0
- package/chunk-JZPBVBIY.js +94 -0
- package/chunk-K6BPOQLF.js +2052 -0
- package/chunk-K777STIO.js +478 -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-LCBAMY2M.js +60 -0
- package/chunk-LM6IYQ3F.js +16 -0
- package/chunk-LTRXGFMS.js +83 -0
- package/chunk-M76ECQRD.js +13658 -0
- package/chunk-MNJDFJND.js +222 -0
- package/chunk-MRC4Q34M.js +188 -0
- package/chunk-MTU75CZ2.js +91 -0
- package/chunk-N54XAP77.js +19 -0
- package/chunk-O2ZNTTET.js +3272 -0
- package/chunk-O4BU24WZ.js +3212 -0
- package/chunk-OLZBQWZU.js +6 -0
- package/chunk-OPZYGHUC.js +89 -0
- package/chunk-OWOHNGCN.js +50 -0
- package/chunk-P3PKED2I.js +962 -0
- package/chunk-PFTAG6DY.js +1939 -0
- package/chunk-PMKQGGGM.js +221 -0
- package/chunk-PP4S6RTL.js +175 -0
- package/chunk-QJ7FZNYN.js +939 -0
- package/chunk-QSJ3HFEF.js +8 -0
- package/chunk-RGIM3WLT.js +113 -0
- package/chunk-RL776AGR.js +190 -0
- package/chunk-ROWQEJRP.js +139 -0
- package/chunk-S7Z2HMCN.js +25 -0
- package/chunk-SDJDLO5W.js +628 -0
- package/chunk-SOTZ6RDN.js +69 -0
- package/chunk-TILFE6LV.js +381 -0
- package/chunk-TIMLUWQA.js +231 -0
- package/chunk-TISCADJH.js +807 -0
- package/chunk-U4TRT5V4.js +246 -0
- package/chunk-U6VC4MU4.js +8 -0
- package/chunk-UAD2WT54.js +64 -0
- package/chunk-VC6OZXO5.js +298 -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-VVX233PH.js +482 -0
- package/chunk-W4NVOSFF.js +37 -0
- package/chunk-WI4XWASA.js +208 -0
- package/chunk-WWC7I6TA.js +8 -0
- package/chunk-WZSRQNQG.js +2587 -0
- package/chunk-XBROXIGL.js +3066 -0
- package/chunk-XENYHRUE.js +104 -0
- package/chunk-Y5GCAMGP.js +9 -0
- package/chunk-YN4XDB7B.js +9036 -0
- package/chunk-YPRZSPF3.js +148 -0
- package/chunk-Z4NR32XR.js +50 -0
- package/chunk-Z6EKEXJW.js +138 -0
- package/chunk-ZDRZMLKO.js +27339 -0
- package/chunk-ZNFJWEN4.js +56 -0
- package/cliExecutor-K3F7DMRO.js +36 -0
- package/clipboardy-BVE3LVEH.js +12001 -0
- package/createAgentAutomationAction-CCABEOM6.js +866 -0
- package/createDialogAction-YPKF5ITI.js +55 -0
- package/createPageAction-YEZ7EK5F.js +172 -0
- package/db-HCJ5PRB5.js +271 -0
- package/dbSlice-QPVZHBOE.js +60 -0
- package/deleteFile-SV5MS23W.js +41 -0
- package/dialogCommands-4IX4XIZE.js +63 -0
- package/dialogSlice-OVTO7QGW.js +148 -0
- package/docCreateCommands-SIL3NPGT.js +220 -0
- package/docDeleteCommands-7IOMLUS4.js +181 -0
- package/docReadCommands-FNFXUA5L.js +134 -0
- package/docStore-ZAYLW2HN.js +98 -0
- package/docUpdateCommands-X2HNDVUC.js +318 -0
- package/fetchMessages-KTNM7QAR.js +17 -0
- package/getPricing-3E6UNPKL.js +30 -0
- package/handleSendMessageAction-TZMZ4EP5.js +185 -0
- package/index.js +188 -112958
- package/lib-FYYBQIXS.js +19839 -0
- package/localDialogRead-2VRI24F4.js +26 -0
- package/localFirstLog-DHNOY2NA.js +19 -0
- package/localRuntimeAuthority-TEGCOWX4.js +471 -0
- package/localRuntimeDb-LGDF6FQP.js +12 -0
- package/machineCommands-M4ZJZIMS.js +781 -0
- package/machineInfo-M6KB6HZN.js +10 -0
- package/machineWsRunDispatch-TPJAUGLP.js +112 -0
- package/memoryCommands-O4MIPIWQ.js +476 -0
- package/models-4OPOOLFS.js +9 -0
- package/offlineMarxistsAgentCommand-BCPJITJL.js +242 -0
- package/package.json +4 -23
- package/read-EBMWX4Z6.js +17 -0
- package/readDocTool-2MWHSTQE.js +16 -0
- package/readlineWorkspace-OMCIU3WT.js +5682 -0
- package/removeDialogAgentAction-SNZ662NP.js +73 -0
- package/runAgentClientLoop-H6NGOUAM.js +293 -0
- package/runtimeDoctorCommands-LRHLPDRC.js +289 -0
- package/setDialogExtraReferencesAction-XDI2KM2N.js +60 -0
- package/setPrimaryDialogAgentAction-PYEC4N4Z.js +80 -0
- package/settingSlice-NOWHY2FK.js +199 -0
- package/skillDiscovery-UGSQGX2U.js +16 -0
- package/skillSummaryMarker-42HKSXYY.js +9 -0
- package/slateToRenderMarkdown-Y5IYN73U.js +7 -0
- package/slateUtils-2M7MUTWX.js +19 -0
- package/spaceCommands-E7VOF4LO.js +450 -0
- package/spaceSlice-QHBPICA2.js +149 -0
- package/streamAgentChatTurn-3XTBA2HN.js +4510 -0
- package/tableCommands-R5UCM63M.js +1286 -0
- package/toolApiClient-QI3YBNWB.js +26 -0
- package/tools-GHLZ3XD6.js +87 -0
- package/tuiSummaryLlmCaller-RV3THLZF.js +78 -0
- package/understanding-3CUQQ6SV.js +271 -0
- package/updateCommands-VOSPKXFF.js +31 -0
- package/updateDialogTitleAction-XA2OZTLP.js +188 -0
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import {
|
|
2
|
+
clearCliLocalRuntimePreparedAgentCache
|
|
3
|
+
} from "./chunk-YN4XDB7B.js";
|
|
4
|
+
import {
|
|
5
|
+
getReadableCliDb
|
|
6
|
+
} from "./chunk-W4NVOSFF.js";
|
|
7
|
+
import {
|
|
8
|
+
buildCreatedAgentRecord,
|
|
9
|
+
buildUpdatedAgentRecord,
|
|
10
|
+
normalizeAgentRecordForOutput,
|
|
11
|
+
parseAgentUpdateArgs,
|
|
12
|
+
resolveAgentRecordFromHybridStore,
|
|
13
|
+
sanitizeAgentRecordForCliOutput,
|
|
14
|
+
writeAgentRecord
|
|
15
|
+
} from "./chunk-SDJDLO5W.js";
|
|
16
|
+
import {
|
|
17
|
+
resolveCliAgentKeyInput
|
|
18
|
+
} from "./chunk-VHBWHNVT.js";
|
|
19
|
+
import {
|
|
20
|
+
parseUserIdFromAuthToken,
|
|
21
|
+
resolveAuthToken
|
|
22
|
+
} from "./chunk-ISNCLGUZ.js";
|
|
23
|
+
import {
|
|
24
|
+
toErrorMessage
|
|
25
|
+
} from "./chunk-HNMXYYJR.js";
|
|
26
|
+
|
|
27
|
+
// packages/cli/agentRecordCommands.ts
|
|
28
|
+
async function runAgentReadCommand(args, deps = {}) {
|
|
29
|
+
const env = deps.env ?? process.env;
|
|
30
|
+
const output = deps.output ?? process.stdout;
|
|
31
|
+
const agentInput = args[0]?.trim();
|
|
32
|
+
if (!agentInput || agentInput === "--help" || agentInput === "-h") {
|
|
33
|
+
output.write("Usage: nolo agent read <agent>\n");
|
|
34
|
+
return agentInput ? 0 : 1;
|
|
35
|
+
}
|
|
36
|
+
const authToken = resolveAuthToken(args, env);
|
|
37
|
+
if (!authToken) {
|
|
38
|
+
output.write("[nolo] agent read requires an auth token. Run `nolo login` or set AUTH_TOKEN.\n");
|
|
39
|
+
return 1;
|
|
40
|
+
}
|
|
41
|
+
const agentKey = resolveCliAgentKeyInput(agentInput);
|
|
42
|
+
const db = deps.db ?? await getReadableCliDb(output);
|
|
43
|
+
const fetchImpl = deps.fetchImpl ?? fetch;
|
|
44
|
+
const fallbackFetchImpl = deps.fallbackFetchImpl;
|
|
45
|
+
try {
|
|
46
|
+
const result = await resolveAgentRecordFromHybridStore({
|
|
47
|
+
agentInput,
|
|
48
|
+
cliArgs: args,
|
|
49
|
+
env,
|
|
50
|
+
db,
|
|
51
|
+
fetchImpl,
|
|
52
|
+
fallbackFetchImpl
|
|
53
|
+
});
|
|
54
|
+
if (!result) {
|
|
55
|
+
throw new Error(`agent not found: ${agentKey}`);
|
|
56
|
+
}
|
|
57
|
+
output.write(JSON.stringify({
|
|
58
|
+
...normalizeAgentRecordForOutput(result.agentKey, authToken, result.record),
|
|
59
|
+
source: result.source
|
|
60
|
+
}, null, 2));
|
|
61
|
+
output.write("\n");
|
|
62
|
+
return 0;
|
|
63
|
+
} catch (error) {
|
|
64
|
+
output.write(
|
|
65
|
+
`[nolo] agent read failed: ${toErrorMessage(error)}
|
|
66
|
+
`
|
|
67
|
+
);
|
|
68
|
+
return 1;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
async function runAgentUpdateCommand(args, deps = {}) {
|
|
72
|
+
const env = deps.env ?? process.env;
|
|
73
|
+
const output = deps.output ?? process.stdout;
|
|
74
|
+
let parsed;
|
|
75
|
+
try {
|
|
76
|
+
parsed = parseAgentUpdateArgs(args);
|
|
77
|
+
} catch (error) {
|
|
78
|
+
output.write(`[nolo] agent update failed: ${toErrorMessage(error)}
|
|
79
|
+
`);
|
|
80
|
+
return 1;
|
|
81
|
+
}
|
|
82
|
+
if (!parsed) {
|
|
83
|
+
output.write(
|
|
84
|
+
"Usage: nolo agent update <agent> [--model <id>] [--cli-provider <provider>] [--api-source <source>] [--max-concurrent <n>] [--expires-at <iso>] [--prompt <text> | --prompt-file <path> | --prompt-doc <pageKey>] [--tools <json>] [--copy-provider-from <agent>] [--field key=value]\n".replace("[--field key=value]", `[--handle <name>] [--field key=value] (e.g. --field disabledTools='["exa_search"]' to disable default tools)`)
|
|
85
|
+
);
|
|
86
|
+
return args[0] ? 0 : 1;
|
|
87
|
+
}
|
|
88
|
+
const authToken = resolveAuthToken(args, env);
|
|
89
|
+
if (!authToken) {
|
|
90
|
+
output.write("[nolo] agent update requires an auth token. Run `nolo login` or set AUTH_TOKEN.\n");
|
|
91
|
+
return 1;
|
|
92
|
+
}
|
|
93
|
+
const userId = parseUserIdFromAuthToken(authToken);
|
|
94
|
+
if (!userId) {
|
|
95
|
+
output.write("[nolo] agent update could not read userId from AUTH_TOKEN.\n");
|
|
96
|
+
return 1;
|
|
97
|
+
}
|
|
98
|
+
const db = deps.db ?? await getReadableCliDb(output);
|
|
99
|
+
const fetchImpl = deps.fetchImpl ?? fetch;
|
|
100
|
+
const fallbackFetchImpl = deps.fallbackFetchImpl;
|
|
101
|
+
try {
|
|
102
|
+
const built = await buildUpdatedAgentRecord({
|
|
103
|
+
cliArgs: args,
|
|
104
|
+
parsed,
|
|
105
|
+
env,
|
|
106
|
+
db,
|
|
107
|
+
fetchImpl,
|
|
108
|
+
fallbackFetchImpl,
|
|
109
|
+
authToken
|
|
110
|
+
});
|
|
111
|
+
await writeAgentRecord({
|
|
112
|
+
agentKey: built.agentKey,
|
|
113
|
+
authToken,
|
|
114
|
+
fallbackFetchImpl,
|
|
115
|
+
fetchImpl,
|
|
116
|
+
serverUrl: built.serverUrl,
|
|
117
|
+
userId,
|
|
118
|
+
record: built.nextRecord
|
|
119
|
+
});
|
|
120
|
+
await db.put(built.agentKey, {
|
|
121
|
+
...built.nextRecord,
|
|
122
|
+
dbKey: built.agentKey,
|
|
123
|
+
key: built.nextRecord?.key || built.agentKey,
|
|
124
|
+
serverOrigin: built.serverUrl
|
|
125
|
+
});
|
|
126
|
+
clearCliLocalRuntimePreparedAgentCache();
|
|
127
|
+
output.write(JSON.stringify({
|
|
128
|
+
ok: true,
|
|
129
|
+
agentKey: built.agentKey,
|
|
130
|
+
baseUrl: built.serverUrl,
|
|
131
|
+
updates: sanitizeAgentRecordForCliOutput(built.updates),
|
|
132
|
+
record: sanitizeAgentRecordForCliOutput(built.nextRecord)
|
|
133
|
+
}, null, 2));
|
|
134
|
+
output.write("\n");
|
|
135
|
+
return 0;
|
|
136
|
+
} catch (error) {
|
|
137
|
+
output.write(
|
|
138
|
+
`[nolo] agent update failed: ${toErrorMessage(error)}
|
|
139
|
+
`
|
|
140
|
+
);
|
|
141
|
+
return 1;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
async function runAgentCreateCommand(args, deps = {}) {
|
|
145
|
+
const env = deps.env ?? process.env;
|
|
146
|
+
const output = deps.output ?? process.stdout;
|
|
147
|
+
let parsed;
|
|
148
|
+
try {
|
|
149
|
+
parsed = parseAgentUpdateArgs(args);
|
|
150
|
+
} catch (error) {
|
|
151
|
+
output.write(`[nolo] agent create failed: ${toErrorMessage(error)}
|
|
152
|
+
`);
|
|
153
|
+
return 1;
|
|
154
|
+
}
|
|
155
|
+
if (!parsed) {
|
|
156
|
+
output.write(
|
|
157
|
+
"Usage: nolo agent create <agent> [--model <id>] [--cli-provider <provider>] [--api-source <source>] [--max-concurrent <n>] [--expires-at <iso>] [--prompt <text> | --prompt-file <path> | --prompt-doc <pageKey>] [--tools <json>] [--copy-provider-from <agent>] [--name <name>] [--custom-provider-url <url>] [--provider-api-key <key>] [--field key=value]\n".replace("[--field key=value]", "[--handle <name>] [--field key=value]")
|
|
158
|
+
);
|
|
159
|
+
return args[0] ? 0 : 1;
|
|
160
|
+
}
|
|
161
|
+
const authToken = resolveAuthToken(args, env);
|
|
162
|
+
if (!authToken) {
|
|
163
|
+
output.write("[nolo] agent create requires an auth token. Run `nolo login` or set AUTH_TOKEN.\n");
|
|
164
|
+
return 1;
|
|
165
|
+
}
|
|
166
|
+
const userId = parseUserIdFromAuthToken(authToken);
|
|
167
|
+
if (!userId) {
|
|
168
|
+
output.write("[nolo] agent create could not read userId from AUTH_TOKEN.\n");
|
|
169
|
+
return 1;
|
|
170
|
+
}
|
|
171
|
+
const db = deps.db ?? await getReadableCliDb(output);
|
|
172
|
+
const fetchImpl = deps.fetchImpl ?? fetch;
|
|
173
|
+
const fallbackFetchImpl = deps.fallbackFetchImpl;
|
|
174
|
+
try {
|
|
175
|
+
const built = await buildCreatedAgentRecord({
|
|
176
|
+
cliArgs: args,
|
|
177
|
+
parsed,
|
|
178
|
+
env,
|
|
179
|
+
db,
|
|
180
|
+
fetchImpl,
|
|
181
|
+
fallbackFetchImpl,
|
|
182
|
+
authToken
|
|
183
|
+
});
|
|
184
|
+
await writeAgentRecord({
|
|
185
|
+
agentKey: built.agentKey,
|
|
186
|
+
authToken,
|
|
187
|
+
fallbackFetchImpl,
|
|
188
|
+
fetchImpl,
|
|
189
|
+
serverUrl: built.serverUrl,
|
|
190
|
+
userId,
|
|
191
|
+
record: built.nextRecord
|
|
192
|
+
});
|
|
193
|
+
await db.put(built.agentKey, {
|
|
194
|
+
...built.nextRecord,
|
|
195
|
+
dbKey: built.agentKey,
|
|
196
|
+
key: built.nextRecord?.key || built.agentKey,
|
|
197
|
+
serverOrigin: built.serverUrl
|
|
198
|
+
});
|
|
199
|
+
clearCliLocalRuntimePreparedAgentCache();
|
|
200
|
+
output.write(JSON.stringify({
|
|
201
|
+
ok: true,
|
|
202
|
+
agentKey: built.agentKey,
|
|
203
|
+
baseUrl: built.serverUrl,
|
|
204
|
+
updates: sanitizeAgentRecordForCliOutput(built.updates),
|
|
205
|
+
record: sanitizeAgentRecordForCliOutput(built.nextRecord)
|
|
206
|
+
}, null, 2));
|
|
207
|
+
output.write("\n");
|
|
208
|
+
return 0;
|
|
209
|
+
} catch (error) {
|
|
210
|
+
output.write(
|
|
211
|
+
`[nolo] agent create failed: ${toErrorMessage(error)}
|
|
212
|
+
`
|
|
213
|
+
);
|
|
214
|
+
return 1;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
export {
|
|
219
|
+
runAgentReadCommand,
|
|
220
|
+
runAgentUpdateCommand,
|
|
221
|
+
runAgentCreateCommand
|
|
222
|
+
};
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import {
|
|
2
|
+
API_VERSION
|
|
3
|
+
} from "./chunk-LCBAMY2M.js";
|
|
4
|
+
|
|
5
|
+
// packages/auth/routes.ts
|
|
6
|
+
var authRoutes = {
|
|
7
|
+
login: {
|
|
8
|
+
path: `${API_VERSION}/users/login`,
|
|
9
|
+
method: "POST",
|
|
10
|
+
createPath: () => `${API_VERSION}/users/login`
|
|
11
|
+
},
|
|
12
|
+
signup: {
|
|
13
|
+
path: `${API_VERSION}/users/signup`,
|
|
14
|
+
method: "POST",
|
|
15
|
+
createPath: () => `${API_VERSION}/users/signup`
|
|
16
|
+
},
|
|
17
|
+
users: {
|
|
18
|
+
cliLoginStart: {
|
|
19
|
+
path: `${API_VERSION}/users/cli-login/start`,
|
|
20
|
+
method: "POST",
|
|
21
|
+
createPath: () => `${API_VERSION}/users/cli-login/start`
|
|
22
|
+
},
|
|
23
|
+
cliLoginAuthorize: {
|
|
24
|
+
path: `${API_VERSION}/users/cli-login/authorize`,
|
|
25
|
+
method: "POST",
|
|
26
|
+
createPath: () => `${API_VERSION}/users/cli-login/authorize`
|
|
27
|
+
},
|
|
28
|
+
cliLoginPoll: {
|
|
29
|
+
path: `${API_VERSION}/users/cli-login/poll`,
|
|
30
|
+
method: "POST",
|
|
31
|
+
createPath: () => `${API_VERSION}/users/cli-login/poll`
|
|
32
|
+
},
|
|
33
|
+
list: {
|
|
34
|
+
path: `${API_VERSION}/users`,
|
|
35
|
+
method: "GET",
|
|
36
|
+
createPath: () => `${API_VERSION}/users`
|
|
37
|
+
},
|
|
38
|
+
usageReport: {
|
|
39
|
+
path: `${API_VERSION}/users/usage-report`,
|
|
40
|
+
method: "GET",
|
|
41
|
+
createPath: () => `${API_VERSION}/users/usage-report`
|
|
42
|
+
},
|
|
43
|
+
growthReport: {
|
|
44
|
+
path: `${API_VERSION}/users/growth-report`,
|
|
45
|
+
method: "GET",
|
|
46
|
+
createPath: () => `${API_VERSION}/users/growth-report`
|
|
47
|
+
},
|
|
48
|
+
providerBillingHealth: {
|
|
49
|
+
path: `${API_VERSION}/users/provider-billing-health`,
|
|
50
|
+
method: "GET",
|
|
51
|
+
createPath: () => `${API_VERSION}/users/provider-billing-health`
|
|
52
|
+
},
|
|
53
|
+
providerBillingDrilldown: {
|
|
54
|
+
path: `${API_VERSION}/users/provider-billing-drilldown`,
|
|
55
|
+
method: "GET",
|
|
56
|
+
createPath: () => `${API_VERSION}/users/provider-billing-drilldown`
|
|
57
|
+
},
|
|
58
|
+
providerCredentials: {
|
|
59
|
+
path: `${API_VERSION}/users/provider-credentials`,
|
|
60
|
+
method: "GET",
|
|
61
|
+
createPath: () => `${API_VERSION}/users/provider-credentials`
|
|
62
|
+
},
|
|
63
|
+
providerCredentialLifecycle: {
|
|
64
|
+
path: `${API_VERSION}/users/provider-credentials/lifecycle`,
|
|
65
|
+
method: "POST",
|
|
66
|
+
createPath: () => `${API_VERSION}/users/provider-credentials/lifecycle`
|
|
67
|
+
},
|
|
68
|
+
billingAnomalyLifecycle: {
|
|
69
|
+
path: `${API_VERSION}/users/billing-anomalies/lifecycle`,
|
|
70
|
+
method: "POST",
|
|
71
|
+
createPath: () => `${API_VERSION}/users/billing-anomalies/lifecycle`
|
|
72
|
+
},
|
|
73
|
+
billingAnomalyDrilldown: {
|
|
74
|
+
path: `${API_VERSION}/users/billing-anomalies/drilldown`,
|
|
75
|
+
method: "GET",
|
|
76
|
+
createPath: () => `${API_VERSION}/users/billing-anomalies/drilldown`
|
|
77
|
+
},
|
|
78
|
+
billingAnomalyAudit: {
|
|
79
|
+
path: `${API_VERSION}/users/billing-anomalies/audit`,
|
|
80
|
+
method: "POST",
|
|
81
|
+
createPath: () => `${API_VERSION}/users/billing-anomalies/audit`
|
|
82
|
+
},
|
|
83
|
+
detail: {
|
|
84
|
+
path: `${API_VERSION}/users/:userId`,
|
|
85
|
+
method: "GET",
|
|
86
|
+
createPath: (params) => `${API_VERSION}/users/${params.userId}`
|
|
87
|
+
},
|
|
88
|
+
sessionRevoke: {
|
|
89
|
+
path: `${API_VERSION}/users/session-revoke`,
|
|
90
|
+
method: "POST",
|
|
91
|
+
createPath: () => `${API_VERSION}/users/session-revoke`
|
|
92
|
+
},
|
|
93
|
+
transfer: {
|
|
94
|
+
path: `${API_VERSION}/users/:userId/transfer`,
|
|
95
|
+
method: "POST",
|
|
96
|
+
createPath: (params) => `${API_VERSION}/users/${params.userId}/transfer`
|
|
97
|
+
},
|
|
98
|
+
delete: {
|
|
99
|
+
path: `${API_VERSION}/users/:userId`,
|
|
100
|
+
method: "DELETE",
|
|
101
|
+
createPath: (params) => `${API_VERSION}/users/${params.userId}`
|
|
102
|
+
},
|
|
103
|
+
disable: {
|
|
104
|
+
path: `${API_VERSION}/users/:userId/disable`,
|
|
105
|
+
method: "POST",
|
|
106
|
+
createPath: (params) => `${API_VERSION}/users/${params.userId}/disable`
|
|
107
|
+
},
|
|
108
|
+
enable: {
|
|
109
|
+
path: `${API_VERSION}/users/:userId/enable`,
|
|
110
|
+
method: "POST",
|
|
111
|
+
createPath: (params) => `${API_VERSION}/users/${params.userId}/enable`
|
|
112
|
+
},
|
|
113
|
+
adminPermissions: {
|
|
114
|
+
path: `${API_VERSION}/users/:userId/admin-permissions`,
|
|
115
|
+
method: "POST",
|
|
116
|
+
createPath: (params) => `${API_VERSION}/users/${params.userId}/admin-permissions`
|
|
117
|
+
},
|
|
118
|
+
sendEmail: {
|
|
119
|
+
path: `${API_VERSION}/users/send-email`,
|
|
120
|
+
method: "POST",
|
|
121
|
+
createPath: () => `${API_VERSION}/users/send-email`
|
|
122
|
+
},
|
|
123
|
+
spaceInvite: {
|
|
124
|
+
path: `${API_VERSION}/users/space-invite`,
|
|
125
|
+
method: "POST",
|
|
126
|
+
createPath: () => `${API_VERSION}/users/space-invite`
|
|
127
|
+
},
|
|
128
|
+
spaceInviteStatus: {
|
|
129
|
+
path: `${API_VERSION}/users/space-invite/status`,
|
|
130
|
+
method: "GET",
|
|
131
|
+
createPath: () => `${API_VERSION}/users/space-invite/status`
|
|
132
|
+
},
|
|
133
|
+
spaceInviteAccept: {
|
|
134
|
+
path: `${API_VERSION}/users/space-invite/accept`,
|
|
135
|
+
method: "POST",
|
|
136
|
+
createPath: () => `${API_VERSION}/users/space-invite/accept`
|
|
137
|
+
},
|
|
138
|
+
emailPreferencesGet: {
|
|
139
|
+
path: `${API_VERSION}/users/email-preferences`,
|
|
140
|
+
method: "GET",
|
|
141
|
+
createPath: () => `${API_VERSION}/users/email-preferences`
|
|
142
|
+
},
|
|
143
|
+
emailPreferencesUpdate: {
|
|
144
|
+
path: `${API_VERSION}/users/email-preferences`,
|
|
145
|
+
method: "POST",
|
|
146
|
+
createPath: () => `${API_VERSION}/users/email-preferences`
|
|
147
|
+
},
|
|
148
|
+
emailReport: {
|
|
149
|
+
path: `${API_VERSION}/users/email-report`,
|
|
150
|
+
method: "GET",
|
|
151
|
+
createPath: () => `${API_VERSION}/users/email-report`
|
|
152
|
+
},
|
|
153
|
+
emailRetryRun: {
|
|
154
|
+
path: `${API_VERSION}/users/email-retry/run`,
|
|
155
|
+
method: "POST",
|
|
156
|
+
createPath: () => `${API_VERSION}/users/email-retry/run`
|
|
157
|
+
},
|
|
158
|
+
emailReplayFailures: {
|
|
159
|
+
path: `${API_VERSION}/users/email-replay-failures`,
|
|
160
|
+
method: "POST",
|
|
161
|
+
createPath: () => `${API_VERSION}/users/email-replay-failures`
|
|
162
|
+
},
|
|
163
|
+
emailConfigGet: {
|
|
164
|
+
path: `${API_VERSION}/users/email-config`,
|
|
165
|
+
method: "GET",
|
|
166
|
+
createPath: () => `${API_VERSION}/users/email-config`
|
|
167
|
+
},
|
|
168
|
+
emailConfigUpdate: {
|
|
169
|
+
path: `${API_VERSION}/users/email-config`,
|
|
170
|
+
method: "POST",
|
|
171
|
+
createPath: () => `${API_VERSION}/users/email-config`
|
|
172
|
+
},
|
|
173
|
+
emailUnsubscribe: {
|
|
174
|
+
path: `${API_VERSION}/users/email-unsubscribe`,
|
|
175
|
+
method: "GET",
|
|
176
|
+
createPath: () => `${API_VERSION}/users/email-unsubscribe`
|
|
177
|
+
},
|
|
178
|
+
rechargeHistory: {
|
|
179
|
+
path: `${API_VERSION}/users/:userId/recharge-history`,
|
|
180
|
+
method: "POST",
|
|
181
|
+
createPath: (params) => `${API_VERSION}/users/${params.userId}/recharge-history`
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
export {
|
|
187
|
+
authRoutes
|
|
188
|
+
};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import {
|
|
2
|
+
dialogMessageKey
|
|
3
|
+
} from "./chunk-O4BU24WZ.js";
|
|
4
|
+
import {
|
|
5
|
+
asOptionalFiniteNumber
|
|
6
|
+
} from "./chunk-WWC7I6TA.js";
|
|
7
|
+
import {
|
|
8
|
+
asOptionalTrimmedString
|
|
9
|
+
} from "./chunk-G3SUCT4W.js";
|
|
10
|
+
|
|
11
|
+
// packages/core/chat/dialogAttachmentCleanup.ts
|
|
12
|
+
var FILE_CONTENT_RE = /(?:https?:\/\/[^/"'\s]+)?\/api\/v1\/db\/file\/content\/([^?#"'\s)]+)/g;
|
|
13
|
+
function extractFileContentIds(value) {
|
|
14
|
+
const ids = /* @__PURE__ */ new Set();
|
|
15
|
+
const visit = (input) => {
|
|
16
|
+
if (typeof input === "string") {
|
|
17
|
+
for (const match of input.matchAll(FILE_CONTENT_RE)) {
|
|
18
|
+
const fileId = decodeURIComponent(match[1] ?? "").trim();
|
|
19
|
+
if (fileId) ids.add(fileId);
|
|
20
|
+
}
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
if (Array.isArray(input)) {
|
|
24
|
+
for (const item of input) visit(item);
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
if (input && typeof input === "object") {
|
|
28
|
+
for (const item of Object.values(input)) visit(item);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
visit(value);
|
|
32
|
+
return [...ids];
|
|
33
|
+
}
|
|
34
|
+
function messageDbKey(dialogId, message) {
|
|
35
|
+
const dbKey = asOptionalTrimmedString(message.dbKey);
|
|
36
|
+
if (dbKey) return dbKey;
|
|
37
|
+
const id = asOptionalTrimmedString(message.id);
|
|
38
|
+
if (id) return dialogMessageKey(dialogId, id);
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
function asText(value) {
|
|
42
|
+
return asOptionalTrimmedString(value) ?? null;
|
|
43
|
+
}
|
|
44
|
+
function buildDialogAttachmentPlan(args) {
|
|
45
|
+
const messageKeys = new Set(
|
|
46
|
+
args.messages.map((message) => messageDbKey(args.dialogId, message)).filter((key) => Boolean(key))
|
|
47
|
+
);
|
|
48
|
+
const referencedFileIds = [
|
|
49
|
+
...new Set(args.messages.flatMap((message) => extractFileContentIds(message)))
|
|
50
|
+
];
|
|
51
|
+
const candidates = referencedFileIds.map((fileId) => {
|
|
52
|
+
const metadata = args.metadataByFileId[fileId];
|
|
53
|
+
const ownerType = asText(metadata?.ownerType);
|
|
54
|
+
const ownerId = asText(metadata?.ownerId);
|
|
55
|
+
const ownerDbKey = asText(metadata?.ownerDbKey);
|
|
56
|
+
const fileDbKey = asText(metadata?.dbKey);
|
|
57
|
+
const source = asText(metadata?.source);
|
|
58
|
+
const ownedByDialog = ownerType === "dialog" && ownerId === args.dialogId;
|
|
59
|
+
const ownedByMessage = Boolean(ownerDbKey && messageKeys.has(ownerDbKey));
|
|
60
|
+
const userOwnedReferenced = args.includeUserOwnedReferenced === true && Boolean(args.ownerId) && ownerType === "user" && ownerId === args.ownerId;
|
|
61
|
+
const canDelete = Boolean(fileDbKey && (ownedByDialog || ownedByMessage || userOwnedReferenced));
|
|
62
|
+
return {
|
|
63
|
+
fileId,
|
|
64
|
+
fileDbKey,
|
|
65
|
+
size: asOptionalFiniteNumber(metadata?.size) ?? null,
|
|
66
|
+
ownerType,
|
|
67
|
+
ownerId,
|
|
68
|
+
ownerDbKey,
|
|
69
|
+
source,
|
|
70
|
+
status: canDelete ? "delete" : "retain",
|
|
71
|
+
reason: canDelete ? ownedByMessage ? "ownerDbKey matches a message in this dialog" : userOwnedReferenced ? "user-owned file is referenced by this dialog and explicit referenced-attachment deletion is enabled" : "ownerType/ownerId matches this dialog" : fileDbKey ? "file ownership is not exclusive to this dialog" : "file metadata not found"
|
|
72
|
+
};
|
|
73
|
+
});
|
|
74
|
+
const deleteCandidates = candidates.filter((candidate) => candidate.status === "delete");
|
|
75
|
+
const retainedCandidates = candidates.filter((candidate) => candidate.status === "retain");
|
|
76
|
+
return {
|
|
77
|
+
dialogId: args.dialogId,
|
|
78
|
+
messageCount: args.messages.length,
|
|
79
|
+
referencedFileIds,
|
|
80
|
+
candidates,
|
|
81
|
+
deleteCandidates,
|
|
82
|
+
retainedCandidates,
|
|
83
|
+
bytesToDelete: deleteCandidates.reduce((sum, candidate) => sum + (candidate.size ?? 0), 0),
|
|
84
|
+
metadataReadFailures: args.metadataReadFailures ?? []
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export {
|
|
89
|
+
extractFileContentIds,
|
|
90
|
+
buildDialogAttachmentPlan
|
|
91
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {
|
|
2
|
+
buildAgentRuntimeAgentLookupKeys,
|
|
3
|
+
shouldFetchAgentRuntimeRecordRemotely
|
|
4
|
+
} from "./chunk-O2ZNTTET.js";
|
|
5
|
+
|
|
6
|
+
// packages/cli/client/localAgentRecords.ts
|
|
7
|
+
var buildLocalAgentLookupKeys = buildAgentRuntimeAgentLookupKeys;
|
|
8
|
+
var shouldReadAgentKeyRemotely = shouldFetchAgentRuntimeRecordRemotely;
|
|
9
|
+
|
|
10
|
+
// packages/core/agentHandle.ts
|
|
11
|
+
function normalizeAgentHandle(value) {
|
|
12
|
+
return typeof value === "string" && value.trim() ? value.trim().toLowerCase().replace(/\s+/g, " ") : void 0;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export {
|
|
16
|
+
buildLocalAgentLookupKeys,
|
|
17
|
+
shouldReadAgentKeyRemotely,
|
|
18
|
+
normalizeAgentHandle
|
|
19
|
+
};
|