@ai-development-environment/control-agent 0.0.90 → 0.0.91
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/control-agent.js +36 -7
- package/package.json +1 -1
package/dist/control-agent.js
CHANGED
|
@@ -6172,6 +6172,7 @@ var WORKTREE_OPERATIONS = [
|
|
|
6172
6172
|
"PULL",
|
|
6173
6173
|
"PUSH",
|
|
6174
6174
|
"RESET",
|
|
6175
|
+
"CLEAR_LOCK",
|
|
6175
6176
|
"STASH_ALL",
|
|
6176
6177
|
"STAGE_ALL",
|
|
6177
6178
|
"UNSTAGE_ALL"
|
|
@@ -14355,6 +14356,20 @@ function rootPath(location) {
|
|
|
14355
14356
|
}
|
|
14356
14357
|
return path;
|
|
14357
14358
|
}
|
|
14359
|
+
function isContainedPath(base, candidate) {
|
|
14360
|
+
return candidate === base || candidate.startsWith(`${base}${sep6}`);
|
|
14361
|
+
}
|
|
14362
|
+
async function resolvedSkillRoot(location) {
|
|
14363
|
+
const root = rootPath(location);
|
|
14364
|
+
const resolvedRoot = await realpath6(root);
|
|
14365
|
+
if (location.scope === "PROJECT") {
|
|
14366
|
+
const resolvedProject = await realpath6(location.folder);
|
|
14367
|
+
if (!isContainedPath(resolvedProject, resolvedRoot)) {
|
|
14368
|
+
throw new Error("Project skill root resolves outside the project folder");
|
|
14369
|
+
}
|
|
14370
|
+
}
|
|
14371
|
+
return { root, resolvedRoot };
|
|
14372
|
+
}
|
|
14358
14373
|
function targetForFolder(targets, folder) {
|
|
14359
14374
|
return folder ? targets.find((target2) => resolve6(target2.folder) === resolve6(folder)) : void 0;
|
|
14360
14375
|
}
|
|
@@ -14395,14 +14410,15 @@ async function listPackageFiles(skillDirectory) {
|
|
|
14395
14410
|
await visit(skillDirectory);
|
|
14396
14411
|
return files;
|
|
14397
14412
|
}
|
|
14398
|
-
async function readPackage(directory) {
|
|
14413
|
+
async function readPackage(directory, resolvedRoot) {
|
|
14399
14414
|
const metadata = await lstat3(directory);
|
|
14400
|
-
|
|
14401
|
-
if (metadata.isSymbolicLink()) {
|
|
14402
|
-
resolvedDirectory = await realpath6(directory);
|
|
14403
|
-
} else if (!metadata.isDirectory()) {
|
|
14415
|
+
if (!metadata.isSymbolicLink() && !metadata.isDirectory()) {
|
|
14404
14416
|
throw new Error("Skill path is not a directory");
|
|
14405
14417
|
}
|
|
14418
|
+
const resolvedDirectory = await realpath6(directory);
|
|
14419
|
+
if (!isContainedPath(resolvedRoot, resolvedDirectory)) {
|
|
14420
|
+
throw new Error("Skill package resolves outside its configured root");
|
|
14421
|
+
}
|
|
14406
14422
|
const files = await listPackageFiles(resolvedDirectory);
|
|
14407
14423
|
const definition = files.find((file) => file.path === "SKILL.md");
|
|
14408
14424
|
if (!definition) throw new Error("Skill does not contain SKILL.md");
|
|
@@ -14442,6 +14458,15 @@ function consumersForRoot(configured, rootKind, scope) {
|
|
|
14442
14458
|
async function scanRoot2(location, configured, targets, warnings) {
|
|
14443
14459
|
const root = rootPath(location);
|
|
14444
14460
|
if (!await directoryExists(root)) return [];
|
|
14461
|
+
let resolvedRoot;
|
|
14462
|
+
try {
|
|
14463
|
+
resolvedRoot = (await resolvedSkillRoot(location)).resolvedRoot;
|
|
14464
|
+
} catch (error) {
|
|
14465
|
+
warnings.push(
|
|
14466
|
+
`${root}: ${error instanceof Error ? error.message : String(error)}`
|
|
14467
|
+
);
|
|
14468
|
+
return [];
|
|
14469
|
+
}
|
|
14445
14470
|
const consumers = consumersForRoot(
|
|
14446
14471
|
configured,
|
|
14447
14472
|
location.rootKind,
|
|
@@ -14454,7 +14479,7 @@ async function scanRoot2(location, configured, targets, warnings) {
|
|
|
14454
14479
|
if (!entry.isDirectory() && !entry.isSymbolicLink()) continue;
|
|
14455
14480
|
const directory = join9(root, entry.name);
|
|
14456
14481
|
try {
|
|
14457
|
-
const skillPackage = await readPackage(directory);
|
|
14482
|
+
const skillPackage = await readPackage(directory, resolvedRoot);
|
|
14458
14483
|
const relativeDirectory = location.folder ? relative6(location.folder, directory).split(sep6).join("/") : "";
|
|
14459
14484
|
installations.push({
|
|
14460
14485
|
...location,
|
|
@@ -14529,9 +14554,10 @@ var readSkills = async (payload) => {
|
|
|
14529
14554
|
if (!allowed.has(`${request.scope}:${root}`)) {
|
|
14530
14555
|
throw new Error("Requested skill root is not enabled or configured");
|
|
14531
14556
|
}
|
|
14557
|
+
const { resolvedRoot } = await resolvedSkillRoot(request);
|
|
14532
14558
|
packages.push({
|
|
14533
14559
|
...request,
|
|
14534
|
-
package: await readPackage(join9(root, request.skillName))
|
|
14560
|
+
package: await readPackage(join9(root, request.skillName), resolvedRoot)
|
|
14535
14561
|
});
|
|
14536
14562
|
}
|
|
14537
14563
|
return { ...successfulProcess6, packages };
|
|
@@ -18012,6 +18038,9 @@ var operateWorktree = async (payload, timeoutMs, signal) => {
|
|
|
18012
18038
|
await runGit(["clean", "-fd"], "Could not remove untracked files");
|
|
18013
18039
|
break;
|
|
18014
18040
|
}
|
|
18041
|
+
case "CLEAR_LOCK":
|
|
18042
|
+
await rm10(join14(input.gitDirectory, "index.lock"), { force: true });
|
|
18043
|
+
break;
|
|
18015
18044
|
case "STASH_ALL":
|
|
18016
18045
|
await runGit(["stash", "push", "--include-untracked"], "Stash failed");
|
|
18017
18046
|
break;
|