nolo-cli 0.33.0-alpha.9 → 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.
Files changed (164) hide show
  1. package/{_executeModel-2WR4RTZZ.js → _executeModel-TMUXL7J5.js} +64 -65
  2. package/{action-OQWPNKAH.js → action-KMBZ3LCZ.js} +12 -12
  3. package/{addContentAction-YVINZQTF.js → addContentAction-KQ44UT2U.js} +10 -10
  4. package/{addDialogAgentAction-6IOCIEPI.js → addDialogAgentAction-ILSDCMYL.js} +9 -9
  5. package/{agentDeleteCommand-H22WRYC6.js → agentDeleteCommand-KA2IQAPG.js} +40 -39
  6. package/{agentEmailCommands-DGJVCMCG.js → agentEmailCommands-UIYBGCZW.js} +74 -75
  7. package/{agentListCommands-6NWMLIMQ.js → agentListCommands-L6JNUOLH.js} +47 -37
  8. package/{agentMachineCommands-5MUO6RDI.js → agentMachineCommands-5CQW5NZR.js} +37 -36
  9. package/agentProviderCommands-65ZC2WB4.js +122 -0
  10. package/{agentPullCommand-YH5GEBK4.js → agentPullCommand-TSWAJPS2.js} +1 -1
  11. package/agentRecordCommands-VUDJQIZH.js +112 -0
  12. package/agentRunCommand-EJWYF3BL.js +132 -0
  13. package/{agentRunControl-SCIVRZWX.js → agentRunControl-7MUPSYDQ.js} +7 -1
  14. package/{agentRuntimeLocal-PRAR3NCW.js → agentRuntimeLocal-XXBMDMBU.js} +33 -33
  15. package/{agentSlice-AMDSTXP5.js → agentSlice-HTIEYKIU.js} +12 -12
  16. package/agentSuperviseCommands-MKWW3ICX.js +640 -0
  17. package/{appDeleteCommands-L5PKC42V.js → appDeleteCommands-OUBL6VHB.js} +35 -34
  18. package/{appDeployCommands-3J7Z4XWV.js → appDeployCommands-BZSS2MX4.js} +35 -34
  19. package/{appDeployStatusCommands-YTRPXE72.js → appDeployStatusCommands-P2ZQOY5X.js} +35 -34
  20. package/{appGetCommands-JVXV5WXD.js → appGetCommands-WCFWQZZM.js} +35 -34
  21. package/{appListCommands-7KDEOJSO.js → appListCommands-FVJ3QNL7.js} +35 -34
  22. package/{authCommand-6Y5LTMZB.js → authCommand-B2XRHNJH.js} +19 -19
  23. package/{authCommands-EAPFGNHN.js → authCommands-GWABTFMR.js} +6 -6
  24. package/{chatQueueReduxAdapter-ZKSS6XRV.js → chatQueueReduxAdapter-ZP2ZS63U.js} +28 -28
  25. package/{chunk-UM4H3URE.js → chunk-23KKIMD5.js} +7 -7
  26. package/chunk-2BWU4ORW.js +2574 -0
  27. package/{chunk-2UECQ7RE.js → chunk-3AOLVADY.js} +1 -1
  28. package/{chunk-M2YMQOLC.js → chunk-4APLX2RT.js} +75 -10
  29. package/{chunk-ZHYK3N56.js → chunk-4AWH4LQA.js} +3 -1
  30. package/{chunk-3GZXL6FM.js → chunk-4DMPISV6.js} +7 -3
  31. package/{chunk-BQ3OHLR5.js → chunk-5GQ6XCJY.js} +1217 -691
  32. package/{chunk-GOIDVXK5.js → chunk-5LDKQUOT.js} +21 -8
  33. package/{chunk-OIQPORYI.js → chunk-64KIQZA2.js} +175 -2
  34. package/{chunk-6XIE5ZGI.js → chunk-6HIGYUBQ.js} +1 -1
  35. package/chunk-6XG52ZQ6.js +146 -0
  36. package/{chunk-FMEVI5TG.js → chunk-7CH6U3FL.js} +1 -1
  37. package/chunk-AA2YUJNV.js +54 -0
  38. package/{chunk-7INB7NXF.js → chunk-AE5GVFMG.js} +294 -54
  39. package/{chunk-UNOTBWZZ.js → chunk-B6H5XCT2.js} +8 -8
  40. package/{chunk-NNWHHCVP.js → chunk-BMB563Y6.js} +10 -4
  41. package/{chunk-DFUPZE6V.js → chunk-C6ELZQ7H.js} +249 -34
  42. package/{chunk-7KNERA53.js → chunk-E2OQ5N2F.js} +87 -13
  43. package/{chunk-6HYVJV7B.js → chunk-ESHYE7WU.js} +2 -1
  44. package/{chunk-KHCLMKZZ.js → chunk-EY7V7REW.js} +280 -6
  45. package/{chunk-JZPBVBIY.js → chunk-FD36SCCD.js} +19 -8
  46. package/{chunk-DKMOY3QI.js → chunk-FGLKRJDI.js} +54 -3
  47. package/{chunk-MQWVAOIU.js → chunk-FT4XBCK4.js} +33 -158
  48. package/{chunk-2QTEYCR7.js → chunk-FTM4KUOZ.js} +17 -17
  49. package/{chunk-U4TRT5V4.js → chunk-GEPHJJW4.js} +1 -1
  50. package/{chunk-7YYHKBJP.js → chunk-GKHV4UH5.js} +1 -1
  51. package/{chunk-2IVEXF7P.js → chunk-GUYMR3JL.js} +6 -33
  52. package/{chunk-YDTYDA5W.js → chunk-GZRMWK5R.js} +6 -4
  53. package/{chunk-X664KVEV.js → chunk-HHBXCRJS.js} +204 -123
  54. package/{chunk-AN7DGYMW.js → chunk-I7VDDN45.js} +4579 -3131
  55. package/{chunk-DSBGWT2C.js → chunk-IEEEWIVO.js} +10 -10
  56. package/{chunk-75U775RZ.js → chunk-IFS5CUEH.js} +1 -1
  57. package/{chunk-WLH5BAKX.js → chunk-IIOHYLIG.js} +9 -4
  58. package/{chunk-UEAUAXYS.js → chunk-ILZY5B4U.js} +2063 -214
  59. package/chunk-IMHO5LC6.js +370 -0
  60. package/{chunk-ADLYMQB6.js → chunk-IZCHPD7T.js} +52 -3
  61. package/{chunk-ITIA6OAQ.js → chunk-IZNJDUJ4.js} +5 -5
  62. package/{chunk-X2DAEZ3X.js → chunk-J5NMOM35.js} +1 -1
  63. package/{chunk-RPRRIFXV.js → chunk-JI2TIPLP.js} +1 -1
  64. package/{chunk-EGRJC4ZN.js → chunk-JIADXJYU.js} +1 -1
  65. package/{chunk-IHEC7VBF.js → chunk-K4KIFRIN.js} +1 -1
  66. package/{chunk-WJSW43QZ.js → chunk-L3JWI7WX.js} +0 -1
  67. package/{chunk-3RUW3ONU.js → chunk-LD6Y6RJY.js} +4 -4
  68. package/chunk-M3JQWYBC.js +387 -0
  69. package/{chunk-GM6PU7B6.js → chunk-MEYIRKDN.js} +0 -1
  70. package/{chunk-6YXDOOSH.js → chunk-MGIHZ5CJ.js} +4 -4
  71. package/{chunk-4F5M2MW5.js → chunk-MJWX4JQO.js} +2 -2
  72. package/{chunk-Q5ITEGIN.js → chunk-N4XRDM26.js} +1 -1
  73. package/{chunk-5CS33IBL.js → chunk-NQ4N4IGO.js} +11 -12
  74. package/{chunk-ZZ2MH7LE.js → chunk-O6OSWFZQ.js} +0 -1
  75. package/{chunk-RJKIB55Y.js → chunk-OSCSEJJR.js} +15 -8
  76. package/{chunk-HUCT7HID.js → chunk-P2I7ELDC.js} +3 -3
  77. package/{chunk-BXPBZVRE.js → chunk-PILJX4DH.js} +285 -251
  78. package/{chunk-SCUETSRP.js → chunk-PV734VZX.js} +1 -1
  79. package/{chunk-XLLTJXAD.js → chunk-QI3CHZUT.js} +39 -2672
  80. package/{chunk-WNHST4IE.js → chunk-RKRXAL3V.js} +5451 -5013
  81. package/{chunk-7E72JMBB.js → chunk-SMPAUSX5.js} +46 -5
  82. package/{chunk-5X4GQ53C.js → chunk-TLBZMLLJ.js} +7 -7
  83. package/{chunk-ASDXPOJH.js → chunk-U6QQLXWI.js} +1 -1
  84. package/{chunk-NUO3QFWD.js → chunk-UNHKVD2N.js} +1 -1
  85. package/{chunk-GE6IWA5N.js → chunk-UNZDCI3O.js} +126 -1
  86. package/{chunk-CPYYM4RJ.js → chunk-V5GA74HI.js} +19 -5
  87. package/{chunk-FXFGNOT2.js → chunk-VFVCYIRQ.js} +1 -1
  88. package/{chunk-G7E4NWFE.js → chunk-W445DPVT.js} +1 -1
  89. package/{chunk-EMW55KKX.js → chunk-WBZE7C6S.js} +1 -1
  90. package/{chunk-3UG2IIZ3.js → chunk-WN5AJG5I.js} +1 -1
  91. package/{chunk-KSRFVP36.js → chunk-WRN7L5CS.js} +1 -1
  92. package/{chunk-GJXRIOLS.js → chunk-WRP5TTM6.js} +4 -84
  93. package/chunk-X2K2JSO4.js +163 -0
  94. package/{chunk-OR2HNLVO.js → chunk-X6EN3KJX.js} +279 -477
  95. package/{chunk-VWY2CZD2.js → chunk-XMFDQYWA.js} +3 -3
  96. package/{chunk-IKWTTKWG.js → chunk-XQES6LXQ.js} +2 -2
  97. package/{chunk-IR6W62Q6.js → chunk-XT73C4VH.js} +18 -21
  98. package/{chunk-7L5CQQIT.js → chunk-Y5W623XU.js} +15 -15
  99. package/{chunk-RY57GLGW.js → chunk-YPREESF4.js} +42 -5
  100. package/{chunk-BQXOGBFN.js → chunk-YZ2WE6CW.js} +2 -2
  101. package/{chunk-DNQK7M7K.js → chunk-Z7COG62J.js} +4 -4
  102. package/{chunk-3WXRAHCG.js → chunk-ZBB3MZR3.js} +3 -3
  103. package/{cliExecutor-DW3PHGEL.js → cliExecutor-BBUVQU4L.js} +2 -2
  104. package/{clipboardy-MMBYVRLF.js → clipboardy-PRUHGPGC.js} +4 -3
  105. package/{codingSkills-DY5MINPG.js → codingSkills-6F4EQFCM.js} +4 -5
  106. package/cooldownCommands-C2SZLEEO.js +90 -0
  107. package/{createAgentAutomationAction-GVSJL2CI.js → createAgentAutomationAction-TGUXUZCY.js} +28 -30
  108. package/createDialogAction-FD5AEOUF.js +58 -0
  109. package/{createPageAction-M2VDKBYS.js → createPageAction-NPC3LYNK.js} +31 -34
  110. package/{dbSlice-UI2VCBLG.js → dbSlice-PIQGICNM.js} +9 -9
  111. package/{deleteFile-XQXPBFFB.js → deleteFile-NPZ64DFN.js} +4 -4
  112. package/{dialogCommands-26DBYNBT.js → dialogCommands-ZF2RSNCG.js} +37 -36
  113. package/{dialogSlice-FFGLRCBL.js → dialogSlice-6BINHWQT.js} +27 -27
  114. package/dist-VODFSGNG.js +7442 -0
  115. package/{docCreateCommands-F2ASWG6B.js → docCreateCommands-4VQ5MOHP.js} +36 -36
  116. package/{docDeleteCommands-A4URDZPI.js → docDeleteCommands-M7WLNVPB.js} +37 -37
  117. package/{docReadCommands-DO6VHDZD.js → docReadCommands-6LU6P2WT.js} +36 -36
  118. package/{docStore-EDAE7RNT.js → docStore-SIUFLABN.js} +29 -31
  119. package/{docUpdateCommands-ZTXZ3RTP.js → docUpdateCommands-S2LX4ENL.js} +39 -39
  120. package/{fetchMessages-7QRCCRYK.js → fetchMessages-CUEFN4GQ.js} +4 -4
  121. package/{getPricing-L2ENXWHV.js → getPricing-P3E2WRIH.js} +5 -5
  122. package/{handleSendMessageAction-CIRLGHOC.js → handleSendMessageAction-QVG5YNZY.js} +29 -29
  123. package/index.js +92 -77
  124. package/{localDialogRead-SLMPV5SK.js → localDialogRead-P7CHFMIC.js} +1 -1
  125. package/{localRuntimeAuthority-E3R24J4T.js → localRuntimeAuthority-S77B5QVB.js} +6 -2
  126. package/{localRuntimeDb-DDZCJFQZ.js → localRuntimeDb-N3H3HQ7G.js} +1 -1
  127. package/{machineCommands-NIQNCYJV.js → machineCommands-OSEBN7BZ.js} +76 -77
  128. package/{machineInfo-M6KB6HZN.js → machineInfo-66ZFUMLE.js} +1 -1
  129. package/{machineWsRunDispatch-EMTSQGAR.js → machineWsRunDispatch-NTJQCIIF.js} +68 -69
  130. package/{models-OX2S5C6Q.js → models-L7S2EKPM.js} +2 -2
  131. package/package.json +1 -1
  132. package/{read-2VHEHCAN.js → read-6C2XD3YZ.js} +5 -5
  133. package/{readDocTool-CSWD6NPC.js → readDocTool-Y7AB365O.js} +1 -1
  134. package/{readlineWorkspace-A2JBJWLI.js → readlineWorkspace-JPME5S7A.js} +4860 -3476
  135. package/{removeDialogAgentAction-2T7BPM3T.js → removeDialogAgentAction-KG5WMJRZ.js} +13 -13
  136. package/{runAgentClientLoop-BV4736ED.js → runAgentClientLoop-SOKEXCUF.js} +61 -61
  137. package/{runtimeDoctorCommands-KIKM6BIO.js → runtimeDoctorCommands-HT4O2PXL.js} +6 -6
  138. package/{setDialogExtraReferencesAction-GPT37HTW.js → setDialogExtraReferencesAction-O2NLXMSM.js} +10 -10
  139. package/{setPrimaryDialogAgentAction-3746P7IW.js → setPrimaryDialogAgentAction-FYYUY7PB.js} +13 -13
  140. package/{settingSlice-FIFOQ6OR.js → settingSlice-GPLI6E3M.js} +11 -11
  141. package/{skillDiscovery-KLLKXPUO.js → skillDiscovery-GPUDHDTZ.js} +3 -4
  142. package/{slateUtils-VO2FU36K.js → slateUtils-RIZES3PV.js} +1 -1
  143. package/{spaceCommands-AYZQHDB3.js → spaceCommands-Z5JLMFFJ.js} +223 -37
  144. package/{spaceSlice-43BNF22B.js → spaceSlice-Z3BGCLGX.js} +28 -30
  145. package/{streamAgentChatTurn-OLLRSITV.js → streamAgentChatTurn-INF5RGK4.js} +115 -129
  146. package/{switchDialogAgentAction-MQTUTQHL.js → switchDialogAgentAction-GH5P6Q3Z.js} +9 -9
  147. package/{chunk-IDAU4UFS.js → syncMapping-N6RGXGBW.js} +11 -11
  148. package/{tableCommands-QE47K72R.js → tableCommands-PQUJ55AS.js} +3 -3
  149. package/{tools-2SI3FXLL.js → tools-ZELMSJZ3.js} +45 -47
  150. package/{tuiSummaryLlmCaller-EAWQ3IZX.js → tuiSummaryLlmCaller-LH7F2SP7.js} +18 -18
  151. package/{updateCommands-AK2RDOFR.js → updateCommands-MNDUIKN7.js} +2 -2
  152. package/{updateDialogTitleAction-YJEQFYOA.js → updateDialogTitleAction-EDUCIB7G.js} +31 -33
  153. package/agentRecordCommands-YMGKT2WF.js +0 -113
  154. package/agentRunCommand-LYEMVQJH.js +0 -131
  155. package/chunk-AETZ7AD6.js +0 -274
  156. package/chunk-D5JI6VDM.js +0 -1800
  157. package/chunk-M3JEW6N6.js +0 -193
  158. package/chunk-ZURFOV5J.js +0 -105
  159. package/chunk-ZWS6DUHX.js +0 -480
  160. package/createDialogAction-VVR46Q2A.js +0 -61
  161. package/syncMapping-RK2MANUX.js +0 -43
  162. package/{chunk-KMSZPTM6.js → chunk-2WKUUY2E.js} +3 -3
  163. package/{chunk-CWMSB67P.js → chunk-AGGIDPCZ.js} +0 -0
  164. package/{chunk-SAQQLJZ5.js → chunk-JDSUTNYY.js} +3 -3
package/chunk-AETZ7AD6.js DELETED
@@ -1,274 +0,0 @@
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
- };