@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.
- package/LICENSE +21 -0
- package/README.md +766 -2
- package/dist/agent-message-meta.d.ts +74 -0
- package/dist/agent-message-meta.js +63 -0
- package/dist/agents.d.ts +170 -0
- package/dist/agents.js +218 -0
- package/dist/app-build-contract.d.ts +43 -0
- package/dist/app-build-contract.js +24 -0
- package/dist/apps.d.ts +66 -0
- package/dist/apps.js +47 -0
- package/dist/backend-declaration.d.ts +6 -0
- package/dist/backend-declaration.js +65 -0
- package/dist/backend-definition.d.ts +88 -0
- package/dist/backend-definition.js +158 -0
- package/dist/backend-refusal.d.ts +10 -0
- package/dist/backend-refusal.js +10 -0
- package/dist/backend.d.ts +30 -0
- package/dist/backend.js +28 -0
- package/dist/capabilities.d.ts +30 -0
- package/dist/capabilities.js +50 -0
- package/dist/channels.d.ts +142 -0
- package/dist/channels.js +97 -0
- package/dist/commands.d.ts +33 -0
- package/dist/commands.js +46 -0
- package/dist/computer-contracts.d.ts +73 -0
- package/dist/computer-contracts.js +57 -0
- package/dist/computer.d.ts +294 -0
- package/dist/computer.js +319 -0
- package/dist/connect.d.ts +11 -0
- package/dist/connect.js +211 -0
- package/dist/errors.d.ts +34 -0
- package/dist/errors.js +106 -0
- package/dist/failure.d.ts +2 -0
- package/dist/failure.js +9 -0
- package/dist/files.d.ts +25 -0
- package/dist/files.js +84 -0
- package/dist/game-servers.d.ts +530 -0
- package/dist/game-servers.js +244 -0
- package/dist/gills.d.ts +43 -0
- package/dist/gills.js +174 -0
- package/dist/git-commit.d.ts +143 -0
- package/dist/git-commit.js +251 -0
- package/dist/git-rpc.d.ts +310 -0
- package/dist/git-rpc.js +166 -0
- package/dist/git-steps.d.ts +579 -0
- package/dist/git-steps.js +804 -0
- package/dist/git-wire.d.ts +33 -0
- package/dist/git-wire.js +240 -0
- package/dist/git.d.ts +322 -0
- package/dist/git.js +98 -0
- package/dist/host.d.ts +97 -0
- package/dist/host.js +732 -0
- package/dist/inbox.d.ts +99 -0
- package/dist/inbox.js +184 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.js +15 -0
- package/dist/inference.d.ts +17 -0
- package/dist/inference.js +115 -0
- package/dist/internal/app-error.d.ts +8 -0
- package/dist/internal/app-error.js +36 -0
- package/dist/internal/app-session.d.ts +8 -0
- package/dist/internal/app-session.js +551 -0
- package/dist/internal/back-inputs.d.ts +22 -0
- package/dist/internal/back-inputs.js +93 -0
- package/dist/internal/browser-bridge.d.ts +30 -0
- package/dist/internal/browser-bridge.js +203 -0
- package/dist/internal/capabilities.d.ts +13 -0
- package/dist/internal/capabilities.js +138 -0
- package/dist/internal/commands.d.ts +9 -0
- package/dist/internal/commands.js +257 -0
- package/dist/internal/disconnect-host.d.ts +7 -0
- package/dist/internal/disconnect-host.js +19 -0
- package/dist/internal/git-edit-tree.d.ts +6 -0
- package/dist/internal/git-edit-tree.js +46 -0
- package/dist/internal/memory-fs.d.ts +39 -0
- package/dist/internal/memory-fs.js +154 -0
- package/dist/internal/protocol.d.ts +116 -0
- package/dist/internal/protocol.js +6 -0
- package/dist/internal/query-feed.d.ts +23 -0
- package/dist/internal/query-feed.js +111 -0
- package/dist/internal/result.d.ts +22 -0
- package/dist/internal/result.js +61 -0
- package/dist/internal/rpc-contract.d.ts +24 -0
- package/dist/internal/rpc-contract.js +78 -0
- package/dist/internal/schemas.d.ts +307 -0
- package/dist/internal/schemas.js +524 -0
- package/dist/internal/store.d.ts +8 -0
- package/dist/internal/store.js +30 -0
- package/dist/internal/terminal-gate.d.ts +17 -0
- package/dist/internal/terminal-gate.js +94 -0
- package/dist/lifecycle.d.ts +44 -0
- package/dist/lifecycle.js +1 -0
- package/dist/marketplace.d.ts +159 -0
- package/dist/marketplace.js +102 -0
- package/dist/media-json.d.ts +181 -0
- package/dist/media-json.js +204 -0
- package/dist/media-library.d.ts +11 -0
- package/dist/media-library.js +15 -0
- package/dist/media-request-id.d.ts +7 -0
- package/dist/media-request-id.js +16 -0
- package/dist/media.d.ts +354 -0
- package/dist/media.js +654 -0
- package/dist/method-refusal.d.ts +64 -0
- package/dist/method-refusal.js +48 -0
- package/dist/pending.d.ts +10 -0
- package/dist/pending.js +10 -0
- package/dist/query.d.ts +76 -0
- package/dist/query.js +195 -0
- package/dist/react-mount.d.ts +23 -0
- package/dist/react-mount.js +108 -0
- package/dist/react.d.ts +41 -0
- package/dist/react.js +111 -0
- package/dist/read-copy.d.ts +103 -0
- package/dist/read-copy.js +195 -0
- package/dist/roles/files.d.ts +295 -0
- package/dist/roles/files.js +184 -0
- package/dist/root.d.ts +21 -0
- package/dist/root.js +1 -0
- package/dist/rpc.d.ts +1 -0
- package/dist/rpc.js +1 -0
- package/dist/status.d.ts +17 -0
- package/dist/status.js +50 -0
- package/dist/storage-wire.d.ts +167 -0
- package/dist/storage-wire.js +115 -0
- package/dist/storage.d.ts +72 -0
- package/dist/storage.js +143 -0
- package/dist/store.d.ts +11 -0
- package/dist/store.js +1 -0
- package/dist/test-kit/git.d.ts +31 -0
- package/dist/test-kit/git.js +174 -0
- package/dist/ui.d.ts +169 -0
- package/dist/ui.js +10 -0
- package/dist/window.d.ts +41 -0
- package/dist/window.js +15 -0
- package/dist/world.d.ts +16 -0
- package/dist/world.js +17 -0
- package/docs/api/README.md +28 -0
- package/docs/api/app-build-contract.md +113 -0
- package/docs/api/backend-declaration.md +62 -0
- package/docs/api/backend-definition.md +215 -0
- package/docs/api/backend.md +269 -0
- package/docs/api/errors.md +169 -0
- package/docs/api/files.md +91 -0
- package/docs/api/gills.md +164 -0
- package/docs/api/git-commit.md +279 -0
- package/docs/api/git-rpc.md +243 -0
- package/docs/api/git-steps.md +1010 -0
- package/docs/api/git-wire.md +197 -0
- package/docs/api/git.md +579 -0
- package/docs/api/index.md +2880 -0
- package/docs/api/media-json.md +507 -0
- package/docs/api/media-request-id.md +32 -0
- package/docs/api/modules.md +32 -0
- package/docs/api/query.md +253 -0
- package/docs/api/react.md +216 -0
- package/docs/api/read-copy.md +204 -0
- package/docs/api/rpc.md +128 -0
- package/docs/api/storage.md +620 -0
- package/package.json +197 -3
package/dist/git-rpc.js
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
import {} from "./git.js";
|
|
3
|
+
import { gitRepositoryNameSchema, gitSha1Schema, } from "@fungi.computer/puffball/git-representation";
|
|
4
|
+
const bytes = z
|
|
5
|
+
.instanceof(Uint8Array)
|
|
6
|
+
.refine((value) => value.byteLength <= 32 * 1024 * 1024);
|
|
7
|
+
const headers = z.record(z.string().max(256), z.string().max(8192));
|
|
8
|
+
const identity = z.strictObject({ name: z.string(), email: z.string() });
|
|
9
|
+
const info = z.strictObject({
|
|
10
|
+
name: gitRepositoryNameSchema,
|
|
11
|
+
defaultBranch: z.string(),
|
|
12
|
+
lastPushAt: z.string().nullable(),
|
|
13
|
+
source: gitRepositoryNameSchema.nullable(),
|
|
14
|
+
});
|
|
15
|
+
const commit = z.strictObject({
|
|
16
|
+
hash: gitSha1Schema,
|
|
17
|
+
treeHash: gitSha1Schema,
|
|
18
|
+
message: z.string(),
|
|
19
|
+
author: identity,
|
|
20
|
+
committer: identity,
|
|
21
|
+
parents: z.array(gitSha1Schema),
|
|
22
|
+
authoredAt: z.number().int(),
|
|
23
|
+
committedAt: z.number().int(),
|
|
24
|
+
});
|
|
25
|
+
const tree = z.strictObject({
|
|
26
|
+
name: z.string(),
|
|
27
|
+
mode: z.string(),
|
|
28
|
+
hash: gitSha1Schema,
|
|
29
|
+
type: z.enum(["blob", "tree", "commit"]),
|
|
30
|
+
});
|
|
31
|
+
const request = z.strictObject({
|
|
32
|
+
service: z.enum(["upload-pack", "receive-pack"]),
|
|
33
|
+
phase: z.enum(["advertise", "exchange"]),
|
|
34
|
+
body: bytes.nullable(),
|
|
35
|
+
headers,
|
|
36
|
+
});
|
|
37
|
+
const response = z.strictObject({
|
|
38
|
+
status: z.number().int().min(100).max(599),
|
|
39
|
+
headers,
|
|
40
|
+
body: bytes,
|
|
41
|
+
});
|
|
42
|
+
const createOptions = z
|
|
43
|
+
.strictObject({
|
|
44
|
+
description: z.string().max(8192).optional(),
|
|
45
|
+
defaultBranch: z.string().min(1).max(1024).optional(),
|
|
46
|
+
})
|
|
47
|
+
.optional();
|
|
48
|
+
const forkOptions = z
|
|
49
|
+
.strictObject({ description: z.string().max(8192).optional() })
|
|
50
|
+
.optional();
|
|
51
|
+
const logOptions = z.strictObject({
|
|
52
|
+
ref: z.string().min(1).max(1024),
|
|
53
|
+
limit: z.number().int().min(1).max(1000).optional(),
|
|
54
|
+
offset: z.number().int().nonnegative().optional(),
|
|
55
|
+
});
|
|
56
|
+
/** The native tuple and result grammar shared by the handle and frame entrypoint. */
|
|
57
|
+
export const nativeGitCodecs = {
|
|
58
|
+
create: {
|
|
59
|
+
args: z.tuple([gitRepositoryNameSchema, createOptions]),
|
|
60
|
+
result: info,
|
|
61
|
+
},
|
|
62
|
+
fork: {
|
|
63
|
+
args: z.tuple([
|
|
64
|
+
gitRepositoryNameSchema,
|
|
65
|
+
gitRepositoryNameSchema,
|
|
66
|
+
forkOptions,
|
|
67
|
+
]),
|
|
68
|
+
result: info,
|
|
69
|
+
},
|
|
70
|
+
cloneUrl: { args: z.tuple([gitRepositoryNameSchema]), result: z.url() },
|
|
71
|
+
info: { args: z.tuple([gitRepositoryNameSchema]), result: info.nullable() },
|
|
72
|
+
delete: { args: z.tuple([gitRepositoryNameSchema]), result: z.boolean() },
|
|
73
|
+
log: {
|
|
74
|
+
args: z.tuple([gitRepositoryNameSchema, logOptions]),
|
|
75
|
+
result: z.array(commit),
|
|
76
|
+
},
|
|
77
|
+
readCommit: {
|
|
78
|
+
args: z.tuple([gitRepositoryNameSchema, gitSha1Schema]),
|
|
79
|
+
result: commit.nullable(),
|
|
80
|
+
},
|
|
81
|
+
readTree: {
|
|
82
|
+
args: z.tuple([gitRepositoryNameSchema, gitSha1Schema]),
|
|
83
|
+
result: z.array(tree).nullable(),
|
|
84
|
+
},
|
|
85
|
+
readBlob: {
|
|
86
|
+
args: z.tuple([gitRepositoryNameSchema, gitSha1Schema]),
|
|
87
|
+
result: bytes.nullable(),
|
|
88
|
+
},
|
|
89
|
+
refs: {
|
|
90
|
+
args: z.tuple([gitRepositoryNameSchema]),
|
|
91
|
+
result: z.array(z.strictObject({ name: z.string(), hash: gitSha1Schema })),
|
|
92
|
+
},
|
|
93
|
+
exchange: {
|
|
94
|
+
args: z.tuple([gitRepositoryNameSchema, request]),
|
|
95
|
+
result: response,
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
/** A frame entrypoint uses the same native argument and result codecs as the handle. */
|
|
99
|
+
function frameMethod(codec, operations) {
|
|
100
|
+
return {
|
|
101
|
+
/** Decode the native positional arguments with the method's tuple codec. */
|
|
102
|
+
decodeArgs: (raw) => codec.args.parse(raw),
|
|
103
|
+
/** Validate the native result, preserving binary values. */
|
|
104
|
+
decodeResult: (raw) => codec.result.parse(raw),
|
|
105
|
+
/** Operations the host must grant for these decoded arguments. */
|
|
106
|
+
requiredOperations: (args) => operations(codec.args.parse(args)),
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
/** Native Git preserves tuples and binary values through the shared frame factory. */
|
|
110
|
+
export const nativeGitFrameMethods = {
|
|
111
|
+
create: frameMethod(nativeGitCodecs.create, () => ["create"]),
|
|
112
|
+
fork: frameMethod(nativeGitCodecs.fork, () => ["fork"]),
|
|
113
|
+
cloneUrl: frameMethod(nativeGitCodecs.cloneUrl, () => ["read"]),
|
|
114
|
+
info: frameMethod(nativeGitCodecs.info, () => ["read"]),
|
|
115
|
+
delete: frameMethod(nativeGitCodecs.delete, () => ["write"]),
|
|
116
|
+
log: frameMethod(nativeGitCodecs.log, () => ["read"]),
|
|
117
|
+
readCommit: frameMethod(nativeGitCodecs.readCommit, () => ["read"]),
|
|
118
|
+
readTree: frameMethod(nativeGitCodecs.readTree, () => ["read"]),
|
|
119
|
+
readBlob: frameMethod(nativeGitCodecs.readBlob, () => ["read"]),
|
|
120
|
+
refs: frameMethod(nativeGitCodecs.refs, () => ["read"]),
|
|
121
|
+
exchange: frameMethod(nativeGitCodecs.exchange, ([, input]) => [
|
|
122
|
+
"exchange",
|
|
123
|
+
input.service === "receive-pack" ? "write" : "read",
|
|
124
|
+
]),
|
|
125
|
+
};
|
|
126
|
+
/** Native method identity is a source-owned refinement, not a transport parser. */
|
|
127
|
+
export const nativeGitMethodNameSchema = z.enum([
|
|
128
|
+
"create",
|
|
129
|
+
"fork",
|
|
130
|
+
"cloneUrl",
|
|
131
|
+
"info",
|
|
132
|
+
"delete",
|
|
133
|
+
"log",
|
|
134
|
+
"readCommit",
|
|
135
|
+
"readTree",
|
|
136
|
+
"readBlob",
|
|
137
|
+
"refs",
|
|
138
|
+
"exchange",
|
|
139
|
+
]);
|
|
140
|
+
/** Dispatch owned tuples through the retained native handle without a JSON conversion. */
|
|
141
|
+
export async function invokeNativeGit(git, method, raw) {
|
|
142
|
+
switch (nativeGitMethodNameSchema.parse(method)) {
|
|
143
|
+
case "create":
|
|
144
|
+
return await git.create(...nativeGitCodecs.create.args.parse(raw));
|
|
145
|
+
case "fork":
|
|
146
|
+
return await git.fork(...nativeGitCodecs.fork.args.parse(raw));
|
|
147
|
+
case "cloneUrl":
|
|
148
|
+
return await git.cloneUrl(...nativeGitCodecs.cloneUrl.args.parse(raw));
|
|
149
|
+
case "info":
|
|
150
|
+
return await git.info(...nativeGitCodecs.info.args.parse(raw));
|
|
151
|
+
case "delete":
|
|
152
|
+
return await git.delete(...nativeGitCodecs.delete.args.parse(raw));
|
|
153
|
+
case "log":
|
|
154
|
+
return await git.log(...nativeGitCodecs.log.args.parse(raw));
|
|
155
|
+
case "readCommit":
|
|
156
|
+
return await git.readCommit(...nativeGitCodecs.readCommit.args.parse(raw));
|
|
157
|
+
case "readTree":
|
|
158
|
+
return await git.readTree(...nativeGitCodecs.readTree.args.parse(raw));
|
|
159
|
+
case "readBlob":
|
|
160
|
+
return await git.readBlob(...nativeGitCodecs.readBlob.args.parse(raw));
|
|
161
|
+
case "refs":
|
|
162
|
+
return await git.refs(...nativeGitCodecs.refs.args.parse(raw));
|
|
163
|
+
case "exchange":
|
|
164
|
+
return await git.exchange(...nativeGitCodecs.exchange.args.parse(raw));
|
|
165
|
+
}
|
|
166
|
+
}
|