@fungi.computer/oyster 0.2.0 → 0.3.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.
- package/README.md +396 -72
- package/dist/agents.d.ts +3 -2
- package/dist/agents.js +4 -2
- package/dist/app-builds.d.ts +81 -8
- package/dist/app-builds.js +213 -60
- package/dist/app-storage.d.ts +3 -3
- package/dist/approval-capability.d.ts +5 -0
- package/dist/approval-capability.js +46 -0
- package/dist/approval-home.d.ts +51 -0
- package/dist/approval-home.js +226 -0
- package/dist/apps/catalog.d.ts +335 -0
- package/dist/apps/catalog.js +46 -0
- package/dist/apps/gate.d.ts +20 -6
- package/dist/apps/gate.js +42 -16
- package/dist/apps/index.d.ts +3 -1
- package/dist/apps/index.js +3 -1
- package/dist/apps/installation.d.ts +132 -51
- package/dist/apps/installation.js +176 -70
- package/dist/apps/permissions.d.ts +247 -0
- package/dist/apps/permissions.js +255 -0
- package/dist/boot-capability-route.d.ts +15 -0
- package/dist/boot-capability-route.js +196 -0
- package/dist/boot-capability.d.ts +103 -0
- package/dist/boot-capability.js +141 -0
- package/dist/boot-construction.d.ts +12 -0
- package/dist/boot-construction.js +175 -0
- package/dist/boot-gate.d.ts +267 -0
- package/dist/boot-gate.js +236 -0
- package/dist/boot-host-script.d.ts +2 -0
- package/dist/boot-host-script.js +1 -0
- package/dist/boot-mount.d.ts +21 -0
- package/dist/boot-mount.js +65 -0
- package/dist/browser/boot.d.ts +73 -0
- package/dist/browser/boot.js +502 -0
- package/dist/browser/browser.d.ts +104 -0
- package/dist/browser/browser.js +374 -0
- package/dist/browser/capability-source.d.ts +76 -0
- package/dist/browser/capability-source.js +338 -0
- package/dist/browser/cdp-client.d.ts +56 -0
- package/dist/browser/cdp-client.js +184 -0
- package/dist/browser/errors.d.ts +79 -0
- package/dist/browser/errors.js +32 -0
- package/dist/browser/index.d.ts +16 -0
- package/dist/browser/index.js +14 -0
- package/dist/browser/lease-registry.d.ts +61 -0
- package/dist/browser/lease-registry.js +101 -0
- package/dist/browser/operations.d.ts +225 -0
- package/dist/browser/operations.js +137 -0
- package/dist/browser/page.d.ts +25 -0
- package/dist/browser/page.js +172 -0
- package/dist/browser/quick-reads.d.ts +29 -0
- package/dist/browser/quick-reads.js +160 -0
- package/dist/browser/sessions.d.ts +52 -0
- package/dist/browser/sessions.js +118 -0
- package/dist/browser/url-policy.d.ts +18 -0
- package/dist/browser/url-policy.js +58 -0
- package/dist/build/app-imports.d.ts +12 -0
- package/dist/build/app-imports.js +105 -0
- package/dist/build/build-policy.d.ts +5 -3
- package/dist/build/build-policy.js +5 -3
- package/dist/build/candidate-builder.d.ts +1 -1
- package/dist/build/candidate-cli.mjs +8375 -334
- package/dist/build/local-build.d.ts +2 -0
- package/dist/build/local-build.js +28 -6
- package/dist/build/snapshot-package-store.d.ts +1 -1
- package/dist/build/snapshot-package-store.js +7 -2
- package/dist/build/workspace-build.d.ts +92 -5
- package/dist/build/workspace-build.js +93 -19
- package/dist/build.d.ts +1 -1
- package/dist/build.js +1 -1
- package/dist/catalog-frame.js +1 -1
- package/dist/cloudflare.d.ts +13 -3
- package/dist/cloudflare.js +102 -4
- package/dist/frame-binding-wire-script.js +1 -1
- package/dist/frame-binding-wire.js +4 -2
- package/dist/git-auth.d.ts +0 -2
- package/dist/git-auth.js +0 -2
- package/dist/git.d.ts +0 -1
- package/dist/git.js +0 -2
- package/dist/host.d.ts +39 -13
- package/dist/host.js +268 -142
- package/dist/index.d.ts +25 -15
- package/dist/index.js +39 -16
- package/dist/install-release-cli.d.ts +2 -0
- package/dist/install-release-cli.js +46 -0
- package/dist/installation-client.d.ts +43 -0
- package/dist/installation-client.js +178 -0
- package/dist/installation-execution.d.ts +11 -0
- package/dist/installation-execution.js +184 -0
- package/dist/installation-operations.d.ts +1437 -0
- package/dist/installation-operations.js +664 -0
- package/dist/installation-store-generation.d.ts +3 -0
- package/dist/installation-store-generation.js +16 -0
- package/dist/instance-id.d.ts +10 -0
- package/dist/instance-id.js +10 -0
- package/dist/instance-refusal.d.ts +11 -0
- package/dist/instance-refusal.js +21 -0
- package/dist/internal/delivery.js +4 -2
- package/dist/internal/host-gate.js +7 -1
- package/dist/internal/registry-installations.js +4 -4
- package/dist/keys.d.ts +5 -1
- package/dist/keys.js +10 -2
- package/dist/machine-link/authority.d.ts +89 -0
- package/dist/machine-link/authority.js +37 -0
- package/dist/machine-link/client.d.ts +66 -0
- package/dist/machine-link/client.js +94 -0
- package/dist/machine-link/delivery.d.ts +18 -0
- package/dist/machine-link/delivery.js +55 -0
- package/dist/machine-link/enrollment.d.ts +111 -0
- package/dist/machine-link/enrollment.js +286 -0
- package/dist/machine-link/fences.d.ts +37 -0
- package/dist/machine-link/fences.js +166 -0
- package/dist/machine-link/home.d.ts +20 -0
- package/dist/machine-link/home.js +24 -0
- package/dist/machine-link/host.d.ts +43 -0
- package/dist/machine-link/host.js +189 -0
- package/dist/machine-link/index.d.ts +15 -0
- package/dist/machine-link/index.js +15 -0
- package/dist/machine-link/link.d.ts +48 -0
- package/dist/machine-link/link.js +223 -0
- package/dist/machine-link/presence.d.ts +10 -0
- package/dist/machine-link/presence.js +25 -0
- package/dist/machine-link/workers.d.ts +6 -0
- package/dist/machine-link/workers.js +6 -0
- package/dist/mcp-owner.d.ts +2 -2
- package/dist/mcp-owner.js +41 -33
- package/dist/mcp.d.ts +15 -3
- package/dist/mcp.js +146 -25
- package/dist/older-oyster-store-refusal.d.ts +4 -0
- package/dist/older-oyster-store-refusal.js +18 -0
- package/dist/older-oyster-store.d.ts +21 -0
- package/dist/older-oyster-store.js +43 -0
- package/dist/pack.d.ts +14 -3
- package/dist/pack.js +44 -19
- package/dist/page/app-access.d.ts +7 -0
- package/dist/page/app-access.js +75 -0
- package/dist/page/boot-host.js +57 -0
- package/dist/page/capabilities.d.ts +3 -3
- package/dist/page/capabilities.js +16 -12
- package/dist/page/computer-handles.d.ts +3 -3
- package/dist/page/computer-target.d.ts +3 -0
- package/dist/page/computer-target.js +9 -0
- package/dist/page/mount.d.ts +23 -3
- package/dist/page/mount.js +152 -16
- package/dist/page-assets.d.ts +22 -0
- package/dist/page-assets.js +28 -0
- package/dist/page-script.d.ts +3 -0
- package/dist/page-script.js +5 -4
- package/dist/release.d.ts +13 -6
- package/dist/release.js +10 -7
- package/dist/root-data.d.ts +16 -6
- package/dist/root-data.js +2 -2
- package/dist/source/index.d.ts +1 -1
- package/dist/source/team-source.d.ts +20 -8
- package/dist/source/team-source.js +39 -10
- package/dist/source/template-seed.d.ts +2 -2
- package/dist/standalone/agent-mail.d.ts +24 -0
- package/dist/standalone/agent-mail.js +62 -0
- package/dist/standalone/agent-store.d.ts +9 -0
- package/dist/standalone/agent-store.js +30 -0
- package/dist/standalone/agents.d.ts +68 -9
- package/dist/standalone/agents.js +428 -56
- package/dist/standalone/app-builds-binding.d.ts +20 -2
- package/dist/standalone/app-builds-binding.js +147 -23
- package/dist/standalone/app-set.d.ts +5 -2
- package/dist/standalone/app-set.js +186 -144
- package/dist/standalone/browser.d.ts +11 -0
- package/dist/standalone/browser.js +72 -0
- package/dist/standalone/builds.d.ts +13 -4
- package/dist/standalone/builds.js +28 -44
- package/dist/standalone/computer-egress.d.ts +2 -0
- package/dist/standalone/computer-egress.js +13 -4
- package/dist/standalone/computer-fleet.d.ts +43 -0
- package/dist/standalone/computer-fleet.js +200 -0
- package/dist/standalone/computer.d.ts +44 -9
- package/dist/standalone/computer.js +129 -22
- package/dist/standalone/install-apps-cli.js +43 -6
- package/dist/standalone/instance.d.ts +2 -2
- package/dist/standalone/instance.js +8 -11
- package/dist/standalone/machine-link.d.ts +354 -0
- package/dist/standalone/machine-link.js +368 -0
- package/dist/standalone/media.d.ts +2 -2
- package/dist/standalone/media.js +19 -16
- package/dist/standalone/preview.d.ts +2 -2
- package/dist/standalone/preview.js +37 -10
- package/dist/standalone/registry.d.ts +151 -9
- package/dist/standalone/registry.js +305 -8
- package/dist/standalone/worker.d.ts +19 -5
- package/dist/standalone/worker.js +90 -54
- package/dist/standalone/workflow-binding.d.ts +18 -22
- package/dist/standalone/workflow-binding.js +18 -18
- package/dist/standalone/workflow-control.d.ts +4 -0
- package/dist/standalone/workflow-control.js +40 -0
- package/dist/standalone/workflow-events.d.ts +2 -2
- package/dist/standalone/workflow-events.js +9 -10
- package/dist/standalone/workflow-git-capture.js +4 -3
- package/dist/standalone/workflow-host.d.ts +162 -161
- package/dist/standalone/workflow-host.js +101 -21
- package/dist/standalone/workflow-node-capture.js +11 -4
- package/dist/standalone/workflow-schedules.d.ts +5 -2
- package/dist/standalone/workflow-schedules.js +9 -10
- package/dist/standalone/workflow-trigger-host.d.ts +65 -5
- package/dist/standalone/workflow-trigger-host.js +2 -2
- package/dist/standalone/workflow-webhooks.d.ts +22 -0
- package/dist/standalone/workflow-webhooks.js +39 -0
- package/dist/standalone/workflows.d.ts +140 -43
- package/dist/standalone/workflows.js +198 -39
- package/dist/storage-frame.d.ts +6 -6
- package/dist/testing/capabilities.js +14 -3
- package/dist/testing/installation.js +26 -2
- package/dist/testing/worker.js +1 -1
- package/dist/testing/workers-runtime.d.ts +8 -2
- package/dist/testing/workers-runtime.js +20 -2
- package/dist/webhook-abuse.d.ts +25 -0
- package/dist/webhook-abuse.js +54 -0
- package/dist/webhook-custody.d.ts +144 -0
- package/dist/webhook-custody.js +222 -0
- package/dist/webhook-ingress.d.ts +36 -0
- package/dist/webhook-ingress.js +146 -0
- package/dist/webhooks.d.ts +111 -0
- package/dist/webhooks.js +189 -0
- package/dist/workers-git.d.ts +12 -17
- package/dist/workers-git.js +64 -52
- package/dist/workers.d.ts +226 -13
- package/dist/workers.js +363 -51
- package/dist/workflow-agent-authority.d.ts +8 -0
- package/dist/workflow-agent-authority.js +42 -0
- package/dist/workflows.d.ts +66 -0
- package/dist/workflows.js +97 -0
- package/docs/api/README.md +63 -37
- package/docs/api/agents.md +17 -0
- package/docs/api/app-storage.md +1 -1
- package/docs/api/apps.md +1394 -543
- package/docs/api/browser/boot.md +132 -0
- package/docs/api/browser.md +1440 -0
- package/docs/api/build-contract.md +38 -25
- package/docs/api/build.md +263 -84
- package/docs/api/cloudflare.md +93 -7
- package/docs/api/git.md +3 -13
- package/docs/api/host.md +944 -118
- package/docs/api/index.md +320 -18
- package/docs/api/keys.md +24 -1
- package/docs/api/mcp.md +59 -12
- package/docs/api/modules.md +33 -40
- package/docs/api/pack.md +57 -8
- package/docs/api/page/mount.md +92 -4
- package/docs/api/workers-git.md +103 -24
- package/docs/api/workers.md +1594 -244
- package/docs/site/agent-quickstart.mdx +28 -14
- package/examples/standalone/worker.ts +3 -1
- package/examples/standalone/wrangler.jsonc +2 -0
- package/package.json +73 -71
- package/dist/installation-consent.d.ts +0 -81
- package/dist/installation-consent.js +0 -84
- package/dist/shell/app-directory.d.ts +0 -542
- package/dist/shell/app-directory.js +0 -196
- package/dist/shell/browser-actions.d.ts +0 -7
- package/dist/shell/browser-actions.js +0 -56
- package/dist/shell/command-host.d.ts +0 -112
- package/dist/shell/command-host.js +0 -502
- package/dist/shell/commands.d.ts +0 -25
- package/dist/shell/commands.js +0 -78
- package/dist/shell/index.d.ts +0 -8
- package/dist/shell/index.js +0 -8
- package/dist/shell/keys.d.ts +0 -41
- package/dist/shell/keys.js +0 -134
- package/dist/shell/shell-module.d.ts +0 -55
- package/dist/shell/shell-module.js +0 -86
- package/dist/shell/window-manager.d.ts +0 -128
- package/dist/shell/window-manager.js +0 -730
- package/dist/shell/workbench-contract.d.ts +0 -68
- package/dist/shell/workbench-directory.d.ts +0 -332
- package/dist/shell/workbench-directory.js +0 -35
- package/dist/shell/workbench-host-types.d.ts +0 -96
- package/dist/shell/workbench-host-types.js +0 -1
- package/dist/shell/workbench-host.d.ts +0 -34
- package/dist/shell/workbench-host.js +0 -352
- package/dist/shell/workbench-model.d.ts +0 -194
- package/dist/shell/workbench-model.js +0 -53
- package/dist/shell/workbench.d.ts +0 -4
- package/dist/shell/workbench.js +0 -2
- package/docs/api/shell/app-directory.md +0 -599
- package/docs/api/shell/command-host.md +0 -224
- package/docs/api/shell/commands.md +0 -197
- package/docs/api/shell/keys.md +0 -183
- package/docs/api/shell/shell-module.md +0 -204
- package/docs/api/shell/window-manager.md +0 -267
- package/docs/api/shell/workbench-directory.md +0 -119
- package/docs/api/shell/workbench.md +0 -205
- package/docs/api/shell.md +0 -1915
- /package/dist/{shell/workbench-contract.js → page/boot-host.d.ts} +0 -0
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
import * as Schema from "effect/Schema";
|
|
2
|
-
import { appDeclaredCommandSchema, appCallsSchema, } from "@fungi.computer/puffball/app";
|
|
3
|
-
import { appDeclaredGillSchema, appGillParamsSchema, } from "@fungi.computer/gills";
|
|
4
|
-
import * as z from "zod";
|
|
5
|
-
/** An App address selects a host default or a specific installation. */
|
|
6
|
-
export const appAddressSchema = z.lazy(() => z.union([
|
|
7
|
-
z.strictObject({
|
|
8
|
-
kind: z.literal("default"),
|
|
9
|
-
appId: z.string().min(1),
|
|
10
|
-
}),
|
|
11
|
-
z.strictObject({
|
|
12
|
-
kind: z.literal("installation"),
|
|
13
|
-
installationId: z.string().min(1),
|
|
14
|
-
}),
|
|
15
|
-
]));
|
|
16
|
-
/** Host-reported progress of applying a revised App authority version. */
|
|
17
|
-
export const appAuthorityEnforcementSchema = z.lazy(() => z.strictObject({
|
|
18
|
-
requestId: z.string().min(1),
|
|
19
|
-
address: appAddressSchema,
|
|
20
|
-
authorityVersion: z.number().int().positive(),
|
|
21
|
-
state: z.enum(["unaffected", "pending", "applied", "expired"]),
|
|
22
|
-
outstanding: z.number().int().nonnegative(),
|
|
23
|
-
}));
|
|
24
|
-
/** Stable identity of one App address across directory and settings views. */
|
|
25
|
-
export const addressKey = (address) => address.kind === "default"
|
|
26
|
-
? `default:${address.appId}`
|
|
27
|
-
: `installation:${address.installationId}`;
|
|
28
|
-
/** Reusable App metadata supplied by an embedding host; it conveys no permissions. */
|
|
29
|
-
export const appDirectoryEntrySchema = z.strictObject({
|
|
30
|
-
address: appAddressSchema,
|
|
31
|
-
installationId: z.string().min(1).nullable(),
|
|
32
|
-
surfaceId: z.string().min(1),
|
|
33
|
-
appId: z.string().min(1),
|
|
34
|
-
displayName: z.string().trim().min(1).optional(),
|
|
35
|
-
icon: z.string().min(1).nullable().optional(),
|
|
36
|
-
releaseId: z.string().min(1).nullable(),
|
|
37
|
-
authorityVersion: z.number().int().nonnegative(),
|
|
38
|
-
enforcement: appAuthorityEnforcementSchema.nullable(),
|
|
39
|
-
handlers: z.array(z.literal("file.open")),
|
|
40
|
-
roles: z.array(z.string().min(1)),
|
|
41
|
-
/** Capabilities the Release declares: the ceiling for host consent, never a grant. */
|
|
42
|
-
declaredCapabilities: z.array(z.string().min(1)),
|
|
43
|
-
calls: z
|
|
44
|
-
.unknown()
|
|
45
|
-
.transform((value) => Schema.decodeUnknownSync(appCallsSchema)(value))
|
|
46
|
-
.optional(),
|
|
47
|
-
commands: z
|
|
48
|
-
.array(z.unknown())
|
|
49
|
-
.transform((values) => values.map((value) => Schema.decodeUnknownSync(appDeclaredCommandSchema)(value))),
|
|
50
|
-
gills: z.array(z.unknown()).transform((values) => values.map((value) => Schema.decodeUnknownSync(appDeclaredGillSchema, {
|
|
51
|
-
onExcessProperty: "error",
|
|
52
|
-
})(value))),
|
|
53
|
-
availability: z.enum(["available", "unavailable"]),
|
|
54
|
-
surface: z
|
|
55
|
-
.strictObject({
|
|
56
|
-
stableRoute: z.string().min(1),
|
|
57
|
-
})
|
|
58
|
-
.nullable(),
|
|
59
|
-
surfacePath: z.string().startsWith("/"),
|
|
60
|
-
});
|
|
61
|
-
/** A host-resolved role selection; a surface address is not launch authority. */
|
|
62
|
-
export const appRoleSelectionSchema = z.strictObject({
|
|
63
|
-
surfaceId: z.string().min(1).nullable(),
|
|
64
|
-
chosen: z.boolean(),
|
|
65
|
-
});
|
|
66
|
-
const appComputerOperationSchema = z.enum([
|
|
67
|
-
"computer.list",
|
|
68
|
-
"computer.readFile",
|
|
69
|
-
"computer.writeFile",
|
|
70
|
-
"computer.execute",
|
|
71
|
-
]);
|
|
72
|
-
const selectedComputerPermissionSchema = z.lazy(() => z.strictObject({
|
|
73
|
-
kind: z.literal("selected-computers"),
|
|
74
|
-
computers: z.array(z.strictObject({
|
|
75
|
-
computerId: z.string().min(1),
|
|
76
|
-
operations: z.array(appComputerOperationSchema),
|
|
77
|
-
})),
|
|
78
|
-
}));
|
|
79
|
-
const allTeamComputersPermissionSchema = z.lazy(() => z.strictObject({
|
|
80
|
-
kind: z.literal("all-team-computers"),
|
|
81
|
-
operations: z.array(appComputerOperationSchema),
|
|
82
|
-
}));
|
|
83
|
-
/** App Computer permissions limited to selected Computers or the Team's Computers. */
|
|
84
|
-
export const appComputerPermissionSchema = z.discriminatedUnion("kind", [
|
|
85
|
-
selectedComputerPermissionSchema,
|
|
86
|
-
allTeamComputersPermissionSchema,
|
|
87
|
-
]);
|
|
88
|
-
const agentDirectoryOperationSchema = z.enum(["agent.list"]);
|
|
89
|
-
const agentSessionOperationSchema = z.enum([
|
|
90
|
-
"agent.read",
|
|
91
|
-
"agent.send",
|
|
92
|
-
"agent.manage",
|
|
93
|
-
]);
|
|
94
|
-
/** Agent directory and session operations an App may request from its host. */
|
|
95
|
-
export const appAgentPermissionSchema = z.discriminatedUnion("kind", [
|
|
96
|
-
z.strictObject({
|
|
97
|
-
kind: z.literal("all-team-agents"),
|
|
98
|
-
directoryOperations: z.array(agentDirectoryOperationSchema),
|
|
99
|
-
sessionOperations: z.array(agentSessionOperationSchema),
|
|
100
|
-
}),
|
|
101
|
-
z.strictObject({
|
|
102
|
-
kind: z.literal("selected-agents"),
|
|
103
|
-
directoryOperations: z.array(agentDirectoryOperationSchema),
|
|
104
|
-
agents: z.array(z.strictObject({
|
|
105
|
-
agentId: z.string().min(1).max(256),
|
|
106
|
-
sessionOperations: z.array(agentSessionOperationSchema),
|
|
107
|
-
})),
|
|
108
|
-
}),
|
|
109
|
-
]);
|
|
110
|
-
/** Whether an App may use language-model and media generation services. */
|
|
111
|
-
export const appGenerationPermissionsSchema = z.strictObject({
|
|
112
|
-
llm: z.boolean(),
|
|
113
|
-
media: z.boolean(),
|
|
114
|
-
});
|
|
115
|
-
/** Whether an App may browse, buy, or install free marketplace entries. */
|
|
116
|
-
export const appMarketplacePermissionsSchema = z.strictObject({
|
|
117
|
-
browse: z.boolean(),
|
|
118
|
-
purchase: z.boolean(),
|
|
119
|
-
installFree: z.boolean(),
|
|
120
|
-
});
|
|
121
|
-
/**
|
|
122
|
-
* A host's Team App directory with its permission projection, parsed strictly
|
|
123
|
-
* by every consumer: an unknown field is a contract change both sides make.
|
|
124
|
-
*/
|
|
125
|
-
export const appDirectoryResponseSchema = z.lazy(() => z.strictObject({
|
|
126
|
-
actorIsTeamOwner: z.boolean(),
|
|
127
|
-
needsUpdate: z
|
|
128
|
-
.array(z.strictObject({
|
|
129
|
-
installationId: z.string().min(1).nullable(),
|
|
130
|
-
appId: z.string().min(1).nullable(),
|
|
131
|
-
displayName: z.string().min(1),
|
|
132
|
-
}))
|
|
133
|
-
.optional(),
|
|
134
|
-
apps: z.array(appDirectoryEntrySchema.extend({
|
|
135
|
-
override: z
|
|
136
|
-
.strictObject({
|
|
137
|
-
appId: z.string().min(1).optional(),
|
|
138
|
-
releaseId: z.string().min(1),
|
|
139
|
-
surfaceRoute: z.string().min(1).nullable(),
|
|
140
|
-
})
|
|
141
|
-
.nullable(),
|
|
142
|
-
grants: z.array(z.strictObject({
|
|
143
|
-
operation: z.string().min(1),
|
|
144
|
-
resourceId: z.string().min(1),
|
|
145
|
-
})),
|
|
146
|
-
computerPermission: appComputerPermissionSchema.nullable().optional(),
|
|
147
|
-
generationPermissions: appGenerationPermissionsSchema,
|
|
148
|
-
marketplacePermissions: appMarketplacePermissionsSchema,
|
|
149
|
-
agentPermission: appAgentPermissionSchema,
|
|
150
|
-
})),
|
|
151
|
-
/** The Team's effective App per role, owned and resolved by the host. */
|
|
152
|
-
roles: z.record(z.string().min(1), appRoleSelectionSchema),
|
|
153
|
-
}));
|
|
154
|
-
/** Desktop metadata is a method result, distinct from the full Release Gill declaration. */
|
|
155
|
-
const catalogGillParamsSchema = z.lazy(() => z
|
|
156
|
-
.array(z.strictObject({
|
|
157
|
-
key: z.string().max(64),
|
|
158
|
-
label: z.string().max(256),
|
|
159
|
-
kind: z.enum(["computer", "repository", "branch"]),
|
|
160
|
-
required: z.boolean(),
|
|
161
|
-
options: z.string().max(256).optional(),
|
|
162
|
-
}))
|
|
163
|
-
.max(4)
|
|
164
|
-
// The wire shape is representable; Gill owns its domain refinements.
|
|
165
|
-
.refine(Schema.is(appGillParamsSchema), "Invalid Gill placement parameters"));
|
|
166
|
-
const catalogGillSchema = z.strictObject({
|
|
167
|
-
id: z.string().trim().min(1).max(256),
|
|
168
|
-
title: z.string().trim().min(1).max(256),
|
|
169
|
-
params: catalogGillParamsSchema.optional(),
|
|
170
|
-
desktop: z
|
|
171
|
-
.strictObject({
|
|
172
|
-
sizes: z
|
|
173
|
-
.array(z.enum(["S", "M", "L"]))
|
|
174
|
-
.min(1)
|
|
175
|
-
.max(3)
|
|
176
|
-
.refine((sizes) => new Set(sizes).size === sizes.length, "Repeated Gill size"),
|
|
177
|
-
})
|
|
178
|
-
.optional(),
|
|
179
|
-
});
|
|
180
|
-
/** Read-only catalog metadata for one App, without host-specific role policy. */
|
|
181
|
-
export const appCatalogEntrySchema = appDirectoryEntrySchema
|
|
182
|
-
.pick({
|
|
183
|
-
surfaceId: true,
|
|
184
|
-
appId: true,
|
|
185
|
-
displayName: true,
|
|
186
|
-
})
|
|
187
|
-
.extend({ gills: z.array(catalogGillSchema).max(16) });
|
|
188
|
-
/** Read-only desktop metadata; identities are surface addresses, never launch authority. */
|
|
189
|
-
export const appCatalogResponseSchema = z.lazy(() => z.strictObject({
|
|
190
|
-
apps: z.array(appCatalogEntrySchema).max(50),
|
|
191
|
-
roles: z.strictObject({
|
|
192
|
-
inbox: appRoleSelectionSchema.optional(),
|
|
193
|
-
}),
|
|
194
|
-
}));
|
|
195
|
-
/** Complete APPS.catalog reply, including broker admission failures. */
|
|
196
|
-
export const appCatalogBrokerResultSchema = z.lazy(() => z.union([appCatalogResponseSchema, z.strictObject({ error: z.string() })]));
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { AppBrowserAction, AppBrowserActionOutcome } from "@fungi.computer/agar";
|
|
2
|
-
/** Browser effects stay in the trusted host, bound to one mounted App frame. */
|
|
3
|
-
export declare function createBrowserActionHandler(options: {
|
|
4
|
-
frame: HTMLIFrameElement;
|
|
5
|
-
hostWindow: Window;
|
|
6
|
-
signal: AbortSignal;
|
|
7
|
-
}): (request: AppBrowserAction) => Promise<AppBrowserActionOutcome>;
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { APP_BROWSER_SAVE_MAX_BYTES, APP_BROWSER_COPY_MAX_BYTES, } from "@fungi.computer/agar";
|
|
2
|
-
/** Browser effects stay in the trusted host, bound to one mounted App frame. */
|
|
3
|
-
export function createBrowserActionHandler(options) {
|
|
4
|
-
let pending = false;
|
|
5
|
-
return async (request) => {
|
|
6
|
-
const { frame, hostWindow, signal } = options;
|
|
7
|
-
if (signal.aborted || !frame.isConnected)
|
|
8
|
-
return { kind: "refused", reason: "unavailable" };
|
|
9
|
-
if (!hostWindow.navigator.userActivation.isActive ||
|
|
10
|
-
hostWindow.document.activeElement !== frame)
|
|
11
|
-
return { kind: "refused", reason: "no-user-gesture" };
|
|
12
|
-
if (request.kind === "saveFile"
|
|
13
|
-
? request.bytes.byteLength > APP_BROWSER_SAVE_MAX_BYTES
|
|
14
|
-
: new TextEncoder().encode(request.text).byteLength >
|
|
15
|
-
APP_BROWSER_COPY_MAX_BYTES)
|
|
16
|
-
return { kind: "refused", reason: "too-large" };
|
|
17
|
-
if (pending)
|
|
18
|
-
return { kind: "refused", reason: "busy" };
|
|
19
|
-
pending = true;
|
|
20
|
-
try {
|
|
21
|
-
if (request.kind === "copyText") {
|
|
22
|
-
await hostWindow.navigator.clipboard.writeText(request.text);
|
|
23
|
-
return { kind: "copied" };
|
|
24
|
-
}
|
|
25
|
-
const blob = new Blob([new Uint8Array(request.bytes)], {
|
|
26
|
-
type: request.mime,
|
|
27
|
-
});
|
|
28
|
-
const url = URL.createObjectURL(blob);
|
|
29
|
-
try {
|
|
30
|
-
const link = hostWindow.document.createElement("a");
|
|
31
|
-
link.href = url;
|
|
32
|
-
link.download = request.name;
|
|
33
|
-
link.click();
|
|
34
|
-
}
|
|
35
|
-
finally {
|
|
36
|
-
// Keep the bytes alive until the browser handles the navigation task.
|
|
37
|
-
hostWindow.setTimeout(() => {
|
|
38
|
-
URL.revokeObjectURL(url);
|
|
39
|
-
}, 0);
|
|
40
|
-
}
|
|
41
|
-
// The browser accepted a download; this does not attest a disk write.
|
|
42
|
-
return { kind: "saved" };
|
|
43
|
-
}
|
|
44
|
-
catch (cause) {
|
|
45
|
-
return {
|
|
46
|
-
kind: "refused",
|
|
47
|
-
reason: cause instanceof DOMException && cause.name === "NotAllowedError"
|
|
48
|
-
? "denied"
|
|
49
|
-
: "unavailable",
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
finally {
|
|
53
|
-
pending = false;
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
}
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
/** An optional field a declaration may carry as explicitly undefined. */
|
|
2
|
-
export type AppCommandOptional<T> = T | undefined;
|
|
3
|
-
/**
|
|
4
|
-
* The digest-covered command rows a mounted App's Release declares, as the
|
|
5
|
-
* host receives them. Oyster compares and projects them; the Release
|
|
6
|
-
* declaration grammar stays with its owner, which hands rows of this shape.
|
|
7
|
-
*/
|
|
8
|
-
export type AppCommandDeclaration = Readonly<{
|
|
9
|
-
id: string;
|
|
10
|
-
title: string;
|
|
11
|
-
category: string;
|
|
12
|
-
description?: AppCommandOptional<string>;
|
|
13
|
-
projections?: AppCommandOptional<Readonly<{
|
|
14
|
-
bindings?: AppCommandOptional<Readonly<{
|
|
15
|
-
order?: AppCommandOptional<number>;
|
|
16
|
-
values: readonly string[];
|
|
17
|
-
}>>;
|
|
18
|
-
agent?: AppCommandOptional<Readonly<{
|
|
19
|
-
order?: AppCommandOptional<number>;
|
|
20
|
-
keybind?: AppCommandOptional<string>;
|
|
21
|
-
}>>;
|
|
22
|
-
help?: AppCommandOptional<Readonly<{
|
|
23
|
-
order?: AppCommandOptional<number>;
|
|
24
|
-
}>>;
|
|
25
|
-
menu?: AppCommandOptional<Readonly<{
|
|
26
|
-
order?: AppCommandOptional<number>;
|
|
27
|
-
}>>;
|
|
28
|
-
palette?: AppCommandOptional<Readonly<{
|
|
29
|
-
order?: AppCommandOptional<number>;
|
|
30
|
-
}>>;
|
|
31
|
-
slash?: AppCommandOptional<Readonly<{
|
|
32
|
-
order?: AppCommandOptional<number>;
|
|
33
|
-
aliases: readonly string[];
|
|
34
|
-
}>>;
|
|
35
|
-
}>>;
|
|
36
|
-
}>;
|
|
37
|
-
import type { AppHostHandlers, AppHostReservedChord } from "@fungi.computer/agar/host";
|
|
38
|
-
import { type WhistleExecutionInput, type WhistleExecutionOutcome, type WhistleContributionLease, type WhistleCommand, type WhistleMenuProjection, type WhistleRuntime, type WhistleSnapshot } from "@fungi.computer/whistle";
|
|
39
|
-
/** Select the shell command-palette chord for a Mac or non-Mac keyboard. */
|
|
40
|
-
export declare function commandPaletteReservedChordForPlatform(mac: boolean): AppHostReservedChord;
|
|
41
|
-
/** Select the shell command-palette chord from the embedding browser user agent. */
|
|
42
|
-
export declare function commandPaletteReservedChordForUserAgent(userAgent: string): AppHostReservedChord;
|
|
43
|
-
/** Whistle source of Release-advertised rows for Apps not yet mounted. */
|
|
44
|
-
export declare const appDirectorySourceId = "app-directory";
|
|
45
|
-
/** The command side of one mounted App's host handlers. */
|
|
46
|
-
export type AppSurfaceCommandMount = Readonly<{
|
|
47
|
-
/** The narrow handler shape consumed by Agar's App host connection. */
|
|
48
|
-
readonly handlers: Pick<AppHostHandlers, "registerCommands" | "invokeReservedChord">;
|
|
49
|
-
/** Release this App's contribution and its mount identity. */
|
|
50
|
-
readonly dispose: () => void;
|
|
51
|
-
}>;
|
|
52
|
-
/** Commands owned by one pane, projected to globals plus its focus scope. */
|
|
53
|
-
export type PaneCommands = Readonly<{
|
|
54
|
-
/** Qualify a locally contributed id in this pane's own namespace. */
|
|
55
|
-
commandId: (id: string) => string;
|
|
56
|
-
/** Contribute or replace commands owned by this pane through the returned lease. */
|
|
57
|
-
contribute: (commands: readonly WhistleCommand<never>[]) => WhistleContributionLease;
|
|
58
|
-
execute: WhistleRuntime["execute"];
|
|
59
|
-
snapshot: WhistleRuntime["snapshot"];
|
|
60
|
-
subscribe: WhistleRuntime["subscribe"];
|
|
61
|
-
/** Registered locally; only the focused pane presents human executions. */
|
|
62
|
-
present: WhistleRuntime["present"];
|
|
63
|
-
}>;
|
|
64
|
-
/** Closing a pane withdraws all its leases, presenters and subscriptions. */
|
|
65
|
-
export type PaneCommandMount = PaneCommands & Readonly<{
|
|
66
|
-
/** Withdraw this pane's contributions, presenters and subscriptions. */
|
|
67
|
-
dispose: () => void;
|
|
68
|
-
}>;
|
|
69
|
-
/** The shell-owned Whistle graph and its focused menu projection. */
|
|
70
|
-
export type AppSurfaceCommandHost = Readonly<{
|
|
71
|
-
/** Create the command scope for one locally rendered pane. */
|
|
72
|
-
readonly mountPane: (paneId: string) => PaneCommandMount;
|
|
73
|
-
/** Create one command admission scope for a mounted App. */
|
|
74
|
-
readonly mount: (mountId: string, declarations: readonly AppCommandDeclaration[]) => AppSurfaceCommandMount;
|
|
75
|
-
/** Select the App or pane whose commands are the active human-facing ones. */
|
|
76
|
-
readonly focus: (mountId: string | null) => void;
|
|
77
|
-
/** Register the shell's own global commands in the shared Whistle graph. */
|
|
78
|
-
readonly registerShellCommands: (commands: readonly WhistleCommand<never>[]) => () => void;
|
|
79
|
-
/** Publish verified Release command rows before their App is mounted. */
|
|
80
|
-
readonly registerDirectoryCommands: (commands: readonly Readonly<{
|
|
81
|
-
surfaceId: string;
|
|
82
|
-
appTitle: string;
|
|
83
|
-
command: AppCommandDeclaration;
|
|
84
|
-
}>[], run: (surfaceId: string, commandId: string) => Promise<void>) => () => void;
|
|
85
|
-
/** Read the menu rows belonging to the focused App. */
|
|
86
|
-
readonly menu: () => readonly WhistleMenuProjection[];
|
|
87
|
-
/**
|
|
88
|
-
* The human-facing commands for the current focus: shell rows plus the
|
|
89
|
-
* focused mount's rows, with its aliases and keys shadowing the shell's.
|
|
90
|
-
*/
|
|
91
|
-
readonly active: () => WhistleSnapshot;
|
|
92
|
-
/** Execute an active row, an agent row, or an exact programmatic action. */
|
|
93
|
-
readonly execute: (commandId: string, input: WhistleExecutionInput) => Promise<WhistleExecutionOutcome>;
|
|
94
|
-
/** Read the complete renderer-neutral graph for host consumers. */
|
|
95
|
-
readonly snapshot: () => WhistleSnapshot;
|
|
96
|
-
/** Observe graph changes, including contribution replacement and disposal. */
|
|
97
|
-
readonly subscribe: (listener: () => void) => () => void;
|
|
98
|
-
/** Dispose all App contributions and close the shell runtime. */
|
|
99
|
-
readonly dispose: () => void;
|
|
100
|
-
}>;
|
|
101
|
-
/**
|
|
102
|
-
* Own one shell's Whistle runtime for mounted Apps and local panes. The
|
|
103
|
-
* embedding host supplies verified Release declarations and decides which
|
|
104
|
-
* App or pane has focus.
|
|
105
|
-
*
|
|
106
|
-
* Agar invokes `registerCommands` once for the aggregate command set of a
|
|
107
|
-
* mount. The adapter keeps that aggregate as one Whistle generation, so an
|
|
108
|
-
* Agar update replaces the generation atomically and disposal releases only
|
|
109
|
-
* that App. Command handlers remain the App's callback; the shell only adds
|
|
110
|
-
* the Whistle identity and routes focused menu execution to it.
|
|
111
|
-
*/
|
|
112
|
-
export declare function createAppSurfaceCommandHost(whistle?: WhistleRuntime): AppSurfaceCommandHost;
|