@fungi.computer/computer 0.16.3 → 0.16.5

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.
@@ -56,3 +56,13 @@ export class ReplayRing {
56
56
  return Buffer.concat(this.#chunks, this.#bytes);
57
57
  }
58
58
  }
59
+
60
+ /** The most PTY and SSH sessions one Computer serves at once. */
61
+ export const maximumSessions = 16;
62
+ /** SSH transports alone stop here, so terminals keep slots a member cannot fill. */
63
+ export const maximumSshSessions = 8;
64
+
65
+ /** May another SSH transport open, given how many are open now? */
66
+ export function sshHasRoom(sshOpen) {
67
+ return sshOpen < maximumSshSessions;
68
+ }
@@ -21,9 +21,11 @@ import manifest from "./package.json" with { type: "json" };
21
21
  import { createWebSocketStream, WebSocketServer } from "ws";
22
22
  import {
23
23
  boundedInteger,
24
+ maximumSessions,
24
25
  parseResize,
25
26
  ReplayRing,
26
27
  replayBytes,
28
+ sshHasRoom,
27
29
  } from "./terminal-protocol.mjs";
28
30
 
29
31
  const terminalShell = "/bin/bash";
@@ -38,7 +40,6 @@ const sshFiles = [
38
40
  ];
39
41
  /** How long a hung-up SSH session's processes get after SIGTERM before SIGKILL. */
40
42
  const sshKillGraceMs = 2_000;
41
- const maximumSessions = 16;
42
43
  const detachedLifetimeMs = 30 * 60 * 1_000;
43
44
  /** A client that cannot drain this much output reconnects and replays. */
44
45
  const maximumBufferedBytes = 4 * 1_024 * 1_024;
@@ -205,7 +206,7 @@ class TerminalSessions {
205
206
  * socket's binary frames. It ends with either side, and never outlives it.
206
207
  */
207
208
  attachSsh(socket) {
208
- if (!this.#makeRoom()) {
209
+ if (!sshHasRoom(this.#ssh.size) || !this.#makeRoom()) {
209
210
  send(socket, { type: "error", message: "terminal session limit" });
210
211
  socket.close(1013, "terminal session limit");
211
212
  return;
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ export type { WorkspaceRuntimeResultOptions } from "@fungi.computer/cloudflare-c
2
2
  export { createLocalBackendReplayStore } from "./local-backend-replay.js";
3
3
  import { type VaultGrantPort, type VaultReferenceAdmission } from "./vault-references.js";
4
4
  import { Workspace, WorkspaceProxy, WorkspaceServiceProxy, type WorkspaceStub, type WorkspaceRuntimeResultOptions } from "@fungi.computer/cloudflare-computer";
5
- import { type WorkerShellBackendOptions } from "@fungi.computer/cloudflare-computer/backends/worker-shell";
5
+ import { type WorkerShellBackendOptions } from "@fungi.computer/cloudflare-computer/backends/worker-shell/backend";
6
6
  import { type IWorkspaceContainerAPI } from "@fungi.computer/cloudflare-computer/backends/container";
7
7
  import { DurableObject } from "cloudflare:workers";
8
8
  import type { FilesPort } from "@fungi.computer/knapsack";
package/dist/index.js CHANGED
@@ -57,7 +57,7 @@ import { computerInternetAccess } from "./internet-access.js";
57
57
  import { createComputerVaultReferences, isVaultExecutionContext, vaultExecutionHooks, } from "./vault-references.js";
58
58
  import { computerName, learnComputerName, recordComputerName, } from "./computer-name.js";
59
59
  import { getWorkspace, SQLiteWorkspaceProvider, Workspace, WorkspaceProxy, WorkspaceServiceProxy, } from "@fungi.computer/cloudflare-computer";
60
- import { WorkerShellBackend, } from "@fungi.computer/cloudflare-computer/backends/worker-shell";
60
+ import { WorkerShellBackend, } from "@fungi.computer/cloudflare-computer/backends/worker-shell/backend";
61
61
  import { withWorkspaceContainer, } from "@fungi.computer/cloudflare-computer/backends/container";
62
62
  import { DurableObject } from "cloudflare:workers";
63
63
  import * as Effect from "effect/Effect";
@@ -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",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fungi.computer/computer",
3
- "version": "0.16.3",
3
+ "version": "0.16.5",
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.21",
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.8",
70
+ "@fungi.computer/computer-contract": "0.5.10",
71
71
  "effect": "4.0.2",
72
72
  "just-bash": "3.4.2",
73
73
  "zod": "4.4.3",