@ryuu-64/dsh-find-all 0.1.17 → 0.1.18

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/lib/client.js CHANGED
@@ -3236,13 +3236,15 @@ module.exports = __toCommonJS(client_exports);
3236
3236
  var ENTRY = "find-all";
3237
3237
  var ROW = "@ryuu-64/dsh-find-all#find-all";
3238
3238
  var LOCALE = "dsh-find-all.settings";
3239
- var FIELDS = ["defaultTitleOnly", "defaultIncludeArchived"];
3239
+ var FIELDS = ["defaultTitleOnly", "defaultIncludeArchived", "showSidebarEntry"];
3240
3240
  var en = {
3241
- description: "Defaults for full-text conversation search.",
3241
+ description: "Full-text conversation search settings.",
3242
3242
  defaultTitleOnly: "Search titles only by default",
3243
3243
  defaultTitleOnlyHint: "When off, search matches titles and message text. Either mode can be selected in the search dialog.",
3244
3244
  defaultIncludeArchived: "Include archived conversations by default",
3245
3245
  defaultIncludeArchivedHint: "Archived conversations can appear in results. Unarchive a conversation to open it.",
3246
+ showSidebarEntry: "Show full-text conversation search in the sidebar",
3247
+ showSidebarEntryHint: "When off, open full-text search from the plugin details.",
3246
3248
  overridden: "Overridden",
3247
3249
  reset: "Reset to default",
3248
3250
  unavailable: "Search settings are unavailable.",
@@ -3252,11 +3254,13 @@ var en = {
3252
3254
  saveFailed: "The Host did not confirm the save. Your edits are still here. Reopen this page to reload the saved values."
3253
3255
  };
3254
3256
  var zh = {
3255
- description: "\u5BF9\u8BDD\u5168\u6587\u641C\u7D22\u7684\u9ED8\u8BA4\u9009\u9879\u3002",
3257
+ description: "\u5BF9\u8BDD\u5168\u6587\u641C\u7D22\u8BBE\u7F6E\u3002",
3256
3258
  defaultTitleOnly: "\u9ED8\u8BA4\u4EC5\u641C\u7D22\u6807\u9898",
3257
3259
  defaultTitleOnlyHint: "\u5173\u95ED\u540E\u540C\u65F6\u641C\u7D22\u6807\u9898\u548C\u6B63\u6587\u3002\u6253\u5F00\u641C\u7D22\u7A97\u53E3\u540E\u4E5F\u53EF\u4EE5\u5207\u6362\u3002",
3258
3260
  defaultIncludeArchived: "\u9ED8\u8BA4\u5305\u542B\u5DF2\u5F52\u6863\u5BF9\u8BDD",
3259
3261
  defaultIncludeArchivedHint: "\u8BA9\u5F52\u6863\u5BF9\u8BDD\u51FA\u73B0\u5728\u641C\u7D22\u7ED3\u679C\u4E2D\u3002\u6253\u5F00\u5F52\u6863\u5BF9\u8BDD\u524D\u9700\u5148\u53D6\u6D88\u5F52\u6863\u3002",
3262
+ showSidebarEntry: "\u5728\u4FA7\u680F\u663E\u793A\u5BF9\u8BDD\u5168\u6587\u641C\u7D22",
3263
+ showSidebarEntryHint: "\u5173\u95ED\u540E\uFF0C\u53EF\u4ECE\u63D2\u4EF6\u8BE6\u60C5\u9875\u6253\u5F00\u5BF9\u8BDD\u5168\u6587\u641C\u7D22\u3002",
3260
3264
  overridden: "\u5DF2\u8986\u76D6",
3261
3265
  reset: "\u6062\u590D\u9ED8\u8BA4",
3262
3266
  unavailable: "\u641C\u7D22\u8BBE\u7F6E\u6682\u4E0D\u53EF\u7528\u3002",
@@ -3284,15 +3288,19 @@ function booleanField(field) {
3284
3288
  parse: (text) => ({ kind: "set", value: text === "true" })
3285
3289
  };
3286
3290
  }
3287
- function installConversationSearchSettings(ctx, react, ui) {
3291
+ function installConversationSearchSettings(ctx, react, ui, { onChange, canToggleSidebar }) {
3288
3292
  let source;
3289
3293
  ctx.inject(["configForms", "locale"], (child) => {
3290
3294
  const { configForms, locale } = child;
3291
3295
  if (typeof configForms?.whileServed !== "function" || typeof locale?.register !== "function") return;
3292
3296
  child.effect(() => {
3293
3297
  source = configForms.get(ENTRY);
3298
+ const stop = source.subscribe(onChange);
3299
+ onChange();
3294
3300
  return () => {
3301
+ stop();
3295
3302
  source = void 0;
3303
+ onChange();
3296
3304
  };
3297
3305
  });
3298
3306
  if (!ui.SettingsFormModel || !ui.SettingsForm || !ui.Switch || !ui.Tag) return;
@@ -3309,7 +3317,8 @@ function installConversationSearchSettings(ctx, react, ui) {
3309
3317
  const { shell, fields } = react.useSyncExternalStore(store.subscribe, store.getSnapshot);
3310
3318
  if (view === "summary") return t("description");
3311
3319
  const disabled = !shell.writable || shell.saving;
3312
- const controls = FIELDS.map((field, index) => {
3320
+ const visibleFields = canToggleSidebar() ? FIELDS : FIELDS.filter((field) => field !== "showSidebarEntry");
3321
+ const controls = visibleFields.map((field, index) => {
3313
3322
  const label = t(field);
3314
3323
  const value = fields[field];
3315
3324
  return h(
@@ -3391,6 +3400,7 @@ var L = zh2 ? {
3391
3400
  close: "\u5173\u95ED\u5BF9\u8BDD\u5168\u6587\u641C\u7D22",
3392
3401
  placeholder: "\u641C\u7D22\u6807\u9898\u548C\u6B63\u6587\u2026",
3393
3402
  titlePlaceholder: "\u641C\u7D22\u6807\u9898\u2026",
3403
+ openFromDetails: "\u6253\u5F00\u5BF9\u8BDD\u5168\u6587\u641C\u7D22",
3394
3404
  scope: "\u641C\u7D22\u8303\u56F4\uFF1A\u6240\u6709\u5DE5\u4F5C\u533A",
3395
3405
  scopeDetails: "\u641C\u7D22\u5F53\u524D\u8FDE\u63A5\u670D\u52A1\u4E2D\u3001\u6240\u6709\u5DE5\u4F5C\u533A\u7684\u666E\u901A\u975E\u7A7A\u5BF9\u8BDD\u3002\u4F7F\u7528\u300C\u5305\u542B\u5F52\u6863\u300D\u8C03\u6574\u8303\u56F4\u3002\u641C\u7D22\u4E0D\u5305\u542B\u5B50\u4EE3\u7406\u5BF9\u8BDD\u3002",
3396
3406
  includeArchived: "\u5305\u542B\u5F52\u6863",
@@ -3442,6 +3452,7 @@ var L = zh2 ? {
3442
3452
  close: "Close full-text conversation search",
3443
3453
  placeholder: "Search titles and message text\u2026",
3444
3454
  titlePlaceholder: "Search titles\u2026",
3455
+ openFromDetails: "Open full-text conversation search",
3445
3456
  scope: "Search scope: All workspaces",
3446
3457
  scopeDetails: "Searches ordinary, nonempty conversations across all workspaces on the connected server. Use Include archived to change the scope. Subagent conversations are excluded.",
3447
3458
  includeArchived: "Include archived",
@@ -3544,7 +3555,6 @@ function searchValue(value, requestId, query, scope) {
3544
3555
  }
3545
3556
  function installConversationSearch(ctx, react, ui, bridge) {
3546
3557
  const h = react.createElement;
3547
- const readDefaults = installConversationSearchSettings(ctx, react, ui);
3548
3558
  let services = null, mounted = true, epoch = 0, request = null, timer = 0;
3549
3559
  let scanId = null, mode = "title-body", includeArchived = false;
3550
3560
  let titleOnlyDefault = false, includeArchivedDefault = false;
@@ -3562,6 +3572,15 @@ function installConversationSearch(ctx, react, ui, bridge) {
3562
3572
  revision++;
3563
3573
  for (const listener of listeners) listener();
3564
3574
  };
3575
+ const subscribe = (listener) => {
3576
+ listeners.add(listener);
3577
+ return () => listeners.delete(listener);
3578
+ };
3579
+ const getRevision = () => revision;
3580
+ let hasOverlay = false, hasDetailsAction = false;
3581
+ const canToggleSidebar = () => hasOverlay && hasDetailsAction && !!ui.Modal && !!ui.Input;
3582
+ const readDefaults = installConversationSearchSettings(ctx, react, ui, { onChange: publish, canToggleSidebar });
3583
+ const sidebarHidden = () => canToggleSidebar() && readDefaults()?.showSidebarEntry === false;
3565
3584
  const currentCatalog = () => {
3566
3585
  try {
3567
3586
  return services ? catalog(ctx.sessions, services.workspaces, includeArchived) : { status: "unsupported", rows: [] };
@@ -4054,21 +4073,56 @@ function installConversationSearch(ctx, react, ui, bridge) {
4054
4073
  )
4055
4074
  );
4056
4075
  }
4057
- function Entry(props) {
4058
- react.useSyncExternalStore((listener) => {
4059
- listeners.add(listener);
4060
- return () => listeners.delete(listener);
4061
- }, () => revision);
4076
+ function SidebarEntry(props) {
4077
+ react.useSyncExternalStore(subscribe, getRevision);
4078
+ if (sidebarHidden()) return null;
4062
4079
  const Icon = ui.IconSearchOutlineRegular || ui.IconSearchOutline16;
4063
4080
  return h(
4064
4081
  react.Fragment,
4065
4082
  null,
4066
4083
  h(ui.Button, { type: "button", size: "sm", variant: "ghost", title: notice || L.title, "aria-label": L.title, onClick: () => show(), style: { width: "100%", justifyContent: props.wide ? "flex-start" : "center", gap: 8 } }, Icon ? h(Icon, { size: 16 }) : null, props.wide ? L.title : null),
4067
4084
  notice && !open2 ? h("div", { role: "status", style: { fontSize: 12, padding: 8, overflowWrap: "anywhere" } }, notice) : null,
4068
- open2 && ui.Modal ? h(Panel) : null
4085
+ !hasOverlay && open2 && ui.Modal ? h(Panel) : null
4069
4086
  );
4070
4087
  }
4071
- ctx.slots.inject("sidebar.footer.action", () => ctx.slots.register({ name: "sidebar.footer.action", id: "dsh-find-all-search", order: 10 }, Entry));
4088
+ function SearchOverlay() {
4089
+ react.useSyncExternalStore(subscribe, getRevision);
4090
+ if (open2 && ui.Modal) return h(Panel);
4091
+ if (!notice || !sidebarHidden()) return null;
4092
+ const message = notice;
4093
+ return ui.Toast ? h(ui.Toast, { key: message, text: message, onDone: () => {
4094
+ if (notice === message) {
4095
+ notice = "";
4096
+ publish();
4097
+ }
4098
+ } }) : h("div", { role: "status" }, message);
4099
+ }
4100
+ function DetailsAction({ subject }) {
4101
+ react.useSyncExternalStore(subscribe, getRevision);
4102
+ if (!sidebarHidden() || subject?.kind !== "bundle" || subject.pkg?.name !== "@ryuu-64/dsh-find-all" || !subject.pkg.installed || !subject.pkg.enabled) return null;
4103
+ return h(ui.Button, { type: "button", size: "sm", variant: "outline", onClick: () => show() }, L.openFromDetails);
4104
+ }
4105
+ ctx.slots.inject("shell.overlay", () => {
4106
+ const stop = ctx.slots.register({ name: "shell.overlay", id: "dsh-find-all-search" }, SearchOverlay);
4107
+ hasOverlay = true;
4108
+ publish();
4109
+ return () => {
4110
+ hasOverlay = false;
4111
+ stop();
4112
+ publish();
4113
+ };
4114
+ });
4115
+ ctx.slots.inject("plugins.detail.actions", () => {
4116
+ const stop = ctx.slots.register({ name: "plugins.detail.actions", id: "dsh-find-all-search" }, DetailsAction);
4117
+ hasDetailsAction = true;
4118
+ publish();
4119
+ return () => {
4120
+ hasDetailsAction = false;
4121
+ stop();
4122
+ publish();
4123
+ };
4124
+ });
4125
+ ctx.slots.inject("sidebar.footer.action", () => ctx.slots.register({ name: "sidebar.footer.action", id: "dsh-find-all-search", order: 10 }, SidebarEntry));
4072
4126
  if (typeof ctx.inject === "function") ctx.inject(["uiWorkspace", "workspaces", "layout"], (child) => {
4073
4127
  child.effect(() => {
4074
4128
  if (typeof child.uiWorkspace?.openSession !== "function" || typeof child.layout?.panelInfo?.subscribe !== "function" || typeof child.layout?.panelInfo?.getSnapshot !== "function" || typeof child.workspaces?.list?.subscribe !== "function" || typeof ctx.sessions?.list?.subscribe !== "function") return;
@@ -4429,6 +4483,8 @@ var NON_BODY_EVENTS = /* @__PURE__ */ new Set([
4429
4483
  "hook/invoked",
4430
4484
  "hook/result",
4431
4485
  "image/offload",
4486
+ "job/registered",
4487
+ "job/settled",
4432
4488
  "llm/retry",
4433
4489
  "llm/retry-started",
4434
4490
  "model/selection",
@@ -7527,7 +7583,7 @@ async function copyDiagnostics() {
7527
7583
  feedback.textContent = L2.copyingDiagnostics;
7528
7584
  var copied = false;
7529
7585
  try {
7530
- var summary = { schemaVersion: 1, pluginVersion: "0.1.17", current: diagnosticState(), lastFailure: state.lastFailure };
7586
+ var summary = { schemaVersion: 1, pluginVersion: "0.1.18", current: diagnosticState(), lastFailure: state.lastFailure };
7531
7587
  copied = typeof state.writeClipboard === "function" && await state.writeClipboard(JSON.stringify(summary, null, 2)) === true;
7532
7588
  } catch (error) {
7533
7589
  }
@@ -8880,7 +8936,7 @@ function buildBar() {
8880
8936
  updateCommand.className = "history-command update-command";
8881
8937
  var currentVersion = document.createElement("p");
8882
8938
  currentVersion.className = "update-version";
8883
- currentVersion.textContent = L2.currentVersion + " 0.1.17";
8939
+ currentVersion.textContent = L2.currentVersion + " 0.1.18";
8884
8940
  var openPluginBtn = document.createElement("button");
8885
8941
  openPluginBtn.type = "button";
8886
8942
  openPluginBtn.textContent = L2.openPlugin;
package/lib/index.js CHANGED
@@ -1,23 +1,24 @@
1
- // Optional Host half. Missing RC2 services leave current-conversation find usable.
2
- import z from '@deepseek-ai/schemastery';
3
- import { createSearchHandler, SEARCH_PATH } from './search-host.js';
4
- export const name = 'dsh-find-all';
5
- export const inject = [];
6
- export const Config = z.object({
7
- defaultTitleOnly: z.boolean().default(false).volatile(),
8
- defaultIncludeArchived: z.boolean().default(false).volatile(),
9
- });
10
- export function apply(ctx) {
11
- ctx.inject(['settings'], child => {
12
- if (typeof child.settings?.configure !== 'function') return;
13
- child.effect(() => child.settings.configure({ auto: false }, ctx.fiber));
14
- });
15
- ctx.inject(['connection', 'sessionQuery', 'workspaceRegistry'], child => {
16
- if (typeof child.sessionQuery.observeSession !== 'function' || typeof child.sessionQuery.listSessions !== 'function' || typeof child.sessionQuery.readTitleSnapshot !== 'function' || typeof child.connection.fetch?.register !== 'function') return;
17
- child.effect(() => {
18
- const handler = createSearchHandler(child);
19
- const stop = child.connection.fetch.register({ path: SEARCH_PATH, methods: ['POST'], requestBody: 'buffered', fetch: handler.fetch });
20
- return async () => { handler.dispose(); await stop(); };
21
- });
22
- });
23
- }
1
+ // Optional Host half. Missing RC2 services leave current-conversation find usable.
2
+ import z from '@deepseek-ai/schemastery';
3
+ import { createSearchHandler, SEARCH_PATH } from './search-host.js';
4
+ export const name = 'dsh-find-all';
5
+ export const inject = [];
6
+ export const Config = z.object({
7
+ defaultTitleOnly: z.boolean().default(false).volatile(),
8
+ defaultIncludeArchived: z.boolean().default(false).volatile(),
9
+ showSidebarEntry: z.boolean().default(true).volatile(),
10
+ });
11
+ export function apply(ctx) {
12
+ ctx.inject(['settings'], child => {
13
+ if (typeof child.settings?.configure !== 'function') return;
14
+ child.effect(() => child.settings.configure({ auto: false }, ctx.fiber));
15
+ });
16
+ ctx.inject(['connection', 'sessionQuery', 'workspaceRegistry'], child => {
17
+ if (typeof child.sessionQuery.observeSession !== 'function' || typeof child.sessionQuery.listSessions !== 'function' || typeof child.sessionQuery.readTitleSnapshot !== 'function' || typeof child.connection.fetch?.register !== 'function') return;
18
+ child.effect(() => {
19
+ const handler = createSearchHandler(child);
20
+ const stop = child.connection.fetch.register({ path: SEARCH_PATH, methods: ['POST'], requestBody: 'buffered', fetch: handler.fetch });
21
+ return async () => { handler.dispose(); await stop(); };
22
+ });
23
+ });
24
+ }