nolo-cli 0.10.0 → 0.12.0-alpha.1

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 (125) hide show
  1. package/{_executeModel-YAXYAUOK.js → _executeModel-MWAY74HA.js} +47 -44
  2. package/{action-TLI3V62L.js → action-RAXNQQKC.js} +9 -10
  3. package/{addContentAction-PLWJSCOZ.js → addContentAction-ZHI7TVV3.js} +8 -10
  4. package/{addDialogAgentAction-BJ6SB76X.js → addDialogAgentAction-JWXPKXNC.js} +7 -8
  5. package/{agentDeleteCommand-2VYX73U5.js → agentDeleteCommand-LXR5A5FV.js} +36 -26
  6. package/{agentEmailCommands-3GDZIX64.js → agentEmailCommands-DXRAP7BB.js} +63 -58
  7. package/{agentListCommands-UWVBT3LH.js → agentListCommands-ZFMS5ZLY.js} +132 -35
  8. package/{agentMachineCommands-WOKMUG2Y.js → agentMachineCommands-ZJLYVV52.js} +40 -29
  9. package/{agentPullCommand-O2MTUAFR.js → agentPullCommand-KRBRIFIY.js} +6 -6
  10. package/{agentRecordCommands-MVNZRH3U.js → agentRecordCommands-DFS626TB.js} +55 -50
  11. package/{agentRunCommand-K7THIJLA.js → agentRunCommand-GWBIE2TS.js} +60 -56
  12. package/{agentRunControl-K4VKNEHF.js → agentRunControl-IX4F5W2C.js} +3 -3
  13. package/{agentRuntimeLocal-WJIGU24U.js → agentRuntimeLocal-YNZSHMZC.js} +29 -14
  14. package/{agentSlice-LL5TKZEO.js → agentSlice-T2PXOEPQ.js} +9 -10
  15. package/{authCommand-TC2SW2CQ.js → authCommand-DMW336GT.js} +13 -13
  16. package/{authCommands-XPEHTKSM.js → authCommands-GH5T6RYV.js} +6 -6
  17. package/{chunk-5JGGZCZL.js → chunk-3HHTVM6G.js} +64 -5
  18. package/chunk-3QKO4EHV.js +112 -0
  19. package/{chunk-AUQ747NZ.js → chunk-43UD5ZP7.js} +76 -15
  20. package/{chunk-6SLCD4RB.js → chunk-4BTHUYMY.js} +596 -67
  21. package/{chunk-T7R3NGUU.js → chunk-4EH7AR52.js} +13 -13
  22. package/{chunk-C3RUNRHT.js → chunk-4GBNEA5B.js} +1 -1
  23. package/{chunk-4IJYA27C.js → chunk-4LG74DRG.js} +1 -1
  24. package/{chunk-2FTTDCD4.js → chunk-4ON5AV72.js} +2 -1
  25. package/{chunk-IWX4UW2E.js → chunk-524BDL33.js} +89 -8
  26. package/{chunk-EXXFGKF7.js → chunk-5ITRDSHY.js} +1400 -119
  27. package/{chunk-ISNCLGUZ.js → chunk-5NBHQD4D.js} +4 -3
  28. package/{chunk-7KNKFIRO.js → chunk-6LMFFG3K.js} +3 -3
  29. package/{chunk-PAKN26FP.js → chunk-6OVCRC72.js} +1 -1
  30. package/{chunk-CKOJQDKR.js → chunk-7JJCGV7N.js} +146 -3
  31. package/{chunk-KBKYAONQ.js → chunk-7MYHLZ3F.js} +2 -2
  32. package/{chunk-PIVFPOW6.js → chunk-AM53Q2SD.js} +175 -2541
  33. package/chunk-BYXBJQAS.js +0 -0
  34. package/{chunk-CL3IOKGK.js → chunk-DE5BA4O6.js} +20 -2
  35. package/{chunk-6KUOUWMP.js → chunk-DRMGJFGQ.js} +300 -89
  36. package/{chunk-QAALPJS7.js → chunk-EBH7G34M.js} +20 -7
  37. package/{chunk-HJGEVL7C.js → chunk-G3B356GF.js} +15 -17
  38. package/{chunk-OZMMKDBI.js → chunk-GDBCUWQ3.js} +26 -20
  39. package/{chunk-I5URP43I.js → chunk-GPZM7QH6.js} +9 -9
  40. package/chunk-IKXL2HZ3.js +70 -0
  41. package/{chunk-AS4PVWA4.js → chunk-IVAOVLM7.js} +1 -1
  42. package/{chunk-TNPIMII7.js → chunk-JUN3HFMN.js} +221 -81
  43. package/{chunk-HFASY3WO.js → chunk-JZDIW766.js} +1 -1
  44. package/{chunk-6JJWFVZ6.js → chunk-LHSJMY5V.js} +17 -17
  45. package/chunk-LTRXGFMS.js +83 -0
  46. package/{chunk-YIHFXH5Q.js → chunk-MEVCDATU.js} +3 -3
  47. package/{chunk-TILFE6LV.js → chunk-NCGFB7NN.js} +5 -3
  48. package/{chunk-BE2OOJ5P.js → chunk-NITP2JDG.js} +42 -11
  49. package/{chunk-YPRZSPF3.js → chunk-OCDEWRE2.js} +1 -1
  50. package/{chunk-VVX233PH.js → chunk-OHEKYYJF.js} +9 -9
  51. package/chunk-OOIN7HSO.js +146 -0
  52. package/{chunk-WPE4F4Z6.js → chunk-OPKKB25T.js} +1 -1
  53. package/{chunk-OR2XR25C.js → chunk-QCA3EPYK.js} +8 -8
  54. package/{chunk-SL35K7AH.js → chunk-QLUFR47U.js} +13 -83
  55. package/{chunk-CDTLMEB3.js → chunk-RNQ5BLR2.js} +1 -1
  56. package/{chunk-AVMKZHBC.js → chunk-RSEUHW6T.js} +3 -2
  57. package/{chunk-TYSCFY6S.js → chunk-RZ735TLX.js} +762 -167
  58. package/chunk-S3UTETIC.js +4885 -0
  59. package/chunk-S73OEOHH.js +2286 -0
  60. package/{chunk-JRKKFRAV.js → chunk-TSKWE74T.js} +58 -8
  61. package/{chunk-A67QFHAA.js → chunk-UG3WOFU6.js} +1 -1
  62. package/{chunk-4ZDM73SD.js → chunk-V2J635L5.js} +1 -1
  63. package/chunk-VC6OZXO5.js +298 -0
  64. package/{chunk-7U44LYTR.js → chunk-WPHL6ALY.js} +1 -1
  65. package/{chunk-4SIMLBEU.js → chunk-WTYKCU4W.js} +9 -9
  66. package/{chunk-NPVBXJY2.js → chunk-WWU275LU.js} +9 -9
  67. package/{chunk-ZQ2UM4KG.js → chunk-WZSRQNQG.js} +1 -292
  68. package/{chunk-DSZUWUYB.js → chunk-XHQWJUW4.js} +2 -2
  69. package/{chunk-GAKEBQD6.js → chunk-YDCZVUFP.js} +4 -0
  70. package/{chunk-2O4IZNTG.js → chunk-YTQLJYLB.js} +2 -2
  71. package/{chunk-3Y3HW5PX.js → chunk-ZPFRLGIZ.js} +1512 -935
  72. package/{chunk-5KLGBAAR.js → chunk-ZR4VHQ5D.js} +14 -13
  73. package/cliEnvHelpers-VYC2OPTB.js +30 -0
  74. package/{cliExecutor-DNE7TCC4.js → cliExecutor-K3F7DMRO.js} +2 -2
  75. package/{createAgentAutomationAction-CCE7CWGQ.js → createAgentAutomationAction-G32GKDGV.js} +22 -23
  76. package/{createDialogAction-QTRR4AT7.js → createDialogAction-TISANRZK.js} +25 -25
  77. package/{createPageAction-Y4KQOAJE.js → createPageAction-O7KOYNV4.js} +27 -27
  78. package/{dbSlice-WWNV2SGX.js → dbSlice-WDP2ZZHK.js} +7 -8
  79. package/{deleteFile-OW53A6BX.js → deleteFile-M7UNIUOO.js} +5 -5
  80. package/{dialogCommands-SMKIAC3Y.js → dialogCommands-6JPB3YQY.js} +33 -23
  81. package/{dialogSlice-PT7YBWNE.js → dialogSlice-PRHHYSP5.js} +21 -22
  82. package/{docCreateCommands-RFNA4HNM.js → docCreateCommands-75E6TZNN.js} +36 -25
  83. package/{docDeleteCommands-4YZ325M6.js → docDeleteCommands-EJHLN7LW.js} +37 -27
  84. package/{docReadCommands-RT6VAFFG.js → docReadCommands-RJYBC4FS.js} +36 -25
  85. package/{docStore-QUQZAFZF.js → docStore-H5VWKT5D.js} +22 -23
  86. package/{docUpdateCommands-EKKKNYPW.js → docUpdateCommands-MG4CNISV.js} +36 -25
  87. package/fetchMessages-KTNM7QAR.js +1 -1
  88. package/{getPricing-3E6UNPKL.js → getPricing-6TOZXPAU.js} +7 -3
  89. package/{handleSendMessageAction-5NSYAS53.js → handleSendMessageAction-QTUGICSZ.js} +22 -23
  90. package/index.js +77 -76
  91. package/{machineCommands-DOOSIUKG.js → machineCommands-MAV7M3TK.js} +67 -60
  92. package/{machineWsRunDispatch-PIOIQRBW.js → machineWsRunDispatch-ZOEGTKHC.js} +54 -49
  93. package/{memoryCommands-O4MIPIWQ.js → memoryCommands-AFMES3LN.js} +5 -5
  94. package/{models-4OPOOLFS.js → models-LSCRJJ6P.js} +2 -2
  95. package/package.json +1 -1
  96. package/{read-GW7ZEI23.js → read-2MIMRBZ2.js} +5 -5
  97. package/{readDocTool-HUFU6OCT.js → readDocTool-QHVGQHUJ.js} +1 -1
  98. package/{readlineWorkspace-QEAOH5EP.js → readlineWorkspace-SWQKC7ZS.js} +1126 -678
  99. package/{removeDialogAgentAction-OHMCNSSD.js → removeDialogAgentAction-GTX5AN54.js} +11 -11
  100. package/{runAgentClientLoop-AIGLXC3R.js → runAgentClientLoop-P25HACXX.js} +42 -40
  101. package/{runtimeDoctorCommands-LRHLPDRC.js → runtimeDoctorCommands-QNF3J3UV.js} +6 -6
  102. package/{setDialogExtraReferencesAction-YJUM5BWQ.js → setDialogExtraReferencesAction-WFQ63KYO.js} +7 -8
  103. package/{setPrimaryDialogAgentAction-EBAREZDM.js → setPrimaryDialogAgentAction-P57FXTSU.js} +11 -11
  104. package/{settingSlice-UW4IUI5L.js → settingSlice-CK5YZGNI.js} +8 -9
  105. package/skillDiscovery-ZYHSX7VD.js +16 -0
  106. package/{spaceCommands-BKHSPR73.js → spaceCommands-6O5EFEM5.js} +41 -33
  107. package/{spaceSlice-TYNWE3OC.js → spaceSlice-4EXTYXS4.js} +25 -24
  108. package/{streamAgentChatTurn-HRMFFA7E.js → streamAgentChatTurn-Q3FJAHG2.js} +205 -107
  109. package/{tableCommands-O7O2LBEG.js → tableCommands-E4SQWDOX.js} +10 -10
  110. package/{tools-3JNDS3WH.js → tools-AHNQE4GP.js} +33 -31
  111. package/{tuiSummaryLlmCaller-RV3THLZF.js → tuiSummaryLlmCaller-TXLF4MEI.js} +8 -6
  112. package/{updateCommands-VOSPKXFF.js → updateCommands-XZDOOYFH.js} +13 -5
  113. package/{updateDialogTitleAction-OCETSKCP.js → updateDialogTitleAction-XZDVLKVX.js} +25 -25
  114. package/chunk-5MMAK75Q.js +0 -15
  115. package/chunk-AZPCASRE.js +0 -36
  116. package/chunk-BBYVOSU2.js +0 -792
  117. package/chunk-DCOA4QSN.js +0 -105
  118. package/chunk-UAD2WT54.js +0 -64
  119. package/{chunk-DZ3XJVET.js → chunk-3QAF2LTL.js} +3 -3
  120. package/{chunk-X7W4TNB4.js → chunk-CMKUBIGW.js} +3 -3
  121. package/{chunk-4CQLVGRV.js → chunk-ID4G2MAR.js} +3 -3
  122. package/{chunk-5CS33IBL.js → chunk-PDL2AV3E.js} +3 -3
  123. package/{chunk-EHLHSX7R.js → chunk-TOILAPLH.js} +3 -3
  124. package/{chunk-UTLZINAP.js → chunk-TSUJOM6N.js} +10 -10
  125. package/{offlineMarxistsAgentCommand-BCPJITJL.js → offlineMarxistsAgentCommand-5OOWZLJI.js} +3 -3
@@ -1,9 +1,12 @@
1
1
  import {
2
2
  getModelConfig
3
- } from "./chunk-BBYVOSU2.js";
3
+ } from "./chunk-S3UTETIC.js";
4
4
  import {
5
5
  asTrimmedLowercaseString
6
6
  } from "./chunk-QSJ3HFEF.js";
7
+ import {
8
+ isRecord
9
+ } from "./chunk-KUG52IAP.js";
7
10
  import {
8
11
  asTrimmedString
9
12
  } from "./chunk-3EUW3WEO.js";
@@ -13,9 +16,6 @@ import {
13
16
  import {
14
17
  asOptionalTrimmedString
15
18
  } from "./chunk-G3SUCT4W.js";
16
- import {
17
- isRecord
18
- } from "./chunk-KUG52IAP.js";
19
19
 
20
20
  // packages/agent-runtime/agentConfigOptions.ts
21
21
  function pickAgentRuntimeInferenceOptions(agentConfig) {
@@ -29,8 +29,35 @@ function pickAgentRuntimeInferenceOptions(agentConfig) {
29
29
  };
30
30
  }
31
31
 
32
+ // packages/agent-runtime/openAiCompatibleMessages.ts
33
+ function preserveAgentStateFields(source, target) {
34
+ const mutableTarget = target;
35
+ if (source.role === "assistant") {
36
+ if (typeof source.reasoning_content === "string") {
37
+ mutableTarget.reasoning_content = source.reasoning_content;
38
+ }
39
+ if (Array.isArray(source.tool_calls)) {
40
+ mutableTarget.tool_calls = source.tool_calls;
41
+ }
42
+ }
43
+ if (source.role === "tool") {
44
+ const toolCallId = typeof source.tool_call_id === "string" ? source.tool_call_id.trim() : typeof source.toolCallId === "string" ? source.toolCallId.trim() : "";
45
+ if (toolCallId) mutableTarget.tool_call_id = toolCallId;
46
+ }
47
+ return target;
48
+ }
49
+ function toOpenAiCompatibleMessages(messages) {
50
+ return messages.map(
51
+ (message) => preserveAgentStateFields(message, {
52
+ role: message.role,
53
+ content: message.content ?? ""
54
+ })
55
+ );
56
+ }
57
+
32
58
  // packages/agent-runtime/platformProviderEndpoints.ts
33
59
  var OPENAI_RESPONSES_ENDPOINT = "https://api.openai.com/v1/responses";
60
+ var DEEPSEEK_RESPONSES_ENDPOINT = "https://api.deepseek.com/v1/responses";
34
61
  var PLATFORM_CHAT_COMPLETIONS_ENDPOINTS = {
35
62
  deepinfra: "https://api.deepinfra.com/v1/openai/chat/completions",
36
63
  deepseek: "https://api.deepseek.com/chat/completions",
@@ -47,7 +74,11 @@ var PLATFORM_CHAT_COMPLETIONS_ENDPOINTS = {
47
74
  nolo: "https://ollama.com/v1/chat/completions"
48
75
  };
49
76
  function isOpenAiResponsesModel(args) {
50
- if (asTrimmedLowercaseString(args.provider) !== "openai") return false;
77
+ const provider = asTrimmedLowercaseString(args.provider);
78
+ if (provider === "deepseek") {
79
+ return asTrimmedLowercaseString(args.model) === "deepseek-v4-flash";
80
+ }
81
+ if (provider !== "openai") return false;
51
82
  if (args.endpointKey === "responses") return true;
52
83
  if (!args.model) return false;
53
84
  try {
@@ -56,10 +87,24 @@ function isOpenAiResponsesModel(args) {
56
87
  return false;
57
88
  }
58
89
  }
90
+ function resolvePlatformResponsesEndpoint(provider) {
91
+ switch (asTrimmedLowercaseString(provider)) {
92
+ case "openai":
93
+ return OPENAI_RESPONSES_ENDPOINT;
94
+ case "deepseek":
95
+ return DEEPSEEK_RESPONSES_ENDPOINT;
96
+ default:
97
+ return void 0;
98
+ }
99
+ }
100
+ var PLATFORM_PROVIDER_ENDPOINT_ALIASES = {
101
+ "ollama-cloud": "nolo"
102
+ };
59
103
  function resolvePlatformChatCompletionsEndpoint(provider) {
60
104
  const key = asTrimmedLowercaseString(provider);
61
105
  if (!key) return void 0;
62
- return PLATFORM_CHAT_COMPLETIONS_ENDPOINTS[key];
106
+ const aliased = PLATFORM_PROVIDER_ENDPOINT_ALIASES[key] ?? key;
107
+ return PLATFORM_CHAT_COMPLETIONS_ENDPOINTS[aliased];
63
108
  }
64
109
 
65
110
  // packages/agent-runtime/providerResolution.ts
@@ -77,7 +122,7 @@ function resolvePlatformProviderEndpoint(agentConfig) {
77
122
  model: agentConfig.model,
78
123
  endpointKey: agentConfig.endpointKey
79
124
  })) {
80
- return OPENAI_RESPONSES_ENDPOINT;
125
+ return resolvePlatformResponsesEndpoint(provider) ?? "";
81
126
  }
82
127
  const endpoint = resolvePlatformChatCompletionsEndpoint(provider);
83
128
  if (!endpoint) {
@@ -407,6 +452,9 @@ var convertMessagesToResponsesInput = (messages) => {
407
452
  continue;
408
453
  }
409
454
  const role = message.role;
455
+ if (role === "assistant" && typeof message.reasoning_content === "string" && message.reasoning_content) {
456
+ input.push({ type: "reasoning", content: message.reasoning_content });
457
+ }
410
458
  const contentParts = normalizeMessageParts(message.content, role);
411
459
  if (contentParts.length > 0) {
412
460
  input.push({
@@ -517,8 +565,10 @@ var extractToolCallsFromResponseOutput = (response) => {
517
565
 
518
566
  export {
519
567
  pickAgentRuntimeInferenceOptions,
520
- OPENAI_RESPONSES_ENDPOINT,
568
+ preserveAgentStateFields,
569
+ toOpenAiCompatibleMessages,
521
570
  isOpenAiResponsesModel,
571
+ resolvePlatformResponsesEndpoint,
522
572
  resolvePlatformChatCompletionsEndpoint,
523
573
  trimTrailingSlash,
524
574
  resolvePlatformServerUrl,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  DEFAULT_AGENT_BASE_POLICY,
3
3
  DEFAULT_USER_PREFERENCE_PROFILE
4
- } from "./chunk-4SIMLBEU.js";
4
+ } from "./chunk-WTYKCU4W.js";
5
5
 
6
6
  // packages/ai/policy/runtimePolicy.ts
7
7
  var clampLevel = (value, fallback) => {
@@ -16,7 +16,7 @@ var BUILTIN_SUMMARY_LLM_CONFIG = {
16
16
  provider: "deepseek",
17
17
  id: "builtin-dialog-summary-llm",
18
18
  name: "Builtin Dialog Summary LLM",
19
- model: "deepseek-v4-pro",
19
+ model: "deepseek-v4-flash",
20
20
  prompt: "\u4F60\u662F\u4E00\u4E2A\u4E13\u4E1A\u7684\u5BF9\u8BDD\u8BB0\u5FC6\u52A9\u7406\u3002\u8BF7\u57FA\u4E8E\u3010\u73B0\u6709\u8BB0\u5FC6\u3011\u548C\u3010\u65B0\u589E\u5BF9\u8BDD\u3011\uFF0C\u8F93\u51FA\u4E00\u4EFD\u66F4\u65B0\u540E\u7684\u5BF9\u8BDD\u8BB0\u5FC6\u6863\u6848\u3002\u4E25\u683C\u53EA\u8F93\u51FA\u4E0B\u9762\u4E24\u90E8\u5206\uFF0C\u6807\u9898\u5FC5\u987B\u5B8C\u5168\u4E00\u81F4\uFF1A\n\u5173\u952E\u4E8B\u5B9E\u6863\u6848\n- ...\n\u5BF9\u8BDD\u5267\u60C5\u6458\u8981\n- ...\n\u8981\u6C42\uFF1A1) \u4F7F\u7528\u5BF9\u8BDD\u4E3B\u8BED\u8A00\uFF1B\u6DF7\u5408\u8BED\u8A00\u65F6\u4F18\u5148\u8DDF\u968F\u7528\u6237\u4E3B\u8981\u8BED\u8A00\uFF0C\u4E13\u6709\u540D\u8BCD\u4FDD\u7559\u539F\u6587\u30022) \u5173\u952E\u4E8B\u5B9E\u6863\u6848\u53EA\u4FDD\u7559\u4E4B\u540E\u7EE7\u7EED\u5BF9\u8BDD\u4ECD\u6709\u4EF7\u503C\u7684\u4FE1\u606F\uFF0C\u4F8B\u5982\u7528\u6237\u504F\u597D\u3001\u76EE\u6807\u3001\u7EA6\u675F\u3001\u6280\u672F\u6808\u3001\u786E\u5B9A\u7684\u6587\u4EF6\u540D/\u53D8\u91CF\u540D\u3001\u6838\u5FC3\u51B3\u7B56\u3001\u5F85\u529E\u4E8B\u9879\u30023) \u5BF9\u8BDD\u5267\u60C5\u6458\u8981\u5148\u6781\u7B80\u6982\u62EC\u65E7\u4E0A\u4E0B\u6587\uFF0C\u518D\u66F4\u8BE6\u7EC6\u8BB0\u5F55\u6700\u8FD1\u65B0\u589E\u7684\u8FDB\u5C55\u3001\u5206\u6B67\u3001\u7ED3\u8BBA\u548C\u4E0B\u4E00\u6B65\u30024) \u5FFD\u7565\u5BD2\u6684\u3001\u91CD\u590D\u5C1D\u8BD5\u3001\u5DF2\u653E\u5F03\u65B9\u6848\u548C\u65E0\u4EF7\u503C\u5E9F\u8BDD\u30025) \u4E0D\u8981\u7F16\u9020\u672A\u51FA\u73B0\u7684\u4FE1\u606F\uFF0C\u4E0D\u8981\u8F93\u51FA\u5F00\u573A\u767D\u3001\u7ED3\u675F\u8BED\u3001markdown \u4EE3\u7801\u5757\u6216\u989D\u5916\u7AE0\u8282\u3002"
21
21
  };
22
22
  var buildBuiltinSummaryContent = (previousSummary, messagesText) => `
@@ -0,0 +1,298 @@
1
+ import {
2
+ dump,
3
+ load
4
+ } from "./chunk-WZSRQNQG.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: ["low", "medium", "high"],
16
+ modality: ["text", "image", "video", "audio", "3d"],
17
+ docKind: ["knowledge", "instruction", "skill"]
18
+ };
19
+ var SKILL_CONFIG_BLOCK = "skill-config";
20
+ var EVAL_CONFIG_BLOCK = "eval-config";
21
+ var WORKFLOW_CONFIG_BLOCK = "workflow-config";
22
+ var normalizeStringArray = (value) => {
23
+ if (!Array.isArray(value)) return void 0;
24
+ const items = [...new Set(asTrimmedNonEmptyStringArray(value))];
25
+ return items.length > 0 ? items : void 0;
26
+ };
27
+ var normalizeBoolean = (value) => typeof value === "boolean" ? value : void 0;
28
+ var normalizeSkillEnumValue = (key, value) => typeof value === "string" && SKILL_DOC_ENUMS[key].includes(value) ? value : void 0;
29
+ var normalizeSkillBudgetTier = (value) => normalizeSkillEnumValue("budgetTier", value);
30
+ var normalizeSkillModalities = (value) => {
31
+ const raw = normalizeStringArray(value);
32
+ if (!raw) return void 0;
33
+ const filtered = raw.flatMap((item) => {
34
+ const modality = normalizeSkillEnumValue("modality", item);
35
+ return modality ? [modality] : [];
36
+ });
37
+ return filtered.length > 0 ? Array.from(new Set(filtered)) : void 0;
38
+ };
39
+ var normalizeSkillConfig = (value, fallbackTools) => {
40
+ if (!value || typeof value !== "object") return void 0;
41
+ const record = value;
42
+ const name = asOptionalTrimmedString(record.name) ?? "";
43
+ const description = asOptionalTrimmedString(record.description) ?? "";
44
+ if (!name || !description) return void 0;
45
+ const triggerMode = normalizeSkillEnumValue("triggerMode", record.triggerMode);
46
+ const budgetTier = normalizeSkillEnumValue("budgetTier", record.budgetTier);
47
+ const modalities = normalizeSkillModalities(record.modalities);
48
+ const toolNames = normalizeStringArray(record.toolNames) ?? normalizeStringArray(fallbackTools) ?? void 0;
49
+ const discover = record.discover && typeof record.discover === "object" ? {
50
+ keywords: normalizeStringArray(
51
+ record.discover.keywords
52
+ ),
53
+ examples: normalizeStringArray(
54
+ record.discover.examples
55
+ )
56
+ } : void 0;
57
+ return {
58
+ version: "0.1",
59
+ kind: "skill",
60
+ id: asOptionalTrimmedString(record.id),
61
+ name,
62
+ description,
63
+ triggerMode,
64
+ toolNames,
65
+ preferredAgents: normalizeStringArray(record.preferredAgents),
66
+ budgetTier,
67
+ dispatchPreferred: normalizeBoolean(record.dispatchPreferred),
68
+ modalities,
69
+ requiredSkills: normalizeStringArray(record.requiredSkills),
70
+ recommendedSkills: normalizeStringArray(record.recommendedSkills),
71
+ promptPatch: asOptionalTrimmedString(record.promptPatch),
72
+ discover: discover?.keywords || discover?.examples ? discover : void 0
73
+ };
74
+ };
75
+ var normalizeEvalConfig = (value) => {
76
+ if (!value || typeof value !== "object") return void 0;
77
+ const record = value;
78
+ if (!Array.isArray(record.cases)) return void 0;
79
+ const cases = [];
80
+ for (const item of record.cases) {
81
+ if (!item || typeof item !== "object") continue;
82
+ const testCase = item;
83
+ const input = asOptionalTrimmedString(testCase.input) ?? "";
84
+ if (!input) continue;
85
+ cases.push({
86
+ input,
87
+ expectedTools: normalizeStringArray(testCase.expectedTools),
88
+ expectedSignals: normalizeStringArray(testCase.expectedSignals),
89
+ forbiddenSignals: normalizeStringArray(testCase.forbiddenSignals)
90
+ });
91
+ }
92
+ return cases.length > 0 ? {
93
+ version: "0.1",
94
+ cases
95
+ } : void 0;
96
+ };
97
+ var normalizeWorkflowConfig = (value) => {
98
+ if (!value || typeof value !== "object") return void 0;
99
+ const record = value;
100
+ const name = asOptionalTrimmedString(record.name) ?? "";
101
+ const description = asOptionalTrimmedString(record.description) ?? "";
102
+ if (!name || !description) return void 0;
103
+ const budgetTier = normalizeSkillEnumValue("budgetTier", record.budgetTier);
104
+ return {
105
+ version: "0.1",
106
+ kind: "workflow",
107
+ id: asOptionalTrimmedString(record.id),
108
+ name,
109
+ description,
110
+ defaultAgent: asOptionalTrimmedString(record.defaultAgent),
111
+ inputs: normalizeStringArray(record.inputs),
112
+ recommendedTools: normalizeStringArray(record.recommendedTools),
113
+ requiredTools: normalizeStringArray(record.requiredTools),
114
+ requiredOutputs: normalizeStringArray(record.requiredOutputs),
115
+ gates: normalizeStringArray(record.gates),
116
+ budgetTier,
117
+ contextStrategy: asOptionalTrimmedString(record.contextStrategy),
118
+ failureProtocol: asOptionalTrimmedString(record.failureProtocol)
119
+ };
120
+ };
121
+ var normalizePageSkillMetadata = (value, fallbackTools) => {
122
+ if (!value || typeof value !== "object") return void 0;
123
+ const record = value;
124
+ const kind = normalizeSkillEnumValue("docKind", record.kind);
125
+ const meta = {
126
+ kind,
127
+ requiredSkills: normalizeStringArray(record.requiredSkills),
128
+ recommendedSkills: normalizeStringArray(record.recommendedSkills),
129
+ skillConfig: normalizeSkillConfig(record.skillConfig, fallbackTools),
130
+ evalConfig: normalizeEvalConfig(record.evalConfig),
131
+ workflowConfig: normalizeWorkflowConfig(record.workflowConfig)
132
+ };
133
+ if (meta.skillConfig && !meta.kind) {
134
+ meta.kind = "skill";
135
+ }
136
+ if (meta.workflowConfig && !meta.kind) {
137
+ meta.kind = "instruction";
138
+ }
139
+ return meta.kind || meta.requiredSkills || meta.recommendedSkills || meta.skillConfig || meta.evalConfig || meta.workflowConfig ? meta : void 0;
140
+ };
141
+ var extractCommentBlock = (markdown, blockName) => {
142
+ if (!markdown) return void 0;
143
+ const matcher = new RegExp(
144
+ `<!--\\s*${blockName}\\s*\\n([\\s\\S]*?)-->`,
145
+ "i"
146
+ );
147
+ const match = markdown.match(matcher);
148
+ return asOptionalTrimmedString(match?.[1]);
149
+ };
150
+ var removeCommentBlock = (markdown, blockName) => markdown.replace(
151
+ new RegExp(`\\n?<!--\\s*${blockName}\\s*\\n[\\s\\S]*?-->\\s*`, "gi"),
152
+ "\n\n"
153
+ );
154
+ var parseYamlObject = (raw) => {
155
+ if (!raw) return void 0;
156
+ try {
157
+ const parsed = load(raw);
158
+ return parsed && typeof parsed === "object" ? parsed : void 0;
159
+ } catch {
160
+ return void 0;
161
+ }
162
+ };
163
+ var parseSkillDocProtocol = (markdown, existingMeta, fallbackTools) => {
164
+ const source = typeof markdown === "string" ? markdown : "";
165
+ const skillBlock = parseYamlObject(extractCommentBlock(source, SKILL_CONFIG_BLOCK));
166
+ const evalBlock = parseYamlObject(extractCommentBlock(source, EVAL_CONFIG_BLOCK));
167
+ const workflowBlock = parseYamlObject(extractCommentBlock(source, WORKFLOW_CONFIG_BLOCK));
168
+ const cleanedContent = removeCommentBlock(
169
+ removeCommentBlock(
170
+ removeCommentBlock(source, SKILL_CONFIG_BLOCK),
171
+ EVAL_CONFIG_BLOCK
172
+ ),
173
+ WORKFLOW_CONFIG_BLOCK
174
+ ).replace(/\n{3,}/g, "\n\n").trim();
175
+ const parsedMeta = normalizePageSkillMetadata(
176
+ {
177
+ ...existingMeta ?? {},
178
+ ...skillBlock ? {
179
+ kind: existingMeta?.kind === "skill" || skillBlock.kind === "skill" ? "skill" : existingMeta?.kind,
180
+ requiredSkills: skillBlock.requiredSkills ?? existingMeta?.requiredSkills,
181
+ recommendedSkills: skillBlock.recommendedSkills ?? existingMeta?.recommendedSkills,
182
+ skillConfig: skillBlock
183
+ } : {},
184
+ ...evalBlock ? { evalConfig: evalBlock } : {},
185
+ ...workflowBlock ? { workflowConfig: workflowBlock } : {}
186
+ },
187
+ fallbackTools
188
+ );
189
+ return {
190
+ content: cleanedContent,
191
+ meta: parsedMeta
192
+ };
193
+ };
194
+ var resolvePageSkillMetadata = (page) => {
195
+ if (!page) return void 0;
196
+ const existingMeta = normalizePageSkillMetadata(page.meta, page.tools);
197
+ return parseSkillDocProtocol(page.content ?? "", existingMeta, page.tools).meta;
198
+ };
199
+ var yamlBlock = (value) => dump(value, { lineWidth: 120, noRefs: true }).trim();
200
+ var buildSkillConfigComment = (config) => {
201
+ const payload = {
202
+ version: config.version,
203
+ kind: config.kind,
204
+ ...config.id ? { id: config.id } : {},
205
+ name: config.name,
206
+ description: config.description,
207
+ ...config.triggerMode ? { triggerMode: config.triggerMode } : {},
208
+ ...config.requiredSkills?.length ? { requiredSkills: config.requiredSkills } : {},
209
+ ...config.recommendedSkills?.length ? { recommendedSkills: config.recommendedSkills } : {},
210
+ ...config.toolNames?.length ? { toolNames: config.toolNames } : {},
211
+ ...config.preferredAgents?.length ? { preferredAgents: config.preferredAgents } : {},
212
+ ...config.budgetTier ? { budgetTier: config.budgetTier } : {},
213
+ ...typeof config.dispatchPreferred === "boolean" ? { dispatchPreferred: config.dispatchPreferred } : {},
214
+ ...config.modalities?.length ? { modalities: config.modalities } : {},
215
+ ...config.discover?.keywords?.length || config.discover?.examples?.length ? {
216
+ discover: {
217
+ ...config.discover?.keywords?.length ? { keywords: config.discover.keywords } : {},
218
+ ...config.discover?.examples?.length ? { examples: config.discover.examples } : {}
219
+ }
220
+ } : {},
221
+ ...config.promptPatch ? { promptPatch: config.promptPatch } : {}
222
+ };
223
+ return `<!-- ${SKILL_CONFIG_BLOCK}
224
+ ${yamlBlock(payload)}
225
+ -->`;
226
+ };
227
+ var buildEvalConfigComment = (config) => `<!-- ${EVAL_CONFIG_BLOCK}
228
+ ${yamlBlock({
229
+ version: config.version,
230
+ cases: config.cases
231
+ })}
232
+ -->`;
233
+ var buildWorkflowConfigComment = (config) => `<!-- ${WORKFLOW_CONFIG_BLOCK}
234
+ ${yamlBlock({
235
+ version: config.version,
236
+ kind: config.kind,
237
+ ...config.id ? { id: config.id } : {},
238
+ name: config.name,
239
+ description: config.description,
240
+ ...config.defaultAgent ? { defaultAgent: config.defaultAgent } : {},
241
+ ...config.inputs?.length ? { inputs: config.inputs } : {},
242
+ ...config.recommendedTools?.length ? { recommendedTools: config.recommendedTools } : {},
243
+ ...config.requiredTools?.length ? { requiredTools: config.requiredTools } : {},
244
+ ...config.requiredOutputs?.length ? { requiredOutputs: config.requiredOutputs } : {},
245
+ ...config.gates?.length ? { gates: config.gates } : {},
246
+ ...config.budgetTier ? { budgetTier: config.budgetTier } : {},
247
+ ...config.contextStrategy ? { contextStrategy: config.contextStrategy } : {},
248
+ ...config.failureProtocol ? { failureProtocol: config.failureProtocol } : {}
249
+ })}
250
+ -->`;
251
+ var buildSkillDocMarkdown = (options) => {
252
+ const sections = [
253
+ asOptionalTrimmedString(options.body) ?? "",
254
+ buildSkillConfigComment(options.skillConfig),
255
+ options.evalConfig ? buildEvalConfigComment(options.evalConfig) : "",
256
+ options.workflowConfig ? buildWorkflowConfigComment(options.workflowConfig) : ""
257
+ ].filter(Boolean);
258
+ return sections.join("\n\n").trim();
259
+ };
260
+ var extractFrontmatter = (markdown) => {
261
+ const match = markdown.match(/^\s*---\s*\n([\s\S]*?)\n\s*---\s*\n?/);
262
+ if (!match) return { body: markdown.trim() };
263
+ const frontmatter = parseYamlObject(match[1]);
264
+ const body = markdown.slice(match[0].length).trim();
265
+ return { frontmatter, body };
266
+ };
267
+ var normalizeAllowedTools = (value) => {
268
+ if (Array.isArray(value)) {
269
+ return normalizeStringArray(value) ?? [];
270
+ }
271
+ if (typeof value === "string") {
272
+ return value.split(/\s+/).map((item) => item.trim()).filter(Boolean);
273
+ }
274
+ return [];
275
+ };
276
+ var parseExternalSkillMarkdown = (markdown) => {
277
+ const { frontmatter, body } = extractFrontmatter(markdown);
278
+ return {
279
+ name: asOptionalTrimmedString(frontmatter?.name),
280
+ description: asOptionalTrimmedString(frontmatter?.description),
281
+ compatibility: asOptionalTrimmedString(frontmatter?.compatibility),
282
+ allowedTools: normalizeAllowedTools(frontmatter?.["allowed-tools"]),
283
+ metadata: frontmatter?.metadata && typeof frontmatter.metadata === "object" ? Object.fromEntries(
284
+ Object.entries(frontmatter.metadata).filter(([, value]) => typeof value === "string").map(([key, value]) => [key, String(value)])
285
+ ) : void 0,
286
+ body
287
+ };
288
+ };
289
+
290
+ export {
291
+ normalizeStringArray,
292
+ normalizeSkillBudgetTier,
293
+ normalizeSkillModalities,
294
+ parseSkillDocProtocol,
295
+ resolvePageSkillMetadata,
296
+ buildSkillDocMarkdown,
297
+ parseExternalSkillMarkdown
298
+ };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  getRuntimeServerContext,
3
3
  scheduleDeleteReplication
4
- } from "./chunk-UTLZINAP.js";
4
+ } from "./chunk-TSUJOM6N.js";
5
5
  import {
6
6
  fetchFromClientDb
7
7
  } from "./chunk-OOSFSFMA.js";
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  parsePositiveFiniteNumberOrFallback
3
3
  } from "./chunk-Y5GCAMGP.js";
4
+ import {
5
+ asRecordOrEmpty
6
+ } from "./chunk-KX6YBIHG.js";
4
7
  import {
5
8
  patch,
6
9
  readAndWait,
7
10
  toTimestampMs,
8
11
  upsert,
9
12
  write
10
- } from "./chunk-BE2OOJ5P.js";
11
- import {
12
- asRecordOrEmpty
13
- } from "./chunk-KX6YBIHG.js";
13
+ } from "./chunk-NITP2JDG.js";
14
14
  import {
15
15
  createUserKey,
16
16
  createUserPreferenceKey,
@@ -21,7 +21,7 @@ import {
21
21
  } from "./chunk-QSJ3HFEF.js";
22
22
  import {
23
23
  BUILTIN_NOLO_AGENT_KEY
24
- } from "./chunk-DSZUWUYB.js";
24
+ } from "./chunk-XHQWJUW4.js";
25
25
  import {
26
26
  asyncThunkCreator,
27
27
  buildCreateSlice,
@@ -29,18 +29,18 @@ import {
29
29
  createAsyncThunk,
30
30
  createSelector,
31
31
  selectIdentityUserId
32
- } from "./chunk-UTLZINAP.js";
32
+ } from "./chunk-TSUJOM6N.js";
33
33
  import {
34
34
  getAllServers,
35
35
  getIsDesktopApp,
36
36
  isProduction
37
37
  } from "./chunk-OOSFSFMA.js";
38
- import {
39
- isLocalServerUrl
40
- } from "./chunk-4SN6J65J.js";
41
38
  import {
42
39
  SERVERS
43
40
  } from "./chunk-LCBAMY2M.js";
41
+ import {
42
+ isLocalServerUrl
43
+ } from "./chunk-4SN6J65J.js";
44
44
  import {
45
45
  normalizeServerOrigin
46
46
  } from "./chunk-CF7PE763.js";
@@ -1,31 +1,31 @@
1
1
  import {
2
2
  readDbRecord,
3
3
  writeAgentRecord
4
- } from "./chunk-OR2XR25C.js";
4
+ } from "./chunk-QCA3EPYK.js";
5
5
  import {
6
6
  buildSkillSummaryMarker
7
7
  } from "./chunk-VF4K2QE6.js";
8
8
  import {
9
9
  buildSkillDocMarkdown
10
- } from "./chunk-ZQ2UM4KG.js";
10
+ } from "./chunk-VC6OZXO5.js";
11
11
  import {
12
12
  createSpaceKey
13
- } from "./chunk-UAD2WT54.js";
13
+ } from "./chunk-3HHTVM6G.js";
14
+ import {
15
+ asTrimmedLowercaseString
16
+ } from "./chunk-QSJ3HFEF.js";
14
17
  import {
15
18
  parseUserIdFromAuthToken,
16
19
  readOption,
17
20
  resolveAuthToken,
18
21
  resolveServerUrl
19
- } from "./chunk-ISNCLGUZ.js";
22
+ } from "./chunk-5NBHQD4D.js";
20
23
  import {
21
- asTrimmedLowercaseString
22
- } from "./chunk-QSJ3HFEF.js";
24
+ NOLO_CLUSTER_SERVERS
25
+ } from "./chunk-LCBAMY2M.js";
23
26
  import {
24
27
  DEFAULT_LOCAL_API_ORIGIN
25
28
  } from "./chunk-4SN6J65J.js";
26
- import {
27
- NOLO_CLUSTER_SERVERS
28
- } from "./chunk-LCBAMY2M.js";
29
29
  import {
30
30
  normalizeServerOrigin
31
31
  } from "./chunk-CF7PE763.js";