jorgex-stack 1.9.44 → 1.9.46

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.
Files changed (3) hide show
  1. package/README.md +6 -4
  2. package/dist/cli.js +75 -9
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -116,7 +116,7 @@ Programmatic mode does **not** provide:
116
116
 
117
117
  El canon de Stack y el paquete Pi adoptado mantienen una snapshot de 17 árboles de skills con 89 archivos de skill. La identidad, procedencia e integridad del paquete adoptado son autoritativas en `src/lib/pi-runtime-pin.json`.
118
118
 
119
- Pi combines the frozen **snapshot v2** package with a Stack-owned shared projection. The version references that follow describe historical Stack/Pi transitions, not the current pin. The current pin, package integrity and lifecycle are maintained in [docs/references/pi-runtime.md](docs/references/pi-runtime.md) and `src/lib/pi-runtime-pin.json`; this README does not imply a future release.
119
+ Pi combines the frozen **snapshot v2** package with a Stack-owned shared projection. The version references that follow describe historical Stack/Pi transitions, not the current pin. The current pin is the published `jorgex-pi@0.8.23` artifact. Package integrity and lifecycle are maintained in [docs/references/pi-runtime.md](docs/references/pi-runtime.md) and `src/lib/pi-runtime-pin.json`; this README does not imply a future Stack release.
120
120
 
121
121
  The following command block is retained as historical reference for that transition:
122
122
 
@@ -128,11 +128,13 @@ pnpm dlx jorgex-stack@1.9.7 sync --agents pi
128
128
  pnpm dlx jorgex-stack@1.9.7 uninstall --agents pi
129
129
  ```
130
130
 
131
- Stack downloads the frozen registry tarball, verifies its exact size plus SHA-256/SHA-512, backs up Pi's `settings.json`, and only then asks Pi to install that local file. The exact artifact and integrity values are authoritative in `src/lib/pi-runtime-pin.json`, while the lifecycle remains authoritative in `src/lib/pi-runtime.ts`. Pi's own package-manager invocation is the narrow runtime exception to the repository's pnpm-only rule; the Stack lifecycle never launches npm directly. After the package is healthy, Stack projects the shared resources into Pi: marked `jorgex:system-prompt` and `jorgex:engram-protocol` sections in `~/.pi/agent/AGENTS.md`, canonical skills under `~/.agents/skills`, and `~/.pi/agent/prompts/lean-audit.md`. Pi 0.8.22 registers Context7 through an isolated in-memory HTTP bridge during bootstrap; `available` means configuration permits registration and does not imply an HTTP handshake. A conflict preserves the existing MCP file and blocks managed activation. No MCP configuration or credentials are written. For the file runtimes, Context7, Playwright and DevTools use independent managed sections. The global Playwright package and Chromium cache are shared by the machine; `--playwright-runtimes` controls which runtime receives the guide. The adopted Pi package implements and tests `playwright-handoff-v1` through `PI_CODING_AGENT_DIR/jorgex-pi/playwright.v1.json`. Historical package entries do not describe the current pin. Filters are applied only after this projection exists, so the package does not duplicate shared resources. Package ownership is recorded separately in `~/.jorgex-stack/pi-receipt.json`; projection ownership is recorded in `~/.jorgex-stack/pi-projection-receipt.json`. Package receipts reject manual, duplicate, divergent, partial, corrupt, copied-to-another-scope, or unknown-history state. Projection cleanup requires an exact scope-bound ownership receipt; DevTools conflicts preserve the handoff for review.
131
+ For the current Pi `0.8.23` pin, package identity and runner validation precede projection; the exact pending initialization diagnostic remains provisional until projection and final `sync` complete.
132
132
 
133
- The static `AGENTS.md` projected by Stack does not include Context7; Pi's native bootstrap adds that section after registering the isolated bridge. Pi never writes, owns or removes MCP files. In Claude Code, Codex and OpenCode, a compatible existing Context7 entry is preserved and removed only with explicit canonical Stack ownership.
133
+ Stack downloads the frozen registry tarball, verifies its exact size plus SHA-256/SHA-512, backs up Pi's `settings.json`, and only then asks Pi to install that local file. The exact artifact and integrity values are authoritative in `src/lib/pi-runtime-pin.json`, while the lifecycle remains authoritative in `src/lib/pi-runtime.ts`. Pi's own package-manager invocation is the narrow runtime exception to the repository's pnpm-only rule; the Stack lifecycle never launches npm directly. A managed install then runs `package install → projection install → package sync`: after the package identity and runner are validated, Stack projects the shared resources into Pi and invokes Pi's native sync to complete initialization. The projection includes marked `jorgex:system-prompt` and `jorgex:engram-protocol` sections in `~/.pi/agent/AGENTS.md`, canonical skills under `~/.agents/skills`, and `~/.pi/agent/prompts/lean-audit.md`. Pi 0.8.23 registers Context7 through an isolated in-memory HTTP bridge during bootstrap; `available` means configuration permits registration and does not imply an HTTP handshake. A conflict preserves the existing MCP file and blocks managed activation. No MCP configuration or credentials are written. For the file runtimes, Context7, Playwright and DevTools use independent managed sections. The global Playwright package and Chromium cache are shared by the machine; `--playwright-runtimes` controls which runtime receives the guide. The adopted Pi package implements and tests `playwright-handoff-v1` through `PI_CODING_AGENT_DIR/jorgex-pi/playwright.v1.json`. Historical package entries do not describe the current pin. Filters are applied only after this projection exists, so the package does not duplicate shared resources. Package ownership is recorded separately in `~/.jorgex-stack/pi-receipt.json`; projection ownership is recorded in `~/.jorgex-stack/pi-projection-receipt.json`. Package receipts reject manual, duplicate, divergent, partial, corrupt, copied-to-another-scope, or unknown-history state. Projection cleanup requires an exact scope-bound ownership receipt; DevTools conflicts preserve the handoff for review.
134
134
 
135
- Pi 0.8.22 also seeds `theme=JorgeX`, `quietStartup=true`, and `hideThinkingBlock=true` only for missing fields during first initialization. User changes and deletions are preserved without reseeding. `hideThinkingBlock` changes presentation only; `defaultThinkingLevel` and reasoning remain unchanged. Pi owns only the fields it creates and records in its lifecycle receipt; pre-existing user settings remain unowned. The JorgeX header preserves builtin and custom commands. `Ctrl+O` remains Pi's native tool presentation, with `NO_COLOR` and `JORGEX_PI_MOTION` behavior unchanged; Stack adds no renderer.
135
+ The static `AGENTS.md` projected by Stack does not include Context7; Pi's native bootstrap adds that section after registering the isolated bridge. Pi never writes, owns or removes MCP files. In Claude Code, Codex and OpenCode, a compatible existing Context7 entry is preserved and removed only with explicit canonical Stack ownership. During package installation only, `initialization-diagnostics-v1` permits the exact pending `doctor` envelope described in [the Pi runtime reference](docs/references/pi-runtime.md); it is provisional and does not make Pi healthy. Projection and final `sync` must still complete, and every other unhealthy or malformed result remains blocked.
136
+
137
+ Pi 0.8.23 also seeds `theme=JorgeX`, `quietStartup=true`, and `hideThinkingBlock=true` only for missing fields during first initialization. User changes and deletions are preserved without reseeding. `hideThinkingBlock` changes presentation only; `defaultThinkingLevel` and reasoning remain unchanged. Pi owns only the fields it creates and records in its lifecycle receipt; pre-existing user settings remain unowned. The JorgeX header preserves builtin and custom commands. `Ctrl+O` remains Pi's native tool presentation, with `NO_COLOR` and `JORGEX_PI_MOTION` behavior unchanged; Stack adds no renderer.
136
138
 
137
139
  Historically, the published Pi 0.8.0 direct-package snapshot added `work-audit`: the snapshot grew from **17 to 18 skill trees** (96 to 97 files), and the active runtime allowlist grew from **16 to 17 skills**. The historical Pi 0.8.5 snapshot reference records 18 skill trees and 98 files; it does not describe the adopted pin. Reference F2-A is included while the private F1 skills remain preserved. `playwright-cli` remains in the snapshot but inactive because browser automation is a separate opt-in integration.
138
140
 
package/dist/cli.js CHANGED
@@ -6146,16 +6146,16 @@ import { createHash as createHash2 } from "crypto";
6146
6146
  var pi_runtime_pin_default = {
6147
6147
  package: {
6148
6148
  name: "jorgex-pi",
6149
- version: "0.8.22",
6150
- source: "npm:jorgex-pi@0.8.22"
6149
+ version: "0.8.23",
6150
+ source: "npm:jorgex-pi@0.8.23"
6151
6151
  },
6152
6152
  provenance: {
6153
- commit: "462de6f6f52dbc86b6808ed051dd441932974500"
6153
+ commit: "ebb5e6e18e8e9297ffbf7bd53cf6785b952474b9"
6154
6154
  },
6155
6155
  tarball: {
6156
- bytes: 89140502,
6157
- sha256: "98fbcffe5ee81e9fd8754dfbb40d786ee7c10251ef7050d68e70808f8de4d1df",
6158
- sha512: "ef415061fab27328cc1e43238653705bca089d32719034a3e6543da19069d42996d5b799b1f94eac8b2fccd64d97b2440dbf1ddcd1f3d22d9fc45ac0a805a7cd"
6156
+ bytes: 89140657,
6157
+ sha256: "cbe75c7975353c6ed3123a9bd9c3395e18263a49f33f80a607123392ba27a8fd",
6158
+ sha512: "bb6dd4075a25818f301ed73d6b7b1432beca635fb6c130c0b0543844d086475640c41fa1e1e68035f3df97ad3cee52e5de8917b05fe01d7483875ae934e3374d"
6159
6159
  }
6160
6160
  };
6161
6161
 
@@ -6187,7 +6187,8 @@ var PI_RUNTIME_CANDIDATE = {
6187
6187
  "tui-branding-v1",
6188
6188
  "managed-primary-model-v1",
6189
6189
  "quality-receipt-contract-v1",
6190
- "quality-capabilities-contract-v1"
6190
+ "quality-capabilities-contract-v1",
6191
+ "initialization-diagnostics-v1"
6191
6192
  ],
6192
6193
  runner: {
6193
6194
  bin: "jorgex-pi",
@@ -6338,6 +6339,49 @@ function healthyDoctor(stdout, stderr, packageRunner, candidate) {
6338
6339
  return false;
6339
6340
  }
6340
6341
  }
6342
+ function provisionalPendingDoctor(exitCode, stdout, stderr, packageRunner, candidate) {
6343
+ const capabilities = candidate.capabilities ?? PI_RUNTIME_CANDIDATE.contract.capabilities;
6344
+ if (!capabilities.includes("initialization-diagnostics-v1")) return false;
6345
+ if (exitCode !== 1 || stderr !== "" || !stdout.endsWith("\n") || stdout.slice(0, -1).includes("\n")) return false;
6346
+ try {
6347
+ const record = JSON.parse(stdout.slice(0, -1));
6348
+ if (record === null || typeof record !== "object" || Array.isArray(record)) return false;
6349
+ if (JSON.stringify(Object.keys(record).sort()) !== JSON.stringify(["command", "error", "ok", "package", "result", "schemaVersion"])) return false;
6350
+ if (Reflect.get(record, "schemaVersion") !== 1) return false;
6351
+ if (Reflect.get(record, "command") !== "doctor") return false;
6352
+ if (Reflect.get(record, "ok") !== false) return false;
6353
+ const packageValue = Reflect.get(record, "package");
6354
+ if (packageValue === null || typeof packageValue !== "object" || Array.isArray(packageValue)) return false;
6355
+ if (JSON.stringify(Object.keys(packageValue).sort()) !== JSON.stringify(["name", "root", "version"])) return false;
6356
+ if (Reflect.get(packageValue, "name") !== "jorgex-pi") return false;
6357
+ if (Reflect.get(packageValue, "version") !== (candidate.package?.version ?? /^npm:jorgex-pi@([^\s]+)$/.exec(candidate.source)?.[1])) return false;
6358
+ if (path33.resolve(packageRunner) !== path33.resolve(String(Reflect.get(packageValue, "root")), "bin", "jorgex-pi.mjs")) return false;
6359
+ const result = Reflect.get(record, "result");
6360
+ if (result === null || typeof result !== "object" || Array.isArray(result)) return false;
6361
+ if (JSON.stringify(Object.keys(result).sort()) !== JSON.stringify(["checks", "healthy"])) return false;
6362
+ if (Reflect.get(result, "healthy") !== false) return false;
6363
+ const checks = Reflect.get(result, "checks");
6364
+ if (!Array.isArray(checks) || checks.length !== 5) return false;
6365
+ const expectedIds = ["package", "engram", "context7", "permissions", "experience"];
6366
+ for (let index = 0; index < 5; index++) {
6367
+ const check = checks[index];
6368
+ if (check === null || typeof check !== "object" || Array.isArray(check)) return false;
6369
+ if (JSON.stringify(Object.keys(check).sort()) !== JSON.stringify(["id", "status"])) return false;
6370
+ if (Reflect.get(check, "id") !== expectedIds[index]) return false;
6371
+ const status = Reflect.get(check, "status");
6372
+ if (index < 3) {
6373
+ if (status !== "ok") return false;
6374
+ } else if (status !== "ok" && status !== "error") return false;
6375
+ }
6376
+ if (Reflect.get(checks[3], "status") === "ok" && Reflect.get(checks[4], "status") === "ok") return false;
6377
+ const errorValue = Reflect.get(record, "error");
6378
+ if (errorValue === null || typeof errorValue !== "object" || Array.isArray(errorValue)) return false;
6379
+ if (JSON.stringify(Object.keys(errorValue).sort()) !== JSON.stringify(["code", "message", "phase", "remedy"])) return false;
6380
+ return Reflect.get(errorValue, "phase") === "initialization" && Reflect.get(errorValue, "code") === "INITIALIZATION_REQUIRED" && Reflect.get(errorValue, "message") === "Pi initialization is pending: run sync to complete first initialization." && Reflect.get(errorValue, "remedy") === "Run jorgex-pi sync --json and retry.";
6381
+ } catch {
6382
+ return false;
6383
+ }
6384
+ }
6341
6385
  function installPiFromVerifiedTarball(input, deps) {
6342
6386
  const paths = input.targetDir === void 0 ? userPaths(input.engramBin, input.piExecutable) : targetPaths(input.targetDir, input.engramBin, input.piExecutable);
6343
6387
  const destination = input.targetDir === void 0 ? path33.join(dataDir(), "packages", `jorgex-pi-${PI_RUNTIME_CANDIDATE.package.version}.tgz`) : path33.join(path33.resolve(input.targetDir), "downloads", `jorgex-pi-${PI_RUNTIME_CANDIDATE.package.version}.tgz`);
@@ -6368,7 +6412,9 @@ function installPiFromVerifiedTarball(input, deps) {
6368
6412
  args: [paths.packageRunner, "doctor", "--json"],
6369
6413
  environment: paths.environment
6370
6414
  });
6371
- if (doctor.exitCode !== 0 || !healthyDoctor(doctor.stdout, doctor.stderr, paths.packageRunner, input.candidate)) {
6415
+ const healthy = doctor.exitCode === 0 && healthyDoctor(doctor.stdout, doctor.stderr, paths.packageRunner, input.candidate);
6416
+ const pending = provisionalPendingDoctor(doctor.exitCode, doctor.stdout, doctor.stderr, paths.packageRunner, input.candidate);
6417
+ if (!healthy && !pending) {
6372
6418
  return { kind: "blocked", reason: "runner-unhealthy" };
6373
6419
  }
6374
6420
  const receipt = flatCandidateReceipt(input.candidate, scope, "installed", input.engramBin);
@@ -6680,7 +6726,8 @@ async function runPiRuntimeSystem(input) {
6680
6726
  source: PI_RUNTIME_CANDIDATE.package.source,
6681
6727
  ...PI_RUNTIME_CANDIDATE.tarball,
6682
6728
  package: PI_RUNTIME_CANDIDATE.package,
6683
- provenance: PI_RUNTIME_CANDIDATE.provenance
6729
+ provenance: PI_RUNTIME_CANDIDATE.provenance,
6730
+ capabilities: PI_RUNTIME_CANDIDATE.contract.capabilities
6684
6731
  }
6685
6732
  }, {
6686
6733
  download: () => artifact,
@@ -6746,6 +6793,21 @@ async function completeProjection(operation, packageResult, deps) {
6746
6793
  }
6747
6794
  return projectionResult.kind === "blocked" ? projectionResult : packageResult;
6748
6795
  }
6796
+ var INSTALL_INIT_REMEDY = "Corrige la causa y ejecuta sync --agents pi para completar la inicializaci\xF3n.";
6797
+ var INSTALL_INIT_TARGET_REMEDY = "Corrige la causa y ejecuta sync --agents pi con el mismo --target-dir para completar la inicializaci\xF3n.";
6798
+ function withInstallInitRemedy(result, fallbackRemedy) {
6799
+ return result.remedy === void 0 ? { kind: "blocked", reason: result.reason, remedy: fallbackRemedy } : result;
6800
+ }
6801
+ async function completeInstallWithInitialization(packageResult, deps) {
6802
+ const projected = await completeProjection("install", packageResult, deps);
6803
+ if (projected.kind === "blocked") return projected;
6804
+ const fallbackRemedy = deps.installInitRemedy ?? INSTALL_INIT_REMEDY;
6805
+ const initResult = await deps.runPackage("sync");
6806
+ if (initResult.kind === "synced") return packageResult;
6807
+ if (initResult.kind === "manual-existing") return manualExistingResult(initResult);
6808
+ if (initResult.kind === "blocked") return withInstallInitRemedy(initResult, fallbackRemedy);
6809
+ return { kind: "blocked", reason: "runner-unhealthy", remedy: fallbackRemedy };
6810
+ }
6749
6811
  async function runManagedPiOperation(operation, deps) {
6750
6812
  if (operation === "uninstall") {
6751
6813
  const preparation = await deps.prepareProjectionUninstall();
@@ -6758,6 +6820,9 @@ async function runManagedPiOperation(operation, deps) {
6758
6820
  const packageResult = await deps.runPackage(operation);
6759
6821
  if (packageResult.kind === "manual-existing") return manualExistingResult(packageResult);
6760
6822
  if (operation === "models") return packageResult;
6823
+ if (operation === "install" && packageResult.kind !== "blocked") {
6824
+ return completeInstallWithInitialization(packageResult, deps);
6825
+ }
6761
6826
  const nextProjectionOperation = projectionOperation(operation);
6762
6827
  if (packageResult.kind !== "blocked") {
6763
6828
  return completeProjection(nextProjectionOperation, packageResult, deps);
@@ -6837,6 +6902,7 @@ async function runManagedPiSystem(input) {
6837
6902
  };
6838
6903
  if (preparedStyle !== void 0 && input.operation !== "doctor") applyWritingStyle(preparedStyle);
6839
6904
  const result = await runManagedPiOperation(input.operation, {
6905
+ installInitRemedy: input.targetDir === void 0 ? void 0 : INSTALL_INIT_TARGET_REMEDY,
6840
6906
  async runPackage(operation) {
6841
6907
  return managedPackageResult(await runPiRuntimeSystem({ ...runtimeInput, operation }));
6842
6908
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jorgex-stack",
3
- "version": "1.9.44",
3
+ "version": "1.9.46",
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",