@warlock.js/ai-workspace 5.43.0 → 5.44.0
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/CHANGELOG.md +18 -0
- package/README.md +14 -1
- package/cjs/index.cjs +1781 -141
- package/cjs/index.cjs.map +1 -1
- package/esm/backends/local.d.mts.map +1 -1
- package/esm/backends/local.mjs +36 -22
- package/esm/backends/local.mjs.map +1 -1
- package/esm/contracts/index.d.mts +5 -1
- package/esm/contracts/shell-approval.type.d.mts +78 -0
- package/esm/contracts/shell-approval.type.d.mts.map +1 -0
- package/esm/contracts/tool-io.type.d.mts +35 -1
- package/esm/contracts/tool-io.type.d.mts.map +1 -1
- package/esm/contracts/workspace-backend.contract.d.mts +11 -1
- package/esm/contracts/workspace-backend.contract.d.mts.map +1 -1
- package/esm/contracts/workspace-edit.type.d.mts +66 -0
- package/esm/contracts/workspace-edit.type.d.mts.map +1 -0
- package/esm/contracts/workspace-ops.contract.d.mts +7 -1
- package/esm/contracts/workspace-ops.contract.d.mts.map +1 -1
- package/esm/contracts/workspace-output.type.d.mts +57 -0
- package/esm/contracts/workspace-output.type.d.mts.map +1 -0
- package/esm/contracts/workspace-policy.type.d.mts +38 -1
- package/esm/contracts/workspace-policy.type.d.mts.map +1 -1
- package/esm/contracts/workspace.contract.d.mts +11 -0
- package/esm/contracts/workspace.contract.d.mts.map +1 -1
- package/esm/edit/apply-replacement.mjs +58 -0
- package/esm/edit/apply-replacement.mjs.map +1 -0
- package/esm/edit/match.d.mts +16 -0
- package/esm/edit/match.d.mts.map +1 -0
- package/esm/edit/match.mjs +214 -0
- package/esm/edit/match.mjs.map +1 -0
- package/esm/errors.d.mts +12 -1
- package/esm/errors.d.mts.map +1 -1
- package/esm/errors.mjs +1 -0
- package/esm/errors.mjs.map +1 -1
- package/esm/hooks/after-edit.mjs +36 -0
- package/esm/hooks/after-edit.mjs.map +1 -0
- package/esm/index.d.mts +7 -2
- package/esm/index.mjs +3 -2
- package/esm/ops.d.mts +3 -1
- package/esm/ops.d.mts.map +1 -1
- package/esm/ops.mjs +196 -75
- package/esm/ops.mjs.map +1 -1
- package/esm/output/spill-dir.mjs +15 -0
- package/esm/output/spill-dir.mjs.map +1 -0
- package/esm/output/spill.mjs +220 -0
- package/esm/output/spill.mjs.map +1 -0
- package/esm/policy/policy.d.mts +3 -1
- package/esm/policy/policy.d.mts.map +1 -1
- package/esm/policy/policy.mjs +12 -4
- package/esm/policy/policy.mjs.map +1 -1
- package/esm/policy/powershell-aliases.mjs +275 -0
- package/esm/policy/powershell-aliases.mjs.map +1 -0
- package/esm/policy/powershell-parser.mjs +418 -0
- package/esm/policy/powershell-parser.mjs.map +1 -0
- package/esm/policy/shell-check.d.mts +32 -2
- package/esm/policy/shell-check.d.mts.map +1 -1
- package/esm/policy/shell-check.mjs +183 -31
- package/esm/policy/shell-check.mjs.map +1 -1
- package/esm/policy/shell-interpreter.d.mts +45 -0
- package/esm/policy/shell-interpreter.d.mts.map +1 -0
- package/esm/policy/shell-interpreter.mjs +109 -0
- package/esm/policy/shell-interpreter.mjs.map +1 -0
- package/esm/policy/shell-parser.d.mts +31 -0
- package/esm/policy/shell-parser.d.mts.map +1 -0
- package/esm/policy/shell-parser.mjs +3 -0
- package/esm/policy/shell-parser.mjs.map +1 -1
- package/esm/tools/glob.mjs +1 -0
- package/esm/tools/glob.mjs.map +1 -1
- package/esm/tools/run-shell.d.mts +10 -0
- package/esm/tools/run-shell.d.mts.map +1 -1
- package/esm/tools/run-shell.mjs +18 -1
- package/esm/tools/run-shell.mjs.map +1 -1
- package/esm/tools/run-tests.d.mts +7 -0
- package/esm/tools/run-tests.d.mts.map +1 -1
- package/esm/tools/run-tests.mjs +5 -4
- package/esm/tools/run-tests.mjs.map +1 -1
- package/esm/tools/write-file.mjs +3 -2
- package/esm/tools/write-file.mjs.map +1 -1
- package/esm/workspace.d.mts.map +1 -1
- package/esm/workspace.mjs +16 -5
- package/esm/workspace.mjs.map +1 -1
- package/llms-full.txt +64 -17
- package/package.json +3 -3
- package/skills/use-a-workspace/SKILL.md +64 -17
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,24 @@ All notable changes to `@warlock.js/ai-workspace` are documented in this file.
|
|
|
4
4
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). `@warlock.js/*` packages are released in lockstep — every package shares the same version number, so a version below may list only the changes that affected this package.
|
|
6
6
|
|
|
7
|
+
## 5.44.0 - 2026-11-05
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- Command rules: `shell.rules` is an ordered list of `{ match, effect: "allow" | "ask" | "deny", reason? }` (the last matching rule wins, a deny anywhere in a line refuses it) and `shell.onAsk({ command, asks, signal })` decides on commands that need approval. With `onAsk` set, commands no rule matches, syntax the parser cannot read (`reason: "unparsed"`) and runners the policy cannot see into (`"nested"`) ask too; `{ allow: true, remember: pattern }` allows later matching commands for the workspace's life (shared with `readonly()` and `scope()`, never over a deny). New refusal reasons `"approval-required"` (an ask rule and no `onAsk`) and `"approval-denied"`.
|
|
12
|
+
- `workspace.shell.classify(line)` and `classifyShellCommand(line, policy?)` return the simple commands a line would run, or `opaque` with the reason when it cannot be read. `checkShellCommand` takes an options argument (`remembered`, `host`, `resolved`) and its result gains `asks`.
|
|
13
|
+
- `shell.interpreter` accepts `"bash"`, `"powershell"`, `"cmd"` and `"auto"`, plus `shell.interpreterPath`. Each shell has its own parser feeding the same deny / allow / `denyPatterns` / `allowCommand` / rule and path-jail checks. PowerShell runs with `-NoLogo -NoProfile -NonInteractive -Command`; its dialect covers `;`, `&&`, `||`, pipelines, `$( )`, the call operator and the usual redirections, refuses script blocks, splatting, here-strings, `--%`, statements and dot-sourcing, treats `Invoke-Expression`, `Invoke-Command`, `Start-Process`, `Add-Type`, `Set-Alias` and `-EncodedCommand` as nested execution, keeps `Set-Location` / `cd` inside the jail, and checks `Remove-Item`, `Copy-Item`, `Move-Item`, `Get-ChildItem`, `Get-Content`, `Invoke-WebRequest`, `Stop-Process` and their aliases in a canonical `rm -rf`-style form as well. `"auto"` picks `bash` then `sh` on POSIX and `pwsh`, `powershell`, Git Bash, `cmd.exe` on Windows. `resolveShell()` is exported.
|
|
14
|
+
- `run_shell`'s description names the resolved shell and its syntax rules; `run_tests` quotes its pattern for each shell.
|
|
15
|
+
- New types `WorkspaceCommandRule`, `WorkspaceCommandDecision`, `WorkspaceShellOnAsk`, `WorkspaceShellAskRequest`, `WorkspaceShellAskDecision`, `WorkspaceShellAsk`, `WorkspaceShellAskReason` and `WorkspaceShellClassification`.
|
|
16
|
+
- Tiered edit matching. `edit_file` and `multi_edit` now find `oldString` exactly first, then with line endings normalised, then with look-alike Unicode punctuation folded (`matchTier: "unicode"`), then line by line ignoring trailing whitespace (`matchTier: "whitespace"`). A loose match must be unique, even with `replaceAll`. Replacement text takes the file's dominant line ending, so CRLF files stay CRLF. New `policy.edit`: `matching` (`"tiered"` default, `"exact"` for the old behaviour), `missHintLines` and `lineEndings`.
|
|
17
|
+
- A `not-found` edit error carries a `hint`: the closest file text (at most 12 lines of 200 characters) or a note that `newString` is already present.
|
|
18
|
+
- `policy.hooks.afterEdit`: runs once after `write_file`, `edit_file`, `multi_edit` and `apply_patch` write files and returns its text as `diagnostics` between `[diagnostics]` lines. A throw or a timeout reports "diagnostics unavailable" and never fails the edit. `afterEditMaxChars` (default 4000) and `afterEditTimeoutMs` (default 10 s) bound it.
|
|
19
|
+
- `policy.output`: with `spillDir`, oversized `run_shell`, `shell_output`, `grep`, `glob` and `read_file` output is saved to a `spill-<time>-<random>-<label>.txt` file and the result keeps its head and tail plus a `[showing lines … of …; full output saved to …]` marker. Results gain a `truncation` object beside the boolean `truncated`. `read_file` may open the spill directory; `retentionMs` (7 days) and `dispose()` clean up files named like spill files. `globResult()` is an optional `WorkspaceOps` method returning the paths with truncation data.
|
|
20
|
+
|
|
21
|
+
### Changed
|
|
22
|
+
|
|
23
|
+
- `resolveInJail()` takes an optional `access` argument (`"read"` also accepts the spill directory).
|
|
24
|
+
|
|
7
25
|
## 5.40.0 - 2026-10-29
|
|
8
26
|
|
|
9
27
|
### Added
|
package/README.md
CHANGED
|
@@ -126,7 +126,12 @@ for (const file of await ws.glob("src/models/**/*.ts")) {
|
|
|
126
126
|
- **argv by default, shell on request** — commands run as one argv without a shell;
|
|
127
127
|
a refusal names the operator and suggests the split. `shell.interpreter: "sh"`
|
|
128
128
|
opts in to pipes, `&&` and redirections, with every command in the line checked
|
|
129
|
-
and redirections kept inside the jail.
|
|
129
|
+
and redirections kept inside the jail. `"bash"`, `"powershell"`, `"cmd"` and `"auto"`
|
|
130
|
+
pick a specific shell, each read by its own parser (`interpreterPath` overrides where
|
|
131
|
+
the shell lives).
|
|
132
|
+
- **Allow / ask / deny rules** — `shell.rules` plus `shell.onAsk` put commands to the
|
|
133
|
+
host for approval (`remember` stores a session allow); `ws.shell.classify(line)` lists
|
|
134
|
+
the commands a line would run.
|
|
130
135
|
- **Backends** — `local` (default; `@warlock.js/fs` + `node:child_process`) and
|
|
131
136
|
`mock` (in-memory, for hermetic disk-free tests).
|
|
132
137
|
- **Tools** under `ws.tools.*` — `read_file`, `edit_file`, `multi_edit`, `apply_patch`, `write_file`,
|
|
@@ -147,6 +152,14 @@ for (const file of await ws.glob("src/models/**/*.ts")) {
|
|
|
147
152
|
- **Read-before-edit guard** — `read_file` returns a SHA-256 `hash`; `edit_file`
|
|
148
153
|
requires an exact, unique `oldString` (or `replaceAll`) and rejects on an
|
|
149
154
|
`expectHash` mismatch.
|
|
155
|
+
- **Tiered edit matching** — `edit.matching` (default `"tiered"`) finds `oldString`
|
|
156
|
+
exactly, then with line endings normalised, Unicode punctuation folded and trailing
|
|
157
|
+
whitespace ignored; replacements keep the file's line endings, a loose match must be
|
|
158
|
+
unique, and a miss returns a `hint` with the closest text.
|
|
159
|
+
- **`hooks.afterEdit`** — runs after a write and returns compiler or linter output as
|
|
160
|
+
`diagnostics` on the result; a throw or timeout never fails the edit.
|
|
161
|
+
- **`output.spillDir`** — oversized `run_shell`, `shell_output`, `grep`, `glob` and
|
|
162
|
+
`read_file` output is saved to a file; the result keeps head and tail plus a pointer.
|
|
150
163
|
- **Bounded reads** — `read.maxBytes` caps the UTF-8 bytes a read returns (line
|
|
151
164
|
numbers included), cutting on a character boundary and flagging `bytesCapped`;
|
|
152
165
|
the `hash` still covers the whole file.
|