@heddleagent/execution-host-client 6.4.0 → 6.6.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 +51 -4
- package/dist/adopter/contracts.d.ts +13 -0
- package/dist/adopter/contracts.d.ts.map +1 -0
- package/dist/adopter/contracts.js +13 -0
- package/dist/adopter/contracts.js.map +1 -0
- package/dist/adopter/hosted-conversation-client.d.ts +20 -0
- package/dist/adopter/hosted-conversation-client.d.ts.map +1 -0
- package/dist/adopter/hosted-conversation-client.js +103 -0
- package/dist/adopter/hosted-conversation-client.js.map +1 -0
- package/dist/adopter/index.d.ts +5 -0
- package/dist/adopter/index.d.ts.map +1 -0
- package/dist/adopter/index.js +3 -0
- package/dist/adopter/index.js.map +1 -0
- package/dist/adopter/types.d.ts +14 -0
- package/dist/adopter/types.d.ts.map +1 -0
- package/dist/adopter/types.js +2 -0
- package/dist/adopter/types.js.map +1 -0
- package/dist/agentcore/agentcore-execution-host.d.ts.map +1 -1
- package/dist/agentcore/agentcore-execution-host.js +7 -4
- package/dist/agentcore/agentcore-execution-host.js.map +1 -1
- package/dist/agentcore/index.d.ts +2 -0
- package/dist/agentcore/index.d.ts.map +1 -1
- package/dist/agentcore/index.js +1 -0
- package/dist/agentcore/index.js.map +1 -1
- package/dist/agentcore/schemas.d.ts +11 -0
- package/dist/agentcore/schemas.d.ts.map +1 -0
- package/dist/agentcore/schemas.js +12 -0
- package/dist/agentcore/schemas.js.map +1 -0
- package/dist/agentcore/types.d.ts +2 -4
- package/dist/agentcore/types.d.ts.map +1 -1
- package/dist/agentcore/types.js.map +1 -1
- package/dist/coordinator/contracts.d.ts +367 -2
- package/dist/coordinator/contracts.d.ts.map +1 -1
- package/dist/coordinator/contracts.js +72 -2
- package/dist/coordinator/contracts.js.map +1 -1
- package/dist/coordinator/hosted-heartbeat-coordinator-client.d.ts +6 -2
- package/dist/coordinator/hosted-heartbeat-coordinator-client.d.ts.map +1 -1
- package/dist/coordinator/hosted-heartbeat-coordinator-client.js +21 -1
- package/dist/coordinator/hosted-heartbeat-coordinator-client.js.map +1 -1
- package/dist/coordinator/index.d.ts +2 -2
- package/dist/coordinator/index.d.ts.map +1 -1
- package/dist/coordinator/index.js +1 -1
- package/dist/coordinator/index.js.map +1 -1
- package/dist/coordinator/types.d.ts +7 -3
- package/dist/coordinator/types.d.ts.map +1 -1
- package/dist/coordinator/types.js.map +1 -1
- package/dist/host/errors.d.ts +23 -0
- package/dist/host/errors.d.ts.map +1 -0
- package/dist/host/errors.js +32 -0
- package/dist/host/errors.js.map +1 -0
- package/dist/host/index.d.ts +8 -0
- package/dist/host/index.d.ts.map +1 -0
- package/dist/host/index.js +7 -0
- package/dist/host/index.js.map +1 -0
- package/dist/host/jwt-execution-host-mcp-capability-verifier.d.ts +8 -0
- package/dist/host/jwt-execution-host-mcp-capability-verifier.d.ts.map +1 -0
- package/dist/host/jwt-execution-host-mcp-capability-verifier.js +86 -0
- package/dist/host/jwt-execution-host-mcp-capability-verifier.js.map +1 -0
- package/dist/host/jwt-execution-identity-verifier.d.ts +8 -0
- package/dist/host/jwt-execution-identity-verifier.d.ts.map +1 -0
- package/dist/host/jwt-execution-identity-verifier.js +76 -0
- package/dist/host/jwt-execution-identity-verifier.js.map +1 -0
- package/dist/host/runtime-session/errors.d.ts +21 -0
- package/dist/host/runtime-session/errors.d.ts.map +1 -0
- package/dist/host/runtime-session/errors.js +21 -0
- package/dist/host/runtime-session/errors.js.map +1 -0
- package/dist/host/runtime-session/index.d.ts +9 -0
- package/dist/host/runtime-session/index.d.ts.map +1 -0
- package/dist/host/runtime-session/index.js +5 -0
- package/dist/host/runtime-session/index.js.map +1 -0
- package/dist/host/runtime-session/scope-binding.d.ts +17 -0
- package/dist/host/runtime-session/scope-binding.d.ts.map +1 -0
- package/dist/host/runtime-session/scope-binding.js +37 -0
- package/dist/host/runtime-session/scope-binding.js.map +1 -0
- package/dist/host/runtime-session/service.d.ts +38 -0
- package/dist/host/runtime-session/service.d.ts.map +1 -0
- package/dist/host/runtime-session/service.js +177 -0
- package/dist/host/runtime-session/service.js.map +1 -0
- package/dist/host/runtime-session/status.d.ts +17 -0
- package/dist/host/runtime-session/status.d.ts.map +1 -0
- package/dist/host/runtime-session/status.js +33 -0
- package/dist/host/runtime-session/status.js.map +1 -0
- package/dist/host/runtime-session/types.d.ts +61 -0
- package/dist/host/runtime-session/types.d.ts.map +1 -0
- package/dist/host/runtime-session/types.js +2 -0
- package/dist/host/runtime-session/types.js.map +1 -0
- package/dist/host/schemas.d.ts +37 -0
- package/dist/host/schemas.d.ts.map +1 -0
- package/dist/host/schemas.js +24 -0
- package/dist/host/schemas.js.map +1 -0
- package/dist/host/types.d.ts +62 -0
- package/dist/host/types.d.ts.map +1 -0
- package/dist/host/types.js +7 -0
- package/dist/host/types.js.map +1 -0
- package/dist/http-sse/direct-http-execution-host.d.ts.map +1 -1
- package/dist/http-sse/direct-http-execution-host.js +10 -177
- package/dist/http-sse/direct-http-execution-host.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/internal/execution-host-event-stream.d.ts +18 -0
- package/dist/internal/execution-host-event-stream.d.ts.map +1 -0
- package/dist/internal/execution-host-event-stream.js +141 -0
- package/dist/internal/execution-host-event-stream.js.map +1 -0
- package/dist/internal/http-response.d.ts +4 -0
- package/dist/internal/http-response.d.ts.map +1 -0
- package/dist/internal/http-response.js +57 -0
- package/dist/internal/http-response.js.map +1 -0
- package/dist/internal/jwt-verification.d.ts +5 -0
- package/dist/internal/jwt-verification.d.ts.map +1 -0
- package/dist/internal/jwt-verification.js +25 -0
- package/dist/internal/jwt-verification.js.map +1 -0
- package/dist/mcp/jwt-capability-verifier.d.ts.map +1 -1
- package/dist/mcp/jwt-capability-verifier.js +6 -25
- package/dist/mcp/jwt-capability-verifier.js.map +1 -1
- package/dist/node/http-service.d.ts +0 -2
- package/dist/node/http-service.d.ts.map +1 -1
- package/dist/node/http-service.js +1 -2
- package/dist/node/http-service.js.map +1 -1
- package/dist/node/index.d.ts +2 -1
- package/dist/node/index.d.ts.map +1 -1
- package/dist/node/index.js +2 -1
- package/dist/node/index.js.map +1 -1
- package/package.json +10 -2
|
@@ -1 +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,
|
|
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,6CAA6C,EAC7C,0CAA0C,EAC1C,yCAAyC,EACzC,wCAAwC,EACxC,wCAAwC,GAKzC,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,OAAO,sCAAuC,SAAQ,KAAK;IAIpD;IACA;IACA;IALF,IAAI,GAAG,wCAAwC,CAAC;IAEzD,YACW,MAAc,EACd,IAAY,EACZ,MAAc;QAEvB,KAAK,CAAC,sBAAsB,MAAM,IAAI,IAAI,uBAAuB,MAAM,GAAG,CAAC,CAAC;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AClB,CAAC;CACF","sourcesContent":["import { z } from 'zod';\nimport {\n OpaqueIdSchema,\n isSafeWebUrl,\n} from '../contracts/index.js';\nimport {\n HOSTED_HEARTBEAT_COORDINATOR_PATHS,\n HostedHeartbeatCoordinatorStateResponseSchema,\n HostedHeartbeatCoordinatorTaskDetailSchema,\n HostedHeartbeatCoordinatorTaskInputSchema,\n HostedHeartbeatCoordinatorTaskListSchema,\n HostedHeartbeatCoordinatorTaskViewSchema,\n type HostedHeartbeatCoordinatorTaskInput,\n type HostedHeartbeatCoordinatorState,\n type HostedHeartbeatCoordinatorTaskDetail,\n type HostedHeartbeatCoordinatorTaskView,\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 readState(\n signal?: AbortSignal,\n ): Promise<HostedHeartbeatCoordinatorState> {\n const response = await this.#request(\n HOSTED_HEARTBEAT_COORDINATOR_PATHS.state,\n { method: 'GET', signal },\n );\n return HostedHeartbeatCoordinatorStateResponseSchema.parse(\n await response.json(),\n ).state;\n }\n\n async listTasks(\n signal?: AbortSignal,\n ): Promise<HostedHeartbeatCoordinatorTaskView[]> {\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 readTask(\n rawTaskId: string,\n signal?: AbortSignal,\n ): Promise<HostedHeartbeatCoordinatorTaskDetail> {\n const response = await this.#request(\n this.#taskPath(OpaqueIdSchema.parse(rawTaskId)),\n { method: 'GET', signal },\n );\n return HostedHeartbeatCoordinatorTaskDetailSchema.parse(\n await response.json(),\n );\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 triggerTask(\n rawTaskId: string,\n signal?: AbortSignal,\n ): Promise<HostedHeartbeatCoordinatorTaskView> {\n const taskId = OpaqueIdSchema.parse(rawTaskId);\n const path = `${this.#taskPath(taskId)}/trigger`;\n const response = await this.#request(path, { method: 'POST', signal });\n return HostedHeartbeatCoordinatorTaskViewSchema.parse(\n await response.json(),\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 async drain(signal?: AbortSignal): Promise<void> {\n await this.#request(HOSTED_HEARTBEAT_COORDINATOR_PATHS.drain, {\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"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { HOSTED_HEARTBEAT_COORDINATOR_PATHS, HOSTED_HEARTBEAT_DELEGATIONS_PATH, HostedHeartbeatCoordinatorTaskInputSchema, HostedHeartbeatCoordinatorTaskListSchema,
|
|
2
|
-
export type { HostedHeartbeatCoordinatorTaskInput,
|
|
1
|
+
export { HOSTED_HEARTBEAT_COORDINATOR_PATHS, HOSTED_HEARTBEAT_DELEGATIONS_PATH, HostedHeartbeatCoordinatorRunViewSchema, HostedHeartbeatCoordinatorStateResponseSchema, HostedHeartbeatCoordinatorStateSchema, HostedHeartbeatCoordinatorTaskDetailSchema, HostedHeartbeatCoordinatorTaskInputSchema, HostedHeartbeatCoordinatorTaskListSchema, HostedHeartbeatCoordinatorTaskResultSchema, HostedHeartbeatCoordinatorTaskStatusSchema, HostedHeartbeatCoordinatorTaskViewSchema, HostedHeartbeatDelegationAuthorizationSchema, HostedHeartbeatDelegationRequestSchema, HostedHeartbeatDelegationSchema, HostedHeartbeatDesiredTaskCatalogSchema, HostedHeartbeatDesiredTaskSchema, } from './contracts.js';
|
|
2
|
+
export type { HostedHeartbeatCoordinatorTaskInput, HostedHeartbeatCoordinatorRunView, HostedHeartbeatCoordinatorState, HostedHeartbeatCoordinatorTaskDetail, HostedHeartbeatCoordinatorTaskView, HostedHeartbeatDelegation, HostedHeartbeatDelegationAuthorization, HostedHeartbeatDelegationRequest, HostedHeartbeatDesiredTask, HostedHeartbeatDesiredTaskCatalog, } from './contracts.js';
|
|
3
3
|
export { HostedHeartbeatCoordinatorClient, HostedHeartbeatCoordinatorRequestError, } from './hosted-heartbeat-coordinator-client.js';
|
|
4
4
|
export { HostedHeartbeatDelegatedExecutionTransport, HostedHeartbeatDelegationClient, HostedHeartbeatDelegationRequestError, } from './hosted-heartbeat-delegation-client.js';
|
|
5
5
|
export { HostedHeartbeatDelegationRejectedError, HostedHeartbeatDelegationService, } from './hosted-heartbeat-delegation-service.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/coordinator/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kCAAkC,EAClC,iCAAiC,EACjC,yCAAyC,EACzC,wCAAwC,EACxC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/coordinator/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kCAAkC,EAClC,iCAAiC,EACjC,uCAAuC,EACvC,6CAA6C,EAC7C,qCAAqC,EACrC,0CAA0C,EAC1C,yCAAyC,EACzC,wCAAwC,EACxC,0CAA0C,EAC1C,0CAA0C,EAC1C,wCAAwC,EACxC,4CAA4C,EAC5C,sCAAsC,EACtC,+BAA+B,EAC/B,uCAAuC,EACvC,gCAAgC,GACjC,MAAM,gBAAgB,CAAC;AACxB,YAAY,EACV,mCAAmC,EACnC,iCAAiC,EACjC,+BAA+B,EAC/B,oCAAoC,EACpC,kCAAkC,EAClC,yBAAyB,EACzB,sCAAsC,EACtC,gCAAgC,EAChC,0BAA0B,EAC1B,iCAAiC,GAClC,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,gCAAgC,EAChC,sCAAsC,GACvC,MAAM,0CAA0C,CAAC;AAClD,OAAO,EACL,0CAA0C,EAC1C,+BAA+B,EAC/B,qCAAqC,GACtC,MAAM,yCAAyC,CAAC;AACjD,OAAO,EACL,sCAAsC,EACtC,gCAAgC,GACjC,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAAE,6BAA6B,EAAE,MAAM,uCAAuC,CAAC;AACtF,OAAO,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AACpE,YAAY,EACV,sCAAsC,EACtC,iCAAiC,EACjC,gDAAgD,EAChD,8CAA8C,EAC9C,2CAA2C,EAC3C,mCAAmC,EACnC,qCAAqC,EACrC,+BAA+B,EAC/B,sCAAsC,EACtC,mCAAmC,EACnC,iCAAiC,EACjC,sCAAsC,GACvC,MAAM,YAAY,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { HOSTED_HEARTBEAT_COORDINATOR_PATHS, HOSTED_HEARTBEAT_DELEGATIONS_PATH, HostedHeartbeatCoordinatorTaskInputSchema, HostedHeartbeatCoordinatorTaskListSchema,
|
|
1
|
+
export { HOSTED_HEARTBEAT_COORDINATOR_PATHS, HOSTED_HEARTBEAT_DELEGATIONS_PATH, HostedHeartbeatCoordinatorRunViewSchema, HostedHeartbeatCoordinatorStateResponseSchema, HostedHeartbeatCoordinatorStateSchema, HostedHeartbeatCoordinatorTaskDetailSchema, HostedHeartbeatCoordinatorTaskInputSchema, HostedHeartbeatCoordinatorTaskListSchema, HostedHeartbeatCoordinatorTaskResultSchema, HostedHeartbeatCoordinatorTaskStatusSchema, HostedHeartbeatCoordinatorTaskViewSchema, HostedHeartbeatDelegationAuthorizationSchema, HostedHeartbeatDelegationRequestSchema, HostedHeartbeatDelegationSchema, HostedHeartbeatDesiredTaskCatalogSchema, HostedHeartbeatDesiredTaskSchema, } from './contracts.js';
|
|
2
2
|
export { HostedHeartbeatCoordinatorClient, HostedHeartbeatCoordinatorRequestError, } from './hosted-heartbeat-coordinator-client.js';
|
|
3
3
|
export { HostedHeartbeatDelegatedExecutionTransport, HostedHeartbeatDelegationClient, HostedHeartbeatDelegationRequestError, } from './hosted-heartbeat-delegation-client.js';
|
|
4
4
|
export { HostedHeartbeatDelegationRejectedError, HostedHeartbeatDelegationService, } from './hosted-heartbeat-delegation-service.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/coordinator/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kCAAkC,EAClC,iCAAiC,EACjC,yCAAyC,EACzC,wCAAwC,EACxC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/coordinator/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kCAAkC,EAClC,iCAAiC,EACjC,uCAAuC,EACvC,6CAA6C,EAC7C,qCAAqC,EACrC,0CAA0C,EAC1C,yCAAyC,EACzC,wCAAwC,EACxC,0CAA0C,EAC1C,0CAA0C,EAC1C,wCAAwC,EACxC,4CAA4C,EAC5C,sCAAsC,EACtC,+BAA+B,EAC/B,uCAAuC,EACvC,gCAAgC,GACjC,MAAM,gBAAgB,CAAC;AAaxB,OAAO,EACL,gCAAgC,EAChC,sCAAsC,GACvC,MAAM,0CAA0C,CAAC;AAClD,OAAO,EACL,0CAA0C,EAC1C,+BAA+B,EAC/B,qCAAqC,GACtC,MAAM,yCAAyC,CAAC;AACjD,OAAO,EACL,sCAAsC,EACtC,gCAAgC,GACjC,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAAE,6BAA6B,EAAE,MAAM,uCAAuC,CAAC;AACtF,OAAO,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC","sourcesContent":["export {\n HOSTED_HEARTBEAT_COORDINATOR_PATHS,\n HOSTED_HEARTBEAT_DELEGATIONS_PATH,\n HostedHeartbeatCoordinatorRunViewSchema,\n HostedHeartbeatCoordinatorStateResponseSchema,\n HostedHeartbeatCoordinatorStateSchema,\n HostedHeartbeatCoordinatorTaskDetailSchema,\n HostedHeartbeatCoordinatorTaskInputSchema,\n HostedHeartbeatCoordinatorTaskListSchema,\n HostedHeartbeatCoordinatorTaskResultSchema,\n HostedHeartbeatCoordinatorTaskStatusSchema,\n HostedHeartbeatCoordinatorTaskViewSchema,\n HostedHeartbeatDelegationAuthorizationSchema,\n HostedHeartbeatDelegationRequestSchema,\n HostedHeartbeatDelegationSchema,\n HostedHeartbeatDesiredTaskCatalogSchema,\n HostedHeartbeatDesiredTaskSchema,\n} from './contracts.js';\nexport type {\n HostedHeartbeatCoordinatorTaskInput,\n HostedHeartbeatCoordinatorRunView,\n HostedHeartbeatCoordinatorState,\n HostedHeartbeatCoordinatorTaskDetail,\n HostedHeartbeatCoordinatorTaskView,\n HostedHeartbeatDelegation,\n HostedHeartbeatDelegationAuthorization,\n HostedHeartbeatDelegationRequest,\n HostedHeartbeatDesiredTask,\n HostedHeartbeatDesiredTaskCatalog,\n} from './contracts.js';\nexport {\n HostedHeartbeatCoordinatorClient,\n HostedHeartbeatCoordinatorRequestError,\n} from './hosted-heartbeat-coordinator-client.js';\nexport {\n HostedHeartbeatDelegatedExecutionTransport,\n HostedHeartbeatDelegationClient,\n HostedHeartbeatDelegationRequestError,\n} from './hosted-heartbeat-delegation-client.js';\nexport {\n HostedHeartbeatDelegationRejectedError,\n HostedHeartbeatDelegationService,\n} from './hosted-heartbeat-delegation-service.js';\nexport { HostedHeartbeatTaskReconciler } from './hosted-heartbeat-task-reconciler.js';\nexport { createHostedRuntimeSessionId } from './runtime-session.js';\nexport type {\n HostedHeartbeatCoordinatorClientConfig,\n HostedHeartbeatCoordinatorTaskApi,\n HostedHeartbeatDelegatedExecutionTransportConfig,\n HostedHeartbeatDelegatedExecutionTransportPort,\n HostedHeartbeatDelegationAuthorizationInput,\n HostedHeartbeatDelegationAuthorizer,\n HostedHeartbeatDelegationClientConfig,\n HostedHeartbeatDelegationIssuer,\n HostedHeartbeatDelegationServiceConfig,\n HostedHeartbeatTaskReconcilerConfig,\n HostedHeartbeatTaskReconciliation,\n HostedHeartbeatTaskReconciliationInput,\n} from './types.js';\n"]}
|
|
@@ -2,18 +2,22 @@ import type { ExecutionAuthorityIssuer } from '../authority/index.js';
|
|
|
2
2
|
import type { HostedModelCredentialProvider } from '../conversation/index.js';
|
|
3
3
|
import type { HostedHeartbeatAgentExecutionTransportInput } from '../heartbeat/index.js';
|
|
4
4
|
import type { HeartbeatExecutionHost } from '../http-sse/index.js';
|
|
5
|
-
import type { HostedHeartbeatCoordinatorTaskInput,
|
|
5
|
+
import type { HostedHeartbeatCoordinatorTaskInput, HostedHeartbeatCoordinatorState, HostedHeartbeatCoordinatorTaskDetail, HostedHeartbeatCoordinatorTaskView, HostedHeartbeatDelegation, HostedHeartbeatDelegationAuthorization, HostedHeartbeatDelegationRequest, HostedHeartbeatDesiredTask } from './contracts.js';
|
|
6
6
|
export type HostedHeartbeatCoordinatorClientConfig = {
|
|
7
7
|
baseUrl: URL;
|
|
8
8
|
apiToken: string;
|
|
9
9
|
fetch?: typeof globalThis.fetch;
|
|
10
10
|
};
|
|
11
11
|
export interface HostedHeartbeatCoordinatorTaskApi {
|
|
12
|
-
|
|
12
|
+
readState(signal?: AbortSignal): Promise<HostedHeartbeatCoordinatorState>;
|
|
13
|
+
listTasks(signal?: AbortSignal): Promise<HostedHeartbeatCoordinatorTaskView[]>;
|
|
14
|
+
readTask(taskId: string, signal?: AbortSignal): Promise<HostedHeartbeatCoordinatorTaskDetail>;
|
|
13
15
|
upsertTask(taskId: string, task: HostedHeartbeatCoordinatorTaskInput, signal?: AbortSignal): Promise<void>;
|
|
16
|
+
triggerTask(taskId: string, signal?: AbortSignal): Promise<HostedHeartbeatCoordinatorTaskView>;
|
|
14
17
|
deleteTask(taskId: string, signal?: AbortSignal): Promise<void>;
|
|
15
18
|
pause(signal?: AbortSignal): Promise<void>;
|
|
16
19
|
resume(signal?: AbortSignal): Promise<void>;
|
|
20
|
+
drain(signal?: AbortSignal): Promise<void>;
|
|
17
21
|
}
|
|
18
22
|
export type HostedHeartbeatTaskReconciliationInput = {
|
|
19
23
|
desiredTasks: readonly HostedHeartbeatDesiredTask[];
|
|
@@ -26,7 +30,7 @@ export type HostedHeartbeatTaskReconciliation = {
|
|
|
26
30
|
resumed: boolean;
|
|
27
31
|
};
|
|
28
32
|
export type HostedHeartbeatTaskReconcilerConfig = {
|
|
29
|
-
coordinator: HostedHeartbeatCoordinatorTaskApi
|
|
33
|
+
coordinator: Pick<HostedHeartbeatCoordinatorTaskApi, 'listTasks' | 'upsertTask' | 'deleteTask' | 'pause' | 'resume'>;
|
|
30
34
|
};
|
|
31
35
|
export type HostedHeartbeatDelegationAuthorizationInput = {
|
|
32
36
|
taskId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/coordinator/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,wBAAwB,EACzB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EACV,6BAA6B,EAC9B,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EACV,2CAA2C,EAC5C,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,KAAK,EACV,mCAAmC,EACnC,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/coordinator/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,wBAAwB,EACzB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EACV,6BAA6B,EAC9B,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EACV,2CAA2C,EAC5C,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,KAAK,EACV,mCAAmC,EACnC,+BAA+B,EAC/B,oCAAoC,EACpC,kCAAkC,EAClC,yBAAyB,EACzB,sCAAsC,E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gBAAgB,EAAE,6BAA6B,CAAC;CACjD,CAAC;AAEF,MAAM,WAAW,8CAA8C;IAC7D,OAAO,CACL,KAAK,EAAE,2CAA2C,GACjD,OAAO,CAAC,OAAO,CAAC,CAAC;CACrB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/coordinator/types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n ExecutionAuthorityIssuer,\n} from '../authority/index.js';\nimport type {\n HostedModelCredentialProvider,\n} from '../conversation/index.js';\nimport type {\n HostedHeartbeatAgentExecutionTransportInput,\n} from '../heartbeat/index.js';\nimport type { HeartbeatExecutionHost } from '../http-sse/index.js';\nimport type {\n HostedHeartbeatCoordinatorTaskInput,\n
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/coordinator/types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n ExecutionAuthorityIssuer,\n} from '../authority/index.js';\nimport type {\n HostedModelCredentialProvider,\n} from '../conversation/index.js';\nimport type {\n HostedHeartbeatAgentExecutionTransportInput,\n} from '../heartbeat/index.js';\nimport type { HeartbeatExecutionHost } from '../http-sse/index.js';\nimport type {\n HostedHeartbeatCoordinatorTaskInput,\n HostedHeartbeatCoordinatorState,\n HostedHeartbeatCoordinatorTaskDetail,\n HostedHeartbeatCoordinatorTaskView,\n HostedHeartbeatDelegation,\n HostedHeartbeatDelegationAuthorization,\n HostedHeartbeatDelegationRequest,\n HostedHeartbeatDesiredTask,\n} from './contracts.js';\n\nexport type HostedHeartbeatCoordinatorClientConfig = {\n baseUrl: URL;\n apiToken: string;\n fetch?: typeof globalThis.fetch;\n};\n\nexport interface HostedHeartbeatCoordinatorTaskApi {\n readState(signal?: AbortSignal): Promise<HostedHeartbeatCoordinatorState>;\n listTasks(\n signal?: AbortSignal,\n ): Promise<HostedHeartbeatCoordinatorTaskView[]>;\n readTask(\n taskId: string,\n signal?: AbortSignal,\n ): Promise<HostedHeartbeatCoordinatorTaskDetail>;\n upsertTask(\n taskId: string,\n task: HostedHeartbeatCoordinatorTaskInput,\n signal?: AbortSignal,\n ): Promise<void>;\n triggerTask(\n taskId: string,\n signal?: AbortSignal,\n ): Promise<HostedHeartbeatCoordinatorTaskView>;\n deleteTask(taskId: string, signal?: AbortSignal): Promise<void>;\n pause(signal?: AbortSignal): Promise<void>;\n resume(signal?: AbortSignal): Promise<void>;\n drain(signal?: AbortSignal): Promise<void>;\n}\n\nexport type HostedHeartbeatTaskReconciliationInput = {\n desiredTasks: readonly HostedHeartbeatDesiredTask[];\n resume: boolean;\n signal?: AbortSignal;\n};\n\nexport type HostedHeartbeatTaskReconciliation = {\n deleted: number;\n upserted: number;\n resumed: boolean;\n};\n\nexport type HostedHeartbeatTaskReconcilerConfig = {\n coordinator: Pick<\n HostedHeartbeatCoordinatorTaskApi,\n 'listTasks' | 'upsertTask' | 'deleteTask' | 'pause' | 'resume'\n >;\n};\n\nexport type HostedHeartbeatDelegationAuthorizationInput = {\n taskId: string;\n executionId: string;\n signal: AbortSignal;\n};\n\nexport interface HostedHeartbeatDelegationAuthorizer {\n authorize(\n input: HostedHeartbeatDelegationAuthorizationInput,\n ): HostedHeartbeatDelegationAuthorization\n | undefined\n | Promise<HostedHeartbeatDelegationAuthorization | undefined>;\n}\n\nexport type HostedHeartbeatDelegationServiceConfig = {\n authority: ExecutionAuthorityIssuer;\n authorizer: HostedHeartbeatDelegationAuthorizer;\n runtimeSessionNamespace: string;\n maxExecutionMs: number;\n now?: () => Date;\n};\n\nexport interface HostedHeartbeatDelegationIssuer {\n issue(\n input: HostedHeartbeatDelegationRequest,\n signal?: AbortSignal,\n ): Promise<HostedHeartbeatDelegation>;\n}\n\nexport type HostedHeartbeatDelegationClientConfig = {\n baseUrl: URL;\n apiToken: string;\n fetch?: typeof globalThis.fetch;\n path?: string;\n};\n\nexport type HostedHeartbeatDelegatedExecutionTransportConfig = {\n delegations: HostedHeartbeatDelegationIssuer;\n executionHost: HeartbeatExecutionHost;\n modelCredentials: HostedModelCredentialProvider;\n};\n\nexport interface HostedHeartbeatDelegatedExecutionTransportPort {\n execute(\n input: HostedHeartbeatAgentExecutionTransportInput,\n ): Promise<unknown>;\n}\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { JwtVerificationUnavailableCategory } from '../internal/jwt-verification.js';
|
|
2
|
+
export declare class ExecutionIdentityVerificationError extends Error {
|
|
3
|
+
readonly name = "ExecutionIdentityVerificationError";
|
|
4
|
+
constructor(options?: ErrorOptions);
|
|
5
|
+
}
|
|
6
|
+
export declare class ExecutionIdentityUnavailableError extends Error {
|
|
7
|
+
readonly category: JwtVerificationUnavailableCategory;
|
|
8
|
+
readonly name = "ExecutionIdentityUnavailableError";
|
|
9
|
+
constructor(category: JwtVerificationUnavailableCategory, options?: ErrorOptions);
|
|
10
|
+
}
|
|
11
|
+
export declare class ExecutionHostMcpCapabilityVerificationError extends Error {
|
|
12
|
+
readonly name = "ExecutionHostMcpCapabilityVerificationError";
|
|
13
|
+
constructor(options?: ErrorOptions);
|
|
14
|
+
}
|
|
15
|
+
export declare class ExecutionHostMcpCapabilityUnavailableError extends Error {
|
|
16
|
+
readonly category: JwtVerificationUnavailableCategory;
|
|
17
|
+
readonly name = "ExecutionHostMcpCapabilityUnavailableError";
|
|
18
|
+
constructor(category: JwtVerificationUnavailableCategory, options?: ErrorOptions);
|
|
19
|
+
}
|
|
20
|
+
export declare class UnexpectedExecutionHostMcpCapabilityError extends Error {
|
|
21
|
+
readonly name = "UnexpectedExecutionHostMcpCapabilityError";
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/host/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kCAAkC,EAAE,MAAM,iCAAiC,CAAC;AAE1F,qBAAa,kCAAmC,SAAQ,KAAK;IAC3D,QAAQ,CAAC,IAAI,wCAAwC;gBAEzC,OAAO,CAAC,EAAE,YAAY;CAGnC;AAED,qBAAa,iCAAkC,SAAQ,KAAK;IAIxD,QAAQ,CAAC,QAAQ,EAAE,kCAAkC;IAHvD,QAAQ,CAAC,IAAI,uCAAuC;gBAGzC,QAAQ,EAAE,kCAAkC,EACrD,OAAO,CAAC,EAAE,YAAY;CAIzB;AAED,qBAAa,2CAA4C,SAAQ,KAAK;IACpE,QAAQ,CAAC,IAAI,iDAAiD;gBAElD,OAAO,CAAC,EAAE,YAAY;CAGnC;AAED,qBAAa,0CAA2C,SAAQ,KAAK;IAIjE,QAAQ,CAAC,QAAQ,EAAE,kCAAkC;IAHvD,QAAQ,CAAC,IAAI,gDAAgD;gBAGlD,QAAQ,EAAE,kCAAkC,EACrD,OAAO,CAAC,EAAE,YAAY;CAIzB;AAED,qBAAa,yCAA0C,SAAQ,KAAK;IAClE,QAAQ,CAAC,IAAI,+CAA+C;CAC7D"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export class ExecutionIdentityVerificationError extends Error {
|
|
2
|
+
name = 'ExecutionIdentityVerificationError';
|
|
3
|
+
constructor(options) {
|
|
4
|
+
super('Execution identity verification failed.', options);
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
export class ExecutionIdentityUnavailableError extends Error {
|
|
8
|
+
category;
|
|
9
|
+
name = 'ExecutionIdentityUnavailableError';
|
|
10
|
+
constructor(category, options) {
|
|
11
|
+
super('Execution identity verification is temporarily unavailable.', options);
|
|
12
|
+
this.category = category;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export class ExecutionHostMcpCapabilityVerificationError extends Error {
|
|
16
|
+
name = 'ExecutionHostMcpCapabilityVerificationError';
|
|
17
|
+
constructor(options) {
|
|
18
|
+
super('MCP capability verification failed.', options);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export class ExecutionHostMcpCapabilityUnavailableError extends Error {
|
|
22
|
+
category;
|
|
23
|
+
name = 'ExecutionHostMcpCapabilityUnavailableError';
|
|
24
|
+
constructor(category, options) {
|
|
25
|
+
super('MCP capability verification is temporarily unavailable.', options);
|
|
26
|
+
this.category = category;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
export class UnexpectedExecutionHostMcpCapabilityError extends Error {
|
|
30
|
+
name = 'UnexpectedExecutionHostMcpCapabilityError';
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/host/errors.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,kCAAmC,SAAQ,KAAK;IAClD,IAAI,GAAG,oCAAoC,CAAC;IAErD,YAAY,OAAsB;QAChC,KAAK,CAAC,yCAAyC,EAAE,OAAO,CAAC,CAAC;IAC5D,CAAC;CACF;AAED,MAAM,OAAO,iCAAkC,SAAQ,KAAK;IAI/C;IAHF,IAAI,GAAG,mCAAmC,CAAC;IAEpD,YACW,QAA4C,EACrD,OAAsB;QAEtB,KAAK,CAAC,6DAA6D,EAAE,OAAO,CAAC,CAAC;QAHrE,aAAQ,GAAR,QAAQ,CAAoC;IAIvD,CAAC;CACF;AAED,MAAM,OAAO,2CAA4C,SAAQ,KAAK;IAC3D,IAAI,GAAG,6CAA6C,CAAC;IAE9D,YAAY,OAAsB;QAChC,KAAK,CAAC,qCAAqC,EAAE,OAAO,CAAC,CAAC;IACxD,CAAC;CACF;AAED,MAAM,OAAO,0CAA2C,SAAQ,KAAK;IAIxD;IAHF,IAAI,GAAG,4CAA4C,CAAC;IAE7D,YACW,QAA4C,EACrD,OAAsB;QAEtB,KAAK,CAAC,yDAAyD,EAAE,OAAO,CAAC,CAAC;QAHjE,aAAQ,GAAR,QAAQ,CAAoC;IAIvD,CAAC;CACF;AAED,MAAM,OAAO,yCAA0C,SAAQ,KAAK;IACzD,IAAI,GAAG,2CAA2C,CAAC;CAC7D","sourcesContent":["import type { JwtVerificationUnavailableCategory } from '../internal/jwt-verification.js';\n\nexport class ExecutionIdentityVerificationError extends Error {\n readonly name = 'ExecutionIdentityVerificationError';\n\n constructor(options?: ErrorOptions) {\n super('Execution identity verification failed.', options);\n }\n}\n\nexport class ExecutionIdentityUnavailableError extends Error {\n readonly name = 'ExecutionIdentityUnavailableError';\n\n constructor(\n readonly category: JwtVerificationUnavailableCategory,\n options?: ErrorOptions,\n ) {\n super('Execution identity verification is temporarily unavailable.', options);\n }\n}\n\nexport class ExecutionHostMcpCapabilityVerificationError extends Error {\n readonly name = 'ExecutionHostMcpCapabilityVerificationError';\n\n constructor(options?: ErrorOptions) {\n super('MCP capability verification failed.', options);\n }\n}\n\nexport class ExecutionHostMcpCapabilityUnavailableError extends Error {\n readonly name = 'ExecutionHostMcpCapabilityUnavailableError';\n\n constructor(\n readonly category: JwtVerificationUnavailableCategory,\n options?: ErrorOptions,\n ) {\n super('MCP capability verification is temporarily unavailable.', options);\n }\n}\n\nexport class UnexpectedExecutionHostMcpCapabilityError extends Error {\n readonly name = 'UnexpectedExecutionHostMcpCapabilityError';\n}\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { ExecutionHostMcpCapabilityUnavailableError, ExecutionHostMcpCapabilityVerificationError, ExecutionIdentityUnavailableError, ExecutionIdentityVerificationError, UnexpectedExecutionHostMcpCapabilityError, } from './errors.js';
|
|
2
|
+
export { JwtExecutionIdentityVerifier } from './jwt-execution-identity-verifier.js';
|
|
3
|
+
export { JwtExecutionHostMcpCapabilityVerifier } from './jwt-execution-host-mcp-capability-verifier.js';
|
|
4
|
+
export { ExecutionHostJwtAlgorithmsSchema, JwtExecutionHostMcpCapabilityVerifierConfigSchema, JwtExecutionIdentityVerifierConfigSchema, } from './schemas.js';
|
|
5
|
+
export { EXECUTION_HOST_SUPPORTED_JWT_ALGORITHMS, } from './types.js';
|
|
6
|
+
export type { ExecutionHostJwtAlgorithm, ExecutionHostJwtVerifierOptions, ExecutionHostMcpCapabilityVerificationRequest, ExecutionHostMcpCapabilityVerifier, ExecutionIdentityVerificationRequest, ExecutionIdentityVerifier, JwtExecutionHostMcpCapabilityVerifierConfig, JwtExecutionIdentityVerifierConfig, VerifiedExecutionHostMcpCapability, VerifiedExecutionIdentity, } from './types.js';
|
|
7
|
+
export * from './runtime-session/index.js';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/host/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,0CAA0C,EAC1C,2CAA2C,EAC3C,iCAAiC,EACjC,kCAAkC,EAClC,yCAAyC,GAC1C,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,4BAA4B,EAAE,MAAM,sCAAsC,CAAC;AACpF,OAAO,EAAE,qCAAqC,EAAE,MAAM,iDAAiD,CAAC;AACxG,OAAO,EACL,gCAAgC,EAChC,iDAAiD,EACjD,wCAAwC,GACzC,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,uCAAuC,GACxC,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,yBAAyB,EACzB,+BAA+B,EAC/B,6CAA6C,EAC7C,kCAAkC,EAClC,oCAAoC,EACpC,yBAAyB,EACzB,2CAA2C,EAC3C,kCAAkC,EAClC,kCAAkC,EAClC,yBAAyB,GAC1B,MAAM,YAAY,CAAC;AACpB,cAAc,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { ExecutionHostMcpCapabilityUnavailableError, ExecutionHostMcpCapabilityVerificationError, ExecutionIdentityUnavailableError, ExecutionIdentityVerificationError, UnexpectedExecutionHostMcpCapabilityError, } from './errors.js';
|
|
2
|
+
export { JwtExecutionIdentityVerifier } from './jwt-execution-identity-verifier.js';
|
|
3
|
+
export { JwtExecutionHostMcpCapabilityVerifier } from './jwt-execution-host-mcp-capability-verifier.js';
|
|
4
|
+
export { ExecutionHostJwtAlgorithmsSchema, JwtExecutionHostMcpCapabilityVerifierConfigSchema, JwtExecutionIdentityVerifierConfigSchema, } from './schemas.js';
|
|
5
|
+
export { EXECUTION_HOST_SUPPORTED_JWT_ALGORITHMS, } from './types.js';
|
|
6
|
+
export * from './runtime-session/index.js';
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/host/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,0CAA0C,EAC1C,2CAA2C,EAC3C,iCAAiC,EACjC,kCAAkC,EAClC,yCAAyC,GAC1C,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,4BAA4B,EAAE,MAAM,sCAAsC,CAAC;AACpF,OAAO,EAAE,qCAAqC,EAAE,MAAM,iDAAiD,CAAC;AACxG,OAAO,EACL,gCAAgC,EAChC,iDAAiD,EACjD,wCAAwC,GACzC,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,uCAAuC,GACxC,MAAM,YAAY,CAAC;AAapB,cAAc,4BAA4B,CAAC","sourcesContent":["export {\n ExecutionHostMcpCapabilityUnavailableError,\n ExecutionHostMcpCapabilityVerificationError,\n ExecutionIdentityUnavailableError,\n ExecutionIdentityVerificationError,\n UnexpectedExecutionHostMcpCapabilityError,\n} from './errors.js';\nexport { JwtExecutionIdentityVerifier } from './jwt-execution-identity-verifier.js';\nexport { JwtExecutionHostMcpCapabilityVerifier } from './jwt-execution-host-mcp-capability-verifier.js';\nexport {\n ExecutionHostJwtAlgorithmsSchema,\n JwtExecutionHostMcpCapabilityVerifierConfigSchema,\n JwtExecutionIdentityVerifierConfigSchema,\n} from './schemas.js';\nexport {\n EXECUTION_HOST_SUPPORTED_JWT_ALGORITHMS,\n} from './types.js';\nexport type {\n ExecutionHostJwtAlgorithm,\n ExecutionHostJwtVerifierOptions,\n ExecutionHostMcpCapabilityVerificationRequest,\n ExecutionHostMcpCapabilityVerifier,\n ExecutionIdentityVerificationRequest,\n ExecutionIdentityVerifier,\n JwtExecutionHostMcpCapabilityVerifierConfig,\n JwtExecutionIdentityVerifierConfig,\n VerifiedExecutionHostMcpCapability,\n VerifiedExecutionIdentity,\n} from './types.js';\nexport * from './runtime-session/index.js';\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ExecutionHostJwtVerifierOptions, ExecutionHostMcpCapabilityVerificationRequest, ExecutionHostMcpCapabilityVerifier, JwtExecutionHostMcpCapabilityVerifierConfig, VerifiedExecutionHostMcpCapability } from './types.js';
|
|
2
|
+
/** Verifies MCP authority against an independently verified host invocation. */
|
|
3
|
+
export declare class JwtExecutionHostMcpCapabilityVerifier implements ExecutionHostMcpCapabilityVerifier {
|
|
4
|
+
#private;
|
|
5
|
+
constructor(config: JwtExecutionHostMcpCapabilityVerifierConfig, options?: ExecutionHostJwtVerifierOptions);
|
|
6
|
+
verify(rawRequest: ExecutionHostMcpCapabilityVerificationRequest): Promise<VerifiedExecutionHostMcpCapability>;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=jwt-execution-host-mcp-capability-verifier.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jwt-execution-host-mcp-capability-verifier.d.ts","sourceRoot":"","sources":["../../src/host/jwt-execution-host-mcp-capability-verifier.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EACV,+BAA+B,EAC/B,6CAA6C,EAC7C,kCAAkC,EAClC,2CAA2C,EAC3C,kCAAkC,EACnC,MAAM,YAAY,CAAC;AAOpB,gFAAgF;AAChF,qBAAa,qCACb,YAAW,kCAAkC;;gBAMzC,MAAM,EAAE,2CAA2C,EACnD,OAAO,GAAE,+BAAoC;IAczC,MAAM,CACV,UAAU,EAAE,6CAA6C,GACxD,OAAO,CAAC,kCAAkC,CAAC;CAkF/C"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { jwtVerify } from 'jose';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { MCP_CAPABILITY_TYPE, McpCapabilityClaimsSchema, } from '../contracts/index.js';
|
|
4
|
+
import { createJwtKeyResolver, resolveJwtVerificationUnavailableCategory, } from '../internal/jwt-verification.js';
|
|
5
|
+
import { ExecutionHostMcpCapabilityUnavailableError, ExecutionHostMcpCapabilityVerificationError, } from './errors.js';
|
|
6
|
+
import { JwtExecutionHostMcpCapabilityVerifierConfigSchema } from './schemas.js';
|
|
7
|
+
const AssertionSchema = z.string().trim().min(32).max(4_096);
|
|
8
|
+
/** Verifies MCP authority against an independently verified host invocation. */
|
|
9
|
+
export class JwtExecutionHostMcpCapabilityVerifier {
|
|
10
|
+
#config;
|
|
11
|
+
#keyResolver;
|
|
12
|
+
#now;
|
|
13
|
+
constructor(config, options = {}) {
|
|
14
|
+
const parsed = JwtExecutionHostMcpCapabilityVerifierConfigSchema.parse(config);
|
|
15
|
+
this.#config = Object.freeze({
|
|
16
|
+
...parsed,
|
|
17
|
+
jwksUrl: new URL(parsed.jwksUrl),
|
|
18
|
+
});
|
|
19
|
+
this.#keyResolver = options.keyResolver
|
|
20
|
+
?? createJwtKeyResolver(this.#config.jwksUrl);
|
|
21
|
+
this.#now = options.now ?? (() => new Date());
|
|
22
|
+
}
|
|
23
|
+
async verify(rawRequest) {
|
|
24
|
+
try {
|
|
25
|
+
const request = Object.freeze({
|
|
26
|
+
...rawRequest,
|
|
27
|
+
assertion: AssertionSchema.parse(rawRequest.assertion),
|
|
28
|
+
});
|
|
29
|
+
const { payload } = await jwtVerify(request.assertion, this.#keyResolver, {
|
|
30
|
+
algorithms: [...this.#config.jwtAlgorithms],
|
|
31
|
+
audience: this.#config.audience,
|
|
32
|
+
clockTolerance: this.#config.clockToleranceSeconds,
|
|
33
|
+
currentDate: this.#now(),
|
|
34
|
+
issuer: this.#config.issuer,
|
|
35
|
+
maxTokenAge: this.#config.maxCapabilityAgeSeconds,
|
|
36
|
+
requiredClaims: ['exp', 'iat', 'jti', 'sub'],
|
|
37
|
+
typ: MCP_CAPABILITY_TYPE,
|
|
38
|
+
});
|
|
39
|
+
const claims = McpCapabilityClaimsSchema.parse(payload);
|
|
40
|
+
this.#assertInvocationBinding(claims, request);
|
|
41
|
+
this.#assertBoundedLifetime(claims);
|
|
42
|
+
return Object.freeze({
|
|
43
|
+
assertion: request.assertion,
|
|
44
|
+
capabilityId: claims.jti,
|
|
45
|
+
serverId: claims.serverId,
|
|
46
|
+
allowedTools: Object.freeze([...claims.allowedTools]),
|
|
47
|
+
issuedAt: new Date(claims.iat * 1_000).toISOString(),
|
|
48
|
+
expiresAt: new Date(claims.exp * 1_000).toISOString(),
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
if (error instanceof ExecutionHostMcpCapabilityVerificationError
|
|
53
|
+
|| error instanceof ExecutionHostMcpCapabilityUnavailableError) {
|
|
54
|
+
throw error;
|
|
55
|
+
}
|
|
56
|
+
const category = resolveJwtVerificationUnavailableCategory(error);
|
|
57
|
+
if (category) {
|
|
58
|
+
throw new ExecutionHostMcpCapabilityUnavailableError(category, { cause: error });
|
|
59
|
+
}
|
|
60
|
+
throw new ExecutionHostMcpCapabilityVerificationError({ cause: error });
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
#assertInvocationBinding(claims, request) {
|
|
64
|
+
const { identity } = request;
|
|
65
|
+
if (claims.adopterId !== this.#config.trustedAdopterId
|
|
66
|
+
|| claims.adopterId !== identity.scope.adopterId
|
|
67
|
+
|| claims.tenantId !== identity.scope.tenantId
|
|
68
|
+
|| claims.sub !== identity.scope.subjectId
|
|
69
|
+
|| claims.productSessionId !== identity.scope.productSessionId
|
|
70
|
+
|| claims.runtimeSessionId !== identity.runtimeSessionId
|
|
71
|
+
|| claims.invocationId !== identity.invocationId
|
|
72
|
+
|| claims.workflow !== identity.workflow
|
|
73
|
+
|| claims.serverId !== this.#config.serverId
|
|
74
|
+
|| claims.jti === identity.invocationId) {
|
|
75
|
+
throw new ExecutionHostMcpCapabilityVerificationError();
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
#assertBoundedLifetime(claims) {
|
|
79
|
+
const lifetimeSeconds = claims.exp - claims.iat;
|
|
80
|
+
if (lifetimeSeconds <= 0
|
|
81
|
+
|| lifetimeSeconds > this.#config.maxCapabilityAgeSeconds) {
|
|
82
|
+
throw new ExecutionHostMcpCapabilityVerificationError();
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=jwt-execution-host-mcp-capability-verifier.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jwt-execution-host-mcp-capability-verifier.js","sourceRoot":"","sources":["../../src/host/jwt-execution-host-mcp-capability-verifier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AACjC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,mBAAmB,EACnB,yBAAyB,GAC1B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,oBAAoB,EACpB,yCAAyC,GAC1C,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,0CAA0C,EAC1C,2CAA2C,GAC5C,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,iDAAiD,EAAE,MAAM,cAAc,CAAC;AASjF,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AAK7D,gFAAgF;AAChF,MAAM,OAAO,qCAAqC;IAEvC,OAAO,CAAyB;IAChC,YAAY,CAA8D;IAC1E,IAAI,CAAa;IAE1B,YACE,MAAmD,EACnD,UAA2C,EAAE;QAE7C,MAAM,MAAM,GAAG,iDAAiD,CAAC,KAAK,CACpE,MAAM,CACP,CAAC;QACF,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC;YAC3B,GAAG,MAAM;YACT,O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gBAAgB,KAAK,QAAQ,CAAC,KAAK,CAAC,gBAAgB;eAC3D,MAAM,CAAC,gBAAgB,KAAK,QAAQ,CAAC,gBAAgB;eACrD,MAAM,CAAC,YAAY,KAAK,QAAQ,CAAC,YAAY;eAC7C,MAAM,CAAC,QAAQ,KAAK,QAAQ,CAAC,QAAQ;eACrC,MAAM,CAAC,QAAQ,KAAK,IAAI,CAAC,OAAO,CAAC,QAAQ;eACzC,MAAM,CAAC,GAAG,KAAK,QAAQ,CAAC,YAAY,EACvC,CAAC;YACD,MAAM,IAAI,2CAA2C,EAAE,CAAC;QAC1D,CAAC;IACH,CAAC;IAED,sBAAsB,CACpB,MAAiD;QAEjD,MAAM,eAAe,GAAG,MAAM,CAAC,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC;QAChD,IACE,eAAe,IAAI,CAAC;eACjB,eAAe,GAAG,IAAI,CAAC,OAAO,CAAC,uBAAuB,EACzD,CAAC;YACD,MAAM,IAAI,2CAA2C,EAAE,CAAC;QAC1D,CAAC;IACH,CAAC;CACF","sourcesContent":["import { jwtVerify } from 'jose';\nimport { z } from 'zod';\nimport {\n MCP_CAPABILITY_TYPE,\n McpCapabilityClaimsSchema,\n} from '../contracts/index.js';\nimport {\n createJwtKeyResolver,\n resolveJwtVerificationUnavailableCategory,\n} from '../internal/jwt-verification.js';\nimport {\n ExecutionHostMcpCapabilityUnavailableError,\n ExecutionHostMcpCapabilityVerificationError,\n} from './errors.js';\nimport { JwtExecutionHostMcpCapabilityVerifierConfigSchema } from './schemas.js';\nimport type {\n ExecutionHostJwtVerifierOptions,\n ExecutionHostMcpCapabilityVerificationRequest,\n ExecutionHostMcpCapabilityVerifier,\n JwtExecutionHostMcpCapabilityVerifierConfig,\n VerifiedExecutionHostMcpCapability,\n} from './types.js';\n\nconst AssertionSchema = z.string().trim().min(32).max(4_096);\ntype ParsedConfig = z.infer<\n typeof JwtExecutionHostMcpCapabilityVerifierConfigSchema\n>;\n\n/** Verifies MCP authority against an independently verified host invocation. */\nexport class JwtExecutionHostMcpCapabilityVerifier\nimplements ExecutionHostMcpCapabilityVerifier {\n readonly #config: Readonly<ParsedConfig>;\n readonly #keyResolver: NonNullable<ExecutionHostJwtVerifierOptions['keyResolver']>;\n readonly #now: () => Date;\n\n constructor(\n config: JwtExecutionHostMcpCapabilityVerifierConfig,\n options: ExecutionHostJwtVerifierOptions = {},\n ) {\n const parsed = JwtExecutionHostMcpCapabilityVerifierConfigSchema.parse(\n config,\n );\n this.#config = Object.freeze({\n ...parsed,\n jwksUrl: new URL(parsed.jwksUrl),\n });\n this.#keyResolver = options.keyResolver\n ?? createJwtKeyResolver(this.#config.jwksUrl);\n this.#now = options.now ?? (() => new Date());\n }\n\n async verify(\n rawRequest: ExecutionHostMcpCapabilityVerificationRequest,\n ): Promise<VerifiedExecutionHostMcpCapability> {\n try {\n const request = Object.freeze({\n ...rawRequest,\n assertion: AssertionSchema.parse(rawRequest.assertion),\n });\n const { payload } = await jwtVerify(\n request.assertion,\n this.#keyResolver,\n {\n algorithms: [...this.#config.jwtAlgorithms],\n audience: this.#config.audience,\n clockTolerance: this.#config.clockToleranceSeconds,\n currentDate: this.#now(),\n issuer: this.#config.issuer,\n maxTokenAge: this.#config.maxCapabilityAgeSeconds,\n requiredClaims: ['exp', 'iat', 'jti', 'sub'],\n typ: MCP_CAPABILITY_TYPE,\n },\n );\n const claims = McpCapabilityClaimsSchema.parse(payload);\n this.#assertInvocationBinding(claims, request);\n this.#assertBoundedLifetime(claims);\n\n return Object.freeze({\n assertion: request.assertion,\n capabilityId: claims.jti,\n serverId: claims.serverId,\n allowedTools: Object.freeze([...claims.allowedTools]),\n issuedAt: new Date(claims.iat * 1_000).toISOString(),\n expiresAt: new Date(claims.exp * 1_000).toISOString(),\n });\n } catch (error) {\n if (\n error instanceof ExecutionHostMcpCapabilityVerificationError\n || error instanceof ExecutionHostMcpCapabilityUnavailableError\n ) {\n throw error;\n }\n const category = resolveJwtVerificationUnavailableCategory(error);\n if (category) {\n throw new ExecutionHostMcpCapabilityUnavailableError(\n category,\n { cause: error },\n );\n }\n throw new ExecutionHostMcpCapabilityVerificationError({ cause: error });\n }\n }\n\n #assertInvocationBinding(\n claims: z.infer<typeof McpCapabilityClaimsSchema>,\n request: ExecutionHostMcpCapabilityVerificationRequest,\n ): void {\n const { identity } = request;\n if (\n claims.adopterId !== this.#config.trustedAdopterId\n || claims.adopterId !== identity.scope.adopterId\n || claims.tenantId !== identity.scope.tenantId\n || claims.sub !== identity.scope.subjectId\n || claims.productSessionId !== identity.scope.productSessionId\n || claims.runtimeSessionId !== identity.runtimeSessionId\n || claims.invocationId !== identity.invocationId\n || claims.workflow !== identity.workflow\n || claims.serverId !== this.#config.serverId\n || claims.jti === identity.invocationId\n ) {\n throw new ExecutionHostMcpCapabilityVerificationError();\n }\n }\n\n #assertBoundedLifetime(\n claims: z.infer<typeof McpCapabilityClaimsSchema>,\n ): void {\n const lifetimeSeconds = claims.exp - claims.iat;\n if (\n lifetimeSeconds <= 0\n || lifetimeSeconds > this.#config.maxCapabilityAgeSeconds\n ) {\n throw new ExecutionHostMcpCapabilityVerificationError();\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ExecutionIdentityVerificationRequest, ExecutionIdentityVerifier, ExecutionHostJwtVerifierOptions, JwtExecutionIdentityVerifierConfig, VerifiedExecutionIdentity } from './types.js';
|
|
2
|
+
/** Verifies adopter authority and binds it to one exact host invocation. */
|
|
3
|
+
export declare class JwtExecutionIdentityVerifier implements ExecutionIdentityVerifier {
|
|
4
|
+
#private;
|
|
5
|
+
constructor(config: JwtExecutionIdentityVerifierConfig, options?: ExecutionHostJwtVerifierOptions);
|
|
6
|
+
verify(rawRequest: ExecutionIdentityVerificationRequest): Promise<VerifiedExecutionIdentity>;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=jwt-execution-identity-verifier.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jwt-execution-identity-verifier.d.ts","sourceRoot":"","sources":["../../src/host/jwt-execution-identity-verifier.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EACV,oCAAoC,EACpC,yBAAyB,EACzB,+BAA+B,EAC/B,kCAAkC,EAClC,yBAAyB,EAC1B,MAAM,YAAY,CAAC;AAKpB,4EAA4E;AAC5E,qBAAa,4BAA6B,YAAW,yBAAyB;;gBAM1E,MAAM,EAAE,kCAAkC,EAC1C,OAAO,GAAE,+BAAoC;IAYzC,MAAM,CACV,UAAU,EAAE,oCAAoC,GAC/C,OAAO,CAAC,yBAAyB,CAAC;CAgEtC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { jwtVerify } from 'jose';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { EXECUTION_ASSERTION_TYPE, ExecutionAssertionClaimsSchema, } from '../contracts/index.js';
|
|
4
|
+
import { createJwtKeyResolver, resolveJwtVerificationUnavailableCategory, } from '../internal/jwt-verification.js';
|
|
5
|
+
import { ExecutionIdentityUnavailableError, ExecutionIdentityVerificationError, } from './errors.js';
|
|
6
|
+
import { JwtExecutionIdentityVerifierConfigSchema } from './schemas.js';
|
|
7
|
+
const AssertionSchema = z.string().trim().min(32).max(4_096);
|
|
8
|
+
/** Verifies adopter authority and binds it to one exact host invocation. */
|
|
9
|
+
export class JwtExecutionIdentityVerifier {
|
|
10
|
+
#config;
|
|
11
|
+
#keyResolver;
|
|
12
|
+
#now;
|
|
13
|
+
constructor(config, options = {}) {
|
|
14
|
+
const parsed = JwtExecutionIdentityVerifierConfigSchema.parse(config);
|
|
15
|
+
this.#config = Object.freeze({
|
|
16
|
+
...parsed,
|
|
17
|
+
executionJwksUrl: new URL(parsed.executionJwksUrl),
|
|
18
|
+
});
|
|
19
|
+
this.#keyResolver = options.keyResolver
|
|
20
|
+
?? createJwtKeyResolver(this.#config.executionJwksUrl);
|
|
21
|
+
this.#now = options.now ?? (() => new Date());
|
|
22
|
+
}
|
|
23
|
+
async verify(rawRequest) {
|
|
24
|
+
try {
|
|
25
|
+
const request = Object.freeze({
|
|
26
|
+
...rawRequest,
|
|
27
|
+
assertion: AssertionSchema.parse(rawRequest.assertion),
|
|
28
|
+
});
|
|
29
|
+
const { payload } = await jwtVerify(request.assertion, this.#keyResolver, {
|
|
30
|
+
algorithms: [...this.#config.executionJwtAlgorithms],
|
|
31
|
+
audience: this.#config.executionAudience,
|
|
32
|
+
clockTolerance: this.#config.assertionClockToleranceSeconds,
|
|
33
|
+
currentDate: this.#now(),
|
|
34
|
+
issuer: this.#config.executionIssuer,
|
|
35
|
+
maxTokenAge: this.#config.maxAssertionAgeSeconds,
|
|
36
|
+
requiredClaims: ['exp', 'iat', 'jti', 'sub'],
|
|
37
|
+
typ: EXECUTION_ASSERTION_TYPE,
|
|
38
|
+
});
|
|
39
|
+
const claims = ExecutionAssertionClaimsSchema.parse(payload);
|
|
40
|
+
this.#assertRequestBinding(claims, request);
|
|
41
|
+
return Object.freeze({
|
|
42
|
+
scope: Object.freeze({
|
|
43
|
+
adopterId: claims.adopterId,
|
|
44
|
+
tenantId: claims.tenantId,
|
|
45
|
+
subjectId: claims.sub,
|
|
46
|
+
productSessionId: claims.productSessionId,
|
|
47
|
+
}),
|
|
48
|
+
runtimeSessionId: claims.runtimeSessionId,
|
|
49
|
+
invocationId: claims.jti,
|
|
50
|
+
workflow: claims.workflow,
|
|
51
|
+
issuedAt: new Date(claims.iat * 1_000).toISOString(),
|
|
52
|
+
expiresAt: new Date(claims.exp * 1_000).toISOString(),
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
if (error instanceof ExecutionIdentityVerificationError
|
|
57
|
+
|| error instanceof ExecutionIdentityUnavailableError) {
|
|
58
|
+
throw error;
|
|
59
|
+
}
|
|
60
|
+
const category = resolveJwtVerificationUnavailableCategory(error);
|
|
61
|
+
if (category) {
|
|
62
|
+
throw new ExecutionIdentityUnavailableError(category, { cause: error });
|
|
63
|
+
}
|
|
64
|
+
throw new ExecutionIdentityVerificationError({ cause: error });
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
#assertRequestBinding(claims, request) {
|
|
68
|
+
if (claims.adopterId !== this.#config.trustedAdopterId
|
|
69
|
+
|| claims.runtimeSessionId !== request.runtimeSessionId
|
|
70
|
+
|| claims.jti !== request.invocationId
|
|
71
|
+
|| claims.workflow !== request.workflow) {
|
|
72
|
+
throw new ExecutionIdentityVerificationError();
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=jwt-execution-identity-verifier.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jwt-execution-identity-verifier.js","sourceRoot":"","sources":["../../src/host/jwt-execution-identity-verifier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AACjC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,wBAAwB,EACxB,8BAA8B,GAC/B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,oBAAoB,EACpB,yCAAyC,GAC1C,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,iCAAiC,EACjC,kCAAkC,GACnC,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,wCAAwC,EAAE,MAAM,cAAc,CAAC;AASxE,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AAG7D,4EAA4E;AAC5E,MAAM,OAAO,4BAA4B;IAC9B,OAAO,CAAyB;IAChC,YAAY,CAA8D;IAC1E,IAAI,CAAa;IAE1B,YACE,MAA0C,EAC1C,UAA2C,EAAE;QAE7C,MAAM,MAAM,GAAG,wCAAwC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QACtE,IAAI,CAAC,OAAO,GAAG,MAAM,CAA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KAAK,OAAO,CAAC,QAAQ,EACvC,CAAC;YACD,MAAM,IAAI,kCAAkC,EAAE,CAAC;QACjD,CAAC;IACH,CAAC;CACF","sourcesContent":["import { jwtVerify } from 'jose';\nimport { z } from 'zod';\nimport {\n EXECUTION_ASSERTION_TYPE,\n ExecutionAssertionClaimsSchema,\n} from '../contracts/index.js';\nimport {\n createJwtKeyResolver,\n resolveJwtVerificationUnavailableCategory,\n} from '../internal/jwt-verification.js';\nimport {\n ExecutionIdentityUnavailableError,\n ExecutionIdentityVerificationError,\n} from './errors.js';\nimport { JwtExecutionIdentityVerifierConfigSchema } from './schemas.js';\nimport type {\n ExecutionIdentityVerificationRequest,\n ExecutionIdentityVerifier,\n ExecutionHostJwtVerifierOptions,\n JwtExecutionIdentityVerifierConfig,\n VerifiedExecutionIdentity,\n} from './types.js';\n\nconst AssertionSchema = z.string().trim().min(32).max(4_096);\ntype ParsedConfig = z.infer<typeof JwtExecutionIdentityVerifierConfigSchema>;\n\n/** Verifies adopter authority and binds it to one exact host invocation. */\nexport class JwtExecutionIdentityVerifier implements ExecutionIdentityVerifier {\n readonly #config: Readonly<ParsedConfig>;\n readonly #keyResolver: NonNullable<ExecutionHostJwtVerifierOptions['keyResolver']>;\n readonly #now: () => Date;\n\n constructor(\n config: JwtExecutionIdentityVerifierConfig,\n options: ExecutionHostJwtVerifierOptions = {},\n ) {\n const parsed = JwtExecutionIdentityVerifierConfigSchema.parse(config);\n this.#config = Object.freeze({\n ...parsed,\n executionJwksUrl: new URL(parsed.executionJwksUrl),\n });\n this.#keyResolver = options.keyResolver\n ?? createJwtKeyResolver(this.#config.executionJwksUrl);\n this.#now = options.now ?? (() => new Date());\n }\n\n async verify(\n rawRequest: ExecutionIdentityVerificationRequest,\n ): Promise<VerifiedExecutionIdentity> {\n try {\n const request = Object.freeze({\n ...rawRequest,\n assertion: AssertionSchema.parse(rawRequest.assertion),\n });\n const { payload } = await jwtVerify(\n request.assertion,\n this.#keyResolver,\n {\n algorithms: [...this.#config.executionJwtAlgorithms],\n audience: this.#config.executionAudience,\n clockTolerance: this.#config.assertionClockToleranceSeconds,\n currentDate: this.#now(),\n issuer: this.#config.executionIssuer,\n maxTokenAge: this.#config.maxAssertionAgeSeconds,\n requiredClaims: ['exp', 'iat', 'jti', 'sub'],\n typ: EXECUTION_ASSERTION_TYPE,\n },\n );\n const claims = ExecutionAssertionClaimsSchema.parse(payload);\n this.#assertRequestBinding(claims, request);\n\n return Object.freeze({\n scope: Object.freeze({\n adopterId: claims.adopterId,\n tenantId: claims.tenantId,\n subjectId: claims.sub,\n productSessionId: claims.productSessionId,\n }),\n runtimeSessionId: claims.runtimeSessionId,\n invocationId: claims.jti,\n workflow: claims.workflow,\n issuedAt: new Date(claims.iat * 1_000).toISOString(),\n expiresAt: new Date(claims.exp * 1_000).toISOString(),\n });\n } catch (error) {\n if (\n error instanceof ExecutionIdentityVerificationError\n || error instanceof ExecutionIdentityUnavailableError\n ) {\n throw error;\n }\n const category = resolveJwtVerificationUnavailableCategory(error);\n if (category) {\n throw new ExecutionIdentityUnavailableError(category, { cause: error });\n }\n throw new ExecutionIdentityVerificationError({ cause: error });\n }\n }\n\n #assertRequestBinding(\n claims: z.infer<typeof ExecutionAssertionClaimsSchema>,\n request: ExecutionIdentityVerificationRequest,\n ): void {\n if (\n claims.adopterId !== this.#config.trustedAdopterId\n || claims.runtimeSessionId !== request.runtimeSessionId\n || claims.jti !== request.invocationId\n || claims.workflow !== request.workflow\n ) {\n throw new ExecutionIdentityVerificationError();\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare class RuntimeExecutionPreparationError extends Error {
|
|
2
|
+
readonly category: RuntimeExecutionPreparationCategory;
|
|
3
|
+
readonly name = "RuntimeExecutionPreparationError";
|
|
4
|
+
constructor(category: RuntimeExecutionPreparationCategory, options?: {
|
|
5
|
+
cause?: unknown;
|
|
6
|
+
});
|
|
7
|
+
}
|
|
8
|
+
export type RuntimeExecutionPreparationCategory = 'authority' | 'configuration' | 'contract' | 'dependency';
|
|
9
|
+
export declare class RuntimeBusyError extends Error {
|
|
10
|
+
readonly name = "RuntimeBusyError";
|
|
11
|
+
}
|
|
12
|
+
export declare class RuntimeDuplicateInvocationError extends Error {
|
|
13
|
+
readonly name = "RuntimeDuplicateInvocationError";
|
|
14
|
+
}
|
|
15
|
+
export declare class RuntimeDeadlineError extends Error {
|
|
16
|
+
readonly name = "RuntimeDeadlineError";
|
|
17
|
+
}
|
|
18
|
+
export declare class RuntimeScopeMismatchError extends Error {
|
|
19
|
+
readonly name = "RuntimeScopeMismatchError";
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/host/runtime-session/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,gCAAiC,SAAQ,KAAK;IAIvD,QAAQ,CAAC,QAAQ,EAAE,mCAAmC;IAHxD,QAAQ,CAAC,IAAI,sCAAsC;gBAGxC,QAAQ,EAAE,mCAAmC,EACtD,OAAO,GAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAO;CAIpC;AAED,MAAM,MAAM,mCAAmC,GAC3C,WAAW,GACX,eAAe,GACf,UAAU,GACV,YAAY,CAAC;AAEjB,qBAAa,gBAAiB,SAAQ,KAAK;IACzC,QAAQ,CAAC,IAAI,sBAAsB;CACpC;AAED,qBAAa,+BAAgC,SAAQ,KAAK;IACxD,QAAQ,CAAC,IAAI,qCAAqC;CACnD;AAED,qBAAa,oBAAqB,SAAQ,KAAK;IAC7C,QAAQ,CAAC,IAAI,0BAA0B;CACxC;AAED,qBAAa,yBAA0B,SAAQ,KAAK;IAClD,QAAQ,CAAC,IAAI,+BAA+B;CAC7C"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export class RuntimeExecutionPreparationError extends Error {
|
|
2
|
+
category;
|
|
3
|
+
name = 'RuntimeExecutionPreparationError';
|
|
4
|
+
constructor(category, options = {}) {
|
|
5
|
+
super('The agent execution dependency could not be prepared.', options);
|
|
6
|
+
this.category = category;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export class RuntimeBusyError extends Error {
|
|
10
|
+
name = 'RuntimeBusyError';
|
|
11
|
+
}
|
|
12
|
+
export class RuntimeDuplicateInvocationError extends Error {
|
|
13
|
+
name = 'RuntimeDuplicateInvocationError';
|
|
14
|
+
}
|
|
15
|
+
export class RuntimeDeadlineError extends Error {
|
|
16
|
+
name = 'RuntimeDeadlineError';
|
|
17
|
+
}
|
|
18
|
+
export class RuntimeScopeMismatchError extends Error {
|
|
19
|
+
name = 'RuntimeScopeMismatchError';
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/host/runtime-session/errors.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,gCAAiC,SAAQ,KAAK;IAI9C;IAHF,IAAI,GAAG,kCAAkC,CAAC;IAEnD,YACW,QAA6C,EACtD,UAA+B,EAAE;QAEjC,KAAK,CAAC,uDAAuD,EAAE,OAAO,CAAC,CAAC;QAH/D,aAAQ,GAAR,QAAQ,CAAqC;IAIxD,CAAC;CACF;AAQD,MAAM,OAAO,gBAAiB,SAAQ,KAAK;IAChC,IAAI,GAAG,kBAAkB,CAAC;CACpC;AAED,MAAM,OAAO,+BAAgC,SAAQ,KAAK;IAC/C,IAAI,GAAG,iCAAiC,CAAC;CACnD;AAED,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IACpC,IAAI,GAAG,sBAAsB,CAAC;CACxC;AAED,MAAM,OAAO,yBAA0B,SAAQ,KAAK;IACzC,IAAI,GAAG,2BAA2B,CAAC;CAC7C","sourcesContent":["export class RuntimeExecutionPreparationError extends Error {\n readonly name = 'RuntimeExecutionPreparationError';\n\n constructor(\n readonly category: RuntimeExecutionPreparationCategory,\n options: { cause?: unknown } = {},\n ) {\n super('The agent execution dependency could not be prepared.', options);\n }\n}\n\nexport type RuntimeExecutionPreparationCategory =\n | 'authority'\n | 'configuration'\n | 'contract'\n | 'dependency';\n\nexport class RuntimeBusyError extends Error {\n readonly name = 'RuntimeBusyError';\n}\n\nexport class RuntimeDuplicateInvocationError extends Error {\n readonly name = 'RuntimeDuplicateInvocationError';\n}\n\nexport class RuntimeDeadlineError extends Error {\n readonly name = 'RuntimeDeadlineError';\n}\n\nexport class RuntimeScopeMismatchError extends Error {\n readonly name = 'RuntimeScopeMismatchError';\n}\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { RuntimeBusyError, RuntimeDeadlineError, RuntimeDuplicateInvocationError, RuntimeExecutionPreparationError, RuntimeScopeMismatchError, } from './errors.js';
|
|
2
|
+
export type { RuntimeExecutionPreparationCategory, } from './errors.js';
|
|
3
|
+
export { RuntimeScopeBindingService, } from './scope-binding.js';
|
|
4
|
+
export type { BoundRuntimeScope, RuntimeScopeBinding, } from './scope-binding.js';
|
|
5
|
+
export { RuntimeSessionService } from './service.js';
|
|
6
|
+
export { RuntimeSessionStatusService } from './status.js';
|
|
7
|
+
export type { RuntimeSessionStatusSnapshot } from './status.js';
|
|
8
|
+
export type { RuntimeExecutionHandle, RuntimeExecutionInput, RuntimeExecutionStreamItem, RuntimeInvocationHandle, RuntimeInvocationRequest, RuntimeSessionConfig, RuntimeWorkflowExecutor, RuntimeWorkflowExecutors, } from './types.js';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/host/runtime-session/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,+BAA+B,EAC/B,gCAAgC,EAChC,yBAAyB,GAC1B,MAAM,aAAa,CAAC;AACrB,YAAY,EACV,mCAAmC,GACpC,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,0BAA0B,GAC3B,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EACV,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAC;AAC1D,YAAY,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAC;AAChE,YAAY,EACV,sBAAsB,EACtB,qBAAqB,EACrB,0BAA0B,EAC1B,uBAAuB,EACvB,wBAAwB,EACxB,oBAAoB,EACpB,uBAAuB,EACvB,wBAAwB,GACzB,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { RuntimeBusyError, RuntimeDeadlineError, RuntimeDuplicateInvocationError, RuntimeExecutionPreparationError, RuntimeScopeMismatchError, } from './errors.js';
|
|
2
|
+
export { RuntimeScopeBindingService, } from './scope-binding.js';
|
|
3
|
+
export { RuntimeSessionService } from './service.js';
|
|
4
|
+
export { RuntimeSessionStatusService } from './status.js';
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/host/runtime-session/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,+BAA+B,EAC/B,gCAAgC,EAChC,yBAAyB,GAC1B,MAAM,aAAa,CAAC;AAIrB,OAAO,EACL,0BAA0B,GAC3B,MAAM,oBAAoB,CAAC;AAK5B,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAC","sourcesContent":["export {\n RuntimeBusyError,\n RuntimeDeadlineError,\n RuntimeDuplicateInvocationError,\n RuntimeExecutionPreparationError,\n RuntimeScopeMismatchError,\n} from './errors.js';\nexport type {\n RuntimeExecutionPreparationCategory,\n} from './errors.js';\nexport {\n RuntimeScopeBindingService,\n} from './scope-binding.js';\nexport type {\n BoundRuntimeScope,\n RuntimeScopeBinding,\n} from './scope-binding.js';\nexport { RuntimeSessionService } from './service.js';\nexport { RuntimeSessionStatusService } from './status.js';\nexport type { RuntimeSessionStatusSnapshot } from './status.js';\nexport type {\n RuntimeExecutionHandle,\n RuntimeExecutionInput,\n RuntimeExecutionStreamItem,\n RuntimeInvocationHandle,\n RuntimeInvocationRequest,\n RuntimeSessionConfig,\n RuntimeWorkflowExecutor,\n RuntimeWorkflowExecutors,\n} from './types.js';\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ExecutionScope } from '../../contracts/index.js';
|
|
2
|
+
export type RuntimeScopeBinding = ExecutionScope & {
|
|
3
|
+
runtimeSessionId: string;
|
|
4
|
+
};
|
|
5
|
+
export type BoundRuntimeScope = {
|
|
6
|
+
binding: RuntimeScopeBinding;
|
|
7
|
+
scopeKey: string;
|
|
8
|
+
executionSessionId: string;
|
|
9
|
+
};
|
|
10
|
+
/** Defense in depth if a host process is reused across execution scopes. */
|
|
11
|
+
export declare class RuntimeScopeBindingService {
|
|
12
|
+
private bound?;
|
|
13
|
+
bind(input: RuntimeScopeBinding): BoundRuntimeScope;
|
|
14
|
+
current(): BoundRuntimeScope | undefined;
|
|
15
|
+
private static toBoundScope;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=scope-binding.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scope-binding.d.ts","sourceRoot":"","sources":["../../../src/host/runtime-session/scope-binding.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAG/D,MAAM,MAAM,mBAAmB,GAAG,cAAc,GAAG;IACjD,gBAAgB,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,EAAE,mBAAmB,CAAC;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,kBAAkB,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,4EAA4E;AAC5E,qBAAa,0BAA0B;IACrC,OAAO,CAAC,KAAK,CAAC,CAAoB;IAElC,IAAI,CAAC,KAAK,EAAE,mBAAmB,GAAG,iBAAiB;IAgBnD,OAAO,IAAI,iBAAiB,GAAG,SAAS;IAIxC,OAAO,CAAC,MAAM,CAAC,YAAY;CAiB5B"}
|