@fungi.computer/agar 0.0.1 → 0.2.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.
Files changed (56) hide show
  1. package/dist/agent-message-meta.d.ts +15 -15
  2. package/dist/agent-message-meta.js +5 -5
  3. package/dist/agents.d.ts +86 -13
  4. package/dist/agents.js +48 -25
  5. package/dist/apps.js +4 -4
  6. package/dist/backend-definition.d.ts +41 -4
  7. package/dist/backend-definition.js +70 -10
  8. package/dist/backend.js +4 -4
  9. package/dist/channels.js +4 -4
  10. package/dist/computer-contracts.d.ts +15 -15
  11. package/dist/computer-contracts.js +14 -14
  12. package/dist/computer.js +16 -16
  13. package/dist/game-servers.js +2 -2
  14. package/dist/git-rpc.d.ts +23 -23
  15. package/dist/git-rpc.js +14 -16
  16. package/dist/git.d.ts +9 -9
  17. package/dist/git.js +8 -8
  18. package/dist/host.d.ts +3 -1
  19. package/dist/host.js +5 -1
  20. package/dist/index.d.ts +5 -4
  21. package/dist/index.js +3 -2
  22. package/dist/inference.js +2 -1
  23. package/dist/internal/app-session.js +37 -1
  24. package/dist/internal/protocol.d.ts +4 -4
  25. package/dist/internal/schemas.d.ts +33 -7
  26. package/dist/internal/schemas.js +107 -16
  27. package/dist/marketplace.js +7 -5
  28. package/dist/media-request-id.d.ts +1 -1
  29. package/dist/media-request-id.js +2 -2
  30. package/dist/media.js +2 -2
  31. package/dist/method-presentation.d.ts +7 -0
  32. package/dist/method-presentation.js +14 -0
  33. package/dist/method-refusal.d.ts +5 -5
  34. package/dist/method-refusal.js +4 -4
  35. package/dist/react.d.ts +14 -2
  36. package/dist/react.js +40 -4
  37. package/dist/read-copy.d.ts +1 -1
  38. package/dist/read-copy.js +3 -6
  39. package/dist/storage-wire.d.ts +2 -2
  40. package/dist/storage-wire.js +2 -2
  41. package/dist/storage.js +1 -1
  42. package/dist/test-kit/git.js +19 -2
  43. package/dist/window.d.ts +64 -0
  44. package/dist/window.js +31 -0
  45. package/docs/api/backend-definition.md +83 -9
  46. package/docs/api/backend.md +44 -38
  47. package/docs/api/git-rpc.md +35 -35
  48. package/docs/api/git-wire.md +3 -0
  49. package/docs/api/git.md +66 -80
  50. package/docs/api/index.md +775 -128
  51. package/docs/api/media-request-id.md +1 -1
  52. package/docs/api/method-presentation.md +21 -0
  53. package/docs/api/modules.md +1 -0
  54. package/docs/api/react.md +10 -4
  55. package/docs/api/storage.md +3 -3
  56. package/package.json +10 -8
@@ -52,7 +52,7 @@ export declare function countingGit(binding: GitBinding, options: {
52
52
  delete(name: string): Promise<boolean>;
53
53
  log(name: string, options: {
54
54
  ref: string;
55
- limit?: number;
55
+ limit? /** Bind a namespace to its maintained App decoder. */: number;
56
56
  offset?: number;
57
57
  }): Promise<import("./git.js").GitCommit[]>;
58
58
  readCommit(name: string, hash: string): Promise<import("./git.js").GitCommit | null>;
package/dist/read-copy.js CHANGED
@@ -44,18 +44,15 @@ export function countingGit(binding, options) {
44
44
  /** Dispatch counts by maintained Git operation. */ counts: () => Object.fromEntries(counts),
45
45
  };
46
46
  }
47
- const rowSchema = z.strictObject({
47
+ const rowSchema = z.lazy(() => z.strictObject({
48
48
  head: gitSha1Schema.nullable(),
49
49
  version: z.number().int(),
50
50
  revision: z.number().int(),
51
51
  value: z.string().nullable(),
52
- });
52
+ }));
53
53
  const name = z.string().min(1).max(1024);
54
54
  const zero = "0".repeat(40);
55
- const blobHash = z.union([
56
- gitSha1Schema,
57
- z.string().regex(/^sha256:[0-9a-f]{64}$/),
58
- ]);
55
+ const blobHash = z.lazy(() => z.union([gitSha1Schema, z.string().regex(/^sha256:[0-9a-f]{64}$/)]));
59
56
  /** Own bounded rows and content-addressed bytes in the App facet, not a host/provider cache. */
60
57
  export function createReadCopies(sql, limits) {
61
58
  z.strictObject({
@@ -44,7 +44,7 @@ export declare const resolvedAppStorageSchema: Schema.Struct<{
44
44
  export type ResolvedAppStorage = typeof resolvedAppStorageSchema.Type;
45
45
  /**
46
46
  * Validates a write request: the key, scope, value to store, and the
47
- * revision it's conditioned on (`null` to write unconditionally).
47
+ * expected revision of that layer (`null` requires the layer to be absent).
48
48
  */
49
49
  export declare const appStorageWriteSchema: Schema.Struct<{
50
50
  readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
@@ -54,7 +54,7 @@ export declare const appStorageWriteSchema: Schema.Struct<{
54
54
  }>;
55
55
  /**
56
56
  * Validates a reset request: the key, scope, and the revision it's
57
- * conditioned on (`null` to reset unconditionally).
57
+ * conditioned on (`null` requires the layer to be absent).
58
58
  */
59
59
  export declare const appStorageResetSchema: Schema.Struct<{
60
60
  key: Schema.String;
@@ -51,7 +51,7 @@ const mutation = {
51
51
  };
52
52
  /**
53
53
  * Validates a write request: the key, scope, value to store, and the
54
- * revision it's conditioned on (`null` to write unconditionally).
54
+ * expected revision of that layer (`null` requires the layer to be absent).
55
55
  */
56
56
  export const appStorageWriteSchema = Schema.Struct({
57
57
  ...mutation,
@@ -59,7 +59,7 @@ export const appStorageWriteSchema = Schema.Struct({
59
59
  });
60
60
  /**
61
61
  * Validates a reset request: the key, scope, and the revision it's
62
- * conditioned on (`null` to reset unconditionally).
62
+ * conditioned on (`null` requires the layer to be absent).
63
63
  */
64
64
  export const appStorageResetSchema = Schema.Struct(mutation);
65
65
  /** Validates a bare revision number returned after a write or reset. */
package/dist/storage.js CHANGED
@@ -140,4 +140,4 @@ function client(raw) {
140
140
  };
141
141
  }
142
142
  /** This App's own declared data. The host seals App and member identities. */
143
- export const appStorage = defineCapability("app.storage", 1, rawSchema.transform(client));
143
+ export const appStorage = defineCapability("app.storage", 1, z.lazy(() => rawSchema.transform(client)));
@@ -1,6 +1,6 @@
1
1
  import { pathToFileURL } from "node:url";
2
2
  import { execFileSync, spawnSync } from "node:child_process";
3
- import { existsSync, mkdtempSync, rmSync } from "node:fs";
3
+ import { existsSync, mkdtempSync, rmSync, statSync } from "node:fs";
4
4
  import { tmpdir } from "node:os";
5
5
  import { join } from "node:path";
6
6
  import * as z from "zod";
@@ -13,7 +13,21 @@ export function realGit() {
13
13
  const info = (name) => existsSync(join(root, `${name}.git`))
14
14
  ? { name, defaultBranch: "main", lastPushAt: null, source: null }
15
15
  : null;
16
+ // A full object id names an immutable commit, so one read serves every
17
+ // later ask; refs and abbreviations move and are never cached.
18
+ const commits = new Map();
19
+ const immutable = (hash) => /^[0-9a-f]{40,64}$/u.test(hash);
16
20
  const readCommit = (name, hash) => {
21
+ // The repository's directory identity keeps a deleted-and-recreated name
22
+ // from serving the old repository's commits, however it was removed.
23
+ const dir = statSync(join(root, `${name}.git`), {
24
+ bigint: true,
25
+ throwIfNoEntry: false,
26
+ });
27
+ const key = `${name}\0${String(dir?.ino)}\0${String(dir?.birthtimeNs)}\0${hash}`;
28
+ const cached = immutable(hash) ? commits.get(key) : undefined;
29
+ if (cached !== undefined)
30
+ return structuredClone(cached);
17
31
  const found = spawnSync("git", [`--git-dir=${join(root, `${name}.git`)}`, "cat-file", "-t", hash], { encoding: "utf8" });
18
32
  if (found.status !== 0 || found.stdout.trim() !== "commit")
19
33
  return null;
@@ -31,7 +45,7 @@ export function realGit() {
31
45
  z.string(),
32
46
  ])
33
47
  .parse(run(name, "show", "-s", "--format=%H%x00%T%x00%P%x00%an%x00%ae%x00%cn%x00%ce%x00%at%x00%ct%x00%B", hash).split("\0"));
34
- return {
48
+ const commit = {
35
49
  hash: oid,
36
50
  treeHash,
37
51
  parents: parents ? parents.split(" ") : [],
@@ -41,6 +55,9 @@ export function realGit() {
41
55
  committedAt: Number(committedAt),
42
56
  message,
43
57
  };
58
+ if (immutable(hash))
59
+ commits.set(key, structuredClone(commit));
60
+ return commit;
44
61
  };
45
62
  const git = {
46
63
  cloneUrl: (name) => {
package/dist/window.d.ts CHANGED
@@ -9,6 +9,54 @@ export type BeforeAppClose = () => boolean | Promise<boolean>;
9
9
  export declare const APP_NAVIGATION_CONTRACT_VERSION: 1;
10
10
  /** The longest page title a host shows beside the App's own name. */
11
11
  export declare const APP_NAVIGATION_TITLE_MAX = 80;
12
+ /** The most crumbs one navigation report may carry. */
13
+ export declare const APP_NAVIGATION_CRUMBS_MAX = 8;
14
+ /** The most siblings one switcher crumb may offer. */
15
+ export declare const APP_NAVIGATION_SIBLINGS_MAX = 16;
16
+ /** The most primary header commands one report may carry. */
17
+ export declare const APP_NAVIGATION_PRIMARY_MAX = 3;
18
+ /** The most header status facts one report may carry. */
19
+ export declare const APP_NAVIGATION_STATUS_MAX = 4;
20
+ /** The most ⋯ menu commands one report may carry. */
21
+ export declare const APP_NAVIGATION_MENU_MAX = 12;
22
+ /** The longest crumb or command label a host shows. */
23
+ export declare const APP_NAVIGATION_LABEL_MAX = 80;
24
+ /** One place in the App's path; `siblings` makes it a switcher. */
25
+ export type AppCrumb = Readonly<{
26
+ id: string;
27
+ label: string;
28
+ siblings?: readonly Readonly<{
29
+ id: string;
30
+ label: string;
31
+ }>[];
32
+ }>;
33
+ /** A command the App offers in its window header; the App owns its effect. */
34
+ export type AppHeaderCommand = Readonly<{
35
+ id: string;
36
+ label: string;
37
+ /** The Caps button a primary command wears; default `outline`. */
38
+ variant?: "primary" | "outline" | "ghost";
39
+ /** A menu command that removes or discards something. */
40
+ tone?: "destructive";
41
+ disabled?: boolean;
42
+ }>;
43
+ /** A quiet fact about the view, shown as muted text with a status bead. */
44
+ export type AppHeaderStatus = Readonly<{
45
+ id: string;
46
+ label: string;
47
+ tone?: "neutral" | "info" | "warning" | "success" | "error";
48
+ }>;
49
+ /** The person used a crumb (or a switcher's sibling) or a header command. */
50
+ export type AppNavigationActivation = Readonly<{
51
+ kind: "crumb";
52
+ crumbId: string;
53
+ siblingId?: string;
54
+ }> | Readonly<{
55
+ kind: "action";
56
+ actionId: string;
57
+ }>;
58
+ /** Handles one activation; `true` when the App acted on it. */
59
+ export type AppNavigationActivationHandler = (activation: AppNavigationActivation) => boolean | Promise<boolean>;
12
60
  /**
13
61
  * What the App's own router can do right now. The App owns its history; the
14
62
  * host only offers a Back affordance and relays the person's request.
@@ -17,6 +65,14 @@ export type AppNavigationState = Readonly<{
17
65
  canGoBack: boolean;
18
66
  /** The current page's title, shown after the App name in window chrome. */
19
67
  title?: string;
68
+ /** The App's path; the host shows it in place of the App name and title. */
69
+ crumbs?: readonly AppCrumb[];
70
+ /** The view's main commands, as buttons in the header. */
71
+ primary?: readonly AppHeaderCommand[];
72
+ /** Less common commands, behind the header's overflow menu. */
73
+ menu?: readonly AppHeaderCommand[];
74
+ /** Facts about the view, such as "Valid" or "Saved". Data only. */
75
+ status?: readonly AppHeaderStatus[];
20
76
  }>;
21
77
  /** Go back one step in the App's own history; `true` when it moved. */
22
78
  export type AppBackHandler = () => boolean | Promise<boolean>;
@@ -26,6 +82,8 @@ export type HostNavigation = Readonly<{
26
82
  publish(state: AppNavigationState): Promise<void>;
27
83
  /** Own the host's Back requests; one owner at a time. */
28
84
  onBack(handler: AppBackHandler): Disposer;
85
+ /** Own the host's crumb and command activations; one owner at a time. */
86
+ onActivate(handler: AppNavigationActivationHandler): Disposer;
29
87
  }>;
30
88
  /** App-owned presentation policy consulted before a user closes its window. */
31
89
  export type AppWindow = Readonly<{
@@ -39,3 +97,9 @@ export type AppWindow = Readonly<{
39
97
  * accepts every report and never asks the App to go back.
40
98
  */
41
99
  export declare const inertHostNavigation: HostNavigation;
100
+ /**
101
+ * Whether an activation names something the App published now: a crumb (and
102
+ * its sibling), or an enabled command. Every hop applies this rule against
103
+ * its own latest copy of the report, so a stale shell cannot reach the App.
104
+ */
105
+ export declare function navigationActivationAllowed(state: AppNavigationState, activation: AppNavigationActivation): boolean;
package/dist/window.js CHANGED
@@ -5,6 +5,18 @@
5
5
  export const APP_NAVIGATION_CONTRACT_VERSION = 1;
6
6
  /** The longest page title a host shows beside the App's own name. */
7
7
  export const APP_NAVIGATION_TITLE_MAX = 80;
8
+ /** The most crumbs one navigation report may carry. */
9
+ export const APP_NAVIGATION_CRUMBS_MAX = 8;
10
+ /** The most siblings one switcher crumb may offer. */
11
+ export const APP_NAVIGATION_SIBLINGS_MAX = 16;
12
+ /** The most primary header commands one report may carry. */
13
+ export const APP_NAVIGATION_PRIMARY_MAX = 3;
14
+ /** The most header status facts one report may carry. */
15
+ export const APP_NAVIGATION_STATUS_MAX = 4;
16
+ /** The most ⋯ menu commands one report may carry. */
17
+ export const APP_NAVIGATION_MENU_MAX = 12;
18
+ /** The longest crumb or command label a host shows. */
19
+ export const APP_NAVIGATION_LABEL_MAX = 80;
8
20
  /**
9
21
  * Navigation for a root with no host chrome, such as a workbench fixture: it
10
22
  * accepts every report and never asks the App to go back.
@@ -12,4 +24,23 @@ export const APP_NAVIGATION_TITLE_MAX = 80;
12
24
  export const inertHostNavigation = Object.freeze({
13
25
  publish: () => Promise.resolve(),
14
26
  onBack: () => () => undefined,
27
+ onActivate: () => () => undefined,
15
28
  });
29
+ /**
30
+ * Whether an activation names something the App published now: a crumb (and
31
+ * its sibling), or an enabled command. Every hop applies this rule against
32
+ * its own latest copy of the report, so a stale shell cannot reach the App.
33
+ */
34
+ export function navigationActivationAllowed(state, activation) {
35
+ if (activation.kind === "action") {
36
+ const command = [...(state.primary ?? []), ...(state.menu ?? [])].find((candidate) => candidate.id === activation.actionId);
37
+ return command !== undefined && command.disabled !== true;
38
+ }
39
+ const crumb = state.crumbs?.find((candidate) => candidate.id === activation.crumbId);
40
+ if (crumb === undefined)
41
+ return false;
42
+ if (activation.siblingId === undefined)
43
+ return true;
44
+ return (crumb.siblings?.some((sibling) => sibling.id === activation.siblingId) ===
45
+ true);
46
+ }
@@ -30,6 +30,9 @@ type MethodPolicy = Readonly<{
30
30
  hidden?: true;
31
31
  anonymous?: true;
32
32
  pending?: true;
33
+ present?: Readonly<{
34
+ verb: string;
35
+ }>;
33
36
  }>;
34
37
  ```
35
38
 
@@ -37,6 +40,44 @@ A method's schemas own both its TypeScript contract and JSON boundary.
37
40
 
38
41
  ---
39
42
 
43
+ ### ResultRowCodec
44
+
45
+ ```ts
46
+ type ResultRowCodec = Readonly<{
47
+ decode: (row) => ResultRow;
48
+ schema: z.ZodType;
49
+ }>;
50
+ ```
51
+
52
+ Decodes and bounds result rows; see `resultRows` in
53
+ `@fungi.computer/agar/method-presentation`.
54
+
55
+ ---
56
+
57
+ ### MethodPresentation
58
+
59
+ ```ts
60
+ type MethodPresentation<I, O> = Readonly<{
61
+ verb: string;
62
+ row: (call) => ResultRow;
63
+ rows: ResultRowCodec;
64
+ }>;
65
+ ```
66
+
67
+ How a finished call reads to a person: a pure projection run in the App backend.
68
+ `rows` is `resultRows` from `@fungi.computer/agar/method-presentation`; only a
69
+ backend that presents imports it, so one without presentations carries no row
70
+ decoder.
71
+
72
+ #### Type Parameters
73
+
74
+ | Type Parameter |
75
+ | -------------- |
76
+ | `I` |
77
+ | `O` |
78
+
79
+ ---
80
+
40
81
  ### AppBackendMethod
41
82
 
42
83
  ```ts
@@ -44,6 +85,8 @@ type AppBackendMethod<Context> = Readonly<{
44
85
  policy: MethodPolicy;
45
86
  input: z.ZodType;
46
87
  output: z.ZodType;
88
+ present?: (input, output) => ResultRow;
89
+ presentRow?: z.ZodType;
47
90
  call: (input, context, caller) => Promise<WhistleJsonValue>;
48
91
  }>;
49
92
  ```
@@ -58,6 +101,24 @@ Prepared method export consumed by the backend and its build.
58
101
 
59
102
  ---
60
103
 
104
+ ### AppBackendMethods
105
+
106
+ ```ts
107
+ type AppBackendMethods<Context> = Readonly<
108
+ Record<string, AppBackendMethod<Context>>
109
+ >;
110
+ ```
111
+
112
+ The prepared methods of one backend, keyed by their public names.
113
+
114
+ #### Type Parameters
115
+
116
+ | Type Parameter | Default type |
117
+ | -------------- | ------------ |
118
+ | `Context` | `void` |
119
+
120
+ ---
121
+
61
122
  ### AppBackendClass
62
123
 
63
124
  ```ts
@@ -123,18 +184,31 @@ EVENTS.emit acknowledges delivery with native void, not a JSON value.
123
184
  ### appSendBudgetRefusalSchema
124
185
 
125
186
  ```ts
126
- const appSendBudgetRefusalSchema: ZodObject<
127
- {
128
- error: ZodLiteral<"send_budget_exceeded">;
129
- retryAfterMs: ZodNumber;
130
- },
131
- $strict
187
+ const appSendBudgetRefusalSchema: ZodLazy<
188
+ ZodObject<
189
+ {
190
+ error: ZodLiteral<"send_budget_exceeded">;
191
+ retryAfterMs: ZodNumber;
192
+ },
193
+ $strict
194
+ >
132
195
  >;
133
196
  ```
134
197
 
135
198
  App-originated Session send refusal; retry advice is a duration, not a
136
199
  timestamp.
137
200
 
201
+ ---
202
+
203
+ ### presentMethodName
204
+
205
+ ```ts
206
+ const presentMethodName: "present" = "present";
207
+ ```
208
+
209
+ Name of the generated, hidden read method that projects a finished call into its
210
+ row.
211
+
138
212
  ## Functions
139
213
 
140
214
  ### defineAppMethod()
@@ -155,9 +229,9 @@ Define a typed method once; neither discovery nor builds execute its handler.
155
229
 
156
230
  #### Parameters
157
231
 
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\<...\>; \} \| \{ ...; \}) |
232
+ | Parameter | Type |
233
+ | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
234
+ | `method` | `Omit`\<`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`; `present?`: `Readonly`\<\{ `verb`: `string`; \}\>; \}\>, `"present"`\> & \{ input: I; output: O; present?: Readonly\<\{ verb: string; row: (call: Readonly\<\{ input: output\<I\>; output: output\<O\>; \}\>) =\> \{ readonly id: string; readonly title: string; ... 4 more ...; readonly media?: \{ ...; \} \| undefined; \}; rows: Readonly\<...\>; \}\> \| undefined; \} & (\{ ...; \} \| \{ ...; \}) |
161
235
 
162
236
  #### Returns
163
237
 
@@ -215,19 +215,21 @@ Bound on the App-authored refusal message that reaches callers.
215
215
  ### appMethodRefusedReplySchema
216
216
 
217
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
218
+ const appMethodRefusedReplySchema: ZodLazy<
219
+ ZodObject<
220
+ {
221
+ kind: ZodLiteral<"refused">;
222
+ code: ZodEnum<{
223
+ unavailable: "unavailable";
224
+ invalid: "invalid";
225
+ conflict: "conflict";
226
+ forbidden: "forbidden";
227
+ not_found: "not_found";
228
+ }>;
229
+ message: ZodString;
230
+ },
231
+ $strict
232
+ >
231
233
  >;
232
234
  ```
233
235
 
@@ -238,31 +240,35 @@ A refused call as it crosses the generated method boundary.
238
240
  ### appMethodReplySchema
239
241
 
240
242
  ```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"
243
+ const appMethodReplySchema: ZodLazy<
244
+ ZodDiscriminatedUnion<
245
+ [
246
+ ZodObject<
247
+ {
248
+ kind: ZodLiteral<"ok">;
249
+ value: ZodJSONSchema;
250
+ },
251
+ $strict
252
+ >,
253
+ ZodLazy<
254
+ ZodObject<
255
+ {
256
+ kind: ZodLiteral<"refused">;
257
+ code: ZodEnum<{
258
+ unavailable: "unavailable";
259
+ invalid: "invalid";
260
+ conflict: "conflict";
261
+ forbidden: "forbidden";
262
+ not_found: "not_found";
263
+ }>;
264
+ message: ZodString;
265
+ },
266
+ $strict
267
+ >
268
+ >,
269
+ ],
270
+ "kind"
271
+ >
266
272
  >;
267
273
  ```
268
274
 
@@ -30,41 +30,41 @@ The native tuple and result grammar shared by the handle and frame entrypoint.
30
30
 
31
31
  #### Type Declaration
32
32
 
33
- | Name | Type | Default value |
34
- | --------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- |
35
- | <a id="property-create"></a> `create` | `object` | - |
36
- | `create.args` | `ZodTuple`\<\[`ZodString`, `ZodOptional`\<`ZodObject`\<\{ `description`: `ZodOptional`\<`ZodString`\>; `defaultBranch`: `ZodOptional`\<`ZodString`\>; \}, `$strict`\>\>\], `null`\> | - |
37
- | `create.result` | `ZodObject`\<\{ `name`: `ZodString`; `defaultBranch`: `ZodString`; `lastPushAt`: `ZodNullable`\<`ZodString`\>; `source`: `ZodNullable`\<`ZodString`\>; \}, `$strict`\> | `info` |
38
- | <a id="property-fork"></a> `fork` | `object` | - |
39
- | `fork.args` | `ZodTuple`\<\[`ZodString`, `ZodString`, `ZodOptional`\<`ZodObject`\<\{ `description`: `ZodOptional`\<`ZodString`\>; \}, `$strict`\>\>\], `null`\> | - |
40
- | `fork.result` | `ZodObject`\<\{ `name`: `ZodString`; `defaultBranch`: `ZodString`; `lastPushAt`: `ZodNullable`\<`ZodString`\>; `source`: `ZodNullable`\<`ZodString`\>; \}, `$strict`\> | `info` |
41
- | <a id="property-cloneurl"></a> `cloneUrl` | `object` | - |
42
- | `cloneUrl.args` | `ZodTuple`\<\[`ZodString`\], `null`\> | - |
43
- | `cloneUrl.result` | `ZodURL` | - |
44
- | <a id="property-info"></a> `info` | `object` | - |
45
- | `info.args` | `ZodTuple`\<\[`ZodString`\], `null`\> | - |
46
- | `info.result` | `ZodNullable`\<`ZodObject`\<\{ `name`: `ZodString`; `defaultBranch`: `ZodString`; `lastPushAt`: `ZodNullable`\<`ZodString`\>; `source`: `ZodNullable`\<`ZodString`\>; \}, `$strict`\>\> | - |
47
- | <a id="property-delete"></a> `delete` | `object` | - |
48
- | `delete.args` | `ZodTuple`\<\[`ZodString`\], `null`\> | - |
49
- | `delete.result` | `ZodBoolean` | - |
50
- | <a id="property-log"></a> `log` | `object` | - |
51
- | `log.args` | `ZodTuple`\<\[`ZodString`, `ZodObject`\<\{ `ref`: `ZodString`; `limit`: `ZodOptional`\<`ZodNumber`\>; `offset`: `ZodOptional`\<`ZodNumber`\>; \}, `$strict`\>\], `null`\> | - |
52
- | `log.result` | `ZodArray`\<`ZodObject`\<\{ `hash`: `ZodString`; `treeHash`: `ZodString`; `message`: `ZodString`; `author`: `ZodObject`\<\{ `name`: `ZodString`; `email`: `ZodString`; \}, `$strict`\>; `committer`: `ZodObject`\<\{ `name`: `ZodString`; `email`: `ZodString`; \}, `$strict`\>; `parents`: `ZodArray`\<`ZodString`\>; `authoredAt`: `ZodNumber`; `committedAt`: `ZodNumber`; \}, `$strict`\>\> | - |
53
- | <a id="property-readcommit"></a> `readCommit` | `object` | - |
54
- | `readCommit.args` | `ZodTuple`\<\[`ZodString`, `ZodString`\], `null`\> | - |
55
- | `readCommit.result` | `ZodNullable`\<`ZodObject`\<\{ `hash`: `ZodString`; `treeHash`: `ZodString`; `message`: `ZodString`; `author`: `ZodObject`\<\{ `name`: `ZodString`; `email`: `ZodString`; \}, `$strict`\>; `committer`: `ZodObject`\<\{ `name`: `ZodString`; `email`: `ZodString`; \}, `$strict`\>; `parents`: `ZodArray`\<`ZodString`\>; `authoredAt`: `ZodNumber`; `committedAt`: `ZodNumber`; \}, `$strict`\>\> | - |
56
- | <a id="property-readtree"></a> `readTree` | `object` | - |
57
- | `readTree.args` | `ZodTuple`\<\[`ZodString`, `ZodString`\], `null`\> | - |
58
- | `readTree.result` | `ZodNullable`\<`ZodArray`\<`ZodObject`\<\{ `name`: `ZodString`; `mode`: `ZodString`; `hash`: `ZodString`; `type`: `ZodEnum`\<\{ `blob`: `"blob"`; `tree`: `"tree"`; `commit`: `"commit"`; \}\>; \}, `$strict`\>\>\> | - |
59
- | <a id="property-readblob"></a> `readBlob` | `object` | - |
60
- | `readBlob.args` | `ZodTuple`\<\[`ZodString`, `ZodString`\], `null`\> | - |
61
- | `readBlob.result` | `ZodNullable`\<`ZodCustom`\<`Uint8Array`\<`ArrayBuffer`\>, `Uint8Array`\<`ArrayBuffer`\>\>\> | - |
62
- | <a id="property-refs"></a> `refs` | `object` | - |
63
- | `refs.args` | `ZodTuple`\<\[`ZodString`\], `null`\> | - |
64
- | `refs.result` | `ZodArray`\<`ZodObject`\<\{ `name`: `ZodString`; `hash`: `ZodString`; \}, `$strict`\>\> | - |
65
- | <a id="property-exchange"></a> `exchange` | `object` | - |
66
- | `exchange.args` | `ZodTuple`\<\[`ZodString`, `ZodObject`\<\{ `service`: `ZodEnum`\<\{ `upload-pack`: `"upload-pack"`; `receive-pack`: `"receive-pack"`; \}\>; `phase`: `ZodEnum`\<\{ `advertise`: `"advertise"`; `exchange`: `"exchange"`; \}\>; `body`: `ZodNullable`\<`ZodCustom`\<`Uint8Array`\<`ArrayBuffer`\>, `Uint8Array`\<`ArrayBuffer`\>\>\>; `headers`: `ZodRecord`\<`ZodString`, `ZodString`\>; \}, `$strict`\>\], `null`\> | - |
67
- | `exchange.result` | `ZodObject`\<\{ `status`: `ZodNumber`; `headers`: `ZodRecord`\<`ZodString`, `ZodString`\>; `body`: `ZodCustom`\<`Uint8Array`\<`ArrayBuffer`\>, `Uint8Array`\<`ArrayBuffer`\>\>; \}, `$strict`\> | `response` |
33
+ | Name | Type | Default value |
34
+ | --------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- |
35
+ | <a id="property-create"></a> `create` | `object` | - |
36
+ | `create.args` | `ZodTuple`\<\[`ZodString`, `ZodLazy`\<`ZodOptional`\<`ZodObject`\<\{ `description`: `ZodOptional`\<`ZodString`\>; `defaultBranch`: `ZodOptional`\<`ZodString`\>; \}, `$strict`\>\>\>\], `null`\> | - |
37
+ | `create.result` | `ZodLazy`\<`ZodObject`\<\{ `name`: `ZodString`; `defaultBranch`: `ZodString`; `lastPushAt`: `ZodNullable`\<`ZodString`\>; `source`: `ZodNullable`\<`ZodString`\>; \}, `$strict`\>\> | `info` |
38
+ | <a id="property-fork"></a> `fork` | `object` | - |
39
+ | `fork.args` | `ZodTuple`\<\[`ZodString`, `ZodString`, `ZodLazy`\<`ZodOptional`\<`ZodObject`\<\{ `description`: `ZodOptional`\<`ZodString`\>; \}, `$strict`\>\>\>\], `null`\> | - |
40
+ | `fork.result` | `ZodLazy`\<`ZodObject`\<\{ `name`: `ZodString`; `defaultBranch`: `ZodString`; `lastPushAt`: `ZodNullable`\<`ZodString`\>; `source`: `ZodNullable`\<`ZodString`\>; \}, `$strict`\>\> | `info` |
41
+ | <a id="property-cloneurl"></a> `cloneUrl` | `object` | - |
42
+ | `cloneUrl.args` | `ZodTuple`\<\[`ZodString`\], `null`\> | - |
43
+ | `cloneUrl.result` | `ZodURL` | - |
44
+ | <a id="property-info"></a> `info` | `object` | - |
45
+ | `info.args` | `ZodTuple`\<\[`ZodString`\], `null`\> | - |
46
+ | `info.result` | `ZodNullable`\<`ZodLazy`\<`ZodObject`\<\{ `name`: `ZodString`; `defaultBranch`: `ZodString`; `lastPushAt`: `ZodNullable`\<`ZodString`\>; `source`: `ZodNullable`\<`ZodString`\>; \}, `$strict`\>\>\> | - |
47
+ | <a id="property-delete"></a> `delete` | `object` | - |
48
+ | `delete.args` | `ZodTuple`\<\[`ZodString`\], `null`\> | - |
49
+ | `delete.result` | `ZodBoolean` | - |
50
+ | <a id="property-log"></a> `log` | `object` | - |
51
+ | `log.args` | `ZodTuple`\<\[`ZodString`, `ZodLazy`\<`ZodObject`\<\{ `ref`: `ZodString`; `limit`: `ZodOptional`\<`ZodNumber`\>; `offset`: `ZodOptional`\<`ZodNumber`\>; \}, `$strict`\>\>\], `null`\> | - |
52
+ | `log.result` | `ZodArray`\<`ZodLazy`\<`ZodObject`\<\{ `hash`: `ZodString`; `treeHash`: `ZodString`; `message`: `ZodString`; `author`: `ZodObject`\<\{ `name`: `ZodString`; `email`: `ZodString`; \}, `$strict`\>; `committer`: `ZodObject`\<\{ `name`: `ZodString`; `email`: `ZodString`; \}, `$strict`\>; `parents`: `ZodArray`\<`ZodString`\>; `authoredAt`: `ZodNumber`; `committedAt`: `ZodNumber`; \}, `$strict`\>\>\> | - |
53
+ | <a id="property-readcommit"></a> `readCommit` | `object` | - |
54
+ | `readCommit.args` | `ZodTuple`\<\[`ZodString`, `ZodString`\], `null`\> | - |
55
+ | `readCommit.result` | `ZodNullable`\<`ZodLazy`\<`ZodObject`\<\{ `hash`: `ZodString`; `treeHash`: `ZodString`; `message`: `ZodString`; `author`: `ZodObject`\<\{ `name`: `ZodString`; `email`: `ZodString`; \}, `$strict`\>; `committer`: `ZodObject`\<\{ `name`: `ZodString`; `email`: `ZodString`; \}, `$strict`\>; `parents`: `ZodArray`\<`ZodString`\>; `authoredAt`: `ZodNumber`; `committedAt`: `ZodNumber`; \}, `$strict`\>\>\> | - |
56
+ | <a id="property-readtree"></a> `readTree` | `object` | - |
57
+ | `readTree.args` | `ZodTuple`\<\[`ZodString`, `ZodString`\], `null`\> | - |
58
+ | `readTree.result` | `ZodNullable`\<`ZodArray`\<`ZodLazy`\<`ZodObject`\<\{ `name`: `ZodString`; `mode`: `ZodString`; `hash`: `ZodString`; `type`: `ZodEnum`\<\{ `blob`: `"blob"`; `tree`: `"tree"`; `commit`: `"commit"`; \}\>; \}, `$strict`\>\>\>\> | - |
59
+ | <a id="property-readblob"></a> `readBlob` | `object` | - |
60
+ | `readBlob.args` | `ZodTuple`\<\[`ZodString`, `ZodString`\], `null`\> | - |
61
+ | `readBlob.result` | `ZodNullable`\<`ZodLazy`\<`ZodCustom`\<`Uint8Array`\<`ArrayBuffer`\>, `Uint8Array`\<`ArrayBuffer`\>\>\>\> | - |
62
+ | <a id="property-refs"></a> `refs` | `object` | - |
63
+ | `refs.args` | `ZodTuple`\<\[`ZodString`\], `null`\> | - |
64
+ | `refs.result` | `ZodArray`\<`ZodObject`\<\{ `name`: `ZodString`; `hash`: `ZodString`; \}, `$strict`\>\> | - |
65
+ | <a id="property-exchange"></a> `exchange` | `object` | - |
66
+ | `exchange.args` | `ZodTuple`\<\[`ZodString`, `ZodObject`\<\{ `service`: `ZodEnum`\<\{ `upload-pack`: `"upload-pack"`; `receive-pack`: `"receive-pack"`; \}\>; `phase`: `ZodEnum`\<\{ `advertise`: `"advertise"`; `exchange`: `"exchange"`; \}\>; `body`: `ZodNullable`\<`ZodLazy`\<`ZodCustom`\<`Uint8Array`\<`ArrayBuffer`\>, `Uint8Array`\<`ArrayBuffer`\>\>\>\>; `headers`: `ZodLazy`\<`ZodRecord`\<`ZodString`, `ZodString`\>\>; \}, `$strict`\>\], `null`\> | - |
67
+ | `exchange.result` | `ZodObject`\<\{ `status`: `ZodNumber`; `headers`: `ZodLazy`\<`ZodRecord`\<`ZodString`, `ZodString`\>\>; `body`: `ZodLazy`\<`ZodCustom`\<`Uint8Array`\<`ArrayBuffer`\>, `Uint8Array`\<`ArrayBuffer`\>\>\>; \}, `$strict`\> | `response` |
68
68
 
69
69
  ---
70
70