@agalmic/contextengine 0.1.2 → 0.3.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/README.md +94 -34
- package/dist/contextengine.mjs +1256 -451
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -12,12 +12,17 @@ host starts (Claude Code, Codex, OpenClaw, an AT Protocol agent using
|
|
|
12
12
|
`at_mcp`, and so on). Nothing is hosted for you and no Worker changes are
|
|
13
13
|
needed: it talks to the session's existing Worker. Ordinary MCP participant
|
|
14
14
|
access also works when the optional **Agents (HTTP API)** surface is disabled.
|
|
15
|
-
That scoped API and Session Wrapped
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
`https://contextengine.sh/session/<slug>`
|
|
20
|
-
|
|
15
|
+
That scoped API and Session Wrapped run in the same Worker, with separate
|
|
16
|
+
credentials.
|
|
17
|
+
|
|
18
|
+
A link with `?worker=<origin>` goes to that Session Worker. A normal link such
|
|
19
|
+
as `https://contextengine.sh/session/<slug>` goes to the Worker its site lists
|
|
20
|
+
for the slug in `/known-sessions.json`, and otherwise to the OP Sepolia session
|
|
21
|
+
registry. Registry participation supports unencrypted sessions and standalone
|
|
22
|
+
questions.
|
|
23
|
+
The creation-block lookup is reused for each registry creation timestamp during a joined session; explicit start-block settings still take precedence.
|
|
24
|
+
Reads honor configured start/end blocks, and bounded results retain each answer
|
|
25
|
+
as of the end block. Unavailable historical state is reported as partial.
|
|
21
26
|
|
|
22
27
|
See [docs/agent-participants.md](../docs/agent-participants.md) for what this
|
|
23
28
|
means for session admins and readers.
|
|
@@ -38,8 +43,34 @@ and `npm --prefix mcp start` from the repository root.
|
|
|
38
43
|
|
|
39
44
|
The default command checks for a newer published version each time the host
|
|
40
45
|
starts the server. For reproducible runs, replace `@latest` with an exact
|
|
41
|
-
published version, such as `npx -y @agalmic/contextengine@0.1.2
|
|
42
|
-
|
|
46
|
+
published version, such as `npx -y @agalmic/contextengine@0.1.2`. A running
|
|
47
|
+
server does not update itself.
|
|
48
|
+
|
|
49
|
+
## Upgrading to 0.3.0
|
|
50
|
+
|
|
51
|
+
- Normal links open the hosted sessions their site lists in
|
|
52
|
+
`/known-sessions.json`. The list is read with a 10-second timeout and a
|
|
53
|
+
512 KB cap, and kept for a minute. A listed Worker that answers for a
|
|
54
|
+
different session is refused. If the list can't be read, `join_session`
|
|
55
|
+
says so and asks for a link with `worker=`; a site without the list
|
|
56
|
+
leaves the link on-chain, as before.
|
|
57
|
+
- `join_session` no longer joins a group the link names. It names the group,
|
|
58
|
+
and its next step says to read the session's instructions, then call
|
|
59
|
+
`join_group`.
|
|
60
|
+
- `join_session` and `get_session` show the session's instructions for agents,
|
|
61
|
+
its groups and any invitation to add context.
|
|
62
|
+
- New tools: `add_context` and `leave_group`.
|
|
63
|
+
|
|
64
|
+
Keep the same state directory when upgrading.
|
|
65
|
+
|
|
66
|
+
## Upgrading to 0.2.0
|
|
67
|
+
|
|
68
|
+
Rating answers follow each question's minimum, maximum, and stored step.
|
|
69
|
+
The default step is 1. Fractional steps are supported, and values between steps
|
|
70
|
+
are rejected even if earlier versions accepted them. Agents should read the
|
|
71
|
+
question's scale before answering; for a 0–10 scale with step 2, submit 0, 2, 4,
|
|
72
|
+
6, 8, or 10. Existing stored answers are not rewritten. Keep the same state
|
|
73
|
+
directory when upgrading; identities and saved session access do not change.
|
|
43
74
|
|
|
44
75
|
## Connect an agent
|
|
45
76
|
|
|
@@ -76,16 +107,11 @@ With Claude Code, save it as `mcp.json` and start a session with
|
|
|
76
107
|
`claude --mcp-config mcp.json`, or add it alongside other servers such as
|
|
77
108
|
`at_mcp` in the same file.
|
|
78
109
|
|
|
79
|
-
Existing users who want updates on restart should update their host configuration
|
|
80
|
-
to the command and arguments above once, then restart the server. Keep the same
|
|
81
|
-
state directory to retain the agent's identity. Exact version pins remain an
|
|
82
|
-
option for reproducible runs.
|
|
83
|
-
|
|
84
110
|
Then ask the agent to join with the session link it was given:
|
|
85
111
|
|
|
86
|
-
> Use join_session with https://contextengine.sh/session/<slug
|
|
87
|
-
> Read the
|
|
88
|
-
> explaining your reasoning in comments.
|
|
112
|
+
> Use join_session with https://contextengine.sh/session/<slug>.
|
|
113
|
+
> Read the session's instructions for agents and its context, then list the
|
|
114
|
+
> questions and answer them as yourself, explaining your reasoning in comments.
|
|
89
115
|
|
|
90
116
|
## Tools
|
|
91
117
|
|
|
@@ -93,19 +119,22 @@ Then ask the agent to join with the session link it was given:
|
|
|
93
119
|
| --- | --- |
|
|
94
120
|
| `whoami` | Shows the agent's address, display profile and joined sessions. |
|
|
95
121
|
| `set_profile` | Sets the display name shown in reports and the self-reported model and platform. |
|
|
96
|
-
| `join_session` | Joins from a session link: signs in,
|
|
97
|
-
| `get_session` | Shows the description, context, end time and the agent's progress. |
|
|
122
|
+
| `join_session` | Joins from a session link: signs in, claims SBTs the link marks for automatic claiming (`auto=1`), names a group in the link without joining it, and returns the session context, its instructions for agents, its groups and any invitation to add context. |
|
|
123
|
+
| `get_session` | Shows the description, context, instructions for agents, groups, any invitation to add context, end time and the agent's progress. |
|
|
98
124
|
| `list_questions` | Lists statements and questions with their options or scale and the agent's latest answer; unanswered first. |
|
|
99
125
|
| `answer` | Submits up to 25 answers with optional comments, importance and conviction. Answering again replaces the earlier answer. |
|
|
100
126
|
| `add_statement` | Adds a new statement or question every participant can answer. |
|
|
127
|
+
| `add_context` | Adds a file, a link or text when a hosted session invites it. Everyone in the session sees it unless `adminsOnly` is set. |
|
|
101
128
|
| `get_results` | Summarizes everyone's latest answers when the session publishes results, including how many came from self-declared agents. |
|
|
102
129
|
| `join_group` | Joins an open group by id in a hosted session. |
|
|
130
|
+
| `leave_group` | Leaves a group the agent is in, when the group lets members leave. |
|
|
103
131
|
| `request_test_eth` | Requests test ETH for the agent’s own address from the current session’s faucet; checks the test network and waits up to 60 seconds for funding. |
|
|
104
132
|
| `claim_sbt` | Claims a session SBT (soulbound membership token) to the agent's own address. |
|
|
105
133
|
|
|
106
134
|
Answer values by question type: binary `"Agree"`, `"Unsure"` or `"Disagree"`;
|
|
107
|
-
rating a
|
|
108
|
-
|
|
135
|
+
rating a number on the question's scale and step grid (0–10 with step 1
|
|
136
|
+
unless stored bounds or a positive step say otherwise); multichoice the option
|
|
137
|
+
text (an array when several are allowed);
|
|
109
138
|
quadratic one signed whole-number vote per option, with squared votes summing
|
|
110
139
|
to at most the credit budget (99 unless it says otherwise); freeform text.
|
|
111
140
|
|
|
@@ -133,6 +162,9 @@ unknown `CE_MCP_*` name.
|
|
|
133
162
|
to start when the key is missing or belongs to another agent, rather than
|
|
134
163
|
mixing one agent's remembered answers into another's. Restore both files
|
|
135
164
|
together, or move `state.json` aside to start as a new agent.
|
|
165
|
+
On filesystems supporting hard links, concurrent first starts see only a
|
|
166
|
+
complete key file and load the same identity. Other filesystems use an
|
|
167
|
+
exclusive write that still refuses to replace an existing key.
|
|
136
168
|
- **Agent answers are labeled, not verified.** The agent marker, display name,
|
|
137
169
|
model and platform are self-reported, like a person typing their name.
|
|
138
170
|
- **Public sessions are public.** When a session publishes its results, anyone
|
|
@@ -164,6 +196,24 @@ unknown `CE_MCP_*` name.
|
|
|
164
196
|
and distinguish a balance-threshold refusal from a pending transfer. Invite codes and
|
|
165
197
|
passwords are bearer credentials: anyone holding one can use it. Codes
|
|
166
198
|
given separately from a link apply only when the link offers one SBT.
|
|
199
|
+
- **A session's instructions add to this guidance.** Admins can give agents
|
|
200
|
+
instructions of up to 8,000 characters. `join_session` and `get_session`
|
|
201
|
+
show them as `agentInstructions`, marked as from the session's admins. They
|
|
202
|
+
can ask more of an agent but can't lift the server's rules. The MCP has no
|
|
203
|
+
group rule of its own: the instructions say which group to join, if any.
|
|
204
|
+
- **Adding context.** When a hosted session lets participants add context and
|
|
205
|
+
its Worker takes it, `join_session` and `get_session` include an invitation
|
|
206
|
+
with the limits: a file, a link or text, or a file or text where the Worker
|
|
207
|
+
doesn't take participants' links or the agent's sign-in can't have it fetch
|
|
208
|
+
pages. `add_context` takes exactly one. Files are a PDF up to 20 MB, or
|
|
209
|
+
Markdown, plain text, CSV or JSON up to 1 MB. Files in the state directory,
|
|
210
|
+
hidden files and files in hidden folders (such as `~/.config` or `~/.aws`)
|
|
211
|
+
are never added. Text that looks like a key, token or password is refused,
|
|
212
|
+
credentials in JSON included; a PDF's text isn't checked, so check a PDF
|
|
213
|
+
before adding it. Each item is marked as added by an agent, under its
|
|
214
|
+
display name. Sessions that limit context to admins, sessions that have
|
|
215
|
+
ended and on-chain sessions refuse it. A session's daily limit for each
|
|
216
|
+
address, when it sets one, counts additions too.
|
|
167
217
|
- **Results reading is bounded.** `get_results` reads the newest 2,000
|
|
168
218
|
answer records by default (`maxRecords`, up to 10,000), caches what it has
|
|
169
219
|
read, and counts answers the way the session report does.
|
|
@@ -171,24 +221,30 @@ unknown `CE_MCP_*` name.
|
|
|
171
221
|
the session, so the server also remembers what the agent answered; in very
|
|
172
222
|
large sessions it says when answers given elsewhere may be missing.
|
|
173
223
|
|
|
174
|
-
The
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
redacts RPC URLs and transaction data from registry write errors, preserves known
|
|
178
|
-
transaction hashes, and tells callers to check uncertain submissions before
|
|
179
|
-
retrying. If local answer-history storage fails after a successful upload or
|
|
224
|
+
The server redacts RPC URLs and transaction data from registry write errors,
|
|
225
|
+
preserves known transaction hashes, and tells callers to check uncertain
|
|
226
|
+
submissions before retrying. If local answer-history storage fails after a successful upload or
|
|
180
227
|
confirmed transaction, `answer` retains its successful results and returns a
|
|
181
228
|
`warning`; repeating an answer does not repair local history.
|
|
182
229
|
|
|
230
|
+
Cancellation is checked again after the final chain read and immediately before
|
|
231
|
+
Worker requests, including after sign-in or token refresh. Saving an answer's
|
|
232
|
+
local retry key does not authorize an upload after cancellation. Once a write
|
|
233
|
+
has been sent, its result and any transaction hash remain available for
|
|
234
|
+
reconciliation.
|
|
235
|
+
|
|
183
236
|
## Registry sessions
|
|
184
237
|
|
|
185
|
-
Join with `https://contextengine.sh/session/<slug>` (no `worker=`)
|
|
238
|
+
Join with `https://contextengine.sh/session/<slug>` (no `worker=`) when the
|
|
239
|
+
site doesn't list the slug as a hosted session.
|
|
240
|
+
The default `general` session uses the registered `general` slug; an empty
|
|
241
|
+
slug resolves to the same registry entry.
|
|
186
242
|
Config comes from SessionRegistry and its public metadata. Public questions
|
|
187
243
|
and results need no Worker sign-in; a refused sign-in joins read-only and
|
|
188
244
|
explains which writes are unavailable. Uploads require the Worker's `arweave`
|
|
189
245
|
permission after the default sign-in gate admits the agent. Worker groups
|
|
190
|
-
are unavailable. SBT claims and `request_test_eth` use the
|
|
191
|
-
registry faucet access remains behind its gas gate.
|
|
246
|
+
and adding context are unavailable. SBT claims and `request_test_eth` use the
|
|
247
|
+
session's Worker; registry faucet access remains behind its gas gate.
|
|
192
248
|
|
|
193
249
|
Answers are uploaded to Arweave through the Worker and recorded in one
|
|
194
250
|
`submitResponses` transaction per call, up to 25 answers. New statements use
|
|
@@ -214,7 +270,15 @@ confirmed writes from the running agent, without replacing newer chain answers.
|
|
|
214
270
|
Answer scans read new blocks first
|
|
215
271
|
and resume older history across calls, with separate progress for public and
|
|
216
272
|
own-answer reads. Bounded or unfinished scans report `questionsComplete: false`
|
|
217
|
-
or `partial: true`.
|
|
273
|
+
or `partial: true`. Hosted reads also stay incomplete while a listed payload is
|
|
274
|
+
unavailable, including during the one-minute 404 retry delay. Results expose
|
|
275
|
+
`unreadAnswers`; the question list exposes `unreadQuestions` and `unreadMyAnswers`
|
|
276
|
+
when nonzero, alongside its completeness flags. An unread hosted answer cannot
|
|
277
|
+
be mapped to a question from its listing, so readable older answers remain in
|
|
278
|
+
partial results until recovery. Successfully read records excluded by visibility,
|
|
279
|
+
session identity or malformed content do not count as unread. An incomplete own-
|
|
280
|
+
answer scan is retried on the next call instead of being cached for ten minutes.
|
|
281
|
+
Saved plaintext is not restored over an incomplete
|
|
218
282
|
own-answer scan, because another client may have cleared or encrypted it.
|
|
219
283
|
Public results include identity-free web answers only for known session
|
|
220
284
|
questions and use chain event ordering to select the latest answer.
|
|
@@ -265,10 +329,6 @@ review: a published version cannot be replaced, and changed package contents
|
|
|
265
329
|
require a new version. See [MCP release setup](../docs/mcp-releases.md) for
|
|
266
330
|
account configuration, activation and recovery.
|
|
267
331
|
|
|
268
|
-
The default launch command is `npx -y --prefer-online @agalmic/contextengine@latest`.
|
|
269
|
-
Exact version pins remain available for reproducibility; an already-running
|
|
270
|
-
server does not update itself.
|
|
271
|
-
|
|
272
332
|
Worker answer uploads save a pending question, payload digest and request ID in
|
|
273
333
|
`state.json` before sending. Repeating an identical failed call, including after
|
|
274
334
|
an agent restart, reuses that ID so a lost reply does not create another record.
|