@opengeni/runtime 2.4.3 → 2.5.1-canary.0
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/{agent-UA75SUZ7.js → agent-Q2VNH5FV.js} +2 -2
- package/dist/{chunk-ORKCCH5X.js → chunk-25B3EQRW.js} +3 -398
- package/dist/{chunk-ORKCCH5X.js.map → chunk-25B3EQRW.js.map} +1 -1
- package/dist/{chunk-BV2DSPZK.js → chunk-26GUTY32.js} +267 -181
- package/dist/chunk-26GUTY32.js.map +1 -0
- package/dist/{chunk-YRKIQK25.js → chunk-CD22I76N.js} +2 -2
- package/dist/{chunk-7K6WOXFS.js → chunk-GB763TSV.js} +17 -1
- package/dist/chunk-GB763TSV.js.map +1 -0
- package/dist/{chunk-WATBACLT.js → chunk-LGLJ5PVD.js} +5 -88
- package/dist/chunk-LGLJ5PVD.js.map +1 -0
- package/dist/index.d.ts +12 -5
- package/dist/index.js +11 -5
- package/dist/{localSources-GDQRRHT3.js → localSources-Z5IJIIRV.js} +3 -3
- package/dist/model-input.d.ts +2 -1
- package/dist/runtime-skills.d.ts +28 -5
- package/dist/sandbox/index.js +3 -3
- package/dist/skill-files.d.ts +4 -0
- package/dist/skill-library.d.ts +1 -1
- package/dist/skill-library.js +3 -1
- package/dist/workspace-tool-gateway.js +5 -5
- package/package.json +11 -11
- package/src/bundled_management_skills/opengeni-skills/SKILL.md +3 -1
- package/src/index.ts +184 -33
- package/src/lazy-tool-transport.ts +0 -3
- package/src/model-input.ts +1 -1
- package/src/run-events.ts +23 -0
- package/src/runtime-skills.ts +122 -161
- package/src/sandbox/routing/routing-session.ts +1 -1
- package/src/skill-files.ts +20 -0
- package/src/skill-library.ts +1 -0
- package/dist/chunk-7K6WOXFS.js.map +0 -1
- package/dist/chunk-BV2DSPZK.js.map +0 -1
- package/dist/chunk-WATBACLT.js.map +0 -1
- /package/dist/{agent-UA75SUZ7.js.map → agent-Q2VNH5FV.js.map} +0 -0
- /package/dist/{chunk-YRKIQK25.js.map → chunk-CD22I76N.js.map} +0 -0
- /package/dist/{localSources-GDQRRHT3.js.map → localSources-Z5IJIIRV.js.map} +0 -0
package/src/runtime-skills.ts
CHANGED
|
@@ -1,29 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
cpSync,
|
|
3
|
-
existsSync,
|
|
4
|
-
mkdirSync,
|
|
5
|
-
readdirSync,
|
|
6
|
-
readFileSync,
|
|
7
|
-
renameSync,
|
|
8
|
-
rmSync,
|
|
9
|
-
} from "node:fs";
|
|
1
|
+
import { existsSync, readdirSync } from "node:fs";
|
|
10
2
|
import { sitePackageVersions } from "./site-package-versions";
|
|
11
|
-
import { dirname,
|
|
3
|
+
import { dirname, join } from "node:path";
|
|
12
4
|
import { fileURLToPath } from "node:url";
|
|
13
5
|
import { readSkillMetadata } from "@opengeni/contracts";
|
|
14
6
|
|
|
15
|
-
import { localDirLazySkillSource } from "@openai/agents/sandbox/local";
|
|
16
7
|
import {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
type SkillIndexEntry,
|
|
24
|
-
} from "@openai/agents/sandbox";
|
|
25
|
-
|
|
26
|
-
import { buildPortableSkillArtifact, readSkillLibraryArtifact } from "./skill-library";
|
|
8
|
+
PORTABLE_SKILL_MAX_FILES,
|
|
9
|
+
buildPortableSkillArtifact,
|
|
10
|
+
readSkillLibraryArtifact,
|
|
11
|
+
} from "./skill-library";
|
|
12
|
+
import { SkillFileError, listSkillPaths, readSkillFiles } from "./skill-files";
|
|
13
|
+
import type { SkillCatalogDescriptor } from "./skill-catalog";
|
|
27
14
|
|
|
28
15
|
export type RuntimeSkillArtifactFile = Readonly<{
|
|
29
16
|
path: string;
|
|
@@ -84,13 +71,28 @@ export type EffectiveSkillSelection = Readonly<{
|
|
|
84
71
|
reason: string;
|
|
85
72
|
}>;
|
|
86
73
|
|
|
74
|
+
export type RuntimeSkillReadable = Readonly<{
|
|
75
|
+
id: string;
|
|
76
|
+
name: string;
|
|
77
|
+
description: string;
|
|
78
|
+
files: readonly RuntimeSkillArtifactFile[];
|
|
79
|
+
}>;
|
|
80
|
+
|
|
87
81
|
export type RuntimeSkillComposition = Readonly<{
|
|
88
|
-
lazySource: LocalDirLazySkillSource;
|
|
89
82
|
selections: readonly EffectiveSkillSelection[];
|
|
90
83
|
/** Exact always-visible catalog descriptors for explicitly activated Skills. */
|
|
91
84
|
configuredDescriptors: readonly RuntimeSkillDescriptor[];
|
|
92
85
|
configuredNames: readonly string[];
|
|
93
86
|
nativeToolNames: readonly string[];
|
|
87
|
+
/** Model-facing catalog descriptors for configured and bundled Skills. */
|
|
88
|
+
index: readonly RuntimeSkillIndexEntry[];
|
|
89
|
+
artifacts: readonly RuntimeSkillReadable[];
|
|
90
|
+
}>;
|
|
91
|
+
|
|
92
|
+
export type RuntimeSkillIndexEntry = Readonly<{
|
|
93
|
+
id: string;
|
|
94
|
+
name: string;
|
|
95
|
+
description: string;
|
|
94
96
|
}>;
|
|
95
97
|
|
|
96
98
|
export type RuntimeSkillDescriptor = Readonly<{
|
|
@@ -101,6 +103,12 @@ export type RuntimeSkillDescriptor = Readonly<{
|
|
|
101
103
|
description: string;
|
|
102
104
|
}>;
|
|
103
105
|
|
|
106
|
+
export type RuntimeSkillReadRequest = Readonly<{
|
|
107
|
+
skill: string;
|
|
108
|
+
paths?: readonly string[];
|
|
109
|
+
listFiles?: boolean;
|
|
110
|
+
}>;
|
|
111
|
+
|
|
104
112
|
type ValidatedRuntimeSkillActivation = Readonly<{
|
|
105
113
|
activation: RuntimeSkillActivation;
|
|
106
114
|
contentSha256: string;
|
|
@@ -144,16 +152,11 @@ export function loadNativeToolSkillArtifacts(
|
|
|
144
152
|
});
|
|
145
153
|
}
|
|
146
154
|
|
|
147
|
-
let stagedBundledArtifactSkillsDir: string | null = null;
|
|
148
|
-
let stagedBundledVideoSkillsDir: string | null = null;
|
|
149
|
-
|
|
150
155
|
/**
|
|
151
156
|
* Compose the exact Skills surface for one agent.
|
|
152
|
-
*
|
|
153
157
|
* Optional/domain Skills enter only through explicit activations. Native
|
|
154
158
|
* Skills are admitted only with the exact executable tool surface they
|
|
155
|
-
* document.
|
|
156
|
-
* provenance so those projections cannot disagree.
|
|
159
|
+
* document. The result is an in-memory catalog and file set, not an SDK loader.
|
|
157
160
|
*/
|
|
158
161
|
export function composeRuntimeSkills(
|
|
159
162
|
activations: readonly RuntimeSkillActivation[],
|
|
@@ -167,39 +170,52 @@ export function composeRuntimeSkills(
|
|
|
167
170
|
activations.map(validateRuntimeSkillActivation),
|
|
168
171
|
nativeNameKeys,
|
|
169
172
|
);
|
|
170
|
-
const
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
for (const source of nativeSources) {
|
|
175
|
-
for (const name of source.names) {
|
|
176
|
-
children[name] = source.entries?.[name] ?? localDir({ src: join(source.directory, name) });
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
const activationIndex: SkillIndexEntry[] = [];
|
|
181
|
-
for (const { activation } of effectiveActivations) {
|
|
182
|
-
const { artifact } = activation;
|
|
183
|
-
children[artifact.name] = runtimeSkillDirEntry(artifact);
|
|
184
|
-
activationIndex.push({
|
|
173
|
+
const nativeArtifacts = loadNativeToolSkillArtifacts(nativeTools);
|
|
174
|
+
const nativeReadables: RuntimeSkillReadable[] = nativeArtifacts.map((artifact) =>
|
|
175
|
+
Object.freeze({
|
|
176
|
+
id: `native-tool:${artifact.name}`,
|
|
185
177
|
name: artifact.name,
|
|
186
178
|
description: runtimeSkillDescription(artifact),
|
|
187
|
-
|
|
188
|
-
})
|
|
189
|
-
|
|
179
|
+
files: artifact.files,
|
|
180
|
+
}),
|
|
181
|
+
);
|
|
182
|
+
const configuredDescriptors = Object.freeze(
|
|
183
|
+
effectiveActivations.map(({ activation }) =>
|
|
184
|
+
Object.freeze({
|
|
185
|
+
id: activation.id,
|
|
186
|
+
name: activation.artifact.name,
|
|
187
|
+
source: activation.source,
|
|
188
|
+
reason: activation.reason,
|
|
189
|
+
description: runtimeSkillDescription(activation.artifact),
|
|
190
|
+
}),
|
|
191
|
+
),
|
|
192
|
+
);
|
|
193
|
+
const configuredReadables: RuntimeSkillReadable[] = effectiveActivations.map(({ activation }) =>
|
|
194
|
+
Object.freeze({
|
|
195
|
+
id: activation.id,
|
|
196
|
+
name: activation.artifact.name,
|
|
197
|
+
description: runtimeSkillDescription(activation.artifact),
|
|
198
|
+
files: activation.artifact.files,
|
|
199
|
+
}),
|
|
200
|
+
);
|
|
201
|
+
const index = Object.freeze([
|
|
202
|
+
...nativeReadables.map((artifact) =>
|
|
203
|
+
Object.freeze({
|
|
204
|
+
id: artifact.id,
|
|
205
|
+
name: artifact.name,
|
|
206
|
+
description: artifact.description,
|
|
207
|
+
}),
|
|
208
|
+
),
|
|
209
|
+
...configuredDescriptors.map((descriptor) =>
|
|
210
|
+
Object.freeze({
|
|
211
|
+
id: descriptor.id,
|
|
212
|
+
name: descriptor.name,
|
|
213
|
+
description: descriptor.description,
|
|
214
|
+
}),
|
|
215
|
+
),
|
|
216
|
+
]);
|
|
190
217
|
|
|
191
218
|
return Object.freeze({
|
|
192
|
-
lazySource: {
|
|
193
|
-
source: dir({ children }),
|
|
194
|
-
getIndex: (manifest, skillsPath) => [
|
|
195
|
-
...nativeSources.flatMap((source) =>
|
|
196
|
-
(source.lazySource.getIndex?.(manifest, skillsPath) ?? []).filter(
|
|
197
|
-
(entry) => !activatedNameKeys.has((entry.path ?? entry.name).toLowerCase()),
|
|
198
|
-
),
|
|
199
|
-
),
|
|
200
|
-
...activationIndex,
|
|
201
|
-
],
|
|
202
|
-
},
|
|
203
219
|
selections: Object.freeze([
|
|
204
220
|
...nativeSources.flatMap((source) =>
|
|
205
221
|
source.names.map((name) =>
|
|
@@ -215,24 +231,58 @@ export function composeRuntimeSkills(
|
|
|
215
231
|
),
|
|
216
232
|
...effectiveActivations.map((activation) => selectionForActivation(activation)),
|
|
217
233
|
]),
|
|
218
|
-
configuredDescriptors
|
|
219
|
-
effectiveActivations.map(({ activation }) =>
|
|
220
|
-
Object.freeze({
|
|
221
|
-
id: activation.id,
|
|
222
|
-
name: activation.artifact.name,
|
|
223
|
-
source: activation.source,
|
|
224
|
-
reason: activation.reason,
|
|
225
|
-
description: runtimeSkillDescription(activation.artifact),
|
|
226
|
-
}),
|
|
227
|
-
),
|
|
228
|
-
),
|
|
234
|
+
configuredDescriptors,
|
|
229
235
|
configuredNames: Object.freeze(
|
|
230
236
|
effectiveActivations.map(({ activation }) => activation.artifact.name),
|
|
231
237
|
),
|
|
232
238
|
nativeToolNames: Object.freeze([...nativeSources.flatMap((source) => source.names)]),
|
|
239
|
+
index,
|
|
240
|
+
artifacts: Object.freeze([...nativeReadables, ...configuredReadables]),
|
|
233
241
|
});
|
|
234
242
|
}
|
|
235
243
|
|
|
244
|
+
export function skillCatalogFromComposition(
|
|
245
|
+
composition: RuntimeSkillComposition,
|
|
246
|
+
): readonly SkillCatalogDescriptor[] {
|
|
247
|
+
return composition.index;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
export function readRuntimeSkill(
|
|
251
|
+
composition: RuntimeSkillComposition,
|
|
252
|
+
request: RuntimeSkillReadRequest,
|
|
253
|
+
): { skillId: string; files?: ReturnType<typeof readSkillFiles>["files"]; paths?: string[] } {
|
|
254
|
+
const skill = request.skill.trim();
|
|
255
|
+
if (!skill)
|
|
256
|
+
throw new SkillFileError("invalid_request", "skill_read requires a Skill identifier.");
|
|
257
|
+
if (request.listFiles === true && request.paths !== undefined) {
|
|
258
|
+
throw new SkillFileError(
|
|
259
|
+
"invalid_request",
|
|
260
|
+
"skill_read listFiles:true cannot be combined with paths.",
|
|
261
|
+
);
|
|
262
|
+
}
|
|
263
|
+
const exact = composition.artifacts.find((artifact) => artifact.id === skill);
|
|
264
|
+
const matches = exact
|
|
265
|
+
? [exact]
|
|
266
|
+
: composition.artifacts.filter((artifact) => artifact.name === skill);
|
|
267
|
+
if (matches.length === 0) {
|
|
268
|
+
throw new SkillFileError("missing_file", `Skill not found: ${skill}`);
|
|
269
|
+
}
|
|
270
|
+
if (matches.length > 1) {
|
|
271
|
+
throw new SkillFileError(
|
|
272
|
+
"invalid_request",
|
|
273
|
+
`Skill name is ambiguous: ${skill}. Use the catalog id.`,
|
|
274
|
+
);
|
|
275
|
+
}
|
|
276
|
+
const artifact = matches[0]!;
|
|
277
|
+
if (request.listFiles === true) {
|
|
278
|
+
return { skillId: artifact.id, ...listSkillPaths(artifact.files, PORTABLE_SKILL_MAX_FILES) };
|
|
279
|
+
}
|
|
280
|
+
return {
|
|
281
|
+
skillId: artifact.id,
|
|
282
|
+
files: readSkillFiles(artifact.files, request.paths).files,
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
|
|
236
286
|
function resolveEffectiveActivations(
|
|
237
287
|
activations: readonly ValidatedRuntimeSkillActivation[],
|
|
238
288
|
nativeNameKeys: ReadonlySet<string>,
|
|
@@ -331,47 +381,25 @@ function selectionForActivation({
|
|
|
331
381
|
}
|
|
332
382
|
|
|
333
383
|
function nativeToolSkillSources(nativeTools: NativeToolSkillSet): Array<{
|
|
334
|
-
directory: string;
|
|
335
|
-
entries?: Record<string, Entry>;
|
|
336
|
-
lazySource: LocalDirLazySkillSource;
|
|
337
384
|
names: string[];
|
|
338
385
|
reason: string;
|
|
339
386
|
}> {
|
|
340
|
-
const sources: Array<{
|
|
341
|
-
directory: string;
|
|
342
|
-
entries?: Record<string, Entry>;
|
|
343
|
-
lazySource: LocalDirLazySkillSource;
|
|
344
|
-
names: string[];
|
|
345
|
-
reason: string;
|
|
346
|
-
}> = [];
|
|
387
|
+
const sources: Array<{ names: string[]; reason: string }> = [];
|
|
347
388
|
if (nativeTools.editableArtifacts) {
|
|
348
|
-
const directory = bundledArtifactSkillsDir();
|
|
349
389
|
sources.push({
|
|
350
|
-
|
|
351
|
-
lazySource: localDirLazySkillSource({ src: directory }),
|
|
352
|
-
names: skillDirNames(directory),
|
|
390
|
+
names: skillDirNames(packagedSkillDirectory("bundled_artifact_skills")),
|
|
353
391
|
reason: "native editable-artifact tool surface",
|
|
354
392
|
});
|
|
355
393
|
}
|
|
356
394
|
if (nativeTools.sites) {
|
|
357
|
-
const directory = packagedSkillDirectory("bundled_site_skills");
|
|
358
|
-
const site = bundledSkillEntry(join(directory, "opengeni-sites"), {
|
|
359
|
-
"package-versions.json": file({ content: JSON.stringify(sitePackageVersions(), null, 2) }),
|
|
360
|
-
});
|
|
361
395
|
sources.push({
|
|
362
|
-
|
|
363
|
-
entries: { "opengeni-sites": site },
|
|
364
|
-
lazySource: localDirLazySkillSource({ src: directory, baseDir: directory }),
|
|
365
|
-
names: skillDirNames(directory),
|
|
396
|
+
names: skillDirNames(packagedSkillDirectory("bundled_site_skills")),
|
|
366
397
|
reason: "bundled Site authoring skill",
|
|
367
398
|
});
|
|
368
399
|
}
|
|
369
400
|
if (nativeTools.videoGeneration) {
|
|
370
|
-
const directory = bundledVideoSkillsDir();
|
|
371
401
|
sources.push({
|
|
372
|
-
|
|
373
|
-
lazySource: localDirLazySkillSource({ src: directory }),
|
|
374
|
-
names: skillDirNames(directory),
|
|
402
|
+
names: skillDirNames(packagedSkillDirectory("bundled_video_skills")),
|
|
375
403
|
reason: "native video-generation tool surface",
|
|
376
404
|
});
|
|
377
405
|
}
|
|
@@ -389,62 +417,6 @@ function packagedSkillDirectory(directoryName: string): string {
|
|
|
389
417
|
);
|
|
390
418
|
}
|
|
391
419
|
|
|
392
|
-
function bundledArtifactSkillsDir(): string {
|
|
393
|
-
const packaged = packagedSkillDirectory("bundled_artifact_skills");
|
|
394
|
-
if (isPathWithin(process.cwd(), packaged)) return packaged;
|
|
395
|
-
if (!stagedBundledArtifactSkillsDir) {
|
|
396
|
-
stagedBundledArtifactSkillsDir = stageSkillDirectory(
|
|
397
|
-
packaged,
|
|
398
|
-
join(process.cwd(), ".opengeni", "bundled_artifact_skills"),
|
|
399
|
-
);
|
|
400
|
-
}
|
|
401
|
-
return stagedBundledArtifactSkillsDir;
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
/** Compose generated metadata in the manifest, never in the installed application. */
|
|
405
|
-
function bundledSkillEntry(directory: string, overrides: Record<string, Entry> = {}): Dir {
|
|
406
|
-
const children: Record<string, Entry> = {};
|
|
407
|
-
for (const entry of readdirSync(directory, { withFileTypes: true })) {
|
|
408
|
-
const path = join(directory, entry.name);
|
|
409
|
-
children[entry.name] = entry.isDirectory()
|
|
410
|
-
? bundledSkillEntry(path)
|
|
411
|
-
: file({ content: readFileSync(path, "utf8") });
|
|
412
|
-
}
|
|
413
|
-
return dir({ children: { ...children, ...overrides } });
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
function bundledVideoSkillsDir(): string {
|
|
417
|
-
const packaged = packagedSkillDirectory("bundled_video_skills");
|
|
418
|
-
if (isPathWithin(process.cwd(), packaged)) return packaged;
|
|
419
|
-
if (!stagedBundledVideoSkillsDir) {
|
|
420
|
-
stagedBundledVideoSkillsDir = stageSkillDirectory(
|
|
421
|
-
packaged,
|
|
422
|
-
join(process.cwd(), ".opengeni", "bundled_video_skills"),
|
|
423
|
-
);
|
|
424
|
-
}
|
|
425
|
-
return stagedBundledVideoSkillsDir;
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
function stageSkillDirectory(packaged: string, target: string): string {
|
|
429
|
-
const temporary = `${target}.tmp-${process.pid}`;
|
|
430
|
-
rmSync(temporary, { recursive: true, force: true });
|
|
431
|
-
mkdirSync(dirname(temporary), { recursive: true });
|
|
432
|
-
cpSync(packaged, temporary, { recursive: true });
|
|
433
|
-
rmSync(target, { recursive: true, force: true });
|
|
434
|
-
try {
|
|
435
|
-
renameSync(temporary, target);
|
|
436
|
-
} catch (error) {
|
|
437
|
-
rmSync(temporary, { recursive: true, force: true });
|
|
438
|
-
if (!existsSync(target)) throw error;
|
|
439
|
-
}
|
|
440
|
-
return target;
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
function isPathWithin(root: string, candidate: string): boolean {
|
|
444
|
-
const relativePath = relative(root, candidate);
|
|
445
|
-
return relativePath === "" || (!relativePath.startsWith("..") && !isAbsolute(relativePath));
|
|
446
|
-
}
|
|
447
|
-
|
|
448
420
|
function skillDirNames(root: string): string[] {
|
|
449
421
|
return readdirSync(root, { withFileTypes: true })
|
|
450
422
|
.filter((entry) => entry.isDirectory() && existsSync(join(root, entry.name, "SKILL.md")))
|
|
@@ -457,10 +429,6 @@ type RuntimeSkillDirNode = {
|
|
|
457
429
|
files: Map<string, string>;
|
|
458
430
|
};
|
|
459
431
|
|
|
460
|
-
function runtimeSkillDirEntry(skill: RuntimeSkillArtifact): Dir {
|
|
461
|
-
return runtimeSkillDirFromNode(runtimeSkillDirNode(skill));
|
|
462
|
-
}
|
|
463
|
-
|
|
464
432
|
function runtimeSkillDirNode(skill: RuntimeSkillArtifact): RuntimeSkillDirNode {
|
|
465
433
|
const root: RuntimeSkillDirNode = { dirs: new Map(), files: new Map() };
|
|
466
434
|
for (const skillFile of skill.files) {
|
|
@@ -489,13 +457,6 @@ function runtimeSkillDirNode(skill: RuntimeSkillArtifact): RuntimeSkillDirNode {
|
|
|
489
457
|
return root;
|
|
490
458
|
}
|
|
491
459
|
|
|
492
|
-
function runtimeSkillDirFromNode(node: RuntimeSkillDirNode): Dir {
|
|
493
|
-
const children: Record<string, Entry> = {};
|
|
494
|
-
for (const [name, child] of node.dirs) children[name] = runtimeSkillDirFromNode(child);
|
|
495
|
-
for (const [name, content] of node.files) children[name] = file({ content });
|
|
496
|
-
return dir({ children });
|
|
497
|
-
}
|
|
498
|
-
|
|
499
460
|
function assertSafeRuntimeSkillName(name: string): void {
|
|
500
461
|
if (!/^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/u.test(name)) {
|
|
501
462
|
throw new Error(`Invalid Skill name: ${name}`);
|
|
@@ -2179,7 +2179,7 @@ export class RoutingSandboxSession implements RoutableBackendSession {
|
|
|
2179
2179
|
// sees a different, empty host directory. `pathExists()` and `readFile()` on
|
|
2180
2180
|
// that SDK session inspect the worker-side path, so only a command executed
|
|
2181
2181
|
// inside the actual sandbox proves the materialized path is usable by the
|
|
2182
|
-
// agent. Never
|
|
2182
|
+
// agent. Never report successful materialization on a split workspace.
|
|
2183
2183
|
const path =
|
|
2184
2184
|
args && typeof args === "object" && typeof (args as { path?: unknown }).path === "string"
|
|
2185
2185
|
? (args as { path: string }).path
|
package/src/skill-files.ts
CHANGED
|
@@ -30,6 +30,26 @@ export function assertSkillRelativePath(path: string): void {
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
/** Inventory shares the reader's path validation and never includes file bodies. */
|
|
34
|
+
export function listSkillPaths(
|
|
35
|
+
files: readonly SkillTextFile[],
|
|
36
|
+
maxFiles: number,
|
|
37
|
+
): { paths: string[] } {
|
|
38
|
+
if (files.length > maxFiles)
|
|
39
|
+
throw new SkillFileError("output_too_large", `Skill inventory exceeds ${maxFiles} files.`);
|
|
40
|
+
const seen = new Set<string>();
|
|
41
|
+
for (const { path } of files) {
|
|
42
|
+
assertSkillRelativePath(path);
|
|
43
|
+
if (seen.has(path))
|
|
44
|
+
throw new SkillFileError("invalid_request", `Duplicate stored Skill path: ${path}`);
|
|
45
|
+
seen.add(path);
|
|
46
|
+
}
|
|
47
|
+
const result = { paths: [...seen].sort() };
|
|
48
|
+
if (new TextEncoder().encode(JSON.stringify(result)).byteLength > SKILL_READ_MAX_OUTPUT_BYTES)
|
|
49
|
+
throw new SkillFileError("output_too_large", "Skill inventory exceeds the read output limit.");
|
|
50
|
+
return result;
|
|
51
|
+
}
|
|
52
|
+
|
|
33
53
|
/** Omitted paths default to the entry point; explicit paths are never expanded. */
|
|
34
54
|
export function readSkillFiles(
|
|
35
55
|
files: readonly SkillTextFile[],
|
package/src/skill-library.ts
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/skill-library.ts","../src/skill-files.ts"],"sourcesContent":["import { createHash } from \"node:crypto\";\nimport { lstatSync, readFileSync, readdirSync } from \"node:fs\";\nimport { dirname, isAbsolute, join, relative } from \"node:path\";\nimport { TextDecoder } from \"node:util\";\nimport { fileURLToPath } from \"node:url\";\nimport {\n parseSkillFrontmatter as parsePortableSkillFrontmatter,\n readSkillMetadata,\n validateSkillTextFiles,\n} from \"@opengeni/contracts\";\nexport { parseSkillFrontmatter as parsePortableSkillFrontmatter } from \"@opengeni/contracts\";\n\nexport {\n applySkillFileChanges,\n assertSkillRelativePath,\n readSkillFiles,\n SkillFileError,\n SKILL_READ_MAX_OUTPUT_BYTES,\n SKILL_READ_MAX_PATHS,\n type SkillTextFile,\n} from \"./skill-files\";\n\n/**\n * Metadata for a platform-curated skill. The metadata is deliberately\n * provider-neutral: it describes guidance provenance and compatibility, not\n * credentials, tools, permissions, or a model route.\n *\n * Entries are immutable in the runtime. A new artifact gets a new version and\n * content hash; callers must not mutate the returned records.\n */\nexport type SkillLibraryEntry = Readonly<{\n id: string;\n name: string;\n version: string;\n description: string;\n category: string;\n tags: readonly string[];\n /** SHA-256 over the complete canonical artifact manifest, not just SKILL.md. */\n contentSha256: string;\n sourceCommit: string;\n sourceUrl: string;\n provenance: string;\n license: string;\n documentationUrl: string;\n compatibility: Readonly<{\n runtime: string;\n minimumSkillCapabilityVersion: string;\n }>;\n upgrade: Readonly<{\n policy: \"immutable-replacement\";\n supersedes: string | null;\n }>;\n relativePath: string;\n}>;\n\nexport type SkillLibraryFile = Readonly<{\n path: string;\n content: string;\n}>;\n\nexport type SkillLibraryArtifact = Readonly<{\n files: readonly SkillLibraryFile[];\n /** SHA-256 over the complete canonical artifact manifest, not just SKILL.md. */\n contentSha256: string;\n}>;\n\nexport type SkillLibrarySkill = Readonly<{\n name: string;\n description: string;\n files: readonly SkillLibraryFile[];\n}>;\n\nexport {\n SKILL_MAX_FILES as PORTABLE_SKILL_MAX_FILES,\n SKILL_MAX_FILE_BYTES as PORTABLE_SKILL_MAX_FILE_BYTES,\n SKILL_MAX_TOTAL_BYTES as PORTABLE_SKILL_MAX_TOTAL_BYTES,\n} from \"@opengeni/contracts\";\n\nexport type PortableSkillArtifact = Readonly<{\n name: string;\n description: string;\n files: readonly SkillLibraryFile[];\n contentSha256: string;\n totalBytes: number;\n}>;\n\ntype SkillLibrarySourceEntry = Omit<SkillLibraryEntry, \"name\" | \"description\">;\n\nconst skillLibraryEntries: readonly SkillLibrarySourceEntry[] = Object.freeze([\n Object.freeze({\n id: \"checkov\",\n version: \"1.0.0\",\n category: \"infrastructure\",\n tags: Object.freeze([\"skill\", \"infrastructure\", \"terraform\", \"security\", \"opt-in\"]),\n contentSha256: \"0331b987cd609946c4b95928fec9982b96b0a8614a95e5e628a531efb8ad8577\",\n sourceCommit: \"e9734c4aa062e0421a68acb5650bd5bf33ce2e10\",\n sourceUrl:\n \"https://github.com/Cloudgeni-ai/opengeni/tree/e9734c4aa062e0421a68acb5650bd5bf33ce2e10/packages/runtime/src/bundled_hashicorp_terraform_skills/checkov\",\n provenance: \"OpenGeni-authored guidance; reviewed immutable opt-in entry.\",\n license: \"Apache-2.0\",\n documentationUrl: \"https://www.checkov.io/\",\n compatibility: Object.freeze({\n runtime: \"openai-agents-skills\",\n minimumSkillCapabilityVersion: \"0.13.3\",\n }),\n upgrade: Object.freeze({ policy: \"immutable-replacement\", supersedes: null }),\n relativePath: \"checkov\",\n }),\n Object.freeze({\n id: \"document-parsing\",\n version: \"1.0.0\",\n category: \"documents\",\n tags: Object.freeze([\"skill\", \"documents\", \"parsing\", \"markdown\", \"opt-in\"]),\n contentSha256: \"5494b5bbb1629001dad8ab823afb2401efc7a6e76679644d211df8a5164f9d1a\",\n sourceCommit: \"4e3089b1ed43404241a303109f81e2c7933040b2\",\n sourceUrl:\n \"https://github.com/firecrawl/anydoc/tree/4e3089b1ed43404241a303109f81e2c7933040b2/skills/convert-documents-to-markdown\",\n provenance:\n \"OpenGeni-authored guidance adapted for the pinned Firecrawl AnyDoc runtime; reviewed immutable opt-in entry.\",\n license: \"MIT\",\n documentationUrl: \"https://github.com/firecrawl/anydoc/tree/v0.1.8\",\n compatibility: Object.freeze({\n runtime: \"openai-agents-skills\",\n minimumSkillCapabilityVersion: \"0.13.3\",\n }),\n upgrade: Object.freeze({ policy: \"immutable-replacement\", supersedes: null }),\n relativePath: \"document-parsing\",\n }),\n Object.freeze({\n id: \"refactor-module\",\n version: \"0.0.1\",\n category: \"infrastructure\",\n tags: Object.freeze([\"skill\", \"infrastructure\", \"terraform\", \"modules\", \"opt-in\"]),\n contentSha256: \"cc6d70034c4d11ef6a496c0081ca28219cbd310283d77e327914bcd2f27f3a09\",\n sourceCommit: \"de4323afdfbc30d1387f287b55062fa8d82b62e8\",\n sourceUrl:\n \"https://github.com/hashicorp/agent-skills/tree/de4323afdfbc30d1387f287b55062fa8d82b62e8/terraform/module-generation/skills/refactor-module\",\n provenance: \"Vendored from hashicorp/agent-skills; reviewed immutable opt-in entry.\",\n license: \"MPL-2.0\",\n documentationUrl: \"https://developer.hashicorp.com/terraform/language/modules/develop\",\n compatibility: Object.freeze({\n runtime: \"openai-agents-skills\",\n minimumSkillCapabilityVersion: \"0.13.3\",\n }),\n upgrade: Object.freeze({ policy: \"immutable-replacement\", supersedes: null }),\n relativePath: \"refactor-module\",\n }),\n Object.freeze({\n id: \"social-media-marketing\",\n version: \"1.0.0\",\n category: \"marketing\",\n tags: Object.freeze([\"skill\", \"marketing\", \"social\", \"analysis\", \"opt-in\"]),\n contentSha256: \"66893de1fd2110f18d9be69b1e0adb61193e0a736a88f0c0725168465d2b06a3\",\n sourceCommit: \"e9734c4aa062e0421a68acb5650bd5bf33ce2e10\",\n sourceUrl:\n \"https://github.com/Cloudgeni-ai/opengeni/tree/e9734c4aa062e0421a68acb5650bd5bf33ce2e10/packages/runtime/src/bundled_hashicorp_terraform_skills/social-media-marketing\",\n provenance: \"OpenGeni-authored guidance; reviewed immutable opt-in entry.\",\n license: \"Apache-2.0\",\n documentationUrl:\n \"https://github.com/Cloudgeni-ai/opengeni/blob/e9734c4aa062e0421a68acb5650bd5bf33ce2e10/docs/social-connectors.md\",\n compatibility: Object.freeze({\n runtime: \"openai-agents-skills\",\n minimumSkillCapabilityVersion: \"0.13.3\",\n }),\n upgrade: Object.freeze({ policy: \"immutable-replacement\", supersedes: null }),\n relativePath: \"social-media-marketing\",\n }),\n Object.freeze({\n id: \"terraform-search-import\",\n version: \"0.1.0\",\n category: \"infrastructure\",\n tags: Object.freeze([\"skill\", \"infrastructure\", \"terraform\", \"import\", \"opt-in\"]),\n contentSha256: \"994d7a48dd6a610daa8a4dbdf4b0f0e52eaf8662a509b6a163bc6e76611227f9\",\n sourceCommit: \"de4323afdfbc30d1387f287b55062fa8d82b62e8\",\n sourceUrl:\n \"https://github.com/hashicorp/agent-skills/tree/de4323afdfbc30d1387f287b55062fa8d82b62e8/terraform/code-generation/skills/terraform-search-import\",\n provenance: \"Vendored from hashicorp/agent-skills; reviewed immutable opt-in entry.\",\n license: \"MPL-2.0\",\n documentationUrl: \"https://developer.hashicorp.com/terraform/language/import\",\n compatibility: Object.freeze({\n runtime: \"openai-agents-skills\",\n minimumSkillCapabilityVersion: \"0.13.3\",\n }),\n upgrade: Object.freeze({ policy: \"immutable-replacement\", supersedes: null }),\n relativePath: \"terraform-search-import\",\n }),\n Object.freeze({\n id: \"terraform-stacks\",\n version: \"0.0.1\",\n category: \"infrastructure\",\n tags: Object.freeze([\"skill\", \"infrastructure\", \"terraform\", \"stacks\", \"opt-in\"]),\n contentSha256: \"0a6244ecddf1cce0357db41b41b3b20a1bfa71f331092ebc8bbd15e649733d35\",\n sourceCommit: \"de4323afdfbc30d1387f287b55062fa8d82b62e8\",\n sourceUrl:\n \"https://github.com/hashicorp/agent-skills/tree/de4323afdfbc30d1387f287b55062fa8d82b62e8/terraform/module-generation/skills/terraform-stacks\",\n provenance: \"Vendored from hashicorp/agent-skills; reviewed immutable opt-in entry.\",\n license: \"MPL-2.0\",\n documentationUrl: \"https://developer.hashicorp.com/terraform/language/stacks\",\n compatibility: Object.freeze({\n runtime: \"openai-agents-skills\",\n minimumSkillCapabilityVersion: \"0.13.3\",\n }),\n upgrade: Object.freeze({ policy: \"immutable-replacement\", supersedes: null }),\n relativePath: \"terraform-stacks\",\n }),\n Object.freeze({\n id: \"terraform-style-guide\",\n version: \"1.0.0\",\n category: \"infrastructure\",\n tags: Object.freeze([\"skill\", \"infrastructure\", \"terraform\", \"style\", \"opt-in\"]),\n contentSha256: \"1453c4f11636d2d88c5186a4ce2d7532d4b2056a861ed69653df21e8e45e19cd\",\n sourceCommit: \"de4323afdfbc30d1387f287b55062fa8d82b62e8\",\n sourceUrl:\n \"https://github.com/hashicorp/agent-skills/tree/de4323afdfbc30d1387f287b55062fa8d82b62e8/terraform/code-generation/skills/terraform-style-guide\",\n provenance: \"Vendored from hashicorp/agent-skills; reviewed immutable opt-in entry.\",\n license: \"MPL-2.0\",\n documentationUrl: \"https://developer.hashicorp.com/terraform/language/style\",\n compatibility: Object.freeze({\n runtime: \"openai-agents-skills\",\n minimumSkillCapabilityVersion: \"0.13.3\",\n }),\n upgrade: Object.freeze({ policy: \"immutable-replacement\", supersedes: null }),\n relativePath: \"terraform-style-guide\",\n }),\n Object.freeze({\n id: \"terraform-test\",\n version: \"0.0.2\",\n category: \"infrastructure\",\n tags: Object.freeze([\"skill\", \"infrastructure\", \"terraform\", \"testing\", \"opt-in\"]),\n contentSha256: \"61be0fa43c48f49980fee28c64215f593c4ab55d55a93c8f2e514d9ca566a97b\",\n sourceCommit: \"de4323afdfbc30d1387f287b55062fa8d82b62e8\",\n sourceUrl:\n \"https://github.com/hashicorp/agent-skills/tree/de4323afdfbc30d1387f287b55062fa8d82b62e8/terraform/code-generation/skills/terraform-test\",\n provenance: \"Vendored from hashicorp/agent-skills; reviewed immutable opt-in entry.\",\n license: \"MPL-2.0\",\n documentationUrl: \"https://developer.hashicorp.com/terraform/language/tests\",\n compatibility: Object.freeze({\n runtime: \"openai-agents-skills\",\n minimumSkillCapabilityVersion: \"0.13.3\",\n }),\n upgrade: Object.freeze({ policy: \"immutable-replacement\", supersedes: null }),\n relativePath: \"terraform-test\",\n }),\n Object.freeze({\n id: \"azure-verified-modules\",\n version: \"1.0.0\",\n category: \"infrastructure\",\n tags: Object.freeze([\"skill\", \"infrastructure\", \"terraform\", \"azure\", \"opt-in\"]),\n contentSha256: \"bbc029412fd4893c35cf2a4df6e052efa5583d57d3c26e35d62869dcf4625699\",\n sourceCommit: \"de4323afdfbc30d1387f287b55062fa8d82b62e8\",\n sourceUrl:\n \"https://github.com/hashicorp/agent-skills/tree/de4323afdfbc30d1387f287b55062fa8d82b62e8/terraform/code-generation/skills/azure-verified-modules\",\n provenance: \"Vendored from hashicorp/agent-skills; reviewed OpenGeni curated entry.\",\n license: \"MPL-2.0\",\n documentationUrl: \"https://azure.github.io/Azure-Verified-Modules/\",\n compatibility: Object.freeze({\n runtime: \"openai-agents-skills\",\n minimumSkillCapabilityVersion: \"0.13.3\",\n }),\n upgrade: Object.freeze({\n policy: \"immutable-replacement\",\n supersedes: null,\n }),\n relativePath: \"azure-verified-modules\",\n }),\n]);\n\nconst skillLibraryRootCandidates = (): string[] => {\n const moduleDir = dirname(fileURLToPath(import.meta.url));\n return [\n join(moduleDir, \"assets\", \"runtime\", \"curated_skill_library\"),\n join(moduleDir, \"curated_skill_library\"),\n join(moduleDir, \"..\", \"src\", \"curated_skill_library\"),\n ];\n};\n\nfunction skillLibraryRoot(): string | null {\n return skillLibraryRootCandidates().find((candidate) => isRealDirectory(candidate)) ?? null;\n}\n\n/** Read packaged guidance on the server; never materialize it into a sandbox. */\nexport function loadSkillManagementSkill(): SkillLibrarySkill {\n const moduleDir = dirname(fileURLToPath(import.meta.url));\n const root = [\n join(moduleDir, \"assets\", \"runtime\", \"bundled_management_skills\"),\n join(moduleDir, \"bundled_management_skills\"),\n join(moduleDir, \"..\", \"src\", \"bundled_management_skills\"),\n ].find((candidate) => isRealDirectory(candidate));\n if (!root) throw new Error(\"Built-in Skill management guidance is missing from this deployment.\");\n const artifact = readSkillLibraryArtifact(join(root, \"opengeni-skills\"));\n const main = artifact.files.find((entry) => entry.path === \"SKILL.md\");\n if (!main) throw new Error(\"Built-in Skill management guidance has no SKILL.md.\");\n const metadata = parsePortableSkillFrontmatter(main.content);\n if (metadata.name !== \"opengeni-skills\" || !metadata.description) {\n throw new Error(\"Built-in Skill management metadata is invalid.\");\n }\n return { name: metadata.name, description: metadata.description, files: artifact.files };\n}\n\nfunction entryDirectory(entry: SkillLibrarySourceEntry): string | null {\n const root = skillLibraryRoot();\n if (!root) return null;\n const directory = join(root, entry.relativePath);\n const withinRoot = relative(root, directory);\n if (\n isAbsolute(withinRoot) ||\n withinRoot === \"..\" ||\n withinRoot.startsWith(\"../\") ||\n !isRealDirectory(directory)\n ) {\n return null;\n }\n return directory;\n}\n\n/** Return only entries whose reviewed artifact is present in this deployment. */\nexport function listSkillLibraryEntries(): readonly SkillLibraryEntry[] {\n return skillLibraryEntries.flatMap((entry) => {\n const resolved = resolveSkillLibraryEntry(entry);\n return resolved ? [resolved] : [];\n });\n}\n\n/** Return whether an id belongs to the immutable library, even if its artifact is unavailable. */\nexport function isSkillLibraryEntryId(id: string): boolean {\n return skillLibraryEntries.some((entry) => entry.id === id);\n}\n\n/** Resolve an exact immutable library entry by id and version. */\nexport function getSkillLibraryEntry(id: string, version?: string): SkillLibraryEntry | null {\n const entry = skillLibraryEntries.find(\n (candidate) => candidate.id === id && (version === undefined || candidate.version === version),\n );\n return entry ? resolveSkillLibraryEntry(entry) : null;\n}\n\n/**\n * Load a selected curated entry into the SDK's in-memory skill shape.\n * Selection is guidance-only: this function has no access to settings,\n * credentials, MCP declarations, or model-provider configuration.\n */\nexport function loadSkillLibrarySkill(\n id: string,\n version?: string,\n): { entry: SkillLibraryEntry; skill: SkillLibrarySkill } {\n const entry = getSkillLibraryEntry(id, version);\n if (!entry) {\n throw new Error(\n version\n ? `Skill library entry is unavailable: ${id}@${version}`\n : `Skill library entry is unavailable: ${id}`,\n );\n }\n const directory = entryDirectory(entry);\n if (!directory) {\n throw new Error(`Skill library entry is unavailable: ${entry.id}@${entry.version}`);\n }\n const artifact = verifySkillLibraryArtifact(directory, entry.contentSha256, entry);\n const files = artifact.files;\n const skillMarkdown = files.find((file) => file.path === \"SKILL.md\")?.content;\n if (skillMarkdown === undefined) {\n throw new Error(`Skill library entry is missing SKILL.md: ${entry.id}@${entry.version}`);\n }\n return {\n entry,\n skill: Object.freeze({\n name: entry.name,\n description: entry.description,\n files: Object.freeze(files.map((file) => Object.freeze(file))),\n }),\n };\n}\n\n/** Return the immutable repository origin for a reviewed library source URL. */\nexport function skillLibraryRepositoryUrl(sourceUrl: string): string {\n const url = new URL(sourceUrl);\n const segments = url.pathname.split(\"/\").filter(Boolean);\n if (url.hostname === \"github.com\" && segments.length >= 2) {\n return `${url.origin}/${segments[0]}/${segments[1]}`;\n }\n return sourceUrl;\n}\n\n/**\n * Read a curated artifact and calculate its canonical whole-artifact digest.\n *\n * The manifest is JSON encoded as sorted `[normalizedRelativePath, base64Bytes]`\n * tuples. Base64 preserves every byte, including bytes that would not survive\n * a lossy UTF-8 string round-trip. Files are decoded only after the digest\n * input has been captured because the SDK skill surface is text-based.\n */\nexport function readSkillLibraryArtifact(root: string): SkillLibraryArtifact {\n const files = materializeSkillLibraryFiles(root);\n const contentSha256 = skillLibraryArtifactSha256(files);\n return Object.freeze({\n files: Object.freeze(\n files.map((file) =>\n Object.freeze({\n path: file.path,\n content: decodeSkillLibraryFile(file.bytes, file.path),\n }),\n ),\n ),\n contentSha256,\n });\n}\n\n/**\n * Validate and fingerprint a portable, text-only Skill artifact before it is\n * persisted or exposed to the runtime. Remote imports and curated entries use\n * the same canonical path and whole-artifact digest rules.\n */\nexport function buildPortableSkillArtifact(\n inputFiles: readonly SkillLibraryFile[],\n): PortableSkillArtifact {\n const { materialized, totalBytes } = materializePortableSkillFiles(inputFiles);\n const skillMarkdown = materialized.find((file) => file.path === \"SKILL.md\")?.content;\n if (skillMarkdown === undefined) {\n throw new Error(\"Skill artifact is missing a top-level SKILL.md\");\n }\n const metadata = readSkillMetadata(skillMarkdown);\n return Object.freeze({\n name: metadata.name,\n description: metadata.description,\n files: Object.freeze(materialized.map(({ path, content }) => Object.freeze({ path, content }))),\n contentSha256: skillLibraryArtifactSha256(materialized),\n totalBytes,\n });\n}\n\n/**\n * Canonical whole-artifact identity for any validated runtime Skill shape.\n * This deliberately does not require frontmatter because legacy Pack/session\n * contracts historically allowed a top-level SKILL.md without metadata. The\n * content identity is nevertheless byte-exact and shared with portable imports.\n */\nexport function skillArtifactContentSha256(inputFiles: readonly SkillLibraryFile[]): string {\n return skillLibraryArtifactSha256(materializePortableSkillFiles(inputFiles).materialized);\n}\n\nfunction materializePortableSkillFiles(inputFiles: readonly SkillLibraryFile[]): {\n materialized: Array<Readonly<{ path: string; content: string; bytes: Uint8Array }>>;\n totalBytes: number;\n} {\n const { totalBytes } = validateSkillTextFiles(inputFiles);\n const materialized = inputFiles\n .map((file) => {\n const path = file.path;\n const bytes = new TextEncoder().encode(file.content);\n return Object.freeze({ path, content: file.content, bytes });\n })\n .sort((left, right) => compareCanonicalPath(left.path, right.path));\n return { materialized, totalBytes };\n}\n\n/** Verify a reviewed artifact against its immutable catalog digest. */\nexport function verifySkillLibraryArtifact(\n root: string,\n expectedSha256: string,\n entry?: Pick<SkillLibraryEntry, \"id\" | \"version\">,\n): SkillLibraryArtifact {\n const artifact = readSkillLibraryArtifact(root);\n if (artifact.files.every((file) => file.path !== \"SKILL.md\")) {\n throw new Error(\n entry\n ? `Skill library entry is missing SKILL.md: ${entry.id}@${entry.version}`\n : \"Skill library artifact is missing SKILL.md\",\n );\n }\n if (artifact.contentSha256 !== expectedSha256) {\n const label = entry ? ` for ${entry.id}@${entry.version}` : \"\";\n throw new Error(\n `Skill library artifact hash mismatch${label}: expected ${expectedSha256}, got ${artifact.contentSha256}`,\n );\n }\n return artifact;\n}\n\ntype MaterializedSkillLibraryFile = Readonly<{\n path: string;\n bytes: Uint8Array;\n}>;\n\nconst utf8Decoder = new TextDecoder(\"utf-8\", { fatal: true, ignoreBOM: true });\n\nfunction materializeSkillLibraryFiles(root: string, current = \"\"): MaterializedSkillLibraryFile[] {\n const directory = current ? join(root, current) : root;\n if (!isRealDirectory(directory)) {\n throw new Error(`Skill library artifact root is not a real directory: ${directory}`);\n }\n return readdirSync(directory, { withFileTypes: true })\n .sort((a, b) => compareCanonicalPath(a.name, b.name))\n .flatMap((child) => {\n const childName = normalizeSkillLibraryRelativePath(child.name, true);\n const path = current ? `${current}/${childName}` : childName;\n normalizeSkillLibraryRelativePath(path);\n const childPath = join(root, path);\n if (child.isSymbolicLink()) {\n throw new Error(`Skill library artifact contains a symbolic link: ${path}`);\n }\n if (child.isDirectory()) {\n return materializeSkillLibraryFiles(root, path);\n }\n if (!child.isFile() || !isRealFile(childPath)) {\n throw new Error(`Skill library artifact contains a non-regular file: ${path}`);\n }\n return [{ path, bytes: Uint8Array.from(readFileSync(childPath)) }];\n });\n}\n\nfunction resolveSkillLibraryEntry(entry: SkillLibrarySourceEntry): SkillLibraryEntry | null {\n const directory = entryDirectory(entry);\n if (!directory) return null;\n try {\n const artifact = verifySkillLibraryArtifact(directory, entry.contentSha256, entry);\n const metadata = readSkillMetadata(\n artifact.files.find((file) => file.path === \"SKILL.md\")!.content,\n );\n return Object.freeze({ ...entry, ...metadata });\n } catch {\n return null;\n }\n}\n\nfunction skillLibraryArtifactSha256(files: readonly MaterializedSkillLibraryFile[]): string {\n const manifest = files\n .map((file) => {\n const path = normalizeSkillLibraryRelativePath(file.path);\n return [path, Buffer.from(file.bytes).toString(\"base64\")] as const;\n })\n .sort((left, right) => compareCanonicalPath(left[0], right[0]));\n const paths = new Set<string>();\n for (const [path] of manifest) {\n if (paths.has(path)) {\n throw new Error(`Skill library artifact contains duplicate file path: ${path}`);\n }\n paths.add(path);\n }\n return createHash(\"sha256\").update(JSON.stringify(manifest), \"utf8\").digest(\"hex\");\n}\n\nfunction decodeSkillLibraryFile(bytes: Uint8Array, path: string): string {\n try {\n return utf8Decoder.decode(bytes);\n } catch {\n throw new Error(`Skill library artifact contains invalid UTF-8: ${path}`);\n }\n}\n\nfunction normalizeSkillLibraryRelativePath(path: string, segment = false): string {\n if (\n path.length === 0 ||\n path.includes(\"\\\\\") ||\n path.includes(\"\\0\") ||\n path.startsWith(\"/\") ||\n /^[A-Za-z]:(?:\\/|$)/u.test(path)\n ) {\n throw new Error(`Skill library artifact contains an unsafe path: ${path}`);\n }\n const parts = path.split(\"/\");\n if (parts.some((part) => part.length === 0 || part === \".\" || part === \"..\")) {\n throw new Error(`Skill library artifact contains an unsafe path: ${path}`);\n }\n if (segment && parts.length !== 1) {\n throw new Error(`Skill library artifact contains an unsafe path: ${path}`);\n }\n return parts.join(\"/\");\n}\n\nfunction compareCanonicalPath(left: string, right: string): number {\n return left < right ? -1 : left > right ? 1 : 0;\n}\n\nfunction isRealDirectory(path: string): boolean {\n try {\n const stats = lstatSync(path);\n return stats.isDirectory() && !stats.isSymbolicLink();\n } catch {\n return false;\n }\n}\n\nfunction isRealFile(path: string): boolean {\n try {\n const stats = lstatSync(path);\n return stats.isFile() && !stats.isSymbolicLink();\n } catch {\n return false;\n }\n}\n","/**\n * Sandbox-independent file operations on an already-authorized Skill folder.\n * Callers resolve workspace authority and current content before entering here.\n * These helpers neither activate guidance nor perform persistence.\n */\nexport type SkillTextFile = Readonly<{ path: string; content: string }>;\n\nexport const SKILL_READ_MAX_OUTPUT_BYTES = 512 * 1024;\nexport const SKILL_READ_MAX_PATHS = 128;\n\nexport class SkillFileError extends Error {\n constructor(\n readonly code: \"invalid_path\" | \"invalid_request\" | \"missing_file\" | \"output_too_large\",\n message: string,\n ) {\n super(message);\n this.name = \"SkillFileError\";\n }\n}\n\nexport function assertSkillRelativePath(path: string): void {\n if (\n !path ||\n path.includes(\"\\\\\") ||\n /[\\u0000-\\u001f\\u007f]/u.test(path) ||\n path.includes(\":\") ||\n path.split(\"/\").some((segment) => !segment || segment === \".\" || segment === \"..\")\n ) {\n throw new SkillFileError(\"invalid_path\", `Expected a safe relative Skill path: ${path}`);\n }\n}\n\n/** Omitted paths default to the entry point; explicit paths are never expanded. */\nexport function readSkillFiles(\n files: readonly SkillTextFile[],\n paths?: readonly string[],\n): { files: SkillTextFile[] } {\n const requested = paths ?? [\"SKILL.md\"];\n if (requested.length === 0 || requested.length > SKILL_READ_MAX_PATHS) {\n throw new SkillFileError(\n \"invalid_request\",\n `Request between 1 and ${SKILL_READ_MAX_PATHS} paths, or omit paths for SKILL.md.`,\n );\n }\n const byPath = new Map<string, SkillTextFile>();\n for (const file of files) {\n assertSkillRelativePath(file.path);\n if (byPath.has(file.path)) {\n throw new SkillFileError(\"invalid_request\", `Duplicate stored Skill path: ${file.path}`);\n }\n byPath.set(file.path, file);\n }\n const seen = new Set<string>();\n const selected = requested.map((path) => {\n assertSkillRelativePath(path);\n if (seen.has(path)) {\n throw new SkillFileError(\"invalid_request\", `Duplicate requested Skill path: ${path}`);\n }\n seen.add(path);\n const file = byPath.get(path);\n if (!file) throw new SkillFileError(\"missing_file\", `Skill file not found: ${path}`);\n return { path: file.path, content: file.content };\n });\n const result = { files: selected };\n if (new TextEncoder().encode(JSON.stringify(result)).byteLength > SKILL_READ_MAX_OUTPUT_BYTES) {\n throw new SkillFileError(\n \"output_too_large\",\n \"Requested Skill files exceed the read output limit. Request fewer paths or use checkout.\",\n );\n }\n return result;\n}\n\n/** Partial text edits preserve omitted files; deletion is always explicit. */\nexport function applySkillFileChanges(\n current: readonly SkillTextFile[],\n changes: readonly SkillTextFile[],\n deletions: readonly string[] = [],\n): SkillTextFile[] {\n const next = new Map<string, SkillTextFile>();\n for (const file of current) {\n assertSkillRelativePath(file.path);\n if (next.has(file.path)) {\n throw new SkillFileError(\"invalid_request\", `Duplicate stored Skill path: ${file.path}`);\n }\n next.set(file.path, { ...file });\n }\n const touched = new Set<string>();\n for (const path of deletions) {\n assertSkillRelativePath(path);\n if (touched.has(path)) {\n throw new SkillFileError(\"invalid_request\", `Duplicate deleted Skill path: ${path}`);\n }\n touched.add(path);\n if (!next.delete(path)) {\n throw new SkillFileError(\"missing_file\", `Cannot delete missing Skill file: ${path}`);\n }\n }\n for (const file of changes) {\n assertSkillRelativePath(file.path);\n if (touched.has(file.path)) {\n throw new SkillFileError(\"invalid_request\", `Conflicting Skill edit: ${file.path}`);\n }\n touched.add(file.path);\n next.set(file.path, { ...file });\n }\n if (!next.has(\"SKILL.md\")) {\n throw new SkillFileError(\"missing_file\", \"A Skill must contain SKILL.md.\");\n }\n return [...next.values()].sort((a, b) => (a.path < b.path ? -1 : a.path > b.path ? 1 : 0));\n}\n"],"mappings":";AAAA,SAAS,kBAAkB;AAC3B,SAAS,WAAW,cAAc,mBAAmB;AACrD,SAAS,SAAS,YAAY,MAAM,gBAAgB;AACpD,SAAS,mBAAmB;AAC5B,SAAS,qBAAqB;AAC9B;AAAA,EACE,yBAAyB;AAAA,EACzB;AAAA,EACA;AAAA,OACK;AACP,SAAkC,6BAAqC;;;ACHhE,IAAM,8BAA8B,MAAM;AAC1C,IAAM,uBAAuB;AAE7B,IAAM,iBAAN,cAA6B,MAAM;AAAA,EACxC,YACW,MACT,SACA;AACA,UAAM,OAAO;AAHJ;AAIT,SAAK,OAAO;AAAA,EACd;AACF;AAEO,SAAS,wBAAwB,MAAoB;AAC1D,MACE,CAAC,QACD,KAAK,SAAS,IAAI,KAClB,yBAAyB,KAAK,IAAI,KAClC,KAAK,SAAS,GAAG,KACjB,KAAK,MAAM,GAAG,EAAE,KAAK,CAAC,YAAY,CAAC,WAAW,YAAY,OAAO,YAAY,IAAI,GACjF;AACA,UAAM,IAAI,eAAe,gBAAgB,wCAAwC,IAAI,EAAE;AAAA,EACzF;AACF;AAGO,SAAS,eACd,OACA,OAC4B;AAC5B,QAAM,YAAY,SAAS,CAAC,UAAU;AACtC,MAAI,UAAU,WAAW,KAAK,UAAU,SAAS,sBAAsB;AACrE,UAAM,IAAI;AAAA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