nolo-cli 0.34.0-alpha.1 → 0.34.0-alpha.3
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-BUYCXZCQ.js → _executeModel-TMUXL7J5.js} +13 -14
- package/{agentDeleteCommand-WSS2IJVM.js → agentDeleteCommand-KA2IQAPG.js} +2 -2
- package/{agentEmailCommands-SHTPJTSX.js → agentEmailCommands-UIYBGCZW.js} +14 -15
- package/{agentListCommands-GV6UYVAF.js → agentListCommands-L6JNUOLH.js} +2 -2
- package/{agentMachineCommands-FLD7TAFH.js → agentMachineCommands-5CQW5NZR.js} +3 -3
- package/{agentRecordCommands-57W6R7QW.js → agentRecordCommands-VUDJQIZH.js} +14 -15
- package/{agentRunCommand-HJGXSMDN.js → agentRunCommand-EJWYF3BL.js} +16 -17
- package/{agentRunControl-GXOB47YI.js → agentRunControl-7MUPSYDQ.js} +3 -1
- package/{agentRuntimeLocal-G7ZV55I6.js → agentRuntimeLocal-XXBMDMBU.js} +2 -2
- package/{agentSlice-HFR7SP3B.js → agentSlice-HTIEYKIU.js} +1 -1
- package/{agentSuperviseCommands-Q64S5SPG.js → agentSuperviseCommands-MKWW3ICX.js} +3 -3
- package/{appDeleteCommands-SHHE56Y2.js → appDeleteCommands-OUBL6VHB.js} +2 -2
- package/{appDeployCommands-WUMSO2VS.js → appDeployCommands-BZSS2MX4.js} +2 -2
- package/{appDeployStatusCommands-VZSVN6SR.js → appDeployStatusCommands-P2ZQOY5X.js} +2 -2
- package/{appGetCommands-ZJ2C3A5Y.js → appGetCommands-WCFWQZZM.js} +2 -2
- package/{appListCommands-W33L6U5X.js → appListCommands-FVJ3QNL7.js} +2 -2
- package/{chatQueueReduxAdapter-SYIX4ODY.js → chatQueueReduxAdapter-ZP2ZS63U.js} +2 -2
- package/chunk-2BWU4ORW.js +2574 -0
- package/{chunk-6KYCG5GW.js → chunk-5GQ6XCJY.js} +11 -11
- package/{chunk-74IQ5RRO.js → chunk-5LDKQUOT.js} +1 -1
- package/{chunk-6XIE5ZGI.js → chunk-6HIGYUBQ.js} +1 -1
- package/{chunk-MI2J67UU.js → chunk-AA2YUJNV.js} +12 -1
- package/{chunk-KCBK4MDT.js → chunk-AE5GVFMG.js} +4 -4
- package/{chunk-VSA6QAGV.js → chunk-E2OQ5N2F.js} +40 -10
- package/{chunk-KHCLMKZZ.js → chunk-EY7V7REW.js} +280 -6
- package/{chunk-3XZUNRYF.js → chunk-FT4XBCK4.js} +7 -7
- package/{chunk-LQ6PUHW6.js → chunk-I7VDDN45.js} +26 -67
- package/{chunk-7YDKVLAE.js → chunk-IEEEWIVO.js} +3 -3
- package/{chunk-VBD7W4Q6.js → chunk-ILZY5B4U.js} +16 -12
- package/{chunk-4HOXB6SY.js → chunk-IMHO5LC6.js} +100 -27
- package/{chunk-2KO5QQFV.js → chunk-P2I7ELDC.js} +1 -1
- package/{chunk-DX6BP4K7.js → chunk-PILJX4DH.js} +8 -8
- package/{chunk-LAUUAYLK.js → chunk-QI3CHZUT.js} +2 -2
- package/{chunk-YRP7LG4R.js → chunk-RKRXAL3V.js} +7 -16
- package/{chunk-AUH2LTIY.js → chunk-TLBZMLLJ.js} +3 -3
- package/{chunk-3LWZNEGQ.js → chunk-WBZE7C6S.js} +1 -1
- package/{chunk-HDT2RB7T.js → chunk-XMFDQYWA.js} +1 -1
- package/{chunk-FDKEDU7R.js → chunk-Y5W623XU.js} +3 -3
- package/{chunk-VD2SO4RG.js → chunk-Z7COG62J.js} +2 -2
- package/{codingSkills-H6N5EKSX.js → codingSkills-6F4EQFCM.js} +2 -3
- package/{createAgentAutomationAction-BH3D2L2H.js → createAgentAutomationAction-TGUXUZCY.js} +3 -3
- package/{createDialogAction-U4LDV2RW.js → createDialogAction-FD5AEOUF.js} +5 -6
- package/{createPageAction-Q2ANG535.js → createPageAction-NPC3LYNK.js} +4 -5
- package/{dialogCommands-C556D6WD.js → dialogCommands-ZF2RSNCG.js} +2 -2
- package/{dialogSlice-P2VSKG2X.js → dialogSlice-6BINHWQT.js} +2 -2
- package/{docCreateCommands-AAVGLQWE.js → docCreateCommands-4VQ5MOHP.js} +4 -5
- package/{docDeleteCommands-PKMKSQD2.js → docDeleteCommands-M7WLNVPB.js} +4 -5
- package/{docReadCommands-2WUH7UXC.js → docReadCommands-6LU6P2WT.js} +4 -5
- package/{docStore-J5UWRBB4.js → docStore-SIUFLABN.js} +4 -4
- package/{docUpdateCommands-B2N4E5HQ.js → docUpdateCommands-S2LX4ENL.js} +4 -5
- package/{handleSendMessageAction-RRZ53YYH.js → handleSendMessageAction-QVG5YNZY.js} +2 -2
- package/index.js +46 -46
- package/{machineCommands-CWKMJG33.js → machineCommands-OSEBN7BZ.js} +14 -15
- package/{machineWsRunDispatch-UYNVNX4A.js → machineWsRunDispatch-NTJQCIIF.js} +14 -15
- package/package.json +1 -1
- package/{readlineWorkspace-VYELP22P.js → readlineWorkspace-JPME5S7A.js} +130 -82
- package/{runAgentClientLoop-35GKZDOZ.js → runAgentClientLoop-SOKEXCUF.js} +10 -11
- package/{skillDiscovery-COX56OBO.js → skillDiscovery-GPUDHDTZ.js} +1 -2
- package/{spaceCommands-AAKQM2PM.js → spaceCommands-Z5JLMFFJ.js} +2 -2
- package/{spaceSlice-NSNGR4Y2.js → spaceSlice-Z3BGCLGX.js} +3 -3
- package/{streamAgentChatTurn-D5IDHXMV.js → streamAgentChatTurn-INF5RGK4.js} +12 -13
- package/{tools-JQOETZP5.js → tools-ZELMSJZ3.js} +8 -9
- package/{updateDialogTitleAction-WOTSDSFQ.js → updateDialogTitleAction-EDUCIB7G.js} +3 -3
- package/chunk-AETZ7AD6.js +0 -274
- package/chunk-OFZPJ3NT.js +0 -114
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
} from "./chunk-KXKQO4Q6.js";
|
|
32
32
|
import {
|
|
33
33
|
createDocState
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-Z7COG62J.js";
|
|
35
35
|
import {
|
|
36
36
|
ToolApiError,
|
|
37
37
|
buildToolRequestHeaders,
|
|
@@ -61,7 +61,7 @@ import {
|
|
|
61
61
|
buildBuiltinObjectSkillDbKey,
|
|
62
62
|
buildBuiltinObjectSkillPageContent,
|
|
63
63
|
createDialogAction
|
|
64
|
-
} from "./chunk-
|
|
64
|
+
} from "./chunk-Y5W623XU.js";
|
|
65
65
|
import {
|
|
66
66
|
addCategory,
|
|
67
67
|
addContentToSpace,
|
|
@@ -81,7 +81,7 @@ import {
|
|
|
81
81
|
loadTableRows,
|
|
82
82
|
updateContentCategory,
|
|
83
83
|
updateContentTitle
|
|
84
|
-
} from "./chunk-
|
|
84
|
+
} from "./chunk-QI3CHZUT.js";
|
|
85
85
|
import {
|
|
86
86
|
normalizeAppRouteId,
|
|
87
87
|
resolveDialogRuntimeAgentKey,
|
|
@@ -91,13 +91,13 @@ import {
|
|
|
91
91
|
selectMsgById,
|
|
92
92
|
uiAskChoiceFunc,
|
|
93
93
|
uiAskChoiceFunctionSchema
|
|
94
|
-
} from "./chunk-
|
|
94
|
+
} from "./chunk-PILJX4DH.js";
|
|
95
95
|
import {
|
|
96
96
|
createAgent,
|
|
97
97
|
runLlm,
|
|
98
98
|
streamAgentChatTurn,
|
|
99
99
|
updateAgent
|
|
100
|
-
} from "./chunk-
|
|
100
|
+
} from "./chunk-TLBZMLLJ.js";
|
|
101
101
|
import {
|
|
102
102
|
getActiveDialogKey,
|
|
103
103
|
require_react,
|
|
@@ -110,7 +110,7 @@ import {
|
|
|
110
110
|
buildCodingSkillContentBySlug,
|
|
111
111
|
buildCodingSkillId,
|
|
112
112
|
buildCodingSkillPageKey
|
|
113
|
-
} from "./chunk-
|
|
113
|
+
} from "./chunk-P2I7ELDC.js";
|
|
114
114
|
import {
|
|
115
115
|
CAPABILITY_PACKS
|
|
116
116
|
} from "./chunk-IIOHYLIG.js";
|
|
@@ -121,7 +121,7 @@ import {
|
|
|
121
121
|
parseExternalSkillMarkdown,
|
|
122
122
|
parseSkillDocProtocol,
|
|
123
123
|
resolvePageSkillMetadata
|
|
124
|
-
} from "./chunk-
|
|
124
|
+
} from "./chunk-EY7V7REW.js";
|
|
125
125
|
import {
|
|
126
126
|
NOLO_WORKSPACE_TOOL_NAMES,
|
|
127
127
|
buildAgentRuntimeAgentLookupKeys,
|
|
@@ -15303,7 +15303,7 @@ async function deleteDialogsFunc(args, thunkApi) {
|
|
|
15303
15303
|
const deletedDialogIds = [];
|
|
15304
15304
|
const deletedDialogKeys = [];
|
|
15305
15305
|
const failures = [];
|
|
15306
|
-
const { deleteDialog } = await import("./dialogSlice-
|
|
15306
|
+
const { deleteDialog } = await import("./dialogSlice-6BINHWQT.js");
|
|
15307
15307
|
for (const target of targets) {
|
|
15308
15308
|
try {
|
|
15309
15309
|
await thunkApi.dispatch(deleteDialog(target.dbKey)).unwrap();
|
|
@@ -24850,7 +24850,7 @@ var executeToolRun = createAsyncThunk(
|
|
|
24850
24850
|
if (!executionInput) {
|
|
24851
24851
|
throw new Error(`ToolRun ${id} has no input to execute with.`);
|
|
24852
24852
|
}
|
|
24853
|
-
const { findToolExecutor: findToolExecutor2 } = await import("./tools-
|
|
24853
|
+
const { findToolExecutor: findToolExecutor2 } = await import("./tools-ZELMSJZ3.js");
|
|
24854
24854
|
const { executor } = findToolExecutor2(run.toolName);
|
|
24855
24855
|
toolRunStarted({
|
|
24856
24856
|
id: run.id,
|
|
@@ -24874,7 +24874,7 @@ var executeToolRun = createAsyncThunk(
|
|
|
24874
24874
|
const latestState = thunkApi.getState();
|
|
24875
24875
|
const userId = latestState.auth?.currentUser?.userId;
|
|
24876
24876
|
if (userId) {
|
|
24877
|
-
const { fetchUserSpaceMemberships } = await import("./spaceSlice-
|
|
24877
|
+
const { fetchUserSpaceMemberships } = await import("./spaceSlice-Z3BGCLGX.js");
|
|
24878
24878
|
await thunkApi.dispatch(fetchUserSpaceMemberships(userId));
|
|
24879
24879
|
}
|
|
24880
24880
|
}
|
|
@@ -27357,7 +27357,7 @@ async function updateDocFunc(args, thunkApi) {
|
|
|
27357
27357
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
27358
27358
|
};
|
|
27359
27359
|
await dispatch(write({ data: updatedPageData, customKey: id })).unwrap();
|
|
27360
|
-
const { getDocState, applyExternalDocUpdate } = await import("./docStore-
|
|
27360
|
+
const { getDocState, applyExternalDocUpdate } = await import("./docStore-SIUFLABN.js");
|
|
27361
27361
|
if (getDocState().pageKey === id) {
|
|
27362
27362
|
applyExternalDocUpdate({
|
|
27363
27363
|
slateData: finalSlateData,
|
|
@@ -34,10 +34,21 @@ function hasAssistantVisibleOutput(content) {
|
|
|
34
34
|
return false;
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
|
+
var LENGTH_TRUNCATED_REASONING_MARKER = "[length_truncated_reasoning_tail]";
|
|
38
|
+
var MAX_TRUNCATED_REASONING_CHARS = 2e3;
|
|
39
|
+
function formatLengthTruncatedReasoningTail(reasoning_content, maxChars = MAX_TRUNCATED_REASONING_CHARS) {
|
|
40
|
+
if (typeof reasoning_content !== "string") return null;
|
|
41
|
+
const trimmed = reasoning_content.trim();
|
|
42
|
+
if (trimmed.length === 0) return null;
|
|
43
|
+
const tail = trimmed.length > maxChars ? trimmed.slice(-maxChars) : trimmed;
|
|
44
|
+
return `[nolo] ${LENGTH_TRUNCATED_REASONING_MARKER}
|
|
45
|
+
${tail}`;
|
|
46
|
+
}
|
|
37
47
|
|
|
38
48
|
export {
|
|
39
49
|
EMPTY_ASSISTANT_REPAIR_PROMPT,
|
|
40
50
|
resolveEmptyAssistantOutcome,
|
|
41
51
|
resolveEmptyAssistantFallbackMessage,
|
|
42
|
-
hasAssistantVisibleOutput
|
|
52
|
+
hasAssistantVisibleOutput,
|
|
53
|
+
formatLengthTruncatedReasoningTail
|
|
43
54
|
};
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
fetchAndSerializeTable,
|
|
11
11
|
resolveBuiltinSkillPage,
|
|
12
12
|
waitForAbortableDelay
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-5GQ6XCJY.js";
|
|
14
14
|
import {
|
|
15
15
|
createDrainExhaustedResponse,
|
|
16
16
|
isCoreDrainingBody,
|
|
@@ -26,18 +26,18 @@ import {
|
|
|
26
26
|
} from "./chunk-MEYIRKDN.js";
|
|
27
27
|
import {
|
|
28
28
|
fetchAndCacheMessages
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-PILJX4DH.js";
|
|
30
30
|
import {
|
|
31
31
|
shouldUseServerProxy
|
|
32
32
|
} from "./chunk-YYLHWIW6.js";
|
|
33
33
|
import {
|
|
34
34
|
fetchServerSyncedCredential
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-TLBZMLLJ.js";
|
|
36
36
|
import {
|
|
37
37
|
buildSkillGuidancePromptBlock,
|
|
38
38
|
extractRuntimePageCapabilities,
|
|
39
39
|
resolveSkillGraphFromRoots
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-P2I7ELDC.js";
|
|
41
41
|
import {
|
|
42
42
|
buildCurrentTimeBlock,
|
|
43
43
|
buildIdentityBlock,
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
|
|
9
9
|
// packages/cli/agentRunControl.ts
|
|
10
10
|
import { homedir as nodeHomedir } from "node:os";
|
|
11
|
-
import { isAbsolute, join, resolve } from "node:path";
|
|
11
|
+
import { dirname, isAbsolute, join, resolve } from "node:path";
|
|
12
12
|
import * as nodeFs from "node:fs";
|
|
13
13
|
import { execFileSync as nodeExecFileSync, spawn as nodeSpawn } from "node:child_process";
|
|
14
14
|
var RUN_TERMINAL_STATUSES = /* @__PURE__ */ new Set([
|
|
@@ -380,16 +380,42 @@ function rewriteMsgFileArg(args, messagePath) {
|
|
|
380
380
|
}
|
|
381
381
|
return result;
|
|
382
382
|
}
|
|
383
|
-
function
|
|
383
|
+
function resolveValidCliEntrypoint(cliEntrypointPath, fs = nodeFs) {
|
|
384
|
+
if (cliEntrypointPath && fs.existsSync(cliEntrypointPath)) {
|
|
385
|
+
return cliEntrypointPath;
|
|
386
|
+
}
|
|
387
|
+
const fallback = resolveCliEntrypointPath();
|
|
388
|
+
if (fs.existsSync(fallback)) {
|
|
389
|
+
return fallback;
|
|
390
|
+
}
|
|
391
|
+
const candidates = [
|
|
392
|
+
join(dirname(fallback), "cli", "index.ts"),
|
|
393
|
+
join(dirname(fallback), "cli", "index.js"),
|
|
394
|
+
join(dirname(fallback), "..", "packages", "cli", "index.ts"),
|
|
395
|
+
join(dirname(fallback), "..", "packages", "cli", "index.js"),
|
|
396
|
+
join(dirname(fallback), "..", "index.js")
|
|
397
|
+
];
|
|
398
|
+
for (const cand of candidates) {
|
|
399
|
+
if (fs.existsSync(cand)) {
|
|
400
|
+
return cand;
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
return fallback;
|
|
404
|
+
}
|
|
405
|
+
function buildAgentRunChildCommand(options, deps = {}) {
|
|
406
|
+
const fs = deps.fs ?? nodeFs;
|
|
384
407
|
const execPath = process.execPath;
|
|
385
|
-
const entrypoint = options.cliEntrypointPath || resolveCliEntrypointPath();
|
|
386
408
|
const commandParts = options.commandPath ?? [];
|
|
387
409
|
let strippedArgs = stripBackgroundFlag(options.rawArgs);
|
|
388
410
|
if (options.messagePath) {
|
|
389
411
|
strippedArgs = rewriteMsgFileArg(strippedArgs, options.messagePath);
|
|
390
412
|
}
|
|
391
413
|
strippedArgs = absolutizeSkillArgs(strippedArgs);
|
|
392
|
-
if (isCompiledBinary() ||
|
|
414
|
+
if (isCompiledBinary() || options.cliEntrypointPath === execPath) {
|
|
415
|
+
return { execPath, childArgs: [...commandParts, ...strippedArgs] };
|
|
416
|
+
}
|
|
417
|
+
const entrypoint = resolveValidCliEntrypoint(options.cliEntrypointPath, fs);
|
|
418
|
+
if (entrypoint === execPath) {
|
|
393
419
|
return { execPath, childArgs: [...commandParts, ...strippedArgs] };
|
|
394
420
|
}
|
|
395
421
|
return { execPath, childArgs: [entrypoint, ...commandParts, ...strippedArgs] };
|
|
@@ -453,12 +479,15 @@ async function spawnLocalBackgroundRun(input, deps = {}) {
|
|
|
453
479
|
...spawnHead ? { spawnHead } : {}
|
|
454
480
|
};
|
|
455
481
|
fs.writeFileSync(recordPath, JSON.stringify(record, null, 2));
|
|
456
|
-
const { execPath, childArgs } = buildAgentRunChildCommand(
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
482
|
+
const { execPath, childArgs } = buildAgentRunChildCommand(
|
|
483
|
+
{
|
|
484
|
+
rawArgs: input.rawArgs,
|
|
485
|
+
commandPath: input.commandPath,
|
|
486
|
+
cliEntrypointPath: input.cliEntrypointPath,
|
|
487
|
+
messagePath
|
|
488
|
+
},
|
|
489
|
+
deps
|
|
490
|
+
);
|
|
462
491
|
const childEnv = {
|
|
463
492
|
...env,
|
|
464
493
|
NOLO_AGENT_RUN_CHILD: "1",
|
|
@@ -1042,6 +1071,7 @@ export {
|
|
|
1042
1071
|
stripBackgroundFlag,
|
|
1043
1072
|
absolutizeSkillArgs,
|
|
1044
1073
|
rewriteMsgFileArg,
|
|
1074
|
+
buildAgentRunChildCommand,
|
|
1045
1075
|
spawnLocalBackgroundRun,
|
|
1046
1076
|
ackRunRecord,
|
|
1047
1077
|
DEFAULT_ACK_LEASE_TTL_MS,
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
import {
|
|
2
|
+
asTrimmedNonEmptyStringArray
|
|
3
|
+
} from "./chunk-I42VC5KR.js";
|
|
4
|
+
import {
|
|
5
|
+
asOptionalTrimmedString
|
|
6
|
+
} from "./chunk-G3SUCT4W.js";
|
|
7
|
+
|
|
8
|
+
// packages/ai/node_modules/js-yaml/dist/js-yaml.mjs
|
|
2
9
|
function getDefaultExportFromCjs(x) {
|
|
3
10
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
4
11
|
}
|
|
@@ -1276,16 +1283,21 @@ function requireLoader() {
|
|
|
1276
1283
|
state.result += _result;
|
|
1277
1284
|
}
|
|
1278
1285
|
}
|
|
1286
|
+
function chargeMergeWork(state) {
|
|
1287
|
+
state.totalMergeKeys++;
|
|
1288
|
+
if (state.maxTotalMergeKeys !== -1 && state.totalMergeKeys > state.maxTotalMergeKeys) {
|
|
1289
|
+
throwError(state, "merge keys exceeded maxTotalMergeKeys (" + state.maxTotalMergeKeys + ")");
|
|
1290
|
+
}
|
|
1291
|
+
}
|
|
1279
1292
|
function mergeMappings(state, destination, source, overridableKeys) {
|
|
1280
1293
|
if (!common2.isObject(source)) {
|
|
1281
1294
|
throwError(state, "cannot merge mappings; the provided source object is unacceptable");
|
|
1282
1295
|
}
|
|
1296
|
+
chargeMergeWork(state);
|
|
1283
1297
|
const sourceKeys = Object.keys(source);
|
|
1284
1298
|
for (let index = 0, quantity = sourceKeys.length; index < quantity; index += 1) {
|
|
1285
1299
|
const key = sourceKeys[index];
|
|
1286
|
-
|
|
1287
|
-
throwError(state, "merge keys exceeded maxTotalMergeKeys (" + state.maxTotalMergeKeys + ")");
|
|
1288
|
-
}
|
|
1300
|
+
chargeMergeWork(state);
|
|
1289
1301
|
if (!_hasOwnProperty.call(destination, key)) {
|
|
1290
1302
|
setProperty(destination, key, source[key]);
|
|
1291
1303
|
overridableKeys[key] = true;
|
|
@@ -1313,6 +1325,9 @@ function requireLoader() {
|
|
|
1313
1325
|
}
|
|
1314
1326
|
if (keyTag === "tag:yaml.org,2002:merge") {
|
|
1315
1327
|
if (Array.isArray(valueNode)) {
|
|
1328
|
+
if (valueNode.length > 100) {
|
|
1329
|
+
throwError(state, "abnormal merge sequence size");
|
|
1330
|
+
}
|
|
1316
1331
|
for (let index = 0, quantity = valueNode.length; index < quantity; index += 1) {
|
|
1317
1332
|
mergeMappings(state, _result, valueNode[index], overridableKeys);
|
|
1318
1333
|
}
|
|
@@ -3056,7 +3071,266 @@ var {
|
|
|
3056
3071
|
safeDump
|
|
3057
3072
|
} = yaml;
|
|
3058
3073
|
|
|
3074
|
+
// packages/ai/skills/skillDocProtocol.ts
|
|
3075
|
+
var SKILL_DOC_ENUMS = {
|
|
3076
|
+
triggerMode: ["explicit", "required", "recommended"],
|
|
3077
|
+
// budgetTier 只服务 WorkflowReferenceConfig;skill 侧已移除(零读点)。
|
|
3078
|
+
budgetTier: ["low", "medium", "high"],
|
|
3079
|
+
modality: ["text", "image", "video", "audio", "3d"],
|
|
3080
|
+
docKind: ["knowledge", "instruction", "skill"]
|
|
3081
|
+
};
|
|
3082
|
+
var SKILL_CONFIG_BLOCK = "skill-config";
|
|
3083
|
+
var EVAL_CONFIG_BLOCK = "eval-config";
|
|
3084
|
+
var WORKFLOW_CONFIG_BLOCK = "workflow-config";
|
|
3085
|
+
var normalizeStringArray = (value) => {
|
|
3086
|
+
if (!Array.isArray(value)) return void 0;
|
|
3087
|
+
const items = [...new Set(asTrimmedNonEmptyStringArray(value))];
|
|
3088
|
+
return items.length > 0 ? items : void 0;
|
|
3089
|
+
};
|
|
3090
|
+
var normalizeSkillEnumValue = (key, value) => typeof value === "string" && SKILL_DOC_ENUMS[key].includes(value) ? value : void 0;
|
|
3091
|
+
var normalizeSkillModalities = (value) => {
|
|
3092
|
+
const raw = normalizeStringArray(value);
|
|
3093
|
+
if (!raw) return void 0;
|
|
3094
|
+
const filtered = raw.flatMap((item) => {
|
|
3095
|
+
const modality = normalizeSkillEnumValue("modality", item);
|
|
3096
|
+
return modality ? [modality] : [];
|
|
3097
|
+
});
|
|
3098
|
+
return filtered.length > 0 ? Array.from(new Set(filtered)) : void 0;
|
|
3099
|
+
};
|
|
3100
|
+
var normalizeSkillConfig = (value, fallbackTools) => {
|
|
3101
|
+
if (!value || typeof value !== "object") return void 0;
|
|
3102
|
+
const record = value;
|
|
3103
|
+
const name = asOptionalTrimmedString(record.name) ?? "";
|
|
3104
|
+
const description = asOptionalTrimmedString(record.description) ?? "";
|
|
3105
|
+
if (!name || !description) return void 0;
|
|
3106
|
+
const triggerMode = normalizeSkillEnumValue("triggerMode", record.triggerMode);
|
|
3107
|
+
const modalities = normalizeSkillModalities(record.modalities);
|
|
3108
|
+
const toolNames = normalizeStringArray(record.toolNames) ?? normalizeStringArray(fallbackTools) ?? void 0;
|
|
3109
|
+
return {
|
|
3110
|
+
version: "0.1",
|
|
3111
|
+
kind: "skill",
|
|
3112
|
+
id: asOptionalTrimmedString(record.id),
|
|
3113
|
+
name,
|
|
3114
|
+
description,
|
|
3115
|
+
triggerMode,
|
|
3116
|
+
toolNames,
|
|
3117
|
+
modalities,
|
|
3118
|
+
requiredSkills: normalizeStringArray(record.requiredSkills),
|
|
3119
|
+
recommendedSkills: normalizeStringArray(record.recommendedSkills),
|
|
3120
|
+
promptPatch: asOptionalTrimmedString(record.promptPatch)
|
|
3121
|
+
};
|
|
3122
|
+
};
|
|
3123
|
+
var normalizeEvalConfig = (value) => {
|
|
3124
|
+
if (!value || typeof value !== "object") return void 0;
|
|
3125
|
+
const record = value;
|
|
3126
|
+
if (!Array.isArray(record.cases)) return void 0;
|
|
3127
|
+
const cases = [];
|
|
3128
|
+
for (const item of record.cases) {
|
|
3129
|
+
if (!item || typeof item !== "object") continue;
|
|
3130
|
+
const testCase = item;
|
|
3131
|
+
const input = asOptionalTrimmedString(testCase.input) ?? "";
|
|
3132
|
+
if (!input) continue;
|
|
3133
|
+
cases.push({
|
|
3134
|
+
input,
|
|
3135
|
+
expectedTools: normalizeStringArray(testCase.expectedTools),
|
|
3136
|
+
expectedSignals: normalizeStringArray(testCase.expectedSignals),
|
|
3137
|
+
forbiddenSignals: normalizeStringArray(testCase.forbiddenSignals)
|
|
3138
|
+
});
|
|
3139
|
+
}
|
|
3140
|
+
return cases.length > 0 ? {
|
|
3141
|
+
version: "0.1",
|
|
3142
|
+
cases
|
|
3143
|
+
} : void 0;
|
|
3144
|
+
};
|
|
3145
|
+
var normalizeWorkflowConfig = (value) => {
|
|
3146
|
+
if (!value || typeof value !== "object") return void 0;
|
|
3147
|
+
const record = value;
|
|
3148
|
+
const name = asOptionalTrimmedString(record.name) ?? "";
|
|
3149
|
+
const description = asOptionalTrimmedString(record.description) ?? "";
|
|
3150
|
+
if (!name || !description) return void 0;
|
|
3151
|
+
const budgetTier = normalizeSkillEnumValue("budgetTier", record.budgetTier);
|
|
3152
|
+
return {
|
|
3153
|
+
version: "0.1",
|
|
3154
|
+
kind: "workflow",
|
|
3155
|
+
id: asOptionalTrimmedString(record.id),
|
|
3156
|
+
name,
|
|
3157
|
+
description,
|
|
3158
|
+
defaultAgent: asOptionalTrimmedString(record.defaultAgent),
|
|
3159
|
+
inputs: normalizeStringArray(record.inputs),
|
|
3160
|
+
recommendedTools: normalizeStringArray(record.recommendedTools),
|
|
3161
|
+
requiredTools: normalizeStringArray(record.requiredTools),
|
|
3162
|
+
requiredOutputs: normalizeStringArray(record.requiredOutputs),
|
|
3163
|
+
gates: normalizeStringArray(record.gates),
|
|
3164
|
+
budgetTier,
|
|
3165
|
+
contextStrategy: asOptionalTrimmedString(record.contextStrategy),
|
|
3166
|
+
failureProtocol: asOptionalTrimmedString(record.failureProtocol)
|
|
3167
|
+
};
|
|
3168
|
+
};
|
|
3169
|
+
var normalizePageSkillMetadata = (value, fallbackTools) => {
|
|
3170
|
+
if (!value || typeof value !== "object") return void 0;
|
|
3171
|
+
const record = value;
|
|
3172
|
+
const kind = normalizeSkillEnumValue("docKind", record.kind);
|
|
3173
|
+
const meta = {
|
|
3174
|
+
kind,
|
|
3175
|
+
requiredSkills: normalizeStringArray(record.requiredSkills),
|
|
3176
|
+
recommendedSkills: normalizeStringArray(record.recommendedSkills),
|
|
3177
|
+
skillConfig: normalizeSkillConfig(record.skillConfig, fallbackTools),
|
|
3178
|
+
evalConfig: normalizeEvalConfig(record.evalConfig),
|
|
3179
|
+
workflowConfig: normalizeWorkflowConfig(record.workflowConfig)
|
|
3180
|
+
};
|
|
3181
|
+
if (meta.skillConfig && !meta.kind) {
|
|
3182
|
+
meta.kind = "skill";
|
|
3183
|
+
}
|
|
3184
|
+
if (meta.workflowConfig && !meta.kind) {
|
|
3185
|
+
meta.kind = "instruction";
|
|
3186
|
+
}
|
|
3187
|
+
return meta.kind || meta.requiredSkills || meta.recommendedSkills || meta.skillConfig || meta.evalConfig || meta.workflowConfig ? meta : void 0;
|
|
3188
|
+
};
|
|
3189
|
+
var extractCommentBlock = (markdown, blockName) => {
|
|
3190
|
+
if (!markdown) return void 0;
|
|
3191
|
+
const matcher = new RegExp(
|
|
3192
|
+
`<!--\\s*${blockName}\\s*\\n([\\s\\S]*?)-->`,
|
|
3193
|
+
"i"
|
|
3194
|
+
);
|
|
3195
|
+
const match = markdown.match(matcher);
|
|
3196
|
+
return asOptionalTrimmedString(match?.[1]);
|
|
3197
|
+
};
|
|
3198
|
+
var removeCommentBlock = (markdown, blockName) => markdown.replace(
|
|
3199
|
+
new RegExp(`\\n?<!--\\s*${blockName}\\s*\\n[\\s\\S]*?-->\\s*`, "gi"),
|
|
3200
|
+
"\n\n"
|
|
3201
|
+
);
|
|
3202
|
+
var parseYamlObject = (raw) => {
|
|
3203
|
+
if (!raw) return void 0;
|
|
3204
|
+
try {
|
|
3205
|
+
const parsed = load(raw);
|
|
3206
|
+
return parsed && typeof parsed === "object" ? parsed : void 0;
|
|
3207
|
+
} catch {
|
|
3208
|
+
return void 0;
|
|
3209
|
+
}
|
|
3210
|
+
};
|
|
3211
|
+
var parseSkillDocProtocol = (markdown, existingMeta, fallbackTools) => {
|
|
3212
|
+
const source = typeof markdown === "string" ? markdown : "";
|
|
3213
|
+
const skillBlock = parseYamlObject(extractCommentBlock(source, SKILL_CONFIG_BLOCK));
|
|
3214
|
+
const evalBlock = parseYamlObject(extractCommentBlock(source, EVAL_CONFIG_BLOCK));
|
|
3215
|
+
const workflowBlock = parseYamlObject(extractCommentBlock(source, WORKFLOW_CONFIG_BLOCK));
|
|
3216
|
+
const cleanedContent = removeCommentBlock(
|
|
3217
|
+
removeCommentBlock(
|
|
3218
|
+
removeCommentBlock(source, SKILL_CONFIG_BLOCK),
|
|
3219
|
+
EVAL_CONFIG_BLOCK
|
|
3220
|
+
),
|
|
3221
|
+
WORKFLOW_CONFIG_BLOCK
|
|
3222
|
+
).replace(/\n{3,}/g, "\n\n").trim();
|
|
3223
|
+
const parsedMeta = normalizePageSkillMetadata(
|
|
3224
|
+
{
|
|
3225
|
+
...existingMeta ?? {},
|
|
3226
|
+
...skillBlock ? {
|
|
3227
|
+
kind: existingMeta?.kind === "skill" || skillBlock.kind === "skill" ? "skill" : existingMeta?.kind,
|
|
3228
|
+
requiredSkills: skillBlock.requiredSkills ?? existingMeta?.requiredSkills,
|
|
3229
|
+
recommendedSkills: skillBlock.recommendedSkills ?? existingMeta?.recommendedSkills,
|
|
3230
|
+
skillConfig: skillBlock
|
|
3231
|
+
} : {},
|
|
3232
|
+
...evalBlock ? { evalConfig: evalBlock } : {},
|
|
3233
|
+
...workflowBlock ? { workflowConfig: workflowBlock } : {}
|
|
3234
|
+
},
|
|
3235
|
+
fallbackTools
|
|
3236
|
+
);
|
|
3237
|
+
return {
|
|
3238
|
+
content: cleanedContent,
|
|
3239
|
+
meta: parsedMeta
|
|
3240
|
+
};
|
|
3241
|
+
};
|
|
3242
|
+
var resolvePageSkillMetadata = (page) => {
|
|
3243
|
+
if (!page) return void 0;
|
|
3244
|
+
const existingMeta = normalizePageSkillMetadata(page.meta, page.tools);
|
|
3245
|
+
return parseSkillDocProtocol(page.content ?? "", existingMeta, page.tools).meta;
|
|
3246
|
+
};
|
|
3247
|
+
var yamlBlock = (value) => dump(value, { lineWidth: 120, noRefs: true }).trim();
|
|
3248
|
+
var buildSkillConfigComment = (config) => {
|
|
3249
|
+
const payload = {
|
|
3250
|
+
version: config.version,
|
|
3251
|
+
kind: config.kind,
|
|
3252
|
+
...config.id ? { id: config.id } : {},
|
|
3253
|
+
name: config.name,
|
|
3254
|
+
description: config.description,
|
|
3255
|
+
...config.triggerMode ? { triggerMode: config.triggerMode } : {},
|
|
3256
|
+
...config.requiredSkills?.length ? { requiredSkills: config.requiredSkills } : {},
|
|
3257
|
+
...config.recommendedSkills?.length ? { recommendedSkills: config.recommendedSkills } : {},
|
|
3258
|
+
...config.toolNames?.length ? { toolNames: config.toolNames } : {},
|
|
3259
|
+
...config.modalities?.length ? { modalities: config.modalities } : {},
|
|
3260
|
+
...config.promptPatch ? { promptPatch: config.promptPatch } : {}
|
|
3261
|
+
};
|
|
3262
|
+
return `<!-- ${SKILL_CONFIG_BLOCK}
|
|
3263
|
+
${yamlBlock(payload)}
|
|
3264
|
+
-->`;
|
|
3265
|
+
};
|
|
3266
|
+
var buildEvalConfigComment = (config) => `<!-- ${EVAL_CONFIG_BLOCK}
|
|
3267
|
+
${yamlBlock({
|
|
3268
|
+
version: config.version,
|
|
3269
|
+
cases: config.cases
|
|
3270
|
+
})}
|
|
3271
|
+
-->`;
|
|
3272
|
+
var buildWorkflowConfigComment = (config) => `<!-- ${WORKFLOW_CONFIG_BLOCK}
|
|
3273
|
+
${yamlBlock({
|
|
3274
|
+
version: config.version,
|
|
3275
|
+
kind: config.kind,
|
|
3276
|
+
...config.id ? { id: config.id } : {},
|
|
3277
|
+
name: config.name,
|
|
3278
|
+
description: config.description,
|
|
3279
|
+
...config.defaultAgent ? { defaultAgent: config.defaultAgent } : {},
|
|
3280
|
+
...config.inputs?.length ? { inputs: config.inputs } : {},
|
|
3281
|
+
...config.recommendedTools?.length ? { recommendedTools: config.recommendedTools } : {},
|
|
3282
|
+
...config.requiredTools?.length ? { requiredTools: config.requiredTools } : {},
|
|
3283
|
+
...config.requiredOutputs?.length ? { requiredOutputs: config.requiredOutputs } : {},
|
|
3284
|
+
...config.gates?.length ? { gates: config.gates } : {},
|
|
3285
|
+
...config.budgetTier ? { budgetTier: config.budgetTier } : {},
|
|
3286
|
+
...config.contextStrategy ? { contextStrategy: config.contextStrategy } : {},
|
|
3287
|
+
...config.failureProtocol ? { failureProtocol: config.failureProtocol } : {}
|
|
3288
|
+
})}
|
|
3289
|
+
-->`;
|
|
3290
|
+
var buildSkillDocMarkdown = (options) => {
|
|
3291
|
+
const sections = [
|
|
3292
|
+
asOptionalTrimmedString(options.body) ?? "",
|
|
3293
|
+
buildSkillConfigComment(options.skillConfig),
|
|
3294
|
+
options.evalConfig ? buildEvalConfigComment(options.evalConfig) : "",
|
|
3295
|
+
options.workflowConfig ? buildWorkflowConfigComment(options.workflowConfig) : ""
|
|
3296
|
+
].filter(Boolean);
|
|
3297
|
+
return sections.join("\n\n").trim();
|
|
3298
|
+
};
|
|
3299
|
+
var extractFrontmatter = (markdown) => {
|
|
3300
|
+
const match = markdown.match(/^\s*---\s*\n([\s\S]*?)\n\s*---\s*\n?/);
|
|
3301
|
+
if (!match) return { body: markdown.trim() };
|
|
3302
|
+
const frontmatter = parseYamlObject(match[1]);
|
|
3303
|
+
const body = markdown.slice(match[0].length).trim();
|
|
3304
|
+
return { frontmatter, body };
|
|
3305
|
+
};
|
|
3306
|
+
var normalizeAllowedTools = (value) => {
|
|
3307
|
+
if (Array.isArray(value)) {
|
|
3308
|
+
return normalizeStringArray(value) ?? [];
|
|
3309
|
+
}
|
|
3310
|
+
if (typeof value === "string") {
|
|
3311
|
+
return value.split(/\s+/).map((item) => item.trim()).filter(Boolean);
|
|
3312
|
+
}
|
|
3313
|
+
return [];
|
|
3314
|
+
};
|
|
3315
|
+
var parseExternalSkillMarkdown = (markdown) => {
|
|
3316
|
+
const { frontmatter, body } = extractFrontmatter(markdown);
|
|
3317
|
+
return {
|
|
3318
|
+
name: asOptionalTrimmedString(frontmatter?.name),
|
|
3319
|
+
description: asOptionalTrimmedString(frontmatter?.description),
|
|
3320
|
+
compatibility: asOptionalTrimmedString(frontmatter?.compatibility),
|
|
3321
|
+
allowedTools: normalizeAllowedTools(frontmatter?.["allowed-tools"]),
|
|
3322
|
+
metadata: frontmatter?.metadata && typeof frontmatter.metadata === "object" ? Object.fromEntries(
|
|
3323
|
+
Object.entries(frontmatter.metadata).filter(([, value]) => typeof value === "string").map(([key, value]) => [key, String(value)])
|
|
3324
|
+
) : void 0,
|
|
3325
|
+
body
|
|
3326
|
+
};
|
|
3327
|
+
};
|
|
3328
|
+
|
|
3059
3329
|
export {
|
|
3060
|
-
|
|
3061
|
-
|
|
3330
|
+
normalizeStringArray,
|
|
3331
|
+
normalizeSkillModalities,
|
|
3332
|
+
parseSkillDocProtocol,
|
|
3333
|
+
resolvePageSkillMetadata,
|
|
3334
|
+
buildSkillDocMarkdown,
|
|
3335
|
+
parseExternalSkillMarkdown
|
|
3062
3336
|
};
|
|
@@ -5,14 +5,14 @@ import {
|
|
|
5
5
|
inlineImageUrlsForCustomProvider,
|
|
6
6
|
prepareTools,
|
|
7
7
|
shouldInlineImageUrlsForAgent
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-XMFDQYWA.js";
|
|
9
9
|
import {
|
|
10
10
|
INVALID_TOOL_ARGS_REPLACEMENT,
|
|
11
11
|
buildInvalidToolCallSelfHealResult,
|
|
12
12
|
parseToolCallArguments,
|
|
13
13
|
performFetchRequest,
|
|
14
14
|
sanitizeOutboundMessages
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-AE5GVFMG.js";
|
|
16
16
|
import {
|
|
17
17
|
createSSEParser,
|
|
18
18
|
createToolRunId,
|
|
@@ -23,22 +23,22 @@ import {
|
|
|
23
23
|
toolRunSetPending,
|
|
24
24
|
toolRunStarted,
|
|
25
25
|
toolRunSucceeded
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-5GQ6XCJY.js";
|
|
27
27
|
import {
|
|
28
28
|
getPublicImageAgentMode
|
|
29
29
|
} from "./chunk-VIDPVFP3.js";
|
|
30
30
|
import {
|
|
31
31
|
getCurrentSpaceId
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-QI3CHZUT.js";
|
|
33
33
|
import {
|
|
34
34
|
addToolMessage,
|
|
35
35
|
messageStreamEnd,
|
|
36
36
|
messageStreaming,
|
|
37
37
|
updateToolMessage
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-PILJX4DH.js";
|
|
39
39
|
import {
|
|
40
40
|
streamAgentChatTurn
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-TLBZMLLJ.js";
|
|
42
42
|
import {
|
|
43
43
|
addActiveController,
|
|
44
44
|
removeActiveController,
|
|
@@ -46,7 +46,7 @@ import {
|
|
|
46
46
|
} from "./chunk-MRWGHF56.js";
|
|
47
47
|
import {
|
|
48
48
|
EMPTY_ASSISTANT_REPAIR_PROMPT
|
|
49
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-AA2YUJNV.js";
|
|
50
50
|
import {
|
|
51
51
|
accumulateToolCallDelta,
|
|
52
52
|
createThinkParserState,
|