@cleocode/lafs-protocol 1.4.0 → 1.5.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/README.md +1 -1
- package/dist/schemas/v1/conformance-profiles.json +35 -0
- package/dist/schemas/v1/error-registry.json +9 -0
- package/dist/src/a2a/bindings/index.d.ts +4 -0
- package/dist/src/a2a/bindings/index.js +25 -0
- package/dist/src/a2a/bridge.d.ts +2 -1
- package/dist/src/a2a/bridge.js +17 -0
- package/dist/src/a2a/extensions.d.ts +17 -0
- package/dist/src/a2a/extensions.js +43 -1
- package/dist/src/a2a/index.d.ts +3 -1
- package/dist/src/a2a/index.js +8 -2
- package/dist/src/a2a/streaming.d.ts +74 -0
- package/dist/src/a2a/streaming.js +265 -0
- package/dist/src/a2a/task-lifecycle.d.ts +11 -0
- package/dist/src/a2a/task-lifecycle.js +52 -2
- package/dist/src/conformance.d.ts +5 -1
- package/dist/src/conformance.js +106 -5
- package/dist/src/conformanceProfiles.d.ts +11 -0
- package/dist/src/conformanceProfiles.js +34 -0
- package/dist/src/deprecationRegistry.d.ts +13 -0
- package/dist/src/deprecationRegistry.js +39 -0
- package/dist/src/errorRegistry.d.ts +6 -0
- package/dist/src/errorRegistry.js +16 -0
- package/dist/src/fieldExtraction.d.ts +67 -0
- package/dist/src/fieldExtraction.js +133 -0
- package/dist/src/flagSemantics.d.ts +7 -3
- package/dist/src/flagSemantics.js +11 -1
- package/dist/src/index.d.ts +5 -2
- package/dist/src/index.js +7 -2
- package/dist/src/types.d.ts +2 -0
- package/dist/src/types.js +6 -1
- package/lafs.md +50 -8
- package/package.json +3 -2
- package/schemas/v1/conformance-profiles.json +35 -0
- package/schemas/v1/error-registry.json +9 -0
package/dist/src/index.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
export * from "./types.js";
|
|
2
2
|
export * from "./errorRegistry.js";
|
|
3
|
+
export * from "./deprecationRegistry.js";
|
|
3
4
|
export * from "./validateEnvelope.js";
|
|
4
5
|
export * from "./envelope.js";
|
|
5
6
|
export * from "./flagSemantics.js";
|
|
7
|
+
export * from "./fieldExtraction.js";
|
|
6
8
|
export * from "./conformance.js";
|
|
9
|
+
export * from "./conformanceProfiles.js";
|
|
7
10
|
export * from "./compliance.js";
|
|
8
11
|
export * from "./tokenEstimator.js";
|
|
9
12
|
export * from "./budgetEnforcement.js";
|
|
@@ -19,8 +22,10 @@ export * from "./circuit-breaker/index.js";
|
|
|
19
22
|
// For full A2A types, import from '@cleocode/lafs-protocol/a2a'.
|
|
20
23
|
export {
|
|
21
24
|
// Bridge
|
|
22
|
-
LafsA2AResult, createLafsArtifact, createTextArtifact, createFileArtifact, isExtensionRequired, getExtensionParams,
|
|
25
|
+
LafsA2AResult, createLafsArtifact, createTextArtifact, createFileArtifact, isExtensionRequired, getExtensionParams, AGENT_CARD_PATH, HTTP_EXTENSION_HEADER,
|
|
23
26
|
// Extensions (T098)
|
|
24
27
|
LAFS_EXTENSION_URI, A2A_EXTENSIONS_HEADER, parseExtensionsHeader, negotiateExtensions, formatExtensionsHeader, buildLafsExtension, ExtensionSupportRequiredError, extensionNegotiationMiddleware,
|
|
25
28
|
// Task Lifecycle (T099)
|
|
26
|
-
TERMINAL_STATES, INTERRUPTED_STATES, VALID_TRANSITIONS, isValidTransition, isTerminalState, isInterruptedState, InvalidStateTransitionError, TaskImmutabilityError, TaskNotFoundError, TaskManager, attachLafsEnvelope,
|
|
29
|
+
TERMINAL_STATES, INTERRUPTED_STATES, VALID_TRANSITIONS, isValidTransition, isTerminalState, isInterruptedState, InvalidStateTransitionError, TaskImmutabilityError, TaskNotFoundError, TaskRefinementError, TaskManager, attachLafsEnvelope,
|
|
30
|
+
// Streaming and Async (T101)
|
|
31
|
+
TaskEventBus, PushNotificationConfigStore, PushNotificationDispatcher, TaskArtifactAssembler, streamTaskEvents, } from "./a2a/index.js";
|
package/dist/src/types.d.ts
CHANGED
|
@@ -8,6 +8,8 @@ export interface Warning {
|
|
|
8
8
|
removeBy?: string;
|
|
9
9
|
}
|
|
10
10
|
export type MVILevel = 'minimal' | 'standard' | 'full' | 'custom';
|
|
11
|
+
export declare const MVI_LEVELS: ReadonlySet<MVILevel>;
|
|
12
|
+
export declare function isMVILevel(value: unknown): value is MVILevel;
|
|
11
13
|
export interface LAFSMeta {
|
|
12
14
|
specVersion: string;
|
|
13
15
|
schemaVersion: string;
|
package/dist/src/types.js
CHANGED
package/lafs.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# LAFS: LLM-Agent-First Specification
|
|
2
2
|
|
|
3
3
|
> 📚 **Documentation:** https://codluv.gitbook.io/lafs-protocol/
|
|
4
|
-
> **Version:** 1.
|
|
4
|
+
> **Version:** 1.5.0 | **Status:** Production Ready
|
|
5
5
|
|
|
6
6
|
## 1. Scope
|
|
7
7
|
|
|
@@ -412,6 +412,16 @@ Returns checksum and version for validation.
|
|
|
412
412
|
- **Validation**: Use `mode=summary` to verify sync state
|
|
413
413
|
- **Default recommendation**: `delta` mode for agent-optimal behavior
|
|
414
414
|
|
|
415
|
+
### 8.2 Lazy Context Retrieval
|
|
416
|
+
|
|
417
|
+
To reduce token and I/O overhead, implementations SHOULD support lazy retrieval semantics:
|
|
418
|
+
|
|
419
|
+
- Clients SHOULD start with `mode=summary` and request `mode=delta` only when `version` or `checksum` changes.
|
|
420
|
+
- Delta responses SHOULD be bounded by `limit` and MAY return paged deltas.
|
|
421
|
+
- Servers SHOULD treat context retrieval as task-scoped and MUST NOT leak entries across `contextId` domains.
|
|
422
|
+
- When a consumer requests additional context beyond MVI defaults, servers MAY return progressive context slices rather than full ledgers.
|
|
423
|
+
- If requested context scope cannot be satisfied within declared budget, servers SHOULD fail with `E_MVI_BUDGET_EXCEEDED`.
|
|
424
|
+
|
|
415
425
|
---
|
|
416
426
|
|
|
417
427
|
## 9. MVI and Progressive Disclosure
|
|
@@ -421,16 +431,45 @@ Returns checksum and version for validation.
|
|
|
421
431
|
- Default list/batch outputs MUST only contain fields required for next action.
|
|
422
432
|
- Verbose fields SHOULD be omitted by default.
|
|
423
433
|
- Systems SHOULD publish operation-level MVI budgets.
|
|
434
|
+
- `_meta.mvi` MUST be one of: `minimal`, `standard`, `full`, or `custom`.
|
|
435
|
+
- `_meta` is a structural envelope field and MUST always be present regardless
|
|
436
|
+
of `mvi` level. MVI levels govern the contents of `result` only; they MUST NOT
|
|
437
|
+
affect envelope structural fields (`$schema`, `_meta`, `success`, `error`,
|
|
438
|
+
`page`, `_extensions`).
|
|
439
|
+
- `minimal`: MUST include only fields within `result` sufficient for the next
|
|
440
|
+
agent action (typically identifiers and status). Implementations SHOULD
|
|
441
|
+
document which fields constitute `minimal` per operation.
|
|
442
|
+
- `standard` (default): MUST include all commonly useful fields for the
|
|
443
|
+
operation.
|
|
444
|
+
- `full`: MUST include all available fields including verbose and
|
|
445
|
+
rarely-accessed data.
|
|
446
|
+
- `custom`: MUST be set by the server when `_fields` projection has been
|
|
447
|
+
applied, indicating the result does not conform to any predefined disclosure
|
|
448
|
+
level. `custom` is not a client-requestable level.
|
|
424
449
|
|
|
425
450
|
### 9.2 Field selection (`_fields`)
|
|
426
451
|
|
|
427
|
-
Clients MAY request a subset of response fields via the `_fields` request
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
-
|
|
431
|
-
|
|
432
|
-
-
|
|
433
|
-
- `
|
|
452
|
+
Clients MAY request a subset of response fields via the `_fields` request
|
|
453
|
+
parameter.
|
|
454
|
+
|
|
455
|
+
- `_fields` MUST be an array of strings identifying `result` field names.
|
|
456
|
+
Path notation (e.g., `task.title`) is not defined by this specification.
|
|
457
|
+
- When `result` is an array, `_fields` applies to the keys of each element.
|
|
458
|
+
- When `result` is a wrapper object whose values are entities or arrays of
|
|
459
|
+
entities (e.g., `{ "task": { ... } }` or `{ "items": [...] }`), servers
|
|
460
|
+
SHOULD apply `_fields` to the nested entity fields rather than the wrapper's
|
|
461
|
+
own keys.
|
|
462
|
+
- When `_fields` is present, the server MUST return only the requested fields
|
|
463
|
+
plus any MVI-required fields for the declared disclosure level.
|
|
464
|
+
The server MUST set `_meta.mvi` to `custom` in the response.
|
|
465
|
+
- When `_fields` is absent, the server MUST return fields appropriate for the
|
|
466
|
+
declared `_meta.mvi` disclosure level.
|
|
467
|
+
- If a requested field does not exist on the resource, the server SHOULD omit
|
|
468
|
+
it silently (no error). Servers MAY include a warning in `_meta.warnings`
|
|
469
|
+
for unknown fields.
|
|
470
|
+
- `_fields` MUST NOT affect envelope structural fields (`$schema`, `_meta`,
|
|
471
|
+
`success`, `error`, `page`, `_extensions`); it applies only to the contents
|
|
472
|
+
of `result`.
|
|
434
473
|
|
|
435
474
|
### 9.3 Expansion mechanism (`_expand`)
|
|
436
475
|
|
|
@@ -447,6 +486,9 @@ Clients MAY request expanded/nested data via the `_expand` request parameter.
|
|
|
447
486
|
- List operations SHOULD return deterministic `page` metadata.
|
|
448
487
|
- Pagination mode (offset or cursor) MUST be documented.
|
|
449
488
|
- Mixed pagination modes in one request MUST fail validation.
|
|
489
|
+
- `page.limit` SHOULD represent the effective item window after `_fields`/`_expand` processing.
|
|
490
|
+
- When `_meta.mvi` is `minimal` and projected payload size exceeds budget, servers SHOULD reduce `page.limit` rather than silently truncate item content.
|
|
491
|
+
- If limit reduction still cannot satisfy declared budget, servers MUST fail with `E_MVI_BUDGET_EXCEEDED`.
|
|
450
492
|
|
|
451
493
|
### 9.5 Token Budget Signaling
|
|
452
494
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cleocode/lafs-protocol",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "LLM-Agent-First Specification schemas and conformance tooling",
|
|
@@ -26,7 +26,8 @@
|
|
|
26
26
|
"./schemas/v1/envelope.schema.json": "./schemas/v1/envelope.schema.json",
|
|
27
27
|
"./schemas/v1/error-registry.json": "./schemas/v1/error-registry.json",
|
|
28
28
|
"./schemas/v1/context-ledger.schema.json": "./schemas/v1/context-ledger.schema.json",
|
|
29
|
-
"./schemas/v1/discovery.schema.json": "./schemas/v1/discovery.schema.json"
|
|
29
|
+
"./schemas/v1/discovery.schema.json": "./schemas/v1/discovery.schema.json",
|
|
30
|
+
"./schemas/v1/conformance-profiles.json": "./schemas/v1/conformance-profiles.json"
|
|
30
31
|
},
|
|
31
32
|
"files": [
|
|
32
33
|
"dist",
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"tiers": {
|
|
5
|
+
"core": [
|
|
6
|
+
"envelope_schema_valid",
|
|
7
|
+
"envelope_invariants",
|
|
8
|
+
"error_code_registered"
|
|
9
|
+
],
|
|
10
|
+
"standard": [
|
|
11
|
+
"envelope_schema_valid",
|
|
12
|
+
"envelope_invariants",
|
|
13
|
+
"error_code_registered",
|
|
14
|
+
"transport_mapping_consistent",
|
|
15
|
+
"meta_mvi_present",
|
|
16
|
+
"meta_strict_present",
|
|
17
|
+
"strict_mode_behavior",
|
|
18
|
+
"pagination_mode_consistent",
|
|
19
|
+
"strict_mode_enforced"
|
|
20
|
+
],
|
|
21
|
+
"complete": [
|
|
22
|
+
"envelope_schema_valid",
|
|
23
|
+
"envelope_invariants",
|
|
24
|
+
"error_code_registered",
|
|
25
|
+
"transport_mapping_consistent",
|
|
26
|
+
"context_mutation_failure",
|
|
27
|
+
"context_preservation_valid",
|
|
28
|
+
"meta_mvi_present",
|
|
29
|
+
"meta_strict_present",
|
|
30
|
+
"strict_mode_behavior",
|
|
31
|
+
"pagination_mode_consistent",
|
|
32
|
+
"strict_mode_enforced"
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -109,6 +109,15 @@
|
|
|
109
109
|
"httpStatus": 413,
|
|
110
110
|
"grpcStatus": "RESOURCE_EXHAUSTED",
|
|
111
111
|
"cliExit": 2
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
"code": "E_FIELD_CONFLICT",
|
|
115
|
+
"category": "CONTRACT",
|
|
116
|
+
"description": "Mutually exclusive field selection modes (single-field extraction and multi-field filtering cannot be combined)",
|
|
117
|
+
"retryable": false,
|
|
118
|
+
"httpStatus": 400,
|
|
119
|
+
"grpcStatus": "INVALID_ARGUMENT",
|
|
120
|
+
"cliExit": 2
|
|
112
121
|
}
|
|
113
122
|
]
|
|
114
123
|
}
|