@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,44 @@
1
+ /** The host-published state surrounding a connected App: its Computer
2
+ * selection, focus, visibility, and any pending open request. */
3
+ export type AppContext = {
4
+ /** Host-selected Computer backing this App's admitted resource capabilities. */
5
+ readonly computerId: string | null;
6
+ /** Whether the Team has Computers, when this host owns its Team directory. */
7
+ readonly teamHasComputers?: boolean | null | undefined;
8
+ /** Whether this App has execute access across the Team, when known. */
9
+ readonly computerAccessGranted?: boolean | undefined;
10
+ readonly focus: FocusState;
11
+ /** One host-issued App open action, present only on the launch/reconfigure. */
12
+ readonly openRequest: AppOpenRequest | null;
13
+ readonly visibility: "hidden" | "visible";
14
+ };
15
+ /** One host-issued action an App must act on when it opens or reconfigures:
16
+ * start composing given text, or navigate
17
+ * to the given params. Each carries a `requestId` so the App can tell a
18
+ * repeated open from a fresh one. */
19
+ export type AppOpenRequest = Readonly<{
20
+ kind: "compose";
21
+ requestId: string;
22
+ text: string;
23
+ }> | Readonly<{
24
+ kind: "navigate";
25
+ requestId: string;
26
+ params: readonly Readonly<{
27
+ key: string;
28
+ value: string;
29
+ }>[];
30
+ }>;
31
+ /** The App's own identity, as admitted by its host. */
32
+ export type AppIdentity = {
33
+ readonly appId: string;
34
+ readonly releaseId: string;
35
+ readonly surfaceId: string;
36
+ };
37
+ /** The connection state of this App's session with its host. */
38
+ export type AppLifecycle = "connected" | "connecting" | "disconnected" | "disposed" | "disposing" | "suspended";
39
+ /** Whether the App's own surface is being edited and which surface, if
40
+ * any, the host considers focused. */
41
+ export type FocusState = {
42
+ readonly editing: boolean;
43
+ readonly surface: null | string;
44
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,159 @@
1
+ import * as Schema from "effect/Schema";
2
+ import type { CapabilityContract } from "./capabilities.js";
3
+ /** Gallery shelves, in display order. */
4
+ export declare const marketplaceCategories: readonly ["agents", "creative", "developer", "games", "productivity"];
5
+ export declare const marketplaceCategorySchema: Schema.Literals<readonly ["agents", "creative", "developer", "games", "productivity"]>;
6
+ export type MarketplaceCategory = Schema.Schema.Type<typeof marketplaceCategorySchema>;
7
+ export declare const marketplacePriceSchema: Schema.Union<readonly [Schema.Struct<{
8
+ readonly kind: Schema.Literal<"free">;
9
+ }>, Schema.Struct<{
10
+ readonly kind: Schema.Literal<"one-time">;
11
+ readonly currency: Schema.Literal<"usd">;
12
+ readonly amountMinor: Schema.Number;
13
+ }>]>;
14
+ export type MarketplacePrice = Schema.Schema.Type<typeof marketplacePriceSchema>;
15
+ /**
16
+ * One gallery entry as the viewing Team sees it. `availability` says what
17
+ * acquiring it means: `included` Apps already ship with every Team,
18
+ * `coming-soon` entries are not yet installable. `installed` is the Team's
19
+ * current state, not an authority.
20
+ */
21
+ export declare const marketplaceListingSchema: Schema.Struct<{
22
+ readonly listingId: Schema.String;
23
+ readonly appId: Schema.String;
24
+ readonly name: Schema.String;
25
+ readonly tagline: Schema.String;
26
+ readonly description: Schema.String;
27
+ readonly category: Schema.Literals<readonly ["agents", "creative", "developer", "games", "productivity"]>;
28
+ readonly icon: Schema.NullOr<Schema.String>;
29
+ readonly screenshots: Schema.$Array<Schema.Struct<{
30
+ readonly src: Schema.String;
31
+ readonly alt: Schema.String;
32
+ }>>;
33
+ readonly price: Schema.Union<readonly [Schema.Struct<{
34
+ readonly kind: Schema.Literal<"free">;
35
+ }>, Schema.Struct<{
36
+ readonly kind: Schema.Literal<"one-time">;
37
+ readonly currency: Schema.Literal<"usd">;
38
+ readonly amountMinor: Schema.Number;
39
+ }>]>;
40
+ readonly seller: Schema.Union<readonly [Schema.Struct<{
41
+ readonly kind: Schema.Literal<"platform">;
42
+ readonly accountId: Schema.String;
43
+ readonly name: Schema.String;
44
+ }>, Schema.Struct<{
45
+ readonly kind: Schema.Literal<"creator">;
46
+ readonly accountId: Schema.String;
47
+ readonly name: Schema.String;
48
+ }>]>;
49
+ readonly availability: Schema.Literals<readonly ["available", "included", "coming-soon"]>;
50
+ readonly installed: Schema.Boolean;
51
+ readonly featured: Schema.Boolean;
52
+ }>;
53
+ export type MarketplaceListing = Schema.Schema.Type<typeof marketplaceListingSchema>;
54
+ export declare const marketplaceBrowseResultSchema: Schema.Struct<{
55
+ readonly listings: Schema.$Array<Schema.Struct<{
56
+ readonly listingId: Schema.String;
57
+ readonly appId: Schema.String;
58
+ readonly name: Schema.String;
59
+ readonly tagline: Schema.String;
60
+ readonly description: Schema.String;
61
+ readonly category: Schema.Literals<readonly ["agents", "creative", "developer", "games", "productivity"]>;
62
+ readonly icon: Schema.NullOr<Schema.String>;
63
+ readonly screenshots: Schema.$Array<Schema.Struct<{
64
+ readonly src: Schema.String;
65
+ readonly alt: Schema.String;
66
+ }>>;
67
+ readonly price: Schema.Union<readonly [Schema.Struct<{
68
+ readonly kind: Schema.Literal<"free">;
69
+ }>, Schema.Struct<{
70
+ readonly kind: Schema.Literal<"one-time">;
71
+ readonly currency: Schema.Literal<"usd">;
72
+ readonly amountMinor: Schema.Number;
73
+ }>]>;
74
+ readonly seller: Schema.Union<readonly [Schema.Struct<{
75
+ readonly kind: Schema.Literal<"platform">;
76
+ readonly accountId: Schema.String;
77
+ readonly name: Schema.String;
78
+ }>, Schema.Struct<{
79
+ readonly kind: Schema.Literal<"creator">;
80
+ readonly accountId: Schema.String;
81
+ readonly name: Schema.String;
82
+ }>]>;
83
+ readonly availability: Schema.Literals<readonly ["available", "included", "coming-soon"]>;
84
+ readonly installed: Schema.Boolean;
85
+ readonly featured: Schema.Boolean;
86
+ }>>;
87
+ readonly paid: Schema.Boolean;
88
+ }>;
89
+ export type MarketplaceBrowseResult = Schema.Schema.Type<typeof marketplaceBrowseResultSchema>;
90
+ /** One catalog family: an ordinary App listing. */
91
+ export declare const decodeMarketplaceBrowseResult: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => {
92
+ readonly listings: readonly {
93
+ readonly listingId: string;
94
+ readonly appId: string;
95
+ readonly name: string;
96
+ readonly tagline: string;
97
+ readonly description: string;
98
+ readonly category: "agents" | "games" | "creative" | "developer" | "productivity";
99
+ readonly icon: string | null;
100
+ readonly screenshots: readonly {
101
+ readonly src: string;
102
+ readonly alt: string;
103
+ }[];
104
+ readonly price: {
105
+ readonly kind: "free";
106
+ } | {
107
+ readonly kind: "one-time";
108
+ readonly currency: "usd";
109
+ readonly amountMinor: number;
110
+ };
111
+ readonly seller: {
112
+ readonly kind: "platform";
113
+ readonly accountId: string;
114
+ readonly name: string;
115
+ } | {
116
+ readonly kind: "creator";
117
+ readonly accountId: string;
118
+ readonly name: string;
119
+ };
120
+ readonly availability: "available" | "included" | "coming-soon";
121
+ readonly installed: boolean;
122
+ readonly featured: boolean;
123
+ }[];
124
+ readonly paid: boolean;
125
+ };
126
+ export declare const marketplaceAcquisitionSchema: Schema.Union<readonly [Schema.Struct<{
127
+ readonly kind: Schema.Literal<"installed">;
128
+ readonly listingId: Schema.String;
129
+ readonly appId: Schema.String;
130
+ }>, Schema.Struct<{
131
+ readonly kind: Schema.Literal<"included">;
132
+ readonly listingId: Schema.String;
133
+ }>, Schema.Struct<{
134
+ readonly kind: Schema.Literal<"checkout">;
135
+ readonly listingId: Schema.String;
136
+ readonly url: Schema.String;
137
+ }>]>;
138
+ export type MarketplaceAcquisition = Schema.Schema.Type<typeof marketplaceAcquisitionSchema>;
139
+ export type MarketplaceBrowseInput = Readonly<{
140
+ query?: string;
141
+ category?: MarketplaceCategory | null;
142
+ }>;
143
+ /** Read the Marketplace gallery as the Team that mounted this App. */
144
+ export declare const marketplaceBrowse: CapabilityContract<{
145
+ list(input: MarketplaceBrowseInput): Promise<MarketplaceBrowseResult>;
146
+ }>;
147
+ /**
148
+ * Acquire a listing for the mounting Team. Free listings install at once;
149
+ * paid listings return a hosted Checkout URL and install after payment.
150
+ * The host re-checks Team authority and entitlement on every call.
151
+ */
152
+ export declare const marketplacePurchase: CapabilityContract<{
153
+ acquire(input: Readonly<{
154
+ listingId: string;
155
+ requestId: string;
156
+ }>): Promise<MarketplaceAcquisition>;
157
+ }>;
158
+ /** Anonymous discovery only; acquisition and launch still require Team admission. */
159
+ export declare function browsePublicMarketplace(hubOrigin: string, category: MarketplaceCategory, request?: typeof fetch): Promise<readonly MarketplaceListing[]>;
@@ -0,0 +1,102 @@
1
+ import * as z from "zod";
2
+ import { defineCapability } from "./capabilities.js";
3
+ import { rpcDataSchema, rpcHandleSchema, rpcMethod, } from "./internal/rpc-contract.js";
4
+ import * as Schema from "effect/Schema";
5
+ /** Gallery shelves, in display order. */
6
+ export const marketplaceCategories = [
7
+ "agents",
8
+ "creative",
9
+ "developer",
10
+ "games",
11
+ "productivity",
12
+ ];
13
+ export const marketplaceCategorySchema = Schema.Literals(marketplaceCategories);
14
+ const text = (maximum) => Schema.String.pipe(Schema.check(Schema.isMinLength(1)), Schema.check(Schema.isMaxLength(maximum)));
15
+ export const marketplacePriceSchema = Schema.Union([
16
+ Schema.Struct({ kind: Schema.Literal("free") }),
17
+ Schema.Struct({
18
+ kind: Schema.Literal("one-time"),
19
+ currency: Schema.Literal("usd"),
20
+ amountMinor: Schema.Number.pipe(Schema.check(Schema.isInt()), Schema.check(Schema.isGreaterThan(0))),
21
+ }),
22
+ ]);
23
+ /**
24
+ * One gallery entry as the viewing Team sees it. `availability` says what
25
+ * acquiring it means: `included` Apps already ship with every Team,
26
+ * `coming-soon` entries are not yet installable. `installed` is the Team's
27
+ * current state, not an authority.
28
+ */
29
+ export const marketplaceListingSchema = Schema.Struct({
30
+ listingId: text(128),
31
+ appId: text(128),
32
+ name: text(60),
33
+ tagline: text(140),
34
+ description: text(4_000),
35
+ category: marketplaceCategorySchema,
36
+ icon: Schema.NullOr(text(400_000)),
37
+ screenshots: Schema.Array(Schema.Struct({ src: text(400_000), alt: text(160) })).pipe(Schema.check(Schema.isMaxLength(6))),
38
+ price: marketplacePriceSchema,
39
+ seller: Schema.Union([
40
+ Schema.Struct({
41
+ kind: Schema.Literal("platform"),
42
+ accountId: text(128),
43
+ name: text(80),
44
+ }),
45
+ Schema.Struct({
46
+ kind: Schema.Literal("creator"),
47
+ accountId: text(128),
48
+ name: text(80),
49
+ }),
50
+ ]),
51
+ availability: Schema.Literals(["available", "included", "coming-soon"]),
52
+ installed: Schema.Boolean,
53
+ featured: Schema.Boolean,
54
+ });
55
+ export const marketplaceBrowseResultSchema = Schema.Struct({
56
+ listings: Schema.Array(marketplaceListingSchema).pipe(Schema.check(Schema.isMaxLength(200))),
57
+ paid: Schema.Boolean,
58
+ });
59
+ /** One catalog family: an ordinary App listing. */
60
+ export const decodeMarketplaceBrowseResult = Schema.decodeUnknownSync(marketplaceBrowseResultSchema);
61
+ export const marketplaceAcquisitionSchema = Schema.Union([
62
+ Schema.Struct({
63
+ kind: Schema.Literal("installed"),
64
+ listingId: text(128),
65
+ appId: text(128),
66
+ }),
67
+ Schema.Struct({ kind: Schema.Literal("included"), listingId: text(128) }),
68
+ Schema.Struct({
69
+ kind: Schema.Literal("checkout"),
70
+ listingId: text(128),
71
+ url: Schema.String.pipe(Schema.check(Schema.makeFilter((value) => value.startsWith("https://")))),
72
+ }),
73
+ ]);
74
+ /** Read the Marketplace gallery as the Team that mounted this App. */
75
+ export const marketplaceBrowse = defineCapability("marketplace.browse", 1, rpcHandleSchema({
76
+ list: rpcMethod(rpcDataSchema(z.unknown().transform((value) => decodeMarketplaceBrowseResult(value)))),
77
+ }));
78
+ /**
79
+ * Acquire a listing for the mounting Team. Free listings install at once;
80
+ * paid listings return a hosted Checkout URL and install after payment.
81
+ * The host re-checks Team authority and entitlement on every call.
82
+ */
83
+ export const marketplacePurchase = defineCapability("marketplace.purchase", 1, rpcHandleSchema({
84
+ acquire: rpcMethod(rpcDataSchema(z
85
+ .unknown()
86
+ .transform((value) => Schema.decodeUnknownSync(marketplaceAcquisitionSchema)(value)))),
87
+ }));
88
+ /** Anonymous discovery only; acquisition and launch still require Team admission. */
89
+ export async function browsePublicMarketplace(hubOrigin, category, request = fetch) {
90
+ const url = new URL("/api/public/marketplace/listings", hubOrigin);
91
+ url.searchParams.set("category", category);
92
+ const response = await request(url, {
93
+ credentials: "omit",
94
+ cache: "no-store",
95
+ });
96
+ if (!response.ok)
97
+ throw new Error("Marketplace is unavailable");
98
+ const page = Schema.decodeUnknownSync(Schema.Struct({
99
+ listings: Schema.Array(marketplaceListingSchema).pipe(Schema.check(Schema.isMaxLength(48))),
100
+ }))(await response.json());
101
+ return page.listings;
102
+ }
@@ -0,0 +1,181 @@
1
+ import { type MediaGenerationHandle, type MediaGenerationAttemptHandle, type MediaGenerationReference, type MediaGenerationInput, type MediaGenerationOutcome, type MediaModel } from "./media.js";
2
+ import * as Schema from "effect/Schema";
3
+ declare const RpcTarget: new () => object;
4
+ export { mediaGenerationReferenceSchema } from "./media.js";
5
+ /** Page-local generic JSON method caller. Signals never enter JSON or RPC. */
6
+ export type MediaGenerationJsonCaller = (method: string, input?: Schema.Json, options?: {
7
+ readonly signal?: AbortSignal;
8
+ }) => Promise<Schema.Json | undefined>;
9
+ /** Plain JSON catalog reply, decoded with Agar's Media model grammar. */
10
+ export declare const mediaGenerationDescriptionSchema: Schema.Struct<{
11
+ /** Fixed Computer identity supplied by the host. */
12
+ readonly computerId: Schema.String;
13
+ /** Whether the admitted host permits generation. */
14
+ readonly canGenerate: Schema.Boolean;
15
+ /** Models supplied by the host catalog owner. */
16
+ readonly models: Schema.$Array<Schema.Struct<{
17
+ readonly id: Schema.String;
18
+ readonly input: Schema.Struct<{
19
+ readonly defaultHeight: Schema.Number;
20
+ readonly defaultSteps: Schema.NullOr<Schema.Number>;
21
+ readonly defaultWidth: Schema.Number;
22
+ readonly dimensions: Schema.Literals<readonly ["none", "own"]>;
23
+ readonly maxDimension: Schema.NullOr<Schema.Number>;
24
+ readonly maxReferences: Schema.Number;
25
+ readonly maxSteps: Schema.NullOr<Schema.Number>;
26
+ readonly referenceField: Schema.NullOr<Schema.String>;
27
+ readonly steps: Schema.Literals<readonly ["steps", "num_steps", "fixed"]>;
28
+ readonly transport: Schema.Literals<readonly ["json", "multipart"]>;
29
+ }>;
30
+ readonly kind: Schema.Literals<readonly ["image", "video"]>;
31
+ readonly label: Schema.String;
32
+ readonly tier: Schema.Literals<readonly ["draft", "balanced", "premium", "max"]>;
33
+ readonly outputFormats: Schema.$Array<Schema.Literals<readonly ["png", "jpeg", "webp"]>>;
34
+ readonly sizes: Schema.NullOr<Schema.$Array<Schema.String>>;
35
+ readonly video: Schema.NullOr<Schema.Struct<{
36
+ readonly minSeconds: Schema.Number;
37
+ readonly maxSeconds: Schema.Number;
38
+ readonly defaultSeconds: Schema.Number;
39
+ readonly durations: Schema.$Array<Schema.Number>;
40
+ readonly provider: Schema.Literals<readonly ["seedance", "veo", "minimax"]>;
41
+ readonly formats: Schema.$Array<Schema.Struct<{
42
+ readonly resolution: Schema.Literals<readonly ["480p", "720p", "768p", "1080p", "4k"]>;
43
+ readonly aspectRatio: Schema.Literals<readonly ["16:9", "4:3", "1:1", "3:4", "9:16", "21:9", "9:21"]>;
44
+ readonly width: Schema.Number;
45
+ readonly height: Schema.Number;
46
+ }>>;
47
+ readonly defaultResolution: Schema.Literals<readonly ["480p", "720p", "768p", "1080p", "4k"]>;
48
+ readonly defaultAspectRatio: Schema.Literals<readonly ["16:9", "4:3", "1:1", "3:4", "9:16", "21:9", "9:21"]>;
49
+ readonly defaultGenerateAudio: Schema.NullOr<Schema.Boolean>;
50
+ readonly maxPromptLength: Schema.Number;
51
+ readonly referenceRoles: Schema.$Array<Schema.Literals<readonly ["first-frame", "last-frame", "reference"]>>;
52
+ readonly maxReferenceImages: Schema.Number;
53
+ readonly referenceResolutions: Schema.$Array<Schema.Literals<readonly ["480p", "720p", "768p", "1080p", "4k"]>>;
54
+ readonly prices: Schema.$Array<Schema.Struct<{
55
+ readonly resolution: Schema.Literals<readonly ["480p", "720p", "768p", "1080p", "4k"]>;
56
+ readonly silentMilliunitsPerSecond: Schema.Number;
57
+ readonly audioMilliunitsPerSecond: Schema.Number;
58
+ }>>;
59
+ }>>;
60
+ }>>;
61
+ }>;
62
+ /** A generation call carries paths and a replay ID; the host supplies authority. */
63
+ export declare const mediaGenerationJsonRequestSchema: Schema.Struct<{
64
+ /** Agar-owned image and video selection, including path references. */
65
+ readonly settings: Schema.Struct<{
66
+ readonly model: Schema.String;
67
+ readonly prompt: Schema.String;
68
+ readonly width: Schema.Number;
69
+ readonly height: Schema.Number;
70
+ readonly steps: Schema.optional<Schema.Number>;
71
+ readonly durationSeconds: Schema.optional<Schema.Number>;
72
+ readonly resolution: Schema.optional<Schema.Literals<readonly ["480p", "720p", "768p", "1080p", "4k"]>>;
73
+ readonly aspectRatio: Schema.optional<Schema.Literals<readonly ["16:9", "4:3", "1:1", "3:4", "9:16", "21:9", "9:21"]>>;
74
+ readonly generateAudio: Schema.optional<Schema.Boolean>;
75
+ readonly references: Schema.optional<Schema.$Array<Schema.Struct<{
76
+ readonly path: Schema.String;
77
+ readonly role: Schema.optional<Schema.Literals<readonly ["first-frame", "last-frame", "reference"]>>;
78
+ }>>>;
79
+ }>;
80
+ readonly destination: Schema.Struct<{
81
+ readonly path: Schema.String;
82
+ }>;
83
+ /** Canonical replay identity reused for polling and restoration. */
84
+ readonly requestId: Schema.String;
85
+ }>;
86
+ /** Plain JSON generation input for an admitted capability's generate method. */
87
+ export type MediaGenerationJsonRequest = Schema.Schema.Type<typeof mediaGenerationJsonRequestSchema>;
88
+ /** A typed completion or refusal; no live attempt handles cross this boundary. */
89
+ export declare const mediaGenerationJsonOutcomeSchema: Schema.Union<readonly [Schema.Struct<{
90
+ /** Completed generation. */
91
+ readonly kind: Schema.Literal<"succeeded">;
92
+ /** Retained and saved host result. */
93
+ readonly result: Schema.Struct<{
94
+ readonly [Symbol.dispose]: Schema.optional<Schema.Unknown>;
95
+ readonly bytes: Schema.Number;
96
+ readonly costMilliunits: Schema.Number;
97
+ readonly destination: Schema.Struct<{
98
+ readonly computerId: Schema.String;
99
+ readonly path: Schema.String;
100
+ }>;
101
+ readonly format: Schema.Literals<readonly ["png", "jpeg", "gif", "webp", "mp4"]>;
102
+ readonly height: Schema.Number;
103
+ readonly model: Schema.String;
104
+ readonly width: Schema.Number;
105
+ }>;
106
+ }>, Schema.Struct<{
107
+ /** Refused or failed generation. */
108
+ readonly kind: Schema.Literal<"failed">;
109
+ /** Sanitized failure with truthful retry semantics. */
110
+ readonly failure: Schema.Struct<{
111
+ readonly message: Schema.String;
112
+ readonly stage: Schema.optional<Schema.Literals<readonly ["admission", "generation-authorization", "settings", "estimate", "billing", "operation", "provider", "normalization", "artifact", "destination-authorization", "destination-write"]>>;
113
+ readonly code: Schema.Literals<readonly ["CANCELLED", "CAPABILITY_DENIED", "CAPABILITY_REVOKED", "DISCONNECTED", "HOST_FAILURE", "IDENTITY", "INSUFFICIENT_CREDIT", "INVALID_ARGUMENT", "PROTOCOL", "SAFETY_FILTER_REFUSED", "TIMEOUT"]>;
114
+ readonly retryable: Schema.Boolean;
115
+ }>;
116
+ }>]>;
117
+ /** Generate may also report Agar's canonical, bounded Pending result. */
118
+ export declare const mediaGenerationJsonReplySchema: Schema.Union<readonly [Schema.Union<readonly [Schema.Struct<{
119
+ /** Completed generation. */
120
+ readonly kind: Schema.Literal<"succeeded">;
121
+ /** Retained and saved host result. */
122
+ readonly result: Schema.Struct<{
123
+ readonly [Symbol.dispose]: Schema.optional<Schema.Unknown>;
124
+ readonly bytes: Schema.Number;
125
+ readonly costMilliunits: Schema.Number;
126
+ readonly destination: Schema.Struct<{
127
+ readonly computerId: Schema.String;
128
+ readonly path: Schema.String;
129
+ }>;
130
+ readonly format: Schema.Literals<readonly ["png", "jpeg", "gif", "webp", "mp4"]>;
131
+ readonly height: Schema.Number;
132
+ readonly model: Schema.String;
133
+ readonly width: Schema.Number;
134
+ }>;
135
+ }>, Schema.Struct<{
136
+ /** Refused or failed generation. */
137
+ readonly kind: Schema.Literal<"failed">;
138
+ /** Sanitized failure with truthful retry semantics. */
139
+ readonly failure: Schema.Struct<{
140
+ readonly message: Schema.String;
141
+ readonly stage: Schema.optional<Schema.Literals<readonly ["admission", "generation-authorization", "settings", "estimate", "billing", "operation", "provider", "normalization", "artifact", "destination-authorization", "destination-write"]>>;
142
+ readonly code: Schema.Literals<readonly ["CANCELLED", "CAPABILITY_DENIED", "CAPABILITY_REVOKED", "DISCONNECTED", "HOST_FAILURE", "IDENTITY", "INSUFFICIENT_CREDIT", "INVALID_ARGUMENT", "PROTOCOL", "SAFETY_FILTER_REFUSED", "TIMEOUT"]>;
143
+ readonly retryable: Schema.Boolean;
144
+ }>;
145
+ }>]>, Schema.declare<Readonly<{
146
+ kind: "pending";
147
+ retryAfterMs: number;
148
+ }>, unknown>]>;
149
+ /** JSON generation reply, including the shared Pending owner. */
150
+ export type MediaGenerationJsonReply = Schema.Schema.Type<typeof mediaGenerationJsonReplySchema>;
151
+ /** Catalog and permission snapshot for the handle's fixed Computer. */
152
+ export type MediaGenerationDescription = Readonly<{
153
+ /** Fixed Computer identity. */
154
+ computerId: string;
155
+ /** Host-described permission to start generation. */
156
+ canGenerate: boolean;
157
+ /** The host's catalog, decoded with Agar's Media wire grammar. */
158
+ models: readonly MediaModel[];
159
+ }>;
160
+ /** Page-side Agar handle over an admitted generic JSON method caller. */
161
+ export declare class MediaGeneration extends RpcTarget implements MediaGenerationHandle {
162
+ #private;
163
+ constructor(call: MediaGenerationJsonCaller, computerId: string, signal?: AbortSignal);
164
+ /** Describe this handle's fixed Computer through the admitted JSON method. */
165
+ describe(): Promise<MediaGenerationDescription>;
166
+ /** Issue a canonical replay identity for a new generation attempt. */
167
+ createAttempt(): Promise<MediaGenerationAttempt>;
168
+ /** Resume the original Computer and canonical request without issuing a new ID. */
169
+ restoreAttempt(reference: MediaGenerationReference): Promise<MediaGenerationAttempt>;
170
+ /** Abort every active browser request belonging to this attempt. */
171
+ cancelAttempt(reference: MediaGenerationReference): Promise<void>;
172
+ }
173
+ /** One replayable host-issued Media attempt, sharing cancellation with its handle. */
174
+ export declare class MediaGenerationAttempt extends RpcTarget implements MediaGenerationAttemptHandle {
175
+ #private;
176
+ constructor(call: MediaGenerationJsonCaller, computerId: string, signal: AbortSignal | undefined, requestId: string, activeRequests: Map<string, Set<AbortController>>);
177
+ /** Return the stable Computer and request identity for replay. */
178
+ reference(): Promise<MediaGenerationReference>;
179
+ /** Save through the admitted host; poll pending work with the same replay identity. */
180
+ generate(input: MediaGenerationInput): Promise<MediaGenerationOutcome>;
181
+ }