@opencoven/coven-code 0.0.4 → 0.0.6

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.
Files changed (115) hide show
  1. package/README.md +29 -130
  2. package/bin/coven-code +26 -0
  3. package/install.js +117 -0
  4. package/package.json +26 -23
  5. package/bin/coven-code-sdk.mjs +0 -12
  6. package/bin/coven-code.mjs +0 -19
  7. package/docs/CLI.md +0 -256
  8. package/docs/CONFIGURATION.md +0 -107
  9. package/docs/DEMO.md +0 -453
  10. package/docs/DEVELOPMENT.md +0 -104
  11. package/docs/DOGFOOD-PROTOCOL.md +0 -263
  12. package/docs/MCP-SKILLS-PLUGINS.md +0 -127
  13. package/docs/README.md +0 -39
  14. package/docs/RELEASE.md +0 -33
  15. package/docs/SDK.md +0 -107
  16. package/docs/superpowers/plans/2026-05-25-coven-code-panel-tui.md +0 -904
  17. package/docs/superpowers/plans/2026-05-25-coven-code-rebrand.md +0 -670
  18. package/docs/superpowers/specs/2026-05-25-coven-code-panel-tui-design.md +0 -235
  19. package/docs/superpowers/specs/2026-05-26-slash-first-tui-review.md +0 -63
  20. package/src/agent/fixture.mjs +0 -95
  21. package/src/agent/lane.mjs +0 -136
  22. package/src/cli/dispatch.mjs +0 -66
  23. package/src/cli/execute.mjs +0 -452
  24. package/src/cli/help.mjs +0 -58
  25. package/src/cli/interactive-core.mjs +0 -28
  26. package/src/cli/interactive-io.mjs +0 -101
  27. package/src/cli/interactive-slash.mjs +0 -184
  28. package/src/cli/notifications.mjs +0 -13
  29. package/src/cli/parse.mjs +0 -83
  30. package/src/cli/reasoning.mjs +0 -45
  31. package/src/cli/refs.mjs +0 -162
  32. package/src/cli/repl.mjs +0 -60
  33. package/src/cli/slash-commands.mjs +0 -375
  34. package/src/cli/stream-json.mjs +0 -225
  35. package/src/cli/tui-actions.mjs +0 -72
  36. package/src/cli/tui-blessed.mjs +0 -198
  37. package/src/cli/tui-keys.mjs +0 -80
  38. package/src/cli/tui-lane.mjs +0 -73
  39. package/src/cli/tui-render.mjs +0 -169
  40. package/src/cli/tui-submit.mjs +0 -82
  41. package/src/cli/tui.mjs +0 -174
  42. package/src/commands/agents.mjs +0 -53
  43. package/src/commands/config.mjs +0 -27
  44. package/src/commands/ide.mjs +0 -17
  45. package/src/commands/login.mjs +0 -84
  46. package/src/commands/mcp.mjs +0 -176
  47. package/src/commands/permissions-eval.mjs +0 -122
  48. package/src/commands/permissions-rules.mjs +0 -53
  49. package/src/commands/permissions-text.mjs +0 -112
  50. package/src/commands/permissions.mjs +0 -62
  51. package/src/commands/plugins.mjs +0 -86
  52. package/src/commands/review.mjs +0 -74
  53. package/src/commands/skill.mjs +0 -23
  54. package/src/commands/threads.mjs +0 -165
  55. package/src/commands/tools.mjs +0 -77
  56. package/src/commands/update.mjs +0 -31
  57. package/src/commands/usage.mjs +0 -34
  58. package/src/constants.mjs +0 -52
  59. package/src/main.mjs +0 -87
  60. package/src/mcp/discover.mjs +0 -154
  61. package/src/mcp/local.mjs +0 -55
  62. package/src/mcp/parsers.mjs +0 -46
  63. package/src/mcp/permissions.mjs +0 -52
  64. package/src/mcp/probe.mjs +0 -85
  65. package/src/mcp/registry.mjs +0 -96
  66. package/src/mcp/remote-oauth.mjs +0 -55
  67. package/src/mcp/remote-session.mjs +0 -54
  68. package/src/mcp/remote-sse.mjs +0 -82
  69. package/src/mcp/remote.mjs +0 -74
  70. package/src/plugins/api.mjs +0 -187
  71. package/src/plugins/configuration.mjs +0 -124
  72. package/src/plugins/discover.mjs +0 -84
  73. package/src/plugins/helpers.mjs +0 -187
  74. package/src/plugins/subsystems.mjs +0 -198
  75. package/src/plugins/validators.mjs +0 -142
  76. package/src/sdk-execute.mjs +0 -82
  77. package/src/sdk-install.mjs +0 -187
  78. package/src/sdk-settings.mjs +0 -88
  79. package/src/sdk.mjs +0 -163
  80. package/src/settings/load.mjs +0 -134
  81. package/src/settings/paths.mjs +0 -101
  82. package/src/skills/builtin/building-skills/SKILL.md +0 -20
  83. package/src/skills/discover.mjs +0 -95
  84. package/src/threads/store.mjs +0 -176
  85. package/src/tools/builtin/bash.mjs +0 -110
  86. package/src/tools/builtin/create-file.mjs +0 -66
  87. package/src/tools/builtin/edit-file.mjs +0 -76
  88. package/src/tools/builtin/finder.mjs +0 -73
  89. package/src/tools/builtin/glob.mjs +0 -74
  90. package/src/tools/builtin/grep.mjs +0 -82
  91. package/src/tools/builtin/index.mjs +0 -83
  92. package/src/tools/builtin/librarian.mjs +0 -97
  93. package/src/tools/builtin/look-at.mjs +0 -92
  94. package/src/tools/builtin/mcp.mjs +0 -51
  95. package/src/tools/builtin/mermaid.mjs +0 -59
  96. package/src/tools/builtin/oracle.mjs +0 -56
  97. package/src/tools/builtin/painter.mjs +0 -81
  98. package/src/tools/builtin/plugin-tool.mjs +0 -53
  99. package/src/tools/builtin/read-mcp-resource.mjs +0 -63
  100. package/src/tools/builtin/read-web-page.mjs +0 -72
  101. package/src/tools/builtin/read.mjs +0 -59
  102. package/src/tools/builtin/runtime-content.mjs +0 -31
  103. package/src/tools/builtin/runtime-decisions.mjs +0 -115
  104. package/src/tools/builtin/runtime.mjs +0 -85
  105. package/src/tools/builtin/task.mjs +0 -63
  106. package/src/tools/builtin/toolbox-tool.mjs +0 -57
  107. package/src/tools/builtin/undo-edit.mjs +0 -97
  108. package/src/tools/builtin/web-search.mjs +0 -128
  109. package/src/tools/toolbox.mjs +0 -273
  110. package/src/util/fs.mjs +0 -13
  111. package/src/util/glob.mjs +0 -46
  112. package/src/util/html.mjs +0 -21
  113. package/src/util/media.mjs +0 -13
  114. package/src/util/shell.mjs +0 -24
  115. package/src/util/table.mjs +0 -11
@@ -1,263 +0,0 @@
1
- # Coven Dogfood Protocol
2
-
3
- This protocol defines how Coven is used to build Coven and CastCodes every day.
4
- The goal is to prove orchestration through repeated use: every meaningful task
5
- should leave behind a clear packet, harness assignment, handoff, verification
6
- record, retrospective note, and captured issue when the work exposes a product
7
- gap.
8
-
9
- ## Operating Rules
10
-
11
- - Use Coven as the default coordination surface for Coven and CastCodes work.
12
- - Keep work packets small enough to finish, review, or hand off in one session.
13
- - Assign the narrowest harness that can prove the task, then record why.
14
- - Prefer evidence from the repo, runtime, tests, screenshots, logs, or GitHub.
15
- - Treat dogfood friction as product evidence, not background annoyance.
16
- - Keep public product docs, marketing copy, and visible product surfaces
17
- maintainer-authored and free of provider or generation credit.
18
- - PR metadata, commit metadata, and required coauthor trailers remain allowed
19
- when project policy requires them.
20
-
21
- ## Artifact Location
22
-
23
- Store dogfood packets where future maintainers can find the proof.
24
-
25
- - For GitHub-attached work, put the task packet, handoff, verification record,
26
- retrospective, and issue capture in the relevant issue, PR comment, or review
27
- thread.
28
- - For local or non-GitHub work, put the record in a dated local dogfood log or
29
- Coven session artifact. Use `.local/dogfood/YYYY-MM-DD.md` only when `.local/`
30
- is ignored (for example via `.git/info/exclude` or a global gitignore), so the
31
- log cannot be committed by accident.
32
- - For sensitive or internal-only context, keep a minimal public summary in the
33
- normal artifact and store the sensitive detail in private memory or private
34
- notes.
35
-
36
- ## Daily Cadence
37
-
38
- 1. Open the day with a queue scan across Coven and CastCodes.
39
- 2. Select one task that improves the product or validates a current integration
40
- path.
41
- 3. Write a task packet before starting implementation or review.
42
- 4. Assign the task to the right harness and record the expected proof.
43
- 5. Execute the work through Coven wherever the current product surface allows.
44
- 6. Produce a handoff packet before switching context or requesting review.
45
- 7. Run the verification gate and attach exact commands plus results.
46
- 8. Capture any product gap discovered during the run as an issue or backlog
47
- entry.
48
- 9. Close with a short retrospective that names one protocol adjustment, product
49
- fix, or explicit no-change decision.
50
-
51
- ## Task Packet
52
-
53
- Create a task packet before changing code, review state, docs, or release
54
- metadata.
55
-
56
- ```markdown
57
- ## Task Packet
58
-
59
- - Repo:
60
- - Branch/worktree:
61
- - Objective:
62
- - Trigger:
63
- - Current evidence:
64
- - Scope:
65
- - Out of scope:
66
- - Harness:
67
- - Required proof:
68
- - Risk:
69
- - Stop condition:
70
- ```
71
-
72
- Field rules:
73
-
74
- - `Repo`: `OpenCoven/coven-code`, `OpenCoven/coven`,
75
- `OpenCoven/cast-codes`, or another exact repo.
76
- - `Branch/worktree`: current branch, detached worktree label, or canonical path.
77
- - `Objective`: one sentence with the user-visible outcome.
78
- - `Trigger`: issue, PR, release need, local failure, audit item, or direct ask.
79
- - `Current evidence`: links, file paths, failing commands, screenshots, logs, or
80
- live state that justify the task.
81
- - `Scope`: the smallest set of files, surfaces, or workflow steps expected to
82
- change.
83
- - `Out of scope`: adjacent ideas that should not expand the task.
84
- - `Harness`: the assigned execution harness from the table below.
85
- - `Required proof`: commands or artifacts needed before handoff.
86
- - `Risk`: what could regress if this is wrong.
87
- - `Stop condition`: the point where the task is complete, blocked, or should be
88
- handed off.
89
-
90
- ## Harness Assignment
91
-
92
- Assign one primary harness per task. Add a secondary harness only when the proof
93
- requires a different runtime or interface.
94
-
95
- | Harness | Use For | Required Output |
96
- | --- | --- | --- |
97
- | `coven-code execute` | Deterministic CLI, SDK, thread, tool, MCP, skill, plugin, and JSON-stream checks | Command, stdout summary, exit status |
98
- | `coven-code panel` | Interactive panel behavior, keyboard flow, visible state, and operator ergonomics | Scripted path or screenshot plus observed result |
99
- | `coven runtime` | Coven CLI/runtime, daemon, socket, TUI, harness launch, and local machine capability work | Command bundle, logs, and exact runtime state |
100
- | `cast-codes app` | CastCodes desktop/app behavior, settings, LSP, indexing, browser panels, and UI flows | App/test command, focused screenshot or log, issue/PR link |
101
- | `repo tests` | Narrow implementation or regression coverage | Exact test command and pass/fail result |
102
- | `maintainer review` | PR review, conflict repair, release follow-through, and issue triage | Live GitHub state, review-thread state, and final blocker |
103
-
104
- Assignment rules:
105
-
106
- - Prefer `coven-code execute` for deterministic orchestration checks.
107
- - Prefer `coven-code panel` when operator experience is the thing being tested.
108
- - Prefer `coven runtime` when the task touches Coven's own Rust runtime,
109
- daemon, socket, local machine capabilities, or harness launch behavior.
110
- - Prefer `cast-codes app` when the proof depends on the CastCodes application
111
- rather than a library or CLI unit.
112
- - Prefer `repo tests` for the smallest code-level regression proof.
113
- - Prefer `maintainer review` when the task is primarily GitHub state, PR
114
- cleanup, merge readiness, or issue accuracy.
115
-
116
- ## Handoff Packet
117
-
118
- Produce a handoff packet before requesting review, switching harnesses, pausing,
119
- or closing the task.
120
-
121
- ```markdown
122
- ## Handoff Packet
123
-
124
- - Outcome:
125
- - Changed files:
126
- - Verification:
127
- - Product gaps found:
128
- - Issues captured:
129
- - Remaining risk:
130
- - Next action:
131
- ```
132
-
133
- Field rules:
134
-
135
- - `Outcome`: shipped, reviewed, blocked, no actionable bug, or follow-up needed.
136
- - `Changed files`: exact paths or `none`.
137
- - `Verification`: exact commands and result summaries.
138
- - `Product gaps found`: dogfood friction observed while using Coven.
139
- - `Issues captured`: issue links, draft titles, or `none`.
140
- - `Remaining risk`: what was not proven.
141
- - `Next action`: the one concrete action another maintainer can take.
142
-
143
- ## Verification Gate
144
-
145
- Every dogfood task needs proof proportional to the change.
146
-
147
- Minimum docs-only gate:
148
-
149
- ```sh
150
- git diff --check
151
- ```
152
-
153
- Minimum Coven Code gate:
154
-
155
- ```sh
156
- git diff --check
157
- node ./bin/coven-code.mjs --help
158
- node ./bin/coven-code.mjs -x "what is 2+2?"
159
- npm test
160
- ```
161
-
162
- Minimum Coven runtime gate:
163
-
164
- ```sh
165
- cargo test
166
- ```
167
-
168
- Add focused runtime commands that exercise the touched Coven surface, such as a
169
- daemon launch, socket call, TUI smoke path, or harness command construction
170
- check.
171
-
172
- Minimum CastCodes gate:
173
-
174
- ```sh
175
- ./script/check_ai_attribution
176
- ./script/check_rebrand
177
- git diff --check
178
- ```
179
-
180
- Add the narrow CastCodes command that proves the touched surface, such as a
181
- focused test target, `rustfmt --check` on changed Rust files, an app launch, or
182
- a screenshot-backed UI check.
183
-
184
- Run `./script/check_rebrand` when touching public docs, UI, settings,
185
- templates, release notes, marketing, or other user-visible surfaces. This
186
- protects the CastCodes product and Coven runtime framing.
187
-
188
- Verification rules:
189
-
190
- - Run the narrowest command that can fail for the changed behavior.
191
- - Record the exact command, result, and any known baseline noise.
192
- - If a broad suite fails from unrelated drift, keep the failure in the handoff
193
- and add a focused passing command for the touched behavior.
194
- - Never mark a handoff complete when the required proof was skipped.
195
-
196
- ## Retrospective
197
-
198
- End each day or substantial task with a short retrospective.
199
-
200
- ```markdown
201
- ## Retrospective
202
-
203
- - What Coven made easier:
204
- - What Coven made harder:
205
- - Missing product affordance:
206
- - Protocol adjustment:
207
- - Follow-up:
208
- ```
209
-
210
- Retrospective rules:
211
-
212
- - Keep it concrete and tied to the day's packets.
213
- - Record one product gap at most unless multiple gaps blocked the work.
214
- - Use `none` when no issue is warranted.
215
- - Do not rewrite the protocol unless repeated evidence supports the change.
216
-
217
- ## Issue Capture
218
-
219
- Capture an issue when dogfood use exposes a reproducible product gap, missing
220
- affordance, confusing handoff, unreliable harness path, or verification hole.
221
-
222
- Issue packet:
223
-
224
- ```markdown
225
- ## Dogfood Issue
226
-
227
- - Title:
228
- - Repo:
229
- - Surface:
230
- - Reproduction:
231
- - Expected:
232
- - Actual:
233
- - Evidence:
234
- - Severity:
235
- - Suggested owner:
236
- ```
237
-
238
- Severity:
239
-
240
- - `P0`: blocks daily Coven or CastCodes work.
241
- - `P1`: forces a manual workaround or makes proof unreliable.
242
- - `P2`: slows handoff, review, or issue capture.
243
- - `P3`: polish, naming, or ergonomics with a clear fix path.
244
-
245
- Capture rules:
246
-
247
- - File issues from evidence, not speculation.
248
- - Link the task packet and handoff packet when available.
249
- - Keep implementation suggestions separate from the reproduction.
250
- - If the gap is actually a docs or protocol mismatch, patch the protocol instead
251
- of opening a product issue.
252
-
253
- ## Daily Closeout
254
-
255
- Use this checklist before ending a dogfood run:
256
-
257
- - Task packet exists.
258
- - Harness assignment is recorded.
259
- - Handoff packet exists or the task is explicitly still active.
260
- - Verification commands and results are recorded.
261
- - Product gaps were captured or marked `none`.
262
- - Retrospective note exists.
263
- - Next action is one concrete maintainer step.
@@ -1,127 +0,0 @@
1
- # MCP, Skills, and Plugins
2
-
3
- ## MCP Servers
4
-
5
- Add a user or workspace MCP server:
6
-
7
- ```sh
8
- coven-code mcp add local-tools -- node ./tools/server.mjs
9
- coven-code mcp add --workspace local-tools -- node ./tools/server.mjs
10
- ```
11
-
12
- Inspect and approve servers:
13
-
14
- ```sh
15
- coven-code mcp list
16
- coven-code mcp doctor
17
- coven-code mcp approve local-tools
18
- ```
19
-
20
- Remote MCP servers can use headers, OAuth credentials, Streamable HTTP session
21
- reuse, and SSE fallback. Configured servers can also filter exposed tools.
22
-
23
- Workspace MCP servers require approval before their tools appear in stream JSON
24
- or tool discovery.
25
-
26
- ## MCP Registry Enforcement
27
-
28
- `covenCode.mcpRegistry.url` can point to a registry of approved remote servers.
29
- When enabled, unlisted servers are blocked. If the registry is unreachable, MCP
30
- activation fails closed.
31
-
32
- This behavior is intentional: local projects should not silently connect to new
33
- tool endpoints when a registry policy is present.
34
-
35
- ## Skills
36
-
37
- List and inspect skills:
38
-
39
- ```sh
40
- coven-code skill list
41
- coven-code skill show building-skills
42
- ```
43
-
44
- Skill discovery checks configured roots, project roots, `.agents/skills`,
45
- legacy `.claude/skills`, and built-in skills. Project skills take precedence
46
- over user-wide or legacy roots with the same name.
47
-
48
- Add one-run skill roots:
49
-
50
- ```sh
51
- coven-code --skills ./skills -x "use the data-map skill"
52
- ```
53
-
54
- Skill-bundled MCP tools stay hidden until the skill is referenced.
55
-
56
- ## Plugins
57
-
58
- Project plugins live under:
59
-
60
- ```text
61
- .coven-code/plugins/*.ts
62
- ```
63
-
64
- User plugins live under:
65
-
66
- ```text
67
- ${XDG_CONFIG_HOME:-~/.config}/coven-code/plugins/*.ts
68
- ```
69
-
70
- Inspect plugins:
71
-
72
- ```sh
73
- coven-code plugins list
74
- coven-code plugins reload
75
- ```
76
-
77
- Plugins can register:
78
-
79
- - tools
80
- - commands
81
- - `session.start` handlers
82
- - `agent.start` handlers
83
- - `agent.end` handlers
84
- - `tool.call` handlers
85
- - `tool.result` handlers
86
- - status items
87
- - configuration subscriptions
88
- - UI fallbacks for prompts, selects, confirms, and notifications
89
-
90
- ## Tool Lifecycle Hooks
91
-
92
- Plugin `tool.call` handlers can:
93
-
94
- - allow execution
95
- - reject and continue with a message
96
- - modify input
97
- - synthesize a result
98
- - stop execution with an error
99
-
100
- Plugin `tool.result` handlers can:
101
-
102
- - preserve results
103
- - replace results
104
- - mark results as errors
105
-
106
- The helper APIs classify shell commands, modified files, unavailable UI, and
107
- paired tool call/result messages.
108
-
109
- ## Toolbox Tools
110
-
111
- Toolbox tools are discovered from:
112
-
113
- - `COVEN_CODE_TOOLBOX`
114
- - `--toolbox <path>`
115
- - `${XDG_CONFIG_HOME:-~/.config}/coven-code/tools`
116
-
117
- Common flow:
118
-
119
- ```sh
120
- coven-code tools make --bash my-tool
121
- coven-code tools list
122
- coven-code tools show tb__my-tool
123
- coven-code tools use tb__my-tool
124
- ```
125
-
126
- Toolbox executions receive `AGENT=coven-code` and
127
- `COVEN_CODE_THREAD_ID=<thread-id>` in their environment.
package/docs/README.md DELETED
@@ -1,39 +0,0 @@
1
- # Coven Code Documentation
2
-
3
- Coven Code is a local-first Node CLI for exercising agentic command, thread,
4
- tool, MCP, skill, plugin, and SDK workflows without depending on a hosted
5
- service. The package is intentionally small and deterministic so it can be used
6
- as a harness for OpenCoven integration work, local demos, and regression tests.
7
-
8
- ## Contents
9
-
10
- - [CLI reference](CLI.md)
11
- - [Configuration](CONFIGURATION.md)
12
- - [MCP, skills, and plugins](MCP-SKILLS-PLUGINS.md)
13
- - [SDK](SDK.md)
14
- - [Development](DEVELOPMENT.md)
15
- - [Coven Dogfood Protocol](DOGFOOD-PROTOCOL.md)
16
- - [Demo](DEMO.md)
17
-
18
- ## Core Ideas
19
-
20
- - `coven-code` is the user-facing CLI.
21
- - `coven-code-sdk` installs or resolves a CLI binary for SDK-driven workflows.
22
- - Threads are persisted locally under Coven Code config/state paths.
23
- - Execute mode is deterministic and suitable for tests and automation.
24
- - Stream JSON mode mirrors the event-oriented shape expected by agent
25
- frontends and SDK integrations.
26
- - Tools, MCP servers, skills, and plugins are local extension points.
27
-
28
- ## Local Smoke Test
29
-
30
- From the repository root:
31
-
32
- ```sh
33
- npm run coven-code -- --help
34
- npm run coven-code -- -x "what is 2+2?"
35
- npm test
36
- ```
37
-
38
- Expected result: help prints, execute mode prints `4`, and the test suite exits
39
- with no failures.
package/docs/RELEASE.md DELETED
@@ -1,33 +0,0 @@
1
- # Coven Code Release Runbook
2
-
3
- This package publishes as `@opencoven/coven-code`.
4
-
5
- ## One-time setup
6
-
7
- 1. Make `OpenCoven/coven-code` public before provenance-backed publishing.
8
- 2. Publish the first public package version manually if npm does not yet have the package. npm trusted publishing can be configured only after the package exists.
9
- 3. Configure npm trusted publishing for GitHub Actions:
10
- - Package: `@opencoven/coven-code`
11
- - Repository: `OpenCoven/coven-code`
12
- - Workflow filename: `release-npm.yml`
13
- - Allowed action: `npm publish`
14
- 4. Add the GitHub repository variable `NPM_RELEASE_ALLOWED_SIGNERS`.
15
-
16
- The signer variable must contain one or more SSH allowed-signers lines. For the current release key, use the Git commit signing principal and public key:
17
-
18
- ```text
19
- 68980965+BunsDev@users.noreply.github.com ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILs6nKUsP+OVzoTXNYcZ98IePpd4j+aeuweVS/cozV8D
20
- ```
21
-
22
- ## Release
23
-
24
- 1. Bump `package.json` and `package-lock.json` to the next semver version.
25
- 2. Commit the verified release changes on the default branch.
26
- 3. Create a signed annotated tag that matches the package version:
27
-
28
- ```bash
29
- git tag -s v0.0.1 -m "v0.0.1"
30
- git push origin v0.0.1
31
- ```
32
-
33
- The tag workflow refuses lightweight tags, unsigned tags, `v0.0.0`, mismatched package versions, tags whose target commit is not on the repository default branch, and package contents containing `.github/`, `.superpowers/`, or `test/`.
package/docs/SDK.md DELETED
@@ -1,107 +0,0 @@
1
- # SDK
2
-
3
- The package root exports local SDK helpers:
4
-
5
- ```js
6
- import {
7
- execute,
8
- createUserMessage,
9
- createPermission,
10
- threads,
11
- } from "@opencoven/coven-code";
12
- ```
13
-
14
- ## CLI Install Helper
15
-
16
- The `coven-code-sdk` binary installs or resolves a CLI for SDK-managed runs:
17
-
18
- ```sh
19
- coven-code-sdk install
20
- coven-code-sdk install --force
21
- ```
22
-
23
- Resolution order includes:
24
-
25
- - `COVEN_CODE_CLI_PATH`
26
- - local npm package bins
27
- - `COVEN_CODE_HOME` managed bin
28
- - `coven-code` on `PATH`
29
-
30
- ## Execute
31
-
32
- ```js
33
- for await (const message of execute({
34
- prompt: "what is 2+2?",
35
- options: {
36
- cwd: process.cwd(),
37
- visibility: "workspace",
38
- },
39
- })) {
40
- console.log(message);
41
- }
42
- ```
43
-
44
- SDK execution streams the same JSONL events produced by:
45
-
46
- ```sh
47
- coven-code --stream-json -x "prompt"
48
- ```
49
-
50
- ## Options
51
-
52
- SDK options map to CLI arguments and environment:
53
-
54
- - `cwd`
55
- - `env`
56
- - `mode`
57
- - `reasoningEffort`
58
- - `thinking`
59
- - `labels`
60
- - `visibility`
61
- - `archive`
62
- - `continue`
63
- - `settingsFile`
64
- - `toolbox`
65
- - `skills`
66
- - `mcpConfig`
67
- - `permissions`
68
- - `enabledTools`
69
- - `systemPrompt`
70
- - `logFile`
71
- - `logLevel`
72
- - permission bypass for trusted local harnesses
73
-
74
- ## User Messages
75
-
76
- ```js
77
- const message = createUserMessage("summarize @README.md");
78
- ```
79
-
80
- Structured image content is supported through the same stream JSON input path
81
- that the CLI uses.
82
-
83
- ## Permissions
84
-
85
- ```js
86
- const permission = createPermission("Bash", "delegate", {
87
- to: "local-policy",
88
- message: "This command is blocked in this workspace.",
89
- });
90
- ```
91
-
92
- Custom reject messages are preserved in CLI and SDK results.
93
-
94
- ## Threads
95
-
96
- ```js
97
- const threadId = await threads.new({ visibility: "workspace" });
98
- const markdown = await threads.markdown({ threadId });
99
- ```
100
-
101
- Thread helpers operate on the same local persistence layer as the CLI.
102
-
103
- ## Abort Handling
104
-
105
- SDK execution supports aborting while waiting on async input. Consumers should
106
- wire cancellation from UI or server request lifecycles so long-running local
107
- agent turns can be stopped promptly.