shadok-ai 0.19.9 → 0.19.11
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/README.md +2 -1
- package/package.json +1 -1
- package/public/index.html +98 -25
package/README.md
CHANGED
|
@@ -373,7 +373,8 @@ Enter to skip; you can add it later from the web UI).
|
|
|
373
373
|
- **From the agent's side.** The ▯ button in an agent's bar opens its info
|
|
374
374
|
panel: its directory and profile, the skills it has (runs this week, ⏰ how
|
|
375
375
|
many on a schedule), and its schedules with the skills each one uses. Click
|
|
376
|
-
a skill to open its card in the Skill Factory.
|
|
376
|
+
a skill to open its card in the Skill Factory. The ⏰ Schedule panel shows
|
|
377
|
+
the same thing under each schedule ("Uses ✦ skill"), one click from editing it.
|
|
377
378
|
- **Creating.** The new-skill form asks for a **name** (what people see) and
|
|
378
379
|
a **technical name** (what agents call it, `/name:name`), proposed from the
|
|
379
380
|
name until you type your own. Choose it then: it is the skill's repository
|
package/package.json
CHANGED
package/public/index.html
CHANGED
|
@@ -287,6 +287,7 @@
|
|
|
287
287
|
#verMenu .vm-label { color: var(--text-dim); }
|
|
288
288
|
#verMenu .vm-check { display: flex; align-items: center; gap: 6px; margin-top: 9px; cursor: pointer; }
|
|
289
289
|
#verMenu .vm-hint { color: var(--text-dim); font-size: 10px; margin-top: 7px; line-height: 1.4; }
|
|
290
|
+
#verMenu .vm-hint.danger { color: #e2564a; }
|
|
290
291
|
#verMenu .vm-btn { margin-top: 10px; width: 100%; padding: 6px 10px; font-size: 11px; cursor: pointer;
|
|
291
292
|
color: var(--text, #e8e8ea); background: transparent; border: 1px solid var(--line, #3a3d42); border-radius: 6px; }
|
|
292
293
|
#verMenu .vm-btn:hover { border-color: var(--amber, #d0a000); }
|
|
@@ -2189,11 +2190,13 @@
|
|
|
2189
2190
|
#infoBody .ip-skill .ip-meta { color: var(--text-dim); font-size: 12px; flex-shrink: 0; }
|
|
2190
2191
|
#infoBody .ip-cron { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin-top: 6px; background: var(--bg); }
|
|
2191
2192
|
#infoBody .ip-cron .ip-prompt { color: var(--text-dim); font-size: 12px; margin-top: 3px; white-space: pre-wrap; overflow-wrap: anywhere; }
|
|
2192
|
-
#infoBody .ip-chip {
|
|
2193
|
+
#infoBody .ip-chip, #cronList .ip-chip {
|
|
2193
2194
|
display: inline-block; margin: 6px 6px 0 0; padding: 2px 9px; border-radius: 999px; font-size: 12px; cursor: pointer;
|
|
2194
2195
|
border: 1px solid color-mix(in srgb, var(--amber) 45%, transparent); background: var(--amber-soft); color: var(--text);
|
|
2195
2196
|
}
|
|
2196
|
-
#infoBody .ip-chip:hover { border-color: var(--amber); }
|
|
2197
|
+
#infoBody .ip-chip:hover, #cronList .ip-chip:hover { border-color: var(--amber); }
|
|
2198
|
+
#cronList .cron-skills { margin: -6px 0 10px; font-size: 12px; }
|
|
2199
|
+
#cronList .cron-skills .ip-chip { margin-top: 4px; }
|
|
2197
2200
|
#infoBody .ip-empty { color: var(--text-dim); font-size: 12px; font-style: italic; padding: 4px 0; }
|
|
2198
2201
|
#infoBody .ip-link { background: none; border: 0; padding: 0; color: var(--amber); cursor: pointer; font-size: 12px; }
|
|
2199
2202
|
.fp-agent-link { background: none; border: 0; padding: 0; color: inherit; font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline dotted; }
|
|
@@ -3431,7 +3434,14 @@
|
|
|
3431
3434
|
</select>
|
|
3432
3435
|
</div>
|
|
3433
3436
|
<div class="vm-hint" id="vmChannelHint"></div>
|
|
3434
|
-
<
|
|
3437
|
+
<div class="vm-row"><span class="vm-label">Permissions</span>
|
|
3438
|
+
<select id="permModeSel">
|
|
3439
|
+
<option value="default">Ask before each action</option>
|
|
3440
|
+
<option value="acceptEdits">Auto-apply edits</option>
|
|
3441
|
+
<option value="auto">Auto mode — no prompts</option>
|
|
3442
|
+
<option value="bypassPermissions">Bypass — 0 questions ⚠️</option>
|
|
3443
|
+
</select>
|
|
3444
|
+
</div>
|
|
3435
3445
|
<div class="vm-hint" id="vmModeHint"></div>
|
|
3436
3446
|
<label class="vm-check"><input type="checkbox" id="ledgerChk"><span>Shared ledger</span></label>
|
|
3437
3447
|
<div class="vm-hint" id="vmLedgerHint"></div>
|
|
@@ -9650,7 +9660,7 @@
|
|
|
9650
9660
|
const verMenu = document.getElementById("verMenu");
|
|
9651
9661
|
const autoUpdateChk = document.getElementById("autoUpdateChk");
|
|
9652
9662
|
const updChannelSel = document.getElementById("updChannelSel");
|
|
9653
|
-
const
|
|
9663
|
+
const permModeSel = document.getElementById("permModeSel");
|
|
9654
9664
|
const ledgerChk = document.getElementById("ledgerChk");
|
|
9655
9665
|
const restartAllBtn = document.getElementById("restartAllBtn");
|
|
9656
9666
|
|
|
@@ -9713,6 +9723,33 @@
|
|
|
9713
9723
|
: "Group isolation did NOT complete — agents are running un-isolated (commons). Check the server logs; it retries on the next restart.";
|
|
9714
9724
|
}
|
|
9715
9725
|
|
|
9726
|
+
// The permission mode every NEW agent spawns in. The dropdown lists the four
|
|
9727
|
+
// useful rungs; the server accepts more (manual/dontAsk/plan, settable via the
|
|
9728
|
+
// API or config). If the instance is on one of those, we show it as a
|
|
9729
|
+
// read-through option rather than snapping the menu to a mode nobody picked.
|
|
9730
|
+
const PERM_MODE_HINTS = {
|
|
9731
|
+
default: "New agents ask before each action.",
|
|
9732
|
+
acceptEdits: "New agents auto-apply file edits, and ask before other actions.",
|
|
9733
|
+
auto: "New agents start in auto mode (Shift+Tab): no prompts, though a risky action can still be refused.",
|
|
9734
|
+
bypassPermissions: "⚠️ No permission checks at all — any command runs with no question. Agents aren't sandboxed and read untrusted content; a prompt injection could do real damage.",
|
|
9735
|
+
};
|
|
9736
|
+
function renderPermMode(mode) {
|
|
9737
|
+
const m = mode || "default";
|
|
9738
|
+
const known = Object.prototype.hasOwnProperty.call(PERM_MODE_HINTS, m);
|
|
9739
|
+
let extra = permModeSel.querySelector('option[data-extra="1"]');
|
|
9740
|
+
if (!known) {
|
|
9741
|
+
if (!extra) { extra = document.createElement("option"); extra.dataset.extra = "1"; permModeSel.appendChild(extra); }
|
|
9742
|
+
extra.value = m; extra.textContent = "Mode: " + m;
|
|
9743
|
+
} else if (extra) {
|
|
9744
|
+
extra.remove();
|
|
9745
|
+
}
|
|
9746
|
+
permModeSel.value = m;
|
|
9747
|
+
permModeSel.dataset.applied = m;
|
|
9748
|
+
const hint = document.getElementById("vmModeHint");
|
|
9749
|
+
hint.textContent = PERM_MODE_HINTS[m] || ("Mode: " + m + ".");
|
|
9750
|
+
hint.classList.toggle("danger", m === "bypassPermissions");
|
|
9751
|
+
}
|
|
9752
|
+
|
|
9716
9753
|
function renderVerMenu() {
|
|
9717
9754
|
if (!lastVersion || verMenu.hidden) return;
|
|
9718
9755
|
const m = lastVersion;
|
|
@@ -9731,13 +9768,7 @@
|
|
|
9731
9768
|
document.getElementById("vmChannelHint").textContent = ch === "alpha"
|
|
9732
9769
|
? "Every merge, as soon as it ships — newest work, freshest bugs."
|
|
9733
9770
|
: "Only promoted releases. Quieter, and what a fresh install gets.";
|
|
9734
|
-
|
|
9735
|
-
acceptEditsChk.checked = autoOn;
|
|
9736
|
-
document.getElementById("vmModeHint").textContent = autoOn
|
|
9737
|
-
? "New agents start in auto mode (Shift+Tab), running without prompts."
|
|
9738
|
-
: (m.permissionMode && m.permissionMode !== "default"
|
|
9739
|
-
? "Mode: " + m.permissionMode + "."
|
|
9740
|
-
: "New agents ask before each action.");
|
|
9771
|
+
renderPermMode(m.permissionMode || "default");
|
|
9741
9772
|
ledgerChk.checked = !!m.ledgerEnabled;
|
|
9742
9773
|
document.getElementById("vmLedgerHint").textContent = m.ledgerEnabled
|
|
9743
9774
|
? "Agents verify a status before re-raising it. Toggling restarts all agents."
|
|
@@ -9972,19 +10003,31 @@
|
|
|
9972
10003
|
updChannelSel.value = channel === "alpha" ? "beta" : "alpha"; // revert on failure
|
|
9973
10004
|
}
|
|
9974
10005
|
});
|
|
9975
|
-
|
|
9976
|
-
const
|
|
10006
|
+
permModeSel.addEventListener("change", async () => {
|
|
10007
|
+
const mode = permModeSel.value;
|
|
10008
|
+
const prev = permModeSel.dataset.applied || "default";
|
|
10009
|
+
if (mode === prev) return;
|
|
10010
|
+
// Bypass runs every new agent with no permission checks at all; make the
|
|
10011
|
+
// operator confirm it explicitly (same native confirm() as End agent etc.).
|
|
10012
|
+
if (mode === "bypassPermissions" && !confirm(
|
|
10013
|
+
"Switch every NEW agent to Bypass (0 questions)?\n\n" +
|
|
10014
|
+
"Agents will run with NO permission checks — any shell command, any file write, " +
|
|
10015
|
+
"nothing is ever asked. They are not sandboxed, run as your user, and read " +
|
|
10016
|
+
"untrusted content (web pages, cloned repos, messages), so a prompt injection " +
|
|
10017
|
+
"could do real damage.\n\nOnly enable this if you understand the risk."
|
|
10018
|
+
)) { permModeSel.value = prev; return; }
|
|
9977
10019
|
try {
|
|
9978
10020
|
const r = await fetch("/permission-mode", {
|
|
9979
10021
|
method: "POST",
|
|
9980
10022
|
headers: { "content-type": "application/json" },
|
|
9981
|
-
body: JSON.stringify({ mode
|
|
10023
|
+
body: JSON.stringify({ mode }),
|
|
9982
10024
|
});
|
|
9983
10025
|
if (!r.ok) throw new Error("refused");
|
|
9984
|
-
//
|
|
9985
|
-
// affects agents started after this — running ones keep their mode.
|
|
10026
|
+
// Optimistic; the server also echoes the new mode over WS (renderVerMenu).
|
|
10027
|
+
// Only affects agents started after this — running ones keep their mode.
|
|
10028
|
+
renderPermMode(mode);
|
|
9986
10029
|
} catch {
|
|
9987
|
-
|
|
10030
|
+
permModeSel.value = prev; // revert on failure
|
|
9988
10031
|
}
|
|
9989
10032
|
});
|
|
9990
10033
|
ledgerChk.addEventListener("change", async () => {
|
|
@@ -14100,6 +14143,21 @@
|
|
|
14100
14143
|
// only through textContent (facEl): skill titles and cron prompts can be
|
|
14101
14144
|
// written by an agent.
|
|
14102
14145
|
let infoSeq = 0;
|
|
14146
|
+
/** A skill as a chip that opens its card in the Skill Factory. `before` runs
|
|
14147
|
+
* first (the schedule panel closes its overlay so the card is visible). */
|
|
14148
|
+
function skillChip(s, before) {
|
|
14149
|
+
const go = () => { if (before) before(); openSkillCard(s.id); };
|
|
14150
|
+
return facEl("span", { class: "ip-chip", role: "button", tabindex: "0", title: "Open this skill in the Skill Factory to edit it", text: "✦ " + facTitle(s),
|
|
14151
|
+
onclick: go, onkeydown: (e) => { if (e.key === "Enter" || e.key === " ") { e.preventDefault(); go(); } } });
|
|
14152
|
+
}
|
|
14153
|
+
/** Which factory skills an agent's schedules use (src/skill-usage.ts):
|
|
14154
|
+
* `named(cronId)` — the skills that cron's prompt names; `picked` — skills a
|
|
14155
|
+
* scheduled run CALLED without any prompt naming them (no cron in particular). */
|
|
14156
|
+
function cronSkillUse(skills, sid) {
|
|
14157
|
+
const named = (cronId) => skills.filter((s) => (s.cronUsers || []).some((u) => u.sessionId === sid && u.crons.some((c) => c.id === cronId && c.mentions)));
|
|
14158
|
+
const picked = skills.filter((s) => (s.cronUsers || []).some((u) => u.sessionId === sid && u.cronRuns && !u.crons.some((c) => c.mentions)));
|
|
14159
|
+
return { named, picked };
|
|
14160
|
+
}
|
|
14103
14161
|
async function renderInfoPanel() {
|
|
14104
14162
|
const body = $("infoBody");
|
|
14105
14163
|
const t = active;
|
|
@@ -14140,9 +14198,8 @@
|
|
|
14140
14198
|
const list = (Array.isArray(crons) ? crons : []).filter((c) => c.sessionId === sid);
|
|
14141
14199
|
body.appendChild(facEl("h3", {}, ["Schedules", facEl("span", { class: "ip-count", text: String(list.length) })]));
|
|
14142
14200
|
if (!list.length) body.appendChild(facEl("div", { class: "ip-empty", text: "No schedule." }));
|
|
14143
|
-
const named = (
|
|
14144
|
-
const chip = (s) =>
|
|
14145
|
-
onclick: () => openSkillCard(s.id), onkeydown: (e) => { if (e.key === "Enter" || e.key === " ") { e.preventDefault(); openSkillCard(s.id); } } });
|
|
14201
|
+
const { named, picked } = cronSkillUse(skills, sid);
|
|
14202
|
+
const chip = (s) => skillChip(s);
|
|
14146
14203
|
for (const c of list) {
|
|
14147
14204
|
const uses = named(c.id);
|
|
14148
14205
|
body.appendChild(facEl("div", { class: "ip-cron" }, [
|
|
@@ -14154,7 +14211,6 @@
|
|
|
14154
14211
|
}
|
|
14155
14212
|
// Skills a scheduled run CALLED without any prompt naming them: the agent
|
|
14156
14213
|
// picked them itself, so they belong to no cron in particular.
|
|
14157
|
-
const picked = skills.filter((s) => (s.cronUsers || []).some((u) => u.sessionId === sid && u.cronRuns && !u.crons.some((c) => c.mentions)));
|
|
14158
14214
|
if (picked.length) body.appendChild(facEl("div", { style: "margin-top:8px" }, [facEl("span", { class: "ip-k", text: "Also called by scheduled runs:" }), facEl("div", {}, picked.map(chip))]));
|
|
14159
14215
|
body.appendChild(facEl("div", { style: "margin-top:10px" }, [facEl("button", { class: "ip-link", type: "button", text: "Manage schedules…", onclick: () => { $("cronOverlay").hidden = false; renderCrons(); } })]));
|
|
14160
14216
|
}
|
|
@@ -14230,10 +14286,20 @@
|
|
|
14230
14286
|
await showCronTz();
|
|
14231
14287
|
$("cronChanName").textContent = (active && (active.name || (active.sessionId || "").slice(0, 8))) || "no agent";
|
|
14232
14288
|
if (!active || !active.sessionId) { ul.innerHTML = '<li><span style="opacity:.6">Open an agent to schedule prompts.</span></li>'; return; }
|
|
14233
|
-
|
|
14234
|
-
|
|
14235
|
-
|
|
14289
|
+
const sid = active.sessionId;
|
|
14290
|
+
// The skills each schedule uses, so a cron that runs a factory skill links
|
|
14291
|
+
// straight to it (same join as the info panel). Skills failing to load only
|
|
14292
|
+
// costs the chips, never the schedule list.
|
|
14293
|
+
const [all, skills] = await Promise.all([
|
|
14294
|
+
fetch("/crons").then((r) => r.json()).catch(() => []),
|
|
14295
|
+
facCall("GET", "/factory/skills").then((o) => (o && o.skills) || []).catch(() => []),
|
|
14296
|
+
]);
|
|
14297
|
+
if (!active || active.sessionId !== sid) return; // switched agent meanwhile
|
|
14298
|
+
ul.innerHTML = "";
|
|
14299
|
+
const list = (Array.isArray(all) ? all : []).filter((c) => c.sessionId === sid);
|
|
14236
14300
|
if (!list.length) { ul.innerHTML = '<li><span style="opacity:.6">no schedule yet</span></li>'; return; }
|
|
14301
|
+
const { named, picked } = cronSkillUse(skills, sid);
|
|
14302
|
+
const closeCron = () => { $("cronOverlay").hidden = true; };
|
|
14237
14303
|
for (const c of list) {
|
|
14238
14304
|
const li = document.createElement("li"); li.style.display = "block";
|
|
14239
14305
|
const line = document.createElement("div");
|
|
@@ -14263,6 +14329,13 @@
|
|
|
14263
14329
|
p.textContent = c.prompt;
|
|
14264
14330
|
p.style.cssText = "opacity:.75;font-size:12px;margin:3px 0 10px;white-space:pre-wrap";
|
|
14265
14331
|
li.append(line, p);
|
|
14332
|
+
const uses = named(c.id);
|
|
14333
|
+
if (uses.length) li.appendChild(facEl("div", { class: "cron-skills" }, [facEl("span", { style: "opacity:.6", text: "Uses " }), ...uses.map((s) => skillChip(s, closeCron))]));
|
|
14334
|
+
ul.appendChild(li);
|
|
14335
|
+
}
|
|
14336
|
+
if (picked.length) {
|
|
14337
|
+
const li = document.createElement("li"); li.style.display = "block";
|
|
14338
|
+
li.appendChild(facEl("div", { class: "cron-skills", style: "margin:0" }, [facEl("span", { style: "opacity:.6", text: "Also called by scheduled runs: " }), ...picked.map((s) => skillChip(s, closeCron))]));
|
|
14266
14339
|
ul.appendChild(li);
|
|
14267
14340
|
}
|
|
14268
14341
|
}
|
|
@@ -14882,7 +14955,7 @@
|
|
|
14882
14955
|
// the reason, rather than a control that silently snaps back.
|
|
14883
14956
|
function applyAdminOnlyControls(amAdmin) {
|
|
14884
14957
|
const why = amAdmin ? "" : "Admin only";
|
|
14885
|
-
for (const id of ["autoUpdateChk", "updChannelSel", "
|
|
14958
|
+
for (const id of ["autoUpdateChk", "updChannelSel", "permModeSel", "ledgerChk", "restartAllBtn", "reloginBtn"]) {
|
|
14886
14959
|
const el = $(id);
|
|
14887
14960
|
if (!el) continue;
|
|
14888
14961
|
el.disabled = !amAdmin;
|