@heddleagent/execution-host-client 6.7.0 → 8.0.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 (116) hide show
  1. package/README.md +54 -35
  2. package/dist/agentcore/agentcore-execution-host.d.ts +1 -1
  3. package/dist/agentcore/agentcore-execution-host.d.ts.map +1 -1
  4. package/dist/agentcore/agentcore-execution-host.js +6 -3
  5. package/dist/agentcore/agentcore-execution-host.js.map +1 -1
  6. package/dist/cli/hostctl.d.ts +11 -0
  7. package/dist/cli/hostctl.d.ts.map +1 -0
  8. package/dist/cli/hostctl.js +49 -0
  9. package/dist/cli/hostctl.js.map +1 -0
  10. package/dist/contracts/index.d.ts +18 -1
  11. package/dist/contracts/index.d.ts.map +1 -1
  12. package/dist/contracts/index.js +28 -1
  13. package/dist/contracts/index.js.map +1 -1
  14. package/dist/conversation/hosted-conversation-turn-service.js +2 -2
  15. package/dist/conversation/hosted-conversation-turn-service.js.map +1 -1
  16. package/dist/conversation/types.d.ts +2 -2
  17. package/dist/conversation/types.d.ts.map +1 -1
  18. package/dist/conversation/types.js.map +1 -1
  19. package/dist/coordinator/contracts.d.ts +148 -5
  20. package/dist/coordinator/contracts.d.ts.map +1 -1
  21. package/dist/coordinator/contracts.js +74 -3
  22. package/dist/coordinator/contracts.js.map +1 -1
  23. package/dist/coordinator/hosted-heartbeat-execution-client.d.ts +30 -0
  24. package/dist/coordinator/hosted-heartbeat-execution-client.d.ts.map +1 -0
  25. package/dist/coordinator/hosted-heartbeat-execution-client.js +240 -0
  26. package/dist/coordinator/hosted-heartbeat-execution-client.js.map +1 -0
  27. package/dist/coordinator/hosted-heartbeat-execution-service.d.ts +14 -0
  28. package/dist/coordinator/hosted-heartbeat-execution-service.d.ts.map +1 -0
  29. package/dist/coordinator/hosted-heartbeat-execution-service.js +100 -0
  30. package/dist/coordinator/hosted-heartbeat-execution-service.js.map +1 -0
  31. package/dist/coordinator/index.d.ts +5 -5
  32. package/dist/coordinator/index.d.ts.map +1 -1
  33. package/dist/coordinator/index.js +3 -3
  34. package/dist/coordinator/index.js.map +1 -1
  35. package/dist/coordinator/node/execution-http-service.d.ts +11 -0
  36. package/dist/coordinator/node/execution-http-service.d.ts.map +1 -0
  37. package/dist/coordinator/node/{delegation-http-service.js → execution-http-service.js} +52 -39
  38. package/dist/coordinator/node/execution-http-service.js.map +1 -0
  39. package/dist/coordinator/node/index.d.ts +2 -2
  40. package/dist/coordinator/node/index.d.ts.map +1 -1
  41. package/dist/coordinator/node/index.js +1 -1
  42. package/dist/coordinator/node/index.js.map +1 -1
  43. package/dist/coordinator/node/types.d.ts +10 -9
  44. package/dist/coordinator/node/types.d.ts.map +1 -1
  45. package/dist/coordinator/node/types.js.map +1 -1
  46. package/dist/coordinator/types.d.ts +51 -13
  47. package/dist/coordinator/types.d.ts.map +1 -1
  48. package/dist/coordinator/types.js.map +1 -1
  49. package/dist/heartbeat/hosted-heartbeat-task-service.js +2 -2
  50. package/dist/heartbeat/hosted-heartbeat-task-service.js.map +1 -1
  51. package/dist/host/jwt-execution-host-mcp-capability-verifier.d.ts.map +1 -1
  52. package/dist/host/jwt-execution-host-mcp-capability-verifier.js +4 -2
  53. package/dist/host/jwt-execution-host-mcp-capability-verifier.js.map +1 -1
  54. package/dist/host/jwt-execution-identity-verifier.d.ts.map +1 -1
  55. package/dist/host/jwt-execution-identity-verifier.js +4 -2
  56. package/dist/host/jwt-execution-identity-verifier.js.map +1 -1
  57. package/dist/host/runtime-session/service.d.ts +2 -2
  58. package/dist/host/runtime-session/service.d.ts.map +1 -1
  59. package/dist/host/runtime-session/service.js +1 -1
  60. package/dist/host/runtime-session/service.js.map +1 -1
  61. package/dist/host/runtime-session/types.d.ts +2 -2
  62. package/dist/host/runtime-session/types.d.ts.map +1 -1
  63. package/dist/host/runtime-session/types.js.map +1 -1
  64. package/dist/host/schemas.d.ts +6 -0
  65. package/dist/host/schemas.d.ts.map +1 -1
  66. package/dist/host/schemas.js +18 -1
  67. package/dist/host/schemas.js.map +1 -1
  68. package/dist/host/types.d.ts +2 -0
  69. package/dist/host/types.d.ts.map +1 -1
  70. package/dist/host/types.js.map +1 -1
  71. package/dist/http-sse/direct-http-execution-host.d.ts.map +1 -1
  72. package/dist/http-sse/direct-http-execution-host.js +8 -7
  73. package/dist/http-sse/direct-http-execution-host.js.map +1 -1
  74. package/dist/http-sse/types.d.ts +5 -3
  75. package/dist/http-sse/types.d.ts.map +1 -1
  76. package/dist/http-sse/types.js.map +1 -1
  77. package/dist/node/authority-key.d.ts.map +1 -1
  78. package/dist/node/authority-key.js +24 -49
  79. package/dist/node/authority-key.js.map +1 -1
  80. package/dist/node/direct-credentials.d.ts +3 -7
  81. package/dist/node/direct-credentials.d.ts.map +1 -1
  82. package/dist/node/direct-credentials.js +3 -15
  83. package/dist/node/direct-credentials.js.map +1 -1
  84. package/dist/node/environment-value.d.ts +17 -0
  85. package/dist/node/environment-value.d.ts.map +1 -0
  86. package/dist/node/environment-value.js +78 -0
  87. package/dist/node/environment-value.js.map +1 -0
  88. package/dist/node/index.d.ts +4 -0
  89. package/dist/node/index.d.ts.map +1 -1
  90. package/dist/node/index.js +2 -0
  91. package/dist/node/index.js.map +1 -1
  92. package/dist/node/local-credential-bundle.d.ts +33 -0
  93. package/dist/node/local-credential-bundle.d.ts.map +1 -0
  94. package/dist/node/local-credential-bundle.js +196 -0
  95. package/dist/node/local-credential-bundle.js.map +1 -0
  96. package/dist/node/owner-only-file.d.ts +17 -0
  97. package/dist/node/owner-only-file.d.ts.map +1 -0
  98. package/dist/node/owner-only-file.js +59 -0
  99. package/dist/node/owner-only-file.js.map +1 -0
  100. package/dist/testing/request.d.ts.map +1 -1
  101. package/dist/testing/request.js +14 -4
  102. package/dist/testing/request.js.map +1 -1
  103. package/package.json +5 -1
  104. package/spec/v1/openapi.json +62 -4
  105. package/spec/v1/schema-bundle.json +58 -0
  106. package/dist/coordinator/hosted-heartbeat-delegation-client.d.ts +0 -21
  107. package/dist/coordinator/hosted-heartbeat-delegation-client.d.ts.map +0 -1
  108. package/dist/coordinator/hosted-heartbeat-delegation-client.js +0 -117
  109. package/dist/coordinator/hosted-heartbeat-delegation-client.js.map +0 -1
  110. package/dist/coordinator/hosted-heartbeat-delegation-service.d.ts +0 -15
  111. package/dist/coordinator/hosted-heartbeat-delegation-service.d.ts.map +0 -1
  112. package/dist/coordinator/hosted-heartbeat-delegation-service.js +0 -81
  113. package/dist/coordinator/hosted-heartbeat-delegation-service.js.map +0 -1
  114. package/dist/coordinator/node/delegation-http-service.d.ts +0 -11
  115. package/dist/coordinator/node/delegation-http-service.d.ts.map +0 -1
  116. package/dist/coordinator/node/delegation-http-service.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"hosted-conversation-turn-service.js","sourceRoot":"","sources":["../../src/conversation/hosted-conversation-turn-service.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,0BAA0B,EAC1B,qBAAqB,GACtB,MAAM,uBAAuB,CAAC;AAK/B,OAAO,EAAE,iCAAiC,EAAE,MAAM,YAAY,CAAC;AAE/D,MAAM,OAAO,oCAAqC,SAAQ,KAAK;IACpD,IAAI,GAAG,sCAAsC,CAAC;CACxD;AAED;;;;;;GAMG;AACH,MAAM,OAAO,6BAA6B;IAE/B,UAAU,CAAmD;IAC7D,cAAc,CAAuD;IACrE,iBAAiB,CAExB;IACO,aAAa,CAAgC;IAEtD,YAAY,MAA2C;QACrD,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,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;YACrE,CAAC,CAAC,SAAS,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AAK,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC7D,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACjD,kBAAkB,EAAE,MAAM,CAAC,kBAAkB,EAAE;YAC/C,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC3C,WAAW;SACZ,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import {\n CONVERSATION_TURN_WORKFLOW,\n McpAllowedToolsSchema,\n} from '../contracts/index.js';\nimport type {\n HostedConversationTurnRunner,\n HostedConversationTurnServiceConfig,\n} from './types.js';\nimport { HostedConversationTurnInputSchema } from './types.js';\n\nexport class HostedConversationConfigurationError extends Error {\n readonly name = 'HostedConversationConfigurationError';\n}\n\n/**\n * Provider-neutral application service for one externally hosted turn.\n *\n * It binds authority, optional product-tool policy, model credentials, and the\n * Execution Host stream while leaving product admission and settlement to the\n * adopter.\n */\nexport class HostedConversationTurnService\nimplements HostedConversationTurnRunner {\n readonly #authority: HostedConversationTurnServiceConfig['authority'];\n readonly #executionHost: HostedConversationTurnServiceConfig['executionHost'];\n readonly #modelCredentials: HostedConversationTurnServiceConfig[\n 'modelCredentials'\n ];\n readonly #allowedTools: readonly string[] | undefined;\n\n constructor(config: HostedConversationTurnServiceConfig) {\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 *streamTurn(\n rawInput: Parameters<HostedConversationTurnRunner['streamTurn']>[0],\n ): ReturnType<HostedConversationTurnRunner['streamTurn']> {\n const input = HostedConversationTurnInputSchema.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: CONVERSATION_TURN_WORKFLOW,\n ...(this.#allowedTools\n ? { mcp: { allowedTools: this.#allowedTools } }\n : {}),\n });\n const mcpCapability = issued.mcpCapability();\n if (this.#allowedTools && !mcpCapability) {\n throw new HostedConversationConfigurationError(\n 'Hosted conversation tool policy requires an MCP-capable execution authority.',\n );\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 yield* this.#executionHost.streamConversationTurn({\n invocationId: input.invocationId,\n runtimeSessionId: input.runtimeSessionId,\n prompt: input.prompt,\n ...(input.deadlineAt ? { deadlineAt: input.deadlineAt } : {}),\n ...(input.signal ? { signal: input.signal } : {}),\n executionAssertion: issued.executionAssertion(),\n ...(mcpCapability ? { mcpCapability } : {}),\n modelApiKey,\n });\n }\n}\n"]}
1
+ {"version":3,"file":"hosted-conversation-turn-service.js","sourceRoot":"","sources":["../../src/conversation/hosted-conversation-turn-service.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,0BAA0B,EAC1B,qBAAqB,GACtB,MAAM,uBAAuB,CAAC;AAK/B,OAAO,EAAE,iCAAiC,EAAE,MAAM,YAAY,CAAC;AAE/D,MAAM,OAAO,oCAAqC,SAAQ,KAAK;IACpD,IAAI,GAAG,sCAAsC,CAAC;CACxD;AAED;;;;;;GAMG;AACH,MAAM,OAAO,6BAA6B;IAE/B,UAAU,CAAmD;IAC7D,cAAc,CAAuD;IACrE,iBAAiB,CAExB;IACO,aAAa,CAAgC;IAEtD,YAAY,MAA2C;QACrD,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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YAAY;YAChC,gBAAgB,EAAE,KAAK,CAAC,gBAAgB;YACxC,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC7D,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACjD,kBAAkB,EAAE,MAAM,CAAC,kBAAkB,EAAE;YAC/C,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC3C,eAAe;SAChB,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import {\n CONVERSATION_TURN_WORKFLOW,\n McpAllowedToolsSchema,\n} from '../contracts/index.js';\nimport type {\n HostedConversationTurnRunner,\n HostedConversationTurnServiceConfig,\n} from './types.js';\nimport { HostedConversationTurnInputSchema } from './types.js';\n\nexport class HostedConversationConfigurationError extends Error {\n readonly name = 'HostedConversationConfigurationError';\n}\n\n/**\n * Provider-neutral application service for one externally hosted turn.\n *\n * It binds authority, optional product-tool policy, model credentials, and the\n * Execution Host stream while leaving product admission and settlement to the\n * adopter.\n */\nexport class HostedConversationTurnService\nimplements HostedConversationTurnRunner {\n readonly #authority: HostedConversationTurnServiceConfig['authority'];\n readonly #executionHost: HostedConversationTurnServiceConfig['executionHost'];\n readonly #modelCredentials: HostedConversationTurnServiceConfig[\n 'modelCredentials'\n ];\n readonly #allowedTools: readonly string[] | undefined;\n\n constructor(config: HostedConversationTurnServiceConfig) {\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 *streamTurn(\n rawInput: Parameters<HostedConversationTurnRunner['streamTurn']>[0],\n ): ReturnType<HostedConversationTurnRunner['streamTurn']> {\n const input = HostedConversationTurnInputSchema.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: CONVERSATION_TURN_WORKFLOW,\n ...(this.#allowedTools\n ? { mcp: { allowedTools: this.#allowedTools } }\n : {}),\n });\n const mcpCapability = issued.mcpCapability();\n if (this.#allowedTools && !mcpCapability) {\n throw new HostedConversationConfigurationError(\n 'Hosted conversation tool policy requires an MCP-capable execution authority.',\n );\n }\n\n const modelCredential = await this.#modelCredentials.resolveModelCredential({\n scope: input.scope,\n invocationId: input.invocationId,\n signal: input.signal,\n });\n input.signal?.throwIfAborted();\n\n yield* this.#executionHost.streamConversationTurn({\n invocationId: input.invocationId,\n runtimeSessionId: input.runtimeSessionId,\n prompt: input.prompt,\n ...(input.deadlineAt ? { deadlineAt: input.deadlineAt } : {}),\n ...(input.signal ? { signal: input.signal } : {}),\n executionAssertion: issued.executionAssertion(),\n ...(mcpCapability ? { mcpCapability } : {}),\n modelCredential,\n });\n }\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { type ExecutionHostStreamEvent } from '../contracts/index.js';
2
+ import { type ExecutionHostModelCredential, type ExecutionHostStreamEvent } from '../contracts/index.js';
3
3
  import type { ExecutionAuthorityIssuer } from '../authority/index.js';
4
4
  import type { ExecutionHost } from '../http-sse/index.js';
5
5
  export declare const HostedConversationTurnInputSchema: z.ZodObject<{
@@ -18,7 +18,7 @@ export type HostedConversationTurnInput = z.infer<typeof HostedConversationTurnI
18
18
  export type HostedConversationCredentialContext = Pick<HostedConversationTurnInput, 'scope' | 'invocationId' | 'signal'>;
19
19
  /** Resolves model authority without exposing it to HTTP or product data. */
20
20
  export interface HostedModelCredentialProvider {
21
- resolveModelApiKey(context: HostedConversationCredentialContext): Promise<string>;
21
+ resolveModelCredential(context: HostedConversationCredentialContext): Promise<ExecutionHostModelCredential>;
22
22
  }
23
23
  /** @deprecated Use `HostedModelCredentialProvider`. */
24
24
  export type HostedConversationModelCredentialProvider = HostedModelCredentialProvider;
@@ -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,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D,eAAO,MAAM,iCAAiC;;;;;;;;;;;kBAUnC,CAAC;AAEZ,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAC/C,OAAO,iCAAiC,CACzC,CAAC;AAEF,MAAM,MAAM,mCAAmC,GAAG,IAAI,CACpD,2BAA2B,EAC3B,OAAO,GAAG,cAAc,GAAG,QAAQ,CACpC,CAAC;AAEF,4EAA4E;AAC5E,MAAM,WAAW,6BAA6B;IAC5C,kBAAkB,CAChB,OAAO,EAAE,mCAAmC,GAC3C,OAAO,CAAC,MAAM,CAAC,CAAC;CACpB;AAED,uDAAuD;AACvD,MAAM,MAAM,yCAAyC,GACnD,6BAA6B,CAAC;AAEhC,MAAM,WAAW,4BAA4B;IAC3C,UAAU,CACR,KAAK,EAAE,2BAA2B,GACjC,aAAa,CAAC,wBAAwB,CAAC,CAAC;CAC5C;AAED,MAAM,MAAM,mCAAmC,GAAG;IAChD,SAAS,EAAE,wBAAwB,CAAC;IACpC,aAAa,EAAE,aAAa,CAAC;IAC7B,gBAAgB,EAAE,6BAA6B,CAAC;IAChD,4EAA4E;IAC5E,GAAG,CAAC,EAAE;QACJ,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;KACjC,CAAC;CACH,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/conversation/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAEL,KAAK,4BAA4B,EAGjC,KAAK,wBAAwB,EAC9B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D,eAAO,MAAM,iCAAiC;;;;;;;;;;;kBAUnC,CAAC;AAEZ,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAC/C,OAAO,iCAAiC,CACzC,CAAC;AAEF,MAAM,MAAM,mCAAmC,GAAG,IAAI,CACpD,2BAA2B,EAC3B,OAAO,GAAG,cAAc,GAAG,QAAQ,CACpC,CAAC;AAEF,4EAA4E;AAC5E,MAAM,WAAW,6BAA6B;IAC5C,sBAAsB,CACpB,OAAO,EAAE,mCAAmC,GAC3C,OAAO,CAAC,4BAA4B,CAAC,CAAC;CAC1C;AAED,uDAAuD;AACvD,MAAM,MAAM,yCAAyC,GACnD,6BAA6B,CAAC;AAEhC,MAAM,WAAW,4BAA4B;IAC3C,UAAU,CACR,KAAK,EAAE,2BAA2B,GACjC,aAAa,CAAC,wBAAwB,CAAC,CAAC;CAC5C;AAED,MAAM,MAAM,mCAAmC,GAAG;IAChD,SAAS,EAAE,wBAAwB,CAAC;IACpC,aAAa,EAAE,aAAa,CAAC;IAC7B,gBAAgB,EAAE,6BAA6B,CAAC;IAChD,4EAA4E;IAC5E,GAAG,CAAC,EAAE;QACJ,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;KACjC,CAAC;CACH,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/conversation/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,0CAA0C,EAC1C,oBAAoB,EACpB,sBAAsB,GAEvB,MAAM,uBAAuB,CAAC;AAI/B,MAAM,CAAC,MAAM,iCAAiC,GAAG,CAAC,CAAC,MAAM,CAAC;IACxD,KAAK,EAAE,oBAAoB,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;IACrD,gBAAgB,EAAE,sBAAsB;IACxC,YAAY,EAAE,0CAA0C,CAAC,KAAK,CAAC,YAAY;IAC3E,MAAM,EAAE,0CAA0C,CAAC,KAAK,CAAC,MAAM;IAC/D,UAAU,EAAE,0CAA0C,CAAC,KAAK,CAAC,UAAU;IACvE,MAAM,EAAE,CAAC,CAAC,MAAM,CACd,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,YAAY,WAAW,EACvC,+BAA+B,CAChC,CAAC,QAAQ,EAAE;CACb,CAAC,CAAC,MAAM,EAAE,CAAC","sourcesContent":["import { z } from 'zod';\nimport {\n ExecutionHostConversationTurnRequestSchema,\n ExecutionScopeSchema,\n RuntimeSessionIdSchema,\n type ExecutionHostStreamEvent,\n} from '../contracts/index.js';\nimport type { ExecutionAuthorityIssuer } from '../authority/index.js';\nimport type { ExecutionHost } from '../http-sse/index.js';\n\nexport const HostedConversationTurnInputSchema = z.object({\n scope: ExecutionScopeSchema.omit({ adopterId: true }),\n runtimeSessionId: RuntimeSessionIdSchema,\n invocationId: ExecutionHostConversationTurnRequestSchema.shape.invocationId,\n prompt: ExecutionHostConversationTurnRequestSchema.shape.prompt,\n deadlineAt: ExecutionHostConversationTurnRequestSchema.shape.deadlineAt,\n signal: z.custom<AbortSignal>(\n (value) => value instanceof AbortSignal,\n 'signal must be an AbortSignal',\n ).optional(),\n}).strict();\n\nexport type HostedConversationTurnInput = z.infer<\n typeof HostedConversationTurnInputSchema\n>;\n\nexport type HostedConversationCredentialContext = Pick<\n HostedConversationTurnInput,\n 'scope' | 'invocationId' | 'signal'\n>;\n\n/** Resolves model authority without exposing it to HTTP or product data. */\nexport interface HostedModelCredentialProvider {\n resolveModelApiKey(\n context: HostedConversationCredentialContext,\n ): Promise<string>;\n}\n\n/** @deprecated Use `HostedModelCredentialProvider`. */\nexport type HostedConversationModelCredentialProvider =\n HostedModelCredentialProvider;\n\nexport interface HostedConversationTurnRunner {\n streamTurn(\n input: HostedConversationTurnInput,\n ): AsyncIterable<ExecutionHostStreamEvent>;\n}\n\nexport type HostedConversationTurnServiceConfig = {\n authority: ExecutionAuthorityIssuer;\n executionHost: ExecutionHost;\n modelCredentials: HostedModelCredentialProvider;\n /** Omit this policy when the hosted workflow needs no product MCP tools. */\n mcp?: {\n allowedTools: readonly string[];\n };\n};\n"]}
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,EAE1C,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 type ExecutionHostModelCredential,\n ExecutionScopeSchema,\n RuntimeSessionIdSchema,\n type ExecutionHostStreamEvent,\n} from '../contracts/index.js';\nimport type { ExecutionAuthorityIssuer } from '../authority/index.js';\nimport type { ExecutionHost } from '../http-sse/index.js';\n\nexport const HostedConversationTurnInputSchema = z.object({\n scope: ExecutionScopeSchema.omit({ adopterId: true }),\n runtimeSessionId: RuntimeSessionIdSchema,\n invocationId: ExecutionHostConversationTurnRequestSchema.shape.invocationId,\n prompt: ExecutionHostConversationTurnRequestSchema.shape.prompt,\n deadlineAt: ExecutionHostConversationTurnRequestSchema.shape.deadlineAt,\n signal: z.custom<AbortSignal>(\n (value) => value instanceof AbortSignal,\n 'signal must be an AbortSignal',\n ).optional(),\n}).strict();\n\nexport type HostedConversationTurnInput = z.infer<\n typeof HostedConversationTurnInputSchema\n>;\n\nexport type HostedConversationCredentialContext = Pick<\n HostedConversationTurnInput,\n 'scope' | 'invocationId' | 'signal'\n>;\n\n/** Resolves model authority without exposing it to HTTP or product data. */\nexport interface HostedModelCredentialProvider {\n resolveModelCredential(\n context: HostedConversationCredentialContext,\n ): Promise<ExecutionHostModelCredential>;\n}\n\n/** @deprecated Use `HostedModelCredentialProvider`. */\nexport type HostedConversationModelCredentialProvider =\n HostedModelCredentialProvider;\n\nexport interface HostedConversationTurnRunner {\n streamTurn(\n input: HostedConversationTurnInput,\n ): AsyncIterable<ExecutionHostStreamEvent>;\n}\n\nexport type HostedConversationTurnServiceConfig = {\n authority: ExecutionAuthorityIssuer;\n executionHost: ExecutionHost;\n modelCredentials: HostedModelCredentialProvider;\n /** Omit this policy when the hosted workflow needs no product MCP tools. */\n mcp?: {\n allowedTools: readonly string[];\n };\n};\n"]}
@@ -6,7 +6,10 @@ export declare const HOSTED_HEARTBEAT_COORDINATOR_PATHS: Readonly<{
6
6
  resume: "/v1/control/resume";
7
7
  drain: "/v1/control/drain";
8
8
  }>;
9
- export declare const HOSTED_HEARTBEAT_DELEGATIONS_PATH = "/hosted-execution/internal/heartbeat-delegations";
9
+ export declare const HOSTED_HEARTBEAT_EXECUTION_PATHS: Readonly<{
10
+ prepare: "/hosted-execution/internal/heartbeat-executions/prepare";
11
+ settle: "/hosted-execution/internal/heartbeat-executions/settle";
12
+ }>;
10
13
  export declare const HostedHeartbeatCoordinatorTaskInputSchema: z.ZodObject<{
11
14
  workspaceId: z.ZodOptional<z.ZodString>;
12
15
  name: z.ZodOptional<z.ZodString>;
@@ -434,10 +437,11 @@ export declare const HostedHeartbeatDesiredTaskCatalogSchema: z.ZodObject<{
434
437
  }, z.core.$strict>>;
435
438
  resume: z.ZodBoolean;
436
439
  }, z.core.$strict>;
437
- export declare const HostedHeartbeatDelegationRequestSchema: z.ZodObject<{
440
+ export declare const HostedHeartbeatExecutionPreparationRequestSchema: z.ZodObject<{
438
441
  schemaVersion: z.ZodLiteral<1>;
439
442
  taskId: z.ZodString;
440
443
  executionId: z.ZodString;
444
+ interruptedExecutionId: z.ZodOptional<z.ZodString>;
441
445
  }, z.core.$strict>;
442
446
  export declare const HostedHeartbeatDelegationSchema: z.ZodObject<{
443
447
  schemaVersion: z.ZodLiteral<1>;
@@ -474,7 +478,7 @@ export declare const HostedHeartbeatDelegationSchema: z.ZodObject<{
474
478
  mcpCapability: z.ZodString;
475
479
  }, z.core.$strict>;
476
480
  }, z.core.$strict>;
477
- export declare const HostedHeartbeatDelegationAuthorizationSchema: z.ZodObject<{
481
+ export declare const HostedHeartbeatExecutionAuthorizationSchema: z.ZodObject<{
478
482
  scope: z.ZodObject<{
479
483
  tenantId: z.ZodString;
480
484
  subjectId: z.ZodString;
@@ -482,6 +486,139 @@ export declare const HostedHeartbeatDelegationAuthorizationSchema: z.ZodObject<{
482
486
  }, z.core.$strict>;
483
487
  allowedTools: z.ZodArray<z.ZodString>;
484
488
  }, z.core.$strict>;
489
+ export declare const HostedHeartbeatExecutionPreparationDecisionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
490
+ kind: z.ZodLiteral<"execute">;
491
+ authorization: z.ZodObject<{
492
+ scope: z.ZodObject<{
493
+ tenantId: z.ZodString;
494
+ subjectId: z.ZodString;
495
+ productSessionId: z.ZodString;
496
+ }, z.core.$strict>;
497
+ allowedTools: z.ZodArray<z.ZodString>;
498
+ }, z.core.$strict>;
499
+ }, z.core.$strict>, z.ZodObject<{
500
+ kind: z.ZodLiteral<"skip">;
501
+ summary: z.ZodString;
502
+ }, z.core.$strict>], "kind">;
503
+ export declare const HostedHeartbeatExecutionPreparationSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
504
+ schemaVersion: z.ZodLiteral<1>;
505
+ kind: z.ZodLiteral<"execute">;
506
+ delegation: z.ZodObject<{
507
+ schemaVersion: z.ZodLiteral<1>;
508
+ taskId: z.ZodString;
509
+ executionId: z.ZodString;
510
+ scope: z.ZodObject<{
511
+ tenantId: z.ZodString;
512
+ subjectId: z.ZodString;
513
+ productSessionId: z.ZodString;
514
+ }, z.core.$strict>;
515
+ runtimeSessionId: z.ZodString;
516
+ deadlineAt: z.ZodISODateTime;
517
+ authority: z.ZodObject<{
518
+ metadata: z.ZodObject<{
519
+ scope: z.ZodObject<{
520
+ adopterId: z.ZodString;
521
+ tenantId: z.ZodString;
522
+ subjectId: z.ZodString;
523
+ productSessionId: z.ZodString;
524
+ }, z.core.$strict>;
525
+ runtimeSessionId: z.ZodString;
526
+ invocationId: z.ZodString;
527
+ workflow: z.ZodLiteral<"heartbeat-task">;
528
+ issuedAt: z.ZodISODateTime;
529
+ executionExpiresAt: z.ZodISODateTime;
530
+ mcp: z.ZodObject<{
531
+ capabilityId: z.ZodString;
532
+ serverId: z.ZodString;
533
+ allowedTools: z.ZodArray<z.ZodString>;
534
+ expiresAt: z.ZodISODateTime;
535
+ }, z.core.$strict>;
536
+ }, z.core.$strict>;
537
+ executionAssertion: z.ZodString;
538
+ mcpCapability: z.ZodString;
539
+ }, z.core.$strict>;
540
+ }, z.core.$strict>;
541
+ }, z.core.$strict>, z.ZodObject<{
542
+ schemaVersion: z.ZodLiteral<1>;
543
+ kind: z.ZodLiteral<"skip">;
544
+ taskId: z.ZodString;
545
+ executionId: z.ZodString;
546
+ summary: z.ZodString;
547
+ }, z.core.$strict>], "kind">;
548
+ export declare const HostedHeartbeatExecutionResultSchema: z.ZodObject<{
549
+ decision: z.ZodEnum<{
550
+ continue: "continue";
551
+ pause: "pause";
552
+ complete: "complete";
553
+ escalate: "escalate";
554
+ }>;
555
+ summary: z.ZodString;
556
+ runId: z.ZodString;
557
+ outcome: z.ZodEnum<{
558
+ error: "error";
559
+ done: "done";
560
+ max_steps: "max_steps";
561
+ interrupted: "interrupted";
562
+ }>;
563
+ }, z.core.$strict>;
564
+ export declare const HostedHeartbeatExecutionSettlementRequestSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
565
+ schemaVersion: z.ZodLiteral<1>;
566
+ taskId: z.ZodString;
567
+ executionId: z.ZodString;
568
+ kind: z.ZodLiteral<"completed">;
569
+ result: z.ZodObject<{
570
+ decision: z.ZodEnum<{
571
+ continue: "continue";
572
+ pause: "pause";
573
+ complete: "complete";
574
+ escalate: "escalate";
575
+ }>;
576
+ summary: z.ZodString;
577
+ runId: z.ZodString;
578
+ outcome: z.ZodEnum<{
579
+ error: "error";
580
+ done: "done";
581
+ max_steps: "max_steps";
582
+ interrupted: "interrupted";
583
+ }>;
584
+ }, z.core.$strict>;
585
+ }, z.core.$strict>, z.ZodObject<{
586
+ schemaVersion: z.ZodLiteral<1>;
587
+ taskId: z.ZodString;
588
+ executionId: z.ZodString;
589
+ kind: z.ZodLiteral<"failed">;
590
+ errorType: z.ZodString;
591
+ }, z.core.$strict>, z.ZodObject<{
592
+ schemaVersion: z.ZodLiteral<1>;
593
+ taskId: z.ZodString;
594
+ executionId: z.ZodString;
595
+ kind: z.ZodLiteral<"interrupted">;
596
+ }, z.core.$strict>], "kind">;
597
+ export declare const HostedHeartbeatExecutionDispositionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
598
+ kind: z.ZodLiteral<"accepted">;
599
+ }, z.core.$strict>, z.ZodObject<{
600
+ kind: z.ZodLiteral<"retry">;
601
+ summary: z.ZodString;
602
+ delayMs: z.ZodOptional<z.ZodNumber>;
603
+ }, z.core.$strict>, z.ZodObject<{
604
+ kind: z.ZodLiteral<"blocked">;
605
+ summary: z.ZodString;
606
+ }, z.core.$strict>], "kind">;
607
+ export declare const HostedHeartbeatExecutionSettlementSchema: z.ZodObject<{
608
+ schemaVersion: z.ZodLiteral<1>;
609
+ taskId: z.ZodString;
610
+ executionId: z.ZodString;
611
+ disposition: z.ZodDiscriminatedUnion<[z.ZodObject<{
612
+ kind: z.ZodLiteral<"accepted">;
613
+ }, z.core.$strict>, z.ZodObject<{
614
+ kind: z.ZodLiteral<"retry">;
615
+ summary: z.ZodString;
616
+ delayMs: z.ZodOptional<z.ZodNumber>;
617
+ }, z.core.$strict>, z.ZodObject<{
618
+ kind: z.ZodLiteral<"blocked">;
619
+ summary: z.ZodString;
620
+ }, z.core.$strict>], "kind">;
621
+ }, z.core.$strict>;
485
622
  export type HostedHeartbeatCoordinatorTaskInput = z.infer<typeof HostedHeartbeatCoordinatorTaskInputSchema>;
486
623
  export type HostedHeartbeatCoordinatorState = z.infer<typeof HostedHeartbeatCoordinatorStateSchema>;
487
624
  export type HostedHeartbeatCoordinatorTaskView = z.infer<typeof HostedHeartbeatCoordinatorTaskViewSchema>;
@@ -489,7 +626,13 @@ export type HostedHeartbeatCoordinatorRunView = z.infer<typeof HostedHeartbeatCo
489
626
  export type HostedHeartbeatCoordinatorTaskDetail = z.infer<typeof HostedHeartbeatCoordinatorTaskDetailSchema>;
490
627
  export type HostedHeartbeatDesiredTask = z.infer<typeof HostedHeartbeatDesiredTaskSchema>;
491
628
  export type HostedHeartbeatDesiredTaskCatalog = z.infer<typeof HostedHeartbeatDesiredTaskCatalogSchema>;
492
- export type HostedHeartbeatDelegationRequest = z.infer<typeof HostedHeartbeatDelegationRequestSchema>;
629
+ export type HostedHeartbeatExecutionPreparationRequest = z.infer<typeof HostedHeartbeatExecutionPreparationRequestSchema>;
493
630
  export type HostedHeartbeatDelegation = z.infer<typeof HostedHeartbeatDelegationSchema>;
494
- export type HostedHeartbeatDelegationAuthorization = z.infer<typeof HostedHeartbeatDelegationAuthorizationSchema>;
631
+ export type HostedHeartbeatExecutionAuthorization = z.infer<typeof HostedHeartbeatExecutionAuthorizationSchema>;
632
+ export type HostedHeartbeatExecutionPreparationDecision = z.infer<typeof HostedHeartbeatExecutionPreparationDecisionSchema>;
633
+ export type HostedHeartbeatExecutionPreparation = z.infer<typeof HostedHeartbeatExecutionPreparationSchema>;
634
+ export type HostedHeartbeatExecutionResult = z.infer<typeof HostedHeartbeatExecutionResultSchema>;
635
+ export type HostedHeartbeatExecutionSettlementRequest = z.infer<typeof HostedHeartbeatExecutionSettlementRequestSchema>;
636
+ export type HostedHeartbeatExecutionDisposition = z.infer<typeof HostedHeartbeatExecutionDispositionSchema>;
637
+ export type HostedHeartbeatExecutionSettlement = z.infer<typeof HostedHeartbeatExecutionSettlementSchema>;
495
638
  //# sourceMappingURL=contracts.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../../src/coordinator/contracts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAexB,eAAO,MAAM,kCAAkC;;;;;;EAM7C,CAAC;AAEH,eAAO,MAAM,iCAAiC,qDACM,CAAC;AAErD,eAAO,MAAM,yCAAyC;;;;;;;;;;;;;;;kBAc3C,CAAC;AAEZ,eAAO,MAAM,qCAAqC;;;;;EAKhD,CAAC;AAEH,eAAO,MAAM,6CAA6C;;;;;;;kBAE/C,CAAC;AAEZ,eAAO,MAAM,0CAA0C;;;;;;;EAOrD,CAAC;AAEH,eAAO,MAAM,0CAA0C;;;;;;;;;;;;;;;;;;;iBAcvC,CAAC;AAEjB,0EAA0E;AAC1E,eAAO,MAAM,wCAAwC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAuBrC,CAAC;AAE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AC,KAAK,CACxD,OAAO,0CAA0C,CAClD,CAAC;AACF,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAC9C,OAAO,gCAAgC,CACxC,CAAC;AACF,MAAM,MAAM,iCAAiC,GAAG,CAAC,CAAC,KAAK,CACrD,OAAO,uCAAuC,CAC/C,CAAC;AACF,MAAM,MAAM,0CAA0C,GAAG,CAAC,CAAC,KAAK,CAC9D,OAAO,gDAAgD,CACxD,CAAC;AACF,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAC7C,OAAO,+BAA+B,CACvC,CAAC;AACF,MAAM,MAAM,qCAAqC,GAAG,CAAC,CAAC,KAAK,CACzD,OAAO,2CAA2C,CACnD,CAAC;AACF,MAAM,MAAM,2CAA2C,GAAG,CAAC,CAAC,KAAK,CAC/D,OAAO,iDAAiD,CACzD,CAAC;AACF,MAAM,MAAM,mCAAmC,GAAG,CAAC,CAAC,KAAK,CACvD,OAAO,yCAAyC,CACjD,CAAC;AACF,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAClD,OAAO,oCAAoC,CAC5C,CAAC;AACF,MAAM,MAAM,yCAAyC,GAAG,CAAC,CAAC,KAAK,CAC7D,OAAO,+CAA+C,CACvD,CAAC;AACF,MAAM,MAAM,mCAAmC,GAAG,CAAC,CAAC,KAAK,CACvD,OAAO,yCAAyC,CACjD,CAAC;AACF,MAAM,MAAM,kCAAkC,GAAG,CAAC,CAAC,KAAK,CACtD,OAAO,wCAAwC,CAChD,CAAC"}
@@ -10,7 +10,10 @@ export const HOSTED_HEARTBEAT_COORDINATOR_PATHS = Object.freeze({
10
10
  resume: '/v1/control/resume',
11
11
  drain: '/v1/control/drain',
12
12
  });
13
- export const HOSTED_HEARTBEAT_DELEGATIONS_PATH = '/hosted-execution/internal/heartbeat-delegations';
13
+ export const HOSTED_HEARTBEAT_EXECUTION_PATHS = Object.freeze({
14
+ prepare: '/hosted-execution/internal/heartbeat-executions/prepare',
15
+ settle: '/hosted-execution/internal/heartbeat-executions/settle',
16
+ });
14
17
  export const HostedHeartbeatCoordinatorTaskInputSchema = z.object({
15
18
  workspaceId: OpaqueIdSchema.optional(),
16
19
  name: z.string().trim().min(1).max(200).optional(),
@@ -121,10 +124,11 @@ export const HostedHeartbeatDesiredTaskCatalogSchema = z.object({
121
124
  seen.add(taskId);
122
125
  });
123
126
  });
124
- export const HostedHeartbeatDelegationRequestSchema = z.object({
127
+ export const HostedHeartbeatExecutionPreparationRequestSchema = z.object({
125
128
  schemaVersion: z.literal(1),
126
129
  taskId: OpaqueIdSchema,
127
130
  executionId: OpaqueIdSchema,
131
+ interruptedExecutionId: OpaqueIdSchema.optional(),
128
132
  }).strict();
129
133
  const DelegatedAuthorityMetadataSchema = z.object({
130
134
  scope: ExecutionScopeSchema,
@@ -170,10 +174,77 @@ export const HostedHeartbeatDelegationSchema = z.object({
170
174
  message: 'must match the delegated execution authority metadata',
171
175
  }));
172
176
  });
173
- export const HostedHeartbeatDelegationAuthorizationSchema = z.object({
177
+ export const HostedHeartbeatExecutionAuthorizationSchema = z.object({
174
178
  scope: ProductExecutionScopeSchema,
175
179
  allowedTools: McpAllowedToolsSchema,
176
180
  }).strict();
181
+ export const HostedHeartbeatExecutionPreparationDecisionSchema = z.discriminatedUnion('kind', [
182
+ z.object({
183
+ kind: z.literal('execute'),
184
+ authorization: HostedHeartbeatExecutionAuthorizationSchema,
185
+ }).strict(),
186
+ z.object({
187
+ kind: z.literal('skip'),
188
+ summary: z.string().trim().min(1).max(500),
189
+ }).strict(),
190
+ ]);
191
+ export const HostedHeartbeatExecutionPreparationSchema = z.discriminatedUnion('kind', [
192
+ z.object({
193
+ schemaVersion: z.literal(1),
194
+ kind: z.literal('execute'),
195
+ delegation: HostedHeartbeatDelegationSchema,
196
+ }).strict(),
197
+ z.object({
198
+ schemaVersion: z.literal(1),
199
+ kind: z.literal('skip'),
200
+ taskId: OpaqueIdSchema,
201
+ executionId: OpaqueIdSchema,
202
+ summary: z.string().trim().min(1).max(500),
203
+ }).strict(),
204
+ ]);
205
+ export const HostedHeartbeatExecutionResultSchema = z.object({
206
+ decision: z.enum(['continue', 'pause', 'complete', 'escalate']),
207
+ summary: z.string(),
208
+ runId: OpaqueIdSchema,
209
+ outcome: z.enum(['done', 'max_steps', 'error', 'interrupted']),
210
+ }).strict();
211
+ const HostedHeartbeatExecutionSettlementEnvelopeSchema = z.object({
212
+ schemaVersion: z.literal(1),
213
+ taskId: OpaqueIdSchema,
214
+ executionId: OpaqueIdSchema,
215
+ });
216
+ export const HostedHeartbeatExecutionSettlementRequestSchema = z.discriminatedUnion('kind', [
217
+ HostedHeartbeatExecutionSettlementEnvelopeSchema.extend({
218
+ kind: z.literal('completed'),
219
+ result: HostedHeartbeatExecutionResultSchema,
220
+ }).strict(),
221
+ HostedHeartbeatExecutionSettlementEnvelopeSchema.extend({
222
+ kind: z.literal('failed'),
223
+ errorType: z.string().trim().min(1).max(128),
224
+ }).strict(),
225
+ HostedHeartbeatExecutionSettlementEnvelopeSchema.extend({
226
+ kind: z.literal('interrupted'),
227
+ }).strict(),
228
+ ]);
229
+ export const HostedHeartbeatExecutionDispositionSchema = z.discriminatedUnion('kind', [
230
+ z.object({ kind: z.literal('accepted') }).strict(),
231
+ z.object({
232
+ kind: z.literal('retry'),
233
+ summary: z.string().trim().min(1).max(500),
234
+ delayMs: z.number().int().min(1_000).max(Number.MAX_SAFE_INTEGER)
235
+ .optional(),
236
+ }).strict(),
237
+ z.object({
238
+ kind: z.literal('blocked'),
239
+ summary: z.string().trim().min(1).max(500),
240
+ }).strict(),
241
+ ]);
242
+ export const HostedHeartbeatExecutionSettlementSchema = z.object({
243
+ schemaVersion: z.literal(1),
244
+ taskId: OpaqueIdSchema,
245
+ executionId: OpaqueIdSchema,
246
+ disposition: HostedHeartbeatExecutionDispositionSchema,
247
+ }).strict();
177
248
  function sameProductScope(left, right) {
178
249
  return left.tenantId === right.tenantId
179
250
  && left.subjectId === right.subjectId
@@ -1 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P,MAAM,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC;SACtC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC;QACpC,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,CAAC,IAAI,CAAC;QACZ,OAAO,EAAE,uDAAuD;KACjE,CAAC,CAAC,CAAC;AACR,CAAC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,4CAA4C,GAAG,CAAC,CAAC,MAAM,CAAC;IACnE,KAAK,EAAE,2BAA2B;IAClC,YAAY,EAAE,qBAAqB;CACpC,CAAC,CAAC,MAAM,EAAE,CAAC;AAiCZ,SAAS,gBAAgB,CACvB,IAA0C,EAC1C,KAAkD;IAElD,OAAO,IAAI,CAAC,QAAQ,KAAK,KAAK,CAAC,QAAQ;WAClC,IAAI,CAAC,SAAS,KAAK,KAAK,CAAC,SAAS;WAClC,IAAI,CAAC,gBAAgB,KAAK,KAAK,CAAC,gBAAgB,CAAC;AACxD,CAAC","sourcesContent":["import { z } from 'zod';\nimport {\n ExecutionScopeSchema,\n HEARTBEAT_TASK_WORKFLOW,\n McpAllowedToolsSchema,\n McpServerIdSchema,\n OpaqueIdSchema,\n RuntimeSessionIdSchema,\n TimestampSchema,\n} from '../contracts/index.js';\n\nconst ProductExecutionScopeSchema = ExecutionScopeSchema.omit({\n adopterId: true,\n});\n\nexport const HOSTED_HEARTBEAT_COORDINATOR_PATHS = Object.freeze({\n state: '/v1/coordinator',\n tasks: '/v1/heartbeat/tasks',\n pause: '/v1/control/pause',\n resume: '/v1/control/resume',\n drain: '/v1/control/drain',\n});\n\nexport const HOSTED_HEARTBEAT_DELEGATIONS_PATH =\n '/hosted-execution/internal/heartbeat-delegations';\n\nexport const HostedHeartbeatCoordinatorTaskInputSchema = z.object({\n workspaceId: OpaqueIdSchema.optional(),\n name: z.string().trim().min(1).max(200).optional(),\n task: z.string().trim().min(1).max(200_000),\n enabled: z.boolean().optional(),\n continuationMode: z.enum(['operator', 'agent']).optional(),\n intervalMs: z.number().int().min(1_000).max(Number.MAX_SAFE_INTEGER)\n .optional(),\n defer: z.boolean().optional(),\n model: z.string().trim().min(1).max(512).optional(),\n maxSteps: z.number().int().positive().max(10_000).optional(),\n searchIgnoreDirs: z.array(z.string().min(1).max(1_024)).max(1_000)\n .optional(),\n systemContext: z.string().max(200_000).optional(),\n}).strict();\n\nexport const HostedHeartbeatCoordinatorStateSchema = z.enum([\n 'running',\n 'paused',\n 'drained',\n 'stopped',\n]);\n\nexport const HostedHeartbeatCoordinatorStateResponseSchema = z.object({\n state: HostedHeartbeatCoordinatorStateSchema,\n}).strict();\n\nexport const HostedHeartbeatCoordinatorTaskStatusSchema = z.enum([\n 'idle',\n 'running',\n 'waiting',\n 'blocked',\n 'complete',\n 'failed',\n]);\n\nexport const HostedHeartbeatCoordinatorTaskResultSchema = z.object({\n kind: z.enum([\n 'agent',\n 'skipped',\n 'cancelled',\n 'retry',\n 'blocked',\n 'failed',\n ]),\n decision: z.enum(['continue', 'pause', 'complete', 'escalate']).optional(),\n summary: z.string(),\n outcome: z.string(),\n agentRunId: OpaqueIdSchema.optional(),\n usage: z.unknown().optional(),\n}).passthrough();\n\n/** Stable product/operator projection returned by the Coordinator API. */\nexport const HostedHeartbeatCoordinatorTaskViewSchema = z.object({\n id: OpaqueIdSchema,\n taskId: OpaqueIdSchema,\n workspaceId: OpaqueIdSchema.optional(),\n name: z.string().optional(),\n task: z.string(),\n enabled: z.boolean(),\n continuationMode: z.enum(['operator', 'agent']).optional(),\n schedule: z.object({\n intervalMs: z.number().int().positive(),\n nextRunAt: TimestampSchema.optional(),\n }).passthrough(),\n state: z.object({\n status: HostedHeartbeatCoordinatorTaskStatusSchema,\n progress: z.string().optional(),\n runId: OpaqueIdSchema.optional(),\n runAt: TimestampSchema.optional(),\n loadedCheckpoint: z.boolean().optional(),\n resumable: z.boolean().optional(),\n result: HostedHeartbeatCoordinatorTaskResultSchema.optional(),\n error: z.string().optional(),\n updatedAt: TimestampSchema.optional(),\n }).passthrough(),\n}).passthrough();\n\nexport const HostedHeartbeatCoordinatorTaskListSchema = z.object({\n tasks: z.array(HostedHeartbeatCoordinatorTaskViewSchema),\n}).strict();\n\nexport const HostedHeartbeatCoordinatorRunViewSchema = z.object({\n id: OpaqueIdSchema,\n taskId: OpaqueIdSchema,\n workspaceId: OpaqueIdSchema.optional(),\n executionId: OpaqueIdSchema,\n runId: OpaqueIdSchema.optional(),\n createdAt: TimestampSchema,\n task: HostedHeartbeatCoordinatorTaskViewSchema,\n result: HostedHeartbeatCoordinatorTaskResultSchema,\n loadedCheckpoint: z.boolean().optional(),\n}).passthrough();\n\nexport const HostedHeartbeatCoordinatorTaskDetailSchema = z.object({\n task: HostedHeartbeatCoordinatorTaskViewSchema,\n runs: z.array(HostedHeartbeatCoordinatorRunViewSchema),\n}).strict();\n\nexport const HostedHeartbeatDesiredTaskSchema = z.object({\n taskId: OpaqueIdSchema,\n input: HostedHeartbeatCoordinatorTaskInputSchema,\n}).strict();\n\nexport const HostedHeartbeatDesiredTaskCatalogSchema = z.object({\n tasks: z.array(HostedHeartbeatDesiredTaskSchema).max(10_000),\n resume: z.boolean(),\n}).strict().superRefine(({ tasks }, context) => {\n const seen = new Set<string>();\n tasks.forEach(({ taskId }, index) => {\n if (seen.has(taskId)) {\n context.addIssue({\n code: 'custom',\n path: ['tasks', index, 'taskId'],\n message: 'must be unique within the desired task catalog',\n });\n }\n seen.add(taskId);\n });\n});\n\nexport const HostedHeartbeatDelegationRequestSchema = z.object({\n schemaVersion: z.literal(1),\n taskId: OpaqueIdSchema,\n executionId: OpaqueIdSchema,\n}).strict();\n\nconst DelegatedAuthorityMetadataSchema = z.object({\n scope: ExecutionScopeSchema,\n runtimeSessionId: RuntimeSessionIdSchema,\n invocationId: OpaqueIdSchema,\n workflow: z.literal(HEARTBEAT_TASK_WORKFLOW),\n issuedAt: TimestampSchema,\n executionExpiresAt: TimestampSchema,\n mcp: z.object({\n capabilityId: OpaqueIdSchema,\n serverId: McpServerIdSchema,\n allowedTools: McpAllowedToolsSchema,\n expiresAt: TimestampSchema,\n }).strict(),\n}).strict();\n\nexport const HostedHeartbeatDelegationSchema = z.object({\n schemaVersion: z.literal(1),\n taskId: OpaqueIdSchema,\n executionId: OpaqueIdSchema,\n scope: ProductExecutionScopeSchema,\n runtimeSessionId: RuntimeSessionIdSchema,\n deadlineAt: TimestampSchema,\n authority: z.object({\n metadata: DelegatedAuthorityMetadataSchema,\n executionAssertion: z.string().min(1).max(16_384),\n mcpCapability: z.string().min(1).max(16_384),\n }).strict(),\n}).strict().superRefine((delegation, context) => {\n const metadata = delegation.authority.metadata;\n const mismatches: Array<[path: string, mismatched: boolean]> = [\n ['executionId', metadata.invocationId !== delegation.executionId],\n [\n 'runtimeSessionId',\n metadata.runtimeSessionId !== delegation.runtimeSessionId,\n ],\n ['scope', !sameProductScope(metadata.scope, delegation.scope)],\n ];\n mismatches\n .filter(([, mismatched]) => mismatched)\n .forEach(([path]) => context.addIssue({\n code: 'custom',\n path: [path],\n message: 'must match the delegated execution authority metadata',\n }));\n});\n\nexport const HostedHeartbeatDelegationAuthorizationSchema = z.object({\n scope: ProductExecutionScopeSchema,\n allowedTools: McpAllowedToolsSchema,\n}).strict();\n\nexport type HostedHeartbeatCoordinatorTaskInput = z.infer<\n typeof HostedHeartbeatCoordinatorTaskInputSchema\n>;\nexport type HostedHeartbeatCoordinatorState = z.infer<\n typeof HostedHeartbeatCoordinatorStateSchema\n>;\nexport type HostedHeartbeatCoordinatorTaskView = z.infer<\n typeof HostedHeartbeatCoordinatorTaskViewSchema\n>;\nexport type HostedHeartbeatCoordinatorRunView = z.infer<\n typeof HostedHeartbeatCoordinatorRunViewSchema\n>;\nexport type HostedHeartbeatCoordinatorTaskDetail = z.infer<\n typeof HostedHeartbeatCoordinatorTaskDetailSchema\n>;\nexport type HostedHeartbeatDesiredTask = z.infer<\n typeof HostedHeartbeatDesiredTaskSchema\n>;\nexport type HostedHeartbeatDesiredTaskCatalog = z.infer<\n typeof HostedHeartbeatDesiredTaskCatalogSchema\n>;\nexport type HostedHeartbeatDelegationRequest = z.infer<\n typeof HostedHeartbeatDelegationRequestSchema\n>;\nexport type HostedHeartbeatDelegation = z.infer<\n typeof HostedHeartbeatDelegationSchema\n>;\nexport type HostedHeartbeatDelegationAuthorization = z.infer<\n typeof HostedHeartbeatDelegationAuthorizationSchema\n>;\n\nfunction sameProductScope(\n left: z.infer<typeof ExecutionScopeSchema>,\n right: z.infer<typeof ProductExecutionScopeSchema>,\n): boolean {\n return left.tenantId === right.tenantId\n && left.subjectId === right.subjectId\n && left.productSessionId === right.productSessionId;\n}\n"]}
1
+ {"version":3,"file":"contracts.js","sourceRoot":"","sources":["../../src/coordinator/contracts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,oBAAoB,EACpB,uBAAuB,EACvB,qBAAqB,EACrB,iBAAiB,EACjB,cAAc,EACd,sBAAsB,EACtB,eAAe,GAChB,MAAM,uBAAuB,CAAC;AAE/B,MAAM,2BAA2B,GAAG,oBAAoB,CAAC,IAAI,CAAC;IAC5D,SAAS,EAAE,IAAI;CAChB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,kCAAkC,GAAG,MAAM,CAAC,MAAM,CAAC;IAC9D,KAAK,EAAE,iBAAiB;IACxB,KAAK,EAAE,qBAAqB;IAC5B,KAAK,EAAE,mBAAmB;IAC1B,MAAM,EAAE,oBAAoB;IAC5B,KAAK,EAAE,mBAAmB;CAC3B,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,gCAAgC,GAAG,MAAM,CAAC,MAAM,CAAC;IAC5D,OAAO,EAAE,yDAAyD;IAClE,MAAM,EAAE,wDAAwD;CACjE,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,yCAAyC,GAAG,CAAC,CAAC,MAAM,CAAC;IAChE,WAAW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,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,gBAAgB,CAAC;aAC9D,QAAQ,EAAE;KACd,CAAC,CAAC,MAAM,EAAE;IACX,CAAC,CAAC,MAAM,CAAC;QACP,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC;QAC1B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;KAC3C,CAAC,CAAC,MAAM,EAAE;CACZ,CACF,CAAC;AAEF,MAAM,CAAC,MAAM,wCAAwC,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/D,aAAa,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;IAC3B,MAAM,EAAE,cAAc;IACtB,WAAW,EAAE,cAAc;IAC3B,WAAW,EAAE,yCAAyC;CACvD,CAAC,CAAC,MAAM,EAAE,CAAC;AAmDZ,SAAS,gBAAgB,CACvB,IAA0C,EAC1C,KAAkD;IAElD,OAAO,IAAI,CAAC,QAAQ,KAAK,KAAK,CAAC,QAAQ;WAClC,IAAI,CAAC,SAAS,KAAK,KAAK,CAAC,SAAS;WAClC,IAAI,CAAC,gBAAgB,KAAK,KAAK,CAAC,gBAAgB,CAAC;AACxD,CAAC","sourcesContent":["import { z } from 'zod';\nimport {\n ExecutionScopeSchema,\n HEARTBEAT_TASK_WORKFLOW,\n McpAllowedToolsSchema,\n McpServerIdSchema,\n OpaqueIdSchema,\n RuntimeSessionIdSchema,\n TimestampSchema,\n} from '../contracts/index.js';\n\nconst ProductExecutionScopeSchema = ExecutionScopeSchema.omit({\n adopterId: true,\n});\n\nexport const HOSTED_HEARTBEAT_COORDINATOR_PATHS = Object.freeze({\n state: '/v1/coordinator',\n tasks: '/v1/heartbeat/tasks',\n pause: '/v1/control/pause',\n resume: '/v1/control/resume',\n drain: '/v1/control/drain',\n});\n\nexport const HOSTED_HEARTBEAT_EXECUTION_PATHS = Object.freeze({\n prepare: '/hosted-execution/internal/heartbeat-executions/prepare',\n settle: '/hosted-execution/internal/heartbeat-executions/settle',\n});\n\nexport const HostedHeartbeatCoordinatorTaskInputSchema = z.object({\n workspaceId: OpaqueIdSchema.optional(),\n name: z.string().trim().min(1).max(200).optional(),\n task: z.string().trim().min(1).max(200_000),\n enabled: z.boolean().optional(),\n continuationMode: z.enum(['operator', 'agent']).optional(),\n intervalMs: z.number().int().min(1_000).max(Number.MAX_SAFE_INTEGER)\n .optional(),\n defer: z.boolean().optional(),\n model: z.string().trim().min(1).max(512).optional(),\n maxSteps: z.number().int().positive().max(10_000).optional(),\n searchIgnoreDirs: z.array(z.string().min(1).max(1_024)).max(1_000)\n .optional(),\n systemContext: z.string().max(200_000).optional(),\n}).strict();\n\nexport const HostedHeartbeatCoordinatorStateSchema = z.enum([\n 'running',\n 'paused',\n 'drained',\n 'stopped',\n]);\n\nexport const HostedHeartbeatCoordinatorStateResponseSchema = z.object({\n state: HostedHeartbeatCoordinatorStateSchema,\n}).strict();\n\nexport const HostedHeartbeatCoordinatorTaskStatusSchema = z.enum([\n 'idle',\n 'running',\n 'waiting',\n 'blocked',\n 'complete',\n 'failed',\n]);\n\nexport const HostedHeartbeatCoordinatorTaskResultSchema = z.object({\n kind: z.enum([\n 'agent',\n 'skipped',\n 'cancelled',\n 'retry',\n 'blocked',\n 'failed',\n ]),\n decision: z.enum(['continue', 'pause', 'complete', 'escalate']).optional(),\n summary: z.string(),\n outcome: z.string(),\n agentRunId: OpaqueIdSchema.optional(),\n usage: z.unknown().optional(),\n}).passthrough();\n\n/** Stable product/operator projection returned by the Coordinator API. */\nexport const HostedHeartbeatCoordinatorTaskViewSchema = z.object({\n id: OpaqueIdSchema,\n taskId: OpaqueIdSchema,\n workspaceId: OpaqueIdSchema.optional(),\n name: z.string().optional(),\n task: z.string(),\n enabled: z.boolean(),\n continuationMode: z.enum(['operator', 'agent']).optional(),\n schedule: z.object({\n intervalMs: z.number().int().positive(),\n nextRunAt: TimestampSchema.optional(),\n }).passthrough(),\n state: z.object({\n status: HostedHeartbeatCoordinatorTaskStatusSchema,\n progress: z.string().optional(),\n runId: OpaqueIdSchema.optional(),\n runAt: TimestampSchema.optional(),\n loadedCheckpoint: z.boolean().optional(),\n resumable: z.boolean().optional(),\n result: HostedHeartbeatCoordinatorTaskResultSchema.optional(),\n error: z.string().optional(),\n updatedAt: TimestampSchema.optional(),\n }).passthrough(),\n}).passthrough();\n\nexport const HostedHeartbeatCoordinatorTaskListSchema = z.object({\n tasks: z.array(HostedHeartbeatCoordinatorTaskViewSchema),\n}).strict();\n\nexport const HostedHeartbeatCoordinatorRunViewSchema = z.object({\n id: OpaqueIdSchema,\n taskId: OpaqueIdSchema,\n workspaceId: OpaqueIdSchema.optional(),\n executionId: OpaqueIdSchema,\n runId: OpaqueIdSchema.optional(),\n createdAt: TimestampSchema,\n task: HostedHeartbeatCoordinatorTaskViewSchema,\n result: HostedHeartbeatCoordinatorTaskResultSchema,\n loadedCheckpoint: z.boolean().optional(),\n}).passthrough();\n\nexport const HostedHeartbeatCoordinatorTaskDetailSchema = z.object({\n task: HostedHeartbeatCoordinatorTaskViewSchema,\n runs: z.array(HostedHeartbeatCoordinatorRunViewSchema),\n}).strict();\n\nexport const HostedHeartbeatDesiredTaskSchema = z.object({\n taskId: OpaqueIdSchema,\n input: HostedHeartbeatCoordinatorTaskInputSchema,\n}).strict();\n\nexport const HostedHeartbeatDesiredTaskCatalogSchema = z.object({\n tasks: z.array(HostedHeartbeatDesiredTaskSchema).max(10_000),\n resume: z.boolean(),\n}).strict().superRefine(({ tasks }, context) => {\n const seen = new Set<string>();\n tasks.forEach(({ taskId }, index) => {\n if (seen.has(taskId)) {\n context.addIssue({\n code: 'custom',\n path: ['tasks', index, 'taskId'],\n message: 'must be unique within the desired task catalog',\n });\n }\n seen.add(taskId);\n });\n});\n\nexport const HostedHeartbeatExecutionPreparationRequestSchema = z.object({\n schemaVersion: z.literal(1),\n taskId: OpaqueIdSchema,\n executionId: OpaqueIdSchema,\n interruptedExecutionId: OpaqueIdSchema.optional(),\n}).strict();\n\nconst DelegatedAuthorityMetadataSchema = z.object({\n scope: ExecutionScopeSchema,\n runtimeSessionId: RuntimeSessionIdSchema,\n invocationId: OpaqueIdSchema,\n workflow: z.literal(HEARTBEAT_TASK_WORKFLOW),\n issuedAt: TimestampSchema,\n executionExpiresAt: TimestampSchema,\n mcp: z.object({\n capabilityId: OpaqueIdSchema,\n serverId: McpServerIdSchema,\n allowedTools: McpAllowedToolsSchema,\n expiresAt: TimestampSchema,\n }).strict(),\n}).strict();\n\nexport const HostedHeartbeatDelegationSchema = z.object({\n schemaVersion: z.literal(1),\n taskId: OpaqueIdSchema,\n executionId: OpaqueIdSchema,\n scope: ProductExecutionScopeSchema,\n runtimeSessionId: RuntimeSessionIdSchema,\n deadlineAt: TimestampSchema,\n authority: z.object({\n metadata: DelegatedAuthorityMetadataSchema,\n executionAssertion: z.string().min(1).max(16_384),\n mcpCapability: z.string().min(1).max(16_384),\n }).strict(),\n}).strict().superRefine((delegation, context) => {\n const metadata = delegation.authority.metadata;\n const mismatches: Array<[path: string, mismatched: boolean]> = [\n ['executionId', metadata.invocationId !== delegation.executionId],\n [\n 'runtimeSessionId',\n metadata.runtimeSessionId !== delegation.runtimeSessionId,\n ],\n ['scope', !sameProductScope(metadata.scope, delegation.scope)],\n ];\n mismatches\n .filter(([, mismatched]) => mismatched)\n .forEach(([path]) => context.addIssue({\n code: 'custom',\n path: [path],\n message: 'must match the delegated execution authority metadata',\n }));\n});\n\nexport const HostedHeartbeatExecutionAuthorizationSchema = z.object({\n scope: ProductExecutionScopeSchema,\n allowedTools: McpAllowedToolsSchema,\n}).strict();\n\nexport const HostedHeartbeatExecutionPreparationDecisionSchema =\n z.discriminatedUnion('kind', [\n z.object({\n kind: z.literal('execute'),\n authorization: HostedHeartbeatExecutionAuthorizationSchema,\n }).strict(),\n z.object({\n kind: z.literal('skip'),\n summary: z.string().trim().min(1).max(500),\n }).strict(),\n ]);\n\nexport const HostedHeartbeatExecutionPreparationSchema = z.discriminatedUnion(\n 'kind',\n [\n z.object({\n schemaVersion: z.literal(1),\n kind: z.literal('execute'),\n delegation: HostedHeartbeatDelegationSchema,\n }).strict(),\n z.object({\n schemaVersion: z.literal(1),\n kind: z.literal('skip'),\n taskId: OpaqueIdSchema,\n executionId: OpaqueIdSchema,\n summary: z.string().trim().min(1).max(500),\n }).strict(),\n ],\n);\n\nexport const HostedHeartbeatExecutionResultSchema = z.object({\n decision: z.enum(['continue', 'pause', 'complete', 'escalate']),\n summary: z.string(),\n runId: OpaqueIdSchema,\n outcome: z.enum(['done', 'max_steps', 'error', 'interrupted']),\n}).strict();\n\nconst HostedHeartbeatExecutionSettlementEnvelopeSchema = z.object({\n schemaVersion: z.literal(1),\n taskId: OpaqueIdSchema,\n executionId: OpaqueIdSchema,\n});\n\nexport const HostedHeartbeatExecutionSettlementRequestSchema =\n z.discriminatedUnion('kind', [\n HostedHeartbeatExecutionSettlementEnvelopeSchema.extend({\n kind: z.literal('completed'),\n result: HostedHeartbeatExecutionResultSchema,\n }).strict(),\n HostedHeartbeatExecutionSettlementEnvelopeSchema.extend({\n kind: z.literal('failed'),\n errorType: z.string().trim().min(1).max(128),\n }).strict(),\n HostedHeartbeatExecutionSettlementEnvelopeSchema.extend({\n kind: z.literal('interrupted'),\n }).strict(),\n ]);\n\nexport const HostedHeartbeatExecutionDispositionSchema = z.discriminatedUnion(\n 'kind',\n [\n z.object({ kind: z.literal('accepted') }).strict(),\n z.object({\n kind: z.literal('retry'),\n summary: z.string().trim().min(1).max(500),\n delayMs: z.number().int().min(1_000).max(Number.MAX_SAFE_INTEGER)\n .optional(),\n }).strict(),\n z.object({\n kind: z.literal('blocked'),\n summary: z.string().trim().min(1).max(500),\n }).strict(),\n ],\n);\n\nexport const HostedHeartbeatExecutionSettlementSchema = z.object({\n schemaVersion: z.literal(1),\n taskId: OpaqueIdSchema,\n executionId: OpaqueIdSchema,\n disposition: HostedHeartbeatExecutionDispositionSchema,\n}).strict();\n\nexport type HostedHeartbeatCoordinatorTaskInput = z.infer<\n typeof HostedHeartbeatCoordinatorTaskInputSchema\n>;\nexport type HostedHeartbeatCoordinatorState = z.infer<\n typeof HostedHeartbeatCoordinatorStateSchema\n>;\nexport type HostedHeartbeatCoordinatorTaskView = z.infer<\n typeof HostedHeartbeatCoordinatorTaskViewSchema\n>;\nexport type HostedHeartbeatCoordinatorRunView = z.infer<\n typeof HostedHeartbeatCoordinatorRunViewSchema\n>;\nexport type HostedHeartbeatCoordinatorTaskDetail = z.infer<\n typeof HostedHeartbeatCoordinatorTaskDetailSchema\n>;\nexport type HostedHeartbeatDesiredTask = z.infer<\n typeof HostedHeartbeatDesiredTaskSchema\n>;\nexport type HostedHeartbeatDesiredTaskCatalog = z.infer<\n typeof HostedHeartbeatDesiredTaskCatalogSchema\n>;\nexport type HostedHeartbeatExecutionPreparationRequest = z.infer<\n typeof HostedHeartbeatExecutionPreparationRequestSchema\n>;\nexport type HostedHeartbeatDelegation = z.infer<\n typeof HostedHeartbeatDelegationSchema\n>;\nexport type HostedHeartbeatExecutionAuthorization = z.infer<\n typeof HostedHeartbeatExecutionAuthorizationSchema\n>;\nexport type HostedHeartbeatExecutionPreparationDecision = z.infer<\n typeof HostedHeartbeatExecutionPreparationDecisionSchema\n>;\nexport type HostedHeartbeatExecutionPreparation = z.infer<\n typeof HostedHeartbeatExecutionPreparationSchema\n>;\nexport type HostedHeartbeatExecutionResult = z.infer<\n typeof HostedHeartbeatExecutionResultSchema\n>;\nexport type HostedHeartbeatExecutionSettlementRequest = z.infer<\n typeof HostedHeartbeatExecutionSettlementRequestSchema\n>;\nexport type HostedHeartbeatExecutionDisposition = z.infer<\n typeof HostedHeartbeatExecutionDispositionSchema\n>;\nexport type HostedHeartbeatExecutionSettlement = z.infer<\n typeof HostedHeartbeatExecutionSettlementSchema\n>;\n\nfunction sameProductScope(\n left: z.infer<typeof ExecutionScopeSchema>,\n right: z.infer<typeof ProductExecutionScopeSchema>,\n): boolean {\n return left.tenantId === right.tenantId\n && left.subjectId === right.subjectId\n && left.productSessionId === right.productSessionId;\n}\n"]}
@@ -0,0 +1,30 @@
1
+ import { type HostedHeartbeatAgentExecutionTransportInput } from '../heartbeat/index.js';
2
+ import { type HostedHeartbeatExecutionPreparation, type HostedHeartbeatExecutionPreparationRequest, type HostedHeartbeatExecutionSettlement, type HostedHeartbeatExecutionSettlementRequest } from './contracts.js';
3
+ import type { HostedHeartbeatCoordinatorExecutionContext, HostedHeartbeatDelegatedExecutionConfig, HostedHeartbeatExecutionTransportPort, HostedHeartbeatExecutionApi, HostedHeartbeatExecutionClientConfig } from './types.js';
4
+ type ExecutionOperation = 'prepare' | 'settle';
5
+ export declare class HostedHeartbeatExecutionRequestError extends Error {
6
+ readonly operation: ExecutionOperation;
7
+ readonly status: number;
8
+ readonly name = "HostedHeartbeatExecutionRequestError";
9
+ constructor(operation: ExecutionOperation, status: number);
10
+ }
11
+ /** Authenticated Coordinator client for the product-owned work lifecycle. */
12
+ export declare class HostedHeartbeatExecutionClient implements HostedHeartbeatExecutionApi {
13
+ #private;
14
+ constructor(config: HostedHeartbeatExecutionClientConfig);
15
+ prepare(rawInput: HostedHeartbeatExecutionPreparationRequest, signal?: AbortSignal): Promise<HostedHeartbeatExecutionPreparation>;
16
+ settle(rawInput: HostedHeartbeatExecutionSettlementRequest, signal?: AbortSignal): Promise<HostedHeartbeatExecutionSettlement>;
17
+ }
18
+ /**
19
+ * Coordinates product work around Heddle's authoritative task attempt.
20
+ * The paired transport consumes exactly the delegation prepared for that
21
+ * execution, so running the agent can never create a second product claim.
22
+ */
23
+ export declare class HostedHeartbeatDelegatedExecution implements HostedHeartbeatExecutionTransportPort {
24
+ #private;
25
+ constructor(config: HostedHeartbeatDelegatedExecutionConfig);
26
+ handle<TResult, TOutcome>(context: HostedHeartbeatCoordinatorExecutionContext<TResult, TOutcome>): Promise<TResult | TOutcome>;
27
+ execute(input: HostedHeartbeatAgentExecutionTransportInput): Promise<unknown>;
28
+ }
29
+ export {};
30
+ //# sourceMappingURL=hosted-heartbeat-execution-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hosted-heartbeat-execution-client.d.ts","sourceRoot":"","sources":["../../src/coordinator/hosted-heartbeat-execution-client.ts"],"names":[],"mappings":"AAaA,OAAO,EAGL,KAAK,2CAA2C,EACjD,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAOL,KAAK,mCAAmC,EACxC,KAAK,0CAA0C,EAC/C,KAAK,kCAAkC,EACvC,KAAK,yCAAyC,EAC/C,MAAM,gBAAgB,CAAC;AAExB,OAAO,KAAK,EACV,0CAA0C,EAC1C,uCAAuC,EACvC,qCAAqC,EACrC,2BAA2B,EAC3B,oCAAoC,EACrC,MAAM,YAAY,CAAC;AAgBpB,KAAK,kBAAkB,GAAG,SAAS,GAAG,QAAQ,CAAC;AAE/C,qBAAa,oCAAqC,SAAQ,KAAK;IAI3D,QAAQ,CAAC,SAAS,EAAE,kBAAkB;IACtC,QAAQ,CAAC,MAAM,EAAE,MAAM;IAJzB,QAAQ,CAAC,IAAI,0CAA0C;gBAG5C,SAAS,EAAE,kBAAkB,EAC7B,MAAM,EAAE,MAAM;CAI1B;AAED,6EAA6E;AAC7E,qBAAa,8BACb,YAAW,2BAA2B;;gBAMxB,MAAM,EAAE,oCAAoC;IAyBlD,OAAO,CACX,QAAQ,EAAE,0CAA0C,EACpD,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,mCAAmC,CAAC;IAczC,MAAM,CACV,QAAQ,EAAE,yCAAyC,EACnD,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,kCAAkC,CAAC;CAqC/C;AAED;;;;GAIG;AACH,qBAAa,iCACb,YAAW,qCAAqC;;gBAIlC,MAAM,EAAE,uCAAuC;IAIrD,MAAM,CAAC,OAAO,EAAE,QAAQ,EAC5B,OAAO,EA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