@fungi.computer/computer 0.5.0 → 0.6.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.
@@ -1,7 +1,7 @@
1
1
  /** Host-neutral fleet contracts. Host policy is supplied as grants, never imported. */
2
2
  export { checkComputerGrant, type ComputerAdmission } from "./admission.js";
3
3
  export { createFleetBacking } from "./backing.js";
4
- export { computerActionSchema, computerProvenanceSchema, computerGrantSchema, computerStateSchema, computerFactSchema, ComputerBackingError, type ComputerAction, type ComputerProvenance, type ComputerGrant, type ComputerRuntimeState, type ComputerFact, type ComputerBackendsProjection, type ComputerBackingChange, type LocalBackendAttachInput, type LocalBackendDetachInput, } from "./wire.js";
4
+ export { computerActionSchema, computerProvenanceSchema, computerGrantSchema, computerStateSchema, computerFactSchema, computerBackendViewSchema, localBackendAttachSchema, localBackendDetachSchema, localBackendDetachRequestSchema, ComputerBackingError, type ComputerAction, type ComputerProvenance, type ComputerGrant, type ComputerRuntimeState, type ComputerFact, type ComputerBackendView, type ComputerBackendsProjection, type ComputerBackingChange, type LocalBackendAttachInput, type LocalBackendDetachInput, } from "./wire.js";
5
5
  export { ComputerRuntimeUsage } from "./runtime-usage.js";
6
6
  export { computerKeepAwake } from "./keep-awake.js";
7
7
  export { computerUsageIntervalSchema, type ComputerUsageInterval, } from "./wire.js";
@@ -1,7 +1,7 @@
1
1
  /** Host-neutral fleet contracts. Host policy is supplied as grants, never imported. */
2
2
  export { checkComputerGrant } from "./admission.js";
3
3
  export { createFleetBacking } from "./backing.js";
4
- export { computerActionSchema, computerProvenanceSchema, computerGrantSchema, computerStateSchema, computerFactSchema, ComputerBackingError, } from "./wire.js";
4
+ export { computerActionSchema, computerProvenanceSchema, computerGrantSchema, computerStateSchema, computerFactSchema, computerBackendViewSchema, localBackendAttachSchema, localBackendDetachSchema, localBackendDetachRequestSchema, ComputerBackingError, } from "./wire.js";
5
5
  export { ComputerRuntimeUsage } from "./runtime-usage.js";
6
6
  export { computerKeepAwake } from "./keep-awake.js";
7
7
  export { computerUsageIntervalSchema, } from "./wire.js";
@@ -133,6 +133,27 @@ export declare const localBackendDetachRequestSchema: z.ZodObject<{
133
133
  requestId: z.ZodString;
134
134
  }, z.core.$strict>;
135
135
  export type LocalBackendDetachInput = z.output<typeof localBackendDetachSchema> | z.output<typeof localBackendDetachRequestSchema>;
136
+ /** One attached backend as its owner sees it on the Computer page. */
137
+ export declare const computerBackendViewSchema: z.ZodObject<{
138
+ id: z.ZodString;
139
+ kind: z.ZodEnum<{
140
+ "platform-container": "platform-container";
141
+ "on-box-vm": "on-box-vm";
142
+ local: "local";
143
+ }>;
144
+ status: z.ZodEnum<{
145
+ ready: "ready";
146
+ online: "online";
147
+ offline: "offline";
148
+ queued: "queued";
149
+ }>;
150
+ queuePosition: z.ZodNullable<z.ZodNumber>;
151
+ hostId: z.ZodNullable<z.ZodString>;
152
+ hostLabel: z.ZodNullable<z.ZodString>;
153
+ folderLabel: z.ZodNullable<z.ZodString>;
154
+ detachable: z.ZodBoolean;
155
+ }, z.core.$strict>;
156
+ export type ComputerBackendView = z.output<typeof computerBackendViewSchema>;
136
157
  /** One runtime observation; the host owns delivery and settlement. */
137
158
  export declare const computerUsageIntervalSchema: z.ZodObject<{
138
159
  runtimeId: z.ZodString;
@@ -77,6 +77,18 @@ export const localBackendDetachRequestSchema = z.strictObject({
77
77
  computerId: localBackendAttachSchema.shape.computerId,
78
78
  requestId: localBackendAttachSchema.shape.requestId,
79
79
  });
80
+ /** One attached backend as its owner sees it on the Computer page. */
81
+ export const computerBackendViewSchema = z.strictObject({
82
+ id: z.string(),
83
+ kind: z.enum(["platform-container", "on-box-vm", "local"]),
84
+ status: z.enum(["ready", "queued", "online", "offline"]),
85
+ queuePosition: z.number().int().positive().nullable(),
86
+ hostId: z.string().nullable(),
87
+ hostLabel: z.string().nullable(),
88
+ folderLabel: z.string().nullable(),
89
+ /** Only the actor who attached a machine may detach it. */
90
+ detachable: z.boolean(),
91
+ });
80
92
  const factIdentity = {
81
93
  computerId: computerGrantSchema.shape.computerId,
82
94
  provenance: computerProvenanceSchema,
package/dist/index.d.ts CHANGED
@@ -302,7 +302,7 @@ export { WorkspaceProxy, WorkspaceServiceProxy };
302
302
  export { OnBoxVmContainerHost, OnBoxVmTimeoutError, onBoxVmPlacement, onBoxVmIngress, type OnBoxVmEnv, type OnBoxVmOperation, type OnBoxVmState, } from "./on-box-vm.js";
303
303
  export { computerContainerSleepAfterMs } from "./container-policy.js";
304
304
  export * from "./computer-backends.js";
305
- export { LocalBackendOfflineError, localBackendAudience, localBackendDialPath, verifyLocalBackendDial, } from "./local-backend.js";
305
+ export { LocalBackendOfflineError, localBackendAudience, localBackendDialPath, ownerLocalBackendDialPath, verifyLocalBackendDial, } from "./local-backend.js";
306
306
  /** Keep each native Workspace lease inside the operation that uses it. */
307
307
  export declare function createComputerFilesPort(computer: ComputerFilesRpc | Rpc.Provider<ComputerFilesRpc>): FilesPort;
308
308
  export { createWorkspaceFilesPort, type WorkspaceFilesOwner } from "./files.js";
package/dist/index.js CHANGED
@@ -79,7 +79,7 @@ import { OnBoxVmContainerHost, onBoxVmPlacement, } from "./on-box-vm.js";
79
79
  import { computerKeepAwake } from "./fleet/keep-awake.js";
80
80
  import { attachedBackendId, describeAttachedBackend, routeComputerBackend, } from "./computer-backends.js";
81
81
  import { MeteredContainerHost } from "./metered-container-host.js";
82
- import { LocalBackendConnections, LocalWorkspaceBackend, localBackendDialPath, verifyLocalBackendDial, } from "./local-backend.js";
82
+ import { LocalBackendConnections, LocalWorkspaceBackend, localBackendDialPath, ownerLocalBackendDialPath, verifyLocalBackendDial, } from "./local-backend.js";
83
83
  const computerBinding = "COMPUTER";
84
84
  const utf8 = new TextEncoder();
85
85
  const terminalDefaultCols = 80;
@@ -470,6 +470,9 @@ class ContainerComputer extends ContainerComputerBase {
470
470
  const dial = localBackendDialPath.exec(url.pathname);
471
471
  if (dial !== null)
472
472
  return this.#acceptLocalDial(request, dial[2] ?? "", dial[3] ?? "");
473
+ const ownerDial = ownerLocalBackendDialPath.exec(url.pathname);
474
+ if (ownerDial !== null)
475
+ return this.#acceptLocalDial(request, ownerDial[1] ?? "", ownerDial[2] ?? "");
473
476
  const vm = vmUpgradePath.exec(url.pathname);
474
477
  const id = vm === null ? "container" : `vm-${vm[1] ?? ""}`;
475
478
  if (vm !== null)
@@ -1535,7 +1538,7 @@ export { WorkspaceProxy, WorkspaceServiceProxy };
1535
1538
  export { OnBoxVmContainerHost, OnBoxVmTimeoutError, onBoxVmPlacement, onBoxVmIngress, } from "./on-box-vm.js";
1536
1539
  export { computerContainerSleepAfterMs } from "./container-policy.js";
1537
1540
  export * from "./computer-backends.js";
1538
- export { LocalBackendOfflineError, localBackendAudience, localBackendDialPath, verifyLocalBackendDial, } from "./local-backend.js";
1541
+ export { LocalBackendOfflineError, localBackendAudience, localBackendDialPath, ownerLocalBackendDialPath, verifyLocalBackendDial, } from "./local-backend.js";
1539
1542
  /** Keep each native Workspace lease inside the operation that uses it. */
1540
1543
  export function createComputerFilesPort(computer) {
1541
1544
  async function withFiles(operation) {
@@ -51,3 +51,9 @@ export declare function verifyLocalBackendDial(request: Request, computerName: s
51
51
  * The Hub forwards it unchanged so the signature covers what the machine sent.
52
52
  */
53
53
  export declare const localBackendDialPath: RegExp;
54
+ /**
55
+ * A standalone Oyster has one owner and no Teams. Its machines dial the owner's
56
+ * Computer directly: `/api/computers/:computer/backends/:id/connect`, signed
57
+ * for the same audience.
58
+ */
59
+ export declare const ownerLocalBackendDialPath: RegExp;
@@ -141,3 +141,9 @@ export async function verifyLocalBackendDial(request, computerName, backend, own
141
141
  * The Hub forwards it unchanged so the signature covers what the machine sent.
142
142
  */
143
143
  export const localBackendDialPath = /^\/api\/teams\/([^/]+)\/computers\/([^/]+)\/backends\/(local-[a-z2-7]{16})\/connect$/;
144
+ /**
145
+ * A standalone Oyster has one owner and no Teams. Its machines dial the owner's
146
+ * Computer directly: `/api/computers/:computer/backends/:id/connect`, signed
147
+ * for the same audience.
148
+ */
149
+ export const ownerLocalBackendDialPath = /^\/api\/computers\/([^/]+)\/backends\/(local-[a-z2-7]{16})\/connect$/;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fungi.computer/computer",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "author": "Levi <levi@technomancy.dev>",
5
5
  "description": "Cloudflare Computer host for one durable Fungi Computer",
6
6
  "type": "module",
@@ -60,10 +60,10 @@
60
60
  "@fungi.computer/capnweb": "0.12.0",
61
61
  "@fungi.computer/cloudflare-computer": "0.2.1-fungi.2",
62
62
  "@fungi.computer/cordyceps": "0.4.0",
63
- "@fungi.computer/knapsack": "0.4.4",
64
- "@fungi.computer/seam": "0.2.0",
63
+ "@fungi.computer/knapsack": "0.4.5",
64
+ "@fungi.computer/seam": "0.2.1",
65
65
  "@fungi.computer/watchdog": "0.1.0",
66
- "@fungi.computer/computer-contract": "0.0.9",
66
+ "@fungi.computer/computer-contract": "0.0.10",
67
67
  "effect": "4.0.2",
68
68
  "just-bash": "3.4.2",
69
69
  "zod": "4.4.3"