@effect-agent/testing 0.1.0-beta.8 → 0.1.0-beta.80

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.
Files changed (54) hide show
  1. package/dist/Certification.d.mts +105 -0
  2. package/dist/Certification.mjs +592 -0
  3. package/dist/Certification.mjs.map +1 -0
  4. package/dist/Chaos.d.mts +126 -0
  5. package/dist/Chaos.mjs +755 -0
  6. package/dist/Chaos.mjs.map +1 -0
  7. package/dist/CodeExecutorConformance.d.mts +33 -0
  8. package/dist/CodeExecutorConformance.mjs +231 -0
  9. package/dist/CodeExecutorConformance.mjs.map +1 -0
  10. package/dist/CodeExecutorSubstitute.d.mts +21 -0
  11. package/dist/CodeExecutorSubstitute.mjs +368 -0
  12. package/dist/CodeExecutorSubstitute.mjs.map +1 -0
  13. package/dist/DocsResearcher.d.mts +270 -0
  14. package/dist/DocsResearcher.mjs +490 -0
  15. package/dist/DocsResearcher.mjs.map +1 -0
  16. package/dist/ScriptedModel-DAvxIiud.d.mts +220 -0
  17. package/dist/ScriptedModel.d.mts +2 -0
  18. package/dist/ScriptedModel.mjs +155 -0
  19. package/dist/ScriptedModel.mjs.map +1 -0
  20. package/dist/TravelPlanner.d.mts +1665 -0
  21. package/dist/TravelPlanner.mjs +1963 -0
  22. package/dist/TravelPlanner.mjs.map +1 -0
  23. package/dist/deterministic-layers-Eka0fMZq.mjs +358 -0
  24. package/dist/deterministic-layers-Eka0fMZq.mjs.map +1 -0
  25. package/dist/index.d.mts +2 -3406
  26. package/dist/index.mjs +2 -4771
  27. package/dist/rolldown-runtime-D7D4PA-g.mjs +13 -0
  28. package/package.json +1 -48
  29. package/src/{certification.ts → Certification.ts} +251 -117
  30. package/src/{chaos.ts → Chaos.ts} +246 -122
  31. package/src/{code-executor-conformance.ts → CodeExecutorConformance.ts} +29 -6
  32. package/src/{code-executor-substitute.ts → CodeExecutorSubstitute.ts} +112 -45
  33. package/src/{fixtures/docs-researcher/index.ts → DocsResearcher.ts} +68 -5
  34. package/src/{scripted-model.ts → ScriptedModel.ts} +22 -25
  35. package/src/TravelPlanner.ts +232 -0
  36. package/src/fixtures/docs-researcher/definition.ts +19 -10
  37. package/src/fixtures/docs-researcher/harness.ts +41 -30
  38. package/src/fixtures/docs-researcher/mcp.ts +49 -3
  39. package/src/fixtures/travel-planner/definition.ts +15 -2
  40. package/src/fixtures/travel-planner/deterministic-layers.ts +47 -4
  41. package/src/fixtures/travel-planner/phase2.ts +4 -3
  42. package/src/fixtures/travel-planner/phase3.ts +18 -41
  43. package/src/fixtures/travel-planner/phase4.ts +23 -36
  44. package/src/fixtures/travel-planner/phase5.ts +38 -41
  45. package/src/fixtures/travel-planner/phase6.ts +187 -84
  46. package/src/fixtures/travel-planner/phase7.ts +4 -102
  47. package/src/fixtures/travel-planner/scenarios.ts +3 -4
  48. package/src/fixtures/travel-planner/subagents-durable.ts +33 -57
  49. package/src/fixtures/travel-planner/subagents.ts +35 -13
  50. package/src/index.ts +1 -11
  51. package/dist/index.mjs.map +0 -1
  52. package/src/code-executor-conformance.d.ts +0 -30
  53. package/src/fixtures/travel-planner/index.ts +0 -11
  54. 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. These require operator, compaction, reservation, or
75
+ * background-worker paths the shapes do 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