MCPcopy Index your code
hub / github.com/callstack/agent-device / createTransport

Function createTransport

src/__tests__/client.test.ts:8–36  ·  view source on GitHub ↗
(
  handler: (req: Omit<DaemonRequest, 'token'>) => Promise<DaemonResponse> | DaemonResponse,
)

Source from the content-addressed store, hash-verified

6import { AppError } from '../kernel/errors.ts';
7
8function createTransport(
9 handler: (req: Omit<DaemonRequest, 'token'>) => Promise<DaemonResponse> | DaemonResponse,
10): {
11 calls: Array<Omit<DaemonRequest, 'token'>>;
12 config: AgentDeviceClientConfig;
13 transport: (req: Omit<DaemonRequest, 'token'>) => Promise<DaemonResponse>;
14} {
15 const calls: Array<Omit<DaemonRequest, 'token'>> = [];
16 const config: AgentDeviceClientConfig = {
17 session: 'qa',
18 cwd: '/tmp/agent-device',
19 debug: true,
20 daemonBaseUrl: 'http://daemon.example.test',
21 daemonAuthToken: 'secret',
22 daemonTransport: 'http',
23 tenant: 'acme',
24 sessionIsolation: 'tenant',
25 runId: 'run-123',
26 leaseId: 'lease-123',
27 };
28 return {
29 calls,
30 config,
31 transport: async (req) => {
32 calls.push(req);
33 return await handler(req);
34 },
35 };
36}
37
38test('apps.open resolves session device identifiers from open response', async () => {
39 const setup = createTransport(async (req) => {

Callers 1

client.test.tsFile · 0.85

Calls 1

pushMethod · 0.80

Tested by

no test coverage detected