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

AgentAwarenessRelay.test.ts

715 lines23.9 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 settledOverride: null,
309 settledAt: null,
310 session: null,
311 latestUserMessageAt: null,
312 hasPendingApprovals: false,
313 hasPendingUserInput: false,
314 hasActionableProposedPlan: false,
315 } satisfies Omit<OrchestrationThreadShell, "id">;
316​
317 expect(
318 AgentAwarenessRelay.resolveAgentAwarenessRelayActiveThreadIds({
319 environmentId,
320 projects: [
321 {
322 id: projectId,
323 title: "T3 Code",
324 },
325 ],
326 threads: [
327 {
328 ...baseThread,
329 id: activeThreadId,
330 latestTurn: {
331 turnId: "turn-1" as TurnId,
332 state: "running",
333 requestedAt: now,
334 startedAt: now,
335 completedAt: null,
336 assistantMessageId: null,
337 },
338 },
339 {
340 ...baseThread,
341 id: idleThreadId,
342 },
343 {
344 ...baseThread,
345 id: "thread-missing-project" as ThreadId,
346 projectId: "missing-project" as ProjectId,
347 latestTurn: {
348 turnId: "turn-2" as TurnId,
349 state: "running",
350 requestedAt: now,
351 startedAt: now,
352 completedAt: null,
353 assistantMessageId: null,
354 },
355 },
356 ],
357 }),
358 ).toEqual([activeThreadId]);
359 });
360​
361 it.effect("signs the activity publish JWT and rejects tampering", () =>
362 Effect.gen(function* () {
363 const keyPair = NodeCrypto.generateKeyPairSync("ed25519", {
364 privateKeyEncoding: { format: "pem", type: "pkcs8" },
365 publicKeyEncoding: { format: "pem", type: "spki" },
366 });
367 const payload = {
368 iss: "t3-env:env",
369 aud: "https://relay.example.test",
370 sub: "env",
371 jti: "nonce-1",
372 iat: 100,
373 exp: 200,
374 environmentId: state.environmentId,
375 threadId: state.threadId,
376 state,
377 } satisfies RelayAgentActivityPublishProofPayload;
378 const proof = yield* AgentAwarenessRelay.signRelayAgentActivityPublishProof({
379 privateKey: keyPair.privateKey,
380 payload,
381 });
382 const verify = (token: string) =>
383 verifyRelayJwt({
384 publicKey: keyPair.publicKey,
385 token,
386 typ: RELAY_ACTIVITY_PUBLISH_TYP,
387 issuer: "t3-env:env",
388 audience: "https://relay.example.test",
389 nowEpochSeconds: 150,
390 });
391​
392 expect(yield* verify(proof)).toMatchObject({ jti: "nonce-1", state });
393​
394 const [header, body, signature = ""] = proof.split(".");
395 const corruptedSignature = `${signature.startsWith("a") ? "b" : "a"}${signature.slice(1)}`;
396 const rejection = yield* Effect.flip(verify(`${header}.${body}.${corruptedSignature}`));
397 expect(rejection).toBeDefined();
398 }),
399 );
400​
401 it.effect("keeps the orchestration listener armed until relay config is installed", () =>
402 Effect.scoped(
403 Effect.gen(function* () {
404 const events = yield* Queue.unbounded<OrchestrationEvent>();
405 const threadShellRequested = yield* Deferred.make<void>();
406 const secrets = makeMemorySecretStore();
407 const now = "2026-05-25T00:00:00.000Z";
408 const projectId = "project-1" as ProjectId;
409 const threadId = "thread-1" as ThreadId;
410 const environmentId = "env-1" as EnvironmentId;
411​
412 const project = {
413 id: projectId,
414 title: "T3 Code",
415 workspaceRoot: "/workspace",
416 repositoryIdentity: null,
417 defaultModelSelection: null,
418 scripts: [],
419 createdAt: now,
420 updatedAt: now,
421 } satisfies OrchestrationProjectShell;
422​
423 const thread = {
424 id: threadId,
425 projectId,
426 title: "Run remote agent",
427 modelSelection: { instanceId: ProviderInstanceId.make("codex"), model: "gpt-5.4" },
428 runtimeMode: "full-access",
429 interactionMode: "default",
430 branch: null,
431 worktreePath: null,
432 latestTurn: {
433 turnId: "turn-1" as TurnId,
434 state: "running",
435 requestedAt: now,
436 startedAt: now,
437 completedAt: null,
438 assistantMessageId: null,
439 },
440 createdAt: now,
441 updatedAt: now,
442 archivedAt: null,
443 settledOverride: null,
444 settledAt: null,
445 session: {
446 threadId,
447 status: "running",
448 providerName: "Codex",
449 runtimeMode: "full-access",
450 activeTurnId: "turn-1" as TurnId,
451 lastError: null,
452 updatedAt: now,
453 },
454 latestUserMessageAt: now,
455 hasPendingApprovals: false,
456 hasPendingUserInput: false,
457 hasActionableProposedPlan: false,
458 } satisfies OrchestrationThreadShell;
459​
460 const orchestrationEngine = {
461 readEvents: () => Stream.empty,
462 dispatch: () => Effect.succeed({ sequence: 1 }),
463 streamDomainEvents: Stream.fromQueue(events),
464 subscribeDomainEvents: Effect.succeed(Stream.fromQueue(events)),
465 latestSequence: Effect.succeed(0),
466 } satisfies OrchestrationEngineShape;
467​
468 const snapshotQuery = {
469 getShellSnapshot: () =>
470 Effect.succeed({
471 snapshotSequence: 1,
472 projects: [project],
473 threads: [thread],
474 updatedAt: now,
475 } satisfies OrchestrationShellSnapshot),
476 getThreadShellById: () =>
477 Deferred.succeed(threadShellRequested, undefined).pipe(
478 Effect.ignore,
479 Effect.as(Option.some(thread)),
480 ),
481 getProjectShellById: () => Effect.succeed(Option.some(project)),
482 } as unknown as ProjectionSnapshotQueryShape;
483​
484 const descriptor = {
485 environmentId,
486 label: "Test Desktop",
487 platform: {
488 os: "darwin",
489 arch: "arm64",
490 },
491 serverVersion: "0.0.0-test",
492 capabilities: {
493 repositoryIdentity: true,
494 },
495 } satisfies ExecutionEnvironmentDescriptor;
496​
497 const layer = Layer.mergeAll(
498 Layer.succeed(ServerSecretStore.ServerSecretStore, secrets.store),
499 Layer.succeed(ServerEnvironment.ServerEnvironment, {
500 getEnvironmentId: Effect.succeed(environmentId),
501 getDescriptor: Effect.succeed(descriptor),
502 }),
503 Layer.succeed(OrchestrationEngineService, orchestrationEngine),
504 Layer.succeed(ProjectionSnapshotQuery, snapshotQuery),
505 );
506​
507 yield* Effect.gen(function* () {
508 const relay = yield* AgentAwarenessRelay.AgentAwarenessRelay;
509 yield* relay.start();
510 yield* secrets.setString(RELAY_URL_SECRET, "http://127.0.0.1:1");
511 yield* secrets.setString(RELAY_ENVIRONMENT_CREDENTIAL_SECRET, "relay-credential");
512 yield* secrets.setString(PUBLISH_AGENT_ACTIVITY_SECRET, "true");
513 yield* Queue.offer(events, {
514 type: "thread.activity-appended",
515 sequence: 1,
516 eventId: "evt-1",
517 commandId: CommandId.make("cmd-1"),
518 aggregateKind: "thread",
519 aggregateId: threadId,
520 actor: { kind: "server" },
521 payload: {
522 threadId,
523 activity: {
524 kind: "approval.requested",
525 },
526 },
527 occurredAt: now,
528 } as unknown as OrchestrationEvent);
529​
530 yield* Deferred.await(threadShellRequested).pipe(Effect.timeout("2 seconds"));
531 }).pipe(
532 Effect.provide(
533 AgentAwarenessRelay.layer.pipe(
534 Layer.provide(layer),
535 Layer.provideMerge(NodeServices.layer),
536 ),
537 ),
538 );
539 }),
540 ),
541 );
542​
543 it.effect("publishes agent activity to the relay transport URL, not the relay issuer", () =>
544 Effect.scoped(
545 Effect.gen(function* () {
546 const originalFetch = globalThis.fetch;
547 const events = yield* Queue.unbounded<OrchestrationEvent>();
548 let resolveFetchSeen: (url: URL) => void = () => {};
549 const fetchSeen = new Promise<URL>((resolve) => {
550 resolveFetchSeen = resolve;
551 });
552 const userSpans: Array<string> = [];
553 const productSpans: Array<string> = [];
554 const collectingTracer = (spans: Array<string>) =>
555 Tracer.make({
556 span: (options) => {
557 const span = new Tracer.NativeSpan(options);
558 const end = span.end.bind(span);
559 span.end = (endTime, exit) => {
560 end(endTime, exit);
561 spans.push(span.name);
562 };
563 return span;
564 },
565 });
566 const secrets = makeMemorySecretStore();
567 const now = "2026-05-25T00:00:00.000Z";
568 const projectId = "project-1" as ProjectId;
569 const threadId = "thread-1" as ThreadId;
570 const environmentId = "env-1" as EnvironmentId;
571​
572 const project = {
573 id: projectId,
574 title: "T3 Code",
575 workspaceRoot: "/workspace",
576 repositoryIdentity: null,
577 defaultModelSelection: null,
578 scripts: [],
579 createdAt: now,
580 updatedAt: now,
581 } satisfies OrchestrationProjectShell;
582​
583 const thread = {
584 id: threadId,
585 projectId,
586 title: "Run remote agent",
587 modelSelection: { instanceId: ProviderInstanceId.make("codex"), model: "gpt-5.4" },
588 runtimeMode: "full-access",
589 interactionMode: "default",
590 branch: null,
591 worktreePath: null,
592 latestTurn: {
593 turnId: "turn-1" as TurnId,
594 state: "running",
595 requestedAt: now,
596 startedAt: now,
597 completedAt: null,
598 assistantMessageId: null,
599 },
600 createdAt: now,
601 updatedAt: now,
602 archivedAt: null,
603 settledOverride: null,
604 settledAt: null,
605 session: {
606 threadId,
607 status: "running",
608 providerName: "Codex",
609 runtimeMode: "full-access",
610 activeTurnId: "turn-1" as TurnId,
611 lastError: null,
612 updatedAt: now,
613 },
614 latestUserMessageAt: now,
615 hasPendingApprovals: false,
616 hasPendingUserInput: false,
617 hasActionableProposedPlan: false,
618 } satisfies OrchestrationThreadShell;
619​
620 const descriptor = {
621 environmentId,
622 label: "Test Desktop",
623 platform: {
624 os: "darwin",
625 arch: "arm64",
626 },
627 serverVersion: "0.0.0-test",
628 capabilities: {
629 repositoryIdentity: true,
630 },
631 } satisfies ExecutionEnvironmentDescriptor;
632​
633 globalThis.fetch = ((input: Parameters<typeof fetch>[0]) => {
634 const url = new URL(
635 typeof input === "string" || input instanceof URL
636 ? input
637 : (input as unknown as { readonly url: string }).url,
638 );
639 resolveFetchSeen(url);
640 return Promise.resolve(Response.json({ ok: true, deliveries: [] }));
641 }) as unknown as typeof fetch;
642 yield* Effect.addFinalizer(() =>
643 Effect.sync(() => {
644 globalThis.fetch = originalFetch;
645 }),
646 );
647​
648 const layer = Layer.mergeAll(
649 Layer.succeed(ServerSecretStore.ServerSecretStore, secrets.store),
650 Layer.succeed(ServerEnvironment.ServerEnvironment, {
651 getEnvironmentId: Effect.succeed(environmentId),
652 getDescriptor: Effect.succeed(descriptor),
653 }),
654 Layer.succeed(OrchestrationEngineService, {
655 readEvents: () => Stream.empty,
656 dispatch: () => Effect.succeed({ sequence: 1 }),
657 streamDomainEvents: Stream.fromQueue(events),
658 subscribeDomainEvents: Effect.succeed(Stream.fromQueue(events)),
659 latestSequence: Effect.succeed(0),
660 } satisfies OrchestrationEngineShape),
661 Layer.succeed(ProjectionSnapshotQuery, {
662 getShellSnapshot: () =>
663 Effect.succeed({
664 snapshotSequence: 1,
665 projects: [project],
666 threads: [thread],
667 updatedAt: now,
668 } satisfies OrchestrationShellSnapshot),
669 getThreadShellById: () => Effect.succeed(Option.some(thread)),
670 getProjectShellById: () => Effect.succeed(Option.some(project)),
671 } as unknown as ProjectionSnapshotQueryShape),
672 );
673​
674 yield* Effect.gen(function* () {
675 const relay = yield* AgentAwarenessRelay.AgentAwarenessRelay;
676 yield* secrets.setString(RELAY_URL_SECRET, "https://transport.example.test");
677 yield* secrets.setString(RELAY_ISSUER_SECRET, "https://issuer.example.test");
678 yield* secrets.setString(RELAY_ENVIRONMENT_CREDENTIAL_SECRET, "relay-credential");
679 yield* secrets.setString(PUBLISH_AGENT_ACTIVITY_SECRET, "true");
680 yield* relay.start();
681 yield* Queue.offer(events, {
682 type: "thread.activity-appended",
683 sequence: 1,
684 eventId: "evt-1",
685 commandId: CommandId.make("cmd-1"),
686 aggregateKind: "thread",
687 aggregateId: threadId,
688 actor: { kind: "server" },
689 payload: {
690 threadId,
691 activity: {
692 kind: "approval.requested",
693 },
694 },
695 occurredAt: now,
696 } as unknown as OrchestrationEvent);
697​
698 const url = yield* Effect.promise(() => fetchSeen).pipe(Effect.timeout("2 seconds"));
699 expect(url.origin).toBe("https://transport.example.test");
700 expect(productSpans).toContain("makePublishProof");
701 expect(userSpans).not.toContain("makePublishProof");
702 }).pipe(
703 Effect.provide(
704 AgentAwarenessRelay.layer.pipe(
705 Layer.provide(layer),
706 Layer.provideMerge(NodeServices.layer),
707 ),
708 ),
709 Effect.provideService(RelayClientTracer, Option.some(collectingTracer(productSpans))),
710 Effect.withTracer(collectingTracer(userSpans)),
711 );
712 }),
713 ),
714 );
715});