nolo-cli 0.54.0 → 0.61.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/README.md +3 -3
- package/{_executeModel-OPTKYHJA.js → _executeModel-R26QYY66.js} +50 -46
- package/{action-ORXWW2ZG.js → action-76JX3JX3.js} +7 -6
- package/{addContentAction-53BZ34AE.js → addContentAction-V3NAZRTJ.js} +6 -5
- package/{addDialogAgentAction-JRYUS54Y.js → addDialogAgentAction-RZOAF46K.js} +5 -4
- package/{agentDeleteCommand-FJIWU2BS.js → agentDeleteCommand-6GNQA4J4.js} +30 -27
- package/{agentEmailCommands-CE32L43B.js → agentEmailCommands-HH67CYKD.js} +61 -57
- package/{agentGrantCommands-2LEZDADN.js → agentGrantCommands-R3VQEZJR.js} +1 -1
- package/{agentListCommands-VJNKULIK.js → agentListCommands-23XW3OPZ.js} +61 -31
- package/{agentMachineCommands-HCJ3WQXL.js → agentMachineCommands-HXHASEWO.js} +31 -28
- package/{agentPullCommand-M552CYSI.js → agentPullCommand-N7L2CT7L.js} +2 -2
- package/{agentRecordCommands-QFWERED4.js → agentRecordCommands-UHTQJVGC.js} +59 -55
- package/{agentRunCommand-G3GQMUNN.js → agentRunCommand-OAMT77EX.js} +63 -59
- package/{agentRunControl-INKFDXDA.js → agentRunControl-WECMOO6O.js} +11 -6
- package/{agentRuntimeLocal-K327ELSL.js → agentRuntimeLocal-QBK4H3T2.js} +26 -23
- package/{agentSlice-ODKF4J6M.js → agentSlice-7XJH5WQF.js} +8 -7
- package/{appDeleteCommands-XUXMFDI4.js → appDeleteCommands-AX2O6VDV.js} +30 -27
- package/{appDeployCommands-37F4GPCU.js → appDeployCommands-L5ZR26CB.js} +30 -27
- package/{appDeployStatusCommands-WSPU7TUK.js → appDeployStatusCommands-5HQHELRA.js} +30 -27
- package/{appGetCommands-YLOBA3EM.js → appGetCommands-HVSYOS57.js} +30 -27
- package/{appListCommands-UD62R5ME.js → appListCommands-XV2FPTWX.js} +30 -27
- package/{authCommand-OK6HLHGS.js → authCommand-WOTWLJNF.js} +35 -29
- package/{authCommands-2DUIUEMT.js → authCommands-ILTBI6JV.js} +7 -5
- package/{chatQueueReduxAdapter-TV2TUOQS.js → chatQueueReduxAdapter-F3R253JE.js} +20 -18
- package/{chunk-HPW5MNDQ.js → chunk-22BTGNSP.js} +113 -57
- package/{chunk-UNZDCI3O.js → chunk-2KDR4CWE.js} +35 -4
- package/{chunk-3ZTR7ZO4.js → chunk-2PGGC63K.js} +1 -1
- package/{chunk-EA5OYZVD.js → chunk-37XDGCY7.js} +1 -1
- package/chunk-3BLB7QKO.js +433 -0
- package/{chunk-CS6TCJ7E.js → chunk-3JQ2NRYU.js} +30 -7
- package/{chunk-3LKZRP7E.js → chunk-3QGUVVX5.js} +2 -2
- package/{chunk-SSXTSPSG.js → chunk-45YO6H7P.js} +71 -30
- package/{chunk-YLCUU3WM.js → chunk-4NJEIGBQ.js} +5 -5
- package/{chunk-K4NISKOR.js → chunk-5ZYA4JJ3.js} +47 -17
- package/{chunk-6HIGYUBQ.js → chunk-6XIE5ZGI.js} +1 -1
- package/{chunk-3Y2K5O2R.js → chunk-7A3RRUCQ.js} +125 -40
- package/{chunk-6COJEAYH.js → chunk-7KELZLC2.js} +44 -37
- package/chunk-AETZ7AD6.js +274 -0
- package/chunk-BFU6C242.js +66 -0
- package/{chunk-IA3A5373.js → chunk-C3FZR5EC.js} +1 -1
- package/{chunk-IWUMSAQF.js → chunk-CJCJF5XB.js} +26 -3
- package/{chunk-UGBHDMHI.js → chunk-CP7VIDZ7.js} +1 -1
- package/{chunk-TR4DXUYX.js → chunk-CQ2OZMLQ.js} +1181 -737
- package/{chunk-JON2PHYT.js → chunk-CTCW7U7N.js} +1 -1
- package/{chunk-7NYDJAQ7.js → chunk-DNNSCSA2.js} +5 -5
- package/{chunk-NI2BS6UD.js → chunk-DWUCB2A3.js} +1 -1
- package/{chunk-FJHMLRDQ.js → chunk-DWYSDNOH.js} +22 -28
- package/{chunk-AA564GBL.js → chunk-E3YVTQWT.js} +2 -2
- package/chunk-E4MARS3Q.js +114 -0
- package/{chunk-75MSWWUE.js → chunk-E6RGHPDR.js} +5 -3
- package/chunk-EDKF7RX4.js +30 -0
- package/{chunk-TC6P4NDR.js → chunk-F44FAXP2.js} +6 -6
- package/{chunk-SYYUU7EV.js → chunk-FHAGENAS.js} +2 -3
- package/{chunk-NJUQBYFJ.js → chunk-FKFMIBTT.js} +3 -1
- package/{chunk-INZZJSQF.js → chunk-FZGV4FGK.js} +24 -12
- package/{chunk-6HDYSFLO.js → chunk-GSXDRMDO.js} +3 -3
- package/{chunk-AUVFJGPC.js → chunk-JX5PJCWS.js} +7 -5
- package/{chunk-LYGNQHUW.js → chunk-JYYZCK2Z.js} +2 -4
- package/{chunk-EY7V7REW.js → chunk-KHCLMKZZ.js} +6 -280
- package/{chunk-EJE33XNR.js → chunk-KSCXMC6U.js} +1521 -565
- package/{chunk-XOJRZUPF.js → chunk-KWSQR2KK.js} +14 -29
- package/{chunk-2WBFJHQA.js → chunk-L7B47JXR.js} +34 -39
- package/{chunk-EICIFHVS.js → chunk-LAFC3B2I.js} +1 -1
- package/{chunk-N4JKMCY3.js → chunk-LJKICKVC.js} +2 -2
- package/chunk-M3JEW6N6.js +193 -0
- package/{chunk-LRGKOI5Y.js → chunk-MBOEV4L2.js} +7 -3
- package/{chunk-SVDMVX4G.js → chunk-MMZ6ZTVO.js} +112 -73
- package/{chunk-JDSUTNYY.js → chunk-MP64VFGD.js} +2 -2
- package/{chunk-NFLA6GSU.js → chunk-MXUDQZXQ.js} +44 -5
- package/chunk-N4G4PKQ6.js +23 -0
- package/{chunk-WQHGJHAL.js → chunk-N6HLMLKE.js} +732 -726
- package/{chunk-YQBXOHE6.js → chunk-NO42UD73.js} +1 -1
- package/{chunk-MLEZPE3U.js → chunk-NRRPKMM7.js} +4 -4
- package/{chunk-KXKQO4Q6.js → chunk-NTW5GWDM.js} +58 -1
- package/chunk-ONXOABJR.js +215 -0
- package/{chunk-TY3ADTX5.js → chunk-OZX2IPKM.js} +7 -2
- package/{chunk-Q4XZVZPN.js → chunk-P7OOB7QP.js} +1 -1
- package/{chunk-XIJZOCSP.js → chunk-PEZJEQAO.js} +1 -1
- package/{chunk-SWJGJMTW.js → chunk-PQDIDWGX.js} +1 -1
- package/chunk-PSCNXBYA.js +11 -0
- package/{chunk-BY2FF2C4.js → chunk-QEFJJS2I.js} +55 -73
- package/{chunk-BG7J6Y5X.js → chunk-QEW2MFDQ.js} +1 -1
- package/{chunk-KLIBF3BY.js → chunk-RDBARW6T.js} +8 -3
- package/{chunk-ZVOHVJI3.js → chunk-RJ2SAFB5.js} +82 -35
- package/{chunk-MYMBBB6Q.js → chunk-RVWRKFUB.js} +5 -3
- package/{chunk-43CXXVJD.js → chunk-RXX4GDIH.js} +1 -1
- package/chunk-SEJ5OS6F.js +49 -0
- package/{chunk-JXIP6ZWH.js → chunk-SKIRVYEI.js} +18 -5
- package/{chunk-SAJSBPI2.js → chunk-SOJM57FX.js} +5 -2
- package/{chunk-EKLRRZIN.js → chunk-SPAQ4PVV.js} +0 -5
- package/{chunk-RHMDMTDK.js → chunk-SYNKICCB.js} +2 -2
- package/{chunk-YBFJQC2M.js → chunk-TBHAHL33.js} +65 -42
- package/{chunk-L7NG2M6H.js → chunk-TRV2MIDW.js} +89 -74
- package/{chunk-5UAYZEXO.js → chunk-UZPQSVM6.js} +1 -1
- package/{chunk-7FAS3NEF.js → chunk-VAKVNHK5.js} +19 -15
- package/{chunk-UOWXD4VN.js → chunk-VHO3TMQZ.js} +336 -244
- package/{chunk-SVC3GGUA.js → chunk-VMWYBIXG.js} +7 -5
- package/{chunk-ZHXJ6M7T.js → chunk-W7XHHYWM.js} +4 -0
- package/{chunk-UR66XPVF.js → chunk-XAVSS3KE.js} +21 -3
- package/{chunk-A65UV3M5.js → chunk-XOKOSO35.js} +10 -19
- package/{chunk-VZMUOPYG.js → chunk-XTJTN3RW.js} +46 -3
- package/{chunk-T5HJEUQN.js → chunk-YCDWJX45.js} +1 -1
- package/{chunk-BBTN4NQD.js → chunk-Z4QSJILV.js} +85 -13
- package/{chunk-5FCIPEKT.js → chunk-Z5MHFBJZ.js} +1051 -926
- package/{chunk-O5FLGN2L.js → chunk-ZRSJ3JEH.js} +6 -2
- package/{cliExecutor-BBUVQU4L.js → cliExecutor-HG3S345O.js} +1 -1
- package/{codingSkills-BCQXRZOI.js → codingSkills-TKROLCBA.js} +4 -3
- package/{contentThunks-KNI6VXLT.js → contentThunks-OZPK5B4Z.js} +21 -19
- package/{cooldownCommands-GI5NNWGL.js → cooldownCommands-BSCH2W7P.js} +2 -2
- package/{createAgentAutomationAction-OK4L33KF.js → createAgentAutomationAction-LCIBGE5T.js} +23 -21
- package/{createDialogAction-JDSMY4AY.js → createDialogAction-JPJZMHJE.js} +25 -22
- package/{createPageAction-T7RA3HCG.js → createPageAction-6P2WLNHO.js} +26 -23
- package/{dbSlice-TVX6SN2T.js → dbSlice-IBVOBVMS.js} +5 -4
- package/{deleteFile-JYKRT7C3.js → deleteFile-FWP2PSBG.js} +3 -2
- package/{dialogCommands-UQZYWOOV.js → dialogCommands-WAFKC3KK.js} +30 -27
- package/{dialogSlice-TYW2G7IL.js → dialogSlice-R5RZHFTU.js} +20 -18
- package/{docCreateCommands-OA6HZBWO.js → docCreateCommands-GHGB42S7.js} +32 -28
- package/{docDeleteCommands-KBB3YQI2.js → docDeleteCommands-Y5I7ZEX4.js} +33 -29
- package/{docReadCommands-ZLMFVC67.js → docReadCommands-BMXM6J7T.js} +32 -28
- package/{docStore-2URPBVCS.js → docStore-DKWZ6XJ5.js} +6 -5
- package/{docUpdateCommands-HMH5KUON.js → docUpdateCommands-QNABH3M2.js} +32 -28
- package/{getPricing-RFOPUWHY.js → getPricing-NM3NUTAS.js} +4 -4
- package/handleSendMessageAction-UQGKM4UX.js +675 -0
- package/index.js +79 -88
- package/{lib-2ZTNRXR4.js → lib-FRRS27KN.js} +63 -28
- package/{localRuntimeAuthority-KQDAE64E.js → localRuntimeAuthority-R5UBODT3.js} +6 -4
- package/{localRuntimeDb-PF7CFKDL.js → localRuntimeDb-P37ZTX55.js} +1 -1
- package/{machineCommands-RK6L7ZWL.js → machineCommands-YDAIPYU5.js} +298 -80
- package/{machineWsRunDispatch-3X64DW2Z.js → machineWsRunDispatch-O6RM2ECT.js} +57 -53
- package/{memberThunks-THZYZFSN.js → memberThunks-VZI6G7YZ.js} +10 -8
- package/{models-JVKUEER5.js → models-FAMINFZ7.js} +2 -2
- package/package.json +3 -2
- package/{read-K4JU4MQC.js → read-2BYWW7AA.js} +3 -2
- package/{readDocTool-LQGR6FUN.js → readDocTool-LC3A7QTB.js} +1 -1
- package/{readlineWorkspace-XUFJV3RS.js → readlineWorkspace-5DP3AJWN.js} +4367 -2796
- package/{removeDialogAgentAction-ECHCFB7N.js → removeDialogAgentAction-SFYZXHNK.js} +8 -7
- package/{runAgentClientLoop-24GQ2AW6.js → runAgentClientLoop-Y6HWP2PT.js} +51 -46
- package/{runtimeDoctorCommands-JKTTN723.js → runtimeDoctorCommands-CROTMULY.js} +7 -5
- package/{setDialogExtraReferencesAction-KCVJNGMB.js → setDialogExtraReferencesAction-Q32RGFTA.js} +6 -5
- package/{setPrimaryDialogAgentAction-VDOBOMKC.js → setPrimaryDialogAgentAction-BFYJHUJS.js} +8 -7
- package/{settingSlice-VR2IJSXC.js → settingSlice-IRUU4VFB.js} +6 -5
- package/{skillDiscovery-2QTZINON.js → skillDiscovery-CYUCJMAG.js} +2 -1
- package/{spaceCommands-S5YJJXL7.js → spaceCommands-CLN45IE3.js} +33 -215
- package/{streamAgentChatTurn-QHKP3ABO.js → streamAgentChatTurn-6WFQJ4DY.js} +107 -74
- package/{switchDialogAgentAction-5L4UP7VI.js → switchDialogAgentAction-L2KOKCGG.js} +5 -4
- package/{tableCommands-R6WFRDYF.js → tableCommands-SUNTHAYX.js} +1 -1
- package/{toolApiClient-53U4UDFF.js → toolApiClient-VGYUB4P5.js} +2 -1
- package/{tools-SSXSTC3O.js → tools-RR53D65Q.js} +39 -35
- package/{tuiSummaryLlmCaller-URFJHFC5.js → tuiSummaryLlmCaller-F3DPFFZM.js} +15 -13
- package/{updateCommands-IYKLF3JX.js → updateCommands-AJYSD73Y.js} +2 -2
- package/{updateDialogTitleAction-YFYAEW3T.js → updateDialogTitleAction-WXS3AKOL.js} +23 -21
- package/agentSuperviseCommands-5AR3DKNN.js +0 -640
- package/chunk-6IGD47IC.js +0 -19
- package/chunk-FD36SCCD.js +0 -105
- package/chunk-GRFK2XP4.js +0 -230
- package/chunk-HJTAGT3W.js +0 -370
- package/chunk-SUEIAK5N.js +0 -2574
- package/handleSendMessageAction-GO53TY7U.js +0 -409
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
import {
|
|
2
|
+
dump,
|
|
3
|
+
load
|
|
4
|
+
} from "./chunk-KHCLMKZZ.js";
|
|
5
|
+
import {
|
|
6
|
+
asTrimmedNonEmptyStringArray
|
|
7
|
+
} from "./chunk-I42VC5KR.js";
|
|
8
|
+
import {
|
|
9
|
+
asOptionalTrimmedString
|
|
10
|
+
} from "./chunk-G3SUCT4W.js";
|
|
11
|
+
|
|
12
|
+
// packages/ai/skills/skillDocProtocol.ts
|
|
13
|
+
var SKILL_DOC_ENUMS = {
|
|
14
|
+
triggerMode: ["explicit", "required", "recommended"],
|
|
15
|
+
// budgetTier 只服务 WorkflowReferenceConfig;skill 侧已移除(零读点)。
|
|
16
|
+
budgetTier: ["low", "medium", "high"],
|
|
17
|
+
modality: ["text", "image", "video", "audio", "3d"],
|
|
18
|
+
docKind: ["knowledge", "instruction", "skill"]
|
|
19
|
+
};
|
|
20
|
+
var SKILL_CONFIG_BLOCK = "skill-config";
|
|
21
|
+
var EVAL_CONFIG_BLOCK = "eval-config";
|
|
22
|
+
var WORKFLOW_CONFIG_BLOCK = "workflow-config";
|
|
23
|
+
var normalizeStringArray = (value) => {
|
|
24
|
+
if (!Array.isArray(value)) return void 0;
|
|
25
|
+
const items = [...new Set(asTrimmedNonEmptyStringArray(value))];
|
|
26
|
+
return items.length > 0 ? items : void 0;
|
|
27
|
+
};
|
|
28
|
+
var normalizeSkillEnumValue = (key, value) => typeof value === "string" && SKILL_DOC_ENUMS[key].includes(value) ? value : void 0;
|
|
29
|
+
var normalizeSkillModalities = (value) => {
|
|
30
|
+
const raw = normalizeStringArray(value);
|
|
31
|
+
if (!raw) return void 0;
|
|
32
|
+
const filtered = raw.flatMap((item) => {
|
|
33
|
+
const modality = normalizeSkillEnumValue("modality", item);
|
|
34
|
+
return modality ? [modality] : [];
|
|
35
|
+
});
|
|
36
|
+
return filtered.length > 0 ? Array.from(new Set(filtered)) : void 0;
|
|
37
|
+
};
|
|
38
|
+
var normalizeSkillConfig = (value, fallbackTools) => {
|
|
39
|
+
if (!value || typeof value !== "object") return void 0;
|
|
40
|
+
const record = value;
|
|
41
|
+
const name = asOptionalTrimmedString(record.name) ?? "";
|
|
42
|
+
const description = asOptionalTrimmedString(record.description) ?? "";
|
|
43
|
+
if (!name || !description) return void 0;
|
|
44
|
+
const triggerMode = normalizeSkillEnumValue("triggerMode", record.triggerMode);
|
|
45
|
+
const modalities = normalizeSkillModalities(record.modalities);
|
|
46
|
+
const toolNames = normalizeStringArray(record.toolNames) ?? normalizeStringArray(fallbackTools) ?? void 0;
|
|
47
|
+
return {
|
|
48
|
+
version: "0.1",
|
|
49
|
+
kind: "skill",
|
|
50
|
+
id: asOptionalTrimmedString(record.id),
|
|
51
|
+
name,
|
|
52
|
+
description,
|
|
53
|
+
triggerMode,
|
|
54
|
+
toolNames,
|
|
55
|
+
modalities,
|
|
56
|
+
requiredSkills: normalizeStringArray(record.requiredSkills),
|
|
57
|
+
recommendedSkills: normalizeStringArray(record.recommendedSkills),
|
|
58
|
+
promptPatch: asOptionalTrimmedString(record.promptPatch)
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
var normalizeEvalConfig = (value) => {
|
|
62
|
+
if (!value || typeof value !== "object") return void 0;
|
|
63
|
+
const record = value;
|
|
64
|
+
if (!Array.isArray(record.cases)) return void 0;
|
|
65
|
+
const cases = [];
|
|
66
|
+
for (const item of record.cases) {
|
|
67
|
+
if (!item || typeof item !== "object") continue;
|
|
68
|
+
const testCase = item;
|
|
69
|
+
const input = asOptionalTrimmedString(testCase.input) ?? "";
|
|
70
|
+
if (!input) continue;
|
|
71
|
+
cases.push({
|
|
72
|
+
input,
|
|
73
|
+
expectedTools: normalizeStringArray(testCase.expectedTools),
|
|
74
|
+
expectedSignals: normalizeStringArray(testCase.expectedSignals),
|
|
75
|
+
forbiddenSignals: normalizeStringArray(testCase.forbiddenSignals)
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
return cases.length > 0 ? {
|
|
79
|
+
version: "0.1",
|
|
80
|
+
cases
|
|
81
|
+
} : void 0;
|
|
82
|
+
};
|
|
83
|
+
var normalizeWorkflowConfig = (value) => {
|
|
84
|
+
if (!value || typeof value !== "object") return void 0;
|
|
85
|
+
const record = value;
|
|
86
|
+
const name = asOptionalTrimmedString(record.name) ?? "";
|
|
87
|
+
const description = asOptionalTrimmedString(record.description) ?? "";
|
|
88
|
+
if (!name || !description) return void 0;
|
|
89
|
+
const budgetTier = normalizeSkillEnumValue("budgetTier", record.budgetTier);
|
|
90
|
+
return {
|
|
91
|
+
version: "0.1",
|
|
92
|
+
kind: "workflow",
|
|
93
|
+
id: asOptionalTrimmedString(record.id),
|
|
94
|
+
name,
|
|
95
|
+
description,
|
|
96
|
+
defaultAgent: asOptionalTrimmedString(record.defaultAgent),
|
|
97
|
+
inputs: normalizeStringArray(record.inputs),
|
|
98
|
+
recommendedTools: normalizeStringArray(record.recommendedTools),
|
|
99
|
+
requiredTools: normalizeStringArray(record.requiredTools),
|
|
100
|
+
requiredOutputs: normalizeStringArray(record.requiredOutputs),
|
|
101
|
+
gates: normalizeStringArray(record.gates),
|
|
102
|
+
budgetTier,
|
|
103
|
+
contextStrategy: asOptionalTrimmedString(record.contextStrategy),
|
|
104
|
+
failureProtocol: asOptionalTrimmedString(record.failureProtocol)
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
var normalizePageSkillMetadata = (value, fallbackTools) => {
|
|
108
|
+
if (!value || typeof value !== "object") return void 0;
|
|
109
|
+
const record = value;
|
|
110
|
+
const kind = normalizeSkillEnumValue("docKind", record.kind);
|
|
111
|
+
const meta = {
|
|
112
|
+
kind,
|
|
113
|
+
requiredSkills: normalizeStringArray(record.requiredSkills),
|
|
114
|
+
recommendedSkills: normalizeStringArray(record.recommendedSkills),
|
|
115
|
+
skillConfig: normalizeSkillConfig(record.skillConfig, fallbackTools),
|
|
116
|
+
evalConfig: normalizeEvalConfig(record.evalConfig),
|
|
117
|
+
workflowConfig: normalizeWorkflowConfig(record.workflowConfig)
|
|
118
|
+
};
|
|
119
|
+
if (meta.skillConfig && !meta.kind) {
|
|
120
|
+
meta.kind = "skill";
|
|
121
|
+
}
|
|
122
|
+
if (meta.workflowConfig && !meta.kind) {
|
|
123
|
+
meta.kind = "instruction";
|
|
124
|
+
}
|
|
125
|
+
return meta.kind || meta.requiredSkills || meta.recommendedSkills || meta.skillConfig || meta.evalConfig || meta.workflowConfig ? meta : void 0;
|
|
126
|
+
};
|
|
127
|
+
var extractCommentBlock = (markdown, blockName) => {
|
|
128
|
+
if (!markdown) return void 0;
|
|
129
|
+
const matcher = new RegExp(
|
|
130
|
+
`<!--\\s*${blockName}\\s*\\n([\\s\\S]*?)-->`,
|
|
131
|
+
"i"
|
|
132
|
+
);
|
|
133
|
+
const match = markdown.match(matcher);
|
|
134
|
+
return asOptionalTrimmedString(match?.[1]);
|
|
135
|
+
};
|
|
136
|
+
var removeCommentBlock = (markdown, blockName) => markdown.replace(
|
|
137
|
+
new RegExp(`\\n?<!--\\s*${blockName}\\s*\\n[\\s\\S]*?-->\\s*`, "gi"),
|
|
138
|
+
"\n\n"
|
|
139
|
+
);
|
|
140
|
+
var parseYamlObject = (raw) => {
|
|
141
|
+
if (!raw) return void 0;
|
|
142
|
+
try {
|
|
143
|
+
const parsed = load(raw);
|
|
144
|
+
return parsed && typeof parsed === "object" ? parsed : void 0;
|
|
145
|
+
} catch {
|
|
146
|
+
return void 0;
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
var parseSkillDocProtocol = (markdown, existingMeta, fallbackTools) => {
|
|
150
|
+
const source = typeof markdown === "string" ? markdown : "";
|
|
151
|
+
const skillBlock = parseYamlObject(extractCommentBlock(source, SKILL_CONFIG_BLOCK));
|
|
152
|
+
const evalBlock = parseYamlObject(extractCommentBlock(source, EVAL_CONFIG_BLOCK));
|
|
153
|
+
const workflowBlock = parseYamlObject(extractCommentBlock(source, WORKFLOW_CONFIG_BLOCK));
|
|
154
|
+
const cleanedContent = removeCommentBlock(
|
|
155
|
+
removeCommentBlock(
|
|
156
|
+
removeCommentBlock(source, SKILL_CONFIG_BLOCK),
|
|
157
|
+
EVAL_CONFIG_BLOCK
|
|
158
|
+
),
|
|
159
|
+
WORKFLOW_CONFIG_BLOCK
|
|
160
|
+
).replace(/\n{3,}/g, "\n\n").trim();
|
|
161
|
+
const parsedMeta = normalizePageSkillMetadata(
|
|
162
|
+
{
|
|
163
|
+
...existingMeta ?? {},
|
|
164
|
+
...skillBlock ? {
|
|
165
|
+
kind: existingMeta?.kind === "skill" || skillBlock.kind === "skill" ? "skill" : existingMeta?.kind,
|
|
166
|
+
requiredSkills: skillBlock.requiredSkills ?? existingMeta?.requiredSkills,
|
|
167
|
+
recommendedSkills: skillBlock.recommendedSkills ?? existingMeta?.recommendedSkills,
|
|
168
|
+
skillConfig: skillBlock
|
|
169
|
+
} : {},
|
|
170
|
+
...evalBlock ? { evalConfig: evalBlock } : {},
|
|
171
|
+
...workflowBlock ? { workflowConfig: workflowBlock } : {}
|
|
172
|
+
},
|
|
173
|
+
fallbackTools
|
|
174
|
+
);
|
|
175
|
+
return {
|
|
176
|
+
content: cleanedContent,
|
|
177
|
+
meta: parsedMeta
|
|
178
|
+
};
|
|
179
|
+
};
|
|
180
|
+
var resolvePageSkillMetadata = (page) => {
|
|
181
|
+
if (!page) return void 0;
|
|
182
|
+
const existingMeta = normalizePageSkillMetadata(page.meta, page.tools);
|
|
183
|
+
return parseSkillDocProtocol(page.content ?? "", existingMeta, page.tools).meta;
|
|
184
|
+
};
|
|
185
|
+
var yamlBlock = (value) => dump(value, { lineWidth: 120, noRefs: true }).trim();
|
|
186
|
+
var buildSkillConfigComment = (config) => {
|
|
187
|
+
const payload = {
|
|
188
|
+
version: config.version,
|
|
189
|
+
kind: config.kind,
|
|
190
|
+
...config.id ? { id: config.id } : {},
|
|
191
|
+
name: config.name,
|
|
192
|
+
description: config.description,
|
|
193
|
+
...config.triggerMode ? { triggerMode: config.triggerMode } : {},
|
|
194
|
+
...config.requiredSkills?.length ? { requiredSkills: config.requiredSkills } : {},
|
|
195
|
+
...config.recommendedSkills?.length ? { recommendedSkills: config.recommendedSkills } : {},
|
|
196
|
+
...config.toolNames?.length ? { toolNames: config.toolNames } : {},
|
|
197
|
+
...config.modalities?.length ? { modalities: config.modalities } : {},
|
|
198
|
+
...config.promptPatch ? { promptPatch: config.promptPatch } : {}
|
|
199
|
+
};
|
|
200
|
+
return `<!-- ${SKILL_CONFIG_BLOCK}
|
|
201
|
+
${yamlBlock(payload)}
|
|
202
|
+
-->`;
|
|
203
|
+
};
|
|
204
|
+
var buildEvalConfigComment = (config) => `<!-- ${EVAL_CONFIG_BLOCK}
|
|
205
|
+
${yamlBlock({
|
|
206
|
+
version: config.version,
|
|
207
|
+
cases: config.cases
|
|
208
|
+
})}
|
|
209
|
+
-->`;
|
|
210
|
+
var buildWorkflowConfigComment = (config) => `<!-- ${WORKFLOW_CONFIG_BLOCK}
|
|
211
|
+
${yamlBlock({
|
|
212
|
+
version: config.version,
|
|
213
|
+
kind: config.kind,
|
|
214
|
+
...config.id ? { id: config.id } : {},
|
|
215
|
+
name: config.name,
|
|
216
|
+
description: config.description,
|
|
217
|
+
...config.defaultAgent ? { defaultAgent: config.defaultAgent } : {},
|
|
218
|
+
...config.inputs?.length ? { inputs: config.inputs } : {},
|
|
219
|
+
...config.recommendedTools?.length ? { recommendedTools: config.recommendedTools } : {},
|
|
220
|
+
...config.requiredTools?.length ? { requiredTools: config.requiredTools } : {},
|
|
221
|
+
...config.requiredOutputs?.length ? { requiredOutputs: config.requiredOutputs } : {},
|
|
222
|
+
...config.gates?.length ? { gates: config.gates } : {},
|
|
223
|
+
...config.budgetTier ? { budgetTier: config.budgetTier } : {},
|
|
224
|
+
...config.contextStrategy ? { contextStrategy: config.contextStrategy } : {},
|
|
225
|
+
...config.failureProtocol ? { failureProtocol: config.failureProtocol } : {}
|
|
226
|
+
})}
|
|
227
|
+
-->`;
|
|
228
|
+
var buildSkillDocMarkdown = (options) => {
|
|
229
|
+
const sections = [
|
|
230
|
+
asOptionalTrimmedString(options.body) ?? "",
|
|
231
|
+
buildSkillConfigComment(options.skillConfig),
|
|
232
|
+
options.evalConfig ? buildEvalConfigComment(options.evalConfig) : "",
|
|
233
|
+
options.workflowConfig ? buildWorkflowConfigComment(options.workflowConfig) : ""
|
|
234
|
+
].filter(Boolean);
|
|
235
|
+
return sections.join("\n\n").trim();
|
|
236
|
+
};
|
|
237
|
+
var extractFrontmatter = (markdown) => {
|
|
238
|
+
const match = markdown.match(/^\s*---\s*\n([\s\S]*?)\n\s*---\s*\n?/);
|
|
239
|
+
if (!match) return { body: markdown.trim() };
|
|
240
|
+
const frontmatter = parseYamlObject(match[1]);
|
|
241
|
+
const body = markdown.slice(match[0].length).trim();
|
|
242
|
+
return { frontmatter, body };
|
|
243
|
+
};
|
|
244
|
+
var normalizeAllowedTools = (value) => {
|
|
245
|
+
if (Array.isArray(value)) {
|
|
246
|
+
return normalizeStringArray(value) ?? [];
|
|
247
|
+
}
|
|
248
|
+
if (typeof value === "string") {
|
|
249
|
+
return value.split(/\s+/).map((item) => item.trim()).filter(Boolean);
|
|
250
|
+
}
|
|
251
|
+
return [];
|
|
252
|
+
};
|
|
253
|
+
var parseExternalSkillMarkdown = (markdown) => {
|
|
254
|
+
const { frontmatter, body } = extractFrontmatter(markdown);
|
|
255
|
+
return {
|
|
256
|
+
name: asOptionalTrimmedString(frontmatter?.name),
|
|
257
|
+
description: asOptionalTrimmedString(frontmatter?.description),
|
|
258
|
+
compatibility: asOptionalTrimmedString(frontmatter?.compatibility),
|
|
259
|
+
allowedTools: normalizeAllowedTools(frontmatter?.["allowed-tools"]),
|
|
260
|
+
metadata: frontmatter?.metadata && typeof frontmatter.metadata === "object" ? Object.fromEntries(
|
|
261
|
+
Object.entries(frontmatter.metadata).filter(([, value]) => typeof value === "string").map(([key, value]) => [key, String(value)])
|
|
262
|
+
) : void 0,
|
|
263
|
+
body
|
|
264
|
+
};
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
export {
|
|
268
|
+
normalizeStringArray,
|
|
269
|
+
normalizeSkillModalities,
|
|
270
|
+
parseSkillDocProtocol,
|
|
271
|
+
resolvePageSkillMetadata,
|
|
272
|
+
buildSkillDocMarkdown,
|
|
273
|
+
parseExternalSkillMarkdown
|
|
274
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import {
|
|
2
|
+
resolveNoloHome
|
|
3
|
+
} from "./chunk-GLKOYSRU.js";
|
|
4
|
+
|
|
5
|
+
// packages/database-engine/cliAuthorityStoreDriver.ts
|
|
6
|
+
import path from "node:path";
|
|
7
|
+
function readCliAuthorityDriver(env) {
|
|
8
|
+
const value = env.NOLO_CLI_AUTHORITY_DRIVER?.trim();
|
|
9
|
+
if (value === "broker") {
|
|
10
|
+
return { driver: "broker", invalidDriver: null };
|
|
11
|
+
}
|
|
12
|
+
return {
|
|
13
|
+
driver: "broker",
|
|
14
|
+
invalidDriver: value ? value : null
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function resolveCliAuthorityRunDir(options = {}) {
|
|
18
|
+
return path.join(resolveNoloHome({
|
|
19
|
+
...options,
|
|
20
|
+
env: options.env ?? process.env
|
|
21
|
+
}), "run");
|
|
22
|
+
}
|
|
23
|
+
function hashString(value) {
|
|
24
|
+
let hash = 0;
|
|
25
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
26
|
+
hash = (hash << 5) - hash + value.charCodeAt(index) | 0;
|
|
27
|
+
}
|
|
28
|
+
return Math.abs(hash);
|
|
29
|
+
}
|
|
30
|
+
function resolveCliAuthorityBrokerPort(options = {}) {
|
|
31
|
+
const envPort = options.env?.NOLO_CLI_AUTHORITY_BROKER_PORT?.trim();
|
|
32
|
+
if (envPort) {
|
|
33
|
+
const port = Number(envPort);
|
|
34
|
+
if (Number.isInteger(port) && port > 0 && port < 65536) return port;
|
|
35
|
+
}
|
|
36
|
+
const noloHome = resolveNoloHome({
|
|
37
|
+
...options,
|
|
38
|
+
env: options.env ?? {}
|
|
39
|
+
});
|
|
40
|
+
return 47e3 + hashString(noloHome) % 2e3;
|
|
41
|
+
}
|
|
42
|
+
function resolveCliAuthorityStoreDriver(options = {}) {
|
|
43
|
+
return readCliAuthorityDriver(options.env ?? {}).driver;
|
|
44
|
+
}
|
|
45
|
+
function resolveCliAuthorityBrokerSocketPath(options) {
|
|
46
|
+
return path.join(resolveCliAuthorityRunDir(options), "authority-store-broker.sock");
|
|
47
|
+
}
|
|
48
|
+
function resolveCliAuthorityBrokerEndpoint(options) {
|
|
49
|
+
if (options.transport === "tcp") {
|
|
50
|
+
return `tcp://127.0.0.1:${resolveCliAuthorityBrokerPort(options)}`;
|
|
51
|
+
}
|
|
52
|
+
return `unix://${resolveCliAuthorityBrokerSocketPath(options)}`;
|
|
53
|
+
}
|
|
54
|
+
function resolveCliAuthorityBrokerMetadataPath(options) {
|
|
55
|
+
return path.join(resolveCliAuthorityRunDir(options), "authority-store-broker.json");
|
|
56
|
+
}
|
|
57
|
+
function resolveCliAuthorityBrokerHealthPath(options) {
|
|
58
|
+
return path.join(resolveCliAuthorityRunDir(options), "authority-store-broker.health.json");
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export {
|
|
62
|
+
resolveCliAuthorityStoreDriver,
|
|
63
|
+
resolveCliAuthorityBrokerEndpoint,
|
|
64
|
+
resolveCliAuthorityBrokerMetadataPath,
|
|
65
|
+
resolveCliAuthorityBrokerHealthPath
|
|
66
|
+
};
|
|
@@ -14,7 +14,7 @@ function buildCliLocalRuntimeDbEnv(env = process.env) {
|
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
16
|
async function getDefaultCliLocalRuntimeDb(options = {}) {
|
|
17
|
-
const { getDefaultCliLocalRuntimeDb: getAuthorityBackedDb } = await import("./localRuntimeAuthority-
|
|
17
|
+
const { getDefaultCliLocalRuntimeDb: getAuthorityBackedDb } = await import("./localRuntimeAuthority-R5UBODT3.js");
|
|
18
18
|
return getAuthorityBackedDb(options);
|
|
19
19
|
}
|
|
20
20
|
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
var QUOTA_ERROR_PATTERNS = [
|
|
3
3
|
/429/,
|
|
4
4
|
/quota/i,
|
|
5
|
+
/access_terminated_error/i,
|
|
6
|
+
/(?:weekly|monthly)\s*(?:\([^)]*\)\s*)?usage\s+limit/i,
|
|
5
7
|
/rate\s*limit/i,
|
|
6
8
|
/too\s*many\s*requests/i,
|
|
7
9
|
/额度/,
|
|
@@ -24,11 +26,24 @@ function isQuotaExhaustedError(error) {
|
|
|
24
26
|
return QUOTA_ERROR_PATTERNS.some((pattern) => pattern.test(error));
|
|
25
27
|
}
|
|
26
28
|
const maybeStatus = error.status;
|
|
27
|
-
if (typeof maybeStatus === "number" && maybeStatus === 429) return true;
|
|
28
29
|
const maybeStatusCode = error.statusCode;
|
|
29
|
-
|
|
30
|
+
const status = typeof maybeStatus === "number" ? maybeStatus : maybeStatusCode;
|
|
31
|
+
if (status === 429) return true;
|
|
32
|
+
if (status === 403) {
|
|
33
|
+
const message = extractMessage(error);
|
|
34
|
+
return QUOTA_ERROR_PATTERNS.some((pattern) => pattern.test(message));
|
|
35
|
+
}
|
|
30
36
|
return false;
|
|
31
37
|
}
|
|
38
|
+
function extractMessage(error) {
|
|
39
|
+
if (typeof error === "string") return error;
|
|
40
|
+
if (error instanceof Error) return error.message;
|
|
41
|
+
if (error && typeof error === "object") {
|
|
42
|
+
const m = error.message;
|
|
43
|
+
return typeof m === "string" ? m : "";
|
|
44
|
+
}
|
|
45
|
+
return "";
|
|
46
|
+
}
|
|
32
47
|
function parseResetsInMs(text) {
|
|
33
48
|
if (!text) return void 0;
|
|
34
49
|
const unitMs = (n, unit) => {
|
|
@@ -114,7 +129,11 @@ function parseResetAtText(value, now) {
|
|
|
114
129
|
return Number.isFinite(parsed) && parsed > now ? parsed : void 0;
|
|
115
130
|
}
|
|
116
131
|
function matchesPeriodicUsageLimitText(text) {
|
|
117
|
-
return /weekly
|
|
132
|
+
return /(?:weekly|monthly)\s*(?:\([^)]*\)\s*)?usage\s+limit/i.test(text);
|
|
133
|
+
}
|
|
134
|
+
function isQuotaLimited403Body(body) {
|
|
135
|
+
const text = typeof body === "string" ? body : JSON.stringify(body ?? "");
|
|
136
|
+
return matchesPeriodicUsageLimitText(text) || /access_terminated_error/i.test(text) || /(?:quota|usage)\s+(?:is\s+)?(?:exhausted|depleted|used\s+up|reached)/i.test(text) || /(?:quota|usage).{0,40}\b(?:reset|resets)\s+at\b/i.test(text);
|
|
118
137
|
}
|
|
119
138
|
function resolveNextAvailableAt(body, now, headers) {
|
|
120
139
|
const headerRetryAfter = headers && typeof headers.get === "function" ? headers.get("retry-after") : headers?.["retry-after"] ?? headers?.["Retry-After"];
|
|
@@ -132,6 +151,9 @@ function resolveNextAvailableAt(body, now, headers) {
|
|
|
132
151
|
return clampCooldownDeadline(parsed, now);
|
|
133
152
|
}
|
|
134
153
|
function resolveAvailabilityAction(status, body, now, headers) {
|
|
154
|
+
if (status === 403 && isQuotaLimited403Body(body)) {
|
|
155
|
+
return { kind: "mark", nextAvailableAt: resolveNextAvailableAt(body, now, headers) };
|
|
156
|
+
}
|
|
135
157
|
if (status >= 200 && status < 300) return { kind: "clear" };
|
|
136
158
|
if (status === 429) {
|
|
137
159
|
return { kind: "mark", nextAvailableAt: resolveNextAvailableAt(body, now, headers) };
|
|
@@ -161,6 +183,7 @@ export {
|
|
|
161
183
|
QUOTA_ERROR_PATTERNS,
|
|
162
184
|
isQuotaExhaustedError,
|
|
163
185
|
isAgentUnavailableNow,
|
|
186
|
+
isQuotaLimited403Body,
|
|
164
187
|
resolveAvailabilityAction,
|
|
165
188
|
mergeAvailabilityDeadline,
|
|
166
189
|
resolveCooldownGate
|