@heddleagent/execution-host-client 6.2.0 → 6.4.0
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/README.md +75 -20
- package/dist/authority/index.d.ts +1 -1
- package/dist/authority/index.d.ts.map +1 -1
- package/dist/authority/index.js.map +1 -1
- package/dist/authority/types.d.ts +3 -1
- package/dist/authority/types.d.ts.map +1 -1
- package/dist/authority/types.js.map +1 -1
- package/dist/conversation/types.d.ts +2 -2
- package/dist/conversation/types.d.ts.map +1 -1
- package/dist/conversation/types.js.map +1 -1
- package/dist/coordinator/contracts.d.ts +130 -0
- package/dist/coordinator/contracts.d.ts.map +1 -0
- package/dist/coordinator/contracts.js +112 -0
- package/dist/coordinator/contracts.js.map +1 -0
- package/dist/coordinator/hosted-heartbeat-coordinator-client.d.ts +20 -0
- package/dist/coordinator/hosted-heartbeat-coordinator-client.d.ts.map +1 -0
- package/dist/coordinator/hosted-heartbeat-coordinator-client.js +77 -0
- package/dist/coordinator/hosted-heartbeat-coordinator-client.js.map +1 -0
- package/dist/coordinator/hosted-heartbeat-delegation-client.d.ts +21 -0
- package/dist/coordinator/hosted-heartbeat-delegation-client.d.ts.map +1 -0
- package/dist/coordinator/hosted-heartbeat-delegation-client.js +117 -0
- package/dist/coordinator/hosted-heartbeat-delegation-client.js.map +1 -0
- package/dist/coordinator/hosted-heartbeat-delegation-service.d.ts +15 -0
- package/dist/coordinator/hosted-heartbeat-delegation-service.d.ts.map +1 -0
- package/dist/coordinator/hosted-heartbeat-delegation-service.js +81 -0
- package/dist/coordinator/hosted-heartbeat-delegation-service.js.map +1 -0
- package/dist/coordinator/hosted-heartbeat-task-reconciler.d.ts +11 -0
- package/dist/coordinator/hosted-heartbeat-task-reconciler.d.ts.map +1 -0
- package/dist/coordinator/hosted-heartbeat-task-reconciler.js +38 -0
- package/dist/coordinator/hosted-heartbeat-task-reconciler.js.map +1 -0
- package/dist/coordinator/index.d.ts +9 -0
- package/dist/coordinator/index.d.ts.map +1 -0
- package/dist/coordinator/index.js +7 -0
- package/dist/coordinator/index.js.map +1 -0
- package/dist/coordinator/node/delegation-http-service.d.ts +11 -0
- package/dist/coordinator/node/delegation-http-service.d.ts.map +1 -0
- package/dist/coordinator/node/delegation-http-service.js +131 -0
- package/dist/coordinator/node/delegation-http-service.js.map +1 -0
- package/dist/coordinator/node/environment.d.ts +3 -0
- package/dist/coordinator/node/environment.d.ts.map +1 -0
- package/dist/coordinator/node/environment.js +13 -0
- package/dist/coordinator/node/environment.js.map +1 -0
- package/dist/coordinator/node/index.d.ts +4 -0
- package/dist/coordinator/node/index.d.ts.map +1 -0
- package/dist/coordinator/node/index.js +3 -0
- package/dist/coordinator/node/index.js.map +1 -0
- package/dist/coordinator/node/types.d.ts +20 -0
- package/dist/coordinator/node/types.d.ts.map +1 -0
- package/dist/coordinator/node/types.js +2 -0
- package/dist/coordinator/node/types.js.map +1 -0
- package/dist/coordinator/runtime-session.d.ts +13 -0
- package/dist/coordinator/runtime-session.d.ts.map +1 -0
- package/dist/coordinator/runtime-session.js +23 -0
- package/dist/coordinator/runtime-session.js.map +1 -0
- package/dist/coordinator/service-token.d.ts +3 -0
- package/dist/coordinator/service-token.d.ts.map +1 -0
- package/dist/coordinator/service-token.js +7 -0
- package/dist/coordinator/service-token.js.map +1 -0
- package/dist/coordinator/types.d.ts +63 -0
- package/dist/coordinator/types.d.ts.map +1 -0
- package/dist/coordinator/types.js +2 -0
- package/dist/coordinator/types.js.map +1 -0
- package/dist/heartbeat/types.d.ts +2 -2
- package/dist/heartbeat/types.d.ts.map +1 -1
- package/dist/heartbeat/types.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/node/http-service.d.ts.map +1 -1
- package/dist/node/http-service.js +5 -108
- package/dist/node/http-service.js.map +1 -1
- package/dist/node/http-utils.d.ts +15 -0
- package/dist/node/http-utils.d.ts.map +1 -0
- package/dist/node/http-utils.js +109 -0
- package/dist/node/http-utils.js.map +1 -0
- package/package.json +9 -1
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ products that invoke a separately deployed Heddle Execution Host. It lets an
|
|
|
5
5
|
adopter keep its own language stack, authentication, database, product policy,
|
|
6
6
|
MCP tools, and UI while reusing the security-sensitive v1 contract machinery.
|
|
7
7
|
|
|
8
|
-
> **Current availability:** stable version `6.
|
|
8
|
+
> **Current availability:** stable version `6.4.0`. The former
|
|
9
9
|
> `@roackb2/heddle-adopter@5.13.0` coordinate is deprecated and remains
|
|
10
10
|
> installable only for existing consumers. Heddle does not currently distribute
|
|
11
11
|
> the compatible Execution Host implementation or offer a hosted service. The
|
|
@@ -31,6 +31,8 @@ modular AWS SDK for its AgentCore transport and the official MCP SDK, plus
|
|
|
31
31
|
| `@heddleagent/execution-host-client/authority` | ES256 execution assertion and optional MCP capability issuance plus public JWKS projection |
|
|
32
32
|
| `@heddleagent/execution-host-client/conversation` | Turn orchestration across authority, model credentials, optional MCP policy, an `ExecutionHost`, and an optional adopter-implemented durable lifecycle store |
|
|
33
33
|
| `@heddleagent/execution-host-client/heartbeat` | Remote heartbeat orchestration that keeps durable task authority in a coordinator while a compatible Execution Host runs the agent cycle |
|
|
34
|
+
| `@heddleagent/execution-host-client/coordinator` | Authenticated task publication, pause-first desired-state reconciliation, product delegation, and delegated heartbeat execution |
|
|
35
|
+
| `@heddleagent/execution-host-client/coordinator/node` | Standard authenticated Node HTTP edge for product-owned heartbeat authorization |
|
|
34
36
|
| `@heddleagent/execution-host-client/mcp` | Independent capability verification at the adopter's MCP edge |
|
|
35
37
|
| `@heddleagent/execution-host-client/mcp/node` | Stateless official-SDK Streamable HTTP lifecycle around adopter-defined toolsets |
|
|
36
38
|
| `@heddleagent/execution-host-client/http-sse` | Transport-neutral conversation and heartbeat ports plus the strict direct-development HTTP/SSE client |
|
|
@@ -279,30 +281,81 @@ The client refuses redirects, bounds parser and error bodies, validates ordered
|
|
|
279
281
|
SSE identity, streams accepted/activity events incrementally, and withholds the
|
|
280
282
|
terminal event until clean EOF. It never retries an ambiguous invocation.
|
|
281
283
|
|
|
282
|
-
##
|
|
284
|
+
## Connect a product to the heartbeat coordinator
|
|
285
|
+
|
|
286
|
+
The product publishes only its desired task state and authorizes individual
|
|
287
|
+
runs. Heddle owns the coordinator protocol, safe reconciliation order, Runtime
|
|
288
|
+
session derivation, short-lived authority bundle, and execution composition.
|
|
289
|
+
|
|
290
|
+
```ts
|
|
291
|
+
import {
|
|
292
|
+
HostedHeartbeatCoordinatorClient,
|
|
293
|
+
HostedHeartbeatDelegationService,
|
|
294
|
+
HostedHeartbeatTaskReconciler,
|
|
295
|
+
} from '@heddleagent/execution-host-client/coordinator'
|
|
296
|
+
import {
|
|
297
|
+
NodeHostedHeartbeatDelegationHttpService,
|
|
298
|
+
} from '@heddleagent/execution-host-client/coordinator/node'
|
|
299
|
+
|
|
300
|
+
const coordinator = new HostedHeartbeatCoordinatorClient({
|
|
301
|
+
baseUrl: coordinatorUrl,
|
|
302
|
+
apiToken: coordinatorApiToken,
|
|
303
|
+
})
|
|
304
|
+
await new HostedHeartbeatTaskReconciler({ coordinator }).reconcile({
|
|
305
|
+
desiredTasks: await projectDesiredHeartbeatTasks(),
|
|
306
|
+
resume: backgroundChecksEnabled,
|
|
307
|
+
})
|
|
308
|
+
|
|
309
|
+
const delegations = new HostedHeartbeatDelegationService({
|
|
310
|
+
authority,
|
|
311
|
+
runtimeSessionNamespace: 'example-product',
|
|
312
|
+
maxExecutionMs: 300_000,
|
|
313
|
+
authorizer: {
|
|
314
|
+
authorize: ({ taskId, signal }) =>
|
|
315
|
+
authorizeProductHeartbeat({ taskId, signal }),
|
|
316
|
+
},
|
|
317
|
+
})
|
|
318
|
+
const delegationHttp = new NodeHostedHeartbeatDelegationHttpService({
|
|
319
|
+
delegations,
|
|
320
|
+
apiToken: coordinatorDelegationToken,
|
|
321
|
+
})
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
`projectDesiredHeartbeatTasks` remains product-owned because it translates
|
|
325
|
+
product records into desired Heddle tasks. `authorizeProductHeartbeat` remains
|
|
326
|
+
product-owned because it decides whether the task may run and returns only the
|
|
327
|
+
authorized tenant/subject/product-session scope and exact MCP tool set. Product
|
|
328
|
+
code does not construct coordinator requests, Runtime-session IDs, deadlines,
|
|
329
|
+
JWTs, or delegation response objects.
|
|
330
|
+
|
|
331
|
+
The Node handler can be mounted before an existing router through
|
|
332
|
+
`delegationHttp.handle(request, response)`. See the
|
|
333
|
+
[coordinator boundary](src/coordinator/README.md) for the corresponding
|
|
334
|
+
coordinator-side client and execution transport.
|
|
335
|
+
|
|
336
|
+
## Compose the coordinator execution transport
|
|
283
337
|
|
|
284
338
|
For autonomous work, keep the durable task store and scheduler in one
|
|
285
339
|
long-running coordinator. Inject the hosted transport only at the point where
|
|
286
|
-
the scheduler would otherwise run the local heartbeat agent
|
|
340
|
+
the scheduler would otherwise run the local heartbeat agent. The coordinator
|
|
341
|
+
uses the product delegation endpoint rather than receiving product signing
|
|
342
|
+
keys or reimplementing its authority shape:
|
|
287
343
|
|
|
288
344
|
```ts
|
|
289
345
|
import { HeartbeatSchedulerService } from '@heddleagent/runtime/advanced'
|
|
290
346
|
import {
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
} from '@heddleagent/execution-host-client/
|
|
347
|
+
HostedHeartbeatDelegatedExecutionTransport,
|
|
348
|
+
HostedHeartbeatDelegationClient,
|
|
349
|
+
} from '@heddleagent/execution-host-client/coordinator'
|
|
294
350
|
|
|
295
|
-
const
|
|
296
|
-
|
|
351
|
+
const delegations = new HostedHeartbeatDelegationClient({
|
|
352
|
+
baseUrl: productBackendUrl,
|
|
353
|
+
apiToken: productDelegationToken,
|
|
354
|
+
})
|
|
355
|
+
const agentExecutionTransport = new HostedHeartbeatDelegatedExecutionTransport({
|
|
356
|
+
delegations,
|
|
297
357
|
executionHost: agentCoreExecutionHost,
|
|
298
358
|
modelCredentials,
|
|
299
|
-
mcp: { allowedTools: ['read_workspace_snapshot'] },
|
|
300
|
-
})
|
|
301
|
-
const agentExecutionTransport = new HostedHeartbeatAgentExecutionTransport({
|
|
302
|
-
runner: hostedHeartbeat,
|
|
303
|
-
resolveInvocationContext: ({ taskId, executionId, signal }) => (
|
|
304
|
-
resolveAuthorizedHeartbeatInvocation({ taskId, executionId, signal })
|
|
305
|
-
),
|
|
306
359
|
})
|
|
307
360
|
|
|
308
361
|
const scheduler = HeartbeatSchedulerService.start({
|
|
@@ -311,11 +364,13 @@ const scheduler = HeartbeatSchedulerService.start({
|
|
|
311
364
|
})
|
|
312
365
|
```
|
|
313
366
|
|
|
314
|
-
The coordinator still owns task lookup, claims, checkpoint loading,
|
|
315
|
-
claim-fenced settlement, history, and recovery. The Runtime
|
|
316
|
-
task/checkpoint request plus invocation-scoped authority and
|
|
317
|
-
it receives no Heddle database credential. Omitting
|
|
318
|
-
preserves the existing in-process runner.
|
|
367
|
+
The coordinator still owns task lookup, claims, checkpoint loading,
|
|
368
|
+
cancellation, claim-fenced settlement, history, and recovery. The Runtime
|
|
369
|
+
receives a bounded task/checkpoint request plus invocation-scoped authority and
|
|
370
|
+
model credentials; it receives no Heddle database credential. Omitting
|
|
371
|
+
`agentExecutionTransport` preserves the existing in-process runner. The lower
|
|
372
|
+
level `/heartbeat` composition remains available for deployments whose
|
|
373
|
+
coordinator and product authority live in the same process.
|
|
319
374
|
|
|
320
375
|
## Verify an adopter integration locally
|
|
321
376
|
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { JoseExecutionAuthority } from './jose-execution-authority.js';
|
|
2
|
-
export type { ExecutionAuthority, ExecutionAuthorityConfig, ExecutionAuthorityIssueInput, ExecutionAuthorityKeyPair, ExecutionAuthorityMcpConfig, IssuedExecutionAuthority, IssuedExecutionAuthorityMetadata, IssuedMcpCapabilityMetadata, JoseExecutionAuthorityOptions, } from './types.js';
|
|
2
|
+
export type { ExecutionAuthority, ExecutionAuthorityConfig, ExecutionAuthorityIssuer, ExecutionAuthorityIssueInput, ExecutionAuthorityKeyPair, ExecutionAuthorityMcpConfig, IssuedExecutionAuthority, IssuedExecutionAuthorityMetadata, IssuedMcpCapabilityMetadata, JoseExecutionAuthorityOptions, } from './types.js';
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/authority/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,YAAY,EACV,kBAAkB,EAClB,wBAAwB,EACxB,4BAA4B,EAC5B,yBAAyB,EACzB,2BAA2B,EAC3B,wBAAwB,EACxB,gCAAgC,EAChC,2BAA2B,EAC3B,6BAA6B,GAC9B,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/authority/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,YAAY,EACV,kBAAkB,EAClB,wBAAwB,EACxB,wBAAwB,EACxB,4BAA4B,EAC5B,yBAAyB,EACzB,2BAA2B,EAC3B,wBAAwB,EACxB,gCAAgC,EAChC,2BAA2B,EAC3B,6BAA6B,GAC9B,MAAM,YAAY,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/authority/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC","sourcesContent":["export { JoseExecutionAuthority } from './jose-execution-authority.js';\nexport type {\n ExecutionAuthority,\n ExecutionAuthorityConfig,\n ExecutionAuthorityIssueInput,\n ExecutionAuthorityKeyPair,\n ExecutionAuthorityMcpConfig,\n IssuedExecutionAuthority,\n IssuedExecutionAuthorityMetadata,\n IssuedMcpCapabilityMetadata,\n JoseExecutionAuthorityOptions,\n} from './types.js';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/authority/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC","sourcesContent":["export { JoseExecutionAuthority } from './jose-execution-authority.js';\nexport type {\n ExecutionAuthority,\n ExecutionAuthorityConfig,\n ExecutionAuthorityIssuer,\n ExecutionAuthorityIssueInput,\n ExecutionAuthorityKeyPair,\n ExecutionAuthorityMcpConfig,\n IssuedExecutionAuthority,\n IssuedExecutionAuthorityMetadata,\n IssuedMcpCapabilityMetadata,\n JoseExecutionAuthorityOptions,\n} from './types.js';\n"]}
|
|
@@ -48,8 +48,10 @@ export interface IssuedExecutionAuthority {
|
|
|
48
48
|
mcpCapability(): string | undefined;
|
|
49
49
|
toJSON(): IssuedExecutionAuthorityMetadata;
|
|
50
50
|
}
|
|
51
|
-
export interface
|
|
51
|
+
export interface ExecutionAuthorityIssuer {
|
|
52
52
|
issue(input: ExecutionAuthorityIssueInput): Promise<IssuedExecutionAuthority>;
|
|
53
|
+
}
|
|
54
|
+
export interface ExecutionAuthority extends ExecutionAuthorityIssuer {
|
|
53
55
|
publicJwks(): JSONWebKeySet;
|
|
54
56
|
}
|
|
55
57
|
export type ExecutionAuthorityKeyPair = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/authority/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,MAAM,CAAC;AACrD,OAAO,KAAK,EACV,cAAc,EACd,uBAAuB,EACxB,MAAM,uBAAuB,CAAC;AAE/B,MAAM,MAAM,2BAA2B,GAAG;IACxC,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,MAAM,EAAE,MAAM,CAAC;I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ACH,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,QAAQ,EAAE,gCAAgC,CAAC;IACpD,kBAAkB,IAAI,MAAM,CAAC;IAC7B,aAAa,IAAI,MAAM,GAAG,SAAS,CAAC;IACpC,MAAM,IAAI,gCAAgC,CAAC;CAC5C;AAED,MAAM,WAAW,wBAAwB;IACvC,KAAK,CAAC,KAAK,EAAE,4BAA4B,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAAC;CAC/E;AAED,MAAM,WAAW,kBAAmB,SAAQ,wBAAwB;IAClE,UAAU,IAAI,aAAa,CAAC;CAC7B;AAED,MAAM,MAAM,yBAAyB,GAAG;IACtC,UAAU,EAAE,SAAS,CAAC;IACtB,SAAS,EAAE,SAAS,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG;IAC1C,GAAG,CAAC,EAAE,MAAM,IAAI,CAAC;IACjB,kBAAkB,CAAC,EAAE,MAAM,MAAM,CAAC;CACnC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/authority/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { CryptoKey, JSONWebKeySet } from 'jose';\nimport type {\n ExecutionScope,\n HostedExecutionWorkflow,\n} from '../contracts/index.js';\n\nexport type ExecutionAuthorityMcpConfig = {\n audience: string;\n serverId: string;\n ttlSeconds: number;\n};\n\nexport type ExecutionAuthorityConfig = {\n issuer: string;\n adopterId: string;\n executionAudience: string;\n keyId: string;\n executionTtlSeconds: number;\n mcp?: ExecutionAuthorityMcpConfig;\n};\n\nexport type ExecutionAuthorityIssueInput = {\n scope: Omit<ExecutionScope, 'adopterId'>;\n runtimeSessionId: string;\n invocationId: string;\n workflow: HostedExecutionWorkflow;\n mcp?: {\n allowedTools: readonly string[];\n };\n};\n\nexport type IssuedMcpCapabilityMetadata = {\n capabilityId: string;\n serverId: string;\n allowedTools: readonly string[];\n expiresAt: string;\n};\n\nexport type IssuedExecutionAuthorityMetadata = {\n scope: ExecutionScope;\n runtimeSessionId: string;\n invocationId: string;\n workflow: HostedExecutionWorkflow;\n issuedAt: string;\n executionExpiresAt: string;\n mcp?: IssuedMcpCapabilityMetadata;\n};\n\n/**\n * Short-lived credentials are available only through explicit accessors.\n * JSON serialization contains credential-free metadata. Identifiers can still\n * be product data and remain subject to the adopter's logging policy.\n */\nexport interface IssuedExecutionAuthority {\n readonly metadata: IssuedExecutionAuthorityMetadata;\n executionAssertion(): string;\n mcpCapability(): string | undefined;\n toJSON(): IssuedExecutionAuthorityMetadata;\n}\n\nexport interface
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/authority/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { CryptoKey, JSONWebKeySet } from 'jose';\nimport type {\n ExecutionScope,\n HostedExecutionWorkflow,\n} from '../contracts/index.js';\n\nexport type ExecutionAuthorityMcpConfig = {\n audience: string;\n serverId: string;\n ttlSeconds: number;\n};\n\nexport type ExecutionAuthorityConfig = {\n issuer: string;\n adopterId: string;\n executionAudience: string;\n keyId: string;\n executionTtlSeconds: number;\n mcp?: ExecutionAuthorityMcpConfig;\n};\n\nexport type ExecutionAuthorityIssueInput = {\n scope: Omit<ExecutionScope, 'adopterId'>;\n runtimeSessionId: string;\n invocationId: string;\n workflow: HostedExecutionWorkflow;\n mcp?: {\n allowedTools: readonly string[];\n };\n};\n\nexport type IssuedMcpCapabilityMetadata = {\n capabilityId: string;\n serverId: string;\n allowedTools: readonly string[];\n expiresAt: string;\n};\n\nexport type IssuedExecutionAuthorityMetadata = {\n scope: ExecutionScope;\n runtimeSessionId: string;\n invocationId: string;\n workflow: HostedExecutionWorkflow;\n issuedAt: string;\n executionExpiresAt: string;\n mcp?: IssuedMcpCapabilityMetadata;\n};\n\n/**\n * Short-lived credentials are available only through explicit accessors.\n * JSON serialization contains credential-free metadata. Identifiers can still\n * be product data and remain subject to the adopter's logging policy.\n */\nexport interface IssuedExecutionAuthority {\n readonly metadata: IssuedExecutionAuthorityMetadata;\n executionAssertion(): string;\n mcpCapability(): string | undefined;\n toJSON(): IssuedExecutionAuthorityMetadata;\n}\n\nexport interface ExecutionAuthorityIssuer {\n issue(input: ExecutionAuthorityIssueInput): Promise<IssuedExecutionAuthority>;\n}\n\nexport interface ExecutionAuthority extends ExecutionAuthorityIssuer {\n publicJwks(): JSONWebKeySet;\n}\n\nexport type ExecutionAuthorityKeyPair = {\n privateKey: CryptoKey;\n publicKey: CryptoKey;\n};\n\nexport type JoseExecutionAuthorityOptions = {\n now?: () => Date;\n createCapabilityId?: () => string;\n};\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { type ExecutionHostStreamEvent } from '../contracts/index.js';
|
|
3
|
-
import type {
|
|
3
|
+
import type { ExecutionAuthorityIssuer } from '../authority/index.js';
|
|
4
4
|
import type { ExecutionHost } from '../http-sse/index.js';
|
|
5
5
|
export declare const HostedConversationTurnInputSchema: z.ZodObject<{
|
|
6
6
|
scope: z.ZodObject<{
|
|
@@ -26,7 +26,7 @@ export interface HostedConversationTurnRunner {
|
|
|
26
26
|
streamTurn(input: HostedConversationTurnInput): AsyncIterable<ExecutionHostStreamEvent>;
|
|
27
27
|
}
|
|
28
28
|
export type HostedConversationTurnServiceConfig = {
|
|
29
|
-
authority:
|
|
29
|
+
authority: ExecutionAuthorityIssuer;
|
|
30
30
|
executionHost: ExecutionHost;
|
|
31
31
|
modelCredentials: HostedModelCredentialProvider;
|
|
32
32
|
/** Omit this policy when the hosted workflow needs no product MCP tools. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/conversation/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAIL,KAAK,wBAAwB,EAC9B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/conversation/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAIL,KAAK,wBAAwB,EAC9B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D,eAAO,MAAM,iCAAiC;;;;;;;;;;;kBAUnC,CAAC;AAEZ,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAC/C,OAAO,iCAAiC,CACzC,CAAC;AAEF,MAAM,MAAM,mCAAmC,GAAG,IAAI,CACpD,2BAA2B,EAC3B,OAAO,GAAG,cAAc,GAAG,QAAQ,CACpC,CAAC;AAEF,4EAA4E;AAC5E,MAAM,WAAW,6BAA6B;IAC5C,kBAAkB,CAChB,OAAO,EAAE,mCAAmC,GAC3C,OAAO,CAAC,MAAM,CAAC,CAAC;CACpB;AAED,uDAAuD;AACvD,MAAM,MAAM,yCAAyC,GACnD,6BAA6B,CAAC;AAEhC,MAAM,WAAW,4BAA4B;IAC3C,UAAU,CACR,KAAK,EAAE,2BAA2B,GACjC,aAAa,CAAC,wBAAwB,CAAC,CAAC;CAC5C;AAED,MAAM,MAAM,mCAAmC,GAAG;IAChD,SAAS,EAAE,wBAAwB,CAAC;IACpC,aAAa,EAAE,aAAa,CAAC;IAC7B,gBAAgB,EAAE,6BAA6B,CAAC;IAChD,4EAA4E;IAC5E,GAAG,CAAC,EAAE;QACJ,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;KACjC,CAAC;CACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/conversation/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,0CAA0C,EAC1C,oBAAoB,EACpB,sBAAsB,GAEvB,MAAM,uBAAuB,CAAC;AAI/B,MAAM,CAAC,MAAM,iCAAiC,GAAG,CAAC,CAAC,MAAM,CAAC;IACxD,KAAK,EAAE,oBAAoB,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;IACrD,gBAAgB,EAAE,sBAAsB;IACxC,YAAY,EAAE,0CAA0C,CAAC,KAAK,CAAC,YAAY;IAC3E,MAAM,EAAE,0CAA0C,CAAC,KAAK,CAAC,MAAM;IAC/D,UAAU,EAAE,0CAA0C,CAAC,KAAK,CAAC,UAAU;IACvE,MAAM,EAAE,CAAC,CAAC,MAAM,CACd,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,YAAY,WAAW,EACvC,+BAA+B,CAChC,CAAC,QAAQ,EAAE;CACb,CAAC,CAAC,MAAM,EAAE,CAAC","sourcesContent":["import { z } from 'zod';\nimport {\n ExecutionHostConversationTurnRequestSchema,\n ExecutionScopeSchema,\n RuntimeSessionIdSchema,\n type ExecutionHostStreamEvent,\n} from '../contracts/index.js';\nimport type {
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/conversation/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,0CAA0C,EAC1C,oBAAoB,EACpB,sBAAsB,GAEvB,MAAM,uBAAuB,CAAC;AAI/B,MAAM,CAAC,MAAM,iCAAiC,GAAG,CAAC,CAAC,MAAM,CAAC;IACxD,KAAK,EAAE,oBAAoB,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;IACrD,gBAAgB,EAAE,sBAAsB;IACxC,YAAY,EAAE,0CAA0C,CAAC,KAAK,CAAC,YAAY;IAC3E,MAAM,EAAE,0CAA0C,CAAC,KAAK,CAAC,MAAM;IAC/D,UAAU,EAAE,0CAA0C,CAAC,KAAK,CAAC,UAAU;IACvE,MAAM,EAAE,CAAC,CAAC,MAAM,CACd,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,YAAY,WAAW,EACvC,+BAA+B,CAChC,CAAC,QAAQ,EAAE;CACb,CAAC,CAAC,MAAM,EAAE,CAAC","sourcesContent":["import { z } from 'zod';\nimport {\n ExecutionHostConversationTurnRequestSchema,\n ExecutionScopeSchema,\n RuntimeSessionIdSchema,\n type ExecutionHostStreamEvent,\n} from '../contracts/index.js';\nimport type { ExecutionAuthorityIssuer } from '../authority/index.js';\nimport type { ExecutionHost } from '../http-sse/index.js';\n\nexport const HostedConversationTurnInputSchema = z.object({\n scope: ExecutionScopeSchema.omit({ adopterId: true }),\n runtimeSessionId: RuntimeSessionIdSchema,\n invocationId: ExecutionHostConversationTurnRequestSchema.shape.invocationId,\n prompt: ExecutionHostConversationTurnRequestSchema.shape.prompt,\n deadlineAt: ExecutionHostConversationTurnRequestSchema.shape.deadlineAt,\n signal: z.custom<AbortSignal>(\n (value) => value instanceof AbortSignal,\n 'signal must be an AbortSignal',\n ).optional(),\n}).strict();\n\nexport type HostedConversationTurnInput = z.infer<\n typeof HostedConversationTurnInputSchema\n>;\n\nexport type HostedConversationCredentialContext = Pick<\n HostedConversationTurnInput,\n 'scope' | 'invocationId' | 'signal'\n>;\n\n/** Resolves model authority without exposing it to HTTP or product data. */\nexport interface HostedModelCredentialProvider {\n resolveModelApiKey(\n context: HostedConversationCredentialContext,\n ): Promise<string>;\n}\n\n/** @deprecated Use `HostedModelCredentialProvider`. */\nexport type HostedConversationModelCredentialProvider =\n HostedModelCredentialProvider;\n\nexport interface HostedConversationTurnRunner {\n streamTurn(\n input: HostedConversationTurnInput,\n ): AsyncIterable<ExecutionHostStreamEvent>;\n}\n\nexport type HostedConversationTurnServiceConfig = {\n authority: ExecutionAuthorityIssuer;\n executionHost: ExecutionHost;\n modelCredentials: HostedModelCredentialProvider;\n /** Omit this policy when the hosted workflow needs no product MCP tools. */\n mcp?: {\n allowedTools: readonly string[];\n };\n};\n"]}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const HOSTED_HEARTBEAT_COORDINATOR_PATHS: Readonly<{
|
|
3
|
+
tasks: "/v1/heartbeat/tasks";
|
|
4
|
+
pause: "/v1/control/pause";
|
|
5
|
+
resume: "/v1/control/resume";
|
|
6
|
+
}>;
|
|
7
|
+
export declare const HOSTED_HEARTBEAT_DELEGATIONS_PATH = "/hosted-execution/internal/heartbeat-delegations";
|
|
8
|
+
export declare const HostedHeartbeatCoordinatorTaskInputSchema: z.ZodObject<{
|
|
9
|
+
workspaceId: z.ZodOptional<z.ZodString>;
|
|
10
|
+
name: z.ZodOptional<z.ZodString>;
|
|
11
|
+
task: z.ZodString;
|
|
12
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
13
|
+
continuationMode: z.ZodOptional<z.ZodEnum<{
|
|
14
|
+
operator: "operator";
|
|
15
|
+
agent: "agent";
|
|
16
|
+
}>>;
|
|
17
|
+
intervalMs: z.ZodOptional<z.ZodNumber>;
|
|
18
|
+
defer: z.ZodOptional<z.ZodBoolean>;
|
|
19
|
+
model: z.ZodOptional<z.ZodString>;
|
|
20
|
+
maxSteps: z.ZodOptional<z.ZodNumber>;
|
|
21
|
+
searchIgnoreDirs: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
22
|
+
systemContext: z.ZodOptional<z.ZodString>;
|
|
23
|
+
}, z.core.$strict>;
|
|
24
|
+
export declare const HostedHeartbeatCoordinatorTaskSummarySchema: z.ZodObject<{
|
|
25
|
+
id: z.ZodString;
|
|
26
|
+
workspaceId: z.ZodOptional<z.ZodString>;
|
|
27
|
+
}, z.core.$loose>;
|
|
28
|
+
export declare const HostedHeartbeatCoordinatorTaskListSchema: z.ZodObject<{
|
|
29
|
+
tasks: z.ZodArray<z.ZodObject<{
|
|
30
|
+
id: z.ZodString;
|
|
31
|
+
workspaceId: z.ZodOptional<z.ZodString>;
|
|
32
|
+
}, z.core.$loose>>;
|
|
33
|
+
}, z.core.$strict>;
|
|
34
|
+
export declare const HostedHeartbeatDesiredTaskSchema: z.ZodObject<{
|
|
35
|
+
taskId: z.ZodString;
|
|
36
|
+
input: z.ZodObject<{
|
|
37
|
+
workspaceId: z.ZodOptional<z.ZodString>;
|
|
38
|
+
name: z.ZodOptional<z.ZodString>;
|
|
39
|
+
task: z.ZodString;
|
|
40
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
41
|
+
continuationMode: z.ZodOptional<z.ZodEnum<{
|
|
42
|
+
operator: "operator";
|
|
43
|
+
agent: "agent";
|
|
44
|
+
}>>;
|
|
45
|
+
intervalMs: z.ZodOptional<z.ZodNumber>;
|
|
46
|
+
defer: z.ZodOptional<z.ZodBoolean>;
|
|
47
|
+
model: z.ZodOptional<z.ZodString>;
|
|
48
|
+
maxSteps: z.ZodOptional<z.ZodNumber>;
|
|
49
|
+
searchIgnoreDirs: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
50
|
+
systemContext: z.ZodOptional<z.ZodString>;
|
|
51
|
+
}, z.core.$strict>;
|
|
52
|
+
}, z.core.$strict>;
|
|
53
|
+
export declare const HostedHeartbeatDesiredTaskCatalogSchema: z.ZodObject<{
|
|
54
|
+
tasks: z.ZodArray<z.ZodObject<{
|
|
55
|
+
taskId: z.ZodString;
|
|
56
|
+
input: z.ZodObject<{
|
|
57
|
+
workspaceId: z.ZodOptional<z.ZodString>;
|
|
58
|
+
name: z.ZodOptional<z.ZodString>;
|
|
59
|
+
task: z.ZodString;
|
|
60
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
61
|
+
continuationMode: z.ZodOptional<z.ZodEnum<{
|
|
62
|
+
operator: "operator";
|
|
63
|
+
agent: "agent";
|
|
64
|
+
}>>;
|
|
65
|
+
intervalMs: z.ZodOptional<z.ZodNumber>;
|
|
66
|
+
defer: z.ZodOptional<z.ZodBoolean>;
|
|
67
|
+
model: z.ZodOptional<z.ZodString>;
|
|
68
|
+
maxSteps: z.ZodOptional<z.ZodNumber>;
|
|
69
|
+
searchIgnoreDirs: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
70
|
+
systemContext: z.ZodOptional<z.ZodString>;
|
|
71
|
+
}, z.core.$strict>;
|
|
72
|
+
}, z.core.$strict>>;
|
|
73
|
+
resume: z.ZodBoolean;
|
|
74
|
+
}, z.core.$strict>;
|
|
75
|
+
export declare const HostedHeartbeatDelegationRequestSchema: z.ZodObject<{
|
|
76
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
77
|
+
taskId: z.ZodString;
|
|
78
|
+
executionId: z.ZodString;
|
|
79
|
+
}, z.core.$strict>;
|
|
80
|
+
export declare const HostedHeartbeatDelegationSchema: z.ZodObject<{
|
|
81
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
82
|
+
taskId: z.ZodString;
|
|
83
|
+
executionId: z.ZodString;
|
|
84
|
+
scope: z.ZodObject<{
|
|
85
|
+
tenantId: z.ZodString;
|
|
86
|
+
subjectId: z.ZodString;
|
|
87
|
+
productSessionId: z.ZodString;
|
|
88
|
+
}, z.core.$strict>;
|
|
89
|
+
runtimeSessionId: z.ZodString;
|
|
90
|
+
deadlineAt: z.ZodISODateTime;
|
|
91
|
+
authority: z.ZodObject<{
|
|
92
|
+
metadata: z.ZodObject<{
|
|
93
|
+
scope: z.ZodObject<{
|
|
94
|
+
adopterId: z.ZodString;
|
|
95
|
+
tenantId: z.ZodString;
|
|
96
|
+
subjectId: z.ZodString;
|
|
97
|
+
productSessionId: z.ZodString;
|
|
98
|
+
}, z.core.$strict>;
|
|
99
|
+
runtimeSessionId: z.ZodString;
|
|
100
|
+
invocationId: z.ZodString;
|
|
101
|
+
workflow: z.ZodLiteral<"heartbeat-task">;
|
|
102
|
+
issuedAt: z.ZodISODateTime;
|
|
103
|
+
executionExpiresAt: z.ZodISODateTime;
|
|
104
|
+
mcp: z.ZodObject<{
|
|
105
|
+
capabilityId: z.ZodString;
|
|
106
|
+
serverId: z.ZodString;
|
|
107
|
+
allowedTools: z.ZodArray<z.ZodString>;
|
|
108
|
+
expiresAt: z.ZodISODateTime;
|
|
109
|
+
}, z.core.$strict>;
|
|
110
|
+
}, z.core.$strict>;
|
|
111
|
+
executionAssertion: z.ZodString;
|
|
112
|
+
mcpCapability: z.ZodString;
|
|
113
|
+
}, z.core.$strict>;
|
|
114
|
+
}, z.core.$strict>;
|
|
115
|
+
export declare const HostedHeartbeatDelegationAuthorizationSchema: z.ZodObject<{
|
|
116
|
+
scope: z.ZodObject<{
|
|
117
|
+
tenantId: z.ZodString;
|
|
118
|
+
subjectId: z.ZodString;
|
|
119
|
+
productSessionId: z.ZodString;
|
|
120
|
+
}, z.core.$strict>;
|
|
121
|
+
allowedTools: z.ZodArray<z.ZodString>;
|
|
122
|
+
}, z.core.$strict>;
|
|
123
|
+
export type HostedHeartbeatCoordinatorTaskInput = z.infer<typeof HostedHeartbeatCoordinatorTaskInputSchema>;
|
|
124
|
+
export type HostedHeartbeatCoordinatorTaskSummary = z.infer<typeof HostedHeartbeatCoordinatorTaskSummarySchema>;
|
|
125
|
+
export type HostedHeartbeatDesiredTask = z.infer<typeof HostedHeartbeatDesiredTaskSchema>;
|
|
126
|
+
export type HostedHeartbeatDesiredTaskCatalog = z.infer<typeof HostedHeartbeatDesiredTaskCatalogSchema>;
|
|
127
|
+
export type HostedHeartbeatDelegationRequest = z.infer<typeof HostedHeartbeatDelegationRequestSchema>;
|
|
128
|
+
export type HostedHeartbeatDelegation = z.infer<typeof HostedHeartbeatDelegationSchema>;
|
|
129
|
+
export type HostedHeartbeatDelegationAuthorization = z.infer<typeof HostedHeartbeatDelegationAuthorizationSchema>;
|
|
130
|
+
//# sourceMappingURL=contracts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../../src/coordinator/contracts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAexB,eAAO,M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IdSchema, OpaqueIdSchema, RuntimeSessionIdSchema, TimestampSchema, } from '../contracts/index.js';
|
|
3
|
+
const ProductExecutionScopeSchema = ExecutionScopeSchema.omit({
|
|
4
|
+
adopterId: true,
|
|
5
|
+
});
|
|
6
|
+
export const HOSTED_HEARTBEAT_COORDINATOR_PATHS = Object.freeze({
|
|
7
|
+
tasks: '/v1/heartbeat/tasks',
|
|
8
|
+
pause: '/v1/control/pause',
|
|
9
|
+
resume: '/v1/control/resume',
|
|
10
|
+
});
|
|
11
|
+
export const HOSTED_HEARTBEAT_DELEGATIONS_PATH = '/hosted-execution/internal/heartbeat-delegations';
|
|
12
|
+
export const HostedHeartbeatCoordinatorTaskInputSchema = z.object({
|
|
13
|
+
workspaceId: OpaqueIdSchema.optional(),
|
|
14
|
+
name: z.string().trim().min(1).max(200).optional(),
|
|
15
|
+
task: z.string().trim().min(1).max(200_000),
|
|
16
|
+
enabled: z.boolean().optional(),
|
|
17
|
+
continuationMode: z.enum(['operator', 'agent']).optional(),
|
|
18
|
+
intervalMs: z.number().int().min(1_000).max(Number.MAX_SAFE_INTEGER)
|
|
19
|
+
.optional(),
|
|
20
|
+
defer: z.boolean().optional(),
|
|
21
|
+
model: z.string().trim().min(1).max(512).optional(),
|
|
22
|
+
maxSteps: z.number().int().positive().max(10_000).optional(),
|
|
23
|
+
searchIgnoreDirs: z.array(z.string().min(1).max(1_024)).max(1_000)
|
|
24
|
+
.optional(),
|
|
25
|
+
systemContext: z.string().max(200_000).optional(),
|
|
26
|
+
}).strict();
|
|
27
|
+
export const HostedHeartbeatCoordinatorTaskSummarySchema = z.object({
|
|
28
|
+
id: OpaqueIdSchema,
|
|
29
|
+
workspaceId: OpaqueIdSchema.optional(),
|
|
30
|
+
}).passthrough();
|
|
31
|
+
export const HostedHeartbeatCoordinatorTaskListSchema = z.object({
|
|
32
|
+
tasks: z.array(HostedHeartbeatCoordinatorTaskSummarySchema),
|
|
33
|
+
}).strict();
|
|
34
|
+
export const HostedHeartbeatDesiredTaskSchema = z.object({
|
|
35
|
+
taskId: OpaqueIdSchema,
|
|
36
|
+
input: HostedHeartbeatCoordinatorTaskInputSchema,
|
|
37
|
+
}).strict();
|
|
38
|
+
export const HostedHeartbeatDesiredTaskCatalogSchema = z.object({
|
|
39
|
+
tasks: z.array(HostedHeartbeatDesiredTaskSchema).max(10_000),
|
|
40
|
+
resume: z.boolean(),
|
|
41
|
+
}).strict().superRefine(({ tasks }, context) => {
|
|
42
|
+
const seen = new Set();
|
|
43
|
+
tasks.forEach(({ taskId }, index) => {
|
|
44
|
+
if (seen.has(taskId)) {
|
|
45
|
+
context.addIssue({
|
|
46
|
+
code: 'custom',
|
|
47
|
+
path: ['tasks', index, 'taskId'],
|
|
48
|
+
message: 'must be unique within the desired task catalog',
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
seen.add(taskId);
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
export const HostedHeartbeatDelegationRequestSchema = z.object({
|
|
55
|
+
schemaVersion: z.literal(1),
|
|
56
|
+
taskId: OpaqueIdSchema,
|
|
57
|
+
executionId: OpaqueIdSchema,
|
|
58
|
+
}).strict();
|
|
59
|
+
const DelegatedAuthorityMetadataSchema = z.object({
|
|
60
|
+
scope: ExecutionScopeSchema,
|
|
61
|
+
runtimeSessionId: RuntimeSessionIdSchema,
|
|
62
|
+
invocationId: OpaqueIdSchema,
|
|
63
|
+
workflow: z.literal(HEARTBEAT_TASK_WORKFLOW),
|
|
64
|
+
issuedAt: TimestampSchema,
|
|
65
|
+
executionExpiresAt: TimestampSchema,
|
|
66
|
+
mcp: z.object({
|
|
67
|
+
capabilityId: OpaqueIdSchema,
|
|
68
|
+
serverId: McpServerIdSchema,
|
|
69
|
+
allowedTools: McpAllowedToolsSchema,
|
|
70
|
+
expiresAt: TimestampSchema,
|
|
71
|
+
}).strict(),
|
|
72
|
+
}).strict();
|
|
73
|
+
export const HostedHeartbeatDelegationSchema = z.object({
|
|
74
|
+
schemaVersion: z.literal(1),
|
|
75
|
+
taskId: OpaqueIdSchema,
|
|
76
|
+
executionId: OpaqueIdSchema,
|
|
77
|
+
scope: ProductExecutionScopeSchema,
|
|
78
|
+
runtimeSessionId: RuntimeSessionIdSchema,
|
|
79
|
+
deadlineAt: TimestampSchema,
|
|
80
|
+
authority: z.object({
|
|
81
|
+
metadata: DelegatedAuthorityMetadataSchema,
|
|
82
|
+
executionAssertion: z.string().min(1).max(16_384),
|
|
83
|
+
mcpCapability: z.string().min(1).max(16_384),
|
|
84
|
+
}).strict(),
|
|
85
|
+
}).strict().superRefine((delegation, context) => {
|
|
86
|
+
const metadata = delegation.authority.metadata;
|
|
87
|
+
const mismatches = [
|
|
88
|
+
['executionId', metadata.invocationId !== delegation.executionId],
|
|
89
|
+
[
|
|
90
|
+
'runtimeSessionId',
|
|
91
|
+
metadata.runtimeSessionId !== delegation.runtimeSessionId,
|
|
92
|
+
],
|
|
93
|
+
['scope', !sameProductScope(metadata.scope, delegation.scope)],
|
|
94
|
+
];
|
|
95
|
+
mismatches
|
|
96
|
+
.filter(([, mismatched]) => mismatched)
|
|
97
|
+
.forEach(([path]) => context.addIssue({
|
|
98
|
+
code: 'custom',
|
|
99
|
+
path: [path],
|
|
100
|
+
message: 'must match the delegated execution authority metadata',
|
|
101
|
+
}));
|
|
102
|
+
});
|
|
103
|
+
export const HostedHeartbeatDelegationAuthorizationSchema = z.object({
|
|
104
|
+
scope: ProductExecutionScopeSchema,
|
|
105
|
+
allowedTools: McpAllowedToolsSchema,
|
|
106
|
+
}).strict();
|
|
107
|
+
function sameProductScope(left, right) {
|
|
108
|
+
return left.tenantId === right.tenantId
|
|
109
|
+
&& left.subjectId === right.subjectId
|
|
110
|
+
&& left.productSessionId === right.productSessionId;
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=contracts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contracts.js","sourceRoot":"","sources":["../../src/coordinator/contracts.ts"],"names":[],"mappings":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E,CAAC,IAAI,CAAC;QACZ,OAAO,EAAE,uDAAuD;KACjE,CAAC,CAAC,CAAC;AACR,CAAC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,4CAA4C,GAAG,CAAC,CAAC,MAAM,CAAC;IACnE,KAAK,EAAE,2BAA2B;IAClC,YAAY,EAAE,qBAAqB;CACpC,CAAC,CAAC,MAAM,EAAE,CAAC;AAwBZ,SAAS,gBAAgB,CACvB,IAA0C,EAC1C,KAAkD;IAElD,OAAO,IAAI,CAAC,QAAQ,KAAK,KAAK,CAAC,QAAQ;WAClC,IAAI,CAAC,SAAS,KAAK,KAAK,CAAC,SAAS;WAClC,IAAI,CAAC,gBAAgB,KAAK,KAAK,CAAC,gBAAgB,CAAC;AACxD,CAAC","sourcesContent":["import { z } from 'zod';\nimport {\n ExecutionScopeSchema,\n HEARTBEAT_TASK_WORKFLOW,\n McpAllowedToolsSchema,\n McpServerIdSchema,\n OpaqueIdSchema,\n RuntimeSessionIdSchema,\n TimestampSchema,\n} from '../contracts/index.js';\n\nconst ProductExecutionScopeSchema = ExecutionScopeSchema.omit({\n adopterId: true,\n});\n\nexport const HOSTED_HEARTBEAT_COORDINATOR_PATHS = Object.freeze({\n tasks: '/v1/heartbeat/tasks',\n pause: '/v1/control/pause',\n resume: '/v1/control/resume',\n});\n\nexport const HOSTED_HEARTBEAT_DELEGATIONS_PATH =\n '/hosted-execution/internal/heartbeat-delegations';\n\nexport const HostedHeartbeatCoordinatorTaskInputSchema = z.object({\n workspaceId: OpaqueIdSchema.optional(),\n name: z.string().trim().min(1).max(200).optional(),\n task: z.string().trim().min(1).max(200_000),\n enabled: z.boolean().optional(),\n continuationMode: z.enum(['operator', 'agent']).optional(),\n intervalMs: z.number().int().min(1_000).max(Number.MAX_SAFE_INTEGER)\n .optional(),\n defer: z.boolean().optional(),\n model: z.string().trim().min(1).max(512).optional(),\n maxSteps: z.number().int().positive().max(10_000).optional(),\n searchIgnoreDirs: z.array(z.string().min(1).max(1_024)).max(1_000)\n .optional(),\n systemContext: z.string().max(200_000).optional(),\n}).strict();\n\nexport const HostedHeartbeatCoordinatorTaskSummarySchema = z.object({\n id: OpaqueIdSchema,\n workspaceId: OpaqueIdSchema.optional(),\n}).passthrough();\n\nexport const HostedHeartbeatCoordinatorTaskListSchema = z.object({\n tasks: z.array(HostedHeartbeatCoordinatorTaskSummarySchema),\n}).strict();\n\nexport const HostedHeartbeatDesiredTaskSchema = z.object({\n taskId: OpaqueIdSchema,\n input: HostedHeartbeatCoordinatorTaskInputSchema,\n}).strict();\n\nexport const HostedHeartbeatDesiredTaskCatalogSchema = z.object({\n tasks: z.array(HostedHeartbeatDesiredTaskSchema).max(10_000),\n resume: z.boolean(),\n}).strict().superRefine(({ tasks }, context) => {\n const seen = new Set<string>();\n tasks.forEach(({ taskId }, index) => {\n if (seen.has(taskId)) {\n context.addIssue({\n code: 'custom',\n path: ['tasks', index, 'taskId'],\n message: 'must be unique within the desired task catalog',\n });\n }\n seen.add(taskId);\n });\n});\n\nexport const HostedHeartbeatDelegationRequestSchema = z.object({\n schemaVersion: z.literal(1),\n taskId: OpaqueIdSchema,\n executionId: OpaqueIdSchema,\n}).strict();\n\nconst DelegatedAuthorityMetadataSchema = z.object({\n scope: ExecutionScopeSchema,\n runtimeSessionId: RuntimeSessionIdSchema,\n invocationId: OpaqueIdSchema,\n workflow: z.literal(HEARTBEAT_TASK_WORKFLOW),\n issuedAt: TimestampSchema,\n executionExpiresAt: TimestampSchema,\n mcp: z.object({\n capabilityId: OpaqueIdSchema,\n serverId: McpServerIdSchema,\n allowedTools: McpAllowedToolsSchema,\n expiresAt: TimestampSchema,\n }).strict(),\n}).strict();\n\nexport const HostedHeartbeatDelegationSchema = z.object({\n schemaVersion: z.literal(1),\n taskId: OpaqueIdSchema,\n executionId: OpaqueIdSchema,\n scope: ProductExecutionScopeSchema,\n runtimeSessionId: RuntimeSessionIdSchema,\n deadlineAt: TimestampSchema,\n authority: z.object({\n metadata: DelegatedAuthorityMetadataSchema,\n executionAssertion: z.string().min(1).max(16_384),\n mcpCapability: z.string().min(1).max(16_384),\n }).strict(),\n}).strict().superRefine((delegation, context) => {\n const metadata = delegation.authority.metadata;\n const mismatches: Array<[path: string, mismatched: boolean]> = [\n ['executionId', metadata.invocationId !== delegation.executionId],\n [\n 'runtimeSessionId',\n metadata.runtimeSessionId !== delegation.runtimeSessionId,\n ],\n ['scope', !sameProductScope(metadata.scope, delegation.scope)],\n ];\n mismatches\n .filter(([, mismatched]) => mismatched)\n .forEach(([path]) => context.addIssue({\n code: 'custom',\n path: [path],\n message: 'must match the delegated execution authority metadata',\n }));\n});\n\nexport const HostedHeartbeatDelegationAuthorizationSchema = z.object({\n scope: ProductExecutionScopeSchema,\n allowedTools: McpAllowedToolsSchema,\n}).strict();\n\nexport type HostedHeartbeatCoordinatorTaskInput = z.infer<\n typeof HostedHeartbeatCoordinatorTaskInputSchema\n>;\nexport type HostedHeartbeatCoordinatorTaskSummary = z.infer<\n typeof HostedHeartbeatCoordinatorTaskSummarySchema\n>;\nexport type HostedHeartbeatDesiredTask = z.infer<\n typeof HostedHeartbeatDesiredTaskSchema\n>;\nexport type HostedHeartbeatDesiredTaskCatalog = z.infer<\n typeof HostedHeartbeatDesiredTaskCatalogSchema\n>;\nexport type HostedHeartbeatDelegationRequest = z.infer<\n typeof HostedHeartbeatDelegationRequestSchema\n>;\nexport type HostedHeartbeatDelegation = z.infer<\n typeof HostedHeartbeatDelegationSchema\n>;\nexport type HostedHeartbeatDelegationAuthorization = z.infer<\n typeof HostedHeartbeatDelegationAuthorizationSchema\n>;\n\nfunction sameProductScope(\n left: z.infer<typeof ExecutionScopeSchema>,\n right: z.infer<typeof ProductExecutionScopeSchema>,\n): boolean {\n return left.tenantId === right.tenantId\n && left.subjectId === right.subjectId\n && left.productSessionId === right.productSessionId;\n}\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type HostedHeartbeatCoordinatorTaskInput, type HostedHeartbeatCoordinatorTaskSummary } from './contracts.js';
|
|
2
|
+
import type { HostedHeartbeatCoordinatorClientConfig, HostedHeartbeatCoordinatorTaskApi } from './types.js';
|
|
3
|
+
export declare class HostedHeartbeatCoordinatorRequestError extends Error {
|
|
4
|
+
readonly method: string;
|
|
5
|
+
readonly path: string;
|
|
6
|
+
readonly status: number;
|
|
7
|
+
readonly name = "HostedHeartbeatCoordinatorRequestError";
|
|
8
|
+
constructor(method: string, path: string, status: number);
|
|
9
|
+
}
|
|
10
|
+
/** Authenticated desired-task and admission client for a Heddle Coordinator. */
|
|
11
|
+
export declare class HostedHeartbeatCoordinatorClient implements HostedHeartbeatCoordinatorTaskApi {
|
|
12
|
+
#private;
|
|
13
|
+
constructor(config: HostedHeartbeatCoordinatorClientConfig);
|
|
14
|
+
listTasks(signal?: AbortSignal): Promise<HostedHeartbeatCoordinatorTaskSummary[]>;
|
|
15
|
+
upsertTask(rawTaskId: string, rawTask: HostedHeartbeatCoordinatorTaskInput, signal?: AbortSignal): Promise<void>;
|
|
16
|
+
deleteTask(rawTaskId: string, signal?: AbortSignal): Promise<void>;
|
|
17
|
+
pause(signal?: AbortSignal): Promise<void>;
|
|
18
|
+
resume(signal?: AbortSignal): Promise<void>;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=hosted-heartbeat-coordinator-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hosted-heartbeat-coordinator-client.d.ts","sourceRoot":"","sources":["../../src/coordinator/hosted-heartbeat-coordinator-client.ts"],"names":[],"mappings":"AAKA,OAAO,EAIL,KAAK,mCAAmC,EACxC,KAAK,qCAAqC,EAC3C,MAAM,gBAAgB,CAAC;AAExB,OAAO,KAAK,EACV,sCAAsC,EACtC,iCAAiC,EAClC,MAAM,YAAY,CAAC;AAOpB,qBAAa,sCAAuC,SAAQ,KAAK;IAI7D,QAAQ,CAAC,MAAM,EAAE,MAAM;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM;IACrB,QAAQ,CAAC,MAAM,EAAE,MAAM;IALzB,QAAQ,CAAC,IAAI,4CAA4C;gBAG9C,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM;CAI1B;AAED,gFAAgF;AAChF,qBAAa,gCACb,YAAW,iCAAiC;;gBAK9B,MAAM,EAAE,sCAAsC;IAQpD,SAAS,CACb,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,qCAAqC,EAAE,CAAC;IAU7C,UAAU,CACd,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,mCAAmC,EAC5C,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,IAAI,CAAC;IAWV,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAOlE,KAAK,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAO1C,MAAM,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;CA8BlD"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { OpaqueIdSchema, isSafeWebUrl, } from '../contracts/index.js';
|
|
3
|
+
import { HOSTED_HEARTBEAT_COORDINATOR_PATHS, HostedHeartbeatCoordinatorTaskInputSchema, HostedHeartbeatCoordinatorTaskListSchema, } from './contracts.js';
|
|
4
|
+
import { HostedHeartbeatServiceTokenSchema } from './service-token.js';
|
|
5
|
+
const SafeBaseUrlSchema = z.custom((value) => value instanceof URL && isSafeWebUrl(value), 'baseUrl must be a safe HTTPS or loopback HTTP URL');
|
|
6
|
+
export class HostedHeartbeatCoordinatorRequestError extends Error {
|
|
7
|
+
method;
|
|
8
|
+
path;
|
|
9
|
+
status;
|
|
10
|
+
name = 'HostedHeartbeatCoordinatorRequestError';
|
|
11
|
+
constructor(method, path, status) {
|
|
12
|
+
super(`Heddle Coordinator ${method} ${path} failed with status ${status}.`);
|
|
13
|
+
this.method = method;
|
|
14
|
+
this.path = path;
|
|
15
|
+
this.status = status;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
/** Authenticated desired-task and admission client for a Heddle Coordinator. */
|
|
19
|
+
export class HostedHeartbeatCoordinatorClient {
|
|
20
|
+
#baseUrl;
|
|
21
|
+
#authorization;
|
|
22
|
+
#fetch;
|
|
23
|
+
constructor(config) {
|
|
24
|
+
this.#baseUrl = new URL(SafeBaseUrlSchema.parse(config.baseUrl));
|
|
25
|
+
this.#authorization = `Bearer ${HostedHeartbeatServiceTokenSchema.parse(config.apiToken)}`;
|
|
26
|
+
this.#fetch = config.fetch ?? globalThis.fetch;
|
|
27
|
+
}
|
|
28
|
+
async listTasks(signal) {
|
|
29
|
+
const response = await this.#request(HOSTED_HEARTBEAT_COORDINATOR_PATHS.tasks, { method: 'GET', signal });
|
|
30
|
+
return HostedHeartbeatCoordinatorTaskListSchema.parse(await response.json()).tasks;
|
|
31
|
+
}
|
|
32
|
+
async upsertTask(rawTaskId, rawTask, signal) {
|
|
33
|
+
const taskId = OpaqueIdSchema.parse(rawTaskId);
|
|
34
|
+
const task = HostedHeartbeatCoordinatorTaskInputSchema.parse(rawTask);
|
|
35
|
+
await this.#request(this.#taskPath(taskId), {
|
|
36
|
+
method: 'PUT',
|
|
37
|
+
headers: { 'content-type': 'application/json' },
|
|
38
|
+
body: JSON.stringify(task),
|
|
39
|
+
signal,
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
async deleteTask(rawTaskId, signal) {
|
|
43
|
+
await this.#request(this.#taskPath(OpaqueIdSchema.parse(rawTaskId)), {
|
|
44
|
+
method: 'DELETE',
|
|
45
|
+
signal,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
async pause(signal) {
|
|
49
|
+
await this.#request(HOSTED_HEARTBEAT_COORDINATOR_PATHS.pause, {
|
|
50
|
+
method: 'POST',
|
|
51
|
+
signal,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
async resume(signal) {
|
|
55
|
+
await this.#request(HOSTED_HEARTBEAT_COORDINATOR_PATHS.resume, {
|
|
56
|
+
method: 'POST',
|
|
57
|
+
signal,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
#taskPath(taskId) {
|
|
61
|
+
return `${HOSTED_HEARTBEAT_COORDINATOR_PATHS.tasks}/${encodeURIComponent(taskId)}`;
|
|
62
|
+
}
|
|
63
|
+
async #request(path, init) {
|
|
64
|
+
const headers = new Headers(init.headers);
|
|
65
|
+
headers.set('authorization', this.#authorization);
|
|
66
|
+
const response = await this.#fetch(new URL(path, this.#baseUrl), {
|
|
67
|
+
...init,
|
|
68
|
+
headers,
|
|
69
|
+
redirect: 'error',
|
|
70
|
+
});
|
|
71
|
+
if (!response.ok) {
|
|
72
|
+
throw new HostedHeartbeatCoordinatorRequestError(init.method ?? 'GET', path, response.status);
|
|
73
|
+
}
|
|
74
|
+
return response;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=hosted-heartbeat-coordinator-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hosted-heartbeat-coordinator-client.js","sourceRoot":"","sources":["../../src/coordinator/hosted-heartbeat-coordinator-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,cAAc,EACd,YAAY,GACb,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,kCAAkC,EAClC,yCAAyC,EACzC,wCAAwC,GAGzC,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,iCAAiC,EAAE,MAAM,oBAAoB,CAAC;AAMvE,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAChC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,YAAY,GAAG,IAAI,YAAY,CAAC,KAAK,CAAC,EACtD,mDAAmD,CACpD,CAAC;AAEF,MAAM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AO;YACP,QAAQ,EAAE,OAAO;SAClB,CAAC,CAAC;QACH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,MAAM,IAAI,sCAAsC,CAC9C,IAAI,CAAC,MAAM,IAAI,KAAK,EACpB,IAAI,EACJ,QAAQ,CAAC,MAAM,CAChB,CAAC;QACJ,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF","sourcesContent":["import { z } from 'zod';\nimport {\n OpaqueIdSchema,\n isSafeWebUrl,\n} from '../contracts/index.js';\nimport {\n HOSTED_HEARTBEAT_COORDINATOR_PATHS,\n HostedHeartbeatCoordinatorTaskInputSchema,\n HostedHeartbeatCoordinatorTaskListSchema,\n type HostedHeartbeatCoordinatorTaskInput,\n type HostedHeartbeatCoordinatorTaskSummary,\n} from './contracts.js';\nimport { HostedHeartbeatServiceTokenSchema } from './service-token.js';\nimport type {\n HostedHeartbeatCoordinatorClientConfig,\n HostedHeartbeatCoordinatorTaskApi,\n} from './types.js';\n\nconst SafeBaseUrlSchema = z.custom<URL>(\n (value) => value instanceof URL && isSafeWebUrl(value),\n 'baseUrl must be a safe HTTPS or loopback HTTP URL',\n);\n\nexport class HostedHeartbeatCoordinatorRequestError extends Error {\n readonly name = 'HostedHeartbeatCoordinatorRequestError';\n\n constructor(\n readonly method: string,\n readonly path: string,\n readonly status: number,\n ) {\n super(`Heddle Coordinator ${method} ${path} failed with status ${status}.`);\n }\n}\n\n/** Authenticated desired-task and admission client for a Heddle Coordinator. */\nexport class HostedHeartbeatCoordinatorClient\nimplements HostedHeartbeatCoordinatorTaskApi {\n readonly #baseUrl: URL;\n readonly #authorization: string;\n readonly #fetch: typeof globalThis.fetch;\n\n constructor(config: HostedHeartbeatCoordinatorClientConfig) {\n this.#baseUrl = new URL(SafeBaseUrlSchema.parse(config.baseUrl));\n this.#authorization = `Bearer ${\n HostedHeartbeatServiceTokenSchema.parse(config.apiToken)\n }`;\n this.#fetch = config.fetch ?? globalThis.fetch;\n }\n\n async listTasks(\n signal?: AbortSignal,\n ): Promise<HostedHeartbeatCoordinatorTaskSummary[]> {\n const response = await this.#request(\n HOSTED_HEARTBEAT_COORDINATOR_PATHS.tasks,\n { method: 'GET', signal },\n );\n return HostedHeartbeatCoordinatorTaskListSchema.parse(\n await response.json(),\n ).tasks;\n }\n\n async upsertTask(\n rawTaskId: string,\n rawTask: HostedHeartbeatCoordinatorTaskInput,\n signal?: AbortSignal,\n ): Promise<void> {\n const taskId = OpaqueIdSchema.parse(rawTaskId);\n const task = HostedHeartbeatCoordinatorTaskInputSchema.parse(rawTask);\n await this.#request(this.#taskPath(taskId), {\n method: 'PUT',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify(task),\n signal,\n });\n }\n\n async deleteTask(rawTaskId: string, signal?: AbortSignal): Promise<void> {\n await this.#request(this.#taskPath(OpaqueIdSchema.parse(rawTaskId)), {\n method: 'DELETE',\n signal,\n });\n }\n\n async pause(signal?: AbortSignal): Promise<void> {\n await this.#request(HOSTED_HEARTBEAT_COORDINATOR_PATHS.pause, {\n method: 'POST',\n signal,\n });\n }\n\n async resume(signal?: AbortSignal): Promise<void> {\n await this.#request(HOSTED_HEARTBEAT_COORDINATOR_PATHS.resume, {\n method: 'POST',\n signal,\n });\n }\n\n #taskPath(taskId: string): string {\n return `${HOSTED_HEARTBEAT_COORDINATOR_PATHS.tasks}/${\n encodeURIComponent(taskId)\n }`;\n }\n\n async #request(path: string, init: RequestInit): Promise<Response> {\n const headers = new Headers(init.headers);\n headers.set('authorization', this.#authorization);\n const response = await this.#fetch(new URL(path, this.#baseUrl), {\n ...init,\n headers,\n redirect: 'error',\n });\n if (!response.ok) {\n throw new HostedHeartbeatCoordinatorRequestError(\n init.method ?? 'GET',\n path,\n response.status,\n );\n }\n return response;\n }\n}\n"]}
|