@kooka/core 0.1.0 → 0.1.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.
- package/dist/cjs/index.cjs +130 -0
- package/dist/esm/index.js +124 -0
- package/dist/types/compaction.d.ts +6 -0
- package/dist/types/compaction.d.ts.map +1 -1
- package/dist/types/fsPath.d.ts +5 -0
- package/dist/types/fsPath.d.ts.map +1 -1
- package/dist/types/history.d.ts +2 -0
- package/dist/types/history.d.ts.map +1 -1
- package/dist/types/index.d.ts +5 -3
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/skills.d.ts +18 -0
- package/dist/types/skills.d.ts.map +1 -0
- package/package.json +16 -10
- package/LICENSE +0 -201
package/dist/cjs/index.cjs
CHANGED
|
@@ -42,11 +42,13 @@ __export(index_exports, {
|
|
|
42
42
|
cleanupDeadBackgroundJobs: () => cleanupDeadBackgroundJobs,
|
|
43
43
|
createAssistantHistoryMessage: () => createAssistantHistoryMessage,
|
|
44
44
|
createBackgroundJobKey: () => createBackgroundJobKey,
|
|
45
|
+
createHistoryForCompactionPrompt: () => createHistoryForCompactionPrompt,
|
|
45
46
|
createHistoryForModel: () => createHistoryForModel,
|
|
46
47
|
createUserHistoryMessage: () => createUserHistoryMessage,
|
|
47
48
|
evaluatePermission: () => evaluatePermission,
|
|
48
49
|
evaluateShellCommand: () => evaluateShellCommand,
|
|
49
50
|
expandHome: () => expandHome,
|
|
51
|
+
extractSkillMentions: () => extractSkillMentions,
|
|
50
52
|
extractUsageTokens: () => extractUsageTokens,
|
|
51
53
|
finalizeStreamingParts: () => finalizeStreamingParts,
|
|
52
54
|
findExternalPathReferencesInShellCommand: () => findExternalPathReferencesInShellCommand,
|
|
@@ -60,16 +62,20 @@ __export(index_exports, {
|
|
|
60
62
|
isSubPath: () => isSubPath,
|
|
61
63
|
killProcessTree: () => killProcessTree,
|
|
62
64
|
listBackgroundJobs: () => listBackgroundJobs,
|
|
65
|
+
markPreviousAssistantToolOutputs: () => markPreviousAssistantToolOutputs,
|
|
63
66
|
markPrunableToolOutputs: () => markPrunableToolOutputs,
|
|
64
67
|
mergeRulesets: () => mergeRulesets,
|
|
65
68
|
normalizeFsPath: () => normalizeFsPath,
|
|
66
69
|
optionalBoolean: () => optionalBoolean,
|
|
67
70
|
optionalNumber: () => optionalNumber,
|
|
68
71
|
optionalString: () => optionalString,
|
|
72
|
+
redactFsPathForPrompt: () => redactFsPathForPrompt,
|
|
69
73
|
refreshBackgroundJob: () => refreshBackgroundJob,
|
|
70
74
|
registerBackgroundJob: () => registerBackgroundJob,
|
|
71
75
|
removeBackgroundJob: () => removeBackgroundJob,
|
|
76
|
+
renderSkillsSectionForPrompt: () => renderSkillsSectionForPrompt,
|
|
72
77
|
requireString: () => requireString,
|
|
78
|
+
selectSkillsForText: () => selectSkillsForText,
|
|
73
79
|
setDynamicToolError: () => setDynamicToolError,
|
|
74
80
|
setDynamicToolOutput: () => setDynamicToolOutput,
|
|
75
81
|
upsertDynamicToolCall: () => upsertDynamicToolCall,
|
|
@@ -99,6 +105,26 @@ function expandHome(p) {
|
|
|
99
105
|
}
|
|
100
106
|
return trimmed;
|
|
101
107
|
}
|
|
108
|
+
function redactFsPathForPrompt(value, options) {
|
|
109
|
+
const raw = (value || "").trim();
|
|
110
|
+
if (!raw) return "";
|
|
111
|
+
const normalized = raw.replace(/\\/g, "/");
|
|
112
|
+
if (!path.isAbsolute(raw)) return normalized;
|
|
113
|
+
const workspaceRoot = options?.workspaceRoot ? path.resolve(options.workspaceRoot) : void 0;
|
|
114
|
+
if (workspaceRoot && isSubPath(raw, workspaceRoot)) {
|
|
115
|
+
const rel = path.relative(workspaceRoot, raw).replace(/\\/g, "/");
|
|
116
|
+
return rel || ".";
|
|
117
|
+
}
|
|
118
|
+
const homeDir = options?.homeDir ?? os.homedir();
|
|
119
|
+
if (homeDir && isSubPath(raw, homeDir)) {
|
|
120
|
+
const rel = path.relative(homeDir, raw).replace(/\\/g, "/");
|
|
121
|
+
return rel ? `~/${rel}` : "~";
|
|
122
|
+
}
|
|
123
|
+
const tailSegments = Math.max(1, Math.floor(options?.tailSegments ?? 2));
|
|
124
|
+
const parts = normalized.split("/").filter(Boolean);
|
|
125
|
+
if (parts.length <= tailSegments) return normalized;
|
|
126
|
+
return `.../${parts.slice(-tailSegments).join("/")}`;
|
|
127
|
+
}
|
|
102
128
|
|
|
103
129
|
// src/permission.ts
|
|
104
130
|
function escapeRegExp(value) {
|
|
@@ -269,6 +295,71 @@ function isPathInsideWorkspace(targetPath, workspaceRoot) {
|
|
|
269
295
|
}
|
|
270
296
|
}
|
|
271
297
|
|
|
298
|
+
// src/skills.ts
|
|
299
|
+
function extractSkillMentions(text) {
|
|
300
|
+
const input = String(text || "");
|
|
301
|
+
if (!input) return [];
|
|
302
|
+
const seen = /* @__PURE__ */ new Set();
|
|
303
|
+
const result = [];
|
|
304
|
+
const re = /\$([A-Za-z0-9_](?:[A-Za-z0-9_.-]{0,126}[A-Za-z0-9_])?)/g;
|
|
305
|
+
for (const match of input.matchAll(re)) {
|
|
306
|
+
const name = match[1];
|
|
307
|
+
if (!name) continue;
|
|
308
|
+
if (seen.has(name)) continue;
|
|
309
|
+
seen.add(name);
|
|
310
|
+
result.push(name);
|
|
311
|
+
}
|
|
312
|
+
return result;
|
|
313
|
+
}
|
|
314
|
+
function selectSkillsForText(text, index) {
|
|
315
|
+
const mentions = extractSkillMentions(text);
|
|
316
|
+
if (mentions.length === 0) return { selected: [], unknown: [] };
|
|
317
|
+
const selected = [];
|
|
318
|
+
const unknown = [];
|
|
319
|
+
for (const name of mentions) {
|
|
320
|
+
const skill = index.byName.get(name);
|
|
321
|
+
if (skill) selected.push(skill);
|
|
322
|
+
else unknown.push(name);
|
|
323
|
+
}
|
|
324
|
+
return { selected, unknown };
|
|
325
|
+
}
|
|
326
|
+
function renderSkillsSectionForPrompt(options) {
|
|
327
|
+
const maxSkills = Math.max(0, Math.floor(options.maxSkills ?? 50));
|
|
328
|
+
const all = Array.isArray(options.skills) ? options.skills : [];
|
|
329
|
+
if (maxSkills === 0) return void 0;
|
|
330
|
+
const shown = all.slice(0, maxSkills);
|
|
331
|
+
const remaining = Math.max(0, all.length - shown.length);
|
|
332
|
+
const lines = [];
|
|
333
|
+
lines.push("## Skills");
|
|
334
|
+
lines.push(
|
|
335
|
+
"A skill is a reusable set of local instructions stored in a `SKILL.md` file. If the user mentions a skill (e.g. `$my-skill`), follow its instructions for that turn."
|
|
336
|
+
);
|
|
337
|
+
lines.push("### Available skills");
|
|
338
|
+
if (shown.length === 0) {
|
|
339
|
+
lines.push("- (none)");
|
|
340
|
+
} else {
|
|
341
|
+
for (const skill of shown) {
|
|
342
|
+
const label = skill.filePath ? ` (file: ${redactFsPathForPrompt(skill.filePath, { workspaceRoot: options.workspaceRoot })})` : "";
|
|
343
|
+
lines.push(`- ${skill.name}: ${skill.description}${label}`);
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
if (remaining > 0) {
|
|
347
|
+
lines.push(`- ... and ${remaining} more (truncated)`);
|
|
348
|
+
}
|
|
349
|
+
lines.push("### How to use skills");
|
|
350
|
+
lines.push(
|
|
351
|
+
[
|
|
352
|
+
"- Trigger: If the user includes `$<skill-name>` in their message, you MUST apply that skill for this turn.",
|
|
353
|
+
"- The skill contents will be provided as a `<skill>...</skill>` block in the conversation history.",
|
|
354
|
+
"- If multiple skills are mentioned, you MUST apply ALL of them for this turn (skills are additive; do not ignore one).",
|
|
355
|
+
"- Skills are listed in the order they were mentioned. If instructions conflict, call it out and ask the user how to proceed.",
|
|
356
|
+
"- Do not carry skills across turns unless they are re-mentioned.",
|
|
357
|
+
"- If a skill is missing or can\u2019t be loaded, say so briefly and proceed without it."
|
|
358
|
+
].join("\n")
|
|
359
|
+
);
|
|
360
|
+
return lines.join("\n");
|
|
361
|
+
}
|
|
362
|
+
|
|
272
363
|
// src/validation.ts
|
|
273
364
|
function validateToolArgs(args, schema) {
|
|
274
365
|
const errors = [];
|
|
@@ -685,6 +776,9 @@ function createUserHistoryMessage(text, options) {
|
|
|
685
776
|
if (options?.synthetic) {
|
|
686
777
|
metadata.synthetic = true;
|
|
687
778
|
}
|
|
779
|
+
if (options?.skill) {
|
|
780
|
+
metadata.skill = true;
|
|
781
|
+
}
|
|
688
782
|
if (options?.compaction) {
|
|
689
783
|
metadata.compaction = options.compaction;
|
|
690
784
|
}
|
|
@@ -868,6 +962,24 @@ function isCompletedToolPart(part) {
|
|
|
868
962
|
function getToolOutputTokens(part) {
|
|
869
963
|
return estimateTokensFromUnknown(part.output);
|
|
870
964
|
}
|
|
965
|
+
function markPreviousAssistantToolOutputs(history, now = Date.now()) {
|
|
966
|
+
if (history.length < 2) return { markedParts: 0 };
|
|
967
|
+
for (let msgIndex = history.length - 2; msgIndex >= 0; msgIndex--) {
|
|
968
|
+
const msg = history[msgIndex];
|
|
969
|
+
if (msg.role !== "assistant") continue;
|
|
970
|
+
if (msg.metadata?.summary) continue;
|
|
971
|
+
let markedParts = 0;
|
|
972
|
+
for (const part of msg.parts) {
|
|
973
|
+
if (!isCompletedToolPart(part)) continue;
|
|
974
|
+
if (part.compactedAt) continue;
|
|
975
|
+
if (part.output === void 0) continue;
|
|
976
|
+
part.compactedAt = now;
|
|
977
|
+
markedParts += 1;
|
|
978
|
+
}
|
|
979
|
+
return { markedParts };
|
|
980
|
+
}
|
|
981
|
+
return { markedParts: 0 };
|
|
982
|
+
}
|
|
871
983
|
function markPrunableToolOutputs(history, config) {
|
|
872
984
|
if (!config.prune) {
|
|
873
985
|
return { totalToolOutputTokens: 0, prunedTokens: 0, markedParts: 0 };
|
|
@@ -930,6 +1042,18 @@ function createHistoryForModel(history) {
|
|
|
930
1042
|
return copied;
|
|
931
1043
|
});
|
|
932
1044
|
}
|
|
1045
|
+
function createHistoryForCompactionPrompt(history, config) {
|
|
1046
|
+
if (!config.prune) {
|
|
1047
|
+
return createHistoryForModel(history);
|
|
1048
|
+
}
|
|
1049
|
+
const cloned = history.map((msg) => ({
|
|
1050
|
+
...msg,
|
|
1051
|
+
metadata: msg.metadata ? { ...msg.metadata } : void 0,
|
|
1052
|
+
parts: msg.parts.map((part) => ({ ...part }))
|
|
1053
|
+
}));
|
|
1054
|
+
markPrunableToolOutputs(cloned, config);
|
|
1055
|
+
return createHistoryForModel(cloned);
|
|
1056
|
+
}
|
|
933
1057
|
function isOverflow(params) {
|
|
934
1058
|
if (!params.config.auto) return false;
|
|
935
1059
|
const context = params.modelLimit?.context;
|
|
@@ -954,11 +1078,13 @@ function isOverflow(params) {
|
|
|
954
1078
|
cleanupDeadBackgroundJobs,
|
|
955
1079
|
createAssistantHistoryMessage,
|
|
956
1080
|
createBackgroundJobKey,
|
|
1081
|
+
createHistoryForCompactionPrompt,
|
|
957
1082
|
createHistoryForModel,
|
|
958
1083
|
createUserHistoryMessage,
|
|
959
1084
|
evaluatePermission,
|
|
960
1085
|
evaluateShellCommand,
|
|
961
1086
|
expandHome,
|
|
1087
|
+
extractSkillMentions,
|
|
962
1088
|
extractUsageTokens,
|
|
963
1089
|
finalizeStreamingParts,
|
|
964
1090
|
findExternalPathReferencesInShellCommand,
|
|
@@ -972,16 +1098,20 @@ function isOverflow(params) {
|
|
|
972
1098
|
isSubPath,
|
|
973
1099
|
killProcessTree,
|
|
974
1100
|
listBackgroundJobs,
|
|
1101
|
+
markPreviousAssistantToolOutputs,
|
|
975
1102
|
markPrunableToolOutputs,
|
|
976
1103
|
mergeRulesets,
|
|
977
1104
|
normalizeFsPath,
|
|
978
1105
|
optionalBoolean,
|
|
979
1106
|
optionalNumber,
|
|
980
1107
|
optionalString,
|
|
1108
|
+
redactFsPathForPrompt,
|
|
981
1109
|
refreshBackgroundJob,
|
|
982
1110
|
registerBackgroundJob,
|
|
983
1111
|
removeBackgroundJob,
|
|
1112
|
+
renderSkillsSectionForPrompt,
|
|
984
1113
|
requireString,
|
|
1114
|
+
selectSkillsForText,
|
|
985
1115
|
setDynamicToolError,
|
|
986
1116
|
setDynamicToolOutput,
|
|
987
1117
|
upsertDynamicToolCall,
|
package/dist/esm/index.js
CHANGED
|
@@ -19,6 +19,26 @@ function expandHome(p) {
|
|
|
19
19
|
}
|
|
20
20
|
return trimmed;
|
|
21
21
|
}
|
|
22
|
+
function redactFsPathForPrompt(value, options) {
|
|
23
|
+
const raw = (value || "").trim();
|
|
24
|
+
if (!raw) return "";
|
|
25
|
+
const normalized = raw.replace(/\\/g, "/");
|
|
26
|
+
if (!path.isAbsolute(raw)) return normalized;
|
|
27
|
+
const workspaceRoot = options?.workspaceRoot ? path.resolve(options.workspaceRoot) : void 0;
|
|
28
|
+
if (workspaceRoot && isSubPath(raw, workspaceRoot)) {
|
|
29
|
+
const rel = path.relative(workspaceRoot, raw).replace(/\\/g, "/");
|
|
30
|
+
return rel || ".";
|
|
31
|
+
}
|
|
32
|
+
const homeDir = options?.homeDir ?? os.homedir();
|
|
33
|
+
if (homeDir && isSubPath(raw, homeDir)) {
|
|
34
|
+
const rel = path.relative(homeDir, raw).replace(/\\/g, "/");
|
|
35
|
+
return rel ? `~/${rel}` : "~";
|
|
36
|
+
}
|
|
37
|
+
const tailSegments = Math.max(1, Math.floor(options?.tailSegments ?? 2));
|
|
38
|
+
const parts = normalized.split("/").filter(Boolean);
|
|
39
|
+
if (parts.length <= tailSegments) return normalized;
|
|
40
|
+
return `.../${parts.slice(-tailSegments).join("/")}`;
|
|
41
|
+
}
|
|
22
42
|
|
|
23
43
|
// src/permission.ts
|
|
24
44
|
function escapeRegExp(value) {
|
|
@@ -189,6 +209,71 @@ function isPathInsideWorkspace(targetPath, workspaceRoot) {
|
|
|
189
209
|
}
|
|
190
210
|
}
|
|
191
211
|
|
|
212
|
+
// src/skills.ts
|
|
213
|
+
function extractSkillMentions(text) {
|
|
214
|
+
const input = String(text || "");
|
|
215
|
+
if (!input) return [];
|
|
216
|
+
const seen = /* @__PURE__ */ new Set();
|
|
217
|
+
const result = [];
|
|
218
|
+
const re = /\$([A-Za-z0-9_](?:[A-Za-z0-9_.-]{0,126}[A-Za-z0-9_])?)/g;
|
|
219
|
+
for (const match of input.matchAll(re)) {
|
|
220
|
+
const name = match[1];
|
|
221
|
+
if (!name) continue;
|
|
222
|
+
if (seen.has(name)) continue;
|
|
223
|
+
seen.add(name);
|
|
224
|
+
result.push(name);
|
|
225
|
+
}
|
|
226
|
+
return result;
|
|
227
|
+
}
|
|
228
|
+
function selectSkillsForText(text, index) {
|
|
229
|
+
const mentions = extractSkillMentions(text);
|
|
230
|
+
if (mentions.length === 0) return { selected: [], unknown: [] };
|
|
231
|
+
const selected = [];
|
|
232
|
+
const unknown = [];
|
|
233
|
+
for (const name of mentions) {
|
|
234
|
+
const skill = index.byName.get(name);
|
|
235
|
+
if (skill) selected.push(skill);
|
|
236
|
+
else unknown.push(name);
|
|
237
|
+
}
|
|
238
|
+
return { selected, unknown };
|
|
239
|
+
}
|
|
240
|
+
function renderSkillsSectionForPrompt(options) {
|
|
241
|
+
const maxSkills = Math.max(0, Math.floor(options.maxSkills ?? 50));
|
|
242
|
+
const all = Array.isArray(options.skills) ? options.skills : [];
|
|
243
|
+
if (maxSkills === 0) return void 0;
|
|
244
|
+
const shown = all.slice(0, maxSkills);
|
|
245
|
+
const remaining = Math.max(0, all.length - shown.length);
|
|
246
|
+
const lines = [];
|
|
247
|
+
lines.push("## Skills");
|
|
248
|
+
lines.push(
|
|
249
|
+
"A skill is a reusable set of local instructions stored in a `SKILL.md` file. If the user mentions a skill (e.g. `$my-skill`), follow its instructions for that turn."
|
|
250
|
+
);
|
|
251
|
+
lines.push("### Available skills");
|
|
252
|
+
if (shown.length === 0) {
|
|
253
|
+
lines.push("- (none)");
|
|
254
|
+
} else {
|
|
255
|
+
for (const skill of shown) {
|
|
256
|
+
const label = skill.filePath ? ` (file: ${redactFsPathForPrompt(skill.filePath, { workspaceRoot: options.workspaceRoot })})` : "";
|
|
257
|
+
lines.push(`- ${skill.name}: ${skill.description}${label}`);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
if (remaining > 0) {
|
|
261
|
+
lines.push(`- ... and ${remaining} more (truncated)`);
|
|
262
|
+
}
|
|
263
|
+
lines.push("### How to use skills");
|
|
264
|
+
lines.push(
|
|
265
|
+
[
|
|
266
|
+
"- Trigger: If the user includes `$<skill-name>` in their message, you MUST apply that skill for this turn.",
|
|
267
|
+
"- The skill contents will be provided as a `<skill>...</skill>` block in the conversation history.",
|
|
268
|
+
"- If multiple skills are mentioned, you MUST apply ALL of them for this turn (skills are additive; do not ignore one).",
|
|
269
|
+
"- Skills are listed in the order they were mentioned. If instructions conflict, call it out and ask the user how to proceed.",
|
|
270
|
+
"- Do not carry skills across turns unless they are re-mentioned.",
|
|
271
|
+
"- If a skill is missing or can\u2019t be loaded, say so briefly and proceed without it."
|
|
272
|
+
].join("\n")
|
|
273
|
+
);
|
|
274
|
+
return lines.join("\n");
|
|
275
|
+
}
|
|
276
|
+
|
|
192
277
|
// src/validation.ts
|
|
193
278
|
function validateToolArgs(args, schema) {
|
|
194
279
|
const errors = [];
|
|
@@ -605,6 +690,9 @@ function createUserHistoryMessage(text, options) {
|
|
|
605
690
|
if (options?.synthetic) {
|
|
606
691
|
metadata.synthetic = true;
|
|
607
692
|
}
|
|
693
|
+
if (options?.skill) {
|
|
694
|
+
metadata.skill = true;
|
|
695
|
+
}
|
|
608
696
|
if (options?.compaction) {
|
|
609
697
|
metadata.compaction = options.compaction;
|
|
610
698
|
}
|
|
@@ -788,6 +876,24 @@ function isCompletedToolPart(part) {
|
|
|
788
876
|
function getToolOutputTokens(part) {
|
|
789
877
|
return estimateTokensFromUnknown(part.output);
|
|
790
878
|
}
|
|
879
|
+
function markPreviousAssistantToolOutputs(history, now = Date.now()) {
|
|
880
|
+
if (history.length < 2) return { markedParts: 0 };
|
|
881
|
+
for (let msgIndex = history.length - 2; msgIndex >= 0; msgIndex--) {
|
|
882
|
+
const msg = history[msgIndex];
|
|
883
|
+
if (msg.role !== "assistant") continue;
|
|
884
|
+
if (msg.metadata?.summary) continue;
|
|
885
|
+
let markedParts = 0;
|
|
886
|
+
for (const part of msg.parts) {
|
|
887
|
+
if (!isCompletedToolPart(part)) continue;
|
|
888
|
+
if (part.compactedAt) continue;
|
|
889
|
+
if (part.output === void 0) continue;
|
|
890
|
+
part.compactedAt = now;
|
|
891
|
+
markedParts += 1;
|
|
892
|
+
}
|
|
893
|
+
return { markedParts };
|
|
894
|
+
}
|
|
895
|
+
return { markedParts: 0 };
|
|
896
|
+
}
|
|
791
897
|
function markPrunableToolOutputs(history, config) {
|
|
792
898
|
if (!config.prune) {
|
|
793
899
|
return { totalToolOutputTokens: 0, prunedTokens: 0, markedParts: 0 };
|
|
@@ -850,6 +956,18 @@ function createHistoryForModel(history) {
|
|
|
850
956
|
return copied;
|
|
851
957
|
});
|
|
852
958
|
}
|
|
959
|
+
function createHistoryForCompactionPrompt(history, config) {
|
|
960
|
+
if (!config.prune) {
|
|
961
|
+
return createHistoryForModel(history);
|
|
962
|
+
}
|
|
963
|
+
const cloned = history.map((msg) => ({
|
|
964
|
+
...msg,
|
|
965
|
+
metadata: msg.metadata ? { ...msg.metadata } : void 0,
|
|
966
|
+
parts: msg.parts.map((part) => ({ ...part }))
|
|
967
|
+
}));
|
|
968
|
+
markPrunableToolOutputs(cloned, config);
|
|
969
|
+
return createHistoryForModel(cloned);
|
|
970
|
+
}
|
|
853
971
|
function isOverflow(params) {
|
|
854
972
|
if (!params.config.auto) return false;
|
|
855
973
|
const context = params.modelLimit?.context;
|
|
@@ -873,11 +991,13 @@ export {
|
|
|
873
991
|
cleanupDeadBackgroundJobs,
|
|
874
992
|
createAssistantHistoryMessage,
|
|
875
993
|
createBackgroundJobKey,
|
|
994
|
+
createHistoryForCompactionPrompt,
|
|
876
995
|
createHistoryForModel,
|
|
877
996
|
createUserHistoryMessage,
|
|
878
997
|
evaluatePermission,
|
|
879
998
|
evaluateShellCommand,
|
|
880
999
|
expandHome,
|
|
1000
|
+
extractSkillMentions,
|
|
881
1001
|
extractUsageTokens,
|
|
882
1002
|
finalizeStreamingParts,
|
|
883
1003
|
findExternalPathReferencesInShellCommand,
|
|
@@ -891,16 +1011,20 @@ export {
|
|
|
891
1011
|
isSubPath,
|
|
892
1012
|
killProcessTree,
|
|
893
1013
|
listBackgroundJobs,
|
|
1014
|
+
markPreviousAssistantToolOutputs,
|
|
894
1015
|
markPrunableToolOutputs,
|
|
895
1016
|
mergeRulesets,
|
|
896
1017
|
normalizeFsPath,
|
|
897
1018
|
optionalBoolean,
|
|
898
1019
|
optionalNumber,
|
|
899
1020
|
optionalString,
|
|
1021
|
+
redactFsPathForPrompt,
|
|
900
1022
|
refreshBackgroundJob,
|
|
901
1023
|
registerBackgroundJob,
|
|
902
1024
|
removeBackgroundJob,
|
|
1025
|
+
renderSkillsSectionForPrompt,
|
|
903
1026
|
requireString,
|
|
1027
|
+
selectSkillsForText,
|
|
904
1028
|
setDynamicToolError,
|
|
905
1029
|
setDynamicToolOutput,
|
|
906
1030
|
upsertDynamicToolCall,
|
|
@@ -3,11 +3,13 @@ export type ModelLimit = {
|
|
|
3
3
|
context: number;
|
|
4
4
|
output?: number;
|
|
5
5
|
};
|
|
6
|
+
export type ToolOutputCompactionMode = 'onCompaction' | 'afterToolCall';
|
|
6
7
|
export type CompactionConfig = {
|
|
7
8
|
auto: boolean;
|
|
8
9
|
prune: boolean;
|
|
9
10
|
pruneProtectTokens: number;
|
|
10
11
|
pruneMinimumTokens: number;
|
|
12
|
+
toolOutputMode: ToolOutputCompactionMode;
|
|
11
13
|
};
|
|
12
14
|
export declare const COMPACTION_MARKER_TEXT = "What did we do so far?";
|
|
13
15
|
export declare const COMPACTION_PROMPT_TEXT = "Provide a detailed prompt for continuing our conversation above. Focus on information that would be helpful for continuing the conversation, including what we did, what we are doing, which files we are working on, and what we should do next. Assume a new session will not have access to the previous conversation.";
|
|
@@ -20,12 +22,16 @@ export declare function getReservedOutputTokens(params: {
|
|
|
20
22
|
}): number;
|
|
21
23
|
export declare function extractUsageTokens(usage: unknown): AgentHistoryMetadata['tokens'] | undefined;
|
|
22
24
|
export declare function getEffectiveHistory(history: AgentHistoryMessage[]): AgentHistoryMessage[];
|
|
25
|
+
export declare function markPreviousAssistantToolOutputs(history: AgentHistoryMessage[], now?: number): {
|
|
26
|
+
markedParts: number;
|
|
27
|
+
};
|
|
23
28
|
export declare function markPrunableToolOutputs(history: AgentHistoryMessage[], config: CompactionConfig): {
|
|
24
29
|
totalToolOutputTokens: number;
|
|
25
30
|
prunedTokens: number;
|
|
26
31
|
markedParts: number;
|
|
27
32
|
};
|
|
28
33
|
export declare function createHistoryForModel(history: AgentHistoryMessage[]): AgentHistoryMessage[];
|
|
34
|
+
export declare function createHistoryForCompactionPrompt(history: AgentHistoryMessage[], config: CompactionConfig): AgentHistoryMessage[];
|
|
29
35
|
export declare function isOverflow(params: {
|
|
30
36
|
lastTokens: AgentHistoryMetadata['tokens'] | undefined;
|
|
31
37
|
modelLimit: ModelLimit | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compaction.d.ts","sourceRoot":"","sources":["../../src/compaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAE3E,MAAM,MAAM,UAAU,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAE9D,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,OAAO,CAAC;IACf,kBAAkB,EAAE,MAAM,CAAC;IAC3B,kBAAkB,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"compaction.d.ts","sourceRoot":"","sources":["../../src/compaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAE3E,MAAM,MAAM,UAAU,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,C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,wBAAgB,gCAAgC,CAAC,OAAO,EAAE,mBAAmB,EAAE,EAAE,MAAM,EAAE,gBAAgB,GAAG,mBAAmB,EAAE,CAahI;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE;IACjC,UAAU,EAAE,oBAAoB,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAC;IACvD,UAAU,EAAE,UAAU,GAAG,SAAS,CAAC;IACnC,oBAAoB,EAAE,MAAM,CAAC;IAC7B,MAAM,EAAE,gBAAgB,CAAC;CAC1B,GAAG,OAAO,CAYV"}
|
package/dist/types/fsPath.d.ts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
export declare function normalizeFsPath(value: string): string;
|
|
2
2
|
export declare function isSubPath(childPath: string, parentPath: string): boolean;
|
|
3
3
|
export declare function expandHome(p: string): string;
|
|
4
|
+
export declare function redactFsPathForPrompt(value: string, options?: {
|
|
5
|
+
workspaceRoot?: string;
|
|
6
|
+
homeDir?: string;
|
|
7
|
+
tailSegments?: number;
|
|
8
|
+
}): string;
|
|
4
9
|
//# sourceMappingURL=fsPath.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fsPath.d.ts","sourceRoot":"","sources":["../../src/fsPath.ts"],"names":[],"mappings":"AAGA,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAGrD;AAED,wBAAgB,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAIxE;AAED,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAQ5C"}
|
|
1
|
+
{"version":3,"file":"fsPath.d.ts","sourceRoot":"","sources":["../../src/fsPath.ts"],"names":[],"mappings":"AAGA,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAGrD;AAED,wBAAgB,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAIxE;AAED,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAQ5C;AAED,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE;IAAE,aAAa,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAA;CAAE,GAC5E,MAAM,CAuBR"}
|
package/dist/types/history.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export type AgentHistoryMetadata = {
|
|
|
3
3
|
mode?: 'build' | 'plan';
|
|
4
4
|
finishReason?: string;
|
|
5
5
|
synthetic?: boolean;
|
|
6
|
+
skill?: boolean;
|
|
6
7
|
summary?: boolean;
|
|
7
8
|
compaction?: {
|
|
8
9
|
auto: boolean;
|
|
@@ -19,6 +20,7 @@ export type AgentHistoryMetadata = {
|
|
|
19
20
|
export type AgentHistoryMessage = UIMessage<AgentHistoryMetadata>;
|
|
20
21
|
export declare function createUserHistoryMessage(text: string, options?: {
|
|
21
22
|
synthetic?: boolean;
|
|
23
|
+
skill?: boolean;
|
|
22
24
|
compaction?: {
|
|
23
25
|
auto: boolean;
|
|
24
26
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../src/history.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAA+B,SAAS,EAAE,MAAM,IAAI,CAAC;AAEpF,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE;QAAE,IAAI,EAAE,OAAO,CAAA;KAAE,CAAC;IAC/B,MAAM,CAAC,EAAE;QACP,KAAK,CAAC,EAAE,MAAM,CAAC;QACf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|
1
1
|
export type { ToolParameterSchema } from './toolSchema';
|
|
2
|
-
export { expandHome, isSubPath, normalizeFsPath } from './fsPath';
|
|
2
|
+
export { expandHome, isSubPath, normalizeFsPath, redactFsPathForPrompt } from './fsPath';
|
|
3
3
|
export type { PermissionAction, PermissionRule, PermissionRuleset } from './permission';
|
|
4
4
|
export { evaluatePermission, mergeRulesets, wildcardMatch } from './permission';
|
|
5
5
|
export { findExternalPathReferencesInShellCommand, isPathInsideWorkspace } from './shellPaths';
|
|
6
|
+
export type { SkillListEntry } from './skills';
|
|
7
|
+
export { extractSkillMentions, renderSkillsSectionForPrompt, selectSkillsForText } from './skills';
|
|
6
8
|
export type { ValidationResult, ShellCommandDecision } from './validation';
|
|
7
9
|
export { evaluateShellCommand, optionalBoolean, optionalNumber, optionalString, requireString, validateToolArgs, } from './validation';
|
|
8
10
|
export type { BackgroundJob } from './backgroundJobs';
|
|
9
11
|
export { DEFAULT_BACKGROUND_KILL_GRACE_MS, DEFAULT_BACKGROUND_TTL_MS, cleanupDeadBackgroundJobs, createBackgroundJobKey, getBackgroundJob, isPidAlive, killProcessTree, listBackgroundJobs, refreshBackgroundJob, registerBackgroundJob, removeBackgroundJob, } from './backgroundJobs';
|
|
10
12
|
export type { AgentHistoryMessage, AgentHistoryMetadata } from './history';
|
|
11
13
|
export { appendReasoning, appendText, createAssistantHistoryMessage, createUserHistoryMessage, finalizeStreamingParts, getMessageText, setDynamicToolError, setDynamicToolOutput, upsertDynamicToolCall, } from './history';
|
|
12
|
-
export type { CompactionConfig, ModelLimit } from './compaction';
|
|
13
|
-
export { COMPACTED_TOOL_PLACEHOLDER, COMPACTION_AUTO_CONTINUE_TEXT, COMPACTION_MARKER_TEXT, COMPACTION_PROMPT_TEXT, COMPACTION_SYSTEM_PROMPT, createHistoryForModel, extractUsageTokens, getEffectiveHistory, getReservedOutputTokens, isOverflow, markPrunableToolOutputs, } from './compaction';
|
|
14
|
+
export type { CompactionConfig, ModelLimit, ToolOutputCompactionMode } from './compaction';
|
|
15
|
+
export { COMPACTED_TOOL_PLACEHOLDER, COMPACTION_AUTO_CONTINUE_TEXT, COMPACTION_MARKER_TEXT, COMPACTION_PROMPT_TEXT, COMPACTION_SYSTEM_PROMPT, createHistoryForCompactionPrompt, createHistoryForModel, extractUsageTokens, getEffectiveHistory, markPreviousAssistantToolOutputs, getReservedOutputTokens, isOverflow, markPrunableToolOutputs, } from './compaction';
|
|
14
16
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAExD,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAExD,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAEzF,YAAY,EAAE,gBAAgB,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACxF,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAEhF,OAAO,EAAE,wCAAwC,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAE/F,YAAY,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,4BAA4B,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAEnG,YAAY,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAC3E,OAAO,EACL,oBAAoB,EACpB,eAAe,EACf,cAAc,EACd,cAAc,EACd,aAAa,EACb,gBAAgB,GACjB,MAAM,cAAc,CAAC;AAEtB,YAAY,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EACL,gCAAgC,EAChC,yBAAyB,EACzB,yBAAyB,EACzB,sBAAsB,EACtB,gBAAgB,EAChB,UAAU,EACV,eAAe,EACf,kBAAkB,EAClB,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,kBAAkB,CAAC;AAE1B,YAAY,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAC3E,OAAO,EACL,eAAe,EACf,UAAU,EACV,6BAA6B,EAC7B,wBAAwB,EACxB,sBAAsB,EACtB,cAAc,EACd,mBAAmB,EACnB,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,WAAW,CAAC;AAEnB,YAAY,EAAE,gBAAgB,EAAE,UAAU,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAC3F,OAAO,EACL,0BAA0B,EAC1B,6BAA6B,EAC7B,sBAAsB,EACtB,sBAAsB,EACtB,wBAAwB,EACxB,gCAAgC,EAChC,qBAAqB,EACrB,kBAAkB,EAClB,mBAAmB,EACnB,gCAAgC,EAChC,uBAAuB,EACvB,UAAU,EACV,uBAAuB,GACxB,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type SkillListEntry = {
|
|
2
|
+
name: string;
|
|
3
|
+
description: string;
|
|
4
|
+
filePath?: string;
|
|
5
|
+
};
|
|
6
|
+
export declare function extractSkillMentions(text: string): string[];
|
|
7
|
+
export declare function selectSkillsForText<T>(text: string, index: {
|
|
8
|
+
byName: Map<string, T>;
|
|
9
|
+
}): {
|
|
10
|
+
selected: T[];
|
|
11
|
+
unknown: string[];
|
|
12
|
+
};
|
|
13
|
+
export declare function renderSkillsSectionForPrompt(options: {
|
|
14
|
+
skills: SkillListEntry[];
|
|
15
|
+
maxSkills?: number;
|
|
16
|
+
workspaceRoot?: string;
|
|
17
|
+
}): string | undefined;
|
|
18
|
+
//# sourceMappingURL=skills.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skills.d.ts","sourceRoot":"","sources":["../../src/skills.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAqB3D;AAED,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE;IAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,CAAA;CAAE,GAAG;IAAE,QAAQ,EAAE,CAAC,EAAE,CAAC;IAAC,OAAO,EAAE,MAAM,EAAE,CAAA;CAAE,CAY5H;AAED,wBAAgB,4BAA4B,CAAC,OAAO,EAAE;IACpD,MAAM,EAAE,cAAc,EAAE,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,GAAG,MAAM,GAAG,SAAS,CA0CrB"}
|
package/package.json
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kooka/core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Shared LingYun core library (runtime-agnostic agent primitives).",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/mzbac/lingyun",
|
|
9
|
+
"directory": "packages/core"
|
|
10
|
+
},
|
|
6
11
|
"license": "Apache-2.0",
|
|
7
12
|
"main": "./dist/cjs/index.cjs",
|
|
8
13
|
"types": "./dist/types/index.d.ts",
|
|
@@ -19,20 +24,21 @@
|
|
|
19
24
|
"files": [
|
|
20
25
|
"dist"
|
|
21
26
|
],
|
|
22
|
-
"dependencies": {
|
|
23
|
-
"ai": "^6.0.6"
|
|
24
|
-
},
|
|
25
|
-
"devDependencies": {
|
|
26
|
-
"@types/node": "^20.11.16",
|
|
27
|
-
"esbuild": "^0.25.0",
|
|
28
|
-
"typescript": "^5.3.3"
|
|
29
|
-
},
|
|
30
27
|
"scripts": {
|
|
31
28
|
"clean": "node -e \"require('fs').rmSync('dist', { recursive: true, force: true })\"",
|
|
32
29
|
"build:types": "tsc -p tsconfig.json",
|
|
33
30
|
"build:esm": "esbuild src/index.ts --bundle --platform=node --target=es2022 --format=esm --outfile=dist/esm/index.js",
|
|
34
31
|
"build:cjs": "esbuild src/index.ts --bundle --platform=node --target=es2022 --format=cjs --outfile=dist/cjs/index.cjs",
|
|
35
32
|
"build": "pnpm run clean && pnpm run build:types && pnpm run build:esm && pnpm run build:cjs",
|
|
33
|
+
"prepack": "pnpm run build",
|
|
36
34
|
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
35
|
+
},
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"ai": "^6.0.6"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@types/node": "^20.11.16",
|
|
41
|
+
"esbuild": "^0.25.0",
|
|
42
|
+
"typescript": "^5.3.3"
|
|
37
43
|
}
|
|
38
|
-
}
|
|
44
|
+
}
|
package/LICENSE
DELETED
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
Apache License
|
|
2
|
-
Version 2.0, January 2004
|
|
3
|
-
http://www.apache.org/licenses/
|
|
4
|
-
|
|
5
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
-
|
|
7
|
-
1. Definitions.
|
|
8
|
-
|
|
9
|
-
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
-
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
-
|
|
12
|
-
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
-
the copyright owner that is granting the License.
|
|
14
|
-
|
|
15
|
-
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
-
other entities that control, are controlled by, or are under common
|
|
17
|
-
control with that entity. For the purposes of this definition,
|
|
18
|
-
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
-
direction or management of such entity, whether by contract or
|
|
20
|
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
-
|
|
23
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
-
exercising permissions granted by this License.
|
|
25
|
-
|
|
26
|
-
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
-
including but not limited to software source code, documentation
|
|
28
|
-
source, and configuration files.
|
|
29
|
-
|
|
30
|
-
"Object" form shall mean any form resulting from mechanical
|
|
31
|
-
transformation or translation of a Source form, including but
|
|
32
|
-
not limited to compiled object code, generated documentation,
|
|
33
|
-
and conversions to other media types.
|
|
34
|
-
|
|
35
|
-
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
-
Object form, made available under the License, as indicated by a
|
|
37
|
-
copyright notice that is included in or attached to the work
|
|
38
|
-
(an example is provided in the Appendix below).
|
|
39
|
-
|
|
40
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
-
form, that is based on (or derived from) the Work and for which the
|
|
42
|
-
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
-
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
-
of this License, Derivative Works shall not include works that remain
|
|
45
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
-
the Work and Derivative Works thereof.
|
|
47
|
-
|
|
48
|
-
"Contribution" shall mean any work of authorship, including
|
|
49
|
-
the original version of the Work and any modifications or additions
|
|
50
|
-
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
-
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
-
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
-
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
-
means any form of electronic, verbal, or written communication sent
|
|
55
|
-
to the Licensor or its representatives, including but not limited to
|
|
56
|
-
communication on electronic mailing lists, source code control systems,
|
|
57
|
-
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
-
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
-
excluding communication that is conspicuously marked or otherwise
|
|
60
|
-
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
-
|
|
62
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
-
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
-
subsequently incorporated within the Work.
|
|
65
|
-
|
|
66
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
-
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
-
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
-
Work and such Derivative Works in Source or Object form.
|
|
72
|
-
|
|
73
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
-
(except as stated in this section) patent license to make, have made,
|
|
77
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
-
where such license applies only to those patent claims licensable
|
|
79
|
-
by such Contributor that are necessarily infringed by their
|
|
80
|
-
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
-
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
-
institute patent litigation against any entity (including a
|
|
83
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
-
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
-
or contributory patent infringement, then any patent licenses
|
|
86
|
-
granted to You under this License for that Work shall terminate
|
|
87
|
-
as of the date such litigation is filed.
|
|
88
|
-
|
|
89
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
-
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
-
modifications, and in Source or Object form, provided that You
|
|
92
|
-
meet the following conditions:
|
|
93
|
-
|
|
94
|
-
(a) You must give any other recipients of the Work or
|
|
95
|
-
Derivative Works a copy of this License; and
|
|
96
|
-
|
|
97
|
-
(b) You must cause any modified files to carry prominent notices
|
|
98
|
-
stating that You changed the files; and
|
|
99
|
-
|
|
100
|
-
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
-
that You distribute, all copyright, patent, trademark, and
|
|
102
|
-
attribution notices from the Source form of the Work,
|
|
103
|
-
excluding those notices that do not pertain to any part of
|
|
104
|
-
the Derivative Works; and
|
|
105
|
-
|
|
106
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
-
distribution, then any Derivative Works that You distribute must
|
|
108
|
-
include a readable copy of the attribution notices contained
|
|
109
|
-
within such NOTICE file, excluding those notices that do not
|
|
110
|
-
pertain to any part of the Derivative Works, in at least one
|
|
111
|
-
of the following places: within a NOTICE text file distributed
|
|
112
|
-
as part of the Derivative Works; within the Source form or
|
|
113
|
-
documentation, if provided along with the Derivative Works; or,
|
|
114
|
-
within a display generated by the Derivative Works, if and
|
|
115
|
-
wherever such third-party notices normally appear. The contents
|
|
116
|
-
of the NOTICE file are for informational purposes only and
|
|
117
|
-
do not modify the License. You may add Your own attribution
|
|
118
|
-
notices within Derivative Works that You distribute, alongside
|
|
119
|
-
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
-
that such additional attribution notices cannot be construed
|
|
121
|
-
as modifying the License.
|
|
122
|
-
|
|
123
|
-
You may add Your own copyright statement to Your modifications and
|
|
124
|
-
may provide additional or different license terms and conditions
|
|
125
|
-
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
-
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
-
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
-
the conditions stated in this License.
|
|
129
|
-
|
|
130
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
-
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
-
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
-
this License, without any additional terms or conditions.
|
|
134
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
-
the terms of any separate license agreement you may have executed
|
|
136
|
-
with Licensor regarding such Contributions.
|
|
137
|
-
|
|
138
|
-
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
-
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
-
except as required for reasonable and customary use in describing the
|
|
141
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
-
|
|
143
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
-
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
-
implied, including, without limitation, any warranties or conditions
|
|
148
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
-
appropriateness of using or redistributing the Work and assume any
|
|
151
|
-
risks associated with Your exercise of permissions under this License.
|
|
152
|
-
|
|
153
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
-
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
-
unless required by applicable law (such as deliberate and grossly
|
|
156
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
-
liable to You for damages, including any direct, indirect, special,
|
|
158
|
-
incidental, or consequential damages of any character arising as a
|
|
159
|
-
result of this License or out of the use or inability to use the
|
|
160
|
-
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
-
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
-
other commercial damages or losses), even if such Contributor
|
|
163
|
-
has been advised of the possibility of such damages.
|
|
164
|
-
|
|
165
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
-
or other liability obligations and/or rights consistent with this
|
|
169
|
-
License. However, in accepting such obligations, You may act only
|
|
170
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
-
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
-
defend, and hold each Contributor harmless for any liability
|
|
173
|
-
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
-
of your accepting any such warranty or additional liability.
|
|
175
|
-
|
|
176
|
-
END OF TERMS AND CONDITIONS
|
|
177
|
-
|
|
178
|
-
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
-
|
|
180
|
-
To apply the Apache License to your work, attach the following
|
|
181
|
-
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
-
replaced with your own identifying information. (Don't include
|
|
183
|
-
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
-
comment syntax for the file format. We also recommend that a
|
|
185
|
-
file or class name and description of purpose be included on the
|
|
186
|
-
same "printed page" as the copyright notice for easier
|
|
187
|
-
identification within third-party archives.
|
|
188
|
-
|
|
189
|
-
Copyright 2026 LingYun contributors
|
|
190
|
-
|
|
191
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
-
you may not use this file except in compliance with the License.
|
|
193
|
-
You may obtain a copy of the License at
|
|
194
|
-
|
|
195
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
-
|
|
197
|
-
Unless required by applicable law or agreed to in writing, software
|
|
198
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
-
See the License for the specific language governing permissions and
|
|
201
|
-
limitations under the License.
|