@heddleagent/execution-host-client 6.1.0 → 6.2.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 +42 -3
- package/dist/agentcore/agentcore-execution-host.d.ts +4 -3
- package/dist/agentcore/agentcore-execution-host.d.ts.map +1 -1
- package/dist/agentcore/agentcore-execution-host.js +4 -0
- package/dist/agentcore/agentcore-execution-host.js.map +1 -1
- package/dist/authority/jose-execution-authority.js +2 -2
- package/dist/authority/jose-execution-authority.js.map +1 -1
- package/dist/contracts/index.d.ts +106 -3
- package/dist/contracts/index.d.ts.map +1 -1
- package/dist/contracts/index.js +67 -2
- package/dist/contracts/index.js.map +1 -1
- package/dist/conversation/index.d.ts +1 -1
- package/dist/conversation/index.d.ts.map +1 -1
- package/dist/conversation/index.js.map +1 -1
- package/dist/conversation/types.d.ts +4 -2
- package/dist/conversation/types.d.ts.map +1 -1
- package/dist/conversation/types.js.map +1 -1
- package/dist/heartbeat/hosted-heartbeat-agent-execution-transport.d.ts +14 -0
- package/dist/heartbeat/hosted-heartbeat-agent-execution-transport.d.ts.map +1 -0
- package/dist/heartbeat/hosted-heartbeat-agent-execution-transport.js +38 -0
- package/dist/heartbeat/hosted-heartbeat-agent-execution-transport.js.map +1 -0
- package/dist/heartbeat/hosted-heartbeat-task-service.d.ts +22 -0
- package/dist/heartbeat/hosted-heartbeat-task-service.d.ts.map +1 -0
- package/dist/heartbeat/hosted-heartbeat-task-service.js +96 -0
- package/dist/heartbeat/hosted-heartbeat-task-service.js.map +1 -0
- package/dist/heartbeat/index.d.ts +5 -0
- package/dist/heartbeat/index.d.ts.map +1 -0
- package/dist/heartbeat/index.js +4 -0
- package/dist/heartbeat/index.js.map +1 -0
- package/dist/heartbeat/types.d.ts +83 -0
- package/dist/heartbeat/types.d.ts.map +1 -0
- package/dist/heartbeat/types.js +17 -0
- package/dist/heartbeat/types.js.map +1 -0
- package/dist/http-sse/direct-http-execution-host.d.ts +4 -3
- package/dist/http-sse/direct-http-execution-host.d.ts.map +1 -1
- package/dist/http-sse/direct-http-execution-host.js +56 -21
- package/dist/http-sse/direct-http-execution-host.js.map +1 -1
- package/dist/http-sse/index.d.ts +1 -1
- package/dist/http-sse/index.d.ts.map +1 -1
- package/dist/http-sse/index.js.map +1 -1
- package/dist/http-sse/types.d.ts +11 -1
- package/dist/http-sse/types.d.ts.map +1 -1
- package/dist/http-sse/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/package.json +5 -1
- package/spec/v1/README.md +14 -4
- package/spec/v1/fixtures/manifest.json +12 -0
- package/spec/v1/fixtures/valid-heartbeat-request.json +23 -0
- package/spec/v1/fixtures/valid-heartbeat-result.sse +13 -0
- package/spec/v1/openapi.json +513 -6
- package/spec/v1/schema-bundle.json +499 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/contracts/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAU,CAAC;AACrD,MAAM,CAAC,MAAM,0BAA0B,GAAG,mBAA4B,CAAC;AACvE,MAAM,CAAC,MAAM,wBAAwB,GAAG,sBAA+B,CAAC;AACxE,MAAM,CAAC,MAAM,mBAAmB,GAAG,2BAAoC,CAAC;AAExE,MAAM,CAAC,MAAM,gCAAgC,GAC3C,6CAAsD,CAAC;AACzD,MAAM,CAAC,MAAM,iCAAiC,GAC5C,qCAA8C,CAAC;AACjD,MAAM,CAAC,MAAM,0BAA0B,GACrC,mCAA4C,CAAC;AAC/C,MAAM,CAAC,MAAM,qBAAqB,GAChC,wCAAiD,CAAC;AACpD,MAAM,CAAC,MAAM,oBAAoB,GAC/B,uCAAgD,CAAC;AAEnD,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC;KAC5B,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CONVERSATION_TURN_WORKFLOW = 'conversation-turn' as const;\nexport const EXECUTION_ASSERTION_TYPE = 'heddle-execution+jwt' as const;\nexport const MCP_CAPABILITY_TYPE = 'heddle-mcp-capability+jwt' as const;\n\nexport const AGENTCORE_RUNTIME_SESSION_HEADER =\n 'x-amzn-bedrock-agentcore-runtime-session-id' as const;\nexport const EXECUTION_HOST_LOCAL_TOKEN_HEADER =\n 'x-heddle-execution-host-local-token' as const;\nexport const EXECUTION_ASSERTION_HEADER =\n 'x-heddle-execution-host-assertion' as const;\nexport const MCP_CAPABILITY_HEADER =\n 'x-heddle-execution-host-mcp-capability' as const;\nexport const MODEL_API_KEY_HEADER =\n 'x-heddle-execution-host-model-api-key' as const;\n\nexport const OpaqueIdSchema = z\n .string()\n .min(1)\n .max(128)\n .regex(\n /^[A-Za-z0-9][A-Za-z0-9._:@-]*$/,\n 'must be an opaque, path-free identifier',\n );\n\nexport const JwtIssuerSchema = z.url().refine(\n (value) => isSafeWebUrl(new URL(value)),\n 'must use HTTPS or loopback HTTP and contain no credentials, query, or fragment',\n);\n\nexport const JwtAudienceSchema = z.string().min(1).max(512);\n\nexport const RuntimeSessionIdSchema = z\n .string()\n .min(33)\n .max(256)\n .refine((value) => value === value.trim(), 'must not contain outer whitespace');\n\nexport const TimestampSchema = z.iso.datetime({ offset: true });\n\nexport const McpServerIdSchema = z\n .string()\n .min(1)\n .max(64)\n .regex(\n /^[A-Za-z0-9_-]+$/,\n 'must be a Heddle-compatible MCP server identifier',\n );\n\nexport const McpToolNameSchema = z\n .string()\n .min(1)\n .max(64)\n .regex(\n /^[A-Za-z][A-Za-z0-9_]*$/,\n 'must be a collision-free MCP tool name',\n );\n\nexport const McpAllowedToolsSchema = z\n .array(McpToolNameSchema)\n .min(1)\n .max(16)\n .refine((tools) => new Set(tools).size === tools.length, {\n message: 'must contain unique MCP tool names',\n })\n .refine(\n (tools) => tools.reduce(\n (characterCount, toolName) => characterCount + toolName.length,\n 0,\n ) <= 512,\n { message: 'contains too many aggregate tool-name characters' },\n );\n\nexport const ExecutionScopeSchema = z.object({\n adopterId: OpaqueIdSchema,\n tenantId: OpaqueIdSchema,\n subjectId: OpaqueIdSchema,\n productSessionId: OpaqueIdSchema,\n}).strict();\n\nexport const ExecutionHostConversationTurnRequestSchema = z.object({\n schemaVersion: z.literal(EXECUTION_CONTRACT_VERSION),\n kind: z.literal(CONVERSATION_TURN_WORKFLOW),\n invocationId: OpaqueIdSchema,\n prompt: z.string().trim().min(1).max(200_000),\n deadlineAt: TimestampSchema.optional(),\n}).strict();\n\nexport const RuntimePublicResultSchema = z.object({\n outcome: z.enum(['done', 'max_steps', 'error', 'interrupted']),\n summary: z.string().optional(),\n failure: z.object({\n source: z.literal('model'),\n code: z.enum([\n 'authentication',\n 'permission',\n 'quota',\n 'rate_limit',\n 'context_window',\n 'request',\n 'transport',\n 'empty_response',\n 'unknown',\n ]),\n }).strict().optional(),\n}).strict();\n\nconst StreamEnvelopeSchema = z.object({\n schemaVersion: z.literal(EXECUTION_CONTRACT_VERSION),\n invocationId: OpaqueIdSchema,\n runId: OpaqueIdSchema,\n sequence: z.number().int().nonnegative(),\n timestamp: TimestampSchema,\n});\n\nexport const ExecutionHostStreamEventSchema = z.discriminatedUnion('kind', [\n StreamEnvelopeSchema.extend({\n sequence: z.literal(0),\n kind: z.literal('accepted'),\n }).strict(),\n StreamEnvelopeSchema.extend({\n kind: z.literal('activity'),\n activity: z.unknown(),\n }).strict(),\n StreamEnvelopeSchema.extend({\n kind: z.literal('result'),\n result: RuntimePublicResultSchema,\n }).strict(),\n StreamEnvelopeSchema.extend({\n kind: z.literal('cancelled'),\n reason: z.string(),\n }).strict(),\n StreamEnvelopeSchema.extend({\n kind: z.literal('error'),\n error: z.object({\n code: z.string().min(1).max(128).regex(/^[a-z0-9_]+$/),\n message: z.string().min(1).max(1_600),\n }).strict(),\n }).strict(),\n]);\n\nexport const ExecutionAssertionClaimsSchema = z.object({\n iss: JwtIssuerSchema,\n aud: JwtAudienceSchema,\n contractVersion: z.literal(EXECUTION_CONTRACT_VERSION),\n adopterId: OpaqueIdSchema,\n tenantId: OpaqueIdSchema,\n productSessionId: OpaqueIdSchema,\n runtimeSessionId: RuntimeSessionIdSchema,\n workflow: z.literal(CONVERSATION_TURN_WORKFLOW),\n sub: OpaqueIdSchema,\n jti: OpaqueIdSchema,\n iat: z.number().int().nonnegative(),\n exp: z.number().int().positive(),\n}).passthrough();\n\nexport const McpCapabilityClaimsSchema = z.object({\n iss: JwtIssuerSchema,\n aud: JwtAudienceSchema,\n contractVersion: z.literal(EXECUTION_CONTRACT_VERSION),\n adopterId: OpaqueIdSchema,\n tenantId: OpaqueIdSchema,\n productSessionId: OpaqueIdSchema,\n runtimeSessionId: RuntimeSessionIdSchema,\n invocationId: OpaqueIdSchema,\n workflow: z.literal(CONVERSATION_TURN_WORKFLOW),\n serverId: McpServerIdSchema,\n allowedTools: McpAllowedToolsSchema,\n sub: OpaqueIdSchema,\n jti: OpaqueIdSchema,\n iat: z.number().int().nonnegative(),\n exp: z.number().int().positive(),\n}).passthrough();\n\nexport type ExecutionScope = z.infer<typeof ExecutionScopeSchema>;\nexport type ExecutionHostConversationTurnRequest = z.infer<\n typeof ExecutionHostConversationTurnRequestSchema\n>;\nexport type RuntimePublicResult = z.infer<typeof RuntimePublicResultSchema>;\nexport type ExecutionHostStreamEvent = z.infer<\n typeof ExecutionHostStreamEventSchema\n>;\nexport type ExecutionHostTerminalEvent = Extract<\n ExecutionHostStreamEvent,\n { kind: 'result' | 'cancelled' | 'error' }\n>;\nexport type ExecutionAssertionClaims = z.infer<\n typeof ExecutionAssertionClaimsSchema\n>;\nexport type McpCapabilityClaims = z.infer<typeof McpCapabilityClaimsSchema>;\nexport type HostedExecutionWorkflow = typeof CONVERSATION_TURN_WORKFLOW;\n\nexport function isExecutionHostTerminalEvent(\n event: ExecutionHostStreamEvent,\n): event is ExecutionHostTerminalEvent {\n return event.kind === 'result'\n || event.kind === 'cancelled'\n || event.kind === 'error';\n}\n\nexport function isSafeWebUrl(url: URL): boolean {\n const loopback = ['127.0.0.1', '[::1]', 'localhost'].includes(url.hostname);\n return (url.protocol === 'https:' || (url.protocol === 'http:' && loopback))\n && !url.username\n && !url.password\n && !url.search\n && !url.hash;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/contracts/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAU,CAAC;AACrD,MAAM,CAAC,MAAM,0BAA0B,GAAG,mBAA4B,CAAC;AACvE,MAAM,CAAC,MAAM,uBAAuB,GAAG,gBAAyB,CAAC;AACjE,MAAM,CAAC,MAAM,wBAAwB,GAAG,sBAA+B,CAAC;AACxE,MAAM,CAAC,MAAM,mBAAmB,GAAG,2BAAoC,CAAC;AAExE,MAAM,CAAC,MAAM,gCAAgC,GAC3C,6CAAsD,CAAC;AACzD,MAAM,CAAC,MAAM,iCAAiC,GAC5C,qCAA8C,CAAC;AACjD,MAAM,CAAC,MAAM,0BAA0B,GACrC,mCAA4C,CAAC;AAC/C,MAAM,CAAC,MAAM,qBAAqB,GAChC,wCAAiD,CAAC;AACpD,MAAM,CAAC,MAAM,oBAAoB,GAC/B,uCAAgD,CAAC;AAEnD,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC;KAC5B,MAAM,EAAE;KACR,GAAG,CAAC,CAAC,CAAC;KACN,GAAG,CAAC,GAAG,CAAC;KACR,KAAK,CACJ,gCAAgC,EAChC,yCAAyC,CAC1C,CAAC;AAEJ,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,MAAM,CAC3C,CAAC,KAAK,EAAE,EAAE,CAAC,YAAY,CAAC,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,EACvC,gFAAgF,CACjF,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC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AC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAC5E,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,QAAQ,IAAI,CAAC,GAAG,CAAC,QAAQ,KAAK,OAAO,IAAI,QAAQ,CAAC,CAAC;WACvE,CAAC,GAAG,CAAC,QAAQ;WACb,CAAC,GAAG,CAAC,QAAQ;WACb,CAAC,GAAG,CAAC,MAAM;WACX,CAAC,GAAG,CAAC,IAAI,CAAC;AACjB,CAAC","sourcesContent":["import { z } from 'zod';\n\nexport const EXECUTION_CONTRACT_VERSION = 1 as const;\nexport const CONVERSATION_TURN_WORKFLOW = 'conversation-turn' as const;\nexport const HEARTBEAT_TASK_WORKFLOW = 'heartbeat-task' as const;\nexport const EXECUTION_ASSERTION_TYPE = 'heddle-execution+jwt' as const;\nexport const MCP_CAPABILITY_TYPE = 'heddle-mcp-capability+jwt' as const;\n\nexport const AGENTCORE_RUNTIME_SESSION_HEADER =\n 'x-amzn-bedrock-agentcore-runtime-session-id' as const;\nexport const EXECUTION_HOST_LOCAL_TOKEN_HEADER =\n 'x-heddle-execution-host-local-token' as const;\nexport const EXECUTION_ASSERTION_HEADER =\n 'x-heddle-execution-host-assertion' as const;\nexport const MCP_CAPABILITY_HEADER =\n 'x-heddle-execution-host-mcp-capability' as const;\nexport const MODEL_API_KEY_HEADER =\n 'x-heddle-execution-host-model-api-key' as const;\n\nexport const OpaqueIdSchema = z\n .string()\n .min(1)\n .max(128)\n .regex(\n /^[A-Za-z0-9][A-Za-z0-9._:@-]*$/,\n 'must be an opaque, path-free identifier',\n );\n\nexport const JwtIssuerSchema = z.url().refine(\n (value) => isSafeWebUrl(new URL(value)),\n 'must use HTTPS or loopback HTTP and contain no credentials, query, or fragment',\n);\n\nexport const JwtAudienceSchema = z.string().min(1).max(512);\n\nexport const RuntimeSessionIdSchema = z\n .string()\n .min(33)\n .max(256)\n .refine((value) => value === value.trim(), 'must not contain outer whitespace');\n\nexport const TimestampSchema = z.iso.datetime({ offset: true });\n\nexport const McpServerIdSchema = z\n .string()\n .min(1)\n .max(64)\n .regex(\n /^[A-Za-z0-9_-]+$/,\n 'must be a Heddle-compatible MCP server identifier',\n );\n\nexport const McpToolNameSchema = z\n .string()\n .min(1)\n .max(64)\n .regex(\n /^[A-Za-z][A-Za-z0-9_]*$/,\n 'must be a collision-free MCP tool name',\n );\n\nexport const McpAllowedToolsSchema = z\n .array(McpToolNameSchema)\n .min(1)\n .max(16)\n .refine((tools) => new Set(tools).size === tools.length, {\n message: 'must contain unique MCP tool names',\n })\n .refine(\n (tools) => tools.reduce(\n (characterCount, toolName) => characterCount + toolName.length,\n 0,\n ) <= 512,\n { message: 'contains too many aggregate tool-name characters' },\n );\n\nexport const ExecutionScopeSchema = z.object({\n adopterId: OpaqueIdSchema,\n tenantId: OpaqueIdSchema,\n subjectId: OpaqueIdSchema,\n productSessionId: OpaqueIdSchema,\n}).strict();\n\nexport const ExecutionHostConversationTurnRequestSchema = z.object({\n schemaVersion: z.literal(EXECUTION_CONTRACT_VERSION),\n kind: z.literal(CONVERSATION_TURN_WORKFLOW),\n invocationId: OpaqueIdSchema,\n prompt: z.string().trim().min(1).max(200_000),\n deadlineAt: TimestampSchema.optional(),\n}).strict();\n\nexport const HeartbeatRunContextSchema = z.object({\n currentDateTime: TimestampSchema,\n intervalMs: z.number().int().positive().max(Number.MAX_SAFE_INTEGER),\n continuationMode: z.enum(['operator', 'agent']).optional(),\n nextRunAt: TimestampSchema.optional(),\n previousRunAt: TimestampSchema.optional(),\n previousRunId: OpaqueIdSchema.optional(),\n}).strict();\n\nexport const ExecutionHostHeartbeatTaskRequestSchema = z.object({\n schemaVersion: z.literal(EXECUTION_CONTRACT_VERSION),\n kind: z.literal(HEARTBEAT_TASK_WORKFLOW),\n invocationId: OpaqueIdSchema,\n taskId: OpaqueIdSchema,\n task: z.string().trim().min(1).max(200_000),\n checkpoint: z.record(z.string(), z.json()).optional(),\n runContext: HeartbeatRunContextSchema,\n model: z.string().trim().min(1).max(512).optional(),\n reasoningEffort: z.enum([\n 'none',\n 'low',\n 'medium',\n 'high',\n 'ultrahigh',\n 'max',\n ]).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).optional(),\n systemContext: z.string().max(200_000).optional(),\n deadlineAt: TimestampSchema.optional(),\n}).strict();\n\nexport const RuntimePublicResultSchema = z.object({\n outcome: z.enum(['done', 'max_steps', 'error', 'interrupted']),\n summary: z.string().optional(),\n failure: z.object({\n source: z.literal('model'),\n code: z.enum([\n 'authentication',\n 'permission',\n 'quota',\n 'rate_limit',\n 'context_window',\n 'request',\n 'transport',\n 'empty_response',\n 'unknown',\n ]),\n }).strict().optional(),\n}).strict();\n\nconst StreamEnvelopeSchema = z.object({\n schemaVersion: z.literal(EXECUTION_CONTRACT_VERSION),\n invocationId: OpaqueIdSchema,\n runId: OpaqueIdSchema,\n sequence: z.number().int().nonnegative(),\n timestamp: TimestampSchema,\n});\n\nexport const ExecutionHostStreamEventSchema = z.discriminatedUnion('kind', [\n StreamEnvelopeSchema.extend({\n sequence: z.literal(0),\n kind: z.literal('accepted'),\n }).strict(),\n StreamEnvelopeSchema.extend({\n kind: z.literal('activity'),\n activity: z.unknown(),\n }).strict(),\n StreamEnvelopeSchema.extend({\n kind: z.literal('result'),\n result: RuntimePublicResultSchema,\n }).strict(),\n StreamEnvelopeSchema.extend({\n kind: z.literal('cancelled'),\n reason: z.string(),\n }).strict(),\n StreamEnvelopeSchema.extend({\n kind: z.literal('error'),\n error: z.object({\n code: z.string().min(1).max(128).regex(/^[a-z0-9_]+$/),\n message: z.string().min(1).max(1_600),\n }).strict(),\n }).strict(),\n]);\n\nexport const ExecutionHostHeartbeatStreamEventSchema = z.discriminatedUnion(\n 'kind',\n [\n StreamEnvelopeSchema.extend({\n sequence: z.literal(0),\n kind: z.literal('accepted'),\n }).strict(),\n StreamEnvelopeSchema.extend({\n kind: z.literal('activity'),\n activity: z.json(),\n }).strict(),\n StreamEnvelopeSchema.extend({\n kind: z.literal('result'),\n result: z.record(z.string(), z.json()),\n }).strict(),\n StreamEnvelopeSchema.extend({\n kind: z.literal('cancelled'),\n reason: z.string(),\n }).strict(),\n StreamEnvelopeSchema.extend({\n kind: z.literal('error'),\n error: z.object({\n code: z.string().min(1).max(128).regex(/^[a-z0-9_]+$/),\n message: z.string().min(1).max(1_600),\n }).strict(),\n }).strict(),\n ],\n);\n\nexport const HostedExecutionWorkflowSchema = z.enum([\n CONVERSATION_TURN_WORKFLOW,\n HEARTBEAT_TASK_WORKFLOW,\n]);\n\nexport const ExecutionAssertionClaimsSchema = z.object({\n iss: JwtIssuerSchema,\n aud: JwtAudienceSchema,\n contractVersion: z.literal(EXECUTION_CONTRACT_VERSION),\n adopterId: OpaqueIdSchema,\n tenantId: OpaqueIdSchema,\n productSessionId: OpaqueIdSchema,\n runtimeSessionId: RuntimeSessionIdSchema,\n workflow: HostedExecutionWorkflowSchema,\n sub: OpaqueIdSchema,\n jti: OpaqueIdSchema,\n iat: z.number().int().nonnegative(),\n exp: z.number().int().positive(),\n}).passthrough();\n\nexport const McpCapabilityClaimsSchema = z.object({\n iss: JwtIssuerSchema,\n aud: JwtAudienceSchema,\n contractVersion: z.literal(EXECUTION_CONTRACT_VERSION),\n adopterId: OpaqueIdSchema,\n tenantId: OpaqueIdSchema,\n productSessionId: OpaqueIdSchema,\n runtimeSessionId: RuntimeSessionIdSchema,\n invocationId: OpaqueIdSchema,\n workflow: HostedExecutionWorkflowSchema,\n serverId: McpServerIdSchema,\n allowedTools: McpAllowedToolsSchema,\n sub: OpaqueIdSchema,\n jti: OpaqueIdSchema,\n iat: z.number().int().nonnegative(),\n exp: z.number().int().positive(),\n}).passthrough();\n\nexport type ExecutionScope = z.infer<typeof ExecutionScopeSchema>;\nexport type ExecutionHostConversationTurnRequest = z.infer<\n typeof ExecutionHostConversationTurnRequestSchema\n>;\nexport type ExecutionHostHeartbeatTaskRequest = z.infer<\n typeof ExecutionHostHeartbeatTaskRequestSchema\n>;\nexport type RuntimePublicResult = z.infer<typeof RuntimePublicResultSchema>;\nexport type ExecutionHostStreamEvent = z.infer<\n typeof ExecutionHostStreamEventSchema\n>;\nexport type ExecutionHostTerminalEvent = Extract<\n ExecutionHostStreamEvent,\n { kind: 'result' | 'cancelled' | 'error' }\n>;\nexport type ExecutionHostHeartbeatStreamEvent = z.infer<\n typeof ExecutionHostHeartbeatStreamEventSchema\n>;\nexport type ExecutionHostHeartbeatTerminalEvent = Extract<\n ExecutionHostHeartbeatStreamEvent,\n { kind: 'result' | 'cancelled' | 'error' }\n>;\nexport type ExecutionAssertionClaims = z.infer<\n typeof ExecutionAssertionClaimsSchema\n>;\nexport type McpCapabilityClaims = z.infer<typeof McpCapabilityClaimsSchema>;\nexport type HostedExecutionWorkflow = z.infer<\n typeof HostedExecutionWorkflowSchema\n>;\n\nexport function isExecutionHostTerminalEvent(\n event: ExecutionHostStreamEvent,\n): event is ExecutionHostTerminalEvent {\n return event.kind === 'result'\n || event.kind === 'cancelled'\n || event.kind === 'error';\n}\n\nexport function isExecutionHostHeartbeatTerminalEvent(\n event: ExecutionHostHeartbeatStreamEvent,\n): event is ExecutionHostHeartbeatTerminalEvent {\n return event.kind === 'result'\n || event.kind === 'cancelled'\n || event.kind === 'error';\n}\n\nexport function isSafeWebUrl(url: URL): boolean {\n const loopback = ['127.0.0.1', '[::1]', 'localhost'].includes(url.hostname);\n return (url.protocol === 'https:' || (url.protocol === 'http:' && loopback))\n && !url.username\n && !url.password\n && !url.search\n && !url.hash;\n}\n"]}
|
|
@@ -3,5 +3,5 @@ export { HOSTED_CONVERSATION_CANCELLED_CODES, HOSTED_CONVERSATION_FAILURE_CODES,
|
|
|
3
3
|
export { HostedConversationConfigurationError, HostedConversationTurnService, } from './hosted-conversation-turn-service.js';
|
|
4
4
|
export type { DurableHostedConversationTurnServiceConfig, DurableHostedConversationTurnServiceOptions, HostedConversationAcceptedTurn, HostedConversationExpiredTurnReconciliation, HostedConversationFailureCode, HostedConversationPersistenceScope, HostedConversationRequestedTurn, HostedConversationTerminalProjection, HostedConversationTerminalStatus, HostedConversationTurnIdentity, HostedConversationTurnLifecycleRecord, HostedConversationTurnLifecycleStore, HostedConversationTurnReconciliationOptions, HostedConversationTurnSettlement, HostedConversationTurnStatus, } from './lifecycle-types.js';
|
|
5
5
|
export { HostedConversationTurnInputSchema } from './types.js';
|
|
6
|
-
export type { HostedConversationCredentialContext, HostedConversationModelCredentialProvider, HostedConversationTurnInput, HostedConversationTurnRunner, HostedConversationTurnServiceConfig, } from './types.js';
|
|
6
|
+
export type { HostedConversationCredentialContext, HostedConversationModelCredentialProvider, HostedModelCredentialProvider, HostedConversationTurnInput, HostedConversationTurnRunner, HostedConversationTurnServiceConfig, } from './types.js';
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/conversation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oCAAoC,EACpC,uCAAuC,EACvC,sCAAsC,GACvC,MAAM,+CAA+C,CAAC;AACvD,OAAO,EACL,mCAAmC,EACnC,iCAAiC,EACjC,gCAAgC,EAChC,qCAAqC,EACrC,iCAAiC,EACjC,oCAAoC,EACpC,iDAAiD,EACjD,mCAAmC,EACnC,wCAAwC,EACxC,qCAAqC,EACrC,oCAAoC,EACpC,sCAAsC,EACtC,kCAAkC,GACnC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,oCAAoC,EACpC,6BAA6B,GAC9B,MAAM,uCAAuC,CAAC;AAC/C,YAAY,EACV,0CAA0C,EAC1C,2CAA2C,EAC3C,8BAA8B,EAC9B,2CAA2C,EAC3C,6BAA6B,EAC7B,kCAAkC,EAClC,+BAA+B,EAC/B,oCAAoC,EACpC,gCAAgC,EAChC,8BAA8B,EAC9B,qCAAqC,EACrC,oCAAoC,EACpC,2CAA2C,EAC3C,gCAAgC,EAChC,4BAA4B,GAC7B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,iCAAiC,EAAE,MAAM,YAAY,CAAC;AAC/D,YAAY,EACV,mCAAmC,EACnC,yCAAyC,EACzC,2BAA2B,EAC3B,4BAA4B,EAC5B,mCAAmC,GACpC,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/conversation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oCAAoC,EACpC,uCAAuC,EACvC,sCAAsC,GACvC,MAAM,+CAA+C,CAAC;AACvD,OAAO,EACL,mCAAmC,EACnC,iCAAiC,EACjC,gCAAgC,EAChC,qCAAqC,EACrC,iCAAiC,EACjC,oCAAoC,EACpC,iDAAiD,EACjD,mCAAmC,EACnC,wCAAwC,EACxC,qCAAqC,EACrC,oCAAoC,EACpC,sCAAsC,EACtC,kCAAkC,GACnC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,oCAAoC,EACpC,6BAA6B,GAC9B,MAAM,uCAAuC,CAAC;AAC/C,YAAY,EACV,0CAA0C,EAC1C,2CAA2C,EAC3C,8BAA8B,EAC9B,2CAA2C,EAC3C,6BAA6B,EAC7B,kCAAkC,EAClC,+BAA+B,EAC/B,oCAAoC,EACpC,gCAAgC,EAChC,8BAA8B,EAC9B,qCAAqC,EACrC,oCAAoC,EACpC,2CAA2C,EAC3C,gCAAgC,EAChC,4BAA4B,GAC7B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,iCAAiC,EAAE,MAAM,YAAY,CAAC;AAC/D,YAAY,EACV,mCAAmC,EACnC,yCAAyC,EACzC,6BAA6B,EAC7B,2BAA2B,EAC3B,4BAA4B,EAC5B,mCAAmC,GACpC,MAAM,YAAY,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/conversation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oCAAoC,EACpC,uCAAuC,EACvC,sCAAsC,GACvC,MAAM,+CAA+C,CAAC;AACvD,OAAO,EACL,mCAAmC,EACnC,iCAAiC,EACjC,gCAAgC,EAChC,qCAAqC,EACrC,iCAAiC,EACjC,oCAAoC,EACpC,iDAAiD,EACjD,mCAAmC,EACnC,wCAAwC,EACxC,qCAAqC,EACrC,oCAAoC,EACpC,sCAAsC,EACtC,kCAAkC,GACnC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,oCAAoC,EACpC,6BAA6B,GAC9B,MAAM,uCAAuC,CAAC;AAkB/C,OAAO,EAAE,iCAAiC,EAAE,MAAM,YAAY,CAAC","sourcesContent":["export {\n DurableHostedConversationTurnService,\n interruptExpiredHostedConversationTurns,\n projectHostedConversationTerminalEvent,\n} from './durable-hosted-conversation-turn-service.js';\nexport {\n HOSTED_CONVERSATION_CANCELLED_CODES,\n HOSTED_CONVERSATION_FAILURE_CODES,\n HOSTED_CONVERSATION_FAILED_CODES,\n HOSTED_CONVERSATION_INTERRUPTED_CODES,\n HOSTED_CONVERSATION_TURN_STATUSES,\n HostedConversationAcceptedTurnSchema,\n HostedConversationExpiredTurnReconciliationSchema,\n HostedConversationFailureCodeSchema,\n HostedConversationPersistenceScopeSchema,\n HostedConversationRequestedTurnSchema,\n HostedConversationTurnIdentitySchema,\n HostedConversationTurnSettlementSchema,\n HostedConversationTurnStatusSchema,\n} from './lifecycle-types.js';\nexport {\n HostedConversationConfigurationError,\n HostedConversationTurnService,\n} from './hosted-conversation-turn-service.js';\nexport type {\n DurableHostedConversationTurnServiceConfig,\n DurableHostedConversationTurnServiceOptions,\n HostedConversationAcceptedTurn,\n HostedConversationExpiredTurnReconciliation,\n HostedConversationFailureCode,\n HostedConversationPersistenceScope,\n HostedConversationRequestedTurn,\n HostedConversationTerminalProjection,\n HostedConversationTerminalStatus,\n HostedConversationTurnIdentity,\n HostedConversationTurnLifecycleRecord,\n HostedConversationTurnLifecycleStore,\n HostedConversationTurnReconciliationOptions,\n HostedConversationTurnSettlement,\n HostedConversationTurnStatus,\n} from './lifecycle-types.js';\nexport { HostedConversationTurnInputSchema } from './types.js';\nexport type {\n HostedConversationCredentialContext,\n HostedConversationModelCredentialProvider,\n HostedConversationTurnInput,\n HostedConversationTurnRunner,\n HostedConversationTurnServiceConfig,\n} from './types.js';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/conversation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oCAAoC,EACpC,uCAAuC,EACvC,sCAAsC,GACvC,MAAM,+CAA+C,CAAC;AACvD,OAAO,EACL,mCAAmC,EACnC,iCAAiC,EACjC,gCAAgC,EAChC,qCAAqC,EACrC,iCAAiC,EACjC,oCAAoC,EACpC,iDAAiD,EACjD,mCAAmC,EACnC,wCAAwC,EACxC,qCAAqC,EACrC,oCAAoC,EACpC,sCAAsC,EACtC,kCAAkC,GACnC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,oCAAoC,EACpC,6BAA6B,GAC9B,MAAM,uCAAuC,CAAC;AAkB/C,OAAO,EAAE,iCAAiC,EAAE,MAAM,YAAY,CAAC","sourcesContent":["export {\n DurableHostedConversationTurnService,\n interruptExpiredHostedConversationTurns,\n projectHostedConversationTerminalEvent,\n} from './durable-hosted-conversation-turn-service.js';\nexport {\n HOSTED_CONVERSATION_CANCELLED_CODES,\n HOSTED_CONVERSATION_FAILURE_CODES,\n HOSTED_CONVERSATION_FAILED_CODES,\n HOSTED_CONVERSATION_INTERRUPTED_CODES,\n HOSTED_CONVERSATION_TURN_STATUSES,\n HostedConversationAcceptedTurnSchema,\n HostedConversationExpiredTurnReconciliationSchema,\n HostedConversationFailureCodeSchema,\n HostedConversationPersistenceScopeSchema,\n HostedConversationRequestedTurnSchema,\n HostedConversationTurnIdentitySchema,\n HostedConversationTurnSettlementSchema,\n HostedConversationTurnStatusSchema,\n} from './lifecycle-types.js';\nexport {\n HostedConversationConfigurationError,\n HostedConversationTurnService,\n} from './hosted-conversation-turn-service.js';\nexport type {\n DurableHostedConversationTurnServiceConfig,\n DurableHostedConversationTurnServiceOptions,\n HostedConversationAcceptedTurn,\n HostedConversationExpiredTurnReconciliation,\n HostedConversationFailureCode,\n HostedConversationPersistenceScope,\n HostedConversationRequestedTurn,\n HostedConversationTerminalProjection,\n HostedConversationTerminalStatus,\n HostedConversationTurnIdentity,\n HostedConversationTurnLifecycleRecord,\n HostedConversationTurnLifecycleStore,\n HostedConversationTurnReconciliationOptions,\n HostedConversationTurnSettlement,\n HostedConversationTurnStatus,\n} from './lifecycle-types.js';\nexport { HostedConversationTurnInputSchema } from './types.js';\nexport type {\n HostedConversationCredentialContext,\n HostedConversationModelCredentialProvider,\n HostedModelCredentialProvider,\n HostedConversationTurnInput,\n HostedConversationTurnRunner,\n HostedConversationTurnServiceConfig,\n} from './types.js';\n"]}
|
|
@@ -17,16 +17,18 @@ export declare const HostedConversationTurnInputSchema: z.ZodObject<{
|
|
|
17
17
|
export type HostedConversationTurnInput = z.infer<typeof HostedConversationTurnInputSchema>;
|
|
18
18
|
export type HostedConversationCredentialContext = Pick<HostedConversationTurnInput, 'scope' | 'invocationId' | 'signal'>;
|
|
19
19
|
/** Resolves model authority without exposing it to HTTP or product data. */
|
|
20
|
-
export interface
|
|
20
|
+
export interface HostedModelCredentialProvider {
|
|
21
21
|
resolveModelApiKey(context: HostedConversationCredentialContext): Promise<string>;
|
|
22
22
|
}
|
|
23
|
+
/** @deprecated Use `HostedModelCredentialProvider`. */
|
|
24
|
+
export type HostedConversationModelCredentialProvider = HostedModelCredentialProvider;
|
|
23
25
|
export interface HostedConversationTurnRunner {
|
|
24
26
|
streamTurn(input: HostedConversationTurnInput): AsyncIterable<ExecutionHostStreamEvent>;
|
|
25
27
|
}
|
|
26
28
|
export type HostedConversationTurnServiceConfig = {
|
|
27
29
|
authority: ExecutionAuthority;
|
|
28
30
|
executionHost: ExecutionHost;
|
|
29
|
-
modelCredentials:
|
|
31
|
+
modelCredentials: HostedModelCredentialProvider;
|
|
30
32
|
/** Omit this policy when the hosted workflow needs no product MCP tools. */
|
|
31
33
|
mcp?: {
|
|
32
34
|
allowedTools: readonly string[];
|
|
@@ -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,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAChE,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,
|
|
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,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAChE,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,CACp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b,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 { ExecutionAuthority } 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
|
|
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 { ExecutionAuthority } 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: ExecutionAuthority;\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,14 @@
|
|
|
1
|
+
import { type HostedHeartbeatAgentExecutionTransportConfig, type HostedHeartbeatAgentExecutionTransportInput } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Binds Heddle's provider-neutral scheduler transport to hosted execution.
|
|
4
|
+
*
|
|
5
|
+
* Product code supplies only authorized scope/session resolution. This class
|
|
6
|
+
* owns execution-id correlation and delegates authority, credentials, and
|
|
7
|
+
* stream semantics to `HostedHeartbeatTaskService`.
|
|
8
|
+
*/
|
|
9
|
+
export declare class HostedHeartbeatAgentExecutionTransport {
|
|
10
|
+
#private;
|
|
11
|
+
constructor(config: HostedHeartbeatAgentExecutionTransportConfig);
|
|
12
|
+
execute(input: HostedHeartbeatAgentExecutionTransportInput): Promise<unknown>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=hosted-heartbeat-agent-execution-transport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hosted-heartbeat-agent-execution-transport.d.ts","sourceRoot":"","sources":["../../src/heartbeat/hosted-heartbeat-agent-execution-transport.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,4CAA4C,EACjD,KAAK,2CAA2C,EACjD,MAAM,YAAY,CAAC;AAEpB;;;;;;GAMG;AACH,qBAAa,sCAAsC;;gBAMrC,MAAM,EAAE,4CAA4C;IAK1D,OAAO,CACX,KAAK,EAAE,2CAA2C,GACjD,OAAO,CAAC,OAAO,CAAC;CAsBpB"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { OpaqueIdSchema } from '../contracts/index.js';
|
|
2
|
+
import { HostedHeartbeatInvocationContextSchema, HostedHeartbeatTaskInputSchema, } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Binds Heddle's provider-neutral scheduler transport to hosted execution.
|
|
5
|
+
*
|
|
6
|
+
* Product code supplies only authorized scope/session resolution. This class
|
|
7
|
+
* owns execution-id correlation and delegates authority, credentials, and
|
|
8
|
+
* stream semantics to `HostedHeartbeatTaskService`.
|
|
9
|
+
*/
|
|
10
|
+
export class HostedHeartbeatAgentExecutionTransport {
|
|
11
|
+
#runner;
|
|
12
|
+
#resolveInvocationContext;
|
|
13
|
+
constructor(config) {
|
|
14
|
+
this.#runner = config.runner;
|
|
15
|
+
this.#resolveInvocationContext = config.resolveInvocationContext;
|
|
16
|
+
}
|
|
17
|
+
async execute(input) {
|
|
18
|
+
input.signal.throwIfAborted();
|
|
19
|
+
const { executionId: rawExecutionId, ...request } = input.request;
|
|
20
|
+
const executionId = OpaqueIdSchema.parse(rawExecutionId);
|
|
21
|
+
const context = HostedHeartbeatInvocationContextSchema.parse(await this.#resolveInvocationContext({
|
|
22
|
+
taskId: input.request.taskId,
|
|
23
|
+
executionId,
|
|
24
|
+
signal: input.signal,
|
|
25
|
+
}));
|
|
26
|
+
input.signal.throwIfAborted();
|
|
27
|
+
return await this.#runner.execute(HostedHeartbeatTaskInputSchema.parse({
|
|
28
|
+
...request,
|
|
29
|
+
invocationId: executionId,
|
|
30
|
+
scope: context.scope,
|
|
31
|
+
runtimeSessionId: context.runtimeSessionId,
|
|
32
|
+
...(context.deadlineAt ? { deadlineAt: context.deadlineAt } : {}),
|
|
33
|
+
signal: input.signal,
|
|
34
|
+
publishActivity: input.publishActivity,
|
|
35
|
+
}));
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=hosted-heartbeat-agent-execution-transport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hosted-heartbeat-agent-execution-transport.js","sourceRoot":"","sources":["../../src/heartbeat/hosted-heartbeat-agent-execution-transport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EACL,sCAAsC,EACtC,8BAA8B,GAG/B,MAAM,YAAY,CAAC;AAEpB;;;;;;GAMG;AACH,MAAM,OAAO,sCAAsC;IACxC,OAAO,CAAyD;IAChE,yBAAyB,CAEhC;IAEF,YAAY,MAAoD;QAC9D,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC;QAC7B,IAAI,CAAC,yBAAyB,GAAG,MAAM,CAAC,wBAAwB,CAAC;IACnE,CAAC;IAED,KAAK,CAAC,OAAO,CACX,KAAkD;QAElD,KAAK,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC;QAC9B,MAAM,EAAE,WAAW,EAAE,cAAc,EAAE,GAAG,OAAO,EAAE,GAAG,KAAK,CAAC,OAAO,CAAC;QAClE,MAAM,WAAW,GAAG,cAAc,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;QACzD,MAAM,OAAO,GAAG,sCAAsC,CAAC,KAAK,CAC1D,MAAM,IAAI,CAAC,yBAAyB,CAAC;YACnC,MAAM,EAAE,KAAK,CAAC,OAAO,CAAC,MAAM;YAC5B,WAAW;YACX,MAAM,EAAE,KAAK,CAAC,MAAM;SACrB,CAAC,CACH,CAAC;QACF,KAAK,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC;QAC9B,OAAO,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,8BAA8B,CAAC,KAAK,CAAC;YACrE,GAAG,OAAO;YACV,YAAY,EAAE,WAAW;YACzB,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,gBAAgB,EAAE,OAAO,CAAC,gBAAgB;YAC1C,GAAG,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACjE,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,eAAe,EAAE,KAAK,CAAC,eAAe;SACvC,CAAC,CAAC,CAAC;IACN,CAAC;CACF","sourcesContent":["import { OpaqueIdSchema } from '../contracts/index.js';\nimport {\n HostedHeartbeatInvocationContextSchema,\n HostedHeartbeatTaskInputSchema,\n type HostedHeartbeatAgentExecutionTransportConfig,\n type HostedHeartbeatAgentExecutionTransportInput,\n} from './types.js';\n\n/**\n * Binds Heddle's provider-neutral scheduler transport to hosted execution.\n *\n * Product code supplies only authorized scope/session resolution. This class\n * owns execution-id correlation and delegates authority, credentials, and\n * stream semantics to `HostedHeartbeatTaskService`.\n */\nexport class HostedHeartbeatAgentExecutionTransport {\n readonly #runner: HostedHeartbeatAgentExecutionTransportConfig['runner'];\n readonly #resolveInvocationContext: HostedHeartbeatAgentExecutionTransportConfig[\n 'resolveInvocationContext'\n ];\n\n constructor(config: HostedHeartbeatAgentExecutionTransportConfig) {\n this.#runner = config.runner;\n this.#resolveInvocationContext = config.resolveInvocationContext;\n }\n\n async execute(\n input: HostedHeartbeatAgentExecutionTransportInput,\n ): Promise<unknown> {\n input.signal.throwIfAborted();\n const { executionId: rawExecutionId, ...request } = input.request;\n const executionId = OpaqueIdSchema.parse(rawExecutionId);\n const context = HostedHeartbeatInvocationContextSchema.parse(\n await this.#resolveInvocationContext({\n taskId: input.request.taskId,\n executionId,\n signal: input.signal,\n }),\n );\n input.signal.throwIfAborted();\n return await this.#runner.execute(HostedHeartbeatTaskInputSchema.parse({\n ...request,\n invocationId: executionId,\n scope: context.scope,\n runtimeSessionId: context.runtimeSessionId,\n ...(context.deadlineAt ? { deadlineAt: context.deadlineAt } : {}),\n signal: input.signal,\n publishActivity: input.publishActivity,\n }));\n }\n}\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type HostedHeartbeatTaskInput, type HostedHeartbeatTaskRunner, type HostedHeartbeatTaskServiceConfig } from './types.js';
|
|
2
|
+
export declare class HostedHeartbeatConfigurationError extends Error {
|
|
3
|
+
readonly name = "HostedHeartbeatConfigurationError";
|
|
4
|
+
}
|
|
5
|
+
export declare class HostedHeartbeatExecutionError extends Error {
|
|
6
|
+
readonly code: string;
|
|
7
|
+
readonly name = "HostedHeartbeatExecutionError";
|
|
8
|
+
constructor(code: string);
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Provider-neutral application service for one remotely executed heartbeat.
|
|
12
|
+
*
|
|
13
|
+
* It owns authority issuance, optional product-tool policy, model credentials,
|
|
14
|
+
* ordered stream consumption, cancellation, and terminal classification. The
|
|
15
|
+
* caller owns product scope/session mapping and the durable heartbeat store.
|
|
16
|
+
*/
|
|
17
|
+
export declare class HostedHeartbeatTaskService implements HostedHeartbeatTaskRunner {
|
|
18
|
+
#private;
|
|
19
|
+
constructor(config: HostedHeartbeatTaskServiceConfig);
|
|
20
|
+
execute(rawInput: HostedHeartbeatTaskInput): Promise<unknown>;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=hosted-heartbeat-task-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hosted-heartbeat-task-service.d.ts","sourceRoot":"","sources":["../../src/heartbeat/hosted-heartbeat-task-service.ts"],"names":[],"mappings":"AAKA,OAAO,EAEL,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAC9B,KAAK,gCAAgC,EACtC,MAAM,YAAY,CAAC;AAEpB,qBAAa,iCAAkC,SAAQ,KAAK;IAC1D,QAAQ,CAAC,IAAI,uCAAuC;CACrD;AAED,qBAAa,6BAA8B,SAAQ,KAAK;IAG1C,QAAQ,CAAC,IAAI,EAAE,MAAM;IAFjC,QAAQ,CAAC,IAAI,mCAAmC;gBAE3B,IAAI,EAAE,MAAM;CAGlC;AAED;;;;;;GAMG;AACH,qBAAa,0BACb,YAAW,yBAAyB;;gBAQtB,MAAM,EAAE,gCAAgC;IAS9C,OAAO,CACX,QAAQ,EAAE,wBAAwB,GACjC,OAAO,CAAC,OAAO,CAAC;CA+DpB"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { HEARTBEAT_TASK_WORKFLOW, McpAllowedToolsSchema, } from '../contracts/index.js';
|
|
2
|
+
import { ExecutionHostInvocationCancelledError } from '../http-sse/index.js';
|
|
3
|
+
import { HostedHeartbeatTaskInputSchema, } from './types.js';
|
|
4
|
+
export class HostedHeartbeatConfigurationError extends Error {
|
|
5
|
+
name = 'HostedHeartbeatConfigurationError';
|
|
6
|
+
}
|
|
7
|
+
export class HostedHeartbeatExecutionError extends Error {
|
|
8
|
+
code;
|
|
9
|
+
name = 'HostedHeartbeatExecutionError';
|
|
10
|
+
constructor(code) {
|
|
11
|
+
super('Execution Host heartbeat task failed.');
|
|
12
|
+
this.code = code;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Provider-neutral application service for one remotely executed heartbeat.
|
|
17
|
+
*
|
|
18
|
+
* It owns authority issuance, optional product-tool policy, model credentials,
|
|
19
|
+
* ordered stream consumption, cancellation, and terminal classification. The
|
|
20
|
+
* caller owns product scope/session mapping and the durable heartbeat store.
|
|
21
|
+
*/
|
|
22
|
+
export class HostedHeartbeatTaskService {
|
|
23
|
+
#authority;
|
|
24
|
+
#executionHost;
|
|
25
|
+
#modelCredentials;
|
|
26
|
+
#allowedTools;
|
|
27
|
+
constructor(config) {
|
|
28
|
+
this.#authority = config.authority;
|
|
29
|
+
this.#executionHost = config.executionHost;
|
|
30
|
+
this.#modelCredentials = config.modelCredentials;
|
|
31
|
+
this.#allowedTools = config.mcp
|
|
32
|
+
? Object.freeze(McpAllowedToolsSchema.parse(config.mcp.allowedTools))
|
|
33
|
+
: undefined;
|
|
34
|
+
}
|
|
35
|
+
async execute(rawInput) {
|
|
36
|
+
const input = HostedHeartbeatTaskInputSchema.parse(rawInput);
|
|
37
|
+
input.signal?.throwIfAborted();
|
|
38
|
+
const issued = await this.#authority.issue({
|
|
39
|
+
scope: input.scope,
|
|
40
|
+
runtimeSessionId: input.runtimeSessionId,
|
|
41
|
+
invocationId: input.invocationId,
|
|
42
|
+
workflow: HEARTBEAT_TASK_WORKFLOW,
|
|
43
|
+
...(this.#allowedTools
|
|
44
|
+
? { mcp: { allowedTools: this.#allowedTools } }
|
|
45
|
+
: {}),
|
|
46
|
+
});
|
|
47
|
+
const mcpCapability = issued.mcpCapability();
|
|
48
|
+
if (this.#allowedTools && !mcpCapability) {
|
|
49
|
+
throw new HostedHeartbeatConfigurationError('Hosted heartbeat tool policy requires an MCP-capable execution authority.');
|
|
50
|
+
}
|
|
51
|
+
const modelApiKey = await this.#modelCredentials.resolveModelApiKey({
|
|
52
|
+
scope: input.scope,
|
|
53
|
+
invocationId: input.invocationId,
|
|
54
|
+
signal: input.signal,
|
|
55
|
+
});
|
|
56
|
+
input.signal?.throwIfAborted();
|
|
57
|
+
for await (const event of this.#executionHost.streamHeartbeatTask({
|
|
58
|
+
invocationId: input.invocationId,
|
|
59
|
+
runtimeSessionId: input.runtimeSessionId,
|
|
60
|
+
taskId: input.taskId,
|
|
61
|
+
task: input.task,
|
|
62
|
+
...(input.checkpoint ? { checkpoint: input.checkpoint } : {}),
|
|
63
|
+
runContext: input.runContext,
|
|
64
|
+
...(input.model ? { model: input.model } : {}),
|
|
65
|
+
...(input.reasoningEffort
|
|
66
|
+
? { reasoningEffort: input.reasoningEffort }
|
|
67
|
+
: {}),
|
|
68
|
+
...(input.maxSteps !== undefined ? { maxSteps: input.maxSteps } : {}),
|
|
69
|
+
...(input.searchIgnoreDirs
|
|
70
|
+
? { searchIgnoreDirs: input.searchIgnoreDirs }
|
|
71
|
+
: {}),
|
|
72
|
+
...(input.systemContext ? { systemContext: input.systemContext } : {}),
|
|
73
|
+
...(input.deadlineAt ? { deadlineAt: input.deadlineAt } : {}),
|
|
74
|
+
...(input.signal ? { signal: input.signal } : {}),
|
|
75
|
+
executionAssertion: issued.executionAssertion(),
|
|
76
|
+
...(mcpCapability ? { mcpCapability } : {}),
|
|
77
|
+
modelApiKey,
|
|
78
|
+
})) {
|
|
79
|
+
if (event.kind === 'activity') {
|
|
80
|
+
input.publishActivity?.(event.activity);
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
if (event.kind === 'result') {
|
|
84
|
+
return event.result;
|
|
85
|
+
}
|
|
86
|
+
if (event.kind === 'cancelled') {
|
|
87
|
+
throw new ExecutionHostInvocationCancelledError();
|
|
88
|
+
}
|
|
89
|
+
if (event.kind === 'error') {
|
|
90
|
+
throw new HostedHeartbeatExecutionError(event.error.code);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
throw new HostedHeartbeatExecutionError('missing_terminal_result');
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=hosted-heartbeat-task-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hosted-heartbeat-task-service.js","sourceRoot":"","sources":["../../src/heartbeat/hosted-heartbeat-task-service.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,qBAAqB,GACtB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,qCAAqC,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OAAO,EACL,8BAA8B,GAI/B,MAAM,YAAY,CAAC;AAEpB,MAAM,OAAO,iCAAkC,SAAQ,KAAK;IACjD,IAAI,GAAG,mCAAmC,CAAC;CACrD;AAED,MAAM,OAAO,6BAA8B,SAAQ,KAAK;IAGjC;IAFZ,IAAI,GAAG,+BAA+B,CAAC;IAEhD,YAAqB,IAAY;QAC/B,KAAK,CAAC,uCAAuC,CAAC,CAAC;QAD5B,SAAI,GAAJ,IAAI,CAAQ;IAEjC,CAAC;CACF;AAED;;;;;;GAMG;AACH,MAAM,OAAO,0BAA0B;IAE5B,UAAU,CAAgD;IAC1D,cAAc,CAAoD;IAClE,iBAAiB,CAExB;IACO,aAAa,CAAgC;IAEtD,YAAY,MAAwC;QAClD,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,SAAS,CAAC;QACnC,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC,aAAa,CAAC;QAC3C,IAAI,CAAC,iBAAiB,GAAG,MAAM,CAAC,gBAAgB,CAAC;QACjD,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC,GAAG;YAC7B,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,qBAAqB,C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aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC3C,WAAW;SACZ,CAAC,EAAE,CAAC;YACH,IAAI,KAAK,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;gBAC9B,KAAK,CAAC,eAAe,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;gBACxC,SAAS;YACX,CAAC;YACD,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;gBAC5B,OAAO,KAAK,CAAC,MAAM,CAAC;YACtB,CAAC;YACD,IAAI,KAAK,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;gBAC/B,MAAM,IAAI,qCAAqC,EAAE,CAAC;YACpD,CAAC;YACD,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;gBAC3B,MAAM,IAAI,6BAA6B,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YAC5D,CAAC;QACH,CAAC;QACD,MAAM,IAAI,6BAA6B,CAAC,yBAAyB,CAAC,CAAC;IACrE,CAAC;CACF","sourcesContent":["import {\n HEARTBEAT_TASK_WORKFLOW,\n McpAllowedToolsSchema,\n} from '../contracts/index.js';\nimport { ExecutionHostInvocationCancelledError } from '../http-sse/index.js';\nimport {\n HostedHeartbeatTaskInputSchema,\n type HostedHeartbeatTaskInput,\n type HostedHeartbeatTaskRunner,\n type HostedHeartbeatTaskServiceConfig,\n} from './types.js';\n\nexport class HostedHeartbeatConfigurationError extends Error {\n readonly name = 'HostedHeartbeatConfigurationError';\n}\n\nexport class HostedHeartbeatExecutionError extends Error {\n readonly name = 'HostedHeartbeatExecutionError';\n\n constructor(readonly code: string) {\n super('Execution Host heartbeat task failed.');\n }\n}\n\n/**\n * Provider-neutral application service for one remotely executed heartbeat.\n *\n * It owns authority issuance, optional product-tool policy, model credentials,\n * ordered stream consumption, cancellation, and terminal classification. The\n * caller owns product scope/session mapping and the durable heartbeat store.\n */\nexport class HostedHeartbeatTaskService\nimplements HostedHeartbeatTaskRunner {\n readonly #authority: HostedHeartbeatTaskServiceConfig['authority'];\n readonly #executionHost: HostedHeartbeatTaskServiceConfig['executionHost'];\n readonly #modelCredentials: HostedHeartbeatTaskServiceConfig[\n 'modelCredentials'\n ];\n readonly #allowedTools: readonly string[] | undefined;\n\n constructor(config: HostedHeartbeatTaskServiceConfig) {\n this.#authority = config.authority;\n this.#executionHost = config.executionHost;\n this.#modelCredentials = config.modelCredentials;\n this.#allowedTools = config.mcp\n ? Object.freeze(McpAllowedToolsSchema.parse(config.mcp.allowedTools))\n : undefined;\n }\n\n async execute(\n rawInput: HostedHeartbeatTaskInput,\n ): Promise<unknown> {\n const input = HostedHeartbeatTaskInputSchema.parse(rawInput);\n input.signal?.throwIfAborted();\n const issued = await this.#authority.issue({\n scope: input.scope,\n runtimeSessionId: input.runtimeSessionId,\n invocationId: input.invocationId,\n workflow: HEARTBEAT_TASK_WORKFLOW,\n ...(this.#allowedTools\n ? { mcp: { allowedTools: this.#allowedTools } }\n : {}),\n });\n const mcpCapability = issued.mcpCapability();\n if (this.#allowedTools && !mcpCapability) {\n throw new HostedHeartbeatConfigurationError(\n 'Hosted heartbeat tool policy requires an MCP-capable execution authority.',\n );\n }\n const modelApiKey = await this.#modelCredentials.resolveModelApiKey({\n scope: input.scope,\n invocationId: input.invocationId,\n signal: input.signal,\n });\n input.signal?.throwIfAborted();\n\n for await (const event of this.#executionHost.streamHeartbeatTask({\n invocationId: input.invocationId,\n runtimeSessionId: input.runtimeSessionId,\n taskId: input.taskId,\n task: input.task,\n ...(input.checkpoint ? { checkpoint: input.checkpoint } : {}),\n runContext: input.runContext,\n ...(input.model ? { model: input.model } : {}),\n ...(input.reasoningEffort\n ? { reasoningEffort: input.reasoningEffort }\n : {}),\n ...(input.maxSteps !== undefined ? { maxSteps: input.maxSteps } : {}),\n ...(input.searchIgnoreDirs\n ? { searchIgnoreDirs: input.searchIgnoreDirs }\n : {}),\n ...(input.systemContext ? { systemContext: input.systemContext } : {}),\n ...(input.deadlineAt ? { deadlineAt: input.deadlineAt } : {}),\n ...(input.signal ? { signal: input.signal } : {}),\n executionAssertion: issued.executionAssertion(),\n ...(mcpCapability ? { mcpCapability } : {}),\n modelApiKey,\n })) {\n if (event.kind === 'activity') {\n input.publishActivity?.(event.activity);\n continue;\n }\n if (event.kind === 'result') {\n return event.result;\n }\n if (event.kind === 'cancelled') {\n throw new ExecutionHostInvocationCancelledError();\n }\n if (event.kind === 'error') {\n throw new HostedHeartbeatExecutionError(event.error.code);\n }\n }\n throw new HostedHeartbeatExecutionError('missing_terminal_result');\n }\n}\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { HostedHeartbeatConfigurationError, HostedHeartbeatExecutionError, HostedHeartbeatTaskService, } from './hosted-heartbeat-task-service.js';
|
|
2
|
+
export { HostedHeartbeatAgentExecutionTransport } from './hosted-heartbeat-agent-execution-transport.js';
|
|
3
|
+
export { HostedHeartbeatInvocationContextSchema, HostedHeartbeatTaskInputSchema, } from './types.js';
|
|
4
|
+
export type { HostedHeartbeatAgentExecutionRequest, HostedHeartbeatAgentExecutionTransportConfig, HostedHeartbeatAgentExecutionTransportInput, HostedHeartbeatInvocationContext, HostedHeartbeatTaskInput, HostedHeartbeatTaskRunner, HostedHeartbeatTaskServiceConfig, } from './types.js';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/heartbeat/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iCAAiC,EACjC,6BAA6B,EAC7B,0BAA0B,GAC3B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,sCAAsC,EAAE,MAAM,iDAAiD,CAAC;AACzG,OAAO,EACL,sCAAsC,EACtC,8BAA8B,GAC/B,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,oCAAoC,EACpC,4CAA4C,EAC5C,2CAA2C,EAC3C,gCAAgC,EAChC,wBAAwB,EACxB,yBAAyB,EACzB,gCAAgC,GACjC,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { HostedHeartbeatConfigurationError, HostedHeartbeatExecutionError, HostedHeartbeatTaskService, } from './hosted-heartbeat-task-service.js';
|
|
2
|
+
export { HostedHeartbeatAgentExecutionTransport } from './hosted-heartbeat-agent-execution-transport.js';
|
|
3
|
+
export { HostedHeartbeatInvocationContextSchema, HostedHeartbeatTaskInputSchema, } from './types.js';
|
|
4
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/heartbeat/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iCAAiC,EACjC,6BAA6B,EAC7B,0BAA0B,GAC3B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,sCAAsC,EAAE,MAAM,iDAAiD,CAAC;AACzG,OAAO,EACL,sCAAsC,EACtC,8BAA8B,GAC/B,MAAM,YAAY,CAAC","sourcesContent":["export {\n HostedHeartbeatConfigurationError,\n HostedHeartbeatExecutionError,\n HostedHeartbeatTaskService,\n} from './hosted-heartbeat-task-service.js';\nexport { HostedHeartbeatAgentExecutionTransport } from './hosted-heartbeat-agent-execution-transport.js';\nexport {\n HostedHeartbeatInvocationContextSchema,\n HostedHeartbeatTaskInputSchema,\n} from './types.js';\nexport type {\n HostedHeartbeatAgentExecutionRequest,\n HostedHeartbeatAgentExecutionTransportConfig,\n HostedHeartbeatAgentExecutionTransportInput,\n HostedHeartbeatInvocationContext,\n HostedHeartbeatTaskInput,\n HostedHeartbeatTaskRunner,\n HostedHeartbeatTaskServiceConfig,\n} from './types.js';\n"]}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { ExecutionAuthority } from '../authority/index.js';
|
|
3
|
+
import type { HostedModelCredentialProvider } from '../conversation/index.js';
|
|
4
|
+
import type { HeartbeatExecutionHost } from '../http-sse/index.js';
|
|
5
|
+
export declare const HostedHeartbeatTaskInputSchema: z.ZodObject<{
|
|
6
|
+
invocationId: z.ZodString;
|
|
7
|
+
deadlineAt: z.ZodOptional<z.ZodISODateTime>;
|
|
8
|
+
taskId: z.ZodString;
|
|
9
|
+
runContext: z.ZodObject<{
|
|
10
|
+
currentDateTime: z.ZodISODateTime;
|
|
11
|
+
intervalMs: z.ZodNumber;
|
|
12
|
+
continuationMode: z.ZodOptional<z.ZodEnum<{
|
|
13
|
+
operator: "operator";
|
|
14
|
+
agent: "agent";
|
|
15
|
+
}>>;
|
|
16
|
+
nextRunAt: z.ZodOptional<z.ZodISODateTime>;
|
|
17
|
+
previousRunAt: z.ZodOptional<z.ZodISODateTime>;
|
|
18
|
+
previousRunId: z.ZodOptional<z.ZodString>;
|
|
19
|
+
}, z.core.$strict>;
|
|
20
|
+
task: z.ZodString;
|
|
21
|
+
checkpoint: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
|
|
22
|
+
model: z.ZodOptional<z.ZodString>;
|
|
23
|
+
reasoningEffort: z.ZodOptional<z.ZodEnum<{
|
|
24
|
+
none: "none";
|
|
25
|
+
low: "low";
|
|
26
|
+
medium: "medium";
|
|
27
|
+
high: "high";
|
|
28
|
+
ultrahigh: "ultrahigh";
|
|
29
|
+
max: "max";
|
|
30
|
+
}>>;
|
|
31
|
+
maxSteps: z.ZodOptional<z.ZodNumber>;
|
|
32
|
+
searchIgnoreDirs: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
33
|
+
systemContext: z.ZodOptional<z.ZodString>;
|
|
34
|
+
scope: z.ZodObject<{
|
|
35
|
+
tenantId: z.ZodString;
|
|
36
|
+
subjectId: z.ZodString;
|
|
37
|
+
productSessionId: z.ZodString;
|
|
38
|
+
}, z.core.$strict>;
|
|
39
|
+
runtimeSessionId: z.ZodString;
|
|
40
|
+
signal: z.ZodOptional<z.ZodCustom<AbortSignal, AbortSignal>>;
|
|
41
|
+
publishActivity: z.ZodOptional<z.ZodCustom<(activity: unknown) => void, (activity: unknown) => void>>;
|
|
42
|
+
}, z.core.$strict>;
|
|
43
|
+
export type HostedHeartbeatTaskInput = z.infer<typeof HostedHeartbeatTaskInputSchema>;
|
|
44
|
+
export interface HostedHeartbeatTaskRunner {
|
|
45
|
+
execute(input: HostedHeartbeatTaskInput): Promise<unknown>;
|
|
46
|
+
}
|
|
47
|
+
export type HostedHeartbeatTaskServiceConfig = {
|
|
48
|
+
authority: ExecutionAuthority;
|
|
49
|
+
executionHost: HeartbeatExecutionHost;
|
|
50
|
+
modelCredentials: HostedModelCredentialProvider;
|
|
51
|
+
/** Omit this policy when the heartbeat workflow needs no product MCP tools. */
|
|
52
|
+
mcp?: {
|
|
53
|
+
allowedTools: readonly string[];
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
export declare const HostedHeartbeatInvocationContextSchema: z.ZodObject<{
|
|
57
|
+
scope: z.ZodObject<{
|
|
58
|
+
tenantId: z.ZodString;
|
|
59
|
+
subjectId: z.ZodString;
|
|
60
|
+
productSessionId: z.ZodString;
|
|
61
|
+
}, z.core.$strict>;
|
|
62
|
+
runtimeSessionId: z.ZodString;
|
|
63
|
+
deadlineAt: z.ZodOptional<z.ZodISODateTime>;
|
|
64
|
+
}, z.core.$strict>;
|
|
65
|
+
export type HostedHeartbeatInvocationContext = z.infer<typeof HostedHeartbeatInvocationContextSchema>;
|
|
66
|
+
export type HostedHeartbeatAgentExecutionRequest = Omit<HostedHeartbeatTaskInput, 'scope' | 'runtimeSessionId' | 'invocationId' | 'deadlineAt' | 'signal' | 'publishActivity' | 'checkpoint'> & {
|
|
67
|
+
executionId: string;
|
|
68
|
+
checkpoint?: unknown;
|
|
69
|
+
};
|
|
70
|
+
export type HostedHeartbeatAgentExecutionTransportInput = {
|
|
71
|
+
request: HostedHeartbeatAgentExecutionRequest;
|
|
72
|
+
signal: AbortSignal;
|
|
73
|
+
publishActivity: (activity: unknown) => void;
|
|
74
|
+
};
|
|
75
|
+
export type HostedHeartbeatAgentExecutionTransportConfig = {
|
|
76
|
+
runner: HostedHeartbeatTaskRunner;
|
|
77
|
+
resolveInvocationContext(input: {
|
|
78
|
+
taskId: string;
|
|
79
|
+
executionId: string;
|
|
80
|
+
signal: AbortSignal;
|
|
81
|
+
}): HostedHeartbeatInvocationContext | Promise<HostedHeartbeatInvocationContext>;
|
|
82
|
+
};
|
|
83
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/heartbeat/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAMhE,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,0BAA0B,CAAC;AAC9E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAEnE,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0DAWF,OAAO,KAAK,IAAI,aAAhB,OAAO,KAAK,IAAI;kBAI5C,CAAC;AAEd,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAC5C,OAAO,8BAA8B,CACtC,CAAC;AAEF,MAAM,WAAW,yBAAyB;IACxC,OAAO,CAAC,KAAK,EAAE,wBAAwB,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAC5D;AAED,MAAM,MAAM,gCAAgC,GAAG;IAC7C,SAAS,EAAE,kBAAkB,CAAC;IAC9B,aAAa,EAAE,sBAAsB,CAAC;IACtC,gBAAgB,EAAE,6BAA6B,CAAC;IAChD,+EAA+E;IAC/E,GAAG,CAAC,EAAE;QACJ,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;KACjC,CAAC;CACH,CAAC;AAEF,eAAO,MAAM,sCAAsC;;;;;;;;kBAIxC,CAAC;AAEZ,MAAM,MAAM,gCAAgC,GAAG,CAAC,CAAC,KAAK,CACpD,OAAO,sCAAsC,CAC9C,CAAC;AAEF,MAAM,MAAM,oCAAoC,GAAG,IAAI,CACrD,wBAAwB,EACtB,OAAO,GACP,kBAAkB,GAClB,cAAc,GACd,YAAY,GACZ,QAAQ,GACR,iBAAiB,GACjB,YAAY,CACf,GAAG;IACF,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,2CAA2C,GAAG;IACxD,OAAO,EAAE,oCAAoC,CAAC;IAC9C,MAAM,EAAE,WAAW,CAAC;IACpB,eAAe,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;CAC9C,CAAC;AAEF,MAAM,MAAM,4CAA4C,GAAG;IACzD,MAAM,EAAE,yBAAyB,CAAC;IAClC,wBAAwB,CAAC,KAAK,EAAE;QAC9B,MAAM,EAAE,MAAM,CAAC;QACf,WAAW,EAAE,MAAM,CAAC;QACpB,MAAM,EAAE,WAAW,CAAC;KACrB,GAAG,gCAAgC,GAChC,OAAO,CAAC,gCAAgC,CAAC,CAAC;CAC/C,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ExecutionHostHeartbeatTaskRequestSchema, ExecutionScopeSchema, RuntimeSessionIdSchema, } from '../contracts/index.js';
|
|
3
|
+
export const HostedHeartbeatTaskInputSchema = ExecutionHostHeartbeatTaskRequestSchema.omit({
|
|
4
|
+
schemaVersion: true,
|
|
5
|
+
kind: true,
|
|
6
|
+
}).extend({
|
|
7
|
+
scope: ExecutionScopeSchema.omit({ adopterId: true }),
|
|
8
|
+
runtimeSessionId: RuntimeSessionIdSchema,
|
|
9
|
+
signal: z.custom((value) => value instanceof AbortSignal, 'signal must be an AbortSignal').optional(),
|
|
10
|
+
publishActivity: z.custom((value) => typeof value === 'function', 'publishActivity must be a function').optional(),
|
|
11
|
+
}).strict();
|
|
12
|
+
export const HostedHeartbeatInvocationContextSchema = z.object({
|
|
13
|
+
scope: ExecutionScopeSchema.omit({ adopterId: true }),
|
|
14
|
+
runtimeSessionId: RuntimeSessionIdSchema,
|
|
15
|
+
deadlineAt: ExecutionHostHeartbeatTaskRequestSchema.shape.deadlineAt,
|
|
16
|
+
}).strict();
|
|
17
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/heartbeat/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,uCAAuC,EACvC,oBAAoB,EACpB,sBAAsB,GACvB,MAAM,uBAAuB,CAAC;AAI/B,MAAM,CAAC,MAAM,8BAA8B,GACzC,uCAAuC,CAAC,IAAI,CAAC;IAC3C,aAAa,EAAE,IAAI;IACnB,IAAI,EAAE,IAAI;CACX,CAAC,CAAC,MAAM,CAAC;IACR,KAAK,EAAE,oBAAoB,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;IACrD,gBAAgB,EAAE,sBAAsB;IACxC,MAAM,EAAE,CAAC,CAAC,MAAM,CACd,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,YAAY,WAAW,EACvC,+BAA+B,CAChC,CAAC,QAAQ,EAAE;IACZ,eAAe,EAAE,CAAC,CAAC,MAAM,CACvB,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,KAAK,KAAK,UAAU,EACtC,oCAAoC,CACrC,CAAC,QAAQ,EAAE;CACb,CAAC,CAAC,MAAM,EAAE,CAAC;AAoBd,MAAM,CAAC,MAAM,sCAAsC,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7D,KAAK,EAAE,oBAAoB,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;IACrD,gBAAgB,EAAE,sBAAsB;IACxC,UAAU,EAAE,uCAAuC,CAAC,KAAK,CAAC,UAAU;CACrE,CAAC,CAAC,MAAM,EAAE,CAAC","sourcesContent":["import { z } from 'zod';\nimport type { ExecutionAuthority } from '../authority/index.js';\nimport {\n ExecutionHostHeartbeatTaskRequestSchema,\n ExecutionScopeSchema,\n RuntimeSessionIdSchema,\n} from '../contracts/index.js';\nimport type { HostedModelCredentialProvider } from '../conversation/index.js';\nimport type { HeartbeatExecutionHost } from '../http-sse/index.js';\n\nexport const HostedHeartbeatTaskInputSchema =\n ExecutionHostHeartbeatTaskRequestSchema.omit({\n schemaVersion: true,\n kind: true,\n }).extend({\n scope: ExecutionScopeSchema.omit({ adopterId: true }),\n runtimeSessionId: RuntimeSessionIdSchema,\n signal: z.custom<AbortSignal>(\n (value) => value instanceof AbortSignal,\n 'signal must be an AbortSignal',\n ).optional(),\n publishActivity: z.custom<(activity: unknown) => void>(\n (value) => typeof value === 'function',\n 'publishActivity must be a function',\n ).optional(),\n }).strict();\n\nexport type HostedHeartbeatTaskInput = z.infer<\n typeof HostedHeartbeatTaskInputSchema\n>;\n\nexport interface HostedHeartbeatTaskRunner {\n execute(input: HostedHeartbeatTaskInput): Promise<unknown>;\n}\n\nexport type HostedHeartbeatTaskServiceConfig = {\n authority: ExecutionAuthority;\n executionHost: HeartbeatExecutionHost;\n modelCredentials: HostedModelCredentialProvider;\n /** Omit this policy when the heartbeat workflow needs no product MCP tools. */\n mcp?: {\n allowedTools: readonly string[];\n };\n};\n\nexport const HostedHeartbeatInvocationContextSchema = z.object({\n scope: ExecutionScopeSchema.omit({ adopterId: true }),\n runtimeSessionId: RuntimeSessionIdSchema,\n deadlineAt: ExecutionHostHeartbeatTaskRequestSchema.shape.deadlineAt,\n}).strict();\n\nexport type HostedHeartbeatInvocationContext = z.infer<\n typeof HostedHeartbeatInvocationContextSchema\n>;\n\nexport type HostedHeartbeatAgentExecutionRequest = Omit<\n HostedHeartbeatTaskInput,\n | 'scope'\n | 'runtimeSessionId'\n | 'invocationId'\n | 'deadlineAt'\n | 'signal'\n | 'publishActivity'\n | 'checkpoint'\n> & {\n executionId: string;\n checkpoint?: unknown;\n};\n\nexport type HostedHeartbeatAgentExecutionTransportInput = {\n request: HostedHeartbeatAgentExecutionRequest;\n signal: AbortSignal;\n publishActivity: (activity: unknown) => void;\n};\n\nexport type HostedHeartbeatAgentExecutionTransportConfig = {\n runner: HostedHeartbeatTaskRunner;\n resolveInvocationContext(input: {\n taskId: string;\n executionId: string;\n signal: AbortSignal;\n }): HostedHeartbeatInvocationContext\n | Promise<HostedHeartbeatInvocationContext>;\n};\n"]}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { type ExecutionHostStreamEvent } from '../contracts/index.js';
|
|
2
|
-
import type { DirectHttpExecutionHostConfig, ExecutionHost, ExecutionHostConversationTurn } from './types.js';
|
|
1
|
+
import { type ExecutionHostHeartbeatStreamEvent, type ExecutionHostStreamEvent } from '../contracts/index.js';
|
|
2
|
+
import type { DirectHttpExecutionHostConfig, ExecutionHost, ExecutionHostConversationTurn, ExecutionHostHeartbeatTask, HeartbeatExecutionHost } from './types.js';
|
|
3
3
|
/**
|
|
4
4
|
* Strict direct-development HTTP/SSE adapter for the Execution Host v1 wire.
|
|
5
5
|
* It deliberately owns neither AWS SDK nor SigV4 behavior.
|
|
6
6
|
*/
|
|
7
|
-
export declare class DirectHttpExecutionHost implements ExecutionHost {
|
|
7
|
+
export declare class DirectHttpExecutionHost implements ExecutionHost, HeartbeatExecutionHost {
|
|
8
8
|
#private;
|
|
9
9
|
constructor(config: DirectHttpExecutionHostConfig);
|
|
10
10
|
streamConversationTurn(rawInput: ExecutionHostConversationTurn): AsyncIterable<ExecutionHostStreamEvent>;
|
|
11
|
+
streamHeartbeatTask(rawInput: ExecutionHostHeartbeatTask): AsyncIterable<ExecutionHostHeartbeatStreamEvent>;
|
|
11
12
|
}
|
|
12
13
|
//# sourceMappingURL=direct-http-execution-host.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"direct-http-execution-host.d.ts","sourceRoot":"","sources":["../../src/http-sse/direct-http-execution-host.ts"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"direct-http-execution-host.d.ts","sourceRoot":"","sources":["../../src/http-sse/direct-http-execution-host.ts"],"names":[],"mappings":"AAEA,OAAO,EAmBL,KAAK,iCAAiC,EACtC,KAAK,wBAAwB,EAC9B,MAAM,uBAAuB,CAAC;AAO/B,OAAO,KAAK,EACV,6BAA6B,EAC7B,aAAa,EACb,6BAA6B,EAC7B,0BAA0B,EAC1B,sBAAsB,EACvB,MAAM,YAAY,CAAC;AAkCpB;;;GAGG;AACH,qBAAa,uBACb,YAAW,aAAa,EAAE,sBAAsB;;gBAKlC,MAAM,EAAE,6BAA6B;IAO1C,sBAAsB,CAC3B,QAAQ,EAAE,6BAA6B,GACtC,aAAa,CAAC,wBAAwB,CAAC;IAoBnC,mBAAmB,CACxB,QAAQ,EAAE,0BAA0B,GACnC,aAAa,CAAC,iCAAiC,CAAC;CAwJpD"}
|