nolo-cli 0.34.0-alpha.1 → 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 (65) hide show
  1. package/{_executeModel-BUYCXZCQ.js → _executeModel-TMUXL7J5.js} +13 -14
  2. package/{agentDeleteCommand-WSS2IJVM.js → agentDeleteCommand-KA2IQAPG.js} +2 -2
  3. package/{agentEmailCommands-SHTPJTSX.js → agentEmailCommands-UIYBGCZW.js} +14 -15
  4. package/{agentListCommands-GV6UYVAF.js → agentListCommands-L6JNUOLH.js} +2 -2
  5. package/{agentMachineCommands-FLD7TAFH.js → agentMachineCommands-5CQW5NZR.js} +3 -3
  6. package/{agentRecordCommands-57W6R7QW.js → agentRecordCommands-VUDJQIZH.js} +14 -15
  7. package/{agentRunCommand-HJGXSMDN.js → agentRunCommand-EJWYF3BL.js} +16 -17
  8. package/{agentRunControl-GXOB47YI.js → agentRunControl-7MUPSYDQ.js} +3 -1
  9. package/{agentRuntimeLocal-G7ZV55I6.js → agentRuntimeLocal-XXBMDMBU.js} +2 -2
  10. package/{agentSlice-HFR7SP3B.js → agentSlice-HTIEYKIU.js} +1 -1
  11. package/{agentSuperviseCommands-Q64S5SPG.js → agentSuperviseCommands-MKWW3ICX.js} +3 -3
  12. package/{appDeleteCommands-SHHE56Y2.js → appDeleteCommands-OUBL6VHB.js} +2 -2
  13. package/{appDeployCommands-WUMSO2VS.js → appDeployCommands-BZSS2MX4.js} +2 -2
  14. package/{appDeployStatusCommands-VZSVN6SR.js → appDeployStatusCommands-P2ZQOY5X.js} +2 -2
  15. package/{appGetCommands-ZJ2C3A5Y.js → appGetCommands-WCFWQZZM.js} +2 -2
  16. package/{appListCommands-W33L6U5X.js → appListCommands-FVJ3QNL7.js} +2 -2
  17. package/{chatQueueReduxAdapter-SYIX4ODY.js → chatQueueReduxAdapter-ZP2ZS63U.js} +2 -2
  18. package/chunk-2BWU4ORW.js +2574 -0
  19. package/{chunk-6KYCG5GW.js → chunk-5GQ6XCJY.js} +11 -11
  20. package/{chunk-74IQ5RRO.js → chunk-5LDKQUOT.js} +1 -1
  21. package/{chunk-6XIE5ZGI.js → chunk-6HIGYUBQ.js} +1 -1
  22. package/{chunk-MI2J67UU.js → chunk-AA2YUJNV.js} +12 -1
  23. package/{chunk-KCBK4MDT.js → chunk-AE5GVFMG.js} +4 -4
  24. package/{chunk-VSA6QAGV.js → chunk-E2OQ5N2F.js} +40 -10
  25. package/{chunk-KHCLMKZZ.js → chunk-EY7V7REW.js} +280 -6
  26. package/{chunk-3XZUNRYF.js → chunk-FT4XBCK4.js} +7 -7
  27. package/{chunk-LQ6PUHW6.js → chunk-I7VDDN45.js} +26 -67
  28. package/{chunk-7YDKVLAE.js → chunk-IEEEWIVO.js} +3 -3
  29. package/{chunk-VBD7W4Q6.js → chunk-ILZY5B4U.js} +16 -12
  30. package/{chunk-4HOXB6SY.js → chunk-IMHO5LC6.js} +100 -27
  31. package/{chunk-2KO5QQFV.js → chunk-P2I7ELDC.js} +1 -1
  32. package/{chunk-DX6BP4K7.js → chunk-PILJX4DH.js} +8 -8
  33. package/{chunk-LAUUAYLK.js → chunk-QI3CHZUT.js} +2 -2
  34. package/{chunk-YRP7LG4R.js → chunk-RKRXAL3V.js} +7 -16
  35. package/{chunk-AUH2LTIY.js → chunk-TLBZMLLJ.js} +3 -3
  36. package/{chunk-3LWZNEGQ.js → chunk-WBZE7C6S.js} +1 -1
  37. package/{chunk-HDT2RB7T.js → chunk-XMFDQYWA.js} +1 -1
  38. package/{chunk-FDKEDU7R.js → chunk-Y5W623XU.js} +3 -3
  39. package/{chunk-VD2SO4RG.js → chunk-Z7COG62J.js} +2 -2
  40. package/{codingSkills-H6N5EKSX.js → codingSkills-6F4EQFCM.js} +2 -3
  41. package/{createAgentAutomationAction-BH3D2L2H.js → createAgentAutomationAction-TGUXUZCY.js} +3 -3
  42. package/{createDialogAction-U4LDV2RW.js → createDialogAction-FD5AEOUF.js} +5 -6
  43. package/{createPageAction-Q2ANG535.js → createPageAction-NPC3LYNK.js} +4 -5
  44. package/{dialogCommands-C556D6WD.js → dialogCommands-ZF2RSNCG.js} +2 -2
  45. package/{dialogSlice-P2VSKG2X.js → dialogSlice-6BINHWQT.js} +2 -2
  46. package/{docCreateCommands-AAVGLQWE.js → docCreateCommands-4VQ5MOHP.js} +4 -5
  47. package/{docDeleteCommands-PKMKSQD2.js → docDeleteCommands-M7WLNVPB.js} +4 -5
  48. package/{docReadCommands-2WUH7UXC.js → docReadCommands-6LU6P2WT.js} +4 -5
  49. package/{docStore-J5UWRBB4.js → docStore-SIUFLABN.js} +4 -4
  50. package/{docUpdateCommands-B2N4E5HQ.js → docUpdateCommands-S2LX4ENL.js} +4 -5
  51. package/{handleSendMessageAction-RRZ53YYH.js → handleSendMessageAction-QVG5YNZY.js} +2 -2
  52. package/index.js +46 -46
  53. package/{machineCommands-CWKMJG33.js → machineCommands-OSEBN7BZ.js} +14 -15
  54. package/{machineWsRunDispatch-UYNVNX4A.js → machineWsRunDispatch-NTJQCIIF.js} +14 -15
  55. package/package.json +1 -1
  56. package/{readlineWorkspace-VYELP22P.js → readlineWorkspace-JPME5S7A.js} +130 -82
  57. package/{runAgentClientLoop-35GKZDOZ.js → runAgentClientLoop-SOKEXCUF.js} +10 -11
  58. package/{skillDiscovery-COX56OBO.js → skillDiscovery-GPUDHDTZ.js} +1 -2
  59. package/{spaceCommands-AAKQM2PM.js → spaceCommands-Z5JLMFFJ.js} +2 -2
  60. package/{spaceSlice-NSNGR4Y2.js → spaceSlice-Z3BGCLGX.js} +3 -3
  61. package/{streamAgentChatTurn-D5IDHXMV.js → streamAgentChatTurn-INF5RGK4.js} +12 -13
  62. package/{tools-JQOETZP5.js → tools-ZELMSJZ3.js} +8 -9
  63. package/{updateDialogTitleAction-WOTSDSFQ.js → updateDialogTitleAction-EDUCIB7G.js} +3 -3
  64. package/chunk-AETZ7AD6.js +0 -274
  65. package/chunk-OFZPJ3NT.js +0 -114
@@ -16,11 +16,11 @@ import {
16
16
  readStreamChunk,
17
17
  sendOpenAICompletionsRequest,
18
18
  updateTotalUsage
19
- } from "./chunk-3XZUNRYF.js";
19
+ } from "./chunk-FT4XBCK4.js";
20
20
  import "./chunk-JEXVIMYZ.js";
21
21
  import {
22
22
  prepareTools
23
- } from "./chunk-HDT2RB7T.js";
23
+ } from "./chunk-XMFDQYWA.js";
24
24
  import {
25
25
  INVALID_TOOL_ARGS_REPLACEMENT,
26
26
  buildInvalidToolCallSelfHealResult,
@@ -38,7 +38,7 @@ import {
38
38
  sanitizeOutboundResponsesInput,
39
39
  selectResponsesConversationState,
40
40
  updateResponsesConversationState
41
- } from "./chunk-KCBK4MDT.js";
41
+ } from "./chunk-AE5GVFMG.js";
42
42
  import "./chunk-HS7MLR74.js";
43
43
  import "./chunk-PV734VZX.js";
44
44
  import {
@@ -48,7 +48,7 @@ import {
48
48
  resolveAgentRequiredPackIds,
49
49
  shouldBlockForGptPro,
50
50
  waitForAbortableDelay
51
- } from "./chunk-6KYCG5GW.js";
51
+ } from "./chunk-5GQ6XCJY.js";
52
52
  import "./chunk-RQSOAMPJ.js";
53
53
  import "./chunk-GUYMR3JL.js";
54
54
  import "./chunk-KQHGZWSV.js";
@@ -56,7 +56,7 @@ import "./chunk-IFS5CUEH.js";
56
56
  import "./chunk-KXKQO4Q6.js";
57
57
  import {
58
58
  getDocState
59
- } from "./chunk-VD2SO4RG.js";
59
+ } from "./chunk-Z7COG62J.js";
60
60
  import {
61
61
  getFinalPrice,
62
62
  getModelPricing,
@@ -77,14 +77,14 @@ import {
77
77
  } from "./chunk-MEYIRKDN.js";
78
78
  import "./chunk-63W5N6P3.js";
79
79
  import "./chunk-VF4K2QE6.js";
80
- import "./chunk-FDKEDU7R.js";
80
+ import "./chunk-Y5W623XU.js";
81
81
  import {
82
82
  getCurrentSpaceId,
83
83
  getCurrentSpaceIdRaw,
84
84
  getViewMode,
85
85
  selectCurrentTable,
86
86
  selectTableRows
87
- } from "./chunk-LAUUAYLK.js";
87
+ } from "./chunk-QI3CHZUT.js";
88
88
  import {
89
89
  PERSONALIZATION_DIALOG_CATEGORY,
90
90
  addToolMessage,
@@ -102,12 +102,12 @@ import {
102
102
  selectCurrentDialogConfig,
103
103
  selectDialogConfigByKey,
104
104
  updateTokens
105
- } from "./chunk-DX6BP4K7.js";
105
+ } from "./chunk-PILJX4DH.js";
106
106
  import "./chunk-RCFIB45Q.js";
107
107
  import "./chunk-JIADXJYU.js";
108
108
  import "./chunk-YYLHWIW6.js";
109
109
  import "./chunk-AGGIDPCZ.js";
110
- import "./chunk-AUH2LTIY.js";
110
+ import "./chunk-TLBZMLLJ.js";
111
111
  import {
112
112
  createCliChatTurnStream,
113
113
  getCliChatSession,
@@ -125,7 +125,7 @@ import {
125
125
  selectPendingUserInputQueue,
126
126
  tokenUsageLiveUpdate
127
127
  } from "./chunk-MRWGHF56.js";
128
- import "./chunk-2KO5QQFV.js";
128
+ import "./chunk-P2I7ELDC.js";
129
129
  import {
130
130
  TOOL_PACKS,
131
131
  addDefaultSystemCapabilityTools,
@@ -136,8 +136,7 @@ import {
136
136
  expandEnabledPacks,
137
137
  resolveEffectiveEnabledPacks
138
138
  } from "./chunk-IIOHYLIG.js";
139
- import "./chunk-AETZ7AD6.js";
140
- import "./chunk-KHCLMKZZ.js";
139
+ import "./chunk-EY7V7REW.js";
141
140
  import {
142
141
  assertDesktopAgentRuntimeTurnBodyHasNoRawSecrets,
143
142
  buildDesktopAgentRuntimeAgentConfigSnapshot,
@@ -146,7 +145,7 @@ import {
146
145
  stripImagePartsForTextOnlyAgent
147
146
  } from "./chunk-64KIQZA2.js";
148
147
  import "./chunk-T27IEBNQ.js";
149
- import "./chunk-MI2J67UU.js";
148
+ import "./chunk-AA2YUJNV.js";
150
149
  import "./chunk-N7J63Q6C.js";
151
150
  import "./chunk-M3JQWYBC.js";
152
151
  import {
@@ -8,39 +8,38 @@ import {
8
8
  toolQueryFunc,
9
9
  toolQueryFunctionSchema,
10
10
  toolRegistry
11
- } from "./chunk-6KYCG5GW.js";
11
+ } from "./chunk-5GQ6XCJY.js";
12
12
  import "./chunk-RQSOAMPJ.js";
13
13
  import "./chunk-GUYMR3JL.js";
14
14
  import "./chunk-KQHGZWSV.js";
15
15
  import "./chunk-IFS5CUEH.js";
16
16
  import "./chunk-KXKQO4Q6.js";
17
- import "./chunk-VD2SO4RG.js";
17
+ import "./chunk-Z7COG62J.js";
18
18
  import "./chunk-BANYWEYY.js";
19
19
  import "./chunk-U6QQLXWI.js";
20
20
  import "./chunk-INZZJSQF.js";
21
21
  import "./chunk-MEYIRKDN.js";
22
22
  import "./chunk-63W5N6P3.js";
23
23
  import "./chunk-VF4K2QE6.js";
24
- import "./chunk-FDKEDU7R.js";
25
- import "./chunk-LAUUAYLK.js";
26
- import "./chunk-DX6BP4K7.js";
24
+ import "./chunk-Y5W623XU.js";
25
+ import "./chunk-QI3CHZUT.js";
26
+ import "./chunk-PILJX4DH.js";
27
27
  import "./chunk-RCFIB45Q.js";
28
28
  import "./chunk-JIADXJYU.js";
29
29
  import "./chunk-YYLHWIW6.js";
30
30
  import "./chunk-AGGIDPCZ.js";
31
- import "./chunk-AUH2LTIY.js";
31
+ import "./chunk-TLBZMLLJ.js";
32
32
  import "./chunk-MGIHZ5CJ.js";
33
33
  import "./chunk-5RGU3J7P.js";
34
34
  import "./chunk-M76ECQRD.js";
35
35
  import "./chunk-MRWGHF56.js";
36
- import "./chunk-2KO5QQFV.js";
36
+ import "./chunk-P2I7ELDC.js";
37
37
  import {
38
38
  TOOL_PACKS,
39
39
  addDefaultLightWebToolsForConfiguredAgents,
40
40
  applyDefaultWebToolPacks
41
41
  } from "./chunk-IIOHYLIG.js";
42
- import "./chunk-AETZ7AD6.js";
43
- import "./chunk-KHCLMKZZ.js";
42
+ import "./chunk-EY7V7REW.js";
44
43
  import "./chunk-IZCHPD7T.js";
45
44
  import "./chunk-X2K2JSO4.js";
46
45
  import "./chunk-WRP5TTM6.js";
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  updateContentTitle
3
- } from "./chunk-LAUUAYLK.js";
3
+ } from "./chunk-QI3CHZUT.js";
4
4
  import {
5
5
  isAssistantToolStub,
6
6
  selectAllMsgs
7
- } from "./chunk-DX6BP4K7.js";
7
+ } from "./chunk-PILJX4DH.js";
8
8
  import {
9
9
  BUILTIN_TITLE_LLM_CONFIG
10
10
  } from "./chunk-RCFIB45Q.js";
@@ -13,7 +13,7 @@ import "./chunk-YYLHWIW6.js";
13
13
  import "./chunk-AGGIDPCZ.js";
14
14
  import {
15
15
  runLlm
16
- } from "./chunk-AUH2LTIY.js";
16
+ } from "./chunk-TLBZMLLJ.js";
17
17
  import "./chunk-MGIHZ5CJ.js";
18
18
  import "./chunk-5RGU3J7P.js";
19
19
  import {
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
- };
package/chunk-OFZPJ3NT.js DELETED
@@ -1,114 +0,0 @@
1
- import {
2
- load
3
- } from "./chunk-KHCLMKZZ.js";
4
- import {
5
- buildSkillDiscoveryLayer
6
- } from "./chunk-3AOLVADY.js";
7
-
8
- // packages/agent-runtime/skillDiscovery.ts
9
- import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
10
- import { join } from "node:path";
11
- var SKILL_SCAN_DIRS = [".agents/skills"];
12
- var MAX_DISCOVERED_SKILLS = 50;
13
- var MAX_DISCOVERY_DESC_BUDGET = 4e3;
14
- var MIN_DESC_LENGTH = 80;
15
- function parseSkillFrontmatter(filePath) {
16
- try {
17
- const content = readFileSync(filePath, "utf8").slice(0, 2048);
18
- const fmMatch = content.match(/^---\n([\s\S]*?)\n---/);
19
- if (!fmMatch) return {};
20
- const fm = (() => {
21
- try {
22
- return load(fmMatch[1]);
23
- } catch (err) {
24
- console.warn(
25
- `[skillDiscovery] failed to parse frontmatter: ${filePath}: ${err.message}`
26
- );
27
- throw err;
28
- }
29
- })();
30
- if (!fm || typeof fm !== "object") return {};
31
- const name = typeof fm.name === "string" ? fm.name : void 0;
32
- const rawDesc = fm.description;
33
- const description = typeof rawDesc === "string" ? rawDesc : rawDesc == null ? void 0 : String(rawDesc);
34
- const sanitizeName = (s) => s?.trim().replace(/^["']|["']$/g, "").replace(/[\n\r]+/g, " ").slice(0, 200);
35
- const sanitizeDesc = (s) => s?.trim().replace(/^["']|["']$/g, "").replace(/[\n\r]+/g, " ").slice(0, 200);
36
- return { name: sanitizeName(name), description: sanitizeDesc(description) };
37
- } catch {
38
- return {};
39
- }
40
- }
41
- function discoverSkills(cwd) {
42
- const skills = [];
43
- for (const dir of SKILL_SCAN_DIRS) {
44
- if (skills.length >= MAX_DISCOVERED_SKILLS) break;
45
- const absDir = join(cwd, dir);
46
- if (!existsSync(absDir) || !statSync(absDir).isDirectory()) continue;
47
- try {
48
- for (const entry of readdirSync(absDir)) {
49
- if (skills.length >= MAX_DISCOVERED_SKILLS) break;
50
- const skillMdPath = join(absDir, entry, "SKILL.md");
51
- if (existsSync(skillMdPath)) {
52
- const { name, description } = parseSkillFrontmatter(skillMdPath);
53
- skills.push({ name: name ?? entry, description: description ?? "", relativePath: join(dir, entry, "SKILL.md") });
54
- continue;
55
- }
56
- }
57
- } catch {
58
- }
59
- }
60
- const totalDescLen = skills.reduce((sum, s) => sum + s.description.length, 0);
61
- if (totalDescLen > MAX_DISCOVERY_DESC_BUDGET && skills.length > 0) {
62
- const scale = MAX_DISCOVERY_DESC_BUDGET / totalDescLen;
63
- for (const s of skills) {
64
- const targetLen = Math.max(MIN_DESC_LENGTH, Math.floor(s.description.length * scale));
65
- if (s.description.length > targetLen) {
66
- s.description = s.description.slice(0, targetLen).trimEnd();
67
- }
68
- }
69
- }
70
- return skills;
71
- }
72
- function resolveSkillByName(cwd, name) {
73
- const trimmed = name.trim();
74
- if (!trimmed || trimmed.includes("/") || trimmed.includes("\\") || trimmed.includes("..")) {
75
- return null;
76
- }
77
- const agentsDir = join(cwd, ".agents", "skills", trimmed);
78
- const agentsSkillMd = join(agentsDir, "SKILL.md");
79
- if (existsSync(agentsSkillMd)) return agentsSkillMd;
80
- const agentsParent = join(cwd, ".agents", "skills");
81
- if (existsSync(agentsParent) && statSync(agentsParent).isDirectory()) {
82
- try {
83
- for (const entry of readdirSync(agentsParent)) {
84
- const candidate = join(agentsParent, entry, "SKILL.md");
85
- if (!existsSync(candidate)) continue;
86
- try {
87
- const { name: fmName } = parseSkillFrontmatter(candidate);
88
- if (fmName && fmName === trimmed) return candidate;
89
- } catch {
90
- }
91
- }
92
- } catch {
93
- }
94
- }
95
- return null;
96
- }
97
- function buildSkillDiscoveryContextLayer(cwd) {
98
- try {
99
- return buildSkillDiscoveryLayer(discoverSkills(cwd), cwd);
100
- } catch {
101
- return null;
102
- }
103
- }
104
- function buildSkillDiscoveryContextBlock(cwd) {
105
- return buildSkillDiscoveryContextLayer(cwd)?.content ?? null;
106
- }
107
-
108
- export {
109
- parseSkillFrontmatter,
110
- discoverSkills,
111
- resolveSkillByName,
112
- buildSkillDiscoveryContextLayer,
113
- buildSkillDiscoveryContextBlock
114
- };