@fungi.computer/oyster 0.47.5 → 0.48.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.
@@ -1505,7 +1505,6 @@ export class StandaloneAgentBase extends ShiitakeDO {
1505
1505
  roster: [
1506
1506
  ...extensions.roster,
1507
1507
  homeExtension({
1508
- instructionsRoot: "",
1509
1508
  computers: {
1510
1509
  prepare: async () => {
1511
1510
  await this.preparedComputerSnapshot();
@@ -2798,9 +2797,7 @@ export function standaloneAgents(env, scope) {
2798
2797
  // AGENTS.md. A Home the owner already wrote to is left as it is. With
2799
2798
  // no Home, the same section stays on the Agent until it has one.
2800
2799
  seedHome: async (agentId) => {
2801
- await seedStarterHome("AGENTS.md", async (path, content) => {
2802
- if (path !== "AGENTS.md")
2803
- throw new Error(`The starter seeds only AGENTS.md, not ${path}`);
2800
+ await seedStarterHome(async (content) => {
2804
2801
  const result = await env.AGENTS.getByName(agentId).replaceInstructions(JSON.stringify(principal), null, content);
2805
2802
  if (!("error" in result))
2806
2803
  return;
@@ -97,6 +97,16 @@ export declare class ComputerDO extends NativeComputerDO implements ComputerFetc
97
97
  #private;
98
98
  private readonly previewBindings;
99
99
  constructor(state: DurableObjectState, previewBindings: StandaloneComputerOwnerEnv);
100
+ /**
101
+ * Once per Computer, copy an owner's Home AGENTS.md from the Workspace root,
102
+ * where the owner editor used to write it and no guest could see it, to
103
+ * /workspace/AGENTS.md, the file an Agent's relative path names. The root copy
104
+ * is kept. The copy pulls every attached guest first and happens only while
105
+ * /workspace/AGENTS.md is absent: when both exist, nothing changes, the
106
+ * conflict is logged and the Agent uses the /workspace file. A guest that
107
+ * cannot be pulled leaves the marker unset, so the next request tries again.
108
+ */
109
+ protected prepareFiles(): Promise<void>;
100
110
  /**
101
111
  * The configured Computer predates the name record, and the container's
102
112
  * object-id reconnect wakes it nameless after every redeploy; it learns its
@@ -1,3 +1,4 @@
1
+ import { agentWorkspacePath } from "@fungi.computer/computer/files";
1
2
  import { PortAccessError } from "@fungi.computer/computer/port-access";
2
3
  import { attachedBackendId, computerSizeSchema, defaultComputerSize, hostedBackingSchema, } from "@fungi.computer/computer/backing";
3
4
  import { appMethodRefusalStatus, appMethodRefusedReplySchema, } from "@fungi.computer/agar/backend";
@@ -140,6 +141,8 @@ export function standaloneComputerSize(sql) {
140
141
  ? defaultComputerSize
141
142
  : computerSizeSchema.parse(row.size);
142
143
  }
144
+ /** Set once the Workspace root's Home AGENTS.md has been copied under /workspace. */
145
+ const homeInstructionsRootMarker = "home-instructions-root:v1";
143
146
  /** Durable workspace and existing backings, with fleet checks at native acceptance. */
144
147
  export class ComputerDO extends NativeComputerDO {
145
148
  previewBindings;
@@ -155,6 +158,45 @@ export class ComputerDO extends NativeComputerDO {
155
158
  });
156
159
  this.previewBindings = previewBindings;
157
160
  }
161
+ #homeInstructionsCopied;
162
+ #homeInstructionsDone = false;
163
+ /**
164
+ * Once per Computer, copy an owner's Home AGENTS.md from the Workspace root,
165
+ * where the owner editor used to write it and no guest could see it, to
166
+ * /workspace/AGENTS.md, the file an Agent's relative path names. The root copy
167
+ * is kept. The copy pulls every attached guest first and happens only while
168
+ * /workspace/AGENTS.md is absent: when both exist, nothing changes, the
169
+ * conflict is logged and the Agent uses the /workspace file. A guest that
170
+ * cannot be pulled leaves the marker unset, so the next request tries again.
171
+ */
172
+ async prepareFiles() {
173
+ if (this.#homeInstructionsDone)
174
+ return;
175
+ this.#homeInstructionsCopied ??= this.#copyHomeInstructions().finally(() => {
176
+ this.#homeInstructionsCopied = undefined;
177
+ });
178
+ await this.#homeInstructionsCopied;
179
+ }
180
+ async #copyHomeInstructions() {
181
+ try {
182
+ if ((await this.state.storage.get(homeInstructionsRootMarker)) !== undefined) {
183
+ this.#homeInstructionsDone = true;
184
+ return;
185
+ }
186
+ const copied = await this.copyWorkspaceFileIfFree("/AGENTS.md", agentWorkspacePath("AGENTS.md"));
187
+ if (copied === "unknown")
188
+ return;
189
+ if (copied === "conflict")
190
+ console.warn("home-instructions-root-conflict", {
191
+ computerId: this.#id(),
192
+ });
193
+ await this.state.storage.put(homeInstructionsRootMarker, true);
194
+ this.#homeInstructionsDone = true;
195
+ }
196
+ catch (cause) {
197
+ console.error("Home AGENTS.md copy under /workspace failed", cause);
198
+ }
199
+ }
158
200
  /**
159
201
  * The configured Computer predates the name record, and the container's
160
202
  * object-id reconnect wakes it nameless after every redeploy; it learns its
@@ -766,7 +808,7 @@ export function standaloneWorkspace(env, keysLive, selectedComputerId = env.OYST
766
808
  */
767
809
  export function standaloneHomeInstructionsFile(computer, computerId, actor) {
768
810
  const authority = grant(computerId, actor);
769
- const path = "/AGENTS.md";
811
+ const path = agentWorkspacePath("AGENTS.md");
770
812
  return {
771
813
  read: async () => {
772
814
  const bytes = await computer.fileRead(authority, path);
@@ -14,9 +14,7 @@ export declare const starterAgent: {
14
14
  readonly requestId: "starter-agent:v1";
15
15
  };
16
16
  /** Seed only a missing Home file; the host supplies an atomic create-if-absent. */
17
- export declare function seedStarterHome(
18
- /** Where this host keeps Home's AGENTS.md. */
19
- instructionsPath: string, writeIfMissing: (path: string, content: string) => Promise<void>): Promise<void>;
17
+ export declare function seedStarterHome(writeIfMissing: (content: string) => Promise<void>): Promise<void>;
20
18
  /** Why the last create or Home seed attempt failed, in plain words. */
21
19
  export type StarterFailure = Readonly<{
22
20
  reason: string;
@@ -6,21 +6,17 @@ export const starterAgent = {
6
6
  requestId: "starter-agent:v1",
7
7
  };
8
8
  /** Seed only a missing Home file; the host supplies an atomic create-if-absent. */
9
- export async function seedStarterHome(
10
- /** Where this host keeps Home's AGENTS.md. */
11
- instructionsPath, writeIfMissing) {
12
- await writeIfMissing(instructionsPath, starterHomeInstructions(`computer://home/${instructionsPath.replace(/^\//u, "")}`));
9
+ export async function seedStarterHome(writeIfMissing) {
10
+ await writeIfMissing(starterHomeInstructions);
13
11
  }
14
12
  /**
15
13
  * The Home AGENTS.md a new Team's Agent starts with. It says nothing about
16
14
  * money; the person and the Agent both edit it from here on.
17
15
  */
18
- const starterHomeInstructions = (
19
- /** Where Home's AGENTS.md is read from on this host, as the Agent names it. */
20
- location) => `# Shiitake's instructions
16
+ const starterHomeInstructions = `# Shiitake's instructions
21
17
 
22
18
  These are my standing instructions. They live on my Computer at
23
- ${location} and load at the start of every conversation. My
19
+ computer://home/AGENTS.md and load at the start of every conversation. My
24
20
  person and I both edit this file.
25
21
 
26
22
  ## First conversation
package/docs/api/apps.md CHANGED
@@ -338,6 +338,38 @@ admission.
338
338
 
339
339
  ---
340
340
 
341
+ ### InstallConfirmationLine
342
+
343
+ ```ts
344
+ type InstallConfirmationLine = Readonly<{
345
+ capability: AppCapabilityId;
346
+ label: string;
347
+ description: string;
348
+ warning: string | null;
349
+ apps: readonly string[];
350
+ }>;
351
+ ```
352
+
353
+ One declared permission as the install confirmation words it.
354
+
355
+ ---
356
+
357
+ ### InstallConfirmation
358
+
359
+ ```ts
360
+ type InstallConfirmation = Readonly<{
361
+ granted: readonly InstallConfirmationLine[];
362
+ needsApproval: readonly InstallConfirmationLine[];
363
+ }>;
364
+ ```
365
+
366
+ Every permission an install declares, once, for one confirmation. `granted` is
367
+ what confirming approves; `needsApproval` is what stays refused until an owner
368
+ approves it. Both come from the rule the install reducer applies, so the list
369
+ cannot promise more or less than the install does.
370
+
371
+ ---
372
+
341
373
  ### ResourceRef
342
374
 
343
375
  ```ts
@@ -1862,6 +1894,27 @@ stay outside this pure gate.
1862
1894
 
1863
1895
  ---
1864
1896
 
1897
+ ### installConfirmation()
1898
+
1899
+ ```ts
1900
+ function installConfirmation(role, apps): InstallConfirmation;
1901
+ ```
1902
+
1903
+ Merge any number of Apps into one combined, once-per-permission list.
1904
+
1905
+ #### Parameters
1906
+
1907
+ | Parameter | Type |
1908
+ | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
1909
+ | `role` | `"member"` \| `"owner"` \| `"admin"` \| `null` |
1910
+ | `apps` | readonly `Readonly`\<\{ `name`: `string`; `capabilities`: readonly ( \| `"computer.list"` \| `"computer.readFile"` \| `"computer.writeFile"` \| `"computer.execute"` \| `"approvals"` \| `"agent.list"` \| `"agent.manage"` \| `"agent.rename"` \| `"agent.avatar"` \| `"agent.instructions"` \| `"agent.toolPolicy"` \| `"agent.read"` \| `"agent.send"` \| `"llm.generation"` \| `"media.generation"` \| `"media.share"` \| `"games:servers"` \| `"git.repository"` \| `"apps.open"` \| `"apps.call"` \| `"app.storage"` \| `"app.events.emit"` \| `"team.workbenchHost"` \| `"marketplace.browse"` \| `"marketplace.purchase"` \| `"workflow.run"` \| `"workflow.publish"` \| `"workflow.arm"` \| `"world"` \| `"channels.read"` \| `"channels.personal.manage"`)[]; \}\>[] |
1911
+
1912
+ #### Returns
1913
+
1914
+ [`InstallConfirmation`](#installconfirmation)
1915
+
1916
+ ---
1917
+
1865
1918
  ### applyGrantCommand()
1866
1919
 
1867
1920
  ```ts
package/docs/api/pack.md CHANGED
@@ -317,6 +317,134 @@ retains its original lifetime.
317
317
 
318
318
  ---
319
319
 
320
+ ### previewRelease()
321
+
322
+ ```ts
323
+ function previewRelease(input): Promise<{
324
+ name: string;
325
+ capabilities: readonly (
326
+ | "computer.list"
327
+ | "computer.readFile"
328
+ | "computer.writeFile"
329
+ | "computer.execute"
330
+ | "approvals"
331
+ | "agent.list"
332
+ | "agent.manage"
333
+ | "agent.rename"
334
+ | "agent.avatar"
335
+ | "agent.instructions"
336
+ | "agent.toolPolicy"
337
+ | "agent.read"
338
+ | "agent.send"
339
+ | "llm.generation"
340
+ | "media.generation"
341
+ | "media.share"
342
+ | "games:servers"
343
+ | "git.repository"
344
+ | "apps.open"
345
+ | "apps.call"
346
+ | "app.storage"
347
+ | "app.events.emit"
348
+ | "team.workbenchHost"
349
+ | "marketplace.browse"
350
+ | "marketplace.purchase"
351
+ | "workflow.run"
352
+ | "workflow.publish"
353
+ | "workflow.arm"
354
+ | "world"
355
+ | "channels.read"
356
+ | "channels.personal.manage"
357
+ )[];
358
+ update: {
359
+ installationId: string;
360
+ needsApproval: readonly (
361
+ | "computer.list"
362
+ | "computer.readFile"
363
+ | "computer.writeFile"
364
+ | "computer.execute"
365
+ | "approvals"
366
+ | "agent.list"
367
+ | "agent.manage"
368
+ | "agent.rename"
369
+ | "agent.avatar"
370
+ | "agent.instructions"
371
+ | "agent.toolPolicy"
372
+ | "agent.read"
373
+ | "agent.send"
374
+ | "llm.generation"
375
+ | "media.generation"
376
+ | "media.share"
377
+ | "games:servers"
378
+ | "git.repository"
379
+ | "apps.open"
380
+ | "apps.call"
381
+ | "app.storage"
382
+ | "app.events.emit"
383
+ | "team.workbenchHost"
384
+ | "marketplace.browse"
385
+ | "marketplace.purchase"
386
+ | "workflow.run"
387
+ | "workflow.publish"
388
+ | "workflow.arm"
389
+ | "world"
390
+ | "channels.read"
391
+ | "channels.personal.manage"
392
+ )[];
393
+ } | null;
394
+ release: {
395
+ releaseId: ReleaseId;
396
+ appId: AppId;
397
+ artifact: {
398
+ artifactRef: ArtifactRef;
399
+ artifactDigest: Sha256Digest;
400
+ provenance: {
401
+ sourceRevision: SourceRevision;
402
+ sourceTreeDigest: Sha256Digest;
403
+ buildRecipeDigest: Sha256Digest;
404
+ };
405
+ };
406
+ };
407
+ }>;
408
+ ```
409
+
410
+ Upload one built Release and ask the Oyster what installing it would request, so
411
+ an owner can confirm several Releases once before any install.
412
+
413
+ #### Parameters
414
+
415
+ | Parameter | Type |
416
+ | --------- | --------------------------------------------------------------------------------------------------------- |
417
+ | `input` | `Readonly`\<\{ `directory`: `string`; `url`: `string`; `key`: `string`; `installationId?`: `string`; \}\> |
418
+
419
+ #### Returns
420
+
421
+ `Promise`\<\{ `name`: `string`; `capabilities`: readonly ( \| `"computer.list"`
422
+ \| `"computer.readFile"` \| `"computer.writeFile"` \| `"computer.execute"` \|
423
+ `"approvals"` \| `"agent.list"` \| `"agent.manage"` \| `"agent.rename"` \|
424
+ `"agent.avatar"` \| `"agent.instructions"` \| `"agent.toolPolicy"` \|
425
+ `"agent.read"` \| `"agent.send"` \| `"llm.generation"` \| `"media.generation"`
426
+ \| `"media.share"` \| `"games:servers"` \| `"git.repository"` \| `"apps.open"`
427
+ \| `"apps.call"` \| `"app.storage"` \| `"app.events.emit"` \|
428
+ `"team.workbenchHost"` \| `"marketplace.browse"` \| `"marketplace.purchase"` \|
429
+ `"workflow.run"` \| `"workflow.publish"` \| `"workflow.arm"` \| `"world"` \|
430
+ `"channels.read"` \| `"channels.personal.manage"`)[]; `update`: \| \{
431
+ `installationId`: `string`; `needsApproval`: readonly ( \| `"computer.list"` \|
432
+ `"computer.readFile"` \| `"computer.writeFile"` \| `"computer.execute"` \|
433
+ `"approvals"` \| `"agent.list"` \| `"agent.manage"` \| `"agent.rename"` \|
434
+ `"agent.avatar"` \| `"agent.instructions"` \| `"agent.toolPolicy"` \|
435
+ `"agent.read"` \| `"agent.send"` \| `"llm.generation"` \| `"media.generation"`
436
+ \| `"media.share"` \| `"games:servers"` \| `"git.repository"` \| `"apps.open"`
437
+ \| `"apps.call"` \| `"app.storage"` \| `"app.events.emit"` \|
438
+ `"team.workbenchHost"` \| `"marketplace.browse"` \| `"marketplace.purchase"` \|
439
+ `"workflow.run"` \| `"workflow.publish"` \| `"workflow.arm"` \| `"world"` \|
440
+ `"channels.read"` \| `"channels.personal.manage"`)[]; \} \| `null`; `release`:
441
+ \{ `releaseId`: `ReleaseId`; `appId`: `AppId`; `artifact`: \{ `artifactRef`:
442
+ `ArtifactRef`; `artifactDigest`: `Sha256Digest`; `provenance`: \{
443
+ `sourceRevision`: `SourceRevision`; `sourceTreeDigest`: `Sha256Digest`;
444
+ `buildRecipeDigest`: `Sha256Digest`; \}; \}; \}; \}\>
445
+
446
+ ---
447
+
320
448
  ### installRelease()
321
449
 
322
450
  ```ts
@@ -333,9 +461,9 @@ is reported as an unconfirmed observation, not refusal.
333
461
 
334
462
  #### Parameters
335
463
 
336
- | Parameter | Type |
337
- | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
338
- | `input` | `Readonly`\<\{ `directory`: `string`; `url`: `string`; `key`: `string`; `installationId?`: `string`; `onAdmitted?`: (`operation`) => `void`; `onCompleted?`: (`operation`) => `Promise`\<`void`\>; \}\> & `Readonly`\<\{ `waitMs?`: `number`; `signal?`: `AbortSignal`; \}\> |
464
+ | Parameter | Type |
465
+ | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
466
+ | `input` | `Readonly`\<\{ `directory`: `string`; `url`: `string`; `key`: `string`; `installationId?`: `string`; `uploaded?`: \{ `releaseId`: `ReleaseId`; `appId`: `AppId`; `artifact`: \{ `artifactRef`: `ArtifactRef`; `artifactDigest`: `Sha256Digest`; `provenance`: \{ `sourceRevision`: `SourceRevision`; `sourceTreeDigest`: `Sha256Digest`; `buildRecipeDigest`: `Sha256Digest`; \}; \}; \}; `onAdmitted?`: (`operation`) => `void`; `onCompleted?`: (`operation`) => `Promise`\<`void`\>; \}\> & `Readonly`\<\{ `waitMs?`: `number`; `signal?`: `AbortSignal`; \}\> |
339
467
 
340
468
  #### Returns
341
469
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fungi.computer/oyster",
3
- "version": "0.47.5",
3
+ "version": "0.48.0",
4
4
  "author": "Levi <levi@technomancy.dev>",
5
5
  "description": "Oyster by Fungi: open-source Apps for people and AI agents. Try with one command or run on your own Cloudflare account.",
6
6
  "homepage": "https://docs.fungi.computer/oyster",
@@ -366,7 +366,7 @@
366
366
  "@fungi.computer/capnweb": "0.12.0-fungi.0",
367
367
  "@fungi.computer/caps": "0.12.2",
368
368
  "@fungi.computer/carrier": "0.2.5",
369
- "@fungi.computer/computer": "0.16.1",
369
+ "@fungi.computer/computer": "0.16.2",
370
370
  "@fungi.computer/computer-contract": "0.5.8",
371
371
  "@fungi.computer/darkroom": "0.11.11",
372
372
  "@fungi.computer/ear-tag": "0.1.0",
@@ -380,7 +380,7 @@
380
380
  "@fungi.computer/puffball": "0.12.0",
381
381
  "@fungi.computer/seam": "0.2.6",
382
382
  "@fungi.computer/shiitake": "0.21.11",
383
- "@fungi.computer/shiitake-extensions": "0.11.22",
383
+ "@fungi.computer/shiitake-extensions": "0.11.23",
384
384
  "@fungi.computer/sigils": "0.3.2",
385
385
  "@fungi.computer/sprite": "0.2.2",
386
386
  "@fungi.computer/sprite-zdog": "0.3.2",