@effect-agent/testing 0.1.0-beta.6 → 0.1.0-beta.60
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/Certification.d.mts +105 -0
- package/dist/Certification.mjs +590 -0
- package/dist/Certification.mjs.map +1 -0
- package/dist/Chaos.d.mts +126 -0
- package/dist/Chaos.mjs +755 -0
- package/dist/Chaos.mjs.map +1 -0
- package/dist/CodeExecutorConformance.d.mts +33 -0
- package/dist/CodeExecutorConformance.mjs +231 -0
- package/dist/CodeExecutorConformance.mjs.map +1 -0
- package/dist/CodeExecutorSubstitute.d.mts +21 -0
- package/dist/CodeExecutorSubstitute.mjs +364 -0
- package/dist/CodeExecutorSubstitute.mjs.map +1 -0
- package/dist/DocsResearcher.d.mts +270 -0
- package/dist/DocsResearcher.mjs +490 -0
- package/dist/DocsResearcher.mjs.map +1 -0
- package/dist/ScriptedModel-DAvxIiud.d.mts +220 -0
- package/dist/ScriptedModel.d.mts +2 -0
- package/dist/ScriptedModel.mjs +155 -0
- package/dist/ScriptedModel.mjs.map +1 -0
- package/dist/TravelPlanner.d.mts +1665 -0
- package/dist/TravelPlanner.mjs +1958 -0
- package/dist/TravelPlanner.mjs.map +1 -0
- package/dist/deterministic-layers-Eka0fMZq.mjs +358 -0
- package/dist/deterministic-layers-Eka0fMZq.mjs.map +1 -0
- package/dist/index.d.mts +2 -3378
- package/dist/index.mjs +2 -4766
- package/dist/rolldown-runtime-D7D4PA-g.mjs +13 -0
- package/package.json +1 -48
- package/src/{certification.ts → Certification.ts} +251 -115
- package/src/{chaos.ts → Chaos.ts} +246 -122
- package/src/{code-executor-conformance.ts → CodeExecutorConformance.ts} +29 -6
- package/src/{code-executor-substitute.ts → CodeExecutorSubstitute.ts} +104 -42
- package/src/{fixtures/docs-researcher/index.ts → DocsResearcher.ts} +68 -5
- package/src/{scripted-model.ts → ScriptedModel.ts} +22 -25
- package/src/TravelPlanner.ts +232 -0
- package/src/fixtures/docs-researcher/definition.ts +19 -10
- package/src/fixtures/docs-researcher/harness.ts +41 -30
- package/src/fixtures/docs-researcher/mcp.ts +49 -3
- package/src/fixtures/travel-planner/definition.ts +15 -2
- package/src/fixtures/travel-planner/deterministic-layers.ts +47 -4
- package/src/fixtures/travel-planner/phase2.ts +4 -3
- package/src/fixtures/travel-planner/phase3.ts +18 -37
- package/src/fixtures/travel-planner/phase4.ts +23 -36
- package/src/fixtures/travel-planner/phase5.ts +38 -41
- package/src/fixtures/travel-planner/phase6.ts +182 -84
- package/src/fixtures/travel-planner/phase7.ts +4 -102
- package/src/fixtures/travel-planner/scenarios.ts +3 -4
- package/src/fixtures/travel-planner/subagents-durable.ts +33 -57
- package/src/fixtures/travel-planner/subagents.ts +35 -13
- package/src/index.ts +1 -11
- package/dist/index.mjs.map +0 -1
- package/src/code-executor-conformance.d.ts +0 -30
- package/src/fixtures/travel-planner/index.ts +0 -11
- package/src/fixtures/warehouse/index.ts +0 -412
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { Crypto, Duration, Effect, Layer } from "effect";
|
|
2
|
+
import { DurableRuntimeFailpointLocation } from "@effect-agent/thread/DurableFailpoint";
|
|
3
|
+
import { SubmissionLedger } from "@effect-agent/thread/SubmissionLedger";
|
|
4
|
+
import { CertificationCaseResult, CertificationReport, CertificationScenario, CertificationSweepResult, CertificationTierThreeReport } from "@effect-agent/thread/testing/Certification";
|
|
5
|
+
import { ThreadStore } from "@effect-agent/thread/ThreadStore";
|
|
6
|
+
import { WakeScheduler } from "@effect-agent/thread/WakeScheduler";
|
|
7
|
+
//#region src/Certification.d.ts
|
|
8
|
+
/**
|
|
9
|
+
* P7 WP2 — `certifyDurableAdapters` (plan §1): the one certification entry point a durable
|
|
10
|
+
* adapter pair runs to earn a Schema-encoded certificate.
|
|
11
|
+
*
|
|
12
|
+
* - **Tier 1 — port contract**: the two shared conformance case arrays, verbatim, through
|
|
13
|
+
* `certifyPorts` (TEST-004/STORE-010).
|
|
14
|
+
* - **Tier 2 — coordinator protocol + failpoint convergence**: the durable coordinator is
|
|
15
|
+
* assembled over the CANDIDATE Layer pair with a scripted deterministic model; every
|
|
16
|
+
* `DurableRuntimeFailpointLocation` is armed one-shot across the six scenario shapes
|
|
17
|
+
* (plain / uncertain-tool / durable-steps / approval / join / delegation). After the injected
|
|
18
|
+
* fault the runner asserts the state stays CLASSIFIABLE (recovery + the public unblocking
|
|
19
|
+
* operations `resolveUnknown`/`resolveApproval` are the only levers used) and that the
|
|
20
|
+
* re-drive CONVERGES to `verifyThreadInvariants` with `requireAllSettled` — including a
|
|
21
|
+
* fully discharged digest-chain check, because the runner captures per-batch producer
|
|
22
|
+
* identity at append time.
|
|
23
|
+
* - **Tier 3 — real loss lever**: recorded honestly. A durable adapter either supplies a
|
|
24
|
+
* `CertificationCrashLever` executed in this run, cites its committed real-loss evidence
|
|
25
|
+
* (process-kill / eviction suites), or the certificate says `not-exercised`. A non-durable
|
|
26
|
+
* reference adapter records `not-applicable`.
|
|
27
|
+
*
|
|
28
|
+
* The runner is adapter-neutral and platform-neutral: it imports nothing Node-only, so the
|
|
29
|
+
* same entry point runs under `@effect/vitest` on Node and inside workerd (storage-cloudflare's
|
|
30
|
+
* in-workerd runner). It must run under a TestClock (Tier 1 drives lease expiry through
|
|
31
|
+
* virtual time), and requires only `Crypto.Crypto` from the environment.
|
|
32
|
+
*/
|
|
33
|
+
/**
|
|
34
|
+
* A real-loss lever supplied by an adapter that wants Tier 3 exercised IN this certification
|
|
35
|
+
* run (kill/evict/reopen around a designated row subset). Rows report with
|
|
36
|
+
* `suite: "real-loss"`. Failures must be captured per-row — the lever's error channel is
|
|
37
|
+
* `never` so a certificate is always produced.
|
|
38
|
+
*/
|
|
39
|
+
type CertificationCrashLever = Effect.Effect<ReadonlyArray<CertificationCaseResult>>;
|
|
40
|
+
interface CertifyDurableAdaptersOptions<LedgerE = never, StoreE = never> {
|
|
41
|
+
/** Adapter pair identity named by the certificate (durability is read from the ledger). */
|
|
42
|
+
readonly adapter: {
|
|
43
|
+
readonly name: string;
|
|
44
|
+
readonly version?: string | undefined;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* The candidate Layer pair. When both ports must share one connection root (the ADR-0011
|
|
48
|
+
* "same file" rule), pass the SAME combined Layer instance for both fields — Layer
|
|
49
|
+
* memoization builds it once. A candidate may require `Crypto.Crypto` (the memory reference
|
|
50
|
+
* does); the certification's own environment supplies nothing else.
|
|
51
|
+
*/
|
|
52
|
+
readonly submissionLedger: Layer.Layer<SubmissionLedger, LedgerE, Crypto.Crypto>;
|
|
53
|
+
readonly threadStore: Layer.Layer<ThreadStore, StoreE, Crypto.Crypto>;
|
|
54
|
+
/** Defaults to `WakeScheduler.layerNoop`; the runner re-drives lanes explicitly. */
|
|
55
|
+
readonly wakeScheduler?: Layer.Layer<WakeScheduler> | undefined;
|
|
56
|
+
/** Executes Tier 3 in this run; takes precedence over `tierThreeEvidence`. */
|
|
57
|
+
readonly crashLever?: CertificationCrashLever | undefined;
|
|
58
|
+
/** Repository-relative citations of committed real-loss suites (Tier 3 `recorded-evidence`). */
|
|
59
|
+
readonly tierThreeEvidence?: ReadonlyArray<string> | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* The candidate ledger's configured ownership lease (defaults to the D5 default, 30s).
|
|
62
|
+
* Every Tier-2 re-drive round advances the TestClock past this lease before reclaiming:
|
|
63
|
+
* a live lease may block ALL new claims (the SQL adapters do; the memory reference also
|
|
64
|
+
* allows same-producer reclaim), so the adapter-NEUTRAL recovery lever after a mid-Attempt
|
|
65
|
+
* fault is lease expiry — exactly the documented D5 liveness mechanism, driven through
|
|
66
|
+
* virtual time.
|
|
67
|
+
*/
|
|
68
|
+
readonly ownershipLeaseDuration?: Duration.Duration | undefined;
|
|
69
|
+
}
|
|
70
|
+
/** The six Tier-2 scenario shapes in sweep order. */
|
|
71
|
+
declare const CERTIFICATION_SCENARIOS: ReadonlyArray<CertificationScenario>;
|
|
72
|
+
/**
|
|
73
|
+
* Coordinator failpoint locations that none of the six scenario shapes can reach, recorded
|
|
74
|
+
* honestly instead of silently claimed: all three sit on operator/abort paths the shapes do
|
|
75
|
+
* not take. They are pinned in-process by the P5/S2 suites
|
|
76
|
+
* (`packages/testing/test/durable-tools.test.ts` "resolveUnknown is idempotent across the
|
|
77
|
+
* intent failpoint", `durable-runtime.test.ts` abort rows,
|
|
78
|
+
* `durable-subagents.test.ts` abort propagation) and by the process-kill/eviction crash
|
|
79
|
+
* matrices. Runner tests assert the observed never-fired set equals EXACTLY this list, so a
|
|
80
|
+
* protocol change that silently stops exercising a location fails the certification.
|
|
81
|
+
*/
|
|
82
|
+
declare const TIER2_UNREACHED_LOCATIONS: ReadonlyArray<DurableRuntimeFailpointLocation>;
|
|
83
|
+
/** Locations of `tier2` rows whose armed fault never fired in ANY scenario, sorted. */
|
|
84
|
+
declare const tier2NeverFiredLocations: (tier2: ReadonlyArray<CertificationSweepResult>) => ReadonlyArray<DurableRuntimeFailpointLocation>;
|
|
85
|
+
/**
|
|
86
|
+
* Resolve the Tier-3 record honestly (plan §1): a non-durable reference adapter has no real
|
|
87
|
+
* loss to exercise (`not-applicable`); a supplied lever runs NOW (`exercised`); committed
|
|
88
|
+
* real-loss citations are recorded (`recorded-evidence`); otherwise the certificate says
|
|
89
|
+
* `not-exercised` — a scoped statement, never a silent claim.
|
|
90
|
+
*/
|
|
91
|
+
declare const resolveTierThree: (durability: "durable-cloudflare" | "durable-node" | "non-durable", options: {
|
|
92
|
+
readonly crashLever?: CertificationCrashLever | undefined;
|
|
93
|
+
readonly tierThreeEvidence?: ReadonlyArray<string> | undefined;
|
|
94
|
+
}) => Effect.Effect<CertificationTierThreeReport, never, never>;
|
|
95
|
+
/**
|
|
96
|
+
* Certify one durable adapter pair (plan §1, §8 WP2). Runs Tier 2 FIRST over pristine
|
|
97
|
+
* storage (each cell converges to all-settled before the next starts, so the recovery scan
|
|
98
|
+
* never sees foreign leftovers), then Tier 1's port contract cases (whose lanes deliberately
|
|
99
|
+
* end in every nonterminal shape), then records Tier 3. Requires `Crypto.Crypto` and a
|
|
100
|
+
* TestClock-backed environment; the candidate Layers are built exactly once.
|
|
101
|
+
*/
|
|
102
|
+
declare const certifyDurableAdapters: <LedgerE = never, StoreE = never>(options: CertifyDurableAdaptersOptions<LedgerE, StoreE>) => Effect.Effect<CertificationReport, LedgerE | StoreE, Crypto.Crypto>;
|
|
103
|
+
//#endregion
|
|
104
|
+
export { CERTIFICATION_SCENARIOS, CertificationCrashLever, CertifyDurableAdaptersOptions, TIER2_UNREACHED_LOCATIONS, certifyDurableAdapters, resolveTierThree, tier2NeverFiredLocations };
|
|
105
|
+
//# sourceMappingURL=Certification.d.mts.map
|