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
@@ -1,4 +1,11 @@
1
- // node_modules/js-yaml/dist/js-yaml.mjs
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
- if (state.maxTotalMergeKeys !== -1 && ++state.totalMergeKeys > state.maxTotalMergeKeys) {
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
- load,
3061
- dump
3330
+ normalizeStringArray,
3331
+ normalizeSkillModalities,
3332
+ parseSkillDocProtocol,
3333
+ resolvePageSkillMetadata,
3334
+ buildSkillDocMarkdown,
3335
+ parseExternalSkillMarkdown
3062
3336
  };
@@ -7,14 +7,24 @@ import {
7
7
  unlinkSync,
8
8
  writeFileSync
9
9
  } from "node:fs";
10
+ import { join as join2 } from "node:path";
11
+
12
+ // packages/agent-runtime/noloStateDir.ts
10
13
  import { homedir } from "node:os";
11
14
  import { join } from "node:path";
15
+ function resolveNoloStateDir(name, homeDir) {
16
+ if (homeDir) return join(homeDir, ".nolo", name);
17
+ const noloHome = process.env.NOLO_HOME?.trim();
18
+ return noloHome ? join(noloHome, name) : join(homedir(), ".nolo", name);
19
+ }
20
+
21
+ // packages/agent-runtime/oauthTokenStore.ts
12
22
  var DEFAULT_REFRESH_SKEW_MS = 5 * 60 * 1e3;
13
- function getCredentialsDir(homeDir = homedir()) {
14
- return join(homeDir, ".nolo", "credentials");
23
+ function getCredentialsDir(homeDir) {
24
+ return resolveNoloStateDir("credentials", homeDir);
15
25
  }
16
- function getCredentialPath(provider, homeDir = homedir()) {
17
- return join(getCredentialsDir(homeDir), `${provider}.json`);
26
+ function getCredentialPath(provider, homeDir) {
27
+ return join2(getCredentialsDir(homeDir), `${provider}.json`);
18
28
  }
19
29
  function ensurePrivateDir(dir) {
20
30
  mkdirSync(dir, { recursive: true, mode: 448 });
@@ -30,7 +40,7 @@ function writePrivateFile(path, body) {
30
40
  } catch {
31
41
  }
32
42
  }
33
- function readOAuthCredential(provider, homeDir = homedir()) {
43
+ function readOAuthCredential(provider, homeDir) {
34
44
  const path = getCredentialPath(provider, homeDir);
35
45
  if (!existsSync(path)) return null;
36
46
  const raw = readFileSync(path, "utf8");
@@ -42,18 +52,18 @@ function readOAuthCredential(provider, homeDir = homedir()) {
42
52
  return null;
43
53
  }
44
54
  }
45
- function writeOAuthCredential(provider, credential, homeDir = homedir()) {
55
+ function writeOAuthCredential(provider, credential, homeDir) {
46
56
  const path = getCredentialPath(provider, homeDir);
47
57
  ensurePrivateDir(getCredentialsDir(homeDir));
48
58
  writePrivateFile(path, `${JSON.stringify(credential, null, 2)}
49
59
  `);
50
60
  }
51
- function removeOAuthCredential(provider, homeDir = homedir()) {
61
+ function removeOAuthCredential(provider, homeDir) {
52
62
  const path = getCredentialPath(provider, homeDir);
53
63
  if (!existsSync(path)) return;
54
64
  unlinkSync(path);
55
65
  }
56
- function createOAuthTokenStore(homeDir = homedir()) {
66
+ function createOAuthTokenStore(homeDir) {
57
67
  return {
58
68
  read(provider) {
59
69
  return readOAuthCredential(provider, homeDir);
@@ -85,6 +95,7 @@ async function resolveFreshAccessToken(args) {
85
95
  }
86
96
 
87
97
  export {
98
+ resolveNoloStateDir,
88
99
  getCredentialsDir,
89
100
  readOAuthCredential,
90
101
  writeOAuthCredential,
@@ -3,13 +3,13 @@ import {
3
3
  } from "./chunk-DWLEOOGR.js";
4
4
  import {
5
5
  addContentAction
6
- } from "./chunk-4F5M2MW5.js";
6
+ } from "./chunk-MJWX4JQO.js";
7
7
  import {
8
8
  upload
9
- } from "./chunk-UM4H3URE.js";
9
+ } from "./chunk-23KKIMD5.js";
10
10
  import {
11
11
  getRuntimeServerContext
12
- } from "./chunk-X664KVEV.js";
12
+ } from "./chunk-HHBXCRJS.js";
13
13
  import {
14
14
  API_ENDPOINTS
15
15
  } from "./chunk-LCBAMY2M.js";
@@ -318,6 +318,8 @@ var planContextUsage = (params) => {
318
318
  // packages/ai/context/planCompression.ts
319
319
  var MIN_COMPRESS_COUNT = 5;
320
320
  var ACTIVE_SUMMARY_TAIL_KEEP_COUNT = 2;
321
+ var STUB_KEEP_COUNT = 3;
322
+ var TOOL_STUB_TEXT = "[tool output cleared to save context]";
321
323
  var getMessageTokenCount = (msg) => {
322
324
  const content = serializeMessageContent(msg.content) || "";
323
325
  let tokens = estimateTokenCount(content);
@@ -432,6 +434,45 @@ function calculateCompressCount(pendingMsgs, rawMessageBudget, opts) {
432
434
  }
433
435
  return pendingMsgs.length - keepCount;
434
436
  }
437
+ function tryComputeStubPlan(pendingMsgs, totalUsed, historyBudget, startIndex) {
438
+ const toolIndices = [];
439
+ for (let i = 0; i < pendingMsgs.length; i++) {
440
+ if (pendingMsgs[i].role === "tool") {
441
+ const content = serializeMessageContent(pendingMsgs[i].content) || "";
442
+ if (content !== TOOL_STUB_TEXT) toolIndices.push(i);
443
+ }
444
+ }
445
+ if (toolIndices.length <= STUB_KEEP_COUNT) return null;
446
+ const firstStubbedIdx = toolIndices[toolIndices.length - STUB_KEEP_COUNT - 1];
447
+ const beforeMsg = pendingMsgs[firstStubbedIdx];
448
+ if (!beforeMsg) return null;
449
+ const stubOverhead = estimateTokenCount(TOOL_STUB_TEXT);
450
+ const stubbedMsgs = pendingMsgs.slice(0, firstStubbedIdx + 1).filter(
451
+ (m) => m.role === "tool"
452
+ );
453
+ const originalTokens = stubbedMsgs.reduce(
454
+ (s, m) => s + getMessageTokenCount(m),
455
+ 0
456
+ );
457
+ const savedTokens = Math.max(0, originalTokens - stubOverhead * stubbedMsgs.length);
458
+ if (totalUsed - savedTokens > historyBudget) return null;
459
+ const keptMsgs = pendingMsgs.slice(firstStubbedIdx + 1);
460
+ return {
461
+ shouldCompress: true,
462
+ compressCount: stubbedMsgs.length,
463
+ msgsToCompress: stubbedMsgs,
464
+ msgsToKeep: keptMsgs,
465
+ newSummarizedBeforeId: void 0,
466
+ startIndex,
467
+ stub: {
468
+ // beforeId = 第一条被 stub 的 tool 结果的消息 id;投影端按
469
+ // 「abs index <= beforeId 的 index 的 tool 消息」判定是否 stub。
470
+ beforeId: beforeMsg.id,
471
+ stubbedCount: stubbedMsgs.length,
472
+ savedTokens
473
+ }
474
+ };
475
+ }
435
476
  function guardToolChainBoundary(pendingMsgs, compressCount) {
436
477
  let count = compressCount;
437
478
  while (count > 0 && count < pendingMsgs.length && pendingMsgs[count].role === "tool") {
@@ -479,6 +520,13 @@ function planCompression(input) {
479
520
  lastMsg: pendingMsgs[pendingMsgs.length - 1]
480
521
  });
481
522
  if (!trigger) return emptyPlan(startIndex);
523
+ const stubPlan = tryComputeStubPlan(
524
+ pendingMsgs,
525
+ totalUsed,
526
+ historyBudget,
527
+ startIndex
528
+ );
529
+ if (stubPlan) return stubPlan;
482
530
  let compressCount = calculateCompressCount(pendingMsgs, rawMessageBudget, {
483
531
  keepTailCount: shouldRunActiveSummary || triggeredByRealUsage,
484
532
  totalUsed,
@@ -500,6 +548,7 @@ function planCompression(input) {
500
548
  }
501
549
 
502
550
  // packages/ai/context/compactionShared.ts
551
+ var COMPACTION_SUMMARY_SCHEMA_VERSION = 1;
503
552
  var COMPACTION_SUMMARY_SYSTEM_PROMPT = `\u4F60\u662F\u5BF9\u8BDD\u4E0A\u4E0B\u6587\u538B\u7F29\u5668\u3002\u6839\u636E\u3010\u73B0\u6709\u8BB0\u5FC6\u3011\u548C\u3010\u65B0\u589E\u5BF9\u8BDD\u3011\uFF0C\u8F93\u51FA\u53EF\u66FF\u4EE3\u539F\u59CB\u6D88\u606F\u7684\u4E8B\u5B9E\u6027\u8981\u70B9\uFF0C\u4F9B\u540E\u7EED\u5BF9\u8BDD\u76F4\u63A5\u4F7F\u7528\u3002
504
553
 
505
554
  \u4E25\u683C\u53EA\u8F93\u51FA\u4E0B\u9762\u4E09\u90E8\u5206\uFF0C\u6807\u9898\u5FC5\u987B\u5B8C\u5168\u4E00\u81F4\uFF1A
@@ -666,7 +715,9 @@ export {
666
715
  buildDatabaseFileContentUrl,
667
716
  serializeMessageContent,
668
717
  normalizeAssistantContentBuffer,
718
+ TOOL_STUB_TEXT,
669
719
  planCompression,
720
+ COMPACTION_SUMMARY_SCHEMA_VERSION,
670
721
  COMPACTION_SUMMARY_SYSTEM_PROMPT,
671
722
  buildCompactionUserContent,
672
723
  formatFileOperationsFromMessages,