@fungi.computer/agar 0.0.0-stage → 0.0.1

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 (159) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +766 -2
  3. package/dist/agent-message-meta.d.ts +74 -0
  4. package/dist/agent-message-meta.js +63 -0
  5. package/dist/agents.d.ts +170 -0
  6. package/dist/agents.js +218 -0
  7. package/dist/app-build-contract.d.ts +43 -0
  8. package/dist/app-build-contract.js +24 -0
  9. package/dist/apps.d.ts +66 -0
  10. package/dist/apps.js +47 -0
  11. package/dist/backend-declaration.d.ts +6 -0
  12. package/dist/backend-declaration.js +65 -0
  13. package/dist/backend-definition.d.ts +88 -0
  14. package/dist/backend-definition.js +158 -0
  15. package/dist/backend-refusal.d.ts +10 -0
  16. package/dist/backend-refusal.js +10 -0
  17. package/dist/backend.d.ts +30 -0
  18. package/dist/backend.js +28 -0
  19. package/dist/capabilities.d.ts +30 -0
  20. package/dist/capabilities.js +50 -0
  21. package/dist/channels.d.ts +142 -0
  22. package/dist/channels.js +97 -0
  23. package/dist/commands.d.ts +33 -0
  24. package/dist/commands.js +46 -0
  25. package/dist/computer-contracts.d.ts +73 -0
  26. package/dist/computer-contracts.js +57 -0
  27. package/dist/computer.d.ts +294 -0
  28. package/dist/computer.js +319 -0
  29. package/dist/connect.d.ts +11 -0
  30. package/dist/connect.js +211 -0
  31. package/dist/errors.d.ts +34 -0
  32. package/dist/errors.js +106 -0
  33. package/dist/failure.d.ts +2 -0
  34. package/dist/failure.js +9 -0
  35. package/dist/files.d.ts +25 -0
  36. package/dist/files.js +84 -0
  37. package/dist/game-servers.d.ts +530 -0
  38. package/dist/game-servers.js +244 -0
  39. package/dist/gills.d.ts +43 -0
  40. package/dist/gills.js +174 -0
  41. package/dist/git-commit.d.ts +143 -0
  42. package/dist/git-commit.js +251 -0
  43. package/dist/git-rpc.d.ts +310 -0
  44. package/dist/git-rpc.js +166 -0
  45. package/dist/git-steps.d.ts +579 -0
  46. package/dist/git-steps.js +804 -0
  47. package/dist/git-wire.d.ts +33 -0
  48. package/dist/git-wire.js +240 -0
  49. package/dist/git.d.ts +322 -0
  50. package/dist/git.js +98 -0
  51. package/dist/host.d.ts +97 -0
  52. package/dist/host.js +732 -0
  53. package/dist/inbox.d.ts +99 -0
  54. package/dist/inbox.js +184 -0
  55. package/dist/index.d.ts +31 -0
  56. package/dist/index.js +15 -0
  57. package/dist/inference.d.ts +17 -0
  58. package/dist/inference.js +115 -0
  59. package/dist/internal/app-error.d.ts +8 -0
  60. package/dist/internal/app-error.js +36 -0
  61. package/dist/internal/app-session.d.ts +8 -0
  62. package/dist/internal/app-session.js +551 -0
  63. package/dist/internal/back-inputs.d.ts +22 -0
  64. package/dist/internal/back-inputs.js +93 -0
  65. package/dist/internal/browser-bridge.d.ts +30 -0
  66. package/dist/internal/browser-bridge.js +203 -0
  67. package/dist/internal/capabilities.d.ts +13 -0
  68. package/dist/internal/capabilities.js +138 -0
  69. package/dist/internal/commands.d.ts +9 -0
  70. package/dist/internal/commands.js +257 -0
  71. package/dist/internal/disconnect-host.d.ts +7 -0
  72. package/dist/internal/disconnect-host.js +19 -0
  73. package/dist/internal/git-edit-tree.d.ts +6 -0
  74. package/dist/internal/git-edit-tree.js +46 -0
  75. package/dist/internal/memory-fs.d.ts +39 -0
  76. package/dist/internal/memory-fs.js +154 -0
  77. package/dist/internal/protocol.d.ts +116 -0
  78. package/dist/internal/protocol.js +6 -0
  79. package/dist/internal/query-feed.d.ts +23 -0
  80. package/dist/internal/query-feed.js +111 -0
  81. package/dist/internal/result.d.ts +22 -0
  82. package/dist/internal/result.js +61 -0
  83. package/dist/internal/rpc-contract.d.ts +24 -0
  84. package/dist/internal/rpc-contract.js +78 -0
  85. package/dist/internal/schemas.d.ts +307 -0
  86. package/dist/internal/schemas.js +524 -0
  87. package/dist/internal/store.d.ts +8 -0
  88. package/dist/internal/store.js +30 -0
  89. package/dist/internal/terminal-gate.d.ts +17 -0
  90. package/dist/internal/terminal-gate.js +94 -0
  91. package/dist/lifecycle.d.ts +44 -0
  92. package/dist/lifecycle.js +1 -0
  93. package/dist/marketplace.d.ts +159 -0
  94. package/dist/marketplace.js +102 -0
  95. package/dist/media-json.d.ts +181 -0
  96. package/dist/media-json.js +204 -0
  97. package/dist/media-library.d.ts +11 -0
  98. package/dist/media-library.js +15 -0
  99. package/dist/media-request-id.d.ts +7 -0
  100. package/dist/media-request-id.js +16 -0
  101. package/dist/media.d.ts +354 -0
  102. package/dist/media.js +654 -0
  103. package/dist/method-refusal.d.ts +64 -0
  104. package/dist/method-refusal.js +48 -0
  105. package/dist/pending.d.ts +10 -0
  106. package/dist/pending.js +10 -0
  107. package/dist/query.d.ts +76 -0
  108. package/dist/query.js +195 -0
  109. package/dist/react-mount.d.ts +23 -0
  110. package/dist/react-mount.js +108 -0
  111. package/dist/react.d.ts +41 -0
  112. package/dist/react.js +111 -0
  113. package/dist/read-copy.d.ts +103 -0
  114. package/dist/read-copy.js +195 -0
  115. package/dist/roles/files.d.ts +295 -0
  116. package/dist/roles/files.js +184 -0
  117. package/dist/root.d.ts +21 -0
  118. package/dist/root.js +1 -0
  119. package/dist/rpc.d.ts +1 -0
  120. package/dist/rpc.js +1 -0
  121. package/dist/status.d.ts +17 -0
  122. package/dist/status.js +50 -0
  123. package/dist/storage-wire.d.ts +167 -0
  124. package/dist/storage-wire.js +115 -0
  125. package/dist/storage.d.ts +72 -0
  126. package/dist/storage.js +143 -0
  127. package/dist/store.d.ts +11 -0
  128. package/dist/store.js +1 -0
  129. package/dist/test-kit/git.d.ts +31 -0
  130. package/dist/test-kit/git.js +174 -0
  131. package/dist/ui.d.ts +169 -0
  132. package/dist/ui.js +10 -0
  133. package/dist/window.d.ts +41 -0
  134. package/dist/window.js +15 -0
  135. package/dist/world.d.ts +16 -0
  136. package/dist/world.js +17 -0
  137. package/docs/api/README.md +28 -0
  138. package/docs/api/app-build-contract.md +113 -0
  139. package/docs/api/backend-declaration.md +62 -0
  140. package/docs/api/backend-definition.md +215 -0
  141. package/docs/api/backend.md +269 -0
  142. package/docs/api/errors.md +169 -0
  143. package/docs/api/files.md +91 -0
  144. package/docs/api/gills.md +164 -0
  145. package/docs/api/git-commit.md +279 -0
  146. package/docs/api/git-rpc.md +243 -0
  147. package/docs/api/git-steps.md +1010 -0
  148. package/docs/api/git-wire.md +197 -0
  149. package/docs/api/git.md +579 -0
  150. package/docs/api/index.md +2880 -0
  151. package/docs/api/media-json.md +507 -0
  152. package/docs/api/media-request-id.md +32 -0
  153. package/docs/api/modules.md +32 -0
  154. package/docs/api/query.md +253 -0
  155. package/docs/api/react.md +216 -0
  156. package/docs/api/read-copy.md +204 -0
  157. package/docs/api/rpc.md +128 -0
  158. package/docs/api/storage.md +620 -0
  159. package/package.json +197 -3
@@ -0,0 +1,215 @@
1
+ <!-- Generated by Botanical API docs (TypeDoc + typedoc-plugin-markdown). Do not edit. -->
2
+
3
+ [**@fungi.computer/agar**](README.md)
4
+
5
+ ---
6
+
7
+ [@fungi.computer/agar](modules.md) / backend-definition
8
+
9
+ # backend-definition
10
+
11
+ ## Type Aliases
12
+
13
+ ### AppSendBudgetRefusal
14
+
15
+ ```ts
16
+ type AppSendBudgetRefusal = z.output<typeof appSendBudgetRefusalSchema>;
17
+ ```
18
+
19
+ A declined Session send, with how long to wait before retrying.
20
+
21
+ ---
22
+
23
+ ### MethodPolicy
24
+
25
+ ```ts
26
+ type MethodPolicy = Readonly<{
27
+ description: string;
28
+ effect: "read" | "write" | "external";
29
+ requires: readonly AppCapabilityId[];
30
+ hidden?: true;
31
+ anonymous?: true;
32
+ pending?: true;
33
+ }>;
34
+ ```
35
+
36
+ A method's schemas own both its TypeScript contract and JSON boundary.
37
+
38
+ ---
39
+
40
+ ### AppBackendMethod
41
+
42
+ ```ts
43
+ type AppBackendMethod<Context> = Readonly<{
44
+ policy: MethodPolicy;
45
+ input: z.ZodType;
46
+ output: z.ZodType;
47
+ call: (input, context, caller) => Promise<WhistleJsonValue>;
48
+ }>;
49
+ ```
50
+
51
+ Prepared method export consumed by the backend and its build.
52
+
53
+ #### Type Parameters
54
+
55
+ | Type Parameter | Default type |
56
+ | -------------- | ------------ |
57
+ | `Context` | `void` |
58
+
59
+ ---
60
+
61
+ ### AppBackendClass
62
+
63
+ ```ts
64
+ type AppBackendClass = (...args) => object & object;
65
+ ```
66
+
67
+ Typed backend export shared by a build and its runtime method admission.
68
+
69
+ #### Type Declaration
70
+
71
+ | Name | Type |
72
+ | ----------- | -------- |
73
+ | `prototype` | `object` |
74
+
75
+ ---
76
+
77
+ ### AppBackendDefinition
78
+
79
+ ```ts
80
+ type AppBackendDefinition<Context> = Readonly<{
81
+ methods: Readonly<Record<string, AppBackendMethod<Context>>>;
82
+ sync?: Readonly<{
83
+ method: string;
84
+ }>;
85
+ gills?: readonly AppBackendGill[];
86
+ gill: (input, context, caller) => Promise<GillReply>;
87
+ toolFamily?: AppApi["toolFamily"];
88
+ events?: Readonly<
89
+ Record<
90
+ string,
91
+ Readonly<{
92
+ description: string;
93
+ payload: z.ZodType;
94
+ }>
95
+ >
96
+ >;
97
+ implement: <C>(implementation) => C;
98
+ call: (method, input, context, caller) => Promise<WhistleJsonValue>;
99
+ }>;
100
+ ```
101
+
102
+ A backend's full generated API: its declared methods, the facet installer, and
103
+ runtime dispatch by method name.
104
+
105
+ #### Type Parameters
106
+
107
+ | Type Parameter | Default type |
108
+ | -------------- | ------------ |
109
+ | `Context` | `void` |
110
+
111
+ ## Variables
112
+
113
+ ### appEventEmitResultSchema
114
+
115
+ ```ts
116
+ const appEventEmitResultSchema: ZodUndefined;
117
+ ```
118
+
119
+ EVENTS.emit acknowledges delivery with native void, not a JSON value.
120
+
121
+ ---
122
+
123
+ ### appSendBudgetRefusalSchema
124
+
125
+ ```ts
126
+ const appSendBudgetRefusalSchema: ZodObject<
127
+ {
128
+ error: ZodLiteral<"send_budget_exceeded">;
129
+ retryAfterMs: ZodNumber;
130
+ },
131
+ $strict
132
+ >;
133
+ ```
134
+
135
+ App-originated Session send refusal; retry advice is a duration, not a
136
+ timestamp.
137
+
138
+ ## Functions
139
+
140
+ ### defineAppMethod()
141
+
142
+ ```ts
143
+ function defineAppMethod<I, O, Context>(method): AppBackendMethod<Context>;
144
+ ```
145
+
146
+ Define a typed method once; neither discovery nor builds execute its handler.
147
+
148
+ #### Type Parameters
149
+
150
+ | Type Parameter | Default type |
151
+ | -------------------------------------------------------------------------------------------- | ------------ |
152
+ | `I` _extends_ `ZodType`\<`unknown`, `unknown`, `$ZodTypeInternals`\<`unknown`, `unknown`\>\> | - |
153
+ | `O` _extends_ `ZodType`\<`unknown`, `unknown`, `$ZodTypeInternals`\<`unknown`, `unknown`\>\> | - |
154
+ | `Context` | `void` |
155
+
156
+ #### Parameters
157
+
158
+ | Parameter | Type |
159
+ | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
160
+ | `method` | `Readonly`\<\{ `description`: `string`; `effect`: `"external"` \| `"read"` \| `"write"`; `requires`: readonly ( \| `"agent.list"` \| `"agent.manage"` \| `"agent.read"` \| `"agent.send"` \| `"computer.list"` \| `"computer.readFile"` \| `"computer.writeFile"` \| `"computer.execute"` \| `"agent.rename"` \| `"agent.toolPolicy"` \| `"apps.open"` \| `"apps.call"` \| `"llm.generation"` \| `"media.generation"` \| `"games:servers"` \| `"git.repository"` \| `"app.storage"` \| `"app.events.emit"` \| `"team.workbenchHost"` \| `"marketplace.browse"` \| `"marketplace.purchase"` \| `"workflow.run"` \| `"workflow.publish"` \| `"workflow.arm"` \| `"world"` \| `"channels.read"` \| `"channels.personal.manage"`)[]; `hidden?`: `true`; `anonymous?`: `true`; `pending?`: `true`; \}\> & \{ input: I; output: O; \} & (\{ pending: true; handler: (input: output\<I\>, context: Context, caller: \{ computerId: string \| null; actor: \{ kind: "member"; memberId: string; \} \| \{ ...; \} \| \{ ...; \}; ... 5 more ...; idempotencyKey?: string \| undefined; \}) =\> Readonly\<...\> \| ... 1 more ... \| Promise\<...\>; \} \| \{ ...; \}) |
161
+
162
+ #### Returns
163
+
164
+ [`AppBackendMethod`](#appbackendmethod)\<`Context`\>
165
+
166
+ ---
167
+
168
+ ### defineAppBackend()
169
+
170
+ ```ts
171
+ function defineAppBackend<Context>(options): AppBackendDefinition<Context>;
172
+ ```
173
+
174
+ Generate the API from the method exports; callers cannot supply a second
175
+ catalog.
176
+
177
+ #### Type Parameters
178
+
179
+ | Type Parameter | Default type |
180
+ | -------------- | ------------ |
181
+ | `Context` | `void` |
182
+
183
+ #### Parameters
184
+
185
+ | Parameter | Type |
186
+ | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
187
+ | `options` | `Readonly`\<\{ `methods`: `Readonly`\<`Record`\<`string`, [`AppBackendMethod`](#appbackendmethod)\<`Context`\>\>\>; `events?`: [`AppBackendDefinition`](#appbackenddefinition)\<`Context`\>\[`"events"`\]; `gills?`: readonly [`AppBackendGill`](gills.md#appbackendgill)[]; `sync?`: [`AppBackendDefinition`](#appbackenddefinition)\<`Context`\>\[`"sync"`\]; `toolFamily?`: [`AppBackendDefinition`](#appbackenddefinition)\<`Context`\>\[`"toolFamily"`\]; \}\> |
188
+
189
+ #### Returns
190
+
191
+ [`AppBackendDefinition`](#appbackenddefinition)\<`Context`\>
192
+
193
+ ## References
194
+
195
+ ### AppBackendGill
196
+
197
+ Re-exports [AppBackendGill](gills.md#appbackendgill)
198
+
199
+ ---
200
+
201
+ ### pending
202
+
203
+ Re-exports [pending](index.md#pending-1)
204
+
205
+ ---
206
+
207
+ ### pendingSchema
208
+
209
+ Re-exports [pendingSchema](index.md#pendingschema)
210
+
211
+ ---
212
+
213
+ ### Pending
214
+
215
+ Re-exports [Pending](index.md#pending)
@@ -0,0 +1,269 @@
1
+ <!-- Generated by Botanical API docs (TypeDoc + typedoc-plugin-markdown). Do not edit. -->
2
+
3
+ [**@fungi.computer/agar**](README.md)
4
+
5
+ ---
6
+
7
+ [@fungi.computer/agar](modules.md) / backend
8
+
9
+ # backend
10
+
11
+ ## Classes
12
+
13
+ ### AppMethodRefusal
14
+
15
+ An App method's declared domain refusal. A handler throws it to decline a call;
16
+ the generated method boundary returns it as a typed
17
+ [AppMethodReply](#appmethodreply) instead of an execution failure. Its message
18
+ is caller-facing App copy, so it must not carry private data.
19
+
20
+ #### Extends
21
+
22
+ - `Error`
23
+
24
+ #### Constructors
25
+
26
+ ##### Constructor
27
+
28
+ ```ts
29
+ new AppMethodRefusal(code, message): AppMethodRefusal;
30
+ ```
31
+
32
+ ###### Parameters
33
+
34
+ | Parameter | Type |
35
+ | --------- | -------------------------------------------------------------------------------- |
36
+ | `code` | `"unavailable"` \| `"invalid"` \| `"conflict"` \| `"forbidden"` \| `"not_found"` |
37
+ | `message` | `string` |
38
+
39
+ ###### Returns
40
+
41
+ [`AppMethodRefusal`](#appmethodrefusal)
42
+
43
+ ###### Overrides
44
+
45
+ ```ts
46
+ Error.constructor;
47
+ ```
48
+
49
+ #### Properties
50
+
51
+ ##### code
52
+
53
+ ```ts
54
+ readonly code: "unavailable" | "invalid" | "conflict" | "forbidden" | "not_found";
55
+ ```
56
+
57
+ ## Type Aliases
58
+
59
+ ### AppMethodRefusalCode
60
+
61
+ ```ts
62
+ type AppMethodRefusalCode = (typeof appMethodRefusalCodes)[number];
63
+ ```
64
+
65
+ One of [appMethodRefusalCodes](#appmethodrefusalcodes).
66
+
67
+ ---
68
+
69
+ ### AppMethodRefusedReply
70
+
71
+ ```ts
72
+ type AppMethodRefusedReply = z.output<typeof appMethodRefusedReplySchema>;
73
+ ```
74
+
75
+ A decoded [appMethodRefusedReplySchema](#appmethodrefusedreplyschema) value.
76
+
77
+ ---
78
+
79
+ ### AppMethodReply
80
+
81
+ ```ts
82
+ type AppMethodReply =
83
+ | Readonly<{
84
+ kind: "ok";
85
+ value: WhistleJsonValue;
86
+ }>
87
+ | AppMethodRefusedReply;
88
+ ```
89
+
90
+ A decoded [appMethodReplySchema](#appmethodreplyschema) value; the result is
91
+ read-only JSON.
92
+
93
+ ## Variables
94
+
95
+ ### appBackendRefusalSchema
96
+
97
+ ```ts
98
+ const appBackendRefusalSchema: ZodObject<
99
+ {
100
+ error: ZodLiteral<"App execution unavailable">;
101
+ reason: ZodEnum<{
102
+ exec_isolation_required: "exec_isolation_required";
103
+ execution_not_admitted: "execution_not_admitted";
104
+ artifact_unavailable: "artifact_unavailable";
105
+ }>;
106
+ },
107
+ $strict
108
+ >;
109
+ ```
110
+
111
+ Closed host refusal vocabulary. Private backend messages never reach callers.
112
+
113
+ ---
114
+
115
+ ### appBackend
116
+
117
+ ```ts
118
+ const appBackend: CapabilityContract<{
119
+ request: Promise<WhistleJsonValue>;
120
+ }>;
121
+ ```
122
+
123
+ Invoke this App's admitted backend. The App defines its JSON request/result.
124
+
125
+ ---
126
+
127
+ ### appMethods
128
+
129
+ ```ts
130
+ const appMethods: CapabilityContract<{
131
+ call: Promise<WhistleJsonValue>;
132
+ }>;
133
+ ```
134
+
135
+ Call one of this App's declared, typed methods through its host. Unlike
136
+ `appBackend`, the host knows which method is called, so it can apply the
137
+ method's declared effect (for example, allow only `read` methods to a visitor of
138
+ a public App).
139
+
140
+ ---
141
+
142
+ ### appBackendActorHeader
143
+
144
+ ```ts
145
+ const appBackendActorHeader: "X-Agar-Actor-Id" = "X-Agar-Actor-Id";
146
+ ```
147
+
148
+ The admitting host overwrites this header from its authenticated principal. App
149
+ request bodies and incoming browser headers never supply this identity.
150
+
151
+ ---
152
+
153
+ ### appBackendComputerHeader
154
+
155
+ ```ts
156
+ const appBackendComputerHeader: "X-Agar-Computer-Id" = "X-Agar-Computer-Id";
157
+ ```
158
+
159
+ The admitting host overwrites this header with the Computer it has verified the
160
+ caller is admitted to use for this invocation, or omits it when no Computer is
161
+ bound to the call. App request bodies and incoming browser headers never supply
162
+ this identity: a backend that needs a Computer scope must read it from here,
163
+ never from its own request body.
164
+
165
+ ---
166
+
167
+ ### appMethodRefusalCodes
168
+
169
+ ```ts
170
+ const appMethodRefusalCodes: readonly [
171
+ "invalid",
172
+ "forbidden",
173
+ "not_found",
174
+ "conflict",
175
+ "unavailable",
176
+ ];
177
+ ```
178
+
179
+ The closed vocabulary an App method may refuse with. Each code names one
180
+ caller-visible outcome; the host owns how it is presented (see
181
+ [appMethodRefusalStatus](#appmethodrefusalstatus)).
182
+
183
+ ---
184
+
185
+ ### appMethodRefusalStatus
186
+
187
+ ```ts
188
+ const appMethodRefusalStatus: object;
189
+ ```
190
+
191
+ HTTP status for each refusal code, shared by every host and App route.
192
+
193
+ #### Type Declaration
194
+
195
+ | Name | Type | Default value |
196
+ | ----------------------------------------------- | ----- | ------------- |
197
+ | <a id="property-invalid"></a> `invalid` | `400` | `400` |
198
+ | <a id="property-forbidden"></a> `forbidden` | `403` | `403` |
199
+ | <a id="property-not_found"></a> `not_found` | `404` | `404` |
200
+ | <a id="property-conflict"></a> `conflict` | `409` | `409` |
201
+ | <a id="property-unavailable"></a> `unavailable` | `503` | `503` |
202
+
203
+ ---
204
+
205
+ ### maxAppMethodRefusalMessage
206
+
207
+ ```ts
208
+ const maxAppMethodRefusalMessage: 500 = 500;
209
+ ```
210
+
211
+ Bound on the App-authored refusal message that reaches callers.
212
+
213
+ ---
214
+
215
+ ### appMethodRefusedReplySchema
216
+
217
+ ```ts
218
+ const appMethodRefusedReplySchema: ZodObject<
219
+ {
220
+ kind: ZodLiteral<"refused">;
221
+ code: ZodEnum<{
222
+ unavailable: "unavailable";
223
+ invalid: "invalid";
224
+ conflict: "conflict";
225
+ forbidden: "forbidden";
226
+ not_found: "not_found";
227
+ }>;
228
+ message: ZodString;
229
+ },
230
+ $strict
231
+ >;
232
+ ```
233
+
234
+ A refused call as it crosses the generated method boundary.
235
+
236
+ ---
237
+
238
+ ### appMethodReplySchema
239
+
240
+ ```ts
241
+ const appMethodReplySchema: ZodDiscriminatedUnion<
242
+ [
243
+ ZodObject<
244
+ {
245
+ kind: ZodLiteral<"ok">;
246
+ value: ZodJSONSchema;
247
+ },
248
+ $strict
249
+ >,
250
+ ZodObject<
251
+ {
252
+ kind: ZodLiteral<"refused">;
253
+ code: ZodEnum<{
254
+ unavailable: "unavailable";
255
+ invalid: "invalid";
256
+ conflict: "conflict";
257
+ forbidden: "forbidden";
258
+ not_found: "not_found";
259
+ }>;
260
+ message: ZodString;
261
+ },
262
+ $strict
263
+ >,
264
+ ],
265
+ "kind"
266
+ >;
267
+ ```
268
+
269
+ Every generated App method RPC answers with exactly one of these.
@@ -0,0 +1,169 @@
1
+ <!-- Generated by Botanical API docs (TypeDoc + typedoc-plugin-markdown). Do not edit. -->
2
+
3
+ [**@fungi.computer/agar**](README.md)
4
+
5
+ ---
6
+
7
+ [@fungi.computer/agar](modules.md) / errors
8
+
9
+ # errors
10
+
11
+ ## Classes
12
+
13
+ ### AppError
14
+
15
+ The SDK's one typed failure. Carries a closed `code` naming the failure kind and
16
+ an explicit `retryable` verdict, instead of leaving callers to guess either from
17
+ the message or exception shape.
18
+
19
+ #### Extends
20
+
21
+ - `Error`
22
+
23
+ #### Constructors
24
+
25
+ ##### Constructor
26
+
27
+ ```ts
28
+ new AppError(message, options): AppError;
29
+ ```
30
+
31
+ ###### Parameters
32
+
33
+ | Parameter | Type |
34
+ | --------- | ------------------------------------- |
35
+ | `message` | `string` |
36
+ | `options` | [`AppErrorOptions`](#apperroroptions) |
37
+
38
+ ###### Returns
39
+
40
+ [`AppError`](#apperror)
41
+
42
+ ###### Overrides
43
+
44
+ ```ts
45
+ Error.constructor;
46
+ ```
47
+
48
+ #### Properties
49
+
50
+ ##### code
51
+
52
+ ```ts
53
+ readonly code: AppErrorCode;
54
+ ```
55
+
56
+ ##### retryable
57
+
58
+ ```ts
59
+ readonly retryable: boolean;
60
+ ```
61
+
62
+ ## Type Aliases
63
+
64
+ ### AppErrorCode
65
+
66
+ ```ts
67
+ type AppErrorCode =
68
+ | "CANCELLED"
69
+ | "CAPABILITY_DENIED"
70
+ | "CAPABILITY_REVOKED"
71
+ | "COMMAND_NOT_DECLARED"
72
+ | "CONFLICT"
73
+ | "DISCONNECTED"
74
+ | "FILE_TOO_LARGE"
75
+ | "HOST_FAILURE"
76
+ | "IDENTITY"
77
+ | "INSUFFICIENT_CREDIT"
78
+ | "INVALID_ARGUMENT"
79
+ | "PROTOCOL"
80
+ | "SAFETY_FILTER_REFUSED"
81
+ | "SELECTION_CHANGED"
82
+ | "TIMEOUT";
83
+ ```
84
+
85
+ The closed set of reasons an AppError can state; every SDK and host-reported
86
+ failure is tagged with exactly one of these codes.
87
+
88
+ ---
89
+
90
+ ### AppErrorOptions
91
+
92
+ ```ts
93
+ type AppErrorOptions = object;
94
+ ```
95
+
96
+ Required construction options for an AppError.
97
+
98
+ #### Properties
99
+
100
+ ##### cause?
101
+
102
+ ```ts
103
+ readonly optional cause?: unknown;
104
+ ```
105
+
106
+ ##### code
107
+
108
+ ```ts
109
+ readonly code: AppErrorCode;
110
+ ```
111
+
112
+ ##### retryable
113
+
114
+ ```ts
115
+ readonly retryable: boolean;
116
+ ```
117
+
118
+ Every error states retry truth explicitly; absence is not a verdict.
119
+
120
+ ---
121
+
122
+ ### ErrorCopy
123
+
124
+ ```ts
125
+ type ErrorCopy = Readonly<{
126
+ title: string;
127
+ message: string;
128
+ }>;
129
+ ```
130
+
131
+ Trusted presentation copy; overrides never change recovery or retry policy.
132
+
133
+ ---
134
+
135
+ ### ErrorDescription
136
+
137
+ ```ts
138
+ type ErrorDescription = ErrorCopy &
139
+ Readonly<{
140
+ retryable: boolean;
141
+ action?: "grant" | "retry" | "reconnect" | "billing";
142
+ }>;
143
+ ```
144
+
145
+ Recovery hints are for the caller's UI, never an instruction to retry
146
+ automatically.
147
+
148
+ ## Functions
149
+
150
+ ### describeAppError()
151
+
152
+ ```ts
153
+ function describeAppError(cause, overrides?): ErrorDescription;
154
+ ```
155
+
156
+ Describe an SDK-decoded failure without exposing exception or request data. The
157
+ error owner retains retry truth. Grant and reconnect hints describe
158
+ prerequisites, so they can accompany a non-retryable operation.
159
+
160
+ #### Parameters
161
+
162
+ | Parameter | Type |
163
+ | ------------ | --------------------------------------------------------------------------------------------------------------------- |
164
+ | `cause` | `unknown` |
165
+ | `overrides?` | `Partial`\<`Record`\<[`AppErrorCode`](#apperrorcode), `Readonly`\<\{ `title`: `string`; `message`: `string`; \}\>\>\> |
166
+
167
+ #### Returns
168
+
169
+ [`ErrorDescription`](#errordescription)