ever-opencode 0.0.0-stage → 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 +203 -0
- package/README.md +221 -2
- package/dist/everos.d.ts +72 -0
- package/dist/everos.js +118 -0
- package/dist/extract.d.ts +37 -0
- package/dist/extract.js +48 -0
- package/dist/identity.d.ts +28 -0
- package/dist/identity.js +56 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.js +245 -0
- package/dist/inject.d.ts +9 -0
- package/dist/inject.js +39 -0
- package/dist/log.d.ts +11 -0
- package/dist/log.js +34 -0
- package/dist/types.d.ts +65 -0
- package/dist/types.js +6 -0
- package/package.json +40 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
(e) The Work is provided to You on an "AS IS" BASIS, WITHOUT
|
|
124
|
+
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
|
|
125
|
+
including, without limitation, any warranties or conditions
|
|
126
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
127
|
+
PARTICULAR PURPOSE. You are responsible for determining the
|
|
128
|
+
appropriateness of using or redistributing the Work and assume
|
|
129
|
+
any risks associated with Your exercise of permissions under
|
|
130
|
+
this License.
|
|
131
|
+
|
|
132
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
133
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
134
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
135
|
+
this License, without any additional terms or conditions.
|
|
136
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
137
|
+
the terms of any separate license agreement you may have executed
|
|
138
|
+
with Licensor regarding such Contributions.
|
|
139
|
+
|
|
140
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
141
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
142
|
+
except as required for reasonable and customary use in describing the
|
|
143
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
144
|
+
|
|
145
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
146
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
147
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
148
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
149
|
+
implied, including, without limitation, any warranties or conditions
|
|
150
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
151
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
152
|
+
appropriateness of using or redistributing the Work and any harm
|
|
153
|
+
resulting from Your use of the Work.
|
|
154
|
+
|
|
155
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
156
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
157
|
+
unless required by applicable law (such as deliberate and grossly
|
|
158
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
159
|
+
liable to You for damages, including any direct, indirect, special,
|
|
160
|
+
incidental, or consequential damages of any character arising as a
|
|
161
|
+
result of this License or out of the use or inability to use the
|
|
162
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
163
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
164
|
+
other commercial damages or losses), even if such Contributor
|
|
165
|
+
has been advised of the possibility of such damages.
|
|
166
|
+
|
|
167
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
168
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
169
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
170
|
+
or other liability obligations and/or rights consistent with this
|
|
171
|
+
License. However, in accepting such obligations, You may act only
|
|
172
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
173
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
174
|
+
defend, and hold each Contributor harmless for any liability
|
|
175
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
176
|
+
of your accepting any such warranty or additional liability.
|
|
177
|
+
|
|
178
|
+
END OF TERMS AND CONDITIONS
|
|
179
|
+
|
|
180
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
181
|
+
|
|
182
|
+
To apply the Apache License to your work, attach the following
|
|
183
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
184
|
+
replaced with your own identifying information. (Don't include
|
|
185
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
186
|
+
comment syntax for the file format. We also recommend that a
|
|
187
|
+
file or class name and description of purpose be included on the
|
|
188
|
+
same "printed page" as the copyright notice for easier
|
|
189
|
+
identification within third-party archives.
|
|
190
|
+
|
|
191
|
+
Copyright [yyyy] [name of copyright owner]
|
|
192
|
+
|
|
193
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
194
|
+
you may not use this file except in compliance with the License.
|
|
195
|
+
You may obtain a copy of the License at
|
|
196
|
+
|
|
197
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
198
|
+
|
|
199
|
+
Unless required by applicable law or agreed to in writing, software
|
|
200
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
201
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
202
|
+
See the License for the specific language governing permissions and
|
|
203
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,222 @@
|
|
|
1
|
-
#
|
|
1
|
+
# ever-opencode
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Persistent memory plugin for [OpenCode](https://docs.opencode.ai) V2, backed by a
|
|
4
|
+
local [EverOS](https://pypi.org/project/everos/) server. Capture every turn,
|
|
5
|
+
inject relevant recall into future turns — zero agent discipline required.
|
|
6
|
+
|
|
7
|
+
Local-first, free, provider-neutral: the plugin is an **LLM-free HTTP client**.
|
|
8
|
+
It never loads an SDK, never sees an API key, and makes zero model calls. All
|
|
9
|
+
provider choice lives in the EverOS server config.
|
|
10
|
+
|
|
11
|
+
## How it works
|
|
12
|
+
|
|
13
|
+
- **Capture** — on each completed assistant turn (`session.text.ended`), the
|
|
14
|
+
plugin reads the new transcript messages and posts them to the EverOS server
|
|
15
|
+
with deferred extraction (buffered, no LLM at capture time). Fire-and-forget;
|
|
16
|
+
turn end is never blocked.
|
|
17
|
+
- **Recall** — on each new user message, the plugin searches EverOS for
|
|
18
|
+
relevant episodes and pushes a compact recall block into the system context.
|
|
19
|
+
Deduped per user message so a single search runs per turn.
|
|
20
|
+
- **Flush** — extraction runs when the Nth capture lands (`flushEvery`, default
|
|
21
|
+
3) and always before compaction, so episodes exist before the transcript is
|
|
22
|
+
summarized.
|
|
23
|
+
- **Storage** — episodes land on disk as human-readable Markdown at
|
|
24
|
+
`~/.everos/<app>/<project>/users/<user_id>/episodes/episode-<date>.md`.
|
|
25
|
+
|
|
26
|
+
The agent never has to "remember to save". Server down? Sessions degrade
|
|
27
|
+
gracefully — the plugin logs once and stays a silent no-op.
|
|
28
|
+
|
|
29
|
+
## Quickstart (30 seconds)
|
|
30
|
+
|
|
31
|
+
### 1. Install and start EverOS
|
|
32
|
+
|
|
33
|
+
Requires Python 3.12+.
|
|
34
|
+
|
|
35
|
+
```sh
|
|
36
|
+
uv tool install everos # or: pip install everos
|
|
37
|
+
everos init # writes ~/.everos/everos.toml
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Point `[llm]` at any OpenAI chat-completions-compatible endpoint, e.g. Ollama
|
|
41
|
+
(local and free):
|
|
42
|
+
|
|
43
|
+
```toml
|
|
44
|
+
[llm]
|
|
45
|
+
model = "openai/llama3.1"
|
|
46
|
+
api_key = "ollama" # ignored by Ollama, but must be set
|
|
47
|
+
base_url = "http://localhost:11434/v1"
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Start the server:
|
|
51
|
+
|
|
52
|
+
```sh
|
|
53
|
+
everos server start # serves http://127.0.0.1:8000
|
|
54
|
+
curl http://127.0.0.1:8000/health # → {"status":"ok"}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### 2. Install the plugin
|
|
58
|
+
|
|
59
|
+
Add it to your OpenCode config's `plugins` array:
|
|
60
|
+
|
|
61
|
+
```json
|
|
62
|
+
{
|
|
63
|
+
"plugins": ["ever-opencode"]
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Or with options:
|
|
68
|
+
|
|
69
|
+
```json
|
|
70
|
+
{
|
|
71
|
+
"plugins": [
|
|
72
|
+
{
|
|
73
|
+
"package": "ever-opencode",
|
|
74
|
+
"options": {
|
|
75
|
+
"everosUrl": "http://127.0.0.1:8000",
|
|
76
|
+
"flushEvery": 3,
|
|
77
|
+
"topK": 5,
|
|
78
|
+
"recallMethod": "keyword",
|
|
79
|
+
"enabled": true,
|
|
80
|
+
"logLevel": "info"
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
]
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### 3. Talk
|
|
88
|
+
|
|
89
|
+
Have a conversation, then check episodes on disk:
|
|
90
|
+
|
|
91
|
+
```sh
|
|
92
|
+
ls ~/.everos/opencode/<project>/users/<you>/episodes/
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Future sessions in the same project recall what happened in past ones.
|
|
96
|
+
|
|
97
|
+
## EverOS `[llm]` provider matrix
|
|
98
|
+
|
|
99
|
+
Any OpenAI-protocol chat-completions endpoint works. Copy-paste TOML for
|
|
100
|
+
`~/.everos/everos.toml`:
|
|
101
|
+
|
|
102
|
+
| Provider | Notes |
|
|
103
|
+
| --- | --- |
|
|
104
|
+
| OpenAI | The reference endpoint. |
|
|
105
|
+
| OpenRouter | One key, hundreds of models. |
|
|
106
|
+
| Z.ai | GLM coding endpoint. |
|
|
107
|
+
| Ollama | Local, free, no key. |
|
|
108
|
+
|
|
109
|
+
```toml
|
|
110
|
+
# OpenAI
|
|
111
|
+
[llm]
|
|
112
|
+
model = "openai/gpt-4o-mini"
|
|
113
|
+
api_key = "sk-..."
|
|
114
|
+
base_url = "https://api.openai.com/v1"
|
|
115
|
+
|
|
116
|
+
# OpenRouter
|
|
117
|
+
[llm]
|
|
118
|
+
model = "openai/anthropic/claude-3.5-haiku"
|
|
119
|
+
api_key = "sk-or-..."
|
|
120
|
+
base_url = "https://openrouter.ai/api/v1"
|
|
121
|
+
|
|
122
|
+
# Z.ai coding endpoint
|
|
123
|
+
[llm]
|
|
124
|
+
model = "glm-5.3-flash"
|
|
125
|
+
api_key = "..."
|
|
126
|
+
base_url = "https://api.z.ai/api/coding/paas/v4"
|
|
127
|
+
|
|
128
|
+
# Ollama (local, free)
|
|
129
|
+
[llm]
|
|
130
|
+
model = "openai/llama3.1"
|
|
131
|
+
api_key = "ollama"
|
|
132
|
+
base_url = "http://localhost:11434/v1"
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Any other OpenAI-compatible `base_url` (llama.cpp, vLLM, DeepInfra, Azure
|
|
136
|
+
OpenAI, …) should work the same way. Non-OpenAI endpoints are
|
|
137
|
+
**reported-working, not guaranteed** — endpoint quirks vary.
|
|
138
|
+
|
|
139
|
+
Requirements: the endpoint must expose OpenAI **chat completions**
|
|
140
|
+
(`/chat/completions`). Responses-API-only endpoints are not supported.
|
|
141
|
+
An optional `[embedding]` section unlocks hybrid search and agentic recall.
|
|
142
|
+
|
|
143
|
+
## Configuration
|
|
144
|
+
|
|
145
|
+
Plugin options (all optional, via the `plugins` entry):
|
|
146
|
+
|
|
147
|
+
| Option | Default | Meaning |
|
|
148
|
+
| ------------- | ----------------------- | ----------------------------------------- |
|
|
149
|
+
| `everosUrl` | `http://127.0.0.1:8000` | EverOS server base URL |
|
|
150
|
+
| `flushEvery` | `3` | Flush memory every N captured turns |
|
|
151
|
+
| `topK` | `5` | Max recall episodes injected |
|
|
152
|
+
| `recallMethod`| `keyword` | `keyword` (no embeddings) / `hybrid` / `agentic` |
|
|
153
|
+
| `enabled` | `true` | Master switch |
|
|
154
|
+
| `logLevel` | `info` | `debug` / `info` / `error` / `silent` |
|
|
155
|
+
|
|
156
|
+
Environment overrides (beat option defaults; explicit options beat env):
|
|
157
|
+
|
|
158
|
+
| Env var | Overrides |
|
|
159
|
+
| ----------------- | -------------------- |
|
|
160
|
+
| `EVEROS_URL` | `everosUrl` |
|
|
161
|
+
| `EVEROS_USER_ID` | user identity |
|
|
162
|
+
| `EVEROS_APP_ID` | app scope (default `opencode`) |
|
|
163
|
+
|
|
164
|
+
## Recall methods
|
|
165
|
+
|
|
166
|
+
| `recallMethod` | Requires | When to use |
|
|
167
|
+
| --- | --- | --- |
|
|
168
|
+
| `keyword` (default) | Nothing | Fresh installs; works before embeddings exist. |
|
|
169
|
+
| `hybrid` | `[embedding]` configured in EverOS | Better semantic matching. |
|
|
170
|
+
| `agentic` | `[embedding]` + a rerank-capable model | Highest quality, slowest. |
|
|
171
|
+
|
|
172
|
+
The default is `keyword` so a fresh install works out of the box.
|
|
173
|
+
|
|
174
|
+
## Troubleshooting
|
|
175
|
+
|
|
176
|
+
- **Nothing is being remembered.** Is the server up? When it's down the plugin
|
|
177
|
+
is a silent no-op (one stderr log per session). Verify:
|
|
178
|
+
`curl http://127.0.0.1:8000/health` → `{"status":"ok"}`.
|
|
179
|
+
- **Inspect what's stored.** Episodes are plain Markdown:
|
|
180
|
+
`~/.everos/opencode/<project>/users/<user_id>/episodes/`.
|
|
181
|
+
- **Just-flushed turns don't show up in recall.** The search index lags
|
|
182
|
+
~10–15 seconds after a flush. Same-session recall of just-captured turns may
|
|
183
|
+
miss; later sessions are fine.
|
|
184
|
+
- **Server comes back mid-session?** Sessions marked degraded retry on the
|
|
185
|
+
next opportunity; restarting the OpenCode session re-arms capture cleanly.
|
|
186
|
+
|
|
187
|
+
## Limitations
|
|
188
|
+
|
|
189
|
+
- **Project identity is the working-directory basename.** OpenCode V2 exposes
|
|
190
|
+
no git remote to the plugin, so two sibling projects with the same folder
|
|
191
|
+
name could collide in EverOS scoping.
|
|
192
|
+
- **Chat-completions endpoints only.** EverOS extraction needs an
|
|
193
|
+
OpenAI-compatible `/chat/completions` endpoint; responses-API-only endpoints
|
|
194
|
+
are unsupported.
|
|
195
|
+
- **~10–15s index lag** after each flush; search may not see just-flushed
|
|
196
|
+
episodes immediately.
|
|
197
|
+
- **No redaction.** Raw transcript text is extracted and stored locally in
|
|
198
|
+
`~/.everos/`. Keep that in mind for sensitive sessions — everything stays on
|
|
199
|
+
your machine, but it is stored verbatim.
|
|
200
|
+
|
|
201
|
+
## FAQ
|
|
202
|
+
|
|
203
|
+
**How is this different from mem0's OpenCode plugin?**
|
|
204
|
+
|
|
205
|
+
- **Local vs cloud.** Everything runs on your machine; transcripts never leave
|
|
206
|
+
it. mem0 routes through its platform.
|
|
207
|
+
- **Free vs metered.** EverOS + your own provider (e.g. Ollama) costs nothing;
|
|
208
|
+
mem0 meters per operation.
|
|
209
|
+
- **Bring any provider vs their allowlist.** EverOS accepts any
|
|
210
|
+
OpenAI-compatible endpoint; mem0 restricts to their supported BYOK list.
|
|
211
|
+
|
|
212
|
+
**How is this different from a curated doc brain (AGENTS.md, Operator, CLAUDE.md)?**
|
|
213
|
+
|
|
214
|
+
Complementary, not competing. Curated docs are **standing truth** you author
|
|
215
|
+
deliberately: conventions, invariants, decisions. This plugin provides
|
|
216
|
+
**episodic recall**: what actually happened in past sessions, captured
|
|
217
|
+
automatically. Standing truth tells the agent what should be true; episodes
|
|
218
|
+
tell it what was.
|
|
219
|
+
|
|
220
|
+
## License
|
|
221
|
+
|
|
222
|
+
Apache-2.0 — matches EverOS.
|
package/dist/everos.d.ts
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP client for a local EverOS server.
|
|
3
|
+
*
|
|
4
|
+
* The plugin is LLM-free: it is only an HTTP client. All provider choice
|
|
5
|
+
* lives in the EverOS server config (~/.everos/everos.toml, [llm] section) —
|
|
6
|
+
* the plugin never sees a model API key.
|
|
7
|
+
*
|
|
8
|
+
* API surface (EverOS v2):
|
|
9
|
+
* GET /health (no /api/v2 prefix)
|
|
10
|
+
* POST /api/v2/memory/add {session_id, app_id?, project_id?, messages[], defer_extraction?}
|
|
11
|
+
* POST /api/v2/memory/flush {session_id, app_id?, project_id?}
|
|
12
|
+
* POST /api/v2/memory/search {user_id, query, method, top_k}
|
|
13
|
+
*
|
|
14
|
+
* Errors arrive as {request_id, error:{code, message}} and are unwrapped
|
|
15
|
+
* into EverosError. All requests are bounded by an AbortController timeout.
|
|
16
|
+
*/
|
|
17
|
+
export interface EverosMessage {
|
|
18
|
+
sender_id: string;
|
|
19
|
+
role: "user" | "assistant" | "tool";
|
|
20
|
+
/** Epoch milliseconds. */
|
|
21
|
+
timestamp: number;
|
|
22
|
+
content: string;
|
|
23
|
+
}
|
|
24
|
+
export interface ScopeIds {
|
|
25
|
+
session_id: string;
|
|
26
|
+
app_id?: string;
|
|
27
|
+
project_id?: string;
|
|
28
|
+
}
|
|
29
|
+
export interface EverosEpisode {
|
|
30
|
+
summary: string;
|
|
31
|
+
score: number;
|
|
32
|
+
atomic_facts?: string[];
|
|
33
|
+
timestamp?: number;
|
|
34
|
+
}
|
|
35
|
+
export interface HealthInfo {
|
|
36
|
+
status: string;
|
|
37
|
+
capabilities?: {
|
|
38
|
+
embed?: boolean;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
export declare class EverosError extends Error {
|
|
42
|
+
readonly code: string;
|
|
43
|
+
readonly status: number;
|
|
44
|
+
constructor(code: string, message: string, status: number);
|
|
45
|
+
}
|
|
46
|
+
export type FetchLike = (input: string, init?: RequestInit) => Promise<Response>;
|
|
47
|
+
export declare class EverosClient {
|
|
48
|
+
readonly baseUrl: string;
|
|
49
|
+
private readonly doFetch;
|
|
50
|
+
constructor(baseUrl: string, doFetch?: FetchLike);
|
|
51
|
+
health(timeoutMs?: number): Promise<HealthInfo>;
|
|
52
|
+
addMemory(scope: ScopeIds, messages: EverosMessage[], opts?: {
|
|
53
|
+
deferExtraction?: boolean;
|
|
54
|
+
timeoutMs?: number;
|
|
55
|
+
}): Promise<{
|
|
56
|
+
status: string;
|
|
57
|
+
}>;
|
|
58
|
+
flushMemory(scope: ScopeIds, timeoutMs?: number): Promise<{
|
|
59
|
+
status: string;
|
|
60
|
+
}>;
|
|
61
|
+
searchMemories(userId: string, query: string, opts?: {
|
|
62
|
+
method?: string;
|
|
63
|
+
topK?: number;
|
|
64
|
+
timeoutMs?: number;
|
|
65
|
+
/** Scope narrowing — results never cross scopes (server default is "default"). */
|
|
66
|
+
scope?: {
|
|
67
|
+
appId?: string;
|
|
68
|
+
projectId?: string;
|
|
69
|
+
};
|
|
70
|
+
}): Promise<EverosEpisode[]>;
|
|
71
|
+
private request;
|
|
72
|
+
}
|
package/dist/everos.js
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP client for a local EverOS server.
|
|
3
|
+
*
|
|
4
|
+
* The plugin is LLM-free: it is only an HTTP client. All provider choice
|
|
5
|
+
* lives in the EverOS server config (~/.everos/everos.toml, [llm] section) —
|
|
6
|
+
* the plugin never sees a model API key.
|
|
7
|
+
*
|
|
8
|
+
* API surface (EverOS v2):
|
|
9
|
+
* GET /health (no /api/v2 prefix)
|
|
10
|
+
* POST /api/v2/memory/add {session_id, app_id?, project_id?, messages[], defer_extraction?}
|
|
11
|
+
* POST /api/v2/memory/flush {session_id, app_id?, project_id?}
|
|
12
|
+
* POST /api/v2/memory/search {user_id, query, method, top_k}
|
|
13
|
+
*
|
|
14
|
+
* Errors arrive as {request_id, error:{code, message}} and are unwrapped
|
|
15
|
+
* into EverosError. All requests are bounded by an AbortController timeout.
|
|
16
|
+
*/
|
|
17
|
+
export class EverosError extends Error {
|
|
18
|
+
code;
|
|
19
|
+
status;
|
|
20
|
+
constructor(code, message, status) {
|
|
21
|
+
super(message);
|
|
22
|
+
this.name = "EverosError";
|
|
23
|
+
this.code = code;
|
|
24
|
+
this.status = status;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
export class EverosClient {
|
|
28
|
+
baseUrl;
|
|
29
|
+
doFetch;
|
|
30
|
+
constructor(baseUrl, doFetch = fetch) {
|
|
31
|
+
this.baseUrl = baseUrl.replace(/\/+$/, "");
|
|
32
|
+
this.doFetch = doFetch;
|
|
33
|
+
}
|
|
34
|
+
async health(timeoutMs = 2000) {
|
|
35
|
+
// Health lives at the server root, no /api/v2 prefix.
|
|
36
|
+
return this.request("GET", "/health", undefined, timeoutMs);
|
|
37
|
+
}
|
|
38
|
+
async addMemory(scope, messages, opts = {}) {
|
|
39
|
+
const body = {
|
|
40
|
+
session_id: scope.session_id,
|
|
41
|
+
app_id: scope.app_id,
|
|
42
|
+
project_id: scope.project_id,
|
|
43
|
+
messages,
|
|
44
|
+
...(opts.deferExtraction ? { defer_extraction: true } : {}),
|
|
45
|
+
};
|
|
46
|
+
const data = await this.request("POST", "/api/v2/memory/add", body, opts.timeoutMs ?? 5000);
|
|
47
|
+
return { status: data?.data?.status ?? "ok" };
|
|
48
|
+
}
|
|
49
|
+
async flushMemory(scope,
|
|
50
|
+
// Flush triggers synchronous server-side extraction (an LLM call plus
|
|
51
|
+
// parse + markdown write), so it needs a generous bound. Capture-path
|
|
52
|
+
// callers invoke it fire-and-forget; this only bounds the HTTP wait.
|
|
53
|
+
timeoutMs = 30000) {
|
|
54
|
+
const body = {
|
|
55
|
+
session_id: scope.session_id,
|
|
56
|
+
app_id: scope.app_id,
|
|
57
|
+
project_id: scope.project_id,
|
|
58
|
+
};
|
|
59
|
+
await this.request("POST", "/api/v2/memory/flush", body, timeoutMs);
|
|
60
|
+
return { status: "flushed" };
|
|
61
|
+
}
|
|
62
|
+
async searchMemories(userId, query, opts = {}) {
|
|
63
|
+
const body = {
|
|
64
|
+
user_id: userId,
|
|
65
|
+
query,
|
|
66
|
+
method: opts.method ?? "keyword",
|
|
67
|
+
top_k: opts.topK ?? 5,
|
|
68
|
+
};
|
|
69
|
+
if (opts.scope?.appId)
|
|
70
|
+
body.app_id = opts.scope.appId;
|
|
71
|
+
if (opts.scope?.projectId)
|
|
72
|
+
body.project_id = opts.scope.projectId;
|
|
73
|
+
const data = await this.request("POST", "/api/v2/memory/search", body, opts.timeoutMs ?? 2000);
|
|
74
|
+
// Success envelope: {request_id, data:{episodes:[...]}} — episodes never
|
|
75
|
+
// sit at the top level.
|
|
76
|
+
return Array.isArray(data?.data?.episodes) ? data.data.episodes : [];
|
|
77
|
+
}
|
|
78
|
+
async request(method, path, body, timeoutMs) {
|
|
79
|
+
const controller = new AbortController();
|
|
80
|
+
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
81
|
+
let res;
|
|
82
|
+
try {
|
|
83
|
+
res = await this.doFetch(this.baseUrl + path, {
|
|
84
|
+
method,
|
|
85
|
+
headers: body === undefined ? undefined : { "content-type": "application/json" },
|
|
86
|
+
body: body === undefined ? undefined : JSON.stringify(body),
|
|
87
|
+
signal: controller.signal,
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
catch (err) {
|
|
91
|
+
clearTimeout(timer);
|
|
92
|
+
const cause = err instanceof Error ? err : new Error(String(err));
|
|
93
|
+
const aborted = cause.name === "AbortError";
|
|
94
|
+
throw new EverosError(aborted ? "timeout" : "connection_failed", aborted
|
|
95
|
+
? `EverOS request timed out after ${timeoutMs}ms: ${method} ${path}`
|
|
96
|
+
: `EverOS request failed: ${method} ${path}: ${cause.message}`, aborted ? 408 : 0);
|
|
97
|
+
}
|
|
98
|
+
clearTimeout(timer);
|
|
99
|
+
const text = await res.text();
|
|
100
|
+
let json = undefined;
|
|
101
|
+
try {
|
|
102
|
+
json = text.length > 0 ? JSON.parse(text) : undefined;
|
|
103
|
+
}
|
|
104
|
+
catch {
|
|
105
|
+
// fall through: non-JSON body
|
|
106
|
+
}
|
|
107
|
+
if (!res.ok) {
|
|
108
|
+
// Error envelope: {request_id, error:{code, message}}
|
|
109
|
+
const code = json?.error?.code;
|
|
110
|
+
const message = json?.error?.message;
|
|
111
|
+
if (typeof code === "string" || typeof message === "string") {
|
|
112
|
+
throw new EverosError(typeof code === "string" ? code : "http_error", typeof message === "string" ? message : `HTTP ${res.status}`, res.status);
|
|
113
|
+
}
|
|
114
|
+
throw new EverosError("http_error", `HTTP ${res.status} ${method} ${path}`, res.status);
|
|
115
|
+
}
|
|
116
|
+
return json;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Transcript extraction: OpenCode session messages → EverOS messages.
|
|
3
|
+
*
|
|
4
|
+
* The transcript from `ctx.session.context({sessionID})` is a list of
|
|
5
|
+
* OpenCode `SessionMessageInfo` discriminated by `type`. We keep:
|
|
6
|
+
* - type "user": has a flat `text` field
|
|
7
|
+
* - type "assistant": `content` is a tagged-union list; keep `type:"text"`
|
|
8
|
+
* parts (skip reasoning/tool parts), joined with "\n"
|
|
9
|
+
* and skip everything else (system, synthetic, compaction, shell, skill, …).
|
|
10
|
+
*
|
|
11
|
+
* Offset tracking: the caller passes in the number of transcript entries
|
|
12
|
+
* already consumed (cursor), we return only NEW messages plus the updated
|
|
13
|
+
* cursor. The transcript is append-ordered by creation time, so the index
|
|
14
|
+
* cursor is stable. The cursor is passed in/out and never stored here.
|
|
15
|
+
*/
|
|
16
|
+
import type { EverosMessage } from "./everos.js";
|
|
17
|
+
/** Internal view of an OpenCode session message (subset). */
|
|
18
|
+
export interface TranscriptMessage {
|
|
19
|
+
id?: string;
|
|
20
|
+
type: string;
|
|
21
|
+
time?: {
|
|
22
|
+
created?: number;
|
|
23
|
+
};
|
|
24
|
+
text?: string;
|
|
25
|
+
content?: Array<{
|
|
26
|
+
type: string;
|
|
27
|
+
text?: string;
|
|
28
|
+
}>;
|
|
29
|
+
}
|
|
30
|
+
export interface ExtractResult {
|
|
31
|
+
messages: EverosMessage[];
|
|
32
|
+
/** Updated cursor: number of transcript entries consumed. */
|
|
33
|
+
offset: number;
|
|
34
|
+
}
|
|
35
|
+
export declare function extractTranscript(transcript: TranscriptMessage[], offset: number, opts?: {
|
|
36
|
+
senderId?: string;
|
|
37
|
+
}): ExtractResult;
|
package/dist/extract.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Transcript extraction: OpenCode session messages → EverOS messages.
|
|
3
|
+
*
|
|
4
|
+
* The transcript from `ctx.session.context({sessionID})` is a list of
|
|
5
|
+
* OpenCode `SessionMessageInfo` discriminated by `type`. We keep:
|
|
6
|
+
* - type "user": has a flat `text` field
|
|
7
|
+
* - type "assistant": `content` is a tagged-union list; keep `type:"text"`
|
|
8
|
+
* parts (skip reasoning/tool parts), joined with "\n"
|
|
9
|
+
* and skip everything else (system, synthetic, compaction, shell, skill, …).
|
|
10
|
+
*
|
|
11
|
+
* Offset tracking: the caller passes in the number of transcript entries
|
|
12
|
+
* already consumed (cursor), we return only NEW messages plus the updated
|
|
13
|
+
* cursor. The transcript is append-ordered by creation time, so the index
|
|
14
|
+
* cursor is stable. The cursor is passed in/out and never stored here.
|
|
15
|
+
*/
|
|
16
|
+
function joinedText(msg) {
|
|
17
|
+
if (msg.type === "user") {
|
|
18
|
+
return typeof msg.text === "string" ? msg.text : "";
|
|
19
|
+
}
|
|
20
|
+
// assistant: join text parts only
|
|
21
|
+
const parts = Array.isArray(msg.content) ? msg.content : [];
|
|
22
|
+
return parts
|
|
23
|
+
.filter((p) => p.type === "text" && typeof p.text === "string")
|
|
24
|
+
.map((p) => p.text)
|
|
25
|
+
.join("\n");
|
|
26
|
+
}
|
|
27
|
+
export function extractTranscript(transcript, offset, opts = {}) {
|
|
28
|
+
// Defensive: sort by creation time (append order is normally already stable).
|
|
29
|
+
const sorted = [...transcript].sort((a, b) => (a.time?.created ?? 0) - (b.time?.created ?? 0));
|
|
30
|
+
const start = Math.max(0, Math.floor(offset));
|
|
31
|
+
const fresh = start >= sorted.length ? [] : sorted.slice(start);
|
|
32
|
+
const messages = [];
|
|
33
|
+
for (const msg of fresh) {
|
|
34
|
+
if (msg.type !== "user" && msg.type !== "assistant")
|
|
35
|
+
continue;
|
|
36
|
+
const content = joinedText(msg).trim();
|
|
37
|
+
if (content.length === 0)
|
|
38
|
+
continue;
|
|
39
|
+
messages.push({
|
|
40
|
+
sender_id: msg.type === "user" ? (opts.senderId ?? "user") : "assistant",
|
|
41
|
+
role: msg.type === "user" ? "user" : "assistant",
|
|
42
|
+
// OpenCode stores message times as epoch milliseconds.
|
|
43
|
+
timestamp: msg.time?.created ?? Date.now(),
|
|
44
|
+
content,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
return { messages, offset: sorted.length };
|
|
48
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Identity / scoping resolution.
|
|
3
|
+
*
|
|
4
|
+
* - app_id: EVEROS_APP_ID env, else "opencode"
|
|
5
|
+
* - project_id: slug(basename of ctx.location.project.directory). The V2 SDK
|
|
6
|
+
* exposes no git remote URL (VcsInfo is only {provider, branch}),
|
|
7
|
+
* so the "owner-repo" idea from the plan collapses to the
|
|
8
|
+
* directory basename.
|
|
9
|
+
* - user_id: EVEROS_USER_ID env → process.env.USER → os.userInfo().username
|
|
10
|
+
* - session_id: the OpenCode sessionID (≤128 chars, matches EverOS charset)
|
|
11
|
+
*/
|
|
12
|
+
import type { PluginContext } from "./types.js";
|
|
13
|
+
export interface Identity {
|
|
14
|
+
appId: string;
|
|
15
|
+
projectId: string;
|
|
16
|
+
userId: string;
|
|
17
|
+
sessionId: string;
|
|
18
|
+
}
|
|
19
|
+
/** EverOS ScopeIds charset: ^[a-zA-Z0-9_.-]+$ */
|
|
20
|
+
export declare function slugify(input: string): string;
|
|
21
|
+
export declare function resolveIdentity(ctx: PluginContext): Identity;
|
|
22
|
+
export declare function withSession(identity: Omit<Identity, "sessionId">, sessionID: string): Identity;
|
|
23
|
+
export declare function resolveScope(ctx: PluginContext, sessionID: string): Promise<{
|
|
24
|
+
appId: string;
|
|
25
|
+
projectId: string;
|
|
26
|
+
userId: string;
|
|
27
|
+
sessionId: string;
|
|
28
|
+
}>;
|
package/dist/identity.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Identity / scoping resolution.
|
|
3
|
+
*
|
|
4
|
+
* - app_id: EVEROS_APP_ID env, else "opencode"
|
|
5
|
+
* - project_id: slug(basename of ctx.location.project.directory). The V2 SDK
|
|
6
|
+
* exposes no git remote URL (VcsInfo is only {provider, branch}),
|
|
7
|
+
* so the "owner-repo" idea from the plan collapses to the
|
|
8
|
+
* directory basename.
|
|
9
|
+
* - user_id: EVEROS_USER_ID env → process.env.USER → os.userInfo().username
|
|
10
|
+
* - session_id: the OpenCode sessionID (≤128 chars, matches EverOS charset)
|
|
11
|
+
*/
|
|
12
|
+
import * as nodeOs from "node:os";
|
|
13
|
+
import * as nodePath from "node:path";
|
|
14
|
+
/** EverOS ScopeIds charset: ^[a-zA-Z0-9_.-]+$ */
|
|
15
|
+
export function slugify(input) {
|
|
16
|
+
const slug = input
|
|
17
|
+
.trim()
|
|
18
|
+
.toLowerCase()
|
|
19
|
+
.replace(/[^a-z0-9_.-]+/g, "-")
|
|
20
|
+
.replace(/^[-.]+|[-.]+$/g, "")
|
|
21
|
+
.slice(0, 64);
|
|
22
|
+
return slug.length > 0 ? slug : "project";
|
|
23
|
+
}
|
|
24
|
+
function resolveUserId() {
|
|
25
|
+
const env = process.env.EVEROS_USER_ID;
|
|
26
|
+
if (env && env.trim().length > 0)
|
|
27
|
+
return env.trim();
|
|
28
|
+
const fromEnvUser = process.env.USER;
|
|
29
|
+
if (fromEnvUser && fromEnvUser.trim().length > 0)
|
|
30
|
+
return fromEnvUser.trim();
|
|
31
|
+
try {
|
|
32
|
+
return nodeOs.userInfo().username;
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
return "unknown";
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
export function resolveIdentity(ctx) {
|
|
39
|
+
const appId = process.env.EVEROS_APP_ID?.trim() || "opencode";
|
|
40
|
+
const directory = ctx.location?.project?.directory ?? "";
|
|
41
|
+
const base = nodePath.basename(directory);
|
|
42
|
+
const projectId = slugify(base);
|
|
43
|
+
return {
|
|
44
|
+
appId,
|
|
45
|
+
projectId,
|
|
46
|
+
userId: resolveUserId(),
|
|
47
|
+
sessionId: "",
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
export function withSession(identity, sessionID) {
|
|
51
|
+
return { ...identity, sessionId: sessionID.slice(0, 128) };
|
|
52
|
+
}
|
|
53
|
+
export async function resolveScope(ctx, sessionID) {
|
|
54
|
+
const id = resolveIdentity(ctx);
|
|
55
|
+
return withSession(id, sessionID);
|
|
56
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* everos-opencode — persistent memory plugin for OpenCode V2.
|
|
3
|
+
*
|
|
4
|
+
* Zero agent discipline: capture each turn (fire-and-forget, deferred
|
|
5
|
+
* extraction), flush on the Nth capture and before compaction, and inject
|
|
6
|
+
* recall into future turns via the `context` hook. The plugin is LLM-free:
|
|
7
|
+
* it only talks HTTP to a local EverOS server; extraction runs server-side.
|
|
8
|
+
*
|
|
9
|
+
* Capture trigger (verified against @opencode/plugin 2.2.5 + @opencode/client
|
|
10
|
+
* generated event types): the V2 event stream has NO "message.*" events. The
|
|
11
|
+
* assistant-completion event is `session.text.ended`
|
|
12
|
+
* (data: {sessionID, assistantMessageID, ordinal, text}); we subscribe to it
|
|
13
|
+
* and re-read the full session transcript each time, letting the offset
|
|
14
|
+
* cursor emit only NEW messages. `session.step.ended` / `session.idle` also
|
|
15
|
+
* exist but fire less precisely per completed text.
|
|
16
|
+
*/
|
|
17
|
+
import type { PluginContext } from "./types.js";
|
|
18
|
+
export declare const storageKeys: {
|
|
19
|
+
offset: (sessionID: string) => string;
|
|
20
|
+
captures: (sessionID: string) => string;
|
|
21
|
+
degraded: (sessionID: string) => string;
|
|
22
|
+
recall: (sessionID: string, userMessageID: string) => string;
|
|
23
|
+
};
|
|
24
|
+
export declare function setupPlugin(rawCtx: PluginContext): Promise<() => void>;
|
|
25
|
+
export type { EverosOptions, PluginContext } from "./types.js";
|
|
26
|
+
export type { EverosEpisode, EverosMessage, EverosError } from "./everos.js";
|
|
27
|
+
export { EverosClient } from "./everos.js";
|
|
28
|
+
export { extractTranscript } from "./extract.js";
|
|
29
|
+
export { formatRecall } from "./inject.js";
|
|
30
|
+
export { slugify, resolveIdentity } from "./identity.js";
|
|
31
|
+
declare const _default: {
|
|
32
|
+
id: string;
|
|
33
|
+
setup: (ctx: unknown) => Promise<() => void>;
|
|
34
|
+
};
|
|
35
|
+
export default _default;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* everos-opencode — persistent memory plugin for OpenCode V2.
|
|
3
|
+
*
|
|
4
|
+
* Zero agent discipline: capture each turn (fire-and-forget, deferred
|
|
5
|
+
* extraction), flush on the Nth capture and before compaction, and inject
|
|
6
|
+
* recall into future turns via the `context` hook. The plugin is LLM-free:
|
|
7
|
+
* it only talks HTTP to a local EverOS server; extraction runs server-side.
|
|
8
|
+
*
|
|
9
|
+
* Capture trigger (verified against @opencode/plugin 2.2.5 + @opencode/client
|
|
10
|
+
* generated event types): the V2 event stream has NO "message.*" events. The
|
|
11
|
+
* assistant-completion event is `session.text.ended`
|
|
12
|
+
* (data: {sessionID, assistantMessageID, ordinal, text}); we subscribe to it
|
|
13
|
+
* and re-read the full session transcript each time, letting the offset
|
|
14
|
+
* cursor emit only NEW messages. `session.step.ended` / `session.idle` also
|
|
15
|
+
* exist but fire less precisely per completed text.
|
|
16
|
+
*/
|
|
17
|
+
import { EverosClient, EverosError } from "./everos.js";
|
|
18
|
+
import { extractTranscript } from "./extract.js";
|
|
19
|
+
import { formatRecall } from "./inject.js";
|
|
20
|
+
import { resolveScope } from "./identity.js";
|
|
21
|
+
import { Logger } from "./log.js";
|
|
22
|
+
const DEFAULTS = {
|
|
23
|
+
everosUrl: "http://127.0.0.1:8000",
|
|
24
|
+
flushEvery: 3,
|
|
25
|
+
topK: 5,
|
|
26
|
+
recallMethod: "keyword",
|
|
27
|
+
enabled: true,
|
|
28
|
+
logLevel: "info",
|
|
29
|
+
};
|
|
30
|
+
function resolveConfig(options) {
|
|
31
|
+
// Precedence: explicit option > env > default.
|
|
32
|
+
const url = options.everosUrl ?? process.env.EVEROS_URL ?? DEFAULTS.everosUrl;
|
|
33
|
+
return {
|
|
34
|
+
everosUrl: url,
|
|
35
|
+
flushEvery: clampInt(options.flushEvery, DEFAULTS.flushEvery, 1),
|
|
36
|
+
topK: clampInt(options.topK, DEFAULTS.topK, 1),
|
|
37
|
+
recallMethod: options.recallMethod ?? DEFAULTS.recallMethod,
|
|
38
|
+
enabled: options.enabled ?? DEFAULTS.enabled,
|
|
39
|
+
logLevel: (options.logLevel ?? DEFAULTS.logLevel),
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function clampInt(raw, fallback, min) {
|
|
43
|
+
const n = typeof raw === "number" ? raw : Number.NaN;
|
|
44
|
+
return Number.isFinite(n) && n >= min ? Math.floor(n) : fallback;
|
|
45
|
+
}
|
|
46
|
+
export const storageKeys = {
|
|
47
|
+
offset: (sessionID) => `everos:offset:${sessionID}`,
|
|
48
|
+
captures: (sessionID) => `everos:captures:${sessionID}`,
|
|
49
|
+
degraded: (sessionID) => `everos:degraded:${sessionID}`,
|
|
50
|
+
recall: (sessionID, userMessageID) => `everos:recall:${sessionID}:${userMessageID}`,
|
|
51
|
+
};
|
|
52
|
+
export async function setupPlugin(rawCtx) {
|
|
53
|
+
const config = resolveConfig(rawCtx.options);
|
|
54
|
+
const log = new Logger(config.logLevel);
|
|
55
|
+
// Core plugin state. `null` when disabled — hooks become no-ops.
|
|
56
|
+
let core = null;
|
|
57
|
+
if (config.enabled) {
|
|
58
|
+
const client = new EverosClient(config.everosUrl);
|
|
59
|
+
const scopeBase = await resolveScope(rawCtx, "");
|
|
60
|
+
core = { ctx: rawCtx, client, scopeBase };
|
|
61
|
+
}
|
|
62
|
+
/** Mark a session degraded (connection refused / timeout), log once. */
|
|
63
|
+
const markDegraded = async (sessionID, err) => {
|
|
64
|
+
const key = storageKeys.degraded(sessionID);
|
|
65
|
+
const already = await rawCtx.storage.get(key);
|
|
66
|
+
if (!already) {
|
|
67
|
+
await rawCtx.storage.set(key, true);
|
|
68
|
+
const detail = err instanceof EverosError ? `${err.code}: ${err.message}` : String(err);
|
|
69
|
+
log.error(`degraded:${sessionID}`, `server unreachable, session degraded (will retry): ${detail}`);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
const withTimeoutGuard = async (fn, sessionID) => {
|
|
73
|
+
try {
|
|
74
|
+
await fn();
|
|
75
|
+
}
|
|
76
|
+
catch (err) {
|
|
77
|
+
await markDegraded(sessionID, err);
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
// ---- Recall injection -------------------------------------------------
|
|
81
|
+
const recallRegistration = await rawCtx.session.hook("context", async (input) => {
|
|
82
|
+
try {
|
|
83
|
+
if (!core || !config.enabled)
|
|
84
|
+
return;
|
|
85
|
+
const sessionID = input.sessionID;
|
|
86
|
+
// Dedupe per user message: the context hook fires on every model call,
|
|
87
|
+
// so the same user turn would otherwise trigger a search per call.
|
|
88
|
+
// The context hook delivers daemon messages ({id, role, content}),
|
|
89
|
+
// while ctx.session.context delivers {id, type, text}. Read both.
|
|
90
|
+
const messages = Array.isArray(input.messages) ? input.messages : [];
|
|
91
|
+
const roleOf = (m) => (typeof m?.role === "string" ? m.role : m?.type);
|
|
92
|
+
const textOf = (m) => {
|
|
93
|
+
if (typeof m?.text === "string")
|
|
94
|
+
return m.text;
|
|
95
|
+
if (typeof m?.content === "string")
|
|
96
|
+
return m.content;
|
|
97
|
+
if (Array.isArray(m?.content)) {
|
|
98
|
+
return m.content
|
|
99
|
+
.filter((p) => p?.type === "text" && typeof p.text === "string")
|
|
100
|
+
.map((p) => p.text)
|
|
101
|
+
.join("\n");
|
|
102
|
+
}
|
|
103
|
+
return "";
|
|
104
|
+
};
|
|
105
|
+
const isUser = (m) => roleOf(m) === "user";
|
|
106
|
+
const lastUser = [...messages].reverse().find(isUser);
|
|
107
|
+
const userKey = typeof lastUser?.id === "string" ? lastUser.id : `noid:${messages.length}`;
|
|
108
|
+
const dedupeKey = storageKeys.recall(sessionID, userKey);
|
|
109
|
+
if (await rawCtx.storage.get(dedupeKey))
|
|
110
|
+
return;
|
|
111
|
+
await rawCtx.storage.set(dedupeKey, true);
|
|
112
|
+
const query = messages
|
|
113
|
+
.filter(isUser)
|
|
114
|
+
.map(textOf)
|
|
115
|
+
.filter((t) => t.trim().length > 0)
|
|
116
|
+
.slice(-3)
|
|
117
|
+
.join(" ")
|
|
118
|
+
.slice(0, 2000);
|
|
119
|
+
if (query.trim().length === 0)
|
|
120
|
+
return;
|
|
121
|
+
const degraded = await rawCtx.storage.get(storageKeys.degraded(sessionID));
|
|
122
|
+
if (degraded)
|
|
123
|
+
return;
|
|
124
|
+
let episodes;
|
|
125
|
+
try {
|
|
126
|
+
episodes = await core.client.searchMemories(core.scopeBase.userId, query, {
|
|
127
|
+
method: config.recallMethod,
|
|
128
|
+
topK: config.topK,
|
|
129
|
+
scope: { appId: core.scopeBase.appId, projectId: core.scopeBase.projectId },
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
catch (err) {
|
|
133
|
+
await markDegraded(sessionID, err);
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
const block = formatRecall(episodes, { topK: config.topK });
|
|
137
|
+
if (block.length === 0)
|
|
138
|
+
return;
|
|
139
|
+
const system = Array.isArray(input.system) ? input.system : [];
|
|
140
|
+
system.push({ type: "text", text: block });
|
|
141
|
+
}
|
|
142
|
+
catch (err) {
|
|
143
|
+
// Never let recall break the turn.
|
|
144
|
+
log.debug(`recall error: ${err instanceof Error ? err.message : String(err)}`);
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
// ---- Capture ----------------------------------------------------------
|
|
148
|
+
const captureOnce = async (sessionID) => {
|
|
149
|
+
if (!core)
|
|
150
|
+
return;
|
|
151
|
+
await withTimeoutGuard(async () => {
|
|
152
|
+
const transcript = (await core.ctx.session.context({ sessionID }));
|
|
153
|
+
const offsetRaw = await rawCtx.storage.get(storageKeys.offset(sessionID));
|
|
154
|
+
const offset = typeof offsetRaw === "number" ? offsetRaw : 0;
|
|
155
|
+
const { messages, offset: nextOffset } = extractTranscript(transcript, offset, {
|
|
156
|
+
senderId: core.scopeBase.userId,
|
|
157
|
+
});
|
|
158
|
+
await rawCtx.storage.set(storageKeys.offset(sessionID), nextOffset);
|
|
159
|
+
if (messages.length === 0)
|
|
160
|
+
return;
|
|
161
|
+
const scope = {
|
|
162
|
+
session_id: sessionID.slice(0, 128),
|
|
163
|
+
app_id: core.scopeBase.appId,
|
|
164
|
+
project_id: core.scopeBase.projectId,
|
|
165
|
+
};
|
|
166
|
+
// Deferred extraction: buffered server-side, no LLM at capture time.
|
|
167
|
+
await core.client.addMemory(scope, messages, { deferExtraction: true });
|
|
168
|
+
const capturesRaw = await rawCtx.storage.get(storageKeys.captures(sessionID));
|
|
169
|
+
const captures = (typeof capturesRaw === "number" ? capturesRaw : 0) + 1;
|
|
170
|
+
await rawCtx.storage.set(storageKeys.captures(sessionID), captures);
|
|
171
|
+
if (captures % config.flushEvery === 0) {
|
|
172
|
+
await core.client.flushMemory(scope);
|
|
173
|
+
log.debug(`flushed after ${captures} captures (${sessionID})`);
|
|
174
|
+
}
|
|
175
|
+
}, sessionID);
|
|
176
|
+
};
|
|
177
|
+
// Serialize captures per session: events can arrive while a previous
|
|
178
|
+
// capture is still in flight, and concurrent reads of the offset cursor
|
|
179
|
+
// would double-capture the same messages.
|
|
180
|
+
const captureQueues = new Map();
|
|
181
|
+
// Fire-and-forget: the event subscription handler must never block turn end.
|
|
182
|
+
const enqueueCapture = (sessionID) => {
|
|
183
|
+
const prev = captureQueues.get(sessionID) ?? Promise.resolve();
|
|
184
|
+
const next = prev
|
|
185
|
+
.then(() => captureOnce(sessionID))
|
|
186
|
+
.catch(() => {
|
|
187
|
+
/* degraded latch handles reporting */
|
|
188
|
+
});
|
|
189
|
+
captureQueues.set(sessionID, next);
|
|
190
|
+
};
|
|
191
|
+
const controller = new AbortController();
|
|
192
|
+
const consumeEvents = async () => {
|
|
193
|
+
try {
|
|
194
|
+
const stream = rawCtx.event.subscribe({
|
|
195
|
+
types: ["session.text.ended"],
|
|
196
|
+
signal: controller.signal,
|
|
197
|
+
});
|
|
198
|
+
for await (const ev of stream) {
|
|
199
|
+
if (controller.signal.aborted)
|
|
200
|
+
break;
|
|
201
|
+
const sessionID = ev?.data?.sessionID;
|
|
202
|
+
if (typeof sessionID !== "string" || sessionID.length === 0)
|
|
203
|
+
continue;
|
|
204
|
+
enqueueCapture(sessionID);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
catch (err) {
|
|
208
|
+
if (!controller.signal.aborted) {
|
|
209
|
+
log.debug(`event subscription error: ${err instanceof Error ? err.message : String(err)}`);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
void consumeEvents();
|
|
214
|
+
// ---- Flush before compaction -----------------------------------------
|
|
215
|
+
const compactionRegistration = await rawCtx.session.hook("compaction", async (input) => {
|
|
216
|
+
if (!core)
|
|
217
|
+
return;
|
|
218
|
+
const sessionID = input.sessionID;
|
|
219
|
+
await withTimeoutGuard(async () => {
|
|
220
|
+
const scope = {
|
|
221
|
+
session_id: sessionID.slice(0, 128),
|
|
222
|
+
app_id: core.scopeBase.appId,
|
|
223
|
+
project_id: core.scopeBase.projectId,
|
|
224
|
+
};
|
|
225
|
+
await core.client.flushMemory(scope);
|
|
226
|
+
log.debug(`flushed before compaction (${sessionID})`);
|
|
227
|
+
}, sessionID);
|
|
228
|
+
});
|
|
229
|
+
// ---- Cleanup ----------------------------------------------------------
|
|
230
|
+
return () => {
|
|
231
|
+
controller.abort();
|
|
232
|
+
void recallRegistration.dispose();
|
|
233
|
+
void compactionRegistration.dispose();
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
export { EverosClient } from "./everos.js";
|
|
237
|
+
export { extractTranscript } from "./extract.js";
|
|
238
|
+
export { formatRecall } from "./inject.js";
|
|
239
|
+
export { slugify, resolveIdentity } from "./identity.js";
|
|
240
|
+
export default {
|
|
241
|
+
// Matches the V2 plugin object contract ({ id, setup }); kept structural so
|
|
242
|
+
// this module imports cleanly without the heavy SDK runtime in tests.
|
|
243
|
+
id: "everos-opencode",
|
|
244
|
+
setup: (ctx) => setupPlugin(ctx),
|
|
245
|
+
};
|
package/dist/inject.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Recall formatting: EverOS episodes → compact system-prompt block.
|
|
3
|
+
* Empty input yields "" (caller skips injection entirely).
|
|
4
|
+
*/
|
|
5
|
+
import type { EverosEpisode } from "./everos.js";
|
|
6
|
+
export declare function formatRecall(episodes: EverosEpisode[], opts?: {
|
|
7
|
+
topK?: number;
|
|
8
|
+
now?: number;
|
|
9
|
+
}): string;
|
package/dist/inject.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Recall formatting: EverOS episodes → compact system-prompt block.
|
|
3
|
+
* Empty input yields "" (caller skips injection entirely).
|
|
4
|
+
*/
|
|
5
|
+
function relativeDate(ts, now) {
|
|
6
|
+
if (typeof ts !== "number" || !Number.isFinite(ts) || ts <= 0)
|
|
7
|
+
return "";
|
|
8
|
+
const days = Math.floor((now - ts) / 86_400_000);
|
|
9
|
+
if (days <= 0)
|
|
10
|
+
return "today";
|
|
11
|
+
if (days === 1)
|
|
12
|
+
return "yesterday";
|
|
13
|
+
if (days < 30)
|
|
14
|
+
return `${days}d ago`;
|
|
15
|
+
const months = Math.floor(days / 30);
|
|
16
|
+
if (months < 12)
|
|
17
|
+
return `${months}mo ago`;
|
|
18
|
+
return `${Math.floor(months / 12)}y ago`;
|
|
19
|
+
}
|
|
20
|
+
export function formatRecall(episodes, opts = {}) {
|
|
21
|
+
const top = episodes
|
|
22
|
+
.slice(0, Math.max(1, opts.topK ?? 5))
|
|
23
|
+
.filter((e) => typeof e?.summary === "string" && e.summary.trim().length > 0);
|
|
24
|
+
if (top.length === 0)
|
|
25
|
+
return "";
|
|
26
|
+
const now = opts.now ?? Date.now();
|
|
27
|
+
const lines = top.map((e) => {
|
|
28
|
+
const date = relativeDate(e.timestamp, now);
|
|
29
|
+
const score = typeof e.score === "number" ? e.score.toFixed(2) : "?";
|
|
30
|
+
const dateSuffix = date.length > 0 ? ` (${date})` : "";
|
|
31
|
+
return `- ${e.summary.trim()} [score ${score}${dateSuffix}]`;
|
|
32
|
+
});
|
|
33
|
+
return [
|
|
34
|
+
"<everos-recall>",
|
|
35
|
+
"Relevant memories from previous sessions (may be imperfect; verify before relying on them):",
|
|
36
|
+
...lines,
|
|
37
|
+
"</everos-recall>",
|
|
38
|
+
].join("\n");
|
|
39
|
+
}
|
package/dist/log.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Once-only stderr logging, gated by log level. */
|
|
2
|
+
export type LogLevel = "debug" | "info" | "error" | "silent";
|
|
3
|
+
export declare class Logger {
|
|
4
|
+
private readonly threshold;
|
|
5
|
+
private readonly seen;
|
|
6
|
+
constructor(level?: LogLevel);
|
|
7
|
+
private emit;
|
|
8
|
+
debug(message: string): void;
|
|
9
|
+
info(key: string, message: string): void;
|
|
10
|
+
error(key: string, message: string): void;
|
|
11
|
+
}
|
package/dist/log.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/** Once-only stderr logging, gated by log level. */
|
|
2
|
+
const order = {
|
|
3
|
+
debug: 10,
|
|
4
|
+
info: 20,
|
|
5
|
+
error: 30,
|
|
6
|
+
silent: 99,
|
|
7
|
+
};
|
|
8
|
+
export class Logger {
|
|
9
|
+
threshold;
|
|
10
|
+
seen = new Set();
|
|
11
|
+
constructor(level = "info") {
|
|
12
|
+
this.threshold = order[level] ?? order.info;
|
|
13
|
+
}
|
|
14
|
+
emit(level, key, message) {
|
|
15
|
+
if (order[level] < this.threshold)
|
|
16
|
+
return;
|
|
17
|
+
if (level === "info" || level === "error") {
|
|
18
|
+
// once-only latch for info/error notices (e.g. degraded latch)
|
|
19
|
+
if (this.seen.has(key))
|
|
20
|
+
return;
|
|
21
|
+
this.seen.add(key);
|
|
22
|
+
}
|
|
23
|
+
process.stderr.write(`[everos-opencode] ${message}\n`);
|
|
24
|
+
}
|
|
25
|
+
debug(message) {
|
|
26
|
+
this.emit("debug", `debug:${message}`, message);
|
|
27
|
+
}
|
|
28
|
+
info(key, message) {
|
|
29
|
+
this.emit("info", key, message);
|
|
30
|
+
}
|
|
31
|
+
error(key, message) {
|
|
32
|
+
this.emit("error", key, message);
|
|
33
|
+
}
|
|
34
|
+
}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal structural interfaces for the subset of the OpenCode V2 plugin
|
|
3
|
+
* context this plugin uses. Kept local so the plugin core stays unit-testable
|
|
4
|
+
* with a synthetic context; the real SDK types are structurally compatible.
|
|
5
|
+
*/
|
|
6
|
+
/** Plugin options (all optional; see README / AGENTS.md). */
|
|
7
|
+
export interface EverosOptions {
|
|
8
|
+
everosUrl?: string;
|
|
9
|
+
flushEvery?: number;
|
|
10
|
+
topK?: number;
|
|
11
|
+
recallMethod?: string;
|
|
12
|
+
enabled?: boolean;
|
|
13
|
+
logLevel?: "debug" | "info" | "error" | "silent";
|
|
14
|
+
}
|
|
15
|
+
/** Subset of `ctx.storage` used here (JSON values in and out). */
|
|
16
|
+
export interface StorageLike {
|
|
17
|
+
get(key: string): Promise<unknown | undefined>;
|
|
18
|
+
set(key: string, value: unknown): Promise<void>;
|
|
19
|
+
remove(key: string): Promise<void>;
|
|
20
|
+
}
|
|
21
|
+
export interface EventSubscribeOptions {
|
|
22
|
+
readonly types?: readonly string[];
|
|
23
|
+
readonly signal?: AbortSignal;
|
|
24
|
+
}
|
|
25
|
+
/** Subset of `ctx.event`. */
|
|
26
|
+
export interface EventDomainLike {
|
|
27
|
+
subscribe(options?: EventSubscribeOptions): AsyncIterable<EverosEvent>;
|
|
28
|
+
}
|
|
29
|
+
/** OpenCode V2 event shape (subset we inspect). Resilient: extra fields ignored. */
|
|
30
|
+
export interface EverosEvent {
|
|
31
|
+
type: string;
|
|
32
|
+
data?: {
|
|
33
|
+
sessionID?: string;
|
|
34
|
+
[key: string]: unknown;
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
export interface RegistrationLike {
|
|
38
|
+
dispose(): Promise<void> | void;
|
|
39
|
+
}
|
|
40
|
+
/** Subset of `ctx.session`. */
|
|
41
|
+
export interface SessionDomainLike {
|
|
42
|
+
/** Register a session hook; returns a registration that can be disposed. */
|
|
43
|
+
hook(name: string, callback: (input: any) => Promise<void> | void): Promise<RegistrationLike>;
|
|
44
|
+
/** Full transcript for a session, newest appended: OpenCode `SessionMessageInfo[]`. */
|
|
45
|
+
context(input: {
|
|
46
|
+
sessionID: string;
|
|
47
|
+
}): Promise<unknown[]>;
|
|
48
|
+
}
|
|
49
|
+
/** Subset of `ctx.vcs` (optional — absent when no VCS is detected). */
|
|
50
|
+
export interface VcsDomainLike {
|
|
51
|
+
get(input?: Record<string, unknown>): Promise<unknown>;
|
|
52
|
+
}
|
|
53
|
+
/** Structural view of the V2 plugin setup context. */
|
|
54
|
+
export interface PluginContext {
|
|
55
|
+
readonly options: Readonly<Record<string, unknown>>;
|
|
56
|
+
readonly location: {
|
|
57
|
+
readonly project: {
|
|
58
|
+
readonly directory: string;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
readonly storage: StorageLike;
|
|
62
|
+
readonly event: EventDomainLike;
|
|
63
|
+
readonly session: SessionDomainLike;
|
|
64
|
+
readonly vcs?: VcsDomainLike;
|
|
65
|
+
}
|
package/dist/types.js
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,42 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ever-opencode",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "EverOS persistent memory plugin for OpenCode V2 \u2014 capture each turn, inject recall. Local-first, provider-neutral.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "Apache-2.0",
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
18
|
+
"engines": {
|
|
19
|
+
"node": ">=18"
|
|
20
|
+
},
|
|
21
|
+
"scripts": {
|
|
22
|
+
"build": "tsc",
|
|
23
|
+
"test": "vitest run",
|
|
24
|
+
"test:integration": "echo 'integration harness not yet implemented (real EverOS server required)'"
|
|
25
|
+
},
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"@opencode/plugin": "^2.2.5"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@types/node": "^24.0.0",
|
|
31
|
+
"typescript": "^5.7.0",
|
|
32
|
+
"vitest": "^3.0.0"
|
|
33
|
+
},
|
|
34
|
+
"repository": {
|
|
35
|
+
"type": "git",
|
|
36
|
+
"url": "git+https://github.com/xeon826/ever-opencode.git"
|
|
37
|
+
},
|
|
38
|
+
"homepage": "https://github.com/xeon826/ever-opencode#readme",
|
|
39
|
+
"bugs": {
|
|
40
|
+
"url": "https://github.com/xeon826/ever-opencode/issues"
|
|
41
|
+
}
|
|
42
|
+
}
|