@fungi.computer/oyster 0.24.0 → 0.25.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.
- package/dist/agent-instructions.d.ts +35 -0
- package/dist/agent-instructions.js +42 -0
- package/dist/agents.d.ts +14 -0
- package/dist/agents.js +43 -1
- package/dist/apps/catalog.d.ts +11 -0
- package/dist/apps/catalog.js +1 -0
- package/dist/apps/gate.d.ts +2 -2
- package/dist/apps/installation.d.ts +7 -7
- package/dist/apps/permissions.d.ts +5 -5
- package/dist/boot-host-script.js +1 -1
- package/dist/browser/boot-once.d.ts +84 -0
- package/dist/browser/boot-once.js +48 -0
- package/dist/build/candidate-cli.mjs +6 -0
- package/dist/embed-metafiles.js +2 -2
- package/dist/embed-scripts.js +1 -1
- package/dist/installation-operations.d.ts +8 -8
- package/dist/page-script.js +2 -2
- package/dist/standalone/agents.d.ts +6 -0
- package/dist/standalone/agents.js +35 -2
- package/dist/standalone/computer.d.ts +3 -3
- package/dist/standalone/computer.js +34 -1
- package/dist/standalone/workflow-host.d.ts +5 -5
- package/dist/standalone/workflow-trigger-host.d.ts +1 -1
- package/docs/api/agents.md +18 -0
- package/docs/api/apps.md +148 -131
- package/docs/api/browser/boot-once.md +169 -0
- package/docs/api/build-contract.md +27 -21
- package/docs/api/build.md +70 -69
- package/docs/api/git.md +3 -3
- package/docs/api/host.md +91 -85
- package/docs/api/mcp.md +16 -16
- package/docs/api/modules.md +1 -0
- package/docs/api/workers-git.md +7 -7
- package/docs/api/workers.md +24 -21
- package/package.json +25 -17
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { UiBootCheckOutcome } from "../boot-gate.js";
|
|
2
|
+
/** One Release and the version of the check that judges it. */
|
|
3
|
+
export type BootRunKey = Readonly<{
|
|
4
|
+
releaseId: string;
|
|
5
|
+
checkVersion: string;
|
|
6
|
+
}>;
|
|
7
|
+
/** Why a check could not judge the page. */
|
|
8
|
+
export type NotCheckedCode = Extract<UiBootCheckOutcome, {
|
|
9
|
+
kind: "not_checked";
|
|
10
|
+
}>["code"];
|
|
11
|
+
/** What an ask for the key's run slot learns. */
|
|
12
|
+
export type BootRunClaim = Readonly<{
|
|
13
|
+
kind: "acquired";
|
|
14
|
+
}>
|
|
15
|
+
/** Another asker is running the check right now. */
|
|
16
|
+
| Readonly<{
|
|
17
|
+
kind: "held";
|
|
18
|
+
}>
|
|
19
|
+
/** The last run was inconclusive a moment ago; it is reused, not retried. */
|
|
20
|
+
| Readonly<{
|
|
21
|
+
kind: "cooling";
|
|
22
|
+
code: NotCheckedCode;
|
|
23
|
+
}>;
|
|
24
|
+
/**
|
|
25
|
+
* The run slot for one key, in a store every isolate shares (the Hub's
|
|
26
|
+
* catalog D1). `acquire` is one atomic step: it hands the slot to exactly one
|
|
27
|
+
* asker unless a live claim exists, and a claim past its lease is free, so a
|
|
28
|
+
* crashed holder never blocks the Release.
|
|
29
|
+
*/
|
|
30
|
+
export type BootRunClaims = Readonly<{
|
|
31
|
+
/** Take the key's slot, or learn who holds it or why it is cooling. */
|
|
32
|
+
acquire: (input: BootRunKey & Readonly<{
|
|
33
|
+
claimId: string;
|
|
34
|
+
now: number;
|
|
35
|
+
leaseMs: number;
|
|
36
|
+
}>) => Promise<BootRunClaim>;
|
|
37
|
+
/**
|
|
38
|
+
* End the holder's claim. With `cooling`, keep the slot closed for `coolMs`
|
|
39
|
+
* so waiters and new asks share the inconclusive reason; without it the slot
|
|
40
|
+
* is free at once. A claim another asker holds is left alone.
|
|
41
|
+
*/
|
|
42
|
+
finish: (input: BootRunKey & Readonly<{
|
|
43
|
+
claimId: string;
|
|
44
|
+
now: number;
|
|
45
|
+
cooling: Readonly<{
|
|
46
|
+
code: NotCheckedCode;
|
|
47
|
+
coolMs: number;
|
|
48
|
+
}> | null;
|
|
49
|
+
}>) => Promise<void>;
|
|
50
|
+
}>;
|
|
51
|
+
/** Everything one single-flight boot ask needs. */
|
|
52
|
+
export type SingleFlightBootInput = BootRunKey & Readonly<{
|
|
53
|
+
claims: BootRunClaims;
|
|
54
|
+
/** The recorded definitive outcome for the key, or null. */
|
|
55
|
+
recorded: () => Promise<UiBootCheckOutcome | null>;
|
|
56
|
+
/** One check; may open a browser session. */
|
|
57
|
+
run: () => Promise<UiBootCheckOutcome>;
|
|
58
|
+
/** Record a definitive outcome; the stored one wins. */
|
|
59
|
+
record: (outcome: Exclude<UiBootCheckOutcome, {
|
|
60
|
+
kind: "not_checked";
|
|
61
|
+
}>) => Promise<UiBootCheckOutcome>;
|
|
62
|
+
/** The clock, epoch ms. */
|
|
63
|
+
now: () => number;
|
|
64
|
+
/** Wait between polls of a held slot. */
|
|
65
|
+
sleep: (ms: number) => Promise<void>;
|
|
66
|
+
/** A host-minted identity for one attempt to take the slot. */
|
|
67
|
+
newClaimId: () => string;
|
|
68
|
+
/** Longer than one `run`, cleanup included. */
|
|
69
|
+
leaseMs: number;
|
|
70
|
+
pollMs: number;
|
|
71
|
+
/** How long an inconclusive reason is shared. */
|
|
72
|
+
coolMs: number;
|
|
73
|
+
/** The longest a waiter holds on before giving up as `boot_timeout`. */
|
|
74
|
+
maxWaitMs: number;
|
|
75
|
+
}>;
|
|
76
|
+
/**
|
|
77
|
+
* At most one boot check per Release and check version is in flight across
|
|
78
|
+
* every caller sharing `claims`. A definitive outcome is recorded and read by
|
|
79
|
+
* everyone after. A waiter reuses whatever the holder produced: the recorded
|
|
80
|
+
* verdict, or its inconclusive reason for `coolMs`. An inconclusive outcome is
|
|
81
|
+
* never a verdict and never reported as a pass; once the cooldown ends the
|
|
82
|
+
* next ask checks again.
|
|
83
|
+
*/
|
|
84
|
+
export declare function singleFlightBoot(input: SingleFlightBootInput): Promise<UiBootCheckOutcome>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* At most one boot check per Release and check version is in flight across
|
|
3
|
+
* every caller sharing `claims`. A definitive outcome is recorded and read by
|
|
4
|
+
* everyone after. A waiter reuses whatever the holder produced: the recorded
|
|
5
|
+
* verdict, or its inconclusive reason for `coolMs`. An inconclusive outcome is
|
|
6
|
+
* never a verdict and never reported as a pass; once the cooldown ends the
|
|
7
|
+
* next ask checks again.
|
|
8
|
+
*/
|
|
9
|
+
export async function singleFlightBoot(input) {
|
|
10
|
+
const key = { releaseId: input.releaseId, checkVersion: input.checkVersion };
|
|
11
|
+
const startedAt = input.now();
|
|
12
|
+
for (;;) {
|
|
13
|
+
const stored = await input.recorded();
|
|
14
|
+
if (stored !== null)
|
|
15
|
+
return stored;
|
|
16
|
+
const claimId = input.newClaimId();
|
|
17
|
+
const claim = await input.claims.acquire({
|
|
18
|
+
...key,
|
|
19
|
+
claimId,
|
|
20
|
+
now: input.now(),
|
|
21
|
+
leaseMs: input.leaseMs,
|
|
22
|
+
});
|
|
23
|
+
if (claim.kind === "cooling")
|
|
24
|
+
return { kind: "not_checked", code: claim.code };
|
|
25
|
+
if (claim.kind === "acquired")
|
|
26
|
+
return await held(input, key, claimId);
|
|
27
|
+
if (input.now() - startedAt >= input.maxWaitMs)
|
|
28
|
+
return { kind: "not_checked", code: "boot_timeout" };
|
|
29
|
+
await input.sleep(input.pollMs);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
async function held(input, key, claimId) {
|
|
33
|
+
let cooling = null;
|
|
34
|
+
try {
|
|
35
|
+
// A verdict recorded between the read and the claim needs no run.
|
|
36
|
+
const stored = await input.recorded();
|
|
37
|
+
if (stored !== null)
|
|
38
|
+
return stored;
|
|
39
|
+
const outcome = await input.run();
|
|
40
|
+
if (outcome.kind !== "not_checked")
|
|
41
|
+
return await input.record(outcome);
|
|
42
|
+
cooling = { code: outcome.code, coolMs: input.coolMs };
|
|
43
|
+
return outcome;
|
|
44
|
+
}
|
|
45
|
+
finally {
|
|
46
|
+
await input.claims.finish({ ...key, claimId, now: input.now(), cooling });
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -19604,6 +19604,11 @@ var appBackendBindingKinds = {
|
|
|
19604
19604
|
requires: ["computer.writeFile"],
|
|
19605
19605
|
effect: "write"
|
|
19606
19606
|
},
|
|
19607
|
+
move: {
|
|
19608
|
+
cap: "app.computer.write",
|
|
19609
|
+
requires: ["computer.writeFile"],
|
|
19610
|
+
effect: "write"
|
|
19611
|
+
},
|
|
19607
19612
|
preview: {
|
|
19608
19613
|
cap: "app.computer.exec",
|
|
19609
19614
|
requires: ["computer.execute"],
|
|
@@ -19677,6 +19682,7 @@ var appCapabilityIds = [
|
|
|
19677
19682
|
"agent.manage",
|
|
19678
19683
|
"agent.rename",
|
|
19679
19684
|
"agent.avatar",
|
|
19685
|
+
"agent.instructions",
|
|
19680
19686
|
"agent.toolPolicy",
|
|
19681
19687
|
"agent.read",
|
|
19682
19688
|
"agent.send",
|