@effect-agent/testing 0.1.0-beta.9 → 0.1.0-beta.90

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