-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgateproof.plan.ts
More file actions
34 lines (31 loc) · 1.18 KB
/
Copy pathgateproof.plan.ts
File metadata and controls
34 lines (31 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { Effect } from 'effect';
import { Act, Assert, Gate, Plan, Require } from 'gateproof';
const agentUrlBase = process.env.AGENT_URL_BASE;
if (!agentUrlBase) throw new Error('AGENT_URL_BASE is required');
const labUrl = process.env.LAB_URL ?? 'https://lab.coey.dev';
const plan = Plan.define({
goals: [
{
id: 'gateway-and-lab-both-record',
title: 'The gateway-routed tool persists a Lab receipt',
gate: Gate.define({
prerequisites: [Require.env('AGENT_URL_BASE', 'deployed agent route')],
act: [Act.exec(`AGENT_URL_BASE="${agentUrlBase}" bun run probe.ts`, { timeoutMs: 150_000 })],
assert: [Assert.noErrors()],
timeoutMs: 180_000,
}),
},
{
id: 'lab-origin-reachable',
title: 'The Lab origin returns its catalog',
gate: Gate.define({
observe: { kind: 'http', url: `${labUrl}/lab/catalog`, pollInterval: 0 },
assert: [Assert.httpResponse({ status: 200 }), Assert.responseBodyIncludes('"version"')],
timeoutMs: 15_000,
}),
},
],
});
const result = await Effect.runPromise(Plan.run(plan));
console.log(JSON.stringify(result, null, 2));
if (result.status !== 'pass') process.exit(1);