shadok-ai 0.19.14 → 0.19.16

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
@@ -204,8 +204,8 @@ Enter to skip; you can add it later from the web UI).
204
204
  they can drive).
205
205
  - **Webhooks** — let an outside system (CI, a form, a monitoring tool, Zapier…)
206
206
  wake an agent with an HTTP call, the event-driven twin of a schedule. Create
207
- one in the agent's **⏰ Schedule** popin (name + the prompt to run); you get a
208
- URL and a secret token, shown **once**:
207
+ one in the agent's **⚡ Webhooks** popin (the ⚡ icon in its bar, beside ⏰;
208
+ name + the prompt to run); you get a URL and a secret token, shown **once**:
209
209
 
210
210
  ```bash
211
211
  curl -X POST https://<your-cockpit>/hooks/<id> \
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shadok-ai",
3
- "version": "0.19.14",
3
+ "version": "0.19.16",
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
@@ -2998,11 +2998,11 @@
2998
2998
  #chanBar .gauge .label { display: none; }
2999
2999
  #chanBar .gauge .value { color: var(--text-dim); font-size: 12px; }
3000
3000
  #chanBar .gauge:nth-of-type(3) { display: none; } /* the session id: in the tooltip of the menu */
3001
- #chanBar .chan-actions #chanGallery, #chanBar .chan-actions #chanCron, #chanBar .chan-actions #chanTerm, #chanBar .chan-actions #chanInfo {
3001
+ #chanBar .chan-actions #chanGallery, #chanBar .chan-actions #chanCron, #chanBar .chan-actions #chanWebhooks, #chanBar .chan-actions #chanTerm, #chanBar .chan-actions #chanInfo {
3002
3002
  position: relative; align-self: stretch; display: inline-flex; align-items: center; gap: 6px;
3003
3003
  border: 0; border-radius: 0; background: none; padding: 0 10px; color: var(--text-dim); font-size: 14px;
3004
3004
  }
3005
- #chanBar .chan-actions #chanGallery:hover, #chanBar .chan-actions #chanCron:hover, #chanBar .chan-actions #chanTerm:hover, #chanBar .chan-actions #chanInfo:hover { color: var(--text); background: none; }
3005
+ #chanBar .chan-actions #chanGallery:hover, #chanBar .chan-actions #chanCron:hover, #chanBar .chan-actions #chanWebhooks:hover, #chanBar .chan-actions #chanTerm:hover, #chanBar .chan-actions #chanInfo:hover { color: var(--text); background: none; }
3006
3006
  #chanBar .chan-actions #chanInfo.on { color: var(--amber); }
3007
3007
  #chanBar .chan-actions #chanTerm.on { color: var(--text); font-weight: 600; background: none; border: 0; }
3008
3008
  #chanBar .chan-actions #chanTerm.on::after {
@@ -3317,7 +3317,7 @@
3317
3317
  /* A room's chat has none of an agent's machinery. */
3318
3318
  body.room-active #dirGauge, body.room-active #branchGauge,
3319
3319
  body.room-active #chanBar .gauge:has(#sessionView),
3320
- body.room-active #chanGallery, body.room-active #chanCron, body.room-active #chanInfo,
3320
+ body.room-active #chanGallery, body.room-active #chanCron, body.room-active #chanWebhooks, body.room-active #chanInfo,
3321
3321
  body.room-active #chanTerm, body.room-active #chanUpdate, body.room-active #skillBtn { display: none !important; }
3322
3322
  </style>
3323
3323
  <!-- Light/dark mode is a per-browser choice (localStorage). Set it BEFORE the
@@ -3671,7 +3671,25 @@
3671
3671
  </span>
3672
3672
  </div>
3673
3673
  </form>
3674
- <h3 class="hook-title">⚡ Webhooks</h3>
3674
+ </div>
3675
+ <div class="modal-foot">
3676
+ <span class="foot-note" id="cronTzNote"></span>
3677
+ <span class="foot-note" id="cronErr" style="color:#ff9a9a"></span>
3678
+ <button type="button" id="cronCancelEdit" hidden>Cancel</button>
3679
+ <button type="submit" form="cronAdd" class="primary" id="cronSubmit">Add schedule</button>
3680
+ </div>
3681
+ </div>
3682
+ </div>
3683
+
3684
+ <!-- Webhooks: the event-driven twin of the Schedule popin — an outside HTTP
3685
+ call wakes this agent. Its own entry (⚡ in the header) and its own popin. -->
3686
+ <div id="webhookOverlay" class="overlay" hidden>
3687
+ <div id="webhookPanel" class="sec-panel modal">
3688
+ <div class="sec-head">
3689
+ <strong>⚡ Webhooks — <span class="obj" id="hookChanName">this agent</span></strong>
3690
+ <button id="hookClose" title="Close">✕</button>
3691
+ </div>
3692
+ <div class="modal-body">
3675
3693
  <p class="sec-note">Let an outside system (CI, a form, a monitoring tool…) wake this agent with an HTTP <code>POST</code>. The request body is handed to the agent as untrusted data, after your prompt. Each webhook has its own secret token, shown only once.</p>
3676
3694
  <ul id="hookList"></ul>
3677
3695
  <div id="hookReveal" class="hook-reveal" hidden></div>
@@ -3690,12 +3708,6 @@
3690
3708
  </div>
3691
3709
  </form>
3692
3710
  </div>
3693
- <div class="modal-foot">
3694
- <span class="foot-note" id="cronTzNote"></span>
3695
- <span class="foot-note" id="cronErr" style="color:#ff9a9a"></span>
3696
- <button type="button" id="cronCancelEdit" hidden>Cancel</button>
3697
- <button type="submit" form="cronAdd" class="primary" id="cronSubmit">Add schedule</button>
3698
- </div>
3699
3711
  </div>
3700
3712
  </div>
3701
3713
 
@@ -4330,6 +4342,8 @@
4330
4342
  <button id="chanUpdate" class="icon" title="Claude Code updated — reload this agent to apply it" aria-label="Reload to apply update" hidden>↻ update</button>
4331
4343
  <button id="chanGallery" class="icon" title="Media gallery — every photo and video in this conversation" aria-label="Media gallery"><svg viewBox="0 0 24 24" width="15" height="15" style="vertical-align:-2px" aria-hidden="true"><rect x="3.5" y="5" width="17" height="14" rx="2" fill="none" stroke="currentColor" stroke-width="1.8"/><circle cx="8.5" cy="9.5" r="1.4" fill="currentColor"/><path d="M5 17l4.5-4.5 3 3 2.5-2.5L19 16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/></svg></button>
4332
4344
  <button id="chanCron" class="icon" title="Scheduled prompts for this agent (monitoring / reporting)" aria-label="Schedule"><svg viewBox="0 0 24 24" width="15" height="15" style="vertical-align:-2px" aria-hidden="true"><circle cx="12" cy="13" r="6.3" fill="none" stroke="currentColor" stroke-width="1.8"/><path d="M12 9.8V13l2.2 1.4" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/><path d="M4.8 6.6 7.2 4.6M19.2 6.6 16.8 4.6" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/></svg></button>
4345
+ <!-- Webhooks: wake this agent from outside with an HTTP call (its own popin). -->
4346
+ <button id="chanWebhooks" class="icon" title="Webhooks — wake this agent from outside with an HTTP call" aria-label="Webhooks"><svg viewBox="0 0 24 24" width="15" height="15" style="vertical-align:-2px" aria-hidden="true"><path d="M13 2.5 5.5 13.5H11l-1 8L18.5 10H13z" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linejoin="round"/></svg></button>
4333
4347
  <!-- About this agent: its environment, the skills it uses, its schedules. -->
4334
4348
  <button id="chanInfo" class="icon" title="About this agent — skills it uses, schedules" aria-label="About this agent" aria-pressed="false"><svg viewBox="0 0 24 24" width="15" height="15" style="vertical-align:-2px" aria-hidden="true"><rect x="3.5" y="4" width="17" height="16" rx="2.5" fill="none" stroke="currentColor" stroke-width="1.8"/><path d="M14.5 4v16M17 8.5h0M17 12h0" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/><path d="M6.5 9h5M6.5 12.5h5M6.5 16h3" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/></svg></button>
4335
4349
  <!-- No end-session icon here: "✕ Close agent" lives in the ⋯ menu below. -->
@@ -5869,6 +5883,8 @@
5869
5883
  // Scheduled prompts (crons) for this agent — the panel targets the active
5870
5884
  // channel, so switch to it first (this menu can be opened on any tab).
5871
5885
  if (tab.sessionId) items.push(["⏰ Schedule…", () => { activate(tab); $("cronOverlay").hidden = false; renderCrons(); }]);
5886
+ // Webhooks — the event-driven twin, in its own popin.
5887
+ if (tab.sessionId) items.push(["⚡ Webhooks…", () => { activate(tab); openWebhooks(); }]);
5872
5888
  // The Telegram mirror. The label states the action AND its cost: turning it
5873
5889
  // off deletes the topic, hence the conversation on the phone — so we confirm.
5874
5890
  // The main channel (the General) is the board's home base: not un-mirrorable.
@@ -8203,6 +8219,7 @@
8203
8219
  // Scheduling has no target: better a dimmed button than a popin talking
8204
8220
  // about an agent that does not exist.
8205
8221
  $("chanCron").disabled = true;
8222
+ $("chanWebhooks").disabled = true;
8206
8223
  $("chanGallery").disabled = true;
8207
8224
  $("chanInfo").disabled = true;
8208
8225
  closeGallery(); // no agent → its media grid is stale; don't leave it up
@@ -8227,6 +8244,7 @@
8227
8244
  promptInput.dataset.agentPlaceholder ??= promptInput.placeholder;
8228
8245
  promptInput.placeholder = t.roomId ? "Write a message to the room" : promptInput.dataset.agentPlaceholder;
8229
8246
  $("chanCron").disabled = !t.sessionId;
8247
+ $("chanWebhooks").disabled = !t.sessionId;
8230
8248
  $("chanGallery").disabled = !t.sessionId;
8231
8249
  $("chanInfo").disabled = !t.sessionId;
8232
8250
  paintChanUpdate();
@@ -12200,6 +12218,18 @@
12200
12218
  });
12201
12219
  $("chanUpdate").addEventListener("click", () => { if (active) handleClaudeUpdate(active); });
12202
12220
  $("chanCron").addEventListener("click", () => { $("cronOverlay").hidden = false; renderCrons(); });
12221
+ // Webhooks live in their own popin (⚡ in the header), the event-driven twin of
12222
+ // the Schedule one. Opening it resets the one-shot token reveal and renders.
12223
+ function openWebhooks() {
12224
+ $("webhookOverlay").hidden = false;
12225
+ $("hookChanName").textContent = (active && (active.name || (active.sessionId || "").slice(0, 8))) || "no agent";
12226
+ $("hookErr").textContent = "";
12227
+ $("hookReveal").hidden = true; $("hookReveal").replaceChildren();
12228
+ renderHooks();
12229
+ }
12230
+ $("chanWebhooks").addEventListener("click", openWebhooks);
12231
+ $("hookClose").addEventListener("click", () => { $("webhookOverlay").hidden = true; });
12232
+ $("webhookOverlay").addEventListener("click", (e) => { if (e.target === $("webhookOverlay")) $("webhookOverlay").hidden = true; });
12203
12233
  // Ending an agent lives only in the ⋯ menu ("✕ Close agent") — no bar icon.
12204
12234
  // The per-agent menu, opened from the channel header — the same one a
12205
12235
  // right-click / long-press on a tab shows. stopPropagation so the document
@@ -12449,6 +12479,7 @@
12449
12479
  if (!$("groupCreateOverlay").hidden) { closeGroupCreate(); e.preventDefault(); return; }
12450
12480
  if (!$("setupOverlay").hidden) { closeSetup(); e.preventDefault(); return; }
12451
12481
  if (!$("cronOverlay").hidden) { $("cronOverlay").hidden = true; e.preventDefault(); return; }
12482
+ if (!$("webhookOverlay").hidden) { $("webhookOverlay").hidden = true; e.preventDefault(); return; }
12452
12483
  if (!$("statsOverlay").hidden) { $("statsOverlay").hidden = true; e.preventDefault(); return; }
12453
12484
  if (!$("telegramOverlay").hidden) { $("telegramOverlay").hidden = true; e.preventDefault(); return; }
12454
12485
  // Only a voluntary (dismissable) re-login card; the signed-out funnel ignores Escape.
@@ -14654,8 +14685,6 @@
14654
14685
  const ul = $("cronList"); ul.innerHTML = "";
14655
14686
  await showCronTz();
14656
14687
  $("cronChanName").textContent = (active && (active.name || (active.sessionId || "").slice(0, 8))) || "no agent";
14657
- $("hookReveal").hidden = true; $("hookReveal").replaceChildren();
14658
- renderHooks();
14659
14688
  if (!active || !active.sessionId) { ul.innerHTML = '<li><span style="opacity:.6">Open an agent to schedule prompts.</span></li>'; return; }
14660
14689
  const sid = active.sessionId;
14661
14690
  // The skills each schedule uses, so a cron that runs a factory skill links