jorgex-stack 1.9.55 → 1.9.57
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/cli.js +98 -12
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -3575,6 +3575,10 @@ var REQUIRED_CAPABILITIES = /* @__PURE__ */ new Set([
|
|
|
3575
3575
|
"runner-json-v1",
|
|
3576
3576
|
"managed-primary-model-v1"
|
|
3577
3577
|
]);
|
|
3578
|
+
var PERMISSIONS_UPGRADE_CAPABILITY = "permissions-upgrade-v1";
|
|
3579
|
+
function supportsPermissionsUpgrade(capabilities) {
|
|
3580
|
+
return Array.isArray(capabilities) && capabilities.includes(PERMISSIONS_UPGRADE_CAPABILITY);
|
|
3581
|
+
}
|
|
3578
3582
|
var ALLOWED_EXTERNAL_WRITES = /* @__PURE__ */ new Set([
|
|
3579
3583
|
"settings.json",
|
|
3580
3584
|
"models.json",
|
|
@@ -3598,6 +3602,7 @@ function managedExternalWritesAreSafe(writes, capabilities) {
|
|
|
3598
3602
|
const permissions = capabilities.includes("permissions-policy-v1");
|
|
3599
3603
|
const experience = capabilities.includes("experience-defaults-v1");
|
|
3600
3604
|
if (experience && !permissions) return false;
|
|
3605
|
+
if (supportsPermissionsUpgrade(capabilities) && !permissions) return false;
|
|
3601
3606
|
const allowed = experience ? EXPERIENCE_EXTERNAL_WRITES : permissions ? PERMISSIONS_EXTERNAL_WRITES : ALLOWED_EXTERNAL_WRITES;
|
|
3602
3607
|
if (writes.length !== allowed.size) return false;
|
|
3603
3608
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -3820,6 +3825,43 @@ function runPackageCommand(input, deps, command) {
|
|
|
3820
3825
|
if (result.exitCode !== 0) return { kind: "blocked", reason: "runner-unhealthy" };
|
|
3821
3826
|
return parseRunnerRecord(result.stdout, result.stderr, command, input.candidate, input.packageRunner) ?? { kind: "blocked", reason: "runner-output" };
|
|
3822
3827
|
}
|
|
3828
|
+
var CONFIG_LOCKED_SIGNAL = "CONFIG_LOCKED";
|
|
3829
|
+
var UPGRADE_LOCK_RETRIES = 2;
|
|
3830
|
+
function stdoutHasConfigLockedSignal(stdout) {
|
|
3831
|
+
const body = stdout.endsWith("\n") ? stdout.slice(0, -1) : stdout;
|
|
3832
|
+
if (body === "" || body.includes("\n") || body.includes("\r")) return false;
|
|
3833
|
+
try {
|
|
3834
|
+
const parsed = JSON.parse(body);
|
|
3835
|
+
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) return false;
|
|
3836
|
+
const error = Reflect.get(parsed, "error");
|
|
3837
|
+
if (error === null || typeof error !== "object" || Array.isArray(error)) return false;
|
|
3838
|
+
return Reflect.get(error, "code") === CONFIG_LOCKED_SIGNAL;
|
|
3839
|
+
} catch {
|
|
3840
|
+
return false;
|
|
3841
|
+
}
|
|
3842
|
+
}
|
|
3843
|
+
function isConfigLockedFailure(result) {
|
|
3844
|
+
if (result.exitCode !== 1) return false;
|
|
3845
|
+
return stdoutHasConfigLockedSignal(result.stdout) || result.stderr.includes(CONFIG_LOCKED_SIGNAL);
|
|
3846
|
+
}
|
|
3847
|
+
function runUpgradeWithLockRetry(input, deps) {
|
|
3848
|
+
let retries = 0;
|
|
3849
|
+
for (; ; ) {
|
|
3850
|
+
const raw = deps.run({
|
|
3851
|
+
executable: input.packageRunner,
|
|
3852
|
+
args: ["upgrade", "--json"],
|
|
3853
|
+
environment: input.environment
|
|
3854
|
+
});
|
|
3855
|
+
if (raw.exitCode !== 0) {
|
|
3856
|
+
if (isConfigLockedFailure(raw) && retries < UPGRADE_LOCK_RETRIES) {
|
|
3857
|
+
retries += 1;
|
|
3858
|
+
continue;
|
|
3859
|
+
}
|
|
3860
|
+
return { kind: "blocked", reason: "runner-unhealthy" };
|
|
3861
|
+
}
|
|
3862
|
+
return parseRunnerRecord(raw.stdout, raw.stderr, "upgrade", input.candidate, input.packageRunner) ?? { kind: "blocked", reason: "runner-output" };
|
|
3863
|
+
}
|
|
3864
|
+
}
|
|
3823
3865
|
function isBlockedResult(value) {
|
|
3824
3866
|
return "kind" in value;
|
|
3825
3867
|
}
|
|
@@ -3852,7 +3894,32 @@ function executePiPackageLifecycle(input, deps) {
|
|
|
3852
3894
|
if (result === null || typeof result !== "object" || Reflect.get(result, "changed") !== true && Reflect.get(result, "changed") !== false || !Array.isArray(Reflect.get(result, "actions"))) {
|
|
3853
3895
|
return { kind: "blocked", reason: "runner-unhealthy" };
|
|
3854
3896
|
}
|
|
3855
|
-
|
|
3897
|
+
const syncActions = Reflect.get(result, "actions");
|
|
3898
|
+
if (input.upgradePermissions !== true || !supportsPermissionsUpgrade(input.candidate.contract.capabilities)) {
|
|
3899
|
+
return { kind: "synced", actions: syncActions };
|
|
3900
|
+
}
|
|
3901
|
+
const upgrade = runUpgradeWithLockRetry(input, deps);
|
|
3902
|
+
if (isBlockedResult(upgrade)) return upgrade;
|
|
3903
|
+
const upgraded = upgrade.result;
|
|
3904
|
+
if (upgraded === null || typeof upgraded !== "object" || Array.isArray(upgraded)) {
|
|
3905
|
+
return { kind: "blocked", reason: "runner-output" };
|
|
3906
|
+
}
|
|
3907
|
+
const changed = Reflect.get(upgraded, "changed");
|
|
3908
|
+
const actions = Reflect.get(upgraded, "actions");
|
|
3909
|
+
if (changed !== true && changed !== false || !Array.isArray(actions)) {
|
|
3910
|
+
return { kind: "blocked", reason: "runner-unhealthy" };
|
|
3911
|
+
}
|
|
3912
|
+
if (typeof Reflect.get(upgraded, "policy") === "string" || typeof Reflect.get(upgraded, "config") === "string") {
|
|
3913
|
+
return { kind: "blocked", reason: "runner-output" };
|
|
3914
|
+
}
|
|
3915
|
+
if (changed === true) {
|
|
3916
|
+
const policySha256 = Reflect.get(upgraded, "policySha256");
|
|
3917
|
+
if (typeof policySha256 !== "string" || !/^[a-f0-9]{64}$/.test(policySha256)) {
|
|
3918
|
+
return { kind: "blocked", reason: "runner-output" };
|
|
3919
|
+
}
|
|
3920
|
+
return { kind: "synced", actions: [...syncActions, ...actions], upgraded: true, policySha256 };
|
|
3921
|
+
}
|
|
3922
|
+
return { kind: "synced", actions: [...syncActions, ...actions], upgraded: false };
|
|
3856
3923
|
}
|
|
3857
3924
|
const models = command.result;
|
|
3858
3925
|
if (models === null || typeof models !== "object" || Reflect.get(models, "mode") !== "inherit-session" || !sameRecord(Reflect.get(models, "tiers"), ["strong", "standard", "cheap"])) {
|
|
@@ -6347,16 +6414,16 @@ import { createHash as createHash2 } from "crypto";
|
|
|
6347
6414
|
var pi_runtime_pin_default = {
|
|
6348
6415
|
package: {
|
|
6349
6416
|
name: "jorgex-pi",
|
|
6350
|
-
version: "0.8.
|
|
6351
|
-
source: "npm:jorgex-pi@0.8.
|
|
6417
|
+
version: "0.8.27",
|
|
6418
|
+
source: "npm:jorgex-pi@0.8.27"
|
|
6352
6419
|
},
|
|
6353
6420
|
provenance: {
|
|
6354
|
-
commit: "
|
|
6421
|
+
commit: "97fb35c88c484f264cbd9dc1f0a3c65da2f9dba1"
|
|
6355
6422
|
},
|
|
6356
6423
|
tarball: {
|
|
6357
|
-
bytes:
|
|
6358
|
-
sha256: "
|
|
6359
|
-
sha512: "
|
|
6424
|
+
bytes: 89140773,
|
|
6425
|
+
sha256: "2ac1ed88c419de87d7a519aa269cac7015e477f6c5250fe7d7090a4c40e3fa17",
|
|
6426
|
+
sha512: "6adbdb8dcf35bd7b6eba63ac6b1c7fc2ccf2063f5768a16bdb462104143a09039be629c8d67ab0e058533d882a27fbbc3d753c769297ed9ac1c04775a2f0b614"
|
|
6360
6427
|
}
|
|
6361
6428
|
};
|
|
6362
6429
|
|
|
@@ -6381,6 +6448,7 @@ var PI_RUNTIME_CANDIDATE = {
|
|
|
6381
6448
|
"engram-runtime-tools-v1",
|
|
6382
6449
|
"context7-http-v1",
|
|
6383
6450
|
"permissions-policy-v1",
|
|
6451
|
+
"permissions-upgrade-v1",
|
|
6384
6452
|
"experience-defaults-v1",
|
|
6385
6453
|
"chrome-devtools-handoff-v1",
|
|
6386
6454
|
"playwright-handoff-v1",
|
|
@@ -6393,7 +6461,7 @@ var PI_RUNTIME_CANDIDATE = {
|
|
|
6393
6461
|
],
|
|
6394
6462
|
runner: {
|
|
6395
6463
|
bin: "jorgex-pi",
|
|
6396
|
-
commands: ["status", "doctor", "models", "sync", "cleanup"],
|
|
6464
|
+
commands: ["status", "doctor", "models", "sync", "upgrade", "cleanup"],
|
|
6397
6465
|
schemaVersion: 1,
|
|
6398
6466
|
maxStdoutBytes: 65536
|
|
6399
6467
|
},
|
|
@@ -6724,7 +6792,8 @@ function runPiRuntime(input, deps) {
|
|
|
6724
6792
|
plan,
|
|
6725
6793
|
candidate: PI_RUNTIME_CANDIDATE,
|
|
6726
6794
|
packageRunner: paths.packageRunner,
|
|
6727
|
-
environment: paths.environment
|
|
6795
|
+
environment: paths.environment,
|
|
6796
|
+
...input.upgradePermissions === true ? { upgradePermissions: true } : {}
|
|
6728
6797
|
});
|
|
6729
6798
|
persistReturnedReceipt(result2, paths, deps);
|
|
6730
6799
|
return result2;
|
|
@@ -7065,8 +7134,11 @@ async function runManagedPiSystem(input) {
|
|
|
7065
7134
|
packageOnly,
|
|
7066
7135
|
writingStyle: suppliedStyle,
|
|
7067
7136
|
writingStyleMode,
|
|
7137
|
+
upgradePermissions: requestedUpgrade,
|
|
7068
7138
|
...runtimeInput
|
|
7069
7139
|
} = input;
|
|
7140
|
+
const supportsPermissionsUpgrade2 = PI_RUNTIME_CANDIDATE.contract.capabilities.includes("permissions-upgrade-v1");
|
|
7141
|
+
const upgradePermissions = requestedUpgrade === true && supportsPermissionsUpgrade2;
|
|
7070
7142
|
if (input.operation === "doctor" && packageOnly) {
|
|
7071
7143
|
const result2 = managedPackageResult(await runPiRuntimeSystem(runtimeInput));
|
|
7072
7144
|
return result2.kind === "manual-existing" ? manualExistingResult(result2) : result2;
|
|
@@ -7105,7 +7177,11 @@ async function runManagedPiSystem(input) {
|
|
|
7105
7177
|
const result = await runManagedPiOperation(input.operation, {
|
|
7106
7178
|
installInitRemedy: input.targetDir === void 0 ? void 0 : INSTALL_INIT_TARGET_REMEDY,
|
|
7107
7179
|
async runPackage(operation) {
|
|
7108
|
-
return managedPackageResult(await runPiRuntimeSystem({
|
|
7180
|
+
return managedPackageResult(await runPiRuntimeSystem({
|
|
7181
|
+
...runtimeInput,
|
|
7182
|
+
operation,
|
|
7183
|
+
...upgradePermissions ? { upgradePermissions: true } : {}
|
|
7184
|
+
}));
|
|
7109
7185
|
},
|
|
7110
7186
|
runProjection(operation) {
|
|
7111
7187
|
const result2 = runPiProjectionLifecycleSystem({
|
|
@@ -8023,7 +8099,16 @@ async function runSelectedPi(options) {
|
|
|
8023
8099
|
engramBin,
|
|
8024
8100
|
...devtoolsMcpEnabled === void 0 ? {} : { devtoolsMcpEnabled },
|
|
8025
8101
|
...playwrightCliEnabled === void 0 ? {} : { playwrightCliEnabled },
|
|
8026
|
-
...playwrightCapability === void 0 ? {} : { playwrightCapability }
|
|
8102
|
+
...playwrightCapability === void 0 ? {} : { playwrightCapability },
|
|
8103
|
+
...(() => {
|
|
8104
|
+
if (options.upgradePermissions !== true) return {};
|
|
8105
|
+
const supports = PI_RUNTIME_CANDIDATE.contract.capabilities.includes("permissions-upgrade-v1");
|
|
8106
|
+
if (!supports) {
|
|
8107
|
+
p6.log.info("Pi: --upgrade-permissions requiere un paquete con permissions-upgrade-v1; se contin\xFAa en modo seed-only.");
|
|
8108
|
+
return {};
|
|
8109
|
+
}
|
|
8110
|
+
return { upgradePermissions: true };
|
|
8111
|
+
})()
|
|
8027
8112
|
});
|
|
8028
8113
|
if (result.kind === "blocked") {
|
|
8029
8114
|
const paths = "paths" in result ? `: ${result.paths.join(", ")}` : "";
|
|
@@ -8258,7 +8343,8 @@ Flags disponibles: jorgex-stack --help`
|
|
|
8258
8343
|
writingStyle,
|
|
8259
8344
|
modePreference: mode,
|
|
8260
8345
|
playwrightCliEnabled: flags.targetDir === void 0 && exitCode === 0 && playwrightToolPlan.actions.length > 0 ? playwrightToolConsent.runtimeSelection?.pi : void 0,
|
|
8261
|
-
playwrightCapability
|
|
8346
|
+
playwrightCapability,
|
|
8347
|
+
...flags.upgradePermissions ? { upgradePermissions: true } : {}
|
|
8262
8348
|
});
|
|
8263
8349
|
exitCode = Math.max(exitCode, piExitCode);
|
|
8264
8350
|
piStatus = piExitCode === 0 ? "ok" : "failed";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jorgex-stack",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.57",
|
|
4
4
|
"description": "Harness multi-agente portable: instala la config JorgeX (agentes, skills, hooks, Engram, MCPs) en Claude Code, Codex CLI, OpenCode y Pi",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|