@ryuu-64/dsh-find-all 0.1.12 → 0.1.14

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
@@ -32,9 +32,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
32
32
  ));
33
33
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
34
34
 
35
- // ../find-all-cross-conversation-20261011/node_modules/semver/internal/debug.js
35
+ // node_modules/semver/internal/debug.js
36
36
  var require_debug = __commonJS({
37
- "../find-all-cross-conversation-20261011/node_modules/semver/internal/debug.js"(exports, module2) {
37
+ "node_modules/semver/internal/debug.js"(exports, module2) {
38
38
  "use strict";
39
39
  var debug = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {
40
40
  };
@@ -42,9 +42,9 @@ var require_debug = __commonJS({
42
42
  }
43
43
  });
44
44
 
45
- // ../find-all-cross-conversation-20261011/node_modules/semver/internal/constants.js
45
+ // node_modules/semver/internal/constants.js
46
46
  var require_constants = __commonJS({
47
- "../find-all-cross-conversation-20261011/node_modules/semver/internal/constants.js"(exports, module2) {
47
+ "node_modules/semver/internal/constants.js"(exports, module2) {
48
48
  "use strict";
49
49
  var SEMVER_SPEC_VERSION = "2.0.0";
50
50
  var MAX_LENGTH = 256;
@@ -74,9 +74,9 @@ var require_constants = __commonJS({
74
74
  }
75
75
  });
76
76
 
77
- // ../find-all-cross-conversation-20261011/node_modules/semver/internal/re.js
77
+ // node_modules/semver/internal/re.js
78
78
  var require_re = __commonJS({
79
- "../find-all-cross-conversation-20261011/node_modules/semver/internal/re.js"(exports, module2) {
79
+ "node_modules/semver/internal/re.js"(exports, module2) {
80
80
  "use strict";
81
81
  var {
82
82
  MAX_SAFE_COMPONENT_LENGTH,
@@ -162,9 +162,9 @@ var require_re = __commonJS({
162
162
  }
163
163
  });
164
164
 
165
- // ../find-all-cross-conversation-20261011/node_modules/semver/internal/parse-options.js
165
+ // node_modules/semver/internal/parse-options.js
166
166
  var require_parse_options = __commonJS({
167
- "../find-all-cross-conversation-20261011/node_modules/semver/internal/parse-options.js"(exports, module2) {
167
+ "node_modules/semver/internal/parse-options.js"(exports, module2) {
168
168
  "use strict";
169
169
  var looseOption = Object.freeze({ loose: true });
170
170
  var emptyOpts = Object.freeze({});
@@ -181,9 +181,9 @@ var require_parse_options = __commonJS({
181
181
  }
182
182
  });
183
183
 
184
- // ../find-all-cross-conversation-20261011/node_modules/semver/internal/identifiers.js
184
+ // node_modules/semver/internal/identifiers.js
185
185
  var require_identifiers = __commonJS({
186
- "../find-all-cross-conversation-20261011/node_modules/semver/internal/identifiers.js"(exports, module2) {
186
+ "node_modules/semver/internal/identifiers.js"(exports, module2) {
187
187
  "use strict";
188
188
  var numeric = /^[0-9]+$/;
189
189
  var compareIdentifiers = (a, b) => {
@@ -206,9 +206,9 @@ var require_identifiers = __commonJS({
206
206
  }
207
207
  });
208
208
 
209
- // ../find-all-cross-conversation-20261011/node_modules/semver/classes/semver.js
209
+ // node_modules/semver/classes/semver.js
210
210
  var require_semver = __commonJS({
211
- "../find-all-cross-conversation-20261011/node_modules/semver/classes/semver.js"(exports, module2) {
211
+ "node_modules/semver/classes/semver.js"(exports, module2) {
212
212
  "use strict";
213
213
  var debug = require_debug();
214
214
  var { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants();
@@ -498,9 +498,9 @@ var require_semver = __commonJS({
498
498
  }
499
499
  });
500
500
 
501
- // ../find-all-cross-conversation-20261011/node_modules/react-dom/cjs/react-dom-server-legacy.browser.production.min.js
501
+ // node_modules/react-dom/cjs/react-dom-server-legacy.browser.production.min.js
502
502
  var require_react_dom_server_legacy_browser_production_min = __commonJS({
503
- "../find-all-cross-conversation-20261011/node_modules/react-dom/cjs/react-dom-server-legacy.browser.production.min.js"(exports) {
503
+ "node_modules/react-dom/cjs/react-dom-server-legacy.browser.production.min.js"(exports) {
504
504
  "use strict";
505
505
  /**
506
506
  * @license React
@@ -2036,9 +2036,9 @@ var require_react_dom_server_legacy_browser_production_min = __commonJS({
2036
2036
  }
2037
2037
  });
2038
2038
 
2039
- // ../find-all-cross-conversation-20261011/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js
2039
+ // node_modules/react-dom/cjs/react-dom-server.browser.production.min.js
2040
2040
  var require_react_dom_server_browser_production_min = __commonJS({
2041
- "../find-all-cross-conversation-20261011/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js"(exports) {
2041
+ "node_modules/react-dom/cjs/react-dom-server.browser.production.min.js"(exports) {
2042
2042
  "use strict";
2043
2043
  /**
2044
2044
  * @license React
@@ -3671,9 +3671,9 @@ var require_react_dom_server_browser_production_min = __commonJS({
3671
3671
  }
3672
3672
  });
3673
3673
 
3674
- // ../find-all-cross-conversation-20261011/node_modules/react-dom/server.browser.js
3674
+ // node_modules/react-dom/server.browser.js
3675
3675
  var require_server_browser = __commonJS({
3676
- "../find-all-cross-conversation-20261011/node_modules/react-dom/server.browser.js"(exports) {
3676
+ "node_modules/react-dom/server.browser.js"(exports) {
3677
3677
  "use strict";
3678
3678
  var l;
3679
3679
  var s;
@@ -4221,7 +4221,7 @@ function installConversationSearch(ctx, react, ui, bridge) {
4221
4221
  const pending = data.status === "ready" && body === "pending";
4222
4222
  const empty = data.status === "ready" && query.trim() && body === "ready" && content.complete && !content.failed && !content.skipped && results.items.length === 0;
4223
4223
  const progress = content.scanned > 0 || content.total > 0 ? L.progress(content.scanned, content.total) : "";
4224
- const partial = content.failed || content.skipped ? L.partial(content.failed, content.skipped) : "";
4224
+ const partial2 = content.failed || content.skipped ? L.partial(content.failed, content.skipped) : "";
4225
4225
  const count = L.shown(results.items.length);
4226
4226
  const ready = data.status === "ready" && body === "ready";
4227
4227
  let announcement = "";
@@ -4229,12 +4229,12 @@ function installConversationSearch(ctx, react, ui, bridge) {
4229
4229
  else if (restoreFeedback) announcement = restoreFeedback.text;
4230
4230
  else if (notice) announcement = notice;
4231
4231
  else if (data.status === "ready" && body === "invalid") announcement = L.invalid;
4232
- else if (pending) announcement = [progress || L.pending, partial].filter(Boolean).join(" \xB7 ");
4233
- else if (ready && content.complete && !partial) announcement = count;
4234
- else if (ready && content.cursor) announcement = [L.page(results.items.length), partial].filter(Boolean).join(" \xB7 ");
4235
- else if (ready || body === "stopped" || body === "unavailable") announcement = [status || count, progress, partial].filter(Boolean).join(" \xB7 ");
4232
+ else if (pending) announcement = [progress || L.pending, partial2].filter(Boolean).join(" \xB7 ");
4233
+ else if (ready && content.complete && !partial2) announcement = count;
4234
+ else if (ready && content.cursor) announcement = [L.page(results.items.length), partial2].filter(Boolean).join(" \xB7 ");
4235
+ else if (ready || body === "stopped" || body === "unavailable") announcement = [status || count, progress, partial2].filter(Boolean).join(" \xB7 ");
4236
4236
  else if (data.status !== "ready") announcement = status;
4237
- const emptyStatus = body === "invalid" && data.status === "ready" ? L.invalidShort : empty ? L.noMatches : body === "unavailable" && data.status === "ready" ? L.unavailableShort : body === "stopped" && data.status === "ready" ? L.stoppedShort : status || (partial ? L.partialShort : ready && content.cursor ? L.noMatchesYet : "");
4237
+ const emptyStatus = body === "invalid" && data.status === "ready" ? L.invalidShort : empty ? L.noMatches : body === "unavailable" && data.status === "ready" ? L.unavailableShort : body === "stopped" && data.status === "ready" ? L.stoppedShort : status || (partial2 ? L.partialShort : ready && content.cursor ? L.noMatchesYet : "");
4238
4238
  const requestClose = () => {
4239
4239
  const dialog = details.current?.closest('[role="dialog"]');
4240
4240
  if (dialog && Array.from(document.querySelectorAll('[role="dialog"][aria-modal="true"],[role="menu"]')).pop() === dialog) dismiss();
@@ -4485,6 +4485,62 @@ async function checkLatestVersion(currentVersion, signal) {
4485
4485
  }
4486
4486
  }
4487
4487
 
4488
+ // src/history-revision.js
4489
+ var MESSAGE_KINDS = /* @__PURE__ */ new Set(["user", "steering", "context", "turn-trigger"]);
4490
+ var sequence = (value, minimum = 0) => Number.isSafeInteger(value) && value >= minimum && !Object.is(value, -0);
4491
+ function durable(node) {
4492
+ if (typeof node?.key !== "string" || !node.data || typeof node.data !== "object") return void 0;
4493
+ const data = node.data;
4494
+ if (MESSAGE_KINDS.has(node.kind) && sequence(data.seq)) return { seq: data.seq, value: data };
4495
+ if (node.kind === "assistant-step" && data.finalNode && sequence(data.finalNode.seq)) {
4496
+ return { seq: data.finalNode.seq, value: { finalNode: data.finalNode, blocks: data.blocks } };
4497
+ }
4498
+ return void 0;
4499
+ }
4500
+ function createHistoryRevisionTracker(store) {
4501
+ const baseline = /* @__PURE__ */ new Map(), latest = /* @__PURE__ */ new Map();
4502
+ let changed = false;
4503
+ function capture(node, description) {
4504
+ const previous = latest.get(node.key);
4505
+ const signature = previous?.data === node.data ? previous.signature : JSON.stringify(description.value);
4506
+ if (typeof signature !== "string") throw new Error("Durable Chat data could not be compared");
4507
+ const record3 = { data: node.data, kind: node.kind, seq: description.seq, signature };
4508
+ latest.set(node.key, record3);
4509
+ return record3;
4510
+ }
4511
+ try {
4512
+ if (typeof store?.values !== "function") changed = true;
4513
+ else for (const node of store.values()) {
4514
+ const description = durable(node);
4515
+ if (description) baseline.set(node.key, capture(node, description));
4516
+ }
4517
+ } catch {
4518
+ changed = true;
4519
+ }
4520
+ return {
4521
+ check(currentStore, snapshot) {
4522
+ if (changed) return true;
4523
+ if (currentStore !== store) return changed = true;
4524
+ const throughSeq = snapshot?.throughSeq;
4525
+ const hasCut = sequence(throughSeq, -1);
4526
+ try {
4527
+ for (const node of currentStore.values()) {
4528
+ const description = durable(node);
4529
+ if (!description) continue;
4530
+ if (hasCut && description.seq > throughSeq) return changed = true;
4531
+ const old = baseline.get(node.key);
4532
+ const current = capture(node, description);
4533
+ if (old && (old.kind !== current.kind || old.seq !== current.seq || old.signature !== current.signature)) return changed = true;
4534
+ if (!old) baseline.set(node.key, current);
4535
+ }
4536
+ } catch {
4537
+ changed = true;
4538
+ }
4539
+ return changed;
4540
+ }
4541
+ };
4542
+ }
4543
+
4488
4544
  // src/context.js
4489
4545
  var MAX_CHARS = 2e4;
4490
4546
  var MAX_ENTRIES = 200;
@@ -4712,7 +4768,7 @@ function createContextClassifier() {
4712
4768
 
4713
4769
  // src/history.js
4714
4770
  var TEXT_TYPES = /* @__PURE__ */ new Set(["text", "reasoning"]);
4715
- var BOUNDARIES = /* @__PURE__ */ new Set(["assistant/message", "tool/call", "tool/result", "llm/retry", "turn/end"]);
4771
+ var BOUNDARIES = /* @__PURE__ */ new Set(["assistant/message", "tool/call", "tool/result", "llm/retry", "turn/end", "turn/start"]);
4716
4772
  var NON_BODY_EVENTS = /* @__PURE__ */ new Set([
4717
4773
  "agent-preset/selected",
4718
4774
  "agent/inbox/spliced",
@@ -4851,16 +4907,16 @@ function assembleAttemptText(stream, seq) {
4851
4907
  requireString(chunk.blockType, "blockType", seq);
4852
4908
  ensure(chunk.index, chunk.blockType);
4853
4909
  } else if (chunk.type === "text-delta" || chunk.type === "reasoning-delta") {
4854
- const partial = ensure(chunk.index, chunk.type === "text-delta" ? "text" : "reasoning");
4910
+ const partial2 = ensure(chunk.index, chunk.type === "text-delta" ? "text" : "reasoning");
4855
4911
  const text = requireString(chunk.text, "Assistant delta", seq);
4856
- if (!partial.closed) partial.fragments.push(text);
4912
+ if (!partial2.closed) partial2.fragments.push(text);
4857
4913
  } else if (chunk.type === "block-end") {
4858
4914
  if (!object(chunk.block) || typeof chunk.block.type !== "string") throw failure("invalid-stream", "Assistant block end is invalid", seq);
4859
- const partial = ensure(chunk.index, chunk.block.type);
4860
- if (!partial.closed) {
4861
- partial.type = chunk.block.type;
4862
- partial.fragments = TEXT_TYPES.has(chunk.block.type) ? [requireString(chunk.block.text, "Assistant block", seq)] : [];
4863
- partial.closed = true;
4915
+ const partial2 = ensure(chunk.index, chunk.block.type);
4916
+ if (!partial2.closed) {
4917
+ partial2.type = chunk.block.type;
4918
+ partial2.fragments = TEXT_TYPES.has(chunk.block.type) ? [requireString(chunk.block.text, "Assistant block", seq)] : [];
4919
+ partial2.closed = true;
4864
4920
  }
4865
4921
  } else if (chunk.type === "tool-call-delta") {
4866
4922
  ensure(chunk.index, "tool-call");
@@ -4891,14 +4947,14 @@ function assembleAttemptText(stream, seq) {
4891
4947
  ensure(record3.index, "tool-call");
4892
4948
  if (typeof record3.id !== "string" || !record3.id || record3.name !== void 0 && (typeof record3.name !== "string" || !record3.name)) throw failure("invalid-stream", "Assistant tool stream identity is invalid", seq);
4893
4949
  } else {
4894
- const partial = ensure(record3.index, record3.type === "text-chunks" ? "text" : "reasoning");
4895
- if (!partial.closed) for (const text of members) partial.fragments.push(text);
4950
+ const partial2 = ensure(record3.index, record3.type === "text-chunks" ? "text" : "reasoning");
4951
+ if (!partial2.closed) for (const text of members) partial2.fragments.push(text);
4896
4952
  }
4897
4953
  }
4898
- return [...partials.values()].filter((partial) => TEXT_TYPES.has(partial.type)).map((partial) => ({
4899
- type: partial.type,
4900
- text: partial.fragments.join(""),
4901
- streamIndex: partial.index
4954
+ return [...partials.values()].filter((partial2) => TEXT_TYPES.has(partial2.type)).map((partial2) => ({
4955
+ type: partial2.type,
4956
+ text: partial2.fragments.join(""),
4957
+ streamIndex: partial2.index
4902
4958
  }));
4903
4959
  }
4904
4960
  function extractEntry(event, sessionId, report) {
@@ -4966,6 +5022,8 @@ function extractEntry(event, sessionId, report) {
4966
5022
  const sourceKind = typeof origin.kind === "string" ? origin.kind : "unknown";
4967
5023
  entry.sourceKind = sourceKind;
4968
5024
  entry.referenceLabels = sourceKind === "session-reference" && Array.isArray(origin.references) ? [...new Set(origin.references.filter((ref) => object(ref) && typeof ref.label === "string" && ref.label).map((ref) => ref.label))] : [];
5025
+ entry.referenceFactsInvalid = sourceKind === "session-reference" && (!Array.isArray(origin.references) || origin.references.some((ref) => !object(ref) || typeof ref.label !== "string" || !ref.label));
5026
+ entry.skillFactsInvalid = sourceKind === "skill-invocation" && (typeof origin.name !== "string" || !origin.name);
4969
5027
  entry.skillName = sourceKind === "skill-invocation" && typeof origin.name === "string" ? origin.name : void 0;
4970
5028
  if (type === "user/message" && sourceKind === "user") {
4971
5029
  checkParts(content, /* @__PURE__ */ new Set(["text"]));
@@ -4979,7 +5037,8 @@ function extractEntry(event, sessionId, report) {
4979
5037
  format: "plain",
4980
5038
  referenceLabels: [],
4981
5039
  skillNames: [],
4982
- contentCount: content.length
5040
+ contentCount: content.length,
5041
+ contextErrors: content.some((part) => part?.type !== "text") ? [{ code: "user-attachment-unprojected", message: "User attachment or extra content is not projected" }] : []
4983
5042
  });
4984
5043
  } else {
4985
5044
  entry.contextVisible = content.some((part) => part?.type === "tool-addition" || part?.type === "tool-removal");
@@ -5177,11 +5236,16 @@ function resolveSources(entries, report) {
5177
5236
  const classifier = createContextClassifier();
5178
5237
  let batchMessages = [];
5179
5238
  let batchSkills = [];
5239
+ let invalidBatchSkills = false;
5180
5240
  const flush = () => {
5181
5241
  const names = [...new Set(batchSkills)];
5182
- for (const source of batchMessages) source.skillNames = names;
5242
+ for (const source of batchMessages) {
5243
+ source.skillNames = names;
5244
+ if (invalidBatchSkills) source.invalidUserFacts = true;
5245
+ }
5183
5246
  batchMessages = [];
5184
5247
  batchSkills = [];
5248
+ invalidBatchSkills = false;
5185
5249
  };
5186
5250
  for (const entry of entries) {
5187
5251
  classifier.accept(entry);
@@ -5208,16 +5272,21 @@ function resolveSources(entries, report) {
5208
5272
  bySeq.set(source.seq, source);
5209
5273
  }
5210
5274
  } else {
5211
- if (entry.referenceLabels?.length) {
5275
+ if (entry.referenceLabels?.length || entry.referenceFactsInvalid) {
5212
5276
  const previous = bySeq.get(entry.seq - 1);
5213
- if (previous) previous.referenceLabels = entry.referenceLabels;
5277
+ if (previous) {
5278
+ previous.referenceLabels = entry.referenceLabels;
5279
+ if (entry.referenceFactsInvalid) previous.invalidUserFacts = true;
5280
+ }
5214
5281
  }
5215
5282
  if (entry.skillName) batchSkills.push(entry.skillName);
5283
+ if (entry.skillFactsInvalid) invalidBatchSkills = true;
5216
5284
  }
5217
5285
  } else if (BOUNDARIES.has(entry.type)) flush();
5218
5286
  }
5219
5287
  flush();
5220
5288
  for (const source of sources) {
5289
+ if (source.kind === "user") source.userTextFacts = source.invalidUserFacts ? null : { sessionLabels: [...source.referenceLabels], skillNames: [...source.skillNames] };
5221
5290
  if (source.kind !== "tool-result") continue;
5222
5291
  const call = calls.get(source.callId);
5223
5292
  if (!call) {
@@ -5325,7 +5394,7 @@ function createHistoryReader({ remote, sessionId, generation = 0, onUpdate, proj
5325
5394
  const entries2 = [];
5326
5395
  for (let index = 0; index < page.records.length; index += 1) {
5327
5396
  assertCurrent();
5328
- const entry = extractEntry(page.records[index].event, sessionId, (issue) => coverageErrors.push(issue));
5397
+ const entry = extractEntry(page.records[index].event, sessionId, (issue2) => coverageErrors.push(issue2));
5329
5398
  if (entry) entries2.push(entry);
5330
5399
  if ((index + 1) % 64 === 0) await tick();
5331
5400
  }
@@ -5341,17 +5410,17 @@ function createHistoryReader({ remote, sessionId, generation = 0, onUpdate, proj
5341
5410
  expectedEnd = proof.first - 1;
5342
5411
  const beforeSeq = proof.first;
5343
5412
  page = void 0;
5344
- const result = await pending(remote.session.page({ address, throughSeq, beforeSeq, maxMessages }, controller.signal));
5413
+ const result2 = await pending(remote.session.page({ address, throughSeq, beforeSeq, maxMessages }, controller.signal));
5345
5414
  assertCurrent();
5346
- if (result?.ok !== true) throw failure(typeof result?.error?.code === "string" ? result.error.code : "page-rpc-failed", typeof result?.error?.message === "string" ? result.error.message : "History page RPC failed");
5347
- page = result.value;
5415
+ if (result2?.ok !== true) throw failure(typeof result2?.error?.code === "string" ? result2.error.code : "page-rpc-failed", typeof result2?.error?.message === "string" ? result2.error.message : "History page RPC failed");
5416
+ page = result2.value;
5348
5417
  }
5349
5418
  assertCurrent();
5350
5419
  page = void 0;
5351
5420
  publish({ readComplete: true, coverageComplete: true, status: "projecting" });
5352
5421
  const entries = pageEntries.reverse().flat();
5353
5422
  pageEntries.length = 0;
5354
- const sources = resolveSources(entries, (issue) => coverageErrors.push(issue));
5423
+ const sources = resolveSources(entries, (issue2) => coverageErrors.push(issue2));
5355
5424
  entries.length = 0;
5356
5425
  const documents = [];
5357
5426
  const errors = coverageErrors;
@@ -5359,25 +5428,34 @@ function createHistoryReader({ remote, sessionId, generation = 0, onUpdate, proj
5359
5428
  assertCurrent();
5360
5429
  const source = sources[index];
5361
5430
  if (sessionCwd !== void 0) source.sessionCwd = sessionCwd;
5362
- const projection = await pending(project(source));
5431
+ let projection;
5432
+ try {
5433
+ projection = await pending(project(source));
5434
+ } catch (error) {
5435
+ assertCurrent();
5436
+ projection = { blocks: [], errors: [{ code: "projection-failed", message: "The display projection failed for this source" }] };
5437
+ }
5363
5438
  assertCurrent();
5364
- if (!object(projection) || !Array.isArray(projection.blocks) || projection.blocks.some((block) => !object(block) || typeof block.text !== "string")) throw failure("invalid-projection", "Text projection returned invalid blocks", source.seq);
5365
- const projectedSource = projection.source === void 0 ? source : projection.source;
5366
- if (!object(projectedSource) || ["sessionId", "seq", "id", "kind", "contentIndex"].some((key) => projectedSource[key] !== source[key])) {
5367
- throw failure("invalid-projection", "Text projection changed durable source identity", source.seq);
5439
+ if (!object(projection) || !Array.isArray(projection.blocks) || projection.blocks.some((block) => !object(block) || typeof block.text !== "string")) projection = { blocks: [], errors: [{ code: "invalid-projection", message: "Text projection returned invalid blocks" }] };
5440
+ let projectedSource = projection.source === void 0 ? source : projection.source;
5441
+ if (!object(projectedSource) || ["sessionId", "seq", "id", "kind", "contentIndex", "messageId", "turn", "step", "stepId"].some((key) => projectedSource[key] !== source[key])) {
5442
+ projectedSource = source;
5443
+ projection = { blocks: [], errors: [{ code: "invalid-projection", message: "Text projection changed durable source identity" }] };
5368
5444
  }
5369
5445
  const localErrors = [...source.contextErrors ?? [], ...Array.isArray(projection.errors) ? projection.errors : []];
5370
5446
  const seenErrors = /* @__PURE__ */ new Set();
5371
5447
  for (const error of localErrors) {
5372
- const issue = errorRecord(error, "projection-incomplete");
5373
- const key = issue.code + "\0" + issue.message;
5374
- if (!seenErrors.has(key)) errors.push({ ...issue, seq: source.seq, textKind: source.kind, ...source.sourceKind === void 0 ? {} : { messageSourceKind: source.sourceKind } });
5448
+ const issue2 = errorRecord(error, "projection-incomplete");
5449
+ const key = issue2.code + "\0" + issue2.message;
5450
+ if (!seenErrors.has(key)) errors.push({ ...issue2, seq: source.seq, textKind: source.kind, ...source.sourceKind === void 0 ? {} : { messageSourceKind: source.sourceKind } });
5375
5451
  seenErrors.add(key);
5376
5452
  }
5377
5453
  documents.push({
5378
5454
  ...projectedSource,
5379
5455
  blocks: projection.blocks,
5380
5456
  ...typeof projection.mapping === "string" ? { mapping: projection.mapping } : {},
5457
+ ...projection.defaultMasked === true ? { defaultMasked: true } : {},
5458
+ ...projection.userTextSemantics === "official-inline" ? { userTextSemantics: "official-inline" } : {},
5381
5459
  ...typeof projection.rootClass === "string" ? { rootClass: projection.rootClass } : {},
5382
5460
  ...typeof projection.cardKind === "string" ? { cardKind: projection.cardKind } : {}
5383
5461
  });
@@ -5510,7 +5588,7 @@ function toolPresentation(source) {
5510
5588
  var BLOCK = new Set("ADDRESS ARTICLE ASIDE BLOCKQUOTE DD DETAILS DIALOG DIV DL DT FIELDSET FIGCAPTION FIGURE FOOTER FORM H1 H2 H3 H4 H5 H6 HEADER HR LI MAIN NAV OL P PRE SECTION SUMMARY TABLE TBODY TD TFOOT TH THEAD TR UL".split(" "));
5511
5589
  var imageAltClasses = /* @__PURE__ */ new Set();
5512
5590
  var SKIP = "script,style,noscript,svg,[data-code-block-banner],[data-clock],.sr-only,.katex-mathml,[data-find-projection-chrome]";
5513
- function collectProjectedBlocks(root, excluded, classify) {
5591
+ function collectProjectedBlocks(root, excluded, classify, options) {
5514
5592
  const blocks = [];
5515
5593
  let text = "", segments = [];
5516
5594
  const flush = () => {
@@ -5549,6 +5627,7 @@ function collectProjectedBlocks(root, excluded, classify) {
5549
5627
  if (description) blocks.push({ text: description, segments: [], imageDescription: true });
5550
5628
  return;
5551
5629
  }
5630
+ if (options?.officialUserInline && node.nodeType === 1 && node.matches('svg[aria-hidden="true"]') && node.closest("[data-ref-chip],[data-secret]")) return;
5552
5631
  if (node.nodeType === 1 && (node.matches(SKIP) || node.tagName === "BR")) {
5553
5632
  flush();
5554
5633
  return;
@@ -5630,8 +5709,8 @@ function semanticSubstring(block, text) {
5630
5709
  }));
5631
5710
  return segments.length ? { text, segments } : null;
5632
5711
  }
5633
- function createProjector(ui, react, document2) {
5634
- if (!ui.MarkdownText || typeof ui.projectUserText !== "function" || !/^18\./u.test(react.version || "")) throw Error("Host text projection unavailable");
5712
+ function createProjector(ui, react, document2, projectUser) {
5713
+ if (!ui.MarkdownText || !/^18\./u.test(react.version || "")) throw Error("Host Markdown projection unavailable");
5635
5714
  const { renderToStaticMarkup } = require_server_browser();
5636
5715
  function render(element) {
5637
5716
  const template = document2.createElement("template");
@@ -5718,6 +5797,8 @@ function createProjector(ui, react, document2) {
5718
5797
  return { blocks, mapping: "markdown", rootClass: root.classList[0], errors: [] };
5719
5798
  }
5720
5799
  if (source.kind === "user" && source.sourceKind === "user") {
5800
+ if (typeof projectUser === "function") return projectUser(source);
5801
+ if (typeof ui.projectUserText !== "function") return { blocks: [], mapping: "user", errors: [{ code: "user-projection-unavailable", message: "Host user-text projection is unavailable; user text was not indexed" }] };
5721
5802
  const fragment = render(react.createElement("div", null, ui.projectUserText(source.raw, source.referenceLabels || [], source.skillNames || [], "skill")));
5722
5803
  return { blocks: collectProjectedBlocks(fragment).map((b, index) => ({ text: b.text, index, ...b.imageDescription ? { imageDescription: true } : {} })), mapping: "user", errors: [] };
5723
5804
  }
@@ -5915,16 +5996,277 @@ function mapProjectedDocument(source, node, rows, targetBlockIndex) {
5915
5996
  }
5916
5997
  if (source.mapping === "user") {
5917
5998
  if (node.data?.seq !== source.seq) return { reason: "source-changed" };
5918
- const candidates = minimumCandidates([...new Set(rows.flatMap((row) => [...row.querySelectorAll("div")]))].filter((el) => sameBlocks(source.blocks, collectProjectedBlocks(el))));
5999
+ if (source.messageId && node.data?.messageId && node.data.messageId !== source.messageId) return { reason: "source-changed" };
6000
+ if (Array.isArray(node.data?.content) && node.data.content.filter((part) => part?.type === "text").map((part) => part.text).join("") !== (source.storedRaw ?? source.raw)) return { reason: "source-changed" };
6001
+ const collectUser = (root) => collectProjectedBlocks(root, void 0, void 0, { officialUserInline: source.userTextSemantics === "official-inline" });
6002
+ const candidates = minimumCandidates([...new Set(rows.flatMap((row) => [...row.querySelectorAll("div")]))].filter((el) => sameBlocks(source.blocks, collectUser(el))));
5919
6003
  if (candidates.length !== 1) return { reason: "user-renderer-ambiguous" };
5920
- return { blocks: collectProjectedBlocks(candidates[0]), root: candidates[0] };
6004
+ return { blocks: collectUser(candidates[0]), root: candidates[0] };
5921
6005
  }
5922
6006
  return { reason: "stored-field-not-rendered" };
5923
6007
  }
5924
6008
 
6009
+ // src/user-projection.js
6010
+ var object2 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
6011
+ var strings2 = (value) => Array.isArray(value) && value.every((item) => typeof item === "string");
6012
+ var integer2 = (value) => Number.isSafeInteger(value) && value >= 0 && !Object.is(value, -0);
6013
+ var issue = (code, message) => ({ code, message });
6014
+ var result = (blocks = [], errors = []) => ({ blocks, mapping: "user", userTextSemantics: "official-inline", errors });
6015
+ var unavailable = () => result([], [issue("user-projection-unavailable", "Host user-text evaluation is unavailable; user text was not indexed")]);
6016
+ function displayText(node, raw) {
6017
+ const data = node.data;
6018
+ if (!object2(data)) return void 0;
6019
+ if (node.id === "text") {
6020
+ if (typeof data.text !== "string" || data.text !== raw.slice(node.start, node.end)) return void 0;
6021
+ return data.display == null ? data.text : typeof data.display === "string" ? data.display : void 0;
6022
+ }
6023
+ if (["session", "file", "folder"].includes(node.id)) return typeof data.label === "string" ? data.label : void 0;
6024
+ if (["skill", "command"].includes(node.id)) return typeof data.name === "string" ? `/${data.name}` : void 0;
6025
+ if (node.id === "secret") return typeof data.masked === "string" ? data.masked : void 0;
6026
+ return void 0;
6027
+ }
6028
+ function projectUserTextNodes(nodes, raw) {
6029
+ if (typeof raw !== "string" || !Array.isArray(nodes)) return result([], [issue("invalid-user-projection", "Host user-text evaluation returned an invalid document")]);
6030
+ let cursor = 0;
6031
+ for (const node of nodes) {
6032
+ if (!object2(node) || typeof node.id !== "string" || !integer2(node.start) || !integer2(node.end) || node.start !== cursor || node.end <= node.start || node.end > raw.length) {
6033
+ return result([], [issue("invalid-user-projection", "Host user-text evaluation did not cover the original document in order")]);
6034
+ }
6035
+ cursor = node.end;
6036
+ }
6037
+ if (cursor !== raw.length) return result([], [issue("invalid-user-projection", "Host user-text evaluation did not cover the original document in order")]);
6038
+ const blocks = [], errors = [];
6039
+ let text = "";
6040
+ const flush = () => {
6041
+ if (text !== "") blocks.push({ text, index: blocks.length });
6042
+ text = "";
6043
+ };
6044
+ for (const node of nodes) {
6045
+ const display = displayText(node, raw);
6046
+ if (display === void 0) {
6047
+ flush();
6048
+ errors.push(issue("unsupported-user-node", "A user-text display node is unsupported or invalid; its raw fallback was not indexed"));
6049
+ } else text += display;
6050
+ }
6051
+ flush();
6052
+ return { ...result(blocks, errors), ...nodes.some((node) => node.id === "secret") ? { defaultMasked: true } : {} };
6053
+ }
6054
+ function sourceFacts(source) {
6055
+ const facts = source.userTextFacts === void 0 ? {
6056
+ ...source.referenceLabels === void 0 ? {} : { sessionLabels: source.referenceLabels },
6057
+ ...source.skillNames === void 0 ? {} : { skillNames: source.skillNames }
6058
+ } : source.userTextFacts;
6059
+ if (!object2(facts)) return void 0;
6060
+ for (const key of ["sessionLabels", "skillNames"]) if (facts[key] !== void 0 && !strings2(facts[key])) return void 0;
6061
+ for (const key of ["collapseWhitespace", "trimWhitespace"]) if (facts[key] !== void 0 && typeof facts[key] !== "boolean") return void 0;
6062
+ if (facts.commands !== void 0 && (!Array.isArray(facts.commands) || !facts.commands.every((command) => object2(command) && integer2(command.start) && integer2(command.end) && command.end > command.start && typeof command.name === "string"))) return void 0;
6063
+ return facts;
6064
+ }
6065
+ function createUserTextProjector(userText, { sessionId, verifyRenderer } = {}) {
6066
+ let evaluate;
6067
+ try {
6068
+ if (typeof userText?.createEvaluator === "function") evaluate = userText.createEvaluator();
6069
+ } catch {
6070
+ }
6071
+ return function projectUser(source) {
6072
+ if (typeof evaluate !== "function") return unavailable();
6073
+ if (!object2(source) || typeof source.raw !== "string") return result([], [issue("invalid-user-source", "User source text is unavailable")]);
6074
+ if (sessionId !== void 0 && source.sessionId !== sessionId) return result([], [issue("user-session-mismatch", "User source belongs to a different Session")]);
6075
+ const facts = sourceFacts(source);
6076
+ if (facts === void 0) return result([], [issue("invalid-user-facts", "Durable user-text facts are invalid")]);
6077
+ let nodes;
6078
+ try {
6079
+ nodes = evaluate({ text: source.raw, facts });
6080
+ } catch {
6081
+ return result([], [issue("user-transform-failed", "Host user-text evaluation failed; its raw fallback was not indexed")]);
6082
+ }
6083
+ try {
6084
+ if (verifyRenderer !== void 0 && (typeof verifyRenderer !== "function" || verifyRenderer(nodes, source) !== true)) {
6085
+ return result([], [issue("user-renderer-unavailable", "Official user-text rendering could not be verified; its raw fallback was not indexed")]);
6086
+ }
6087
+ } catch {
6088
+ return result([], [issue("user-renderer-unavailable", "Official user-text rendering could not be verified; its raw fallback was not indexed")]);
6089
+ }
6090
+ return projectUserTextNodes(nodes, source.raw);
6091
+ };
6092
+ }
6093
+
6094
+ // src/user-projection-binding.js
6095
+ var NODE_SLOT = "conversation.user.text.node";
6096
+ var FACTORIES = ["conversation.user.text", "conversation.chat.user.content"];
6097
+ var NODE_IDS = /* @__PURE__ */ new Set(["text", "session", "file", "folder", "skill", "command", "secret"]);
6098
+ var partial = (code, message) => ({ blocks: [], mapping: "user", errors: [{ code, message }] });
6099
+ var service = (ctx, name) => typeof ctx?.get === "function" ? ctx.get(name) : ctx?.[name];
6100
+ var disposeSafely = (dispose) => {
6101
+ try {
6102
+ const completion = dispose?.();
6103
+ if (typeof completion?.catch === "function") completion.catch(() => {
6104
+ });
6105
+ } catch {
6106
+ }
6107
+ };
6108
+ function effectiveEntries(slots) {
6109
+ const entries = slots?.entriesOfSlot?.(NODE_SLOT);
6110
+ if (!Array.isArray(entries)) return void 0;
6111
+ const byKey = /* @__PURE__ */ new Map();
6112
+ for (const entry of entries) {
6113
+ const key = entry?.options?.key;
6114
+ if (typeof key !== "string" || byKey.has(key)) return void 0;
6115
+ byKey.set(key, entry);
6116
+ }
6117
+ return byKey;
6118
+ }
6119
+ function factoriesAvailable(slots) {
6120
+ return FACTORIES.every((name) => {
6121
+ const trees = slots?.snapshot?.(`factory:${name}`);
6122
+ if (!Array.isArray(trees) || trees.length !== 1) return false;
6123
+ const factory = trees[0];
6124
+ if (factory?.type !== "factory" || factory.name !== name || factory.scope !== "session") return false;
6125
+ return name !== "conversation.user.text" || Array.isArray(factory.children) && factory.children.some((child) => child?.type === "slot" && child.name === NODE_SLOT && child.kind === "keyed" && child.scope === "session");
6126
+ });
6127
+ }
6128
+ function createUserProjectionBinding(ctx, onChange) {
6129
+ let slots, baseline, observedEntries, factoryChanged = false, disposed = false;
6130
+ let offSlots, offErrors;
6131
+ const sessions = /* @__PURE__ */ new Map(), registries = /* @__PURE__ */ new Map();
6132
+ const failedNodes = /* @__PURE__ */ new Set();
6133
+ const changed = () => {
6134
+ if (!disposed) {
6135
+ try {
6136
+ onChange?.();
6137
+ } catch {
6138
+ }
6139
+ }
6140
+ };
6141
+ try {
6142
+ slots = service(ctx, "slots");
6143
+ } catch {
6144
+ }
6145
+ const refreshEntries = () => {
6146
+ let current;
6147
+ try {
6148
+ current = effectiveEntries(slots);
6149
+ } catch {
6150
+ return void 0;
6151
+ }
6152
+ if (!current) return void 0;
6153
+ for (const id of failedNodes) if (baseline?.has(id) && current.get(id) === baseline.get(id) && observedEntries && observedEntries.get(id) !== current.get(id)) failedNodes.delete(id);
6154
+ observedEntries = current;
6155
+ return current;
6156
+ };
6157
+ const isFactory = (key) => FACTORIES.some((name) => key === `factory:${name}`);
6158
+ try {
6159
+ offSlots = ctx?.on?.("slots/changed", (key) => {
6160
+ if (disposed || key !== NODE_SLOT && !isFactory(key)) return;
6161
+ if (isFactory(key)) {
6162
+ if (baseline) factoryChanged = true;
6163
+ } else refreshEntries();
6164
+ changed();
6165
+ });
6166
+ offErrors = slots?.onEntryError?.((key, registration) => {
6167
+ if (disposed || key !== NODE_SLOT && !isFactory(key)) return;
6168
+ if (isFactory(key)) factoryChanged = true;
6169
+ else {
6170
+ refreshEntries();
6171
+ const id = registration?.options?.key;
6172
+ if (typeof id === "string" && id) failedNodes.add(id);
6173
+ else for (const known of NODE_IDS) failedNodes.add(known);
6174
+ }
6175
+ changed();
6176
+ });
6177
+ } catch {
6178
+ }
6179
+ function verifyRenderer(nodes) {
6180
+ if (disposed || typeof offSlots !== "function" || factoryChanged || !Array.isArray(nodes)) return false;
6181
+ try {
6182
+ if (!factoriesAvailable(slots)) return false;
6183
+ const current = refreshEntries();
6184
+ if (!current || !nodes.every((node) => NODE_IDS.has(node?.id) && current.has(node.id))) return false;
6185
+ if (!baseline) baseline = current;
6186
+ return nodes.every((node) => !failedNodes.has(node.id) && baseline.has(node.id) && current.get(node.id) === baseline.get(node.id));
6187
+ } catch {
6188
+ return false;
6189
+ }
6190
+ }
6191
+ function release(record3) {
6192
+ if (record3.released) return;
6193
+ record3.released = true;
6194
+ if (sessions.get(record3.id) === record3) sessions.delete(record3.id);
6195
+ const watch = registries.get(record3.registry);
6196
+ watch?.records.delete(record3);
6197
+ if (watch?.records.size === 0) {
6198
+ registries.delete(record3.registry);
6199
+ disposeSafely(watch.dispose);
6200
+ }
6201
+ disposeSafely(record3.disposeScope);
6202
+ }
6203
+ function bind(id, scope, registry) {
6204
+ const record3 = { id, scope, registry, released: false, project: void 0, disposeScope: void 0 };
6205
+ let watch = registries.get(registry);
6206
+ if (!watch) {
6207
+ watch = { records: /* @__PURE__ */ new Set(), dispose: void 0 };
6208
+ watch.dispose = registry.subscribe(() => {
6209
+ if (registries.get(registry) === watch) {
6210
+ refreshEntries();
6211
+ changed();
6212
+ }
6213
+ });
6214
+ if (typeof watch.dispose !== "function") throw new Error("Registry revision observation is unavailable");
6215
+ registries.set(registry, watch);
6216
+ }
6217
+ watch.records.add(record3);
6218
+ sessions.set(id, record3);
6219
+ try {
6220
+ record3.project = createUserTextProjector(registry, { sessionId: id, verifyRenderer });
6221
+ if (typeof scope.effect === "function") record3.disposeScope = scope.effect(() => () => {
6222
+ if (record3.released) return;
6223
+ release(record3);
6224
+ changed();
6225
+ }, "find-all: user projection generation");
6226
+ return record3;
6227
+ } catch (error) {
6228
+ release(record3);
6229
+ throw error;
6230
+ }
6231
+ }
6232
+ return {
6233
+ project(source) {
6234
+ if (disposed) return partial("user-projection-disposed", "User-text projection has been disposed");
6235
+ const id = source?.sessionId;
6236
+ let scope, registry;
6237
+ try {
6238
+ if (typeof id === "string" && id) scope = service(ctx, "sessions")?.scope?.(id);
6239
+ if (scope) registry = service(scope, "uiConversation")?.userText;
6240
+ } catch {
6241
+ }
6242
+ let record3 = sessions.get(id);
6243
+ if (record3 && (record3.scope !== scope || record3.registry !== registry)) {
6244
+ release(record3);
6245
+ record3 = void 0;
6246
+ }
6247
+ if (!scope) return partial("user-session-unavailable", "The user message's retained Session is unavailable; user text was not indexed");
6248
+ if (typeof registry?.createEvaluator !== "function" || typeof registry?.subscribe !== "function") {
6249
+ return partial("user-projection-unavailable", "The Session's public user-text evaluator is unavailable; user text was not indexed");
6250
+ }
6251
+ try {
6252
+ return (record3 ?? bind(id, scope, registry)).project(source);
6253
+ } catch {
6254
+ return partial("user-projection-unavailable", "The Session's user-text projection could not be bound; user text was not indexed");
6255
+ }
6256
+ },
6257
+ dispose() {
6258
+ if (disposed) return;
6259
+ disposed = true;
6260
+ disposeSafely(offSlots);
6261
+ disposeSafely(offErrors);
6262
+ for (const record3 of [...sessions.values()]) release(record3);
6263
+ }
6264
+ };
6265
+ }
6266
+
5925
6267
  // src/search-content.js
5926
6268
  var SEARCH_CONTENT_SERVICE = "ryuu.findAllSearchContent";
5927
- var object2 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
6269
+ var object3 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
5928
6270
  function createSearchContentService(onChange) {
5929
6271
  const registrations = /* @__PURE__ */ new Map();
5930
6272
  const changed = () => {
@@ -5954,18 +6296,26 @@ function createSearchContentService(onChange) {
5954
6296
  },
5955
6297
  createProjector(project) {
5956
6298
  if (typeof project !== "function") throw new TypeError("Search content needs a text projector");
5957
- const rules = [...registrations.values()].map(({ createRule }) => createRule()).filter((rule) => typeof rule === "function");
6299
+ let rules, ruleFailure = false;
6300
+ try {
6301
+ rules = [...registrations.values()].map(({ createRule }) => createRule());
6302
+ if (rules.some((rule) => typeof rule !== "function")) ruleFailure = true;
6303
+ } catch {
6304
+ ruleFailure = true;
6305
+ }
5958
6306
  return async (source) => {
5959
6307
  let current = { ...source };
6308
+ if (ruleFailure) return { source, blocks: [], errors: [{ code: "search-content-rule-failed", message: "Search content rule initialization failed" }] };
5960
6309
  try {
5961
6310
  for (const rule of rules) {
5962
6311
  const patch = await rule(current);
5963
6312
  if (patch === void 0 || patch === null) continue;
5964
- if (!object2(patch)) throw new TypeError("Search content rule returned an invalid change");
6313
+ if (!object3(patch)) throw new TypeError("Search content rule returned an invalid change");
6314
+ if (["sessionId", "seq", "id", "kind", "contentIndex", "messageId", "turn", "step", "stepId"].some((key) => Object.hasOwn(patch, key) && patch[key] !== source[key])) throw new TypeError("Search content rule changed durable identity");
5965
6315
  current = { ...current, ...patch };
5966
6316
  }
5967
6317
  } catch (error) {
5968
- return { source: current, blocks: [], errors: [{ code: "search-content-rule-failed", message: error instanceof Error ? error.message : String(error) }] };
6318
+ return { source: current, blocks: [], errors: [{ code: "search-content-rule-failed", message: "Search content rule failed" }] };
5969
6319
  }
5970
6320
  const projection = await project(current);
5971
6321
  return { ...projection, source: current };
@@ -6035,11 +6385,8 @@ var L2 = ZH ? {
6035
6385
  prev: "\u4E0A\u4E00\u4E2A\u5339\u914D",
6036
6386
  next: "\u4E0B\u4E00\u4E2A\u5339\u914D",
6037
6387
  close: "\u5173\u95ED\u67E5\u627E",
6038
- move: "\u62D6\u52A8\u67E5\u627E\u680F\uFF1B\u70B9\u51FB\u5C55\u5F00\u79FB\u52A8\u6309\u94AE",
6039
- moveLeft: "\u5411\u5DE6\u79FB\u52A8",
6040
- moveRight: "\u5411\u53F3\u79FB\u52A8",
6041
- moveUp: "\u5411\u4E0A\u79FB\u52A8",
6042
- moveDown: "\u5411\u4E0B\u79FB\u52A8",
6388
+ findTitle: "\u5F53\u524D\u5BF9\u8BDD\u67E5\u627E",
6389
+ move: "\u62D6\u52A8\u67E5\u627E\u680F\u7A7A\u767D\u5904\u79FB\u52A8\uFF1B\u65B9\u5411\u952E\u79FB\u52A8\uFF1BHome \u6062\u590D\u9ED8\u8BA4\u4F4D\u7F6E",
6043
6390
  resetPosition: "\u6062\u590D\u9ED8\u8BA4\u4F4D\u7F6E",
6044
6391
  cap: "\u4EC5\u663E\u793A\u524D {n} \u5904\u5339\u914D",
6045
6392
  resultCount: "{n} \u4E2A\u7ED3\u679C",
@@ -6122,11 +6469,8 @@ var L2 = ZH ? {
6122
6469
  prev: "Previous match",
6123
6470
  next: "Next match",
6124
6471
  close: "Close find",
6125
- move: "Drag find bar; click for move controls",
6126
- moveLeft: "Move left",
6127
- moveRight: "Move right",
6128
- moveUp: "Move up",
6129
- moveDown: "Move down",
6472
+ findTitle: "Find in conversation",
6473
+ move: "Drag empty space in the find bar to move it; use arrow keys to move and Home to reset",
6130
6474
  resetPosition: "Reset position",
6131
6475
  cap: "Showing only the first {n} matches",
6132
6476
  resultCount: "{n} results",
@@ -6255,16 +6599,16 @@ function createHandlers(ops) {
6255
6599
  }
6256
6600
  async function runPageIn(opts) {
6257
6601
  var pages = 0;
6258
- function result(reason) {
6602
+ function result2(reason) {
6259
6603
  return { pages, reason };
6260
6604
  }
6261
6605
  for (; ; ) {
6262
- if (opts.isCancelled()) return result("cancelled");
6606
+ if (opts.isCancelled()) return result2("cancelled");
6263
6607
  var ready = await opts.waitReady();
6264
- if (opts.isCancelled()) return result("cancelled");
6265
- if (ready.reason) return result(ready.reason);
6266
- if (ready.hasMore === false) return result("done");
6267
- if (pages >= opts.maxPages) return result("capped");
6608
+ if (opts.isCancelled()) return result2("cancelled");
6609
+ if (ready.reason) return result2(ready.reason);
6610
+ if (ready.hasMore === false) return result2("done");
6611
+ if (pages >= opts.maxPages) return result2("capped");
6268
6612
  var before = opts.signature();
6269
6613
  var loaded;
6270
6614
  try {
@@ -6272,29 +6616,29 @@ async function runPageIn(opts) {
6272
6616
  } catch (error) {
6273
6617
  loaded = { reason: "error" };
6274
6618
  }
6275
- if (opts.isCancelled()) return result("cancelled");
6619
+ if (opts.isCancelled()) return result2("cancelled");
6276
6620
  ready = await opts.waitReady(!!(loaded && loaded.reason));
6277
- if (opts.isCancelled()) return result("cancelled");
6278
- if (loaded && loaded.reason) return result(loaded.reason);
6279
- if (ready.reason) return result(ready.reason);
6621
+ if (opts.isCancelled()) return result2("cancelled");
6622
+ if (loaded && loaded.reason) return result2(loaded.reason);
6623
+ if (ready.reason) return result2(ready.reason);
6280
6624
  if (loaded && loaded.deferred) continue;
6281
6625
  if (ready.hasMore !== false) await opts.waitChange(before);
6282
- if (opts.isCancelled()) return result("cancelled");
6626
+ if (opts.isCancelled()) return result2("cancelled");
6283
6627
  ready = await opts.waitReady();
6284
- if (opts.isCancelled()) return result("cancelled");
6285
- if (ready.reason) return result(ready.reason);
6628
+ if (opts.isCancelled()) return result2("cancelled");
6629
+ if (ready.reason) return result2(ready.reason);
6286
6630
  var changed = opts.signature() !== before;
6287
6631
  if (changed) {
6288
6632
  pages += 1;
6289
6633
  if (opts.onProgress) opts.onProgress(pages);
6290
6634
  }
6291
- if (opts.isCancelled()) return result("cancelled");
6292
- if (ready.hasMore === false) return result("done");
6293
- if (!changed) return result("stalled");
6635
+ if (opts.isCancelled()) return result2("cancelled");
6636
+ if (ready.hasMore === false) return result2("done");
6637
+ if (!changed) return result2("stalled");
6294
6638
  }
6295
6639
  }
6296
6640
  function cssText() {
6297
- return "#" + BAR_ID + "{--dsh-find-all-max-width:480px;container:dsh-find-all / inline-size;position:fixed;top:var(--dsh-find-all-bar-top);right:var(--dsh-find-all-bar-right);z-index:2147483000;visibility:hidden;isolation:isolate;box-sizing:border-box;align-items:stretch;gap:4px;padding:6px 8px;display:flex;flex-direction:column;width:min(var(--dsh-find-all-max-width),var(--dsh-find-all-panel-width));max-width:calc(100vw - 16px);max-height:var(--dsh-find-all-max-height);overflow:auto;background:transparent;--dsw-elevation-stroke-color:var(--dsw-alias-border-l1);border:0;border-radius:var(--dsw-radius-md,8px);box-shadow:var(--dsw-elevation-panel,var(--dsw-shadow-lv2))}#" + BAR_ID + "[data-positioned]{visibility:visible}#" + BAR_ID + ":before,#" + BAR_ID + '-content-panel:before{content:"";position:absolute;inset:0;z-index:-1;pointer-events:none;border-radius:inherit;background:var(--dsw-menu-surface-fill,var(--dsw-specific-menu,var(--dsw-alias-bg-layer-2)));-webkit-backdrop-filter:var(--dsw-menu-backdrop-filter,blur(40px) saturate(150%));backdrop-filter:var(--dsw-menu-backdrop-filter,blur(40px) saturate(150%))}#' + BAR_ID + " .controls{display:flex;flex-wrap:nowrap;align-items:center;gap:4px;min-width:0}#" + BAR_ID + " input.query{box-sizing:border-box;flex:1 1 0;min-width:64px;max-width:100%;width:auto;height:28px;color:var(--dsw-alias-label-primary);font:13px/1 var(--dsw-font-family);background:var(--dsw-alias-bg-base);border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-sm,6px);outline:none;padding:0 8px}#" + BAR_ID + " input.query:focus-visible{border-color:var(--dsw-alias-state-business-primary)}#" + BAR_ID + " .count{box-sizing:border-box;flex:0 1 80px;width:80px;min-width:64px;max-width:96px;height:28px;line-height:28px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--dsw-alias-label-tertiary);font:12px/28px var(--dsw-font-family);font-variant-numeric:tabular-nums;text-align:center}#" + BAR_ID + " button.count{width:80px;min-width:64px;padding:0 4px;flex:0 1 80px}#" + BAR_ID + " .count[hidden],#" + BAR_ID + " .count-editor[hidden],#" + BAR_ID + " .count-hint[hidden]{display:none}#" + BAR_ID + " .count-editor{display:flex;align-items:center;gap:2px;flex:none;color:var(--dsw-alias-label-tertiary);font:12px/1 var(--dsw-font-family);font-variant-numeric:tabular-nums}#" + BAR_ID + " input.count-input{box-sizing:border-box;width:5.5ch;min-width:0;height:28px;padding:0 3px;text-align:right;font:inherit;color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-base);border:1px solid var(--dsw-alias-border-l4);border-radius:4px}#" + BAR_ID + " input.count-input:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:1px}#" + BAR_ID + " input.count-input[aria-invalid=true]{border-color:var(--dsw-alias-state-error-primary,#c33)}#" + BAR_ID + " .count-hint{padding:2px 8px 0 32px;color:var(--dsw-alias-label-secondary);font:12px/1.5 var(--dsw-font-family);overflow-wrap:anywhere}#" + BAR_ID + " .count-hint[data-error]{color:var(--dsw-alias-state-error-primary,#c33)}#" + BAR_ID + " .status{box-sizing:border-box;width:100%;padding:2px 8px 4px 32px;color:var(--dsw-alias-label-tertiary);font:12px/1.5 var(--dsw-font-family);text-align:left;white-space:normal;overflow-wrap:anywhere}#" + BAR_ID + " .status:empty{display:none}#" + BAR_ID + " .position-controls{display:flex;flex-wrap:wrap;align-items:center;gap:4px}#" + BAR_ID + " .position-controls[hidden]{display:none}#" + BAR_ID + " button.drag-handle{touch-action:none;user-select:none;cursor:grab;flex:none}#" + BAR_ID + "[data-dragging] button.drag-handle{cursor:grabbing}#" + BAR_ID + " .status[data-busy]{cursor:pointer;color:var(--dsw-alias-state-business-primary)}#" + BAR_ID + " .navigation-controls{display:flex;align-items:center;gap:4px;flex:none}#" + BAR_ID + " .content-filter{position:relative;width:28px;padding:0}#" + BAR_ID + " .content-filter[aria-expanded=true]{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-button-ghost-active-fill,var(--dsw-alias-interactive-bg-hover))}#" + BAR_ID + " .content-filter[aria-expanded=true]:hover{background:var(--dsw-alias-button-ghost-active-hover,var(--dsw-alias-interactive-bg-active))}#" + BAR_ID + ' .content-filter[data-filtered]:after{content:"";position:absolute;top:3px;right:3px;width:5px;height:5px;border-radius:50%;background:var(--dsw-alias-state-business-primary)}#' + BAR_ID + "-content-panel{position:fixed;z-index:2147483001;isolation:isolate;box-sizing:border-box;display:flex;flex-direction:column;min-width:0;width:320px;max-width:calc(100vw - 16px);margin:0;padding:0;overflow:hidden;--dsw-elevation-stroke-color:var(--dsw-alias-border-l1);box-shadow:var(--dsw-elevation-prominent,var(--dsw-elevation-panel,var(--dsw-shadow-lv2)));color:var(--dsw-alias-label-primary);font:13px/20px var(--dsw-font-family);border:0;border-radius:var(--dsw-radius-md,8px);background:transparent}#" + BAR_ID + "-content-panel[hidden]{display:none}#" + BAR_ID + "-content-panel .content-viewport{min-height:0;overflow:auto;padding:4px;--dsh-scrollbar-thumb:var(--dsw-alias-scrollbar-bg-l2);--dsh-scrollbar-thumb-hover:var(--dsw-alias-scrollbar-hover-l2)}#" + BAR_ID + "-content-panel fieldset{min-width:0;margin:0;padding:0;border:0}#" + BAR_ID + "-content-panel legend{box-sizing:border-box;width:100%;padding:4px 8px;font:500 11px/16px var(--dsw-font-family);color:var(--dsw-alias-label-tertiary)}#" + BAR_ID + "-content-panel .content-options{display:grid;grid-template-columns:minmax(0,1fr)}#" + BAR_ID + "-content-panel .content-option{box-sizing:border-box;min-width:0;min-height:28px;padding:4px 8px;align-items:center;gap:6px;display:flex;border-radius:var(--dsw-radius-sm,6px);cursor:pointer}#" + BAR_ID + "-content-panel .content-option:hover{background:var(--dsw-alias-interactive-bg-hover)}#" + BAR_ID + "-content-panel .content-option span{min-width:0;overflow-wrap:anywhere}#" + BAR_ID + "-content-panel .content-option input{appearance:auto;accent-color:var(--dsw-alias-brand-primary,var(--dsw-alias-state-business-primary));flex:none;width:16px;height:16px;margin:0;cursor:inherit}#" + BAR_ID + "-content-panel .content-reset{margin-top:4px;padding:0 8px;font:12px/18px var(--dsw-font-family)}#" + BAR_ID + "-content-panel .scope-group{padding-bottom:4px;margin-bottom:4px;border-bottom:1px solid var(--dsw-alias-border-l1)}#" + BAR_ID + "-content-panel .history-command{margin-top:4px;padding-top:4px;border-top:1px solid var(--dsw-alias-border-l1)}#" + BAR_ID + "-content-panel .update-version,#" + BAR_ID + "-content-panel .update-status{margin:0;padding:4px 8px;font:12px/18px var(--dsw-font-family);color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere}#" + BAR_ID + "-content-panel .update-status:empty{padding:0}#" + BAR_ID + "-content-panel .update-command [hidden]{display:none}#" + BAR_ID + "-content-panel .diagnostic-command{display:flex;flex-wrap:wrap;align-items:center;gap:4px}#" + BAR_ID + "-content-panel .diagnostic-command button{flex:1;width:auto}#" + BAR_ID + "-content-panel .diagnostic-feedback{padding:0 8px;font:12px/18px var(--dsw-font-family);color:var(--dsw-alias-label-secondary)}#" + BAR_ID + "-content-panel .feedback-issue{display:flex;align-items:center;gap:6px;box-sizing:border-box;min-height:28px;width:100%;padding:4px 8px;color:var(--dsw-alias-label-secondary);text-decoration:none;border-radius:var(--dsw-radius-sm,6px)}#" + BAR_ID + "-content-panel .feedback-issue:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}#" + BAR_ID + "-content-panel .feedback-privacy{margin:0;padding:0 8px 4px;font:12px/18px var(--dsw-font-family);color:var(--dsw-alias-label-tertiary);overflow-wrap:anywhere}#" + BAR_ID + "-content-panel .history-command button{width:100%;height:auto;min-height:28px;justify-content:flex-start;gap:6px;padding:4px 8px;text-align:left;font:13px/20px var(--dsw-font-family)}#" + BAR_ID + " button,#" + BAR_ID + "-content-panel button{box-sizing:border-box;flex:none;height:28px;min-width:28px;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;border-radius:var(--dsw-radius-sm,6px);align-items:center;justify-content:center;display:inline-flex}#" + BAR_ID + " button[hidden]{display:none}#" + BAR_ID + " button:hover,#" + BAR_ID + "-content-panel button:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}#" + BAR_ID + " button:focus-visible,#" + BAR_ID + "-content-panel :focus-visible{outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:2px}#" + BAR_ID + " button:disabled,#" + BAR_ID + "-content-panel button:disabled,#" + BAR_ID + "-content-panel button[aria-disabled=true]{opacity:.5;cursor:default}#" + BAR_ID + " [data-find-all-return][hidden]{display:none}#" + BAR_ID + " [data-find-all-return]{gap:4px;padding:0 8px;white-space:nowrap}@container dsh-find-all (max-width:550px){#" + BAR_ID + " .return-label{display:none}#" + BAR_ID + " [data-find-all-return]{padding:0 6px}}@container dsh-find-all (max-width:360px){#" + BAR_ID + " .controls,#" + BAR_ID + " .navigation-controls{gap:2px}#" + BAR_ID + " .count,#" + BAR_ID + " button.count{width:64px;min-width:64px;max-width:64px}#" + BAR_ID + " .status{padding-left:30px}}@container dsh-find-all (max-width:330px){#" + BAR_ID + " .controls{flex-wrap:wrap}#" + BAR_ID + " .navigation-controls{margin-left:auto}}#" + BAR_ID + " svg{pointer-events:none}#" + BAR_ID + "[data-about-open]{z-index:999;pointer-events:none}.dsh-find-all-conversations{width:min(680px,100%);align-self:flex-start;max-height:100%;min-width:0;padding:0;gap:0;font-family:var(--dsw-font-family)}.dsh-find-all-conversations-layout{display:flex;flex-direction:column;min-width:0;min-height:0;flex:1;width:100%;max-width:100%;overflow-y:auto;overflow-x:hidden}.dsh-find-all-conversations-header{display:flex;align-items:center;gap:8px;flex:none;min-width:0;padding:16px 16px 8px}.dsh-find-all-conversations-input{flex:1;min-width:0;box-sizing:border-box}.dsh-find-all-conversations-close{flex:none;width:28px;padding:0;color:var(--dsw-alias-label-secondary)}.dsh-find-all-conversations-toolbar{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:6px 12px;flex:none;min-width:0;padding:0 16px 10px;border-bottom:.5px solid var(--dsw-alias-border-l1)}.dsh-find-all-conversations-scope{min-width:0;font-size:12px;line-height:18px;color:var(--dsw-alias-label-tertiary);overflow-wrap:anywhere}.dsh-find-all-conversations-options{display:flex;align-items:center;flex-wrap:wrap;gap:6px 12px;margin-left:auto;min-width:0;max-width:100%}.dsh-find-all-conversations-title-only{flex:none;font-size:12px;line-height:18px;white-space:nowrap}.dsh-find-all-conversations-title-only-fallback{display:inline-flex;align-items:center;gap:6px}.dsh-find-all-conversations-title-only-fallback input{margin:0;accent-color:var(--dsw-alias-brand-primary)}.dsh-find-all-conversations-list{display:flex;flex-direction:column;flex:0 1 auto;min-height:0;min-width:0;max-width:100%;max-height:416px;box-sizing:border-box;padding:4px 8px;overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain}.dsh-find-all-conversations-empty{padding:16px 8px;font-size:13px;line-height:20px;color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere}.dsh-find-all-conversations-footer{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:4px 8px;flex:none;min-height:0;max-height:35%;padding:8px 12px;border-top:.5px solid var(--dsw-alias-border-l1);overflow-y:auto;overflow-x:hidden}.dsh-find-all-conversations-status-actions{display:flex;align-items:center;flex-wrap:wrap;gap:4px 8px;flex:1;min-width:0}.dsh-find-all-conversations-status{margin:0;min-width:0;font-size:12px;line-height:18px;color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere}.dsh-find-all-conversations-status:empty{display:none}.dsh-find-all-conversations-actions{display:flex;gap:4px;flex-wrap:wrap}.dsh-find-all-conversations-help{flex:none;margin-left:auto;color:var(--dsw-alias-label-tertiary)}.dsh-find-all-conversations-help-content{flex:0 1 auto;min-height:0;max-height:160px;padding:0 16px 12px;overflow-y:auto;font-size:12px;line-height:18px;color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere}.dsh-find-all-conversations-help-content[hidden]{display:none}.dsh-find-all-conversations-help-content p{margin:6px 0 0}.dsh-find-all-conversations-match{color:inherit;background:var(--dsw-alias-state-business-tertiary);font-weight:600}.dsh-find-all-conversations-row{display:flex;flex-direction:column;align-items:stretch;flex:none;width:100%;min-width:0;max-width:100%;min-height:48px;box-sizing:border-box;border:none;border-radius:var(--dsw-radius-lg);padding:4px 8px;background:transparent;cursor:pointer;text-align:left;color:var(--dsw-alias-label-primary);font-family:inherit}.dsh-find-all-conversations-row:not(.dsh-find-all-conversations-archived-row):hover,.dsh-find-all-conversations-row:not(.dsh-find-all-conversations-archived-row)[aria-current=true]{background:var(--dsw-alias-interactive-bg-hover)}.dsh-find-all-conversations-row:focus-visible{outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px}.dsh-find-all-conversations-archived-row{cursor:default}.dsh-find-all-conversations-row-heading{display:flex;align-items:center;flex-wrap:wrap;gap:6px;min-width:0;max-width:100%}.dsh-find-all-conversations-row-heading>.dsh-find-all-conversations-title{flex:1;min-width:0}.dsh-find-all-conversations-archive-label{flex:none;font-size:12px;line-height:17px;color:var(--dsw-alias-label-tertiary)}.dsh-find-all-conversations-restore{flex:none}.dsh-find-all-conversations-row-error{min-width:0;max-width:100%;font-size:12px;line-height:17px;color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere}.dsh-find-all-conversations-title{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:14px;line-height:20px;font-weight:400}.dsh-find-all-conversations-meta{display:flex;align-items:center;gap:6px;min-width:0;min-height:17px}.dsh-find-all-conversations-info,.dsh-find-all-conversations-snippet{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px;line-height:17px}.dsh-find-all-conversations-info{flex:none;max-width:40%;color:var(--dsw-alias-label-tertiary)}.dsh-find-all-conversations-info:only-child{max-width:100%}.dsh-find-all-conversations-snippet{flex:1;min-width:0;color:var(--dsw-alias-label-secondary)}.dsh-find-all-about{max-height:100%;font-family:var(--dsw-font-family)}.dsh-find-all-about-content{min-height:0;overflow:auto}.dsh-find-all-about-details{display:flex;flex-direction:column;gap:16px;color:var(--dsw-alias-label-primary);font:13px/20px var(--dsw-font-family);overflow-wrap:anywhere}.dsh-find-all-about-details p{margin:0}.dsh-find-all-about-details h3{margin:0 0 6px;font:500 13px/20px var(--dsw-font-family)}.dsh-find-all-about-details a{color:var(--dsw-alias-state-business-primary);text-underline-offset:3px}.dsh-find-all-about-links{display:flex;flex-wrap:wrap;gap:6px 16px}.dsh-find-all-about-group{display:flex;align-items:center;flex-wrap:wrap;gap:6px 10px}.dsh-find-all-about-status{color:var(--dsw-alias-label-secondary)}.dsh-find-all-about-details :focus-visible{outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:2px}::highlight(" + HL_ALL + "){background-color:rgba(245,197,24,.42)}::highlight(" + HL_CUR + "){background-color:#f5a623;color:#141414}";
6641
+ return "#" + BAR_ID + "{--dsh-find-all-max-width:480px;container:dsh-find-all / inline-size;position:fixed;top:var(--dsh-find-all-bar-top);right:var(--dsh-find-all-bar-right);z-index:2147483000;visibility:hidden;isolation:isolate;box-sizing:border-box;align-items:stretch;gap:4px;padding:6px 8px;display:flex;flex-direction:column;width:min(var(--dsh-find-all-max-width),var(--dsh-find-all-panel-width));max-width:calc(100vw - 16px);max-height:var(--dsh-find-all-max-height);overflow:auto;background:transparent;--dsw-elevation-stroke-color:var(--dsw-alias-border-l1);border:0;border-radius:var(--dsw-radius-md,8px);box-shadow:var(--dsw-elevation-panel,var(--dsw-shadow-lv2))}#" + BAR_ID + "[data-positioned]{visibility:visible}#" + BAR_ID + ":before,#" + BAR_ID + '-content-panel:before{content:"";position:absolute;inset:0;z-index:-1;pointer-events:none;border-radius:inherit;background:var(--dsw-menu-surface-fill,var(--dsw-specific-menu,var(--dsw-alias-bg-layer-2)));-webkit-backdrop-filter:var(--dsw-menu-backdrop-filter,blur(40px) saturate(150%));backdrop-filter:var(--dsw-menu-backdrop-filter,blur(40px) saturate(150%))}#' + BAR_ID + " .move-header{display:flex;align-items:center;gap:4px;min-width:0;min-height:28px;cursor:move}#" + BAR_ID + " .move-header:focus-visible{outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px;border-radius:var(--dsw-radius-sm,6px)}#" + BAR_ID + " .move-grip{flex:none;width:8px;align-self:stretch;touch-action:none;user-select:none}#" + BAR_ID + " .move-actions{display:flex;align-items:center;gap:2px;flex:none}#" + BAR_ID + "[data-dragging] .move-header{cursor:grabbing}#" + BAR_ID + " .controls{display:flex;flex:1;flex-wrap:nowrap;align-items:center;gap:4px;min-width:0}#" + BAR_ID + " input.query{box-sizing:border-box;flex:1 1 0;min-width:64px;max-width:100%;width:auto;height:28px;color:var(--dsw-alias-label-primary);font:13px/1 var(--dsw-font-family);background:var(--dsw-alias-bg-base);border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-sm,6px);outline:none;padding:0 8px}#" + BAR_ID + " input.query:focus-visible{border-color:var(--dsw-alias-state-business-primary)}#" + BAR_ID + " .count{box-sizing:border-box;flex:0 1 80px;width:80px;min-width:64px;max-width:96px;height:28px;line-height:28px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--dsw-alias-label-tertiary);font:12px/28px var(--dsw-font-family);font-variant-numeric:tabular-nums;text-align:center}#" + BAR_ID + " button.count{width:80px;min-width:64px;padding:0 4px;flex:0 1 80px}#" + BAR_ID + " .count[hidden],#" + BAR_ID + " .count-editor[hidden],#" + BAR_ID + " .count-hint[hidden]{display:none}#" + BAR_ID + " .count-editor{display:flex;align-items:center;gap:2px;flex:none;color:var(--dsw-alias-label-tertiary);font:12px/1 var(--dsw-font-family);font-variant-numeric:tabular-nums}#" + BAR_ID + " input.count-input{box-sizing:border-box;width:5.5ch;min-width:0;height:28px;padding:0 3px;text-align:right;font:inherit;color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-base);border:1px solid var(--dsw-alias-border-l4);border-radius:4px}#" + BAR_ID + " input.count-input:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:1px}#" + BAR_ID + " input.count-input[aria-invalid=true]{border-color:var(--dsw-alias-state-error-primary,#c33)}#" + BAR_ID + " .count-hint{padding:2px 8px 0;color:var(--dsw-alias-label-secondary);font:12px/1.5 var(--dsw-font-family);overflow-wrap:anywhere}#" + BAR_ID + " .count-hint[data-error]{color:var(--dsw-alias-state-error-primary,#c33)}#" + BAR_ID + " .status{box-sizing:border-box;width:100%;padding:2px 8px 4px;color:var(--dsw-alias-label-tertiary);font:12px/1.5 var(--dsw-font-family);text-align:left;white-space:normal;overflow-wrap:anywhere}#" + BAR_ID + " .status:empty{display:none}#" + BAR_ID + " .status[data-busy]{cursor:pointer;color:var(--dsw-alias-state-business-primary)}#" + BAR_ID + " .navigation-controls{display:flex;align-items:center;gap:4px;flex:none}#" + BAR_ID + " .content-filter{position:relative;width:28px;padding:0}#" + BAR_ID + " .content-filter[aria-expanded=true]{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-button-ghost-active-fill,var(--dsw-alias-interactive-bg-hover))}#" + BAR_ID + " .content-filter[aria-expanded=true]:hover{background:var(--dsw-alias-button-ghost-active-hover,var(--dsw-alias-interactive-bg-active))}#" + BAR_ID + ' .content-filter[data-filtered]:after{content:"";position:absolute;top:3px;right:3px;width:5px;height:5px;border-radius:50%;background:var(--dsw-alias-state-business-primary)}#' + BAR_ID + "-content-panel{position:fixed;z-index:2147483001;isolation:isolate;box-sizing:border-box;display:flex;flex-direction:column;min-width:0;width:320px;max-width:calc(100vw - 16px);margin:0;padding:0;overflow:hidden;--dsw-elevation-stroke-color:var(--dsw-alias-border-l1);box-shadow:var(--dsw-elevation-prominent,var(--dsw-elevation-panel,var(--dsw-shadow-lv2)));color:var(--dsw-alias-label-primary);font:13px/20px var(--dsw-font-family);border:0;border-radius:var(--dsw-radius-md,8px);background:transparent}#" + BAR_ID + "-content-panel[hidden]{display:none}#" + BAR_ID + "-content-panel .content-viewport{min-height:0;overflow:auto;padding:4px;--dsh-scrollbar-thumb:var(--dsw-alias-scrollbar-bg-l2);--dsh-scrollbar-thumb-hover:var(--dsw-alias-scrollbar-hover-l2)}#" + BAR_ID + "-content-panel fieldset{min-width:0;margin:0;padding:0;border:0}#" + BAR_ID + "-content-panel legend{box-sizing:border-box;width:100%;padding:4px 8px;font:500 11px/16px var(--dsw-font-family);color:var(--dsw-alias-label-tertiary)}#" + BAR_ID + "-content-panel .content-options{display:grid;grid-template-columns:minmax(0,1fr)}#" + BAR_ID + "-content-panel .content-option{box-sizing:border-box;min-width:0;min-height:28px;padding:4px 8px;align-items:center;gap:6px;display:flex;border-radius:var(--dsw-radius-sm,6px);cursor:pointer}#" + BAR_ID + "-content-panel .content-option:hover{background:var(--dsw-alias-interactive-bg-hover)}#" + BAR_ID + "-content-panel .content-option span{min-width:0;overflow-wrap:anywhere}#" + BAR_ID + "-content-panel .content-option input{appearance:auto;accent-color:var(--dsw-alias-brand-primary,var(--dsw-alias-state-business-primary));flex:none;width:16px;height:16px;margin:0;cursor:inherit}#" + BAR_ID + "-content-panel .content-reset{margin-top:4px;padding:0 8px;font:12px/18px var(--dsw-font-family)}#" + BAR_ID + "-content-panel .scope-group{padding-bottom:4px;margin-bottom:4px;border-bottom:1px solid var(--dsw-alias-border-l1)}#" + BAR_ID + "-content-panel .history-command{margin-top:4px;padding-top:4px;border-top:1px solid var(--dsw-alias-border-l1)}#" + BAR_ID + "-content-panel .update-version,#" + BAR_ID + "-content-panel .update-status{margin:0;padding:4px 8px;font:12px/18px var(--dsw-font-family);color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere}#" + BAR_ID + "-content-panel .update-status:empty{padding:0}#" + BAR_ID + "-content-panel .update-command [hidden]{display:none}#" + BAR_ID + "-content-panel .diagnostic-command{display:flex;flex-wrap:wrap;align-items:center;gap:4px}#" + BAR_ID + "-content-panel .diagnostic-command button{flex:1;width:auto}#" + BAR_ID + "-content-panel .diagnostic-feedback{padding:0 8px;font:12px/18px var(--dsw-font-family);color:var(--dsw-alias-label-secondary)}#" + BAR_ID + "-content-panel .feedback-issue{display:flex;align-items:center;gap:6px;box-sizing:border-box;min-height:28px;width:100%;padding:4px 8px;color:var(--dsw-alias-label-secondary);text-decoration:none;border-radius:var(--dsw-radius-sm,6px)}#" + BAR_ID + "-content-panel .feedback-issue:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}#" + BAR_ID + "-content-panel .feedback-privacy{margin:0;padding:0 8px 4px;font:12px/18px var(--dsw-font-family);color:var(--dsw-alias-label-tertiary);overflow-wrap:anywhere}#" + BAR_ID + "-content-panel .history-command button{width:100%;height:auto;min-height:28px;justify-content:flex-start;gap:6px;padding:4px 8px;text-align:left;font:13px/20px var(--dsw-font-family)}#" + BAR_ID + " button,#" + BAR_ID + "-content-panel button{box-sizing:border-box;flex:none;height:28px;min-width:28px;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;border-radius:var(--dsw-radius-sm,6px);align-items:center;justify-content:center;display:inline-flex}#" + BAR_ID + " button[hidden]{display:none}#" + BAR_ID + " button:hover,#" + BAR_ID + "-content-panel button:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}#" + BAR_ID + " button:focus-visible,#" + BAR_ID + "-content-panel :focus-visible{outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:2px}#" + BAR_ID + " button:disabled,#" + BAR_ID + "-content-panel button:disabled,#" + BAR_ID + "-content-panel button[aria-disabled=true]{opacity:.5;cursor:default}#" + BAR_ID + " [data-find-all-return][hidden]{display:none}#" + BAR_ID + " [data-find-all-return]{gap:4px;padding:0 8px;white-space:nowrap}@container dsh-find-all (max-width:550px){#" + BAR_ID + " .return-label{display:none}#" + BAR_ID + " [data-find-all-return]{padding:0 6px}}@container dsh-find-all (max-width:360px){#" + BAR_ID + " .controls,#" + BAR_ID + " .navigation-controls{gap:2px}#" + BAR_ID + " .count,#" + BAR_ID + " button.count{width:64px;min-width:64px;max-width:64px}}@container dsh-find-all (max-width:330px){#" + BAR_ID + " .controls{flex-wrap:wrap}#" + BAR_ID + " .navigation-controls{margin-left:auto}}#" + BAR_ID + " svg{pointer-events:none}#" + BAR_ID + "[data-about-open]{z-index:999;pointer-events:none}.dsh-find-all-conversations{width:min(680px,100%);align-self:flex-start;max-height:100%;min-width:0;padding:0;gap:0;font-family:var(--dsw-font-family)}.dsh-find-all-conversations-layout{display:flex;flex-direction:column;min-width:0;min-height:0;flex:1;width:100%;max-width:100%;overflow-y:auto;overflow-x:hidden}.dsh-find-all-conversations-header{display:flex;align-items:center;gap:8px;flex:none;min-width:0;padding:16px 16px 8px}.dsh-find-all-conversations-input{flex:1;min-width:0;box-sizing:border-box}.dsh-find-all-conversations-close{flex:none;width:28px;padding:0;color:var(--dsw-alias-label-secondary)}.dsh-find-all-conversations-toolbar{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:6px 12px;flex:none;min-width:0;padding:0 16px 10px;border-bottom:.5px solid var(--dsw-alias-border-l1)}.dsh-find-all-conversations-scope{min-width:0;font-size:12px;line-height:18px;color:var(--dsw-alias-label-tertiary);overflow-wrap:anywhere}.dsh-find-all-conversations-options{display:flex;align-items:center;flex-wrap:wrap;gap:6px 12px;margin-left:auto;min-width:0;max-width:100%}.dsh-find-all-conversations-title-only{flex:none;font-size:12px;line-height:18px;white-space:nowrap}.dsh-find-all-conversations-title-only-fallback{display:inline-flex;align-items:center;gap:6px}.dsh-find-all-conversations-title-only-fallback input{margin:0;accent-color:var(--dsw-alias-brand-primary)}.dsh-find-all-conversations-list{display:flex;flex-direction:column;flex:0 1 auto;min-height:0;min-width:0;max-width:100%;max-height:416px;box-sizing:border-box;padding:4px 8px;overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain}.dsh-find-all-conversations-empty{padding:16px 8px;font-size:13px;line-height:20px;color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere}.dsh-find-all-conversations-footer{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:4px 8px;flex:none;min-height:0;max-height:35%;padding:8px 12px;border-top:.5px solid var(--dsw-alias-border-l1);overflow-y:auto;overflow-x:hidden}.dsh-find-all-conversations-status-actions{display:flex;align-items:center;flex-wrap:wrap;gap:4px 8px;flex:1;min-width:0}.dsh-find-all-conversations-status{margin:0;min-width:0;font-size:12px;line-height:18px;color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere}.dsh-find-all-conversations-status:empty{display:none}.dsh-find-all-conversations-actions{display:flex;gap:4px;flex-wrap:wrap}.dsh-find-all-conversations-help{flex:none;margin-left:auto;color:var(--dsw-alias-label-tertiary)}.dsh-find-all-conversations-help-content{flex:0 1 auto;min-height:0;max-height:160px;padding:0 16px 12px;overflow-y:auto;font-size:12px;line-height:18px;color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere}.dsh-find-all-conversations-help-content[hidden]{display:none}.dsh-find-all-conversations-help-content p{margin:6px 0 0}.dsh-find-all-conversations-match{color:inherit;background:var(--dsw-alias-state-business-tertiary);font-weight:600}.dsh-find-all-conversations-row{display:flex;flex-direction:column;align-items:stretch;flex:none;width:100%;min-width:0;max-width:100%;min-height:48px;box-sizing:border-box;border:none;border-radius:var(--dsw-radius-lg);padding:4px 8px;background:transparent;cursor:pointer;text-align:left;color:var(--dsw-alias-label-primary);font-family:inherit}.dsh-find-all-conversations-row:not(.dsh-find-all-conversations-archived-row):hover,.dsh-find-all-conversations-row:not(.dsh-find-all-conversations-archived-row)[aria-current=true]{background:var(--dsw-alias-interactive-bg-hover)}.dsh-find-all-conversations-row:focus-visible{outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px}.dsh-find-all-conversations-archived-row{cursor:default}.dsh-find-all-conversations-row-heading{display:flex;align-items:center;flex-wrap:wrap;gap:6px;min-width:0;max-width:100%}.dsh-find-all-conversations-row-heading>.dsh-find-all-conversations-title{flex:1;min-width:0}.dsh-find-all-conversations-archive-label{flex:none;font-size:12px;line-height:17px;color:var(--dsw-alias-label-tertiary)}.dsh-find-all-conversations-restore{flex:none}.dsh-find-all-conversations-row-error{min-width:0;max-width:100%;font-size:12px;line-height:17px;color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere}.dsh-find-all-conversations-title{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:14px;line-height:20px;font-weight:400}.dsh-find-all-conversations-meta{display:flex;align-items:center;gap:6px;min-width:0;min-height:17px}.dsh-find-all-conversations-info,.dsh-find-all-conversations-snippet{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px;line-height:17px}.dsh-find-all-conversations-info{flex:none;max-width:40%;color:var(--dsw-alias-label-tertiary)}.dsh-find-all-conversations-info:only-child{max-width:100%}.dsh-find-all-conversations-snippet{flex:1;min-width:0;color:var(--dsw-alias-label-secondary)}.dsh-find-all-about{max-height:100%;font-family:var(--dsw-font-family)}.dsh-find-all-about-content{min-height:0;overflow:auto}.dsh-find-all-about-details{display:flex;flex-direction:column;gap:16px;color:var(--dsw-alias-label-primary);font:13px/20px var(--dsw-font-family);overflow-wrap:anywhere}.dsh-find-all-about-details p{margin:0}.dsh-find-all-about-details h3{margin:0 0 6px;font:500 13px/20px var(--dsw-font-family)}.dsh-find-all-about-details a{color:var(--dsw-alias-state-business-primary);text-underline-offset:3px}.dsh-find-all-about-links{display:flex;flex-wrap:wrap;gap:6px 16px}.dsh-find-all-about-group{display:flex;align-items:center;flex-wrap:wrap;gap:6px 10px}.dsh-find-all-about-status{color:var(--dsw-alias-label-secondary)}.dsh-find-all-about-details :focus-visible{outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:2px}::highlight(" + HL_ALL + "){background-color:rgba(245,197,24,.42)}::highlight(" + HL_CUR + "){background-color:#f5a623;color:#141414}";
6298
6642
  }
6299
6643
  function injectCss() {
6300
6644
  if (typeof document === "undefined") return;
@@ -6428,15 +6772,18 @@ function matchAnchorRect(range) {
6428
6772
  }
6429
6773
  return null;
6430
6774
  }
6775
+ function matchLineMargin(range, rect) {
6776
+ var lineHeight = window.getComputedStyle(range.startContainer.parentElement).lineHeight;
6777
+ var margin = /^\d+(?:\.\d+)?px$/.test(lineHeight) ? parseFloat(lineHeight) : rect.height;
6778
+ return Number.isFinite(margin) && margin > 0 ? margin : rect.height;
6779
+ }
6431
6780
  function matchScrollPlan(range, scroll, viewport, bar, center) {
6432
6781
  var rect = matchAnchorRect(range);
6433
6782
  if (!rect) return null;
6434
6783
  var current = scroll.scrollTop, maximum = Math.max(0, scroll.scrollHeight - scroll.clientHeight);
6435
6784
  var bands = [[viewport.top, viewport.bottom]], margin = 0;
6436
6785
  if (center) {
6437
- var lineHeight = window.getComputedStyle(range.startContainer.parentElement).lineHeight;
6438
- margin = /^\d+(?:\.\d+)?px$/.test(lineHeight) ? parseFloat(lineHeight) : rect.height;
6439
- if (!Number.isFinite(margin) || margin <= 0) margin = rect.height;
6786
+ margin = matchLineMargin(range, rect);
6440
6787
  }
6441
6788
  if (bar && rect.right > bar.left && rect.left < bar.right && bar.bottom > viewport.top && bar.top < viewport.bottom) {
6442
6789
  bands = [
@@ -6647,7 +6994,8 @@ function activateLoadedTurn(target, store, preferredTurn, exactOnly) {
6647
6994
  return !target.root.contains(nav) && (label === "Turn navigation" || label === "\u8F6E\u6B21\u5BFC\u822A");
6648
6995
  });
6649
6996
  if (!navs.length) return exactOnly ? null : false;
6650
- if (navs.length !== 1 || !visible(navs[0])) return false;
6997
+ if (navs.length !== 1) return false;
6998
+ if (!visible(navs[0])) return exactOnly && !navs[0].querySelector("button") ? null : false;
6651
6999
  var loaded = /* @__PURE__ */ new Set();
6652
7000
  Array.prototype.forEach.call(target.root.querySelectorAll("[data-chat-anchor-key][data-chat-turn]"), function(row) {
6653
7001
  var key = row.getAttribute("data-chat-node-key") || row.getAttribute("data-chat-anchor-key");
@@ -6939,13 +7287,15 @@ function navigateToRange(range) {
6939
7287
  var origin = state.origin, token = state.navigationToken, queryToken = state.queryToken, query = state.query, started = Date.now();
6940
7288
  var dataHit = state.scope === "whole" ? state.hits[state.index] : null;
6941
7289
  var selection = state.selection, activated = /* @__PURE__ */ new Set(), announceReturn = false, statusApplied = false;
6942
- var transferred = false, directAttempted = false, corrections = 0, previous = null, stable = 0;
7290
+ var transferred = false, directAttempted = false, corrections = 0, previous = null, stable = 0, navigationPhase = "navigation-loading";
6943
7291
  function retry() {
6944
7292
  state.navigationTimer = setTimeout(check, 100);
6945
7293
  }
6946
- function fail() {
6947
- recordFailure("jump", "render");
7294
+ function fail(code) {
7295
+ var reason = diagnosticCode(code || navigationPhase);
7296
+ recordFailure("jump", reason);
6948
7297
  setStatus(L2.matchRevealFailed, false);
7298
+ state.status.title = L2.matchRevealFailed + " (" + reason + ")";
6949
7299
  if (state.announcement) state.announcement.textContent = L2.matchRevealFailed;
6950
7300
  }
6951
7301
  function check() {
@@ -6983,6 +7333,7 @@ function navigateToRange(range) {
6983
7333
  var geometry = attached && !concealed && matchAnchorRect(current);
6984
7334
  if (attached && (!geometry || concealed)) revealMatchRange(target, current, activated);
6985
7335
  if (!geometry) {
7336
+ navigationPhase = "navigation-geometry";
6986
7337
  previous = null;
6987
7338
  stable = 0;
6988
7339
  retry();
@@ -6992,6 +7343,7 @@ function navigateToRange(range) {
6992
7343
  paint();
6993
7344
  var viewport = readingViewport(target), landing = matchLanding(current, viewport);
6994
7345
  if (!landing) {
7346
+ navigationPhase = "navigation-viewport";
6995
7347
  retry();
6996
7348
  return;
6997
7349
  }
@@ -6999,11 +7351,12 @@ function navigateToRange(range) {
6999
7351
  var row = current.startContainer.parentElement.closest("[data-chat-turn]");
7000
7352
  var turn = row && row.getAttribute("data-chat-turn");
7001
7353
  if (directAttempted) {
7002
- fail();
7354
+ fail("navigation-reversed");
7003
7355
  return;
7004
7356
  }
7005
7357
  var handoff = turn ? activateLoadedTurn(target, store, turn, true) : null;
7006
7358
  if (handoff === false) {
7359
+ navigationPhase = "navigation-control";
7007
7360
  retry();
7008
7361
  return;
7009
7362
  }
@@ -7018,7 +7371,7 @@ function navigateToRange(range) {
7018
7371
  }
7019
7372
  if (!landing.settled) {
7020
7373
  if (corrections >= 2) {
7021
- fail();
7374
+ fail("navigation-reversed");
7022
7375
  return;
7023
7376
  }
7024
7377
  corrections++;
@@ -7062,6 +7415,7 @@ function navigateToRange(range) {
7062
7415
  }) ? stable + 1 : 0;
7063
7416
  previous = sample;
7064
7417
  if (stable < 2) {
7418
+ navigationPhase = "navigation-settling";
7065
7419
  retry();
7066
7420
  return;
7067
7421
  }
@@ -7385,10 +7739,7 @@ var state = {
7385
7739
  positionFrame: null,
7386
7740
  positionOwner: null,
7387
7741
  manualPosition: null,
7388
- drag: null,
7389
- dragHandle: null,
7390
- positionControls: null,
7391
- suppressMoveClick: false
7742
+ drag: null
7392
7743
  };
7393
7744
  function diagnosticCode(code) {
7394
7745
  switch (code) {
@@ -7428,6 +7779,38 @@ function diagnosticCode(code) {
7428
7779
  return "tool-projection-empty";
7429
7780
  case "custom-tool-projection-unverified":
7430
7781
  return "custom-tool-projection-unverified";
7782
+ case "user-projection-unavailable":
7783
+ return "user-projection-unavailable";
7784
+ case "user-session-unavailable":
7785
+ return "user-session-unavailable";
7786
+ case "user-renderer-unavailable":
7787
+ return "user-renderer-unavailable";
7788
+ case "user-transform-failed":
7789
+ return "user-transform-failed";
7790
+ case "invalid-user-facts":
7791
+ return "invalid-user-facts";
7792
+ case "invalid-user-projection":
7793
+ return "invalid-user-projection";
7794
+ case "unsupported-user-node":
7795
+ return "unsupported-user-node";
7796
+ case "user-attachment-unprojected":
7797
+ return "user-attachment-unprojected";
7798
+ case "search-content-rule-failed":
7799
+ return "search-content-rule-failed";
7800
+ case "projection-failed":
7801
+ return "projection-failed";
7802
+ case "navigation-loading":
7803
+ return "navigation-loading";
7804
+ case "navigation-geometry":
7805
+ return "navigation-geometry";
7806
+ case "navigation-viewport":
7807
+ return "navigation-viewport";
7808
+ case "navigation-control":
7809
+ return "navigation-control";
7810
+ case "navigation-reversed":
7811
+ return "navigation-reversed";
7812
+ case "navigation-settling":
7813
+ return "navigation-settling";
7431
7814
  case "render":
7432
7815
  return "render";
7433
7816
  case "position":
@@ -7474,7 +7857,10 @@ function diagnosticState() {
7474
7857
  readComplete: snapshot ? snapshot.readComplete === true : null,
7475
7858
  coverageComplete: snapshot ? snapshot.coverageComplete === true : null,
7476
7859
  projectionComplete: snapshot ? snapshot.projectionComplete === true : null,
7477
- selectedProjectionComplete: snapshot ? selectedProjectionComplete(snapshot) : null
7860
+ selectedProjectionComplete: snapshot ? selectedProjectionComplete(snapshot) : null,
7861
+ projectionCodes: snapshot ? [...new Set(selectedHistoryErrors(snapshot).map(function(error) {
7862
+ return diagnosticCode(error.code);
7863
+ }))] : []
7478
7864
  },
7479
7865
  scan: {
7480
7866
  busy: !!state.scanBusy,
@@ -7513,7 +7899,7 @@ async function copyDiagnostics() {
7513
7899
  feedback.textContent = L2.copyingDiagnostics;
7514
7900
  var copied = false;
7515
7901
  try {
7516
- var summary = { schemaVersion: 1, pluginVersion: "0.1.12", current: diagnosticState(), lastFailure: state.lastFailure };
7902
+ var summary = { schemaVersion: 1, pluginVersion: "0.1.14", current: diagnosticState(), lastFailure: state.lastFailure };
7517
7903
  copied = typeof state.writeClipboard === "function" && await state.writeClipboard(JSON.stringify(summary, null, 2)) === true;
7518
7904
  } catch (error) {
7519
7905
  }
@@ -7565,7 +7951,8 @@ function positionBar() {
7565
7951
  }
7566
7952
  var avoid = state.avoidMatchRange && rangeRect(state.avoidMatchRange);
7567
7953
  if (avoid && left < avoid.right && left + box.width > avoid.left && top < avoid.bottom && top + box.height > avoid.top) {
7568
- var choices = [{ left, top: avoid.bottom + 8 }, { left, top: avoid.top - box.height - 8 }, { left: avoid.left - box.width - 8, top }, { left: avoid.right + 8, top }].filter(function(p) {
7954
+ var verticalGap = 8 + matchLineMargin(state.avoidMatchRange, avoid);
7955
+ var choices = [{ left, top: avoid.bottom + verticalGap }, { left, top: avoid.top - box.height - verticalGap }, { left: avoid.left - box.width - 8, top }, { left: avoid.right + 8, top }].filter(function(p) {
7569
7956
  return p.left >= leftEdge && p.left + box.width <= rightEdge && p.top >= topEdge && p.top + box.height <= bottomEdge;
7570
7957
  });
7571
7958
  choices.sort(function(a, b) {
@@ -7605,67 +7992,70 @@ function moveBarBy(x, y) {
7605
7992
  state.manualPosition = { left: box.left + x, top: box.top + y };
7606
7993
  scheduleBarPosition();
7607
7994
  }
7608
- function buildPositionControls(controls, bar) {
7609
- var moves = document.createElement("div");
7610
- moves.className = "position-controls";
7611
- moves.id = BAR_ID + "-position";
7612
- moves.hidden = true;
7613
- var handle = button(L2.move, "M9 5h.01M15 5h.01M9 12h.01M15 12h.01M9 19h.01M15 19h.01", function(event) {
7614
- if (event.detail && state.suppressMoveClick) {
7615
- state.suppressMoveClick = false;
7616
- return;
7617
- }
7618
- moves.hidden = !moves.hidden;
7619
- handle.setAttribute("aria-expanded", String(!moves.hidden));
7620
- scheduleBarPosition();
7995
+ function buildMoveHeader(bar, controls) {
7996
+ var header = document.createElement("div");
7997
+ header.className = "move-header";
7998
+ header.tabIndex = 0;
7999
+ header.setAttribute("role", "group");
8000
+ header.setAttribute("aria-label", L2.move);
8001
+ header.title = L2.move;
8002
+ var actions = document.createElement("div");
8003
+ actions.className = "move-actions";
8004
+ var reset = button(L2.resetPosition, "M3 10a9 9 0 1 1 2 8M3 4v6h6", resetBarPosition);
8005
+ var closeBtn = button(L2.close, "M18 6 6 18M6 6l12 12", close);
8006
+ [reset, closeBtn].forEach(function(action) {
8007
+ action.addEventListener("pointerdown", function(event) {
8008
+ event.stopPropagation();
8009
+ });
7621
8010
  });
7622
- handle.className = "drag-handle";
7623
- handle.setAttribute("aria-expanded", "false");
7624
- handle.setAttribute("aria-controls", moves.id);
7625
- handle.addEventListener("pointerdown", function(event) {
8011
+ actions.append(reset, closeBtn);
8012
+ var grip = document.createElement("span");
8013
+ grip.className = "move-grip";
8014
+ grip.setAttribute("aria-hidden", "true");
8015
+ header.append(grip, controls, actions);
8016
+ header.addEventListener("pointerdown", function(event) {
8017
+ if (event.target.closest("input, button, select, textarea, a, [contenteditable]")) return;
7626
8018
  state.avoidMatchRange = null;
7627
8019
  if (!event.isPrimary || event.button !== 0 || state.drag || !positionBar()) return;
7628
- state.suppressMoveClick = false;
7629
8020
  try {
7630
- handle.setPointerCapture(event.pointerId);
8021
+ header.setPointerCapture(event.pointerId);
7631
8022
  } catch (error) {
7632
8023
  return;
7633
8024
  }
7634
8025
  var box = state.bar.getBoundingClientRect();
7635
- state.drag = { id: event.pointerId, handle, x: event.clientX, y: event.clientY, left: box.left, top: box.top };
8026
+ state.drag = { id: event.pointerId, handle: header, x: event.clientX, y: event.clientY, left: box.left, top: box.top, moved: false };
7636
8027
  event.preventDefault();
7637
8028
  });
7638
- handle.addEventListener("pointermove", function(event) {
8029
+ header.addEventListener("pointermove", function(event) {
7639
8030
  var drag = state.drag;
7640
8031
  if (!drag || event.pointerId !== drag.id) return;
7641
8032
  var x = event.clientX - drag.x, y = event.clientY - drag.y;
7642
- if (!state.suppressMoveClick && Math.abs(x) + Math.abs(y) < 4) return;
7643
- state.suppressMoveClick = true;
8033
+ if (!drag.moved && Math.abs(x) + Math.abs(y) < 4) return;
8034
+ drag.moved = true;
7644
8035
  state.bar.setAttribute("data-dragging", "");
7645
8036
  state.manualPosition = { left: drag.left + x, top: drag.top + y };
7646
8037
  scheduleBarPosition();
7647
8038
  });
7648
8039
  ["pointerup", "pointercancel", "lostpointercapture"].forEach(function(type) {
7649
- handle.addEventListener(type, finishBarDrag);
8040
+ header.addEventListener(type, finishBarDrag);
7650
8041
  });
7651
- moves.appendChild(button(L2.moveLeft, "m14 6-6 6 6 6", function() {
7652
- moveBarBy(-32, 0);
7653
- }));
7654
- moves.appendChild(button(L2.moveRight, "m10 6 6 6-6 6", function() {
7655
- moveBarBy(32, 0);
7656
- }));
7657
- moves.appendChild(button(L2.moveUp, "m6 14 6-6 6 6", function() {
7658
- moveBarBy(0, -32);
7659
- }));
7660
- moves.appendChild(button(L2.moveDown, "m6 10 6 6 6-6", function() {
7661
- moveBarBy(0, 32);
7662
- }));
7663
- var reset = button(L2.resetPosition, "M3 10a9 9 0 1 1 2 8M3 4v6h6", resetBarPosition);
7664
- moves.appendChild(reset);
7665
- state.dragHandle = handle;
7666
- state.positionControls = moves;
7667
- controls.appendChild(handle);
7668
- bar.appendChild(moves);
8042
+ header.addEventListener("keydown", function(event) {
8043
+ if (event.target !== event.currentTarget || event.altKey || event.ctrlKey || event.metaKey || event.isComposing) return;
8044
+ if (event.key === " ") {
8045
+ event.preventDefault();
8046
+ return;
8047
+ }
8048
+ var movement = { ArrowLeft: [-32, 0], ArrowRight: [32, 0], ArrowUp: [0, -32], ArrowDown: [0, 32] }[event.key];
8049
+ if (movement) {
8050
+ event.preventDefault();
8051
+ moveBarBy(movement[0], movement[1]);
8052
+ } else if (event.key === "Home") {
8053
+ event.preventDefault();
8054
+ resetBarPosition();
8055
+ }
8056
+ });
8057
+ bar.appendChild(header);
8058
+ return closeBtn;
7669
8059
  }
7670
8060
  function scheduleBarPosition() {
7671
8061
  if (!isOpen() || state.positionFrame !== null) return;
@@ -7919,10 +8309,10 @@ function renderUpdateCheck() {
7919
8309
  if (!state.updateBtn) return;
7920
8310
  state.updateBtn.setAttribute("aria-disabled", state.updateTask ? "true" : "false");
7921
8311
  if (state.updateBtn.textContent !== L2.checkUpdate) state.updateBtn.textContent = L2.checkUpdate;
7922
- var result = state.updateResult;
7923
- var message = state.updateTask ? L2.checkingUpdate : !result ? "" : result.status === "available" ? L2.updateAvailable.replace("{v}", result.version) : result.status === "current" ? L2.updateCurrent : result.status === "ahead" ? L2.updateAhead.replace("{v}", result.version) : L2.updateFailed;
8312
+ var result2 = state.updateResult;
8313
+ var message = state.updateTask ? L2.checkingUpdate : !result2 ? "" : result2.status === "available" ? L2.updateAvailable.replace("{v}", result2.version) : result2.status === "current" ? L2.updateCurrent : result2.status === "ahead" ? L2.updateAhead.replace("{v}", result2.version) : L2.updateFailed;
7924
8314
  if (state.updateStatus.textContent !== message) state.updateStatus.textContent = message;
7925
- state.updateGuide.hidden = !result || result.status !== "available" || !!state.updateTask;
8315
+ state.updateGuide.hidden = !result2 || result2.status !== "available" || !!state.updateTask;
7926
8316
  }
7927
8317
  function cancelUpdateCheck() {
7928
8318
  var task = state.updateTask;
@@ -7940,8 +8330,8 @@ async function checkForUpdates() {
7940
8330
  state.updateResult = null;
7941
8331
  renderUpdateCheck();
7942
8332
  try {
7943
- var result = await checkLatestVersion("0.1.12", task.signal);
7944
- if (state.mounted && state.updateTask === task) state.updateResult = result;
8333
+ var result2 = await checkLatestVersion("0.1.14", task.signal);
8334
+ if (state.mounted && state.updateTask === task) state.updateResult = result2;
7945
8335
  } catch (error) {
7946
8336
  if (state.mounted && state.updateTask === task) state.updateResult = { status: "failed" };
7947
8337
  } finally {
@@ -8192,6 +8582,21 @@ function activateMatch(index) {
8192
8582
  navigateToRange(range);
8193
8583
  }
8194
8584
  function scheduleRescan() {
8585
+ if (state.scope === "whole" && state.ranges.some(Boolean)) {
8586
+ var hit = state.hits[state.index], target = state.target, store = state.adapter?.nodes(target);
8587
+ var node = hit && sourceNode(hit.source, store), mapped = node && mapProjectedDocument(hit.source, node, sourceRows(target, node), hit.blockIndex);
8588
+ var range = mapped?.blocks && rangeForBlock(mapped.blocks[hit.blockIndex], hit.start, hit.end);
8589
+ if (!range || range.toString() !== hit.text) {
8590
+ cancelNavigation();
8591
+ state.ranges = [];
8592
+ paint();
8593
+ state.sourceNotice = ZH ? "\u6B64\u6D88\u606F\u7684\u663E\u793A\u5DF2\u53D8\u5316\uFF0C\u539F\u9AD8\u4EAE\u5DF2\u6E05\u9664\uFF1B\u5168\u6587\u8BA1\u6570\u4ECD\u6309\u9ED8\u8BA4\u663E\u793A\u8BA1\u7B97\u3002" : "This message display changed; its highlight was cleared. Whole-history counts still use the default display.";
8594
+ historyStatus();
8595
+ } else {
8596
+ state.ranges[state.index] = range;
8597
+ paint();
8598
+ }
8599
+ }
8195
8600
  if (state.scope === "page") {
8196
8601
  state.pageDirty = true;
8197
8602
  cancelCountEdit(false);
@@ -8247,7 +8652,9 @@ function schedulePageIn() {
8247
8652
  }, 150);
8248
8653
  }
8249
8654
  function searchContentChanged() {
8655
+ cancelNavigation();
8250
8656
  cancelPageIn();
8657
+ state.historyRevision = null;
8251
8658
  state.history = null;
8252
8659
  state.historySnapshot = null;
8253
8660
  state.scanQuery = null;
@@ -8278,9 +8685,16 @@ function historyStatus() {
8278
8685
  if (part) text += (text ? " \xB7 " : "") + part;
8279
8686
  }
8280
8687
  if (state.capped) add(L2.cap.replace("{n}", String(MAX_MATCHES)));
8688
+ if (snapshot?.documents?.some(function(doc) {
8689
+ return doc.defaultMasked && contentTypeEnabled(sourceContentType(doc));
8690
+ })) add(ZH ? "\u5168\u6587\u8BA1\u6570\u4F7F\u7528\u9ED8\u8BA4\u906E\u6321\u6587\u5B57\uFF1B\u5C55\u5F00\u53EA\u6539\u53D8\u5F53\u524D\u6D88\u606F\u663E\u793A\u3002" : "Whole-history counts use default masked text; revealing changes only the displayed message.");
8281
8691
  add(state.sourceNotice);
8282
8692
  if (state.liveCount) add((ZH ? "\u5F53\u524D\u6B63\u5728\u751F\u6210\u7684\u56DE\u590D\u4E2D\u53E6\u6709 " : "The reply being generated contains ") + state.liveCount + (state.liveCapped ? "+" : "") + (ZH ? " \u4E2A\u5339\u914D\u3002" : " additional matches."));
8283
8693
  setStatus(text, state.paging || state.scanBusy);
8694
+ var errorCodes = [...new Set(relevantErrors.map(function(error) {
8695
+ return diagnosticCode(error.code);
8696
+ }))].join(", ");
8697
+ state.status.title = text + (errorCodes ? " (" + errorCodes + ")" : "");
8284
8698
  }
8285
8699
  function startPageIn() {
8286
8700
  if (state.scope !== "whole" || !state.query || !isOpen()) return;
@@ -8292,7 +8706,7 @@ function startPageIn() {
8292
8706
  var remote = state.remote && state.remote.session;
8293
8707
  if (!state.projector || !remote || typeof remote.follow !== "function" || typeof remote.page !== "function") {
8294
8708
  recordFailure("capability", "unsupported-host");
8295
- setStatus(ZH ? "\u5B8C\u6574\u4F1A\u8BDD\u641C\u7D22\u4E0D\u53EF\u7528\uFF1A\u5BBF\u4E3B\u7F3A\u5C11\u5B8C\u6574\u5386\u53F2\u63A5\u53E3\u3002\u8BF7\u5207\u6362\u5230\u5DF2\u52A0\u8F7D\u5185\u5BB9" : "Whole-session search unavailable: complete-history API missing. Switch to Loaded content", false);
8709
+ setStatus(ZH ? "\u5B8C\u6574\u4F1A\u8BDD\u641C\u7D22\u4E0D\u53EF\u7528\uFF1A\u5BBF\u4E3B\u7F3A\u5C11\u5386\u53F2\u8BFB\u53D6\u6216\u6587\u672C\u6295\u5F71\u80FD\u529B\u3002\u8BF7\u5207\u6362\u5230\u5DF2\u52A0\u8F7D\u5185\u5BB9" : "Whole-session search unavailable: history or text projection capability missing. Switch to Loaded content", false);
8296
8710
  return;
8297
8711
  }
8298
8712
  if (state.history && state.historySnapshot && state.historySnapshot.sessionId === target.id && !["cancelled", "error"].includes(state.historySnapshot.status)) {
@@ -8300,6 +8714,9 @@ function startPageIn() {
8300
8714
  return;
8301
8715
  }
8302
8716
  var token = ++state.pageToken, errorCount = 0;
8717
+ var nodeStore = state.adapter.nodes(target);
8718
+ var revision = nodeStore ? createHistoryRevisionTracker(nodeStore) : null;
8719
+ state.historyRevision = revision;
8303
8720
  state.paging = true;
8304
8721
  state.sourceNotice = "";
8305
8722
  state.historySnapshot = null;
@@ -8307,6 +8724,10 @@ function startPageIn() {
8307
8724
  var project = state.searchContent ? state.searchContent.createProjector(state.projector) : state.projector;
8308
8725
  state.history = createHistoryReader({ remote: state.remote, sessionId: target.id, generation: token, project, onUpdate: function(snapshot) {
8309
8726
  if (token !== state.pageToken || state.target !== target || !isOpen() || state.scope !== "whole" || !state.adapter.valid(target)) return;
8727
+ if (revision?.check(state.adapter.nodes(target), snapshot)) {
8728
+ searchContentChanged();
8729
+ return;
8730
+ }
8310
8731
  state.historySnapshot = snapshot;
8311
8732
  state.paging = ["reading", "projecting", "idle"].includes(snapshot.status);
8312
8733
  if (snapshot.status !== "cancelled" && snapshot.errors.length > errorCount) {
@@ -8481,7 +8902,7 @@ async function navigateHistoryHit(hit) {
8481
8902
  var target = state.target, source = hit.source, token = state.navigationToken, queryToken = state.queryToken;
8482
8903
  var face = state.adapter.face(target), store = state.adapter.nodes(target), activated = /* @__PURE__ */ new Set();
8483
8904
  function current() {
8484
- return token === state.navigationToken && queryToken === state.queryToken && state.target === target && state.scope === "whole" && isOpen() && state.adapter.valid(target) && state.adapter.face(target) === face && state.hits[state.index] === hit;
8905
+ return token === state.navigationToken && queryToken === state.queryToken && state.target === target && state.scope === "whole" && isOpen() && state.adapter.valid(target) && state.adapter.face(target) === face && state.adapter.nodes(target) === store && state.hits[state.index] === hit;
8485
8906
  }
8486
8907
  function pause() {
8487
8908
  return new Promise((resolve) => setTimeout(resolve, 35));
@@ -8542,8 +8963,6 @@ function syncTarget(target, passive) {
8542
8963
  var owner = state.positionOwner;
8543
8964
  if (owner && (owner.id !== selected.id || owner.panel !== selected.panel)) {
8544
8965
  resetBarPosition();
8545
- if (state.positionControls) state.positionControls.hidden = true;
8546
- if (state.dragHandle) state.dragHandle.setAttribute("aria-expanded", "false");
8547
8966
  }
8548
8967
  state.positionOwner = { id: selected.id, panel: selected.panel };
8549
8968
  }
@@ -8565,10 +8984,9 @@ function syncTarget(target, passive) {
8565
8984
  discardOrigin();
8566
8985
  cancelPageIn();
8567
8986
  stopObserver();
8568
- if (!selected || !state.target || selected.id !== state.target.id) {
8569
- state.history = null;
8570
- state.historySnapshot = null;
8571
- }
8987
+ state.historyRevision = null;
8988
+ state.history = null;
8989
+ state.historySnapshot = null;
8572
8990
  state.target = selected;
8573
8991
  state.sessionId = selected ? selected.id : null;
8574
8992
  if (!isOpen()) return;
@@ -8578,10 +8996,17 @@ function syncTarget(target, passive) {
8578
8996
  startObserver();
8579
8997
  if (selected && state.scope === "whole" && state.query) schedulePageIn();
8580
8998
  }
8999
+ function checkHistoryContent() {
9000
+ var snapshot = state.historySnapshot, store = state.adapter?.nodes(state.target);
9001
+ if (state.scope === "whole" && snapshot?.readComplete && state.historyRevision?.check(store, snapshot)) searchContentChanged();
9002
+ }
8581
9003
  function watchSession() {
8582
9004
  clearInterval(state.sessionTimer);
8583
9005
  state.sessionTimer = setInterval(function() {
8584
- if (isOpen()) syncTarget(null, true);
9006
+ if (isOpen()) {
9007
+ syncTarget(null, true);
9008
+ checkHistoryContent();
9009
+ }
8585
9010
  }, SESSION_POLL_MS);
8586
9011
  }
8587
9012
  function stopWatchingSession() {
@@ -8661,8 +9086,10 @@ function buildBar() {
8661
9086
  var bar = document.createElement("div");
8662
9087
  bar.id = BAR_ID;
8663
9088
  bar.setAttribute("role", "search");
9089
+ bar.setAttribute("aria-label", L2.findTitle);
8664
9090
  var controls = document.createElement("div");
8665
9091
  controls.className = "controls";
9092
+ var closeBtn = buildMoveHeader(bar, controls);
8666
9093
  var navigation = document.createElement("div");
8667
9094
  navigation.className = "navigation-controls";
8668
9095
  var input = document.createElement("input");
@@ -8817,7 +9244,6 @@ function buildBar() {
8817
9244
  cancelPageIn();
8818
9245
  setStatus(L2.incomplete, false);
8819
9246
  });
8820
- buildPositionControls(controls, bar);
8821
9247
  controls.appendChild(input);
8822
9248
  controls.appendChild(countState);
8823
9249
  controls.appendChild(count);
@@ -8854,7 +9280,7 @@ function buildBar() {
8854
9280
  updateCommand.className = "history-command update-command";
8855
9281
  var currentVersion = document.createElement("p");
8856
9282
  currentVersion.className = "update-version";
8857
- currentVersion.textContent = L2.currentVersion + " 0.1.12";
9283
+ currentVersion.textContent = L2.currentVersion + " 0.1.14";
8858
9284
  var updateBtn = document.createElement("button");
8859
9285
  updateBtn.type = "button";
8860
9286
  updateBtn.className = "check-update";
@@ -8935,8 +9361,6 @@ function buildBar() {
8935
9361
  state.returnBtn = returnBtn;
8936
9362
  navigation.appendChild(returnBtn);
8937
9363
  navigation.appendChild(contentBtn);
8938
- var closeBtn = button(L2.close, "M18 6 6 18M6 6l12 12", close);
8939
- navigation.appendChild(closeBtn);
8940
9364
  contentPanel.addEventListener("keydown", function(event) {
8941
9365
  if (event.key !== "Tab") return;
8942
9366
  if (event.shiftKey && event.target === scopeInputs[state.scope]) {
@@ -8949,7 +9373,6 @@ function buildBar() {
8949
9373
  }
8950
9374
  });
8951
9375
  controls.appendChild(navigation);
8952
- bar.insertBefore(controls, bar.firstChild);
8953
9376
  bar.appendChild(countHint);
8954
9377
  bar.appendChild(status);
8955
9378
  bar.appendChild(countLive);
@@ -9030,9 +9453,6 @@ function close() {
9030
9453
  stopWatchingSession();
9031
9454
  stopBarPositioning();
9032
9455
  state.manualPosition = state.positionOwner = null;
9033
- state.suppressMoveClick = false;
9034
- if (state.positionControls) state.positionControls.hidden = true;
9035
- if (state.dragHandle) state.dragHandle.setAttribute("aria-expanded", "false");
9036
9456
  if (state.bar) {
9037
9457
  state.bar.style.display = "none";
9038
9458
  state.bar.removeAttribute("data-positioned");
@@ -9085,12 +9505,21 @@ function apply(ctx) {
9085
9505
  });
9086
9506
  });
9087
9507
  try {
9088
- state.projector = createProjector(ui, react, document);
9508
+ var userBinding = typeof ui.projectUserText === "function" ? null : createUserProjectionBinding(ctx, searchContentChanged);
9509
+ state.projector = createProjector(ui, react, document, userBinding?.project);
9510
+ if (userBinding) ctx.effect(function() {
9511
+ return function() {
9512
+ userBinding.dispose();
9513
+ };
9514
+ });
9089
9515
  } catch (error) {
9090
9516
  state.projector = null;
9091
9517
  }
9092
9518
  state.adapter = createHostAdapter(ctx, function() {
9093
- if (isOpen()) syncTarget(null, true);
9519
+ if (isOpen()) {
9520
+ syncTarget(null, true);
9521
+ checkHistoryContent();
9522
+ }
9094
9523
  });
9095
9524
  if (typeof ctx.inject === "function") state.conversationSearch = installConversationSearch(ctx, react, ui, {
9096
9525
  closeFind: close,
@@ -9329,7 +9758,7 @@ function apply(ctx) {
9329
9758
  if (state.bar) state.bar.remove();
9330
9759
  if (state.contentPanel) state.contentPanel.remove();
9331
9760
  if (state.announcement) state.announcement.remove();
9332
- state.announcement = state.returnBtn = state.dragHandle = state.positionControls = null;
9761
+ state.announcement = state.returnBtn = null;
9333
9762
  state.diagnosticBtn = state.diagnosticFeedback = state.writeClipboard = null;
9334
9763
  state.updateBtn = state.updateStatus = state.updateGuide = state.updateResult = null;
9335
9764
  var style = document.querySelector('style[data-plugin-css="dsh-find-all/bar.css"]');