@deftai/directive-runtime 0.129.5 → 0.129.6

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 (154) hide show
  1. package/Taskfile.yml +235 -0
  2. package/UPGRADING.md +1 -0
  3. package/contracts/design-critique.md +1 -1
  4. package/contracts/path-write-fence.md +6 -0
  5. package/dist/applying-host-release.d.ts +16 -0
  6. package/dist/applying-host-release.js +98 -0
  7. package/dist/authz.d.ts +1 -1
  8. package/dist/authz.js +1 -1
  9. package/dist/check.d.ts +1 -0
  10. package/dist/check.js +27 -4
  11. package/dist/design-critique-ensure-arc-dest.d.ts +16 -0
  12. package/dist/design-critique-ensure-arc-dest.js +168 -0
  13. package/dist/dispatch.d.ts +1 -1
  14. package/dist/dispatch.js +8 -0
  15. package/dist/hook-dispatch.js +3 -2
  16. package/dist/human-presence-mint.d.ts +6 -1
  17. package/dist/human-presence-mint.js +20 -6
  18. package/dist/session-start.js +40 -6
  19. package/dist/setup-wiring.d.ts +36 -0
  20. package/dist/setup-wiring.js +169 -14
  21. package/dist/verify-source-cli/verify-deposit-closure.js +5 -5
  22. package/dist/windows-bin-ps1.d.ts +2 -2
  23. package/dist/windows-bin-ps1.js +5 -11
  24. package/docs/deft-directive-disable.md +3 -3
  25. package/package.json +2 -3
  26. package/packs/lessons/lessons-pack-0.1.json +15 -0
  27. package/packs/skills/skills-pack-0.1.json +2 -2
  28. package/skills/deft-directive-design-critique/SKILL.md +1 -1
  29. package/skills/deft-directive-release/SKILL.md +31 -1
  30. package/vendor/directive-content/Taskfile.yml +235 -0
  31. package/vendor/directive-content/UPGRADING.md +1 -0
  32. package/vendor/directive-content/contracts/design-critique.md +1 -1
  33. package/vendor/directive-content/contracts/path-write-fence.md +6 -0
  34. package/vendor/directive-content/docs/deft-directive-disable.md +3 -3
  35. package/vendor/directive-content/packs/lessons/lessons-pack-0.1.json +15 -0
  36. package/vendor/directive-content/packs/skills/skills-pack-0.1.json +2 -2
  37. package/vendor/directive-content/skills/deft-directive-design-critique/SKILL.md +1 -1
  38. package/vendor/directive-content/skills/deft-directive-release/SKILL.md +31 -1
  39. package/vendor/directive-core/dist/.tsbuildinfo +1 -1
  40. package/vendor/directive-core/dist/authz/classify.d.ts +12 -0
  41. package/vendor/directive-core/dist/authz/classify.d.ts.map +1 -1
  42. package/vendor/directive-core/dist/authz/classify.js +40 -12
  43. package/vendor/directive-core/dist/authz/classify.js.map +1 -1
  44. package/vendor/directive-core/dist/authz/templates.d.ts +2 -2
  45. package/vendor/directive-core/dist/authz/templates.d.ts.map +1 -1
  46. package/vendor/directive-core/dist/authz/templates.js +1 -0
  47. package/vendor/directive-core/dist/authz/templates.js.map +1 -1
  48. package/vendor/directive-core/dist/authz/types.d.ts +1 -1
  49. package/vendor/directive-core/dist/authz/types.d.ts.map +1 -1
  50. package/vendor/directive-core/dist/authz/types.js +2 -0
  51. package/vendor/directive-core/dist/authz/types.js.map +1 -1
  52. package/vendor/directive-core/dist/authz/verb-classification.d.ts.map +1 -1
  53. package/vendor/directive-core/dist/authz/verb-classification.js +30 -3
  54. package/vendor/directive-core/dist/authz/verb-classification.js.map +1 -1
  55. package/vendor/directive-core/dist/cache/fetch.d.ts.map +1 -1
  56. package/vendor/directive-core/dist/cache/fetch.js +50 -4
  57. package/vendor/directive-core/dist/cache/fetch.js.map +1 -1
  58. package/vendor/directive-core/dist/design-critique/arc-dest.d.ts +22 -5
  59. package/vendor/directive-core/dist/design-critique/arc-dest.d.ts.map +1 -1
  60. package/vendor/directive-core/dist/design-critique/arc-dest.js +61 -0
  61. package/vendor/directive-core/dist/design-critique/arc-dest.js.map +1 -1
  62. package/vendor/directive-core/dist/design-critique/run-posture.d.ts +7 -2
  63. package/vendor/directive-core/dist/design-critique/run-posture.d.ts.map +1 -1
  64. package/vendor/directive-core/dist/design-critique/run-posture.js +6 -1
  65. package/vendor/directive-core/dist/design-critique/run-posture.js.map +1 -1
  66. package/vendor/directive-core/dist/hooks/dispatcher.d.ts.map +1 -1
  67. package/vendor/directive-core/dist/hooks/dispatcher.js +174 -12
  68. package/vendor/directive-core/dist/hooks/dispatcher.js.map +1 -1
  69. package/vendor/directive-core/dist/hooks/shell-write-targets.d.ts +5 -0
  70. package/vendor/directive-core/dist/hooks/shell-write-targets.d.ts.map +1 -1
  71. package/vendor/directive-core/dist/hooks/shell-write-targets.js +18 -1
  72. package/vendor/directive-core/dist/hooks/shell-write-targets.js.map +1 -1
  73. package/vendor/directive-core/dist/init-deposit/host-hook-outer.d.ts +5 -0
  74. package/vendor/directive-core/dist/init-deposit/host-hook-outer.d.ts.map +1 -1
  75. package/vendor/directive-core/dist/init-deposit/host-hook-outer.js +22 -9
  76. package/vendor/directive-core/dist/init-deposit/host-hook-outer.js.map +1 -1
  77. package/vendor/directive-core/dist/init-deposit/scaffold.d.ts +8 -1
  78. package/vendor/directive-core/dist/init-deposit/scaffold.d.ts.map +1 -1
  79. package/vendor/directive-core/dist/init-deposit/scaffold.js +38 -4
  80. package/vendor/directive-core/dist/init-deposit/scaffold.js.map +1 -1
  81. package/vendor/directive-core/dist/install-health/cheap.d.ts +2 -1
  82. package/vendor/directive-core/dist/install-health/cheap.d.ts.map +1 -1
  83. package/vendor/directive-core/dist/install-health/cheap.js +4 -3
  84. package/vendor/directive-core/dist/install-health/cheap.js.map +1 -1
  85. package/vendor/directive-core/dist/install-health/constants.d.ts +18 -2
  86. package/vendor/directive-core/dist/install-health/constants.d.ts.map +1 -1
  87. package/vendor/directive-core/dist/install-health/constants.js +18 -2
  88. package/vendor/directive-core/dist/install-health/constants.js.map +1 -1
  89. package/vendor/directive-core/dist/policy/deft-directive-disable.d.ts +42 -5
  90. package/vendor/directive-core/dist/policy/deft-directive-disable.d.ts.map +1 -1
  91. package/vendor/directive-core/dist/policy/deft-directive-disable.js +71 -41
  92. package/vendor/directive-core/dist/policy/deft-directive-disable.js.map +1 -1
  93. package/vendor/directive-core/dist/pr-closeout-attestable/evaluate.d.ts +6 -1
  94. package/vendor/directive-core/dist/pr-closeout-attestable/evaluate.d.ts.map +1 -1
  95. package/vendor/directive-core/dist/pr-closeout-attestable/evaluate.js +24 -12
  96. package/vendor/directive-core/dist/pr-closeout-attestable/evaluate.js.map +1 -1
  97. package/vendor/directive-core/dist/pr-closeout-attestable/pr-head-assert.d.ts +68 -14
  98. package/vendor/directive-core/dist/pr-closeout-attestable/pr-head-assert.d.ts.map +1 -1
  99. package/vendor/directive-core/dist/pr-closeout-attestable/pr-head-assert.js +278 -47
  100. package/vendor/directive-core/dist/pr-closeout-attestable/pr-head-assert.js.map +1 -1
  101. package/vendor/directive-core/dist/release/gh.d.ts.map +1 -1
  102. package/vendor/directive-core/dist/release/gh.js +2 -1
  103. package/vendor/directive-core/dist/release/gh.js.map +1 -1
  104. package/vendor/directive-core/dist/release/version.d.ts +4 -2
  105. package/vendor/directive-core/dist/release/version.d.ts.map +1 -1
  106. package/vendor/directive-core/dist/release/version.js +4 -2
  107. package/vendor/directive-core/dist/release/version.js.map +1 -1
  108. package/vendor/directive-core/dist/release-publish/gh-api.d.ts.map +1 -1
  109. package/vendor/directive-core/dist/release-publish/gh-api.js +4 -2
  110. package/vendor/directive-core/dist/release-publish/gh-api.js.map +1 -1
  111. package/vendor/directive-core/dist/release-publish/main.d.ts.map +1 -1
  112. package/vendor/directive-core/dist/release-publish/main.js +15 -4
  113. package/vendor/directive-core/dist/release-publish/main.js.map +1 -1
  114. package/vendor/directive-core/dist/release-publish/pipeline.d.ts +11 -0
  115. package/vendor/directive-core/dist/release-publish/pipeline.d.ts.map +1 -1
  116. package/vendor/directive-core/dist/release-publish/pipeline.js +143 -2
  117. package/vendor/directive-core/dist/release-publish/pipeline.js.map +1 -1
  118. package/vendor/directive-core/dist/release-rollback/gh.d.ts.map +1 -1
  119. package/vendor/directive-core/dist/release-rollback/gh.js +2 -1
  120. package/vendor/directive-core/dist/release-rollback/gh.js.map +1 -1
  121. package/vendor/directive-core/dist/session/git.d.ts +21 -2
  122. package/vendor/directive-core/dist/session/git.d.ts.map +1 -1
  123. package/vendor/directive-core/dist/session/git.js +21 -4
  124. package/vendor/directive-core/dist/session/git.js.map +1 -1
  125. package/vendor/directive-core/dist/session/occupancy.d.ts +93 -6
  126. package/vendor/directive-core/dist/session/occupancy.d.ts.map +1 -1
  127. package/vendor/directive-core/dist/session/occupancy.js +215 -52
  128. package/vendor/directive-core/dist/session/occupancy.js.map +1 -1
  129. package/vendor/directive-core/dist/session/session-start.d.ts.map +1 -1
  130. package/vendor/directive-core/dist/session/session-start.js +5 -2
  131. package/vendor/directive-core/dist/session/session-start.js.map +1 -1
  132. package/vendor/directive-core/dist/swarm/dest-place.d.ts +1 -1
  133. package/vendor/directive-core/dist/swarm/dest-place.d.ts.map +1 -1
  134. package/vendor/directive-core/dist/swarm/dest-place.js +36 -41
  135. package/vendor/directive-core/dist/swarm/dest-place.js.map +1 -1
  136. package/vendor/directive-core/dist/swarm/finalize-owed.d.ts +14 -0
  137. package/vendor/directive-core/dist/swarm/finalize-owed.d.ts.map +1 -1
  138. package/vendor/directive-core/dist/swarm/finalize-owed.js +214 -48
  139. package/vendor/directive-core/dist/swarm/finalize-owed.js.map +1 -1
  140. package/vendor/directive-core/dist/swarm/launch.d.ts.map +1 -1
  141. package/vendor/directive-core/dist/swarm/launch.js +15 -4
  142. package/vendor/directive-core/dist/swarm/launch.js.map +1 -1
  143. package/vendor/directive-core/dist/swarm/worktree-pm-install.d.ts +49 -2
  144. package/vendor/directive-core/dist/swarm/worktree-pm-install.d.ts.map +1 -1
  145. package/vendor/directive-core/dist/swarm/worktree-pm-install.js +207 -12
  146. package/vendor/directive-core/dist/swarm/worktree-pm-install.js.map +1 -1
  147. package/vendor/directive-core/dist/swarm/worktrees-cli.d.ts +6 -0
  148. package/vendor/directive-core/dist/swarm/worktrees-cli.d.ts.map +1 -1
  149. package/vendor/directive-core/dist/swarm/worktrees-cli.js +79 -2
  150. package/vendor/directive-core/dist/swarm/worktrees-cli.js.map +1 -1
  151. package/vendor/directive-core/dist/swarm/worktrees.d.ts +12 -1
  152. package/vendor/directive-core/dist/swarm/worktrees.d.ts.map +1 -1
  153. package/vendor/directive-core/dist/swarm/worktrees.js +34 -26
  154. package/vendor/directive-core/dist/swarm/worktrees.js.map +1 -1
package/Taskfile.yml CHANGED
@@ -845,6 +845,241 @@ tasks:
845
845
  vars:
846
846
  ENGINE_CMD: 'release-wait-npm {{.CLI_ARGS}}'
847
847
 
848
+ # Phase 7 maintainer primary checkout closeout (#5953 Prefer-A Bound 6430511888).
849
+ # Inline cmds only — no engine:invoke / no deps:[ts:build] so the post-install
850
+ # payload can replace the N-1 runtime the cut was using. Never reset/force-push/
851
+ # commit / npm i -g.
852
+ release:local-update:
853
+ desc: "Phase 7 fail-closed maintainer checkout update (#5953) -- task release:local-update -- <version> --checkout <primary-occupancy-root>"
854
+ dir: '{{.USER_WORKING_DIR}}'
855
+ env:
856
+ PYTHONUTF8: "1"
857
+ cmds:
858
+ - |
859
+ set -e
860
+ # node -e bodies use shell single quotes + JS double quotes only (no apostrophes).
861
+ PARSE_OUT="$(node -e '
862
+ const raw = process.argv[1] || "";
863
+ const tokens = [];
864
+ let cur = "";
865
+ let q = null;
866
+ const DQ = String.fromCharCode(34);
867
+ const SQ = String.fromCharCode(39);
868
+ for (let i = 0; i < raw.length; i++) {
869
+ const ch = raw[i];
870
+ if (q) {
871
+ if (ch === q) { q = null; continue; }
872
+ cur += ch;
873
+ continue;
874
+ }
875
+ if (ch === DQ || ch === SQ) { q = ch; continue; }
876
+ if (/\s/.test(ch)) {
877
+ if (cur.length) { tokens.push(cur); cur = ""; }
878
+ continue;
879
+ }
880
+ cur += ch;
881
+ }
882
+ if (q) { console.error("release:local-update: unmatched quote in args"); process.exit(2); }
883
+ if (cur.length) tokens.push(cur);
884
+ let version = "";
885
+ let checkout = "";
886
+ for (let i = 0; i < tokens.length; i++) {
887
+ const t = tokens[i];
888
+ if (t === "--checkout") {
889
+ const v = tokens[++i];
890
+ if (!v) { console.error("release:local-update: --checkout requires a path"); process.exit(2); }
891
+ checkout = v;
892
+ continue;
893
+ }
894
+ if (t.startsWith("--")) {
895
+ console.error("release:local-update: unknown flag " + t);
896
+ console.error("Usage: task release:local-update -- <version> --checkout <maintainer-primary-occupancy-root>");
897
+ process.exit(2);
898
+ }
899
+ if (!version) { version = t; continue; }
900
+ console.error("release:local-update: unexpected arg " + t);
901
+ process.exit(2);
902
+ }
903
+ if (!version) {
904
+ console.error("release:local-update: missing <version>");
905
+ console.error("Usage: task release:local-update -- <version> --checkout <maintainer-primary-occupancy-root>");
906
+ process.exit(2);
907
+ }
908
+ if (!checkout) {
909
+ console.error("release:local-update: refuse ambient release-worktree-only success; require --checkout naming the maintainer primary occupancy root (#5953)");
910
+ process.exit(1);
911
+ }
912
+ process.stdout.write(JSON.stringify({ version, checkout }));
913
+ ' "{{.CLI_ARGS}}")"
914
+ VERSION="$(node -e 'const j=JSON.parse(process.argv[1]); process.stdout.write(j.version);' "$PARSE_OUT")"
915
+ CHECKOUT="$(node -e 'const j=JSON.parse(process.argv[1]); process.stdout.write(j.checkout);' "$PARSE_OUT")"
916
+ case "$CHECKOUT" in
917
+ /*|[A-Za-z]:*) ;;
918
+ *) CHECKOUT="$(pwd)/$CHECKOUT" ;;
919
+ esac
920
+ CHECKOUT="$(node -e 'const fs=require("fs"); const path=require("path"); const inPath=process.argv[1]; try { process.stdout.write(fs.realpathSync(inPath)); } catch { process.stdout.write(path.resolve(inPath)); }' "$CHECKOUT")"
921
+ if [ ! -d "$CHECKOUT/.git" ] && [ ! -f "$CHECKOUT/.git" ]; then
922
+ echo "release:local-update: --checkout is not a git checkout: $CHECKOUT" >&2
923
+ exit 1
924
+ fi
925
+ COMMON_DIR="$(git -C "$CHECKOUT" rev-parse --git-common-dir 2>/dev/null || true)"
926
+ if [ -z "$COMMON_DIR" ]; then
927
+ echo "release:local-update: cannot resolve git-common-dir for $CHECKOUT" >&2
928
+ exit 1
929
+ fi
930
+ case "$COMMON_DIR" in
931
+ /*|[A-Za-z]:*) ;;
932
+ *) COMMON_DIR="$CHECKOUT/$COMMON_DIR" ;;
933
+ esac
934
+ MAIN_ROOT="$(node -e 'const path=require("path"); process.stdout.write(path.resolve(path.dirname(process.argv[1])));' "$COMMON_DIR")"
935
+ SAME_MAIN="$(node -e 'const a=process.argv[1]; const b=process.argv[2]; const norm=s => process.platform==="win32" ? s.split(String.fromCharCode(92)).join("/").toLowerCase() : s.split(String.fromCharCode(92)).join("/"); process.stdout.write(norm(a)===norm(b)?"1":"0");' "$CHECKOUT" "$MAIN_ROOT")"
936
+ if [ "$SAME_MAIN" != "1" ]; then
937
+ echo "release:local-update: refuse ambient release-worktree-only success; --checkout must name the maintainer primary occupancy root (dirname git-common-dir=$MAIN_ROOT), not $CHECKOUT (#5953)" >&2
938
+ exit 1
939
+ fi
940
+ CHECKOUT_NORM="$(node -e 'process.stdout.write(String(process.argv[1]||"").split(String.fromCharCode(92)).join("/"));' "$CHECKOUT")"
941
+ case "$CHECKOUT_NORM" in
942
+ */.deft-scratch/worktrees/*)
943
+ echo "release:local-update: refuse ambient release-worktree-only success; --checkout must name the maintainer primary occupancy root, not $CHECKOUT (#5953)" >&2
944
+ exit 1
945
+ ;;
946
+ esac
947
+ print_deposit_recovery() {
948
+ echo "Phase 7 local closeout INCOMPLETE (#5953)." >&2
949
+ echo "Recovery: merge the version-matched agent-hook deposit for $VERSION onto tip, then re-run:" >&2
950
+ echo " task release:local-update -- $VERSION --checkout $CHECKOUT" >&2
951
+ echo "Expected managed deposit paths include: .grok/hooks/ .cursor/hooks.json .claude/settings.json .codex/ (and related deposit files)." >&2
952
+ echo "Do not auto-commit deposit bytes inside the release flow; do not npm i -g." >&2
953
+ }
954
+ OCC_FILE="$CHECKOUT/.deft/occupancy.json"
955
+ if [ -f "$OCC_FILE" ]; then
956
+ node -e '
957
+ const fs = require("fs");
958
+ const path = process.argv[1];
959
+ const checkout = process.argv[2];
960
+ const raw = fs.readFileSync(path, "utf8");
961
+ let rec;
962
+ try { rec = JSON.parse(raw); } catch { process.exit(0); }
963
+ const sid = String(rec.session_id || rec.sessionId || "");
964
+ const hb = Date.parse(rec.heartbeat_at || rec.heartbeatAt || "");
965
+ const claimed = Date.parse(rec.claimed_at || rec.claimedAt || "");
966
+ const now = Date.now();
967
+ const TTL = 20 * 60 * 1000;
968
+ const MAX = 24 * 60 * 60 * 1000;
969
+ if (!Number.isFinite(hb) || !Number.isFinite(claimed)) process.exit(0);
970
+ if (now - claimed > MAX || now - hb > TTL) process.exit(0);
971
+ const providers = ["grok", "claude", "cursor", "codex", "openclaw"];
972
+ const rawPresenters = [
973
+ process.env.DEFT_SESSION_ID,
974
+ process.env.GROK_SESSION_ID,
975
+ process.env.CLAUDE_SESSION_ID,
976
+ process.env.CURSOR_SESSION_ID,
977
+ process.env.CODEX_SESSION_ID,
978
+ ].filter((v) => typeof v === "string" && v.trim().length > 0).map((v) => v.trim());
979
+ const presenters = new Set(rawPresenters);
980
+ for (const p of rawPresenters) {
981
+ if (p.startsWith("host:")) continue;
982
+ for (const provider of providers) {
983
+ presenters.add("host:" + provider + ":v1:" + Buffer.from(p, "utf8").toString("base64url"));
984
+ }
985
+ }
986
+ let sidRaw = null;
987
+ const m = /^host:([a-z]+):v1:([A-Za-z0-9_-]+)$/.exec(sid);
988
+ if (m) {
989
+ try { sidRaw = Buffer.from(m[2], "base64url").toString("utf8"); } catch { sidRaw = null; }
990
+ }
991
+ const grants = Array.isArray(rec.grants) ? rec.grants : [];
992
+ const grantIds = grants
993
+ .filter((g) => Date.parse(g.expires_at || g.expiresAt || 0) > now)
994
+ .map((g) => g.session_id || g.sessionId || g.child_session_id || g.childSessionId)
995
+ .filter(Boolean)
996
+ .map(String);
997
+ const admitted = [...presenters].some((p) => p === sid || grantIds.includes(p) || (sidRaw && p === sidRaw));
998
+ if (!admitted && presenters.size > 0) {
999
+ console.error("release:local-update: refuse live foreign occupancy lease on " + checkout + " (occupant=" + sid + ") before any write (#5953)");
1000
+ process.exit(1);
1001
+ }
1002
+ if (!admitted && presenters.size === 0 && sid) {
1003
+ console.error("release:local-update: refuse live occupancy lease on " + checkout + " (occupant=" + sid + "); no presenter session id in env (#5953)");
1004
+ process.exit(1);
1005
+ }
1006
+ ' "$OCC_FILE" "$CHECKOUT"
1007
+ fi
1008
+ cd "$CHECKOUT"
1009
+ if ! git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
1010
+ echo "release:local-update: not a git work tree: $CHECKOUT" >&2
1011
+ exit 1
1012
+ fi
1013
+ if [ -n "$(git status --porcelain)" ]; then
1014
+ echo "release:local-update: refuse dirty tree at $CHECKOUT" >&2
1015
+ git status --short >&2
1016
+ exit 1
1017
+ fi
1018
+ DEFAULT_BRANCH="$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed "s@^refs/remotes/origin/@@" || true)"
1019
+ if [ -z "$DEFAULT_BRANCH" ]; then DEFAULT_BRANCH=master; fi
1020
+ CURRENT="$(git rev-parse --abbrev-ref HEAD)"
1021
+ if [ "$CURRENT" != "$DEFAULT_BRANCH" ]; then
1022
+ echo "release:local-update: refuse; checkout must be on default branch $DEFAULT_BRANCH (on $CURRENT)" >&2
1023
+ exit 1
1024
+ fi
1025
+ echo "release:local-update: ff-only pull on $DEFAULT_BRANCH at $CHECKOUT"
1026
+ git pull --ff-only
1027
+ if [ -f pnpm-workspace.yaml ]; then
1028
+ if grep -q "minimumReleaseAgeExclude" pnpm-workspace.yaml; then
1029
+ if ! grep -q "@deftai/directive-runtime@$VERSION" pnpm-workspace.yaml; then
1030
+ echo "release:local-update: AgeExclude missing @deftai/directive-runtime@$VERSION before frozen install (#5953 footnote)" >&2
1031
+ exit 1
1032
+ fi
1033
+ fi
1034
+ fi
1035
+ echo "release:local-update: pnpm install --frozen-lockfile"
1036
+ pnpm install --frozen-lockfile
1037
+ PIN_PKG="$(node -e 'const fs=require("fs"); const p=JSON.parse(fs.readFileSync("package.json","utf8")); const v=(p.dependencies||{})["@deftai/directive-runtime"]||(p.devDependencies||{})["@deftai/directive-runtime"]||""; console.log(String(v).replace(/^[^0-9]*/, ""));')"
1038
+ INST_PKG="$(node -e 'const fs=require("fs"); const p=JSON.parse(fs.readFileSync("node_modules/@deftai/directive-runtime/package.json","utf8")); console.log(p.version);')"
1039
+ if [ "$PIN_PKG" != "$VERSION" ] || [ "$INST_PKG" != "$VERSION" ]; then
1040
+ echo "release:local-update: tip-pin-equals-released FAILED; want $VERSION; package.json pin=$PIN_PKG installed=$INST_PKG" >&2
1041
+ exit 1
1042
+ fi
1043
+ echo "release:local-update: tip-pin-equals-released ok ($VERSION)"
1044
+ RUNTIME_BIN="node_modules/@deftai/directive-runtime/dist/bin.js"
1045
+ if [ ! -f "$RUNTIME_BIN" ]; then
1046
+ echo "release:local-update: missing checkout runtime bin $RUNTIME_BIN" >&2
1047
+ exit 1
1048
+ fi
1049
+ echo "release:local-update: require version-matched agent-hook deposit already on tip"
1050
+ if ! DEFT_DOCTOR_HOOK_DIAGNOSTIC=1 node "$RUNTIME_BIN" verify:hooks-installed --project-root "$CHECKOUT" --scope=agent; then
1051
+ print_deposit_recovery
1052
+ exit 1
1053
+ fi
1054
+ UPGRADE_BIN=""
1055
+ if [ -x "node_modules/.bin/directive" ]; then
1056
+ UPGRADE_BIN="node_modules/.bin/directive"
1057
+ elif [ -f "node_modules/@deftai/directive/dist/bin.js" ]; then
1058
+ UPGRADE_BIN="node node_modules/@deftai/directive/dist/bin.js"
1059
+ elif command -v directive >/dev/null 2>&1; then
1060
+ UPGRADE_BIN="directive"
1061
+ else
1062
+ echo "release:local-update: cannot resolve directive upgrade binary after frozen install" >&2
1063
+ exit 1
1064
+ fi
1065
+ echo "release:local-update: $UPGRADE_BIN upgrade --target-version $VERSION --yes --root $CHECKOUT"
1066
+ $UPGRADE_BIN upgrade --target-version "$VERSION" --yes --root "$CHECKOUT"
1067
+ if [ -n "$(git status --porcelain)" ]; then
1068
+ echo "release:local-update: tracked-file diff after upgrade; closeout non-zero/incomplete (#5953)" >&2
1069
+ git status --short >&2
1070
+ print_deposit_recovery
1071
+ exit 1
1072
+ fi
1073
+ echo "release:local-update: verify:hooks-installed --project-root --scope=all"
1074
+ DEFT_DOCTOR_HOOK_DIAGNOSTIC=1 node "$RUNTIME_BIN" verify:hooks-installed --project-root "$CHECKOUT" --scope=all
1075
+ INST_PKG2="$(node -e 'const fs=require("fs"); const p=JSON.parse(fs.readFileSync("node_modules/@deftai/directive-runtime/package.json","utf8")); console.log(p.version);')"
1076
+ if [ "$INST_PKG2" != "$VERSION" ]; then
1077
+ echo "release:local-update: post-upgrade runtime $INST_PKG2 != $VERSION" >&2
1078
+ exit 1
1079
+ fi
1080
+ echo "release:local-update COMPLETE; checkout=$CHECKOUT version=$INST_PKG2 hooks=verify:hooks-installed --scope=all green"
1081
+ echo "global npm i -g was NOT run (report-only drift remains Phase 7 step 2)."
1082
+
848
1083
 
849
1084
  # ------------------------------------------------------------------
850
1085
  # Triage v1 user-facing alias tasks (#845, #913).
package/UPGRADING.md CHANGED
@@ -949,6 +949,7 @@ Every **real** policy write (Phase 2 / Phase 4, and every other `meta/policy-cha
949
949
  - **On-disk layout changed.** Old: `.deft-cache/issues/<owner>-<repo>/<N>.{json,md}` (flat sidecar). New: `.deft-cache/<source>/<key>/{raw.json,content.md,meta.json}` (per-entry directory; schema-validated meta envelope). `cache:get` validates `meta.json` against `vbrief/schemas/cache-meta.schema.json` on every read so a corrupt or version-incompatible file fails closed.
950
950
  - **Audit log UNCHANGED.** `vbrief/.eval/candidates.jsonl` preserves accept / reject / defer / needs-ac / mark-duplicate / reset records across the migration. The Story 3 Tier-2 short-circuit (terminal-decision skip on bulk-* re-runs) operates on the same file.
951
951
  - **All other `triage:*` actions UNCHANGED.** `triage:accept` / `triage:reject` / `triage:defer` / `triage:needs-ac` / `triage:mark-duplicate` / `triage:bulk-accept` / `triage:bulk-reject` / `triage:bulk-defer` / `triage:bulk-needs-ac` / `triage:status` / `triage:reset` / `triage:history` / `triage:refresh-active` keep their v0.25.x surface byte-for-byte (13 aliases). The rebind onto `cache:get` is internal. `triage:bootstrap` keeps its v0.25.x command surface but its on-disk output is the new `.deft-cache/<source>/<key>/` per-entry layout (now delegates to `cache:fetch-all`); see the Commands list above.
952
+ - **Gitcrawl fallback semantics no longer apply.** After this cache rebind, the old `docs/gitcrawl-fallback.md` gh-only install/recovery path is withdrawn. Do not follow that doc for v0.26+ triage/cache; use `cache:*` and this migration section instead (#1092).
952
953
 
953
954
  ### Rollback
954
955
 
@@ -65,7 +65,7 @@ Record `arc-mode: no-ingest` or `arc-mode: checkout` on the Stop 1 write-back. `
65
65
  - ! Parent-unclaimed is its own MUST: `session:start --read-only`, or an explicit occupancy release if a mutation lease is already held. Dest create does not clear occupancy.
66
66
  - ! Recognition of `no-ingest` happens before mutation initialization. Refuse github-only when mutation `session:start` has already occurred, unless the lease is released first.
67
67
  - ! Posting path that survives a foreign lease: `gh issue comment --body-file -` (stdin). Least-authority envelope: bounded GitHub reads and one comment post.
68
- - ! Parent fetches, then creates or verifies one dest at origin/<default> tip (`ensureArcDest`). dispatch-sha equals that tip. Against-implementation dest is the fetched PR head SHA, recorded on Stop 1. ⊗ Pin dest to local HEAD.
68
+ - ! Parent fetches, then creates or verifies one dest at origin/<default> tip via the sanctioned pin-bin verb `deft design-critique:ensure-arc-dest` (library `ensureArcDest`; guarded-prep default, or explicit `process-only-no-install`). When guarded-prep is selected, success requires the outer-visible runtime pin. dispatch-sha equals that tip. Against-implementation dest is the fetched PR head SHA, recorded on Stop 1. ⊗ Pin dest to local HEAD. ⊗ Treat gitignored `packages/core/dist` as SoT for `ensureArcDest` on framework-source.
69
69
  - ! N>1 process-only critics share that dest with cwd-without-occupy. They are not swarm Phase 2 and not a #4066 mutating worker. Unique dest-lock stays for implement-class. Skip class is a host-visible Grok stdin marker (`subagent_type` `plan` or `process_only`), not dest-path. That marker is the process-only skip class, not an implementation-gate bypass: implement-class never sets `process_only`. ⊗ Skip #2885 on destProven. Keep #4066 primary-path deny. ⊗ Pin dest / process_only skip-class rules into `templates/agents-entry.md`.
70
70
  - ! Pin reads to `git show <dispatch-sha>:` against the recorded SHA. ⊗ A moving branch ref.
71
71
  - ! Before panel-deposit on a process-only dest, record a closed `verification-path:` line that either (a) names the read-only pin-read path (`git show <dispatch-sha>:`, dest cwd-without-occupy for on-pin file reads), or (b) records a provisioned runnable path when a specific check requires executing fixtures/tests. Default to (a). Keep N≥3 launch-probe (`evaluateN3LaunchProbe`) as launchability, separate from method-verification. `verificationPathRecordLine` / `evaluateVerificationPathBeforePanelDeposit` are the fixtures. ⊗ Mandate full install-on-dest for every panel.
@@ -195,6 +195,12 @@ OS-temp dests and commands with no recognized dest (`git status`,
195
195
  remains **escape** polarity (in-tree dest whose realpath leaves the tree) and is
196
196
  not this check. The hook still runs before the shell, so a link created between
197
197
  check and write is TOCTOU.
198
+ - **Kill-switch / permanent opt-out plant (#6136):** Shell write reissue checks
199
+ `.deft-directive-disable` / `.no-deft-directive` basenames **before** the
200
+ `isInRepoShellWritePath` skip, so an out-of-tree plant cannot fail-open. Agent
201
+ Write/Edit/Shell of those basenames is always-on deny without a human-origin
202
+ settings grant (docs: `deft-directive-disable.md`). General protected-target /
203
+ out-of-tree floor work stays on #6138; deny wording on #6139.
198
204
 
199
205
  Fail-open at this predicate is the bound posture (#3997). Inverting it to
200
206
  fail-closed on dests the parser cannot prove external is that issue's refuted
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Clear the worktree applying-host soft claim (#6143 Prefer-A).
4
+ *
5
+ * session:end / occupancy:release already clear applying-host with the lease.
6
+ * This verb clears an abandoned no-lease claim or the matching owner record.
7
+ */
8
+ export declare function formatApplyingHostReleaseHelp(): string;
9
+ export declare function parseArgs(argv: readonly string[]): {
10
+ projectRoot: string;
11
+ sessionId?: string;
12
+ help?: boolean;
13
+ error?: string;
14
+ };
15
+ export declare function run(argv: readonly string[]): number;
16
+ //# sourceMappingURL=applying-host-release.d.ts.map
@@ -0,0 +1,98 @@
1
+ #!/usr/bin/env node
2
+ import { fileURLToPath } from "node:url";
3
+ import { clearApplyingHost } from "../vendor/directive-core/dist/session/index.js";
4
+ import { occupancyUnrecognizedArgument } from "./occupancy-unrecognized.js";
5
+ /**
6
+ * Clear the worktree applying-host soft claim (#6143 Prefer-A).
7
+ *
8
+ * session:end / occupancy:release already clear applying-host with the lease.
9
+ * This verb clears an abandoned no-lease claim or the matching owner record.
10
+ */
11
+ export function formatApplyingHostReleaseHelp() {
12
+ return [
13
+ "Usage: deft applying-host:release [--project-root <path>] [--session-id <id>]",
14
+ "",
15
+ "Clear .deft/applying-host.json for this worktree.",
16
+ "Owner match always clears. With no live foreign occupant, an abandoned",
17
+ "no-lease soft claim may be cleared without impersonating the recorded owner.",
18
+ "Live foreign lease keeps the record (use occupancy:release / session:end or steal).",
19
+ "",
20
+ ].join("\n");
21
+ }
22
+ export function parseArgs(argv) {
23
+ const parsed = {
24
+ projectRoot: ".",
25
+ };
26
+ for (let i = 0; i < argv.length; i += 1) {
27
+ const arg = argv[i];
28
+ if (arg === "--help" || arg === "-h") {
29
+ parsed.help = true;
30
+ }
31
+ else if (arg === "--project-root") {
32
+ const value = argv[i + 1];
33
+ if (value === undefined || value.startsWith("--")) {
34
+ return { ...parsed, error: "argument --project-root: expected one argument" };
35
+ }
36
+ parsed.projectRoot = value;
37
+ i += 1;
38
+ }
39
+ else if (arg?.startsWith("--project-root=")) {
40
+ const value = arg.slice("--project-root=".length);
41
+ if (value.length === 0 || value.startsWith("--")) {
42
+ return { ...parsed, error: "argument --project-root: expected one argument" };
43
+ }
44
+ parsed.projectRoot = value;
45
+ }
46
+ else if (arg === "--session-id") {
47
+ const value = argv[i + 1];
48
+ if (value === undefined || value.startsWith("--")) {
49
+ return { ...parsed, error: "argument --session-id: expected one argument" };
50
+ }
51
+ const sessionId = value.trim();
52
+ if (sessionId.length === 0 || sessionId.startsWith("--")) {
53
+ return { ...parsed, error: "argument --session-id: expected a non-empty value" };
54
+ }
55
+ parsed.sessionId = sessionId;
56
+ i += 1;
57
+ }
58
+ else if (arg?.startsWith("--session-id=")) {
59
+ const sessionId = arg.slice("--session-id=".length).trim();
60
+ if (sessionId.length === 0 || sessionId.startsWith("--")) {
61
+ return { ...parsed, error: "argument --session-id: expected a non-empty value" };
62
+ }
63
+ parsed.sessionId = sessionId;
64
+ }
65
+ else {
66
+ return { ...parsed, error: occupancyUnrecognizedArgument(arg) };
67
+ }
68
+ }
69
+ return parsed;
70
+ }
71
+ export function run(argv) {
72
+ const args = parseArgs(argv);
73
+ if (args.error !== undefined) {
74
+ process.stderr.write(`applying-host:release: ${args.error}\n`);
75
+ return 2;
76
+ }
77
+ if (args.help === true) {
78
+ process.stdout.write(formatApplyingHostReleaseHelp());
79
+ return 0;
80
+ }
81
+ const result = clearApplyingHost(args.projectRoot, {
82
+ sessionId: args.sessionId ?? process.env.DEFT_SESSION_ID ?? null,
83
+ });
84
+ if (result.status === "missing") {
85
+ process.stdout.write("applying-host already clear\n");
86
+ return 0;
87
+ }
88
+ if (result.status === "denied") {
89
+ process.stderr.write(`${result.message}\n`);
90
+ return 1;
91
+ }
92
+ process.stdout.write(`applying-host cleared (${result.previousSessionId})\n`);
93
+ return 0;
94
+ }
95
+ if (process.argv[1] !== undefined && fileURLToPath(import.meta.url) === process.argv[1]) {
96
+ process.exit(run(process.argv.slice(2)));
97
+ }
98
+ //# sourceMappingURL=applying-host-release.js.map
package/dist/authz.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { type HumanPresenceMintSeams } from "./human-presence-mint.js";
3
3
  export type { HumanPresenceMintSeams as AuthzMainSeams } from "./human-presence-mint.js";
4
- export { AUTHZ_AGENT_SHELL_ENV_MARKERS, AUTHZ_INTERACTIVE_CONFIRM_PHRASE, } from "./human-presence-mint.js";
4
+ export { AUTHZ_AGENT_SHELL_ENV_MARKERS, AUTHZ_INTERACTIVE_CONFIRM_PHRASE, detectedAgentShellMarkers, looksLikeAgentShell, } from "./human-presence-mint.js";
5
5
  export declare function main(argv?: string[], seams?: HumanPresenceMintSeams): number;
6
6
  export default main;
7
7
  //# sourceMappingURL=authz.d.ts.map
package/dist/authz.js CHANGED
@@ -33,7 +33,7 @@ import { AFK_TEMPLATE_NAMES, AUTHZ_OPERATIONS, CLOSED_VERB_TEMPLATE_NAMES, FINIS
33
33
  import { uatCampaignEndSeal } from "../vendor/directive-core/dist/authz/campaign-end-seal.js";
34
34
  import { isSpecDriftOverrideTemplateName, mintSpecDriftOverrideTemplateGrant, SPEC_DRIFT_OVERRIDE_TEMPLATE_NAME, } from "../vendor/directive-core/dist/policy/index.js";
35
35
  import { refuseMintWhileUatActive, refuseNonInteractiveMint, resolveHumanPresenceMintSeams, } from "./human-presence-mint.js";
36
- export { AUTHZ_AGENT_SHELL_ENV_MARKERS, AUTHZ_INTERACTIVE_CONFIRM_PHRASE, } from "./human-presence-mint.js";
36
+ export { AUTHZ_AGENT_SHELL_ENV_MARKERS, AUTHZ_INTERACTIVE_CONFIRM_PHRASE, detectedAgentShellMarkers, looksLikeAgentShell, } from "./human-presence-mint.js";
37
37
  function parseOps(raw) {
38
38
  const allowed = new Set(AUTHZ_OPERATIONS);
39
39
  const out = [];
package/dist/check.d.ts CHANGED
@@ -8,6 +8,7 @@ export interface ParsedArgs {
8
8
  /**
9
9
  * Resolve check's framework-root from `projectRoot` without last-resort
10
10
  * `resolveDefaultFrameworkRoot` (#4722). Returns null on miss (fail-closed).
11
+ * OVPR pin under node_modules/@deftai/directive-runtime is a candidate (#5996).
11
12
  */
12
13
  export declare function resolveCheckFrameworkRoot(projectRoot: string, explicitRoot?: string | null): string | null;
13
14
  export declare function parseArgs(argv: readonly string[]): ParsedArgs;
package/dist/check.js CHANGED
@@ -5,15 +5,18 @@
5
5
  * Usage: deft-ts check [--framework-root <path>] [--project-root <path>] [--no-cache]
6
6
  *
7
7
  * Omitted --project-root defaults to cwd. Omitted --framework-root walks
8
- * explicit / DEFT_ROOT / source checkout / .deft/core / legacy deft/ and
9
- * fail-closes instead of resolveDefaultFrameworkRoot (#4722).
8
+ * explicit / DEFT_ROOT / source checkout / .deft/core / legacy deft/ /
9
+ * node_modules/@deftai/directive-runtime and fail-closes instead of
10
+ * resolveDefaultFrameworkRoot (#4722 / #5996).
10
11
  */
11
- import { statSync } from "node:fs";
12
+ import { existsSync, statSync } from "node:fs";
12
13
  import { join, resolve } from "node:path";
13
14
  import { fileURLToPath } from "node:url";
14
15
  import { dispatchTaskCheck } from "../vendor/directive-core/dist/check/index.js";
15
16
  import { DEFT_REPO_POSITIVE_MARKERS } from "../vendor/directive-core/dist/doctor/index.js";
16
17
  import { refuseIfWslOwnershipBlocked } from "./wsl-ownership-guard.js";
18
+ /** OVPR pin package path under a consumer project root (#5996). */
19
+ const OVPR_RUNTIME_PACKAGE_REL = join("node_modules", "@deftai", "directive-runtime");
17
20
  function isFrameworkSourceCheckoutAt(projectRoot) {
18
21
  try {
19
22
  if (!statSync(join(projectRoot, "main.md")).isFile()) {
@@ -32,9 +35,25 @@ function isFrameworkSourceCheckoutAt(projectRoot) {
32
35
  }
33
36
  });
34
37
  }
38
+ /**
39
+ * True when `candidate` is an installed `@deftai/directive-runtime` package
40
+ * root (directory + main.md), matching resolveFrameworkRootForProject (#5490).
41
+ */
42
+ function looksLikeRuntimePackageRoot(candidate) {
43
+ try {
44
+ if (!statSync(candidate).isDirectory()) {
45
+ return false;
46
+ }
47
+ }
48
+ catch {
49
+ return false;
50
+ }
51
+ return existsSync(join(candidate, "main.md"));
52
+ }
35
53
  /**
36
54
  * Resolve check's framework-root from `projectRoot` without last-resort
37
55
  * `resolveDefaultFrameworkRoot` (#4722). Returns null on miss (fail-closed).
56
+ * OVPR pin under node_modules/@deftai/directive-runtime is a candidate (#5996).
38
57
  */
39
58
  export function resolveCheckFrameworkRoot(projectRoot, explicitRoot) {
40
59
  const explicit = explicitRoot?.trim();
@@ -60,6 +79,10 @@ export function resolveCheckFrameworkRoot(projectRoot, explicitRoot) {
60
79
  // try next candidate
61
80
  }
62
81
  }
82
+ const ovprRuntime = join(root, OVPR_RUNTIME_PACKAGE_REL);
83
+ if (looksLikeRuntimePackageRoot(ovprRuntime)) {
84
+ return ovprRuntime;
85
+ }
63
86
  return null;
64
87
  }
65
88
  function takeRootOptionValue(argv, index, flag) {
@@ -125,7 +148,7 @@ export function parseArgs(argv) {
125
148
  }
126
149
  return parsed;
127
150
  }
128
- const FRAMEWORK_ROOT_MISS = "check: no framework-root at this project (source checkout, .deft/core, or legacy deft/). Run directive init.\n";
151
+ const FRAMEWORK_ROOT_MISS = "check: no framework-root at this project (source checkout, .deft/core, legacy deft/, or node_modules/@deftai/directive-runtime). Install @deftai/directive-runtime (project package manager) or run directive install.\n";
129
152
  export function run(argv) {
130
153
  const args = parseArgs(argv);
131
154
  if (args.error !== undefined) {
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env node
2
+ import { type ArcDestInstallMode } from "@deftai/directive-core/dist/design-critique/arc-dest.js";
3
+ export declare const DESIGN_CRITIQUE_ENSURE_ARC_DEST_HELP = "design-critique:ensure-arc-dest \u2014 create/verify arc dest via pin-bin (#6142)\n\nUsage:\n deft design-critique:ensure-arc-dest --dest-path <path> [--project-root PATH] [--against-implementation SHA] [--install-mode guarded-prep|process-only-no-install] [--json]\n\nOptions:\n --dest-path PATH Linked worktree path for the arc dest (required)\n --project-root PATH Repo root that owns the worktree (default: cwd)\n --against-implementation SHA Fetched PR head SHA (against-implementation pin)\n --install-mode MODE guarded-prep (default) or process-only-no-install\n --json Emit structured result\n\nExit codes:\n 0 Dest created or reused with selected install mode\n 1 Operational refuse (prep failed, runtime pin missing, stranger lease, \u2026)\n 2 Config / usage error\n";
4
+ export interface DesignCritiqueEnsureArcDestArgs {
5
+ destPath: string | null;
6
+ projectRoot: string;
7
+ againstImplementationSha: string | null;
8
+ installMode: ArcDestInstallMode | null;
9
+ emitJson: boolean;
10
+ help: boolean;
11
+ error?: string;
12
+ }
13
+ export declare function parseDesignCritiqueEnsureArcDestArgs(argv: readonly string[]): DesignCritiqueEnsureArcDestArgs;
14
+ export declare function run(argv: readonly string[]): number;
15
+ export declare function main(argv: readonly string[]): number;
16
+ //# sourceMappingURL=design-critique-ensure-arc-dest.d.ts.map