@snack-ai/opencode 0.1.1 → 0.1.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.
Files changed (2) hide show
  1. package/README.md +59 -5
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -1,8 +1,62 @@
1
1
  # @snack-ai/opencode
2
2
 
3
- Fail-open OpenCode capture plugin for SNACK. It writes only versioned, content-free metadata to the
4
- private spool configured by `snack setup opencode --install-plugin --yes`.
3
+ Live metadata capture for [SNACK](https://github.com/Duck1201/snack), an OpenCode plugin that
4
+ records what happened to each prompt — never what was in it.
5
5
 
6
- The plugin never opens SQLite, imports the SNACK CLI, stores prompt/response text, or throws a
7
- capture failure back to OpenCode. It requires a compatible `@snack-ai/cli` that accepts
8
- `spool-event-v1`.
6
+ ## You do not install this yourself
7
+
8
+ This package is registered in OpenCode's own configuration by the SNACK CLI:
9
+
10
+ ```bash
11
+ npm install -g @snack-ai/cli
12
+ snack setup opencode --install-plugin
13
+ ```
14
+
15
+ Setup shows the exact configuration change before making it, keeps a backup, and does nothing until
16
+ you confirm. `snack doctor` afterwards reports whether the registration is one SNACK can read.
17
+
18
+ SNACK works without this plugin: it can read OpenCode's own database directly. The plugin adds what
19
+ a database read cannot give you — outcomes observed as they happen, including restrictions that
20
+ leave no durable trace, and optional prompt-size features that are computed and discarded rather
21
+ than stored.
22
+
23
+ ## What it writes
24
+
25
+ One line of JSON per event, appended to a private spool directory that setup configured, under a
26
+ versioned schema (`spool-event-v1`) that both packages ship a byte-identical copy of. Every field is
27
+ metadata:
28
+
29
+ - which prompt and session it belongs to, by identifier;
30
+ - the provider and model, and when it happened;
31
+ - how it ended: completed, cancelled, an operational error, or an observed restriction and its
32
+ class;
33
+ - token counts and cost as the provider reported them.
34
+
35
+ There is no field for prompt text or response text, and the schema refuses unknown fields outright.
36
+
37
+ With `--enable-prospective-analysis`, each prompt additionally carries a few non-semantic shape
38
+ features: an estimated token count, a bucketed line count, a bucketed count of fenced code blocks,
39
+ and how many files were attached. They are derived in memory from text the plugin never writes down.
40
+
41
+ ## What it will not do
42
+
43
+ **It will not break OpenCode.** Capture failures are swallowed, never thrown into the host, and
44
+ never allowed to block a prompt. If the spool cannot be written, the plugin warns at most once a
45
+ minute and OpenCode carries on as though it were not installed.
46
+
47
+ **It will not read what it does not need.** It never opens SQLite, never imports the SNACK CLI, and
48
+ never touches OpenCode's credentials. It writes to its own spool directory and nowhere else.
49
+
50
+ **It will not guess.** An event that does not validate against the shipped schema is dropped rather
51
+ than partially interpreted, because a canonical record built from a shape SNACK does not recognize
52
+ would carry an invented meaning downstream.
53
+
54
+ ## Compatibility
55
+
56
+ Requires Node.js 24 and a `@snack-ai/cli` that accepts `spool-event-v1`. Every `0.1.x` of this
57
+ plugin emits that contract, so a CLI on the MVP line reads any of them; `snack doctor` reports a
58
+ registration pinned at a different `0.1.x` as outdated rather than incompatible, and re-running
59
+ `snack setup opencode --install-plugin` updates the pin.
60
+
61
+ Apache-2.0. Security reports go through the private channel described in
62
+ [SECURITY.md](https://github.com/Duck1201/snack/blob/main/SECURITY.md).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@snack-ai/opencode",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Fail-open OpenCode metadata capture for SNACK",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -25,7 +25,7 @@
25
25
  "publishConfig": {
26
26
  "access": "public",
27
27
  "provenance": true,
28
- "tag": "next"
28
+ "tag": "latest"
29
29
  },
30
30
  "scripts": {
31
31
  "test": "node --test"