@lore-co/core 0.2.38 → 0.2.39
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/auth-schemas.d.ts +16 -0
- package/dist/auth-schemas.d.ts.map +1 -1
- package/dist/auth-schemas.js +14 -0
- package/dist/auth-schemas.js.map +1 -1
- package/dist/connection-refresh.d.ts +91 -0
- package/dist/connection-refresh.d.ts.map +1 -0
- package/dist/connection-refresh.js +525 -0
- package/dist/connection-refresh.js.map +1 -0
- package/dist/guard-evaluation.d.ts +29 -0
- package/dist/guard-evaluation.d.ts.map +1 -1
- package/dist/guard-evaluation.js +174 -0
- package/dist/guard-evaluation.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/local-scope.d.ts +3 -0
- package/dist/local-scope.d.ts.map +1 -1
- package/dist/local-scope.js +8 -4
- package/dist/local-scope.js.map +1 -1
- package/dist/package-warnings.d.ts +63 -0
- package/dist/package-warnings.d.ts.map +1 -0
- package/dist/package-warnings.js +69 -0
- package/dist/package-warnings.js.map +1 -0
- package/dist/pilot-schemas.d.ts +3 -3
- package/dist/problem-reports.d.ts +352 -0
- package/dist/problem-reports.d.ts.map +1 -0
- package/dist/problem-reports.js +94 -0
- package/dist/problem-reports.js.map +1 -0
- package/dist/product-usage.d.ts +20 -3
- package/dist/product-usage.d.ts.map +1 -1
- package/dist/product-usage.js +12 -4
- package/dist/product-usage.js.map +1 -1
- package/dist/public-rule-text.d.ts +1 -1
- package/dist/public-rule-text.d.ts.map +1 -1
- package/dist/public-rule-text.js +1 -1
- package/dist/public-rule-text.js.map +1 -1
- package/dist/public-rules.d.ts +1 -1
- package/dist/public-rules.d.ts.map +1 -1
- package/dist/public-rules.js +36 -3
- package/dist/public-rules.js.map +1 -1
- package/dist/redaction.d.ts +7 -0
- package/dist/redaction.d.ts.map +1 -1
- package/dist/redaction.js +30 -0
- package/dist/redaction.js.map +1 -1
- package/dist/reliability-schemas.d.ts +2 -2
- package/dist/schemas.d.ts +2 -2
- package/dist/search-schemas.d.ts +1 -1
- package/dist/skill-context.d.ts +0 -3
- package/dist/skill-context.d.ts.map +1 -1
- package/dist/skill-context.js +2 -15
- package/dist/skill-context.js.map +1 -1
- package/dist/skill-folder.d.ts.map +1 -1
- package/dist/skill-folder.js +10 -5
- package/dist/skill-folder.js.map +1 -1
- package/dist/skill-secrets.d.ts +11 -0
- package/dist/skill-secrets.d.ts.map +1 -0
- package/dist/skill-secrets.js +263 -0
- package/dist/skill-secrets.js.map +1 -0
- package/dist/skills.d.ts +34 -5
- package/dist/skills.d.ts.map +1 -1
- package/dist/skills.js +127 -36
- package/dist/skills.js.map +1 -1
- package/package.json +13 -1
package/dist/schemas.d.ts
CHANGED
|
@@ -275,10 +275,10 @@ export declare const MemoryConflictAnalysisSchema: z.ZodObject<{
|
|
|
275
275
|
export type MemoryConflictAnalysis = z.infer<typeof MemoryConflictAnalysisSchema>;
|
|
276
276
|
export declare const AgentMessageSchema: z.ZodObject<{
|
|
277
277
|
role: z.ZodEnum<{
|
|
278
|
+
tool: "tool";
|
|
278
279
|
system: "system";
|
|
279
280
|
user: "user";
|
|
280
281
|
assistant: "assistant";
|
|
281
|
-
tool: "tool";
|
|
282
282
|
}>;
|
|
283
283
|
content: z.ZodString;
|
|
284
284
|
id: z.ZodOptional<z.ZodString>;
|
|
@@ -305,10 +305,10 @@ export declare const AgentInteractionSchema: z.ZodObject<{
|
|
|
305
305
|
sessionId: z.ZodOptional<z.ZodString>;
|
|
306
306
|
messages: z.ZodArray<z.ZodObject<{
|
|
307
307
|
role: z.ZodEnum<{
|
|
308
|
+
tool: "tool";
|
|
308
309
|
system: "system";
|
|
309
310
|
user: "user";
|
|
310
311
|
assistant: "assistant";
|
|
311
|
-
tool: "tool";
|
|
312
312
|
}>;
|
|
313
313
|
content: z.ZodString;
|
|
314
314
|
id: z.ZodOptional<z.ZodString>;
|
package/dist/search-schemas.d.ts
CHANGED
|
@@ -14,8 +14,8 @@ export declare const WorkspaceSearchQuerySchema: z.ZodObject<{
|
|
|
14
14
|
false: "false";
|
|
15
15
|
}>>;
|
|
16
16
|
sort: z.ZodDefault<z.ZodEnum<{
|
|
17
|
-
relevance: "relevance";
|
|
18
17
|
recent: "recent";
|
|
18
|
+
relevance: "relevance";
|
|
19
19
|
}>>;
|
|
20
20
|
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
21
21
|
offset: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
package/dist/skill-context.d.ts
CHANGED
|
@@ -16,7 +16,4 @@ export declare function packSkillContext(skills: readonly Skill[], task: string,
|
|
|
16
16
|
* the cap by dropping whole skills from the end, least relevant first, and
|
|
17
17
|
* saying so, as packSkillContext does; never deliver a cut-off skill. */
|
|
18
18
|
export declare function fitSkillContext(text: string, maxCharacters?: number): string;
|
|
19
|
-
/** fitSkillContext for a delivery or turn response after its text was redacted,
|
|
20
|
-
* so the response still satisfies the skill pack's schema limit. */
|
|
21
|
-
export declare function fitResponseSkillContext<T>(value: T): T;
|
|
22
19
|
//# sourceMappingURL=skill-context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skill-context.d.ts","sourceRoot":"","sources":["../src/skill-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEzC,eAAO,MAAM,4BAA4B,QAAS,CAAC;AAEnD,eAAO,MAAM,yBAAyB,uJAAuJ,CAAC;AAE9L,2HAA2H;AAC3H,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,KAAK,EAAE,EAAE,OAAO,UAAQ,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAa3G;AASD;6EAC6E;AAC7E,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,SAAS,KAAK,EAAE,EACxB,IAAI,EAAE,MAAM,EACZ,aAAa,SAA+B,EAC5C,OAAO,UAAQ,EACf,eAAe,GAAE,CAAC,KAAK,EAAE,KAAK,KAAK;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG,SAA2B,GAClG,MAAM,CAyBR;AAKD;;yEAEyE;AACzE,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,aAAa,SAA+B,GAAG,MAAM,CASlG
|
|
1
|
+
{"version":3,"file":"skill-context.d.ts","sourceRoot":"","sources":["../src/skill-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEzC,eAAO,MAAM,4BAA4B,QAAS,CAAC;AAEnD,eAAO,MAAM,yBAAyB,uJAAuJ,CAAC;AAE9L,2HAA2H;AAC3H,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,KAAK,EAAE,EAAE,OAAO,UAAQ,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAa3G;AASD;6EAC6E;AAC7E,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,SAAS,KAAK,EAAE,EACxB,IAAI,EAAE,MAAM,EACZ,aAAa,SAA+B,EAC5C,OAAO,UAAQ,EACf,eAAe,GAAE,CAAC,KAAK,EAAE,KAAK,KAAK;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG,SAA2B,GAClG,MAAM,CAyBR;AAKD;;yEAEyE;AACzE,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,aAAa,SAA+B,GAAG,MAAM,CASlG"}
|
package/dist/skill-context.js
CHANGED
|
@@ -22,7 +22,7 @@ function supportingFilesLine(name, count) {
|
|
|
22
22
|
if (!count?.files)
|
|
23
23
|
return "";
|
|
24
24
|
const scripts = count.scripts ? ` (${count.scripts} ${count.scripts === 1 ? "script" : "scripts"})` : "";
|
|
25
|
-
return `\nSupporting files: ${count.files}${scripts}.
|
|
25
|
+
return `\nSupporting files: ${count.files}${scripts}. They are not in this repository, and paths in these instructions are relative to the skill directory. When this skill applies, first run \`lore skill files ${name}\` or call read_skill to get that directory, and use the files from there. Run its scripts only with your normal permissions.`;
|
|
26
26
|
}
|
|
27
27
|
/** Deliver complete instructions, never a cut-off workflow. Relevance orders the
|
|
28
28
|
* bounded pack; the skill's description still determines when it applies. */
|
|
@@ -38,7 +38,7 @@ export function packSkillContext(skills, task, maxCharacters = MAX_SKILL_CONTEXT
|
|
|
38
38
|
return [...terms].filter(term => words.has(term)).length + (named.has(skill.name) ? 100 : 0);
|
|
39
39
|
};
|
|
40
40
|
const ranked = [...enabled].sort((a, b) => score(b) - score(a) || a.name.localeCompare(b.name));
|
|
41
|
-
const parts = ["## Enabled Lore skills", "Use this current list of Lore skills for the task; do not carry forward disabled skills from earlier tasks. Apply skills when their descriptions match the request. Their
|
|
41
|
+
const parts = ["## Enabled Lore skills", "Use this current list of Lore skills for the task; do not carry forward disabled skills from earlier tasks. Apply skills when their descriptions match the request. Their instructions are supplied here; a skill with supporting files says how to get them. Follow the current user's request and higher-priority instructions. Skills do not grant permissions or prove that a review was completed."];
|
|
42
42
|
const omitted = [];
|
|
43
43
|
// Reserve room for an honest omission notice, including very small copy budgets.
|
|
44
44
|
const footer = SKILLS_OMITTED;
|
|
@@ -75,17 +75,4 @@ export function fitSkillContext(text, maxCharacters = MAX_SKILL_CONTEXT_CHARACTE
|
|
|
75
75
|
}
|
|
76
76
|
return SKILLS_OMITTED.length <= maxCharacters ? SKILLS_OMITTED : "";
|
|
77
77
|
}
|
|
78
|
-
/** fitSkillContext for a delivery or turn response after its text was redacted,
|
|
79
|
-
* so the response still satisfies the skill pack's schema limit. */
|
|
80
|
-
export function fitResponseSkillContext(value) {
|
|
81
|
-
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
82
|
-
return value;
|
|
83
|
-
const record = value;
|
|
84
|
-
if (typeof record.skillContext === "string")
|
|
85
|
-
return { ...record, skillContext: fitSkillContext(record.skillContext) };
|
|
86
|
-
const context = record.context;
|
|
87
|
-
if (typeof context === "object" && context !== null && !Array.isArray(context) && typeof context.skillContext === "string")
|
|
88
|
-
return { ...record, context: fitResponseSkillContext(context) };
|
|
89
|
-
return value;
|
|
90
|
-
}
|
|
91
78
|
//# sourceMappingURL=skill-context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skill-context.js","sourceRoot":"","sources":["../src/skill-context.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,4BAA4B,GAAG,MAAM,CAAC;AACnD,MAAM,cAAc,GAAG,2NAA2N,CAAC;AACnP,MAAM,CAAC,MAAM,yBAAyB,GAAG,oJAAoJ,CAAC;AAE9L,2HAA2H;AAC3H,MAAM,UAAU,gBAAgB,CAAC,MAAwB,EAAE,OAAO,GAAG,KAAK;IACxE,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;IAChI,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC,OAAO;QAAE,OAAO,EAAE,IAAI,EAAE,4GAA4G,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;IACzK,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,KAAK,CAAC,KAAK,KAAK,KAAK,CAAC,IAAI,MAAM,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,OAAO,E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F,CAAC;AAEhH;;yEAEyE;AACzE,MAAM,UAAU,eAAe,CAAC,IAAY,EAAE,aAAa,GAAG,4BAA4B;IACxF,IAAI,IAAI,CAAC,MAAM,IAAI,aAAa;QAAE,OAAO,IAAI,CAAC;IAC9C,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,cAAc,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACzG,MAAM,MAAM,GAAG,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC3E,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,OAAO,EAAE,EAAE,CAAC;QACrC,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;QAClC,IAAI,IAAI,CAAC,MAAM,GAAG,cAAc,CAAC,MAAM,GAAG,CAAC,IAAI,aAAa;YAAE,OAAO,GAAG,IAAI,OAAO,cAAc,EAAE,CAAC;IACtG,CAAC;IACD,OAAO,cAAc,CAAC,MAAM,IAAI,aAAa,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC;AACtE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skill-folder.d.ts","sourceRoot":"","sources":["../src/skill-folder.ts"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"skill-folder.d.ts","sourceRoot":"","sources":["../src/skill-folder.ts"],"names":[],"mappings":"AAEA,OAAO,EAA6B,KAAK,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAGjF;;;;;;;;;;;GAWG;AACH,wBAAsB,gBAAgB,CAAC,aAAa,EAAE,MAAM,EAAE,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,CAMzG;AAED,eAAO,MAAM,sBAAsB,QAA0B,CAAC"}
|
package/dist/skill-folder.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { lstat, mkdir, mkdtemp, readFile, readdir, rename, rm, utimes, writeFile } from "node:fs/promises";
|
|
2
2
|
import { dirname, resolve } from "node:path";
|
|
3
|
-
import { skillDigest } from "./skills.js";
|
|
3
|
+
import { decodeBase64, skillDigest } from "./skills.js";
|
|
4
4
|
import { stripHiddenCharacters } from "./delivered-text.js";
|
|
5
5
|
/**
|
|
6
6
|
* Writes a reviewed skill folder (SKILL.md plus supporting files) to
|
|
@@ -41,8 +41,12 @@ async function placeSkillFolder(loreDirectory, bundle) {
|
|
|
41
41
|
const directory = resolve(root, `${bundle.name}-${bundle.digest.slice(0, 16)}`);
|
|
42
42
|
// Agents read the instructions as written here: Markdown loses hidden
|
|
43
43
|
// characters, while scripts and other files keep their exact bytes.
|
|
44
|
-
const contents = [{ path: "SKILL.md",
|
|
45
|
-
...bundle.files.map(file =>
|
|
44
|
+
const contents = [{ path: "SKILL.md", bytes: utf8(stripHiddenCharacters(bundle.markdown)) },
|
|
45
|
+
...bundle.files.map(file => ({
|
|
46
|
+
path: file.path,
|
|
47
|
+
bytes: file.encoding === "base64" ? decodeBase64(file.content)
|
|
48
|
+
: utf8(file.path.toLowerCase().endsWith(".md") ? stripHiddenCharacters(file.content) : file.content),
|
|
49
|
+
}))];
|
|
46
50
|
await mkdir(root, { recursive: true, mode: 0o700 });
|
|
47
51
|
for (const folder of [loreDirectory, root])
|
|
48
52
|
if ((await lstat(folder)).isSymbolicLink())
|
|
@@ -55,7 +59,7 @@ async function placeSkillFolder(loreDirectory, bundle) {
|
|
|
55
59
|
for (const file of contents) {
|
|
56
60
|
const target = resolve(temporary, ...file.path.split("/"));
|
|
57
61
|
await mkdir(dirname(target), { recursive: true, mode: 0o755 });
|
|
58
|
-
await writeFile(target, file.
|
|
62
|
+
await writeFile(target, file.bytes, { flag: "wx", mode: 0o644 });
|
|
59
63
|
}
|
|
60
64
|
await rename(temporary, directory);
|
|
61
65
|
}
|
|
@@ -69,13 +73,14 @@ async function placeSkillFolder(loreDirectory, bundle) {
|
|
|
69
73
|
return directory;
|
|
70
74
|
}
|
|
71
75
|
/** True when the folder already holds exactly these files, unmodified. */
|
|
76
|
+
const utf8 = (text) => new TextEncoder().encode(text);
|
|
72
77
|
async function matches(directory, contents) {
|
|
73
78
|
try {
|
|
74
79
|
if (!(await lstat(directory)).isDirectory())
|
|
75
80
|
return false;
|
|
76
81
|
for (const file of contents) {
|
|
77
82
|
const target = resolve(directory, ...file.path.split("/"));
|
|
78
|
-
if (!(await lstat(target)).isFile() || await readFile(target
|
|
83
|
+
if (!(await lstat(target)).isFile() || !Buffer.from(file.bytes).equals(await readFile(target)))
|
|
79
84
|
return false;
|
|
80
85
|
}
|
|
81
86
|
return true;
|
package/dist/skill-folder.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skill-folder.js","sourceRoot":"","sources":["../src/skill-folder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC3G,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,WAAW,EAA2B,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"skill-folder.js","sourceRoot":"","sources":["../src/skill-folder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC3G,OAAO,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,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QACtD,yDAAyD;QACzD,IAAI,MAAM,OAAO,CAAC,SAAS,EAAE,QAAQ,CAAC;YAAE,OAAO,SAAS,CAAC;QACzD,MAAM,KAAK,CAAC;IACd,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,0EAA0E;AAC1E,MAAM,IAAI,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAE9D,KAAK,UAAU,OAAO,CAAC,SAAiB,EAAE,QAAwD;IAChG,IAAI,CAAC;QACH,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,EAAE;YAAE,OAAO,KAAK,CAAC;QAC1D,KAAK,MAAM,IAAI,IAAI,QAAQ,EAAE,CAAC;YAC5B,MAAM,MAAM,GAAG,OAAO,CAAC,SAAS,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;YAC3D,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,MAAM,QAAQ,CAAC,MAAM,CAAC,CAAC;gBAAE,OAAO,KAAK,CAAC;QAC/G,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
type Redact = (text: string) => string;
|
|
2
|
+
export declare function isProseWord(token: string): boolean;
|
|
3
|
+
/**
|
|
4
|
+
* Skill text with every real-looking secret hidden and everything else exact. It
|
|
5
|
+
* doesn't matter when a skill was added or what the check was then: this judges
|
|
6
|
+
* the text as it stands, with the redactor as it stands. Unchanged text means the
|
|
7
|
+
* skill holds no credential, so importing and delivering always agree.
|
|
8
|
+
*/
|
|
9
|
+
export declare function maskSkillSecrets(text: string, redact: Redact): string;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=skill-secrets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skill-secrets.d.ts","sourceRoot":"","sources":["../src/skill-secrets.ts"],"names":[],"mappings":"AASA,KAAK,MAAM,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;AAevC,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAMlD;AA6MD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CASrE"}
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
// The capture redactor errs toward redacting: a session may hold anything. Skills
|
|
2
|
+
// are reviewed text full of setup examples, so here each value the redactor hid
|
|
3
|
+
// is looked at again, and comes back only when it is plainly not a secret: a
|
|
4
|
+
// placeholder, a variable or environment-variable name, code, or prose. Anything
|
|
5
|
+
// not recognized, including whatever a new redactor rule hides, stays hidden.
|
|
6
|
+
//
|
|
7
|
+
// Copied beside the hook runtime in ~/.lore, so this file has no imports: each
|
|
8
|
+
// caller passes its own redactor, which is core's or the runtime's parity copy.
|
|
9
|
+
const TRAILING_PUNCTUATION = /[.,;:!?)\]}"'`*]+$/u;
|
|
10
|
+
const VOWELS = /[aeiouy]/gu;
|
|
11
|
+
const CONSONANT_RUN = /[^aeiouy]+/gu;
|
|
12
|
+
function isWordPart(part) {
|
|
13
|
+
// The redactor ignores tokens shorter than 8 characters, so short words are prose.
|
|
14
|
+
if (part.length < 8)
|
|
15
|
+
return true;
|
|
16
|
+
if (part.length > 16 || /^[a-f]+$/u.test(part))
|
|
17
|
+
return false;
|
|
18
|
+
const vowels = part.match(VOWELS)?.length ?? 0;
|
|
19
|
+
const longestConsonantRun = Math.max(0, ...(part.match(CONSONANT_RUN) ?? []).map(run => run.length));
|
|
20
|
+
return vowels / part.length >= 0.25 && longestConsonantRun <= 4;
|
|
21
|
+
}
|
|
22
|
+
export function isProseWord(token) {
|
|
23
|
+
const word = token.replace(TRAILING_PUNCTUATION, "");
|
|
24
|
+
if (!/^[a-z]+(?:-[a-z]+){0,2}$/u.test(word))
|
|
25
|
+
return false;
|
|
26
|
+
// A run of short hyphenated hex parts is still a hex token.
|
|
27
|
+
if (word.replace(/-/gu, "").length >= 8 && /^[a-f-]+$/u.test(word))
|
|
28
|
+
return false;
|
|
29
|
+
return word.split("-").every(isWordPart);
|
|
30
|
+
}
|
|
31
|
+
/** "Operations", "Multi-Turn", "EventProcessorClient", "--location", "text/image":
|
|
32
|
+
* what follows "Basic" in headings, SKU tables, and CLI flags. Base64 has no such shape. */
|
|
33
|
+
function isHeadingWord(token) {
|
|
34
|
+
const word = token.replace(TRAILING_PUNCTUATION, "");
|
|
35
|
+
if (/^--?[a-z]+(?:-[a-z]+)*$/u.test(word))
|
|
36
|
+
return true;
|
|
37
|
+
if (/^[a-z]+\/[a-z]+$/u.test(word))
|
|
38
|
+
return word.split("/").every(isProseWord);
|
|
39
|
+
if (!/^(?:[A-Z][a-z]{2,})+(?:-(?:[A-Z][a-z]{2,})+)?$/u.test(word))
|
|
40
|
+
return false;
|
|
41
|
+
return (word.match(/[A-Z][a-z]+/gu) ?? []).every(part => /[aeiouy]/u.test(part) && isProseWord(part.toLowerCase()));
|
|
42
|
+
}
|
|
43
|
+
// `your-api-key`, `YourSecurePassword123!`: people do not start a real secret with "your".
|
|
44
|
+
const YOUR_PLACEHOLDER = /^your[-_ a-z]+\d{0,4}!?$/iu;
|
|
45
|
+
// `build-placeholder`: a hyphenated value that says so.
|
|
46
|
+
const SAYS_PLACEHOLDER = /^(?:[a-z]+-)*(?:placeholder|example|changeme|dummy)(?:-[a-z]+)*$/iu;
|
|
47
|
+
// `mypassword`, `secret123`, `abc123`: only stock words, then at most a stock number.
|
|
48
|
+
const STOCK_WORDS = /^(?:my|the|some|new|secure|strong|example|sample|test|dummy|fake|placeholder|replace|change|changeme|me|here|this|value|api|key|keys|token|tokens|secret|secrets|password|passwd|pass|pwd|credential|credentials|auth|client|access|bearer|user|username|connection|string|abc|xyz|foo|bar|baz)+$/u;
|
|
49
|
+
const STOCK_NUMBER = /(?:12345|1234|123|456|789|1|2)?!?$/u;
|
|
50
|
+
// `ghp_xxx`, `xxxx`, `***`; `eyJ0eXAi...`, `postgres://...`: masked or cut short on purpose.
|
|
51
|
+
const MASKED = /^(?:\w+[-_])?(?:[xX]{3,}|\*{3,})$|^\*{3,}\\n/u;
|
|
52
|
+
const CUT_SHORT = /^\S{0,12}\.\.\.[)\]`]*$/u;
|
|
53
|
+
// A secret-store reference such as `secretref:db-password`, not the secret.
|
|
54
|
+
const STORE_REFERENCE = /^(?:secretref|keyvaultref):/u;
|
|
55
|
+
const TEMPLATE = /^(?:[A-Za-z.:/_-]{0,12}\$\{\S*|\$(?:\(\S*|[A-Za-z_][\w.:\\()-]*)|\{+[\w.()'[\]$ -]*\}*|%[\w%]+%?|\[[^\s]*\]?)$/u;
|
|
56
|
+
/** A value that says what belongs there instead of holding it. */
|
|
57
|
+
function isPlaceholder(raw, rest = "") {
|
|
58
|
+
const value = raw.replace(/^`+/u, "");
|
|
59
|
+
if (/^<[^<>]*>[.,;:!?)\]}`]*$/u.test(value) || (/^<[^<>]*$/u.test(value) && /^[^<>\n]{0,80}>/u.test(rest)))
|
|
60
|
+
return true;
|
|
61
|
+
if (TEMPLATE.test(value) || MASKED.test(value) || CUT_SHORT.test(value) || STORE_REFERENCE.test(value))
|
|
62
|
+
return true;
|
|
63
|
+
// The redactor keeps trailing dots out of what it hides.
|
|
64
|
+
if (value.length <= 12 && rest.startsWith("..."))
|
|
65
|
+
return true;
|
|
66
|
+
const trimmed = value.replace(/[.,;:?)\]}"'`*]+$/u, "");
|
|
67
|
+
if (trimmed.length > 64)
|
|
68
|
+
return false;
|
|
69
|
+
if (YOUR_PLACEHOLDER.test(trimmed) || SAYS_PLACEHOLDER.test(trimmed))
|
|
70
|
+
return true;
|
|
71
|
+
const words = trimmed.replace(STOCK_NUMBER, "").replace(/[-_ .]/gu, "").toLowerCase();
|
|
72
|
+
return words.length > 0 && STOCK_WORDS.test(words);
|
|
73
|
+
}
|
|
74
|
+
const NOT_A_VALUE = /^(?:none|null|nil|true|false|undefined|str|string|int|bool|boolean|bytes|required|optional|read|write|development|production|staging|await|new|async|lambda|function|if|not|return|this|self)$/iu;
|
|
75
|
+
const ENVIRONMENT_NAME = /^[A-Z][A-Z0-9]*(?:_[A-Z0-9]*[A-Z][A-Z0-9]*)+$/u;
|
|
76
|
+
/** `FIGMA_OAUTH_TOKEN`, `S3_ACCESS_KEY`. `A1B2_C3D4_E5F6` reads as a key, not a name. */
|
|
77
|
+
function isEnvironmentName(value) {
|
|
78
|
+
return ENVIRONMENT_NAME.test(value) && value.split("_").filter(part => /[0-9]/u.test(part)).length <= 1;
|
|
79
|
+
}
|
|
80
|
+
const CREDENTIAL_NOUN = /^(?:apikey|key|secret|token|password|passwd|credential|credentials|connectionstring|string|text|auth)$/u;
|
|
81
|
+
/** A name such as `blueprint_secret`, `SendGridApiKey`, or `_credential`: at most
|
|
82
|
+
* three words ending in the kind of thing it holds. Digits and hyphens rule it out. */
|
|
83
|
+
function isVariableName(value) {
|
|
84
|
+
if (!/^_*[A-Za-z][A-Za-z_]*$/u.test(value))
|
|
85
|
+
return false;
|
|
86
|
+
const words = value.replace(/_+/gu, " ").replace(/([a-z])([A-Z])/gu, "$1 $2").toLowerCase()
|
|
87
|
+
.replace(/\bapi key\b/u, "apikey").replace(/\bconnection string\b/u, "connectionstring").trim().split(" ");
|
|
88
|
+
return words.length <= 3 && CREDENTIAL_NOUN.test(words.at(-1) ?? "");
|
|
89
|
+
}
|
|
90
|
+
// `process.env.TOKEN`, `token.Token`, `DefaultAzureCredential()`, `os.environ[`, `Optional[str]`.
|
|
91
|
+
const CODE_EXPRESSION = /^[!&*]?[A-Za-z_$][A-Za-z_$]*(?:(?:\.|::|\?\.|->)[A-Za-z_$][A-Za-z_$]*)*(?:[([<].*|[!?])?$/u;
|
|
92
|
+
const CODE_MEMBER_OR_CALL = /(?:\.|::|\?\.|->|[([<])/u;
|
|
93
|
+
// The tail of `DeveloperToolsCredential::new(None)`: the redactor reads the first colon as a separator.
|
|
94
|
+
const PATH_TAIL = /^:[A-Za-z_]+(?:\(.*)?$/u;
|
|
95
|
+
// After `if not token:` or `Secret:`, the next line is usually code, another key, or a code fence. Anything else may be the value.
|
|
96
|
+
const NEXT_LINE_NOT_A_VALUE = /^(?:(?:raise|try|with|break|continue|return|for|if|else|elif|while|def|class|yield|pass)\b.*|[\w-]+:|`{3}.*)$/u;
|
|
97
|
+
const CODE_ASSIGNMENT = /(?:\$\w+|\b(?:let|const|var)\s+\w+)\s*=\s*$/u;
|
|
98
|
+
/** A quoted argument that could be the secret itself: `AzureKeyCredential("0a1b…")`. */
|
|
99
|
+
function hasSecretLiteral(line) {
|
|
100
|
+
return [...line.matchAll(/["'`]([^"'`\n]+)["'`]/gu)].some(([, literal = ""]) => {
|
|
101
|
+
if (/\s/u.test(literal) || /^[a-z+]+:\/\//u.test(literal) || isPlaceholder(literal))
|
|
102
|
+
return false;
|
|
103
|
+
const classes = [/[a-z]/u, /[A-Z]/u, /[0-9]/u, /[^A-Za-z0-9]/u].filter(kind => kind.test(literal)).length;
|
|
104
|
+
return /[0-9]/u.test(literal) && (literal.length >= 16 ? /[A-Za-z]/u.test(literal) : literal.length >= 8 && classes >= 3);
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
// `The access token is returned`, `API key is invalid`: a state, not a value.
|
|
108
|
+
const PROSE_SEPARATOR = /\s(?:is|was|equals?)\s+["'`]?$/iu;
|
|
109
|
+
const STATE_WORD = /^(?:[a-z]+-)*[a-z]+(?:ed|ing|able|ible)$|^(?:valid|invalid|not|never|only|still|also|now)$/u;
|
|
110
|
+
// `count-correct:token:cited→actual`: a table's notation, read as `token: value`.
|
|
111
|
+
const WORD_ARROW_WORD = /^[a-z]+→[a-z]+$/u;
|
|
112
|
+
// How much of the line after a value is read, so one huge line of values stays linear.
|
|
113
|
+
const MAX_REST = 1000;
|
|
114
|
+
// Parts of an Azure-style connection string that hold no secret.
|
|
115
|
+
const PUBLIC_CONNECTION_PART = /^(?:defaultendpointsprotocol|accountname|endpoint|endpointsuffix|ingestionendpoint|liveendpoint|applicationid|resourceid|sharedaccesskeyname|version|id)$/iu;
|
|
116
|
+
/** The redactor stops a value at `;`, so `AccountName=…` could be followed by a
|
|
117
|
+
* real `AccountKey=…`. Every part up to the next space has to be safe. */
|
|
118
|
+
function isSafeConnectionString(value, rest) {
|
|
119
|
+
if (!/^[A-Za-z]+=/u.test(value))
|
|
120
|
+
return false;
|
|
121
|
+
const tail = /^[^\s"'`]*/u.exec(rest)?.[0] ?? "";
|
|
122
|
+
// Too long to read to its end, so it can't be vouched for.
|
|
123
|
+
if (tail.length >= MAX_REST)
|
|
124
|
+
return false;
|
|
125
|
+
const whole = `${value}${tail}`;
|
|
126
|
+
return whole.split(";").filter(Boolean).every(part => {
|
|
127
|
+
const separator = part.indexOf("=");
|
|
128
|
+
if (separator < 1)
|
|
129
|
+
return false;
|
|
130
|
+
return PUBLIC_CONNECTION_PART.test(part.slice(0, separator)) || isPlaceholder(part.slice(separator + 1));
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
/** `https://jwt.ms`, `postgres://user:pass@host/db`: a URL that holds no real password.
|
|
134
|
+
* A web URL with a path can carry the secret itself, as a webhook does. */
|
|
135
|
+
function isSafeUrl(value) {
|
|
136
|
+
if (/^https?:\/\/[\w.-]+\/?$/u.test(value))
|
|
137
|
+
return true;
|
|
138
|
+
if (/^https?:/u.test(value))
|
|
139
|
+
return false;
|
|
140
|
+
const url = /^[a-z][a-z+]*:\/\/(?:[^:@/\s]*:([^@/\s]+)@)?[^@\s]*$/u.exec(value);
|
|
141
|
+
return url !== null && (url[1] === undefined || isPlaceholder(url[1]));
|
|
142
|
+
}
|
|
143
|
+
const HARD_SECRET = /\[REDACTED:(?:API_KEY|JWT|PRIVATE_KEY|SECRET)\]/u;
|
|
144
|
+
function isSafeCredentialValue(hidden, before, rest, redact) {
|
|
145
|
+
// `${ghp_…}` is a real token inside placeholder syntax.
|
|
146
|
+
if (HARD_SECRET.test(redact(hidden)))
|
|
147
|
+
return false;
|
|
148
|
+
// A listing such as `token: "abc",` hides the quotes along with the value.
|
|
149
|
+
const unquoted = /^(["'])(.*)\1[);,]*$/u.exec(hidden)?.[2];
|
|
150
|
+
if (isPlaceholder(unquoted ?? hidden, rest))
|
|
151
|
+
return true;
|
|
152
|
+
const exact = unquoted ?? hidden;
|
|
153
|
+
const value = exact.replace(/^`+/u, "");
|
|
154
|
+
const word = value.replace(TRAILING_PUNCTUATION, "");
|
|
155
|
+
if (NOT_A_VALUE.test(word) || WORD_ARROW_WORD.test(word) || isEnvironmentName(word) || isVariableName(word) || isSafeUrl(word))
|
|
156
|
+
return true;
|
|
157
|
+
if (isSafeConnectionString(value, rest))
|
|
158
|
+
return true;
|
|
159
|
+
if (/\n\s*$/u.test(before) && (NEXT_LINE_NOT_A_VALUE.test(exact) || /^\s*=/u.test(rest)))
|
|
160
|
+
return true;
|
|
161
|
+
if (PROSE_SEPARATOR.test(before))
|
|
162
|
+
return STATE_WORD.test(word);
|
|
163
|
+
if (unquoted !== undefined || /["'`]$/u.test(before) || hasSecretLiteral(rest))
|
|
164
|
+
return false;
|
|
165
|
+
return (CODE_ASSIGNMENT.test(before) && !/\d/u.test(word)) || PATH_TAIL.test(word) || (CODE_EXPRESSION.test(word) && CODE_MEMBER_OR_CALL.test(word));
|
|
166
|
+
}
|
|
167
|
+
const AUTHORIZATION_LABEL = /auth(?:orization)?["'`]?\s*[:=]\s*["'`]?$/iu;
|
|
168
|
+
function isSafeAuthorization(hidden, before) {
|
|
169
|
+
// A Cookie header is always name=value; `cookie: { secure }` is an options object.
|
|
170
|
+
if (/cookie\s*:\s*$/iu.test(before))
|
|
171
|
+
return !hidden.includes("=") && !/^\S{16,}$/u.test(hidden.trim());
|
|
172
|
+
const token = /^(?:bearer|basic)\s+(\S+)$/iu.exec(hidden)?.[1];
|
|
173
|
+
if (token === undefined)
|
|
174
|
+
return false;
|
|
175
|
+
if (isPlaceholder(token.replace(/[,;"'`]+$/u, "")))
|
|
176
|
+
return true;
|
|
177
|
+
// A header says what follows it is a credential, however readable.
|
|
178
|
+
return !AUTHORIZATION_LABEL.test(before) && (isProseWord(token) || isHeadingWord(token));
|
|
179
|
+
}
|
|
180
|
+
// An SVG path's letters are all drawing commands; a random token's almost never are.
|
|
181
|
+
const SVG_PATH = /^[MmLlHhVvCcSsQqTtAaZz0-9.-]+$/u;
|
|
182
|
+
/** `eyJoYXNTZXNzaW9uIjpmYWxzZX0` is `{"hasSession":false}`: base64 JSON holding only flags and numbers. */
|
|
183
|
+
function isEncodedFlags(hidden) {
|
|
184
|
+
if (!/^eyJ[A-Za-z0-9_-]+={0,2}$/u.test(hidden))
|
|
185
|
+
return false;
|
|
186
|
+
try {
|
|
187
|
+
const decoded = JSON.parse(Buffer.from(hidden, "base64url").toString("utf8"));
|
|
188
|
+
return typeof decoded === "object" && decoded !== null && Object.values(decoded).every(value => typeof value === "boolean" || typeof value === "number");
|
|
189
|
+
}
|
|
190
|
+
catch {
|
|
191
|
+
return false;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
// `sk-xxxxxxxxxxxx`: a provider prefix over a masked tail.
|
|
195
|
+
const MASKED_PROVIDER_TOKEN = /^[A-Za-z_-]*[-_][xX*]{8,}$/u;
|
|
196
|
+
function isSafeHiddenText(kind, hidden, before, rest, redact) {
|
|
197
|
+
if (/^\[REDACTED(?::[A-Z_]+|_[A-Z_]+)?\]$/u.test(hidden))
|
|
198
|
+
return true;
|
|
199
|
+
if (kind === "AUTHORIZATION")
|
|
200
|
+
return isSafeAuthorization(hidden, before);
|
|
201
|
+
if (kind === "CREDENTIAL")
|
|
202
|
+
return isSafeCredentialValue(hidden, before, rest, redact);
|
|
203
|
+
if (kind === "PASSWORD")
|
|
204
|
+
return isPlaceholder(hidden);
|
|
205
|
+
if (kind === "API_KEY")
|
|
206
|
+
return MASKED_PROVIDER_TOKEN.test(hidden);
|
|
207
|
+
if (kind === "SECRET")
|
|
208
|
+
return SVG_PATH.test(hidden) || isEncodedFlags(hidden);
|
|
209
|
+
return false;
|
|
210
|
+
}
|
|
211
|
+
// The redactor rewrites "Bearer<space>token", so the scheme counts as part of what it hid.
|
|
212
|
+
const MARKER = /(?:\b(?:bearer|basic) (?=\[REDACTED:AUTHORIZATION\]))?\[REDACTED:([A-Z_]+)\]/giu;
|
|
213
|
+
/** Walk the redacted text against the original and restore each stretch it hid
|
|
214
|
+
* that is safe. Undefined when the two can't be lined up, so nothing is restored. */
|
|
215
|
+
function restoreSafeText(text, redacted, redact) {
|
|
216
|
+
const parts = [];
|
|
217
|
+
let from = 0, written = 0, kind, marker = "";
|
|
218
|
+
const settle = (end) => {
|
|
219
|
+
if (kind === undefined)
|
|
220
|
+
return "";
|
|
221
|
+
const hidden = text.slice(from, end);
|
|
222
|
+
return isSafeHiddenText(kind, hidden, text.slice(Math.max(0, from - 80), from), text.slice(end, end + MAX_REST).split("\n", 1)[0], redact) ? hidden : marker;
|
|
223
|
+
};
|
|
224
|
+
for (const match of redacted.matchAll(MARKER)) {
|
|
225
|
+
const literal = redacted.slice(written, match.index);
|
|
226
|
+
const at = text.indexOf(literal, from);
|
|
227
|
+
if (at < 0 || (kind === undefined && at !== from))
|
|
228
|
+
return undefined;
|
|
229
|
+
parts.push(settle(at), literal);
|
|
230
|
+
from = at + literal.length;
|
|
231
|
+
written = match.index + match[0].length;
|
|
232
|
+
kind = match[1];
|
|
233
|
+
marker = match[0];
|
|
234
|
+
}
|
|
235
|
+
const tail = redacted.slice(written);
|
|
236
|
+
if (!text.endsWith(tail) || text.length - tail.length < from)
|
|
237
|
+
return undefined;
|
|
238
|
+
parts.push(settle(text.length - tail.length), tail);
|
|
239
|
+
return parts.join("");
|
|
240
|
+
}
|
|
241
|
+
// Inline images and fonts are base64 by design, and a timestamp's "T" reads as mixed case to the redactor.
|
|
242
|
+
const BINARY_DATA_URI = /\bdata:(?:(?:image|font|audio|video)\/[\w.+-]+|application\/(?:pdf|(?:x-)?font-[\w.+-]+))(?:;[\w=.-]+)*;base64,[A-Za-z0-9+/]+={0,2}/gu;
|
|
243
|
+
const TIMESTAMP = /\b\d{4}-\d{2}-\d{2}T\d{2}[-:]\d{2}(?:[-:]\d{2}(?:\.\d+)?)?Z?\b/gu;
|
|
244
|
+
// Stands in for what's set aside, long enough that `password=<date>` is still hidden as a value.
|
|
245
|
+
const SET_ASIDE = /\uE000(?:data|date)(\d+)\uE001/gu;
|
|
246
|
+
/**
|
|
247
|
+
* Skill text with every real-looking secret hidden and everything else exact. It
|
|
248
|
+
* doesn't matter when a skill was added or what the check was then: this judges
|
|
249
|
+
* the text as it stands, with the redactor as it stands. Unchanged text means the
|
|
250
|
+
* skill holds no credential, so importing and delivering always agree.
|
|
251
|
+
*/
|
|
252
|
+
export function maskSkillSecrets(text, redact) {
|
|
253
|
+
const saved = [];
|
|
254
|
+
const setAside = (kind) => (value) => `\uE000${kind}${saved.push(value) - 1}\uE001`;
|
|
255
|
+
// Text that already holds the stand-in characters is judged as it is, which only hides more.
|
|
256
|
+
const checked = text.includes("\uE000") ? text : text.replace(BINARY_DATA_URI, setAside("data")).replace(TIMESTAMP, setAside("date"));
|
|
257
|
+
const redacted = redact(checked);
|
|
258
|
+
if (redacted === checked)
|
|
259
|
+
return text;
|
|
260
|
+
const masked = restoreSafeText(checked, redacted, redact) ?? redacted;
|
|
261
|
+
return saved.length ? masked.replace(SET_ASIDE, (standIn, index) => saved[Number(index)] ?? standIn) : masked;
|
|
262
|
+
}
|
|
263
|
+
//# sourceMappingURL=skill-secrets.js.map
|
|
@@ -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C,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;AACxH,CAAC"}
|
package/dist/skills.d.ts
CHANGED
|
@@ -31,30 +31,49 @@ export declare const SkillDocumentSchema: z.ZodObject<{
|
|
|
31
31
|
}, z.core.$strict>;
|
|
32
32
|
export type SkillDocument = z.infer<typeof SkillDocumentSchema>;
|
|
33
33
|
export type SkillSource = z.infer<typeof SkillSourceSchema>;
|
|
34
|
-
export declare const MAX_SKILL_FILES =
|
|
34
|
+
export declare const MAX_SKILL_FILES = 500;
|
|
35
35
|
export declare const MAX_SKILL_FILE_BYTES: number;
|
|
36
36
|
export declare const MAX_SKILL_FOLDER_BYTES: number;
|
|
37
|
+
/** Room for a full skill folder as JSON: base64 and escaping make it larger than its files. */
|
|
38
|
+
export declare const MAX_SKILL_RESPONSE_BYTES: number;
|
|
39
|
+
export type SkillMediaKind = "image" | "font" | "pdf";
|
|
40
|
+
/** Whether a supporting file is an image, font, or PDF, by its name. */
|
|
41
|
+
export declare function skillMediaKind(path: string): SkillMediaKind | undefined;
|
|
42
|
+
export declare function encodeBase64(bytes: Uint8Array): string;
|
|
43
|
+
export declare function decodeBase64(text: string): Uint8Array;
|
|
37
44
|
/** Folders never imported with a skill, matching local SKILL.md discovery. */
|
|
38
45
|
export declare const SKIPPED_SKILL_FOLDERS: ReadonlySet<string>;
|
|
39
46
|
export declare const SkillFilePathSchema: z.ZodString;
|
|
40
47
|
export declare const SkillFileSchema: z.ZodObject<{
|
|
41
48
|
path: z.ZodString;
|
|
42
49
|
content: z.ZodString;
|
|
50
|
+
encoding: z.ZodOptional<z.ZodLiteral<"base64">>;
|
|
43
51
|
}, z.core.$strict>;
|
|
52
|
+
export type SkillFile = z.infer<typeof SkillFileSchema>;
|
|
53
|
+
/** The size of a supporting file on disk. */
|
|
54
|
+
export declare const skillFileBytes: (file: SkillFile) => number;
|
|
44
55
|
export declare const SkillFilesSchema: z.ZodArray<z.ZodObject<{
|
|
45
56
|
path: z.ZodString;
|
|
46
57
|
content: z.ZodString;
|
|
58
|
+
encoding: z.ZodOptional<z.ZodLiteral<"base64">>;
|
|
47
59
|
}, z.core.$strict>>;
|
|
48
|
-
export type SkillFile = z.infer<typeof SkillFileSchema>;
|
|
49
60
|
export declare const SkillFileEntrySchema: z.ZodObject<{
|
|
50
61
|
path: z.ZodString;
|
|
51
62
|
content: z.ZodString;
|
|
63
|
+
encoding: z.ZodOptional<z.ZodLiteral<"base64">>;
|
|
52
64
|
bytes: z.ZodNumber;
|
|
53
65
|
script: z.ZodBoolean;
|
|
54
66
|
}, z.core.$strict>;
|
|
55
67
|
export type SkillFileEntry = z.infer<typeof SkillFileEntrySchema>;
|
|
56
68
|
/** Code an agent could run. Shown to reviewers; Lore itself never runs it. */
|
|
57
69
|
export declare function isSkillScript(path: string, content: string): boolean;
|
|
70
|
+
/** Over what fit in a skill before Lore 0.2.39: 100 files, 2 MB in total. */
|
|
71
|
+
export declare function isLargeSkill(files: readonly SkillFile[]): boolean;
|
|
72
|
+
/** Clients before Lore 0.2.39 refuse a response with images, fonts, or PDFs, a
|
|
73
|
+
* file over 256 KB, or more than 8 MB in all. They're asked to update instead. */
|
|
74
|
+
export declare function needsCurrentSkillClient(files: readonly SkillFile[]): boolean;
|
|
75
|
+
/** The files to send or store, without the sizes and labels shown for review. */
|
|
76
|
+
export declare function skillFilesOf(entries: readonly SkillFileEntry[]): SkillFile[];
|
|
58
77
|
export declare function skillFileEntries(files: readonly SkillFile[]): SkillFileEntry[];
|
|
59
78
|
/** One digest for SKILL.md and every supporting file, so a review covers the
|
|
60
79
|
* whole folder. A skill without files keeps the SKILL.md digest it had before. */
|
|
@@ -68,10 +87,11 @@ export interface SkillFolderEntry {
|
|
|
68
87
|
/** Paths a folder import leaves out: hidden files, build output, and nested skills. */
|
|
69
88
|
export declare function skippedSkillPath(path: string, nestedSkillFolders?: readonly string[]): boolean;
|
|
70
89
|
/** Choose the files beside SKILL.md to import, before reading any of them, or
|
|
71
|
-
* name
|
|
72
|
-
* folders holding their own SKILL.md (another skill) are left out. */
|
|
90
|
+
* name every problem that stops the import at once. Only hidden files, build
|
|
91
|
+
* output, and folders holding their own SKILL.md (another skill) are left out. */
|
|
73
92
|
export declare function selectSkillFolder(entries: readonly SkillFolderEntry[]): string[];
|
|
74
|
-
/**
|
|
93
|
+
/** Read the selected files: text as text, images, fonts, and PDFs as base64.
|
|
94
|
+
* Anything else stops the import by name. */
|
|
75
95
|
export declare function readSkillFolder(files: readonly {
|
|
76
96
|
path: string;
|
|
77
97
|
bytes: Uint8Array;
|
|
@@ -209,6 +229,7 @@ export declare const PreviewSkillSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
209
229
|
files: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
210
230
|
path: z.ZodString;
|
|
211
231
|
content: z.ZodString;
|
|
232
|
+
encoding: z.ZodOptional<z.ZodLiteral<"base64">>;
|
|
212
233
|
}, z.core.$strict>>>;
|
|
213
234
|
}, z.core.$strict>]>;
|
|
214
235
|
export declare const PreviewSkillResponseSchema: z.ZodObject<{
|
|
@@ -231,6 +252,7 @@ export declare const PreviewSkillResponseSchema: z.ZodObject<{
|
|
|
231
252
|
files: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
232
253
|
path: z.ZodString;
|
|
233
254
|
content: z.ZodString;
|
|
255
|
+
encoding: z.ZodOptional<z.ZodLiteral<"base64">>;
|
|
234
256
|
bytes: z.ZodNumber;
|
|
235
257
|
script: z.ZodBoolean;
|
|
236
258
|
}, z.core.$strict>>>;
|
|
@@ -250,6 +272,7 @@ export declare const ImportSkillSchema: z.ZodObject<{
|
|
|
250
272
|
files: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
251
273
|
path: z.ZodString;
|
|
252
274
|
content: z.ZodString;
|
|
275
|
+
encoding: z.ZodOptional<z.ZodLiteral<"base64">>;
|
|
253
276
|
}, z.core.$strict>>>;
|
|
254
277
|
}, z.core.$strict>;
|
|
255
278
|
/**
|
|
@@ -271,6 +294,7 @@ export declare const UpdateSkillSchema: z.ZodObject<{
|
|
|
271
294
|
files: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
272
295
|
path: z.ZodString;
|
|
273
296
|
content: z.ZodString;
|
|
297
|
+
encoding: z.ZodOptional<z.ZodLiteral<"base64">>;
|
|
274
298
|
}, z.core.$strict>>>;
|
|
275
299
|
expectedVersion: z.ZodNumber;
|
|
276
300
|
}, z.core.$strict>;
|
|
@@ -292,6 +316,7 @@ export declare const SkillFilesResponseSchema: z.ZodObject<{
|
|
|
292
316
|
files: z.ZodArray<z.ZodObject<{
|
|
293
317
|
path: z.ZodString;
|
|
294
318
|
content: z.ZodString;
|
|
319
|
+
encoding: z.ZodOptional<z.ZodLiteral<"base64">>;
|
|
295
320
|
bytes: z.ZodNumber;
|
|
296
321
|
script: z.ZodBoolean;
|
|
297
322
|
}, z.core.$strict>>;
|
|
@@ -305,6 +330,10 @@ export declare const SetSkillEnabledSchema: z.ZodObject<{
|
|
|
305
330
|
export declare const SkillScopeSchema: z.ZodObject<{
|
|
306
331
|
repo: z.ZodOptional<z.ZodString>;
|
|
307
332
|
}, z.core.$strict>;
|
|
333
|
+
export declare const SkillFilesQuerySchema: z.ZodObject<{
|
|
334
|
+
repo: z.ZodOptional<z.ZodString>;
|
|
335
|
+
include: z.ZodOptional<z.ZodLiteral<"all">>;
|
|
336
|
+
}, z.core.$strict>;
|
|
308
337
|
export declare const SkillParamsSchema: z.ZodObject<{
|
|
309
338
|
name: z.ZodString;
|
|
310
339
|
}, z.core.$strict>;
|