shadok-ai 0.20.29 → 0.20.31

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
@@ -702,8 +702,9 @@ Enter to skip; you can add it later from the web UI).
702
702
  `autonomous`). Every attempt — published, refused, expired,
703
703
  failed — is written to a **publication log** (who triggered it, who approved
704
704
  it, the text, the post URL or LinkedIn's error), readable by anyone who can
705
- use the account through the row's **Log** button (the last 50 entries). A pending draft counts as "waiting for an answer" like a
706
- dialog (favicon badge, tab blink), and an unapproved draft expires after 7
705
+ use the account through the row's **Log** button (the last 50 entries). A new pending draft flags its agent as "unread" (amber, cleared by
706
+ visiting the channel), never as "waiting for an answer": one nobody decides
707
+ would keep that signal on for good, so the card in the chat is the reminder. An unapproved draft expires after 7
707
708
  days. LinkedIn tokens last about 60 days: seven days before expiry the owner
708
709
  gets a dismissible banner at the top of the cockpit (and again once it has
709
710
  expired) and, when they are the Telegram DM owner, a DM; an expired
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shadok-ai",
3
- "version": "0.20.29",
3
+ "version": "0.20.31",
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
@@ -4928,7 +4928,7 @@
4928
4928
  window.SPAWN_HINT = SPAWN_HINT;
4929
4929
  import { uploadFailure } from "/upload.js?v=__ASSET_V__";
4930
4930
  window.uploadFailure = uploadFailure;
4931
- import { draftCardModel, accountRowModel, hasPendingDraft, autonomousConfirmText, shareChoices, toggleShare, profileChoices, toggleProfile, accountBanners, logEntryLine, googleAutonomousConfirmText, googlePolicyRows, accountBannerKey, GOOGLE_AREA_CHOICES, googleAreaChips } from "/social-card.js?v=__ASSET_V__";
4931
+ import { draftCardModel, accountRowModel, autonomousConfirmText, shareChoices, toggleShare, profileChoices, toggleProfile, accountBanners, logEntryLine, googleAutonomousConfirmText, googlePolicyRows, accountBannerKey, GOOGLE_AREA_CHOICES, googleAreaChips } from "/social-card.js?v=__ASSET_V__";
4932
4932
  window.googleAreaChips = googleAreaChips;
4933
4933
  window.googleAutonomousConfirmText = googleAutonomousConfirmText;
4934
4934
  window.googlePolicyRows = googlePolicyRows;
@@ -4936,7 +4936,6 @@
4936
4936
  window.GOOGLE_AREA_CHOICES = GOOGLE_AREA_CHOICES;
4937
4937
  window.draftCardModel = draftCardModel;
4938
4938
  window.accountRowModel = accountRowModel;
4939
- window.hasPendingDraft = hasPendingDraft;
4940
4939
  window.autonomousConfirmText = autonomousConfirmText;
4941
4940
  window.shareChoices = shareChoices;
4942
4941
  window.toggleShare = toggleShare;
@@ -5298,7 +5297,6 @@
5298
5297
  const text = !google && d && typeof d.text === "string" ? d.text : "";
5299
5298
  return { title, kind: "post", kindLabel: "", fields: [], attachments: [], text, image: null, actions, statusLine: pending ? "" : String((d && d.status) || ""), link: null, pending };
5300
5299
  },
5301
- hasPendingDraft: (drafts) => [...(drafts || [])].some((d) => d && d.status === "pending"),
5302
5300
  // The panel opens on a click, long after the module lands; neutral rows.
5303
5301
  accountRowModel: (a) => ({ provider: (a && a.provider) || "linkedin", label: (a && a.label) || "", via: "", expiryText: "", tone: "ok", shareText: "", policyText: "", areas: [], testNote: "", shareHint: "", disconnectText: "" }),
5304
5302
  // No setting chips until the module lands: a stub must never PUT a guess.
@@ -8006,9 +8004,9 @@
8006
8004
 
8007
8005
  /** Channel highlight: "working" | "needs-answer" | "unread" | null. */
8008
8006
  function setTabMood(tab, mood) {
8009
- // A LinkedIn draft waiting for a person outranks every other mood until it
8010
- // is decided: a turn ending or a dialog being answered must not hide it.
8011
- if (mood !== "needs-answer" && tab.drafts && window.hasPendingDraft(tab.drafts.values())) mood = "needs-answer";
8007
+ // A pending draft card (an email, a LinkedIn post, a Drive upload) raises
8008
+ // NO mood on purpose: a draft nobody decides would keep the cockpit's
8009
+ // "needs an answer" signal lit forever. The card itself is the reminder.
8012
8010
  const wasNeeds = tab.btnEl.classList.contains("needs-answer");
8013
8011
  tab.btnEl.classList.toggle("working", mood === "working");
8014
8012
  tab.btnEl.classList.toggle("needs-answer", mood === "needs-answer");
@@ -9803,7 +9801,6 @@
9803
9801
  tab.transcriptEl.appendChild(turn);
9804
9802
  pinBottom(tab);
9805
9803
  }
9806
- refreshDraftMood(tab);
9807
9804
  }
9808
9805
 
9809
9806
  function paintDraftCard(tab, turn, draft, at) {
@@ -9917,14 +9914,6 @@
9917
9914
  if (!(j && j.draft) && el) el.querySelectorAll(".sd-actions button").forEach((b) => (b.disabled = false));
9918
9915
  }
9919
9916
 
9920
- /** A pending draft keeps the tab on needs-answer; once none is left, the
9921
- * highlight goes — unless a real dialog or a pace bubble still holds it. */
9922
- function refreshDraftMood(tab) {
9923
- const pending = tab.drafts && window.hasPendingDraft(tab.drafts.values());
9924
- if (pending) setTabMood(tab, "needs-answer");
9925
- else if (tab.btnEl.classList.contains("needs-answer") && !tab.pendingChoices && !tab.paceBubble) setTabMood(tab, null);
9926
- }
9927
-
9928
9917
  /** Repaint every draft card (after the ESM bridge lands: stubs drew them). */
9929
9918
  function repaintDraftCards() {
9930
9919
  for (const tab of tabs) {
@@ -9933,7 +9922,6 @@
9933
9922
  const d = tab.drafts.get(id);
9934
9923
  if (d && el.isConnected) paintDraftCard(tab, el, d, d.createdAt);
9935
9924
  }
9936
- refreshDraftMood(tab);
9937
9925
  }
9938
9926
  }
9939
9927
 
@@ -11583,9 +11571,6 @@
11583
11571
  if (h.afterInternal) b.parentElement.classList.add("after-gap");
11584
11572
  }
11585
11573
  }
11586
- // Re-evaluate the draft mood once the replay is in: a draft decided
11587
- // while this tab was away must stop asking for an answer.
11588
- refreshDraftMood(t);
11589
11574
  // Restore the reader's place deterministically — never trust the
11590
11575
  // browser's implicit scroll anchoring for a full teardown.
11591
11576
  el._stickBottom = wasStick;
@@ -11807,11 +11792,20 @@
11807
11792
  }
11808
11793
  if (t === active) updateJumpButton();
11809
11794
  break;
11810
- case "social-draft":
11811
- // A LinkedIn draft appeared or changed state (published, discarded…):
11812
- // its card is updated in place, and the tab's mood follows.
11795
+ case "social-draft": {
11796
+ // A draft card (email, LinkedIn post, Drive upload) appeared or changed
11797
+ // state (published, discarded…): its card is updated in place.
11798
+ // A NEW pending one flags the tab "unread" — the same signal as an answer
11799
+ // landing, cleared by simply visiting the channel. Never "needs-answer":
11800
+ // a draft nobody decides would keep that lit forever. Only on the live
11801
+ // arrival (a replay never re-flags) and never over a real question.
11802
+ const isNew = !!(msg.draft && msg.draft.id) && !(t.drafts && t.drafts.has(msg.draft.id));
11813
11803
  if (msg.draft) renderSocialDraft(t, msg.draft, msg.draft.createdAt);
11804
+ const away = document.hidden || !document.hasFocus();
11805
+ if (isNew && msg.draft.status === "pending" && (t !== active || away)
11806
+ && !t.btnEl.classList.contains("needs-answer")) setTabMood(t, "unread");
11814
11807
  break;
11808
+ }
11815
11809
  case "stream-tool":
11816
11810
  // The suspended message's tool_use is written right AFTER its text
11817
11811
  // blocks: from here on, new text really comes after the question.
@@ -349,11 +349,6 @@ function googleCardModel(d) {
349
349
  };
350
350
  }
351
351
 
352
- /** Does any of these drafts still wait for a person? */
353
- export function hasPendingDraft(drafts) {
354
- return [...(drafts ?? [])].some((d) => d && d.status === "pending");
355
- }
356
-
357
352
  function groupName(groups, id) {
358
353
  const g = (Array.isArray(groups) ? groups : []).find((x) => x && String(x.id) === String(id));
359
354
  return g ? g.name : String(id);