@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
@@ -0,0 +1,132 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://lafs.dev/schemas/v1/discovery.schema.json",
4
+ "title": "LAFS Discovery Document",
5
+ "description": "Schema for LAFS agent discovery documents served at /.well-known/lafs.json",
6
+ "type": "object",
7
+ "required": [
8
+ "$schema",
9
+ "lafs_version",
10
+ "service",
11
+ "capabilities",
12
+ "endpoints"
13
+ ],
14
+ "properties": {
15
+ "$schema": {
16
+ "type": "string",
17
+ "format": "uri",
18
+ "description": "URL of the schema this document conforms to"
19
+ },
20
+ "lafs_version": {
21
+ "type": "string",
22
+ "pattern": "^\\d+\\.\\d+\\.\\d+$",
23
+ "description": "LAFS protocol version (semantic versioning)"
24
+ },
25
+ "service": {
26
+ "type": "object",
27
+ "description": "Service identification and metadata",
28
+ "required": [
29
+ "name",
30
+ "version"
31
+ ],
32
+ "properties": {
33
+ "name": {
34
+ "type": "string",
35
+ "minLength": 1,
36
+ "maxLength": 100,
37
+ "description": "Unique service name (kebab-case recommended)"
38
+ },
39
+ "version": {
40
+ "type": "string",
41
+ "pattern": "^\\d+\\.\\d+\\.\\d+$",
42
+ "description": "Service version (semantic versioning)"
43
+ },
44
+ "description": {
45
+ "type": "string",
46
+ "maxLength": 500,
47
+ "description": "Human-readable service description"
48
+ }
49
+ },
50
+ "additionalProperties": false
51
+ },
52
+ "capabilities": {
53
+ "type": "array",
54
+ "description": "List of LAFS capabilities this service provides",
55
+ "minItems": 1,
56
+ "items": {
57
+ "type": "object",
58
+ "required": [
59
+ "name",
60
+ "version",
61
+ "operations"
62
+ ],
63
+ "properties": {
64
+ "name": {
65
+ "type": "string",
66
+ "minLength": 1,
67
+ "maxLength": 100,
68
+ "description": "Capability identifier (kebab-case recommended)"
69
+ },
70
+ "version": {
71
+ "type": "string",
72
+ "pattern": "^\\d+\\.\\d+\\.\\d+$",
73
+ "description": "Capability version (semantic versioning)"
74
+ },
75
+ "description": {
76
+ "type": "string",
77
+ "maxLength": 500,
78
+ "description": "Human-readable capability description"
79
+ },
80
+ "operations": {
81
+ "type": "array",
82
+ "description": "List of operations this capability supports",
83
+ "minItems": 1,
84
+ "items": {
85
+ "type": "string",
86
+ "minLength": 1,
87
+ "maxLength": 50
88
+ }
89
+ },
90
+ "optional": {
91
+ "type": "boolean",
92
+ "default": false,
93
+ "description": "Whether this capability is optional for clients"
94
+ }
95
+ },
96
+ "additionalProperties": false
97
+ }
98
+ },
99
+ "endpoints": {
100
+ "type": "object",
101
+ "description": "URL endpoints for LAFS operations",
102
+ "required": [
103
+ "envelope",
104
+ "discovery"
105
+ ],
106
+ "properties": {
107
+ "envelope": {
108
+ "type": "string",
109
+ "minLength": 1,
110
+ "description": "URL for envelope submission (POST)"
111
+ },
112
+ "context": {
113
+ "type": "string",
114
+ "minLength": 1,
115
+ "description": "URL for context ledger operations"
116
+ },
117
+ "discovery": {
118
+ "type": "string",
119
+ "minLength": 1,
120
+ "description": "URL of this discovery document"
121
+ }
122
+ },
123
+ "additionalProperties": false
124
+ },
125
+ "extensions": {
126
+ "type": "object",
127
+ "description": "Extension fields for vendor-specific metadata",
128
+ "additionalProperties": true
129
+ }
130
+ },
131
+ "additionalProperties": false
132
+ }
File without changes
File without changes
@@ -8,60 +8,167 @@
8
8
  * Reference: A2A spec Section 10.3-10.6
9
9
  */
10
10
  import type { A2AErrorType } from './jsonrpc.js';
11
- /** Standard gRPC status codes (numeric values 0-16) */
11
+ /**
12
+ * Standard gRPC status codes (numeric values 0-16).
13
+ *
14
+ * @remarks
15
+ * Canonical gRPC status codes as defined in the gRPC specification.
16
+ * Used to map A2A errors to appropriate gRPC status values.
17
+ */
12
18
  export declare const GRPC_STATUS_CODE: {
19
+ /** Not an error; returned on success */
13
20
  readonly OK: 0;
21
+ /** The operation was cancelled by the caller */
14
22
  readonly CANCELLED: 1;
23
+ /** Unknown error */
15
24
  readonly UNKNOWN: 2;
25
+ /** Client specified an invalid argument */
16
26
  readonly INVALID_ARGUMENT: 3;
27
+ /** Deadline expired before operation could complete */
17
28
  readonly DEADLINE_EXCEEDED: 4;
29
+ /** Requested entity was not found */
18
30
  readonly NOT_FOUND: 5;
31
+ /** Entity already exists */
19
32
  readonly ALREADY_EXISTS: 6;
33
+ /** Caller does not have permission */
20
34
  readonly PERMISSION_DENIED: 7;
35
+ /** Resource has been exhausted (e.g. quota) */
21
36
  readonly RESOURCE_EXHAUSTED: 8;
37
+ /** Operation rejected because the system is not in a required state */
22
38
  readonly FAILED_PRECONDITION: 9;
39
+ /** The operation was aborted (e.g. concurrency conflict) */
23
40
  readonly ABORTED: 10;
41
+ /** Operation was attempted past the valid range */
24
42
  readonly OUT_OF_RANGE: 11;
43
+ /** Operation is not implemented or not supported */
25
44
  readonly UNIMPLEMENTED: 12;
45
+ /** Internal error */
26
46
  readonly INTERNAL: 13;
47
+ /** The service is currently unavailable */
27
48
  readonly UNAVAILABLE: 14;
49
+ /** Unrecoverable data loss or corruption */
28
50
  readonly DATA_LOSS: 15;
51
+ /** The request does not have valid authentication credentials */
29
52
  readonly UNAUTHENTICATED: 16;
30
53
  };
54
+ /** Numeric gRPC status code value (0-16) */
31
55
  export type GrpcStatusCode = (typeof GRPC_STATUS_CODE)[keyof typeof GRPC_STATUS_CODE];
56
+ /** String name of a gRPC status code (e.g. `"OK"`, `"NOT_FOUND"`) */
32
57
  export type GrpcStatusName = keyof typeof GRPC_STATUS_CODE;
33
- /** Maps A2A error types to gRPC status names */
58
+ /**
59
+ * Maps A2A error types to gRPC status names.
60
+ *
61
+ * @remarks
62
+ * Used to determine the appropriate gRPC status code for each A2A error
63
+ * type per spec Section 5.4.
64
+ */
34
65
  export declare const A2A_GRPC_STATUS_CODES: Record<A2AErrorType, GrpcStatusName>;
35
- /** UPPER_SNAKE_CASE error reasons without "Error" suffix */
66
+ /**
67
+ * UPPER_SNAKE_CASE error reasons without "Error" suffix.
68
+ *
69
+ * @remarks
70
+ * Used as the `reason` field in gRPC `google.rpc.ErrorInfo` details
71
+ * per spec Section 10.6.
72
+ */
36
73
  export declare const A2A_GRPC_ERROR_REASONS: Record<A2AErrorType, string>;
37
- /** Error domain for A2A gRPC errors */
74
+ /**
75
+ * Error domain for A2A gRPC errors.
76
+ *
77
+ * @remarks
78
+ * Used as the `domain` field in `google.rpc.ErrorInfo` to identify
79
+ * the error source as the A2A protocol.
80
+ */
38
81
  export declare const A2A_GRPC_ERROR_DOMAIN: "a2a-protocol.org";
39
- /** gRPC service method descriptor */
82
+ /**
83
+ * Descriptor for a single gRPC service method.
84
+ *
85
+ * @remarks
86
+ * Describes the Protobuf request/response message types and whether
87
+ * the method uses server-side streaming.
88
+ */
40
89
  export interface GrpcServiceMethod {
90
+ /** Protobuf request message type name */
41
91
  request: string;
92
+ /** Protobuf response message type name */
42
93
  response: string;
94
+ /** Whether the method uses server-side streaming */
43
95
  streaming: boolean;
44
96
  }
45
- /** gRPC service method definitions for the A2A protocol */
97
+ /**
98
+ * gRPC service method definitions for the A2A protocol.
99
+ *
100
+ * @remarks
101
+ * Enumerates all RPC methods in the A2A gRPC service with their Protobuf
102
+ * message types and streaming mode per spec Section 10.3.
103
+ */
46
104
  export declare const GRPC_SERVICE_METHODS: Record<string, GrpcServiceMethod>;
47
- /** gRPC metadata key for A2A protocol version */
105
+ /**
106
+ * gRPC metadata key for A2A protocol version.
107
+ *
108
+ * @remarks
109
+ * Sent as gRPC metadata to declare the A2A protocol version in use.
110
+ */
48
111
  export declare const GRPC_METADATA_VERSION_KEY: "a2a-version";
49
- /** gRPC metadata key for activated A2A extensions */
112
+ /**
113
+ * gRPC metadata key for activated A2A extensions.
114
+ *
115
+ * @remarks
116
+ * Sent as gRPC metadata to declare which A2A extensions are active on the connection.
117
+ */
50
118
  export declare const GRPC_METADATA_EXTENSIONS_KEY: "a2a-extensions";
51
- /** gRPC Status object for A2A errors */
119
+ /**
120
+ * gRPC Status object for A2A errors.
121
+ *
122
+ * @remarks
123
+ * Models the gRPC `Status` message with an optional `details` array
124
+ * containing `google.rpc.ErrorInfo` entries for rich error context.
125
+ */
52
126
  export interface GrpcStatus {
127
+ /** Numeric gRPC status code */
53
128
  code: GrpcStatusCode;
129
+ /** Human-readable error message */
54
130
  message: string;
131
+ /**
132
+ * Structured error details (typically `google.rpc.ErrorInfo` entries).
133
+ * @defaultValue undefined
134
+ */
55
135
  details?: GrpcErrorInfo[];
56
136
  }
57
- /** google.rpc.ErrorInfo equivalent */
137
+ /**
138
+ * Equivalent of `google.rpc.ErrorInfo` for structured gRPC error details.
139
+ *
140
+ * @remarks
141
+ * Provides machine-readable error context including a reason code,
142
+ * error domain, and optional key-value metadata.
143
+ */
58
144
  export interface GrpcErrorInfo {
145
+ /** UPPER_SNAKE_CASE reason string identifying the error */
59
146
  reason: string;
147
+ /** Error domain (e.g. `"a2a-protocol.org"`) */
60
148
  domain: string;
149
+ /**
150
+ * Additional key-value metadata for the error.
151
+ * @defaultValue undefined
152
+ */
61
153
  metadata?: Record<string, string>;
62
154
  }
63
155
  /**
64
156
  * Create a gRPC Status object for an A2A error type.
65
- * Includes ErrorInfo details with reason and domain.
157
+ *
158
+ * @remarks
159
+ * Resolves the gRPC status code from the A2A error type mapping and
160
+ * attaches an `ErrorInfo` detail entry with the error reason and domain.
161
+ *
162
+ * @param errorType - The A2A error type name (e.g. `"TaskNotFound"`)
163
+ * @param message - Human-readable error message
164
+ * @param metadata - Optional key-value metadata to include in the ErrorInfo detail
165
+ * @returns A fully formed {@link GrpcStatus} object with ErrorInfo details
166
+ *
167
+ * @example
168
+ * ```ts
169
+ * const status = createGrpcStatus('TaskNotFound', 'No task with id xyz');
170
+ * // { code: 5, message: '...', details: [{ reason: 'TASK_NOT_FOUND', domain: 'a2a-protocol.org' }] }
171
+ * ```
66
172
  */
67
173
  export declare function createGrpcStatus(errorType: A2AErrorType, message: string, metadata?: Record<string, string>): GrpcStatus;
174
+ //# sourceMappingURL=grpc.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grpc.d.ts","sourceRoot":"","sources":["../../../../src/a2a/bindings/grpc.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAMjD;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB;IAC3B,wCAAwC;;IAExC,gDAAgD;;IAEhD,oBAAoB;;IAEpB,2CAA2C;;IAE3C,uDAAuD;;IAEvD,qCAAqC;;IAErC,4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;GAMG;AACH,MAAM,WAAW,aAAa;IAC5B,2DAA2D;IAC3D,MAAM,EAAE,MAAM,CAAC;IACf,+CAA+C;IAC/C,MAAM,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACnC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,YAAY,EACvB,OAAO,EAAE,MAAM,EACf,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAChC,UAAU,CAeZ"}
@@ -10,30 +10,59 @@
10
10
  // ============================================================================
11
11
  // gRPC Status Codes (standard)
12
12
  // ============================================================================
13
- /** Standard gRPC status codes (numeric values 0-16) */
13
+ /**
14
+ * Standard gRPC status codes (numeric values 0-16).
15
+ *
16
+ * @remarks
17
+ * Canonical gRPC status codes as defined in the gRPC specification.
18
+ * Used to map A2A errors to appropriate gRPC status values.
19
+ */
14
20
  export const GRPC_STATUS_CODE = {
21
+ /** Not an error; returned on success */
15
22
  OK: 0,
23
+ /** The operation was cancelled by the caller */
16
24
  CANCELLED: 1,
25
+ /** Unknown error */
17
26
  UNKNOWN: 2,
27
+ /** Client specified an invalid argument */
18
28
  INVALID_ARGUMENT: 3,
29
+ /** Deadline expired before operation could complete */
19
30
  DEADLINE_EXCEEDED: 4,
31
+ /** Requested entity was not found */
20
32
  NOT_FOUND: 5,
33
+ /** Entity already exists */
21
34
  ALREADY_EXISTS: 6,
35
+ /** Caller does not have permission */
22
36
  PERMISSION_DENIED: 7,
37
+ /** Resource has been exhausted (e.g. quota) */
23
38
  RESOURCE_EXHAUSTED: 8,
39
+ /** Operation rejected because the system is not in a required state */
24
40
  FAILED_PRECONDITION: 9,
41
+ /** The operation was aborted (e.g. concurrency conflict) */
25
42
  ABORTED: 10,
43
+ /** Operation was attempted past the valid range */
26
44
  OUT_OF_RANGE: 11,
45
+ /** Operation is not implemented or not supported */
27
46
  UNIMPLEMENTED: 12,
47
+ /** Internal error */
28
48
  INTERNAL: 13,
49
+ /** The service is currently unavailable */
29
50
  UNAVAILABLE: 14,
51
+ /** Unrecoverable data loss or corruption */
30
52
  DATA_LOSS: 15,
53
+ /** The request does not have valid authentication credentials */
31
54
  UNAUTHENTICATED: 16,
32
55
  };
33
56
  // ============================================================================
34
57
  // A2A gRPC Status Mapping (spec Section 5.4)
35
58
  // ============================================================================
36
- /** Maps A2A error types to gRPC status names */
59
+ /**
60
+ * Maps A2A error types to gRPC status names.
61
+ *
62
+ * @remarks
63
+ * Used to determine the appropriate gRPC status code for each A2A error
64
+ * type per spec Section 5.4.
65
+ */
37
66
  export const A2A_GRPC_STATUS_CODES = {
38
67
  TaskNotFound: 'NOT_FOUND',
39
68
  TaskNotCancelable: 'FAILED_PRECONDITION',
@@ -48,7 +77,13 @@ export const A2A_GRPC_STATUS_CODES = {
48
77
  // ============================================================================
49
78
  // Error Reasons (spec Section 10.6)
50
79
  // ============================================================================
51
- /** UPPER_SNAKE_CASE error reasons without "Error" suffix */
80
+ /**
81
+ * UPPER_SNAKE_CASE error reasons without "Error" suffix.
82
+ *
83
+ * @remarks
84
+ * Used as the `reason` field in gRPC `google.rpc.ErrorInfo` details
85
+ * per spec Section 10.6.
86
+ */
52
87
  export const A2A_GRPC_ERROR_REASONS = {
53
88
  TaskNotFound: 'TASK_NOT_FOUND',
54
89
  TaskNotCancelable: 'TASK_NOT_CANCELABLE',
@@ -60,9 +95,21 @@ export const A2A_GRPC_ERROR_REASONS = {
60
95
  ExtensionSupportRequired: 'EXTENSION_SUPPORT_REQUIRED',
61
96
  VersionNotSupported: 'VERSION_NOT_SUPPORTED',
62
97
  };
63
- /** Error domain for A2A gRPC errors */
98
+ /**
99
+ * Error domain for A2A gRPC errors.
100
+ *
101
+ * @remarks
102
+ * Used as the `domain` field in `google.rpc.ErrorInfo` to identify
103
+ * the error source as the A2A protocol.
104
+ */
64
105
  export const A2A_GRPC_ERROR_DOMAIN = 'a2a-protocol.org';
65
- /** gRPC service method definitions for the A2A protocol */
106
+ /**
107
+ * gRPC service method definitions for the A2A protocol.
108
+ *
109
+ * @remarks
110
+ * Enumerates all RPC methods in the A2A gRPC service with their Protobuf
111
+ * message types and streaming mode per spec Section 10.3.
112
+ */
66
113
  export const GRPC_SERVICE_METHODS = {
67
114
  SendMessage: {
68
115
  request: 'MessageSendParams',
@@ -123,13 +170,37 @@ export const GRPC_SERVICE_METHODS = {
123
170
  // ============================================================================
124
171
  // gRPC Metadata Constants
125
172
  // ============================================================================
126
- /** gRPC metadata key for A2A protocol version */
173
+ /**
174
+ * gRPC metadata key for A2A protocol version.
175
+ *
176
+ * @remarks
177
+ * Sent as gRPC metadata to declare the A2A protocol version in use.
178
+ */
127
179
  export const GRPC_METADATA_VERSION_KEY = 'a2a-version';
128
- /** gRPC metadata key for activated A2A extensions */
180
+ /**
181
+ * gRPC metadata key for activated A2A extensions.
182
+ *
183
+ * @remarks
184
+ * Sent as gRPC metadata to declare which A2A extensions are active on the connection.
185
+ */
129
186
  export const GRPC_METADATA_EXTENSIONS_KEY = 'a2a-extensions';
130
187
  /**
131
188
  * Create a gRPC Status object for an A2A error type.
132
- * Includes ErrorInfo details with reason and domain.
189
+ *
190
+ * @remarks
191
+ * Resolves the gRPC status code from the A2A error type mapping and
192
+ * attaches an `ErrorInfo` detail entry with the error reason and domain.
193
+ *
194
+ * @param errorType - The A2A error type name (e.g. `"TaskNotFound"`)
195
+ * @param message - Human-readable error message
196
+ * @param metadata - Optional key-value metadata to include in the ErrorInfo detail
197
+ * @returns A fully formed {@link GrpcStatus} object with ErrorInfo details
198
+ *
199
+ * @example
200
+ * ```ts
201
+ * const status = createGrpcStatus('TaskNotFound', 'No task with id xyz');
202
+ * // { code: 5, message: '...', details: [{ reason: 'TASK_NOT_FOUND', domain: 'a2a-protocol.org' }] }
203
+ * ```
133
204
  */
134
205
  export function createGrpcStatus(errorType, message, metadata) {
135
206
  const statusName = A2A_GRPC_STATUS_CODES[errorType];
@@ -146,3 +217,4 @@ export function createGrpcStatus(errorType, message, metadata) {
146
217
  ],
147
218
  };
148
219
  }
220
+ //# sourceMappingURL=grpc.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grpc.js","sourceRoot":"","sources":["../../../../src/a2a/bindings/grpc.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,+EAA+E;AAC/E,+BAA+B;AAC/B,+EAA+E;AAE/E;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,wCAAwC;IACxC,EAAE,EAAE,CAAC;IACL,gDAAgD;IAChD,SAAS,EAAE,CAAC;IACZ,oBAAoB;IACpB,OAAO,EAAE,CAAC;IACV,2CAA2C;IAC3C,gBAAgB,EAAE,CAAC;IACnB,uDAAuD;IACvD,iBAAiB,EAAE,CAAC;IACpB,qCAAqC;IACrC,SAAS,EAAE,CAAC;IACZ,4BAA4B;IAC5B,cAAc,EAAE,CAAC;IACjB,sCAAsC;IACtC,iBAAiB,EAAE,CAAC;IACpB,+CAA+C;IAC/C,kBAAkB,EAAE,CAAC;IACrB,uEAAuE;IACvE,mBAAmB,EAAE,CAAC;IACtB,4DAA4D;IAC5D,OAAO,EAAE,EAAE;IACX,mDAAmD;IACnD,YAAY,EAAE,EAAE;IAChB,oDAAoD;IACpD,aAAa,EAAE,EAAE;IACjB,qBAAqB;IACrB,QAAQ,EAAE,EAAE;IACZ,2CAA2C;IAC3C,WAAW,EAAE,EAAE;IACf,4CAA4C;IAC5C,SAAS,EAAE,EAAE;IACb,iEAAiE;IACjE,eAAe,EAAE,EAAE;CACX,CAAC;AAOX,+EAA+E;AAC/E,6CAA6C;AAC7C,+EAA+E;AAE/E;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAyC;IACzE,YAAY,EAAE,WAAW;IACzB,iBAAiB,EAAE,qBAAqB;IACxC,4BAA4B,EAAE,eAAe;IAC7C,oBAAoB,EAAE,eA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