@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
package/LICENSE CHANGED
File without changes
package/README.md CHANGED
@@ -1,12 +1,11 @@
1
1
  # LAFS Protocol
2
2
 
3
- **LLM-Agent-First Specification** — a response envelope contract for AI agent systems.
3
+ **LLM-Agent-First Specification** -- a response envelope contract for AI agent systems.
4
4
 
5
- LAFS defines a standard envelope format for structured responses from LLM-powered agents and tools. It complements transport protocols like [MCP](https://modelcontextprotocol.io/) and [A2A](https://github.com/google/A2A) by standardizing what comes back — not how it gets there.
5
+ LAFS defines a standard envelope format for structured responses from LLM-powered agents and tools. It complements transport protocols like [MCP](https://modelcontextprotocol.io/) and [A2A](https://github.com/google/A2A) by standardizing what comes back -- not how it gets there.
6
6
 
7
- **Current version:** 1.5.0 | [📚 Documentation](https://codluv.gitbook.io/lafs/) | [Spec](lafs.md) | [Migration Guides](migrations/)
7
+ **Current version:** 2026.4.0 | [Spec](lafs.md)
8
8
 
9
- [![GitBook](https://img.shields.io/badge/docs-gitbook-blue)](https://codluv.gitbook.io/lafs/)
10
9
  [![npm](https://img.shields.io/npm/v/@cleocode/lafs)](https://www.npmjs.com/package/@cleocode/lafs)
11
10
 
12
11
  ## What LAFS provides
@@ -16,17 +15,24 @@ LAFS defines a standard envelope format for structured responses from LLM-powere
16
15
  | **Spec** | `lafs.md` | Protocol specification with RFC 2119 language |
17
16
  | **Schemas** | `schemas/v1/envelope.schema.json` | Envelope schema (Draft-07) with conditional pagination validation |
18
17
  | | `schemas/v1/context-ledger.schema.json` | Context ledger for state tracking across request/response cycles |
19
- | | `schemas/v1/error-registry.json` | 12 registered error codes with HTTP/gRPC/CLI transport mappings |
18
+ | | `schemas/v1/discovery.schema.json` | Agent Card discovery schema |
19
+ | | `schemas/v1/conformance-profiles.json` | Conformance tier definitions |
20
+ | | `schemas/v1/error-registry.json` | 13 registered error codes with HTTP/gRPC/CLI transport mappings |
20
21
  | **Tooling** | `src/` | TypeScript validation, conformance runner, CLI diagnostic tool |
21
- | **A2A** | `src/a2a/` | Agent-to-Agent integration: extensions, task lifecycle, protocol bindings (JSON-RPC/HTTP/gRPC) |
22
- | **Tests** | `tests/` | Tests covering envelope, pagination, strict mode, error handling, A2A extensions, task lifecycle, bindings |
23
- | **Fixtures** | `fixtures/` | 14 JSON fixtures (valid + invalid) for conformance testing |
24
- | **Docs** | `docs/` | [GitBook documentation](https://codluv.gitbook.io/lafs/) with guides, SDK reference, and specs |
22
+ | **A2A** | `src/a2a/` | Agent-to-Agent integration: extensions, task lifecycle, streaming, protocol bindings (JSON-RPC/HTTP/gRPC) |
23
+ | **Tests** | `tests/` | 20 test suites covering envelope, pagination, strict mode, error handling, A2A extensions, task lifecycle, bindings |
24
+ | **Fixtures** | `fixtures/` | 25 JSON fixtures (valid + invalid + agent workflow scenarios) for conformance testing |
25
+ | **Docs** | `docs/` | Guides, SDK reference, architecture docs, and specs |
25
26
 
26
27
  ## Install
27
28
 
28
29
  ```bash
30
+ # Inside the monorepo (pnpm workspace)
31
+ pnpm add @cleocode/lafs
32
+
33
+ # External consumers
29
34
  npm install @cleocode/lafs
35
+ # or: yarn add @cleocode/lafs
30
36
  ```
31
37
 
32
38
  ## Usage
@@ -41,7 +47,7 @@ import {
41
47
  isRegisteredErrorCode,
42
48
  } from "@cleocode/lafs";
43
49
 
44
- // Build envelope with defaults
50
+ // Build a success envelope
45
51
  const envelope = createEnvelope({
46
52
  success: true,
47
53
  result: { items: [] },
@@ -54,7 +60,7 @@ if (!validation.valid) {
54
60
  console.error(validation.errors);
55
61
  }
56
62
 
57
- // Parse envelope responses with one function
63
+ // Parse envelope responses
58
64
  try {
59
65
  const parsed = parseLafsResponse(envelope);
60
66
  console.log(parsed);
@@ -69,26 +75,6 @@ const report = runEnvelopeConformance(envelope);
69
75
  console.log(report.ok); // true if all checks pass
70
76
  ```
71
77
 
72
- ## LLM-agent implementation guides
73
-
74
- - `docs/guides/llm-agent-guide.md` - parser, success/error handling, strict JSON policy
75
- - `docs/guides/schema-extension.md` - operation-specific result validation on top of core schema
76
- - `docs/guides/compliance-pipeline.md` - generation middleware with validate + conformance gates
77
- - `docs/llms.txt` - LLM-oriented index and canonical sources
78
-
79
- ## CLI
80
-
81
- ```bash
82
- # Run conformance checks on a fixture
83
- npm run conformance -- --envelope fixtures/valid-success-envelope.json
84
-
85
- # Run tests
86
- npm test
87
-
88
- # Type check
89
- npm run typecheck
90
- ```
91
-
92
78
  ## Envelope structure
93
79
 
94
80
  ```json
@@ -115,17 +101,28 @@ npm run typecheck
115
101
  }
116
102
  ```
117
103
 
104
+ ### Envelope invariants
105
+
106
+ - `$schema`, `_meta`, `success`, and `result` are always required.
107
+ - `success: true` implies `error` is `null` (or absent).
108
+ - `success: false` requires a non-null `error` object. `result` MAY be non-null on error envelopes -- this allows validation tools to include actionable data (e.g., suggested fixes) alongside error metadata.
109
+ - Exactly one pagination mode (`cursor`, `offset`, `none`) with mode-specific required fields.
110
+ - `strict: true` rejects additional properties; `strict: false` allows them.
111
+
118
112
  ## Key features
119
113
 
120
- - **Conditional pagination** — cursor, offset, and none modes with mode-specific required fields
121
- - **Strict/lenient mode** — `strict: true` rejects unknown properties; `strict: false` allows them
122
- - **MVI disclosure levels** — `minimal`, `standard`, `full`, `custom` control response verbosity
114
+ - **Conditional pagination** -- cursor, offset, and none modes with mode-specific required fields
115
+ - **Strict/lenient mode** -- `strict: true` rejects unknown properties; `strict: false` allows them
116
+ - **MVI disclosure levels** -- `minimal`, `standard`, `full`, `custom` control response verbosity
123
117
  - **Field selection** (`_fields`) and **expansion** (`_expand`) request parameters
124
- - **Context ledger** — tracks state across request/response cycles with monotonic versioning
125
- - **Error registry** — 12 codes with category, retryability, and transport-specific status mappings
126
- - **Extension mechanism** — `_extensions` field for vendor metadata (`x-` prefix convention)
127
- - **Adoption tiers** — Core, Standard, Complete with progressive conformance requirements
128
- - **A2A integration** — Agent Card discovery, extension negotiation, task lifecycle management, protocol bindings
118
+ - **Context ledger** -- tracks state across request/response cycles with monotonic versioning
119
+ - **Error registry** -- 13 codes with category, retryability, agent action, and transport-specific status mappings
120
+ - **Extension mechanism** -- `_extensions` field for vendor metadata (`x-` prefix convention)
121
+ - **Adoption tiers** -- Core, Standard, Complete with progressive conformance requirements
122
+ - **A2A integration** -- Agent Card discovery, extension negotiation, task lifecycle management, protocol bindings
123
+ - **Operations and reliability** -- circuit breaker, health checks, graceful shutdown, budget enforcement, token estimation
124
+ - **MCP adapter** -- wrap LAFS envelopes for Model Context Protocol tool responses
125
+ - **Problem Details** -- RFC 9457 Problem Details generation from LAFS errors
129
126
 
130
127
  ## A2A Integration
131
128
 
@@ -150,7 +147,7 @@ import {
150
147
  } from "@cleocode/lafs/a2a";
151
148
  ```
152
149
 
153
- **Agent Card with LAFS extension** — use `autoIncludeLafsExtension` in discovery config:
150
+ **Agent Card with LAFS extension** -- use `autoIncludeLafsExtension` in discovery config:
154
151
 
155
152
  ```typescript
156
153
  import { discoveryMiddleware } from "@cleocode/lafs/discovery";
@@ -167,6 +164,19 @@ app.use(discoveryMiddleware({
167
164
  import { getErrorCodeMapping } from "@cleocode/lafs/a2a/bindings";
168
165
  ```
169
166
 
167
+ ## CLI
168
+
169
+ ```bash
170
+ # Run conformance checks on a fixture
171
+ pnpm run conformance -- --envelope fixtures/valid-success-envelope.json
172
+
173
+ # Run tests
174
+ pnpm test
175
+
176
+ # Type check
177
+ pnpm run typecheck
178
+ ```
179
+
170
180
  ## Conformance checks
171
181
 
172
182
  | Check | Description | Tier |
@@ -187,48 +197,67 @@ lafs.md # Protocol specification
187
197
  schemas/v1/
188
198
  envelope.schema.json # Envelope schema (Draft-07)
189
199
  context-ledger.schema.json # Context ledger schema
190
- error-registry.json # Error code registry
200
+ discovery.schema.json # Agent Card discovery schema
201
+ conformance-profiles.json # Conformance tier definitions
202
+ agent-card.schema.json # Agent Card schema
203
+ error-registry.json # Error code registry (13 codes)
191
204
  src/
192
- types.ts # TypeScript types (discriminated unions)
193
- validateEnvelope.ts # Ajv-based schema validator
194
- conformance.ts # Conformance runner (8 checks)
195
- errorRegistry.ts # Error code helpers
196
- flagSemantics.ts # Format flag resolution
205
+ index.ts # Barrel export (all public API)
206
+ types.ts # Core types (LAFSEnvelope, LAFSError, etc.)
207
+ envelope.ts # createEnvelope(), parseLafsResponse(), LafsError
208
+ validateEnvelope.ts # Schema validator (native Rust via napi-rs, AJV fallback)
209
+ conformance.ts # Conformance runner (runEnvelopeConformance)
210
+ conformanceProfiles.ts # Tier-based conformance profile definitions
211
+ compliance.ts # Compliance pipeline utilities
212
+ errorRegistry.ts # Error code helpers (getRegistryCode, isRegisteredErrorCode)
213
+ flagSemantics.ts # Format flag resolution (--json / --human)
214
+ flagResolver.ts # Flag resolution with config precedence
215
+ fieldExtraction.ts # _fields / _expand parameter extraction
216
+ mviProjection.ts # MVI disclosure level projection
217
+ tokenEstimator.ts # Token budget estimation
218
+ budgetEnforcement.ts # Token budget enforcement
219
+ problemDetails.ts # RFC 9457 Problem Details from LAFS errors
220
+ deprecationRegistry.ts # Deprecation tracking and warnings
221
+ native-loader.ts # Lazy native Rust validator loader
197
222
  discovery.ts # A2A Agent Card discovery middleware
198
- cli.ts # CLI diagnostic tool
223
+ cli.ts # CLI diagnostic tool (lafs-conformance)
224
+ health/index.ts # Health check endpoint
225
+ circuit-breaker/index.ts # Circuit breaker pattern
226
+ shutdown/index.ts # Graceful shutdown handler
199
227
  a2a/
228
+ index.ts # A2A barrel export
200
229
  bridge.ts # A2A SDK integration & result wrapper
201
230
  extensions.ts # Extension negotiation & LAFS extension builder
202
231
  task-lifecycle.ts # Task state machine & lifecycle management
232
+ streaming.ts # SSE/streaming task event support
203
233
  bindings/
234
+ index.ts # Barrel export & cross-binding error mapping
204
235
  jsonrpc.ts # JSON-RPC 2.0 method/error constants & builders
205
236
  http.ts # HTTP endpoints, RFC 9457 Problem Details
206
237
  grpc.ts # gRPC status codes & service definitions (types only)
207
- index.ts # Barrel export & cross-binding error mapping
208
- tests/ # Tests (vitest)
209
- fixtures/ # JSON test fixtures
210
- docs/
211
- POSITIONING.md # MCP/A2A complementary positioning
212
- VISION.md # Project vision and primary persona
213
- CONFORMANCE.md # Conformance checks and adoption tiers
214
- migrations/
215
- v0.3.0-to-v0.4.0.md # Envelope rationalization migration
216
- v0.4.0-to-v0.5.0.md # Pagination & MVI schema migration
217
- CONTRIBUTING.md # Contributor guidelines, RFC process
238
+ tests/ # 20 test suites (vitest)
239
+ fixtures/ # 25 JSON fixtures (valid + invalid + agent workflows)
240
+ docs/ # Guides, architecture, SDK reference
241
+ CONTRIBUTING.md # Contributor guidelines
218
242
  ```
219
243
 
220
244
  ## Version history
221
245
 
222
- | Version | Phase | Description |
223
- |---------|-------|-------------|
224
- | **v1.2.3** | **4** | **A2A v1.0+ compliance: extension negotiation, task lifecycle, protocol bindings (JSON-RPC/HTTP/gRPC)** |
225
- | v1.0.0 | 3 | Production release: Token budgets, agent discovery, MCP integration, complete SDKs |
226
- | v0.5.0 | 2B | Conditional pagination, MVI field selection/expansion, context ledger schema |
227
- | v0.4.0 | 2A | Optional page/error, extensions, strict/lenient mode, warnings |
228
- | v0.3.0 | 1 | Strategic positioning, vision alignment, adoption tiers |
229
- | v0.2.0 | 0 | Protocol cleanup, fixtures, governance, security considerations |
230
- | v0.1.1 | — | Initial npm publish |
231
- | v0.1.0 | — | Bootstrap |
246
+ | Version | Description |
247
+ |---------|-------------|
248
+ | **2026.4.0** | CalVer adoption. Operations and reliability modules (circuit breaker, health, shutdown, budget enforcement). MCP adapter. Problem Details (RFC 9457). Streaming support. |
249
+ | 1.8.0 | Error envelopes MAY include non-null `result` for actionable data alongside error metadata. |
250
+ | 1.5.0 | Agent workflows fixtures. Deprecation registry. Field extraction. MVI projection. |
251
+ | 1.2.3 | A2A v1.0+ compliance: extension negotiation, task lifecycle, protocol bindings (JSON-RPC/HTTP/gRPC). |
252
+ | 1.0.0 | Production release: token budgets, agent discovery, MCP integration. |
253
+ | 0.5.0 | Conditional pagination, MVI field selection/expansion, context ledger schema. |
254
+ | 0.4.0 | Optional page/error, extensions, strict/lenient mode, warnings. |
255
+ | 0.3.0 | Strategic positioning, vision alignment, adoption tiers. |
256
+ | 0.1.0 | Initial release. |
257
+
258
+ ## Repository
259
+
260
+ This package lives at [`packages/lafs`](https://github.com/kryptobaseddev/cleo/tree/main/packages/lafs) in the [kryptobaseddev/cleo](https://github.com/kryptobaseddev/cleo) monorepo.
232
261
 
233
262
  ## License
234
263
 
@@ -0,0 +1,230 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://lafs.dev/schemas/v1/agent-card.schema.json",
4
+ "title": "A2A Agent Card v1.0",
5
+ "description": "A2A-compliant Agent Card schema for agent discovery. Reference: specs/external/specification.md",
6
+ "type": "object",
7
+ "required": [
8
+ "name",
9
+ "description",
10
+ "version",
11
+ "url",
12
+ "capabilities",
13
+ "defaultInputModes",
14
+ "defaultOutputModes",
15
+ "skills"
16
+ ],
17
+ "properties": {
18
+ "$schema": {
19
+ "type": "string",
20
+ "format": "uri",
21
+ "description": "JSON Schema URL"
22
+ },
23
+ "name": {
24
+ "type": "string",
25
+ "minLength": 1,
26
+ "maxLength": 128,
27
+ "description": "Human-readable agent name"
28
+ },
29
+ "description": {
30
+ "type": "string",
31
+ "minLength": 1,
32
+ "maxLength": 2048,
33
+ "description": "Detailed description of agent capabilities"
34
+ },
35
+ "version": {
36
+ "type": "string",
37
+ "pattern": "^\\d+\\.\\d+\\.\\d+$",
38
+ "description": "Agent version (SemVer)"
39
+ },
40
+ "url": {
41
+ "type": "string",
42
+ "format": "uri",
43
+ "description": "Base URL for A2A endpoints"
44
+ },
45
+ "provider": {
46
+ "type": "object",
47
+ "required": ["organization", "url"],
48
+ "properties": {
49
+ "organization": {
50
+ "type": "string",
51
+ "minLength": 1,
52
+ "description": "Organization name"
53
+ },
54
+ "url": {
55
+ "type": "string",
56
+ "format": "uri",
57
+ "description": "Organization URL"
58
+ }
59
+ }
60
+ },
61
+ "capabilities": {
62
+ "type": "object",
63
+ "required": [],
64
+ "properties": {
65
+ "streaming": {
66
+ "type": "boolean",
67
+ "description": "Supports streaming responses"
68
+ },
69
+ "pushNotifications": {
70
+ "type": "boolean",
71
+ "description": "Supports push notifications"
72
+ },
73
+ "extendedAgentCard": {
74
+ "type": "boolean",
75
+ "description": "Supports extended agent card"
76
+ },
77
+ "extensions": {
78
+ "type": "array",
79
+ "description": "Supported extensions",
80
+ "items": {
81
+ "type": "object",
82
+ "required": ["uri", "description", "required"],
83
+ "properties": {
84
+ "uri": {
85
+ "type": "string",
86
+ "format": "uri",
87
+ "description": "Extension URI (unique identifier)"
88
+ },
89
+ "description": {
90
+ "type": "string",
91
+ "description": "Human-readable description"
92
+ },
93
+ "required": {
94
+ "type": "boolean",
95
+ "description": "Whether the extension is required"
96
+ },
97
+ "params": {
98
+ "type": "object",
99
+ "description": "Extension-specific parameters"
100
+ }
101
+ }
102
+ }
103
+ }
104
+ }
105
+ },
106
+ "defaultInputModes": {
107
+ "type": "array",
108
+ "minItems": 1,
109
+ "description": "Supported input content types",
110
+ "items": {
111
+ "type": "string",
112
+ "description": "MIME type"
113
+ }
114
+ },
115
+ "defaultOutputModes": {
116
+ "type": "array",
117
+ "minItems": 1,
118
+ "description": "Supported output content types",
119
+ "items": {
120
+ "type": "string",
121
+ "description": "MIME type"
122
+ }
123
+ },
124
+ "skills": {
125
+ "type": "array",
126
+ "minItems": 1,
127
+ "description": "Agent skills/capabilities",
128
+ "items": {
129
+ "type": "object",
130
+ "required": ["id", "name", "description", "tags"],
131
+ "properties": {
132
+ "id": {
133
+ "type": "string",
134
+ "minLength": 1,
135
+ "description": "Skill unique identifier"
136
+ },
137
+ "name": {
138
+ "type": "string",
139
+ "minLength": 1,
140
+ "description": "Human-readable name"
141
+ },
142
+ "description": {
143
+ "type": "string",
144
+ "minLength": 1,
145
+ "description": "Detailed description"
146
+ },
147
+ "tags": {
148
+ "type": "array",
149
+ "minItems": 1,
150
+ "description": "Keywords/tags",
151
+ "items": {
152
+ "type": "string"
153
+ }
154
+ },
155
+ "examples": {
156
+ "type": "array",
157
+ "description": "Example prompts",
158
+ "items": {
159
+ "type": "string"
160
+ }
161
+ },
162
+ "inputModes": {
163
+ "type": "array",
164
+ "description": "Supported input modes (overrides agent defaults)",
165
+ "items": {
166
+ "type": "string"
167
+ }
168
+ },
169
+ "outputModes": {
170
+ "type": "array",
171
+ "description": "Supported output modes (overrides agent defaults)",
172
+ "items": {
173
+ "type": "string"
174
+ }
175
+ }
176
+ }
177
+ }
178
+ },
179
+ "securitySchemes": {
180
+ "type": "object",
181
+ "description": "Security authentication schemes (OpenAPI 3.0 style)",
182
+ "additionalProperties": {
183
+ "type": "object",
184
+ "required": ["type"],
185
+ "properties": {
186
+ "type": {
187
+ "type": "string",
188
+ "enum": ["http", "apiKey", "oauth2", "openIdConnect"],
189
+ "description": "Security scheme type"
190
+ },
191
+ "description": {
192
+ "type": "string",
193
+ "description": "Description"
194
+ },
195
+ "scheme": {
196
+ "type": "string",
197
+ "description": "HTTP scheme (e.g., bearer)"
198
+ },
199
+ "bearerFormat": {
200
+ "type": "string",
201
+ "description": "Bearer token format (e.g., JWT)"
202
+ }
203
+ }
204
+ }
205
+ },
206
+ "security": {
207
+ "type": "array",
208
+ "description": "Required security schemes",
209
+ "items": {
210
+ "type": "object",
211
+ "additionalProperties": {
212
+ "type": "array",
213
+ "items": {
214
+ "type": "string"
215
+ }
216
+ }
217
+ }
218
+ },
219
+ "documentationUrl": {
220
+ "type": "string",
221
+ "format": "uri",
222
+ "description": "Documentation URL"
223
+ },
224
+ "iconUrl": {
225
+ "type": "string",
226
+ "format": "uri",
227
+ "description": "Icon URL"
228
+ }
229
+ }
230
+ }
File without changes
@@ -0,0 +1,70 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://lafs.dev/schemas/v1/context-ledger.schema.json",
4
+ "title": "LAFS Context Ledger",
5
+ "description": "Tracks state across request/response cycles for context preservation",
6
+ "type": "object",
7
+ "required": ["ledgerId", "version", "createdAt", "updatedAt", "entries", "checksum", "maxEntries"],
8
+ "properties": {
9
+ "ledgerId": {
10
+ "type": "string",
11
+ "description": "Unique identifier for this context ledger instance"
12
+ },
13
+ "version": {
14
+ "type": "integer",
15
+ "minimum": 0,
16
+ "description": "Monotonically increasing version number matching _meta.contextVersion"
17
+ },
18
+ "createdAt": {
19
+ "type": "string",
20
+ "format": "date-time",
21
+ "description": "ISO 8601 timestamp when the ledger was created"
22
+ },
23
+ "updatedAt": {
24
+ "type": "string",
25
+ "format": "date-time",
26
+ "description": "ISO 8601 timestamp of the last ledger update"
27
+ },
28
+ "entries": {
29
+ "type": "array",
30
+ "items": {
31
+ "type": "object",
32
+ "required": ["entryId", "timestamp", "operation", "contextDelta"],
33
+ "properties": {
34
+ "entryId": {
35
+ "type": "string",
36
+ "description": "Unique identifier for this ledger entry"
37
+ },
38
+ "timestamp": {
39
+ "type": "string",
40
+ "format": "date-time"
41
+ },
42
+ "operation": {
43
+ "type": "string",
44
+ "description": "The operation that generated this entry"
45
+ },
46
+ "contextDelta": {
47
+ "type": "object",
48
+ "description": "The context changes introduced by this operation",
49
+ "additionalProperties": true
50
+ },
51
+ "requestId": {
52
+ "type": "string",
53
+ "description": "Correlation with the request that produced this entry"
54
+ }
55
+ }
56
+ },
57
+ "description": "Ordered array of context entries (append-only)"
58
+ },
59
+ "checksum": {
60
+ "type": "string",
61
+ "description": "Integrity checksum of the ledger contents"
62
+ },
63
+ "maxEntries": {
64
+ "type": "integer",
65
+ "minimum": 1,
66
+ "description": "Maximum number of entries before truncation/compaction"
67
+ }
68
+ },
69
+ "additionalProperties": false
70
+ }