@fungi.computer/oyster 0.48.0 → 0.49.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 CHANGED
@@ -202,9 +202,13 @@ again later, since every deploy replaces the Worker's variables.
202
202
 
203
203
  The first `install-apps` takes about 15 to 20 minutes, mostly building the seven
204
204
  Apps on your Computer, two at a time. It prints a line per step and a timing
205
- table, ending with `Installed 7 Apps`. Open `$OYSTER_URL/login`, sign in with
206
- the owner key, and your Oyster opens on the Tourtois desktop. Run `install-apps`
207
- again to update the Apps; a replaced Release keeps each App's data.
205
+ table, ending with `Installed 7 Apps`. When the builds finish it shows what
206
+ built, what failed and why, and the permissions the Apps ask for, then asks you
207
+ to confirm once; nothing installs before you answer, and `--yes` confirms
208
+ without asking (required without a terminal). Open `$OYSTER_URL/login`, sign in
209
+ with the owner key, and your Oyster opens on the Tourtois desktop. Run
210
+ `install-apps` again to update the Apps; a replaced Release keeps each App's
211
+ data.
208
212
 
209
213
  Starting without `try`, deploying with an API token, upgrading, tearing down and
210
214
  the celld trial are in the [API reference](docs/api/README.md) under "Deploy and
@@ -90,13 +90,26 @@ export function createAppRegion(native, deliver) {
90
90
  };
91
91
  const connects = new Map();
92
92
  const regionFull = (reason) => Response.json({ error: "region_full", reason }, { status: 429 });
93
+ // Each socket's decoded host stamp, filled when connect stamps it or, after
94
+ // a hibernation wake, by the first read of its native attachment. Only the
95
+ // supervisor writes an attachment, once at admission, so a cached stamp
96
+ // never goes stale; connect and every reply then cost no parse per socket.
97
+ const stamps = new WeakMap();
98
+ const remember = (socket, connection, caller) => {
99
+ const stamp = { connection, caller, key: callerKey(caller) };
100
+ stamps.set(socket, stamp);
101
+ return stamp;
102
+ };
93
103
  const attachment = (socket) => {
104
+ const known = stamps.get(socket);
105
+ if (known !== undefined)
106
+ return known;
94
107
  const parsed = attachmentSchema.safeParse(socket.deserializeAttachment());
95
108
  if (!parsed.success)
96
109
  return null;
97
110
  const caller = appMethodCallerSchema.safeParse(parsed.data.caller);
98
111
  return caller.success
99
- ? { connection: parsed.data.connection, caller: caller.data }
112
+ ? remember(socket, parsed.data.connection, caller.data)
100
113
  : null;
101
114
  };
102
115
  const apply = async (raw) => {
@@ -153,10 +166,7 @@ export function createAppRegion(native, deliver) {
153
166
  if (sockets.length >= appRegionLimits.socketsPerInstance)
154
167
  return regionFull("Region socket limit reached");
155
168
  const key = callerKey(stamped);
156
- const held = sockets.filter((socket) => {
157
- const stamp = attachment(socket);
158
- return stamp !== null && callerKey(stamp.caller) === key;
159
- }).length;
169
+ const held = sockets.filter((socket) => attachment(socket)?.key === key).length;
160
170
  if (held >= appRegionLimits.socketsPerCaller)
161
171
  return regionFull("Region socket share reached");
162
172
  const now = native.now();
@@ -175,6 +185,7 @@ export function createAppRegion(native, deliver) {
175
185
  const connection = regionIds.connection.generate();
176
186
  native.accept(server);
177
187
  server.serializeAttachment({ connection, caller: stamped });
188
+ remember(server, connection, stamped);
178
189
  try {
179
190
  await apply(await deliverConnect({
180
191
  kind: "connect",