@cleocode/lafs 2026.5.132 → 2026.5.134

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.
@@ -2,316 +2,439 @@
2
2
  "$schema": "http://json-schema.org/draft-07/schema#",
3
3
  "$id": "https://lafs.dev/schemas/v1/envelope.schema.json",
4
4
  "title": "LAFS Envelope v1",
5
- "type": "object",
6
- "required": [
7
- "$schema",
8
- "_meta",
9
- "success",
10
- "result"
11
- ],
12
- "properties": {
13
- "$schema": {
14
- "type": "string",
15
- "const": "https://lafs.dev/schemas/v1/envelope.schema.json"
16
- },
17
- "_meta": {
5
+ "description": "Accepts both the canonical LAFS SDK shape (_meta/result) and the CLEO CLI canonical shape (meta/data). See ADR-039 and T11419.",
6
+ "oneOf": [
7
+ {
8
+ "title": "LAFS SDK envelope (_meta / result shape)",
18
9
  "type": "object",
19
- "additionalProperties": false,
20
10
  "required": [
21
- "specVersion",
22
- "schemaVersion",
23
- "timestamp",
24
- "operation",
25
- "requestId",
26
- "transport",
27
- "strict",
28
- "mvi",
29
- "contextVersion"
11
+ "$schema",
12
+ "_meta",
13
+ "success",
14
+ "result"
30
15
  ],
31
16
  "properties": {
32
- "specVersion": {
33
- "type": "string",
34
- "pattern": "^\\d+\\.\\d+\\.\\d+$"
35
- },
36
- "schemaVersion": {
37
- "type": "string",
38
- "pattern": "^\\d+\\.\\d+\\.\\d+$"
39
- },
40
- "timestamp": {
41
- "type": "string",
42
- "format": "date-time"
43
- },
44
- "operation": {
17
+ "$schema": {
45
18
  "type": "string",
46
- "minLength": 1,
47
- "maxLength": 128
19
+ "const": "https://lafs.dev/schemas/v1/envelope.schema.json"
48
20
  },
49
- "requestId": {
50
- "type": "string",
51
- "minLength": 3,
52
- "maxLength": 128
53
- },
54
- "transport": {
55
- "type": "string",
56
- "enum": ["cli", "http", "grpc", "sdk"]
21
+ "_meta": {
22
+ "type": "object",
23
+ "additionalProperties": false,
24
+ "required": [
25
+ "specVersion",
26
+ "schemaVersion",
27
+ "timestamp",
28
+ "operation",
29
+ "requestId",
30
+ "transport",
31
+ "strict",
32
+ "mvi",
33
+ "contextVersion"
34
+ ],
35
+ "properties": {
36
+ "specVersion": {
37
+ "type": "string",
38
+ "pattern": "^\\d+\\.\\d+\\.\\d+$"
39
+ },
40
+ "schemaVersion": {
41
+ "type": "string",
42
+ "pattern": "^\\d+\\.\\d+\\.\\d+$"
43
+ },
44
+ "timestamp": {
45
+ "type": "string",
46
+ "format": "date-time"
47
+ },
48
+ "operation": {
49
+ "type": "string",
50
+ "minLength": 1,
51
+ "maxLength": 128
52
+ },
53
+ "requestId": {
54
+ "type": "string",
55
+ "minLength": 3,
56
+ "maxLength": 128
57
+ },
58
+ "transport": {
59
+ "type": "string",
60
+ "enum": ["cli", "http", "grpc", "sdk"]
61
+ },
62
+ "strict": {
63
+ "type": "boolean"
64
+ },
65
+ "mvi": {
66
+ "type": "string",
67
+ "enum": ["minimal", "standard", "full", "custom"],
68
+ "description": "Disclosure level: minimal (MVI only), standard (common fields), full (all fields), custom (per _fields parameter)"
69
+ },
70
+ "contextVersion": {
71
+ "type": "integer",
72
+ "minimum": 0
73
+ },
74
+ "sessionId": {
75
+ "type": "string",
76
+ "minLength": 1,
77
+ "maxLength": 256,
78
+ "description": "Session identifier for correlating multi-step agent workflows"
79
+ },
80
+ "originSessionId": {
81
+ "type": "string",
82
+ "minLength": 1,
83
+ "maxLength": 256,
84
+ "description": "Root session that originally initiated the workflow or saga"
85
+ },
86
+ "executionSessionId": {
87
+ "type": "string",
88
+ "minLength": 1,
89
+ "maxLength": 256,
90
+ "description": "Specific execution instance for the command, saga step, or delegated worker"
91
+ },
92
+ "warnings": {
93
+ "type": "array",
94
+ "items": {
95
+ "type": "object",
96
+ "properties": {
97
+ "code": { "type": "string", "description": "Warning identifier (e.g., DEPRECATED_FIELD)" },
98
+ "message": { "type": "string", "description": "Human-readable warning" },
99
+ "deprecated": { "type": "string", "description": "The deprecated feature or field name" },
100
+ "replacement": { "type": "string", "description": "Suggested replacement, if any" },
101
+ "removeBy": { "type": "string", "description": "Version when the deprecated feature will be removed" }
102
+ },
103
+ "required": ["code", "message"]
104
+ },
105
+ "description": "Non-fatal advisory warnings (deprecations, migration hints)"
106
+ }
107
+ }
57
108
  },
58
- "strict": {
109
+ "success": {
59
110
  "type": "boolean"
60
111
  },
61
- "mvi": {
62
- "type": "string",
63
- "enum": ["minimal", "standard", "full", "custom"],
64
- "description": "Disclosure level: minimal (MVI only), standard (common fields), full (all fields), custom (per _fields parameter)"
65
- },
66
- "contextVersion": {
67
- "type": "integer",
68
- "minimum": 0
69
- },
70
- "sessionId": {
71
- "type": "string",
72
- "minLength": 1,
73
- "maxLength": 256,
74
- "description": "Session identifier for correlating multi-step agent workflows"
75
- },
76
- "originSessionId": {
77
- "type": "string",
78
- "minLength": 1,
79
- "maxLength": 256,
80
- "description": "Root session that originally initiated the workflow or saga"
112
+ "result": {
113
+ "type": ["object", "array", "null"]
81
114
  },
82
- "executionSessionId": {
83
- "type": "string",
84
- "minLength": 1,
85
- "maxLength": 256,
86
- "description": "Specific execution instance for the command, saga step, or delegated worker"
115
+ "error": {
116
+ "type": ["object", "null"],
117
+ "additionalProperties": true,
118
+ "required": [
119
+ "code",
120
+ "message",
121
+ "category",
122
+ "retryable",
123
+ "retryAfterMs",
124
+ "details"
125
+ ],
126
+ "properties": {
127
+ "code": {
128
+ "type": "string",
129
+ "pattern": "^E_[A-Z0-9]+_[A-Z0-9_]+$"
130
+ },
131
+ "message": {
132
+ "type": "string",
133
+ "minLength": 1,
134
+ "maxLength": 1024
135
+ },
136
+ "category": {
137
+ "type": "string",
138
+ "enum": [
139
+ "VALIDATION",
140
+ "AUTH",
141
+ "PERMISSION",
142
+ "NOT_FOUND",
143
+ "CONFLICT",
144
+ "RATE_LIMIT",
145
+ "TRANSIENT",
146
+ "INTERNAL",
147
+ "CONTRACT",
148
+ "MIGRATION"
149
+ ]
150
+ },
151
+ "retryable": {
152
+ "type": "boolean"
153
+ },
154
+ "retryAfterMs": {
155
+ "type": ["integer", "null"],
156
+ "minimum": 0
157
+ },
158
+ "details": {
159
+ "type": "object"
160
+ },
161
+ "agentAction": {
162
+ "type": "string",
163
+ "enum": ["retry", "retry_modified", "escalate", "stop", "wait", "refresh_context", "authenticate"],
164
+ "description": "Machine-actionable instruction for the consuming agent"
165
+ },
166
+ "escalationRequired": {
167
+ "type": "boolean",
168
+ "description": "Whether human/owner intervention is required"
169
+ },
170
+ "suggestedAction": {
171
+ "type": "string",
172
+ "maxLength": 512,
173
+ "description": "Brief actionable instruction for error recovery"
174
+ },
175
+ "docUrl": {
176
+ "type": "string",
177
+ "format": "uri",
178
+ "description": "Documentation URL for this error type"
179
+ }
180
+ }
87
181
  },
88
- "warnings": {
89
- "type": "array",
90
- "items": {
91
- "type": "object",
92
- "properties": {
93
- "code": { "type": "string", "description": "Warning identifier (e.g., DEPRECATED_FIELD)" },
94
- "message": { "type": "string", "description": "Human-readable warning" },
95
- "deprecated": { "type": "string", "description": "The deprecated feature or field name" },
96
- "replacement": { "type": "string", "description": "Suggested replacement, if any" },
97
- "removeBy": { "type": "string", "description": "Version when the deprecated feature will be removed" }
182
+ "page": {
183
+ "type": ["object", "null"],
184
+ "additionalProperties": false,
185
+ "required": ["mode"],
186
+ "properties": {
187
+ "mode": {
188
+ "type": "string",
189
+ "enum": ["offset", "cursor", "none"]
190
+ },
191
+ "limit": {
192
+ "type": "integer",
193
+ "minimum": 1,
194
+ "maximum": 1000
195
+ },
196
+ "offset": {
197
+ "type": "integer",
198
+ "minimum": 0
199
+ },
200
+ "nextCursor": {
201
+ "type": ["string", "null"],
202
+ "maxLength": 2048
98
203
  },
99
- "required": ["code", "message"]
204
+ "hasMore": {
205
+ "type": "boolean"
206
+ },
207
+ "total": {
208
+ "type": ["integer", "null"],
209
+ "minimum": 0
210
+ }
100
211
  },
101
- "description": "Non-fatal advisory warnings (deprecations, migration hints)"
102
- }
103
- }
104
- },
105
- "success": {
106
- "type": "boolean"
107
- },
108
- "result": {
109
- "type": ["object", "array", "null"]
110
- },
111
- "error": {
112
- "type": ["object", "null"],
113
- "additionalProperties": true,
114
- "required": [
115
- "code",
116
- "message",
117
- "category",
118
- "retryable",
119
- "retryAfterMs",
120
- "details"
121
- ],
122
- "properties": {
123
- "code": {
124
- "type": "string",
125
- "pattern": "^E_[A-Z0-9]+_[A-Z0-9_]+$"
126
- },
127
- "message": {
128
- "type": "string",
129
- "minLength": 1,
130
- "maxLength": 1024
131
- },
132
- "category": {
133
- "type": "string",
134
- "enum": [
135
- "VALIDATION",
136
- "AUTH",
137
- "PERMISSION",
138
- "NOT_FOUND",
139
- "CONFLICT",
140
- "RATE_LIMIT",
141
- "TRANSIENT",
142
- "INTERNAL",
143
- "CONTRACT",
144
- "MIGRATION"
212
+ "allOf": [
213
+ {
214
+ "if": {
215
+ "type": "object",
216
+ "properties": { "mode": { "const": "cursor" } },
217
+ "required": ["mode"]
218
+ },
219
+ "then": {
220
+ "required": ["mode", "nextCursor", "hasMore"],
221
+ "properties": {
222
+ "mode": true,
223
+ "nextCursor": true,
224
+ "hasMore": true,
225
+ "limit": true,
226
+ "total": true
227
+ }
228
+ }
229
+ },
230
+ {
231
+ "if": {
232
+ "type": "object",
233
+ "properties": { "mode": { "const": "offset" } },
234
+ "required": ["mode"]
235
+ },
236
+ "then": {
237
+ "required": ["mode", "limit", "offset", "hasMore"],
238
+ "properties": {
239
+ "mode": true,
240
+ "limit": true,
241
+ "offset": true,
242
+ "hasMore": true,
243
+ "total": true
244
+ }
245
+ }
246
+ },
247
+ {
248
+ "if": {
249
+ "type": "object",
250
+ "properties": { "mode": { "const": "none" } },
251
+ "required": ["mode"]
252
+ },
253
+ "then": {
254
+ "required": ["mode"],
255
+ "properties": {
256
+ "mode": true
257
+ }
258
+ }
259
+ }
145
260
  ]
146
261
  },
147
- "retryable": {
148
- "type": "boolean"
149
- },
150
- "retryAfterMs": {
151
- "type": ["integer", "null"],
152
- "minimum": 0
153
- },
154
- "details": {
155
- "type": "object"
156
- },
157
- "agentAction": {
158
- "type": "string",
159
- "enum": ["retry", "retry_modified", "escalate", "stop", "wait", "refresh_context", "authenticate"],
160
- "description": "Machine-actionable instruction for the consuming agent"
161
- },
162
- "escalationRequired": {
163
- "type": "boolean",
164
- "description": "Whether human/owner intervention is required"
165
- },
166
- "suggestedAction": {
167
- "type": "string",
168
- "maxLength": 512,
169
- "description": "Brief actionable instruction for error recovery"
170
- },
171
- "docUrl": {
172
- "type": "string",
173
- "format": "uri",
174
- "description": "Documentation URL for this error type"
175
- }
176
- }
177
- },
178
- "page": {
179
- "type": ["object", "null"],
180
- "additionalProperties": false,
181
- "required": ["mode"],
182
- "properties": {
183
- "mode": {
184
- "type": "string",
185
- "enum": ["offset", "cursor", "none"]
186
- },
187
- "limit": {
188
- "type": "integer",
189
- "minimum": 1,
190
- "maximum": 1000
191
- },
192
- "offset": {
193
- "type": "integer",
194
- "minimum": 0
195
- },
196
- "nextCursor": {
197
- "type": ["string", "null"],
198
- "maxLength": 2048
199
- },
200
- "hasMore": {
201
- "type": "boolean"
202
- },
203
- "total": {
204
- "type": ["integer", "null"],
205
- "minimum": 0
262
+ "_extensions": {
263
+ "type": "object",
264
+ "description": "Vendor extensions. Keys SHOULD use x- prefix (e.g., x-myvendor-trace-id).",
265
+ "additionalProperties": true
206
266
  }
207
267
  },
208
268
  "allOf": [
209
269
  {
210
270
  "if": {
211
- "type": "object",
212
- "properties": { "mode": { "const": "cursor" } },
213
- "required": ["mode"]
271
+ "properties": {
272
+ "success": { "const": true }
273
+ }
214
274
  },
215
275
  "then": {
216
- "required": ["mode", "nextCursor", "hasMore"],
217
276
  "properties": {
218
- "mode": true,
219
- "nextCursor": true,
220
- "hasMore": true,
221
- "limit": true,
222
- "total": true
277
+ "error": { "type": "null" }
223
278
  }
224
279
  }
225
280
  },
226
281
  {
227
282
  "if": {
228
- "type": "object",
229
- "properties": { "mode": { "const": "offset" } },
230
- "required": ["mode"]
283
+ "properties": {
284
+ "success": { "const": false }
285
+ }
231
286
  },
232
287
  "then": {
233
- "required": ["mode", "limit", "offset", "hasMore"],
288
+ "required": ["error"],
234
289
  "properties": {
235
- "mode": true,
236
- "limit": true,
237
- "offset": true,
238
- "hasMore": true,
239
- "total": true
290
+ "error": { "type": "object" }
240
291
  }
241
292
  }
242
293
  },
243
294
  {
244
295
  "if": {
245
- "type": "object",
246
- "properties": { "mode": { "const": "none" } },
247
- "required": ["mode"]
296
+ "properties": {
297
+ "_meta": {
298
+ "type": "object",
299
+ "properties": {
300
+ "strict": { "const": true }
301
+ }
302
+ }
303
+ }
248
304
  },
249
305
  "then": {
250
- "required": ["mode"],
306
+ "additionalProperties": false,
251
307
  "properties": {
252
- "mode": true
308
+ "$schema": true,
309
+ "_meta": true,
310
+ "success": true,
311
+ "result": true,
312
+ "error": true,
313
+ "page": true,
314
+ "_extensions": true
253
315
  }
316
+ },
317
+ "else": {
318
+ "additionalProperties": true
254
319
  }
255
320
  }
256
321
  ]
257
322
  },
258
- "_extensions": {
259
- "type": "object",
260
- "description": "Vendor extensions. Keys SHOULD use x- prefix (e.g., x-myvendor-trace-id).",
261
- "additionalProperties": true
262
- }
263
- },
264
- "allOf": [
265
323
  {
266
- "if": {
267
- "properties": {
268
- "success": { "const": true }
269
- }
270
- },
271
- "then": {
272
- "properties": {
273
- "error": { "type": "null" }
274
- }
275
- }
276
- },
277
- {
278
- "if": {
279
- "properties": {
280
- "success": { "const": false }
324
+ "title": "CLEO CLI canonical success envelope (meta / data shape, ADR-039)",
325
+ "description": "Success variant: success=true with data field. No _meta field present.",
326
+ "type": "object",
327
+ "required": ["success", "data", "meta"],
328
+ "properties": {
329
+ "success": { "type": "boolean", "const": true },
330
+ "data": {},
331
+ "meta": {
332
+ "type": "object",
333
+ "required": ["operation", "requestId", "duration_ms", "timestamp"],
334
+ "properties": {
335
+ "operation": { "type": "string", "minLength": 1 },
336
+ "requestId": { "type": "string", "minLength": 1 },
337
+ "duration_ms": { "type": "number" },
338
+ "timestamp": { "type": "string" },
339
+ "sessionId": { "type": "string" },
340
+ "originSessionId": { "type": "string" },
341
+ "executionSessionId": { "type": "string" },
342
+ "message": { "type": "string" },
343
+ "warnings": {
344
+ "type": "array",
345
+ "items": {
346
+ "type": "object",
347
+ "required": ["code", "message"],
348
+ "properties": {
349
+ "code": { "type": "string" },
350
+ "message": { "type": "string" }
351
+ },
352
+ "additionalProperties": true
353
+ }
354
+ },
355
+ "suggestedNext": {
356
+ "type": "array",
357
+ "items": { "type": "string" }
358
+ }
359
+ },
360
+ "additionalProperties": true
361
+ },
362
+ "page": {
363
+ "type": "object",
364
+ "required": ["mode"],
365
+ "properties": {
366
+ "mode": {
367
+ "type": "string",
368
+ "enum": ["offset", "cursor", "none"]
369
+ },
370
+ "limit": { "type": "integer", "minimum": 1 },
371
+ "offset": { "type": "integer", "minimum": 0 },
372
+ "nextCursor": { "type": ["string", "null"] },
373
+ "hasMore": { "type": "boolean" },
374
+ "total": { "type": ["integer", "null"], "minimum": 0 }
375
+ },
376
+ "additionalProperties": true
281
377
  }
282
378
  },
283
- "then": {
284
- "required": ["error"],
285
- "properties": {
286
- "error": { "type": "object" }
287
- }
379
+ "additionalProperties": true,
380
+ "not": {
381
+ "required": ["_meta"]
288
382
  }
289
383
  },
290
384
  {
291
- "if": {
292
- "properties": {
293
- "_meta": {
294
- "type": "object",
295
- "properties": {
296
- "strict": { "const": true }
385
+ "title": "CLEO CLI canonical error envelope (meta / error shape, ADR-039)",
386
+ "description": "Error variant: success=false with error field. No _meta field present.",
387
+ "type": "object",
388
+ "required": ["success", "error", "meta"],
389
+ "properties": {
390
+ "success": { "type": "boolean", "const": false },
391
+ "error": {
392
+ "type": "object",
393
+ "required": ["code", "message"],
394
+ "properties": {
395
+ "code": { "type": ["string", "number"] },
396
+ "message": { "type": "string", "minLength": 1 },
397
+ "category": { "type": "string" },
398
+ "retryable": { "type": "boolean" },
399
+ "agentAction": { "type": "string" }
400
+ },
401
+ "additionalProperties": true
402
+ },
403
+ "meta": {
404
+ "type": "object",
405
+ "required": ["operation", "requestId", "duration_ms", "timestamp"],
406
+ "properties": {
407
+ "operation": { "type": "string", "minLength": 1 },
408
+ "requestId": { "type": "string", "minLength": 1 },
409
+ "duration_ms": { "type": "number" },
410
+ "timestamp": { "type": "string" },
411
+ "sessionId": { "type": "string" },
412
+ "originSessionId": { "type": "string" },
413
+ "executionSessionId": { "type": "string" },
414
+ "message": { "type": "string" },
415
+ "warnings": {
416
+ "type": "array",
417
+ "items": {
418
+ "type": "object",
419
+ "required": ["code", "message"],
420
+ "properties": {
421
+ "code": { "type": "string" },
422
+ "message": { "type": "string" }
423
+ },
424
+ "additionalProperties": true
425
+ }
426
+ },
427
+ "suggestedNext": {
428
+ "type": "array",
429
+ "items": { "type": "string" }
297
430
  }
298
- }
299
- }
300
- },
301
- "then": {
302
- "additionalProperties": false,
303
- "properties": {
304
- "$schema": true,
305
- "_meta": true,
306
- "success": true,
307
- "result": true,
308
- "error": true,
309
- "page": true,
310
- "_extensions": true
431
+ },
432
+ "additionalProperties": true
311
433
  }
312
434
  },
313
- "else": {
314
- "additionalProperties": true
435
+ "additionalProperties": true,
436
+ "not": {
437
+ "required": ["_meta"]
315
438
  }
316
439
  }
317
440
  ]