@fungi.computer/oyster 0.40.0 → 0.41.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/app-builds.d.ts +1 -1
- package/dist/app-builds.js +12 -12
- package/dist/build/job-log.d.ts +10 -4
- package/dist/build/job-log.js +101 -4
- package/dist/cloudflare.js +24 -12
- package/dist/standalone/agents.js +19 -8
- package/dist/standalone/computer.js +1 -1
- package/dist/standalone/registry.js +1 -1
- package/dist/standalone/workflow-binding.d.ts +20 -0
- package/dist/standalone/workflow-host.js +14 -2
- package/dist/standalone/workflow-trigger-host.d.ts +5 -1
- package/dist/standalone/workflows.d.ts +28 -4
- package/dist/standalone/workflows.js +3 -14
- package/docs/api/host.md +1 -0
- package/package.json +3 -3
package/dist/app-builds.d.ts
CHANGED
|
@@ -267,7 +267,7 @@ export declare function createOysterAppBuilds(options: OysterAppBuildOptions): R
|
|
|
267
267
|
credentialId: string;
|
|
268
268
|
status: "succeeded" | "failed";
|
|
269
269
|
detail: string | null;
|
|
270
|
-
}>): void
|
|
270
|
+
}>): Promise<void>;
|
|
271
271
|
/**
|
|
272
272
|
* May this live job's build upload one object now, and how large? The
|
|
273
273
|
* grant is the one inside the job's fixed command; the bound is its
|
package/dist/app-builds.js
CHANGED
|
@@ -233,8 +233,8 @@ export function createOysterAppBuilds(options) {
|
|
|
233
233
|
: { digest: job.artifact_digest, bytes: job.artifact_bytes },
|
|
234
234
|
detail: job.detail,
|
|
235
235
|
});
|
|
236
|
-
const settle = (jobId, status, detail) => {
|
|
237
|
-
const diagnostic = detail === null ? null : buildJobDiagnostic(jobId, detail);
|
|
236
|
+
const settle = async (jobId, status, detail) => {
|
|
237
|
+
const diagnostic = detail === null ? null : await buildJobDiagnostic(jobId, detail);
|
|
238
238
|
owner.sql.exec(`UPDATE oyster_build_jobs SET installation=CASE WHEN ?='succeeded' THEN installation ELSE ${failedInstallation} END,
|
|
239
239
|
status=?, detail=?, expires_at=MIN(expires_at, ?) WHERE job_id=? AND status='running'`, status, diagnostic, status, diagnostic, now(), jobId);
|
|
240
240
|
};
|
|
@@ -277,9 +277,9 @@ export function createOysterAppBuilds(options) {
|
|
|
277
277
|
team: {
|
|
278
278
|
// The job row is minted in `start`; the lifecycle only reads it back.
|
|
279
279
|
mintTeamBuildCredential: ({ jobId }) => Promise.resolve(lifecycleJob(required(jobId))),
|
|
280
|
-
revokeTeamBuild: (jobId) => {
|
|
281
|
-
settle(jobId, "revoked", "Build revoked");
|
|
282
|
-
return
|
|
280
|
+
revokeTeamBuild: async (jobId) => {
|
|
281
|
+
await settle(jobId, "revoked", "Build revoked");
|
|
282
|
+
return lifecycleJob(required(jobId));
|
|
283
283
|
},
|
|
284
284
|
build: () => Promise.resolve({
|
|
285
285
|
prepare: (jobId) => Promise.resolve(lifecycleJob(required(jobId))),
|
|
@@ -287,9 +287,9 @@ export function createOysterAppBuilds(options) {
|
|
|
287
287
|
const job = readJob(jobId);
|
|
288
288
|
return Promise.resolve(job === null ? null : lifecycleJob(job));
|
|
289
289
|
},
|
|
290
|
-
complete: (jobId, status, detail) => {
|
|
291
|
-
settle(jobId, status, detail);
|
|
292
|
-
return
|
|
290
|
+
complete: async (jobId, status, detail) => {
|
|
291
|
+
await settle(jobId, status, detail);
|
|
292
|
+
return lifecycleJob(required(jobId));
|
|
293
293
|
},
|
|
294
294
|
// Oyster's egress writes job facts here directly; nothing is queued.
|
|
295
295
|
deliverProjection: () => Promise.resolve(),
|
|
@@ -339,7 +339,7 @@ export function createOysterAppBuilds(options) {
|
|
|
339
339
|
// An unknown output can belong to a live builder. Its reports can
|
|
340
340
|
// still succeed; the existing build expiry interrupts it if abandoned.
|
|
341
341
|
if (!(cause instanceof BuildOutcomeUnknown))
|
|
342
|
-
settle(jobId, "failed", candidateFailureDiagnostic(cause));
|
|
342
|
+
await settle(jobId, "failed", candidateFailureDiagnostic(cause));
|
|
343
343
|
}
|
|
344
344
|
return view(required(jobId));
|
|
345
345
|
};
|
|
@@ -609,7 +609,7 @@ export function createOysterAppBuilds(options) {
|
|
|
609
609
|
.toArray().length > 0);
|
|
610
610
|
},
|
|
611
611
|
/** A reported artifact or status for a live job. */
|
|
612
|
-
record(event) {
|
|
612
|
+
async record(event) {
|
|
613
613
|
const job = readJob(event.jobId);
|
|
614
614
|
if (!live(job) || job.credential_id !== event.credentialId)
|
|
615
615
|
return;
|
|
@@ -617,7 +617,7 @@ export function createOysterAppBuilds(options) {
|
|
|
617
617
|
owner.sql.exec("UPDATE oyster_build_jobs SET artifact_digest=?, artifact_bytes=? WHERE job_id=?", event.digest, event.bytes, event.jobId);
|
|
618
618
|
// Success is the recorded Release's fact, never the report's alone.
|
|
619
619
|
else if (event.status === "failed" || readRelease(event.jobId) !== null)
|
|
620
|
-
settle(event.jobId, event.status, event.detail);
|
|
620
|
+
await settle(event.jobId, event.status, event.detail);
|
|
621
621
|
},
|
|
622
622
|
/**
|
|
623
623
|
* May this live job's build upload one object now, and how large? The
|
|
@@ -693,7 +693,7 @@ export function createOysterAppBuilds(options) {
|
|
|
693
693
|
await verifyRelease(options.artifacts, release, defaultAssetPolicy, false);
|
|
694
694
|
}
|
|
695
695
|
catch {
|
|
696
|
-
settle(jobId, "failed", "Candidate could not be stored as a Release");
|
|
696
|
+
await settle(jobId, "failed", "Candidate could not be stored as a Release");
|
|
697
697
|
return new Response(null, { status: 422 });
|
|
698
698
|
}
|
|
699
699
|
owner.transactionSync(() => {
|
package/dist/build/job-log.d.ts
CHANGED
|
@@ -12,12 +12,18 @@ export declare const buildJobLogSchema: Schema.Struct<{
|
|
|
12
12
|
export type BuildJobLog = Schema.Schema.Type<typeof buildJobLogSchema>;
|
|
13
13
|
/** The artifact-upload door cannot write this host-owned job-log namespace. */
|
|
14
14
|
export declare const isBuildJobLogRef: (ref: string) => boolean;
|
|
15
|
-
/**
|
|
16
|
-
export declare
|
|
15
|
+
/** What a host writes where it cannot redact: the ADR's form, never raw output. */
|
|
16
|
+
export declare const redactionWithheld = "[output withheld: redaction unavailable]";
|
|
17
|
+
/**
|
|
18
|
+
* One bounded sink for a build's combined output. Veil's pattern redactor
|
|
19
|
+
* (S3's gitleaks rules) runs before a byte is retained, so the stored log and
|
|
20
|
+
* every `?log` read of it are already scrubbed.
|
|
21
|
+
*/
|
|
22
|
+
export declare function createBuildJobLog(): Promise<{
|
|
17
23
|
/** Retained buffer capacity, distinct from the transient encoded result. */
|
|
18
24
|
readonly allocatedBytes: number;
|
|
19
25
|
append(bytes: Uint8Array): void;
|
|
20
26
|
finish(): BuildJobLog;
|
|
21
|
-
}
|
|
27
|
+
}>;
|
|
22
28
|
/** Preserve BirdDog's redacted 200-character status/mail budget and name the full log. */
|
|
23
|
-
export declare function buildJobDiagnostic(jobId: string, detail: string): string
|
|
29
|
+
export declare function buildJobDiagnostic(jobId: string, detail: string): Promise<string>;
|
package/dist/build/job-log.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as Schema from "effect/Schema";
|
|
2
2
|
import { base64url } from "jose";
|
|
3
3
|
import { boundedDiagnostic } from "@fungi.computer/bird-dog/effect";
|
|
4
|
+
import { loadPatternRedactor, } from "@fungi.computer/veil/redaction";
|
|
4
5
|
/** Maximum retained combined stdout/stderr bytes, split equally into head and tail. */
|
|
5
6
|
export const buildJobLogMaxBytes = 2 * 1024 * 1024;
|
|
6
7
|
/** Base64url preserves raw command bytes, including split UTF-8 and terminal control bytes. */
|
|
@@ -13,8 +14,8 @@ export const buildJobLogSchema = Schema.Struct({
|
|
|
13
14
|
});
|
|
14
15
|
/** The artifact-upload door cannot write this host-owned job-log namespace. */
|
|
15
16
|
export const isBuildJobLogRef = (ref) => ref.startsWith("artifact:build-log-");
|
|
16
|
-
/** One bounded raw-event
|
|
17
|
-
|
|
17
|
+
/** One bounded raw-event ring; event arrival order is the combined output order. */
|
|
18
|
+
function createBoundedLog() {
|
|
18
19
|
const half = buildJobLogMaxBytes / 2;
|
|
19
20
|
let head = new Uint8Array(0);
|
|
20
21
|
let tail = new Uint8Array(0);
|
|
@@ -78,11 +79,107 @@ export function createBuildJobLog() {
|
|
|
78
79
|
},
|
|
79
80
|
};
|
|
80
81
|
}
|
|
82
|
+
/**
|
|
83
|
+
* Latin-1 maps every byte to one code unit, so redaction sees the text and
|
|
84
|
+
* every byte it does not mask (split UTF-8, terminal controls) comes back exact.
|
|
85
|
+
*/
|
|
86
|
+
function bytesToText(bytes) {
|
|
87
|
+
const parts = [];
|
|
88
|
+
for (let start = 0; start < bytes.byteLength; start += 8192)
|
|
89
|
+
parts.push(String.fromCharCode(...bytes.subarray(start, start + 8192)));
|
|
90
|
+
return parts.join("");
|
|
91
|
+
}
|
|
92
|
+
function textToBytes(text) {
|
|
93
|
+
const bytes = new Uint8Array(text.length);
|
|
94
|
+
for (let index = 0; index < text.length; index++)
|
|
95
|
+
bytes[index] = text.charCodeAt(index);
|
|
96
|
+
return bytes;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Pattern rules match complete text, so output is scanned in windows and the
|
|
100
|
+
* last window stays unemitted: a secret split across events or windows is
|
|
101
|
+
* still seen whole, and a stored byte is never an unscanned one.
|
|
102
|
+
*/
|
|
103
|
+
const scanWindow = 16 * 1024;
|
|
104
|
+
const maxPendingText = 1024 * 1024;
|
|
105
|
+
/** What a host writes where it cannot redact: the ADR's form, never raw output. */
|
|
106
|
+
export const redactionWithheld = "[output withheld: redaction unavailable]";
|
|
107
|
+
/**
|
|
108
|
+
* The redactor, or undefined when its rules cannot load: callers then write
|
|
109
|
+
* {@link redactionWithheld} and never the unredacted text.
|
|
110
|
+
*/
|
|
111
|
+
async function loadRedactorOrWithhold() {
|
|
112
|
+
try {
|
|
113
|
+
return { redactor: await loadPatternRedactor() };
|
|
114
|
+
}
|
|
115
|
+
catch (cause) {
|
|
116
|
+
console.error("redaction rules failed to load", cause instanceof Error ? cause.name : "unknown");
|
|
117
|
+
return { redactor: undefined };
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* One bounded sink for a build's combined output. Veil's pattern redactor
|
|
122
|
+
* (S3's gitleaks rules) runs before a byte is retained, so the stored log and
|
|
123
|
+
* every `?log` read of it are already scrubbed.
|
|
124
|
+
*/
|
|
125
|
+
export async function createBuildJobLog() {
|
|
126
|
+
const ring = createBoundedLog();
|
|
127
|
+
// A rule table that cannot load stores the withheld notice, never the output.
|
|
128
|
+
const { redactor } = await loadRedactorOrWithhold();
|
|
129
|
+
let pending = "";
|
|
130
|
+
let scannedLength = 0;
|
|
131
|
+
const scan = (final) => {
|
|
132
|
+
if (redactor === undefined) {
|
|
133
|
+
pending = "";
|
|
134
|
+
scannedLength = 0;
|
|
135
|
+
if (final)
|
|
136
|
+
ring.append(textToBytes(redactionWithheld));
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
const text = redactor.redact(pending).text;
|
|
140
|
+
if (final) {
|
|
141
|
+
ring.append(textToBytes(text));
|
|
142
|
+
pending = "";
|
|
143
|
+
scannedLength = 0;
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
// Text past the last replacement is unchanged; a match near the end could
|
|
147
|
+
// still grow with later output, so only an unchanged window leaves pending.
|
|
148
|
+
let unchanged = 0;
|
|
149
|
+
while (unchanged < text.length &&
|
|
150
|
+
unchanged < pending.length &&
|
|
151
|
+
text[text.length - 1 - unchanged] ===
|
|
152
|
+
pending[pending.length - 1 - unchanged])
|
|
153
|
+
unchanged++;
|
|
154
|
+
if (text.length > scanWindow &&
|
|
155
|
+
(unchanged >= scanWindow || text.length > maxPendingText)) {
|
|
156
|
+
ring.append(textToBytes(text.slice(0, text.length - scanWindow)));
|
|
157
|
+
pending = text.slice(text.length - scanWindow);
|
|
158
|
+
}
|
|
159
|
+
scannedLength = pending.length;
|
|
160
|
+
};
|
|
161
|
+
return {
|
|
162
|
+
/** Retained buffer capacity, distinct from the transient encoded result. */
|
|
163
|
+
get allocatedBytes() {
|
|
164
|
+
return ring.allocatedBytes;
|
|
165
|
+
},
|
|
166
|
+
append(bytes) {
|
|
167
|
+
pending += bytesToText(bytes);
|
|
168
|
+
if (pending.length >= Math.max(2 * scanWindow, scannedLength + scanWindow))
|
|
169
|
+
scan(false);
|
|
170
|
+
},
|
|
171
|
+
finish() {
|
|
172
|
+
scan(true);
|
|
173
|
+
return ring.finish();
|
|
174
|
+
},
|
|
175
|
+
};
|
|
176
|
+
}
|
|
81
177
|
/** The job read door, not an artifact-serving URL. */
|
|
82
178
|
const buildJobLogReference = (jobId) => `/api/builds/${encodeURIComponent(jobId)}?log`;
|
|
83
179
|
/** Preserve BirdDog's redacted 200-character status/mail budget and name the full log. */
|
|
84
|
-
export function buildJobDiagnostic(jobId, detail) {
|
|
180
|
+
export async function buildJobDiagnostic(jobId, detail) {
|
|
85
181
|
const reference = `Log: ${buildJobLogReference(jobId)}`;
|
|
86
|
-
const
|
|
182
|
+
const { redactor } = await loadRedactorOrWithhold();
|
|
183
|
+
const diagnostic = boundedDiagnostic(redactor === undefined ? redactionWithheld : redactor.redact(detail).text) ?? "Build finished";
|
|
87
184
|
return `${reference}\n${diagnostic.slice(0, 200 - reference.length - 1)}`;
|
|
88
185
|
}
|
package/dist/cloudflare.js
CHANGED
|
@@ -57,11 +57,13 @@ import { facetInvocationModule, facetFrameBindingModule, } from "./facet-invocat
|
|
|
57
57
|
import { createFrameBindingWire, } from "./frame-binding-wire.js";
|
|
58
58
|
import { backgroundSyncRefusalSchema, claimedJobAdmissionSchema, } from "@fungi.computer/puffball/background-replay";
|
|
59
59
|
import { causeClass, failureDiagnostic, guestFailure } from "./cause-class.js";
|
|
60
|
+
import { loadPatternRedactor } from "@fungi.computer/veil/redaction";
|
|
60
61
|
import { appGitPushFactSchema, gitPushVerdictSchema, } from "@fungi.computer/agar/git";
|
|
61
62
|
import { WorkerEntrypoint } from "cloudflare:workers";
|
|
62
63
|
import { appRegionReplySchema } from "@fungi.computer/puffball/backend";
|
|
63
64
|
import { guestLimits } from "./guest-policy.js";
|
|
64
65
|
import { headContentObject } from "./build/content-objects.js";
|
|
66
|
+
import { redactionWithheld } from "./build/job-log.js";
|
|
65
67
|
import { appBackendBindingKinds, } from "@fungi.computer/puffball/app";
|
|
66
68
|
import { isAppApiMethodName, parseAppMethodCallContext, } from "@fungi.computer/puffball/app-method-runtime";
|
|
67
69
|
import { appMethodSchemas } from "@fungi.computer/forage";
|
|
@@ -78,6 +80,26 @@ export { checkBackendConstruction } from "./boot-construction.js";
|
|
|
78
80
|
export { createAppRegion, durableAppRegionNative, isAppRegionSocket, } from "./app-region.js";
|
|
79
81
|
import { createAppInstance, AppInstanceError, instanceIdSchema, instanceSchema, appInstanceErrorCodeSchema, } from "./index.js";
|
|
80
82
|
const bindingWire = createFrameBindingWire(appInstanceErrorCodeSchema.literals);
|
|
83
|
+
/**
|
|
84
|
+
* Logs a recycled-guest failure with its message masked by Veil's pattern
|
|
85
|
+
* rules. A rule table that cannot load withholds the message, never logs it raw.
|
|
86
|
+
*/
|
|
87
|
+
async function logAppInstanceFailure(stage, cause) {
|
|
88
|
+
const diagnostic = failureDiagnostic(cause);
|
|
89
|
+
const { message, ...rest } = diagnostic;
|
|
90
|
+
const masked = message === undefined
|
|
91
|
+
? rest
|
|
92
|
+
: {
|
|
93
|
+
...rest,
|
|
94
|
+
message: await loadPatternRedactor().then((redactor) => redactor.redact(message).text, () => redactionWithheld),
|
|
95
|
+
};
|
|
96
|
+
console.error("AppInstance failure", {
|
|
97
|
+
stage,
|
|
98
|
+
code: "failed",
|
|
99
|
+
...masked,
|
|
100
|
+
recycled: true,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
81
103
|
/**
|
|
82
104
|
* The zone's edge cache as a {@link VerifiedObjectCache}: each verified object
|
|
83
105
|
* under a digest-named key on `origin` that no route serves. A failed write is
|
|
@@ -546,12 +568,7 @@ export function createCloudflareAppInstance(ctx, loader, resolve, guestEnv, boot
|
|
|
546
568
|
}
|
|
547
569
|
const failure = cause instanceof Error ? guestFailure(cause) : fallback();
|
|
548
570
|
retireGuest(frame);
|
|
549
|
-
|
|
550
|
-
stage,
|
|
551
|
-
code: "failed",
|
|
552
|
-
...failureDiagnostic(cause),
|
|
553
|
-
recycled: true,
|
|
554
|
-
});
|
|
571
|
+
void logAppInstanceFailure(stage, cause);
|
|
555
572
|
return failure;
|
|
556
573
|
};
|
|
557
574
|
return createAppInstance({
|
|
@@ -636,12 +653,7 @@ export function createCloudflareAppInstance(ctx, loader, resolve, guestEnv, boot
|
|
|
636
653
|
catch (error) {
|
|
637
654
|
// The Loader and facet are host platform: their text is host-owned.
|
|
638
655
|
retireGuest(frame);
|
|
639
|
-
|
|
640
|
-
stage: "artifact_resolve",
|
|
641
|
-
code: "failed",
|
|
642
|
-
...failureDiagnostic(error),
|
|
643
|
-
recycled: true,
|
|
644
|
-
});
|
|
656
|
+
void logAppInstanceFailure("artifact_resolve", error);
|
|
645
657
|
throw error;
|
|
646
658
|
}
|
|
647
659
|
// A host that cannot mint its binding stubs refuses the frame by code;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { isDeepStrictEqual } from "node:util";
|
|
2
|
+
import { loadPatternRedactor } from "@fungi.computer/veil/redaction";
|
|
3
|
+
import { redactionWithheld } from "../build/job-log.js";
|
|
2
4
|
import { createSelfSource } from "./agent-self.js";
|
|
3
5
|
import { agentCodeExecutionTimeoutMs } from "@fungi.computer/computer-contract";
|
|
4
6
|
import { isRetryableProviderRejection, normalizeModel, observeProviderStatus, providerDisplayNames, streamModel, } from "@fungi.computer/mule/effect";
|
|
@@ -85,6 +87,16 @@ import { agentCeiling, oysterPrincipalIsOwner } from "../authorization.js";
|
|
|
85
87
|
import { defaultTenant, tenantIdSchema, tenantScope, } from "../tenant.js";
|
|
86
88
|
import { createCodemodeSandbox } from "@fungi.computer/mycelium/workers";
|
|
87
89
|
import { forageDiscoveryInstructions } from "@fungi.computer/mycelium/effect";
|
|
90
|
+
/** A failure for the host log: Veil's pattern rules mask any key in its text. */
|
|
91
|
+
const redactedFailure = (cause) => loadPatternRedactor().then((redactor) => redactor.redact(cause instanceof Error
|
|
92
|
+
? `${cause.name}: ${cause.message}`
|
|
93
|
+
: String(cause)).text, () => redactionWithheld);
|
|
94
|
+
/** Logs a failure once its text is masked; the log line never blocks the caller. */
|
|
95
|
+
const logRedactedFailure = (label, cause) => {
|
|
96
|
+
void redactedFailure(cause).then((text) => {
|
|
97
|
+
console.error(label, text);
|
|
98
|
+
});
|
|
99
|
+
};
|
|
88
100
|
/** The starter has no Home yet: the owner has not attached a Computer. The seed waits for one. */
|
|
89
101
|
class StarterHomePending extends Error {
|
|
90
102
|
constructor() {
|
|
@@ -400,7 +412,7 @@ export class StandaloneAgentBase extends ShiitakeDO {
|
|
|
400
412
|
: (this.websiteBindings.get(conversation.bindingId) ?? null),
|
|
401
413
|
};
|
|
402
414
|
}, sessionId ?? "none", (cause) => {
|
|
403
|
-
|
|
415
|
+
logRedactedFailure("channel run decision failed", cause);
|
|
404
416
|
});
|
|
405
417
|
}
|
|
406
418
|
/** Shiitake calls instructions.load at the start of the actual model turn.
|
|
@@ -435,7 +447,7 @@ export class StandaloneAgentBase extends ShiitakeDO {
|
|
|
435
447
|
async askDiscord(bindingId, ask) {
|
|
436
448
|
await this.discordReplies().record(bindingId, ask);
|
|
437
449
|
this.ctx.waitUntil(this.wakeRuntime().catch((cause) => {
|
|
438
|
-
|
|
450
|
+
logRedactedFailure("discord reply wake failed", cause);
|
|
439
451
|
}));
|
|
440
452
|
}
|
|
441
453
|
discordReplyOwner;
|
|
@@ -1825,12 +1837,12 @@ export class AgentDirectory extends DurableObject {
|
|
|
1825
1837
|
push: (fact) => authority().deliverControlFact(fact),
|
|
1826
1838
|
wakeNow: () => {
|
|
1827
1839
|
this.ctx.waitUntil(this.ctx.storage.setAlarm(Date.now()).catch((cause) => {
|
|
1828
|
-
|
|
1840
|
+
logRedactedFailure("machine-link.first-fence-wake", cause);
|
|
1829
1841
|
}));
|
|
1830
1842
|
},
|
|
1831
1843
|
retryDelayMs: (failures) => Math.min(60_000, 1_000 * 2 ** Math.min(failures, 6)),
|
|
1832
1844
|
report: (operation, cause) => {
|
|
1833
|
-
|
|
1845
|
+
logRedactedFailure(operation, cause);
|
|
1834
1846
|
},
|
|
1835
1847
|
}));
|
|
1836
1848
|
}
|
|
@@ -2655,10 +2667,9 @@ export function standaloneAgents(env, scope) {
|
|
|
2655
2667
|
// Waiting for the owner to attach a Computer is not a failure.
|
|
2656
2668
|
if (cause instanceof StarterHomePending)
|
|
2657
2669
|
return;
|
|
2658
|
-
|
|
2659
|
-
event: "starter_agent_failed",
|
|
2660
|
-
|
|
2661
|
-
}));
|
|
2670
|
+
void redactedFailure(cause).then((text) => {
|
|
2671
|
+
console.warn(JSON.stringify({ event: "starter_agent_failed", cause: text }));
|
|
2672
|
+
});
|
|
2662
2673
|
},
|
|
2663
2674
|
});
|
|
2664
2675
|
},
|
|
@@ -379,7 +379,7 @@ export class ComputerDO extends NativeComputerDO {
|
|
|
379
379
|
const admitted = await this.previewBindings.REGISTRY.getByName("registry").admitBuildExecution(input.jobId, this.state.id.toString());
|
|
380
380
|
if (!admitted)
|
|
381
381
|
throw new AppInstanceError("revoked");
|
|
382
|
-
const log = createBuildJobLog();
|
|
382
|
+
const log = await createBuildJobLog();
|
|
383
383
|
const result = await this.executeOperationAfterAcceptance({
|
|
384
384
|
command: input.command,
|
|
385
385
|
cwd: "/workspace",
|
|
@@ -639,7 +639,7 @@ export class StandaloneRegistry extends OysterRegistry {
|
|
|
639
639
|
return exchangeOysterTemplateGit(this.#artifacts(), `https://git.team.internal/${repository}.git`, repository, request, "read");
|
|
640
640
|
}
|
|
641
641
|
async recordBuildEvent(event) {
|
|
642
|
-
(await this.#appBuilds()).record(event);
|
|
642
|
+
await (await this.#appBuilds()).record(event);
|
|
643
643
|
}
|
|
644
644
|
/** The egress: may this Computer's live job upload one object, how large? */
|
|
645
645
|
async admitBuildObject(jobId, computerObjectId, grant) {
|
|
@@ -81,6 +81,25 @@ export declare const workflowFrameMethods: {
|
|
|
81
81
|
readonly agentId: string;
|
|
82
82
|
readonly sessionId: string;
|
|
83
83
|
} | undefined;
|
|
84
|
+
readonly test?: undefined;
|
|
85
|
+
readonly published?: undefined;
|
|
86
|
+
} | {
|
|
87
|
+
readonly input: {
|
|
88
|
+
readonly [x: string]: S.Json;
|
|
89
|
+
};
|
|
90
|
+
readonly requestId: string;
|
|
91
|
+
readonly bindings: Record<string, string | {
|
|
92
|
+
kind: "team-source";
|
|
93
|
+
}>;
|
|
94
|
+
readonly test: {
|
|
95
|
+
readonly workflowId: string;
|
|
96
|
+
readonly draftRevision: number;
|
|
97
|
+
};
|
|
98
|
+
readonly definition: unknown;
|
|
99
|
+
readonly delivery?: {
|
|
100
|
+
readonly agentId: string;
|
|
101
|
+
readonly sessionId: string;
|
|
102
|
+
} | undefined;
|
|
84
103
|
readonly published?: undefined;
|
|
85
104
|
} | {
|
|
86
105
|
readonly input: {
|
|
@@ -102,6 +121,7 @@ export declare const workflowFrameMethods: {
|
|
|
102
121
|
readonly agentId: string;
|
|
103
122
|
readonly sessionId: string;
|
|
104
123
|
} | undefined;
|
|
124
|
+
readonly test?: undefined;
|
|
105
125
|
}]) | ((input: unknown, options?: import("effect/SchemaAST").ParseOptions) => readonly [{
|
|
106
126
|
readonly runId: string;
|
|
107
127
|
}]) | ((input: unknown, options?: import("effect/SchemaAST").ParseOptions) => readonly [{
|
|
@@ -601,7 +601,11 @@ export function createStandaloneWorkflowHost(owner, host, options) {
|
|
|
601
601
|
}
|
|
602
602
|
: {
|
|
603
603
|
initiatedBy: { kind: "member", memberId: actorId },
|
|
604
|
-
source:
|
|
604
|
+
source: request.test !== undefined
|
|
605
|
+
? "test"
|
|
606
|
+
: facts.subject.kind === "lifecycle"
|
|
607
|
+
? "event"
|
|
608
|
+
: "manual",
|
|
605
609
|
libraryInstallationId: libraryId,
|
|
606
610
|
computerId: context.computerId,
|
|
607
611
|
plan: compiled.plan,
|
|
@@ -626,7 +630,15 @@ export function createStandaloneWorkflowHost(owner, host, options) {
|
|
|
626
630
|
source: preparation.source,
|
|
627
631
|
initiatedBy: preparation.initiatedBy,
|
|
628
632
|
};
|
|
629
|
-
|
|
633
|
+
// A test is listed under its library, as a published run is.
|
|
634
|
+
const tested = request.test === undefined
|
|
635
|
+
? started
|
|
636
|
+
: {
|
|
637
|
+
...started,
|
|
638
|
+
test: request.test,
|
|
639
|
+
libraryInstallationId: libraryId,
|
|
640
|
+
};
|
|
641
|
+
const record = delivery === undefined ? tested : { ...tested, delivery };
|
|
630
642
|
const current = await admitStart(facts);
|
|
631
643
|
if (canonicalJson(S.decodeUnknownSync(S.Json)(current.context)) !==
|
|
632
644
|
canonicalJson(S.decodeUnknownSync(S.Json)(context)))
|
|
@@ -26,7 +26,7 @@ export declare function createStandaloneWorkflowTriggerHost(options: {
|
|
|
26
26
|
readonly input: {
|
|
27
27
|
readonly [x: string]: import("effect/Schema").Json;
|
|
28
28
|
};
|
|
29
|
-
readonly source: "key" | "manual" | "event" | "schedule" | "agent";
|
|
29
|
+
readonly source: "key" | "manual" | "event" | "schedule" | "test" | "agent";
|
|
30
30
|
readonly teamId: string;
|
|
31
31
|
readonly runId: string;
|
|
32
32
|
readonly computerId: string | null;
|
|
@@ -420,6 +420,10 @@ export declare function createStandaloneWorkflowTriggerHost(options: {
|
|
|
420
420
|
readonly agentId: string;
|
|
421
421
|
readonly sessionId: string;
|
|
422
422
|
};
|
|
423
|
+
readonly test?: {
|
|
424
|
+
readonly workflowId: string;
|
|
425
|
+
readonly draftRevision: number;
|
|
426
|
+
};
|
|
423
427
|
readonly trigger?: {
|
|
424
428
|
readonly workflowId: string;
|
|
425
429
|
readonly armedBy: string;
|
|
@@ -166,10 +166,10 @@ export declare abstract class StandaloneWorkflowRunsBase<Env extends StandaloneW
|
|
|
166
166
|
workflowId?: string;
|
|
167
167
|
}): Promise<{
|
|
168
168
|
runs: ({
|
|
169
|
-
runId: string;
|
|
170
169
|
workflowId: string | undefined;
|
|
171
170
|
commit: string | undefined;
|
|
172
|
-
source: "key" | "manual" | "
|
|
171
|
+
source: "key" | "manual" | "event" | "schedule" | "test" | "agent";
|
|
172
|
+
runId: string;
|
|
173
173
|
initiatedBy: Readonly<{
|
|
174
174
|
kind: "member";
|
|
175
175
|
memberId: string;
|
|
@@ -184,11 +184,29 @@ export declare abstract class StandaloneWorkflowRunsBase<Env extends StandaloneW
|
|
|
184
184
|
}>;
|
|
185
185
|
startedAt: number;
|
|
186
186
|
} | {
|
|
187
|
-
|
|
187
|
+
workflowId: string;
|
|
188
|
+
draftRevision: number;
|
|
189
|
+
source: "key" | "manual" | "event" | "schedule" | "test" | "agent";
|
|
188
190
|
runId: string;
|
|
191
|
+
initiatedBy: Readonly<{
|
|
192
|
+
kind: "member";
|
|
193
|
+
memberId: string;
|
|
194
|
+
}> | Readonly<{
|
|
195
|
+
kind: "agent";
|
|
196
|
+
agentId: string;
|
|
197
|
+
grantorMemberId: string;
|
|
198
|
+
}> | Readonly<{
|
|
199
|
+
kind: "key";
|
|
200
|
+
keyId: string;
|
|
201
|
+
grantorMemberId: string;
|
|
202
|
+
}>;
|
|
203
|
+
startedAt: number;
|
|
204
|
+
} | {
|
|
205
|
+
triggerId: string;
|
|
189
206
|
workflowId: string | undefined;
|
|
190
207
|
commit: string | undefined;
|
|
191
|
-
source: "key" | "manual" | "
|
|
208
|
+
source: "key" | "manual" | "event" | "schedule" | "test" | "agent";
|
|
209
|
+
runId: string;
|
|
192
210
|
initiatedBy: Readonly<{
|
|
193
211
|
kind: "member";
|
|
194
212
|
memberId: string;
|
|
@@ -681,6 +699,9 @@ export declare abstract class StandaloneWorkflowRunsBase<Env extends StandaloneW
|
|
|
681
699
|
runId: string;
|
|
682
700
|
planDigest: string;
|
|
683
701
|
title: string;
|
|
702
|
+
input: {
|
|
703
|
+
readonly [x: string]: S.Json;
|
|
704
|
+
};
|
|
684
705
|
outcome: "active" | "terminal" | "cancelled" | null;
|
|
685
706
|
events: readonly {
|
|
686
707
|
readonly runId: string;
|
|
@@ -772,6 +793,9 @@ export declare abstract class StandaloneWorkflowRunsBase<Env extends StandaloneW
|
|
|
772
793
|
runId: string;
|
|
773
794
|
planDigest: string;
|
|
774
795
|
title: string;
|
|
796
|
+
input: {
|
|
797
|
+
readonly [x: string]: S.Json;
|
|
798
|
+
};
|
|
775
799
|
outcome: "active" | "terminal" | "cancelled" | null;
|
|
776
800
|
events: readonly {
|
|
777
801
|
readonly runId: string;
|
|
@@ -13,7 +13,7 @@ import { createWorkflowPublishedDefinitionPort, readPublishedWorkflow, } from "@
|
|
|
13
13
|
import { workflowAgentAuthority } from "../workflow-agent-authority.js";
|
|
14
14
|
import { defaultTenant, tenantScope, } from "../tenant.js";
|
|
15
15
|
import { AppInstanceError } from "../index.js";
|
|
16
|
-
import { createWorkflowGitPasses, createWorkflowGitPassStore, workflowGitPassWriter, workflowRunReport,
|
|
16
|
+
import { createWorkflowGitPasses, createWorkflowGitPassStore, workflowGitPassWriter, workflowRunReport, wireRunRow, } from "@fungi.computer/braid/runtime";
|
|
17
17
|
import { canonicalJson } from "@fungi.computer/braid";
|
|
18
18
|
import { runKey, reviewKey, workflowGitPassRequestSchema, } from "./workflow-binding.js";
|
|
19
19
|
import { agentDirectoryForScope } from "./agent-directory.js";
|
|
@@ -436,19 +436,7 @@ export class StandaloneWorkflowRunsBase extends DurableObject {
|
|
|
436
436
|
? { installationId: libraryId }
|
|
437
437
|
: { installationId: libraryId, workflowId: input.workflowId };
|
|
438
438
|
return {
|
|
439
|
-
runs: owner.store.list(filter).map(
|
|
440
|
-
const row = {
|
|
441
|
-
runId: run.runId,
|
|
442
|
-
workflowId: run.publication?.workflowId ?? run.trigger?.workflowId,
|
|
443
|
-
commit: run.publication?.commit ?? run.trigger?.commit,
|
|
444
|
-
source: run.source,
|
|
445
|
-
initiatedBy: wireRunInitiator(run.initiatedBy),
|
|
446
|
-
startedAt: run.startedAt,
|
|
447
|
-
};
|
|
448
|
-
return run.trigger === undefined
|
|
449
|
-
? row
|
|
450
|
-
: { ...row, triggerId: run.trigger.triggerId };
|
|
451
|
-
}),
|
|
439
|
+
runs: owner.store.list(filter).map(wireRunRow),
|
|
452
440
|
};
|
|
453
441
|
}
|
|
454
442
|
/** Native alarm delivery: fire every due schedule of this library. */
|
|
@@ -636,6 +624,7 @@ export class StandaloneWorkflowRunsBase extends DurableObject {
|
|
|
636
624
|
runId,
|
|
637
625
|
planDigest: run.plan.planDigest,
|
|
638
626
|
title: run.plan.definition.title,
|
|
627
|
+
input: run.input,
|
|
639
628
|
outcome,
|
|
640
629
|
events: owner.store.events(runId),
|
|
641
630
|
reviews: owner.store.reviews(runId),
|
package/docs/api/host.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fungi.computer/oyster",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.41.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",
|
|
@@ -360,7 +360,7 @@
|
|
|
360
360
|
"@earendil-works/pi-ai": "1.5.2",
|
|
361
361
|
"@fungi.computer/agar": "0.22.1",
|
|
362
362
|
"@fungi.computer/bird-dog": "0.3.7",
|
|
363
|
-
"@fungi.computer/braid": "0.
|
|
363
|
+
"@fungi.computer/braid": "0.6.0",
|
|
364
364
|
"@fungi.computer/burrow": "0.2.1",
|
|
365
365
|
"@fungi.computer/cairn": "0.1.0",
|
|
366
366
|
"@fungi.computer/capnweb": "0.12.0-fungi.0",
|
|
@@ -387,7 +387,7 @@
|
|
|
387
387
|
"@fungi.computer/veil": "0.8.2",
|
|
388
388
|
"@fungi.computer/watchdog": "0.1.4",
|
|
389
389
|
"@fungi.computer/whistle": "0.3.0",
|
|
390
|
-
"@fungi.computer/workflows-wire": "0.
|
|
390
|
+
"@fungi.computer/workflows-wire": "0.6.0",
|
|
391
391
|
"@fungi.computer/zookeeper": "0.0.43",
|
|
392
392
|
"@jellybrick/dbus-next": "0.11.4",
|
|
393
393
|
"@modelcontextprotocol/server": "2.0.0",
|