@effect-agent/testing 0.1.0-beta.44 → 0.1.0-beta.46
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 → Certification.d.mts} +7 -4
- package/dist/{certification.mjs → Certification.mjs} +30 -14
- package/dist/Certification.mjs.map +1 -0
- package/dist/{chaos.d.mts → Chaos.d.mts} +7 -5
- package/dist/{chaos.mjs → Chaos.mjs} +25 -9
- package/dist/Chaos.mjs.map +1 -0
- package/dist/{code-executor.d.mts → CodeExecutorConformance.d.mts} +6 -21
- package/dist/{code-executor.mjs → CodeExecutorConformance.mjs} +6 -340
- package/dist/CodeExecutorConformance.mjs.map +1 -0
- package/dist/CodeExecutorSubstitute.d.mts +21 -0
- package/dist/CodeExecutorSubstitute.mjs +341 -0
- package/dist/CodeExecutorSubstitute.mjs.map +1 -0
- package/dist/{docs-researcher.d.mts → DocsResearcher.d.mts} +24 -17
- package/dist/{docs-researcher.mjs → DocsResearcher.mjs} +15 -5
- package/dist/DocsResearcher.mjs.map +1 -0
- package/dist/{scripted-model-dOa_e0-n.d.mts → ScriptedModel-Dx8aW73W.d.mts} +5 -3
- package/dist/ScriptedModel.d.mts +2 -0
- package/dist/{scripted-model-C2y0ztuj.mjs → ScriptedModel.mjs} +13 -3
- package/dist/ScriptedModel.mjs.map +1 -0
- package/dist/{travel-planner.d.mts → TravelPlanner.d.mts} +37 -26
- package/dist/{travel-planner.mjs → TravelPlanner.mjs} +19 -8
- package/dist/TravelPlanner.mjs.map +1 -0
- package/dist/{deterministic-layers-CKyYxBhN.mjs → deterministic-layers-Eka0fMZq.mjs} +7 -3
- package/dist/deterministic-layers-Eka0fMZq.mjs.map +1 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +2 -2
- package/dist/rolldown-runtime-D7D4PA-g.mjs +13 -0
- package/package.json +1 -1
- package/src/{certification.ts → Certification.ts} +70 -56
- package/src/{chaos.ts → Chaos.ts} +49 -33
- package/src/{code-executor-conformance.ts → CodeExecutorConformance.ts} +5 -3
- package/src/{code-executor-substitute.ts → CodeExecutorSubstitute.ts} +2 -2
- package/src/{fixtures/docs-researcher/index.ts → DocsResearcher.ts} +67 -4
- package/src/TravelPlanner.ts +244 -0
- package/src/fixtures/docs-researcher/definition.ts +5 -3
- package/src/fixtures/docs-researcher/harness.ts +10 -17
- package/src/fixtures/docs-researcher/mcp.ts +1 -1
- package/src/fixtures/travel-planner/definition.ts +2 -1
- package/src/fixtures/travel-planner/deterministic-layers.ts +4 -2
- package/src/fixtures/travel-planner/phase2.ts +2 -1
- package/src/fixtures/travel-planner/phase3.ts +4 -4
- package/src/fixtures/travel-planner/phase4.ts +8 -8
- package/src/fixtures/travel-planner/phase5.ts +14 -7
- package/src/fixtures/travel-planner/phase6.ts +6 -7
- package/src/fixtures/travel-planner/scenarios.ts +1 -1
- package/src/fixtures/travel-planner/subagents-durable.ts +11 -17
- package/src/fixtures/travel-planner/subagents.ts +6 -4
- package/src/index.ts +1 -2
- package/dist/certification.mjs.map +0 -1
- package/dist/chaos.mjs.map +0 -1
- package/dist/code-executor.mjs.map +0 -1
- package/dist/deterministic-layers-CKyYxBhN.mjs.map +0 -1
- package/dist/docs-researcher.mjs.map +0 -1
- package/dist/scripted-model-C2y0ztuj.mjs.map +0 -1
- package/dist/travel-planner.mjs.map +0 -1
- package/src/code-executor.ts +0 -3
- package/src/docs-researcher.ts +0 -2
- package/src/fixtures/travel-planner/index.ts +0 -11
- package/src/travel-planner.ts +0 -2
- /package/src/{scripted-model.ts → ScriptedModel.ts} +0 -0
|
@@ -1,55 +1,51 @@
|
|
|
1
|
+
import * as Subagent from "@effect-agent/capabilities/Subagent";
|
|
2
|
+
import { SubagentPolicy, SubagentRuntime } from "@effect-agent/capabilities/Subagent";
|
|
3
|
+
import { SubagentReservationsMemoryLive } from "@effect-agent/capabilities/SubagentReservations";
|
|
4
|
+
import * as Agent from "@effect-agent/core/Agent";
|
|
5
|
+
import { AgentPolicy } from "@effect-agent/core/AgentPolicy";
|
|
1
6
|
import {
|
|
2
|
-
Subagent,
|
|
3
|
-
SubagentPolicy,
|
|
4
|
-
SubagentReservationsMemoryLive,
|
|
5
|
-
SubagentRuntime,
|
|
6
|
-
} from "@effect-agent/capabilities";
|
|
7
|
-
import {
|
|
8
|
-
Agent,
|
|
9
|
-
AgentPolicy,
|
|
10
7
|
ThreadId,
|
|
11
|
-
IdGenerator,
|
|
12
8
|
RunId,
|
|
13
9
|
ToolCallId,
|
|
14
10
|
TurnId,
|
|
15
11
|
type AgentId,
|
|
16
12
|
type SubmissionId,
|
|
17
|
-
} from "@effect-agent/core";
|
|
18
|
-
import {
|
|
13
|
+
} from "@effect-agent/core/Identifiers";
|
|
14
|
+
import { IdGenerator } from "@effect-agent/core/IdGenerator";
|
|
15
|
+
import { DurableStep, DurableStepError } from "@effect-agent/engine/DurableStep";
|
|
16
|
+
import { RunToolAuthorization } from "@effect-agent/engine/RunOptions";
|
|
17
|
+
import { DurableWorkerBinding, type ResolvedBinding } from "@effect-agent/thread/AgentRegistration";
|
|
19
18
|
import {
|
|
20
|
-
ApprovalDecisionCommand,
|
|
21
|
-
ThreadExportRequest,
|
|
22
|
-
ThreadStore,
|
|
23
|
-
DefinitionDigests,
|
|
24
|
-
DeploymentId,
|
|
25
|
-
Digest,
|
|
26
19
|
DurableAgentRuntime,
|
|
27
20
|
DurableRuntimeConfig,
|
|
21
|
+
type DurableSubmitFailure,
|
|
22
|
+
type DurableSubmitOptions,
|
|
23
|
+
type Receipt,
|
|
24
|
+
} from "@effect-agent/thread/DurableAgentRuntime";
|
|
25
|
+
import {
|
|
28
26
|
DurableRuntimeFailpointError,
|
|
29
27
|
DurableRuntimeFailpointLocation,
|
|
30
|
-
|
|
28
|
+
} from "@effect-agent/thread/DurableFailpoint";
|
|
29
|
+
import {
|
|
30
|
+
DefinitionDigests,
|
|
31
|
+
DeploymentId,
|
|
32
|
+
Digest,
|
|
33
|
+
ProducerId,
|
|
34
|
+
type BatchId,
|
|
35
|
+
} from "@effect-agent/thread/Records";
|
|
36
|
+
import { childThreadIdFor } from "@effect-agent/thread/RunJournal";
|
|
37
|
+
import {
|
|
38
|
+
ApprovalDecisionCommand,
|
|
31
39
|
IdempotencyKey,
|
|
32
|
-
LoadCheckpointRequest,
|
|
33
40
|
Principal,
|
|
34
|
-
ProducerId,
|
|
35
41
|
ResolutionSafeToRetry,
|
|
36
42
|
SubmissionLedger,
|
|
37
43
|
SubmissionLookupById,
|
|
38
|
-
ToolReconciler,
|
|
39
44
|
UnknownResolutionCommand,
|
|
40
|
-
WakeScheduler,
|
|
41
45
|
DEFAULT_OWNERSHIP_LEASE_DURATION,
|
|
42
|
-
childThreadIdFor,
|
|
43
|
-
verifyThreadInvariants,
|
|
44
|
-
type BatchId,
|
|
45
|
-
type DurableSubmitFailure,
|
|
46
|
-
type DurableSubmitOptions,
|
|
47
|
-
type Receipt,
|
|
48
|
-
type ResolvedBinding,
|
|
49
46
|
type SubmissionSnapshot,
|
|
50
|
-
} from "@effect-agent/thread";
|
|
47
|
+
} from "@effect-agent/thread/SubmissionLedger";
|
|
51
48
|
import {
|
|
52
|
-
DurableRuntimeFailpointTestControl,
|
|
53
49
|
type CertificationCaseResult,
|
|
54
50
|
CertificationReport,
|
|
55
51
|
CertificationSweepResult,
|
|
@@ -57,7 +53,16 @@ import {
|
|
|
57
53
|
CertifiedAdapterIdentity,
|
|
58
54
|
certifyPorts,
|
|
59
55
|
type CertificationScenario,
|
|
60
|
-
} from "@effect-agent/thread/testing";
|
|
56
|
+
} from "@effect-agent/thread/testing/Certification";
|
|
57
|
+
import { DurableRuntimeFailpointTestControl } from "@effect-agent/thread/testing/DurableFailpointTestControl";
|
|
58
|
+
import { verifyThreadInvariants } from "@effect-agent/thread/ThreadInvariants";
|
|
59
|
+
import {
|
|
60
|
+
ThreadExportRequest,
|
|
61
|
+
ThreadStore,
|
|
62
|
+
LoadCheckpointRequest,
|
|
63
|
+
} from "@effect-agent/thread/ThreadStore";
|
|
64
|
+
import { ToolReconciler } from "@effect-agent/thread/ToolReconciler";
|
|
65
|
+
import { WakeScheduler } from "@effect-agent/thread/WakeScheduler";
|
|
61
66
|
import type { Crypto } from "effect";
|
|
62
67
|
import {
|
|
63
68
|
Cause,
|
|
@@ -575,21 +580,23 @@ const makeCell = Effect.fn("Certification.makeCell")(function* (
|
|
|
575
580
|
const resolved = yield* DurableWorkerBinding.make(binding, DIGESTS);
|
|
576
581
|
const threadId = decodeThreadId(`certify-${slug}`);
|
|
577
582
|
|
|
578
|
-
const submitOne = (
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
583
|
+
const submitOne = Effect.fn("Certification.submitOne")(function* (
|
|
584
|
+
key: string,
|
|
585
|
+
question: string,
|
|
586
|
+
) {
|
|
587
|
+
const runtime = yield* DurableAgentRuntime;
|
|
588
|
+
|
|
589
|
+
return yield* runtime.submit(
|
|
590
|
+
{ definition: { id: plainDefinition.id, input: plainDefinition.input } },
|
|
591
|
+
{ question },
|
|
592
|
+
{
|
|
593
|
+
threadId,
|
|
594
|
+
principal: PRINCIPAL,
|
|
595
|
+
idempotencyKey: decodeIdempotencyKey(key),
|
|
596
|
+
definitions: DIGESTS,
|
|
597
|
+
},
|
|
598
|
+
);
|
|
599
|
+
});
|
|
593
600
|
|
|
594
601
|
const cell: CertificationCell = {
|
|
595
602
|
bindings: [resolved],
|
|
@@ -747,7 +754,6 @@ const runSweepCell = Effect.fn("Certification.runSweepCell")(function* (
|
|
|
747
754
|
batchProducers: ReadonlyMap<BatchId, ProducerId>,
|
|
748
755
|
leaseAdvance: Duration.Duration,
|
|
749
756
|
) {
|
|
750
|
-
const runtime = yield* DurableAgentRuntime;
|
|
751
757
|
const ledger = yield* SubmissionLedger;
|
|
752
758
|
const control = yield* DurableRuntimeFailpointTestControl;
|
|
753
759
|
const slug = `${scenario}-${location.replaceAll(":", "-")}`;
|
|
@@ -764,6 +770,16 @@ const runSweepCell = Effect.fn("Certification.runSweepCell")(function* (
|
|
|
764
770
|
|
|
765
771
|
const cell = yield* makeCell(scenario, slug);
|
|
766
772
|
|
|
773
|
+
const runtime = yield* DurableAgentRuntime.pipe(
|
|
774
|
+
Effect.provide(
|
|
775
|
+
DurableAgentRuntime.layerWithBindings(cell.bindings).pipe(
|
|
776
|
+
Layer.provide(RunToolAuthorization.allowAll),
|
|
777
|
+
),
|
|
778
|
+
),
|
|
779
|
+
);
|
|
780
|
+
|
|
781
|
+
const submit = cell.submit.pipe(Effect.provideService(DurableAgentRuntime, runtime));
|
|
782
|
+
|
|
767
783
|
// One-shot arm: the fault fires at most once anywhere in the cell (initial drive OR a
|
|
768
784
|
// re-drive round's public unblocking operation), modelling one crash at this boundary.
|
|
769
785
|
const fired = yield* Ref.make(false);
|
|
@@ -782,12 +798,12 @@ const runSweepCell = Effect.fn("Certification.runSweepCell")(function* (
|
|
|
782
798
|
|
|
783
799
|
// Submissions are idempotent (DUR-001): one replay recovers a submit-boundary fault.
|
|
784
800
|
let receipts: ReadonlyArray<Receipt>;
|
|
785
|
-
const firstSubmit = yield* Effect.exit(
|
|
801
|
+
const firstSubmit = yield* Effect.exit(submit);
|
|
786
802
|
|
|
787
803
|
if (Exit.isSuccess(firstSubmit)) {
|
|
788
804
|
receipts = firstSubmit.value;
|
|
789
805
|
} else {
|
|
790
|
-
const secondSubmit = yield* Effect.exit(
|
|
806
|
+
const secondSubmit = yield* Effect.exit(submit);
|
|
791
807
|
|
|
792
808
|
if (Exit.isFailure(secondSubmit)) {
|
|
793
809
|
yield* control.clear;
|
|
@@ -801,7 +817,7 @@ const runSweepCell = Effect.fn("Certification.runSweepCell")(function* (
|
|
|
801
817
|
}
|
|
802
818
|
const lanes = cell.lanes(receipts);
|
|
803
819
|
|
|
804
|
-
const driveLane = (lane: ThreadId) => runtime.processThreadResolved(lane
|
|
820
|
+
const driveLane = (lane: ThreadId) => runtime.processThreadResolved(lane);
|
|
805
821
|
|
|
806
822
|
const allSettled = Effect.gen(function* () {
|
|
807
823
|
for (const receipt of receipts) {
|
|
@@ -1008,7 +1024,9 @@ export const certifyDurableAdapters = <LedgerE = never, StoreE = never>(
|
|
|
1008
1024
|
}),
|
|
1009
1025
|
).pipe(Layer.provide(options.threadStore));
|
|
1010
1026
|
|
|
1011
|
-
|
|
1027
|
+
// RUN-036: certification uses the default-none Tool failure observer. Trusted application
|
|
1028
|
+
// reporting adds no durable transition and is verified separately from adapter certification.
|
|
1029
|
+
const environment = Layer.mergeAll(
|
|
1012
1030
|
options.submissionLedger,
|
|
1013
1031
|
capturingStore,
|
|
1014
1032
|
options.wakeScheduler ?? WakeScheduler.layerNoop,
|
|
@@ -1023,10 +1041,6 @@ export const certifyDurableAdapters = <LedgerE = never, StoreE = never>(
|
|
|
1023
1041
|
}),
|
|
1024
1042
|
);
|
|
1025
1043
|
|
|
1026
|
-
// RUN-036: certification uses the default-none Tool failure observer. Trusted application
|
|
1027
|
-
// reporting adds no durable transition and is verified separately from adapter certification.
|
|
1028
|
-
const environment = DurableAgentRuntime.layer.pipe(Layer.provideMerge(support));
|
|
1029
|
-
|
|
1030
1044
|
const leaseAdvance = Duration.millis(
|
|
1031
1045
|
Duration.toMillis(options.ownershipLeaseDuration ?? DEFAULT_OWNERSHIP_LEASE_DURATION) + 1_000,
|
|
1032
1046
|
);
|
|
@@ -1,34 +1,51 @@
|
|
|
1
|
+
import * as Subagent from "@effect-agent/capabilities/Subagent";
|
|
2
|
+
import { SubagentPolicy, SubagentRuntime } from "@effect-agent/capabilities/Subagent";
|
|
3
|
+
import { SubagentReservationsMemoryLive } from "@effect-agent/capabilities/SubagentReservations";
|
|
4
|
+
import * as Agent from "@effect-agent/core/Agent";
|
|
5
|
+
import { AgentPolicy } from "@effect-agent/core/AgentPolicy";
|
|
1
6
|
import {
|
|
2
|
-
Subagent,
|
|
3
|
-
SubagentPolicy,
|
|
4
|
-
SubagentReservationsMemoryLive,
|
|
5
|
-
SubagentRuntime,
|
|
6
|
-
} from "@effect-agent/capabilities";
|
|
7
|
-
import {
|
|
8
|
-
Agent,
|
|
9
|
-
AgentPolicy,
|
|
10
7
|
ThreadId,
|
|
11
|
-
IdGenerator,
|
|
12
8
|
RunId,
|
|
13
9
|
ToolCallId,
|
|
14
10
|
TurnId,
|
|
15
11
|
type SubmissionId,
|
|
16
|
-
} from "@effect-agent/core";
|
|
17
|
-
import {
|
|
12
|
+
} from "@effect-agent/core/Identifiers";
|
|
13
|
+
import { IdGenerator } from "@effect-agent/core/IdGenerator";
|
|
14
|
+
import {
|
|
15
|
+
DurableStep,
|
|
16
|
+
DurableStepError,
|
|
17
|
+
ToolExecutionClass,
|
|
18
|
+
} from "@effect-agent/engine/DurableStep";
|
|
19
|
+
import { RunToolAuthorization } from "@effect-agent/engine/RunOptions";
|
|
20
|
+
import { ObligationThresholds } from "@effect-agent/thread/Admin";
|
|
21
|
+
import {
|
|
22
|
+
DurableWorkerBinding,
|
|
23
|
+
type DurableBindingFailure,
|
|
24
|
+
type ResolvedBinding,
|
|
25
|
+
} from "@effect-agent/thread/AgentRegistration";
|
|
18
26
|
import {
|
|
19
|
-
AbortCommand,
|
|
20
|
-
ApprovalDecisionCommand,
|
|
21
|
-
ThreadExportRequest,
|
|
22
|
-
ThreadStore,
|
|
23
|
-
DefinitionDigests,
|
|
24
|
-
Digest,
|
|
25
27
|
DurableAgentRuntime,
|
|
26
28
|
DurableRuntimeConfig,
|
|
29
|
+
type DurableSubmitFailure,
|
|
30
|
+
type DurableWorkerFailure,
|
|
31
|
+
type Receipt,
|
|
32
|
+
} from "@effect-agent/thread/DurableAgentRuntime";
|
|
33
|
+
import {
|
|
27
34
|
DurableRuntimeFailpointError,
|
|
28
35
|
DurableRuntimeFailpointLocation,
|
|
29
|
-
|
|
36
|
+
} from "@effect-agent/thread/DurableFailpoint";
|
|
37
|
+
import {
|
|
38
|
+
DefinitionDigests,
|
|
39
|
+
Digest,
|
|
40
|
+
type CanonicalRecordEnvelope,
|
|
41
|
+
type BatchId,
|
|
42
|
+
type ProducerId,
|
|
43
|
+
} from "@effect-agent/thread/Records";
|
|
44
|
+
import { childThreadIdFor } from "@effect-agent/thread/RunJournal";
|
|
45
|
+
import {
|
|
46
|
+
AbortCommand,
|
|
47
|
+
ApprovalDecisionCommand,
|
|
30
48
|
IdempotencyKey,
|
|
31
|
-
ObligationThresholds,
|
|
32
49
|
Principal,
|
|
33
50
|
ResolutionAbortSubmission,
|
|
34
51
|
ResolutionCompletedWithResult,
|
|
@@ -36,21 +53,13 @@ import {
|
|
|
36
53
|
SubmissionLedger,
|
|
37
54
|
SubmissionLookupById,
|
|
38
55
|
UnknownResolutionCommand,
|
|
39
|
-
childThreadIdFor,
|
|
40
|
-
verifyThreadInvariants,
|
|
41
|
-
type CanonicalRecordEnvelope,
|
|
42
|
-
type BatchId,
|
|
43
|
-
type DurableBindingFailure,
|
|
44
|
-
type DurableSubmitFailure,
|
|
45
|
-
type DurableWorkerFailure,
|
|
46
|
-
type ProducerId,
|
|
47
|
-
type Receipt,
|
|
48
|
-
type ResolvedBinding,
|
|
49
56
|
type Settlement,
|
|
50
57
|
type SubmissionSnapshot,
|
|
51
58
|
type UnknownResolution,
|
|
52
|
-
} from "@effect-agent/thread";
|
|
53
|
-
import { DurableRuntimeFailpointTestControl } from "@effect-agent/thread/testing";
|
|
59
|
+
} from "@effect-agent/thread/SubmissionLedger";
|
|
60
|
+
import { DurableRuntimeFailpointTestControl } from "@effect-agent/thread/testing/DurableFailpointTestControl";
|
|
61
|
+
import { verifyThreadInvariants } from "@effect-agent/thread/ThreadInvariants";
|
|
62
|
+
import { ThreadExportRequest, ThreadStore } from "@effect-agent/thread/ThreadStore";
|
|
54
63
|
import { Cause, Effect, Exit, Layer, Option, Ref, Schema, Stream } from "effect";
|
|
55
64
|
import { FastCheck } from "effect/testing";
|
|
56
65
|
import {
|
|
@@ -775,8 +784,15 @@ const makeLaneFixture = Effect.fn("Chaos.makeLaneFixture")(function* (
|
|
|
775
784
|
childLaneDigests(laneIndex),
|
|
776
785
|
);
|
|
777
786
|
|
|
778
|
-
const
|
|
779
|
-
|
|
787
|
+
const registeredRuntime = yield* DurableAgentRuntime.pipe(
|
|
788
|
+
Effect.provide(
|
|
789
|
+
DurableAgentRuntime.layerWithBindings([parentResolved, childResolved]).pipe(
|
|
790
|
+
Layer.provide(RunToolAuthorization.allowAll),
|
|
791
|
+
),
|
|
792
|
+
),
|
|
793
|
+
);
|
|
794
|
+
|
|
795
|
+
const driveResolved = (thread: ThreadId) => registeredRuntime.processThreadResolved(thread);
|
|
780
796
|
|
|
781
797
|
const fixture: LaneFixture = {
|
|
782
798
|
index: laneIndex,
|
|
@@ -6,14 +6,16 @@ import {
|
|
|
6
6
|
CodeExecutor,
|
|
7
7
|
CodeHostCallFailure,
|
|
8
8
|
CodeHostCallSuccess,
|
|
9
|
-
NetworkAllowlist,
|
|
10
|
-
NetworkDisabled,
|
|
11
9
|
type CodeExecutionError,
|
|
12
10
|
type CodeExecutionResult,
|
|
13
11
|
type CodeHostCall,
|
|
14
12
|
type CodeHostCallResult,
|
|
13
|
+
} from "@effect-agent/sandbox/CodeExecutor";
|
|
14
|
+
import {
|
|
15
|
+
NetworkAllowlist,
|
|
16
|
+
NetworkDisabled,
|
|
15
17
|
type SandboxImplementation,
|
|
16
|
-
} from "@effect-agent/sandbox";
|
|
18
|
+
} from "@effect-agent/sandbox/Sandbox";
|
|
17
19
|
import { Deferred, Duration, Effect, Fiber, Schema } from "effect";
|
|
18
20
|
|
|
19
21
|
/**
|
|
@@ -13,11 +13,11 @@ import {
|
|
|
13
13
|
CodeOutputLimitError,
|
|
14
14
|
CodeProgramFailedError,
|
|
15
15
|
CodeSourceError,
|
|
16
|
-
SandboxImplementation,
|
|
17
16
|
type CodeExecutionLimits,
|
|
18
17
|
type CodeExecutionNamespace,
|
|
19
18
|
type CodeExecutionRequest,
|
|
20
|
-
} from "@effect-agent/sandbox";
|
|
19
|
+
} from "@effect-agent/sandbox/CodeExecutor";
|
|
20
|
+
import { SandboxImplementation } from "@effect-agent/sandbox/Sandbox";
|
|
21
21
|
import { Clock, Duration, Effect, Fiber, Layer, Option, Queue, Schema } from "effect";
|
|
22
22
|
|
|
23
23
|
/**
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
/** Shared Docs Researcher definitions and MCP delegation fixtures. */
|
|
2
|
+
|
|
1
3
|
// ---------------------------------------------------------------------------
|
|
2
4
|
// Docs Researcher fixture (P7 internal agent #3): S2 durable delegation on DN
|
|
3
|
-
// with MCP-discovered content tools. See definition
|
|
5
|
+
// with MCP-discovered content tools. See fixtures/docs-researcher/{definition,mcp,harness}.ts.
|
|
4
6
|
//
|
|
5
7
|
// Authoring friction note (WP7 input; real observations from writing this
|
|
6
8
|
// agent):
|
|
@@ -29,6 +31,67 @@
|
|
|
29
31
|
// exactly where a reviewer looks for them.
|
|
30
32
|
// ---------------------------------------------------------------------------
|
|
31
33
|
|
|
32
|
-
export
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
export {
|
|
35
|
+
ResearchDocumentId,
|
|
36
|
+
BoundedSummary,
|
|
37
|
+
DocumentQuery,
|
|
38
|
+
ResearchDocument,
|
|
39
|
+
DocumentUnavailable,
|
|
40
|
+
DocumentLibrary,
|
|
41
|
+
FetchDocument,
|
|
42
|
+
DocContentToolkit,
|
|
43
|
+
docContentToolkitLayer,
|
|
44
|
+
docsDocumentBodySecret,
|
|
45
|
+
researchCorpusDocumentIds,
|
|
46
|
+
researchDocumentLookup,
|
|
47
|
+
researchDocumentFor,
|
|
48
|
+
documentBodyPhrase,
|
|
49
|
+
SummaryBrief,
|
|
50
|
+
DocumentSummary,
|
|
51
|
+
documentSummaryFor,
|
|
52
|
+
encodedDocumentSummary,
|
|
53
|
+
DocSummarizer,
|
|
54
|
+
SummaryRequest,
|
|
55
|
+
SummaryFinding,
|
|
56
|
+
DocumentSummaryFailed,
|
|
57
|
+
documentSummaryPolicy,
|
|
58
|
+
delegateDocumentSummary,
|
|
59
|
+
mapSummaryChildFailure,
|
|
60
|
+
docsSummarizerDigestStrings,
|
|
61
|
+
docsSummaryHandlersLayer,
|
|
62
|
+
ResearchRequest,
|
|
63
|
+
ResearchDigest,
|
|
64
|
+
docsCoordinatorConfidentialMarker,
|
|
65
|
+
docsMissionConfidentialMarker,
|
|
66
|
+
DocsResearcherToolkit,
|
|
67
|
+
DocsResearcher,
|
|
68
|
+
researchMissionRequest,
|
|
69
|
+
expectedResearchDigest,
|
|
70
|
+
} from "./fixtures/docs-researcher/definition.ts";
|
|
71
|
+
|
|
72
|
+
export {
|
|
73
|
+
docsResearcherDeploymentId,
|
|
74
|
+
docsResearcherProducerId,
|
|
75
|
+
docsResearcherPrincipal,
|
|
76
|
+
docsCoordinatorDigests,
|
|
77
|
+
docsSummarizerDigests,
|
|
78
|
+
docsResearcherSubmitOptions,
|
|
79
|
+
docsResearcherSubmitAgent,
|
|
80
|
+
summarizeCallId,
|
|
81
|
+
fetchCallId,
|
|
82
|
+
type DocsResearcherHarnessOptions,
|
|
83
|
+
type DocsResearcherHarness,
|
|
84
|
+
makeDocsResearcherHarness,
|
|
85
|
+
redactedDocumentPreview,
|
|
86
|
+
type DocsResearcherHarnessRequirements,
|
|
87
|
+
} from "./fixtures/docs-researcher/harness.ts";
|
|
88
|
+
|
|
89
|
+
export {
|
|
90
|
+
docsMcpRequest,
|
|
91
|
+
docsMcpIdentity,
|
|
92
|
+
docsMcpConnectorLayer,
|
|
93
|
+
docsMcpOversizedConnectorLayer,
|
|
94
|
+
docsMcpMismatchedConnectorLayer,
|
|
95
|
+
assertDiscoveryMatchesAuthoredToolkit,
|
|
96
|
+
DocsMcpDiscoveryEvidence,
|
|
97
|
+
} from "./fixtures/docs-researcher/mcp.ts";
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
/** Shared Travel Planner definitions, deterministic services, and durability fixtures. */
|
|
2
|
+
export {
|
|
3
|
+
AirportCode,
|
|
4
|
+
QuoteId,
|
|
5
|
+
TripRequest,
|
|
6
|
+
FlightQuery,
|
|
7
|
+
LodgingQuery,
|
|
8
|
+
ActivityQuery,
|
|
9
|
+
FlightOption,
|
|
10
|
+
LodgingOption,
|
|
11
|
+
ActivitySearchResult,
|
|
12
|
+
Itinerary,
|
|
13
|
+
TravelPlan,
|
|
14
|
+
FlightUnavailable,
|
|
15
|
+
LodgingUnavailable,
|
|
16
|
+
ActivityUnavailable,
|
|
17
|
+
GuidanceFailure,
|
|
18
|
+
FlightCatalog,
|
|
19
|
+
LodgingCatalog,
|
|
20
|
+
ActivityCatalog,
|
|
21
|
+
TravelGuidance,
|
|
22
|
+
SearchFlights,
|
|
23
|
+
SearchLodging,
|
|
24
|
+
SearchActivities,
|
|
25
|
+
TravelPlannerToolkit,
|
|
26
|
+
TravelPlannerToolkitLayer,
|
|
27
|
+
TravelPlanner,
|
|
28
|
+
} from "./fixtures/travel-planner/definition.ts";
|
|
29
|
+
|
|
30
|
+
export {
|
|
31
|
+
CatalogLifecycleCounts,
|
|
32
|
+
CatalogLifecycle,
|
|
33
|
+
type TravelPlannerCompletionControls,
|
|
34
|
+
ReverseCompletionToolkitLayer,
|
|
35
|
+
FlightCatalogLayer,
|
|
36
|
+
LodgingCatalogLayer,
|
|
37
|
+
ActivityCatalogLayer,
|
|
38
|
+
BookingRef,
|
|
39
|
+
SupplierOperation,
|
|
40
|
+
SupplierBookingRecord,
|
|
41
|
+
SupplierUnavailable,
|
|
42
|
+
type SupplierBookRequest,
|
|
43
|
+
type SupplierHoldControls,
|
|
44
|
+
cancelBookingIdempotencyKey,
|
|
45
|
+
supplierBookingRefFor,
|
|
46
|
+
SupplierBookingDesk,
|
|
47
|
+
TravelGuidanceLayer,
|
|
48
|
+
DeterministicIdGeneratorLayer,
|
|
49
|
+
TravelPlannerRuntimeLayer,
|
|
50
|
+
} from "./fixtures/travel-planner/deterministic-layers.ts";
|
|
51
|
+
|
|
52
|
+
export {
|
|
53
|
+
ItineraryHoldRequest,
|
|
54
|
+
ItineraryHold,
|
|
55
|
+
ItineraryHoldUnavailable,
|
|
56
|
+
ItineraryHoldGateway,
|
|
57
|
+
HoldItinerary,
|
|
58
|
+
TravelPlannerPhase2Toolkit,
|
|
59
|
+
TravelPlannerPhase2ToolkitLayer,
|
|
60
|
+
TravelPlannerPhase2,
|
|
61
|
+
} from "./fixtures/travel-planner/phase2.ts";
|
|
62
|
+
|
|
63
|
+
export {
|
|
64
|
+
TravelPlannerPersistenceProfile,
|
|
65
|
+
phase3TravelPlannerProfile,
|
|
66
|
+
phase3TravelPlannerThreadId,
|
|
67
|
+
phase3TravelPlannerProducerId,
|
|
68
|
+
phase3TravelPlannerRunId,
|
|
69
|
+
phase3TravelPlannerDefinitionDigests,
|
|
70
|
+
phase3TravelPlannerInitialBatch,
|
|
71
|
+
phase3TravelPlannerCompletionBatch,
|
|
72
|
+
phase3TravelPlannerBatches,
|
|
73
|
+
phase3TravelPlannerEncodedFixture,
|
|
74
|
+
TravelPlannerProjectionError,
|
|
75
|
+
travelPlanFromProjection,
|
|
76
|
+
makePhase3TravelPlannerCheckpoint,
|
|
77
|
+
} from "./fixtures/travel-planner/phase3.ts";
|
|
78
|
+
|
|
79
|
+
export {
|
|
80
|
+
TravelPlannerDurabilityProfile,
|
|
81
|
+
phase4TravelPlannerProfile,
|
|
82
|
+
phase4TravelPlannerDeploymentId,
|
|
83
|
+
phase4TravelPlannerProducerId,
|
|
84
|
+
phase4TravelPlannerPrincipal,
|
|
85
|
+
phase4TravelPlannerDefinitionDigests,
|
|
86
|
+
phase4TravelPlannerSubmitOptions,
|
|
87
|
+
DurableSearchFlights,
|
|
88
|
+
DurableSearchLodging,
|
|
89
|
+
DurableSearchActivities,
|
|
90
|
+
TravelPlannerPhase4Toolkit,
|
|
91
|
+
TravelPlannerPhase4ToolkitLayer,
|
|
92
|
+
TravelPlannerPhase4,
|
|
93
|
+
makePhase4TravelPlannerAgent,
|
|
94
|
+
phase4TravelPlannerWorkerLayer,
|
|
95
|
+
TravelPlannerDurableEvidenceError,
|
|
96
|
+
travelPlanFromDurableSettlement,
|
|
97
|
+
normalizeDurableTravelPlannerEvidence,
|
|
98
|
+
} from "./fixtures/travel-planner/phase4.ts";
|
|
99
|
+
|
|
100
|
+
export {
|
|
101
|
+
TravelPlannerBookingProfile,
|
|
102
|
+
phase5TravelPlannerProfile,
|
|
103
|
+
phase5TravelPlannerDeploymentId,
|
|
104
|
+
phase5TravelPlannerProducerId,
|
|
105
|
+
phase5TravelPlannerPrincipal,
|
|
106
|
+
phase5TravelPlannerDefinitionDigests,
|
|
107
|
+
phase5TravelPlannerSubmitOptions,
|
|
108
|
+
TravelerRef,
|
|
109
|
+
FlightBookingRequest,
|
|
110
|
+
SupplierBookingConfirmation,
|
|
111
|
+
CancelBookingRequest,
|
|
112
|
+
CancellationConfirmation,
|
|
113
|
+
ItineraryBookingRequest,
|
|
114
|
+
ItineraryConfirmation,
|
|
115
|
+
TravelBookingReport,
|
|
116
|
+
bookFlightIdempotencyKey,
|
|
117
|
+
itineraryStepIdempotencyKey,
|
|
118
|
+
BookFlight,
|
|
119
|
+
CancelBooking,
|
|
120
|
+
BookItinerary,
|
|
121
|
+
TravelPlannerPhase5Toolkit,
|
|
122
|
+
TravelPlannerPhase5ToolkitLayer,
|
|
123
|
+
TravelSupplierReconcilerLayer,
|
|
124
|
+
TravelPlannerPhase5,
|
|
125
|
+
TravelPlannerBookingEvidenceError,
|
|
126
|
+
assertSettledBookingsExistAtSupplier,
|
|
127
|
+
phase5TravelPlannerWorkerLayer,
|
|
128
|
+
} from "./fixtures/travel-planner/phase5.ts";
|
|
129
|
+
|
|
130
|
+
export {
|
|
131
|
+
TravelPlannerCloudflareProfile,
|
|
132
|
+
phase6TravelPlannerProfile,
|
|
133
|
+
phase6TravelPlannerDeploymentId,
|
|
134
|
+
phase6TravelPlannerProducerPrefix,
|
|
135
|
+
phase6TravelPlannerProducerId,
|
|
136
|
+
phase6GatedPlannerDefinitionDigests,
|
|
137
|
+
type CrossPlatformEvidenceIdentity,
|
|
138
|
+
normalizeCrossPlatformTravelPlannerEvidence,
|
|
139
|
+
phase6FlightCallId,
|
|
140
|
+
phase6LodgingCallId,
|
|
141
|
+
phase6ActivityCallId,
|
|
142
|
+
phase6PlannerModel,
|
|
143
|
+
releasePhase6PlannerGate,
|
|
144
|
+
resetPhase6PlannerGate,
|
|
145
|
+
phase6GatedTrip,
|
|
146
|
+
phase6GatedPlannerModel,
|
|
147
|
+
phase6SupplierDesk,
|
|
148
|
+
phase6SupplierDeskLayer,
|
|
149
|
+
phase6SupplierReconcilerLayer,
|
|
150
|
+
phase6BookingToolCallId,
|
|
151
|
+
phase6BookingRef,
|
|
152
|
+
phase6BookingTrip,
|
|
153
|
+
phase6BookingModel,
|
|
154
|
+
phase6GuideInvocationCount,
|
|
155
|
+
phase6ResearchMission,
|
|
156
|
+
phase6ResearchDestination,
|
|
157
|
+
phase6ChildLookupCallId,
|
|
158
|
+
phase6CoordinatorModel,
|
|
159
|
+
releasePhase6ResearcherGate,
|
|
160
|
+
resetPhase6ResearcherGate,
|
|
161
|
+
phase6ResearcherModel,
|
|
162
|
+
makePhase6TravelPlannerBindings,
|
|
163
|
+
phase6TravelPlannerGoldenEvidence,
|
|
164
|
+
} from "./fixtures/travel-planner/phase6.ts";
|
|
165
|
+
|
|
166
|
+
export {
|
|
167
|
+
TravelPlannerPhase7Profile,
|
|
168
|
+
phase7TravelPlannerProfile,
|
|
169
|
+
PHASE7_LIVE_GATE_ENV,
|
|
170
|
+
PHASE7_LIVE_CREDENTIAL_ENV,
|
|
171
|
+
type Phase7LiveGateEnvironment,
|
|
172
|
+
phase7LiveProfileEnabled,
|
|
173
|
+
} from "./fixtures/travel-planner/phase7.ts";
|
|
174
|
+
|
|
175
|
+
export {
|
|
176
|
+
phase1Trip,
|
|
177
|
+
expectedTravelPlan,
|
|
178
|
+
phase1HappyPathTurns,
|
|
179
|
+
} from "./fixtures/travel-planner/scenarios.ts";
|
|
180
|
+
|
|
181
|
+
export {
|
|
182
|
+
DestinationQuery,
|
|
183
|
+
DestinationFacts,
|
|
184
|
+
DestinationGuideUnavailable,
|
|
185
|
+
DestinationGuide,
|
|
186
|
+
LookupDestination,
|
|
187
|
+
DestinationResearcherToolkit,
|
|
188
|
+
DestinationResearcherToolkitLayer,
|
|
189
|
+
DestinationBrief,
|
|
190
|
+
DestinationReport,
|
|
191
|
+
DestinationResearcher,
|
|
192
|
+
destinationLookup,
|
|
193
|
+
destinationReportFor,
|
|
194
|
+
encodedDestinationReport,
|
|
195
|
+
DestinationGuideLayer,
|
|
196
|
+
DestinationResearchSupportLayer,
|
|
197
|
+
DestinationResearchRequest,
|
|
198
|
+
DestinationResearchFindings,
|
|
199
|
+
DestinationResearchFailed,
|
|
200
|
+
ResearchDispatchGate,
|
|
201
|
+
destinationResearchPolicy,
|
|
202
|
+
destinationResearchDelegation,
|
|
203
|
+
mapResearchChildFailure,
|
|
204
|
+
destinationResearchHandlersLayer,
|
|
205
|
+
ResearchMission,
|
|
206
|
+
DestinationRecommendation,
|
|
207
|
+
DestinationShortlist,
|
|
208
|
+
coordinatorConfidentialMarker,
|
|
209
|
+
missionConfidentialMarker,
|
|
210
|
+
TravelCoordinatorToolkit,
|
|
211
|
+
TravelCoordinator,
|
|
212
|
+
researchMission,
|
|
213
|
+
expectedDestinationShortlist,
|
|
214
|
+
type DestinationResearchCall,
|
|
215
|
+
coordinatorResearchTurn,
|
|
216
|
+
coordinatorShortlistTurn,
|
|
217
|
+
researcherHappyPathTurns,
|
|
218
|
+
type DestinationResearcherControls,
|
|
219
|
+
makeDestinationResearcherModel,
|
|
220
|
+
} from "./fixtures/travel-planner/subagents.ts";
|
|
221
|
+
|
|
222
|
+
export {
|
|
223
|
+
TravelPlannerSubagentDurabilityProfile,
|
|
224
|
+
s2TravelPlannerProfile,
|
|
225
|
+
s2TravelPlannerDeploymentId,
|
|
226
|
+
s2TravelPlannerProducerId,
|
|
227
|
+
s2TravelPlannerPrincipal,
|
|
228
|
+
s2CoordinatorDigests,
|
|
229
|
+
s2ResearcherDigestStrings,
|
|
230
|
+
s2ResearcherDigests,
|
|
231
|
+
s2TravelPlannerSubmitOptions,
|
|
232
|
+
s2CoordinatorSubmitAgent,
|
|
233
|
+
durableResearchAllocation,
|
|
234
|
+
durableResearchCallId,
|
|
235
|
+
durableChildLookupCallId,
|
|
236
|
+
durableResearchFinding,
|
|
237
|
+
durableResearchShortlist,
|
|
238
|
+
encodedDestinationFacts,
|
|
239
|
+
makeInvocationCountingModel,
|
|
240
|
+
durableDestinationResearchHandlersLayer,
|
|
241
|
+
type DurableResearchHarnessOptions,
|
|
242
|
+
type DurableResearchHarness,
|
|
243
|
+
makeDurableResearchHarness,
|
|
244
|
+
} from "./fixtures/travel-planner/subagents-durable.ts";
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
1
|
+
import * as Subagent from "@effect-agent/capabilities/Subagent";
|
|
2
|
+
import { SubagentPolicy, SubagentRuntime } from "@effect-agent/capabilities/Subagent";
|
|
3
|
+
import * as Agent from "@effect-agent/core/Agent";
|
|
4
|
+
import { AgentPolicy } from "@effect-agent/core/AgentPolicy";
|
|
5
|
+
import { type RuntimeBinding } from "@effect-agent/engine/AgentRuntime";
|
|
4
6
|
import { Context, Effect, Schema } from "effect";
|
|
5
7
|
import { Tool, Toolkit } from "effect/unstable/ai";
|
|
6
8
|
|