@sharedcontext/sdk 0.0.0-stage → 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/LICENSE-APACHE +201 -0
- package/LICENSE-MIT +21 -0
- package/NOTICE +8 -0
- package/README.md +94 -2
- package/dist/canonical.d.ts +47 -0
- package/dist/canonical.js +257 -0
- package/dist/client.d.ts +96 -0
- package/dist/client.js +205 -0
- package/dist/constants.d.ts +19 -0
- package/dist/constants.js +21 -0
- package/dist/event.d.ts +104 -0
- package/dist/event.js +173 -0
- package/dist/generated/content.d.ts +588 -0
- package/dist/generated/content.js +3 -0
- package/dist/generated/schemas.d.ts +10 -0
- package/dist/generated/schemas.js +22 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +8 -0
- package/dist/reasons.d.ts +14 -0
- package/dist/reasons.js +142 -0
- package/dist/schema.d.ts +45 -0
- package/dist/schema.js +285 -0
- package/dist/types.d.ts +230 -0
- package/dist/types.js +3 -0
- package/package.json +46 -4
- package/schemas/sharedcontext-1/changes.schema.json +128 -0
- package/schemas/sharedcontext-1/content.schema.json +2076 -0
- package/schemas/sharedcontext-1/context.schema.json +218 -0
- package/schemas/sharedcontext-1/event.schema.json +55 -0
- package/schemas/sharedcontext-1/execution.schema.json +342 -0
- package/schemas/sharedcontext-1/history/content-1.0.schema.json +1915 -0
- package/schemas/sharedcontext-1/lineage.schema.json +753 -0
- package/schemas/sharedcontext-1/mcp-tools.schema.json +1357 -0
- package/schemas/sharedcontext-1/stored-event.schema.json +14 -0
- package/schemas/sharedcontext-directory-1/members.schema.json +52 -0
- package/schemas/sharedcontext-directory-1/memberships.schema.json +32 -0
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "sharedcontext/1.5, the execution vocabulary",
|
|
4
|
+
"$comment": "sharedcontext/1.5, an additive minor of sharedcontext/1: the v tag stays \"1\". Holds only what the minor adds or changes: four new types (run.planned, run.decided, attempt.started, attempt.ended), the lesson layer on note.added, the visibility mark, two read tools (run_events, claim_state) and two reject names. Every other type is as in content.schema.json; note.added copies 1.0's definition and adds to it; shared nested shapes are $refs into content.schema.json. Nested objects stay lenient, top levels strict. Served only when the policy turns execution.vocabulary on (crates/sharedcontext/src/work/execution.rs). The minor's cases and two worked runs are in crates/sharedcontext/tests/work/execution/, run against the code by its tests. Not yet merged into content.schema.json and mcp-tools.schema.json.",
|
|
5
|
+
"$defs": {
|
|
6
|
+
"EventId": {
|
|
7
|
+
"type": "string",
|
|
8
|
+
"pattern": "^[0-9a-f]{64}$",
|
|
9
|
+
"$comment": "a work event's id (64 lower-case hex)"
|
|
10
|
+
},
|
|
11
|
+
"Pubkey": {
|
|
12
|
+
"type": "string",
|
|
13
|
+
"pattern": "^[0-9a-f]{64}$",
|
|
14
|
+
"$comment": "an x-only public key of the actor registry"
|
|
15
|
+
},
|
|
16
|
+
"Digest": {
|
|
17
|
+
"type": "string",
|
|
18
|
+
"pattern": "^sha256:[0-9a-f]{64}$",
|
|
19
|
+
"$comment": "bytes in object storage, by digest; the form of the job envelope's refs"
|
|
20
|
+
},
|
|
21
|
+
"StepId": {
|
|
22
|
+
"type": "string",
|
|
23
|
+
"pattern": "^[A-Za-z0-9._:-]{1,64}$",
|
|
24
|
+
"$comment": "a step of the run's plan; main is the one step of a run with no run.planned"
|
|
25
|
+
},
|
|
26
|
+
"Visibility": {
|
|
27
|
+
"enum": ["agent", "human"],
|
|
28
|
+
"$comment": "The visibility mark. agent: tracker, code-host and chat projections leave the event out. human: projections treat it as today. Absent: the type's default, agent for the four execution types and for note.added{layer: lesson}; as today for every other type and layer."
|
|
29
|
+
},
|
|
30
|
+
"Strategy": {
|
|
31
|
+
"type": "object",
|
|
32
|
+
"$comment": "A strategy is versioned policy data pinned in the log. name is the strategy's name, digest the bytes of its definition. The log records it; whether it is the definition in force is the controller's check at run start and an auditor's afterwards (the log does not read the policy's exec section).",
|
|
33
|
+
"properties": {
|
|
34
|
+
"name": { "type": "string", "minLength": 1, "maxLength": 64 },
|
|
35
|
+
"digest": { "$ref": "#/$defs/Digest" }
|
|
36
|
+
},
|
|
37
|
+
"required": ["name", "digest"]
|
|
38
|
+
},
|
|
39
|
+
"PlanStep": {
|
|
40
|
+
"type": "object",
|
|
41
|
+
"$comment": "one step (a batch) of a plan, by the digest of its own description; after lists the steps it waits for (an order edge, not a claim)",
|
|
42
|
+
"properties": {
|
|
43
|
+
"step": { "$ref": "#/$defs/StepId" },
|
|
44
|
+
"digest": { "$ref": "#/$defs/Digest" },
|
|
45
|
+
"after": { "type": "array", "items": { "$ref": "#/$defs/StepId" } }
|
|
46
|
+
},
|
|
47
|
+
"required": ["step", "digest"]
|
|
48
|
+
},
|
|
49
|
+
"Why": {
|
|
50
|
+
"type": "object",
|
|
51
|
+
"$comment": "why a decision was taken: the strategy's rule that fired, the digest of what it read (scores, candidates), and a short text for people",
|
|
52
|
+
"properties": {
|
|
53
|
+
"rule": { "type": "string", "minLength": 1, "maxLength": 128 },
|
|
54
|
+
"inputs": { "anyOf": [{ "type": "null" }, { "$ref": "#/$defs/Digest" }] },
|
|
55
|
+
"text": { "type": ["string", "null"], "maxLength": 1024 }
|
|
56
|
+
},
|
|
57
|
+
"required": ["rule"]
|
|
58
|
+
},
|
|
59
|
+
"LessonEvidence": {
|
|
60
|
+
"type": "object",
|
|
61
|
+
"$comment": "what a lesson rests on: an event of this log (an attempt.ended, a findings.seen), a record by digest, or both",
|
|
62
|
+
"properties": {
|
|
63
|
+
"event": { "$ref": "#/$defs/EventId" },
|
|
64
|
+
"record": { "$ref": "#/$defs/Digest" }
|
|
65
|
+
},
|
|
66
|
+
"anyOf": [{ "required": ["event"] }, { "required": ["record"] }]
|
|
67
|
+
},
|
|
68
|
+
"Lesson": {
|
|
69
|
+
"type": "object",
|
|
70
|
+
"$comment": "A structured note layer. guidance is what to do next time; observation what happened; scope narrows where it applies below the node it is written on (node kinds, labels); evidence what it rests on; run the run it came from. Who may pin one, and how it enters a context bundle, is context.schema.json's (sharedcontext/1.6). Text sizes as note text (MAX_BODY_BYTES, 16 KiB, for the whole content).",
|
|
71
|
+
"properties": {
|
|
72
|
+
"guidance": { "type": "string", "minLength": 1, "maxLength": 2048 },
|
|
73
|
+
"observation": { "type": ["string", "null"], "maxLength": 2048 },
|
|
74
|
+
"scope": {
|
|
75
|
+
"type": ["object", "null"],
|
|
76
|
+
"properties": {
|
|
77
|
+
"kinds": { "type": "array", "items": { "type": "string" } },
|
|
78
|
+
"labels": { "type": "array", "items": { "type": "string" } }
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
"evidence": { "type": "array", "items": { "$ref": "#/$defs/LessonEvidence" } },
|
|
82
|
+
"run": { "anyOf": [{ "type": "null" }, { "$ref": "#/$defs/EventId" }] }
|
|
83
|
+
},
|
|
84
|
+
"required": ["guidance"]
|
|
85
|
+
},
|
|
86
|
+
"run.planned": {
|
|
87
|
+
"type": "object",
|
|
88
|
+
"additionalProperties": false,
|
|
89
|
+
"$comment": "New type. The plan of a run: the strategy, the plan's bytes by digest and its steps by digest. Signed by the holder of the run's claim while it is live; tag n = the claim's node. A re-plan names the plan it replaces in supersedes. Log rules (not shape): run is the live claim of n held by the signer (not_claimant, no_live_claim, claim_mismatch); step ids unique and after names only steps of this plan (invalid_value); supersedes names a run.planned of the same run (invalid_value).",
|
|
90
|
+
"properties": {
|
|
91
|
+
"run": { "$ref": "#/$defs/EventId", "$comment": "the run's claim: the event id of its claim.taken (the job's dedupe_key)" },
|
|
92
|
+
"strategy": { "$ref": "#/$defs/Strategy" },
|
|
93
|
+
"plan": { "$ref": "content.schema.json#/$defs/Blob" },
|
|
94
|
+
"steps": { "type": "array", "minItems": 1, "items": { "$ref": "#/$defs/PlanStep" } },
|
|
95
|
+
"supersedes": { "anyOf": [{ "type": "null" }, { "$ref": "#/$defs/EventId" }] },
|
|
96
|
+
"visibility": { "$ref": "#/$defs/Visibility" }
|
|
97
|
+
},
|
|
98
|
+
"required": ["run", "strategy", "plan", "steps"]
|
|
99
|
+
},
|
|
100
|
+
"run.decided": {
|
|
101
|
+
"type": "object",
|
|
102
|
+
"additionalProperties": false,
|
|
103
|
+
"$comment": "New type. A decision that changes what happens, written before it is acted on: assign a step to an assignee on a node for a round, skip a step, or stop the run. Signed by the holder of the run's claim while it is live; tag n = the claim's node; for assign, tag p = to. Log rules (not shape): the run's claim is live and held by the signer (not_claimant, no_live_claim, claim_mismatch); step is a step of the plan in force, or main when the run has no plan (unknown_step); for assign, to is a registry key whose role may sign claim.taken and node an open node of the project (invalid_value, unknown_node), and round is greater than every earlier round of the step in this run (invalid_value); nothing after stop (invalid_value).",
|
|
104
|
+
"properties": {
|
|
105
|
+
"run": { "$ref": "#/$defs/EventId" },
|
|
106
|
+
"action": { "enum": ["assign", "skip", "stop"] },
|
|
107
|
+
"step": { "anyOf": [{ "type": "null" }, { "$ref": "#/$defs/StepId" }] },
|
|
108
|
+
"round": { "type": ["integer", "null"], "minimum": 1 },
|
|
109
|
+
"to": { "anyOf": [{ "type": "null" }, { "$ref": "#/$defs/Pubkey" }] },
|
|
110
|
+
"node": { "type": ["string", "null"], "minLength": 1, "$comment": "the node the assignee claims and works the step on: the run's own node, or another (a change node for a batch)" },
|
|
111
|
+
"why": { "$ref": "#/$defs/Why" },
|
|
112
|
+
"visibility": { "$ref": "#/$defs/Visibility" }
|
|
113
|
+
},
|
|
114
|
+
"required": ["run", "action", "why"],
|
|
115
|
+
"allOf": [
|
|
116
|
+
{
|
|
117
|
+
"if": { "properties": { "action": { "const": "assign" } }, "required": ["action"] },
|
|
118
|
+
"then": {
|
|
119
|
+
"required": ["step", "round", "to", "node"],
|
|
120
|
+
"properties": { "step": { "$ref": "#/$defs/StepId" }, "round": { "type": "integer" }, "to": { "$ref": "#/$defs/Pubkey" }, "node": { "type": "string" } }
|
|
121
|
+
},
|
|
122
|
+
"$comment": "assign names the step, the round, the assignee and the node"
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"if": { "properties": { "action": { "const": "skip" } }, "required": ["action"] },
|
|
126
|
+
"then": { "required": ["step"], "properties": { "step": { "$ref": "#/$defs/StepId" } } },
|
|
127
|
+
"$comment": "skip names the step"
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
"if": { "properties": { "action": { "enum": ["skip", "stop"] } }, "required": ["action"] },
|
|
131
|
+
"then": { "not": { "anyOf": [{ "required": ["to"], "properties": { "to": { "type": "string" } } }, { "required": ["round"], "properties": { "round": { "type": "integer" } } }] } },
|
|
132
|
+
"$comment": "only assign has an assignee and a round"
|
|
133
|
+
}
|
|
134
|
+
]
|
|
135
|
+
},
|
|
136
|
+
"attempt.started": {
|
|
137
|
+
"type": "object",
|
|
138
|
+
"additionalProperties": false,
|
|
139
|
+
"$comment": "New type. Written by the assignee before the work starts, under its own live claim on n; tag e = decision. For a job-backed claim, an execution gateway writes it as the claimant before it submits the job. Log rules (not shape): claim is the live claim of n held by the signer (not_claimant, no_live_claim, claim_mismatch); the run's claim is live (no_live_claim); decision is a run.decided{assign} of this run naming this step, round, the signer as to and n as node (no_decision); one start per (run, step, round) (invalid_value).",
|
|
140
|
+
"properties": {
|
|
141
|
+
"run": { "$ref": "#/$defs/EventId" },
|
|
142
|
+
"claim": { "$ref": "#/$defs/EventId", "$comment": "the claim the attempt runs under; equals run when the run's claimant works the step itself" },
|
|
143
|
+
"step": { "$ref": "#/$defs/StepId" },
|
|
144
|
+
"round": { "type": "integer", "minimum": 1 },
|
|
145
|
+
"decision": { "$ref": "#/$defs/EventId" },
|
|
146
|
+
"session": { "anyOf": [{ "type": "null" }, { "$ref": "content.schema.json#/$defs/SessionRef" }], "$comment": "the session reference, when the assignee knows it before the work starts (a self-running agent's session); a gateway writes the start before submit, so it leaves this out and the job id follows on the job-id note and on attempt.ended" },
|
|
147
|
+
"visibility": { "$ref": "#/$defs/Visibility" }
|
|
148
|
+
},
|
|
149
|
+
"required": ["run", "claim", "step", "round", "decision"]
|
|
150
|
+
},
|
|
151
|
+
"attempt.ended": {
|
|
152
|
+
"type": "object",
|
|
153
|
+
"additionalProperties": false,
|
|
154
|
+
"$comment": "New type. The outcome of an attempt, signed by the key that signed its start; tag e = started; no live claim needed (an outcome after a lapse is still recorded, as a note is); allowed on a closed node. outcome follows the job's end: completed, failed, budget_exceeded, cancelled; abandoned when the claim ended first (lapse, self-fencing, max_hold). Log rules (not shape): started is an attempt.started of this run, step and round signed by the same key (not_claimant, invalid_value); one end per start (invalid_value). A job's artifacts are never evidence: record is a reference, and only the evaluator's system-signed pair closes work.",
|
|
155
|
+
"properties": {
|
|
156
|
+
"run": { "$ref": "#/$defs/EventId" },
|
|
157
|
+
"step": { "$ref": "#/$defs/StepId" },
|
|
158
|
+
"round": { "type": "integer", "minimum": 1 },
|
|
159
|
+
"started": { "$ref": "#/$defs/EventId" },
|
|
160
|
+
"outcome": { "enum": ["completed", "failed", "budget_exceeded", "cancelled", "abandoned"] },
|
|
161
|
+
"record": { "anyOf": [{ "type": "null" }, { "$ref": "content.schema.json#/$defs/Blob" }], "$comment": "the attempt's record by digest: the job's index manifest, or a runner's record" },
|
|
162
|
+
"changes": { "type": "array", "items": { "type": "string" }, "$comment": "change nodes the attempt produced" },
|
|
163
|
+
"reasons": { "type": "array", "items": { "type": "string", "maxLength": 256 }, "$comment": "the job's status reasons, short" },
|
|
164
|
+
"session": { "anyOf": [{ "type": "null" }, { "$ref": "content.schema.json#/$defs/SessionRef" }], "$comment": "the job that ran the attempt; a gateway learns the job id only from submit, after attempt.started, so the id is on this event and on the job-id note" },
|
|
165
|
+
"visibility": { "$ref": "#/$defs/Visibility" }
|
|
166
|
+
},
|
|
167
|
+
"required": ["run", "step", "round", "started", "outcome"]
|
|
168
|
+
},
|
|
169
|
+
"note.added": {
|
|
170
|
+
"type": "object",
|
|
171
|
+
"additionalProperties": false,
|
|
172
|
+
"$comment": "sharedcontext/1.5: 1.0's note.added plus the layer lesson, the field lesson (required with that layer, refused with any other) and visibility. Who may write a lesson: as note.added (agent, person, steward); pinning one is context.schema.json's (sharedcontext/1.6). Policy rows: note.added:lesson joins allowed_on_closed (a lesson learnt after the close). An older log refuses all three (invalid_value for the layer, unknown_field for the fields).",
|
|
173
|
+
"properties": {
|
|
174
|
+
"layer": { "enum": ["pinned", "working", "summary", "lesson"], "$comment": "1.0: crates/sharedcontext/src/work/types.rs NOTE_LAYERS; lesson added" },
|
|
175
|
+
"text": { "type": ["string", "null"] },
|
|
176
|
+
"blob": { "anyOf": [{ "type": "null" }, { "$ref": "content.schema.json#/$defs/Blob" }] },
|
|
177
|
+
"supersedes": { "type": ["string", "null"] },
|
|
178
|
+
"session": { "anyOf": [{ "type": "null" }, { "$ref": "content.schema.json#/$defs/SessionRef" }] },
|
|
179
|
+
"lesson": { "anyOf": [{ "type": "null" }, { "$ref": "#/$defs/Lesson" }] },
|
|
180
|
+
"visibility": { "$ref": "#/$defs/Visibility" }
|
|
181
|
+
},
|
|
182
|
+
"allOf": [
|
|
183
|
+
{
|
|
184
|
+
"if": { "properties": { "layer": { "const": "lesson" } }, "required": ["layer"] },
|
|
185
|
+
"then": { "required": ["lesson"], "properties": { "lesson": { "$ref": "#/$defs/Lesson" } } },
|
|
186
|
+
"$comment": "a lesson note carries its lesson"
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
"if": { "required": ["lesson"], "properties": { "lesson": { "type": "object" } } },
|
|
190
|
+
"then": { "required": ["layer"], "properties": { "layer": { "const": "lesson" } } },
|
|
191
|
+
"$comment": "lesson only on the lesson layer"
|
|
192
|
+
}
|
|
193
|
+
]
|
|
194
|
+
},
|
|
195
|
+
"reject.no_decision": {
|
|
196
|
+
"type": "object",
|
|
197
|
+
"$comment": "New reject name: an attempt.started with no run.decided{assign} of its run naming its step, round, signer and node. The log's RejectReason::NoDecision (crates/sharedcontext/src/signed/verifier.rs).",
|
|
198
|
+
"properties": {
|
|
199
|
+
"reason": { "const": "no_decision" },
|
|
200
|
+
"detail": {
|
|
201
|
+
"type": "object",
|
|
202
|
+
"properties": { "run": { "$ref": "#/$defs/EventId" }, "step": { "$ref": "#/$defs/StepId" }, "round": { "type": "integer" } },
|
|
203
|
+
"required": ["run", "step", "round"]
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
"required": ["reason", "detail"]
|
|
207
|
+
},
|
|
208
|
+
"reject.unknown_step": {
|
|
209
|
+
"type": "object",
|
|
210
|
+
"$comment": "New reject name: a run.decided naming a step that is not in the plan in force (or not main, for a run with no plan).",
|
|
211
|
+
"properties": {
|
|
212
|
+
"reason": { "const": "unknown_step" },
|
|
213
|
+
"detail": {
|
|
214
|
+
"type": "object",
|
|
215
|
+
"properties": { "run": { "$ref": "#/$defs/EventId" }, "step": { "type": "string" }, "plan": { "anyOf": [{ "type": "null" }, { "$ref": "#/$defs/EventId" }] } },
|
|
216
|
+
"required": ["run", "step"]
|
|
217
|
+
}
|
|
218
|
+
},
|
|
219
|
+
"required": ["reason", "detail"]
|
|
220
|
+
},
|
|
221
|
+
"RunEventsArgs": {
|
|
222
|
+
"type": "object",
|
|
223
|
+
"$comment": "read tool run_events: one run's events after a seq, a page",
|
|
224
|
+
"properties": {
|
|
225
|
+
"run": { "$ref": "#/$defs/EventId" },
|
|
226
|
+
"after_seq": { "type": "integer", "minimum": 0 },
|
|
227
|
+
"limit": { "type": ["integer", "null"], "minimum": 0, "$comment": "default 100, as subscribe" }
|
|
228
|
+
},
|
|
229
|
+
"required": ["run", "after_seq"]
|
|
230
|
+
},
|
|
231
|
+
"RunEventsResult": {
|
|
232
|
+
"type": "object",
|
|
233
|
+
"$comment": "the run's events after after_seq in seq order, each as a subscribe row: every event whose content names the run (run.planned, run.decided, attempt.started, attempt.ended, a lesson note whose lesson.run is the run), and the claim events of the run's claim and of every claim an attempt of the run names (claim.taken, claim.renewed, claim.released, claim.expired). Served from events_by_node over the run's nodes (its claim's node and every node a decision names), merged by seq: no new keyspace.",
|
|
234
|
+
"properties": {
|
|
235
|
+
"run": { "$ref": "#/$defs/EventId" },
|
|
236
|
+
"node": { "type": "string", "$comment": "the run's claim's node" },
|
|
237
|
+
"after_seq": { "type": "integer", "minimum": 0 },
|
|
238
|
+
"head_seq": { "type": "integer", "minimum": 0 },
|
|
239
|
+
"next_after_seq": { "type": "integer", "minimum": 0 },
|
|
240
|
+
"events": { "$ref": "mcp-tools.schema.json#/$defs/SubscribeResult/properties/events" }
|
|
241
|
+
},
|
|
242
|
+
"required": ["run", "node", "after_seq", "head_seq", "next_after_seq", "events"]
|
|
243
|
+
},
|
|
244
|
+
"ClaimStateArgs": {
|
|
245
|
+
"type": "object",
|
|
246
|
+
"$comment": "read tool claim_state: one claim's state",
|
|
247
|
+
"properties": { "claim": { "$ref": "#/$defs/EventId" } },
|
|
248
|
+
"required": ["claim"]
|
|
249
|
+
},
|
|
250
|
+
"ClaimState": {
|
|
251
|
+
"type": "object",
|
|
252
|
+
"$comment": "one claim folded: its lease, how it ended, and the run it roots (if any). Derived, never stored as truth, not part of the canonical snapshot, so expected-state.json does not change.",
|
|
253
|
+
"properties": {
|
|
254
|
+
"claim": { "$ref": "#/$defs/EventId" },
|
|
255
|
+
"node": { "type": "string" },
|
|
256
|
+
"holder": { "$ref": "#/$defs/Pubkey" },
|
|
257
|
+
"intent": { "enum": ["fix", "triage", "review", "verify"] },
|
|
258
|
+
"taken": {
|
|
259
|
+
"type": "object",
|
|
260
|
+
"properties": { "seq": { "type": "integer", "minimum": 1 }, "received_at": { "type": "integer", "minimum": 0 } },
|
|
261
|
+
"required": ["seq", "received_at"]
|
|
262
|
+
},
|
|
263
|
+
"live": { "type": "boolean" },
|
|
264
|
+
"lease_until": { "type": ["integer", "null"], "minimum": 0 },
|
|
265
|
+
"renewals": { "type": "integer", "minimum": 0 },
|
|
266
|
+
"ended": {
|
|
267
|
+
"anyOf": [
|
|
268
|
+
{ "type": "null" },
|
|
269
|
+
{
|
|
270
|
+
"type": "object",
|
|
271
|
+
"properties": {
|
|
272
|
+
"how": { "enum": ["released", "expired"] },
|
|
273
|
+
"reason": { "type": ["string", "null"] },
|
|
274
|
+
"seq": { "type": "integer", "minimum": 1 }
|
|
275
|
+
},
|
|
276
|
+
"required": ["how", "seq"]
|
|
277
|
+
}
|
|
278
|
+
]
|
|
279
|
+
},
|
|
280
|
+
"session": { "anyOf": [{ "type": "null" }, { "$ref": "content.schema.json#/$defs/SessionRef" }] },
|
|
281
|
+
"run": { "anyOf": [{ "type": "null" }, { "$ref": "#/$defs/RunView" }] }
|
|
282
|
+
},
|
|
283
|
+
"required": ["claim", "node", "holder", "intent", "taken", "live", "lease_until", "renewals", "ended", "run"]
|
|
284
|
+
},
|
|
285
|
+
"RunView": {
|
|
286
|
+
"type": "object",
|
|
287
|
+
"$comment": "the run this claim roots, folded from its events: the strategy and plan in force, each step's latest round with its decision and attempt, and the stop if any",
|
|
288
|
+
"properties": {
|
|
289
|
+
"strategy": { "anyOf": [{ "type": "null" }, { "$ref": "#/$defs/Strategy" }] },
|
|
290
|
+
"plan": {
|
|
291
|
+
"anyOf": [
|
|
292
|
+
{ "type": "null" },
|
|
293
|
+
{ "type": "object", "properties": { "event": { "$ref": "#/$defs/EventId" }, "digest": { "$ref": "#/$defs/Digest" } }, "required": ["event", "digest"] }
|
|
294
|
+
]
|
|
295
|
+
},
|
|
296
|
+
"steps": {
|
|
297
|
+
"type": "array",
|
|
298
|
+
"items": {
|
|
299
|
+
"type": "object",
|
|
300
|
+
"properties": {
|
|
301
|
+
"step": { "$ref": "#/$defs/StepId" },
|
|
302
|
+
"state": { "enum": ["planned", "assigned", "running", "ended", "skipped"] },
|
|
303
|
+
"round": { "type": ["integer", "null"], "minimum": 1 },
|
|
304
|
+
"to": { "anyOf": [{ "type": "null" }, { "$ref": "#/$defs/Pubkey" }] },
|
|
305
|
+
"node": { "type": ["string", "null"] },
|
|
306
|
+
"decision": { "anyOf": [{ "type": "null" }, { "$ref": "#/$defs/EventId" }] },
|
|
307
|
+
"attempt": {
|
|
308
|
+
"anyOf": [
|
|
309
|
+
{ "type": "null" },
|
|
310
|
+
{
|
|
311
|
+
"type": "object",
|
|
312
|
+
"properties": {
|
|
313
|
+
"started": { "$ref": "#/$defs/EventId" },
|
|
314
|
+
"claim": { "$ref": "#/$defs/EventId" },
|
|
315
|
+
"ended": { "anyOf": [{ "type": "null" }, { "$ref": "#/$defs/EventId" }] },
|
|
316
|
+
"outcome": { "anyOf": [{ "type": "null" }, { "enum": ["completed", "failed", "budget_exceeded", "cancelled", "abandoned"] }] },
|
|
317
|
+
"record": { "anyOf": [{ "type": "null" }, { "$ref": "content.schema.json#/$defs/Blob" }] }
|
|
318
|
+
},
|
|
319
|
+
"required": ["started", "claim", "ended", "outcome"]
|
|
320
|
+
}
|
|
321
|
+
]
|
|
322
|
+
}
|
|
323
|
+
},
|
|
324
|
+
"required": ["step", "state"]
|
|
325
|
+
}
|
|
326
|
+
},
|
|
327
|
+
"stopped": { "anyOf": [{ "type": "null" }, { "$ref": "#/$defs/EventId" }] }
|
|
328
|
+
},
|
|
329
|
+
"required": ["strategy", "plan", "steps", "stopped"]
|
|
330
|
+
},
|
|
331
|
+
"tool.run_events": {
|
|
332
|
+
"type": "object",
|
|
333
|
+
"$comment": "read tool; emits nothing",
|
|
334
|
+
"properties": { "name": { "const": "run_events" }, "arguments": { "$ref": "#/$defs/RunEventsArgs" }, "result": { "$ref": "#/$defs/RunEventsResult" } }
|
|
335
|
+
},
|
|
336
|
+
"tool.claim_state": {
|
|
337
|
+
"type": "object",
|
|
338
|
+
"$comment": "read tool; emits nothing",
|
|
339
|
+
"properties": { "name": { "const": "claim_state" }, "arguments": { "$ref": "#/$defs/ClaimStateArgs" }, "result": { "$ref": "#/$defs/ClaimState" } }
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
}
|