@crvouga/mockingbird-service-hermes 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/openapi.yaml ADDED
@@ -0,0 +1,342 @@
1
+ openapi: 3.1.0
2
+ info:
3
+ title: Hermes Agent peer runs (Mockingbird)
4
+ version: "2026.8.31"
5
+ description: Pinned public peer-run submission and polling with explicit synthetic
6
+ observations. No agent or inference executes.
7
+ x-mockingbird-upstream:
8
+ url: https://github.com/NousResearch/hermes-agent/blob/29112bef099274229cadff79cdff7bf7b99c4b77/gateway/platforms/api_server_runs.py
9
+ note: Pinned v2026.8.31 route inventory; see API_EVIDENCE.md for researched behavior.
10
+ servers:
11
+ - url: http://hermes.mock
12
+ paths:
13
+ /v1/runs:
14
+ post:
15
+ operationId: RunCreate
16
+ summary: Admit a synthetic tracked run
17
+ x-mockingbird:
18
+ supported: true
19
+ parity:
20
+ enabled: true
21
+ safe: false
22
+ requestBody:
23
+ required: true
24
+ content:
25
+ application/json:
26
+ example:
27
+ input: synthetic playground prompt
28
+ schema:
29
+ type: object
30
+ required: [input]
31
+ properties:
32
+ input: {}
33
+ model: {}
34
+ session_id: {}
35
+ instructions: {}
36
+ conversation_history: {}
37
+ previous_response_id: {}
38
+ additionalProperties: true
39
+ responses:
40
+ "202":
41
+ description: Admission accepted; execution is still queued
42
+ content:
43
+ application/json:
44
+ schema:
45
+ type: object
46
+ required: [run_id, status, replayed]
47
+ properties:
48
+ run_id:
49
+ type: string
50
+ x-mockingbird-resource:
51
+ type: run
52
+ identity: true
53
+ status:
54
+ type: string
55
+ enum: [started, queued, running, waiting_for_approval, stopping, completed, failed, cancelled, interrupted]
56
+ replayed:
57
+ type: boolean
58
+ "400":
59
+ description: Pinned submission validation error
60
+ content:
61
+ application/json:
62
+ schema:
63
+ $ref: "#/components/schemas/HermesError"
64
+ "409":
65
+ description: Idempotency key reused with a different request fingerprint
66
+ content:
67
+ application/json:
68
+ schema:
69
+ $ref: "#/components/schemas/HermesError"
70
+ "429":
71
+ description: Pinned capacity throttle, available as an explicit fault scenario
72
+ headers:
73
+ Retry-After:
74
+ schema:
75
+ type: string
76
+ const: "1"
77
+ content:
78
+ application/json:
79
+ schema:
80
+ $ref: "#/components/schemas/ThrottleError"
81
+ "503":
82
+ description: Pinned gateway-draining envelope, available as an explicit fault scenario
83
+ headers:
84
+ Retry-After:
85
+ schema:
86
+ type: string
87
+ const: "1"
88
+ content:
89
+ application/json:
90
+ schema:
91
+ $ref: "#/components/schemas/HermesError"
92
+ "501":
93
+ description: Explicit unsupported request outside the implemented subset
94
+ content:
95
+ application/json:
96
+ schema:
97
+ $ref: "#/components/schemas/MockError"
98
+ /v1/runs/{run_id}:
99
+ get:
100
+ operationId: RunGet
101
+ summary: Poll a tracked run without advancing execution
102
+ x-mockingbird:
103
+ supported: true
104
+ parity:
105
+ enabled: true
106
+ safe: true
107
+ parameters:
108
+ - in: path
109
+ name: run_id
110
+ required: true
111
+ schema:
112
+ type: string
113
+ x-mockingbird-resource-ref:
114
+ type: run
115
+ responses:
116
+ "200":
117
+ description: Current public run observation
118
+ content:
119
+ application/json:
120
+ schema:
121
+ $ref: "#/components/schemas/Run"
122
+ "404":
123
+ description: Run not found in the selected namespace
124
+ content:
125
+ application/json:
126
+ schema:
127
+ $ref: "#/components/schemas/HermesError"
128
+ /v1/runs/{run_id}/stop:
129
+ post:
130
+ operationId: RunStop
131
+ summary: Request run interruption without assuming execution has settled
132
+ x-mockingbird:
133
+ supported: true
134
+ parity:
135
+ enabled: true
136
+ safe: false
137
+ parameters:
138
+ - in: path
139
+ name: run_id
140
+ required: true
141
+ schema:
142
+ type: string
143
+ x-mockingbird-resource-ref:
144
+ type: run
145
+ responses:
146
+ "200":
147
+ description: Stop accepted, or an unchanged terminal observation
148
+ content:
149
+ application/json:
150
+ schema:
151
+ oneOf:
152
+ - type: object
153
+ required: [run_id, status]
154
+ additionalProperties: false
155
+ properties:
156
+ run_id:
157
+ type: string
158
+ status:
159
+ type: string
160
+ const: stopping
161
+ - $ref: "#/components/schemas/Run"
162
+ "404":
163
+ description: Run missing or inaccessible in the selected synthetic scope
164
+ content:
165
+ application/json:
166
+ schema:
167
+ $ref: "#/components/schemas/HermesError"
168
+ "409":
169
+ description: Active run belongs to a different live modeled gateway
170
+ content:
171
+ application/json:
172
+ schema:
173
+ $ref: "#/components/schemas/HermesError"
174
+ /v1/runs/{run_id}/events:
175
+ get:
176
+ operationId: RunEvents
177
+ summary: Stream run events
178
+ x-mockingbird:
179
+ supported: false
180
+ reason: SSE is outside the public peer-run mock subset.
181
+ parity:
182
+ enabled: false
183
+ reason: No provider operation is implemented in the scaffold.
184
+ safe: true
185
+ parameters:
186
+ - in: path
187
+ name: run_id
188
+ required: true
189
+ schema:
190
+ type: string
191
+ responses:
192
+ "501":
193
+ description: Explicit Mockingbird-only unsupported operation
194
+ content:
195
+ application/json:
196
+ schema:
197
+ $ref: "#/components/schemas/MockError"
198
+ /v1/runs/{run_id}/approval:
199
+ post:
200
+ operationId: RunApproval
201
+ summary: Resolve run approval
202
+ x-mockingbird:
203
+ supported: false
204
+ reason: Host tool approval execution is outside this mock.
205
+ parity:
206
+ enabled: false
207
+ reason: No provider operation is implemented in the scaffold.
208
+ safe: false
209
+ parameters:
210
+ - in: path
211
+ name: run_id
212
+ required: true
213
+ schema:
214
+ type: string
215
+ responses:
216
+ "501":
217
+ description: Explicit Mockingbird-only unsupported operation
218
+ content:
219
+ application/json:
220
+ schema:
221
+ $ref: "#/components/schemas/MockError"
222
+ /v1/runs/{run_id}/steer:
223
+ post:
224
+ operationId: RunSteer
225
+ summary: Steer active execution
226
+ x-mockingbird:
227
+ supported: false
228
+ reason: Agent execution and steering are outside this mock.
229
+ parity:
230
+ enabled: false
231
+ reason: No provider operation is implemented in the scaffold.
232
+ safe: false
233
+ parameters:
234
+ - in: path
235
+ name: run_id
236
+ required: true
237
+ schema:
238
+ type: string
239
+ responses:
240
+ "501":
241
+ description: Explicit Mockingbird-only unsupported operation
242
+ content:
243
+ application/json:
244
+ schema:
245
+ $ref: "#/components/schemas/MockError"
246
+ components:
247
+ schemas:
248
+ HermesError:
249
+ type: object
250
+ required: [error]
251
+ properties:
252
+ error:
253
+ type: object
254
+ required: [message, type, param, code]
255
+ properties:
256
+ message:
257
+ type: string
258
+ type:
259
+ type: string
260
+ const: invalid_request_error
261
+ param:
262
+ type: "null"
263
+ code:
264
+ type: [string, "null"]
265
+ ThrottleError:
266
+ type: object
267
+ required: [error]
268
+ properties:
269
+ error:
270
+ type: object
271
+ required: [message, type, param, code]
272
+ properties:
273
+ message:
274
+ type: string
275
+ type:
276
+ type: string
277
+ const: rate_limit_error
278
+ param:
279
+ type: "null"
280
+ code:
281
+ type: string
282
+ const: rate_limit_exceeded
283
+ Run:
284
+ type: object
285
+ required: [object, run_id, status, created_at, updated_at, session_id, model]
286
+ properties:
287
+ object:
288
+ type: string
289
+ const: hermes.run
290
+ run_id:
291
+ type: string
292
+ status:
293
+ type: string
294
+ enum: [queued, running, waiting_for_approval, stopping, completed, failed, cancelled, interrupted]
295
+ created_at:
296
+ type: number
297
+ updated_at:
298
+ type: number
299
+ session_id: {}
300
+ model: {}
301
+ last_event:
302
+ type: string
303
+ output:
304
+ type: string
305
+ error:
306
+ type: string
307
+ pending_steer:
308
+ type: string
309
+ approval:
310
+ type: object
311
+ additionalProperties: true
312
+ usage:
313
+ type: object
314
+ required: [input_tokens, output_tokens, total_tokens]
315
+ properties:
316
+ input_tokens:
317
+ type: integer
318
+ minimum: 0
319
+ output_tokens:
320
+ type: integer
321
+ minimum: 0
322
+ total_tokens:
323
+ type: integer
324
+ minimum: 0
325
+ MockError:
326
+ type: object
327
+ required: [error]
328
+ properties:
329
+ error:
330
+ type: object
331
+ required: [message, type, param, code]
332
+ properties:
333
+ message:
334
+ type: string
335
+ type:
336
+ type: string
337
+ const: mockingbird_unsupported
338
+ param:
339
+ type: "null"
340
+ code:
341
+ type: string
342
+ const: operation_not_implemented
@@ -0,0 +1,99 @@
1
+ # Pinned Hermes runtime oracle
2
+
3
+ This opt-in harness compares Mockingbird with Hermes `v2026.8.31`, commit
4
+ `29112bef099274229cadff79cdff7bf7b99c4b77`. It is not part of default tests or
5
+ setup. The authorized run passed 33 comparisons;
6
+ [the recorded report](../evidence/pinned-oracle.json) contains the observations
7
+ and provenance. This establishes only the declared comparison matrix.
8
+
9
+ ## Execution boundary
10
+
11
+ `source-lock.json` records exact source hashes and upstream paths. `fetch.py`
12
+ downloads only those files; `sources.py` verifies every hash before execution.
13
+ Python must be `>=3.11,<3.14`; aiohttp is pinned to `3.14.3`, matching the upstream
14
+ release's messaging extra. No full Hermes installation is needed.
15
+
16
+ The entire pinned run-handler and idempotency-store modules execute unchanged.
17
+ Ancillary definitions are selected from original AST nodes, including transitive
18
+ local definition dependencies; function bodies are not rewritten. The report lists
19
+ every selected definition. The pinned SQLite journal-mode helper and SQLite
20
+ version guard are retained, as are the upstream schema, transaction, retention,
21
+ lookup, reservation, status persistence and owner PID/start-time checks.
22
+
23
+ The adapter supplies only the ordinary default listener. Original auth and
24
+ session-key parsing functions remain intact in their upstream no-key test mode.
25
+ This does not test production authentication. Hosted-room requests are excluded;
26
+ no operational board, credentials, webhook, tool or inference execution is used.
27
+
28
+ Declared substitutions:
29
+
30
+ - `_create_agent` returns a scripted executor with an explicit completion latch.
31
+ The pinned background handler still owns running, stop races, failure,
32
+ cancellation and completion transitions.
33
+ - Session binding, approval notification registration and tool-process ownership
34
+ hooks are inert test integrations. No host tool runs or child-tool process is
35
+ created. The upstream hard-interrupt compatibility function calls the scripted
36
+ agent's interrupt method.
37
+ - Routing returns the default route, transcript history is empty, profile context
38
+ is fixed to default, and automatic capacity admission is disabled. These are
39
+ outside the comparison matrix; throttle/draining scenarios belong to US-021.
40
+ - Only the loaded run/store modules' `time` bindings use a controlled clock.
41
+ Sweeps invoke the upstream one-shot sweep; the global Python clock is unchanged.
42
+ - Gateway startup and unrelated imports are not loaded. Missing optional journal
43
+ configuration takes the upstream default; no operational Hermes home is read.
44
+
45
+ ## Disposable process and database operations
46
+
47
+ Each comparison creates a unique directory beneath `.mockingbird/hermes-oracle/`.
48
+ The pinned store initializes its own SQLite schema there and may perform its
49
+ upstream schema adjustments and retention DELETE statements. No existing database
50
+ is opened. The comparison deliberately exits the owned Python process without
51
+ executor/connection cleanup, then starts a new process against that same disposable
52
+ file. This proves the measured restart behavior, not power-loss durability.
53
+
54
+ The harness also starts its own loopback Mockingbird HTTP server and closes it in
55
+ cleanup. Python startup failures may terminate only that fixture child. Source,
56
+ virtualenv, caches and database/report artifacts remain inside the project; no
57
+ cleanup deletes them automatically.
58
+
59
+ Repository rules require explicit approval for dependency installation, database
60
+ initialization/migrations/DELETE and process lifecycle before the run. The opt-in
61
+ flag is a guard, not a grant of authority.
62
+
63
+ After approval, prepare the environment using the existing compatible Python:
64
+
65
+ ```sh
66
+ mkdir -p .mockingbird/tmp .mockingbird/uv-cache
67
+ TMPDIR="$PWD/.mockingbird/tmp" uv venv --python python3.11 --no-python-downloads --cache-dir .mockingbird/uv-cache .mockingbird/hermes-oracle-venv
68
+ TMPDIR="$PWD/.mockingbird/tmp" uv pip install --python .mockingbird/hermes-oracle-venv/bin/python --cache-dir .mockingbird/uv-cache -r packages/service/hermes/oracle/requirements.lock
69
+ PYTHONDONTWRITEBYTECODE=1 python3.11 packages/service/hermes/oracle/fetch.py --fetch
70
+ bun run --cwd packages/service/hermes build
71
+ MOCKINGBIRD_HERMES_ORACLE_APPROVED=1 HERMES_ORACLE_PYTHON="$PWD/.mockingbird/hermes-oracle-venv/bin/python" node packages/service/hermes/oracle/compare.mjs --run
72
+ ```
73
+
74
+ The report records the source hashes, interpreter/aiohttp/SQLite versions,
75
+ selected definitions and compared synthetic observations. Only top-level `run_id` and `session_id` identity fields are mapped between sides.
76
+ The exact pinned 404 `run_not_found` message template maps its ID suffix; differing
77
+ prefixes or trailing text fail comparison. All other error/result strings, status,
78
+ replay headers and timestamps remain unchanged and compared.
79
+
80
+ Verified matrix: admission/running polling, active/terminal replay, changed-body
81
+ conflict, stop/cancel, completion winning a stop race, execution failure,
82
+ terminal/unfinished/keyless real-process restart, interrupted replay, exact one-hour
83
+ cache boundaries and exact24hour
84
+ retention equality, GET without durable pruning, expiry/re-admission and ordinary
85
+ 404 after pruning plus sweep. A failure leaves US-022 incomplete.
86
+
87
+ ## Recorded execution
88
+
89
+ The passing run used Python3.11.16, aiohttp3.14.3 and SQLite3.53.1. Both owned
90
+ process epochs opened the disposable database in WAL mode; their distinct PIDs
91
+ are recorded. The report includes all10 installed dependency versions, also
92
+ captured in `requirements.lock` for repeat setup. No production or pre-existing
93
+ Hermes database was used. The 33 comparisons all matched without changing the
94
+ mock's implementation or weakening field comparison.
95
+
96
+ Initial harness execution exposed two integration defects: importing typing's
97
+ module metadata overwrote the synthetic module name, and the run-event callback
98
+ binding omitted the upstream namespace argument. Both were fixed in the harness;
99
+ upstream functions, source hashes, auth logic and database logic were unchanged.