shadok-ai 0.17.20 → 0.17.22
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/server.js +16 -2
- package/dist/server.js.map +1 -1
- package/dist/skill-paths.d.ts +27 -0
- package/dist/skill-paths.js +32 -0
- package/dist/skill-paths.js.map +1 -0
- package/package.json +1 -1
- package/public/index.html +9 -15
package/dist/server.js
CHANGED
|
@@ -52,6 +52,7 @@ import { migrateTgBindings } from "./channels.js";
|
|
|
52
52
|
import { viewerFor, canResumeAs, canRestartInto, canSeeGroup, membershipVerdict, canSeeSession, listableGroups, visibleChannels, secretOwnGroupIds, ledgerGroupsFor, groupsPutFlow, privateGroupFor, newPrivateGroup, accountDeleteGroups, MAIN_GROUP_ID, } from "./groups.js";
|
|
53
53
|
import { resolveSpawnIsolation, osUserFor, homeForUser, runAsUser, provisionGroupUser, teardownGroupUser, reconcileGroupProvisioning, DEFAULT_HOME_BASE, createGroupFlow, deleteGroupFlow, SHARED_POT_GROUP, DEFAULT_SHARED_POT_PATH, } from "./osusers.js";
|
|
54
54
|
import { runPrivileged, TREE_OP_TIMEOUT_MS } from "./privileged.js";
|
|
55
|
+
import { HOME_SKILLS_BASE, rewriteSkillsBase } from "./skill-paths.js";
|
|
55
56
|
import { instanceKey } from "./paths.js";
|
|
56
57
|
import { peerFileFor, loadPeers, savePeers, peerFromToken, signPeerToken, newPeer, withSalts, redeemVerdict, redeemPeer, normPeerName, removePeer, ownedByPeer, peersOutFileFor, agentInvitePrompt, peerScope, } from "./peers.js";
|
|
57
58
|
import { loadCrons, saveCrons, upsertCron, removeCron, resolveCronId, nextRunFor, nextRunAfterFailure, isTransient, CRON_MAX_RETRIES, markCronPrompt, normalizeSchedule, onceAt, stateAfterFire, scheduleLabel, cronTimeZone, defaultTimeZone, systemTimeZone, isValidTimeZone, } from "./crons.js";
|
|
@@ -2419,6 +2420,14 @@ const SKILL_SOURCES = [
|
|
|
2419
2420
|
* `~/.claude/skills`. `/etc/claude-code/.claude/skills` on Linux (overridable
|
|
2420
2421
|
* for other layouts). Disable in the CLI with `CLAUDE_CODE_DISABLE_POLICY_SKILLS`. */
|
|
2421
2422
|
const SYSTEM_SKILLS_DIR = (process.env.SHADOK_SYSTEM_SKILLS_DIR ?? "").trim() || "/etc/claude-code/.claude/skills";
|
|
2423
|
+
/** Where the shadok skills' scripts REALLY live for this instance — the base the
|
|
2424
|
+
* shipped `~/.claude/skills/...` paths must be rewritten to (`rewriteSkillsBase`).
|
|
2425
|
+
* Multi-tenant installs them machine-wide and drops agents to HOMEs that have no
|
|
2426
|
+
* personal copy, so the Enterprise tier is the truth; mono-tenant keeps the HOME
|
|
2427
|
+
* tier, where `seedXxxSkill` put them and the literal is already correct. Keyed
|
|
2428
|
+
* on the SAME `DEPLOYMENT_MODE` that decides where they are installed, so the
|
|
2429
|
+
* path named can never diverge from the path on disk. */
|
|
2430
|
+
const SKILLS_BASE = DEPLOYMENT_MODE === "multi-tenant" ? SYSTEM_SKILLS_DIR : HOME_SKILLS_BASE;
|
|
2422
2431
|
/**
|
|
2423
2432
|
* Install the shadok skills GLOBALLY, into the machine-wide Enterprise tier, so
|
|
2424
2433
|
* every dropped group agent (`sk-<id>`, HOME `/home/sk-<id>`) gets them with NO
|
|
@@ -2437,6 +2446,11 @@ function seedSystemSkills() {
|
|
|
2437
2446
|
const dst = path.join(SYSTEM_SKILLS_DIR, dstName);
|
|
2438
2447
|
fs.mkdirSync(dst, { recursive: true });
|
|
2439
2448
|
fs.cpSync(src, dst, { recursive: true });
|
|
2449
|
+
// The copied SKILL.md still names the HOME path (`~/.claude/skills/...`),
|
|
2450
|
+
// but a dropped agent reads THIS tier — retarget it so the commands it
|
|
2451
|
+
// runs resolve. SKILLS_BASE is SYSTEM_SKILLS_DIR here (multi-tenant only).
|
|
2452
|
+
const skillMd = path.join(dst, "SKILL.md");
|
|
2453
|
+
fs.writeFileSync(skillMd, rewriteSkillsBase(fs.readFileSync(skillMd, "utf8"), SKILLS_BASE));
|
|
2440
2454
|
}
|
|
2441
2455
|
// World-readable (every sk-* user reads the same install) and .mjs runnable.
|
|
2442
2456
|
execFileSync("chmod", ["-R", "a+rX", SYSTEM_SKILLS_DIR]);
|
|
@@ -4772,7 +4786,7 @@ function pilotPrompt() {
|
|
|
4772
4786
|
pilotPromptCache =
|
|
4773
4787
|
process.env.SHADOK_PILOT_PROMPT === "0"
|
|
4774
4788
|
? null
|
|
4775
|
-
: fs.readFileSync(PILOT_PROMPT_PATH, "utf8").trim() || null;
|
|
4789
|
+
: rewriteSkillsBase(fs.readFileSync(PILOT_PROMPT_PATH, "utf8").trim(), SKILLS_BASE) || null;
|
|
4776
4790
|
}
|
|
4777
4791
|
catch {
|
|
4778
4792
|
pilotPromptCache = null;
|
|
@@ -4790,7 +4804,7 @@ let ledgerReflexCache;
|
|
|
4790
4804
|
function ledgerReflex() {
|
|
4791
4805
|
if (ledgerReflexCache === undefined) {
|
|
4792
4806
|
try {
|
|
4793
|
-
ledgerReflexCache = fs.readFileSync(LEDGER_REFLEX_PATH, "utf8").trim() || null;
|
|
4807
|
+
ledgerReflexCache = rewriteSkillsBase(fs.readFileSync(LEDGER_REFLEX_PATH, "utf8").trim(), SKILLS_BASE) || null;
|
|
4794
4808
|
}
|
|
4795
4809
|
catch {
|
|
4796
4810
|
ledgerReflexCache = null;
|