Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

AgentAwarenessRelay.test.ts

717 lines23.8 KB

1import * as NodeCrypto from "node:crypto";
2import * as NodeServices from "@effect/platform-node/NodeServices";
3​
4import type {
5 EnvironmentId,
6 ExecutionEnvironmentDescriptor,
7 OrchestrationEvent,
8 OrchestrationProjectShell,
9 OrchestrationShellSnapshot,
10 OrchestrationThreadShell,
11 ProjectId,
12 ThreadId,
13 TurnId,
14} from "@t3tools/contracts";
15import type {
16 RelayAgentActivityPublishProofPayload,
17 RelayAgentActivityState,
18} from "@t3tools/contracts/relay";
19import { CommandId, ProviderInstanceId } from "@t3tools/contracts";
20import { RelayClientTracer } from "@t3tools/shared/relayTracing";
21import { RELAY_ACTIVITY_PUBLISH_TYP, verifyRelayJwt } from "@t3tools/shared/relayJwt";
22import { describe, expect, it } from "@effect/vitest";
23import * as Deferred from "effect/Deferred";
24import * as Effect from "effect/Effect";
25import * as Layer from "effect/Layer";
26import * as Option from "effect/Option";
27import * as Queue from "effect/Queue";
28import * as Stream from "effect/Stream";
29import * as Tracer from "effect/Tracer";
30​
31import * as ServerSecretStore from "../auth/ServerSecretStore.ts";
32import * as ServerEnvironment from "../environment/ServerEnvironment.ts";
33import {
34 OrchestrationEngineService,
35 type OrchestrationEngineShape,
36} from "../orchestration/Services/OrchestrationEngine.ts";
37import {
38 ProjectionSnapshotQuery,
39 type ProjectionSnapshotQueryShape,
40} from "../orchestration/Services/ProjectionSnapshotQuery.ts";
41import {
42 RELAY_ENVIRONMENT_CREDENTIAL_SECRET,
43 RELAY_ISSUER_SECRET,
44 RELAY_URL_SECRET,
45 PUBLISH_AGENT_ACTIVITY_SECRET,
46} from "../cloud/config.ts";
47import * as AgentAwarenessRelay from "./AgentAwarenessRelay.ts";
48​
49const state: RelayAgentActivityState = {
50 environmentId: "env" as RelayAgentActivityState["environmentId"],
51 threadId: "thread" as RelayAgentActivityState["threadId"],
52 projectTitle: "Project",
53 threadTitle: "Thread",
54 modelTitle: "gpt-5.4",
55 phase: "running",
56 headline: "Running",
57 updatedAt: "2026-05-25T00:00:00.000Z",
58 deepLink: "/threads/env/thread",
59};
60​
61const encodeSecret = (value: string): Uint8Array => new TextEncoder().encode(value);
62​
63function makeMemorySecretStore() {
64 const values = new Map<string, Uint8Array>();
65 const store = {
66 get: ((name) =>
67 Effect.sync(() => {
68 const value = values.get(name);
69 return value === undefined ? Option.none() : Option.some(Uint8Array.from(value));
70 })) satisfies ServerSecretStore.ServerSecretStore["Service"]["get"],
71 set: ((name, value) =>
72 Effect.sync(() => {
73 values.set(name, Uint8Array.from(value));
74 })) satisfies ServerSecretStore.ServerSecretStore["Service"]["set"],
75 create: ((name, value) =>
76 Effect.sync(() => {
77 values.set(name, Uint8Array.from(value));
78 })) satisfies ServerSecretStore.ServerSecretStore["Service"]["create"],
79 getOrCreateRandom: ((name, bytes) =>
80 Effect.sync(() => {
81 const existing = values.get(name);
82 if (existing) {
83 return existing;
84 }
85 const generated = new Uint8Array(bytes);
86 values.set(name, generated);
87 return generated;
88 })) satisfies ServerSecretStore.ServerSecretStore["Service"]["getOrCreateRandom"],
89 remove: ((name) =>
90 Effect.sync(() => {
91 values.delete(name);
92 })) satisfies ServerSecretStore.ServerSecretStore["Service"]["remove"],
93 } satisfies ServerSecretStore.ServerSecretStore["Service"];
94 return {
95 store,
96 setString: (name: string, value: string) => store.set(name, encodeSecret(value)),
97 };
99​
100describe.sequential("signRelayAgentActivityPublishProof", () => {
101 it("distinguishes pending link credentials from disabled publication", () => {
102 expect(
103 AgentAwarenessRelay.resolveAgentActivityPublishingStartupState({
104 relayConfigured: false,
105 publishEnabled: false,
106 }),
107 ).toBe("waiting-for-link");
108 expect(
109 AgentAwarenessRelay.resolveAgentActivityPublishingStartupState({
110 relayConfigured: true,
111 publishEnabled: false,
112 }),
113 ).toBe("disabled");
114 expect(
115 AgentAwarenessRelay.resolveAgentActivityPublishingStartupState({
116 relayConfigured: true,
117 publishEnabled: true,
118 }),
119 ).toBe("enabled");
120 });
121​
122 it("derives the thread id from the aggregate id for thread events without payload thread ids", () => {
123 const threadId = "thread-aggregate-1" as ThreadId;
124 const now = "2026-05-25T00:00:00.000Z";
125 const event = {
126 type: "thread.activity-appended",
127 sequence: 1,
128 eventId: "evt-aggregate-1",
129 commandId: CommandId.make("cmd-1"),
130 aggregateKind: "thread",
131 aggregateId: threadId,
132 actor: { kind: "server" },
133 payload: {},
134 occurredAt: now,
135 } as unknown as OrchestrationEvent;
136​
137 expect(AgentAwarenessRelay.eventThreadId(event)).toBe(threadId);
138 });
139​
140 it("does not publish start intents, streaming content, or non-awareness activity events", () => {
141 const now = "2026-05-25T00:00:00.000Z";
142 const base = {
143 sequence: 1,
144 eventId: "evt-1",
145 commandId: CommandId.make("cmd-1"),
146 aggregateKind: "thread",
147 aggregateId: "thread-1" as ThreadId,
148 occurredAt: now,
149 };
150​
151 expect(
152 AgentAwarenessRelay.shouldPublishAgentAwarenessEvent({
153 ...base,
154 type: "thread.message-sent",
155 payload: {
156 threadId: "thread-1" as ThreadId,
157 streaming: true,
158 },
159 } as unknown as OrchestrationEvent),
160 ).toBe(false);
161 expect(
162 AgentAwarenessRelay.shouldPublishAgentAwarenessEvent({
163 ...base,
164 type: "thread.activity-appended",
165 payload: {
166 threadId: "thread-1" as ThreadId,
167 activity: {
168 kind: "task.progress",
169 },
170 },
171 } as unknown as OrchestrationEvent),
172 ).toBe(false);
173 expect(
174 AgentAwarenessRelay.shouldPublishAgentAwarenessEvent({
175 ...base,
176 type: "thread.activity-appended",
177 payload: {
178 threadId: "thread-1" as ThreadId,
179 activity: {
180 kind: "approval.requested",
181 },
182 },
183 } as unknown as OrchestrationEvent),
184 ).toBe(true);
185 expect(
186 AgentAwarenessRelay.shouldPublishAgentAwarenessEvent({
187 ...base,
188 type: "thread.message-sent",
189 payload: {
190 threadId: "thread-1" as ThreadId,
191 streaming: false,
192 },
193 } as unknown as OrchestrationEvent),
194 ).toBe(false);
195 expect(
196 AgentAwarenessRelay.shouldPublishAgentAwarenessEvent({
197 ...base,
198 type: "thread.turn-start-requested",
199 payload: {
200 threadId: "thread-1" as ThreadId,
201 },
202 } as unknown as OrchestrationEvent),
203 ).toBe(false);
204 });
205​
206 it("deduplicates awareness state updates whose only change is their event timestamp", () => {
207 expect(AgentAwarenessRelay.agentAwarenessPublishIdentity(state)).toBe(
208 AgentAwarenessRelay.agentAwarenessPublishIdentity({
209 ...state,
210 updatedAt: "2026-05-25T00:10:00.000Z",
211 }),
212 );
213 expect(AgentAwarenessRelay.agentAwarenessPublishIdentity(state)).not.toBe(
214 AgentAwarenessRelay.agentAwarenessPublishIdentity({
215 ...state,
216 phase: "completed",
217 headline: "Agent finished",
218 }),
219 );
220 });
221​
222 it("requires an explicit opt-in before publishing agent activity", () => {
223 expect(AgentAwarenessRelay.isAgentActivityPublishingEnabled(null)).toBe(false);
224 expect(AgentAwarenessRelay.isAgentActivityPublishingEnabled("false")).toBe(false);
225 expect(AgentAwarenessRelay.isAgentActivityPublishingEnabled("true")).toBe(true);
226 });
227​
228 it("redacts failed activity details and caps other relay detail", () => {
229 expect(
230 AgentAwarenessRelay.sanitizeRelayAgentActivityState({
231 ...state,
232 phase: "failed",
233 detail: "Provider process exited with secret token.",
234 }),
235 ).toMatchObject({
236 phase: "failed",
237 detail: "The agent run failed.",
238 });
239 expect(
240 AgentAwarenessRelay.sanitizeRelayAgentActivityState({
241 ...state,
242 detail: "x".repeat(200),
243 })?.detail,
244 ).toHaveLength(160);
245 });
246​
247 it("resolves a null publish state when a thread or project snapshot disappeared", () => {
248 const environmentId = "env-1" as EnvironmentId;
249 const threadId = "thread-1" as ThreadId;
250 const thread = {
251 id: threadId,
252 projectId: "project-1" as ProjectId,
253 title: "Deleted thread",
254 modelSelection: { instanceId: ProviderInstanceId.make("codex"), model: "gpt-5.4" },
255 session: null,
256 latestTurn: null,
257 updatedAt: "2026-05-25T00:00:00.000Z",
258 hasPendingApprovals: false,
259 hasPendingUserInput: false,
260 } as OrchestrationThreadShell;
261​
262 expect(
263 AgentAwarenessRelay.resolveAgentAwarenessRelayPublishSnapshot({
264 environmentId,
265 threadId,
266 thread: Option.none(),
267 project: Option.none(),
268 }),
269 ).toEqual({
270 projectId: null,
271 state: null,
272 reason: "thread-not-found",
273 });
274​
275 expect(
276 AgentAwarenessRelay.resolveAgentAwarenessRelayPublishSnapshot({
277 environmentId,
278 threadId,
279 thread: Option.some(thread),
280 project: Option.none(),
281 }),
282 ).toEqual({
283 projectId: "project-1",
284 state: null,
285 reason: "project-not-found",
286 });
287 });
288​
289 it("selects only active shell snapshot threads for startup catch-up", () => {
290 const now = "2026-05-25T00:00:00.000Z";
291 const environmentId = "env-1" as EnvironmentId;
292 const projectId = "project-1" as ProjectId;
293 const activeThreadId = "thread-active" as ThreadId;
294 const idleThreadId = "thread-idle" as ThreadId;
295​
296 const baseThread = {
297 projectId,
298 title: "Run remote agent",
299 modelSelection: { instanceId: ProviderInstanceId.make("codex"), model: "gpt-5.4" },
300 runtimeMode: "full-access",
301 interactionMode: "default",
302 branch: null,
303 worktreePath: null,
304 latestTurn: null,
305 createdAt: now,
306 updatedAt: now,
307 archivedAt: null,
308 session: null,
309 latestUserMessageAt: null,
310 hasPendingApprovals: false,
311 hasPendingUserInput: false,
312 hasActionableProposedPlan: false,
313 } satisfies Omit<OrchestrationThreadShell, "id">;
314​
315 expect(
316 AgentAwarenessRelay.resolveAgentAwarenessRelayActiveThreadIds({
317 environmentId,
318 projects: [
319 {
320 id: projectId,
321 title: "T3 Code",
322 },
323 ],
324 threads: [
325 {
326 ...baseThread,
327 id: activeThreadId,
328 latestTurn: {
329 turnId: "turn-1" as TurnId,
330 state: "running",
331 requestedAt: now,
332 startedAt: now,
333 completedAt: null,
334 assistantMessageId: null,
335 },
336 },
337 {
338 ...baseThread,
339 id: idleThreadId,
340 },
341 {
342 ...baseThread,
343 id: "thread-missing-project" as ThreadId,
344 projectId: "missing-project" as ProjectId,
345 latestTurn: {
346 turnId: "turn-2" as TurnId,
347 state: "running",
348 requestedAt: now,
349 startedAt: now,
350 completedAt: null,
351 assistantMessageId: null,
352 },
353 },
354 ],
355 }),
356 ).toEqual([activeThreadId]);
357 });
358​
359 it("signs the activity publish JWT and rejects tampering", async () => {
360 const keyPair = NodeCrypto.generateKeyPairSync("ed25519", {
361 privateKeyEncoding: { format: "pem", type: "pkcs8" },
362 publicKeyEncoding: { format: "pem", type: "spki" },
363 });
364 const payload = {
365 iss: "t3-env:env",
366 aud: "https://relay.example.test",
367 sub: "env",
368 jti: "nonce-1",
369 iat: 100,
370 exp: 200,
371 environmentId: state.environmentId,
372 threadId: state.threadId,
373 state,
374 } satisfies RelayAgentActivityPublishProofPayload;
375 const proof = await Effect.runPromise(
376 AgentAwarenessRelay.signRelayAgentActivityPublishProof({
377 privateKey: keyPair.privateKey,
378 payload,
379 }),
380 );
381​
382 await expect(
383 Effect.runPromise(
384 verifyRelayJwt({
385 publicKey: keyPair.publicKey,
386 token: proof,
387 typ: RELAY_ACTIVITY_PUBLISH_TYP,
388 issuer: "t3-env:env",
389 audience: "https://relay.example.test",
390 nowEpochSeconds: 150,
391 }),
392 ),
393 ).resolves.toMatchObject({ jti: "nonce-1", state });
394 await expect(
395 Effect.runPromise(
396 verifyRelayJwt({
397 publicKey: keyPair.publicKey,
398 token: (() => {
399 const [header, body, signature = ""] = proof.split(".");
400 const corruptedSignature = `${signature.startsWith("a") ? "b" : "a"}${signature.slice(1)}`;
401 return `${header}.${body}.${corruptedSignature}`;
402 })(),
403 typ: RELAY_ACTIVITY_PUBLISH_TYP,
404 issuer: "t3-env:env",
405 audience: "https://relay.example.test",
406 nowEpochSeconds: 150,
407 }),
408 ),
409 ).rejects.toBeDefined();
410 });
411​
412 it.effect("keeps the orchestration listener armed until relay config is installed", () =>
413 Effect.scoped(
414 Effect.gen(function* () {
415 const events = yield* Queue.unbounded<OrchestrationEvent>();
416 const threadShellRequested = yield* Deferred.make<void>();
417 const secrets = makeMemorySecretStore();
418 const now = "2026-05-25T00:00:00.000Z";
419 const projectId = "project-1" as ProjectId;
420 const threadId = "thread-1" as ThreadId;
421 const environmentId = "env-1" as EnvironmentId;
422​
423 const project = {
424 id: projectId,
425 title: "T3 Code",
426 workspaceRoot: "/workspace",
427 repositoryIdentity: null,
428 defaultModelSelection: null,
429 scripts: [],
430 createdAt: now,
431 updatedAt: now,
432 } satisfies OrchestrationProjectShell;
433​
434 const thread = {
435 id: threadId,
436 projectId,
437 title: "Run remote agent",
438 modelSelection: { instanceId: ProviderInstanceId.make("codex"), model: "gpt-5.4" },
439 runtimeMode: "full-access",
440 interactionMode: "default",
441 branch: null,
442 worktreePath: null,
443 latestTurn: {
444 turnId: "turn-1" as TurnId,
445 state: "running",
446 requestedAt: now,
447 startedAt: now,
448 completedAt: null,
449 assistantMessageId: null,
450 },
451 createdAt: now,
452 updatedAt: now,
453 archivedAt: null,
454 session: {
455 threadId,
456 status: "running",
457 providerName: "Codex",
458 runtimeMode: "full-access",
459 activeTurnId: "turn-1" as TurnId,
460 lastError: null,
461 updatedAt: now,
462 },
463 latestUserMessageAt: now,
464 hasPendingApprovals: false,
465 hasPendingUserInput: false,
466 hasActionableProposedPlan: false,
467 } satisfies OrchestrationThreadShell;
468​
469 const orchestrationEngine = {
470 readEvents: () => Stream.empty,
471 dispatch: () => Effect.succeed({ sequence: 1 }),
472 streamDomainEvents: Stream.fromQueue(events),
473 } satisfies OrchestrationEngineShape;
474​
475 const snapshotQuery = {
476 getShellSnapshot: () =>
477 Effect.succeed({
478 snapshotSequence: 1,
479 projects: [project],
480 threads: [thread],
481 updatedAt: now,
482 } satisfies OrchestrationShellSnapshot),
483 getThreadShellById: () =>
484 Deferred.succeed(threadShellRequested, undefined).pipe(
485 Effect.ignore,
486 Effect.as(Option.some(thread)),
487 ),
488 getProjectShellById: () => Effect.succeed(Option.some(project)),
489 } as unknown as ProjectionSnapshotQueryShape;
490​
491 const descriptor = {
492 environmentId,
493 label: "Test Desktop",
494 platform: {
495 os: "darwin",
496 arch: "arm64",
497 },
498 serverVersion: "0.0.0-test",
499 capabilities: {
500 repositoryIdentity: true,
501 },
502 } satisfies ExecutionEnvironmentDescriptor;
503​
504 const layer = Layer.mergeAll(
505 Layer.succeed(ServerSecretStore.ServerSecretStore, secrets.store),
506 Layer.succeed(ServerEnvironment.ServerEnvironment, {
507 getEnvironmentId: Effect.succeed(environmentId),
508 getDescriptor: Effect.succeed(descriptor),
509 }),
510 Layer.succeed(OrchestrationEngineService, orchestrationEngine),
511 Layer.succeed(ProjectionSnapshotQuery, snapshotQuery),
512 );
513​
514 yield* Effect.gen(function* () {
515 const relay = yield* AgentAwarenessRelay.AgentAwarenessRelay;
516 yield* relay.start();
517 yield* secrets.setString(RELAY_URL_SECRET, "http://127.0.0.1:1");
518 yield* secrets.setString(RELAY_ENVIRONMENT_CREDENTIAL_SECRET, "relay-credential");
519 yield* secrets.setString(PUBLISH_AGENT_ACTIVITY_SECRET, "true");
520 yield* Queue.offer(events, {
521 type: "thread.activity-appended",
522 sequence: 1,
523 eventId: "evt-1",
524 commandId: CommandId.make("cmd-1"),
525 aggregateKind: "thread",
526 aggregateId: threadId,
527 actor: { kind: "server" },
528 payload: {
529 threadId,
530 activity: {
531 kind: "approval.requested",
532 },
533 },
534 occurredAt: now,
535 } as unknown as OrchestrationEvent);
536​
537 yield* Deferred.await(threadShellRequested).pipe(Effect.timeout("2 seconds"));
538 }).pipe(
539 Effect.provide(
540 AgentAwarenessRelay.layer.pipe(
541 Layer.provide(layer),
542 Layer.provideMerge(NodeServices.layer),
543 ),
544 ),
545 );
546 }),
547 ),
548 );
549​
550 it.effect("publishes agent activity to the relay transport URL, not the relay issuer", () =>
551 Effect.scoped(
552 Effect.gen(function* () {
553 const originalFetch = globalThis.fetch;
554 const context = yield* Effect.context<never>();
555 const runFork = Effect.runForkWith(context);
556 const events = yield* Queue.unbounded<OrchestrationEvent>();
557 const fetchSeen = yield* Deferred.make<URL>();
558 const userSpans: Array<string> = [];
559 const productSpans: Array<string> = [];
560 const collectingTracer = (spans: Array<string>) =>
561 Tracer.make({
562 span: (options) => {
563 const span = new Tracer.NativeSpan(options);
564 const end = span.end.bind(span);
565 span.end = (endTime, exit) => {
566 end(endTime, exit);
567 spans.push(span.name);
568 };
569 return span;
570 },
571 });
572 const secrets = makeMemorySecretStore();
573 const now = "2026-05-25T00:00:00.000Z";
574 const projectId = "project-1" as ProjectId;
575 const threadId = "thread-1" as ThreadId;
576 const environmentId = "env-1" as EnvironmentId;
577​
578 const project = {
579 id: projectId,
580 title: "T3 Code",
581 workspaceRoot: "/workspace",
582 repositoryIdentity: null,
583 defaultModelSelection: null,
584 scripts: [],
585 createdAt: now,
586 updatedAt: now,
587 } satisfies OrchestrationProjectShell;
588​
589 const thread = {
590 id: threadId,
591 projectId,
592 title: "Run remote agent",
593 modelSelection: { instanceId: ProviderInstanceId.make("codex"), model: "gpt-5.4" },
594 runtimeMode: "full-access",
595 interactionMode: "default",
596 branch: null,
597 worktreePath: null,
598 latestTurn: {
599 turnId: "turn-1" as TurnId,
600 state: "running",
601 requestedAt: now,
602 startedAt: now,
603 completedAt: null,
604 assistantMessageId: null,
605 },
606 createdAt: now,
607 updatedAt: now,
608 archivedAt: null,
609 session: {
610 threadId,
611 status: "running",
612 providerName: "Codex",
613 runtimeMode: "full-access",
614 activeTurnId: "turn-1" as TurnId,
615 lastError: null,
616 updatedAt: now,
617 },
618 latestUserMessageAt: now,
619 hasPendingApprovals: false,
620 hasPendingUserInput: false,
621 hasActionableProposedPlan: false,
622 } satisfies OrchestrationThreadShell;
623​
624 const descriptor = {
625 environmentId,
626 label: "Test Desktop",
627 platform: {
628 os: "darwin",
629 arch: "arm64",
630 },
631 serverVersion: "0.0.0-test",
632 capabilities: {
633 repositoryIdentity: true,
634 },
635 } satisfies ExecutionEnvironmentDescriptor;
636​
637 globalThis.fetch = ((input: Parameters<typeof fetch>[0]) => {
638 const url = new URL(
639 typeof input === "string" || input instanceof URL
640 ? input
641 : (input as unknown as { readonly url: string }).url,
642 );
643 runFork(Deferred.succeed(fetchSeen, url));
644 return Promise.resolve(Response.json({ ok: true, deliveries: [] }));
645 }) as unknown as typeof fetch;
646 yield* Effect.addFinalizer(() =>
647 Effect.sync(() => {
648 globalThis.fetch = originalFetch;
649 }),
650 );
651​
652 const layer = Layer.mergeAll(
653 Layer.succeed(ServerSecretStore.ServerSecretStore, secrets.store),
654 Layer.succeed(ServerEnvironment.ServerEnvironment, {
655 getEnvironmentId: Effect.succeed(environmentId),
656 getDescriptor: Effect.succeed(descriptor),
657 }),
658 Layer.succeed(OrchestrationEngineService, {
659 readEvents: () => Stream.empty,
660 dispatch: () => Effect.succeed({ sequence: 1 }),
661 streamDomainEvents: Stream.fromQueue(events),
662 } satisfies OrchestrationEngineShape),
663 Layer.succeed(ProjectionSnapshotQuery, {
664 getShellSnapshot: () =>
665 Effect.succeed({
666 snapshotSequence: 1,
667 projects: [project],
668 threads: [thread],
669 updatedAt: now,
670 } satisfies OrchestrationShellSnapshot),
671 getThreadShellById: () => Effect.succeed(Option.some(thread)),
672 getProjectShellById: () => Effect.succeed(Option.some(project)),
673 } as unknown as ProjectionSnapshotQueryShape),
674 );
675​
676 yield* Effect.gen(function* () {
677 const relay = yield* AgentAwarenessRelay.AgentAwarenessRelay;
678 yield* secrets.setString(RELAY_URL_SECRET, "https://transport.example.test");
679 yield* secrets.setString(RELAY_ISSUER_SECRET, "https://issuer.example.test");
680 yield* secrets.setString(RELAY_ENVIRONMENT_CREDENTIAL_SECRET, "relay-credential");
681 yield* secrets.setString(PUBLISH_AGENT_ACTIVITY_SECRET, "true");
682 yield* relay.start();
683 yield* Queue.offer(events, {
684 type: "thread.activity-appended",
685 sequence: 1,
686 eventId: "evt-1",
687 commandId: CommandId.make("cmd-1"),
688 aggregateKind: "thread",
689 aggregateId: threadId,
690 actor: { kind: "server" },
691 payload: {
692 threadId,
693 activity: {
694 kind: "approval.requested",
695 },
696 },
697 occurredAt: now,
698 } as unknown as OrchestrationEvent);
699​
700 const url = yield* Deferred.await(fetchSeen).pipe(Effect.timeout("2 seconds"));
701 expect(url.origin).toBe("https://transport.example.test");
702 expect(productSpans).toContain("makePublishProof");
703 expect(userSpans).not.toContain("makePublishProof");
704 }).pipe(
705 Effect.provide(
706 AgentAwarenessRelay.layer.pipe(
707 Layer.provide(layer),
708 Layer.provideMerge(NodeServices.layer),
709 ),
710 ),
711 Effect.provideService(RelayClientTracer, Option.some(collectingTracer(productSpans))),
712 Effect.withTracer(collectingTracer(userSpans)),
713 );
714 }),
715 ),
716 );
717});