shadok-ai 0.19.23 → 0.19.25
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/context/scheduler-skill/SKILL.md +11 -11
- package/dist/server.js +60 -5
- package/dist/server.js.map +1 -1
- package/dist/skill-paths.d.ts +29 -0
- package/dist/skill-paths.js +34 -0
- package/dist/skill-paths.js.map +1 -1
- package/package.json +1 -1
|
@@ -61,17 +61,17 @@ absent, and you find out at 6am rather than now. A name that isn't in the vault
|
|
|
61
61
|
is skipped just as silently. Your own shell having the key proves nothing about
|
|
62
62
|
the guard's.
|
|
63
63
|
|
|
64
|
-
`schedule.mjs env` prints exactly what a guard gets here. Run it before writing a
|
|
64
|
+
`node ~/.claude/skills/shadok-scheduler/scripts/schedule.mjs env` prints exactly what a guard gets here. Run it before writing a
|
|
65
65
|
check that needs a secret.
|
|
66
66
|
|
|
67
67
|
## Commands
|
|
68
68
|
|
|
69
69
|
```
|
|
70
|
-
node scripts/schedule.mjs add --schedule <spec> --prompt "<text>" [--check "<shell command>"] [--tz <zone>]
|
|
71
|
-
node scripts/schedule.mjs list
|
|
72
|
-
node scripts/schedule.mjs del <id>
|
|
73
|
-
node scripts/schedule.mjs tz [<zone>|-]
|
|
74
|
-
node scripts/schedule.mjs env
|
|
70
|
+
node ~/.claude/skills/shadok-scheduler/scripts/schedule.mjs add --schedule <spec> --prompt "<text>" [--check "<shell command>"] [--tz <zone>]
|
|
71
|
+
node ~/.claude/skills/shadok-scheduler/scripts/schedule.mjs list
|
|
72
|
+
node ~/.claude/skills/shadok-scheduler/scripts/schedule.mjs del <id>
|
|
73
|
+
node ~/.claude/skills/shadok-scheduler/scripts/schedule.mjs tz [<zone>|-]
|
|
74
|
+
node ~/.claude/skills/shadok-scheduler/scripts/schedule.mjs env
|
|
75
75
|
```
|
|
76
76
|
|
|
77
77
|
`<spec>`: `every:30m` · `every:2h` · `daily:09:00` · `once:2026-08-25T08:42`.
|
|
@@ -98,7 +98,7 @@ Two behaviours worth knowing:
|
|
|
98
98
|
carries its own date, so say in it what it is about and when it was for.
|
|
99
99
|
|
|
100
100
|
```
|
|
101
|
-
node scripts/schedule.mjs add \
|
|
101
|
+
node ~/.claude/skills/shadok-scheduler/scripts/schedule.mjs add \
|
|
102
102
|
--schedule once:2026-08-25T08:42 \
|
|
103
103
|
--prompt "REMINDER — Alex is back today. Two documents have been stuck in generation since 18/08: …"
|
|
104
104
|
```
|
|
@@ -109,8 +109,8 @@ A `daily` runs at that wall-clock time **in a timezone**, and the default is
|
|
|
109
109
|
whatever the SERVER's machine is set to. On a machine running in UTC,
|
|
110
110
|
`daily:09:00` fires at 11:00 for someone in Paris — silently.
|
|
111
111
|
|
|
112
|
-
- `schedule.mjs tz` prints the timezone `daily` schedules actually use.
|
|
113
|
-
- `schedule.mjs tz Europe/Paris` pins it for every `daily` on this instance,
|
|
112
|
+
- `node ~/.claude/skills/shadok-scheduler/scripts/schedule.mjs tz` prints the timezone `daily` schedules actually use.
|
|
113
|
+
- `node ~/.claude/skills/shadok-scheduler/scripts/schedule.mjs tz Europe/Paris` pins it for every `daily` on this instance,
|
|
114
114
|
including the ones already scheduled (they're realigned immediately).
|
|
115
115
|
- `--tz Europe/Paris` on `add` pins one schedule only.
|
|
116
116
|
|
|
@@ -126,7 +126,7 @@ So check `tz` BEFORE scheduling a dated reminder, not after.
|
|
|
126
126
|
### Example — guarded monitoring (near-zero tokens)
|
|
127
127
|
|
|
128
128
|
```
|
|
129
|
-
node scripts/schedule.mjs add \
|
|
129
|
+
node ~/.claude/skills/shadok-scheduler/scripts/schedule.mjs add \
|
|
130
130
|
--schedule daily:09:00 \
|
|
131
131
|
--check "python3 $HOME/.claude/skills/google-ads/scripts/check_budget.py" \
|
|
132
132
|
--prompt "The monitoring detected a Google Ads budget anomaly. Write a clear, actionable alert for the team."
|
|
@@ -135,7 +135,7 @@ node scripts/schedule.mjs add \
|
|
|
135
135
|
### Example — plain recurring report (runs every time)
|
|
136
136
|
|
|
137
137
|
```
|
|
138
|
-
node scripts/schedule.mjs add --schedule daily:18:00 \
|
|
138
|
+
node ~/.claude/skills/shadok-scheduler/scripts/schedule.mjs add --schedule daily:18:00 \
|
|
139
139
|
--prompt "Review the day on the account and post a short summary."
|
|
140
140
|
```
|
|
141
141
|
|
package/dist/server.js
CHANGED
|
@@ -66,7 +66,7 @@ import { resolveSpawnIsolation, osUserFor, homeForUser, tierStateDir, tierStateD
|
|
|
66
66
|
import { mayActOnSession, cronCheckAllowed, mayReachGroup, osUserForChannelGroup, cronCheckEnv, cronCheckCommand, statAsUserArgv, parseStatOutput, readAsUserArgv, sameOfferedFile, } from "./group-exec.js";
|
|
67
67
|
import { mediaDirForGroup, mediaFileMode, parseMediaRequest, groupForMediaKey, passwdGid, mediaDirSpec, mediaDirTrusted, mediaServable, } from "./media-scope.js";
|
|
68
68
|
import { runPrivileged, TREE_OP_TIMEOUT_MS } from "./privileged.js";
|
|
69
|
-
import { HOME_SKILLS_BASE, rewriteSkillsBase } from "./skill-paths.js";
|
|
69
|
+
import { HOME_SKILLS_BASE, missingHomeSkillLinks, rewriteSkillsBase } from "./skill-paths.js";
|
|
70
70
|
import { instanceKey } from "./paths.js";
|
|
71
71
|
import { peerFileFor, loadPeers, savePeers, peerFromToken, signPeerToken, newPeer, withSalts, redeemVerdict, redeemPeer, normPeerName, removePeer, ownedByPeer, peersOutFileFor, tierPeersOutSeed, agentInvitePrompt, peerScope, } from "./peers.js";
|
|
72
72
|
import { loadCrons, saveCrons, upsertCron, removeCron, resolveCronId, nextRunFor, nextRunAfterFailure, isTransient, CRON_MAX_RETRIES, markCronPrompt, isCronPrompt, normalizeSchedule, parseDays, onceAt, stateAfterFire, scheduleLabel, cronTimeZone, defaultTimeZone, systemTimeZone, isValidTimeZone, } from "./crons.js";
|
|
@@ -3752,12 +3752,62 @@ function seedSystemSkills() {
|
|
|
3752
3752
|
}
|
|
3753
3753
|
}
|
|
3754
3754
|
/**
|
|
3755
|
-
*
|
|
3755
|
+
* Make the conventional `~/.claude/skills/<skill>` path resolve in a group's
|
|
3756
|
+
* HOME, by linking each machine-wide skill into it.
|
|
3757
|
+
*
|
|
3758
|
+
* The skills themselves stay in ONE place (`seedSystemSkills`) — these are
|
|
3759
|
+
* symlinks, not copies, so an updated skill needs no per-HOME refresh. What
|
|
3760
|
+
* this buys is the path: `rewriteSkillsBase` fixes what an agent reads, and
|
|
3761
|
+
* cannot fix what an agent KNOWS. A dropped agent writing a command from habit
|
|
3762
|
+
* reaches for `~/.claude/skills/...`, which exists for the server user and for
|
|
3763
|
+
* every mono-tenant install and, until now, nowhere in a group home — the
|
|
3764
|
+
* answer being a bare `MODULE_NOT_FOUND` that names no better path
|
|
3765
|
+
* (`missingHomeSkillLinks`).
|
|
3766
|
+
*
|
|
3767
|
+
* A directory, never a symlink to the tier: `~/.claude/skills` is also where an
|
|
3768
|
+
* agent keeps the skills it AUTHORS (`healCommonsStrandedScripts`), and that
|
|
3769
|
+
* directory has to stay writable by its owner. For the same reason an existing
|
|
3770
|
+
* name is never touched — `ln -s` without `-f`, so the agent's own copy wins.
|
|
3771
|
+
*
|
|
3772
|
+
* Everything runs AS the group user, like `ensureTierStateDir`: root must not
|
|
3773
|
+
* write through a 0700 HOME it does not own, where an agent could have planted
|
|
3774
|
+
* a symlink.
|
|
3775
|
+
*/
|
|
3776
|
+
function linkSystemSkills(user, home) {
|
|
3777
|
+
if (DEPLOYMENT_MODE !== "multi-tenant")
|
|
3778
|
+
return;
|
|
3779
|
+
const dir = path.join(home, ".claude", "skills");
|
|
3780
|
+
try {
|
|
3781
|
+
const system = fs
|
|
3782
|
+
.readdirSync(SYSTEM_SKILLS_DIR, { withFileTypes: true })
|
|
3783
|
+
.filter((d) => d.isDirectory())
|
|
3784
|
+
.map((d) => d.name);
|
|
3785
|
+
if (!system.length)
|
|
3786
|
+
return; // nothing seeded (SHADOK_SEED_SKILLS=0, or a failed seed)
|
|
3787
|
+
if (!spawnAsUserSync(user, "mkdir", ["-p", dir]).ok) {
|
|
3788
|
+
console.log(`skills: could not create ${dir} as ${user} — left alone`);
|
|
3789
|
+
return;
|
|
3790
|
+
}
|
|
3791
|
+
const have = spawnAsUserSync(user, "ls", ["-1", dir]).stdout.split("\n");
|
|
3792
|
+
const missing = missingHomeSkillLinks(system, have);
|
|
3793
|
+
for (const name of missing) {
|
|
3794
|
+
spawnAsUserSync(user, "ln", ["-s", path.join(SYSTEM_SKILLS_DIR, name), path.join(dir, name)]);
|
|
3795
|
+
}
|
|
3796
|
+
if (missing.length)
|
|
3797
|
+
console.log(`skills: linked ${missing.length} machine-wide skills into ${dir}`);
|
|
3798
|
+
}
|
|
3799
|
+
catch (e) {
|
|
3800
|
+
console.log(`skills: could not link the machine-wide skills into ${dir} — ${e instanceof Error ? e.message : String(e)}`);
|
|
3801
|
+
}
|
|
3802
|
+
}
|
|
3803
|
+
/**
|
|
3804
|
+
* Seed a group user's HOME at PROVISION time. The skills are not COPIED here —
|
|
3756
3805
|
* they live in the machine-wide Enterprise tier (`seedSystemSkills`), read by
|
|
3757
|
-
* every user
|
|
3806
|
+
* every user — but they are LINKED, so the conventional `~/.claude/skills` path
|
|
3807
|
+
* an agent reaches for from habit resolves (`linkSystemSkills`).
|
|
3758
3808
|
*/
|
|
3759
|
-
async function seedGroupHome(
|
|
3760
|
-
|
|
3809
|
+
async function seedGroupHome(home, user) {
|
|
3810
|
+
linkSystemSkills(user, home);
|
|
3761
3811
|
}
|
|
3762
3812
|
/** Does an OS user already exist? Used to make provisioning idempotent. */
|
|
3763
3813
|
async function osUserExists(u) {
|
|
@@ -8161,6 +8211,11 @@ function preseedGroupHomes() {
|
|
|
8161
8211
|
// merely RESUMED never runs the spawn path, so it stayed without an identity
|
|
8162
8212
|
// until someone reloaded it. Idempotent: skipped the moment the key is there.
|
|
8163
8213
|
ensureAgentSshKey(user, home);
|
|
8214
|
+
// And the skills' conventional path, at BOOT and not only at provisioning:
|
|
8215
|
+
// every HOME that predates this, and every one a docker recreate wiped,
|
|
8216
|
+
// would otherwise keep answering MODULE_NOT_FOUND. Idempotent — an existing
|
|
8217
|
+
// name is left exactly as it is.
|
|
8218
|
+
linkSystemSkills(user, home);
|
|
8164
8219
|
}
|
|
8165
8220
|
seedCommonsPeersOut();
|
|
8166
8221
|
}
|