@tomflow/chatloop-tools 0.9.15 → 0.9.17

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.
Files changed (148) hide show
  1. package/README.md +2 -1
  2. package/index.mjs +12 -1
  3. package/lib/gateway.mjs +15 -3
  4. package/lib/mcp-tool-router.mjs +50 -3
  5. package/lib/trace-observation.mjs +19 -0
  6. package/node_modules/@tomflow/chatloop-context/README.md +240 -0
  7. package/node_modules/@tomflow/chatloop-context/bin/cli.mjs +48 -0
  8. package/node_modules/@tomflow/chatloop-context/capabilities/approval.mjs +151 -0
  9. package/node_modules/@tomflow/chatloop-context/capabilities/context.mjs +376 -0
  10. package/node_modules/@tomflow/chatloop-context/capabilities/document.mjs +266 -0
  11. package/node_modules/@tomflow/chatloop-context/capabilities/evidence.mjs +134 -0
  12. package/node_modules/@tomflow/chatloop-context/capabilities/presentation.mjs +82 -0
  13. package/node_modules/@tomflow/chatloop-context/capabilities/project.mjs +349 -0
  14. package/node_modules/@tomflow/chatloop-context/capabilities/sdk.mjs +72 -0
  15. package/node_modules/@tomflow/chatloop-context/capabilities/start.mjs +73 -0
  16. package/node_modules/@tomflow/chatloop-context/capabilities/task.mjs +507 -0
  17. package/node_modules/@tomflow/chatloop-context/capabilities.generated.mjs +11 -0
  18. package/node_modules/@tomflow/chatloop-context/docs/interfaces.md +182 -0
  19. package/node_modules/@tomflow/chatloop-context/docs/operator-and-migration.md +277 -0
  20. package/node_modules/@tomflow/chatloop-context/index.mjs +233 -0
  21. package/node_modules/@tomflow/chatloop-context/lib/api-log.mjs +86 -0
  22. package/node_modules/@tomflow/chatloop-context/lib/approval-policy.mjs +24 -0
  23. package/node_modules/@tomflow/chatloop-context/lib/capability-catalog.generated.json +1989 -0
  24. package/node_modules/@tomflow/chatloop-context/lib/capability-router.mjs +67 -0
  25. package/node_modules/@tomflow/chatloop-context/lib/cli-commands.mjs +280 -0
  26. package/node_modules/@tomflow/chatloop-context/lib/context-cli.mjs +298 -0
  27. package/node_modules/@tomflow/chatloop-context/lib/context-migration.mjs +280 -0
  28. package/node_modules/@tomflow/chatloop-context/lib/core/context.mjs +115 -0
  29. package/node_modules/@tomflow/chatloop-context/lib/core/evidence.mjs +51 -0
  30. package/node_modules/@tomflow/chatloop-context/lib/core/health.mjs +55 -0
  31. package/node_modules/@tomflow/chatloop-context/lib/core/migration.mjs +262 -0
  32. package/node_modules/@tomflow/chatloop-context/lib/core/project.mjs +246 -0
  33. package/node_modules/@tomflow/chatloop-context/lib/core/review.mjs +147 -0
  34. package/node_modules/@tomflow/chatloop-context/lib/core/run.mjs +343 -0
  35. package/node_modules/@tomflow/chatloop-context/lib/core/store.mjs +391 -0
  36. package/node_modules/@tomflow/chatloop-context/lib/core/task.mjs +166 -0
  37. package/node_modules/@tomflow/chatloop-context/lib/line-review.mjs +13 -0
  38. package/node_modules/@tomflow/chatloop-context/lib/methods.mjs +111 -0
  39. package/node_modules/@tomflow/chatloop-context/lib/operations.mjs +107 -0
  40. package/node_modules/@tomflow/chatloop-context/lib/orphan-operator.mjs +117 -0
  41. package/node_modules/@tomflow/chatloop-context/lib/process-inventory.mjs +20 -0
  42. package/node_modules/@tomflow/chatloop-context/lib/project-branch.mjs +312 -0
  43. package/node_modules/@tomflow/chatloop-context/lib/project-diagnostic.mjs +153 -0
  44. package/node_modules/@tomflow/chatloop-context/lib/project-guards.mjs +19 -0
  45. package/node_modules/@tomflow/chatloop-context/lib/project-store.mjs +115 -0
  46. package/node_modules/@tomflow/chatloop-context/lib/trusted-run.mjs +86 -0
  47. package/node_modules/@tomflow/chatloop-context/lib/workspace-operator.mjs +169 -0
  48. package/node_modules/@tomflow/chatloop-context/package.json +40 -0
  49. package/node_modules/@tomflow/chatloop-context/scripts/build-capabilities.mjs +114 -0
  50. package/node_modules/@tomflow/chatloop-extension/README.md +94 -0
  51. package/node_modules/@tomflow/chatloop-extension/actions.generated.mjs +11 -0
  52. package/node_modules/@tomflow/chatloop-extension/bin/cli.mjs +141 -0
  53. package/node_modules/@tomflow/chatloop-extension/bin/native-host.mjs +109 -0
  54. package/node_modules/@tomflow/chatloop-extension/capabilities/chat_dom.mjs +1 -0
  55. package/node_modules/@tomflow/chatloop-extension/capabilities/chat_screenshot.mjs +1 -0
  56. package/node_modules/@tomflow/chatloop-extension/capabilities/chat_text.mjs +1 -0
  57. package/node_modules/@tomflow/chatloop-extension/capabilities/clean.mjs +1 -0
  58. package/node_modules/@tomflow/chatloop-extension/capabilities/continue.mjs +1 -0
  59. package/node_modules/@tomflow/chatloop-extension/capabilities/handoff.mjs +1 -0
  60. package/node_modules/@tomflow/chatloop-extension/capabilities/reload.mjs +1 -0
  61. package/node_modules/@tomflow/chatloop-extension/capabilities/start.mjs +1 -0
  62. package/node_modules/@tomflow/chatloop-extension/capabilities/status.mjs +1 -0
  63. package/node_modules/@tomflow/chatloop-extension/extension/actions/clean.js +120 -0
  64. package/node_modules/@tomflow/chatloop-extension/extension/actions/common.js +180 -0
  65. package/node_modules/@tomflow/chatloop-extension/extension/actions/continue.js +322 -0
  66. package/node_modules/@tomflow/chatloop-extension/extension/actions/dom.js +2 -0
  67. package/node_modules/@tomflow/chatloop-extension/extension/actions/handoff.js +378 -0
  68. package/node_modules/@tomflow/chatloop-extension/extension/actions/index.js +2 -0
  69. package/node_modules/@tomflow/chatloop-extension/extension/actions/model-intent.js +54 -0
  70. package/node_modules/@tomflow/chatloop-extension/extension/actions/read-mode.js +9 -0
  71. package/node_modules/@tomflow/chatloop-extension/extension/actions/reload.js +20 -0
  72. package/node_modules/@tomflow/chatloop-extension/extension/actions/screenshot.js +69 -0
  73. package/node_modules/@tomflow/chatloop-extension/extension/actions/start.js +287 -0
  74. package/node_modules/@tomflow/chatloop-extension/extension/actions/status.js +23 -0
  75. package/node_modules/@tomflow/chatloop-extension/extension/actions/text.js +2 -0
  76. package/node_modules/@tomflow/chatloop-extension/extension/background.js +16 -0
  77. package/node_modules/@tomflow/chatloop-extension/extension/clean.html +5 -0
  78. package/node_modules/@tomflow/chatloop-extension/extension/content.js +40 -0
  79. package/node_modules/@tomflow/chatloop-extension/extension/continue.html +9 -0
  80. package/node_modules/@tomflow/chatloop-extension/extension/dom.html +17 -0
  81. package/node_modules/@tomflow/chatloop-extension/extension/handoff.html +9 -0
  82. package/node_modules/@tomflow/chatloop-extension/extension/loop/action-catalog.generated.js +2 -0
  83. package/node_modules/@tomflow/chatloop-extension/extension/loop/api-aspect.generated.js +275 -0
  84. package/node_modules/@tomflow/chatloop-extension/extension/loop/api-observation-queue.generated.js +76 -0
  85. package/node_modules/@tomflow/chatloop-extension/extension/loop/core.js +107 -0
  86. package/node_modules/@tomflow/chatloop-extension/extension/loop/index.js +36 -0
  87. package/node_modules/@tomflow/chatloop-extension/extension/loop/observer-approval.js +227 -0
  88. package/node_modules/@tomflow/chatloop-extension/extension/loop/observer-inspect.js +144 -0
  89. package/node_modules/@tomflow/chatloop-extension/extension/loop/observer-poll.js +171 -0
  90. package/node_modules/@tomflow/chatloop-extension/extension/loop/observer-recovery.js +109 -0
  91. package/node_modules/@tomflow/chatloop-extension/extension/loop/observer.js +154 -0
  92. package/node_modules/@tomflow/chatloop-extension/extension/loop/resources.js +254 -0
  93. package/node_modules/@tomflow/chatloop-extension/extension/manifest.json +42 -0
  94. package/node_modules/@tomflow/chatloop-extension/extension/popup.html +25 -0
  95. package/node_modules/@tomflow/chatloop-extension/extension/popup.js +93 -0
  96. package/node_modules/@tomflow/chatloop-extension/extension/reload.html +17 -0
  97. package/node_modules/@tomflow/chatloop-extension/extension/screenshot.html +17 -0
  98. package/node_modules/@tomflow/chatloop-extension/extension/start.html +6 -0
  99. package/node_modules/@tomflow/chatloop-extension/extension/status.html +6 -0
  100. package/node_modules/@tomflow/chatloop-extension/extension/text.html +17 -0
  101. package/node_modules/@tomflow/chatloop-extension/extension/worker/action-result.js +136 -0
  102. package/node_modules/@tomflow/chatloop-extension/extension/worker/action-take.js +220 -0
  103. package/node_modules/@tomflow/chatloop-extension/extension/worker/admission.js +122 -0
  104. package/node_modules/@tomflow/chatloop-extension/extension/worker/adopt-prepare.js +155 -0
  105. package/node_modules/@tomflow/chatloop-extension/extension/worker/adopt-recovery.js +185 -0
  106. package/node_modules/@tomflow/chatloop-extension/extension/worker/adopt-result.js +120 -0
  107. package/node_modules/@tomflow/chatloop-extension/extension/worker/bootstrap.js +172 -0
  108. package/node_modules/@tomflow/chatloop-extension/extension/worker/manual.js +165 -0
  109. package/node_modules/@tomflow/chatloop-extension/extension/worker/readiness.js +244 -0
  110. package/node_modules/@tomflow/chatloop-extension/extension/worker/router.js +181 -0
  111. package/node_modules/@tomflow/chatloop-extension/extension/worker/scheduler.js +147 -0
  112. package/node_modules/@tomflow/chatloop-extension/extension/worker/turn-failure.js +197 -0
  113. package/node_modules/@tomflow/chatloop-extension/extension/worker/turn-finished.js +200 -0
  114. package/node_modules/@tomflow/chatloop-extension/index.mjs +71 -0
  115. package/node_modules/@tomflow/chatloop-extension/lib/action-routing.mjs +18 -0
  116. package/node_modules/@tomflow/chatloop-extension/lib/api-observation-queue.mjs +74 -0
  117. package/node_modules/@tomflow/chatloop-extension/lib/bridge.mjs +208 -0
  118. package/node_modules/@tomflow/chatloop-extension/lib/browser-launch.mjs +40 -0
  119. package/node_modules/@tomflow/chatloop-extension/lib/context-binding.mjs +45 -0
  120. package/node_modules/@tomflow/chatloop-extension/lib/context-ipc.mjs +111 -0
  121. package/node_modules/@tomflow/chatloop-extension/lib/owner-evidence.mjs +67 -0
  122. package/node_modules/@tomflow/chatloop-extension/lib/session-file.mjs +120 -0
  123. package/node_modules/@tomflow/chatloop-extension/package.json +38 -0
  124. package/node_modules/@tomflow/chatloop-extension/scripts/build-actions.mjs +133 -0
  125. package/node_modules/@tomflow/chatloop-trace/README.md +105 -0
  126. package/node_modules/@tomflow/chatloop-trace/events/context.api.mjs +23 -0
  127. package/node_modules/@tomflow/chatloop-trace/events/typed.api.call.mjs +22 -0
  128. package/node_modules/@tomflow/chatloop-trace/events.generated.mjs +4 -0
  129. package/node_modules/@tomflow/chatloop-trace/index.mjs +59 -0
  130. package/node_modules/@tomflow/chatloop-trace/lib/api-aspect.mjs +273 -0
  131. package/node_modules/@tomflow/chatloop-trace/lib/trace-reader.mjs +265 -0
  132. package/node_modules/@tomflow/chatloop-trace/lib/trace.mjs +205 -0
  133. package/node_modules/@tomflow/chatloop-trace/package.json +30 -0
  134. package/node_modules/@tomflow/chatloop-trace/scripts/build-events.mjs +68 -0
  135. package/node_modules/ps-list/index.d.ts +76 -0
  136. package/node_modules/ps-list/index.js +366 -0
  137. package/node_modules/ps-list/license +9 -0
  138. package/node_modules/ps-list/package.json +44 -0
  139. package/node_modules/ps-list/readme.md +56 -0
  140. package/node_modules/ps-list/vendor/fastlist-0.3.0-x64.exe +0 -0
  141. package/node_modules/ps-list/vendor/fastlist-0.3.0-x86.exe +0 -0
  142. package/package.json +23 -8
  143. package/providers/form.mjs +286 -0
  144. package/providers.generated.mjs +3 -2
  145. package/scripts/build-form-app.mjs +27 -0
  146. package/ui/form/review-app.js +128 -0
  147. package/ui/form/review.html +859 -0
  148. package/ui/form/review.template.html +45 -0
@@ -0,0 +1,376 @@
1
+ // One self-contained Context capability contract. Registered at build time.
2
+ export const capability={
3
+ "id": "context",
4
+ "version": 1,
5
+ "purpose": "Business progress, durable receipts, UNKNOWN effects and checkpoints",
6
+ "startWith": "context.request.status",
7
+ "methods": [
8
+ {
9
+ "id": "context.history",
10
+ "group": "context",
11
+ "mode": "read",
12
+ "description": "Read versioned history and receipts for a task.",
13
+ "inputSchema": {
14
+ "type": "object",
15
+ "required": [
16
+ "operation",
17
+ "projectId",
18
+ "taskId"
19
+ ],
20
+ "additionalProperties": false,
21
+ "properties": {
22
+ "operation": {
23
+ "const": "context.history"
24
+ },
25
+ "projectId": {
26
+ "type": "string",
27
+ "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$"
28
+ },
29
+ "taskId": {
30
+ "type": "string",
31
+ "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$"
32
+ }
33
+ }
34
+ },
35
+ "order": 8,
36
+ "route": {
37
+ "kind": "core",
38
+ "method": "history",
39
+ "params": [
40
+ "projectId",
41
+ "taskId"
42
+ ]
43
+ }
44
+ },
45
+ {
46
+ "id": "context.resume",
47
+ "group": "context",
48
+ "mode": "read",
49
+ "description": "Read one verified checkpoint snapshot; does not grant Browser Owner.",
50
+ "inputSchema": {
51
+ "type": "object",
52
+ "required": [
53
+ "operation",
54
+ "projectId",
55
+ "taskId",
56
+ "checkpointId"
57
+ ],
58
+ "additionalProperties": false,
59
+ "properties": {
60
+ "operation": {
61
+ "const": "context.resume"
62
+ },
63
+ "projectId": {
64
+ "type": "string",
65
+ "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$"
66
+ },
67
+ "taskId": {
68
+ "type": "string",
69
+ "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$"
70
+ },
71
+ "checkpointId": {
72
+ "type": "string",
73
+ "minLength": 8,
74
+ "maxLength": 64
75
+ },
76
+ "maxBytes": {
77
+ "type": "integer",
78
+ "minimum": 16384,
79
+ "maximum": 262144
80
+ }
81
+ }
82
+ },
83
+ "order": 9,
84
+ "route": {
85
+ "kind": "core",
86
+ "method": "resume",
87
+ "params": [
88
+ "projectId",
89
+ "taskId",
90
+ "checkpointId",
91
+ "maxBytes"
92
+ ]
93
+ }
94
+ },
95
+ {
96
+ "id": "context.request.status",
97
+ "group": "context",
98
+ "mode": "read",
99
+ "description": "Check an unknown write using its original durable writeRequestId.",
100
+ "inputSchema": {
101
+ "type": "object",
102
+ "required": [
103
+ "operation",
104
+ "projectId",
105
+ "storeEpoch",
106
+ "writeRequestId"
107
+ ],
108
+ "additionalProperties": false,
109
+ "properties": {
110
+ "operation": {
111
+ "const": "context.request.status"
112
+ },
113
+ "projectId": {
114
+ "type": "string",
115
+ "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$"
116
+ },
117
+ "storeEpoch": {
118
+ "type": "string",
119
+ "minLength": 10,
120
+ "maxLength": 64
121
+ },
122
+ "writeRequestId": {
123
+ "type": "string",
124
+ "minLength": 8,
125
+ "maxLength": 128
126
+ }
127
+ }
128
+ },
129
+ "order": 10,
130
+ "route": {
131
+ "kind": "core",
132
+ "method": "requestStatus",
133
+ "params": [
134
+ "$args"
135
+ ]
136
+ }
137
+ },
138
+ {
139
+ "id": "context.patch",
140
+ "group": "context",
141
+ "mode": "write",
142
+ "description": "Write active-run progress under the current holder and revisions.",
143
+ "inputSchema": {
144
+ "type": "object",
145
+ "required": [
146
+ "operation",
147
+ "projectId",
148
+ "taskId",
149
+ "expectedTaskRevision",
150
+ "expectedBindingRevision",
151
+ "runRef",
152
+ "runCredential",
153
+ "patch",
154
+ "expectedStoreEpoch",
155
+ "writeRequestId"
156
+ ],
157
+ "additionalProperties": false,
158
+ "properties": {
159
+ "operation": {
160
+ "const": "context.patch"
161
+ },
162
+ "projectId": {
163
+ "type": "string",
164
+ "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$"
165
+ },
166
+ "taskId": {
167
+ "type": "string",
168
+ "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$"
169
+ },
170
+ "expectedTaskRevision": {
171
+ "type": "integer",
172
+ "minimum": 1
173
+ },
174
+ "expectedBindingRevision": {
175
+ "type": "integer",
176
+ "minimum": 0
177
+ },
178
+ "runRef": {
179
+ "type": "string",
180
+ "minLength": 8,
181
+ "maxLength": 256
182
+ },
183
+ "runCredential": {
184
+ "type": "string",
185
+ "pattern": "^[0-9a-f]{64}$"
186
+ },
187
+ "patch": {
188
+ "type": "object"
189
+ },
190
+ "expectedStoreEpoch": {
191
+ "type": "string",
192
+ "minLength": 10,
193
+ "maxLength": 64
194
+ },
195
+ "writeRequestId": {
196
+ "type": "string",
197
+ "minLength": 8,
198
+ "maxLength": 128
199
+ }
200
+ }
201
+ },
202
+ "order": 31,
203
+ "route": {
204
+ "kind": "core",
205
+ "method": "patch",
206
+ "params": [
207
+ "$args"
208
+ ]
209
+ }
210
+ },
211
+ {
212
+ "id": "context.unknown.resolve",
213
+ "group": "context",
214
+ "mode": "write",
215
+ "description": "Resolve a known unknown side effect only with matching evidence.",
216
+ "inputSchema": {
217
+ "type": "object",
218
+ "required": [
219
+ "operation",
220
+ "projectId",
221
+ "taskId",
222
+ "expectedTaskRevision",
223
+ "expectedBindingRevision",
224
+ "runRef",
225
+ "runCredential",
226
+ "effectRef",
227
+ "resolutionEvidenceRef",
228
+ "expectedStoreEpoch",
229
+ "writeRequestId"
230
+ ],
231
+ "additionalProperties": false,
232
+ "properties": {
233
+ "operation": {
234
+ "const": "context.unknown.resolve"
235
+ },
236
+ "projectId": {
237
+ "type": "string",
238
+ "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$"
239
+ },
240
+ "taskId": {
241
+ "type": "string",
242
+ "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$"
243
+ },
244
+ "expectedTaskRevision": {
245
+ "type": "integer",
246
+ "minimum": 1
247
+ },
248
+ "expectedBindingRevision": {
249
+ "type": "integer",
250
+ "minimum": 0
251
+ },
252
+ "runRef": {
253
+ "type": "string",
254
+ "minLength": 8,
255
+ "maxLength": 256
256
+ },
257
+ "runCredential": {
258
+ "type": "string",
259
+ "pattern": "^[0-9a-f]{64}$"
260
+ },
261
+ "effectRef": {
262
+ "type": "string",
263
+ "minLength": 1,
264
+ "maxLength": 256
265
+ },
266
+ "resolutionEvidenceRef": {
267
+ "type": "string",
268
+ "minLength": 8,
269
+ "maxLength": 4096
270
+ },
271
+ "expectedStoreEpoch": {
272
+ "type": "string",
273
+ "minLength": 10,
274
+ "maxLength": 64
275
+ },
276
+ "writeRequestId": {
277
+ "type": "string",
278
+ "minLength": 8,
279
+ "maxLength": 128
280
+ }
281
+ }
282
+ },
283
+ "order": 32,
284
+ "route": {
285
+ "kind": "core",
286
+ "method": "resolveUnknownEffect",
287
+ "params": [
288
+ "$args"
289
+ ]
290
+ }
291
+ },
292
+ {
293
+ "id": "context.checkpoint",
294
+ "group": "context",
295
+ "mode": "write",
296
+ "description": "Create a durable business checkpoint, not Browser Owner permission.",
297
+ "inputSchema": {
298
+ "type": "object",
299
+ "required": [
300
+ "operation",
301
+ "projectId",
302
+ "taskId",
303
+ "expectedTaskRevision",
304
+ "expectedBindingRevision",
305
+ "runRef",
306
+ "runCredential",
307
+ "expectedStoreEpoch",
308
+ "writeRequestId"
309
+ ],
310
+ "additionalProperties": false,
311
+ "properties": {
312
+ "operation": {
313
+ "const": "context.checkpoint"
314
+ },
315
+ "projectId": {
316
+ "type": "string",
317
+ "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$"
318
+ },
319
+ "taskId": {
320
+ "type": "string",
321
+ "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$"
322
+ },
323
+ "expectedTaskRevision": {
324
+ "type": "integer",
325
+ "minimum": 1
326
+ },
327
+ "expectedBindingRevision": {
328
+ "type": "integer",
329
+ "minimum": 0
330
+ },
331
+ "runRef": {
332
+ "type": "string",
333
+ "minLength": 8,
334
+ "maxLength": 256
335
+ },
336
+ "runCredential": {
337
+ "type": "string",
338
+ "pattern": "^[0-9a-f]{64}$"
339
+ },
340
+ "expectedStoreEpoch": {
341
+ "type": "string",
342
+ "minLength": 10,
343
+ "maxLength": 64
344
+ },
345
+ "writeRequestId": {
346
+ "type": "string",
347
+ "minLength": 8,
348
+ "maxLength": 128
349
+ },
350
+ "evidenceRefs": {
351
+ "type": "array",
352
+ "maxItems": 200,
353
+ "items": {
354
+ "type": "object"
355
+ }
356
+ },
357
+ "unknownEffects": {
358
+ "type": "array",
359
+ "maxItems": 200,
360
+ "items": {
361
+ "type": "object"
362
+ }
363
+ }
364
+ }
365
+ },
366
+ "order": 33,
367
+ "route": {
368
+ "kind": "core",
369
+ "method": "checkpoint",
370
+ "params": [
371
+ "$args"
372
+ ]
373
+ }
374
+ }
375
+ ]
376
+ };
@@ -0,0 +1,266 @@
1
+ // One self-contained Context capability contract. Registered at build time.
2
+ export const capability={
3
+ "id": "document",
4
+ "version": 1,
5
+ "purpose": "Immutable R/P drafts, issue preparation and exact version reads",
6
+ "startWith": "document.list",
7
+ "methods": [
8
+ {
9
+ "id": "document.get",
10
+ "group": "document",
11
+ "mode": "read",
12
+ "description": "Read an immutable R/P document at a precise version.",
13
+ "inputSchema": {
14
+ "type": "object",
15
+ "required": [
16
+ "operation",
17
+ "projectId",
18
+ "taskId",
19
+ "documentId",
20
+ "version"
21
+ ],
22
+ "additionalProperties": false,
23
+ "properties": {
24
+ "operation": {
25
+ "const": "document.get"
26
+ },
27
+ "projectId": {
28
+ "type": "string",
29
+ "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$"
30
+ },
31
+ "taskId": {
32
+ "type": "string",
33
+ "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$"
34
+ },
35
+ "documentId": {
36
+ "type": "string",
37
+ "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$"
38
+ },
39
+ "version": {
40
+ "type": "integer",
41
+ "minimum": 1
42
+ }
43
+ }
44
+ },
45
+ "order": 5,
46
+ "route": {
47
+ "kind": "core",
48
+ "method": "documentGet",
49
+ "params": [
50
+ "projectId",
51
+ "taskId",
52
+ "documentId",
53
+ "version"
54
+ ]
55
+ }
56
+ },
57
+ {
58
+ "id": "document.list",
59
+ "group": "document",
60
+ "mode": "read",
61
+ "description": "List versioned R/P documents of a task.",
62
+ "inputSchema": {
63
+ "type": "object",
64
+ "required": [
65
+ "operation",
66
+ "projectId",
67
+ "taskId"
68
+ ],
69
+ "additionalProperties": false,
70
+ "properties": {
71
+ "operation": {
72
+ "const": "document.list"
73
+ },
74
+ "projectId": {
75
+ "type": "string",
76
+ "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$"
77
+ },
78
+ "taskId": {
79
+ "type": "string",
80
+ "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$"
81
+ }
82
+ }
83
+ },
84
+ "order": 6,
85
+ "route": {
86
+ "kind": "core",
87
+ "method": "documentList",
88
+ "params": [
89
+ "projectId",
90
+ "taskId"
91
+ ]
92
+ }
93
+ },
94
+ {
95
+ "id": "document.createDraft",
96
+ "group": "document",
97
+ "mode": "write",
98
+ "description": "Create immutable R/P draft version linked to a task.",
99
+ "inputSchema": {
100
+ "type": "object",
101
+ "required": [
102
+ "operation",
103
+ "projectId",
104
+ "taskId",
105
+ "documentId",
106
+ "version",
107
+ "kind",
108
+ "body",
109
+ "expectedTaskRevision",
110
+ "expectedStoreEpoch",
111
+ "writeRequestId"
112
+ ],
113
+ "additionalProperties": false,
114
+ "properties": {
115
+ "operation": {
116
+ "const": "document.createDraft"
117
+ },
118
+ "projectId": {
119
+ "type": "string",
120
+ "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$"
121
+ },
122
+ "taskId": {
123
+ "type": "string",
124
+ "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$"
125
+ },
126
+ "documentId": {
127
+ "type": "string",
128
+ "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$"
129
+ },
130
+ "version": {
131
+ "type": "integer",
132
+ "minimum": 1
133
+ },
134
+ "kind": {
135
+ "enum": [
136
+ "R",
137
+ "P",
138
+ "INSTRUCTIONS",
139
+ "HISTORY",
140
+ "LEGACY_EVIDENCE",
141
+ "REFERENCE"
142
+ ]
143
+ },
144
+ "body": {
145
+ "type": "string",
146
+ "minLength": 1,
147
+ "maxLength": 4194304
148
+ },
149
+ "expectedTaskRevision": {
150
+ "type": "integer",
151
+ "minimum": 1
152
+ },
153
+ "expectedStoreEpoch": {
154
+ "type": "string",
155
+ "minLength": 10,
156
+ "maxLength": 64
157
+ },
158
+ "writeRequestId": {
159
+ "type": "string",
160
+ "minLength": 8,
161
+ "maxLength": 128
162
+ },
163
+ "requirementRef": {
164
+ "type": "object",
165
+ "additionalProperties": false,
166
+ "required": [
167
+ "documentId",
168
+ "version",
169
+ "contentHash"
170
+ ],
171
+ "properties": {
172
+ "documentId": {
173
+ "type": "string",
174
+ "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$"
175
+ },
176
+ "version": {
177
+ "type": "integer",
178
+ "minimum": 1
179
+ },
180
+ "contentHash": {
181
+ "type": "string",
182
+ "pattern": "^[a-f0-9]{64}$"
183
+ }
184
+ }
185
+ }
186
+ }
187
+ },
188
+ "order": 24,
189
+ "route": {
190
+ "kind": "core",
191
+ "method": "documentCreate",
192
+ "params": [
193
+ "$args"
194
+ ]
195
+ }
196
+ },
197
+ {
198
+ "id": "document.prepareIssue",
199
+ "group": "document",
200
+ "mode": "write",
201
+ "description": "Record intent to present a precise R/P version.",
202
+ "inputSchema": {
203
+ "type": "object",
204
+ "required": [
205
+ "operation",
206
+ "projectId",
207
+ "taskId",
208
+ "documentId",
209
+ "version",
210
+ "contentHash",
211
+ "expectedTaskRevision",
212
+ "expectedStoreEpoch",
213
+ "writeRequestId"
214
+ ],
215
+ "additionalProperties": false,
216
+ "properties": {
217
+ "operation": {
218
+ "const": "document.prepareIssue"
219
+ },
220
+ "projectId": {
221
+ "type": "string",
222
+ "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$"
223
+ },
224
+ "taskId": {
225
+ "type": "string",
226
+ "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$"
227
+ },
228
+ "documentId": {
229
+ "type": "string",
230
+ "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$"
231
+ },
232
+ "version": {
233
+ "type": "integer",
234
+ "minimum": 1
235
+ },
236
+ "contentHash": {
237
+ "type": "string",
238
+ "pattern": "^[a-f0-9]{64}$"
239
+ },
240
+ "expectedTaskRevision": {
241
+ "type": "integer",
242
+ "minimum": 1
243
+ },
244
+ "expectedStoreEpoch": {
245
+ "type": "string",
246
+ "minLength": 10,
247
+ "maxLength": 64
248
+ },
249
+ "writeRequestId": {
250
+ "type": "string",
251
+ "minLength": 8,
252
+ "maxLength": 128
253
+ }
254
+ }
255
+ },
256
+ "order": 26,
257
+ "route": {
258
+ "kind": "core",
259
+ "method": "prepareIssue",
260
+ "params": [
261
+ "$args"
262
+ ]
263
+ }
264
+ }
265
+ ]
266
+ };