@nomadop/session-watcher-dsh 0.10.0 → 0.10.2

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/dist/client.js CHANGED
@@ -49,7 +49,8 @@ function resultSignalState(result) {
49
49
  return result === null || result.state === "bootstrapping" ? "reading" : result.kind === "unreachable" ? "unreachable" : result.state;
50
50
  }
51
51
  var en = {
52
- "view.label": "Session Watcher",
52
+ // The host's view strip truncates a long tab label, so this one is short; the product name heads the dock as `dock.title`.
53
+ "view.label": "SW Meter",
53
54
  "state.unobserved": "Session Watcher is not observing this session.",
54
55
  "state.bootstrapping": "Session Watcher is reading this session\u2026",
55
56
  "state.failed": "Session Watcher could not measure this session: {message}",
@@ -61,6 +62,7 @@ var en = {
61
62
  "signal.unobserved": "unobserved",
62
63
  "signal.failed": "failed",
63
64
  "signal.unreachable": "unreachable",
65
+ "dock.title": "Session Watcher",
64
66
  "dock.label": "Session Watcher readings",
65
67
  "dock.pill": "Session Watcher: {summary}",
66
68
  "dock.separator": ", ",
@@ -82,10 +84,16 @@ var en = {
82
84
  "dock.stock": "Context stock",
83
85
  "dock.baseline": "Rebuild baseline",
84
86
  "dock.effective": "Effective context",
85
- "dock.growth": "Growth per call"
87
+ "dock.growth": "Growth per call",
88
+ "picker.search": "Search by token or task",
89
+ "picker.empty": "No handoffs available for this project.",
90
+ "picker.noResults": "No handoffs match.",
91
+ "picker.group.undelivered": "Undelivered",
92
+ "picker.group.delivered": "Delivered",
93
+ "picker.noSession": "This session is no longer open."
86
94
  };
87
95
  var zh = {
88
- "view.label": "Session Watcher",
96
+ "view.label": "SW Meter",
89
97
  "state.unobserved": "Session Watcher \u672A\u5728\u89C2\u6D4B\u6B64\u4F1A\u8BDD\u3002",
90
98
  "state.bootstrapping": "Session Watcher \u6B63\u5728\u8BFB\u53D6\u6B64\u4F1A\u8BDD\u2026",
91
99
  "state.failed": "Session Watcher \u65E0\u6CD5\u6D4B\u91CF\u6B64\u4F1A\u8BDD\uFF1A{message}",
@@ -97,6 +105,7 @@ var zh = {
97
105
  "signal.unobserved": "\u672A\u89C2\u6D4B",
98
106
  "signal.failed": "\u5931\u8D25",
99
107
  "signal.unreachable": "\u65E0\u6CD5\u8FDE\u63A5",
108
+ "dock.title": "Session Watcher",
100
109
  "dock.label": "Session Watcher \u8BFB\u6570",
101
110
  "dock.pill": "Session Watcher\uFF1A{summary}",
102
111
  "dock.separator": "\uFF0C",
@@ -117,7 +126,13 @@ var zh = {
117
126
  "dock.stock": "\u4E0A\u4E0B\u6587\u5B58\u91CF",
118
127
  "dock.baseline": "\u91CD\u5EFA\u57FA\u7EBF",
119
128
  "dock.effective": "\u6709\u6548\u4E0A\u4E0B\u6587",
120
- "dock.growth": "\u6BCF\u6B21\u8C03\u7528\u589E\u957F"
129
+ "dock.growth": "\u6BCF\u6B21\u8C03\u7528\u589E\u957F",
130
+ "picker.search": "\u6309 token \u6216\u4EFB\u52A1\u641C\u7D22",
131
+ "picker.empty": "\u5F53\u524D\u9879\u76EE\u6CA1\u6709\u53EF\u7528\u7684 handoff\u3002",
132
+ "picker.noResults": "\u6CA1\u6709\u5339\u914D\u7684 handoff\u3002",
133
+ "picker.group.undelivered": "\u672A\u4EA4\u4ED8",
134
+ "picker.group.delivered": "\u5DF2\u4EA4\u4ED8",
135
+ "picker.noSession": "\u6B64\u4F1A\u8BDD\u5DF2\u4E0D\u518D\u6253\u5F00\u3002"
121
136
  };
122
137
 
123
138
  // dsh/src/client/tab.js
@@ -18584,7 +18599,7 @@ function createDock({ useAnchoredPosition: useAnchoredPosition2, useDismissOnOut
18584
18599
  h3(
18585
18600
  "div",
18586
18601
  { key: "title", className: "sw-title" },
18587
- h3("span", { className: "sw-title-label" }, lamp, t("view.label")),
18602
+ h3("span", { className: "sw-title-label" }, lamp, t("dock.title")),
18588
18603
  h3("span", { className: "sw-title-value", "data-tone": failing ? "error" : void 0 }, rateLamp === null ? word : t(`dock.zone.${status.lamp}`))
18589
18604
  ),
18590
18605
  h3("div", { key: "rule", className: "sw-title-rule" })
@@ -18630,6 +18645,47 @@ function createDock({ useAnchoredPosition: useAnchoredPosition2, useDismissOnOut
18630
18645
  return { Dock, DockView };
18631
18646
  }
18632
18647
 
18648
+ // dsh/src/client/handoff-picker.js
18649
+ var COMMAND = "sw-load";
18650
+ var LIST_ENDPOINT = "handoff/list";
18651
+ var DETAIL_SEPARATOR = " \xB7 ";
18652
+ function registerHandoffPicker(child, { call, t }) {
18653
+ const { commandUi, sessions, conversation } = child;
18654
+ commandUi.decorate({
18655
+ name: COMMAND,
18656
+ available: () => true,
18657
+ ui: {
18658
+ kind: "popupSelect",
18659
+ searchLabels: () => ({ placeholder: t("picker.search"), empty: t("picker.empty"), noResults: t("picker.noResults") }),
18660
+ async options({ sessionId }, signal) {
18661
+ const reply = await call(LIST_ENDPOINT, { sessionId }, signal);
18662
+ if (reply.ok !== true) throw new Error(stateText({ kind: "unreachable", message: reply.error.message }, t));
18663
+ if (reply.value.state !== "live") {
18664
+ throw new Error(stateText({ kind: "state", state: reply.value.state, diagnostic: reply.value.diagnostic }, t));
18665
+ }
18666
+ const groups = {
18667
+ undelivered: { name: "undelivered", label: t("picker.group.undelivered") },
18668
+ delivered: { name: "delivered", label: t("picker.group.delivered") }
18669
+ };
18670
+ return reply.value.payload.items.map(({ loadToken, age, nextTask, deliveredAt }) => ({
18671
+ id: loadToken,
18672
+ label: loadToken,
18673
+ detail: nextTask ? `${age}${DETAIL_SEPARATOR}${nextTask}` : age,
18674
+ group: deliveredAt == null ? groups.undelivered : groups.delivered
18675
+ }));
18676
+ },
18677
+ onSelect(option, { sessionId }) {
18678
+ const actx = sessions.scope(sessionId);
18679
+ if (actx === void 0) throw new Error(t("picker.noSession"));
18680
+ conversation.input.for(actx).setDraft(`/${COMMAND} ${option.id}`);
18681
+ }
18682
+ }
18683
+ });
18684
+ child.effect(() => () => {
18685
+ commandUi.dismiss(COMMAND);
18686
+ }, "session-watcher: /sw-load popup dismissal");
18687
+ }
18688
+
18633
18689
  // dsh/src/client/plugin.js
18634
18690
  var PLUGIN_ID = "@nomadop/session-watcher-dsh";
18635
18691
  var CHANNEL = "/session-watcher";
@@ -18646,9 +18702,8 @@ function applyClient(ctx, { tabCss, useAnchoredPosition: useAnchoredPosition2, u
18646
18702
  tag.remove();
18647
18703
  };
18648
18704
  }, "session-watcher: tab stylesheet");
18649
- const sessions = createSessionStores({
18650
- call: (endpoint, payload, signal) => ctx.connection.rpc.call(CHANNEL, endpoint, payload, signal)
18651
- });
18705
+ const call = (endpoint, payload, signal) => ctx.connection.rpc.call(CHANNEL, endpoint, payload, signal);
18706
+ const sessions = createSessionStores({ call });
18652
18707
  let signalState = "connecting";
18653
18708
  const signalListeners = /* @__PURE__ */ new Set();
18654
18709
  const signalStore = {
@@ -18731,6 +18786,7 @@ function applyClient(ctx, { tabCss, useAnchoredPosition: useAnchoredPosition2, u
18731
18786
  locale: NS,
18732
18787
  inject: (sessionId) => ({ store: sessions.for(sessionId) })
18733
18788
  }, Dock));
18789
+ ctx.inject(["commandUi", "sessions", "conversation"], (child) => registerHandoffPicker(child, { call, t }));
18734
18790
  }
18735
18791
 
18736
18792
  // public/themes/base.css