@cleocode/lafs 2026.3.74 → 2026.4.3

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 (143) hide show
  1. package/LICENSE +0 -0
  2. package/README.md +97 -68
  3. package/dist/schemas/v1/agent-card.schema.json +230 -0
  4. package/dist/schemas/v1/conformance-profiles.json +0 -0
  5. package/dist/schemas/v1/context-ledger.schema.json +70 -0
  6. package/dist/schemas/v1/discovery.schema.json +132 -0
  7. package/dist/schemas/v1/envelope.schema.json +0 -0
  8. package/dist/schemas/v1/error-registry.json +0 -0
  9. package/dist/src/a2a/bindings/grpc.d.ts +118 -11
  10. package/dist/src/a2a/bindings/grpc.d.ts.map +1 -0
  11. package/dist/src/a2a/bindings/grpc.js +80 -8
  12. package/dist/src/a2a/bindings/grpc.js.map +1 -0
  13. package/dist/src/a2a/bindings/http.d.ts +131 -15
  14. package/dist/src/a2a/bindings/http.d.ts.map +1 -0
  15. package/dist/src/a2a/bindings/http.js +101 -14
  16. package/dist/src/a2a/bindings/http.js.map +1 -0
  17. package/dist/src/a2a/bindings/index.d.ts +83 -9
  18. package/dist/src/a2a/bindings/index.d.ts.map +1 -0
  19. package/dist/src/a2a/bindings/index.js +74 -6
  20. package/dist/src/a2a/bindings/index.js.map +1 -0
  21. package/dist/src/a2a/bindings/jsonrpc.d.ts +194 -9
  22. package/dist/src/a2a/bindings/jsonrpc.d.ts.map +1 -0
  23. package/dist/src/a2a/bindings/jsonrpc.js +155 -10
  24. package/dist/src/a2a/bindings/jsonrpc.js.map +1 -0
  25. package/dist/src/a2a/bridge.d.ts +237 -44
  26. package/dist/src/a2a/bridge.d.ts.map +1 -0
  27. package/dist/src/a2a/bridge.js +187 -48
  28. package/dist/src/a2a/bridge.js.map +1 -0
  29. package/dist/src/a2a/extensions.d.ts +222 -12
  30. package/dist/src/a2a/extensions.d.ts.map +1 -0
  31. package/dist/src/a2a/extensions.js +178 -13
  32. package/dist/src/a2a/extensions.js.map +1 -0
  33. package/dist/src/a2a/index.d.ts +10 -7
  34. package/dist/src/a2a/index.d.ts.map +1 -0
  35. package/dist/src/a2a/index.js +24 -27
  36. package/dist/src/a2a/index.js.map +1 -0
  37. package/dist/src/a2a/streaming.d.ts +276 -3
  38. package/dist/src/a2a/streaming.d.ts.map +1 -0
  39. package/dist/src/a2a/streaming.js +255 -11
  40. package/dist/src/a2a/streaming.js.map +1 -0
  41. package/dist/src/a2a/task-lifecycle.d.ts +341 -20
  42. package/dist/src/a2a/task-lifecycle.d.ts.map +1 -0
  43. package/dist/src/a2a/task-lifecycle.js +327 -26
  44. package/dist/src/a2a/task-lifecycle.js.map +1 -0
  45. package/dist/src/budgetEnforcement.d.ts +93 -20
  46. package/dist/src/budgetEnforcement.d.ts.map +1 -0
  47. package/dist/src/budgetEnforcement.js +146 -31
  48. package/dist/src/budgetEnforcement.js.map +1 -0
  49. package/dist/src/circuit-breaker/index.d.ts +260 -10
  50. package/dist/src/circuit-breaker/index.d.ts.map +1 -0
  51. package/dist/src/circuit-breaker/index.js +226 -14
  52. package/dist/src/circuit-breaker/index.js.map +1 -0
  53. package/dist/src/cli.d.ts +1 -0
  54. package/dist/src/cli.d.ts.map +1 -0
  55. package/dist/src/cli.js +12 -11
  56. package/dist/src/cli.js.map +1 -0
  57. package/dist/src/compliance.d.ts +180 -3
  58. package/dist/src/compliance.d.ts.map +1 -0
  59. package/dist/src/compliance.js +114 -13
  60. package/dist/src/compliance.js.map +1 -0
  61. package/dist/src/conformance.d.ts +55 -2
  62. package/dist/src/conformance.d.ts.map +1 -0
  63. package/dist/src/conformance.js +124 -76
  64. package/dist/src/conformance.js.map +1 -0
  65. package/dist/src/conformanceProfiles.d.ts +68 -1
  66. package/dist/src/conformanceProfiles.d.ts.map +1 -0
  67. package/dist/src/conformanceProfiles.js +53 -1
  68. package/dist/src/conformanceProfiles.js.map +1 -0
  69. package/dist/src/deprecationRegistry.d.ts +82 -1
  70. package/dist/src/deprecationRegistry.d.ts.map +1 -0
  71. package/dist/src/deprecationRegistry.js +58 -7
  72. package/dist/src/deprecationRegistry.js.map +1 -0
  73. package/dist/src/discovery.d.ts +347 -65
  74. package/dist/src/discovery.d.ts.map +1 -0
  75. package/dist/src/discovery.js +130 -72
  76. package/dist/src/discovery.js.map +1 -0
  77. package/dist/src/envelope.d.ts +262 -9
  78. package/dist/src/envelope.d.ts.map +1 -0
  79. package/dist/src/envelope.js +179 -15
  80. package/dist/src/envelope.js.map +1 -0
  81. package/dist/src/errorRegistry.d.ts +163 -3
  82. package/dist/src/errorRegistry.d.ts.map +1 -0
  83. package/dist/src/errorRegistry.js +119 -3
  84. package/dist/src/errorRegistry.js.map +1 -0
  85. package/dist/src/fieldExtraction.d.ts +128 -27
  86. package/dist/src/fieldExtraction.d.ts.map +1 -0
  87. package/dist/src/fieldExtraction.js +100 -27
  88. package/dist/src/fieldExtraction.js.map +1 -0
  89. package/dist/src/flagResolver.d.ts +77 -10
  90. package/dist/src/flagResolver.d.ts.map +1 -0
  91. package/dist/src/flagResolver.js +22 -5
  92. package/dist/src/flagResolver.js.map +1 -0
  93. package/dist/src/flagSemantics.d.ts +80 -4
  94. package/dist/src/flagSemantics.d.ts.map +1 -0
  95. package/dist/src/flagSemantics.js +78 -11
  96. package/dist/src/flagSemantics.js.map +1 -0
  97. package/dist/src/health/index.d.ts +103 -9
  98. package/dist/src/health/index.d.ts.map +1 -0
  99. package/dist/src/health/index.js +75 -26
  100. package/dist/src/health/index.js.map +1 -0
  101. package/dist/src/index.d.ts +34 -23
  102. package/dist/src/index.d.ts.map +1 -0
  103. package/dist/src/index.js +40 -28
  104. package/dist/src/index.js.map +1 -0
  105. package/dist/src/mviProjection.d.ts +43 -6
  106. package/dist/src/mviProjection.d.ts.map +1 -0
  107. package/dist/src/mviProjection.js +32 -5
  108. package/dist/src/mviProjection.js.map +1 -0
  109. package/dist/src/native-loader.d.ts +49 -0
  110. package/dist/src/native-loader.d.ts.map +1 -0
  111. package/dist/src/native-loader.js +56 -0
  112. package/dist/src/native-loader.js.map +1 -0
  113. package/dist/src/problemDetails.d.ts +71 -4
  114. package/dist/src/problemDetails.d.ts.map +1 -0
  115. package/dist/src/problemDetails.js +27 -3
  116. package/dist/src/problemDetails.js.map +1 -0
  117. package/dist/src/shutdown/index.d.ts +103 -9
  118. package/dist/src/shutdown/index.d.ts.map +1 -0
  119. package/dist/src/shutdown/index.js +78 -12
  120. package/dist/src/shutdown/index.js.map +1 -0
  121. package/dist/src/tokenEstimator.d.ts +98 -11
  122. package/dist/src/tokenEstimator.d.ts.map +1 -0
  123. package/dist/src/tokenEstimator.js +91 -13
  124. package/dist/src/tokenEstimator.js.map +1 -0
  125. package/dist/src/types.d.ts +477 -11
  126. package/dist/src/types.d.ts.map +1 -0
  127. package/dist/src/types.js +76 -2
  128. package/dist/src/types.js.map +1 -0
  129. package/dist/src/validateEnvelope.d.ts +61 -2
  130. package/dist/src/validateEnvelope.d.ts.map +1 -0
  131. package/dist/src/validateEnvelope.js +81 -14
  132. package/dist/src/validateEnvelope.js.map +1 -0
  133. package/dist/tsconfig.build.tsbuildinfo +1 -0
  134. package/lafs.md +3 -4
  135. package/package.json +14 -12
  136. package/schemas/v1/agent-card.schema.json +0 -0
  137. package/schemas/v1/conformance-profiles.json +0 -0
  138. package/schemas/v1/context-ledger.schema.json +0 -0
  139. package/schemas/v1/discovery.schema.json +0 -0
  140. package/schemas/v1/envelope.schema.json +0 -0
  141. package/schemas/v1/error-registry.json +0 -0
  142. package/dist/src/mcpAdapter.d.ts +0 -28
  143. package/dist/src/mcpAdapter.js +0 -281
@@ -1,29 +1,132 @@
1
- import type { LAFSEnvelope, LAFSError, LAFSErrorCategory, LAFSAgentAction, LAFSMeta, LAFSTransport, MVILevel } from "./types.js";
1
+ import type { LAFSAgentAction, LAFSEnvelope, LAFSError, LAFSErrorCategory, LAFSMeta, LAFSTransport, MVILevel } from './types.js';
2
+ /**
3
+ * Canonical JSON Schema URL for the LAFS v1 envelope.
4
+ *
5
+ * @remarks
6
+ * Every LAFS envelope includes this URL in its `$schema` field so that
7
+ * validators and tooling can locate the authoritative schema definition.
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * import { LAFS_SCHEMA_URL } from '@cleocode/lafs';
12
+ * console.log(LAFS_SCHEMA_URL);
13
+ * // => 'https://lafs.dev/schemas/v1/envelope.schema.json'
14
+ * ```
15
+ */
2
16
  export declare const LAFS_SCHEMA_URL: "https://lafs.dev/schemas/v1/envelope.schema.json";
17
+ /**
18
+ * Input for constructing the `_meta` block of a LAFS envelope.
19
+ *
20
+ * @remarks
21
+ * Only `operation` and `requestId` are required; all other fields have
22
+ * sensible defaults (see {@link createEnvelope} for the resolution logic).
23
+ */
3
24
  export interface CreateEnvelopeMetaInput {
25
+ /** Dot-delimited operation identifier (e.g. `"tasks.list"`). */
4
26
  operation: string;
27
+ /** Unique identifier for correlating this request/response pair. */
5
28
  requestId: string;
29
+ /**
30
+ * Transport protocol for this envelope.
31
+ *
32
+ * @defaultValue 'sdk'
33
+ */
6
34
  transport?: LAFSTransport;
35
+ /**
36
+ * LAFS spec version to stamp on the envelope.
37
+ *
38
+ * @defaultValue '1.0.0'
39
+ */
7
40
  specVersion?: string;
41
+ /**
42
+ * JSON Schema version to stamp on the envelope.
43
+ *
44
+ * @defaultValue '1.0.0'
45
+ */
8
46
  schemaVersion?: string;
47
+ /**
48
+ * ISO 8601 timestamp; auto-generated when omitted.
49
+ *
50
+ * @defaultValue undefined
51
+ */
9
52
  timestamp?: string;
53
+ /**
54
+ * Whether strict schema validation should be applied.
55
+ *
56
+ * @defaultValue true
57
+ */
10
58
  strict?: boolean;
59
+ /**
60
+ * MVI level as a string, or `true` for `'minimal'` / `false` for `'standard'`.
61
+ *
62
+ * @defaultValue 'standard'
63
+ */
11
64
  mvi?: MVILevel | boolean;
65
+ /**
66
+ * Context ledger version the caller is operating against.
67
+ *
68
+ * @defaultValue 0
69
+ */
12
70
  contextVersion?: number;
71
+ /**
72
+ * Session identifier for multi-step workflow correlation.
73
+ *
74
+ * @defaultValue undefined
75
+ */
13
76
  sessionId?: string;
14
- warnings?: LAFSMeta["warnings"];
77
+ /**
78
+ * Non-fatal warnings to attach to the envelope metadata.
79
+ *
80
+ * @defaultValue undefined
81
+ */
82
+ warnings?: LAFSMeta['warnings'];
15
83
  }
84
+ /**
85
+ * Input for creating a successful LAFS envelope.
86
+ *
87
+ * @remarks
88
+ * When `success` is `true`, the `result` field carries the operation payload
89
+ * and `error` is forced to `null` in the output envelope.
90
+ */
16
91
  export interface CreateEnvelopeSuccessInput {
92
+ /** Discriminant marking this as a success input. */
17
93
  success: true;
18
- result: LAFSEnvelope["result"];
19
- page?: LAFSEnvelope["page"];
94
+ /** Operation result payload (object, array, or `null`). */
95
+ result: LAFSEnvelope['result'];
96
+ /**
97
+ * Pagination metadata for collection results.
98
+ *
99
+ * @defaultValue undefined
100
+ */
101
+ page?: LAFSEnvelope['page'];
102
+ /**
103
+ * Must be `null` for success inputs; exists for type uniformity with error inputs.
104
+ *
105
+ * @defaultValue undefined
106
+ */
20
107
  error?: null;
21
- _extensions?: LAFSEnvelope["_extensions"];
108
+ /**
109
+ * Vendor or protocol extension data.
110
+ *
111
+ * @defaultValue undefined
112
+ */
113
+ _extensions?: LAFSEnvelope['_extensions'];
114
+ /** Metadata input for constructing the envelope's `_meta` block. */
22
115
  meta: CreateEnvelopeMetaInput;
23
116
  }
117
+ /**
118
+ * Input for creating a failing LAFS envelope.
119
+ *
120
+ * @remarks
121
+ * When `success` is `false`, the `error` field is required and will be
122
+ * normalized (category, agent action, doc URL) via the error registry.
123
+ * An optional `result` can carry actionable data alongside the error.
124
+ */
24
125
  export interface CreateEnvelopeErrorInput {
126
+ /** Discriminant marking this as an error input. */
25
127
  success: false;
26
- error: Partial<LAFSError> & Pick<LAFSError, "code" | "message">;
128
+ /** Partial error object; at minimum `code` and `message` are required. */
129
+ error: Partial<LAFSError> & Pick<LAFSError, 'code' | 'message'>;
27
130
  /**
28
131
  * Optional result payload to include alongside the error.
29
132
  * For validation tools (linters, type checkers), the actionable data
@@ -32,29 +135,179 @@ export interface CreateEnvelopeErrorInput {
32
135
  * and the detailed result in a single response.
33
136
  *
34
137
  * When omitted or null, the envelope emits `result: null` (default behavior).
138
+ *
139
+ * @defaultValue undefined
140
+ */
141
+ result?: LAFSEnvelope['result'] | null;
142
+ /**
143
+ * Pagination metadata, if applicable even in error scenarios.
144
+ *
145
+ * @defaultValue undefined
146
+ */
147
+ page?: LAFSEnvelope['page'];
148
+ /**
149
+ * Vendor or protocol extension data.
150
+ *
151
+ * @defaultValue undefined
35
152
  */
36
- result?: LAFSEnvelope["result"] | null;
37
- page?: LAFSEnvelope["page"];
38
- _extensions?: LAFSEnvelope["_extensions"];
153
+ _extensions?: LAFSEnvelope['_extensions'];
154
+ /** Metadata input for constructing the envelope's `_meta` block. */
39
155
  meta: CreateEnvelopeMetaInput;
40
156
  }
157
+ /**
158
+ * Discriminated union of success and error inputs for {@link createEnvelope}.
159
+ *
160
+ * @remarks
161
+ * The `success` boolean discriminant determines which branch is active and
162
+ * which fields are required.
163
+ */
41
164
  export type CreateEnvelopeInput = CreateEnvelopeSuccessInput | CreateEnvelopeErrorInput;
165
+ /**
166
+ * Default agent action for each error category.
167
+ *
168
+ * @remarks
169
+ * When a {@link LAFSError} does not specify an explicit `agentAction` and the
170
+ * error registry has no override, this map provides the fallback recommendation
171
+ * based on the error's category.
172
+ *
173
+ * @example
174
+ * ```ts
175
+ * import { CATEGORY_ACTION_MAP } from '@cleocode/lafs';
176
+ * const action = CATEGORY_ACTION_MAP['RATE_LIMIT']; // => 'wait'
177
+ * ```
178
+ */
42
179
  export declare const CATEGORY_ACTION_MAP: Record<LAFSErrorCategory, LAFSAgentAction>;
180
+ /**
181
+ * Create a fully validated LAFS envelope from a success or error input.
182
+ *
183
+ * @param input - Discriminated union of success or error input data.
184
+ * @returns A complete {@link LAFSEnvelope} ready for serialization.
185
+ *
186
+ * @remarks
187
+ * This is the primary factory for LAFS envelopes. It delegates to
188
+ * internal `createMeta` for metadata construction and `normalizeError`
189
+ * for error normalization. Optional fields (`page`, `_extensions`) are only
190
+ * included when explicitly provided, keeping the envelope minimal.
191
+ *
192
+ * @example
193
+ * ```ts
194
+ * import { createEnvelope } from '@cleocode/lafs';
195
+ *
196
+ * const envelope = createEnvelope({
197
+ * success: true,
198
+ * result: { items: [] },
199
+ * meta: { operation: 'tasks.list', requestId: 'req-1' },
200
+ * });
201
+ * ```
202
+ */
43
203
  export declare function createEnvelope(input: CreateEnvelopeInput): LAFSEnvelope;
204
+ /**
205
+ * Error subclass that carries the full {@link LAFSError} payload.
206
+ *
207
+ * @remarks
208
+ * Thrown by {@link parseLafsResponse} when the envelope indicates failure.
209
+ * Implements {@link LAFSError} so consumers can access structured error
210
+ * metadata directly on the caught error instance. The `registered` flag
211
+ * indicates whether the error code exists in the canonical error registry.
212
+ *
213
+ * @example
214
+ * ```ts
215
+ * try {
216
+ * parseLafsResponse(envelope);
217
+ * } catch (err) {
218
+ * if (err instanceof LafsError) {
219
+ * console.log(err.code, err.agentAction);
220
+ * }
221
+ * }
222
+ * ```
223
+ */
44
224
  export declare class LafsError extends Error implements LAFSError {
225
+ /** Stable, machine-readable error code. */
45
226
  code: string;
227
+ /** High-level classification of the error. */
46
228
  category: LAFSErrorCategory;
229
+ /** Whether the operation can be retried without modification. */
47
230
  retryable: boolean;
231
+ /** Suggested delay in milliseconds before retrying, or `null` if not applicable. */
48
232
  retryAfterMs: number | null;
233
+ /** Arbitrary key-value pairs with additional context about the error. */
49
234
  details: Record<string, unknown>;
235
+ /** Whether this error code exists in the canonical error registry. */
50
236
  registered: boolean;
237
+ /**
238
+ * Recommended action for the consuming agent.
239
+ *
240
+ * @defaultValue undefined
241
+ */
51
242
  agentAction?: LAFSAgentAction;
243
+ /**
244
+ * Whether the error requires human or higher-privilege intervention.
245
+ *
246
+ * @defaultValue undefined
247
+ */
52
248
  escalationRequired?: boolean;
249
+ /**
250
+ * Free-text description of a suggested recovery action.
251
+ *
252
+ * @defaultValue undefined
253
+ */
53
254
  suggestedAction?: string;
255
+ /**
256
+ * URL pointing to documentation about this error code.
257
+ *
258
+ * @defaultValue undefined
259
+ */
54
260
  docUrl?: string;
261
+ /**
262
+ * Create a new `LafsError` from a structured {@link LAFSError} payload.
263
+ *
264
+ * @param error - The structured error data to wrap.
265
+ *
266
+ * @remarks
267
+ * Copies all fields from the input and sets `registered` by checking the
268
+ * error code against the canonical registry via {@link isRegisteredErrorCode}.
269
+ */
55
270
  constructor(error: LAFSError);
56
271
  }
272
+ /**
273
+ * Options for {@link parseLafsResponse}.
274
+ *
275
+ * @remarks
276
+ * Controls how strictly the parser validates the error code against the
277
+ * canonical error registry.
278
+ */
57
279
  export interface ParseLafsResponseOptions {
280
+ /**
281
+ * When `true`, unregistered error codes cause an additional `Error` to be
282
+ * thrown instead of the normal {@link LafsError}.
283
+ *
284
+ * @defaultValue undefined
285
+ */
58
286
  requireRegisteredErrorCode?: boolean;
59
287
  }
288
+ /**
289
+ * Parse and unwrap a raw LAFS envelope, returning the result or throwing on error.
290
+ *
291
+ * @typeParam T - Expected type of the result payload.
292
+ * @param input - Raw value expected to be a valid {@link LAFSEnvelope}.
293
+ * @param options - Parsing options controlling error-code validation.
294
+ * @returns The `result` field of the envelope cast to `T`.
295
+ * @throws {LafsError} When the envelope indicates failure (`success=false`).
296
+ * @throws {Error} When the envelope is structurally invalid or
297
+ * `requireRegisteredErrorCode` is `true` and the code is unregistered.
298
+ *
299
+ * @remarks
300
+ * Delegates to {@link assertEnvelope} for schema validation before inspecting
301
+ * the `success` flag. On success, the `result` is returned directly. On
302
+ * failure, the `error` payload is wrapped in a {@link LafsError} and thrown.
303
+ *
304
+ * @example
305
+ * ```ts
306
+ * import { parseLafsResponse } from '@cleocode/lafs';
307
+ *
308
+ * interface TaskList { items: Task[] }
309
+ * const tasks = parseLafsResponse<TaskList>(rawEnvelope);
310
+ * ```
311
+ */
60
312
  export declare function parseLafsResponse<T = unknown>(input: unknown, options?: ParseLafsResponseOptions): T;
313
+ //# sourceMappingURL=envelope.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"envelope.d.ts","sourceRoot":"","sources":["../../src/envelope.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,eAAe,EACf,YAAY,EACZ,SAAS,EACT,iBAAiB,EACjB,QAAQ,EACR,aAAa,EACb,QAAQ,EACT,MAAM,YAAY,CAAC;AAGpB;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,eAAe,EAAG,kDAA2D,CAAC;AAE3F;;;;;;GAMG;AACH,MAAM,WAAW,uBAAuB;IACtC,gEAAgE;IAChE,SAAS,EAAE,MAAM,CAAC;IAClB,oEAAoE;IACpE,SAAS,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;OAIG;IACH,GAAG,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;IACzB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC;CACjC;AAED;;;;;;GAMG;AACH,MAAM,WAAW,0BAA0B;IACzC,oDAAoD;IACpD,OAAO,EAAE,IAAI,CAAC;IACd,2DAA2D;IAC3D,MAAM,EAAE,YAAY,CAAC,QAAQ,CAAC,CAAC;IAC/B;;;;OAIG;IACH,IAAI,CAAC,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC;IAC5B;;;;OAIG;IACH,KAAK,CAAC,EAAE,IAAI,CAAC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AAO,CAAC,CAAC;IACjC,sEAAsE;IACtE,UAAU,EAAE,OAAO,CAAC;IACpB;;;;OAIG;IACH,WAAW,CAAC,EAAE,eAAe,CAAC;IAC9B;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;;;;;;OAQG;gBACS,KAAK,EAAE,SAAS;CAc7B;AAED;;;;;;GAMG;AACH,MAAM,WAAW,wBAAwB;IACvC;;;;;OAKG;IACH,0BAA0B,CAAC,EAAE,OAAO,CAAC;CACtC;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,GAAG,OAAO,EAC3C,KAAK,EAAE,OAAO,EACd,OAAO,GAAE,wBAA6B,GACrC,CAAC,CAgBH"}
@@ -1,20 +1,56 @@
1
- import { isRegisteredErrorCode, getRegistryCode, getAgentAction, getDocUrl } from "./errorRegistry.js";
2
- import { assertEnvelope } from "./validateEnvelope.js";
3
- export const LAFS_SCHEMA_URL = "https://lafs.dev/schemas/v1/envelope.schema.json";
1
+ import { getAgentAction, getDocUrl, getRegistryCode, isRegisteredErrorCode, } from './errorRegistry.js';
2
+ import { assertEnvelope } from './validateEnvelope.js';
3
+ /**
4
+ * Canonical JSON Schema URL for the LAFS v1 envelope.
5
+ *
6
+ * @remarks
7
+ * Every LAFS envelope includes this URL in its `$schema` field so that
8
+ * validators and tooling can locate the authoritative schema definition.
9
+ *
10
+ * @example
11
+ * ```ts
12
+ * import { LAFS_SCHEMA_URL } from '@cleocode/lafs';
13
+ * console.log(LAFS_SCHEMA_URL);
14
+ * // => 'https://lafs.dev/schemas/v1/envelope.schema.json'
15
+ * ```
16
+ */
17
+ export const LAFS_SCHEMA_URL = 'https://lafs.dev/schemas/v1/envelope.schema.json';
18
+ /**
19
+ * Resolve an MVI input (string, boolean, or undefined) to a canonical {@link MVILevel}.
20
+ *
21
+ * @param input - MVI value from the caller: a level string, `true` for minimal,
22
+ * `false` for standard, or `undefined` for the default.
23
+ * @returns The resolved {@link MVILevel} string.
24
+ *
25
+ * @remarks
26
+ * Boolean shorthand exists for CLI convenience: `--mvi` (no value) maps to
27
+ * `true` which resolves to `'minimal'`.
28
+ */
4
29
  function resolveMviLevel(input) {
5
- if (typeof input === "boolean") {
6
- return input ? "minimal" : "standard";
30
+ if (typeof input === 'boolean') {
31
+ return input ? 'minimal' : 'standard';
7
32
  }
8
- return input ?? "standard";
33
+ return input ?? 'standard';
9
34
  }
35
+ /**
36
+ * Build a fully populated {@link LAFSMeta} object from partial input.
37
+ *
38
+ * @param input - Caller-supplied metadata fields; missing values receive defaults.
39
+ * @returns A complete {@link LAFSMeta} ready for embedding in an envelope.
40
+ *
41
+ * @remarks
42
+ * Defaults: `specVersion` and `schemaVersion` to `'1.0.0'`, `transport` to
43
+ * `'sdk'`, `strict` to `true`, `mvi` to `'standard'`, `contextVersion` to `0`,
44
+ * and `timestamp` to the current time.
45
+ */
10
46
  function createMeta(input) {
11
47
  return {
12
- specVersion: input.specVersion ?? "1.0.0",
13
- schemaVersion: input.schemaVersion ?? "1.0.0",
48
+ specVersion: input.specVersion ?? '1.0.0',
49
+ schemaVersion: input.schemaVersion ?? '1.0.0',
14
50
  timestamp: input.timestamp ?? new Date().toISOString(),
15
51
  operation: input.operation,
16
52
  requestId: input.requestId,
17
- transport: input.transport ?? "sdk",
53
+ transport: input.transport ?? 'sdk',
18
54
  strict: input.strict ?? true,
19
55
  mvi: resolveMviLevel(input.mvi),
20
56
  contextVersion: input.contextVersion ?? 0,
@@ -22,6 +58,20 @@ function createMeta(input) {
22
58
  ...(input.warnings ? { warnings: input.warnings } : {}),
23
59
  };
24
60
  }
61
+ /**
62
+ * Default agent action for each error category.
63
+ *
64
+ * @remarks
65
+ * When a {@link LAFSError} does not specify an explicit `agentAction` and the
66
+ * error registry has no override, this map provides the fallback recommendation
67
+ * based on the error's category.
68
+ *
69
+ * @example
70
+ * ```ts
71
+ * import { CATEGORY_ACTION_MAP } from '@cleocode/lafs';
72
+ * const action = CATEGORY_ACTION_MAP['RATE_LIMIT']; // => 'wait'
73
+ * ```
74
+ */
25
75
  export const CATEGORY_ACTION_MAP = {
26
76
  VALIDATION: 'retry_modified',
27
77
  AUTH: 'authenticate',
@@ -34,14 +84,25 @@ export const CATEGORY_ACTION_MAP = {
34
84
  CONTRACT: 'retry_modified',
35
85
  MIGRATION: 'stop',
36
86
  };
87
+ /**
88
+ * Normalize a partial error input into a fully populated {@link LAFSError}.
89
+ *
90
+ * @param error - Partial error with at least `code` and `message`.
91
+ * @returns A complete {@link LAFSError} with category, retryable flag, agent
92
+ * action, and optional doc URL resolved from the error registry and
93
+ * category-action map.
94
+ *
95
+ * @remarks
96
+ * Resolution precedence for `agentAction`: explicit caller value > error
97
+ * registry entry > {@link CATEGORY_ACTION_MAP} fallback. The same pattern
98
+ * applies to `category`, `retryable`, and `docUrl`.
99
+ */
37
100
  function normalizeError(error) {
38
101
  const registryEntry = getRegistryCode(error.code);
39
- const category = (error.category ?? registryEntry?.category ?? "INTERNAL");
102
+ const category = (error.category ?? registryEntry?.category ?? 'INTERNAL');
40
103
  const retryable = error.retryable ?? registryEntry?.retryable ?? false;
41
104
  // Derive agentAction: explicit > registry > category fallback
42
- const agentAction = error.agentAction ??
43
- getAgentAction(error.code) ??
44
- CATEGORY_ACTION_MAP[category];
105
+ const agentAction = error.agentAction ?? getAgentAction(error.code) ?? CATEGORY_ACTION_MAP[category];
45
106
  const docUrl = error.docUrl ?? getDocUrl(error.code);
46
107
  const result = {
47
108
  code: error.code,
@@ -65,6 +126,29 @@ function normalizeError(error) {
65
126
  }
66
127
  return result;
67
128
  }
129
+ /**
130
+ * Create a fully validated LAFS envelope from a success or error input.
131
+ *
132
+ * @param input - Discriminated union of success or error input data.
133
+ * @returns A complete {@link LAFSEnvelope} ready for serialization.
134
+ *
135
+ * @remarks
136
+ * This is the primary factory for LAFS envelopes. It delegates to
137
+ * internal `createMeta` for metadata construction and `normalizeError`
138
+ * for error normalization. Optional fields (`page`, `_extensions`) are only
139
+ * included when explicitly provided, keeping the envelope minimal.
140
+ *
141
+ * @example
142
+ * ```ts
143
+ * import { createEnvelope } from '@cleocode/lafs';
144
+ *
145
+ * const envelope = createEnvelope({
146
+ * success: true,
147
+ * result: { items: [] },
148
+ * meta: { operation: 'tasks.list', requestId: 'req-1' },
149
+ * });
150
+ * ```
151
+ */
68
152
  export function createEnvelope(input) {
69
153
  const meta = createMeta(input.meta);
70
154
  if (input.success) {
@@ -90,20 +174,75 @@ export function createEnvelope(input) {
90
174
  ...(input._extensions !== undefined ? { _extensions: input._extensions } : {}),
91
175
  };
92
176
  }
177
+ /**
178
+ * Error subclass that carries the full {@link LAFSError} payload.
179
+ *
180
+ * @remarks
181
+ * Thrown by {@link parseLafsResponse} when the envelope indicates failure.
182
+ * Implements {@link LAFSError} so consumers can access structured error
183
+ * metadata directly on the caught error instance. The `registered` flag
184
+ * indicates whether the error code exists in the canonical error registry.
185
+ *
186
+ * @example
187
+ * ```ts
188
+ * try {
189
+ * parseLafsResponse(envelope);
190
+ * } catch (err) {
191
+ * if (err instanceof LafsError) {
192
+ * console.log(err.code, err.agentAction);
193
+ * }
194
+ * }
195
+ * ```
196
+ */
93
197
  export class LafsError extends Error {
198
+ /** Stable, machine-readable error code. */
94
199
  code;
200
+ /** High-level classification of the error. */
95
201
  category;
202
+ /** Whether the operation can be retried without modification. */
96
203
  retryable;
204
+ /** Suggested delay in milliseconds before retrying, or `null` if not applicable. */
97
205
  retryAfterMs;
206
+ /** Arbitrary key-value pairs with additional context about the error. */
98
207
  details;
208
+ /** Whether this error code exists in the canonical error registry. */
99
209
  registered;
210
+ /**
211
+ * Recommended action for the consuming agent.
212
+ *
213
+ * @defaultValue undefined
214
+ */
100
215
  agentAction;
216
+ /**
217
+ * Whether the error requires human or higher-privilege intervention.
218
+ *
219
+ * @defaultValue undefined
220
+ */
101
221
  escalationRequired;
222
+ /**
223
+ * Free-text description of a suggested recovery action.
224
+ *
225
+ * @defaultValue undefined
226
+ */
102
227
  suggestedAction;
228
+ /**
229
+ * URL pointing to documentation about this error code.
230
+ *
231
+ * @defaultValue undefined
232
+ */
103
233
  docUrl;
234
+ /**
235
+ * Create a new `LafsError` from a structured {@link LAFSError} payload.
236
+ *
237
+ * @param error - The structured error data to wrap.
238
+ *
239
+ * @remarks
240
+ * Copies all fields from the input and sets `registered` by checking the
241
+ * error code against the canonical registry via {@link isRegisteredErrorCode}.
242
+ */
104
243
  constructor(error) {
105
244
  super(error.message);
106
- this.name = "LafsError";
245
+ this.name = 'LafsError';
107
246
  this.code = error.code;
108
247
  this.category = error.category;
109
248
  this.retryable = error.retryable;
@@ -120,6 +259,30 @@ export class LafsError extends Error {
120
259
  this.docUrl = error.docUrl;
121
260
  }
122
261
  }
262
+ /**
263
+ * Parse and unwrap a raw LAFS envelope, returning the result or throwing on error.
264
+ *
265
+ * @typeParam T - Expected type of the result payload.
266
+ * @param input - Raw value expected to be a valid {@link LAFSEnvelope}.
267
+ * @param options - Parsing options controlling error-code validation.
268
+ * @returns The `result` field of the envelope cast to `T`.
269
+ * @throws {LafsError} When the envelope indicates failure (`success=false`).
270
+ * @throws {Error} When the envelope is structurally invalid or
271
+ * `requireRegisteredErrorCode` is `true` and the code is unregistered.
272
+ *
273
+ * @remarks
274
+ * Delegates to {@link assertEnvelope} for schema validation before inspecting
275
+ * the `success` flag. On success, the `result` is returned directly. On
276
+ * failure, the `error` payload is wrapped in a {@link LafsError} and thrown.
277
+ *
278
+ * @example
279
+ * ```ts
280
+ * import { parseLafsResponse } from '@cleocode/lafs';
281
+ *
282
+ * interface TaskList { items: Task[] }
283
+ * const tasks = parseLafsResponse<TaskList>(rawEnvelope);
284
+ * ```
285
+ */
123
286
  export function parseLafsResponse(input, options = {}) {
124
287
  const envelope = assertEnvelope(input);
125
288
  if (envelope.success) {
@@ -127,10 +290,11 @@ export function parseLafsResponse(input, options = {}) {
127
290
  }
128
291
  const error = envelope.error;
129
292
  if (!error) {
130
- throw new Error("Invalid LAFS envelope: success=false requires error object");
293
+ throw new Error('Invalid LAFS envelope: success=false requires error object');
131
294
  }
132
295
  if (options.requireRegisteredErrorCode && !isRegisteredErrorCode(error.code)) {
133
296
  throw new Error(`Unregistered LAFS error code: ${error.code}`);
134
297
  }
135
298
  throw new LafsError(error);
136
299
  }
300
+ //# sourceMappingURL=envelope.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"envelope.js","sourceRoot":"","sources":["../../src/envelope.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,SAAS,EACT,eAAe,EACf,qBAAqB,GACtB,MAAM,oBAAoB,CAAC;AAU5B,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,kDAA2D,CAAC;AA0J3F;;;;;;;;;;GAUG;AACH,SAAS,eAAe,CAAC,KAAqC;IAC5D,IAAI,OAAO,KAAK,KAAK,SAAS,EAAE,CAAC;QAC/B,OAAO,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC;IACxC,CAAC;IACD,OAAO,KAAK,IAAI,UAAU,CAAC;AAC7B,CAAC;AAED;;;;;;;;;;GAUG;AACH,SAAS,UAAU,CAAC,KAA8B;IAChD,OAAO;QACL,WAAW,EAAE,KAAK,CAAC,WAAW,IAAI,OAAO;QACzC,aAAa,EAAE,KAAK,CAAC,aAAa,IAAI,OAAO;QAC7C,SAAS,EAAE,KAAK,CAAC,SAAS,IAAI,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACtD,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,SAAS,EAAE,KAAK,CAAC,SAAS,IAAI,KAAK;QACnC,MAAM,EAAE,KAAK,CA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