@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
@@ -1,11 +1,11 @@
1
1
  import * as z from "zod";
2
2
  /** Public metadata for one host-admitted Workflow Git pass; parsing never grants authority. */
3
- export declare const workflowGitPassResultSchema: z.ZodObject<{
3
+ export declare const workflowGitPassResultSchema: z.ZodLazy<z.ZodObject<{
4
4
  passId: z.ZodString;
5
5
  remote: z.ZodURL;
6
6
  expiresAt: z.ZodNumber;
7
7
  bearer: z.ZodExactOptional<z.ZodString>;
8
- }, z.core.$strict>;
8
+ }, z.core.$strict>>;
9
9
  /** The complete remote stays opaque; the host owns admission, renewal and revocation. */
10
10
  export type WorkflowGitPassResult = z.output<typeof workflowGitPassResultSchema>;
11
11
  /** Existing attachment budget operation kinds shared by Computer and Media. */
@@ -15,7 +15,7 @@ export declare const connectorOperationBudgetKindSchema: z.ZodEnum<{
15
15
  exec: "exec";
16
16
  }>;
17
17
  /** Existing owner budget refusal; it remains a domain result, not a wire envelope. */
18
- export declare const connectorOperationBudgetRefusalSchema: z.ZodObject<{
18
+ export declare const connectorOperationBudgetRefusalSchema: z.ZodLazy<z.ZodObject<{
19
19
  error: z.ZodLiteral<"attachment_budget_exceeded">;
20
20
  kind: z.ZodEnum<{
21
21
  write: "write";
@@ -23,16 +23,16 @@ export declare const connectorOperationBudgetRefusalSchema: z.ZodObject<{
23
23
  exec: "exec";
24
24
  }>;
25
25
  retryAfterMs: z.ZodNumber;
26
- }, z.core.$strict>;
26
+ }, z.core.$strict>>;
27
27
  /** Computer admission refusals returned before native dispatch. */
28
- export declare const appComputerAdmissionRefusalSchema: z.ZodUnion<readonly [z.ZodObject<{
28
+ export declare const appComputerAdmissionRefusalSchema: z.ZodLazy<z.ZodUnion<readonly [z.ZodObject<{
29
29
  error: z.ZodEnum<{
30
30
  unavailable: "unavailable";
31
31
  revoked: "revoked";
32
32
  not_granted: "not_granted";
33
33
  grantor_lost_authority: "grantor_lost_authority";
34
34
  }>;
35
- }, z.core.$strict>, z.ZodObject<{
35
+ }, z.core.$strict>, z.ZodLazy<z.ZodObject<{
36
36
  error: z.ZodLiteral<"attachment_budget_exceeded">;
37
37
  kind: z.ZodEnum<{
38
38
  write: "write";
@@ -40,34 +40,34 @@ export declare const appComputerAdmissionRefusalSchema: z.ZodUnion<readonly [z.Z
40
40
  exec: "exec";
41
41
  }>;
42
42
  retryAfterMs: z.ZodNumber;
43
- }, z.core.$strict>]>;
43
+ }, z.core.$strict>>]>>;
44
44
  /** Existing Computer broker argument refusals. */
45
- export declare const appComputerInputRefusalSchema: z.ZodObject<{
45
+ export declare const appComputerInputRefusalSchema: z.ZodLazy<z.ZodObject<{
46
46
  error: z.ZodEnum<{
47
47
  invalid: "invalid";
48
48
  too_large: "too_large";
49
49
  invalid_path: "invalid_path";
50
50
  }>;
51
- }, z.core.$strict>;
51
+ }, z.core.$strict>>;
52
52
  /** Existing Computer dispatch status/decoding refusals. */
53
- export declare const appComputerDispatchRefusalSchema: z.ZodObject<{
53
+ export declare const appComputerDispatchRefusalSchema: z.ZodLazy<z.ZodObject<{
54
54
  error: z.ZodEnum<{
55
55
  unavailable: "unavailable";
56
56
  conflict: "conflict";
57
57
  not_granted: "not_granted";
58
58
  too_large: "too_large";
59
59
  }>;
60
- }, z.core.$strict>;
60
+ }, z.core.$strict>>;
61
61
  /** An execution wait can time out while its durable request remains identifiable. */
62
- export declare const appComputerExecTimeoutSchema: z.ZodObject<{
62
+ export declare const appComputerExecTimeoutSchema: z.ZodLazy<z.ZodObject<{
63
63
  error: z.ZodLiteral<"timeout">;
64
64
  requestId: z.ZodString;
65
- }, z.core.$strict>;
65
+ }, z.core.$strict>>;
66
66
  /** The Workflow Git-pass owner has exactly these existing domain refusals. */
67
- export declare const workflowGitPassRefusalSchema: z.ZodObject<{
67
+ export declare const workflowGitPassRefusalSchema: z.ZodLazy<z.ZodObject<{
68
68
  error: z.ZodEnum<{
69
69
  unavailable: "unavailable";
70
70
  revoked: "revoked";
71
71
  not_granted: "not_granted";
72
72
  }>;
73
- }, z.core.$strict>;
73
+ }, z.core.$strict>>;
@@ -1,6 +1,6 @@
1
1
  import * as z from "zod";
2
2
  /** Public metadata for one host-admitted Workflow Git pass; parsing never grants authority. */
3
- export const workflowGitPassResultSchema = z.strictObject({
3
+ export const workflowGitPassResultSchema = z.lazy(() => z.strictObject({
4
4
  passId: z.string().min(1),
5
5
  remote: z.url({ protocol: /^https$/, abort: true }).refine((value) => {
6
6
  const remote = new URL(value);
@@ -13,7 +13,7 @@ export const workflowGitPassResultSchema = z.strictObject({
13
13
  * command-local Git config, never written to a repository config.
14
14
  */
15
15
  bearer: z.string().min(1).exactOptional(),
16
- });
16
+ }));
17
17
  /** Existing attachment budget operation kinds shared by Computer and Media. */
18
18
  export const connectorOperationBudgetKindSchema = z.enum([
19
19
  "exec",
@@ -21,13 +21,13 @@ export const connectorOperationBudgetKindSchema = z.enum([
21
21
  "media",
22
22
  ]);
23
23
  /** Existing owner budget refusal; it remains a domain result, not a wire envelope. */
24
- export const connectorOperationBudgetRefusalSchema = z.strictObject({
24
+ export const connectorOperationBudgetRefusalSchema = z.lazy(() => z.strictObject({
25
25
  error: z.literal("attachment_budget_exceeded"),
26
26
  kind: connectorOperationBudgetKindSchema,
27
27
  retryAfterMs: z.number(),
28
- });
28
+ }));
29
29
  /** Computer admission refusals returned before native dispatch. */
30
- export const appComputerAdmissionRefusalSchema = z.union([
30
+ export const appComputerAdmissionRefusalSchema = z.lazy(() => z.union([
31
31
  z.strictObject({
32
32
  error: z.enum([
33
33
  "revoked",
@@ -37,21 +37,21 @@ export const appComputerAdmissionRefusalSchema = z.union([
37
37
  ]),
38
38
  }),
39
39
  connectorOperationBudgetRefusalSchema,
40
- ]);
40
+ ]));
41
41
  /** Existing Computer broker argument refusals. */
42
- export const appComputerInputRefusalSchema = z.strictObject({
42
+ export const appComputerInputRefusalSchema = z.lazy(() => z.strictObject({
43
43
  error: z.enum(["too_large", "invalid_path", "invalid"]),
44
- });
44
+ }));
45
45
  /** Existing Computer dispatch status/decoding refusals. */
46
- export const appComputerDispatchRefusalSchema = z.strictObject({
46
+ export const appComputerDispatchRefusalSchema = z.lazy(() => z.strictObject({
47
47
  error: z.enum(["not_granted", "too_large", "conflict", "unavailable"]),
48
- });
48
+ }));
49
49
  /** An execution wait can time out while its durable request remains identifiable. */
50
- export const appComputerExecTimeoutSchema = z.strictObject({
50
+ export const appComputerExecTimeoutSchema = z.lazy(() => z.strictObject({
51
51
  error: z.literal("timeout"),
52
52
  requestId: z.string(),
53
- });
53
+ }));
54
54
  /** The Workflow Git-pass owner has exactly these existing domain refusals. */
55
- export const workflowGitPassRefusalSchema = z.strictObject({
55
+ export const workflowGitPassRefusalSchema = z.lazy(() => z.strictObject({
56
56
  error: z.enum(["revoked", "not_granted", "unavailable"]),
57
- });
57
+ }));
package/dist/computer.js CHANGED
@@ -15,11 +15,11 @@ export const computerListingSchema = Schema.Struct({
15
15
  })),
16
16
  nextOffset: Schema.NullOr(Schema.Number),
17
17
  });
18
- export const computerList = defineCapability("computer.list", 1, rpcHandleSchema({
18
+ export const computerList = defineCapability("computer.list", 1, z.lazy(() => rpcHandleSchema({
19
19
  list: rpcMethod(rpcDataSchema(z
20
20
  .unknown()
21
21
  .transform((value) => Schema.decodeUnknownSync(computerListingSchema)(value)))),
22
- }));
22
+ })));
23
23
  export const computerRuntimeStateSchema = Schema.Union([
24
24
  Schema.Struct({
25
25
  state: Schema.Literals(["running", "sleeping", "starting"]),
@@ -50,12 +50,12 @@ export const computerInstrumentSnapshotSchema = Schema.Struct({
50
50
  })),
51
51
  internet: computerInternetAccessSchema,
52
52
  });
53
- export const computerInstrumentRead = defineCapability("computer.instrument.read", 1, rpcHandleSchema({
53
+ export const computerInstrumentRead = defineCapability("computer.instrument.read", 1, z.lazy(() => rpcHandleSchema({
54
54
  read: rpcMethod(rpcDataSchema(z
55
55
  .unknown()
56
56
  .transform((value) => Schema.decodeUnknownSync(computerInstrumentSnapshotSchema)(value)))),
57
- }));
58
- export const computerInstrumentControl = defineCapability("computer.instrument.control", 1, rpcHandleSchema({
57
+ })));
58
+ export const computerInstrumentControl = defineCapability("computer.instrument.control", 1, z.lazy(() => rpcHandleSchema({
59
59
  start: rpcMethod(rpcDataSchema(z
60
60
  .unknown()
61
61
  .transform((value) => Schema.decodeUnknownSync(computerRuntimeStateSchema)(value)))),
@@ -65,7 +65,7 @@ export const computerInstrumentControl = defineCapability("computer.instrument.c
65
65
  detachLocal: rpcMethod(rpcDataSchema(z
66
66
  .unknown()
67
67
  .transform((value) => Schema.decodeUnknownSync(Schema.Struct({ detached: Schema.Boolean }))(value)))),
68
- }));
68
+ })));
69
69
  export async function readComputerInstrument(capabilities) {
70
70
  return Schema.decodeUnknownSync(computerInstrumentSnapshotSchema)(await capabilities.require(computerInstrumentRead).read());
71
71
  }
@@ -106,7 +106,7 @@ export const computerPortRemovalSchema = Schema.Struct({
106
106
  removed: Schema.Boolean,
107
107
  });
108
108
  /** The selected Computer's admitted preview URLs and port mutations. */
109
- export const computerPorts = defineCapability("computer.ports", 2, rpcHandleSchema({
109
+ export const computerPorts = defineCapability("computer.ports", 2, z.lazy(() => rpcHandleSchema({
110
110
  list: rpcMethod(rpcDataSchema(z
111
111
  .unknown()
112
112
  .transform((value) => Schema.decodeUnknownSync(computerPortsResultSchema)(value)))),
@@ -116,7 +116,7 @@ export const computerPorts = defineCapability("computer.ports", 2, rpcHandleSche
116
116
  unexpose: rpcMethod(rpcDataSchema(z
117
117
  .unknown()
118
118
  .transform((value) => Schema.decodeUnknownSync(computerPortRemovalSchema)(value)))),
119
- }));
119
+ })));
120
120
  /** Decode exposed ports at the SDK boundary. */
121
121
  export async function listComputerPorts(capabilities) {
122
122
  const result = Schema.decodeUnknownSync(computerPortsResultSchema)(await capabilities.require(computerPorts).list());
@@ -178,7 +178,7 @@ export const computerProcessStartSchema = Schema.Struct({
178
178
  port: Schema.optionalKey(computerPortExposureSchema.fields.port),
179
179
  });
180
180
  /** Read the authoritative process inventory from the selected Computer. */
181
- export const computerProcesses = defineCapability("computer.processes", 1, rpcHandleSchema({
181
+ export const computerProcesses = defineCapability("computer.processes", 1, z.lazy(() => rpcHandleSchema({
182
182
  start: rpcMethod(rpcDataSchema(z
183
183
  .unknown()
184
184
  .transform((value) => Schema.decodeUnknownSync(computerProcessSchema)(value)))),
@@ -188,7 +188,7 @@ export const computerProcesses = defineCapability("computer.processes", 1, rpcHa
188
188
  kill: rpcMethod(rpcDataSchema(z
189
189
  .unknown()
190
190
  .transform((value) => Schema.decodeUnknownSync(computerProcessKillSchema)(value)))),
191
- }));
191
+ })));
192
192
  /** Decode the Computer owner's process inventory at the App boundary. */
193
193
  export async function listComputerProcesses(capabilities) {
194
194
  return Schema.decodeUnknownSync(computerProcessesSchema)(await capabilities.require(computerProcesses).list());
@@ -197,12 +197,12 @@ export async function listComputerProcesses(capabilities) {
197
197
  export async function killComputerProcess(capabilities, id) {
198
198
  return Schema.decodeUnknownSync(computerProcessKillSchema)(await capabilities.require(computerProcesses).kill(id));
199
199
  }
200
- export const computerReadFile = defineCapability("computer.readFile", 1, rpcHandleSchema({
200
+ export const computerReadFile = defineCapability("computer.readFile", 1, z.lazy(() => rpcHandleSchema({
201
201
  open: rpcMethod(rpcHandleSchema({
202
202
  response: rpcMethod(z.instanceof(Response)),
203
203
  close: rpcVoid,
204
204
  })),
205
- }));
205
+ })));
206
206
  /** The caller receives native file bytes; HTTP details stay in the SDK adapter. */
207
207
  export async function readComputerFile(capabilities, input, options) {
208
208
  return await readAppFile(await capabilities.require(computerReadFile).open(input), { ...options, name: input.path.split("/").at(-1) ?? "file" });
@@ -211,13 +211,13 @@ export async function readComputerFile(capabilities, input, options) {
211
211
  export async function listComputerFiles(capabilities, input) {
212
212
  return Schema.decodeUnknownSync(computerListingSchema)(await capabilities.require(computerList).list(input));
213
213
  }
214
- export const computerWriteFile = defineCapability("computer.writeFile", 3, rpcHandleSchema({
214
+ export const computerWriteFile = defineCapability("computer.writeFile", 3, z.lazy(() => rpcHandleSchema({
215
215
  open: rpcMethod(rpcHandleSchema({ write: rpcVoid, close: rpcVoid })),
216
216
  mkdir: rpcVoid,
217
217
  replace: rpcMethod(rpcDataSchema(z
218
218
  .unknown()
219
219
  .transform((value) => Schema.decodeUnknownSync(computerFileReplacementOutcomeSchema)(value)))),
220
- }));
220
+ })));
221
221
  const computerFileReplacementOutcomeSchema = Schema.Union([
222
222
  Schema.Struct({
223
223
  kind: Schema.Literal("replaced"),
@@ -244,7 +244,7 @@ export const computerTerminalInformationSchema = Schema.Struct({
244
244
  uptimeSeconds: Schema.Number.pipe(Schema.check(Schema.isInt()), Schema.check(Schema.isGreaterThanOrEqualTo(0))),
245
245
  version: Schema.NonEmptyString.pipe(Schema.check(Schema.isMaxLength(64))),
246
246
  });
247
- export const computerTerminal = defineCapability("computer.terminal", 2, rpcHandleSchema({
247
+ export const computerTerminal = defineCapability("computer.terminal", 2, z.lazy(() => rpcHandleSchema({
248
248
  open: rpcMethod(rpcHandleSchema({
249
249
  information: rpcMethod(rpcDataSchema(z
250
250
  .unknown()
@@ -258,7 +258,7 @@ export const computerTerminal = defineCapability("computer.terminal", 2, rpcHand
258
258
  resize: rpcVoid,
259
259
  close: rpcVoid,
260
260
  })),
261
- }));
261
+ })));
262
262
  /** Open one host-owned terminal and bind its lifetime to the mounted App. */
263
263
  export async function openComputerTerminal(capabilities, size, options = {}) {
264
264
  options.signal?.throwIfAborted();
@@ -221,7 +221,7 @@ export class GameServerRequestError extends Error {
221
221
  this.name = "GameServerRequestError";
222
222
  }
223
223
  }
224
- export const gamesServers = defineCapability("games:servers", 1, rpcHandleSchema({
224
+ export const gamesServers = defineCapability("games:servers", 1, z.lazy(() => rpcHandleSchema({
225
225
  list: rpcMethod(rpcDataSchema(z.unknown().transform((value) => gameServerPageSchema.parse(value)))),
226
226
  catalog: rpcMethod(rpcDataSchema(z
227
227
  .unknown()
@@ -236,7 +236,7 @@ export const gamesServers = defineCapability("games:servers", 1, rpcHandleSchema
236
236
  .transform((value) => z.array(gameServerBackupSchema).parse(value)))),
237
237
  delete: rpcVoid,
238
238
  backupNow: rpcVoid,
239
- }));
239
+ })));
240
240
  /** Decode the host's listing at the App boundary. */
241
241
  export async function listGameServers(capabilities, input) {
242
242
  const page = await capabilities.require(gamesServers).list(input);
package/dist/git-rpc.d.ts CHANGED
@@ -3,27 +3,27 @@ import { type GitBinding } from "./git.js";
3
3
  /** The native tuple and result grammar shared by the handle and frame entrypoint. */
4
4
  export declare const nativeGitCodecs: {
5
5
  create: {
6
- args: z.ZodTuple<[z.ZodString, z.ZodOptional<z.ZodObject<{
6
+ args: z.ZodTuple<[z.ZodString, z.ZodLazy<z.ZodOptional<z.ZodObject<{
7
7
  description: z.ZodOptional<z.ZodString>;
8
8
  defaultBranch: z.ZodOptional<z.ZodString>;
9
- }, z.core.$strict>>], null>;
10
- result: z.ZodObject<{
9
+ }, z.core.$strict>>>], null>;
10
+ result: z.ZodLazy<z.ZodObject<{
11
11
  name: z.ZodString;
12
12
  defaultBranch: z.ZodString;
13
13
  lastPushAt: z.ZodNullable<z.ZodString>;
14
14
  source: z.ZodNullable<z.ZodString>;
15
- }, z.core.$strict>;
15
+ }, z.core.$strict>>;
16
16
  };
17
17
  fork: {
18
- args: z.ZodTuple<[z.ZodString, z.ZodString, z.ZodOptional<z.ZodObject<{
18
+ args: z.ZodTuple<[z.ZodString, z.ZodString, z.ZodLazy<z.ZodOptional<z.ZodObject<{
19
19
  description: z.ZodOptional<z.ZodString>;
20
- }, z.core.$strict>>], null>;
21
- result: z.ZodObject<{
20
+ }, z.core.$strict>>>], null>;
21
+ result: z.ZodLazy<z.ZodObject<{
22
22
  name: z.ZodString;
23
23
  defaultBranch: z.ZodString;
24
24
  lastPushAt: z.ZodNullable<z.ZodString>;
25
25
  source: z.ZodNullable<z.ZodString>;
26
- }, z.core.$strict>;
26
+ }, z.core.$strict>>;
27
27
  };
28
28
  cloneUrl: {
29
29
  args: z.ZodTuple<[z.ZodString], null>;
@@ -31,24 +31,24 @@ export declare const nativeGitCodecs: {
31
31
  };
32
32
  info: {
33
33
  args: z.ZodTuple<[z.ZodString], null>;
34
- result: z.ZodNullable<z.ZodObject<{
34
+ result: z.ZodNullable<z.ZodLazy<z.ZodObject<{
35
35
  name: z.ZodString;
36
36
  defaultBranch: z.ZodString;
37
37
  lastPushAt: z.ZodNullable<z.ZodString>;
38
38
  source: z.ZodNullable<z.ZodString>;
39
- }, z.core.$strict>>;
39
+ }, z.core.$strict>>>;
40
40
  };
41
41
  delete: {
42
42
  args: z.ZodTuple<[z.ZodString], null>;
43
43
  result: z.ZodBoolean;
44
44
  };
45
45
  log: {
46
- args: z.ZodTuple<[z.ZodString, z.ZodObject<{
46
+ args: z.ZodTuple<[z.ZodString, z.ZodLazy<z.ZodObject<{
47
47
  ref: z.ZodString;
48
48
  limit: z.ZodOptional<z.ZodNumber>;
49
49
  offset: z.ZodOptional<z.ZodNumber>;
50
- }, z.core.$strict>], null>;
51
- result: z.ZodArray<z.ZodObject<{
50
+ }, z.core.$strict>>], null>;
51
+ result: z.ZodArray<z.ZodLazy<z.ZodObject<{
52
52
  hash: z.ZodString;
53
53
  treeHash: z.ZodString;
54
54
  message: z.ZodString;
@@ -63,11 +63,11 @@ export declare const nativeGitCodecs: {
63
63
  parents: z.ZodArray<z.ZodString>;
64
64
  authoredAt: z.ZodNumber;
65
65
  committedAt: z.ZodNumber;
66
- }, z.core.$strict>>;
66
+ }, z.core.$strict>>>;
67
67
  };
68
68
  readCommit: {
69
69
  args: z.ZodTuple<[z.ZodString, z.ZodString], null>;
70
- result: z.ZodNullable<z.ZodObject<{
70
+ result: z.ZodNullable<z.ZodLazy<z.ZodObject<{
71
71
  hash: z.ZodString;
72
72
  treeHash: z.ZodString;
73
73
  message: z.ZodString;
@@ -82,11 +82,11 @@ export declare const nativeGitCodecs: {
82
82
  parents: z.ZodArray<z.ZodString>;
83
83
  authoredAt: z.ZodNumber;
84
84
  committedAt: z.ZodNumber;
85
- }, z.core.$strict>>;
85
+ }, z.core.$strict>>>;
86
86
  };
87
87
  readTree: {
88
88
  args: z.ZodTuple<[z.ZodString, z.ZodString], null>;
89
- result: z.ZodNullable<z.ZodArray<z.ZodObject<{
89
+ result: z.ZodNullable<z.ZodArray<z.ZodLazy<z.ZodObject<{
90
90
  name: z.ZodString;
91
91
  mode: z.ZodString;
92
92
  hash: z.ZodString;
@@ -95,11 +95,11 @@ export declare const nativeGitCodecs: {
95
95
  tree: "tree";
96
96
  commit: "commit";
97
97
  }>;
98
- }, z.core.$strict>>>;
98
+ }, z.core.$strict>>>>;
99
99
  };
100
100
  readBlob: {
101
101
  args: z.ZodTuple<[z.ZodString, z.ZodString], null>;
102
- result: z.ZodNullable<z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>>;
102
+ result: z.ZodNullable<z.ZodLazy<z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>>>;
103
103
  };
104
104
  refs: {
105
105
  args: z.ZodTuple<[z.ZodString], null>;
@@ -118,13 +118,13 @@ export declare const nativeGitCodecs: {
118
118
  advertise: "advertise";
119
119
  exchange: "exchange";
120
120
  }>;
121
- body: z.ZodNullable<z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>>;
122
- headers: z.ZodRecord<z.ZodString, z.ZodString>;
121
+ body: z.ZodNullable<z.ZodLazy<z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>>>;
122
+ headers: z.ZodLazy<z.ZodRecord<z.ZodString, z.ZodString>>;
123
123
  }, z.core.$strict>], null>;
124
124
  result: z.ZodObject<{
125
125
  status: z.ZodNumber;
126
- headers: z.ZodRecord<z.ZodString, z.ZodString>;
127
- body: z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
126
+ headers: z.ZodLazy<z.ZodRecord<z.ZodString, z.ZodString>>;
127
+ body: z.ZodLazy<z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>>;
128
128
  }, z.core.$strict>;
129
129
  };
130
130
  };
package/dist/git-rpc.js CHANGED
@@ -1,18 +1,18 @@
1
1
  import * as z from "zod";
2
2
  import {} from "./git.js";
3
3
  import { gitRepositoryNameSchema, gitSha1Schema, } from "@fungi.computer/puffball/git-representation";
4
- const bytes = z
4
+ const bytes = z.lazy(() => z
5
5
  .instanceof(Uint8Array)
6
- .refine((value) => value.byteLength <= 32 * 1024 * 1024);
7
- const headers = z.record(z.string().max(256), z.string().max(8192));
6
+ .refine((value) => value.byteLength <= 32 * 1024 * 1024));
7
+ const headers = z.lazy(() => z.record(z.string().max(256), z.string().max(8192)));
8
8
  const identity = z.strictObject({ name: z.string(), email: z.string() });
9
- const info = z.strictObject({
9
+ const info = z.lazy(() => z.strictObject({
10
10
  name: gitRepositoryNameSchema,
11
11
  defaultBranch: z.string(),
12
12
  lastPushAt: z.string().nullable(),
13
13
  source: gitRepositoryNameSchema.nullable(),
14
- });
15
- const commit = z.strictObject({
14
+ }));
15
+ const commit = z.lazy(() => z.strictObject({
16
16
  hash: gitSha1Schema,
17
17
  treeHash: gitSha1Schema,
18
18
  message: z.string(),
@@ -21,13 +21,13 @@ const commit = z.strictObject({
21
21
  parents: z.array(gitSha1Schema),
22
22
  authoredAt: z.number().int(),
23
23
  committedAt: z.number().int(),
24
- });
25
- const tree = z.strictObject({
24
+ }));
25
+ const tree = z.lazy(() => z.strictObject({
26
26
  name: z.string(),
27
27
  mode: z.string(),
28
28
  hash: gitSha1Schema,
29
29
  type: z.enum(["blob", "tree", "commit"]),
30
- });
30
+ }));
31
31
  const request = z.strictObject({
32
32
  service: z.enum(["upload-pack", "receive-pack"]),
33
33
  phase: z.enum(["advertise", "exchange"]),
@@ -39,20 +39,18 @@ const response = z.strictObject({
39
39
  headers,
40
40
  body: bytes,
41
41
  });
42
- const createOptions = z
42
+ const createOptions = z.lazy(() => z
43
43
  .strictObject({
44
44
  description: z.string().max(8192).optional(),
45
45
  defaultBranch: z.string().min(1).max(1024).optional(),
46
46
  })
47
- .optional();
48
- const forkOptions = z
49
- .strictObject({ description: z.string().max(8192).optional() })
50
- .optional();
51
- const logOptions = z.strictObject({
47
+ .optional());
48
+ const forkOptions = z.lazy(() => z.strictObject({ description: z.string().max(8192).optional() }).optional());
49
+ const logOptions = z.lazy(() => z.strictObject({
52
50
  ref: z.string().min(1).max(1024),
53
51
  limit: z.number().int().min(1).max(1000).optional(),
54
52
  offset: z.number().int().nonnegative().optional(),
55
- });
53
+ }));
56
54
  /** The native tuple and result grammar shared by the handle and frame entrypoint. */
57
55
  export const nativeGitCodecs = {
58
56
  create: {
package/dist/git.d.ts CHANGED
@@ -9,14 +9,14 @@ export type GitRepositoryName = z.output<typeof gitRepositoryNameSchema>;
9
9
  * Host-selected repository namespace. Team identity comes from the host;
10
10
  * decoding this reference never grants access to either namespace.
11
11
  */
12
- export declare const repositoryRefSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
12
+ export declare const repositoryRefSchema: z.ZodLazy<z.ZodDiscriminatedUnion<[z.ZodObject<{
13
13
  kind: z.ZodLiteral<"installation">;
14
14
  installationId: z.ZodString;
15
15
  repository: z.ZodString;
16
16
  }, z.core.$strict>, z.ZodObject<{
17
17
  kind: z.ZodLiteral<"team-source">;
18
18
  repository: z.ZodString;
19
- }, z.core.$strict>], "kind">;
19
+ }, z.core.$strict>], "kind">>;
20
20
  /** Installation-local repository or registered Team source, selected by its host. */
21
21
  export type RepositoryRef = z.output<typeof repositoryRefSchema>;
22
22
  /** Stable namespace identity, serialized through the canonical repository decoder. */
@@ -84,7 +84,7 @@ export declare const gitWriterSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
84
84
  }, z.core.$strict>], "kind">>;
85
85
  }, z.core.$strict>], "kind">;
86
86
  /** The App's question covers the whole push, under host-held attribution. */
87
- export declare const gitPushQuestionSchema: z.ZodObject<{
87
+ export declare const gitPushQuestionSchema: z.ZodLazy<z.ZodObject<{
88
88
  repository: z.ZodString;
89
89
  writer: z.ZodObject<{
90
90
  kind: z.ZodLiteral<"actor">;
@@ -124,9 +124,9 @@ export declare const gitPushQuestionSchema: z.ZodObject<{
124
124
  before: z.ZodString;
125
125
  after: z.ZodString;
126
126
  }, z.core.$strict>>;
127
- }, z.core.$strict>;
127
+ }, z.core.$strict>>;
128
128
  /** A whole push verdict; refusal messages are shown by ordinary Git clients. */
129
- export declare const gitPushVerdictSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
129
+ export declare const gitPushVerdictSchema: z.ZodLazy<z.ZodDiscriminatedUnion<[z.ZodObject<{
130
130
  allowed: z.ZodLiteral<true>;
131
131
  }, z.core.$strict>, z.ZodObject<{
132
132
  allowed: z.ZodLiteral<false>;
@@ -134,13 +134,13 @@ export declare const gitPushVerdictSchema: z.ZodDiscriminatedUnion<[z.ZodObject<
134
134
  ref: z.ZodString;
135
135
  message: z.ZodString;
136
136
  }, z.core.$strict>>;
137
- }, z.core.$strict>], "allowed">;
137
+ }, z.core.$strict>], "allowed">>;
138
138
  /** Ref question sent only after host grant and Workflow branch admission. */
139
139
  export type GitPushQuestion = z.output<typeof gitPushQuestionSchema>;
140
140
  /** Explicit permission or bounded per-ref refusal for the whole push. */
141
141
  export type GitPushVerdict = z.output<typeof gitPushVerdictSchema>;
142
142
  /** One accepted push, with host attribution and no remote or credential. */
143
- export declare const appGitPushFactSchema: z.ZodObject<{
143
+ export declare const appGitPushFactSchema: z.ZodLazy<z.ZodObject<{
144
144
  repository: z.ZodString;
145
145
  writer: z.ZodDiscriminatedUnion<[z.ZodObject<{
146
146
  kind: z.ZodLiteral<"actor">;
@@ -197,8 +197,8 @@ export declare const appGitPushFactSchema: z.ZodObject<{
197
197
  ref: z.ZodString;
198
198
  journaled: z.ZodNullable<z.ZodString>;
199
199
  }, z.core.$strict>>>;
200
- eventId: z.ZodString;
201
- }, z.core.$strict>;
200
+ eventId: z.ZodLazy<z.ZodString>;
201
+ }, z.core.$strict>>;
202
202
  /** One bounded ref update, shared by push questions and accepted facts. */
203
203
  export type GitRefUpdate = z.output<typeof appGitPushFactSchema>["updates"][number];
204
204
  /** Host-delivered push fact; retries retain the same event ID. */
package/dist/git.js CHANGED
@@ -7,7 +7,7 @@ export const gitRepositoryCapability = "git.repository";
7
7
  * Host-selected repository namespace. Team identity comes from the host;
8
8
  * decoding this reference never grants access to either namespace.
9
9
  */
10
- export const repositoryRefSchema = z.discriminatedUnion("kind", [
10
+ export const repositoryRefSchema = z.lazy(() => z.discriminatedUnion("kind", [
11
11
  z.strictObject({
12
12
  kind: z.literal("installation"),
13
13
  installationId: z.string().min(1).max(256),
@@ -17,7 +17,7 @@ export const repositoryRefSchema = z.discriminatedUnion("kind", [
17
17
  kind: z.literal("team-source"),
18
18
  repository: gitRepositoryNameSchema,
19
19
  }),
20
- ]);
20
+ ]));
21
21
  /** Stable namespace identity, serialized through the canonical repository decoder. */
22
22
  export function repositoryRefKey(repository) {
23
23
  return JSON.stringify(repositoryRefSchema.parse(repository));
@@ -55,13 +55,13 @@ export const gitWriterSchema = z.discriminatedUnion("kind", [
55
55
  }),
56
56
  ]);
57
57
  /** The App's question covers the whole push, under host-held attribution. */
58
- export const gitPushQuestionSchema = z.strictObject({
58
+ export const gitPushQuestionSchema = z.lazy(() => z.strictObject({
59
59
  repository: gitRepositoryNameSchema,
60
60
  writer: gitWriterSchema.options[0],
61
61
  updates: z.array(gitRefUpdateSchema).min(1).max(256),
62
- });
62
+ }));
63
63
  /** A whole push verdict; refusal messages are shown by ordinary Git clients. */
64
- export const gitPushVerdictSchema = z.discriminatedUnion("allowed", [
64
+ export const gitPushVerdictSchema = z.lazy(() => z.discriminatedUnion("allowed", [
65
65
  z.strictObject({ allowed: z.literal(true) }),
66
66
  z.strictObject({
67
67
  allowed: z.literal(false),
@@ -73,9 +73,9 @@ export const gitPushVerdictSchema = z.discriminatedUnion("allowed", [
73
73
  .min(1)
74
74
  .max(256),
75
75
  }),
76
- ]);
76
+ ]));
77
77
  /** One accepted push, with host attribution and no remote or credential. */
78
- export const appGitPushFactSchema = z.strictObject({
78
+ export const appGitPushFactSchema = z.lazy(() => z.strictObject({
79
79
  repository: gitRepositoryNameSchema,
80
80
  writer: gitWriterSchema,
81
81
  updates: z.array(gitRefUpdateSchema).min(1).max(256),
@@ -88,7 +88,7 @@ export const appGitPushFactSchema = z.strictObject({
88
88
  .optional(),
89
89
  // Host event IDs may include a Computer ID as well as its local event ID.
90
90
  eventId: gitPushEventIdSchema,
91
- });
91
+ }));
92
92
  /** Parse a host-admitted fact and invoke its lifecycle handler, preserving rejection. */
93
93
  export async function dispatchAppGitPush(lifecycle, raw) {
94
94
  const fact = appGitPushFactSchema.parse(raw);
package/dist/host.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import type { AppCommand } from "./commands.js";
2
2
  import type { WhistleExecutionOrigin, WhistleJsonValue } from "@fungi.computer/whistle";
3
3
  import type { AppContext, AppIdentity, FocusState } from "./lifecycle.js";
4
- import type { AppNavigationState } from "./window.js";
4
+ import type { AppNavigationActivation, AppNavigationState } from "./window.js";
5
5
  import type { AppBrowserAction, AppBrowserActionOutcome, AgentSessionSelection, AppPermissionOutcome, AppPermissionRequest, AppStatusAction, AppStatusItem, FileNavigationInput, ToastInput } from "./ui.js";
6
6
  import { AppError } from "./errors.js";
7
7
  import { type AppConnectMessage } from "./internal/protocol.js";
@@ -11,6 +11,8 @@ export type AppHost = {
11
11
  requestClose(): Promise<boolean>;
12
12
  /** Ask the App to go back one step in its own history; `true` when it did. */
13
13
  requestBack(): Promise<boolean>;
14
+ /** Deliver the person's use of a crumb or header command; `true` when the App acted. */
15
+ activateNavigation(activation: AppNavigationActivation): Promise<boolean>;
14
16
  /** Deliver the person's use of a status item; `true` when the App acted. */
15
17
  activateStatus(action: AppStatusAction): Promise<boolean>;
16
18
  updateContext(fact: AppHostFact<AppContext>): Promise<void>;
package/dist/host.js CHANGED
@@ -12,7 +12,7 @@ import { disposeRpcValue } from "./internal/capabilities.js";
12
12
  import { disconnectHost } from "./internal/disconnect-host.js";
13
13
  import { APP_CONNECT_TYPE, APP_PROTOCOL_VERSION, APP_READY_TYPE, } from "./internal/protocol.js";
14
14
  import { callRpc, rpcFailure, rpcSuccess, } from "./internal/result.js";
15
- import { parseBrowserAction, parseChordInvocation, parseCommandResultRpc, parseBackDecisionResult, parseCloseDecisionResult, parseCommand, parseCommandId, parseConnectRequest, parseContextFact, parseFocus, parseAgentSessionSelection, parseLocalHostBootstrap, parseHostLifecycleFact, parseNavigation, parseNavigationState, parseStatusAction, parseStatusItems, parsePermissionRequest, parseReady, parseReservedChordsFact, parseThemeFact, parseToast, parseVoidResult, } from "./internal/schemas.js";
15
+ import { parseBrowserAction, parseChordInvocation, parseCommandResultRpc, parseBackDecisionResult, parseCloseDecisionResult, parseCommand, parseCommandId, parseConnectRequest, parseContextFact, parseFocus, parseAgentSessionSelection, parseLocalHostBootstrap, parseHostLifecycleFact, parseNavigation, parseNavigationActivation, parseNavigationState, parseStatusAction, parseStatusItems, parsePermissionRequest, parseReady, parseReservedChordsFact, parseThemeFact, parseToast, parseVoidResult, } from "./internal/schemas.js";
16
16
  import { createTerminalGate, } from "./internal/terminal-gate.js";
17
17
  /** One pending or live mount belongs to each iframe WindowProxy. */
18
18
  const liveMounts = new WeakMap();
@@ -639,6 +639,10 @@ function createHost(options) {
639
639
  assertLive();
640
640
  return await callRpc(options.client.requestBack(), parseBackDecisionResult);
641
641
  },
642
+ activateNavigation: async (activation) => {
643
+ assertLive();
644
+ return await callRpc(options.client.activateNavigation(parseNavigationActivation(activation)), parseBackDecisionResult);
645
+ },
642
646
  activateStatus: async (action) => {
643
647
  assertLive();
644
648
  return await callRpc(options.client.activateStatus(parseStatusAction(action)), parseBackDecisionResult);