@heddleagent/execution-host-client 6.0.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.
Files changed (62) hide show
  1. package/README.md +76 -14
  2. package/dist/agentcore/agentcore-execution-host.d.ts +17 -0
  3. package/dist/agentcore/agentcore-execution-host.d.ts.map +1 -0
  4. package/dist/agentcore/agentcore-execution-host.js +201 -0
  5. package/dist/agentcore/agentcore-execution-host.js.map +1 -0
  6. package/dist/agentcore/index.d.ts +3 -0
  7. package/dist/agentcore/index.d.ts.map +1 -0
  8. package/dist/agentcore/index.js +2 -0
  9. package/dist/agentcore/index.js.map +1 -0
  10. package/dist/agentcore/types.d.ts +14 -0
  11. package/dist/agentcore/types.d.ts.map +1 -0
  12. package/dist/agentcore/types.js +2 -0
  13. package/dist/agentcore/types.js.map +1 -0
  14. package/dist/authority/jose-execution-authority.js +2 -2
  15. package/dist/authority/jose-execution-authority.js.map +1 -1
  16. package/dist/contracts/index.d.ts +106 -3
  17. package/dist/contracts/index.d.ts.map +1 -1
  18. package/dist/contracts/index.js +67 -2
  19. package/dist/contracts/index.js.map +1 -1
  20. package/dist/conversation/index.d.ts +1 -1
  21. package/dist/conversation/index.d.ts.map +1 -1
  22. package/dist/conversation/index.js.map +1 -1
  23. package/dist/conversation/types.d.ts +4 -2
  24. package/dist/conversation/types.d.ts.map +1 -1
  25. package/dist/conversation/types.js.map +1 -1
  26. package/dist/heartbeat/hosted-heartbeat-agent-execution-transport.d.ts +14 -0
  27. package/dist/heartbeat/hosted-heartbeat-agent-execution-transport.d.ts.map +1 -0
  28. package/dist/heartbeat/hosted-heartbeat-agent-execution-transport.js +38 -0
  29. package/dist/heartbeat/hosted-heartbeat-agent-execution-transport.js.map +1 -0
  30. package/dist/heartbeat/hosted-heartbeat-task-service.d.ts +22 -0
  31. package/dist/heartbeat/hosted-heartbeat-task-service.d.ts.map +1 -0
  32. package/dist/heartbeat/hosted-heartbeat-task-service.js +96 -0
  33. package/dist/heartbeat/hosted-heartbeat-task-service.js.map +1 -0
  34. package/dist/heartbeat/index.d.ts +5 -0
  35. package/dist/heartbeat/index.d.ts.map +1 -0
  36. package/dist/heartbeat/index.js +4 -0
  37. package/dist/heartbeat/index.js.map +1 -0
  38. package/dist/heartbeat/types.d.ts +83 -0
  39. package/dist/heartbeat/types.d.ts.map +1 -0
  40. package/dist/heartbeat/types.js +17 -0
  41. package/dist/heartbeat/types.js.map +1 -0
  42. package/dist/http-sse/direct-http-execution-host.d.ts +4 -3
  43. package/dist/http-sse/direct-http-execution-host.d.ts.map +1 -1
  44. package/dist/http-sse/direct-http-execution-host.js +56 -21
  45. package/dist/http-sse/direct-http-execution-host.js.map +1 -1
  46. package/dist/http-sse/index.d.ts +1 -1
  47. package/dist/http-sse/index.d.ts.map +1 -1
  48. package/dist/http-sse/index.js.map +1 -1
  49. package/dist/http-sse/types.d.ts +11 -1
  50. package/dist/http-sse/types.d.ts.map +1 -1
  51. package/dist/http-sse/types.js.map +1 -1
  52. package/dist/index.d.ts +1 -0
  53. package/dist/index.d.ts.map +1 -1
  54. package/dist/index.js +1 -0
  55. package/dist/index.js.map +1 -1
  56. package/package.json +11 -1
  57. package/spec/v1/README.md +14 -4
  58. package/spec/v1/fixtures/manifest.json +12 -0
  59. package/spec/v1/fixtures/valid-heartbeat-request.json +23 -0
  60. package/spec/v1/fixtures/valid-heartbeat-result.sse +13 -0
  61. package/spec/v1/openapi.json +513 -6
  62. package/spec/v1/schema-bundle.json +499 -2
@@ -1,6 +1,7 @@
1
1
  import { z } from 'zod';
2
2
  export declare const EXECUTION_CONTRACT_VERSION: 1;
3
3
  export declare const CONVERSATION_TURN_WORKFLOW: "conversation-turn";
4
+ export declare const HEARTBEAT_TASK_WORKFLOW: "heartbeat-task";
4
5
  export declare const EXECUTION_ASSERTION_TYPE: "heddle-execution+jwt";
5
6
  export declare const MCP_CAPABILITY_TYPE: "heddle-mcp-capability+jwt";
6
7
  export declare const AGENTCORE_RUNTIME_SESSION_HEADER: "x-amzn-bedrock-agentcore-runtime-session-id";
@@ -29,6 +30,49 @@ export declare const ExecutionHostConversationTurnRequestSchema: z.ZodObject<{
29
30
  prompt: z.ZodString;
30
31
  deadlineAt: z.ZodOptional<z.ZodISODateTime>;
31
32
  }, z.core.$strict>;
33
+ export declare const HeartbeatRunContextSchema: z.ZodObject<{
34
+ currentDateTime: z.ZodISODateTime;
35
+ intervalMs: z.ZodNumber;
36
+ continuationMode: z.ZodOptional<z.ZodEnum<{
37
+ operator: "operator";
38
+ agent: "agent";
39
+ }>>;
40
+ nextRunAt: z.ZodOptional<z.ZodISODateTime>;
41
+ previousRunAt: z.ZodOptional<z.ZodISODateTime>;
42
+ previousRunId: z.ZodOptional<z.ZodString>;
43
+ }, z.core.$strict>;
44
+ export declare const ExecutionHostHeartbeatTaskRequestSchema: z.ZodObject<{
45
+ schemaVersion: z.ZodLiteral<1>;
46
+ kind: z.ZodLiteral<"heartbeat-task">;
47
+ invocationId: z.ZodString;
48
+ taskId: z.ZodString;
49
+ task: z.ZodString;
50
+ checkpoint: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
51
+ runContext: z.ZodObject<{
52
+ currentDateTime: z.ZodISODateTime;
53
+ intervalMs: z.ZodNumber;
54
+ continuationMode: z.ZodOptional<z.ZodEnum<{
55
+ operator: "operator";
56
+ agent: "agent";
57
+ }>>;
58
+ nextRunAt: z.ZodOptional<z.ZodISODateTime>;
59
+ previousRunAt: z.ZodOptional<z.ZodISODateTime>;
60
+ previousRunId: z.ZodOptional<z.ZodString>;
61
+ }, z.core.$strict>;
62
+ model: z.ZodOptional<z.ZodString>;
63
+ reasoningEffort: z.ZodOptional<z.ZodEnum<{
64
+ none: "none";
65
+ low: "low";
66
+ medium: "medium";
67
+ high: "high";
68
+ ultrahigh: "ultrahigh";
69
+ max: "max";
70
+ }>>;
71
+ maxSteps: z.ZodOptional<z.ZodNumber>;
72
+ searchIgnoreDirs: z.ZodOptional<z.ZodArray<z.ZodString>>;
73
+ systemContext: z.ZodOptional<z.ZodString>;
74
+ deadlineAt: z.ZodOptional<z.ZodISODateTime>;
75
+ }, z.core.$strict>;
32
76
  export declare const RuntimePublicResultSchema: z.ZodObject<{
33
77
  outcome: z.ZodEnum<{
34
78
  error: "error";
@@ -117,6 +161,53 @@ export declare const ExecutionHostStreamEventSchema: z.ZodDiscriminatedUnion<[z.
117
161
  message: z.ZodString;
118
162
  }, z.core.$strict>;
119
163
  }, z.core.$strict>], "kind">;
164
+ export declare const ExecutionHostHeartbeatStreamEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
165
+ schemaVersion: z.ZodLiteral<1>;
166
+ invocationId: z.ZodString;
167
+ runId: z.ZodString;
168
+ timestamp: z.ZodISODateTime;
169
+ sequence: z.ZodLiteral<0>;
170
+ kind: z.ZodLiteral<"accepted">;
171
+ }, z.core.$strict>, z.ZodObject<{
172
+ schemaVersion: z.ZodLiteral<1>;
173
+ invocationId: z.ZodString;
174
+ runId: z.ZodString;
175
+ sequence: z.ZodNumber;
176
+ timestamp: z.ZodISODateTime;
177
+ kind: z.ZodLiteral<"activity">;
178
+ activity: z.ZodJSONSchema;
179
+ }, z.core.$strict>, z.ZodObject<{
180
+ schemaVersion: z.ZodLiteral<1>;
181
+ invocationId: z.ZodString;
182
+ runId: z.ZodString;
183
+ sequence: z.ZodNumber;
184
+ timestamp: z.ZodISODateTime;
185
+ kind: z.ZodLiteral<"result">;
186
+ result: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
187
+ }, z.core.$strict>, z.ZodObject<{
188
+ schemaVersion: z.ZodLiteral<1>;
189
+ invocationId: z.ZodString;
190
+ runId: z.ZodString;
191
+ sequence: z.ZodNumber;
192
+ timestamp: z.ZodISODateTime;
193
+ kind: z.ZodLiteral<"cancelled">;
194
+ reason: z.ZodString;
195
+ }, z.core.$strict>, z.ZodObject<{
196
+ schemaVersion: z.ZodLiteral<1>;
197
+ invocationId: z.ZodString;
198
+ runId: z.ZodString;
199
+ sequence: z.ZodNumber;
200
+ timestamp: z.ZodISODateTime;
201
+ kind: z.ZodLiteral<"error">;
202
+ error: z.ZodObject<{
203
+ code: z.ZodString;
204
+ message: z.ZodString;
205
+ }, z.core.$strict>;
206
+ }, z.core.$strict>], "kind">;
207
+ export declare const HostedExecutionWorkflowSchema: z.ZodEnum<{
208
+ "conversation-turn": "conversation-turn";
209
+ "heartbeat-task": "heartbeat-task";
210
+ }>;
120
211
  export declare const ExecutionAssertionClaimsSchema: z.ZodObject<{
121
212
  iss: z.ZodURL;
122
213
  aud: z.ZodString;
@@ -125,7 +216,10 @@ export declare const ExecutionAssertionClaimsSchema: z.ZodObject<{
125
216
  tenantId: z.ZodString;
126
217
  productSessionId: z.ZodString;
127
218
  runtimeSessionId: z.ZodString;
128
- workflow: z.ZodLiteral<"conversation-turn">;
219
+ workflow: z.ZodEnum<{
220
+ "conversation-turn": "conversation-turn";
221
+ "heartbeat-task": "heartbeat-task";
222
+ }>;
129
223
  sub: z.ZodString;
130
224
  jti: z.ZodString;
131
225
  iat: z.ZodNumber;
@@ -140,7 +234,10 @@ export declare const McpCapabilityClaimsSchema: z.ZodObject<{
140
234
  productSessionId: z.ZodString;
141
235
  runtimeSessionId: z.ZodString;
142
236
  invocationId: z.ZodString;
143
- workflow: z.ZodLiteral<"conversation-turn">;
237
+ workflow: z.ZodEnum<{
238
+ "conversation-turn": "conversation-turn";
239
+ "heartbeat-task": "heartbeat-task";
240
+ }>;
144
241
  serverId: z.ZodString;
145
242
  allowedTools: z.ZodArray<z.ZodString>;
146
243
  sub: z.ZodString;
@@ -150,14 +247,20 @@ export declare const McpCapabilityClaimsSchema: z.ZodObject<{
150
247
  }, z.core.$loose>;
151
248
  export type ExecutionScope = z.infer<typeof ExecutionScopeSchema>;
152
249
  export type ExecutionHostConversationTurnRequest = z.infer<typeof ExecutionHostConversationTurnRequestSchema>;
250
+ export type ExecutionHostHeartbeatTaskRequest = z.infer<typeof ExecutionHostHeartbeatTaskRequestSchema>;
153
251
  export type RuntimePublicResult = z.infer<typeof RuntimePublicResultSchema>;
154
252
  export type ExecutionHostStreamEvent = z.infer<typeof ExecutionHostStreamEventSchema>;
155
253
  export type ExecutionHostTerminalEvent = Extract<ExecutionHostStreamEvent, {
156
254
  kind: 'result' | 'cancelled' | 'error';
157
255
  }>;
256
+ export type ExecutionHostHeartbeatStreamEvent = z.infer<typeof ExecutionHostHeartbeatStreamEventSchema>;
257
+ export type ExecutionHostHeartbeatTerminalEvent = Extract<ExecutionHostHeartbeatStreamEvent, {
258
+ kind: 'result' | 'cancelled' | 'error';
259
+ }>;
158
260
  export type ExecutionAssertionClaims = z.infer<typeof ExecutionAssertionClaimsSchema>;
159
261
  export type McpCapabilityClaims = z.infer<typeof McpCapabilityClaimsSchema>;
160
- export type HostedExecutionWorkflow = typeof CONVERSATION_TURN_WORKFLOW;
262
+ export type HostedExecutionWorkflow = z.infer<typeof HostedExecutionWorkflowSchema>;
161
263
  export declare function isExecutionHostTerminalEvent(event: ExecutionHostStreamEvent): event is ExecutionHostTerminalEvent;
264
+ export declare function isExecutionHostHeartbeatTerminalEvent(event: ExecutionHostHeartbeatStreamEvent): event is ExecutionHostHeartbeatTerminalEvent;
162
265
  export declare function isSafeWebUrl(url: URL): boolean;
163
266
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/contracts/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,0BAA0B,EAAG,CAAU,CAAC;AACrD,eAAO,MAAM,0BAA0B,EAAG,mBAA4B,CAAC;AACvE,eAAO,MAAM,wBAAwB,EAAG,sBAA+B,CAAC;AACxE,eAAO,MAAM,mBAAmB,EAAG,2BAAoC,CAAC;AAExE,eAAO,MAAM,gCAAgC,EAC3C,6CAAsD,CAAC;AACzD,eAAO,MAAM,iCAAiC,EAC5C,qCAA8C,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CAAC;AACF,MAAM,MAAM,0BAA0B,GAAG,OAAO,CAC9C,wBAAwB,EACxB;IAAE,IAAI,EAAE,QAAQ,GAAG,WAAW,GAAG,OAAO,CAAA;CAAE,CAC3C,CAAC;AACF,MAAM,MAAM,iCAAiC,GAAG,CAAC,CAAC,KAAK,CACrD,OAAO,uCAAuC,CAC/C,CAAC;AACF,MAAM,MAAM,mCAAmC,GAAG,OAAO,CACvD,iCAAiC,EACjC;IAAE,IAAI,EAAE,QAAQ,GAAG,WAAW,GAAG,OAAO,CAAA;CAAE,CAC3C,CAAC;AACF,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAC5C,OAAO,8BAA8B,CACtC,CAAC;AACF,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAC5E,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAC3C,OAAO,6BAA6B,CACrC,CAAC;AAEF,wBAAgB,4BAA4B,CAC1C,KAAK,EAAE,wBAAwB,GAC9B,KAAK,IAAI,0BAA0B,CAIrC;AAED,wBAAgB,qCAAqC,CACnD,KAAK,EAAE,iCAAiC,GACvC,KAAK,IAAI,mCAAmC,CAI9C;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAO9C"}
@@ -1,6 +1,7 @@
1
1
  import { z } from 'zod';
2
2
  export const EXECUTION_CONTRACT_VERSION = 1;
3
3
  export const CONVERSATION_TURN_WORKFLOW = 'conversation-turn';
4
+ export const HEARTBEAT_TASK_WORKFLOW = 'heartbeat-task';
4
5
  export const EXECUTION_ASSERTION_TYPE = 'heddle-execution+jwt';
5
6
  export const MCP_CAPABILITY_TYPE = 'heddle-mcp-capability+jwt';
6
7
  export const AGENTCORE_RUNTIME_SESSION_HEADER = 'x-amzn-bedrock-agentcore-runtime-session-id';
@@ -52,6 +53,36 @@ export const ExecutionHostConversationTurnRequestSchema = z.object({
52
53
  prompt: z.string().trim().min(1).max(200_000),
53
54
  deadlineAt: TimestampSchema.optional(),
54
55
  }).strict();
56
+ export const HeartbeatRunContextSchema = z.object({
57
+ currentDateTime: TimestampSchema,
58
+ intervalMs: z.number().int().positive().max(Number.MAX_SAFE_INTEGER),
59
+ continuationMode: z.enum(['operator', 'agent']).optional(),
60
+ nextRunAt: TimestampSchema.optional(),
61
+ previousRunAt: TimestampSchema.optional(),
62
+ previousRunId: OpaqueIdSchema.optional(),
63
+ }).strict();
64
+ export const ExecutionHostHeartbeatTaskRequestSchema = z.object({
65
+ schemaVersion: z.literal(EXECUTION_CONTRACT_VERSION),
66
+ kind: z.literal(HEARTBEAT_TASK_WORKFLOW),
67
+ invocationId: OpaqueIdSchema,
68
+ taskId: OpaqueIdSchema,
69
+ task: z.string().trim().min(1).max(200_000),
70
+ checkpoint: z.record(z.string(), z.json()).optional(),
71
+ runContext: HeartbeatRunContextSchema,
72
+ model: z.string().trim().min(1).max(512).optional(),
73
+ reasoningEffort: z.enum([
74
+ 'none',
75
+ 'low',
76
+ 'medium',
77
+ 'high',
78
+ 'ultrahigh',
79
+ 'max',
80
+ ]).optional(),
81
+ maxSteps: z.number().int().positive().max(10_000).optional(),
82
+ searchIgnoreDirs: z.array(z.string().min(1).max(1_024)).max(1_000).optional(),
83
+ systemContext: z.string().max(200_000).optional(),
84
+ deadlineAt: TimestampSchema.optional(),
85
+ }).strict();
55
86
  export const RuntimePublicResultSchema = z.object({
56
87
  outcome: z.enum(['done', 'max_steps', 'error', 'interrupted']),
57
88
  summary: z.string().optional(),
@@ -102,6 +133,35 @@ export const ExecutionHostStreamEventSchema = z.discriminatedUnion('kind', [
102
133
  }).strict(),
103
134
  }).strict(),
104
135
  ]);
136
+ export const ExecutionHostHeartbeatStreamEventSchema = z.discriminatedUnion('kind', [
137
+ StreamEnvelopeSchema.extend({
138
+ sequence: z.literal(0),
139
+ kind: z.literal('accepted'),
140
+ }).strict(),
141
+ StreamEnvelopeSchema.extend({
142
+ kind: z.literal('activity'),
143
+ activity: z.json(),
144
+ }).strict(),
145
+ StreamEnvelopeSchema.extend({
146
+ kind: z.literal('result'),
147
+ result: z.record(z.string(), z.json()),
148
+ }).strict(),
149
+ StreamEnvelopeSchema.extend({
150
+ kind: z.literal('cancelled'),
151
+ reason: z.string(),
152
+ }).strict(),
153
+ StreamEnvelopeSchema.extend({
154
+ kind: z.literal('error'),
155
+ error: z.object({
156
+ code: z.string().min(1).max(128).regex(/^[a-z0-9_]+$/),
157
+ message: z.string().min(1).max(1_600),
158
+ }).strict(),
159
+ }).strict(),
160
+ ]);
161
+ export const HostedExecutionWorkflowSchema = z.enum([
162
+ CONVERSATION_TURN_WORKFLOW,
163
+ HEARTBEAT_TASK_WORKFLOW,
164
+ ]);
105
165
  export const ExecutionAssertionClaimsSchema = z.object({
106
166
  iss: JwtIssuerSchema,
107
167
  aud: JwtAudienceSchema,
@@ -110,7 +170,7 @@ export const ExecutionAssertionClaimsSchema = z.object({
110
170
  tenantId: OpaqueIdSchema,
111
171
  productSessionId: OpaqueIdSchema,
112
172
  runtimeSessionId: RuntimeSessionIdSchema,
113
- workflow: z.literal(CONVERSATION_TURN_WORKFLOW),
173
+ workflow: HostedExecutionWorkflowSchema,
114
174
  sub: OpaqueIdSchema,
115
175
  jti: OpaqueIdSchema,
116
176
  iat: z.number().int().nonnegative(),
@@ -125,7 +185,7 @@ export const McpCapabilityClaimsSchema = z.object({
125
185
  productSessionId: OpaqueIdSchema,
126
186
  runtimeSessionId: RuntimeSessionIdSchema,
127
187
  invocationId: OpaqueIdSchema,
128
- workflow: z.literal(CONVERSATION_TURN_WORKFLOW),
188
+ workflow: HostedExecutionWorkflowSchema,
129
189
  serverId: McpServerIdSchema,
130
190
  allowedTools: McpAllowedToolsSchema,
131
191
  sub: OpaqueIdSchema,
@@ -138,6 +198,11 @@ export function isExecutionHostTerminalEvent(event) {
138
198
  || event.kind === 'cancelled'
139
199
  || event.kind === 'error';
140
200
  }
201
+ export function isExecutionHostHeartbeatTerminalEvent(event) {
202
+ return event.kind === 'result'
203
+ || event.kind === 'cancelled'
204
+ || event.kind === 'error';
205
+ }
141
206
  export function isSafeWebUrl(url) {
142
207
  const loopback = ['127.0.0.1', '[::1]', 'localhost'].includes(url.hostname);
143
208
  return (url.protocol === 'https:' || (url.protocol === 'http:' && loopback))
@@ -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,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,MAAM,EAAE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AAE,cAAc;IACnB,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE;IACnC,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;CACjC,CAAC,CAAC,WAAW,EAAE,CAAC;AAoBjB,MAAM,UAAU,4BAA4B,CAC1C,KAA+B;IAE/B,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ;WACzB,KAAK,CAAC,IAAI,KAAK,WAAW;WAC1B,KAAK,CAAC,IAAI,KAAK,OAAO,CAAC;AAC9B,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,GAAQ;IACnC,MAAM,QAAQ,GAAG,CAAC,WAAW,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC,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 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,G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SATION_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 HostedConversationModelCredentialProvider {
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: HostedConversationModelCredentialProvider;
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,G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ACvD,MAAM,MAAM,yCAAyC,GACnD,6BAA6B,CAAC;AAEhC,MAAM,WAAW,4BAA4B;IAC3C,UAAU,CACR,KAAK,EAAE,2BAA2B,GACjC,aAAa,CAAC,wBAAwB,CAAC,CAAC;CAC5C;AAED,MAAM,MAAM,mCAAmC,GAAG;IAChD,SAAS,EAAE,kBAAkB,CAAC;IAC9B,aAAa,EAAE,aAAa,CAAC;IAC7B,gBAAgB,EAAE,6BAA6B,CAAC;IAChD,4EAA4E;IAC5E,GAAG,CAAC,EAAE;QACJ,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;KACjC,CAAC;CACH,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/conversation/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,0CAA0C,EAC1C,oBAAoB,EACpB,sBAAsB,GAEvB,MAAM,uBAAuB,CAAC;AAI/B,MAAM,CAAC,MAAM,iCAAiC,GAAG,CAAC,CAAC,MAAM,CAAC;IACxD,KAAK,EAAE,oBAAoB,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;IACrD,gBAAgB,EAAE,sBAAsB;IACxC,YAAY,EAAE,0CAA0C,CAAC,KAAK,CAAC,YAAY;IAC3E,MAAM,EAAE,0CAA0C,CAAC,KAAK,CAAC,MAAM;IAC/D,UAAU,EAAE,0CAA0C,CAAC,KAAK,CAAC,UAAU;IACvE,MAAM,EAAE,CAAC,CAAC,MAAM,CACd,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,YAAY,WAAW,EACvC,+BAA+B,CAChC,CAAC,QAAQ,EAAE;CACb,CAAC,CAAC,MAAM,EAAE,CAAC","sourcesContent":["import { z } from 'zod';\nimport {\n ExecutionHostConversationTurnRequestSchema,\n ExecutionScopeSchema,\n RuntimeSessionIdSchema,\n type ExecutionHostStreamEvent,\n} from '../contracts/index.js';\nimport type { 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 HostedConversationModelCredentialProvider {\n resolveModelApiKey(\n context: HostedConversationCredentialContext,\n ): Promise<string>;\n}\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: HostedConversationModelCredentialProvider;\n /** Omit this policy when the hosted workflow needs no product MCP tools. */\n mcp?: {\n allowedTools: readonly string[];\n };\n};\n"]}
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