@massa-ai/codex-plugin 1.11.0 → 1.12.1
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/.codex-plugin/plugin.json +1 -1
- package/install.sh +81 -12
- package/package.json +1 -1
package/install.sh
CHANGED
|
@@ -297,7 +297,13 @@ if (typeof data.platforms !== "object" || data.platforms === null || Array.isArr
|
|
|
297
297
|
data.platforms = {};
|
|
298
298
|
}
|
|
299
299
|
data.version = 2;
|
|
300
|
+
const prev = data.platforms[host];
|
|
300
301
|
data.platforms[host] = { root, skillsOwner: "plugin", skills: ["massa-ai", "persona-router"] };
|
|
302
|
+
// The whole-record replace must not drop the plugin version record a previous
|
|
303
|
+
// successful install wrote (R2) — re-attach it.
|
|
304
|
+
if (prev && typeof prev === "object" && !Array.isArray(prev) && prev.plugin && typeof prev.plugin === "object") {
|
|
305
|
+
data.platforms[host].plugin = prev.plugin;
|
|
306
|
+
}
|
|
301
307
|
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
302
308
|
fs.writeFileSync(file, JSON.stringify(data, null, 2) + "\n");
|
|
303
309
|
NODE
|
|
@@ -323,28 +329,87 @@ try {
|
|
|
323
329
|
}
|
|
324
330
|
NODE
|
|
325
331
|
)"
|
|
326
|
-
[[ "$raw_owner" == "plugin" ]]
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
332
|
+
[[ "$raw_owner" == "plugin" ]] && {
|
|
333
|
+
local name
|
|
334
|
+
for name in massa-ai persona-router; do
|
|
335
|
+
rm -rf "$HARNESS_SKILLS_DIR/$name"
|
|
336
|
+
done
|
|
337
|
+
rmdir "$HARNESS_SKILLS_DIR" 2>/dev/null || true
|
|
338
|
+
echo " - removed plugin-owned harness skills from $HARNESS_SKILLS_DIR"
|
|
339
|
+
}
|
|
334
340
|
|
|
341
|
+
# AC-15: a plugin-owned platform keeps the whole-record delete (clean-slate
|
|
342
|
+
# semantics unchanged); any other platform loses only its plugin version
|
|
343
|
+
# record while root/skills/skillsOwner survive (Plan Challenge C-4).
|
|
335
344
|
"$runner" - "$HARNESS_STATE_FILE" "$HARNESS_HOST" <<'NODE'
|
|
336
345
|
const fs = require("fs");
|
|
337
346
|
const [, , file, host] = process.argv;
|
|
338
347
|
try {
|
|
339
348
|
const data = JSON.parse(fs.readFileSync(file, "utf8"));
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
349
|
+
const rec = data && data.platforms && data.platforms[host];
|
|
350
|
+
if (rec && typeof rec === "object") {
|
|
351
|
+
if (rec.skillsOwner === "plugin") {
|
|
352
|
+
delete data.platforms[host];
|
|
353
|
+
fs.writeFileSync(file, JSON.stringify(data, null, 2) + "\n");
|
|
354
|
+
} else if (rec.plugin && typeof rec.plugin === "object") {
|
|
355
|
+
delete rec.plugin;
|
|
356
|
+
fs.writeFileSync(file, JSON.stringify(data, null, 2) + "\n");
|
|
357
|
+
}
|
|
343
358
|
}
|
|
344
359
|
} catch { /* nothing to clean up */ }
|
|
345
360
|
NODE
|
|
346
361
|
}
|
|
347
362
|
|
|
363
|
+
# ── Plugin version recording (PAI-03/04/07) ─────────────────────────────────
|
|
364
|
+
# Why: the harness gates re-runs on the recorded bundle version, so a
|
|
365
|
+
# successful install records it — but ONLY as the final step of the
|
|
366
|
+
# install path. A version written before a later step fails would mark a
|
|
367
|
+
# broken install "current" and skip it forever (AC-16, Plan Challenge C-1).
|
|
368
|
+
# Impacts: PAI-03 record, PAI-04 upgrade trigger, PAI-07 uninstall, AC-3/16.
|
|
369
|
+
# Test: bash scripts/tests/test-plugin-auto-install.sh (Section 3 e2e chain)
|
|
370
|
+
record_plugin_version() {
|
|
371
|
+
local runner=""
|
|
372
|
+
if command -v node &>/dev/null; then runner="node"
|
|
373
|
+
elif command -v bun &>/dev/null; then runner="bun"
|
|
374
|
+
else
|
|
375
|
+
echo " ⚠ node or bun required to record the plugin version — next run will reinstall" >&2
|
|
376
|
+
return 0
|
|
377
|
+
fi
|
|
378
|
+
|
|
379
|
+
local version installed_at
|
|
380
|
+
version="$(sed -n 's/.*"version"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' "$SCRIPT_DIR/package.json" | head -n 1)"
|
|
381
|
+
installed_at="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
|
|
382
|
+
|
|
383
|
+
# Tolerant of a corrupt/missing state file (rewrites a minimal valid one —
|
|
384
|
+
# AC-8). A record-write failure warns but never fails the install: the next
|
|
385
|
+
# run treats the host as unknown-version and reinstalls.
|
|
386
|
+
"$runner" - "$HARNESS_STATE_FILE" "$HARNESS_HOST" "$CODEX_DIR" "$version" "$installed_at" <<'NODE' || \
|
|
387
|
+
echo " ⚠ could not record the plugin version — next run will reinstall (unknown version)" >&2
|
|
388
|
+
const fs = require("fs");
|
|
389
|
+
const path = require("path");
|
|
390
|
+
const [, , file, host, root, version, installedAt] = process.argv;
|
|
391
|
+
let data = { version: 2, platforms: {} };
|
|
392
|
+
try {
|
|
393
|
+
const existing = JSON.parse(fs.readFileSync(file, "utf8"));
|
|
394
|
+
if (existing && typeof existing === "object" && !Array.isArray(existing)) data = existing;
|
|
395
|
+
} catch { /* fresh */ }
|
|
396
|
+
if (typeof data.platforms !== "object" || data.platforms === null || Array.isArray(data.platforms)) {
|
|
397
|
+
data.platforms = {};
|
|
398
|
+
}
|
|
399
|
+
data.version = 2;
|
|
400
|
+
// Preserve every unrelated field; a missing record gets the minimal shape the
|
|
401
|
+
// strict skills reader accepts (non-empty root + a skills list).
|
|
402
|
+
const rec =
|
|
403
|
+
data.platforms[host] && typeof data.platforms[host] === "object" && !Array.isArray(data.platforms[host])
|
|
404
|
+
? data.platforms[host]
|
|
405
|
+
: { root, skillsOwner: "plugin", skills: [] };
|
|
406
|
+
rec.plugin = { version, installedAt };
|
|
407
|
+
data.platforms[host] = rec;
|
|
408
|
+
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
409
|
+
fs.writeFileSync(file, JSON.stringify(data, null, 2) + "\n");
|
|
410
|
+
NODE
|
|
411
|
+
}
|
|
412
|
+
|
|
348
413
|
# ── Plugin-registry registration (delegated to the codex CLI) ───────────────
|
|
349
414
|
# The CLI owns config.toml's [marketplaces.*] / [plugins."x@y"] tables and the
|
|
350
415
|
# plugins/cache layout, so it is the only supported way to reach /plugins.
|
|
@@ -547,4 +612,8 @@ else
|
|
|
547
612
|
vecho ""
|
|
548
613
|
vecho "⚠ Run /hooks in Codex to trust massa-ai hooks, or no observations will be captured."
|
|
549
614
|
vecho "💡 MCP is registered in ~/.codex/config.toml by scripts/install-agents.sh (single writer)."
|
|
550
|
-
fi
|
|
615
|
+
fi
|
|
616
|
+
|
|
617
|
+
# Final step of the install path: record the bundle version. Reached only when
|
|
618
|
+
# every fallible step succeeded (AC-16) — never on --uninstall (exits above).
|
|
619
|
+
record_plugin_version
|