shadok-ai 0.17.42 → 0.17.43
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/migrate-groups.d.ts +26 -13
- package/dist/migrate-groups.js +48 -17
- package/dist/migrate-groups.js.map +1 -1
- package/dist/server.js +23 -16
- package/dist/server.js.map +1 -1
- package/package.json +1 -1
package/dist/migrate-groups.d.ts
CHANGED
|
@@ -124,21 +124,34 @@ export declare function rewriteCronCheckHome(check: string, oldHome: string, new
|
|
|
124
124
|
*/
|
|
125
125
|
export declare const SHADOK_INTERNAL_DIRS: readonly string[];
|
|
126
126
|
/**
|
|
127
|
-
* The `~/.
|
|
128
|
-
*
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
127
|
+
* The `~/.claude/<dir>` subtrees NEVER carried by the heal. `.credentials` is a
|
|
128
|
+
* FILE, not a dir, so it can't match anyway — the real entries are the big
|
|
129
|
+
* already-migrated trees (`migChownTreeToCommons` copies `projects`/`todos`/
|
|
130
|
+
* `shell-snapshots`/`file-history`) and the caches (`statsig`/`plugins`/`ide`):
|
|
131
|
+
* re-copying them would be wasteful, and they are not scripts a guard runs.
|
|
132
|
+
* `skills` and `scripts` (and any custom dir) are deliberately NOT here — those
|
|
133
|
+
* are where an agent keeps the monitoring scripts it authored.
|
|
134
|
+
*/
|
|
135
|
+
export declare const CLAUDE_INTERNAL_DIRS: readonly string[];
|
|
136
|
+
/**
|
|
137
|
+
* The home-rooted `<top>/<sub>` script directories a cron `check` names, that the
|
|
138
|
+
* HOME move off `/root` stranded. A dropped `main` guard cannot traverse `/root`
|
|
139
|
+
* (0700), so ANY `/root/<top>/<sub>/…` path it names — a script or its sibling
|
|
140
|
+
* state file — is unreachable and the guard dies `check-failed` in silence. #419
|
|
141
|
+
* relocated only `.claude/skills`; this generalises the discovery so `.claude/scripts`
|
|
142
|
+
* (seen on the biosense cockpit), every `.shadok-ai/<dir>` (the dogfood instance),
|
|
143
|
+
* and any future script dir are all carried across — the trap is not one directory,
|
|
144
|
+
* it is "any `/root` path a check names".
|
|
134
145
|
*
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
* `<
|
|
138
|
-
*
|
|
139
|
-
*
|
|
146
|
+
* Matches an absolute `oldHome` reference AND a `$HOME`/`${HOME}`/`~`-relative one
|
|
147
|
+
* (a portable check still needs its dir to EXIST in the new HOME). Only the 2-level
|
|
148
|
+
* `<top>/<sub>` unit is relocated, with `<top>` restricted to the two script homes
|
|
149
|
+
* and `<sub>` refused when it is shadok's own state/credentials or a big
|
|
150
|
+
* already-migrated `.claude` tree (`RELOCATABLE_TOPS`). Returns distinct RELATIVE
|
|
151
|
+
* prefixes (`".claude/scripts"`, `".shadok-ai/checks"`, …), ready to feed
|
|
152
|
+
* `rewriteCronCheckHome` and `path.join`. Pure.
|
|
140
153
|
*/
|
|
141
|
-
export declare function
|
|
154
|
+
export declare function strandedCheckDirs(check: string, oldHome: string): string[];
|
|
142
155
|
/**
|
|
143
156
|
* The running agents to respawn, as session ids — deduped, order preserved so
|
|
144
157
|
* the caller cycles them ONE AT A TIME (the OAuth refresh-token race,
|
package/dist/migrate-groups.js
CHANGED
|
@@ -161,30 +161,61 @@ export const SHADOK_INTERNAL_DIRS = [
|
|
|
161
161
|
"wt",
|
|
162
162
|
];
|
|
163
163
|
/**
|
|
164
|
-
* The `~/.
|
|
165
|
-
*
|
|
166
|
-
*
|
|
167
|
-
*
|
|
168
|
-
*
|
|
169
|
-
*
|
|
170
|
-
*
|
|
164
|
+
* The `~/.claude/<dir>` subtrees NEVER carried by the heal. `.credentials` is a
|
|
165
|
+
* FILE, not a dir, so it can't match anyway — the real entries are the big
|
|
166
|
+
* already-migrated trees (`migChownTreeToCommons` copies `projects`/`todos`/
|
|
167
|
+
* `shell-snapshots`/`file-history`) and the caches (`statsig`/`plugins`/`ide`):
|
|
168
|
+
* re-copying them would be wasteful, and they are not scripts a guard runs.
|
|
169
|
+
* `skills` and `scripts` (and any custom dir) are deliberately NOT here — those
|
|
170
|
+
* are where an agent keeps the monitoring scripts it authored.
|
|
171
|
+
*/
|
|
172
|
+
export const CLAUDE_INTERNAL_DIRS = [
|
|
173
|
+
"projects",
|
|
174
|
+
"todos",
|
|
175
|
+
"shell-snapshots",
|
|
176
|
+
"file-history",
|
|
177
|
+
"statsig",
|
|
178
|
+
"plugins",
|
|
179
|
+
"ide",
|
|
180
|
+
];
|
|
181
|
+
/** The two home subtrees under which an agent/operator legitimately drops a
|
|
182
|
+
* script a cron guard runs. An ALLOWLIST of TOPS (safe — scripts never live
|
|
183
|
+
* anywhere else under the HOME) combined with a per-top DENYLIST of SUBS (so a
|
|
184
|
+
* custom-named script dir still heals). */
|
|
185
|
+
const RELOCATABLE_TOPS = {
|
|
186
|
+
".claude": CLAUDE_INTERNAL_DIRS,
|
|
187
|
+
".shadok-ai": SHADOK_INTERNAL_DIRS,
|
|
188
|
+
};
|
|
189
|
+
/**
|
|
190
|
+
* The home-rooted `<top>/<sub>` script directories a cron `check` names, that the
|
|
191
|
+
* HOME move off `/root` stranded. A dropped `main` guard cannot traverse `/root`
|
|
192
|
+
* (0700), so ANY `/root/<top>/<sub>/…` path it names — a script or its sibling
|
|
193
|
+
* state file — is unreachable and the guard dies `check-failed` in silence. #419
|
|
194
|
+
* relocated only `.claude/skills`; this generalises the discovery so `.claude/scripts`
|
|
195
|
+
* (seen on the biosense cockpit), every `.shadok-ai/<dir>` (the dogfood instance),
|
|
196
|
+
* and any future script dir are all carried across — the trap is not one directory,
|
|
197
|
+
* it is "any `/root` path a check names".
|
|
171
198
|
*
|
|
172
|
-
*
|
|
173
|
-
*
|
|
174
|
-
* `<
|
|
175
|
-
*
|
|
176
|
-
*
|
|
199
|
+
* Matches an absolute `oldHome` reference AND a `$HOME`/`${HOME}`/`~`-relative one
|
|
200
|
+
* (a portable check still needs its dir to EXIST in the new HOME). Only the 2-level
|
|
201
|
+
* `<top>/<sub>` unit is relocated, with `<top>` restricted to the two script homes
|
|
202
|
+
* and `<sub>` refused when it is shadok's own state/credentials or a big
|
|
203
|
+
* already-migrated `.claude` tree (`RELOCATABLE_TOPS`). Returns distinct RELATIVE
|
|
204
|
+
* prefixes (`".claude/scripts"`, `".shadok-ai/checks"`, …), ready to feed
|
|
205
|
+
* `rewriteCronCheckHome` and `path.join`. Pure.
|
|
177
206
|
*/
|
|
178
|
-
export function
|
|
207
|
+
export function strandedCheckDirs(check, oldHome) {
|
|
179
208
|
if (!check || !oldHome)
|
|
180
209
|
return [];
|
|
181
|
-
const
|
|
210
|
+
const homeAlt = [escapeRegExp(oldHome), "\\$HOME", "\\$\\{HOME\\}", "~"].join("|");
|
|
211
|
+
const tops = Object.keys(RELOCATABLE_TOPS).map((t) => escapeRegExp(t)).join("|");
|
|
212
|
+
const re = new RegExp("(?:" + homeAlt + ")/(" + tops + ")/([^/\\s'\"]+)/", "g");
|
|
182
213
|
const out = new Set();
|
|
183
214
|
for (let m = re.exec(check); m; m = re.exec(check)) {
|
|
184
|
-
const
|
|
185
|
-
if (
|
|
215
|
+
const [, top, sub] = m;
|
|
216
|
+
if (RELOCATABLE_TOPS[top]?.includes(sub))
|
|
186
217
|
continue;
|
|
187
|
-
out.add("
|
|
218
|
+
out.add(top + "/" + sub);
|
|
188
219
|
}
|
|
189
220
|
return [...out];
|
|
190
221
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrate-groups.js","sourceRoot":"","sources":["../src/migrate-groups.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH;kDACkD;AAClD,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC;AAEnC;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,sBAAsB,CAAC;AAuB5D;;;;;;;;GAQG;AACH,MAAM,UAAU,aAAa,CAAC,KAK7B;IACC,IAAI,KAAK,CAAC,eAAe;QAAE,O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/G,CAAC;IACD,MAAM,IAAI,CAAC,uCAAuC,EAAE,IAAI,CAAC,mBAAmB,EAAE,IAAI,CAAC,mBAAmB,EAAE,KAAK,CAAC,CAAC;IAE/G,IAAI,MAAM,EAAE,CAAC;QACX,IAAI,CAAC;YACH,IAAI,CAAC,WAAW,EAAE,CAAC;YACnB,GAAG,CAAC,yFAAyF,CAAC,CAAC;QACjG,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,GAAG,CAAC,uCAAwC,CAAW,EAAE,OAAO,IAAI,CAAC,EAAE,CAAC,CAAC;QAC3E,CAAC;IACH,CAAC;SAAM,CAAC;QACN,GAAG,CAAC,iGAAiG,CAAC,CAAC;IACzG,CAAC;AACH,CAAC"}
|
package/dist/server.js
CHANGED
|
@@ -34,7 +34,7 @@ import { readGroundAt } from "./ground.js";
|
|
|
34
34
|
import { homeGreetingBrief } from "./greeting.js";
|
|
35
35
|
import { ensureSshIdentity } from "./ssh.js";
|
|
36
36
|
import { accountsEnabled, deploymentMode, probeCanProvision } from "./capability.js";
|
|
37
|
-
import { migrationPlan, runMigration, respawnPlan, commonsOsUser, COMMONS_USER, MIGRATION_MARKER_FILE, rewriteCronCheckHome,
|
|
37
|
+
import { migrationPlan, runMigration, respawnPlan, commonsOsUser, COMMONS_USER, MIGRATION_MARKER_FILE, rewriteCronCheckHome, strandedCheckDirs, } from "./migrate-groups.js";
|
|
38
38
|
import { relayOAuthCallback } from "./oauth-relay.js";
|
|
39
39
|
import { openBrowser } from "./open-browser.js";
|
|
40
40
|
import { parseSkillMeta, prepromptParts, prepromptFingerprint, stalenessReasons, LEGACY_FINGERPRINT, } from "./preprompt.js";
|
|
@@ -3024,13 +3024,16 @@ async function ensureGroupsProvisioned() {
|
|
|
3024
3024
|
* crons stuck, "son script est sous /root"). New agents are fine (their HOME is
|
|
3025
3025
|
* already `/home/main`); this is the one-way carry for what predates the move.
|
|
3026
3026
|
*
|
|
3027
|
-
*
|
|
3028
|
-
* 1. `~/.claude/skills` — the subtree `migChownTreeToCommons` skipped,
|
|
3029
|
-
* agent keeps the custom
|
|
3030
|
-
*
|
|
3031
|
-
*
|
|
3032
|
-
*
|
|
3033
|
-
*
|
|
3027
|
+
* What is relocated here and then repointed:
|
|
3028
|
+
* 1. `~/.claude/skills` — ALWAYS, the subtree `migChownTreeToCommons` skipped,
|
|
3029
|
+
* where an agent keeps the custom skills it authored even when no guard names
|
|
3030
|
+
* them (#419).
|
|
3031
|
+
* 2. Every home-rooted `<top>/<sub>` script dir a cron check NAMES — `.claude/scripts`
|
|
3032
|
+
* (seen on the biosense cockpit), any `.shadok-ai/<dir>` (the dogfood instance),
|
|
3033
|
+
* and any future one — discovered by `strandedCheckDirs`. The trap is not one
|
|
3034
|
+
* directory, it is "any `/root` path a check names". Its denylist refuses shadok's
|
|
3035
|
+
* own state/credential stores and the big already-migrated `.claude` trees, so a
|
|
3036
|
+
* key/secret dir is NEVER copied into `/home/main`.
|
|
3034
3037
|
*
|
|
3035
3038
|
* Runs on EVERY capable boot, independent of the migration marker (the twin of
|
|
3036
3039
|
* the reprovision reconciler above), so an ALREADY-migrated instance self-heals on
|
|
@@ -3068,14 +3071,16 @@ async function healCommonsStrandedScripts() {
|
|
|
3068
3071
|
catch (e) {
|
|
3069
3072
|
console.error(`heal: reading crons failed (best-effort): ${e?.message ?? e}`);
|
|
3070
3073
|
}
|
|
3071
|
-
// The
|
|
3072
|
-
// credential/state dir
|
|
3074
|
+
// The home-rooted <top>/<sub> script dirs the guards name (.claude/scripts,
|
|
3075
|
+
// .shadok-ai/<dir>, …), deduped — never a credential/state dir, strandedCheckDirs
|
|
3076
|
+
// denylists those.
|
|
3073
3077
|
const scriptDirs = [
|
|
3074
|
-
...new Set(crons.flatMap((c) => (c.check ?
|
|
3078
|
+
...new Set(crons.flatMap((c) => (c.check ? strandedCheckDirs(c.check, oldHome) : []))),
|
|
3075
3079
|
];
|
|
3076
|
-
// 1) Relocate the
|
|
3077
|
-
//
|
|
3078
|
-
|
|
3080
|
+
// 1) Relocate ~/.claude/skills unconditionally (the subtree the migration skipped,
|
|
3081
|
+
// where an agent's custom skills live even when no guard names them), plus every
|
|
3082
|
+
// discovered script dir. Deduped; each copy is independent and best-effort.
|
|
3083
|
+
for (const rel of [...new Set([path.join(".claude", "skills"), ...scriptDirs])]) {
|
|
3079
3084
|
try {
|
|
3080
3085
|
await copyTree(rel);
|
|
3081
3086
|
}
|
|
@@ -3083,8 +3088,10 @@ async function healCommonsStrandedScripts() {
|
|
|
3083
3088
|
console.error(`heal: relocating commons ~/${rel} failed (best-effort): ${e?.message ?? e}`);
|
|
3084
3089
|
}
|
|
3085
3090
|
}
|
|
3086
|
-
// 2) Repoint this instance's cron guards: the .claude base
|
|
3087
|
-
//
|
|
3091
|
+
// 2) Repoint this instance's cron guards: the .claude base (covers any .claude/*
|
|
3092
|
+
// path) AND every relocated .shadok-ai/<dir>. A /root path NOT relocated (a
|
|
3093
|
+
// denylisted or unknown dir) stays intact — surfaced as a check-failed, not
|
|
3094
|
+
// silently repointed to a place nothing was copied.
|
|
3088
3095
|
try {
|
|
3089
3096
|
let changed = false;
|
|
3090
3097
|
for (const c of crons) {
|