@engineeros/connector 1.67.42 → 1.67.44

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -12,42 +12,64 @@ Connect a local coding agent or Bug Hunter host to EngineerOS.
12
12
  ## Run without a global install
13
13
 
14
14
  ```sh
15
- npx --yes "@engineeros/connector@latest" version
15
+ npx -y @engineeros/connector@latest version
16
16
  ```
17
17
 
18
- All commands below use npm's launcher; the connector binary does not need to be on your PATH.
18
+ The npx commands use npm's launcher; no global connector install is required.
19
19
 
20
20
  ## Connect a workspace
21
21
 
22
22
  In EngineerOS, open **Project steering → Connect workspace** and copy the pairing command. Run it inside your project folder. For example, with Codex:
23
23
 
24
24
  ```sh
25
- npx --yes "@engineeros/connector@latest" agent codex-acp install
26
- npx --yes "@engineeros/connector@latest" pair PAIRING_CODE --url https://your-engineeros.example --workspace . --onboard --agent codex-acp
25
+ npx -y @engineeros/connector@latest agent codex-acp install
26
+ npx -y @engineeros/connector@latest pair PAIRING_CODE --url https://your-engineeros.example --onboard --agent codex-acp
27
27
  ```
28
28
 
29
29
  Replace the code and server URL with the values from EngineerOS. Sign in to the agent when prompted; for Codex, run `codex login` in another terminal. Keep the connector terminal open.
30
30
 
31
- Run `npx --yes "@engineeros/connector@latest" agents` to list supported agents. Use the chosen agent's ID in both commands above; for Claude, use `claude-acp`.
31
+ Run `npx -y @engineeros/connector@latest agents` to list supported agents. Use the chosen agent's ID in both commands above; for Claude, use `claude-acp`.
32
32
 
33
33
  Auto onboarding requires connector 1.61.0 or newer and the backend's explicit Auto pairing acknowledgement. Deploy the matching backend before enabling the Auto setup command:
34
34
 
35
35
  ```sh
36
- npx --yes "@engineeros/connector@latest" pair PAIRING_CODE --url https://your-engineeros.example --workspace . --onboard --auto-agents "codex-cli,forge"
36
+ npx -y @engineeros/connector@latest pair PAIRING_CODE --url https://your-engineeros.example --onboard --auto-agents "codex-cli,forge"
37
37
  ```
38
38
 
39
- Only the selected installed agents are inspected. `codex-cli` selects native Codex; `forge` selects native Forge. Add exact registry IDs such as `claude-acp` only when their adapters are already installed and signed in. Auto does not install adapters, sign in, or ask models questions during selection. The normal session readiness question runs after pairing succeeds. Unavailable selected peers are reported while healthy selected agents remain usable; a fresh pairing uses the first usable selection. Auto and manual agent launch flags cannot be combined.
39
+ Only the selected agents are inspected. `codex-cli` selects native Codex; `forge` selects native Forge. Add exact registry IDs such as `claude-acp`, `codex-acp` or `antigravity-acp`: Auto pairing installs missing selected registry adapters with the existing npm, uv or verified binary installer before inspecting them. Already installed exact adapters are reused. Native Codex/Forge and required package managers must be installed separately. Sign in to providers locally; setup does not sign in or ask models questions during selection. The normal session readiness question runs after pairing succeeds. Unavailable selected peers and installation failures are reported while healthy selected agents remain usable; the first selection remains the configured default. Auto and manual agent launch flags cannot be combined.
40
40
 
41
- Stop the running connector before re-pairing an existing folder. Auto retains its primary agent, native sessions, runtime IDs and retired identities. Include that primary in the selection and restore its installation if unavailable; changing it requires the explicit manual agent-change flow. Unselected peers are disabled with their records retained. An uncached npx adapter remains unavailable. Python adapters require an exact `package==version` already installed through `uv tool install`; Auto verifies the installed distribution and launches its executable directly. A uvx temporary cache alone is insufficient. Auto never downloads adapters during discovery, later execution or maintenance. Install a selected adapter explicitly with `npx --yes "@engineeros/connector@latest" agent AGENT_ID install` (replace `AGENT_ID` with its exact registry ID), sign in locally, then refresh.
41
+ Stop the running connector before re-pairing an existing folder. Saved native sessions, runtime IDs and retired identities are retained. Missing selected adapters are prepared in the environment running the connector; Windows installs do not supply WSL adapters. Python adapters require uv and an exact `package==version` tool installation; setup uses `uv tool install`, then verifies the installed distribution and launches its executable directly. A uvx temporary cache alone is insufficient. Explicit Auto pairing and local `start` prepare missing configured registry adapters automatically. `start` reuses installed versions and prepares only enabled saved adapters. Background discovery, reconnects, execution and maintenance remain download-free. A saved launch that differs from the current registry requires an explicit runtime update rather than a silent replacement. For manual installation, use `npx -y @engineeros/connector@latest agent AGENT_ID install` (replace `AGENT_ID` with its exact registry ID), sign in locally, then refresh.
42
42
 
43
43
  If an older backend rotates the credential without confirming Auto, the new credential is saved securely and execution stays blocked, including after restart. Saved sessions for the same connector are retained. Update the backend or resolve its routing policy, then explicitly pair again; an ordinary reconnect cannot confirm Auto.
44
44
 
45
45
  Restart an already paired workspace with:
46
46
 
47
47
  ```sh
48
- npx --yes "@engineeros/connector@latest" start --workspace .
48
+ npx -y @engineeros/connector@latest start
49
49
  ```
50
50
 
51
+ The workspace defaults to the current directory. Use `--workspace PATH` or its
52
+ alias `--ws PATH` to select another directory.
53
+
54
+ For shorter commands, install the connector globally once:
55
+
56
+ ```sh
57
+ npm install -g @engineeros/connector@latest
58
+ eosc pair PAIRING_CODE --url https://your-engineeros.example
59
+ ```
60
+
61
+ To start an already-paired workspace:
62
+
63
+ ```sh
64
+ eosc start
65
+ ```
66
+
67
+ Both `eosc` and `engineeros-connector` launch the same connector. The `npx`
68
+ commands also remain available without a global install. `--ws PATH` and
69
+ `--workspace PATH` work with either command; omitting them uses the current
70
+ directory. The package name needs no quotes in these commands. Keep quotes
71
+ around comma-separated agent selections and paths containing spaces.
72
+
51
73
  ## Enable multiple agent runtimes
52
74
 
53
75
  While the connector is running, use its terminal:
@@ -67,19 +89,19 @@ Changes queue until all active work finishes, then save and refresh discovery in
67
89
  The paired agent remains the primary runtime, named `default`. Enable additional local runtimes for Auto routing or explicit runtime/model choices:
68
90
 
69
91
  ```sh
70
- npx --yes "@engineeros/connector@latest" agent claude-acp install
71
- npx --yes "@engineeros/connector@latest" runtime add claude --agent claude-acp --workspace .
72
- npx --yes "@engineeros/connector@latest" runtime add codex-native --agent-protocol codex --workspace .
73
- npx --yes "@engineeros/connector@latest" runtime add forge --agent-protocol forge --workspace .
74
- npx --yes "@engineeros/connector@latest" runtime list --workspace .
75
- npx --yes "@engineeros/connector@latest" runtime refresh --workspace .
92
+ npx -y @engineeros/connector@latest agent claude-acp install
93
+ npx -y @engineeros/connector@latest runtime add claude --agent claude-acp --workspace .
94
+ npx -y @engineeros/connector@latest runtime add codex-native --agent-protocol codex --workspace .
95
+ npx -y @engineeros/connector@latest runtime add forge --agent-protocol forge --workspace .
96
+ npx -y @engineeros/connector@latest runtime list --workspace .
97
+ npx -y @engineeros/connector@latest runtime refresh --workspace .
76
98
  ```
77
99
 
78
100
  Use `--agent opencode` or another supported registry ID for additional ACP agents. Install the chosen agent and complete its provider sign-in locally. `runtime list` and `runtime refresh` inspect enabled agents and report their discovered models, reasoning settings and readiness; they do not ask models to complete engineering work. Credentials and executable configuration remain on this machine.
79
101
 
80
102
  Existing organization and environment agent restrictions apply to every runtime using its local registry identity. Native Codex and Forge use their canonical identities. An unregistered ACP adapter cannot satisfy a restricted agent policy; display names do not grant agent access.
81
103
 
82
- The running connector applies configuration changes at its next idle refresh; no restart or pairing command is needed. A missing or signed-out runtime does not hide healthy peers. A pinned unavailable runtime blocks until its prerequisite is restored; it never silently becomes another provider. Remove an additional entry with `npx --yes "@engineeros/connector@latest" runtime remove claude --workspace .`.
104
+ The running connector applies configuration changes at its next idle refresh; no restart or pairing command is needed. A missing or signed-out runtime does not hide healthy peers. A pinned unavailable runtime blocks until its prerequisite is restored; it never silently becomes another provider. Remove an additional entry with `npx -y @engineeros/connector@latest runtime remove claude --workspace .`.
83
105
 
84
106
  Runtime IDs identify stable installations/accounts. Removing an additional runtime retires its ID permanently within this pairing and removes only its native session mappings; choose a fresh ID for another installation/account. Use `runtime refresh` for sign-in recovery. Saved work, evidence, memory and execution budgets remain retained. Idle ACP resources for retired entries are released when the connector next refreshes safely; active work is not cancelled.
85
107
 
@@ -94,7 +116,7 @@ Direct test automation freezes one approved writing profile for implementation,
94
116
  Provider and model-family tags come from discovery when available. Configure missing tags and normalized reasoning levels locally, using exact model IDs and native settings that the runtime actually advertises:
95
117
 
96
118
  ```sh
97
- npx --yes "@engineeros/connector@latest" runtime configure claude --model-metadata ./model-metadata.json --workspace .
119
+ npx -y @engineeros/connector@latest runtime configure claude --model-metadata ./model-metadata.json --workspace .
98
120
  ```
99
121
 
100
122
  The JSON object maps each raw model ID to optional `provider_id`, `model_family` and `reasoning_levels`. For example, a model that advertises `xhigh` can explicitly map `"max": {"reasoning_effort": "xhigh"}` under `reasoning_levels`. The connector does not infer this mapping or a model's family. Configured tags are labeled as configured and cannot grant tool, write, cancellation or data permissions. Runtime/model refresh changes discovery only; it does not change provider sign-in. Requested reasoning settings remain separate from provider-reported actual settings; missing observations stay unknown.
@@ -107,7 +129,7 @@ ACP agents may report cumulative session currency costs. A compatible backend re
107
129
 
108
130
  The Linux background Goal runner requires systemd and a working user session bus. If setup reports `Failed to connect to bus`, check `systemctl --user show-environment` as the same user running the connector. On WSL, enable `[boot]` / `systemd=true` in `/etc/wsl.conf`, preserving existing settings, then save other work before restarting the distribution and reopening its user session. See [Microsoft's WSL systemd instructions](https://learn.microsoft.com/en-us/windows/wsl/systemd).
109
131
 
110
- After the user bus works, run `npx --yes "@engineeros/connector@latest" runner start --workspace .` in the paired checkout. Existing queued jobs are retained. For immediate processing without systemd, run `npx --yes "@engineeros/connector@latest" runner serve --workspace .` in a second terminal in that checkout. Keep it open; output goes to `.engineeros/runner/service.log` and the runner exits after five idle minutes. This command does not install a background service.
132
+ After the user bus works, run `npx -y @engineeros/connector@latest runner start` in the paired checkout. Existing queued jobs are retained. For immediate processing without systemd, run `npx -y @engineeros/connector@latest runner serve --workspace .` in a second terminal in that checkout. Keep it open; output goes to `.engineeros/runner/service.log` and the runner exits after five idle minutes. This command does not install a background service.
111
133
 
112
134
  If an older connector reports npm `EALLOWSCRIPTS` while installing its verified
113
135
  runner, do not enable dependency scripts or change global npm configuration.
@@ -138,7 +160,7 @@ Runs created before server repair accounting retain their evidence and saved hea
138
160
  Choose **Find bugs in a running app** in EngineerOS, add your target and copy its host command:
139
161
 
140
162
  ```sh
141
- npx --yes "@engineeros/connector@latest" hunt-host PAIRING_CODE --url https://your-engineeros.example --project PROJECT_UUID --agent codex-acp
163
+ npx -y @engineeros/connector@latest hunt-host PAIRING_CODE --url https://your-engineeros.example --project PROJECT_UUID --agent codex-acp
142
164
  ```
143
165
 
144
166
  The command prepares the agent and automatically installs the connector's pinned Playwright runtime and matching managed Chromium when missing. Workspace `pair` and `start`, hunts and recorded sign-ins use the same browser setup path. Complete the requested agent sign-in and keep the terminal open. No separate Playwright setup command is needed.
@@ -160,7 +182,7 @@ Screenshots and live frames are off by default. Setup's **Allow screenshots in n
160
182
  Restart the host with:
161
183
 
162
184
  ```sh
163
- npx --yes "@engineeros/connector@latest" hunt-host --project PROJECT_UUID
185
+ npx -y @engineeros/connector@latest hunt-host --project PROJECT_UUID
164
186
  ```
165
187
 
166
188
  ## Connector agent defaults
@@ -180,7 +202,7 @@ These controls apply only to connector launches. They do not edit the coding age
180
202
  ## Troubleshoot and update
181
203
 
182
204
  ```sh
183
- npx --yes "@engineeros/connector@latest" doctor --workspace .
205
+ npx -y @engineeros/connector@latest doctor --workspace .
184
206
  npm install --global @engineeros/connector@latest
185
207
  ```
186
208
 
@@ -195,8 +217,8 @@ npm install --global @engineeros/connector@latest
195
217
  Pair the workspace first. Prepare a local JSON runtime configuration with `kind: docker-readonly-tmpfs-v1`, immutable digest-pinned `image` and `proxy_image`, `connector_entry: /opt/engineeros/bin/engineeros-connector.mjs`, and the installed adapter's `agent_config` (`agent_protocol`, optional `agent_command`, `agent_args`, `agent_name`). Keep provider credentials in individual local files. Each explicit `credentials` entry names an absolute regular-file `source`, a unique `/run/credentials/<name>` target and `readonly: true`; directories and symlinks are refused. Never put credential values or environment secrets in the JSON.
196
218
 
197
219
  ```sh
198
- npx --yes "@engineeros/connector@latest" delivery configure --profile /absolute/path/runtime.json --workspace .
199
- npx --yes "@engineeros/connector@latest" delivery status --workspace .
220
+ npx -y @engineeros/connector@latest delivery configure --profile /absolute/path/runtime.json --workspace .
221
+ npx -y @engineeros/connector@latest delivery status --workspace .
200
222
  ```
201
223
 
202
224
  Restart the connector to advertise the configured isolation identity. Retain the real isolation, process, resource, recovery, provider-bound and scope measurements and obtain environment approval before executing a governed plan. Configuration and `delivery probe` alone do not qualify a runtime. Changed credentials, images or capability hashes require requalification. Native scope uses a complete measured CLI bundle and filesystem ownership; it does not implement per-tool filtering. Missing prerequisites refuse work before launch and retain existing evidence/accounting.
@@ -211,4 +233,4 @@ The [EngineerOS Connector Binary Use License](LICENSE) permits personal and comm
211
233
 
212
234
  ### Retained job history
213
235
 
214
- `npx --yes "@engineeros/connector@latest" history compact --workspace <folder>` combines acknowledged terminal report files while retaining every encrypted evidence body, acknowledgement and execution identity. Pending or rejected reports, locally retained evidence and interrupted/uncertain work stay untouched. New terminal reports compact automatically. Stop older connector versions before this storage-layout cutover; they cannot read compacted archives. The command uses local protected storage without contacting EngineerOS. See the [retention contract](../../docs/architecture/connector-history-retention.md).
236
+ `npx -y @engineeros/connector@latest history compact --workspace <folder>` combines acknowledged terminal report files while retaining every encrypted evidence body, acknowledgement and execution identity. Pending or rejected reports, locally retained evidence and interrupted/uncertain work stay untouched. New terminal reports compact automatically. Stop older connector versions before this storage-layout cutover; they cannot read compacted archives. The command uses local protected storage without contacting EngineerOS. See the [retention contract](../../docs/architecture/connector-history-retention.md).
@@ -1,4 +1,4 @@
1
- import ae from"node:path";import ce from"node:v8";import{Worker as le,isMainThread as ue,parentPort as P,workerData as v}from"node:worker_threads";import{constants as W}from"node:fs";import{lstat as K,open as Z,realpath as j}from"node:fs/promises";import m from"node:path";var R=10*1024*1024,N=(s,e)=>{let t=m.relative(s,e);return t&&!t.startsWith(`..${m.sep}`)&&t!==".."&&!m.isAbsolute(t)};async function I(s,e,{maxBytes:t=R}={}){let n=()=>Object.assign(new Error("Use a regular file inside the workspace without symlinks or redirected directories."),{code:"WORKSPACE_READ_UNSAFE"}),r=()=>Object.assign(new Error(`Workspace file exceeds the ${t} byte read limit. Provide a smaller file before retrying.`),{code:"WORKSPACE_READ_LIMIT"}),o=String(e||"").replaceAll("\\","/");if(!o||m.isAbsolute(o)||m.win32.isAbsolute(o))throw n();let p=await j(s),f=m.resolve(p,o);if(!N(p,f))throw n();let d=p,i;for(let c of m.relative(p,f).split(m.sep))if(d=m.join(d,c),i=await K(d),i.isSymbolicLink())throw n();if(!i.isFile())throw n();if(i.size>t)throw r();if(!N(p,await j(f)))throw n();let h=await Z(f,W.O_RDONLY|(W.O_NOFOLLOW||0));try{let c=await h.stat();if(!c.isFile()||c.ino!==i.ino||c.dev!==i.dev||!N(p,await j(f)))throw n();if(c.size>t)throw r();let b=Buffer.alloc(Math.min(t+1,64*1024)),x=[],g=0;for(;g<=t;){let{bytesRead:a}=await h.read(b,0,Math.min(b.length,t+1-g),null);if(!a)break;if(g+=a,g>t)throw r();x.push(Buffer.from(b.subarray(0,a)))}return Buffer.concat(x,g)}finally{await h.close()}}import{execFile as q}from"node:child_process";import{promisify as V}from"node:util";var Ce=V(q);var Me=Object.freeze({"skills.include_instructions":!1,"skills.bundled.enabled":!1,"features.apps":!1,"features.plugins":!1,include_apps_instructions:!1}),ee=Object.freeze({"read-only":"read-only","workspace-write":"workspace-write"}),Pe=Object.freeze({"codex-acp":ee,"claude-acp":Object.freeze({"read-only":"plan","workspace-write":"acceptEdits"}),opencode:Object.freeze({"read-only":"plan","workspace-write":"build"})});var te="engineeros-verifier",ne=Object.freeze({"*":"ask",read:"allow",glob:"allow",grep:"allow",list:"allow",bash:"allow",edit:"deny",task:"deny",external_directory:"deny",patch:"deny",apply_patch:"deny"});var se=Object.freeze({OPENCODE_CONFIG:"",OPENCODE_CONFIG_CONTENT:JSON.stringify({agent:{[te]:{mode:"primary",description:"Independent Goal verification with commands and no direct edits",permission:ne},plan:{permission:{"*":"ask",read:"allow",glob:"allow",grep:"allow",list:"allow",edit:"deny",bash:"deny",task:"deny",external_directory:"deny",patch:"deny",apply_patch:"deny"}}}}),OPENCODE_DISABLE_PROJECT_CONFIG:"true",OPENCODE_DISABLE_CLAUDE_CODE:"true",OPENCODE_DISABLE_EXTERNAL_SKILLS:"true"});var ze=String.raw`import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
1
+ import ce from"node:path";import le from"node:v8";import{Worker as ue,isMainThread as pe,parentPort as L,workerData as A}from"node:worker_threads";import{constants as G}from"node:fs";import{lstat as Z,open as q,realpath as N}from"node:fs/promises";import g from"node:path";var I=10*1024*1024,R=(s,e)=>{let t=g.relative(s,e);return t&&!t.startsWith(`..${g.sep}`)&&t!==".."&&!g.isAbsolute(t)};async function M(s,e,{maxBytes:t=I}={}){let n=()=>Object.assign(new Error("Use a regular file inside the workspace without symlinks or redirected directories."),{code:"WORKSPACE_READ_UNSAFE"}),r=()=>Object.assign(new Error(`Workspace file exceeds the ${t} byte read limit. Provide a smaller file before retrying.`),{code:"WORKSPACE_READ_LIMIT"}),o=String(e||"").replaceAll("\\","/");if(!o||g.isAbsolute(o)||g.win32.isAbsolute(o))throw n();let f=await N(s),d=g.resolve(f,o);if(!R(f,d))throw n();let h=f,i;for(let c of g.relative(f,d).split(g.sep))if(h=g.join(h,c),i=await Z(h),i.isSymbolicLink())throw n();if(!i.isFile())throw n();if(i.size>t)throw r();if(!R(f,await N(d)))throw n();let m=await q(d,G.O_RDONLY|(G.O_NOFOLLOW||0));try{let c=await m.stat();if(!c.isFile()||c.ino!==i.ino||c.dev!==i.dev||!R(f,await N(d)))throw n();if(c.size>t)throw r();let x=Buffer.alloc(Math.min(t+1,64*1024)),S=[],w=0;for(;w<=t;){let{bytesRead:a}=await m.read(x,0,Math.min(x.length,t+1-w),null);if(!a)break;if(w+=a,w>t)throw r();S.push(Buffer.from(x.subarray(0,a)))}return Buffer.concat(S,w)}finally{await m.close()}}import{execFile as V}from"node:child_process";import{promisify as J}from"node:util";var Ne=J(V);var We=Object.freeze({"skills.include_instructions":!1,"skills.bundled.enabled":!1,"features.apps":!1,"features.plugins":!1,include_apps_instructions:!1}),te=Object.freeze({"read-only":"read-only","workspace-write":"workspace-write"}),Ge=Object.freeze({"codex-acp":te,"claude-acp":Object.freeze({"read-only":"plan","workspace-write":"acceptEdits"}),opencode:Object.freeze({"read-only":"plan","workspace-write":"build"})});var ne="engineeros-verifier",se=Object.freeze({"*":"ask",read:"allow",glob:"allow",grep:"allow",list:"allow",bash:"allow",edit:"deny",task:"deny",external_directory:"deny",patch:"deny",apply_patch:"deny"});var oe=Object.freeze({OPENCODE_CONFIG:"",OPENCODE_CONFIG_CONTENT:JSON.stringify({agent:{[ne]:{mode:"primary",description:"Independent Goal verification with commands and no direct edits",permission:se},plan:{permission:{"*":"ask",read:"allow",glob:"allow",grep:"allow",list:"allow",edit:"deny",bash:"deny",task:"deny",external_directory:"deny",patch:"deny",apply_patch:"deny"}}}}),OPENCODE_DISABLE_PROJECT_CONFIG:"true",OPENCODE_DISABLE_CLAUDE_CODE:"true",OPENCODE_DISABLE_EXTERNAL_SKILLS:"true"});var Ye=String.raw`import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
2
2
  import path from "node:path";
3
3
  import { spawnSync } from "node:child_process";
4
4
 
@@ -215,16 +215,16 @@ export default {
215
215
  return "Patch applied:\n" + summary.join("\n");
216
216
  },
217
217
  };
218
- `;var Xe=10080*60*1e3;var Ze=new URL("../grammars/",import.meta.url);var M=`
218
+ `;var et=10080*60*1e3;var ot=new URL("../grammars/",import.meta.url);var P=`
219
219
  (program (lexical_declaration (variable_declarator name: (identifier) @name) @definition.constant))
220
220
  (program (variable_declaration (variable_declarator name: (identifier) @name) @definition.constant))
221
221
  (program (export_statement declaration: (lexical_declaration (variable_declarator name: (identifier) @name) @definition.constant)))
222
- `,G=`
222
+ `,B=`
223
223
  (type_alias_declaration name: (type_identifier) @name) @definition.type
224
224
  (enum_declaration name: (identifier) @name) @definition.enum
225
- `,qe={javascript:M,typescript:M+G,tsx:M+G};var Qe=40*1024*1024;var ot=768*1024;var re=new Set([".js",".jsx",".mjs",".cjs",".ts",".tsx"]),rt=new Set([...re,".py",".go",".java",".kt",".cs",".rb",".rs"]);var it=new RegExp([String.raw`\bassert\w*\b`,String.raw`\bexpect\w*\s*\(`,String.raw`\.should\b`,String.raw`\bpytest\.raises\b`,String.raw`\bself\.assert\w+`,String.raw`\bt\.(?:Error|Errorf|Fatal|Fatalf|Fail|FailNow)\b`,String.raw`\brequire\.\w+\(`,String.raw`\bAssert\.\w+`,String.raw`\bassert_(?:eq|ne)!`,String.raw`\bverify\s*\(`,String.raw`\bto(?:Have|Be|Equal|Contain|Match|Throw)\w*\s*\(`].join("|"),"g");var jt=512*1024,Nt=1024*1024;var Rt=10080*60*1e3,It=720*60*60*1e3;var Mt=new Set("a an and are as at be been being but by can could did do does done for from had has have how into is it its may might must need needs no not of on or our our should so than that the their them then there these they this those to too use used using very was were what when where which while who why will with would you your about after all also any before between both during each every here how just make made more most need next now once only other over same should some such take then through under until up upon via want wants well when work works".split(/\s+/));var Pt=256*1024;function _(s){return String(s||"").replace(/[\u0000-\u001f\u007f]/g,e=>`\\u${e.codePointAt(0).toString(16).padStart(4,"0")}`).replaceAll("`","'")}var ie={"claude.md":"Claude Code","gemini.md":"Gemini CLI"},Lt=new Set(["agents.md",...Object.keys(ie)]);var pe=50,D=4e3,B=1e3,U=8,L=1e3,fe=5e3,de=2,F=0;async function Ht(s,e,t){let n=String(e.pattern??""),r=String(e.glob??"");if(!n)throw new Error("Pass a non-empty pattern to engineeros_grep.");if(n.length>4096||r.length>1024)throw new Error("Grep pattern or glob is too long. Use a smaller pattern and narrower glob.");if(F>=de)throw new Error("Two workspace searches are already running. Retry after one finishes.");F+=1;let o,p;try{let f=await t();return o=new le(new URL("./context-grep.mjs",import.meta.url),{workerData:{kind:"context-grep",workspace:s,args:e,files:f},execArgv:[],env:{},resourceLimits:{maxOldGenerationSizeMb:128,maxYoungGenerationSizeMb:16,stackSizeMb:4}}),await new Promise((d,i)=>{p=setTimeout(()=>i(new Error("Workspace search exceeded its five-second limit. Narrow the glob or simplify the regular expression.")),fe),o.once("message",h=>h.error?i(new Error(h.error)):d(h.text)),o.once("error",()=>i(new Error("Workspace search worker failed or exceeded its memory limit. Narrow the glob or pattern."))),o.once("exit",()=>i(new Error("Workspace search stopped before returning a result. Narrow the glob or pattern.")))})}finally{clearTimeout(p);try{o&&await o.terminate()}finally{F-=1}}}!ue&&v?.kind==="context-grep"&&(ce.setFlagsFromString("--enable-experimental-regexp-engine-on-excessive-backtracks"),he(v.workspace,v.args,v.files).then(s=>P.postMessage({text:s}),s=>P.postMessage({error:s.message})).finally(()=>P.close()));async function he(s,e,t){let n=String(e.pattern??"");if(!n)throw new Error("Pass a non-empty pattern to engineeros_grep.");let r;try{r=new RegExp(e.regex===!0?n:n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),e.ignore_case===!0?"i":"")}catch(l){throw new Error(`The pattern is not a valid regular expression: ${l.message}`)}let o=String(e.glob||"").trim(),p=o?ge(o):()=>!0,f=t.filter(p),d=[],i=0,h=0,c=0;e:for(let l=0;l<f.length;l+=U){let S=f.slice(l,l+U),C=await Promise.all(S.map(async w=>{try{return await I(s,w)}catch(y){return y.code==="WORKSPACE_READ_LIMIT"?{tooLarge:!0}:null}}));for(let w=0;w<S.length;w+=1){h+=1;let y=C[w];if(y?.tooLarge){i+=1;continue}if(!y||y.subarray(0,8192).includes(0))continue;let E=y.toString("utf8"),O=[];for(let k=0,z=1;k<=E.length;z+=1){let $=E.indexOf(`
226
- `,k),Y=$<0?E.length:$,T=E.slice(k,Y).replace(/\r$/,"");if(r.test(T)&&(O.push({line:z,text:me(T,r),shortened:T.trimEnd().length>D}),c+=1),c===L||$<0)break;k=$+1}if(O.length&&d.push({path:S[w],lines:O}),c===L)break e}}let b=c===L,x=`${o?` in \`${_(o)}\``:""}`,g=`searched ${h.toLocaleString()} file(s)${i?`; ${i} file(s) over ${R/1024/1024} MB were not read`:""}`,a=["# EngineerOS Grep",""];if(o&&!f.length)return a.push(`The glob \`${_(o)}\` matched no file, so nothing was searched. A glob without a slash matches file names; name a directory as \`dir/\` or \`dir/**\`.`),a.join(`
227
- `);if(!d.length)return a.push(`No file matches \`${_(n)}\`${x} (${g}).`),a.join(`
228
- `);let X=e.output==="files"||e.output==="lines"?e.output:c<=pe?"lines":"files";if(a.push(`\`${_(n)}\`${x}: ${c.toLocaleString()} matching line(s) in ${d.length.toLocaleString()} file(s) (${g}).`),b&&a.push("Search reached the 1,000-line limit; counts may be partial. Narrow `glob` or the pattern to continue.",""),X==="files")return a.push('Narrow this with `glob`, or pass `output: "lines"` for the matching lines within the search limit.',"",...d.map(l=>`- \`${_(l.path)}\` (${l.lines.length})`)),a.join(`
229
- `);let A=0;for(let l of d)a.push("",...l.lines.map(({line:S,text:C,shortened:w})=>(w&&(A+=1),`${l.path}:${S}: ${C}`)));return A&&a.push("",`${A} line(s) over ${D.toLocaleString()} characters (minified or generated code) are shown around their match; read the file for the rest.`),a.join(`
230
- `)}function me(s,e){let t=s.trimEnd();if(t.length<=D)return t;let n=Math.max(0,t.search(e)-Math.floor(B/3)),r=n+B;return`${n?"\u2026":""}${t.slice(n,r)}${r<t.length?"\u2026":""}`}function ge(s){let e=s.replaceAll("\\","/").replace(/^\.\//,"");e.endsWith("/")&&(e+="**");let t=new RegExp(`^${H(e)}$`),n=!e.includes("/"),r=/[*?{]/.test(e)?null:`${e}/`;return o=>t.test(n?ae.posix.basename(o):o)||r!==null&&o.startsWith(r)}function H(s){let e="";for(let t=0;t<s.length;t+=1){let n=s[t];if(n==="*"&&s[t+1]==="*")t+=1,s[t+1]==="/"?(t+=1,e+="(?:.*/)?"):e+=".*";else if(n==="*")e+="[^/]*";else if(n==="?")e+="[^/]";else if(n==="{"){let r=s.indexOf("}",t);if(r<0){e+="\\{";continue}e+=`(?:${s.slice(t+1,r).split(",").map(H).join("|")})`,t=r}else e+=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}return e}export{L as GREP_MAX_MATCHES,fe as GREP_TIMEOUT_MS,Ht as boundedGrep,ge as globMatcher};
225
+ `,rt={javascript:P,typescript:P+B,tsx:P+B};var lt=40*1024*1024;var mt=768*1024;var ie=new Set([".js",".jsx",".mjs",".cjs",".ts",".tsx"]),gt=new Set([...ie,".py",".go",".java",".kt",".cs",".rb",".rs"]);var wt=new RegExp([String.raw`\bassert\w*\b`,String.raw`\bexpect\w*\s*\(`,String.raw`\.should\b`,String.raw`\bpytest\.raises\b`,String.raw`\bself\.assert\w+`,String.raw`\bt\.(?:Error|Errorf|Fatal|Fatalf|Fail|FailNow)\b`,String.raw`\brequire\.\w+\(`,String.raw`\bAssert\.\w+`,String.raw`\bassert_(?:eq|ne)!`,String.raw`\bverify\s*\(`,String.raw`\bto(?:Have|Be|Equal|Contain|Match|Throw)\w*\s*\(`].join("|"),"g");var Bt=512*1024,Ut=1024*1024;var Ht=10080*60*1e3,Xt=720*60*60*1e3;var Yt=new Set("a an and are as at be been being but by can could did do does done for from had has have how into is it its may might must need needs no not of on or our our should so than that the their them then there these they this those to too use used using very was were what when where which while who why will with would you your about after all also any before between both during each every here how just make made more most need next now once only other over same should some such take then through under until up upon via want wants well when work works".split(/\s+/));var Kt=256*1024;function b(s){return String(s||"").replace(/[\u0000-\u001f\u007f]/g,e=>`\\u${e.codePointAt(0).toString(16).padStart(4,"0")}`).replaceAll("`","'")}var ae={"claude.md":"Claude Code","gemini.md":"Gemini CLI"},Zt=new Set(["agents.md",...Object.keys(ae)]);var fe=50,z=4e3,U=1e3,H=8,F=1e3,de=5e3,he=2,D=0;async function on(s,e,t){let n=String(e.pattern??""),r=String(e.glob??"");if(!n)throw new Error("Pass a non-empty pattern to engineeros_grep.");if(n.length>4096||r.length>1024)throw new Error("Grep pattern or glob is too long. Use a smaller pattern and narrower glob.");if(D>=he)throw new Error("Two workspace searches are already running. Retry after one finishes.");D+=1;let o,f;try{let d=await t();return o=new ue(new URL("./context-grep.mjs",import.meta.url),{workerData:{kind:"context-grep",workspace:s,args:e,files:d},execArgv:[],env:{},resourceLimits:{maxOldGenerationSizeMb:128,maxYoungGenerationSizeMb:16,stackSizeMb:4}}),await new Promise((h,i)=>{f=setTimeout(()=>i(new Error("Workspace search exceeded its five-second limit. Narrow the glob or simplify the regular expression.")),de),o.once("message",m=>m.error?i(new Error(m.error)):h(m.text)),o.once("error",()=>i(new Error("Workspace search worker failed or exceeded its memory limit. Narrow the glob or pattern."))),o.once("exit",()=>i(new Error("Workspace search stopped before returning a result. Narrow the glob or pattern.")))})}finally{clearTimeout(f);try{o&&await o.terminate()}finally{D-=1}}}!pe&&A?.kind==="context-grep"&&(le.setFlagsFromString("--enable-experimental-regexp-engine-on-excessive-backtracks"),me(A.workspace,A.args,A.files).then(s=>L.postMessage({text:s}),s=>L.postMessage({error:s.message})).finally(()=>L.close()));async function me(s,e,t){let n=String(e.pattern??"");if(!n)throw new Error("Pass a non-empty pattern to engineeros_grep.");let r;try{r=new RegExp(e.regex===!0?n:n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),e.ignore_case===!0?"i":"")}catch(l){throw new Error(`The pattern is not a valid regular expression: ${l.message}`)}let o=String(e.glob||"").trim(),f=o?we(o):()=>!0,d=t.filter(f),h=[],i=0,m=0,c=0;e:for(let l=0;l<d.length;l+=H){let E=d.slice(l,l+H),O=await Promise.all(E.map(async y=>{try{return await M(s,y)}catch(_){return _.code==="WORKSPACE_READ_LIMIT"?{tooLarge:!0}:null}}));for(let y=0;y<E.length;y+=1){m+=1;let _=O[y];if(_?.tooLarge){i+=1;continue}if(!_||_.subarray(0,8192).includes(0))continue;let k=_.toString("utf8"),T=[];for(let $=0,W=1;$<=k.length;W+=1){let v=k.indexOf(`
226
+ `,$),K=v<0?k.length:v,j=k.slice($,K).replace(/\r$/,"");if(r.test(j)&&(T.push({line:W,text:ge(j,r),shortened:j.trimEnd().length>z}),c+=1),c===F||v<0)break;$=v+1}if(T.length&&h.push({path:E[y],lines:T}),c===F)break e}}let x=c===F,S=`${o?` in \`${b(o)}\``:""}`,w=`searched ${m.toLocaleString()} file(s)${i?`; ${i} file(s) over ${I/1024/1024} MB were not read`:""}`,a=["# EngineerOS Grep",""];if(o&&!d.length)return a.push(`The glob \`${b(o)}\` matched no file, so nothing was searched. A glob without a slash matches file names; name a directory as \`dir/\` or \`dir/**\`.`),a.join(`
227
+ `);if(!h.length)return a.push(`No file matches \`${b(n)}\`${S} (${w}).`),a.join(`
228
+ `);let Y=e.output==="files"||e.output==="lines"?e.output:c<=fe?"lines":"files";if(a.push(`\`${b(n)}\`${S}: ${c.toLocaleString()} matching line(s) in ${h.length.toLocaleString()} file(s) (${w}).`),x&&a.push("Search reached the 1,000-line limit; counts may be partial. Narrow `glob` or the pattern to continue.",""),Y==="files")return a.push('Narrow this with `glob`, or pass `output: "lines"` for the matching lines within the search limit.',"",...h.map(l=>`- \`${b(l.path)}\` (${l.lines.length})`)),a.join(`
229
+ `);let C=0;for(let l of h)a.push("",...l.lines.map(({line:E,text:O,shortened:y})=>(y&&(C+=1),`${l.path}:${E}: ${O}`)));return C&&a.push("",`${C} line(s) over ${z.toLocaleString()} characters (minified or generated code) are shown around their match; read the file for the rest.`),a.join(`
230
+ `)}function ge(s,e){let t=s.trimEnd();if(t.length<=z)return t;let n=Math.max(0,t.search(e)-Math.floor(U/3)),r=n+U;return`${n?"\u2026":""}${t.slice(n,r)}${r<t.length?"\u2026":""}`}function we(s){let e=s.replaceAll("\\","/").replace(/^\.\//,"");e.endsWith("/")&&(e+="**");let t=new RegExp(`^${X(e)}$`),n=!e.includes("/"),r=/[*?{]/.test(e)?null:`${e}/`;return o=>t.test(n?ce.posix.basename(o):o)||r!==null&&o.startsWith(r)}function X(s){let e="";for(let t=0;t<s.length;t+=1){let n=s[t];if(n==="*"&&s[t+1]==="*")t+=1,s[t+1]==="/"?(t+=1,e+="(?:.*/)?"):e+=".*";else if(n==="*")e+="[^/]*";else if(n==="?")e+="[^/]";else if(n==="{"){let r=s.indexOf("}",t);if(r<0){e+="\\{";continue}e+=`(?:${s.slice(t+1,r).split(",").map(X).join("|")})`,t=r}else e+=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}return e}export{F as GREP_MAX_MATCHES,de as GREP_TIMEOUT_MS,on as boundedGrep,we as globMatcher};