Open History to see the last commit
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 };
98}
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 readThreadEvents: () => Stream.empty,
463 getThreadReplayStats: () => Effect.die("unused thread replay stats"),
464 dispatch: () => Effect.succeed({ sequence: 1 }),
465 streamDomainEvents: Stream.fromQueue(events),
466 subscribeDomainEvents: Effect.succeed(Stream.fromQueue(events)),
467 latestSequence: Effect.succeed(0),
468 } satisfies OrchestrationEngineShape;
469
470 const snapshotQuery = {
471 getShellSnapshot: () =>
472 Effect.succeed({
473 snapshotSequence: 1,
474 projects: [project],
475 threads: [thread],
476 updatedAt: now,
477 } satisfies OrchestrationShellSnapshot),
478 getThreadShellById: () =>
479 Deferred.succeed(threadShellRequested, undefined).pipe(
480 Effect.ignore,
481 Effect.as(Option.some(thread)),
482 ),
483 getProjectShellById: () => Effect.succeed(Option.some(project)),
484 } as unknown as ProjectionSnapshotQueryShape;
485
486 const descriptor = {
487 environmentId,
488 label: "Test Desktop",
489 platform: {
490 os: "darwin",
491 arch: "arm64",
492 },
493 serverVersion: "0.0.0-test",
494 capabilities: {
495 repositoryIdentity: true,
496 },
497 } satisfies ExecutionEnvironmentDescriptor;
498
499 const layer = Layer.mergeAll(
500 Layer.succeed(ServerSecretStore.ServerSecretStore, secrets.store),
501 Layer.succeed(ServerEnvironment.ServerEnvironment, {
502 getEnvironmentId: Effect.succeed(environmentId),
503 getDescriptor: Effect.succeed(descriptor),
504 }),
505 Layer.succeed(OrchestrationEngineService, orchestrationEngine),
506 Layer.succeed(ProjectionSnapshotQuery, snapshotQuery),
507 );
508
509 yield* Effect.gen(function* () {
510 const relay = yield* AgentAwarenessRelay.AgentAwarenessRelay;
511 yield* relay.start();
512 yield* secrets.setString(RELAY_URL_SECRET, "http://127.0.0.1:1");
513 yield* secrets.setString(RELAY_ENVIRONMENT_CREDENTIAL_SECRET, "relay-credential");
514 yield* secrets.setString(PUBLISH_AGENT_ACTIVITY_SECRET, "true");
515 yield* Queue.offer(events, {
516 type: "thread.activity-appended",
517 sequence: 1,
518 eventId: "evt-1",
519 commandId: CommandId.make("cmd-1"),
520 aggregateKind: "thread",
521 aggregateId: threadId,
522 actor: { kind: "server" },
523 payload: {
524 threadId,
525 activity: {
526 kind: "approval.requested",
527 },
528 },
529 occurredAt: now,
530 } as unknown as OrchestrationEvent);
531
532 yield* Deferred.await(threadShellRequested).pipe(Effect.timeout("2 seconds"));
533 }).pipe(
534 Effect.provide(
535 AgentAwarenessRelay.layer.pipe(
536 Layer.provide(layer),
537 Layer.provideMerge(NodeServices.layer),
538 ),
539 ),
540 );
541 }),
542 ),
543 );
544
545 it.effect("publishes agent activity to the relay transport URL, not the relay issuer", () =>
546 Effect.scoped(
547 Effect.gen(function* () {
548 const originalFetch = globalThis.fetch;
549 const events = yield* Queue.unbounded<OrchestrationEvent>();
550 let resolveFetchSeen: (url: URL) => void = () => {};
551 const fetchSeen = new Promise<URL>((resolve) => {
552 resolveFetchSeen = resolve;
553 });
554 const userSpans: Array<string> = [];
555 const productSpans: Array<string> = [];
556 const collectingTracer = (spans: Array<string>) =>
557 Tracer.make({
558 span: (options) => {
559 const span = new Tracer.NativeSpan(options);
560 const end = span.end.bind(span);
561 span.end = (endTime, exit) => {
562 end(endTime, exit);
563 spans.push(span.name);
564 };
565 return span;
566 },
567 });
568 const secrets = makeMemorySecretStore();
569 const now = "2026-05-25T00:00:00.000Z";
570 const projectId = "project-1" as ProjectId;
571 const threadId = "thread-1" as ThreadId;
572 const environmentId = "env-1" as EnvironmentId;
573
574 const project = {
575 id: projectId,
576 title: "T3 Code",
577 workspaceRoot: "/workspace",
578 repositoryIdentity: null,
579 defaultModelSelection: null,
580 scripts: [],
581 createdAt: now,
582 updatedAt: now,
583 } satisfies OrchestrationProjectShell;
584
585 const thread = {
586 id: threadId,
587 projectId,
588 title: "Run remote agent",
589 modelSelection: { instanceId: ProviderInstanceId.make("codex"), model: "gpt-5.4" },
590 runtimeMode: "full-access",
591 interactionMode: "default",
592 branch: null,
593 worktreePath: null,
594 latestTurn: {
595 turnId: "turn-1" as TurnId,
596 state: "running",
597 requestedAt: now,
598 startedAt: now,
599 completedAt: null,
600 assistantMessageId: null,
601 },
602 createdAt: now,
603 updatedAt: now,
604 archivedAt: null,
605 settledOverride: null,
606 settledAt: null,
607 session: {
608 threadId,
609 status: "running",
610 providerName: "Codex",
611 runtimeMode: "full-access",
612 activeTurnId: "turn-1" as TurnId,
613 lastError: null,
614 updatedAt: now,
615 },
616 latestUserMessageAt: now,
617 hasPendingApprovals: false,
618 hasPendingUserInput: false,
619 hasActionableProposedPlan: false,
620 } satisfies OrchestrationThreadShell;
621
622 const descriptor = {
623 environmentId,
624 label: "Test Desktop",
625 platform: {
626 os: "darwin",
627 arch: "arm64",
628 },
629 serverVersion: "0.0.0-test",
630 capabilities: {
631 repositoryIdentity: true,
632 },
633 } satisfies ExecutionEnvironmentDescriptor;
634
635 globalThis.fetch = ((input: Parameters<typeof fetch>[0]) => {
636 const url = new URL(
637 typeof input === "string" || input instanceof URL
638 ? input
639 : (input as unknown as { readonly url: string }).url,
640 );
641 resolveFetchSeen(url);
642 return Promise.resolve(Response.json({ ok: true, deliveries: [] }));
643 }) as unknown as typeof fetch;
644 yield* Effect.addFinalizer(() =>
645 Effect.sync(() => {
646 globalThis.fetch = originalFetch;
647 }),
648 );
649
650 const layer = Layer.mergeAll(
651 Layer.succeed(ServerSecretStore.ServerSecretStore, secrets.store),
652 Layer.succeed(ServerEnvironment.ServerEnvironment, {
653 getEnvironmentId: Effect.succeed(environmentId),
654 getDescriptor: Effect.succeed(descriptor),
655 }),
656 Layer.succeed(OrchestrationEngineService, {
657 readEvents: () => Stream.empty,
658 readThreadEvents: () => Stream.empty,
659 getThreadReplayStats: () => Effect.die("unused thread replay stats"),
660 dispatch: () => Effect.succeed({ sequence: 1 }),
661 streamDomainEvents: Stream.fromQueue(events),
662 subscribeDomainEvents: Effect.succeed(Stream.fromQueue(events)),
663 latestSequence: Effect.succeed(0),
664 } satisfies OrchestrationEngineShape),
665 Layer.succeed(ProjectionSnapshotQuery, {
666 getShellSnapshot: () =>
667 Effect.succeed({
668 snapshotSequence: 1,
669 projects: [project],
670 threads: [thread],
671 updatedAt: now,
672 } satisfies OrchestrationShellSnapshot),
673 getThreadShellById: () => Effect.succeed(Option.some(thread)),
674 getProjectShellById: () => Effect.succeed(Option.some(project)),
675 } as unknown as ProjectionSnapshotQueryShape),
676 );
677
678 yield* Effect.gen(function* () {
679 const relay = yield* AgentAwarenessRelay.AgentAwarenessRelay;
680 yield* secrets.setString(RELAY_URL_SECRET, "https://transport.example.test");
681 yield* secrets.setString(RELAY_ISSUER_SECRET, "https://issuer.example.test");
682 yield* secrets.setString(RELAY_ENVIRONMENT_CREDENTIAL_SECRET, "relay-credential");
683 yield* secrets.setString(PUBLISH_AGENT_ACTIVITY_SECRET, "true");
684 yield* relay.start();
685 yield* Queue.offer(events, {
686 type: "thread.activity-appended",
687 sequence: 1,
688 eventId: "evt-1",
689 commandId: CommandId.make("cmd-1"),
690 aggregateKind: "thread",
691 aggregateId: threadId,
692 actor: { kind: "server" },
693 payload: {
694 threadId,
695 activity: {
696 kind: "approval.requested",
697 },
698 },
699 occurredAt: now,
700 } as unknown as OrchestrationEvent);
701
702 const url = yield* Effect.promise(() => fetchSeen).pipe(Effect.timeout("2 seconds"));
703 expect(url.origin).toBe("https://transport.example.test");
704 expect(productSpans).toContain("makePublishProof");
705 expect(userSpans).not.toContain("makePublishProof");
706 }).pipe(
707 Effect.provide(
708 AgentAwarenessRelay.layer.pipe(
709 Layer.provide(layer),
710 Layer.provideMerge(NodeServices.layer),
711 ),
712 ),
713 Effect.provideService(RelayClientTracer, Option.some(collectingTracer(productSpans))),
714 Effect.withTracer(collectingTracer(userSpans)),
715 );
716 }),
717 ),
718 );
719});