@fungi.computer/computer 0.16.4 → 0.16.6
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/dist/port-access.d.ts +7 -1
- package/dist/port-access.js +18 -4
- package/dist/team-candidate-builder.mjs +27 -14
- package/package.json +3 -3
package/dist/port-access.d.ts
CHANGED
|
@@ -22,9 +22,15 @@ export declare function initializePortAccess(storage: WatchdogSqliteOwner): void
|
|
|
22
22
|
export declare class ComputerPortAccess {
|
|
23
23
|
private readonly storage;
|
|
24
24
|
private readonly options;
|
|
25
|
-
constructor(storage: WatchdogSqliteOwner, options
|
|
25
|
+
constructor(storage: WatchdogSqliteOwner, options: Readonly<{
|
|
26
26
|
publicAccess?: "on";
|
|
27
27
|
now?: () => number;
|
|
28
|
+
/**
|
|
29
|
+
* Whether the principal a member session stored still has access. It
|
|
30
|
+
* is asked on every request that session makes, so a viewer who loses
|
|
31
|
+
* access is refused at once rather than when the session expires.
|
|
32
|
+
*/
|
|
33
|
+
admitted: (principal: PortAccessPrincipal) => Promise<boolean>;
|
|
28
34
|
}>);
|
|
29
35
|
private now;
|
|
30
36
|
private visibility;
|
package/dist/port-access.js
CHANGED
|
@@ -9,6 +9,16 @@ const principalSchema = z.union([
|
|
|
9
9
|
z.strictObject({ userId: z.string().min(1), teamId: z.string().min(1) }),
|
|
10
10
|
z.strictObject({ ownerId: z.string().min(1) }),
|
|
11
11
|
]);
|
|
12
|
+
/** A stored session row: a share holds no principal, a member session does. */
|
|
13
|
+
const storedSessionSchema = z.union([
|
|
14
|
+
z.object({ kind: z.literal("share"), principal_json: z.null() }),
|
|
15
|
+
z
|
|
16
|
+
.object({ kind: z.literal("member"), principal_json: z.string() })
|
|
17
|
+
.transform((row) => ({
|
|
18
|
+
kind: row.kind,
|
|
19
|
+
principal: principalSchema.parse(JSON.parse(row.principal_json)),
|
|
20
|
+
})),
|
|
21
|
+
]);
|
|
12
22
|
const credentialSchema = z
|
|
13
23
|
.string()
|
|
14
24
|
.length(LONG)
|
|
@@ -67,7 +77,7 @@ function fromSibling(request, target, site) {
|
|
|
67
77
|
export class ComputerPortAccess {
|
|
68
78
|
storage;
|
|
69
79
|
options;
|
|
70
|
-
constructor(storage, options
|
|
80
|
+
constructor(storage, options) {
|
|
71
81
|
this.storage = storage;
|
|
72
82
|
this.options = options;
|
|
73
83
|
initializePortAccess(storage);
|
|
@@ -177,9 +187,13 @@ export class ComputerPortAccess {
|
|
|
177
187
|
if (secret === undefined || !credentialSchema.safeParse(secret).success)
|
|
178
188
|
return false;
|
|
179
189
|
const sessionHash = await hash(secret);
|
|
180
|
-
|
|
181
|
-
.exec("SELECT s.
|
|
182
|
-
.toArray()
|
|
190
|
+
const row = this.storage.sql
|
|
191
|
+
.exec("SELECT s.kind, s.principal_json FROM computer_port_session s JOIN computer_exposed_ports p ON p.port = s.port WHERE s.session_hash = ? AND s.port = ? AND s.expires_at > ? AND (p.visibility = 'unlisted' OR (p.visibility = 'private' AND s.kind = 'member'))", sessionHash, port, this.now())
|
|
192
|
+
.toArray()[0];
|
|
193
|
+
if (row === undefined)
|
|
194
|
+
return false;
|
|
195
|
+
const session = storedSessionSchema.parse(row);
|
|
196
|
+
return session.kind === "share" || this.options.admitted(session.principal);
|
|
183
197
|
}
|
|
184
198
|
/** Mount on one target host. Forwarding remains responsible for live exposure. */
|
|
185
199
|
gate(portInput, policy, forward) {
|
|
@@ -5362,8 +5362,8 @@ var require_coerce = __commonJS({
|
|
|
5362
5362
|
const minor = match4[3] || "0";
|
|
5363
5363
|
const patch = match4[4] || "0";
|
|
5364
5364
|
const prerelease = options.includePrerelease && match4[5] ? `-${match4[5]}` : "";
|
|
5365
|
-
const
|
|
5366
|
-
return parse6(`${major}.${minor}.${patch}${prerelease}${
|
|
5365
|
+
const build = options.includePrerelease && match4[6] ? `+${match4[6]}` : "";
|
|
5366
|
+
return parse6(`${major}.${minor}.${patch}${prerelease}${build}`, options);
|
|
5367
5367
|
};
|
|
5368
5368
|
module.exports = coerce;
|
|
5369
5369
|
}
|
|
@@ -20840,6 +20840,7 @@ var appCapabilityIds = [
|
|
|
20840
20840
|
"agent.avatar",
|
|
20841
20841
|
"agent.instructions",
|
|
20842
20842
|
"agent.toolPolicy",
|
|
20843
|
+
"agent.stop",
|
|
20843
20844
|
"agent.read",
|
|
20844
20845
|
"agent.send",
|
|
20845
20846
|
"computer.list",
|
|
@@ -22998,12 +22999,12 @@ async function createDefinitionEmission(source, recipe) {
|
|
|
22998
22999
|
let declarationCode;
|
|
22999
23000
|
const declarationPlugin = {
|
|
23000
23001
|
name: "derived-app-declaration",
|
|
23001
|
-
setup(
|
|
23002
|
-
|
|
23002
|
+
setup(build) {
|
|
23003
|
+
build.onResolve(
|
|
23003
23004
|
{ filter: /^fungi:app-declaration$/ },
|
|
23004
23005
|
(args2) => args2.kind === "entry-point" ? { path: "app-declaration.js", namespace: declarationNamespace } : void 0
|
|
23005
23006
|
);
|
|
23006
|
-
|
|
23007
|
+
build.onLoad(
|
|
23007
23008
|
{ filter: /.*/, namespace: declarationNamespace },
|
|
23008
23009
|
() => ({
|
|
23009
23010
|
contents: `import { appBackend } from ${JSON.stringify(definitionPath)}; import { buildAppDeclaration } from ${JSON.stringify(buildOnlySdk)}; export const appDeclaration = buildAppDeclaration(appBackend, ${JSON.stringify(packageDeclaration)});`,
|
|
@@ -24404,7 +24405,6 @@ import { dirname as dirname3, isAbsolute as isAbsolute4, join as join3, relative
|
|
|
24404
24405
|
import { readFile as readFile2, realpath as realpath2 } from "node:fs/promises";
|
|
24405
24406
|
import { dirname as dirname2, extname, join as join2 } from "node:path";
|
|
24406
24407
|
import { fileURLToPath, pathToFileURL as pathToFileURL2, URL as URL3 } from "node:url";
|
|
24407
|
-
import { build } from "esbuild";
|
|
24408
24408
|
|
|
24409
24409
|
// ../../node_modules/.pnpm/parse5@8.0.1/node_modules/parse5/dist/common/unicode.js
|
|
24410
24410
|
var UNDEFINED_CODE_POINTS = /* @__PURE__ */ new Set([
|
|
@@ -32289,6 +32289,15 @@ function parse3(html, options) {
|
|
|
32289
32289
|
return Parser.parse(html, options);
|
|
32290
32290
|
}
|
|
32291
32291
|
|
|
32292
|
+
// src/lazy-import.ts
|
|
32293
|
+
async function loadLazily(load3, what) {
|
|
32294
|
+
try {
|
|
32295
|
+
return await load3();
|
|
32296
|
+
} catch (cause) {
|
|
32297
|
+
throw new Error(`${what} failed to load`, { cause });
|
|
32298
|
+
}
|
|
32299
|
+
}
|
|
32300
|
+
|
|
32292
32301
|
// src/build/app-imports.ts
|
|
32293
32302
|
var codeExtensions = /* @__PURE__ */ new Set([
|
|
32294
32303
|
".js",
|
|
@@ -32343,6 +32352,10 @@ async function appRuntimeImports(options) {
|
|
|
32343
32352
|
if (path !== void 0)
|
|
32344
32353
|
modules.push({ entryPoints: [await contained(join2(root, path))] });
|
|
32345
32354
|
const imports = /* @__PURE__ */ new Set();
|
|
32355
|
+
const { build } = await loadLazily(
|
|
32356
|
+
() => import("esbuild"),
|
|
32357
|
+
"Oyster's App build tool (esbuild)"
|
|
32358
|
+
);
|
|
32346
32359
|
for (const module of modules) {
|
|
32347
32360
|
const result2 = await build({
|
|
32348
32361
|
...module,
|
|
@@ -32410,14 +32423,14 @@ var manifestSchema = fromJsonString2(
|
|
|
32410
32423
|
);
|
|
32411
32424
|
function readBuildManifest(packageJson) {
|
|
32412
32425
|
const manifest = decodeUnknownSync(manifestSchema)(packageJson);
|
|
32413
|
-
const
|
|
32426
|
+
const build = manifest.fungi?.build;
|
|
32414
32427
|
return {
|
|
32415
32428
|
...manifest,
|
|
32416
32429
|
fungi: {
|
|
32417
32430
|
...manifest.fungi,
|
|
32418
|
-
build:
|
|
32431
|
+
build: build === void 0 ? void 0 : decodeUnknownSync(workspaceBuildPolicySchema, {
|
|
32419
32432
|
onExcessProperty: "error"
|
|
32420
|
-
})(
|
|
32433
|
+
})(build)
|
|
32421
32434
|
}
|
|
32422
32435
|
};
|
|
32423
32436
|
}
|
|
@@ -32582,19 +32595,19 @@ async function resolveWorkspaceBuild(options) {
|
|
|
32582
32595
|
const path = within(root, join3(appDirectory, stylesheet));
|
|
32583
32596
|
steps.push({ kind: "tailwind", input: path, output: path });
|
|
32584
32597
|
}
|
|
32585
|
-
const
|
|
32598
|
+
const build = {
|
|
32586
32599
|
directory,
|
|
32587
32600
|
packageName,
|
|
32588
32601
|
react: policy.react === true,
|
|
32589
32602
|
dependencies: Object.freeze(dependencies),
|
|
32590
32603
|
steps: Object.freeze(steps)
|
|
32591
32604
|
};
|
|
32592
|
-
if (policy.shellEntry === void 0) return Object.freeze(
|
|
32605
|
+
if (policy.shellEntry === void 0) return Object.freeze(build);
|
|
32593
32606
|
const shellEntry = relative3(
|
|
32594
32607
|
join3(root, directory),
|
|
32595
32608
|
join3(root, appDirectory, policy.shellEntry)
|
|
32596
32609
|
).split(sep3).join("/");
|
|
32597
|
-
return Object.freeze({ ...
|
|
32610
|
+
return Object.freeze({ ...build, shellEntry });
|
|
32598
32611
|
}
|
|
32599
32612
|
|
|
32600
32613
|
// src/build/bundled-html.ts
|
|
@@ -35995,8 +36008,8 @@ var workspacePackageSchema = Struct({
|
|
|
35995
36008
|
name: String4.pipe(check(isMinLength(1))),
|
|
35996
36009
|
path: String4.pipe(check(isMinLength(1)))
|
|
35997
36010
|
});
|
|
35998
|
-
function productionWorkspaceSelectors(
|
|
35999
|
-
return ["--filter-prod", `${
|
|
36011
|
+
function productionWorkspaceSelectors(build) {
|
|
36012
|
+
return ["--filter-prod", `${build.packageName}...`];
|
|
36000
36013
|
}
|
|
36001
36014
|
function capturedWorkspaceBuild(snapshot, entry, run2, backendEntry) {
|
|
36002
36015
|
return flatMap2(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fungi.computer/computer",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.6",
|
|
4
4
|
"author": "Levi <levi@technomancy.dev>",
|
|
5
5
|
"description": "Cloudflare Computer host for one durable Fungi Computer",
|
|
6
6
|
"type": "module",
|
|
@@ -64,10 +64,10 @@
|
|
|
64
64
|
"@fungi.computer/capnweb": "0.12.0-fungi.0",
|
|
65
65
|
"@fungi.computer/cloudflare-computer": "0.2.1-fungi.2",
|
|
66
66
|
"@fungi.computer/cordyceps": "0.4.3",
|
|
67
|
-
"@fungi.computer/knapsack": "0.4.
|
|
67
|
+
"@fungi.computer/knapsack": "0.4.23",
|
|
68
68
|
"@fungi.computer/seam": "0.2.6",
|
|
69
69
|
"@fungi.computer/watchdog": "0.1.4",
|
|
70
|
-
"@fungi.computer/computer-contract": "0.5.
|
|
70
|
+
"@fungi.computer/computer-contract": "0.5.11",
|
|
71
71
|
"effect": "4.0.2",
|
|
72
72
|
"just-bash": "3.4.2",
|
|
73
73
|
"zod": "4.4.3",
|