@fungi.computer/oyster 0.5.0 → 0.7.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/README.md +155 -63
- package/dist/agent-archive-projection.d.ts +8 -0
- package/dist/agent-archive-projection.js +49 -0
- package/dist/agent-schedules.d.ts +50 -0
- package/dist/agent-schedules.js +17 -0
- package/dist/agents.d.ts +35 -14
- package/dist/agents.js +97 -144
- package/dist/app-builds.d.ts +7 -2
- package/dist/app-builds.js +19 -2
- package/dist/approval-capability.d.ts +1 -1
- package/dist/approval-capability.js +11 -16
- package/dist/approval-home.d.ts +2 -1
- package/dist/approval-home.js +5 -3
- package/dist/apps/catalog.js +1 -1
- package/dist/apps/gate.d.ts +4 -7
- package/dist/apps/gate.js +14 -29
- package/dist/apps/index.d.ts +1 -1
- package/dist/apps/installation.d.ts +4 -42
- package/dist/apps/installation.js +7 -75
- package/dist/apps/operations.js +0 -10
- package/dist/apps/permissions.d.ts +18 -8
- package/dist/apps/permissions.js +7 -1
- package/dist/auth.js +9 -1
- package/dist/authorization.d.ts +307 -0
- package/dist/authorization.js +542 -0
- package/dist/boot-host-script.js +1 -1
- package/dist/build/build-jobs.d.ts +2 -2
- package/dist/build/candidate-builder.d.ts +2 -0
- package/dist/build/candidate-builder.js +5 -1
- package/dist/build/candidate-cli.js +3 -0
- package/dist/build/candidate-cli.mjs +67 -22
- package/dist/build/job-log.d.ts +23 -0
- package/dist/build/job-log.js +88 -0
- package/dist/build/local-build.d.ts +2 -0
- package/dist/build/local-build.js +11 -9
- package/dist/channels/binding.d.ts +8 -1
- package/dist/channels/binding.js +12 -0
- package/dist/channels/conversations.d.ts +16 -5
- package/dist/channels/visitor-channel.d.ts +53 -0
- package/dist/channels/visitor-channel.js +124 -0
- package/dist/channels/visitor-edge.d.ts +115 -0
- package/dist/channels/visitor-edge.js +582 -0
- package/dist/channels/visitor-request.d.ts +7 -0
- package/dist/channels/visitor-request.js +17 -0
- package/dist/channels/visitor-stream-slots.d.ts +2 -0
- package/dist/channels/visitor-stream-slots.js +33 -0
- package/dist/channels/visitors.d.ts +47 -0
- package/dist/channels/visitors.js +181 -0
- package/dist/cloudflare.d.ts +11 -2
- package/dist/cloudflare.js +27 -1
- package/dist/{page/computer-target.d.ts → computer-target.d.ts} +2 -0
- package/dist/{page/computer-target.js → computer-target.js} +3 -1
- package/dist/files.js +9 -8
- package/dist/git-admission.d.ts +3 -3
- package/dist/git-admission.js +4 -6
- package/dist/git-door.d.ts +8 -7
- package/dist/git-door.js +18 -17
- package/dist/git.d.ts +1 -1
- package/dist/host.d.ts +38 -42
- package/dist/host.js +182 -239
- package/dist/installation-execution.js +10 -5
- package/dist/installation-operations.d.ts +4 -180
- package/dist/installation-operations.js +1 -5
- package/dist/installation-store-generation.d.ts +4 -1
- package/dist/installation-store-generation.js +59 -6
- package/dist/internal/delivery.js +0 -1
- package/dist/internal/host-gate.d.ts +9 -6
- package/dist/internal/host-gate.js +19 -25
- package/dist/internal/invocation-timing.d.ts +16 -0
- package/dist/internal/invocation-timing.js +23 -0
- package/dist/internal/registry-installations.js +1 -0
- package/dist/invocation.d.ts +19 -11
- package/dist/invocation.js +171 -96
- package/dist/keys.d.ts +2 -19
- package/dist/keys.js +1 -37
- package/dist/mcp.d.ts +15 -27
- package/dist/mcp.js +105 -155
- package/dist/page/agent-browser.d.ts +15 -0
- package/dist/page/agent-browser.js +162 -0
- package/dist/page/app-permissions-port.d.ts +3 -0
- package/dist/page/app-permissions-port.js +43 -0
- package/dist/page/app-permissions.d.ts +11 -0
- package/dist/page/app-permissions.js +296 -0
- package/dist/page/capabilities.js +1 -1
- package/dist/page/child-selection.d.ts +27 -0
- package/dist/page/child-selection.js +38 -0
- package/dist/page/isolated-page-theme.d.ts +2 -0
- package/dist/page/isolated-page-theme.js +11 -0
- package/dist/page/mount.d.ts +2 -13
- package/dist/page/mount.js +8 -94
- package/dist/page-script.d.ts +0 -3
- package/dist/page-script.js +3 -4
- package/dist/release.d.ts +13 -0
- package/dist/release.js +10 -0
- package/dist/request-origin.d.ts +4 -0
- package/dist/request-origin.js +10 -0
- package/dist/standalone/agent-archive-owner.d.ts +42 -0
- package/dist/standalone/agent-archive-owner.js +116 -0
- package/dist/standalone/agent-archive-schedules.d.ts +6 -0
- package/dist/standalone/agent-archive-schedules.js +76 -0
- package/dist/standalone/agent-archive.d.ts +31 -0
- package/dist/standalone/agent-archive.js +67 -0
- package/dist/standalone/agent-computers.d.ts +7 -6
- package/dist/standalone/agent-computers.js +4 -7
- package/dist/standalone/agent-mail.d.ts +2 -2
- package/dist/standalone/agents.d.ts +157 -20
- package/dist/standalone/agents.js +242 -38
- package/dist/standalone/app-builds-binding.js +1 -1
- package/dist/standalone/app-set.js +2 -54
- package/dist/standalone/app-source.d.ts +3 -4
- package/dist/standalone/app-source.js +12 -9
- package/dist/standalone/builds.d.ts +2 -14
- package/dist/standalone/builds.js +15 -13
- package/dist/standalone/computer-fleet.d.ts +4 -4
- package/dist/standalone/computer-fleet.js +20 -43
- package/dist/standalone/computer.d.ts +4 -3
- package/dist/standalone/computer.js +52 -53
- package/dist/standalone/dashboard-approval.d.ts +10 -0
- package/dist/standalone/dashboard-approval.js +66 -0
- package/dist/standalone/machine-link.d.ts +4 -221
- package/dist/standalone/machine-link.js +21 -15
- package/dist/standalone/media.d.ts +1 -0
- package/dist/standalone/media.js +20 -14
- package/dist/standalone/owner-routes.d.ts +16 -0
- package/dist/standalone/owner-routes.js +21 -0
- package/dist/standalone/permission-resources.d.ts +5 -0
- package/dist/standalone/permission-resources.js +31 -0
- package/dist/standalone/registry.d.ts +7 -0
- package/dist/standalone/registry.js +3 -0
- package/dist/standalone/tenancy.js +3 -1
- package/dist/standalone/worker-routes.d.ts +19 -0
- package/dist/standalone/worker-routes.js +9 -0
- package/dist/standalone/worker.d.ts +1 -1
- package/dist/standalone/worker.js +27 -35
- package/dist/standalone/workflow-binding.d.ts +8 -3
- package/dist/standalone/workflow-binding.js +14 -5
- package/dist/standalone/workflow-git-capture.js +2 -1
- package/dist/standalone/workflow-host.d.ts +8 -103
- package/dist/standalone/workflow-host.js +1 -1
- package/dist/standalone/workflow-node-capture.js +2 -2
- package/dist/standalone/workflow-root-authority.d.ts +1 -1
- package/dist/standalone/workflow-root-authority.js +1 -1
- package/dist/standalone/workflow-schedules.d.ts +14 -5
- package/dist/standalone/workflow-schedules.js +11 -5
- package/dist/standalone/workflow-webhooks.d.ts +4 -18
- package/dist/standalone/workflow-webhooks.js +5 -5
- package/dist/standalone/workflows.d.ts +36 -28
- package/dist/standalone/workflows.js +6 -3
- package/dist/storage-frame.d.ts +6 -6
- package/dist/testing/capabilities.d.ts +7 -6
- package/dist/testing/capabilities.js +3 -6
- package/dist/testing/installation.d.ts +0 -1
- package/dist/testing/installation.js +2 -5
- package/dist/turnstile.d.ts +27 -0
- package/dist/turnstile.js +51 -0
- package/dist/workers-git.d.ts +12 -4
- package/dist/workers-git.js +58 -36
- package/dist/workers.d.ts +9 -1
- package/dist/workers.js +59 -20
- package/dist/workflows.d.ts +2 -0
- package/dist/workflows.js +1 -0
- package/docs/api/README.md +7 -0
- package/docs/api/agent-schedules.md +175 -0
- package/docs/api/agents.md +34 -13
- package/docs/api/app-storage.md +1 -1
- package/docs/api/apps.md +323 -225
- package/docs/api/authorization.md +1300 -0
- package/docs/api/build-contract.md +2 -2
- package/docs/api/build.md +40 -37
- package/docs/api/cloudflare.md +27 -2
- package/docs/api/git.md +20 -11
- package/docs/api/host.md +80 -199
- package/docs/api/index.md +1 -1
- package/docs/api/invocation.md +15 -11
- package/docs/api/keys.md +1 -98
- package/docs/api/mcp.md +43 -40
- package/docs/api/modules.md +2 -0
- package/docs/api/page/mount.md +16 -19
- package/docs/api/workers-git.md +46 -12
- package/docs/api/workers.md +125 -235
- package/docs/site/agent-quickstart.mdx +6 -2
- package/examples/standalone/wrangler.celld.jsonc +66 -0
- package/package.json +64 -21
- package/dist/standalone/channel-session-door.d.ts +0 -4
- package/dist/standalone/channel-session-door.js +0 -42
|
@@ -87,7 +87,7 @@ export declare function createTeamBuildPublisher(options: Readonly<{
|
|
|
87
87
|
readonly expiresAt: number;
|
|
88
88
|
readonly remote: string;
|
|
89
89
|
readonly reportUrl: string;
|
|
90
|
-
readonly status: "revoked" | "
|
|
90
|
+
readonly status: "revoked" | "failed" | "running" | "succeeded" | "interrupted";
|
|
91
91
|
readonly artifact: {
|
|
92
92
|
readonly digest: string;
|
|
93
93
|
readonly bytes: number;
|
|
@@ -103,7 +103,7 @@ export declare function createTeamBuildPublisher(options: Readonly<{
|
|
|
103
103
|
readonly expiresAt: number;
|
|
104
104
|
readonly remote: string;
|
|
105
105
|
readonly reportUrl: string;
|
|
106
|
-
readonly status: "revoked" | "
|
|
106
|
+
readonly status: "revoked" | "failed" | "running" | "succeeded" | "interrupted";
|
|
107
107
|
readonly artifact: {
|
|
108
108
|
readonly digest: string;
|
|
109
109
|
readonly bytes: number;
|
|
@@ -56,6 +56,8 @@ export declare function buildTeamCandidate(input: {
|
|
|
56
56
|
outputPath: string;
|
|
57
57
|
/** Trusted Computer-local cache; never part of customer configuration. */
|
|
58
58
|
packageStoreDirectory?: string;
|
|
59
|
+
/** Host-owned observation of raw subprocess output; never source configuration. */
|
|
60
|
+
onOutput?: (stream: "stdout" | "stderr", bytes: Uint8Array) => void;
|
|
59
61
|
}): Promise<Readonly<{
|
|
60
62
|
digest: string;
|
|
61
63
|
bytes: number;
|
|
@@ -48,15 +48,19 @@ export async function buildTeamCandidate(input) {
|
|
|
48
48
|
const onPhase = (phase, milliseconds) => {
|
|
49
49
|
phases[phase] += milliseconds;
|
|
50
50
|
};
|
|
51
|
+
const onOutput = (stream, bytes) => {
|
|
52
|
+
input.onOutput?.(stream, bytes);
|
|
53
|
+
};
|
|
51
54
|
const prepareStarted = performance.now();
|
|
52
55
|
const candidate = await Effect.runPromise(createCapturedCandidatePreparer(config, {
|
|
53
56
|
sourceCapture: createLocalCommitSourceCapture(input.repositoryPath, config.sourceRevision),
|
|
54
57
|
buildExecutor: createLocalBuildExecutor(input.packageStoreDirectory === undefined
|
|
55
|
-
? { packageScripts: "run", onPhase }
|
|
58
|
+
? { packageScripts: "run", onPhase, onOutput }
|
|
56
59
|
: {
|
|
57
60
|
packageScripts: "run",
|
|
58
61
|
packageStoreDirectory: input.packageStoreDirectory,
|
|
59
62
|
onPhase,
|
|
63
|
+
onOutput,
|
|
60
64
|
}),
|
|
61
65
|
}).prepareCandidate(parseReleaseId("rel_build")));
|
|
62
66
|
const prepared = performance.now() - prepareStarted;
|
|
@@ -32,6 +32,9 @@ try {
|
|
|
32
32
|
outputPath,
|
|
33
33
|
// Computer scratch survives captured snapshot cleanup, without a global or durable Workspace store.
|
|
34
34
|
packageStoreDirectory: "/var/tmp/fungi-app-package-store",
|
|
35
|
+
onOutput: (stream, bytes) => {
|
|
36
|
+
process[stream].write(bytes);
|
|
37
|
+
},
|
|
35
38
|
});
|
|
36
39
|
const reportUrl = process.env.TEAM_BUILD_REPORT;
|
|
37
40
|
if (!reportUrl)
|
|
@@ -19518,6 +19518,11 @@ var appBackendBindingKinds = {
|
|
|
19518
19518
|
requires: ["workflow.run", "workflow.arm"],
|
|
19519
19519
|
effect: "write"
|
|
19520
19520
|
},
|
|
19521
|
+
pauseSchedule: {
|
|
19522
|
+
cap: "app.workflow.run",
|
|
19523
|
+
requires: ["workflow.run", "workflow.arm"],
|
|
19524
|
+
effect: "write"
|
|
19525
|
+
},
|
|
19521
19526
|
schedules: {
|
|
19522
19527
|
cap: "app.workflow.read",
|
|
19523
19528
|
requires: ["workflow.run"],
|
|
@@ -19659,7 +19664,22 @@ var appBackendBindingKinds = {
|
|
|
19659
19664
|
name: "AGENTS",
|
|
19660
19665
|
operations: {
|
|
19661
19666
|
list: { cap: "agent.list", requires: ["agent.list"], effect: "read" },
|
|
19662
|
-
send: { cap: "agent.send", requires: ["agent.send"], effect: "write" }
|
|
19667
|
+
send: { cap: "agent.send", requires: ["agent.send"], effect: "write" },
|
|
19668
|
+
schedules: {
|
|
19669
|
+
cap: "agent.read",
|
|
19670
|
+
requires: ["agent.read"],
|
|
19671
|
+
effect: "read"
|
|
19672
|
+
},
|
|
19673
|
+
pauseSchedule: {
|
|
19674
|
+
cap: "agent.manage",
|
|
19675
|
+
requires: ["agent.manage"],
|
|
19676
|
+
effect: "write"
|
|
19677
|
+
},
|
|
19678
|
+
deleteSchedule: {
|
|
19679
|
+
cap: "agent.manage",
|
|
19680
|
+
requires: ["agent.manage"],
|
|
19681
|
+
effect: "write"
|
|
19682
|
+
}
|
|
19663
19683
|
}
|
|
19664
19684
|
}
|
|
19665
19685
|
};
|
|
@@ -19714,13 +19734,17 @@ var emptyAppDeclaration = Object.freeze({
|
|
|
19714
19734
|
|
|
19715
19735
|
// ../puffball/dist/app-api.js
|
|
19716
19736
|
var appApiMethodNameSchema = String4.check(makeFilter2(isAppApiMethodName));
|
|
19737
|
+
function isJsonContainer(value) {
|
|
19738
|
+
return value !== null && typeof value === "object";
|
|
19739
|
+
}
|
|
19717
19740
|
function withinDepth(value, depth = 0) {
|
|
19718
19741
|
if (depth > 16)
|
|
19719
19742
|
return false;
|
|
19720
|
-
if (
|
|
19721
|
-
|
|
19722
|
-
|
|
19723
|
-
|
|
19743
|
+
if (isJsonContainer(value)) {
|
|
19744
|
+
for (const child of Object.values(value))
|
|
19745
|
+
if (!withinDepth(child, depth + 1))
|
|
19746
|
+
return false;
|
|
19747
|
+
}
|
|
19724
19748
|
return true;
|
|
19725
19749
|
}
|
|
19726
19750
|
var projection = JsonObject.pipe(check(makeFilter2((value) => new TextEncoder().encode(JSON.stringify(value)).byteLength <= 2e4 && withinDepth(value), { message: "App API schema exceeds its byte or depth bound" })));
|
|
@@ -19731,15 +19755,12 @@ var method = Struct({
|
|
|
19731
19755
|
output: projection,
|
|
19732
19756
|
pending: optional2(Literal2(true)),
|
|
19733
19757
|
hidden: optional2(Literal2(true)),
|
|
19734
|
-
anonymous: optional2(Literal2(true)),
|
|
19735
19758
|
present: optional2(Struct({
|
|
19736
19759
|
verb: String4.check(isMinLength(1), isMaxLength(32))
|
|
19737
19760
|
})),
|
|
19738
19761
|
effect: Literals(["read", "write", "external"]),
|
|
19739
19762
|
requires: ArraySchema(Literals(appCapabilityIds)).pipe(check(makeFilter2((values) => new Set(values).size === values.length)))
|
|
19740
|
-
})
|
|
19741
|
-
message: "Anonymous methods must be reads with no required capabilities"
|
|
19742
|
-
}));
|
|
19763
|
+
});
|
|
19743
19764
|
var appApiSchema = Struct({
|
|
19744
19765
|
methods: Record(String4, method).pipe(check(makeFilter2((methods) => Object.keys(methods).every(is2(appApiMethodNameSchema)), { message: "Invalid App API method name" })), check(makeFilter2((methods) => Object.keys(methods).length <= 64)), check(makeFilter2((methods) => {
|
|
19745
19766
|
const names = Object.keys(methods);
|
|
@@ -21745,6 +21766,12 @@ var BirdDogSystemIdentitySchema = Struct({
|
|
|
21745
21766
|
systemId: Literal2("hub")
|
|
21746
21767
|
});
|
|
21747
21768
|
var BIRD_DOG_DIAGNOSTIC_MAX_LENGTH = 200;
|
|
21769
|
+
var BIRD_DOG_WAITING_MAX_ITEMS = 8;
|
|
21770
|
+
var BirdDogWaitingItemSchema = Struct({
|
|
21771
|
+
itemId: Identifier,
|
|
21772
|
+
kind: String4.check(isMinLength(1), isMaxLength(64)),
|
|
21773
|
+
summary: String4.check(isMinLength(1), isMaxLength(200))
|
|
21774
|
+
});
|
|
21748
21775
|
var SettledBirdDogReplySchema = Struct({
|
|
21749
21776
|
commandId: Identifier,
|
|
21750
21777
|
outcome: Literals([
|
|
@@ -21754,7 +21781,8 @@ var SettledBirdDogReplySchema = Struct({
|
|
|
21754
21781
|
"cancelled",
|
|
21755
21782
|
"outcome_unknown"
|
|
21756
21783
|
]),
|
|
21757
|
-
diagnostic: optionalKey2(String4.check(isMinLength(1), isMaxLength(BIRD_DOG_DIAGNOSTIC_MAX_LENGTH)))
|
|
21784
|
+
diagnostic: optionalKey2(String4.check(isMinLength(1), isMaxLength(BIRD_DOG_DIAGNOSTIC_MAX_LENGTH))),
|
|
21785
|
+
waitingOnYou: optionalKey2(ArraySchema(BirdDogWaitingItemSchema).check(isMinLength(1), isMaxLength(BIRD_DOG_WAITING_MAX_ITEMS)))
|
|
21758
21786
|
});
|
|
21759
21787
|
var BirdDogUndeliverableReasonSchema = Literals([
|
|
21760
21788
|
"recipient_offline",
|
|
@@ -21835,6 +21863,7 @@ var BirdDogAgentJobPayloadSchema = Struct({
|
|
|
21835
21863
|
});
|
|
21836
21864
|
var BirdDogAgentJobInputSchema = Struct({
|
|
21837
21865
|
work: BirdDogAgentWorkSchema,
|
|
21866
|
+
delivery: Literals(["steer", "followUp"]),
|
|
21838
21867
|
mail: optional2(BirdDogMailSchema)
|
|
21839
21868
|
});
|
|
21840
21869
|
|
|
@@ -35634,7 +35663,7 @@ async function stopHtmlGroup(child) {
|
|
|
35634
35663
|
}
|
|
35635
35664
|
throw new Error("HTML process group survived its five-second cleanup bound");
|
|
35636
35665
|
}
|
|
35637
|
-
function runHtmlCommand(args2, cwd, env, command = "pnpm") {
|
|
35666
|
+
function runHtmlCommand(args2, cwd, env, command = "pnpm", onOutput) {
|
|
35638
35667
|
return acquireUseRelease2(
|
|
35639
35668
|
sync2(() => {
|
|
35640
35669
|
if (process.platform === "win32")
|
|
@@ -35649,11 +35678,13 @@ function runHtmlCommand(args2, cwd, env, command = "pnpm") {
|
|
|
35649
35678
|
let stdout = "";
|
|
35650
35679
|
let stderr = "";
|
|
35651
35680
|
child.stdout.on("data", (chunk) => {
|
|
35681
|
+
onOutput?.("stdout", chunk);
|
|
35652
35682
|
stdout += chunk.toString();
|
|
35653
35683
|
if (Buffer2.byteLength(stdout) > 1024 * 1024)
|
|
35654
35684
|
reject(new Error("HTML command output exceeded its bound"));
|
|
35655
35685
|
});
|
|
35656
35686
|
child.stderr.on("data", (chunk) => {
|
|
35687
|
+
onOutput?.("stderr", chunk);
|
|
35657
35688
|
stderr += chunk.toString();
|
|
35658
35689
|
if (Buffer2.byteLength(stderr) > 1024 * 1024)
|
|
35659
35690
|
reject(new Error("HTML command diagnostics exceeded their bound"));
|
|
@@ -35694,10 +35725,10 @@ function snapshotBuildEnvironment(sourceSnapshotPath) {
|
|
|
35694
35725
|
}
|
|
35695
35726
|
function rebuildViteSnapshot(sourceSnapshotPath, recipe, options) {
|
|
35696
35727
|
if (recipe.kind === "source-html")
|
|
35697
|
-
return rebuildNpmSnapshot(sourceSnapshotPath, recipe);
|
|
35728
|
+
return rebuildNpmSnapshot(sourceSnapshotPath, recipe, options);
|
|
35698
35729
|
return gen2(function* () {
|
|
35699
35730
|
const env = snapshotBuildEnvironment(sourceSnapshotPath);
|
|
35700
|
-
const run2 = (args2, cwd = sourceSnapshotPath) => runHtmlCommand(args2, cwd, env);
|
|
35731
|
+
const run2 = (args2, cwd = sourceSnapshotPath) => runHtmlCommand(args2, cwd, env, "pnpm", options.onOutput);
|
|
35701
35732
|
if ((yield* run2(["--version"])).trim() !== "11.24.0") {
|
|
35702
35733
|
return yield* fail5(new Error("Publisher requires pnpm 11.24.0"));
|
|
35703
35734
|
}
|
|
@@ -35915,7 +35946,7 @@ function readHtmlBuildOutput(sourceSnapshotPath, recipe) {
|
|
|
35915
35946
|
return Object.freeze({ kind: "bytes", bytes });
|
|
35916
35947
|
});
|
|
35917
35948
|
}
|
|
35918
|
-
function rebuildNpmSnapshot(sourceSnapshotPath, recipe) {
|
|
35949
|
+
function rebuildNpmSnapshot(sourceSnapshotPath, recipe, options) {
|
|
35919
35950
|
return gen2(function* () {
|
|
35920
35951
|
const env = snapshotBuildEnvironment(sourceSnapshotPath);
|
|
35921
35952
|
const home = join5(sourceSnapshotPath, ".publisher-home");
|
|
@@ -35932,7 +35963,8 @@ function rebuildNpmSnapshot(sourceSnapshotPath, recipe) {
|
|
|
35932
35963
|
["--version"],
|
|
35933
35964
|
sourceSnapshotPath,
|
|
35934
35965
|
env,
|
|
35935
|
-
"npm"
|
|
35966
|
+
"npm",
|
|
35967
|
+
options.onOutput
|
|
35936
35968
|
)).trim() !== recipe.toolchain.npm)
|
|
35937
35969
|
return yield* fail5(
|
|
35938
35970
|
new Error("Captured npm version differs from the recipe")
|
|
@@ -35941,7 +35973,8 @@ function rebuildNpmSnapshot(sourceSnapshotPath, recipe) {
|
|
|
35941
35973
|
["ci", "--include=dev", "--ignore-scripts", "--no-audit", "--no-fund"],
|
|
35942
35974
|
sourceSnapshotPath,
|
|
35943
35975
|
env,
|
|
35944
|
-
"npm"
|
|
35976
|
+
"npm",
|
|
35977
|
+
options.onOutput
|
|
35945
35978
|
);
|
|
35946
35979
|
const program = join5(sourceSnapshotPath, ".publisher-build.mjs");
|
|
35947
35980
|
yield* tryPromise2(async () => {
|
|
@@ -35962,7 +35995,8 @@ function rebuildNpmSnapshot(sourceSnapshotPath, recipe) {
|
|
|
35962
35995
|
],
|
|
35963
35996
|
sourceSnapshotPath,
|
|
35964
35997
|
env,
|
|
35965
|
-
"node"
|
|
35998
|
+
"node",
|
|
35999
|
+
options.onOutput
|
|
35966
36000
|
);
|
|
35967
36001
|
return yield* readHtmlBuildOutput(sourceSnapshotPath, recipe);
|
|
35968
36002
|
});
|
|
@@ -36103,7 +36137,9 @@ function createLocalBuildExecutor(options = {}) {
|
|
|
36103
36137
|
if ((yield* runHtmlCommand(
|
|
36104
36138
|
["--version"],
|
|
36105
36139
|
source.snapshotPath,
|
|
36106
|
-
environment
|
|
36140
|
+
environment,
|
|
36141
|
+
"pnpm",
|
|
36142
|
+
options.onOutput
|
|
36107
36143
|
)).trim() !== "11.24.0")
|
|
36108
36144
|
return yield* fail5(
|
|
36109
36145
|
new Error("Publisher requires pnpm 11.24.0")
|
|
@@ -36114,7 +36150,9 @@ function createLocalBuildExecutor(options = {}) {
|
|
|
36114
36150
|
options.packageCacheDirectory
|
|
36115
36151
|
),
|
|
36116
36152
|
source.snapshotPath,
|
|
36117
|
-
environment
|
|
36153
|
+
environment,
|
|
36154
|
+
"pnpm",
|
|
36155
|
+
options.onOutput
|
|
36118
36156
|
);
|
|
36119
36157
|
}
|
|
36120
36158
|
}
|
|
@@ -36265,6 +36303,9 @@ async function buildTeamCandidate(input) {
|
|
|
36265
36303
|
const onPhase = (phase, milliseconds) => {
|
|
36266
36304
|
phases[phase] += milliseconds;
|
|
36267
36305
|
};
|
|
36306
|
+
const onOutput = (stream, bytes2) => {
|
|
36307
|
+
input.onOutput?.(stream, bytes2);
|
|
36308
|
+
};
|
|
36268
36309
|
const prepareStarted = performance.now();
|
|
36269
36310
|
const candidate = await runPromise2(
|
|
36270
36311
|
createCapturedCandidatePreparer(config2, {
|
|
@@ -36273,10 +36314,11 @@ async function buildTeamCandidate(input) {
|
|
|
36273
36314
|
config2.sourceRevision
|
|
36274
36315
|
),
|
|
36275
36316
|
buildExecutor: createLocalBuildExecutor(
|
|
36276
|
-
input.packageStoreDirectory === void 0 ? { packageScripts: "run", onPhase } : {
|
|
36317
|
+
input.packageStoreDirectory === void 0 ? { packageScripts: "run", onPhase, onOutput } : {
|
|
36277
36318
|
packageScripts: "run",
|
|
36278
36319
|
packageStoreDirectory: input.packageStoreDirectory,
|
|
36279
|
-
onPhase
|
|
36320
|
+
onPhase,
|
|
36321
|
+
onOutput
|
|
36280
36322
|
}
|
|
36281
36323
|
)
|
|
36282
36324
|
}).prepareCandidate(parseReleaseId("rel_build"))
|
|
@@ -36347,7 +36389,10 @@ try {
|
|
|
36347
36389
|
repositoryPath,
|
|
36348
36390
|
outputPath,
|
|
36349
36391
|
// Computer scratch survives captured snapshot cleanup, without a global or durable Workspace store.
|
|
36350
|
-
packageStoreDirectory: "/var/tmp/fungi-app-package-store"
|
|
36392
|
+
packageStoreDirectory: "/var/tmp/fungi-app-package-store",
|
|
36393
|
+
onOutput: (stream, bytes) => {
|
|
36394
|
+
process[stream].write(bytes);
|
|
36395
|
+
}
|
|
36351
36396
|
});
|
|
36352
36397
|
const reportUrl = process.env.TEAM_BUILD_REPORT;
|
|
36353
36398
|
if (!reportUrl) throw new TeamCandidateBuildError("report_failed");
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as Schema from "effect/Schema";
|
|
2
|
+
/** Maximum retained combined stdout/stderr bytes, split equally into head and tail. */
|
|
3
|
+
export declare const buildJobLogMaxBytes: number;
|
|
4
|
+
/** Base64url preserves raw command bytes, including split UTF-8 and terminal control bytes. */
|
|
5
|
+
export declare const buildJobLogSchema: Schema.Struct<{
|
|
6
|
+
readonly encoding: Schema.Literal<"base64url">;
|
|
7
|
+
readonly output: Schema.String;
|
|
8
|
+
readonly truncated: Schema.NullOr<Schema.Struct<{
|
|
9
|
+
readonly droppedBytes: Schema.Number;
|
|
10
|
+
}>>;
|
|
11
|
+
}>;
|
|
12
|
+
export type BuildJobLog = Schema.Schema.Type<typeof buildJobLogSchema>;
|
|
13
|
+
/** The artifact-upload door cannot write this host-owned job-log namespace. */
|
|
14
|
+
export declare const isBuildJobLogRef: (ref: string) => boolean;
|
|
15
|
+
/** One bounded raw-event sink; event arrival order is the combined output order. */
|
|
16
|
+
export declare function createBuildJobLog(): {
|
|
17
|
+
/** Retained buffer capacity, distinct from the transient encoded result. */
|
|
18
|
+
readonly allocatedBytes: number;
|
|
19
|
+
append(bytes: Uint8Array): void;
|
|
20
|
+
finish(): BuildJobLog;
|
|
21
|
+
};
|
|
22
|
+
/** Preserve BirdDog's redacted 200-character status/mail budget and name the full log. */
|
|
23
|
+
export declare function buildJobDiagnostic(jobId: string, detail: string): string;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import * as Schema from "effect/Schema";
|
|
2
|
+
import { base64url } from "jose";
|
|
3
|
+
import { boundedDiagnostic } from "@fungi.computer/bird-dog/effect";
|
|
4
|
+
/** Maximum retained combined stdout/stderr bytes, split equally into head and tail. */
|
|
5
|
+
export const buildJobLogMaxBytes = 2 * 1024 * 1024;
|
|
6
|
+
/** Base64url preserves raw command bytes, including split UTF-8 and terminal control bytes. */
|
|
7
|
+
export const buildJobLogSchema = Schema.Struct({
|
|
8
|
+
encoding: Schema.Literal("base64url"),
|
|
9
|
+
output: Schema.String.check(Schema.isMaxLength(Math.ceil(buildJobLogMaxBytes / 3) * 4)),
|
|
10
|
+
truncated: Schema.NullOr(Schema.Struct({
|
|
11
|
+
droppedBytes: Schema.Number.check(Schema.isInt(), Schema.isGreaterThan(0)),
|
|
12
|
+
})),
|
|
13
|
+
});
|
|
14
|
+
/** The artifact-upload door cannot write this host-owned job-log namespace. */
|
|
15
|
+
export const isBuildJobLogRef = (ref) => ref.startsWith("artifact:build-log-");
|
|
16
|
+
/** One bounded raw-event sink; event arrival order is the combined output order. */
|
|
17
|
+
export function createBuildJobLog() {
|
|
18
|
+
const half = buildJobLogMaxBytes / 2;
|
|
19
|
+
let head = new Uint8Array(0);
|
|
20
|
+
let tail = new Uint8Array(0);
|
|
21
|
+
let headBytes = 0;
|
|
22
|
+
let tailBytes = 0;
|
|
23
|
+
let tailPosition = 0;
|
|
24
|
+
let total = 0;
|
|
25
|
+
const capacityFor = (current, needed) => Math.min(half, Math.max(needed, current === 0 ? 4096 : current * 2));
|
|
26
|
+
return {
|
|
27
|
+
/** Retained buffer capacity, distinct from the transient encoded result. */
|
|
28
|
+
get allocatedBytes() {
|
|
29
|
+
return head.byteLength + tail.byteLength;
|
|
30
|
+
},
|
|
31
|
+
append(bytes) {
|
|
32
|
+
total += bytes.byteLength;
|
|
33
|
+
const prefix = Math.min(half - headBytes, bytes.byteLength);
|
|
34
|
+
if (headBytes + prefix > head.byteLength) {
|
|
35
|
+
const next = new Uint8Array(capacityFor(head.byteLength, headBytes + prefix));
|
|
36
|
+
next.set(head.subarray(0, headBytes));
|
|
37
|
+
head = next;
|
|
38
|
+
}
|
|
39
|
+
head.set(bytes.subarray(0, prefix), headBytes);
|
|
40
|
+
headBytes += prefix;
|
|
41
|
+
const remaining = bytes.subarray(prefix);
|
|
42
|
+
if (remaining.byteLength === 0)
|
|
43
|
+
return;
|
|
44
|
+
const needed = Math.min(half, tailBytes + remaining.byteLength);
|
|
45
|
+
if (needed > tail.byteLength) {
|
|
46
|
+
const next = new Uint8Array(capacityFor(tail.byteLength, needed));
|
|
47
|
+
const start = tailBytes === tail.byteLength ? tailPosition : 0;
|
|
48
|
+
const first = Math.min(tailBytes, tail.byteLength - start);
|
|
49
|
+
next.set(tail.subarray(start, start + first));
|
|
50
|
+
next.set(tail.subarray(0, tailBytes - first), first);
|
|
51
|
+
tail = next;
|
|
52
|
+
tailPosition = tailBytes;
|
|
53
|
+
}
|
|
54
|
+
const suffix = remaining.subarray(Math.max(0, remaining.byteLength - half));
|
|
55
|
+
if (remaining.byteLength >= half) {
|
|
56
|
+
tailBytes = 0;
|
|
57
|
+
tailPosition = 0;
|
|
58
|
+
}
|
|
59
|
+
const first = Math.min(suffix.byteLength, tail.byteLength - tailPosition);
|
|
60
|
+
tail.set(suffix.subarray(0, first), tailPosition);
|
|
61
|
+
tail.set(suffix.subarray(first), 0);
|
|
62
|
+
tailPosition = (tailPosition + suffix.byteLength) % tail.byteLength;
|
|
63
|
+
tailBytes = Math.min(half, tailBytes + remaining.byteLength);
|
|
64
|
+
},
|
|
65
|
+
finish() {
|
|
66
|
+
const bytes = new Uint8Array(headBytes + tailBytes);
|
|
67
|
+
bytes.set(head.subarray(0, headBytes));
|
|
68
|
+
const start = tailBytes === tail.byteLength ? tailPosition : 0;
|
|
69
|
+
const first = Math.min(tailBytes, tail.byteLength - start);
|
|
70
|
+
bytes.set(tail.subarray(start, start + first), headBytes);
|
|
71
|
+
bytes.set(tail.subarray(0, tailBytes - first), headBytes + first);
|
|
72
|
+
const droppedBytes = total - bytes.byteLength;
|
|
73
|
+
return {
|
|
74
|
+
encoding: "base64url",
|
|
75
|
+
output: base64url.encode(bytes),
|
|
76
|
+
truncated: droppedBytes === 0 ? null : { droppedBytes },
|
|
77
|
+
};
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
/** The job read door, not an artifact-serving URL. */
|
|
82
|
+
const buildJobLogReference = (jobId) => `/api/builds/${encodeURIComponent(jobId)}?log`;
|
|
83
|
+
/** Preserve BirdDog's redacted 200-character status/mail budget and name the full log. */
|
|
84
|
+
export function buildJobDiagnostic(jobId, detail) {
|
|
85
|
+
const reference = `Log: ${buildJobLogReference(jobId)}`;
|
|
86
|
+
const diagnostic = boundedDiagnostic(detail) ?? "Build finished";
|
|
87
|
+
return `${reference}\n${diagnostic.slice(0, 200 - reference.length - 1)}`;
|
|
88
|
+
}
|
|
@@ -53,6 +53,8 @@ export type LocalBuildExecutorOptions = Readonly<{
|
|
|
53
53
|
packageScripts?: "run";
|
|
54
54
|
/** Hears how long the dependency install and the compile each took. */
|
|
55
55
|
onPhase?: (phase: "install" | "build", milliseconds: number) => void;
|
|
56
|
+
/** Forward raw install/build output to the admitted Computer's job log. */
|
|
57
|
+
onOutput?: (stream: "stdout" | "stderr", bytes: Uint8Array) => void;
|
|
56
58
|
}>;
|
|
57
59
|
/** Exact pinned esbuild options shared by local builds and artifact-budget proofs. */
|
|
58
60
|
export declare function localSnapshotBuildOptions(source: CapturedSource, recipe: PinnedRecipe, emission: DefinitionEmission): esbuild.BuildOptions;
|
|
@@ -571,7 +571,7 @@ async function stopHtmlGroup(child) {
|
|
|
571
571
|
}
|
|
572
572
|
throw new Error("HTML process group survived its five-second cleanup bound");
|
|
573
573
|
}
|
|
574
|
-
function runHtmlCommand(args, cwd, env, command = "pnpm") {
|
|
574
|
+
function runHtmlCommand(args, cwd, env, command = "pnpm", onOutput) {
|
|
575
575
|
return Effect.acquireUseRelease(Effect.sync(() => {
|
|
576
576
|
if (process.platform === "win32")
|
|
577
577
|
throw new Error("HTML builds require POSIX process groups");
|
|
@@ -585,11 +585,13 @@ function runHtmlCommand(args, cwd, env, command = "pnpm") {
|
|
|
585
585
|
let stdout = "";
|
|
586
586
|
let stderr = "";
|
|
587
587
|
child.stdout.on("data", (chunk) => {
|
|
588
|
+
onOutput?.("stdout", chunk);
|
|
588
589
|
stdout += chunk.toString();
|
|
589
590
|
if (Buffer.byteLength(stdout) > 1024 * 1024)
|
|
590
591
|
reject(new Error("HTML command output exceeded its bound"));
|
|
591
592
|
});
|
|
592
593
|
child.stderr.on("data", (chunk) => {
|
|
594
|
+
onOutput?.("stderr", chunk);
|
|
593
595
|
stderr += chunk.toString();
|
|
594
596
|
if (Buffer.byteLength(stderr) > 1024 * 1024)
|
|
595
597
|
reject(new Error("HTML command diagnostics exceeded their bound"));
|
|
@@ -632,10 +634,10 @@ function snapshotBuildEnvironment(sourceSnapshotPath) {
|
|
|
632
634
|
}
|
|
633
635
|
function rebuildViteSnapshot(sourceSnapshotPath, recipe, options) {
|
|
634
636
|
if (recipe.kind === "source-html")
|
|
635
|
-
return rebuildNpmSnapshot(sourceSnapshotPath, recipe);
|
|
637
|
+
return rebuildNpmSnapshot(sourceSnapshotPath, recipe, options);
|
|
636
638
|
return Effect.gen(function* () {
|
|
637
639
|
const env = snapshotBuildEnvironment(sourceSnapshotPath);
|
|
638
|
-
const run = (args, cwd = sourceSnapshotPath) => runHtmlCommand(args, cwd, env);
|
|
640
|
+
const run = (args, cwd = sourceSnapshotPath) => runHtmlCommand(args, cwd, env, "pnpm", options.onOutput);
|
|
639
641
|
if ((yield* run(["--version"])).trim() !== "11.24.0") {
|
|
640
642
|
return yield* Effect.fail(new Error("Publisher requires pnpm 11.24.0"));
|
|
641
643
|
}
|
|
@@ -827,7 +829,7 @@ function readHtmlBuildOutput(sourceSnapshotPath, recipe) {
|
|
|
827
829
|
return Object.freeze({ kind: "bytes", bytes });
|
|
828
830
|
});
|
|
829
831
|
}
|
|
830
|
-
function rebuildNpmSnapshot(sourceSnapshotPath, recipe) {
|
|
832
|
+
function rebuildNpmSnapshot(sourceSnapshotPath, recipe, options) {
|
|
831
833
|
return Effect.gen(function* () {
|
|
832
834
|
const env = snapshotBuildEnvironment(sourceSnapshotPath);
|
|
833
835
|
const home = join(sourceSnapshotPath, ".publisher-home");
|
|
@@ -840,9 +842,9 @@ function rebuildNpmSnapshot(sourceSnapshotPath, recipe) {
|
|
|
840
842
|
await writeFile(userConfig, "", { flag: "wx" });
|
|
841
843
|
await writeFile(globalConfig, "", { flag: "wx" });
|
|
842
844
|
});
|
|
843
|
-
if ((yield* runHtmlCommand(["--version"], sourceSnapshotPath, env, "npm")).trim() !== recipe.toolchain.npm)
|
|
845
|
+
if ((yield* runHtmlCommand(["--version"], sourceSnapshotPath, env, "npm", options.onOutput)).trim() !== recipe.toolchain.npm)
|
|
844
846
|
return yield* Effect.fail(new Error("Captured npm version differs from the recipe"));
|
|
845
|
-
yield* runHtmlCommand(["ci", "--include=dev", "--ignore-scripts", "--no-audit", "--no-fund"], sourceSnapshotPath, env, "npm");
|
|
847
|
+
yield* runHtmlCommand(["ci", "--include=dev", "--ignore-scripts", "--no-audit", "--no-fund"], sourceSnapshotPath, env, "npm", options.onOutput);
|
|
846
848
|
const program = join(sourceSnapshotPath, ".publisher-build.mjs");
|
|
847
849
|
yield* Effect.tryPromise(async () => {
|
|
848
850
|
const { htmlBuildProgram } = await snapshotPrograms();
|
|
@@ -858,7 +860,7 @@ function rebuildNpmSnapshot(sourceSnapshotPath, recipe) {
|
|
|
858
860
|
dirname(recipe.entry),
|
|
859
861
|
"true",
|
|
860
862
|
"",
|
|
861
|
-
], sourceSnapshotPath, env, "node");
|
|
863
|
+
], sourceSnapshotPath, env, "node", options.onOutput);
|
|
862
864
|
return yield* readHtmlBuildOutput(sourceSnapshotPath, recipe);
|
|
863
865
|
});
|
|
864
866
|
}
|
|
@@ -982,9 +984,9 @@ export function createLocalBuildExecutor(options = {}) {
|
|
|
982
984
|
})))(await readFile(join(source.snapshotPath, "package.json"), "utf8"));
|
|
983
985
|
});
|
|
984
986
|
const environment = snapshotBuildEnvironment(source.snapshotPath);
|
|
985
|
-
if ((yield* runHtmlCommand(["--version"], source.snapshotPath, environment)).trim() !== "11.24.0")
|
|
987
|
+
if ((yield* runHtmlCommand(["--version"], source.snapshotPath, environment, "pnpm", options.onOutput)).trim() !== "11.24.0")
|
|
986
988
|
return yield* Effect.fail(new Error("Publisher requires pnpm 11.24.0"));
|
|
987
|
-
yield* runHtmlCommand(frozenSnapshotInstallArguments(options.packageStoreDirectory, options.packageCacheDirectory), source.snapshotPath, environment);
|
|
989
|
+
yield* runHtmlCommand(frozenSnapshotInstallArguments(options.packageStoreDirectory, options.packageCacheDirectory), source.snapshotPath, environment, "pnpm", options.onOutput);
|
|
988
990
|
}
|
|
989
991
|
}
|
|
990
992
|
const ui = yield* recipe.kind === "bundled-html"
|
|
@@ -9,11 +9,18 @@ export type ConversationBinding = Readonly<{
|
|
|
9
9
|
verifier: "fungi-v1" | "github" | "secret-url";
|
|
10
10
|
eventsPerMinute: number;
|
|
11
11
|
}> | Readonly<{
|
|
12
|
-
provider: "web"
|
|
12
|
+
provider: "web";
|
|
13
|
+
siteKey: string;
|
|
14
|
+
origins: readonly string[];
|
|
15
|
+
accent?: string | undefined;
|
|
16
|
+
}> | Readonly<{
|
|
17
|
+
provider: "discord" | "email" | "game";
|
|
13
18
|
}>;
|
|
14
19
|
/** Zod's optional binding projection may carry an explicit undefined. */
|
|
15
20
|
limits?: BindingLimits | undefined;
|
|
16
21
|
}>;
|
|
22
|
+
/** Does one allowlisted origin admit this exact browser origin? */
|
|
23
|
+
export declare function originAllowed(allowed: readonly string[], origin: string): boolean;
|
|
17
24
|
/** Per-party edge limits applied before any work is accepted. */
|
|
18
25
|
export declare const bindingLimitsSchema: z.ZodObject<{
|
|
19
26
|
messagesPerPartyPerDay: z.ZodNumber;
|
package/dist/channels/binding.js
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { channelIds } from "./ids.js";
|
|
3
|
+
/** Does one allowlisted origin admit this exact browser origin? */
|
|
4
|
+
export function originAllowed(allowed, origin) {
|
|
5
|
+
return allowed.some((entry) => {
|
|
6
|
+
if (!entry.startsWith("https://*."))
|
|
7
|
+
return entry === origin;
|
|
8
|
+
const suffix = entry.slice("https://*".length);
|
|
9
|
+
if (!origin.startsWith("https://") || !origin.endsWith(suffix))
|
|
10
|
+
return false;
|
|
11
|
+
const label = origin.slice("https://".length, -suffix.length);
|
|
12
|
+
return label.length > 0 && !label.includes(".");
|
|
13
|
+
});
|
|
14
|
+
}
|
|
3
15
|
/** Per-party edge limits applied before any work is accepted. */
|
|
4
16
|
export const bindingLimitsSchema = z.strictObject({
|
|
5
17
|
messagesPerPartyPerDay: z.number().int().min(1).max(10_000),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { type FungiAuthor, type AuthorMeta
|
|
2
|
+
import { type FungiAuthor, type AuthorMeta } from "@fungi.computer/agar/agents";
|
|
3
3
|
import { type Handoff } from "@fungi.computer/agar/channels";
|
|
4
4
|
import { type ConversationBinding, type ChannelParty } from "./binding.js";
|
|
5
5
|
export type HandoffEvent = Readonly<{
|
|
@@ -124,12 +124,11 @@ export type ChannelWithdrawResult = Readonly<{
|
|
|
124
124
|
commandId: string;
|
|
125
125
|
sessionId?: string;
|
|
126
126
|
}>;
|
|
127
|
-
/**
|
|
128
|
-
export type
|
|
127
|
+
/** A host-projected intent contains no private metadata or internal request key. */
|
|
128
|
+
export type VisitorPendingPrompt = Readonly<{
|
|
129
129
|
requestId: string;
|
|
130
130
|
commandId: string;
|
|
131
131
|
text: string;
|
|
132
|
-
meta?: MessageMetaValue | undefined;
|
|
133
132
|
delivery: "steer" | "followUp";
|
|
134
133
|
images?: readonly Readonly<{
|
|
135
134
|
type: "image";
|
|
@@ -137,10 +136,22 @@ export type ChannelPendingPrompt = Readonly<{
|
|
|
137
136
|
mimeType: string;
|
|
138
137
|
}>[] | undefined;
|
|
139
138
|
}>;
|
|
139
|
+
/** Only public baseline pagination crosses the visitor Session port. */
|
|
140
|
+
export type VisitorReadOptions = Readonly<{
|
|
141
|
+
limit?: number;
|
|
142
|
+
before?: string;
|
|
143
|
+
}>;
|
|
140
144
|
/** The channel's narrow Session port; hosts translate to their durable client. */
|
|
141
145
|
export type SessionDoor = Readonly<{
|
|
142
146
|
withdraw: (sessionId: string, requestId: string) => Promise<ChannelWithdrawResult>;
|
|
143
|
-
latestPending: (sessionId: string, visitor: FungiAuthor) => Promise<
|
|
147
|
+
latestPending: (sessionId: string, visitor: FungiAuthor) => Promise<VisitorPendingPrompt | null>;
|
|
148
|
+
participantDocument: (sessionId: string, visitorId: string, options: VisitorReadOptions) => Promise<string>;
|
|
149
|
+
participantStream: (sessionId: string, visitorId: string, options: Readonly<{
|
|
150
|
+
expiresAt: number;
|
|
151
|
+
now: () => number;
|
|
152
|
+
release: () => void;
|
|
153
|
+
canRead: () => Promise<boolean>;
|
|
154
|
+
}>) => Promise<ReadableStream<Uint8Array>>;
|
|
144
155
|
createSession: (requestId: string) => Promise<string>;
|
|
145
156
|
/** Deliver this conversation Session's tool grants to the runtime. */
|
|
146
157
|
deliverGrants: (sessionId: string) => void;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { type ConversationBinding } from "./binding.js";
|
|
2
|
+
import { type ChannelConversations, type ChannelWithdrawResult, type InboundEvent, type IntakeResult, type SessionDoor, type VisitorPendingPrompt, type VisitorReadOptions } from "./conversations.js";
|
|
3
|
+
import type { ChannelVisitors, VisitorGrant } from "./visitors.js";
|
|
4
|
+
/**
|
|
5
|
+
* Web visitor sequencing only. The host owns authorization, its admission
|
|
6
|
+
* receipt and the Session implementation; identity and conversations can live
|
|
7
|
+
* in different stores (and, in standalone, different Agents).
|
|
8
|
+
*/
|
|
9
|
+
export declare function createVisitorChannel(options: Readonly<{
|
|
10
|
+
binding: (bindingId: string) => ConversationBinding | null;
|
|
11
|
+
visitors: () => ChannelVisitors;
|
|
12
|
+
conversations: () => ChannelConversations;
|
|
13
|
+
sessionDoor: () => SessionDoor;
|
|
14
|
+
intake: (event: InboundEvent) => Promise<IntakeResult>;
|
|
15
|
+
acquireStream: (bindingId: string, visitorId: string, addressHash: string) => (() => void) | null;
|
|
16
|
+
now: () => number;
|
|
17
|
+
}>): {
|
|
18
|
+
mint: (bindingId: string, siteKey: string, addressHash: string) => Promise<VisitorGrant>;
|
|
19
|
+
refresh: (bindingId: string, secret: string) => Promise<VisitorGrant>;
|
|
20
|
+
rotate: (bindingId: string, siteKey: string, token: string, addressHash: string) => Promise<VisitorGrant | Readonly<{
|
|
21
|
+
kind: "unauthorized";
|
|
22
|
+
}>>;
|
|
23
|
+
send: (bindingId: string, token: string, requestId: string, text: string) => Promise<IntakeResult | Readonly<{
|
|
24
|
+
kind: "unauthorized";
|
|
25
|
+
}>>;
|
|
26
|
+
withdraw: (bindingId: string, token: string, rawRequestId: string) => Promise<ChannelWithdrawResult | Readonly<{
|
|
27
|
+
kind: "unauthorized";
|
|
28
|
+
}> | Readonly<{
|
|
29
|
+
kind: "denied";
|
|
30
|
+
reason: "event_conflict" | "new_party_limit" | "banned";
|
|
31
|
+
}>>;
|
|
32
|
+
latestPending: (bindingId: string, token: string) => Promise<VisitorPendingPrompt | null | Readonly<{
|
|
33
|
+
kind: "unauthorized";
|
|
34
|
+
}>>;
|
|
35
|
+
open: (bindingId: string, token: string, read: VisitorReadOptions) => Promise<Readonly<{
|
|
36
|
+
kind: "session";
|
|
37
|
+
snapshot: string;
|
|
38
|
+
}> | Readonly<{
|
|
39
|
+
kind: "unauthorized";
|
|
40
|
+
}> | Readonly<{
|
|
41
|
+
kind: "denied";
|
|
42
|
+
reason: "new_party_limit" | "banned";
|
|
43
|
+
}>>;
|
|
44
|
+
watch: (bindingId: string, token: string, canRead: (visitorId: string) => Promise<boolean>) => Promise<Readonly<{
|
|
45
|
+
kind: "stream";
|
|
46
|
+
body: ReadableStream<Uint8Array>;
|
|
47
|
+
}> | Readonly<{
|
|
48
|
+
kind: "empty" | "unauthorized";
|
|
49
|
+
}> | Readonly<{
|
|
50
|
+
kind: "denied";
|
|
51
|
+
reason: "suspended" | "stream_limit";
|
|
52
|
+
}>>;
|
|
53
|
+
};
|