@abelxiaoxing/cadence 2.0.38 → 2.0.40

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.
@@ -205,3 +205,33 @@ A parent session may record a whole batch of tool results together, so those tim
205
205
  Long workflows retain earlier steps in readonly pages rather than stopping at a step count.
206
206
  Open **Earlier workflow steps** in the WebUI, **Earlier steps** in native history, or use `cadence_status` with the returned `stepsBefore` as `before`.
207
207
  Route revisions and failed attempts remain visible; a later successful attempt never rewrites their original outcomes.
208
+
209
+ ## Discover active Pi work
210
+
211
+ The unified WebUI sidebar automatically lists active work in this account and state home, including projects you have never selected.
212
+ An interactive terminal must load the Cadence extension: a real model/tool round appears even without `/cadence`, but an idle terminal or idle owner does not.
213
+ Terminal rounds are observe-only; owner turns and workflows retain their actual queue, execution, recovery and settlement phases and existing authorized controls.
214
+ The counts deduplicate projects and sessions, while separate terminal instances and owner work keep their own sources.
215
+
216
+ Click an activity to remember its directory and read the shared Pi session at the observed branch.
217
+ This does not start or associate an owner, grant execution consent or expand workbench Stop.
218
+ If Pi has not flushed its first session file, the page says history is not yet readable; it never invents messages or treats that session as a new draft.
219
+ A different session-directory configuration can leave an activity visible but its history unavailable; Cadence never follows an arbitrary reported session path.
220
+ A fixed observed branch stays fixed until you choose another branch; background discovery cannot take over your open page.
221
+
222
+ Finished activity leaves the list without closing its history page.
223
+ Lost or partial observations are explicitly stale/unknown, not evidence of success or completion; uncertain rows have a short retention window.
224
+ This discovers neither idle terminals nor other accounts/hosts, and does not provide remote control of ordinary CLI Pi.
225
+
226
+ ## Investigating installed packages
227
+
228
+ Cadence research, diagnosis and review remain readonly, but their search roots are defaults rather than a barrier around the checkout.
229
+ Use `read`, `ls`, `grep` and `find`/`glob` with an explicit host path to inspect an installed package; `~` refers to the service account's home.
230
+ Searches include dependency directories and follow symlinks with cycle detection.
231
+ `grep` supports regular expressions by default and `literal: true` for exact text; `find`/`glob` support patterns such as `**/*.{ts,js}`.
232
+ For deep package trees, set `depth` explicitly.
233
+ A result with `nextCursor` is a continuing observation, not a failed search or evidence of absence.
234
+
235
+ Readonly subagents do not have shell or editing tools: use the direct listing, search and read tools rather than a `bash` pipeline.
236
+ Approved implementation workers keep their existing shell and editing tools.
237
+ This distinction preserves execution consent; it is not an OS sandbox or permission to copy credentials or profiles.
@@ -31,3 +31,81 @@ The no-project entry never initializes an SDK session, manufactures a checkout,
31
31
  A technical service-process cwd is not a model/tool workspace.
32
32
  The built same-origin routing covers both HTTP requests and WebSockets, while browser authority and project consent remain distinct from native management capability.
33
33
  New Linux manager tests exercise the no-workspace default; macOS/Windows generated-definition tests are not native-platform execution qualification.
34
+
35
+ ## Maintainer releases from any computer
36
+
37
+ `.github/workflows/publish.yml` publishes through GitHub Actions and npm Trusted Publishing (OIDC).
38
+ Only tag pushes trigger this workflow; there is no branch, pull-request, GitHub Release or manual-dispatch trigger.
39
+ Creating and pushing a stable `vMAJOR.MINOR.PATCH` tag is an explicit publication action; a local tag alone does nothing.
40
+ The workflow is repository-owned, not tied to the developer's computer or Pi session.
41
+ An agent can perform the release steps after an explicit user release request, using authorized GitHub access; it needs no npm token.
42
+ The workflow does not install Cadence globally, restart a service, deploy an application or create a GitHub Release.
43
+
44
+ ### One-time setup
45
+
46
+ 1. Review, commit and push the workflow and its helper/tests to `abelxiaoxing/cadence` on `main` before creating a release tag.
47
+ 2. In GitHub repository **Settings → Environments**, create `npm-release` and restrict deployment to selected tags matching `v*`.
48
+ For deliberately unattended publishing, this dedicated environment must not require approval on every run; review existing organization/environment policies rather than silently removing protections.
49
+ Protect `main` and workflow changes, and use repository rulesets to restrict release-tag creation to trusted maintainers and prevent tag updates/deletion.
50
+ A maintainer allowed to change the publishing workflow or create an eligible release tag is being entrusted with npm publication.
51
+ 3. In the npm package **Settings → Trusted publishing**, add a GitHub Actions publisher with these exact values:
52
+
53
+ | Field | Value |
54
+ | ----------------- | ------------------------------------------------------------- |
55
+ | Organization/user | `abelxiaoxing` |
56
+ | Repository | `cadence` |
57
+ | Workflow filename | `publish.yml` (not its full path) |
58
+ | Environment | `npm-release` |
59
+ | Allowed actions | Enable direct **`npm publish`**, not only `npm stage publish` |
60
+
61
+ Complete the maintainer authentication requested by npm for this one-time trust configuration.
62
+ Existing trust connections must be reviewed; do not revoke another publisher incidentally.
63
+ 4. No `NPM_TOKEN` or `NODE_AUTH_TOKEN` secret is required.
64
+ Account 2FA can remain enabled, including npm's **Require two-factor authentication and disallow tokens** setting: it restricts traditional tokens, not this OIDC publisher.
65
+ Stage-only permission still requires a human to approve each version and is not the unattended route.
66
+ After a successful migration, separately review whether old automation tokens are still needed; this workflow never revokes them.
67
+
68
+ This lane requires GitHub-hosted runners; npm does not currently support self-hosted runners for this trust flow.
69
+ See npm's [Trusted Publishing documentation](https://docs.npmjs.com/trusted-publishers) for current platform and permission requirements.
70
+ The workflow pins its runtimes and third-party actions; review pin updates together with the normal verification gate.
71
+
72
+ ### Release a new version
73
+
74
+ From a clean `main` checkout on any authorized computer:
75
+
76
+ 1. Explicitly choose an unused stable version newer than npm's current `latest`; update `package.json` and regenerate operator/service/Web outputs through the canonical builders.
77
+ Configure the external private disk-backed temporary directory required by the repository's verification instructions.
78
+ 2. Run `bun run verify`, review the candidate, and make the explicitly authorized release commit.
79
+ There is no additional slow/browser/paid-model/service-manager release gate.
80
+ 3. Push that commit to `main`, then create and push its matching annotated tag:
81
+
82
+ ```sh
83
+ git push origin main
84
+ version=$(node -p "require('./package.json').version")
85
+ git tag -a "v$version" -m "Release $version" HEAD
86
+ git push origin "refs/tags/v$version"
87
+ ```
88
+
89
+ These commands publish the selected version; do not use the current already-published version as a test.
90
+ Do not force-move or delete a release tag to repair a failed release.
91
+ 4. Follow **Actions → Publish npm**.
92
+ A successful dispatch or artifact upload is not proof of npm publication.
93
+ The final step verifies registry version/integrity, the `latest` tag and the actual downloaded tarball bytes.
94
+
95
+ The tag must name the checked-out event commit, match `package.json`, and already belong to `main`.
96
+ Pre-release/build-metadata tags, forks, moved/deleted tags, dirty checkouts, existing versions and versions behind the observed `latest` are refused.
97
+ This stable-release lane owns registry, access and dist-tag options; `package.json` must not add a competing `publishConfig`.
98
+
99
+ The preparation job has no OIDC permission.
100
+ It installs the frozen lockfile on its disposable runner, runs the sole gate, and audits a separate real Bun tarball.
101
+ A fresh publish job installs no project dependencies and builds nothing.
102
+ It downloads the immutable artifact by ID, checks its SHA-256 and every body against the clean tagged source, then calls `npm publish` once with lifecycle scripts disabled.
103
+ Only that job receives the OIDC permission.
104
+ No profile, private-state directory or local credential file is copied into either job.
105
+
106
+ Releases are serialized without cancelling an in-progress publish.
107
+ GitHub can replace a pending run when another is queued, so push one release tag at a time and inspect each run's outcome.
108
+ There is no automatic retry of `npm publish`, version bump, unpublish, dist-tag repair or staged-package approval.
109
+ After a failed or interrupted publish, inspect npm before retrying: the registry may have accepted the request despite a lost client reply.
110
+ Confirmation makes bounded readonly observations for propagation and does not convert a failed publish command into a successful command receipt.
111
+ The live-ref/latest checks are not a transaction with other maintainers; an external publication can still race and must be investigated rather than overwritten.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abelxiaoxing/cadence",
3
- "version": "2.0.38",
3
+ "version": "2.0.40",
4
4
  "description": "Conversation-driven Pi workspace: persistent native and WebUI workflows, explicit plan approval, checks and local delivery.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -91,7 +91,9 @@
91
91
  "src/data-shapes.ts",
92
92
  "src/service/checkout-lock.ts",
93
93
  "src/service/liveness.ts",
94
- "src/agent-browser"
94
+ "src/agent-browser",
95
+ "src/activity.ts",
96
+ "src/service/activity-files.ts"
95
97
  ],
96
98
  "pi": {
97
99
  "extensions": [
@@ -0,0 +1,147 @@
1
+ /** Reports only an interactive Pi's real agent lifetime; no presence, owner or control. */
2
+ import { randomUUID } from "node:crypto";
3
+ import { realpathSync } from "node:fs";
4
+ import {
5
+ type ExtensionAPI,
6
+ getAgentDir,
7
+ } from "@earendil-works/pi-coding-agent";
8
+ import {
9
+ ACTIVITY_RENEW_MS,
10
+ ActivityFiles,
11
+ type NativeActivity,
12
+ } from "./service/activity-files.ts";
13
+ import { selfMark } from "./service/liveness.ts";
14
+ import { type FileSnapshot, hash } from "./service/private-files.ts";
15
+ import {
16
+ privateWorkspace,
17
+ resolveWorkspaceAsync,
18
+ stateHomeInside,
19
+ } from "./workspace.ts";
20
+
21
+ export interface ActivityPublisherOptions {
22
+ store?: () => Pick<
23
+ ActivityFiles,
24
+ "scope" | "publish" | "withdraw" | "retireDead"
25
+ >;
26
+ now?: () => number;
27
+ canonical?: (cwd: string, signal: AbortSignal) => string | Promise<string>;
28
+ }
29
+ export function registerActivity(
30
+ pi: ExtensionAPI,
31
+ options: ActivityPublisherOptions = {},
32
+ ): void {
33
+ if (process.env.CADENCE_SUBAGENT_CHILD === "1") return;
34
+ const instance = randomUUID();
35
+ const now = options.now ?? Date.now;
36
+ let active:
37
+ | {
38
+ id: string;
39
+ sessionId: string;
40
+ abort: AbortController;
41
+ record?: NativeActivity;
42
+ saved?: FileSnapshot;
43
+ store?: ReturnType<NonNullable<ActivityPublisherOptions["store"]>>;
44
+ }
45
+ | undefined;
46
+ let timer: ReturnType<typeof setTimeout> | undefined;
47
+ let retired = false;
48
+ const stop = () => {
49
+ clearTimeout(timer);
50
+ timer = undefined;
51
+ const previous = active;
52
+ active = undefined; // Fence callbacks before any filesystem operation.
53
+ previous?.abort.abort();
54
+ try {
55
+ if (previous?.store && previous.saved)
56
+ previous.store.withdraw(instance, previous.saved);
57
+ } catch {
58
+ /* Retain uncertain bytes; discovery reports stale/unknown, not success. */
59
+ }
60
+ };
61
+ pi.on("agent_start", (_event, ctx) => {
62
+ if (retired || ctx.mode !== "tui" || !ctx.hasUI) return;
63
+ try {
64
+ const sessionId = ctx.sessionManager.getSessionId();
65
+ if (active?.sessionId === sessionId) return; // retries/compaction/queued continuation
66
+ stop();
67
+ const cwdAtStart = ctx.cwd,
68
+ sessionScope = hash(ctx.sessionManager.getSessionDir()),
69
+ startedAt = now();
70
+ const current = {
71
+ id: randomUUID(),
72
+ sessionId,
73
+ abort: new AbortController(),
74
+ } as NonNullable<typeof active>;
75
+ active = current;
76
+ // Lifecycle hooks never await publication. One callback at a time; timers
77
+ // neither keep Pi alive nor run after settlement/session replacement.
78
+ const publish = async () => {
79
+ if (active !== current || retired) return;
80
+ try {
81
+ if (!current.store) {
82
+ current.store =
83
+ options.store?.() ?? new ActivityFiles(getAgentDir());
84
+ const resolving = options.canonical
85
+ ? options.canonical(cwdAtStart, current.abort.signal)
86
+ : resolveWorkspaceAsync(cwdAtStart, current.abort.signal).then(
87
+ ({ root, cwd }) => {
88
+ if (privateWorkspace(root) || stateHomeInside(root))
89
+ throw new Error("private-workspace");
90
+ return realpathSync(cwd);
91
+ },
92
+ );
93
+ const cwd =
94
+ typeof resolving === "string" ? resolving : await resolving;
95
+ if (active !== current || retired) return;
96
+ current.store.retireDead(now());
97
+ current.record = {
98
+ schema: "cadence-pi-activity/1",
99
+ instance,
100
+ activity: current.id,
101
+ scope: current.store.scope,
102
+ sessionScope,
103
+ process: selfMark(),
104
+ cwd,
105
+ sessionId,
106
+ leaf: null,
107
+ startedAt,
108
+ renewedAt: now(),
109
+ };
110
+ }
111
+ const record = current.record;
112
+ if (!record) return;
113
+ record.leaf = ctx.sessionManager.getLeafId();
114
+ record.renewedAt = now();
115
+ current.saved = current.store.publish(record, current.saved);
116
+ timer = setTimeout(publish, ACTIVITY_RENEW_MS);
117
+ timer.unref?.();
118
+ } catch {
119
+ /* Observation failures do not fail, cancel or retry Pi work. */
120
+ }
121
+ };
122
+ timer = setTimeout(publish, 0);
123
+ timer.unref?.();
124
+ } catch {
125
+ /* Metadata is optional; no error escapes into Pi. */
126
+ }
127
+ });
128
+ // agent_end is deliberately NOT a settlement signal.
129
+ pi.on("agent_settled", (_event, ctx) => {
130
+ if (!active || retired) return;
131
+ try {
132
+ if (active.sessionId === ctx.sessionManager.getSessionId()) stop();
133
+ } catch {
134
+ // An invalidated public context cannot fail Pi's final notification.
135
+ // Preserve uncertain metadata but never keep renewing an idle report.
136
+ clearTimeout(timer);
137
+ timer = undefined;
138
+ const previous = active;
139
+ active = undefined;
140
+ previous?.abort.abort();
141
+ }
142
+ });
143
+ pi.on("session_shutdown", () => {
144
+ retired = true;
145
+ stop();
146
+ });
147
+ }
package/src/index.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import os from "node:os";
2
2
  import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
3
+ import { registerActivity } from "./activity.ts";
3
4
  import { registerAgentPanel } from "./agent-panel.ts";
4
5
  import { registerCadenceAgentFeed } from "./agent-panel-cadence.ts";
5
6
  import { registerCadenceMode } from "./cadence-mode.ts";
@@ -12,6 +13,7 @@ import { CONFIG_MISSING, startupCardLines } from "./startup-card.ts";
12
13
  * actual host binding belongs to the readonly history shell’s session_start. */
13
14
  export default function register(pi: ExtensionAPI): void {
14
15
  if (process.env.CADENCE_SUBAGENT_CHILD === "1") return;
16
+ registerActivity(pi);
15
17
  registerHistoryShell(pi);
16
18
  registerCadenceMode(pi);
17
19
  // Readonly: notices the browser continuing the session this terminal holds.
@@ -2,5 +2,5 @@
2
2
  export const nativeBuild = {
3
3
  kind: "native",
4
4
  contractHash:
5
- "0e4bbeb78c11fa9948adefea308d4d00c15af7f4879265fc079aad4b021f2324",
5
+ "002b8e5b103844b2237ba13aa27a72344e5bd61b94f96bb41181f53b9dd5a225",
6
6
  } as const;
@@ -116,7 +116,7 @@ function gitArguments(args) {
116
116
  }
117
117
 
118
118
  // src/workspace.ts
119
- import { spawnSync } from "node:child_process";
119
+ import { execFile, spawnSync } from "node:child_process";
120
120
  import { createHash } from "node:crypto";
121
121
  import {
122
122
  closeSync,
@@ -245,6 +245,9 @@ function resolveWorkspace(cwd) {
245
245
  maxBuffer: 8192,
246
246
  windowsHide: true
247
247
  });
248
+ return workspaceResult(actual, result);
249
+ }
250
+ function workspaceResult(actual, result) {
248
251
  const topLevel = result.stdout?.replace(process.platform === "win32" ? /\r?\n$/ : /\n$/, "");
249
252
  if (result.status === 0 && topLevel)
250
253
  return { root: realpathSync(topLevel), cwd: actual };
@@ -2,6 +2,7 @@
2
2
  * not a page number or a replay of an earlier scan. No shell or spill files. */
3
3
  import { constants } from "node:fs";
4
4
  import { lstat, open, opendir, realpath } from "node:fs/promises";
5
+ import { homedir } from "node:os";
5
6
  import { basename, join, matchesGlob, relative, resolve, sep } from "node:path";
6
7
  import { withinRoot } from "./worker-workspace.mjs";
7
8
 
@@ -45,6 +46,7 @@ export class ResearchScan {
45
46
  this.page = counters();
46
47
  this.fileBytes = new Map();
47
48
  this.sources = new Set();
49
+ this.bindings = new Map();
48
50
  this.stopping = false;
49
51
  this.iterator = this.records();
50
52
  }
@@ -88,7 +90,19 @@ export class ResearchScan {
88
90
  throw new SourceChanged();
89
91
  this.check();
90
92
  }
93
+ async validateBinding(path, selected) {
94
+ this.check();
95
+ try {
96
+ if ((await realpath(path)) !== selected) throw new SourceChanged();
97
+ } catch (e) {
98
+ if (unavailable(e)) throw new SourceChanged();
99
+ throw e;
100
+ }
101
+ this.check();
102
+ }
91
103
  async validate() {
104
+ for (const [path, selected] of this.bindings)
105
+ await this.validateBinding(path, selected);
92
106
  for (const source of this.sources) await this.validateSource(source);
93
107
  }
94
108
  async closeHandle(handle) {
@@ -100,23 +114,45 @@ export class ResearchScan {
100
114
  throw new Error("Investigation handle closure failed");
101
115
  }
102
116
  }
103
- async target(path) {
117
+ async canonical(path) {
104
118
  this.check();
105
- const selected = await realpath(resolve(this.roots[0], path ?? "."));
119
+ const selected = await realpath(path);
106
120
  this.check();
107
- const root = this.roots.findIndex((p) => withinRoot(p, selected));
108
- if (root < 0)
109
- throw new Error(
110
- "Path outside investigation roots; select the intended root explicitly.",
111
- );
112
- return { path: selected, root };
121
+ return selected;
122
+ }
123
+ bind(path, selected) {
124
+ if (path === selected) return () => {};
125
+ const previous = this.bindings.get(path);
126
+ if (previous !== undefined && previous !== selected)
127
+ throw new SourceChanged();
128
+ this.bindings.set(path, selected);
129
+ return () => {
130
+ if (previous === undefined) this.bindings.delete(path);
131
+ };
132
+ }
133
+ async target(path) {
134
+ const expanded =
135
+ path === "~"
136
+ ? homedir()
137
+ : path?.startsWith("~/")
138
+ ? join(homedir(), path.slice(2))
139
+ : path;
140
+ const requested = resolve(this.roots[0], expanded ?? ".");
141
+ const selected = await this.canonical(requested);
142
+ this.bind(requested, selected);
143
+ // Roots choose the default query scope, not permission to read host files.
144
+ const root = this.roots.findIndex((p) => withinRoot(p, requested));
145
+ return { path: selected, display: requested, root: root < 0 ? null : root };
113
146
  }
114
147
  location(target) {
148
+ const path = target.display ?? target.path;
115
149
  return {
116
150
  root: target.root,
117
151
  path:
118
- relative(this.roots[target.root], target.path).split(sep).join("/") ||
119
- basename(target.path),
152
+ target.root === null
153
+ ? path
154
+ : relative(this.roots[target.root], path).split(sep).join("/") ||
155
+ basename(path),
120
156
  };
121
157
  }
122
158
  async *records() {
@@ -174,16 +210,16 @@ export class ResearchScan {
174
210
  }
175
211
  const glob = this.query.glob;
176
212
  const name =
177
- relative(target.path, file.path).split(sep).join("/") ||
178
- basename(file.path);
213
+ relative(target.display, file.display).split(sep).join("/") ||
214
+ basename(file.display);
179
215
  if (
180
216
  glob &&
181
- !matchesGlob(glob.includes("/") ? name : basename(file.path), glob)
217
+ !matchesGlob(glob.includes("/") ? name : basename(file.display), glob)
182
218
  ) {
183
219
  yield null;
184
220
  continue;
185
221
  }
186
- if (this.query.kind === "find")
222
+ if (["find", "glob"].includes(this.query.kind))
187
223
  yield { item: { ...this.location(file), kind: "file" } };
188
224
  else {
189
225
  try {
@@ -196,7 +232,12 @@ export class ResearchScan {
196
232
  }
197
233
  }
198
234
  }
199
- async *walk(target, remaining) {
235
+ async *walk(target, remaining, ancestors = new Set()) {
236
+ if (ancestors.has(target.path)) {
237
+ this.omit("symlink cycle omitted");
238
+ return;
239
+ }
240
+ const branch = new Set(ancestors).add(target.path);
200
241
  const source = await this.source(target.path);
201
242
  this.check();
202
243
  const dir = await opendir(target.path);
@@ -213,7 +254,11 @@ export class ResearchScan {
213
254
  this.check();
214
255
  if (!entry) return;
215
256
  this.count("inspectedEntries");
216
- const file = { path: join(target.path, entry.name), root: target.root };
257
+ const file = {
258
+ path: join(target.path, entry.name),
259
+ display: join(target.display, entry.name),
260
+ root: target.root,
261
+ };
217
262
  if (this.query.kind === "ls") {
218
263
  yield {
219
264
  ...file,
@@ -227,25 +272,54 @@ export class ResearchScan {
227
272
  };
228
273
  continue;
229
274
  }
230
- if (entry.isSymbolicLink()) this.omit("symlink omitted");
231
- else if (entry.isDirectory()) {
232
- if ([".git", "node_modules"].includes(entry.name))
233
- this.omit(".git/node_modules omitted");
234
- else if (!remaining) this.omit("depth limit");
235
- else {
236
- // Yield before descent too, so unmatched directories consume a quantum.
237
- yield null;
275
+ let release = () => {};
276
+ const binding = file.path;
277
+ try {
278
+ let info = entry;
279
+ if (entry.isSymbolicLink()) {
238
280
  try {
239
- yield* this.walk(file, remaining - 1);
281
+ file.path = await this.canonical(file.path);
282
+ release = this.bind(binding, file.path);
283
+ this.check();
284
+ info = await lstat(file.path);
285
+ this.check();
240
286
  } catch (e) {
241
287
  if (!unavailable(e)) throw e;
242
- this.omit("unreadable directory omitted");
288
+ this.omit("unreadable symlink omitted");
289
+ yield null;
290
+ continue;
243
291
  }
244
292
  }
245
- } else if (entry.isFile()) {
246
- yield file;
247
- continue;
248
- } else this.omit("special file omitted");
293
+ if (info.isDirectory()) {
294
+ if (entry.name === ".git") this.omit(".git omitted");
295
+ else if (!remaining) this.omit("depth limit");
296
+ else {
297
+ yield null;
298
+ try {
299
+ yield* this.walk(file, remaining - 1, branch);
300
+ } catch (e) {
301
+ if (!unavailable(e)) throw e;
302
+ this.omit("unreadable directory omitted");
303
+ }
304
+ }
305
+ } else if (info.isFile()) {
306
+ yield file;
307
+ continue;
308
+ } else this.omit("special file omitted");
309
+ } finally {
310
+ try {
311
+ if (
312
+ entry.isSymbolicLink() &&
313
+ this.bindings.has(binding) &&
314
+ !this.stopping &&
315
+ !this.signal?.aborted
316
+ ) {
317
+ await this.validateBinding(binding, file.path);
318
+ }
319
+ } finally {
320
+ release();
321
+ }
322
+ }
249
323
  yield null;
250
324
  }
251
325
  } finally {
@@ -316,7 +390,13 @@ export class ResearchScan {
316
390
  if (!ranges) {
317
391
  const haystack = this.query.ignoreCase ? text.toLowerCase() : text;
318
392
  const matched = this.query.patterns.flatMap((pattern, index) =>
319
- haystack.includes(pattern) ? [index] : [],
393
+ (
394
+ this.query.literal
395
+ ? haystack.includes(pattern)
396
+ : this.query.regex[index].test(text)
397
+ )
398
+ ? [index]
399
+ : [],
320
400
  );
321
401
  if (!matched.length) return null;
322
402
  item.matchedPatterns = matched;