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.
Files changed (158) hide show
  1. package/README.md +3 -3
  2. package/{_executeModel-OPTKYHJA.js → _executeModel-R26QYY66.js} +50 -46
  3. package/{action-ORXWW2ZG.js → action-76JX3JX3.js} +7 -6
  4. package/{addContentAction-53BZ34AE.js → addContentAction-V3NAZRTJ.js} +6 -5
  5. package/{addDialogAgentAction-JRYUS54Y.js → addDialogAgentAction-RZOAF46K.js} +5 -4
  6. package/{agentDeleteCommand-FJIWU2BS.js → agentDeleteCommand-6GNQA4J4.js} +30 -27
  7. package/{agentEmailCommands-CE32L43B.js → agentEmailCommands-HH67CYKD.js} +61 -57
  8. package/{agentGrantCommands-2LEZDADN.js → agentGrantCommands-R3VQEZJR.js} +1 -1
  9. package/{agentListCommands-VJNKULIK.js → agentListCommands-23XW3OPZ.js} +61 -31
  10. package/{agentMachineCommands-HCJ3WQXL.js → agentMachineCommands-HXHASEWO.js} +31 -28
  11. package/{agentPullCommand-M552CYSI.js → agentPullCommand-N7L2CT7L.js} +2 -2
  12. package/{agentRecordCommands-QFWERED4.js → agentRecordCommands-UHTQJVGC.js} +59 -55
  13. package/{agentRunCommand-G3GQMUNN.js → agentRunCommand-OAMT77EX.js} +63 -59
  14. package/{agentRunControl-INKFDXDA.js → agentRunControl-WECMOO6O.js} +11 -6
  15. package/{agentRuntimeLocal-K327ELSL.js → agentRuntimeLocal-QBK4H3T2.js} +26 -23
  16. package/{agentSlice-ODKF4J6M.js → agentSlice-7XJH5WQF.js} +8 -7
  17. package/{appDeleteCommands-XUXMFDI4.js → appDeleteCommands-AX2O6VDV.js} +30 -27
  18. package/{appDeployCommands-37F4GPCU.js → appDeployCommands-L5ZR26CB.js} +30 -27
  19. package/{appDeployStatusCommands-WSPU7TUK.js → appDeployStatusCommands-5HQHELRA.js} +30 -27
  20. package/{appGetCommands-YLOBA3EM.js → appGetCommands-HVSYOS57.js} +30 -27
  21. package/{appListCommands-UD62R5ME.js → appListCommands-XV2FPTWX.js} +30 -27
  22. package/{authCommand-OK6HLHGS.js → authCommand-WOTWLJNF.js} +35 -29
  23. package/{authCommands-2DUIUEMT.js → authCommands-ILTBI6JV.js} +7 -5
  24. package/{chatQueueReduxAdapter-TV2TUOQS.js → chatQueueReduxAdapter-F3R253JE.js} +20 -18
  25. package/{chunk-HPW5MNDQ.js → chunk-22BTGNSP.js} +113 -57
  26. package/{chunk-UNZDCI3O.js → chunk-2KDR4CWE.js} +35 -4
  27. package/{chunk-3ZTR7ZO4.js → chunk-2PGGC63K.js} +1 -1
  28. package/{chunk-EA5OYZVD.js → chunk-37XDGCY7.js} +1 -1
  29. package/chunk-3BLB7QKO.js +433 -0
  30. package/{chunk-CS6TCJ7E.js → chunk-3JQ2NRYU.js} +30 -7
  31. package/{chunk-3LKZRP7E.js → chunk-3QGUVVX5.js} +2 -2
  32. package/{chunk-SSXTSPSG.js → chunk-45YO6H7P.js} +71 -30
  33. package/{chunk-YLCUU3WM.js → chunk-4NJEIGBQ.js} +5 -5
  34. package/{chunk-K4NISKOR.js → chunk-5ZYA4JJ3.js} +47 -17
  35. package/{chunk-6HIGYUBQ.js → chunk-6XIE5ZGI.js} +1 -1
  36. package/{chunk-3Y2K5O2R.js → chunk-7A3RRUCQ.js} +125 -40
  37. package/{chunk-6COJEAYH.js → chunk-7KELZLC2.js} +44 -37
  38. package/chunk-AETZ7AD6.js +274 -0
  39. package/chunk-BFU6C242.js +66 -0
  40. package/{chunk-IA3A5373.js → chunk-C3FZR5EC.js} +1 -1
  41. package/{chunk-IWUMSAQF.js → chunk-CJCJF5XB.js} +26 -3
  42. package/{chunk-UGBHDMHI.js → chunk-CP7VIDZ7.js} +1 -1
  43. package/{chunk-TR4DXUYX.js → chunk-CQ2OZMLQ.js} +1181 -737
  44. package/{chunk-JON2PHYT.js → chunk-CTCW7U7N.js} +1 -1
  45. package/{chunk-7NYDJAQ7.js → chunk-DNNSCSA2.js} +5 -5
  46. package/{chunk-NI2BS6UD.js → chunk-DWUCB2A3.js} +1 -1
  47. package/{chunk-FJHMLRDQ.js → chunk-DWYSDNOH.js} +22 -28
  48. package/{chunk-AA564GBL.js → chunk-E3YVTQWT.js} +2 -2
  49. package/chunk-E4MARS3Q.js +114 -0
  50. package/{chunk-75MSWWUE.js → chunk-E6RGHPDR.js} +5 -3
  51. package/chunk-EDKF7RX4.js +30 -0
  52. package/{chunk-TC6P4NDR.js → chunk-F44FAXP2.js} +6 -6
  53. package/{chunk-SYYUU7EV.js → chunk-FHAGENAS.js} +2 -3
  54. package/{chunk-NJUQBYFJ.js → chunk-FKFMIBTT.js} +3 -1
  55. package/{chunk-INZZJSQF.js → chunk-FZGV4FGK.js} +24 -12
  56. package/{chunk-6HDYSFLO.js → chunk-GSXDRMDO.js} +3 -3
  57. package/{chunk-AUVFJGPC.js → chunk-JX5PJCWS.js} +7 -5
  58. package/{chunk-LYGNQHUW.js → chunk-JYYZCK2Z.js} +2 -4
  59. package/{chunk-EY7V7REW.js → chunk-KHCLMKZZ.js} +6 -280
  60. package/{chunk-EJE33XNR.js → chunk-KSCXMC6U.js} +1521 -565
  61. package/{chunk-XOJRZUPF.js → chunk-KWSQR2KK.js} +14 -29
  62. package/{chunk-2WBFJHQA.js → chunk-L7B47JXR.js} +34 -39
  63. package/{chunk-EICIFHVS.js → chunk-LAFC3B2I.js} +1 -1
  64. package/{chunk-N4JKMCY3.js → chunk-LJKICKVC.js} +2 -2
  65. package/chunk-M3JEW6N6.js +193 -0
  66. package/{chunk-LRGKOI5Y.js → chunk-MBOEV4L2.js} +7 -3
  67. package/{chunk-SVDMVX4G.js → chunk-MMZ6ZTVO.js} +112 -73
  68. package/{chunk-JDSUTNYY.js → chunk-MP64VFGD.js} +2 -2
  69. package/{chunk-NFLA6GSU.js → chunk-MXUDQZXQ.js} +44 -5
  70. package/chunk-N4G4PKQ6.js +23 -0
  71. package/{chunk-WQHGJHAL.js → chunk-N6HLMLKE.js} +732 -726
  72. package/{chunk-YQBXOHE6.js → chunk-NO42UD73.js} +1 -1
  73. package/{chunk-MLEZPE3U.js → chunk-NRRPKMM7.js} +4 -4
  74. package/{chunk-KXKQO4Q6.js → chunk-NTW5GWDM.js} +58 -1
  75. package/chunk-ONXOABJR.js +215 -0
  76. package/{chunk-TY3ADTX5.js → chunk-OZX2IPKM.js} +7 -2
  77. package/{chunk-Q4XZVZPN.js → chunk-P7OOB7QP.js} +1 -1
  78. package/{chunk-XIJZOCSP.js → chunk-PEZJEQAO.js} +1 -1
  79. package/{chunk-SWJGJMTW.js → chunk-PQDIDWGX.js} +1 -1
  80. package/chunk-PSCNXBYA.js +11 -0
  81. package/{chunk-BY2FF2C4.js → chunk-QEFJJS2I.js} +55 -73
  82. package/{chunk-BG7J6Y5X.js → chunk-QEW2MFDQ.js} +1 -1
  83. package/{chunk-KLIBF3BY.js → chunk-RDBARW6T.js} +8 -3
  84. package/{chunk-ZVOHVJI3.js → chunk-RJ2SAFB5.js} +82 -35
  85. package/{chunk-MYMBBB6Q.js → chunk-RVWRKFUB.js} +5 -3
  86. package/{chunk-43CXXVJD.js → chunk-RXX4GDIH.js} +1 -1
  87. package/chunk-SEJ5OS6F.js +49 -0
  88. package/{chunk-JXIP6ZWH.js → chunk-SKIRVYEI.js} +18 -5
  89. package/{chunk-SAJSBPI2.js → chunk-SOJM57FX.js} +5 -2
  90. package/{chunk-EKLRRZIN.js → chunk-SPAQ4PVV.js} +0 -5
  91. package/{chunk-RHMDMTDK.js → chunk-SYNKICCB.js} +2 -2
  92. package/{chunk-YBFJQC2M.js → chunk-TBHAHL33.js} +65 -42
  93. package/{chunk-L7NG2M6H.js → chunk-TRV2MIDW.js} +89 -74
  94. package/{chunk-5UAYZEXO.js → chunk-UZPQSVM6.js} +1 -1
  95. package/{chunk-7FAS3NEF.js → chunk-VAKVNHK5.js} +19 -15
  96. package/{chunk-UOWXD4VN.js → chunk-VHO3TMQZ.js} +336 -244
  97. package/{chunk-SVC3GGUA.js → chunk-VMWYBIXG.js} +7 -5
  98. package/{chunk-ZHXJ6M7T.js → chunk-W7XHHYWM.js} +4 -0
  99. package/{chunk-UR66XPVF.js → chunk-XAVSS3KE.js} +21 -3
  100. package/{chunk-A65UV3M5.js → chunk-XOKOSO35.js} +10 -19
  101. package/{chunk-VZMUOPYG.js → chunk-XTJTN3RW.js} +46 -3
  102. package/{chunk-T5HJEUQN.js → chunk-YCDWJX45.js} +1 -1
  103. package/{chunk-BBTN4NQD.js → chunk-Z4QSJILV.js} +85 -13
  104. package/{chunk-5FCIPEKT.js → chunk-Z5MHFBJZ.js} +1051 -926
  105. package/{chunk-O5FLGN2L.js → chunk-ZRSJ3JEH.js} +6 -2
  106. package/{cliExecutor-BBUVQU4L.js → cliExecutor-HG3S345O.js} +1 -1
  107. package/{codingSkills-BCQXRZOI.js → codingSkills-TKROLCBA.js} +4 -3
  108. package/{contentThunks-KNI6VXLT.js → contentThunks-OZPK5B4Z.js} +21 -19
  109. package/{cooldownCommands-GI5NNWGL.js → cooldownCommands-BSCH2W7P.js} +2 -2
  110. package/{createAgentAutomationAction-OK4L33KF.js → createAgentAutomationAction-LCIBGE5T.js} +23 -21
  111. package/{createDialogAction-JDSMY4AY.js → createDialogAction-JPJZMHJE.js} +25 -22
  112. package/{createPageAction-T7RA3HCG.js → createPageAction-6P2WLNHO.js} +26 -23
  113. package/{dbSlice-TVX6SN2T.js → dbSlice-IBVOBVMS.js} +5 -4
  114. package/{deleteFile-JYKRT7C3.js → deleteFile-FWP2PSBG.js} +3 -2
  115. package/{dialogCommands-UQZYWOOV.js → dialogCommands-WAFKC3KK.js} +30 -27
  116. package/{dialogSlice-TYW2G7IL.js → dialogSlice-R5RZHFTU.js} +20 -18
  117. package/{docCreateCommands-OA6HZBWO.js → docCreateCommands-GHGB42S7.js} +32 -28
  118. package/{docDeleteCommands-KBB3YQI2.js → docDeleteCommands-Y5I7ZEX4.js} +33 -29
  119. package/{docReadCommands-ZLMFVC67.js → docReadCommands-BMXM6J7T.js} +32 -28
  120. package/{docStore-2URPBVCS.js → docStore-DKWZ6XJ5.js} +6 -5
  121. package/{docUpdateCommands-HMH5KUON.js → docUpdateCommands-QNABH3M2.js} +32 -28
  122. package/{getPricing-RFOPUWHY.js → getPricing-NM3NUTAS.js} +4 -4
  123. package/handleSendMessageAction-UQGKM4UX.js +675 -0
  124. package/index.js +79 -88
  125. package/{lib-2ZTNRXR4.js → lib-FRRS27KN.js} +63 -28
  126. package/{localRuntimeAuthority-KQDAE64E.js → localRuntimeAuthority-R5UBODT3.js} +6 -4
  127. package/{localRuntimeDb-PF7CFKDL.js → localRuntimeDb-P37ZTX55.js} +1 -1
  128. package/{machineCommands-RK6L7ZWL.js → machineCommands-YDAIPYU5.js} +298 -80
  129. package/{machineWsRunDispatch-3X64DW2Z.js → machineWsRunDispatch-O6RM2ECT.js} +57 -53
  130. package/{memberThunks-THZYZFSN.js → memberThunks-VZI6G7YZ.js} +10 -8
  131. package/{models-JVKUEER5.js → models-FAMINFZ7.js} +2 -2
  132. package/package.json +3 -2
  133. package/{read-K4JU4MQC.js → read-2BYWW7AA.js} +3 -2
  134. package/{readDocTool-LQGR6FUN.js → readDocTool-LC3A7QTB.js} +1 -1
  135. package/{readlineWorkspace-XUFJV3RS.js → readlineWorkspace-5DP3AJWN.js} +4367 -2796
  136. package/{removeDialogAgentAction-ECHCFB7N.js → removeDialogAgentAction-SFYZXHNK.js} +8 -7
  137. package/{runAgentClientLoop-24GQ2AW6.js → runAgentClientLoop-Y6HWP2PT.js} +51 -46
  138. package/{runtimeDoctorCommands-JKTTN723.js → runtimeDoctorCommands-CROTMULY.js} +7 -5
  139. package/{setDialogExtraReferencesAction-KCVJNGMB.js → setDialogExtraReferencesAction-Q32RGFTA.js} +6 -5
  140. package/{setPrimaryDialogAgentAction-VDOBOMKC.js → setPrimaryDialogAgentAction-BFYJHUJS.js} +8 -7
  141. package/{settingSlice-VR2IJSXC.js → settingSlice-IRUU4VFB.js} +6 -5
  142. package/{skillDiscovery-2QTZINON.js → skillDiscovery-CYUCJMAG.js} +2 -1
  143. package/{spaceCommands-S5YJJXL7.js → spaceCommands-CLN45IE3.js} +33 -215
  144. package/{streamAgentChatTurn-QHKP3ABO.js → streamAgentChatTurn-6WFQJ4DY.js} +107 -74
  145. package/{switchDialogAgentAction-5L4UP7VI.js → switchDialogAgentAction-L2KOKCGG.js} +5 -4
  146. package/{tableCommands-R6WFRDYF.js → tableCommands-SUNTHAYX.js} +1 -1
  147. package/{toolApiClient-53U4UDFF.js → toolApiClient-VGYUB4P5.js} +2 -1
  148. package/{tools-SSXSTC3O.js → tools-RR53D65Q.js} +39 -35
  149. package/{tuiSummaryLlmCaller-URFJHFC5.js → tuiSummaryLlmCaller-F3DPFFZM.js} +15 -13
  150. package/{updateCommands-IYKLF3JX.js → updateCommands-AJYSD73Y.js} +2 -2
  151. package/{updateDialogTitleAction-YFYAEW3T.js → updateDialogTitleAction-WXS3AKOL.js} +23 -21
  152. package/agentSuperviseCommands-5AR3DKNN.js +0 -640
  153. package/chunk-6IGD47IC.js +0 -19
  154. package/chunk-FD36SCCD.js +0 -105
  155. package/chunk-GRFK2XP4.js +0 -230
  156. package/chunk-HJTAGT3W.js +0 -370
  157. package/chunk-SUEIAK5N.js +0 -2574
  158. package/handleSendMessageAction-GO53TY7U.js +0 -409
@@ -1,11 +1,4 @@
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
1
+ // node_modules/js-yaml/dist/js-yaml.mjs
9
2
  function getDefaultExportFromCjs(x) {
10
3
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
11
4
  }
@@ -1283,21 +1276,16 @@ function requireLoader() {
1283
1276
  state.result += _result;
1284
1277
  }
1285
1278
  }
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
- }
1292
1279
  function mergeMappings(state, destination, source, overridableKeys) {
1293
1280
  if (!common2.isObject(source)) {
1294
1281
  throwError(state, "cannot merge mappings; the provided source object is unacceptable");
1295
1282
  }
1296
- chargeMergeWork(state);
1297
1283
  const sourceKeys = Object.keys(source);
1298
1284
  for (let index = 0, quantity = sourceKeys.length; index < quantity; index += 1) {
1299
1285
  const key = sourceKeys[index];
1300
- chargeMergeWork(state);
1286
+ if (state.maxTotalMergeKeys !== -1 && ++state.totalMergeKeys > state.maxTotalMergeKeys) {
1287
+ throwError(state, "merge keys exceeded maxTotalMergeKeys (" + state.maxTotalMergeKeys + ")");
1288
+ }
1301
1289
  if (!_hasOwnProperty.call(destination, key)) {
1302
1290
  setProperty(destination, key, source[key]);
1303
1291
  overridableKeys[key] = true;
@@ -1325,9 +1313,6 @@ function requireLoader() {
1325
1313
  }
1326
1314
  if (keyTag === "tag:yaml.org,2002:merge") {
1327
1315
  if (Array.isArray(valueNode)) {
1328
- if (valueNode.length > 100) {
1329
- throwError(state, "abnormal merge sequence size");
1330
- }
1331
1316
  for (let index = 0, quantity = valueNode.length; index < quantity; index += 1) {
1332
1317
  mergeMappings(state, _result, valueNode[index], overridableKeys);
1333
1318
  }
@@ -3071,266 +3056,7 @@ var {
3071
3056
  safeDump
3072
3057
  } = yaml;
3073
3058
 
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
-
3329
3059
  export {
3330
- normalizeStringArray,
3331
- normalizeSkillModalities,
3332
- parseSkillDocProtocol,
3333
- resolvePageSkillMetadata,
3334
- buildSkillDocMarkdown,
3335
- parseExternalSkillMarkdown
3060
+ load,
3061
+ dump
3336
3062
  };