opencode-swarm 7.27.1 → 7.27.2
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 +36 -7
- package/dist/cli/index.js +576 -141
- package/dist/evidence/manager.d.ts +8 -0
- package/dist/index.js +11916 -905
- package/dist/plan/checkpoint.d.ts +0 -10
- package/dist/services/config-doctor.d.ts +33 -0
- package/dist/test-impact/analyzer.d.ts +2 -0
- package/dist/test-impact/failure-classifier.d.ts +1 -1
- package/dist/test-impact/history-store.d.ts +8 -0
- package/dist/tools/pre-check-batch.d.ts +1 -1
- package/dist/tools/resolve-working-directory.d.ts +8 -1
- package/dist/tools/test-runner.d.ts +10 -0
- package/dist/tools/update-task-status.d.ts +3 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -39,7 +39,7 @@ Most AI coding tools let one model write code and ask that same model whether th
|
|
|
39
39
|
- 🌐 **20 languages** — TypeScript, Python, Go, Rust, Java, Kotlin, C/C++, C#, Ruby, Swift, Dart, PHP, JavaScript, CSS, Bash, PowerShell, INI, Regex (extending: see [docs/adding-a-language.md](docs/adding-a-language.md))
|
|
40
40
|
- 🛡️ **Built-in security** — SAST, secrets scanning, dependency audit per task
|
|
41
41
|
- 📝 **Shell write detection** — Static analysis of POSIX/PowerShell/cmd commands to detect file writes (redirects, builtins, in-place editors, network downloads, archive extraction, git destructive ops) before execution
|
|
42
|
-
- 🔒 **Scope enforcement** — Validates write targets against declared scope with cross-process persistence and
|
|
42
|
+
- 🔒 **Scope enforcement** — Validates write targets against declared scope with cross-process persistence, TTL expiry, and scope-aware destructive command blocking
|
|
43
43
|
- 🆓 **Free tier** — works with OpenCode Zen's free model roster
|
|
44
44
|
- ⚙️ **Fully configurable** — override any agent's model, disable agents, tune guardrails
|
|
45
45
|
|
|
@@ -76,6 +76,7 @@ Swarm includes comprehensive static analysis for shell commands to detect and in
|
|
|
76
76
|
- TTL expiry (default 24 hours)
|
|
77
77
|
- Symlink guards (O_NOFOLLOW + realpath containment)
|
|
78
78
|
- Schema versioning and fail-closed validation
|
|
79
|
+
- **Scope-aware destructive command blocking** — Recursive delete patterns (`rm -rf`, `rmdir /s`, `del /s`, `Remove-Item -Recurse`, `rsync --delete`) are blocked unless ALL target paths are within the declared scope (coder agents only)
|
|
79
80
|
|
|
80
81
|
### Security Patterns
|
|
81
82
|
|
|
@@ -717,14 +718,28 @@ File rotates automatically at 10MB to `.swarm/telemetry.jsonl.1`.
|
|
|
717
718
|
</details>
|
|
718
719
|
|
|
719
720
|
<details>
|
|
720
|
-
<summary><strong>
|
|
721
|
+
<summary><strong>Working Directory Requirement: No process.cwd() Fallback</strong></summary>
|
|
721
722
|
|
|
722
|
-
|
|
723
|
+
All Swarm tools that accept a `working_directory` parameter **require an explicit path**. They do **not** fall back to `process.cwd()`. This prevents `.swarm` state from being created in project subdirectories when the host process's working directory differs from the actual project root (issue [#922](https://github.com/zaxbysauce/opencode-swarm/issues/922)).
|
|
723
724
|
|
|
724
|
-
###
|
|
725
|
+
### Defense-in-Depth
|
|
725
726
|
|
|
726
|
-
|
|
727
|
-
|
|
727
|
+
This safety guarantee is implemented in two layers:
|
|
728
|
+
|
|
729
|
+
1. **Fast-path filter** (`resolveWorkingDirectory` in `src/tools/resolve-working-directory.ts`) — validates all incoming `working_directory` values for null-byte injection, path traversal, Windows device paths, and subdirectory containment before any file system access
|
|
730
|
+
2. **Canonical write-time guard** (`validateProjectRoot` in `src/evidence/manager.ts`) — uses `realpathSync` to canonicalize paths at evidence-write time, catching any symlink-based subdirectory bypasses that slip past the fast-path filter
|
|
731
|
+
|
|
732
|
+
### Tools That Require Explicit working_directory
|
|
733
|
+
|
|
734
|
+
The following tools require an explicit `working_directory` and reject subdirectory paths:
|
|
735
|
+
|
|
736
|
+
- `save_plan`
|
|
737
|
+
- `update_task_status`
|
|
738
|
+
- `declare_scope`
|
|
739
|
+
- `pre_check_batch`
|
|
740
|
+
- `test_impact`
|
|
741
|
+
- `mutation_test`
|
|
742
|
+
- `diff_summary`
|
|
728
743
|
|
|
729
744
|
### Failure Conditions
|
|
730
745
|
|
|
@@ -733,20 +748,34 @@ The `save_plan` tool requires an explicit target workspace path. It does **not**
|
|
|
733
748
|
| Missing (`undefined` / `null`) | Fails with: "Target workspace is required" |
|
|
734
749
|
| Empty or whitespace-only | Fails with: "Target workspace cannot be empty or whitespace" |
|
|
735
750
|
| Path traversal (`..`) | Fails with: "Target workspace cannot contain path traversal" |
|
|
751
|
+
| Subdirectory of project root | Fails with: "...is a subdirectory of fallback..." |
|
|
752
|
+
| Windows device path | Fails with: "Windows device paths are not allowed" |
|
|
736
753
|
|
|
737
754
|
### Usage Contract
|
|
738
755
|
|
|
739
|
-
When using
|
|
756
|
+
When using any affected tool, always pass a valid `working_directory`:
|
|
740
757
|
|
|
741
758
|
```typescript
|
|
759
|
+
// save_plan example
|
|
742
760
|
save_plan({
|
|
743
761
|
title: "My Project",
|
|
744
762
|
swarm_id: "mega",
|
|
745
763
|
phases: [{ id: 1, name: "Setup", tasks: [{ id: "1.1", description: "Initialize project" }] }],
|
|
764
|
+
working_directory: "/path/to/project" // Required - no process.cwd() fallback
|
|
765
|
+
})
|
|
766
|
+
|
|
767
|
+
// update_task_status example
|
|
768
|
+
update_task_status({
|
|
769
|
+
task_id: "1.1",
|
|
770
|
+
status: "completed",
|
|
746
771
|
working_directory: "/path/to/project" // Required - no fallback
|
|
747
772
|
})
|
|
748
773
|
```
|
|
749
774
|
|
|
775
|
+
### Stray .swarm Detection
|
|
776
|
+
|
|
777
|
+
`/swarm doctor` now detects and reports stray `.swarm` directories found in project subdirectories (created by older versions or misconfigured tools). It offers cleanup guidance to prevent state pollution.
|
|
778
|
+
|
|
750
779
|
</details>
|
|
751
780
|
|
|
752
781
|
<details>
|