shadok-ai 0.19.8 → 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.8",
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; }
@@ -8868,7 +8870,8 @@
8868
8870
  Tool traffic is grouped instead of stacked. A *block* is a run of tool
8869
8871
  events between two pieces of assistant text; inside it, consecutive calls
8870
8872
  to the same tool condense into a *run*; each call hides its own output.
8871
- At turn-done every block folds — except any that saw an error.
8873
+ Every block is born folded (one "N operations" line) and stays that way;
8874
+ the reader expands it on demand.
8872
8875
 
8873
8876
  All fold state lives on `tab.act` (current block) and `tab.turnBlocks`
8874
8877
  (blocks awaiting the end-of-turn fold). */
@@ -8898,10 +8901,13 @@
8898
8901
  function openBlock(tab) {
8899
8902
  const turn = document.createElement("div");
8900
8903
  turn.className = "turn claude activity";
8901
- turn.dataset.folded = "false";
8904
+ // Folded from the start, not only at turn-done: while the agent works the
8905
+ // chat shows "N operations" on one line, and the reader opens it on demand.
8906
+ // An error shows on that line ("· N errors"), and expanding lands on it.
8907
+ turn.dataset.folded = "true";
8902
8908
  const head = document.createElement("button");
8903
8909
  head.className = "act-head";
8904
- head.innerHTML = '<span class="caret">▾</span><span class="count"></span>';
8910
+ head.innerHTML = '<span class="caret">▸</span><span class="count"></span>';
8905
8911
  head.addEventListener("click", () => toggleFold(turn));
8906
8912
  const body = document.createElement("div");
8907
8913
  body.className = "act-body";
@@ -14096,6 +14102,21 @@
14096
14102
  // only through textContent (facEl): skill titles and cron prompts can be
14097
14103
  // written by an agent.
14098
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
+ }
14099
14120
  async function renderInfoPanel() {
14100
14121
  const body = $("infoBody");
14101
14122
  const t = active;
@@ -14136,9 +14157,8 @@
14136
14157
  const list = (Array.isArray(crons) ? crons : []).filter((c) => c.sessionId === sid);
14137
14158
  body.appendChild(facEl("h3", {}, ["Schedules", facEl("span", { class: "ip-count", text: String(list.length) })]));
14138
14159
  if (!list.length) body.appendChild(facEl("div", { class: "ip-empty", text: "No schedule." }));
14139
- const named = (cronId) => skills.filter((s) => (s.cronUsers || []).some((u) => u.sessionId === sid && u.crons.some((c) => c.id === cronId && c.mentions)));
14140
- const chip = (s) => facEl("span", { class: "ip-chip", role: "button", tabindex: "0", title: "Open this skill in the Skill Factory", text: "✦ " + facTitle(s),
14141
- 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);
14142
14162
  for (const c of list) {
14143
14163
  const uses = named(c.id);
14144
14164
  body.appendChild(facEl("div", { class: "ip-cron" }, [
@@ -14150,7 +14170,6 @@
14150
14170
  }
14151
14171
  // Skills a scheduled run CALLED without any prompt naming them: the agent
14152
14172
  // picked them itself, so they belong to no cron in particular.
14153
- const picked = skills.filter((s) => (s.cronUsers || []).some((u) => u.sessionId === sid && u.cronRuns && !u.crons.some((c) => c.mentions)));
14154
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))]));
14155
14174
  body.appendChild(facEl("div", { style: "margin-top:10px" }, [facEl("button", { class: "ip-link", type: "button", text: "Manage schedules…", onclick: () => { $("cronOverlay").hidden = false; renderCrons(); } })]));
14156
14175
  }
@@ -14226,10 +14245,20 @@
14226
14245
  await showCronTz();
14227
14246
  $("cronChanName").textContent = (active && (active.name || (active.sessionId || "").slice(0, 8))) || "no agent";
14228
14247
  if (!active || !active.sessionId) { ul.innerHTML = '<li><span style="opacity:.6">Open an agent to schedule prompts.</span></li>'; return; }
14229
- let all = [];
14230
- try { all = await (await fetch("/crons")).json(); } catch { all = []; }
14231
- 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);
14232
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; };
14233
14262
  for (const c of list) {
14234
14263
  const li = document.createElement("li"); li.style.display = "block";
14235
14264
  const line = document.createElement("div");
@@ -14259,6 +14288,13 @@
14259
14288
  p.textContent = c.prompt;
14260
14289
  p.style.cssText = "opacity:.75;font-size:12px;margin:3px 0 10px;white-space:pre-wrap";
14261
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))]));
14262
14298
  ul.appendChild(li);
14263
14299
  }
14264
14300
  }