@uselemma/opencode 0.1.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/LICENSE +9 -0
- package/README.md +48 -0
- package/package.json +47 -0
- package/runtime/lemma.d.ts +3 -0
- package/runtime/lemma.mjs +5268 -0
- package/scripts/setup.mjs +376 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Forge AI Labs, Inc
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Lemma for OpenCode
|
|
2
|
+
|
|
3
|
+
`@uselemma/opencode` records one complete Lemma trace for each OpenCode user turn. It uses OpenCode's native plugin hooks and event stream directly. It does not install an MCP server or require an npm-published plugin for local use.
|
|
4
|
+
|
|
5
|
+
## Local setup
|
|
6
|
+
|
|
7
|
+
From a Lemma checkout:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pnpm install
|
|
11
|
+
pnpm --filter @uselemma/tracing build
|
|
12
|
+
pnpm --filter @uselemma/opencode build
|
|
13
|
+
node plugins/lemma-opencode/scripts/setup.mjs
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Setup copies the bundled plugin into `~/.config/opencode/plugins/uselemma-opencode.js`, opens project-scoped Lemma authorization, and stores the resulting credential under `~/.config/opencode/lemma`. OpenCode automatically loads global plugin files at startup.
|
|
17
|
+
|
|
18
|
+
For development:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
node plugins/lemma-opencode/scripts/setup.mjs \
|
|
22
|
+
--api-url https://dev.api.uselemma.ai
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Use `--config-dir PATH` and `--data-dir PATH` for isolated verification. Use `--skip-install` to rotate credentials without replacing the installed plugin files.
|
|
26
|
+
|
|
27
|
+
## Captured data
|
|
28
|
+
|
|
29
|
+
- User prompt and final assistant response.
|
|
30
|
+
- OpenCode session and message IDs.
|
|
31
|
+
- Model provider, model ID, and agent name.
|
|
32
|
+
- Native tool inputs, outputs, errors, and timing.
|
|
33
|
+
- One Lemma thread per OpenCode session.
|
|
34
|
+
|
|
35
|
+
Sensitive keys, authorization values, common provider tokens, credential-bearing URLs, and PEM material are removed before a turn is queued. Failed deliveries remain in a private pending directory and retry on the next plugin startup or completed turn. A turn keeps the API and project scope active when capture started. Rotating credentials for the same project preserves delivery, while switching projects leaves the older trace queued instead of misrouting it.
|
|
36
|
+
|
|
37
|
+
## Distribution
|
|
38
|
+
|
|
39
|
+
OpenCode supports both local plugin files and npm package configuration. The setup command uses the local-file path so it can be verified from a checkout or packed tarball before any public npm publication. Public npm release and ecosystem listing are separate release steps.
|
|
40
|
+
|
|
41
|
+
## Verification
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
pnpm --filter @uselemma/opencode type-check
|
|
45
|
+
pnpm --filter @uselemma/opencode test
|
|
46
|
+
pnpm --filter @uselemma/opencode build
|
|
47
|
+
pnpm --filter @uselemma/opencode verify:local
|
|
48
|
+
```
|
package/package.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@uselemma/opencode",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Lemma SDK tracing for OpenCode coding-agent sessions",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./runtime/lemma.mjs",
|
|
8
|
+
"types": "./runtime/lemma.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./runtime/lemma.d.ts",
|
|
12
|
+
"import": "./runtime/lemma.mjs",
|
|
13
|
+
"default": "./runtime/lemma.mjs"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"bin": {
|
|
17
|
+
"lemma-opencode": "./scripts/setup.mjs"
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"runtime/lemma.mjs",
|
|
21
|
+
"runtime/lemma.d.ts",
|
|
22
|
+
"scripts/setup.mjs",
|
|
23
|
+
"README.md"
|
|
24
|
+
],
|
|
25
|
+
"keywords": [
|
|
26
|
+
"opencode",
|
|
27
|
+
"observability",
|
|
28
|
+
"tracing"
|
|
29
|
+
],
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@opencode-ai/plugin": "1.18.19",
|
|
32
|
+
"@uselemma/tracing": "^7.11.0"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@opencode-ai/sdk": "1.18.19",
|
|
36
|
+
"@types/node": "^22.18.8",
|
|
37
|
+
"esbuild": "^0.25.11",
|
|
38
|
+
"typescript": "^5.9.3",
|
|
39
|
+
"vitest": "^3.2.4"
|
|
40
|
+
},
|
|
41
|
+
"scripts": {
|
|
42
|
+
"build": "node build.mjs",
|
|
43
|
+
"type-check": "tsc --noEmit",
|
|
44
|
+
"test": "vitest run",
|
|
45
|
+
"verify:local": "pnpm run build && node verify-local.mjs"
|
|
46
|
+
}
|
|
47
|
+
}
|