agentwheel 0.19.5 → 0.19.7
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/index.js +94 -66
- package/openpack.json +1 -1
- package/package.json +1 -1
- package/skills/agentwheel/SKILL.md +1 -1
- package/skills/agentwheel-discovery/SKILL.md +1 -1
package/dist/index.js
CHANGED
|
@@ -4132,7 +4132,8 @@ async function createPlanFromOperations(desiredOps, adapter, targetRoot, manifes
|
|
|
4132
4132
|
const semanticPlugin = entry.semanticPlugin;
|
|
4133
4133
|
const destPath = semanticPlugin ? targetRoot : join17(targetRoot, entry.path);
|
|
4134
4134
|
if (!semanticPlugin && !await transport.pathExists(destPath)) continue;
|
|
4135
|
-
const
|
|
4135
|
+
const inferredMode = semanticPlugin ? void 0 : await inferExactLegacyManagedInstructionMode(entry, destPath, transport);
|
|
4136
|
+
const currentHash = semanticPlugin ? entry.hash : await currentEntryHash(entry, destPath, transport, inferredMode);
|
|
4136
4137
|
if (workspaceOwner && !entryOwnedByWorkspace(entry, workspaceOwner)) {
|
|
4137
4138
|
operations.push(keepForeignManifestEntryOperation(entry, targetRoot, workspaceOwner, void 0, currentHash));
|
|
4138
4139
|
continue;
|
|
@@ -4154,7 +4155,7 @@ async function createPlanFromOperations(desiredOps, adapter, targetRoot, manifes
|
|
|
4154
4155
|
semanticPlugin,
|
|
4155
4156
|
execute: entry.executed,
|
|
4156
4157
|
mergeStrategy: entry.mergeStrategy,
|
|
4157
|
-
mode: entry.mode,
|
|
4158
|
+
mode: entry.mode ?? inferredMode,
|
|
4158
4159
|
composedFrom: entry.composedFrom,
|
|
4159
4160
|
...operationMetadataFromEntry(entry),
|
|
4160
4161
|
...options.forceDrift ? { action: "remove", reason: "force removing drifted stale managed destination", overrideDrift: true } : {}
|
|
@@ -4176,7 +4177,7 @@ async function createPlanFromOperations(desiredOps, adapter, targetRoot, manifes
|
|
|
4176
4177
|
semanticPlugin,
|
|
4177
4178
|
execute: entry.executed,
|
|
4178
4179
|
mergeStrategy: entry.mergeStrategy,
|
|
4179
|
-
mode: entry.mode,
|
|
4180
|
+
mode: entry.mode ?? inferredMode,
|
|
4180
4181
|
composedFrom: entry.composedFrom,
|
|
4181
4182
|
...operationMetadataFromEntry(entry)
|
|
4182
4183
|
});
|
|
@@ -4361,12 +4362,19 @@ async function planManagedBlockOperation(op, manifestByPath, transport, options,
|
|
|
4361
4362
|
reason: reasonWithComposedDiff("managed instruction source changed", op.composedFrom, existing.composedFrom)
|
|
4362
4363
|
}];
|
|
4363
4364
|
}
|
|
4364
|
-
async function currentEntryHash(entry, destPath, transport) {
|
|
4365
|
-
if (
|
|
4365
|
+
async function currentEntryHash(entry, destPath, transport, mode = entry.mode) {
|
|
4366
|
+
if (mode !== managedInstructionBlockMode) return transport.hashPath(destPath);
|
|
4366
4367
|
const selector = managedInstructionSelector("logicalSelector" in entry ? entry.logicalSelector : void 0, entry.artifactType, entry.artifactName);
|
|
4367
4368
|
const state = await readManagedInstructionBlockState(destPath, selector, transport);
|
|
4368
4369
|
return state.hash;
|
|
4369
4370
|
}
|
|
4371
|
+
async function inferExactLegacyManagedInstructionMode(entry, destPath, transport) {
|
|
4372
|
+
if (entry.mode || entry.artifactType !== "instructions") return void 0;
|
|
4373
|
+
const selector = managedInstructionSelector("logicalSelector" in entry ? entry.logicalSelector : void 0, entry.artifactType, entry.artifactName);
|
|
4374
|
+
const state = await readManagedInstructionBlockState(destPath, selector, transport);
|
|
4375
|
+
if (!state.hasBlock || state.drifted || state.hash !== entry.hash) return void 0;
|
|
4376
|
+
return managedInstructionBlockMode;
|
|
4377
|
+
}
|
|
4370
4378
|
async function canStrictlyAdoptLegacyEntry(entry, op, targetRoot, transport) {
|
|
4371
4379
|
if (entry.artifactType !== op.artifactType || entry.artifactName !== op.artifactName) return false;
|
|
4372
4380
|
if (!op.desiredHash || entry.sourceHash !== op.desiredHash) return false;
|
|
@@ -6259,9 +6267,9 @@ function cachePathFor(packageName, cacheRoot) {
|
|
|
6259
6267
|
|
|
6260
6268
|
// src/source/git.ts
|
|
6261
6269
|
import { execFile as execFile4 } from "child_process";
|
|
6262
|
-
import {
|
|
6270
|
+
import { mkdir as mkdir14, rename as rename3, rm as rm7, stat as stat5 } from "fs/promises";
|
|
6263
6271
|
import { homedir as homedir3 } from "os";
|
|
6264
|
-
import { basename as basename11, dirname as dirname17, join as join24, resolve as resolve7 } from "path";
|
|
6272
|
+
import { basename as basename11, dirname as dirname17, join as join24, resolve as resolve7, sep } from "path";
|
|
6265
6273
|
import { promisify as promisify4 } from "util";
|
|
6266
6274
|
|
|
6267
6275
|
// src/source/auth.ts
|
|
@@ -6558,13 +6566,17 @@ var GitSourceDriver = class {
|
|
|
6558
6566
|
async fetch(resolved) {
|
|
6559
6567
|
return withFilesystemLock(`${resolved.resolvedPath}.lock`, resolved.cacheLockTimeoutMs ?? 3e4, async () => {
|
|
6560
6568
|
const parsed = parseGitSource(resolved.source);
|
|
6561
|
-
|
|
6569
|
+
const cacheRoot = dirname17(resolved.resolvedPath);
|
|
6570
|
+
await mkdir14(cacheRoot, { recursive: true });
|
|
6571
|
+
await assertOwnedByCurrentUser(cacheRoot);
|
|
6572
|
+
if (await pathExists(resolved.resolvedPath)) await assertOwnedByCurrentUser(resolved.resolvedPath);
|
|
6562
6573
|
if (!await pathExists(join24(resolved.resolvedPath, ".git"))) {
|
|
6563
6574
|
if (resolved.frozenLock) {
|
|
6564
6575
|
throw new Error(`Frozen lock requires cached git checkout at ${resolved.resolvedPath}`);
|
|
6565
6576
|
}
|
|
6566
6577
|
await rm7(resolved.resolvedPath, { recursive: true, force: true });
|
|
6567
|
-
await git([...await gitAuthArguments(parsed.url), "clone", parsed.url, resolved.resolvedPath]);
|
|
6578
|
+
await git([...await gitAuthArguments(parsed.url), "clone", "--no-checkout", parsed.url, resolved.resolvedPath]);
|
|
6579
|
+
await assertOwnedByCurrentUser(resolved.resolvedPath);
|
|
6568
6580
|
} else if (!resolved.frozenLock) {
|
|
6569
6581
|
await git([
|
|
6570
6582
|
...await gitAuthArguments(parsed.url),
|
|
@@ -6577,27 +6589,12 @@ var GitSourceDriver = class {
|
|
|
6577
6589
|
]);
|
|
6578
6590
|
}
|
|
6579
6591
|
const ref = resolved.requestedRef ?? parsed.ref ?? "HEAD";
|
|
6580
|
-
|
|
6581
|
-
await git(["-C", resolved.resolvedPath, "checkout", "--detach", "origin/HEAD"]);
|
|
6582
|
-
} else if (/^[0-9a-f]{7,40}$/i.test(ref)) {
|
|
6583
|
-
await git(["-C", resolved.resolvedPath, "checkout", "--detach", ref]);
|
|
6584
|
-
} else {
|
|
6585
|
-
try {
|
|
6586
|
-
await git(["-C", resolved.resolvedPath, "checkout", ref]);
|
|
6587
|
-
await git(["-C", resolved.resolvedPath, "reset", "--hard", `origin/${ref}`]);
|
|
6588
|
-
} catch {
|
|
6589
|
-
await git(["-C", resolved.resolvedPath, "checkout", "--detach", ref]);
|
|
6590
|
-
}
|
|
6591
|
-
}
|
|
6592
|
-
await removeGeneratedEntries(resolved.resolvedPath, true);
|
|
6593
|
-
const { stdout } = await git(["-C", resolved.resolvedPath, "rev-parse", "HEAD"]);
|
|
6594
|
-
const resolvedCommit = stdout.trim();
|
|
6595
|
-
const cacheRoot = dirname17(resolved.resolvedPath);
|
|
6592
|
+
const resolvedCommit = await resolveCommit(resolved.resolvedPath, ref);
|
|
6596
6593
|
const snapshot = await withGitCacheMaintenanceLock(
|
|
6597
6594
|
cacheRoot,
|
|
6598
6595
|
resolved.cacheLockTimeoutMs ?? 3e4,
|
|
6599
6596
|
async () => {
|
|
6600
|
-
const path = await
|
|
6597
|
+
const path = await snapshotCommit(resolved.resolvedPath, resolvedCommit);
|
|
6601
6598
|
const leasePath = await createGitSnapshotLease(path);
|
|
6602
6599
|
await pruneGitCache(cacheRoot, {
|
|
6603
6600
|
currentSnapshot: path,
|
|
@@ -6654,20 +6651,41 @@ function cachePathFor2(url, cacheRoot) {
|
|
|
6654
6651
|
const slug2 = url.replace(/^[a-z]+:\/\//i, "").replace(/\.git$/i, "").replace(/[^a-z0-9._-]+/gi, "-").replace(/^-+|-+$/g, "");
|
|
6655
6652
|
return join24(root, slug2 || basename11(url));
|
|
6656
6653
|
}
|
|
6657
|
-
async function git(args) {
|
|
6658
|
-
return execFileAsync4("git", args, { maxBuffer: 1024 * 1024 * 10 });
|
|
6654
|
+
async function git(args, env2) {
|
|
6655
|
+
return execFileAsync4("git", args, { env: env2, maxBuffer: 1024 * 1024 * 10 });
|
|
6659
6656
|
}
|
|
6660
|
-
async function
|
|
6657
|
+
async function resolveCommit(checkoutPath, ref) {
|
|
6658
|
+
const candidates = ref === "HEAD" ? ["origin/HEAD"] : /^[0-9a-f]{7,40}$/i.test(ref) ? [ref] : [`origin/${ref}`, ref];
|
|
6659
|
+
let lastError;
|
|
6660
|
+
for (const candidate of candidates) {
|
|
6661
|
+
try {
|
|
6662
|
+
const { stdout } = await git(["-C", checkoutPath, "rev-parse", "--verify", `${candidate}^{commit}`]);
|
|
6663
|
+
return stdout.trim();
|
|
6664
|
+
} catch (error) {
|
|
6665
|
+
lastError = error;
|
|
6666
|
+
}
|
|
6667
|
+
}
|
|
6668
|
+
throw lastError;
|
|
6669
|
+
}
|
|
6670
|
+
async function snapshotCommit(checkoutPath, commit) {
|
|
6661
6671
|
const snapshotPath = join24(dirname17(checkoutPath), `${basename11(checkoutPath)}-${commit.slice(0, 12)}`);
|
|
6662
6672
|
if (await pathExists(snapshotPath)) return snapshotPath;
|
|
6663
6673
|
const tempPath = join24(dirname17(checkoutPath), `${basename11(snapshotPath)}.tmp-${process.pid}-${Date.now()}`);
|
|
6674
|
+
const tempIndexPath = `${tempPath}.index`;
|
|
6664
6675
|
await rm7(tempPath, { recursive: true, force: true });
|
|
6665
|
-
await
|
|
6666
|
-
|
|
6667
|
-
|
|
6668
|
-
|
|
6669
|
-
|
|
6670
|
-
|
|
6676
|
+
await rm7(tempIndexPath, { force: true });
|
|
6677
|
+
await mkdir14(tempPath, { recursive: true });
|
|
6678
|
+
const env2 = { ...process.env, GIT_INDEX_FILE: tempIndexPath };
|
|
6679
|
+
try {
|
|
6680
|
+
await git(["-C", checkoutPath, "read-tree", commit], env2);
|
|
6681
|
+
await git(["-C", checkoutPath, "checkout-index", "--all", `--prefix=${resolve7(tempPath)}${sep}`], env2);
|
|
6682
|
+
await removeGeneratedEntries(tempPath, false);
|
|
6683
|
+
} catch (error) {
|
|
6684
|
+
await rm7(tempPath, { recursive: true, force: true });
|
|
6685
|
+
throw error;
|
|
6686
|
+
} finally {
|
|
6687
|
+
await rm7(tempIndexPath, { force: true });
|
|
6688
|
+
}
|
|
6671
6689
|
try {
|
|
6672
6690
|
await rename3(tempPath, snapshotPath);
|
|
6673
6691
|
} catch (error) {
|
|
@@ -6677,6 +6695,16 @@ async function snapshotCheckout(checkoutPath, commit) {
|
|
|
6677
6695
|
}
|
|
6678
6696
|
return snapshotPath;
|
|
6679
6697
|
}
|
|
6698
|
+
async function assertOwnedByCurrentUser(path) {
|
|
6699
|
+
const currentUid = process.getuid?.();
|
|
6700
|
+
if (currentUid === void 0) return;
|
|
6701
|
+
const ownerUid = (await stat5(path)).uid;
|
|
6702
|
+
if (ownerUid !== currentUid) {
|
|
6703
|
+
throw new Error(
|
|
6704
|
+
`Git cache path ${path} is owned by uid ${ownerUid}, but Agentwheel is running as uid ${currentUid}. Run Agentwheel as the cache owner or use a separate cache root.`
|
|
6705
|
+
);
|
|
6706
|
+
}
|
|
6707
|
+
}
|
|
6680
6708
|
|
|
6681
6709
|
// src/source/mcp-registry.ts
|
|
6682
6710
|
import { mkdir as mkdir15, writeFile as writeFile16 } from "fs/promises";
|
|
@@ -6817,14 +6845,14 @@ function cachePathFor3(serverName, cacheRoot) {
|
|
|
6817
6845
|
// src/source/skillkit.ts
|
|
6818
6846
|
import { createHash as createHash6, randomUUID as randomUUID2 } from "crypto";
|
|
6819
6847
|
import { execFile as execFile5 } from "child_process";
|
|
6820
|
-
import { cp as
|
|
6848
|
+
import { cp as cp2, mkdir as mkdir16, readFile as readFile20, rename as rename4, rm as rm8 } from "fs/promises";
|
|
6821
6849
|
import { homedir as homedir4 } from "os";
|
|
6822
6850
|
import { basename as basename14, dirname as dirname20, join as join27, resolve as resolve9 } from "path";
|
|
6823
6851
|
import { promisify as promisify5 } from "util";
|
|
6824
6852
|
import * as defaultSkillKit from "@skillkit/core";
|
|
6825
6853
|
|
|
6826
6854
|
// src/source/skill-artifacts.ts
|
|
6827
|
-
import { readdir as readdir4, stat as
|
|
6855
|
+
import { readdir as readdir4, stat as stat6 } from "fs/promises";
|
|
6828
6856
|
import { basename as basename13, dirname as dirname19, extname as extname2, join as join26 } from "path";
|
|
6829
6857
|
async function artifactsFromSkillPaths(paths, packageName) {
|
|
6830
6858
|
const artifacts = [];
|
|
@@ -6845,7 +6873,7 @@ async function discoverSkillPaths(root) {
|
|
|
6845
6873
|
return paths;
|
|
6846
6874
|
}
|
|
6847
6875
|
async function artifactFromSkillPath(item, packageName) {
|
|
6848
|
-
const stats = await
|
|
6876
|
+
const stats = await stat6(item.path);
|
|
6849
6877
|
if (stats.isDirectory()) {
|
|
6850
6878
|
const skillMd = join26(item.path, "SKILL.md");
|
|
6851
6879
|
if (!await pathExists(skillMd)) return void 0;
|
|
@@ -7022,7 +7050,7 @@ var SkillKitSourceDriver = class {
|
|
|
7022
7050
|
return { path: cachePath, commit: resolvedIdentity.commit, cacheIdentity: resolvedIdentity.cacheKey };
|
|
7023
7051
|
}
|
|
7024
7052
|
const publishCandidate = resolve9(result.path) === resolve9(candidatePath) ? candidatePath : publishPath;
|
|
7025
|
-
if (publishCandidate === publishPath) await
|
|
7053
|
+
if (publishCandidate === publishPath) await cp2(result.path, publishPath, { recursive: true, dereference: true });
|
|
7026
7054
|
try {
|
|
7027
7055
|
await rename4(publishCandidate, cachePath);
|
|
7028
7056
|
} catch (error) {
|
|
@@ -7149,7 +7177,7 @@ async function checkoutCommit(root, commit) {
|
|
|
7149
7177
|
}
|
|
7150
7178
|
|
|
7151
7179
|
// src/source/vercel-skills.ts
|
|
7152
|
-
import { stat as
|
|
7180
|
+
import { stat as stat7 } from "fs/promises";
|
|
7153
7181
|
import { basename as basename15, join as join28, relative as relative5, resolve as resolve10 } from "path";
|
|
7154
7182
|
var VercelSkillsSourceDriver = class {
|
|
7155
7183
|
name = "vercel-skills";
|
|
@@ -7158,7 +7186,7 @@ var VercelSkillsSourceDriver = class {
|
|
|
7158
7186
|
const parsed = parseVercelSource(source);
|
|
7159
7187
|
if (parsed.kind === "local") {
|
|
7160
7188
|
const resolvedPath = resolve10(parsed.path);
|
|
7161
|
-
if (!await pathExists(resolvedPath) || !(await
|
|
7189
|
+
if (!await pathExists(resolvedPath) || !(await stat7(resolvedPath)).isDirectory()) {
|
|
7162
7190
|
throw new Error(`Vercel skills local source not found: ${resolvedPath}`);
|
|
7163
7191
|
}
|
|
7164
7192
|
return {
|
|
@@ -7283,14 +7311,14 @@ function getSourceDriver(name = "local") {
|
|
|
7283
7311
|
}
|
|
7284
7312
|
|
|
7285
7313
|
// src/staging/staging.ts
|
|
7286
|
-
import { chmod, cp as
|
|
7287
|
-
import { basename as basename19, dirname as dirname24, join as join32, relative as relative7, resolve as resolve12, sep as
|
|
7314
|
+
import { chmod, cp as cp4, mkdir as mkdir19, mkdtemp as mkdtemp3, readdir as readdir7, stat as stat10 } from "fs/promises";
|
|
7315
|
+
import { basename as basename19, dirname as dirname24, join as join32, relative as relative7, resolve as resolve12, sep as sep3 } from "path";
|
|
7288
7316
|
import { tmpdir as tmpdir4 } from "os";
|
|
7289
7317
|
|
|
7290
7318
|
// src/compose/markdown.ts
|
|
7291
7319
|
import { createHash as createHash7 } from "crypto";
|
|
7292
|
-
import { readdir as readdir5, readFile as readFile21, stat as
|
|
7293
|
-
import { basename as basename16, dirname as dirname21, extname as extname3, join as join29, relative as relative6, resolve as resolve11, sep } from "path";
|
|
7320
|
+
import { readdir as readdir5, readFile as readFile21, stat as stat8, writeFile as writeFile17 } from "fs/promises";
|
|
7321
|
+
import { basename as basename16, dirname as dirname21, extname as extname3, join as join29, relative as relative6, resolve as resolve11, sep as sep2 } from "path";
|
|
7294
7322
|
var includePattern = /<!--\s*openpack:include(\?)?\s+([^>]+?)\s*-->/g;
|
|
7295
7323
|
var escapedIncludePattern = /<!--\s*openpack\\:include(\?)?\s+([^>]+?)\s*-->/g;
|
|
7296
7324
|
var generatedPattern = /<!--\s*(?:BEGIN|END)\s+openpack:include\b/;
|
|
@@ -7427,7 +7455,7 @@ async function expandInclude(selector, packageRoot, artifactPaths, options) {
|
|
|
7427
7455
|
if (options.optional) return void 0;
|
|
7428
7456
|
throw new Error(`OpenPack include not found: ${displaySelector}`);
|
|
7429
7457
|
}
|
|
7430
|
-
const stats = await
|
|
7458
|
+
const stats = await stat8(sourcePath);
|
|
7431
7459
|
if (!stats.isFile()) {
|
|
7432
7460
|
throw new Error(`OpenPack include is not a file: ${displaySelector}`);
|
|
7433
7461
|
}
|
|
@@ -7491,14 +7519,14 @@ function extractOpenPackIncludeSelectors(content) {
|
|
|
7491
7519
|
function resolvePackageSelector(packageRoot, selector) {
|
|
7492
7520
|
const root = resolve11(packageRoot);
|
|
7493
7521
|
const resolved = resolve11(root, selector);
|
|
7494
|
-
if (resolved !== root && !resolved.startsWith(`${root}${
|
|
7522
|
+
if (resolved !== root && !resolved.startsWith(`${root}${sep2}`)) {
|
|
7495
7523
|
throw new Error(`OpenPack include escapes package root: ${selector}`);
|
|
7496
7524
|
}
|
|
7497
7525
|
return resolved;
|
|
7498
7526
|
}
|
|
7499
7527
|
async function markdownFilesForArtifact(artifact) {
|
|
7500
7528
|
const root = artifact.stagedPath ?? artifact.sourcePath;
|
|
7501
|
-
const stats = await
|
|
7529
|
+
const stats = await stat8(root);
|
|
7502
7530
|
if (stats.isFile()) return extname3(root).toLowerCase() === ".md" ? [root] : [];
|
|
7503
7531
|
if (!stats.isDirectory()) return [];
|
|
7504
7532
|
return listMarkdownFiles(root);
|
|
@@ -7571,7 +7599,7 @@ function artifactPathMap(artifacts) {
|
|
|
7571
7599
|
}
|
|
7572
7600
|
|
|
7573
7601
|
// src/staging/customize.ts
|
|
7574
|
-
import { cp as
|
|
7602
|
+
import { cp as cp3, mkdir as mkdir17, readdir as readdir6, readFile as readFile22, writeFile as writeFile18 } from "fs/promises";
|
|
7575
7603
|
import { dirname as dirname22, join as join30 } from "path";
|
|
7576
7604
|
async function applyCustomizations(artifacts, options) {
|
|
7577
7605
|
let next = [...artifacts];
|
|
@@ -7670,7 +7698,7 @@ async function applyReplacements2(artifacts, options, channel, artifactTypes) {
|
|
|
7670
7698
|
const existing = byKey.get(artifactMapKey);
|
|
7671
7699
|
const stagedPath = join30(options.stageRoot, ".agentwheel-composed", channel, type, entry.name);
|
|
7672
7700
|
await mkdir17(dirname22(stagedPath), { recursive: true });
|
|
7673
|
-
await
|
|
7701
|
+
await cp3(full, stagedPath, { recursive: artifactKind === "dir", dereference: true });
|
|
7674
7702
|
byKey.set(artifactMapKey, {
|
|
7675
7703
|
...existing,
|
|
7676
7704
|
type,
|
|
@@ -7786,7 +7814,7 @@ async function stageResolvedArtifactsRaw(resolved, artifacts) {
|
|
|
7786
7814
|
for (const artifact of artifacts) {
|
|
7787
7815
|
const stagedPath = join32(root, artifact.relativePath);
|
|
7788
7816
|
await mkdir19(dirname24(stagedPath), { recursive: true });
|
|
7789
|
-
await
|
|
7817
|
+
await cp4(artifact.sourcePath, stagedPath, {
|
|
7790
7818
|
recursive: artifact.kind === "dir",
|
|
7791
7819
|
dereference: true,
|
|
7792
7820
|
filter: (path) => !isIgnoredGeneratedEntry(basename19(path))
|
|
@@ -7878,7 +7906,7 @@ async function composeAssets(artifact, packageRoot, stagedPath) {
|
|
|
7878
7906
|
}
|
|
7879
7907
|
}
|
|
7880
7908
|
async function copyAsset(asset, source, dest) {
|
|
7881
|
-
const sourceStats = await
|
|
7909
|
+
const sourceStats = await stat10(source);
|
|
7882
7910
|
if (sourceStats.isFile()) {
|
|
7883
7911
|
if (matchesAny(basename19(source), asset.include)) {
|
|
7884
7912
|
await mkdir19(dest, { recursive: true });
|
|
@@ -7891,7 +7919,7 @@ async function copyAsset(asset, source, dest) {
|
|
|
7891
7919
|
}
|
|
7892
7920
|
if (!asset.include?.length) {
|
|
7893
7921
|
await mkdir19(dirname24(dest), { recursive: true });
|
|
7894
|
-
await
|
|
7922
|
+
await cp4(source, dest, { recursive: true, dereference: true });
|
|
7895
7923
|
if (asset.mode === "copy") await normalizeCopiedModes(dest);
|
|
7896
7924
|
return;
|
|
7897
7925
|
}
|
|
@@ -7903,13 +7931,13 @@ async function copyAsset(asset, source, dest) {
|
|
|
7903
7931
|
}
|
|
7904
7932
|
async function copyAssetFile(source, dest, asset) {
|
|
7905
7933
|
await mkdir19(dirname24(dest), { recursive: true });
|
|
7906
|
-
await
|
|
7934
|
+
await cp4(source, dest, { dereference: true });
|
|
7907
7935
|
if (asset.mode === "copy") await chmod(dest, 420);
|
|
7908
7936
|
}
|
|
7909
7937
|
function resolvePackagePath(packageRoot, path) {
|
|
7910
7938
|
const resolved = resolve12(packageRoot, path);
|
|
7911
7939
|
const root = resolve12(packageRoot);
|
|
7912
|
-
if (resolved !== root && !resolved.startsWith(`${root}${
|
|
7940
|
+
if (resolved !== root && !resolved.startsWith(`${root}${sep3}`)) {
|
|
7913
7941
|
throw new Error(`Asset include escapes package root: ${path}`);
|
|
7914
7942
|
}
|
|
7915
7943
|
return resolved;
|
|
@@ -7930,7 +7958,7 @@ async function listFiles2(root) {
|
|
|
7930
7958
|
return out;
|
|
7931
7959
|
}
|
|
7932
7960
|
async function normalizeCopiedModes(path) {
|
|
7933
|
-
const stats = await
|
|
7961
|
+
const stats = await stat10(path);
|
|
7934
7962
|
if (stats.isFile()) {
|
|
7935
7963
|
await chmod(path, 420);
|
|
7936
7964
|
return;
|
|
@@ -8335,12 +8363,12 @@ function sortedUnique2(values) {
|
|
|
8335
8363
|
}
|
|
8336
8364
|
|
|
8337
8365
|
// src/lifecycle/customization.ts
|
|
8338
|
-
import { appendFile, cp as
|
|
8366
|
+
import { appendFile, cp as cp5, mkdir as mkdir20, rm as rm10 } from "fs/promises";
|
|
8339
8367
|
import { dirname as dirname27, join as join36 } from "path";
|
|
8340
8368
|
|
|
8341
8369
|
// src/resolve/graph.ts
|
|
8342
8370
|
import { createHash as createHash9 } from "crypto";
|
|
8343
|
-
import { mkdtemp as mkdtemp4, readdir as readdir8, readFile as readFile27, stat as
|
|
8371
|
+
import { mkdtemp as mkdtemp4, readdir as readdir8, readFile as readFile27, stat as stat12 } from "fs/promises";
|
|
8344
8372
|
import { tmpdir as tmpdir5 } from "os";
|
|
8345
8373
|
import { basename as basename20, extname as extname4, join as join35 } from "path";
|
|
8346
8374
|
|
|
@@ -8467,7 +8495,7 @@ import { homedir as homedir7 } from "os";
|
|
|
8467
8495
|
import { resolve as resolve15 } from "path";
|
|
8468
8496
|
|
|
8469
8497
|
// src/registry/client.ts
|
|
8470
|
-
import { readFile as readFile26, rm as rm9, stat as
|
|
8498
|
+
import { readFile as readFile26, rm as rm9, stat as stat11 } from "fs/promises";
|
|
8471
8499
|
import { homedir as homedir6 } from "os";
|
|
8472
8500
|
import { dirname as dirname26, join as join34, resolve as resolve14 } from "path";
|
|
8473
8501
|
import { fileURLToPath } from "url";
|
|
@@ -8584,7 +8612,7 @@ var RegistryClient = class {
|
|
|
8584
8612
|
const filePath = source.startsWith("file:") ? fileURLToPath(source) : source;
|
|
8585
8613
|
if (await pathExists(filePath)) {
|
|
8586
8614
|
const fullPath = resolve14(filePath);
|
|
8587
|
-
const stats = await
|
|
8615
|
+
const stats = await stat11(fullPath);
|
|
8588
8616
|
return readFile26(stats.isDirectory() ? join34(fullPath, "index.json") : fullPath, "utf8");
|
|
8589
8617
|
}
|
|
8590
8618
|
const resolved = await this.git.fetch(await this.git.resolve(source, { cacheRoot: join34(dirname26(this.cachePath), "registry-repos") }));
|
|
@@ -9346,7 +9374,7 @@ function requirementTargetsRuntime(runtimes, runtime, label, warn) {
|
|
|
9346
9374
|
}
|
|
9347
9375
|
async function markdownFilesForArtifact2(artifact) {
|
|
9348
9376
|
const root = artifact.sourcePath;
|
|
9349
|
-
const stats = await
|
|
9377
|
+
const stats = await stat12(root);
|
|
9350
9378
|
if (stats.isFile()) return extname4(root).toLowerCase() === ".md" ? [root] : [];
|
|
9351
9379
|
if (!stats.isDirectory()) return [];
|
|
9352
9380
|
return listMarkdownFiles2(root);
|
|
@@ -9639,7 +9667,7 @@ async function ejectArtifact(workspaceRoot, item) {
|
|
|
9639
9667
|
const ejectedPath = join36(workspaceRoot, ".agentwheel", "ejected", ...ejectedIdentity.split("/"), parsed.type, parsed.name);
|
|
9640
9668
|
await mkdir20(dirname27(ejectedPath), { recursive: true });
|
|
9641
9669
|
await rm10(ejectedPath, { recursive: true, force: true });
|
|
9642
|
-
await
|
|
9670
|
+
await cp5(artifact.stagedPath ?? artifact.sourcePath, ejectedPath, { recursive: artifact.kind === "dir", dereference: true });
|
|
9643
9671
|
return {
|
|
9644
9672
|
...parsed,
|
|
9645
9673
|
packageName: candidate.packageName,
|
|
@@ -11473,7 +11501,7 @@ function normalizeVersion(version) {
|
|
|
11473
11501
|
}
|
|
11474
11502
|
|
|
11475
11503
|
// src/model/package-validate.ts
|
|
11476
|
-
import { stat as
|
|
11504
|
+
import { stat as stat13 } from "fs/promises";
|
|
11477
11505
|
import { resolve as resolve19 } from "path";
|
|
11478
11506
|
async function validatePackage(root) {
|
|
11479
11507
|
const packageRoot = resolve19(root);
|
|
@@ -11582,7 +11610,7 @@ async function validateManifestComposeInclude(packageRoot, selector, optional, f
|
|
|
11582
11610
|
findings.push({ level: "error", message: `Compose include escapes package root: ${selector}`, path: manifestPath });
|
|
11583
11611
|
return;
|
|
11584
11612
|
}
|
|
11585
|
-
if (!optional) await
|
|
11613
|
+
if (!optional) await stat13(full);
|
|
11586
11614
|
} catch (error) {
|
|
11587
11615
|
if (!optional) {
|
|
11588
11616
|
findings.push({ level: "error", message: error instanceof Error ? error.message : String(error), path: manifestPath });
|
|
@@ -13262,7 +13290,7 @@ function ensureTrailingSlash(value) {
|
|
|
13262
13290
|
|
|
13263
13291
|
// src/trial/skill.ts
|
|
13264
13292
|
import { createHash as createHash14 } from "crypto";
|
|
13265
|
-
import { readFile as readFile35, stat as
|
|
13293
|
+
import { readFile as readFile35, stat as stat14 } from "fs/promises";
|
|
13266
13294
|
import { join as join49 } from "path";
|
|
13267
13295
|
import { parse as parseYaml2 } from "yaml";
|
|
13268
13296
|
var MAX_TRIAL_SKILL_BYTES = 512 * 1024;
|
|
@@ -13276,7 +13304,7 @@ async function createSkillTrial(driver, resolved, selectors) {
|
|
|
13276
13304
|
}
|
|
13277
13305
|
const artifact = skills[0];
|
|
13278
13306
|
const path = artifact.kind === "dir" ? join49(artifact.sourcePath, "SKILL.md") : artifact.sourcePath;
|
|
13279
|
-
const info = await
|
|
13307
|
+
const info = await stat14(path);
|
|
13280
13308
|
if (info.size > MAX_TRIAL_SKILL_BYTES) {
|
|
13281
13309
|
throw new Error(`Skill trial exceeds the ${MAX_TRIAL_SKILL_BYTES / 1024} KiB content limit.`);
|
|
13282
13310
|
}
|
package/openpack.json
CHANGED
package/package.json
CHANGED