shadok-ai 0.19.9 → 0.19.10

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 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shadok-ai",
3
- "version": "0.19.9",
3
+ "version": "0.19.10",
4
4
  "main": "dist/session.js",
5
5
  "scripts": {
6
6
  "test": "node --import tsx --test --test-timeout=120000 test/*.ts context/*/test/*.test.mjs",
package/public/index.html CHANGED
@@ -2189,11 +2189,13 @@
2189
2189
  #infoBody .ip-skill .ip-meta { color: var(--text-dim); font-size: 12px; flex-shrink: 0; }
2190
2190
  #infoBody .ip-cron { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin-top: 6px; background: var(--bg); }
2191
2191
  #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 {
2192
+ #infoBody .ip-chip, #cronList .ip-chip {
2193
2193
  display: inline-block; margin: 6px 6px 0 0; padding: 2px 9px; border-radius: 999px; font-size: 12px; cursor: pointer;
2194
2194
  border: 1px solid color-mix(in srgb, var(--amber) 45%, transparent); background: var(--amber-soft); color: var(--text);
2195
2195
  }
2196
- #infoBody .ip-chip:hover { border-color: var(--amber); }
2196
+ #infoBody .ip-chip:hover, #cronList .ip-chip:hover { border-color: var(--amber); }
2197
+ #cronList .cron-skills { margin: -6px 0 10px; font-size: 12px; }
2198
+ #cronList .cron-skills .ip-chip { margin-top: 4px; }
2197
2199
  #infoBody .ip-empty { color: var(--text-dim); font-size: 12px; font-style: italic; padding: 4px 0; }
2198
2200
  #infoBody .ip-link { background: none; border: 0; padding: 0; color: var(--amber); cursor: pointer; font-size: 12px; }
2199
2201
  .fp-agent-link { background: none; border: 0; padding: 0; color: inherit; font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline dotted; }
@@ -14100,6 +14102,21 @@
14100
14102
  // only through textContent (facEl): skill titles and cron prompts can be
14101
14103
  // written by an agent.
14102
14104
  let infoSeq = 0;
14105
+ /** A skill as a chip that opens its card in the Skill Factory. `before` runs
14106
+ * first (the schedule panel closes its overlay so the card is visible). */
14107
+ function skillChip(s, before) {
14108
+ const go = () => { if (before) before(); openSkillCard(s.id); };
14109
+ return facEl("span", { class: "ip-chip", role: "button", tabindex: "0", title: "Open this skill in the Skill Factory to edit it", text: "✦ " + facTitle(s),
14110
+ onclick: go, onkeydown: (e) => { if (e.key === "Enter" || e.key === " ") { e.preventDefault(); go(); } } });
14111
+ }
14112
+ /** Which factory skills an agent's schedules use (src/skill-usage.ts):
14113
+ * `named(cronId)` — the skills that cron's prompt names; `picked` — skills a
14114
+ * scheduled run CALLED without any prompt naming them (no cron in particular). */
14115
+ function cronSkillUse(skills, sid) {
14116
+ const named = (cronId) => skills.filter((s) => (s.cronUsers || []).some((u) => u.sessionId === sid && u.crons.some((c) => c.id === cronId && c.mentions)));
14117
+ const picked = skills.filter((s) => (s.cronUsers || []).some((u) => u.sessionId === sid && u.cronRuns && !u.crons.some((c) => c.mentions)));
14118
+ return { named, picked };
14119
+ }
14103
14120
  async function renderInfoPanel() {
14104
14121
  const body = $("infoBody");
14105
14122
  const t = active;
@@ -14140,9 +14157,8 @@
14140
14157
  const list = (Array.isArray(crons) ? crons : []).filter((c) => c.sessionId === sid);
14141
14158
  body.appendChild(facEl("h3", {}, ["Schedules", facEl("span", { class: "ip-count", text: String(list.length) })]));
14142
14159
  if (!list.length) body.appendChild(facEl("div", { class: "ip-empty", text: "No schedule." }));
14143
- const named = (cronId) => skills.filter((s) => (s.cronUsers || []).some((u) => u.sessionId === sid && u.crons.some((c) => c.id === cronId && c.mentions)));
14144
- const chip = (s) => facEl("span", { class: "ip-chip", role: "button", tabindex: "0", title: "Open this skill in the Skill Factory", text: "✦ " + facTitle(s),
14145
- onclick: () => openSkillCard(s.id), onkeydown: (e) => { if (e.key === "Enter" || e.key === " ") { e.preventDefault(); openSkillCard(s.id); } } });
14160
+ const { named, picked } = cronSkillUse(skills, sid);
14161
+ const chip = (s) => skillChip(s);
14146
14162
  for (const c of list) {
14147
14163
  const uses = named(c.id);
14148
14164
  body.appendChild(facEl("div", { class: "ip-cron" }, [
@@ -14154,7 +14170,6 @@
14154
14170
  }
14155
14171
  // Skills a scheduled run CALLED without any prompt naming them: the agent
14156
14172
  // 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
14173
  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
14174
  body.appendChild(facEl("div", { style: "margin-top:10px" }, [facEl("button", { class: "ip-link", type: "button", text: "Manage schedules…", onclick: () => { $("cronOverlay").hidden = false; renderCrons(); } })]));
14160
14175
  }
@@ -14230,10 +14245,20 @@
14230
14245
  await showCronTz();
14231
14246
  $("cronChanName").textContent = (active && (active.name || (active.sessionId || "").slice(0, 8))) || "no agent";
14232
14247
  if (!active || !active.sessionId) { ul.innerHTML = '<li><span style="opacity:.6">Open an agent to schedule prompts.</span></li>'; return; }
14233
- let all = [];
14234
- try { all = await (await fetch("/crons")).json(); } catch { all = []; }
14235
- const list = (Array.isArray(all) ? all : []).filter((c) => c.sessionId === active.sessionId);
14248
+ const sid = active.sessionId;
14249
+ // The skills each schedule uses, so a cron that runs a factory skill links
14250
+ // straight to it (same join as the info panel). Skills failing to load only
14251
+ // costs the chips, never the schedule list.
14252
+ const [all, skills] = await Promise.all([
14253
+ fetch("/crons").then((r) => r.json()).catch(() => []),
14254
+ facCall("GET", "/factory/skills").then((o) => (o && o.skills) || []).catch(() => []),
14255
+ ]);
14256
+ if (!active || active.sessionId !== sid) return; // switched agent meanwhile
14257
+ ul.innerHTML = "";
14258
+ const list = (Array.isArray(all) ? all : []).filter((c) => c.sessionId === sid);
14236
14259
  if (!list.length) { ul.innerHTML = '<li><span style="opacity:.6">no schedule yet</span></li>'; return; }
14260
+ const { named, picked } = cronSkillUse(skills, sid);
14261
+ const closeCron = () => { $("cronOverlay").hidden = true; };
14237
14262
  for (const c of list) {
14238
14263
  const li = document.createElement("li"); li.style.display = "block";
14239
14264
  const line = document.createElement("div");
@@ -14263,6 +14288,13 @@
14263
14288
  p.textContent = c.prompt;
14264
14289
  p.style.cssText = "opacity:.75;font-size:12px;margin:3px 0 10px;white-space:pre-wrap";
14265
14290
  li.append(line, p);
14291
+ const uses = named(c.id);
14292
+ if (uses.length) li.appendChild(facEl("div", { class: "cron-skills" }, [facEl("span", { style: "opacity:.6", text: "Uses " }), ...uses.map((s) => skillChip(s, closeCron))]));
14293
+ ul.appendChild(li);
14294
+ }
14295
+ if (picked.length) {
14296
+ const li = document.createElement("li"); li.style.display = "block";
14297
+ 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
14298
  ul.appendChild(li);
14267
14299
  }
14268
14300
  }