nolo-cli 0.14.0 → 0.16.0-alpha.1
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-TURRLTZ2.js → _executeModel-QAUS6B7J.js} +24 -24
- package/{action-N3KXFO5V.js → action-GUOZYYGN.js} +4 -4
- package/{addContentAction-4Z762DMR.js → addContentAction-QDGHGUBH.js} +3 -3
- package/{addDialogAgentAction-FALLEKPR.js → addDialogAgentAction-Z4YCYZIV.js} +2 -2
- package/{agentDeleteCommand-AZDVM4HQ.js → agentDeleteCommand-365DMKHW.js} +20 -20
- package/{agentEmailCommands-M4AHOEZ3.js → agentEmailCommands-TQMXL36I.js} +38 -38
- package/{agentGrantCommands-B4MB23VQ.js → agentGrantCommands-JNDE4RWR.js} +2 -2
- package/{agentListCommands-OJLOXSKL.js → agentListCommands-6B5X4RC6.js} +22 -22
- package/{agentMachineCommands-NPMM4Z53.js → agentMachineCommands-LOEARB6V.js} +20 -20
- package/{agentPullCommand-KRBRIFIY.js → agentPullCommand-6HWUT3SW.js} +2 -2
- package/{agentRecordCommands-RVUH7XLZ.js → agentRecordCommands-DCH2WBL2.js} +33 -33
- package/{agentRunCommand-F6W2WKKZ.js → agentRunCommand-SGMH67WT.js} +35 -35
- package/{agentRunControl-IX4F5W2C.js → agentRunControl-6ADXVYMR.js} +2 -2
- package/{agentRuntimeLocal-DSUBT77I.js → agentRuntimeLocal-YSYZ33ER.js} +11 -11
- package/{agentSlice-PCEL26Z7.js → agentSlice-IVE735EV.js} +3 -3
- package/appDeleteCommands-6QYOO3JB.js +124 -0
- package/appDeployCommands-WTCT6XO6.js +163 -0
- package/appDeployStatusCommands-CGWGZJKB.js +144 -0
- package/appGetCommands-O4OCAMRW.js +119 -0
- package/appListCommands-UENFP4XY.js +122 -0
- package/{authCommand-66ME4KZX.js → authCommand-YFTR3347.js} +5 -5
- package/{authCommands-GH5T6RYV.js → authCommands-YXGOXNBZ.js} +3 -3
- package/{chunk-3B2LFO6R.js → browser-image-compression-MFDTD7K6.js} +4 -518
- package/{chunk-5R73BS7Y.js → chunk-4NLUNENX.js} +5 -5
- package/chunk-4QQFLN5C.js +552 -0
- package/{chunk-LNSRTNH7.js → chunk-6565R2TI.js} +20 -16
- package/{chunk-VQFY3VXW.js → chunk-6MHDWKOT.js} +3 -2
- package/{chunk-5NBHQD4D.js → chunk-A7GB5UGH.js} +1 -1
- package/{chunk-MYE5X27Y.js → chunk-BFRVXJJJ.js} +43 -16
- package/{chunk-XIDYAII4.js → chunk-E237VE6U.js} +7 -140
- package/{chunk-IYGQF62W.js → chunk-EMXI3N3Z.js} +3 -3
- package/{chunk-PYAJ6ZSK.js → chunk-G2MKOQCB.js} +1 -1
- package/chunk-GFUIQ4RY.js +136 -0
- package/{chunk-RZALKBP4.js → chunk-GRTFNYLR.js} +2 -2
- package/{chunk-KTFJUPDW.js → chunk-HRQCKQA5.js} +31 -31
- package/chunk-I66RU7P7.js +107 -0
- package/{chunk-OIMX7MM4.js → chunk-ISYE6GZB.js} +1 -1
- package/{chunk-4UUJFFMK.js → chunk-J55UHASN.js} +1 -1
- package/{chunk-V6VXDXGY.js → chunk-JS33TCQ3.js} +2 -2
- package/{chunk-7JJCGV7N.js → chunk-K6EUAOW3.js} +1 -1
- package/{chunk-OHEKYYJF.js → chunk-KMQPSTMJ.js} +6 -6
- package/{chunk-3WGLLTK4.js → chunk-LSFAWXKC.js} +100 -3
- package/{chunk-4ON5AV72.js → chunk-MYMMNKYL.js} +1 -1
- package/{chunk-BHK5ZAW7.js → chunk-N5424GSW.js} +1 -1
- package/{chunk-7LAIOHOL.js → chunk-O53CP2QR.js} +3 -3
- package/{chunk-IMZ7AFIJ.js → chunk-OQMPU2ML.js} +4 -4
- package/{chunk-NZFWHBW5.js → chunk-QLFCNUVQ.js} +496 -442
- package/{chunk-TQCONXQ3.js → chunk-QZVGMD5F.js} +1 -1
- package/{chunk-UW3WOIWJ.js → chunk-RKM3K52F.js} +1 -1
- package/{chunk-TLNEQI2R.js → chunk-RSYUDGGZ.js} +9 -9
- package/{chunk-A5V7UEZJ.js → chunk-SFXYKGK2.js} +3 -3
- package/{chunk-S5UACFUP.js → chunk-TTGAVETO.js} +10 -2
- package/{chunk-BOJVWKNA.js → chunk-U7LEGLEB.js} +1 -1
- package/{chunk-R5AOLZZV.js → chunk-VE6XMVKG.js} +203 -45
- package/{chunk-NJVPXLRY.js → chunk-VPTJB4HM.js} +1 -1
- package/{chunk-PB2DHBEQ.js → chunk-WA6KZL5V.js} +25 -6
- package/{chunk-T3X232L6.js → chunk-WNLPAOIT.js} +1 -1
- package/{chunk-E6KIDMTW.js → chunk-WPN6RMDF.js} +9 -9
- package/{chunk-NFPO7274.js → chunk-WRN5EQT7.js} +1 -1
- package/{chunk-3FCSMQAC.js → chunk-XVP3C2KY.js} +1 -1
- package/{chunk-33K5FKRL.js → chunk-YC3DJILJ.js} +111 -40
- package/{chunk-TYRTLSGX.js → chunk-YNHQIXX5.js} +833 -5746
- package/{chunk-4F4FJPFM.js → chunk-YYIRR6QC.js} +98 -209
- package/{chunk-7TN6V43T.js → chunk-Z24FGIU2.js} +2 -2
- package/{cliEnvHelpers-VYC2OPTB.js → cliEnvHelpers-ZXNMX7VV.js} +1 -1
- package/{createAgentAutomationAction-VLNDOHSP.js → createAgentAutomationAction-TS6NNZ4X.js} +9 -9
- package/{createDialogAction-6WYTS62Z.js → createDialogAction-5HVQ33EX.js} +10 -10
- package/{createPageAction-YKHOC3LW.js → createPageAction-4F3ZGQJD.js} +9 -9
- package/{dbSlice-7Q23HSWH.js → dbSlice-OP6UPXKA.js} +2 -2
- package/{dialogCommands-BQDGLVMO.js → dialogCommands-ZL6L24BS.js} +16 -16
- package/{dialogSlice-2A2JOFZW.js → dialogSlice-FAWUQDJW.js} +9 -9
- package/{docCreateCommands-K2MPMXYF.js → docCreateCommands-LYROQTFH.js} +22 -20
- package/{docDeleteCommands-NBAARB77.js → docDeleteCommands-6TWGTZNR.js} +21 -19
- package/{docReadCommands-S3MO5RPS.js → docReadCommands-PRULNF26.js} +20 -18
- package/{docStore-JJP5PUR7.js → docStore-2UHVWLTV.js} +10 -10
- package/{docUpdateCommands-EHEI7FCE.js → docUpdateCommands-NNYYWJBI.js} +21 -19
- package/{handleSendMessageAction-UAXTF73I.js → handleSendMessageAction-LJPUYNOH.js} +15 -11
- package/index.js +109 -78
- package/{machineCommands-BQ46IS5M.js → machineCommands-JQPEQFSE.js} +36 -36
- package/{machineWsRunDispatch-R33NXNNI.js → machineWsRunDispatch-FFFNWVEW.js} +32 -32
- package/{memoryCommands-AFMES3LN.js → memoryCommands-EBMICQR6.js} +1 -1
- package/package.json +1 -1
- package/{read-SIWMJRHC.js → read-HXHAZBKH.js} +1 -1
- package/{readDocTool-TCYJY4PP.js → readDocTool-VPBDTO4G.js} +1 -1
- package/{readlineWorkspace-KBG4DKLX.js → readlineWorkspace-QSXHSBHA.js} +211 -105
- package/{removeDialogAgentAction-WKHZT6VJ.js → removeDialogAgentAction-HUFVN35S.js} +4 -4
- package/{runAgentClientLoop-MUV5YIRK.js → runAgentClientLoop-A75BUU6D.js} +19 -19
- package/{runtimeDoctorCommands-QNF3J3UV.js → runtimeDoctorCommands-THIHX2SY.js} +1 -1
- package/{setDialogExtraReferencesAction-GCI5QU6E.js → setDialogExtraReferencesAction-2VLGWQKG.js} +2 -2
- package/{setPrimaryDialogAgentAction-NRO57AS6.js → setPrimaryDialogAgentAction-VB4UV2CC.js} +4 -4
- package/{settingSlice-FTWZ5ZHT.js → settingSlice-7JYPQNAC.js} +3 -3
- package/{spaceCommands-4R63UST3.js → spaceCommands-4LE45GB7.js} +21 -21
- package/{spaceSlice-VTC3QXP3.js → spaceSlice-444MFUP6.js} +11 -9
- package/{streamAgentChatTurn-43N7BNV2.js → streamAgentChatTurn-DJAE7USZ.js} +42 -39
- package/{tableCommands-E4SQWDOX.js → tableCommands-3P7MJ3PF.js} +4 -4
- package/{tools-PX6PEJLE.js → tools-YB6LXSVN.js} +14 -14
- package/{tuiSummaryLlmCaller-2D65LKWM.js → tuiSummaryLlmCaller-QQL3JA5I.js} +3 -3
- package/{updateCommands-XZDOOYFH.js → updateCommands-XTW55TOT.js} +2 -2
- package/{updateDialogTitleAction-NPQZWAKG.js → updateDialogTitleAction-6HGFBM64.js} +9 -9
- package/{chunk-3QAF2LTL.js → chunk-DZ3XJVET.js} +3 -3
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
buildCurrentTimeBlock,
|
|
3
3
|
buildIdentityBlock,
|
|
4
4
|
buildRuntimeGuidanceBlocks
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-RKM3K52F.js";
|
|
6
6
|
import {
|
|
7
7
|
canonicalizeToolNames
|
|
8
8
|
} from "./chunk-B4KT7RN2.js";
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
planCompression,
|
|
13
13
|
planContextUsage,
|
|
14
14
|
serializeMessageContent
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-4QQFLN5C.js";
|
|
16
16
|
import {
|
|
17
17
|
clipCompactText
|
|
18
18
|
} from "./chunk-5MMAK75Q.js";
|
|
@@ -1496,6 +1496,7 @@ async function runLocalAgentTurn(input) {
|
|
|
1496
1496
|
// 透出最后一轮 provider 调用的 finish_reason;多轮工具循环里只有最后一轮收尾状态有意义。
|
|
1497
1497
|
...result.finish_reason ? { finish_reason: result.finish_reason } : {},
|
|
1498
1498
|
dialogId: saved.dialogId,
|
|
1499
|
+
title: saved.title,
|
|
1499
1500
|
turnMessages
|
|
1500
1501
|
};
|
|
1501
1502
|
}
|
|
@@ -86,7 +86,7 @@ function resolveDeleteServerCandidates(input, envOrPreferred, preferred) {
|
|
|
86
86
|
);
|
|
87
87
|
}
|
|
88
88
|
function resolveAuthTokenFromEnv(env, extraEnvKeys = []) {
|
|
89
|
-
for (const key of ["AUTH_TOKEN", "AUTH", ...extraEnvKeys]) {
|
|
89
|
+
for (const key of ["AUTH_TOKEN", "AUTH", "NOLO_MACHINE_API_KEY", ...extraEnvKeys]) {
|
|
90
90
|
const value = env[key];
|
|
91
91
|
if (typeof value === "string" && value.trim()) return value;
|
|
92
92
|
}
|
|
@@ -5,13 +5,10 @@ import {
|
|
|
5
5
|
inlineImageUrlsForCustomProvider,
|
|
6
6
|
prepareTools,
|
|
7
7
|
shouldInlineImageUrlsForAgent
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-WRN5EQT7.js";
|
|
9
9
|
import {
|
|
10
10
|
performFetchRequest
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import {
|
|
13
|
-
getPublicImageAgentMode
|
|
14
|
-
} from "./chunk-VIDPVFP3.js";
|
|
11
|
+
} from "./chunk-6565R2TI.js";
|
|
15
12
|
import {
|
|
16
13
|
createSSEParser,
|
|
17
14
|
createToolRunId,
|
|
@@ -22,29 +19,35 @@ import {
|
|
|
22
19
|
toolRunSetPending,
|
|
23
20
|
toolRunStarted,
|
|
24
21
|
toolRunSucceeded
|
|
25
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-VE6XMVKG.js";
|
|
23
|
+
import {
|
|
24
|
+
getPublicImageAgentMode
|
|
25
|
+
} from "./chunk-VIDPVFP3.js";
|
|
26
26
|
import {
|
|
27
27
|
addToolMessage,
|
|
28
28
|
messageStreamEnd,
|
|
29
29
|
messageStreaming,
|
|
30
30
|
selectCurrentSpaceId,
|
|
31
31
|
updateToolMessage
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-YNHQIXX5.js";
|
|
33
33
|
import {
|
|
34
34
|
streamAgentChatTurn
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-OQMPU2ML.js";
|
|
36
36
|
import {
|
|
37
37
|
EMPTY_ASSISTANT_REPAIR_PROMPT
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-6MHDWKOT.js";
|
|
39
39
|
import {
|
|
40
40
|
accumulateToolCallDelta,
|
|
41
41
|
createThinkParserState,
|
|
42
|
+
createToolCallTextParserState,
|
|
42
43
|
flushThinkParser,
|
|
44
|
+
flushToolCallTextParserIntoCallback,
|
|
45
|
+
processContentChunkWithToolCallStripping,
|
|
43
46
|
processThinkChunk
|
|
44
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-LSFAWXKC.js";
|
|
45
48
|
import {
|
|
46
49
|
getModelInfo
|
|
47
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-4QQFLN5C.js";
|
|
48
51
|
import {
|
|
49
52
|
getApiEndpoint
|
|
50
53
|
} from "./chunk-OGGHETUE.js";
|
|
@@ -61,10 +64,10 @@ import {
|
|
|
61
64
|
} from "./chunk-HNMXYYJR.js";
|
|
62
65
|
import {
|
|
63
66
|
selectCurrentServer
|
|
64
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-TTGAVETO.js";
|
|
65
68
|
import {
|
|
66
69
|
write
|
|
67
|
-
} from "./chunk-
|
|
70
|
+
} from "./chunk-SFXYKGK2.js";
|
|
68
71
|
import {
|
|
69
72
|
createDialogMessageKeyAndId,
|
|
70
73
|
dialogMessageKey,
|
|
@@ -1105,6 +1108,7 @@ function createInitialStreamState() {
|
|
|
1105
1108
|
accumulatedToolCalls: [],
|
|
1106
1109
|
reasoningBuffer: "",
|
|
1107
1110
|
thinkState: createThinkParserState(),
|
|
1111
|
+
toolCallTextState: createToolCallTextParserState(),
|
|
1108
1112
|
assistantToolCalls: void 0,
|
|
1109
1113
|
hasHandedOff: false,
|
|
1110
1114
|
hasProcessedToolCalls: false,
|
|
@@ -1248,7 +1252,19 @@ function applyDelta(state, delta) {
|
|
|
1248
1252
|
}
|
|
1249
1253
|
const contentChunk = delta.content || "";
|
|
1250
1254
|
if (contentChunk) {
|
|
1251
|
-
const
|
|
1255
|
+
const { cleanedContent, state: tcState } = processContentChunkWithToolCallStripping(
|
|
1256
|
+
contentChunk,
|
|
1257
|
+
next.toolCallTextState,
|
|
1258
|
+
(name, arguments_) => {
|
|
1259
|
+
next.accumulatedToolCalls = accumulateToolCallChunks(
|
|
1260
|
+
next.accumulatedToolCalls ?? [],
|
|
1261
|
+
[{ index: next.accumulatedToolCalls.length, type: "function", function: { name, arguments: arguments_ } }]
|
|
1262
|
+
);
|
|
1263
|
+
}
|
|
1264
|
+
);
|
|
1265
|
+
next.toolCallTextState = tcState;
|
|
1266
|
+
if (!cleanedContent) return { state: next, hasNewVisibleContent };
|
|
1267
|
+
const parsed = processThinkChunk(cleanedContent, next.thinkState);
|
|
1252
1268
|
next.thinkState = parsed.state;
|
|
1253
1269
|
if (parsed.reasoning) {
|
|
1254
1270
|
next.reasoningBuffer = (next.reasoningBuffer || "") + parsed.reasoning;
|
|
@@ -1438,15 +1454,26 @@ async function readStreamChunkWithTimeout(reader, signal) {
|
|
|
1438
1454
|
async function handleStreamCompletion(state, ctx, finalizeCtx) {
|
|
1439
1455
|
let hasHandedOff = false;
|
|
1440
1456
|
let hasPendingInteraction = false;
|
|
1457
|
+
const { residualContent, state: tcFlushState } = flushToolCallTextParserIntoCallback(
|
|
1458
|
+
state.toolCallTextState,
|
|
1459
|
+
(name, arguments_) => {
|
|
1460
|
+
state.accumulatedToolCalls = accumulateToolCallChunks(
|
|
1461
|
+
state.accumulatedToolCalls ?? [],
|
|
1462
|
+
[{ index: state.accumulatedToolCalls.length, type: "function", function: { name, arguments: arguments_ } }]
|
|
1463
|
+
);
|
|
1464
|
+
}
|
|
1465
|
+
);
|
|
1466
|
+
state.toolCallTextState = tcFlushState;
|
|
1441
1467
|
const flushed = flushThinkParser(state.thinkState);
|
|
1442
1468
|
state.thinkState = flushed.state;
|
|
1443
1469
|
if (flushed.reasoning) {
|
|
1444
1470
|
state.reasoningBuffer = (state.reasoningBuffer || "") + flushed.reasoning;
|
|
1445
1471
|
}
|
|
1446
|
-
|
|
1472
|
+
const combinedFlushContent = residualContent + (flushed.content ?? "");
|
|
1473
|
+
if (combinedFlushContent) {
|
|
1447
1474
|
state = {
|
|
1448
1475
|
...state,
|
|
1449
|
-
contentBuffer: appendTextChunk(state.contentBuffer,
|
|
1476
|
+
contentBuffer: appendTextChunk(state.contentBuffer, combinedFlushContent)
|
|
1450
1477
|
};
|
|
1451
1478
|
}
|
|
1452
1479
|
if (!state.hasProcessedToolCalls && state.accumulatedToolCalls.length > 0) {
|
|
@@ -1,25 +1,22 @@
|
|
|
1
1
|
import {
|
|
2
2
|
readDbRecord,
|
|
3
3
|
writeAgentRecord
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-4NLUNENX.js";
|
|
5
5
|
import {
|
|
6
6
|
buildSkillSummaryMarker
|
|
7
7
|
} from "./chunk-VF4K2QE6.js";
|
|
8
8
|
import {
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
parseUserIdFromAuthToken,
|
|
10
|
+
readOption,
|
|
11
|
+
resolveAuthToken,
|
|
12
|
+
resolveServerUrl
|
|
13
|
+
} from "./chunk-A7GB5UGH.js";
|
|
11
14
|
import {
|
|
12
15
|
createSpaceKey
|
|
13
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-XVP3C2KY.js";
|
|
14
17
|
import {
|
|
15
18
|
asTrimmedLowercaseString
|
|
16
19
|
} from "./chunk-QSJ3HFEF.js";
|
|
17
|
-
import {
|
|
18
|
-
parseUserIdFromAuthToken,
|
|
19
|
-
readOption,
|
|
20
|
-
resolveAuthToken,
|
|
21
|
-
resolveServerUrl
|
|
22
|
-
} from "./chunk-5NBHQD4D.js";
|
|
23
20
|
import {
|
|
24
21
|
NOLO_CLUSTER_SERVERS
|
|
25
22
|
} from "./chunk-LCBAMY2M.js";
|
|
@@ -30,128 +27,6 @@ import {
|
|
|
30
27
|
normalizeServerOrigin
|
|
31
28
|
} from "./chunk-CF7PE763.js";
|
|
32
29
|
|
|
33
|
-
// packages/cli/docPageHelpers.ts
|
|
34
|
-
import { readFileSync } from "node:fs";
|
|
35
|
-
import { ulid } from "ulid";
|
|
36
|
-
function getCliArg(args, flag) {
|
|
37
|
-
const idx = args.indexOf(flag);
|
|
38
|
-
return idx !== -1 ? args[idx + 1] : void 0;
|
|
39
|
-
}
|
|
40
|
-
function readBodyArg(args, fallback = "") {
|
|
41
|
-
const bodyFile = getCliArg(args, "--body-file");
|
|
42
|
-
if (bodyFile !== void 0) {
|
|
43
|
-
return readFileSync(bodyFile, "utf8");
|
|
44
|
-
}
|
|
45
|
-
return getCliArg(args, "--body") ?? fallback;
|
|
46
|
-
}
|
|
47
|
-
function textToSlate(text) {
|
|
48
|
-
return text.split("\n").map((line) => ({
|
|
49
|
-
type: "paragraph",
|
|
50
|
-
children: [{ text: line }]
|
|
51
|
-
}));
|
|
52
|
-
}
|
|
53
|
-
function createPageId() {
|
|
54
|
-
return ulid();
|
|
55
|
-
}
|
|
56
|
-
function buildPageKey(userId, pageId) {
|
|
57
|
-
return `page-${userId}-${pageId}`;
|
|
58
|
-
}
|
|
59
|
-
function buildPageRecord(args) {
|
|
60
|
-
const { dbKey, pageId, title, spaceId, content, existing, meta, slateData } = args;
|
|
61
|
-
const now = Date.now();
|
|
62
|
-
const createdAt = typeof existing?.createdAt === "number" ? existing.createdAt : now;
|
|
63
|
-
const created = typeof existing?.created === "string" ? existing.created : new Date(createdAt).toISOString();
|
|
64
|
-
const nextRecord = {
|
|
65
|
-
...existing ?? {},
|
|
66
|
-
id: existing?.id ?? pageId,
|
|
67
|
-
dbKey,
|
|
68
|
-
type: "page",
|
|
69
|
-
title,
|
|
70
|
-
spaceId,
|
|
71
|
-
content,
|
|
72
|
-
updatedAt: now,
|
|
73
|
-
createdAt,
|
|
74
|
-
created
|
|
75
|
-
};
|
|
76
|
-
if (meta !== void 0) {
|
|
77
|
-
if (meta === null) {
|
|
78
|
-
delete nextRecord.meta;
|
|
79
|
-
} else {
|
|
80
|
-
nextRecord.meta = meta;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
if (slateData !== void 0) {
|
|
84
|
-
if (slateData === null) {
|
|
85
|
-
delete nextRecord.slateData;
|
|
86
|
-
} else {
|
|
87
|
-
nextRecord.slateData = slateData;
|
|
88
|
-
}
|
|
89
|
-
} else if (!existing?.slateData) {
|
|
90
|
-
nextRecord.slateData = textToSlate(content);
|
|
91
|
-
}
|
|
92
|
-
return nextRecord;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
// packages/cli/docSkillHelpers.ts
|
|
96
|
-
function normalizeSkillSeed(input) {
|
|
97
|
-
return input.trim().toLowerCase().replace(/[^a-z0-9\u4e00-\u9fa5]+/g, "-").replace(/^-+|-+$/g, "");
|
|
98
|
-
}
|
|
99
|
-
function deterministicId(prefix, seed) {
|
|
100
|
-
let h = 2166136261;
|
|
101
|
-
for (let i = 0; i < seed.length; i++) {
|
|
102
|
-
h ^= seed.charCodeAt(i);
|
|
103
|
-
h = h * 16777619 >>> 0;
|
|
104
|
-
}
|
|
105
|
-
const suffix = h.toString(36).toUpperCase().padStart(14, "0");
|
|
106
|
-
return (prefix + suffix).slice(0, 26);
|
|
107
|
-
}
|
|
108
|
-
function buildSkillDocId(input) {
|
|
109
|
-
return deterministicId("01SK", normalizeSkillSeed(input) || input);
|
|
110
|
-
}
|
|
111
|
-
function buildSkillPageKey(userId, skillId) {
|
|
112
|
-
return buildPageKey(userId, skillId);
|
|
113
|
-
}
|
|
114
|
-
function buildSkillPageRecord(args) {
|
|
115
|
-
const {
|
|
116
|
-
dbKey,
|
|
117
|
-
skillId,
|
|
118
|
-
title,
|
|
119
|
-
spaceId,
|
|
120
|
-
body,
|
|
121
|
-
skillConfig,
|
|
122
|
-
evalConfig,
|
|
123
|
-
workflowConfig,
|
|
124
|
-
existing
|
|
125
|
-
} = args;
|
|
126
|
-
return {
|
|
127
|
-
...buildPageRecord({
|
|
128
|
-
dbKey,
|
|
129
|
-
pageId: skillId,
|
|
130
|
-
title,
|
|
131
|
-
spaceId,
|
|
132
|
-
content: buildSkillDocMarkdown({
|
|
133
|
-
body,
|
|
134
|
-
skillConfig,
|
|
135
|
-
evalConfig,
|
|
136
|
-
workflowConfig
|
|
137
|
-
}),
|
|
138
|
-
existing,
|
|
139
|
-
meta: {
|
|
140
|
-
...existing?.meta ?? {},
|
|
141
|
-
kind: "skill",
|
|
142
|
-
skillConfig,
|
|
143
|
-
...evalConfig ? { evalConfig } : {},
|
|
144
|
-
...workflowConfig ? { workflowConfig } : {}
|
|
145
|
-
},
|
|
146
|
-
slateData: null
|
|
147
|
-
})
|
|
148
|
-
};
|
|
149
|
-
}
|
|
150
|
-
function parseJsonArg(raw, fallback) {
|
|
151
|
-
if (raw === void 0) return fallback;
|
|
152
|
-
return JSON.parse(raw);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
30
|
// packages/cli/docSpaceHelpers.ts
|
|
156
31
|
async function ensurePageAttachedToSpace(params) {
|
|
157
32
|
const { baseUrl, userId, authToken, spaceId, contentKey, title, skillSummary } = params;
|
|
@@ -333,14 +208,6 @@ function buildSkillSummaryForRecord(record) {
|
|
|
333
208
|
}
|
|
334
209
|
|
|
335
210
|
export {
|
|
336
|
-
readBodyArg,
|
|
337
|
-
createPageId,
|
|
338
|
-
buildPageKey,
|
|
339
|
-
buildPageRecord,
|
|
340
|
-
buildSkillDocId,
|
|
341
|
-
buildSkillPageKey,
|
|
342
|
-
buildSkillPageRecord,
|
|
343
|
-
parseJsonArg,
|
|
344
211
|
removePageFromSpace,
|
|
345
212
|
hasHelpArg,
|
|
346
213
|
hasFlag,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
clearCliLocalRuntimePreparedAgentCache
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-QLFCNUVQ.js";
|
|
4
4
|
import {
|
|
5
5
|
getReadableCliDb
|
|
6
6
|
} from "./chunk-W4NVOSFF.js";
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
resolveAgentRecordFromHybridStore,
|
|
13
13
|
sanitizeAgentRecordForCliOutput,
|
|
14
14
|
writeAgentRecord
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-4NLUNENX.js";
|
|
16
16
|
import {
|
|
17
17
|
resolveCliAgentKeyInput
|
|
18
18
|
} from "./chunk-VHBWHNVT.js";
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
import {
|
|
23
23
|
parseUserIdFromAuthToken,
|
|
24
24
|
resolveAuthToken
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-A7GB5UGH.js";
|
|
26
26
|
|
|
27
27
|
// packages/cli/agentRecordCommands.ts
|
|
28
28
|
async function runAgentReadCommand(args, deps = {}) {
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import {
|
|
2
|
+
buildSkillDocMarkdown
|
|
3
|
+
} from "./chunk-VC6OZXO5.js";
|
|
4
|
+
|
|
5
|
+
// packages/cli/docPageHelpers.ts
|
|
6
|
+
import { readFileSync } from "node:fs";
|
|
7
|
+
import { ulid } from "ulid";
|
|
8
|
+
function getCliArg(args, flag) {
|
|
9
|
+
const idx = args.indexOf(flag);
|
|
10
|
+
return idx !== -1 ? args[idx + 1] : void 0;
|
|
11
|
+
}
|
|
12
|
+
function readBodyArg(args, fallback = "") {
|
|
13
|
+
const bodyFile = getCliArg(args, "--body-file");
|
|
14
|
+
if (bodyFile !== void 0) {
|
|
15
|
+
return readFileSync(bodyFile, "utf8");
|
|
16
|
+
}
|
|
17
|
+
return getCliArg(args, "--body") ?? fallback;
|
|
18
|
+
}
|
|
19
|
+
function textToSlate(text) {
|
|
20
|
+
return text.split("\n").map((line) => ({
|
|
21
|
+
type: "paragraph",
|
|
22
|
+
children: [{ text: line }]
|
|
23
|
+
}));
|
|
24
|
+
}
|
|
25
|
+
function createPageId() {
|
|
26
|
+
return ulid();
|
|
27
|
+
}
|
|
28
|
+
function buildPageKey(userId, pageId) {
|
|
29
|
+
return `page-${userId}-${pageId}`;
|
|
30
|
+
}
|
|
31
|
+
function buildPageRecord(args) {
|
|
32
|
+
const { dbKey, pageId, title, spaceId, content, existing, meta, slateData } = args;
|
|
33
|
+
const now = Date.now();
|
|
34
|
+
const createdAt = typeof existing?.createdAt === "number" ? existing.createdAt : now;
|
|
35
|
+
const created = typeof existing?.created === "string" ? existing.created : new Date(createdAt).toISOString();
|
|
36
|
+
const nextRecord = {
|
|
37
|
+
...existing ?? {},
|
|
38
|
+
id: existing?.id ?? pageId,
|
|
39
|
+
dbKey,
|
|
40
|
+
type: "page",
|
|
41
|
+
title,
|
|
42
|
+
spaceId,
|
|
43
|
+
content,
|
|
44
|
+
updatedAt: now,
|
|
45
|
+
createdAt,
|
|
46
|
+
created
|
|
47
|
+
};
|
|
48
|
+
if (meta !== void 0) {
|
|
49
|
+
if (meta === null) {
|
|
50
|
+
delete nextRecord.meta;
|
|
51
|
+
} else {
|
|
52
|
+
nextRecord.meta = meta;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
if (slateData !== void 0) {
|
|
56
|
+
if (slateData === null) {
|
|
57
|
+
delete nextRecord.slateData;
|
|
58
|
+
} else {
|
|
59
|
+
nextRecord.slateData = slateData;
|
|
60
|
+
}
|
|
61
|
+
} else if (!existing?.slateData) {
|
|
62
|
+
nextRecord.slateData = textToSlate(content);
|
|
63
|
+
}
|
|
64
|
+
return nextRecord;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// packages/cli/docSkillHelpers.ts
|
|
68
|
+
function normalizeSkillSeed(input) {
|
|
69
|
+
return input.trim().toLowerCase().replace(/[^a-z0-9\u4e00-\u9fa5]+/g, "-").replace(/^-+|-+$/g, "");
|
|
70
|
+
}
|
|
71
|
+
function deterministicId(prefix, seed) {
|
|
72
|
+
let h = 2166136261;
|
|
73
|
+
for (let i = 0; i < seed.length; i++) {
|
|
74
|
+
h ^= seed.charCodeAt(i);
|
|
75
|
+
h = h * 16777619 >>> 0;
|
|
76
|
+
}
|
|
77
|
+
const suffix = h.toString(36).toUpperCase().padStart(14, "0");
|
|
78
|
+
return (prefix + suffix).slice(0, 26);
|
|
79
|
+
}
|
|
80
|
+
function buildSkillDocId(input) {
|
|
81
|
+
return deterministicId("01SK", normalizeSkillSeed(input) || input);
|
|
82
|
+
}
|
|
83
|
+
function buildSkillPageKey(userId, skillId) {
|
|
84
|
+
return buildPageKey(userId, skillId);
|
|
85
|
+
}
|
|
86
|
+
function buildSkillPageRecord(args) {
|
|
87
|
+
const {
|
|
88
|
+
dbKey,
|
|
89
|
+
skillId,
|
|
90
|
+
title,
|
|
91
|
+
spaceId,
|
|
92
|
+
body,
|
|
93
|
+
skillConfig,
|
|
94
|
+
evalConfig,
|
|
95
|
+
workflowConfig,
|
|
96
|
+
existing
|
|
97
|
+
} = args;
|
|
98
|
+
return {
|
|
99
|
+
...buildPageRecord({
|
|
100
|
+
dbKey,
|
|
101
|
+
pageId: skillId,
|
|
102
|
+
title,
|
|
103
|
+
spaceId,
|
|
104
|
+
content: buildSkillDocMarkdown({
|
|
105
|
+
body,
|
|
106
|
+
skillConfig,
|
|
107
|
+
evalConfig,
|
|
108
|
+
workflowConfig
|
|
109
|
+
}),
|
|
110
|
+
existing,
|
|
111
|
+
meta: {
|
|
112
|
+
...existing?.meta ?? {},
|
|
113
|
+
kind: "skill",
|
|
114
|
+
skillConfig,
|
|
115
|
+
...evalConfig ? { evalConfig } : {},
|
|
116
|
+
...workflowConfig ? { workflowConfig } : {}
|
|
117
|
+
},
|
|
118
|
+
slateData: null
|
|
119
|
+
})
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
function parseJsonArg(raw, fallback) {
|
|
123
|
+
if (raw === void 0) return fallback;
|
|
124
|
+
return JSON.parse(raw);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export {
|
|
128
|
+
readBodyArg,
|
|
129
|
+
createPageId,
|
|
130
|
+
buildPageKey,
|
|
131
|
+
buildPageRecord,
|
|
132
|
+
buildSkillDocId,
|
|
133
|
+
buildSkillPageKey,
|
|
134
|
+
buildSkillPageRecord,
|
|
135
|
+
parseJsonArg
|
|
136
|
+
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
listUserRecordsFromServers,
|
|
3
3
|
readLiveDbRecordAfterTombstoneMerge
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-J55UHASN.js";
|
|
5
5
|
import {
|
|
6
6
|
agentRecordHasConfiguredCredential
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-4NLUNENX.js";
|
|
8
8
|
import {
|
|
9
9
|
toSafeAgentSummary
|
|
10
10
|
} from "./chunk-OOIN7HSO.js";
|
|
@@ -29,32 +29,6 @@ function pickAgentRuntimeInferenceOptions(agentConfig) {
|
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
// packages/agent-runtime/openAiCompatibleMessages.ts
|
|
33
|
-
function preserveAgentStateFields(source, target) {
|
|
34
|
-
const mutableTarget = target;
|
|
35
|
-
if (source.role === "assistant") {
|
|
36
|
-
if (typeof source.reasoning_content === "string") {
|
|
37
|
-
mutableTarget.reasoning_content = source.reasoning_content;
|
|
38
|
-
}
|
|
39
|
-
if (Array.isArray(source.tool_calls)) {
|
|
40
|
-
mutableTarget.tool_calls = source.tool_calls;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
if (source.role === "tool") {
|
|
44
|
-
const toolCallId = typeof source.tool_call_id === "string" ? source.tool_call_id.trim() : typeof source.toolCallId === "string" ? source.toolCallId.trim() : "";
|
|
45
|
-
if (toolCallId) mutableTarget.tool_call_id = toolCallId;
|
|
46
|
-
}
|
|
47
|
-
return target;
|
|
48
|
-
}
|
|
49
|
-
function toOpenAiCompatibleMessages(messages) {
|
|
50
|
-
return messages.map(
|
|
51
|
-
(message) => preserveAgentStateFields(message, {
|
|
52
|
-
role: message.role,
|
|
53
|
-
content: message.content ?? ""
|
|
54
|
-
})
|
|
55
|
-
);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
32
|
// packages/agent-runtime/platformProviderEndpoints.ts
|
|
59
33
|
var OPENAI_RESPONSES_ENDPOINT = "https://api.openai.com/v1/responses";
|
|
60
34
|
var DEEPSEEK_RESPONSES_ENDPOINT = "https://api.deepseek.com/v1/responses";
|
|
@@ -158,7 +132,7 @@ function resolvePlatformServerUrl(env) {
|
|
|
158
132
|
return trimTrailingSlash(env.NOLO_SERVER || env.BASE_URL || "https://nolo.chat");
|
|
159
133
|
}
|
|
160
134
|
function resolvePlatformAuthToken(env) {
|
|
161
|
-
return env.AUTH_TOKEN || env.AUTH || env.BENCHMARK_AUTH_TOKEN || "";
|
|
135
|
+
return env.AUTH_TOKEN || env.AUTH || env.NOLO_MACHINE_API_KEY || env.BENCHMARK_AUTH_TOKEN || "";
|
|
162
136
|
}
|
|
163
137
|
function canUsePlatformChatProvider(env) {
|
|
164
138
|
return Boolean(resolvePlatformAuthToken(env));
|
|
@@ -370,6 +344,32 @@ async function buildProviderExecutionPlan(args) {
|
|
|
370
344
|
};
|
|
371
345
|
}
|
|
372
346
|
|
|
347
|
+
// packages/agent-runtime/openAiCompatibleMessages.ts
|
|
348
|
+
function preserveAgentStateFields(source, target, options) {
|
|
349
|
+
const mutableTarget = target;
|
|
350
|
+
if (source.role === "assistant") {
|
|
351
|
+
if (!options?.stripReasoningContent && typeof source.reasoning_content === "string") {
|
|
352
|
+
mutableTarget.reasoning_content = source.reasoning_content;
|
|
353
|
+
}
|
|
354
|
+
if (Array.isArray(source.tool_calls)) {
|
|
355
|
+
mutableTarget.tool_calls = source.tool_calls;
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
if (source.role === "tool") {
|
|
359
|
+
const toolCallId = typeof source.tool_call_id === "string" ? source.tool_call_id.trim() : typeof source.toolCallId === "string" ? source.toolCallId.trim() : "";
|
|
360
|
+
if (toolCallId) mutableTarget.tool_call_id = toolCallId;
|
|
361
|
+
}
|
|
362
|
+
return target;
|
|
363
|
+
}
|
|
364
|
+
function toOpenAiCompatibleMessages(messages, options) {
|
|
365
|
+
return messages.map(
|
|
366
|
+
(message) => preserveAgentStateFields(message, {
|
|
367
|
+
role: message.role,
|
|
368
|
+
content: message.content ?? ""
|
|
369
|
+
}, options)
|
|
370
|
+
);
|
|
371
|
+
}
|
|
372
|
+
|
|
373
373
|
// packages/integrations/openai/responsesHelpers.ts
|
|
374
374
|
var RESPONSES_TOP_LEVEL_SCHEMA_KEYS = ["anyOf", "oneOf", "allOf", "enum", "not"];
|
|
375
375
|
var sanitizeResponsesParameters = (parameters) => {
|
|
@@ -575,10 +575,6 @@ function hasImageParts(messages) {
|
|
|
575
575
|
|
|
576
576
|
export {
|
|
577
577
|
pickAgentRuntimeInferenceOptions,
|
|
578
|
-
isImageUrlPart,
|
|
579
|
-
hasImageParts,
|
|
580
|
-
preserveAgentStateFields,
|
|
581
|
-
toOpenAiCompatibleMessages,
|
|
582
578
|
isOpenAiResponsesModel,
|
|
583
579
|
resolvePlatformResponsesEndpoint,
|
|
584
580
|
resolvePlatformChatCompletionsEndpoint,
|
|
@@ -591,6 +587,10 @@ export {
|
|
|
591
587
|
resolveProviderTransportDecision,
|
|
592
588
|
buildProviderAuthHeaders,
|
|
593
589
|
buildProviderExecutionPlan,
|
|
590
|
+
isImageUrlPart,
|
|
591
|
+
hasImageParts,
|
|
592
|
+
preserveAgentStateFields,
|
|
593
|
+
toOpenAiCompatibleMessages,
|
|
594
594
|
toResponsesTools,
|
|
595
595
|
convertMessagesToResponsesInput,
|
|
596
596
|
extractTextFromResponseOutput,
|