@agent-vm/agent-portal-sdk 0.0.141 → 0.0.142

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 (120) hide show
  1. package/contract-fixtures/portable-contracts/approval/decision-request-approved.fixture.json +18 -0
  2. package/contract-fixtures/portable-contracts/approval/decision-result-recorded.fixture.json +18 -0
  3. package/contract-fixtures/portable-contracts/approval/presentation-outcome-approved.fixture.json +16 -0
  4. package/contract-fixtures/portable-contracts/approval/presentation-request.fixture.json +32 -0
  5. package/contract-fixtures/portable-contracts/discovery/describe-result.fixture.json +7 -3
  6. package/contract-fixtures/portable-contracts/discovery/list-result.fixture.json +15 -3
  7. package/contract-fixtures/portable-contracts/discovery/search-result.fixture.json +7 -3
  8. package/contract-fixtures/portable-contracts/gateway/managed-agent-projection-hermes-valid.fixture.json +7 -4
  9. package/contract-fixtures/portable-contracts/gateway/managed-agent-projection-long-namespace-name.fixture.json +13 -6
  10. package/contract-fixtures/portable-contracts/gateway/managed-agent-projection-namespace-names-code-point-order.fixture.json +7 -4
  11. package/contract-fixtures/portable-contracts/gateway/managed-agent-projection-namespace-names-code-point-reverse.fixture.json +6 -3
  12. package/contract-fixtures/portable-contracts/gateway/managed-agent-projection-namespace-names-duplicate.fixture.json +6 -3
  13. package/contract-fixtures/portable-contracts/gateway/managed-agent-projection-namespace-names-unsorted.fixture.json +6 -3
  14. package/contract-fixtures/portable-contracts/gateway/managed-agent-projection-old-authority-rejected.fixture.json +5 -2
  15. package/contract-fixtures/portable-contracts/gateway/managed-agent-projection-openclaw-valid.fixture.json +7 -4
  16. package/contract-fixtures/portable-contracts/gateway/managed-agent-projection-self-root-rejected.fixture.json +5 -2
  17. package/contract-fixtures/portable-contracts/gateway/managed-agent-projection-work-root-rejected.fixture.json +5 -2
  18. package/dist/adapter-boundary/index.d.ts +1 -1
  19. package/dist/approval-surface/index.d.ts +2 -2
  20. package/dist/approval-surface/index.js +2 -2
  21. package/dist/approval-surface-Cqk_hAtN.js +132 -0
  22. package/dist/approval-surface-Cqk_hAtN.js.map +1 -0
  23. package/dist/artifact-surface/index.d.ts +1 -1
  24. package/dist/artifact-surface/index.js +1 -1
  25. package/dist/{artifact-surface-BIDasG5x.js → artifact-surface-CHEu4tDd.js} +2 -2
  26. package/dist/{artifact-surface-BIDasG5x.js.map → artifact-surface-CHEu4tDd.js.map} +1 -1
  27. package/dist/capability-description-surface/index.d.ts +1 -1
  28. package/dist/capability-description-surface/index.js +2 -2
  29. package/dist/capability-description-surface-CplIb93y.js +2 -0
  30. package/dist/{capability-descriptor-schema-DmzUtpji.js → capability-descriptor-schema-v9tj7yKr.js} +2 -2
  31. package/dist/{capability-descriptor-schema-DmzUtpji.js.map → capability-descriptor-schema-v9tj7yKr.js.map} +1 -1
  32. package/dist/cli/tool-portal.js +6 -6
  33. package/dist/contracts/index.d.ts +1 -1
  34. package/dist/contracts/index.js +1 -1
  35. package/dist/{contracts-3pjrcMjD.js → contracts-mBPxCxoG.js} +15 -14
  36. package/dist/{contracts-3pjrcMjD.js.map → contracts-mBPxCxoG.js.map} +1 -1
  37. package/dist/gateway-runtime-client/index.d.ts +11 -4
  38. package/dist/gateway-runtime-client/index.d.ts.map +1 -1
  39. package/dist/gateway-runtime-client/index.js +22 -5
  40. package/dist/gateway-runtime-client/index.js.map +1 -1
  41. package/dist/gateway-runtime-local-exec/gateway-runtime-local-exec-helper.js +1 -1
  42. package/dist/gateway-runtime-local-exec/index.js +1 -1
  43. package/dist/{gateway-runtime-local-exec-transport-DjxMXdT9.js → gateway-runtime-local-exec-transport-CO2bQ3wz.js} +1 -1
  44. package/dist/{gateway-runtime-local-exec-transport-DjxMXdT9.js.map → gateway-runtime-local-exec-transport-CO2bQ3wz.js.map} +1 -1
  45. package/dist/{index-D8uVfMBv.d.ts → index-BIvLq827.d.ts} +2 -2
  46. package/dist/{index-D8uVfMBv.d.ts.map → index-BIvLq827.d.ts.map} +1 -1
  47. package/dist/{index-yuB9HEo-.d.ts → index-BQj9hHds.d.ts} +4 -4
  48. package/dist/{index-yuB9HEo-.d.ts.map → index-BQj9hHds.d.ts.map} +1 -1
  49. package/dist/{index-BQ12JshX.d.ts → index-Ba_G25p_.d.ts} +11 -11
  50. package/dist/{index-BQ12JshX.d.ts.map → index-Ba_G25p_.d.ts.map} +1 -1
  51. package/dist/{index-BgKPbuap.d.ts → index-Badq9e6i.d.ts} +1 -1
  52. package/dist/{index-BgKPbuap.d.ts.map → index-Badq9e6i.d.ts.map} +1 -1
  53. package/dist/{index-DqMFYBbN.d.ts → index-C-QFWaH5.d.ts} +39 -6
  54. package/dist/index-C-QFWaH5.d.ts.map +1 -0
  55. package/dist/{index-B_FqoejO.d.ts → index-C8O_HiyA.d.ts} +4 -4
  56. package/dist/{index-B_FqoejO.d.ts.map → index-C8O_HiyA.d.ts.map} +1 -1
  57. package/dist/index-COlx8Y1g.d.ts +124 -0
  58. package/dist/index-COlx8Y1g.d.ts.map +1 -0
  59. package/dist/{index-B_xYdo3v.d.ts → index-DDLN0DE_.d.ts} +2 -2
  60. package/dist/{index-B_xYdo3v.d.ts.map → index-DDLN0DE_.d.ts.map} +1 -1
  61. package/dist/index-D_69tlLY.d.ts +29 -0
  62. package/dist/index-D_69tlLY.d.ts.map +1 -0
  63. package/dist/{index-C5NhyO2R.d.ts → index-tmZkznV6.d.ts} +5 -2
  64. package/dist/{index-C5NhyO2R.d.ts.map → index-tmZkznV6.d.ts.map} +1 -1
  65. package/dist/index.d.ts +12 -12
  66. package/dist/index.js +16 -15
  67. package/dist/{json-value-schema-BGfMDOGA.js → json-value-schema-Br5M7d7X.js} +2 -2
  68. package/dist/{json-value-schema-BGfMDOGA.js.map → json-value-schema-Br5M7d7X.js.map} +1 -1
  69. package/dist/{json-value-schema-C-87ATB3.d.ts → json-value-schema-CwDmttWU.d.ts} +1 -1
  70. package/dist/{json-value-schema-C-87ATB3.d.ts.map → json-value-schema-CwDmttWU.d.ts.map} +1 -1
  71. package/dist/namespace-discovery-schema-DwbJHVLu.js +21 -0
  72. package/dist/namespace-discovery-schema-DwbJHVLu.js.map +1 -0
  73. package/dist/{node-tool-portal-mcp-transport-CnB8MCW2.js → node-tool-portal-mcp-transport-xFo0i37Q.js} +1 -1
  74. package/dist/{node-tool-portal-mcp-transport-CnB8MCW2.js.map → node-tool-portal-mcp-transport-xFo0i37Q.js.map} +1 -1
  75. package/dist/portable-contracts/index.d.ts +1 -1
  76. package/dist/portable-contracts/index.js +2 -2
  77. package/dist/{portable-contracts-C5rtqe-H.js → portable-contracts-CKeFnjAA.js} +28 -11
  78. package/dist/portable-contracts-CKeFnjAA.js.map +1 -0
  79. package/dist/{portable-refinement-authoring-CvlKRs_Z.js → portable-refinement-authoring-C1Q92x2G.js} +29 -6
  80. package/dist/portable-refinement-authoring-C1Q92x2G.js.map +1 -0
  81. package/dist/{portal-call-request-schema-DYxcWijW.js → portal-call-request-schema-Cl0kTLaX.js} +4 -4
  82. package/dist/{portal-call-request-schema-DYxcWijW.js.map → portal-call-request-schema-Cl0kTLaX.js.map} +1 -1
  83. package/dist/{portal-call-result-schema-CVWMGu2y.js → portal-call-result-schema-B25_rzZZ.js} +20 -10
  84. package/dist/portal-call-result-schema-B25_rzZZ.js.map +1 -0
  85. package/dist/{portal-call-result-schema-DalyNrfW.d.ts → portal-call-result-schema-CS2rX3oP.d.ts} +1132 -166
  86. package/dist/portal-call-result-schema-CS2rX3oP.d.ts.map +1 -0
  87. package/dist/portal-call-surface/index.d.ts +3 -3
  88. package/dist/portal-call-surface/index.js +5 -5
  89. package/dist/{portal-call-surface-B_oQxm5X.js → portal-call-surface-qykVz_8k.js} +6 -6
  90. package/dist/{portal-call-surface-B_oQxm5X.js.map → portal-call-surface-qykVz_8k.js.map} +1 -1
  91. package/dist/{portal-error-schema-BCALC7xt.js → portal-error-schema-TSNrpQSy.js} +1 -1
  92. package/dist/{portal-error-schema-BCALC7xt.js.map → portal-error-schema-TSNrpQSy.js.map} +1 -1
  93. package/dist/portal-event-surface/index.d.ts +1 -1
  94. package/dist/portal-event-surface/index.js +2 -2
  95. package/dist/{portal-event-surface-DSWv7Kgi.js → portal-event-surface-Bp3rXsBz.js} +3 -3
  96. package/dist/{portal-event-surface-DSWv7Kgi.js.map → portal-event-surface-Bp3rXsBz.js.map} +1 -1
  97. package/dist/{request-id-schema-DGLLX-tp.js → request-id-schema-Hq_6lSFV.js} +2 -2
  98. package/dist/{request-id-schema-DGLLX-tp.js.map → request-id-schema-Hq_6lSFV.js.map} +1 -1
  99. package/dist/testing/index.d.ts +2 -2
  100. package/dist/testing/index.js +2 -2
  101. package/dist/tool-portal-mcp-client/index.d.ts +1 -1
  102. package/dist/tool-portal-mcp-client/index.js +1 -1
  103. package/dist/tool-portal-mcp-client/node-tool-portal-mcp-transport.d.ts +1 -1
  104. package/dist/tool-portal-mcp-client/node-tool-portal-mcp-transport.js +1 -1
  105. package/dist/{tool-portal-mcp-client-nMGxqQ-A.js → tool-portal-mcp-client-DZoloMod.js} +5 -5
  106. package/dist/{tool-portal-mcp-client-nMGxqQ-A.js.map → tool-portal-mcp-client-DZoloMod.js.map} +1 -1
  107. package/package.json +1 -1
  108. package/portable-contract-schema-manifest.json +275 -9
  109. package/dist/approval-surface-z5JUqa0K.js +0 -20
  110. package/dist/approval-surface-z5JUqa0K.js.map +0 -1
  111. package/dist/capability-description-surface-CyPgad9d.js +0 -2
  112. package/dist/index-BqWw914Z.d.ts +0 -64
  113. package/dist/index-BqWw914Z.d.ts.map +0 -1
  114. package/dist/index-DqMFYBbN.d.ts.map +0 -1
  115. package/dist/index-dKXgrOwm.d.ts +0 -17
  116. package/dist/index-dKXgrOwm.d.ts.map +0 -1
  117. package/dist/portable-contracts-C5rtqe-H.js.map +0 -1
  118. package/dist/portable-refinement-authoring-CvlKRs_Z.js.map +0 -1
  119. package/dist/portal-call-result-schema-CVWMGu2y.js.map +0 -1
  120. package/dist/portal-call-result-schema-DalyNrfW.d.ts.map +0 -1
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { a as encodeGatewayRuntimeLocalExecFrame, i as GatewayRuntimeLocalExecLineDecoder, n as GATEWAY_RUNTIME_LOCAL_EXEC_TOKEN_ENV, o as parseGatewayRuntimeLocalExecServerFrame, t as GATEWAY_RUNTIME_LOCAL_EXEC_SOCKET_ENV } from "../gateway-runtime-local-exec-transport-DjxMXdT9.js";
2
+ import { a as encodeGatewayRuntimeLocalExecFrame, i as GatewayRuntimeLocalExecLineDecoder, n as GATEWAY_RUNTIME_LOCAL_EXEC_TOKEN_ENV, o as parseGatewayRuntimeLocalExecServerFrame, t as GATEWAY_RUNTIME_LOCAL_EXEC_SOCKET_ENV } from "../gateway-runtime-local-exec-transport-CO2bQ3wz.js";
3
3
  import { createConnection } from "node:net";
4
4
  //#region src/gateway-runtime-local-exec/gateway-runtime-local-exec-helper.ts
5
5
  const CONNECTION_DEADLINE_MS = 1e4;
@@ -1,2 +1,2 @@
1
- import { n as GATEWAY_RUNTIME_LOCAL_EXEC_TOKEN_ENV, r as GatewayRuntimeLocalExecTransport, t as GATEWAY_RUNTIME_LOCAL_EXEC_SOCKET_ENV } from "../gateway-runtime-local-exec-transport-DjxMXdT9.js";
1
+ import { n as GATEWAY_RUNTIME_LOCAL_EXEC_TOKEN_ENV, r as GatewayRuntimeLocalExecTransport, t as GATEWAY_RUNTIME_LOCAL_EXEC_SOCKET_ENV } from "../gateway-runtime-local-exec-transport-CO2bQ3wz.js";
2
2
  export { GATEWAY_RUNTIME_LOCAL_EXEC_SOCKET_ENV, GATEWAY_RUNTIME_LOCAL_EXEC_TOKEN_ENV, GatewayRuntimeLocalExecTransport };
@@ -424,4 +424,4 @@ var GatewayRuntimeLocalExecTransport = class {
424
424
  //#endregion
425
425
  export { encodeGatewayRuntimeLocalExecFrame as a, GatewayRuntimeLocalExecLineDecoder as i, GATEWAY_RUNTIME_LOCAL_EXEC_TOKEN_ENV as n, parseGatewayRuntimeLocalExecServerFrame as o, GatewayRuntimeLocalExecTransport as r, GATEWAY_RUNTIME_LOCAL_EXEC_SOCKET_ENV as t };
426
426
 
427
- //# sourceMappingURL=gateway-runtime-local-exec-transport-DjxMXdT9.js.map
427
+ //# sourceMappingURL=gateway-runtime-local-exec-transport-CO2bQ3wz.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"gateway-runtime-local-exec-transport-DjxMXdT9.js","names":["#buffer","#socket","#pendingWrite","#helperArgv","#reservationScheduler","#reservationTimeoutMs","#reservations","#temporaryDirectory","#expireReservation","#acceptConnection","#disposeReservation","#processClientFrames","#runAuthenticatedOperation","#disposeReservationOnce"],"sources":["../src/gateway-runtime-local-exec/gateway-runtime-local-exec-protocol.ts","../src/gateway-runtime-local-exec/gateway-runtime-local-exec-transport.ts"],"sourcesContent":["const MAXIMUM_LOCAL_EXEC_FRAME_BYTES = 128 * 1024;\nconst MAXIMUM_LOCAL_EXEC_STREAM_CHUNK_BYTES = 64 * 1024;\nconst MAXIMUM_LOCAL_EXEC_TOKEN_BYTES = 256;\n\nexport type GatewayRuntimeLocalExecClientFrame =\n\t| { readonly kind: 'authenticate'; readonly token: string }\n\t| { readonly kind: 'cancel' }\n\t| { readonly contentBase64: string; readonly kind: 'stdin-chunk' }\n\t| { readonly kind: 'stdin-end' }\n\t| { readonly columns: number; readonly kind: 'terminal-resize'; readonly rows: number };\n\nexport type GatewayRuntimeLocalExecServerFrame =\n\t| { readonly kind: 'accepted' }\n\t| { readonly contentBase64: string; readonly kind: 'stderr-chunk' }\n\t| { readonly kind: 'stderr-end' }\n\t| { readonly exitCode: number | null; readonly kind: 'exited' }\n\t| { readonly message: string; readonly kind: 'rejected' }\n\t| { readonly contentBase64: string; readonly kind: 'stdout-chunk' }\n\t| { readonly kind: 'stdout-end' };\n\nexport class GatewayRuntimeLocalExecProtocolError extends Error {\n\tconstructor(message: string) {\n\t\tsuper(message);\n\t\tthis.name = 'GatewayRuntimeLocalExecProtocolError';\n\t}\n}\n\nfunction isRecord(value: unknown): value is Readonly<Record<string, unknown>> {\n\treturn typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nfunction requireExactKeys(value: Readonly<Record<string, unknown>>, keys: readonly string[]): void {\n\tconst actualKeys = Object.keys(value).toSorted();\n\tconst expectedKeys = keys.toSorted();\n\tif (\n\t\tactualKeys.length !== expectedKeys.length ||\n\t\tactualKeys.some((key, index) => key !== expectedKeys[index])\n\t) {\n\t\tthrow new GatewayRuntimeLocalExecProtocolError('Local exec frame contains unexpected fields.');\n\t}\n}\n\nfunction requireString(value: unknown, fieldName: string): string {\n\tif (typeof value !== 'string' || value.length === 0) {\n\t\tthrow new GatewayRuntimeLocalExecProtocolError(\n\t\t\t`Local exec frame field '${fieldName}' must be a non-empty string.`,\n\t\t);\n\t}\n\treturn value;\n}\n\nfunction requireBoundedToken(value: unknown): string {\n\tconst token = requireString(value, 'token');\n\tif (Buffer.byteLength(token, 'utf8') > MAXIMUM_LOCAL_EXEC_TOKEN_BYTES) {\n\t\tthrow new GatewayRuntimeLocalExecProtocolError(\n\t\t\t'Local exec reservation token exceeds the byte limit.',\n\t\t);\n\t}\n\treturn token;\n}\n\nfunction requireCanonicalBase64(value: unknown): string {\n\tconst encoded = requireString(value, 'contentBase64');\n\tconst decoded = Buffer.from(encoded, 'base64');\n\tif (\n\t\tdecoded.byteLength > MAXIMUM_LOCAL_EXEC_STREAM_CHUNK_BYTES ||\n\t\tdecoded.toString('base64') !== encoded\n\t) {\n\t\tthrow new GatewayRuntimeLocalExecProtocolError(\n\t\t\t'Local exec stream content must be canonical bounded base64.',\n\t\t);\n\t}\n\treturn encoded;\n}\n\nfunction requireTerminalDimension(value: unknown, fieldName: string): number {\n\tif (!Number.isSafeInteger(value) || (value as number) <= 0 || (value as number) > 1_000) {\n\t\tthrow new GatewayRuntimeLocalExecProtocolError(\n\t\t\t`Local exec frame field '${fieldName}' must be a bounded positive integer.`,\n\t\t);\n\t}\n\treturn value as number;\n}\n\nfunction parseJsonObject(line: string): Readonly<Record<string, unknown>> {\n\tif (Buffer.byteLength(line, 'utf8') > MAXIMUM_LOCAL_EXEC_FRAME_BYTES) {\n\t\tthrow new GatewayRuntimeLocalExecProtocolError('Local exec frame exceeds the byte limit.');\n\t}\n\tlet value: unknown;\n\ttry {\n\t\tvalue = JSON.parse(line);\n\t} catch (error: unknown) {\n\t\tthrow new GatewayRuntimeLocalExecProtocolError(\n\t\t\terror instanceof Error\n\t\t\t\t? `Local exec frame is not valid JSON: ${error.message}`\n\t\t\t\t: 'Local exec frame is not valid JSON.',\n\t\t);\n\t}\n\tif (!isRecord(value)) {\n\t\tthrow new GatewayRuntimeLocalExecProtocolError('Local exec frame must be an object.');\n\t}\n\treturn value;\n}\n\nexport function encodeGatewayRuntimeLocalExecFrame(\n\tframe: GatewayRuntimeLocalExecClientFrame | GatewayRuntimeLocalExecServerFrame,\n): string {\n\treturn `${JSON.stringify(frame)}\\n`;\n}\n\nexport function parseGatewayRuntimeLocalExecClientFrame(\n\tline: string,\n): GatewayRuntimeLocalExecClientFrame {\n\tconst value = parseJsonObject(line);\n\tconst kind = requireString(value.kind, 'kind');\n\tswitch (kind) {\n\t\tcase 'authenticate':\n\t\t\trequireExactKeys(value, ['kind', 'token']);\n\t\t\treturn { kind, token: requireBoundedToken(value.token) };\n\t\tcase 'cancel':\n\t\tcase 'stdin-end':\n\t\t\trequireExactKeys(value, ['kind']);\n\t\t\treturn { kind };\n\t\tcase 'stdin-chunk':\n\t\t\trequireExactKeys(value, ['contentBase64', 'kind']);\n\t\t\treturn { contentBase64: requireCanonicalBase64(value.contentBase64), kind };\n\t\tcase 'terminal-resize':\n\t\t\trequireExactKeys(value, ['columns', 'kind', 'rows']);\n\t\t\treturn {\n\t\t\t\tcolumns: requireTerminalDimension(value.columns, 'columns'),\n\t\t\t\tkind,\n\t\t\t\trows: requireTerminalDimension(value.rows, 'rows'),\n\t\t\t};\n\t\tdefault:\n\t\t\tthrow new GatewayRuntimeLocalExecProtocolError(`Unknown local exec client frame '${kind}'.`);\n\t}\n}\n\nexport function parseGatewayRuntimeLocalExecServerFrame(\n\tline: string,\n): GatewayRuntimeLocalExecServerFrame {\n\tconst value = parseJsonObject(line);\n\tconst kind = requireString(value.kind, 'kind');\n\tswitch (kind) {\n\t\tcase 'accepted':\n\t\tcase 'stderr-end':\n\t\tcase 'stdout-end':\n\t\t\trequireExactKeys(value, ['kind']);\n\t\t\treturn { kind };\n\t\tcase 'stderr-chunk':\n\t\tcase 'stdout-chunk':\n\t\t\trequireExactKeys(value, ['contentBase64', 'kind']);\n\t\t\treturn { contentBase64: requireCanonicalBase64(value.contentBase64), kind };\n\t\tcase 'exited':\n\t\t\trequireExactKeys(value, ['exitCode', 'kind']);\n\t\t\tif (\n\t\t\t\tvalue.exitCode !== null &&\n\t\t\t\t(!Number.isSafeInteger(value.exitCode) ||\n\t\t\t\t\t(value.exitCode as number) < 0 ||\n\t\t\t\t\t(value.exitCode as number) > 255)\n\t\t\t) {\n\t\t\t\tthrow new GatewayRuntimeLocalExecProtocolError(\n\t\t\t\t\t\"Local exec frame field 'exitCode' must be null or an integer from 0 through 255.\",\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn { exitCode: value.exitCode as number | null, kind };\n\t\tcase 'rejected':\n\t\t\trequireExactKeys(value, ['kind', 'message']);\n\t\t\treturn { kind, message: requireString(value.message, 'message') };\n\t\tdefault:\n\t\t\tthrow new GatewayRuntimeLocalExecProtocolError(`Unknown local exec server frame '${kind}'.`);\n\t}\n}\n\nexport class GatewayRuntimeLocalExecLineDecoder {\n\t#buffer = Buffer.alloc(0);\n\n\tpush(chunk: Uint8Array): readonly string[] {\n\t\tif (chunk.byteLength + this.#buffer.byteLength > MAXIMUM_LOCAL_EXEC_FRAME_BYTES) {\n\t\t\tthrow new GatewayRuntimeLocalExecProtocolError(\n\t\t\t\t'Local exec frame batch exceeds the byte limit.',\n\t\t\t);\n\t\t}\n\t\tthis.#buffer = Buffer.concat([this.#buffer, chunk]);\n\t\tconst lines: string[] = [];\n\t\tlet newlineIndex = this.#buffer.indexOf(0x0a);\n\t\twhile (newlineIndex >= 0) {\n\t\t\tconst line = this.#buffer.subarray(0, newlineIndex).toString('utf8');\n\t\t\tthis.#buffer = this.#buffer.subarray(newlineIndex + 1);\n\t\t\tif (Buffer.byteLength(line, 'utf8') > MAXIMUM_LOCAL_EXEC_FRAME_BYTES) {\n\t\t\t\tthrow new GatewayRuntimeLocalExecProtocolError('Local exec frame exceeds the byte limit.');\n\t\t\t}\n\t\t\tif (line.length > 0) lines.push(line);\n\t\t\tnewlineIndex = this.#buffer.indexOf(0x0a);\n\t\t}\n\t\tif (this.#buffer.byteLength > MAXIMUM_LOCAL_EXEC_FRAME_BYTES) {\n\t\t\tthrow new GatewayRuntimeLocalExecProtocolError('Local exec frame exceeds the byte limit.');\n\t\t}\n\t\treturn lines;\n\t}\n}\n","import { randomBytes } from 'node:crypto';\nimport { chmod, mkdtemp, rm } from 'node:fs/promises';\nimport { createServer, type Server, type Socket } from 'node:net';\nimport { join } from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nimport {\n\tGatewayRuntimeLocalExecLineDecoder,\n\tGatewayRuntimeLocalExecProtocolError,\n\tencodeGatewayRuntimeLocalExecFrame,\n\tparseGatewayRuntimeLocalExecClientFrame,\n\ttype GatewayRuntimeLocalExecServerFrame,\n} from './gateway-runtime-local-exec-protocol.js';\n\nexport const GATEWAY_RUNTIME_LOCAL_EXEC_SOCKET_ENV = 'AGENT_VM_LOCAL_EXEC_SOCKET';\nexport const GATEWAY_RUNTIME_LOCAL_EXEC_TOKEN_ENV = 'AGENT_VM_LOCAL_EXEC_TOKEN';\n\nconst DEFAULT_RESERVATION_TIMEOUT_MS = 15_000;\nconst DEFAULT_TEMPORARY_DIRECTORY = '/tmp';\nconst MAXIMUM_STREAM_CHUNK_BYTES = 64 * 1024;\n\nexport type GatewayRuntimeLocalExecReadResult =\n\t| { readonly content: Uint8Array; readonly kind: 'chunk' }\n\t| { readonly kind: 'end' };\n\nexport interface GatewayRuntimeLocalExecOperation {\n\treadonly cancel: () => Promise<void>;\n\treadonly closeStdin: () => Promise<void>;\n\treadonly readStderr: (maximumBytes: number) => Promise<GatewayRuntimeLocalExecReadResult>;\n\treadonly readStdout: (maximumBytes: number) => Promise<GatewayRuntimeLocalExecReadResult>;\n\treadonly resizeTerminal?: (size: {\n\t\treadonly columns: number;\n\t\treadonly rows: number;\n\t}) => Promise<void>;\n\treadonly wait: () => Promise<{ readonly exitCode: number | null }>;\n\treadonly writeStdin: (content: Uint8Array) => Promise<void>;\n}\n\nexport interface GatewayRuntimeLocalExecReservationScheduler {\n\treadonly schedule: (callback: () => void, delayMs: number) => { readonly cancel: () => void };\n}\n\nexport interface GatewayRuntimeLocalExecFinalizeToken {\n\treadonly kind: 'gateway-runtime-local-exec';\n\treadonly reservationId: string;\n}\n\nexport interface GatewayRuntimeLocalExecSpec {\n\treadonly argv: readonly string[];\n\treadonly env: Readonly<Record<string, string>>;\n\treadonly finalizeToken: GatewayRuntimeLocalExecFinalizeToken;\n\treadonly stdinMode: 'pipe-open';\n}\n\nexport interface GatewayRuntimeLocalExecTransportOptions {\n\treadonly helperArgv?: readonly string[];\n\treadonly reservationScheduler?: GatewayRuntimeLocalExecReservationScheduler;\n\treadonly reservationTimeoutMs?: number;\n\treadonly temporaryDirectory?: string;\n}\n\ninterface ReservationRecord {\n\treadonly cancelExpiry: () => void;\n\treadonly operation: GatewayRuntimeLocalExecOperation;\n\treadonly reservationDirectory: string;\n\treadonly reservationId: string;\n\treadonly server: Server;\n\treadonly socketPath: string;\n\treadonly token: string;\n\tconsumed: boolean;\n\tdisposal?: Promise<void>;\n\tfinalized: boolean;\n\tsocket?: Socket;\n}\n\nconst defaultReservationScheduler: GatewayRuntimeLocalExecReservationScheduler = {\n\tschedule(callback, delayMs) {\n\t\tconst timeout = setTimeout(callback, delayMs);\n\t\treturn { cancel: () => clearTimeout(timeout) };\n\t},\n};\n\nfunction validateReservationTimeout(timeoutMs: number): number {\n\tif (!Number.isSafeInteger(timeoutMs) || timeoutMs <= 0 || timeoutMs > 60_000) {\n\t\tthrow new RangeError('Local exec reservation timeout must be an integer from 1 through 60000.');\n\t}\n\treturn timeoutMs;\n}\n\nasync function closeServer(server: Server): Promise<void> {\n\tif (!server.listening) return;\n\tawait new Promise<void>((resolve, reject) => {\n\t\tserver.close((error?: Error) => (error === undefined ? resolve() : reject(error)));\n\t});\n}\n\nasync function writeFrame(\n\tsocket: Socket,\n\tframe: GatewayRuntimeLocalExecServerFrame,\n): Promise<void> {\n\tconst encodedFrame = encodeGatewayRuntimeLocalExecFrame(frame);\n\tif (socket.write(encodedFrame)) return;\n\tawait new Promise<void>((resolve, reject) => {\n\t\tconst cleanup = (): void => {\n\t\t\tsocket.off('drain', handleDrain);\n\t\t\tsocket.off('error', handleError);\n\t\t};\n\t\tconst handleDrain = (): void => {\n\t\t\tcleanup();\n\t\t\tresolve();\n\t\t};\n\t\tconst handleError = (error: Error): void => {\n\t\t\tcleanup();\n\t\t\treject(error);\n\t\t};\n\t\tsocket.once('drain', handleDrain);\n\t\tsocket.once('error', handleError);\n\t});\n}\n\nclass GatewayRuntimeLocalExecFrameWriter {\n\t#pendingWrite = Promise.resolve();\n\treadonly #socket: Socket;\n\n\tconstructor(socket: Socket) {\n\t\tthis.#socket = socket;\n\t}\n\n\tasync write(frame: GatewayRuntimeLocalExecServerFrame): Promise<void> {\n\t\tconst write = this.#pendingWrite.then(async () => await writeFrame(this.#socket, frame));\n\t\tthis.#pendingWrite = write.catch(() => undefined);\n\t\tawait write;\n\t}\n}\n\nasync function endSocket(socket: Socket): Promise<void> {\n\tif (socket.destroyed) return;\n\tawait new Promise<void>((resolve) => socket.end(resolve));\n}\n\nasync function pumpOutput(props: {\n\treadonly frameWriter: GatewayRuntimeLocalExecFrameWriter;\n\treadonly kind: 'stderr' | 'stdout';\n\treadonly operation: GatewayRuntimeLocalExecOperation;\n\treadonly socket: Socket;\n}): Promise<void> {\n\tconst read =\n\t\tprops.kind === 'stdout'\n\t\t\t? props.operation.readStdout.bind(props.operation)\n\t\t\t: props.operation.readStderr.bind(props.operation);\n\tif (props.socket.destroyed) return;\n\tconst result = await read(MAXIMUM_STREAM_CHUNK_BYTES);\n\tif (result.kind === 'end') {\n\t\tawait props.frameWriter.write({ kind: `${props.kind}-end` });\n\t\treturn;\n\t}\n\tawait props.frameWriter.write({\n\t\tcontentBase64: Buffer.from(result.content).toString('base64'),\n\t\tkind: `${props.kind}-chunk`,\n\t});\n\tawait pumpOutput(props);\n}\n\nexport class GatewayRuntimeLocalExecTransport {\n\treadonly #helperArgv: readonly string[];\n\treadonly #reservationScheduler: GatewayRuntimeLocalExecReservationScheduler;\n\treadonly #reservationTimeoutMs: number;\n\treadonly #reservations = new Map<string, ReservationRecord>();\n\treadonly #temporaryDirectory: string;\n\n\tconstructor(options: GatewayRuntimeLocalExecTransportOptions = {}) {\n\t\tthis.#helperArgv =\n\t\t\toptions.helperArgv ??\n\t\t\tObject.freeze([\n\t\t\t\tprocess.execPath,\n\t\t\t\tfileURLToPath(\n\t\t\t\t\tnew URL(\n\t\t\t\t\t\t'./gateway-runtime-local-exec/gateway-runtime-local-exec-helper.js',\n\t\t\t\t\t\timport.meta.url,\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t]);\n\t\tif (this.#helperArgv.length === 0)\n\t\t\tthrow new TypeError('Local exec helper argv cannot be empty.');\n\t\tthis.#reservationScheduler = options.reservationScheduler ?? defaultReservationScheduler;\n\t\tthis.#reservationTimeoutMs = validateReservationTimeout(\n\t\t\toptions.reservationTimeoutMs ?? DEFAULT_RESERVATION_TIMEOUT_MS,\n\t\t);\n\t\tthis.#temporaryDirectory = options.temporaryDirectory ?? DEFAULT_TEMPORARY_DIRECTORY;\n\t}\n\n\tasync reserve(operation: GatewayRuntimeLocalExecOperation): Promise<GatewayRuntimeLocalExecSpec> {\n\t\tconst reservationId = randomBytes(16).toString('hex');\n\t\tconst token = randomBytes(32).toString('base64url');\n\t\tconst reservationDirectory = await mkdtemp(\n\t\t\tjoin(this.#temporaryDirectory, 'agent-vm-local-exec-'),\n\t\t);\n\t\tawait chmod(reservationDirectory, 0o700);\n\t\tconst socketPath = join(reservationDirectory, 'relay.sock');\n\t\tconst server = createServer();\n\t\tconst expiry = this.#reservationScheduler.schedule(() => {\n\t\t\tvoid this.#expireReservation(reservationId).catch(() => undefined);\n\t\t}, this.#reservationTimeoutMs);\n\t\tconst reservation: ReservationRecord = {\n\t\t\tcancelExpiry: expiry.cancel,\n\t\t\tconsumed: false,\n\t\t\tfinalized: false,\n\t\t\toperation,\n\t\t\treservationDirectory,\n\t\t\treservationId,\n\t\t\tserver,\n\t\t\tsocketPath,\n\t\t\ttoken,\n\t\t};\n\t\tthis.#reservations.set(reservationId, reservation);\n\t\tserver.on('connection', (socket) => this.#acceptConnection(reservation, socket));\n\t\ttry {\n\t\t\tawait new Promise<void>((resolve, reject) => {\n\t\t\t\tserver.once('error', reject);\n\t\t\t\tserver.listen(socketPath, () => {\n\t\t\t\t\tserver.off('error', reject);\n\t\t\t\t\tresolve();\n\t\t\t\t});\n\t\t\t});\n\t\t\tawait chmod(socketPath, 0o600);\n\t\t} catch (error: unknown) {\n\t\t\tawait this.#disposeReservation(reservation, true);\n\t\t\tthrow error;\n\t\t}\n\t\treturn {\n\t\t\targv: [...this.#helperArgv],\n\t\t\tenv: {\n\t\t\t\t[GATEWAY_RUNTIME_LOCAL_EXEC_SOCKET_ENV]: socketPath,\n\t\t\t\t[GATEWAY_RUNTIME_LOCAL_EXEC_TOKEN_ENV]: token,\n\t\t\t},\n\t\t\tfinalizeToken: { kind: 'gateway-runtime-local-exec', reservationId },\n\t\t\tstdinMode: 'pipe-open',\n\t\t};\n\t}\n\n\tasync finalize(token: unknown): Promise<void> {\n\t\tconst reservationId =\n\t\t\ttypeof token === 'object' && token !== null ? Reflect.get(token, 'reservationId') : undefined;\n\t\tif (\n\t\t\ttypeof token !== 'object' ||\n\t\t\ttoken === null ||\n\t\t\tReflect.get(token, 'kind') !== 'gateway-runtime-local-exec' ||\n\t\t\ttypeof reservationId !== 'string'\n\t\t) {\n\t\t\treturn;\n\t\t}\n\t\tconst reservation = this.#reservations.get(reservationId);\n\t\tif (reservation === undefined) return;\n\t\tawait this.#disposeReservation(reservation, !reservation.consumed);\n\t}\n\n\tasync close(): Promise<void> {\n\t\tawait Promise.all(\n\t\t\t[...this.#reservations.values()].map(\n\t\t\t\tasync (reservation) => await this.#disposeReservation(reservation, true),\n\t\t\t),\n\t\t);\n\t}\n\n\tasync #expireReservation(reservationId: string): Promise<void> {\n\t\tconst reservation = this.#reservations.get(reservationId);\n\t\tif (reservation === undefined || reservation.consumed) return;\n\t\tawait this.#disposeReservation(reservation, true);\n\t}\n\n\t#acceptConnection(reservation: ReservationRecord, socket: Socket): void {\n\t\tif (reservation.finalized || reservation.consumed) {\n\t\t\tvoid writeFrame(socket, {\n\t\t\t\tkind: 'rejected',\n\t\t\t\tmessage: 'Reservation already consumed.',\n\t\t\t})\n\t\t\t\t.catch(() => undefined)\n\t\t\t\t.finally(() => socket.destroy());\n\t\t\treturn;\n\t\t}\n\t\tconst decoder = new GatewayRuntimeLocalExecLineDecoder();\n\t\tconst connectionState = { authenticated: false };\n\t\tsocket.once('close', () => {\n\t\t\tif (connectionState.authenticated && !reservation.finalized) {\n\t\t\t\tvoid this.#disposeReservation(reservation, true).catch(() => undefined);\n\t\t\t}\n\t\t});\n\t\tsocket.on('data', (chunk: Buffer) => {\n\t\t\tsocket.pause();\n\t\t\tvoid this.#processClientFrames({\n\t\t\t\tchunk,\n\t\t\t\tconnectionState,\n\t\t\t\tdecoder,\n\t\t\t\treservation,\n\t\t\t\tsocket,\n\t\t\t})\n\t\t\t\t.then(() => {\n\t\t\t\t\tif (!socket.destroyed) socket.resume();\n\t\t\t\t})\n\t\t\t\t.catch((error: unknown) => {\n\t\t\t\t\tvoid writeFrame(socket, {\n\t\t\t\t\t\tkind: 'rejected',\n\t\t\t\t\t\tmessage: error instanceof Error ? error.message : 'Invalid local exec frame.',\n\t\t\t\t\t})\n\t\t\t\t\t\t.catch(() => undefined)\n\t\t\t\t\t\t.finally(() => socket.destroy());\n\t\t\t\t});\n\t\t});\n\t}\n\n\tasync #processClientFrames(props: {\n\t\treadonly chunk: Buffer;\n\t\treadonly connectionState: { authenticated: boolean };\n\t\treadonly decoder: GatewayRuntimeLocalExecLineDecoder;\n\t\treadonly reservation: ReservationRecord;\n\t\treadonly socket: Socket;\n\t}): Promise<void> {\n\t\t// oxlint-disable no-await-in-loop -- input frames must preserve order and backpressure.\n\t\tfor (const line of props.decoder.push(props.chunk)) {\n\t\t\tconst frame = parseGatewayRuntimeLocalExecClientFrame(line);\n\t\t\tif (!props.connectionState.authenticated) {\n\t\t\t\tif (\n\t\t\t\t\tframe.kind !== 'authenticate' ||\n\t\t\t\t\tframe.token !== props.reservation.token ||\n\t\t\t\t\tprops.reservation.consumed\n\t\t\t\t) {\n\t\t\t\t\tawait writeFrame(props.socket, {\n\t\t\t\t\t\tkind: 'rejected',\n\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\tframe.kind === 'authenticate' && frame.token === props.reservation.token\n\t\t\t\t\t\t\t\t? 'Reservation already consumed.'\n\t\t\t\t\t\t\t\t: 'Invalid reservation token.',\n\t\t\t\t\t});\n\t\t\t\t\tprops.socket.destroy();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tprops.connectionState.authenticated = true;\n\t\t\t\tprops.reservation.consumed = true;\n\t\t\t\tprops.reservation.cancelExpiry();\n\t\t\t\tprops.reservation.socket = props.socket;\n\t\t\t\tprops.reservation.server.close();\n\t\t\t\tawait writeFrame(props.socket, { kind: 'accepted' });\n\t\t\t\tvoid this.#runAuthenticatedOperation(props.reservation, props.socket).catch(\n\t\t\t\t\t() => undefined,\n\t\t\t\t);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tswitch (frame.kind) {\n\t\t\t\tcase 'authenticate':\n\t\t\t\t\tthrow new GatewayRuntimeLocalExecProtocolError('Duplicate authentication frame.');\n\t\t\t\tcase 'cancel':\n\t\t\t\t\tawait props.reservation.operation.cancel();\n\t\t\t\t\treturn;\n\t\t\t\tcase 'stdin-chunk':\n\t\t\t\t\tawait props.reservation.operation.writeStdin(Buffer.from(frame.contentBase64, 'base64'));\n\t\t\t\t\tcontinue;\n\t\t\t\tcase 'stdin-end':\n\t\t\t\t\tawait props.reservation.operation.closeStdin();\n\t\t\t\t\tcontinue;\n\t\t\t\tcase 'terminal-resize':\n\t\t\t\t\tif (props.reservation.operation.resizeTerminal === undefined) {\n\t\t\t\t\t\tthrow new GatewayRuntimeLocalExecProtocolError('Terminal resize is unavailable.');\n\t\t\t\t\t}\n\t\t\t\t\tawait props.reservation.operation.resizeTerminal({\n\t\t\t\t\t\tcolumns: frame.columns,\n\t\t\t\t\t\trows: frame.rows,\n\t\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\t// oxlint-enable no-await-in-loop\n\t}\n\n\tasync #runAuthenticatedOperation(reservation: ReservationRecord, socket: Socket): Promise<void> {\n\t\ttry {\n\t\t\tconst frameWriter = new GatewayRuntimeLocalExecFrameWriter(socket);\n\t\t\tconst [waitResult] = await Promise.all([\n\t\t\t\treservation.operation.wait(),\n\t\t\t\tpumpOutput({ frameWriter, kind: 'stdout', operation: reservation.operation, socket }),\n\t\t\t\tpumpOutput({ frameWriter, kind: 'stderr', operation: reservation.operation, socket }),\n\t\t\t]);\n\t\t\tif (!socket.destroyed) {\n\t\t\t\tawait frameWriter.write({ exitCode: waitResult.exitCode, kind: 'exited' });\n\t\t\t\tawait endSocket(socket);\n\t\t\t}\n\t\t} catch {\n\t\t\tsocket.destroy();\n\t\t} finally {\n\t\t\tawait this.#disposeReservation(reservation, false);\n\t\t}\n\t}\n\n\tasync #disposeReservation(reservation: ReservationRecord, cancel: boolean): Promise<void> {\n\t\tif (reservation.disposal !== undefined) return await reservation.disposal;\n\t\treservation.disposal = this.#disposeReservationOnce(reservation, cancel);\n\t\tawait reservation.disposal;\n\t}\n\n\tasync #disposeReservationOnce(reservation: ReservationRecord, cancel: boolean): Promise<void> {\n\t\tif (reservation.finalized) return;\n\t\treservation.finalized = true;\n\t\treservation.cancelExpiry();\n\t\tlet cancellationError: unknown;\n\t\tif (cancel) {\n\t\t\ttry {\n\t\t\t\tawait reservation.operation.cancel();\n\t\t\t} catch (error: unknown) {\n\t\t\t\tcancellationError = error;\n\t\t\t}\n\t\t}\n\t\tlet cleanupError: unknown;\n\t\ttry {\n\t\t\treservation.socket?.destroy();\n\t\t\tawait closeServer(reservation.server).catch(() => undefined);\n\t\t\tawait rm(reservation.reservationDirectory, { force: true, recursive: true });\n\t\t} catch (error: unknown) {\n\t\t\tcleanupError = error;\n\t\t} finally {\n\t\t\tthis.#reservations.delete(reservation.reservationId);\n\t\t}\n\t\tif (cancellationError !== undefined && cleanupError !== undefined) {\n\t\t\tthrow new AggregateError(\n\t\t\t\t[cancellationError, cleanupError],\n\t\t\t\t'Local exec cancellation and cleanup both failed.',\n\t\t\t);\n\t\t}\n\t\tif (cancellationError !== undefined) throw cancellationError;\n\t\tif (cleanupError !== undefined) throw cleanupError;\n\t}\n}\n"],"mappings":";;;;;;AAAA,MAAM,iCAAiC,MAAM;AAC7C,MAAM,wCAAwC,KAAK;AACnD,MAAM,iCAAiC;AAkBvC,IAAa,uCAAb,cAA0D,MAAM;CAC/D,YAAY,SAAiB;EAC5B,MAAM,QAAQ;EACd,KAAK,OAAO;;;AAId,SAAS,SAAS,OAA4D;CAC7E,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,MAAM;;AAG5E,SAAS,iBAAiB,OAA0C,MAA+B;CAClG,MAAM,aAAa,OAAO,KAAK,MAAM,CAAC,UAAU;CAChD,MAAM,eAAe,KAAK,UAAU;CACpC,IACC,WAAW,WAAW,aAAa,UACnC,WAAW,MAAM,KAAK,UAAU,QAAQ,aAAa,OAAO,EAE5D,MAAM,IAAI,qCAAqC,+CAA+C;;AAIhG,SAAS,cAAc,OAAgB,WAA2B;CACjE,IAAI,OA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Y,cAAc;;EAErD,IAAI,sBAAsB,KAAA,KAAa,iBAAiB,KAAA,GACvD,MAAM,IAAI,eACT,CAAC,mBAAmB,aAAa,EACjC,mDACA;EAEF,IAAI,sBAAsB,KAAA,GAAW,MAAM;EAC3C,IAAI,iBAAiB,KAAA,GAAW,MAAM"}
1
+ {"version":3,"file":"gateway-runtime-local-exec-transport-CO2bQ3wz.js","names":["#buffer","#socket","#pendingWrite","#helperArgv","#reservationScheduler","#reservationTimeoutMs","#reservations","#temporaryDirectory","#expireReservation","#acceptConnection","#disposeReservation","#processClientFrames","#runAuthenticatedOperation","#disposeReservationOnce"],"sources":["../src/gateway-runtime-local-exec/gateway-runtime-local-exec-protocol.ts","../src/gateway-runtime-local-exec/gateway-runtime-local-exec-transport.ts"],"sourcesContent":["const MAXIMUM_LOCAL_EXEC_FRAME_BYTES = 128 * 1024;\nconst MAXIMUM_LOCAL_EXEC_STREAM_CHUNK_BYTES = 64 * 1024;\nconst MAXIMUM_LOCAL_EXEC_TOKEN_BYTES = 256;\n\nexport type GatewayRuntimeLocalExecClientFrame =\n\t| { readonly kind: 'authenticate'; readonly token: string }\n\t| { readonly kind: 'cancel' }\n\t| { readonly contentBase64: string; readonly kind: 'stdin-chunk' }\n\t| { readonly kind: 'stdin-end' }\n\t| { readonly columns: number; readonly kind: 'terminal-resize'; readonly rows: number };\n\nexport type GatewayRuntimeLocalExecServerFrame =\n\t| { readonly kind: 'accepted' }\n\t| { readonly contentBase64: string; readonly kind: 'stderr-chunk' }\n\t| { readonly kind: 'stderr-end' }\n\t| { readonly exitCode: number | null; readonly kind: 'exited' }\n\t| { readonly message: string; readonly kind: 'rejected' }\n\t| { readonly contentBase64: string; readonly kind: 'stdout-chunk' }\n\t| { readonly kind: 'stdout-end' };\n\nexport class GatewayRuntimeLocalExecProtocolError extends Error {\n\tconstructor(message: string) {\n\t\tsuper(message);\n\t\tthis.name = 'GatewayRuntimeLocalExecProtocolError';\n\t}\n}\n\nfunction isRecord(value: unknown): value is Readonly<Record<string, unknown>> {\n\treturn typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nfunction requireExactKeys(value: Readonly<Record<string, unknown>>, keys: readonly string[]): void {\n\tconst actualKeys = Object.keys(value).toSorted();\n\tconst expectedKeys = keys.toSorted();\n\tif (\n\t\tactualKeys.length !== expectedKeys.length ||\n\t\tactualKeys.some((key, index) => key !== expectedKeys[index])\n\t) {\n\t\tthrow new GatewayRuntimeLocalExecProtocolError('Local exec frame contains unexpected fields.');\n\t}\n}\n\nfunction requireString(value: unknown, fieldName: string): string {\n\tif (typeof value !== 'string' || value.length === 0) {\n\t\tthrow new GatewayRuntimeLocalExecProtocolError(\n\t\t\t`Local exec frame field '${fieldName}' must be a non-empty string.`,\n\t\t);\n\t}\n\treturn value;\n}\n\nfunction requireBoundedToken(value: unknown): string {\n\tconst token = requireString(value, 'token');\n\tif (Buffer.byteLength(token, 'utf8') > MAXIMUM_LOCAL_EXEC_TOKEN_BYTES) {\n\t\tthrow new GatewayRuntimeLocalExecProtocolError(\n\t\t\t'Local exec reservation token exceeds the byte limit.',\n\t\t);\n\t}\n\treturn token;\n}\n\nfunction requireCanonicalBase64(value: unknown): string {\n\tconst encoded = requireString(value, 'contentBase64');\n\tconst decoded = Buffer.from(encoded, 'base64');\n\tif (\n\t\tdecoded.byteLength > MAXIMUM_LOCAL_EXEC_STREAM_CHUNK_BYTES ||\n\t\tdecoded.toString('base64') !== encoded\n\t) {\n\t\tthrow new GatewayRuntimeLocalExecProtocolError(\n\t\t\t'Local exec stream content must be canonical bounded base64.',\n\t\t);\n\t}\n\treturn encoded;\n}\n\nfunction requireTerminalDimension(value: unknown, fieldName: string): number {\n\tif (!Number.isSafeInteger(value) || (value as number) <= 0 || (value as number) > 1_000) {\n\t\tthrow new GatewayRuntimeLocalExecProtocolError(\n\t\t\t`Local exec frame field '${fieldName}' must be a bounded positive integer.`,\n\t\t);\n\t}\n\treturn value as number;\n}\n\nfunction parseJsonObject(line: string): Readonly<Record<string, unknown>> {\n\tif (Buffer.byteLength(line, 'utf8') > MAXIMUM_LOCAL_EXEC_FRAME_BYTES) {\n\t\tthrow new GatewayRuntimeLocalExecProtocolError('Local exec frame exceeds the byte limit.');\n\t}\n\tlet value: unknown;\n\ttry {\n\t\tvalue = JSON.parse(line);\n\t} catch (error: unknown) {\n\t\tthrow new GatewayRuntimeLocalExecProtocolError(\n\t\t\terror instanceof Error\n\t\t\t\t? `Local exec frame is not valid JSON: ${error.message}`\n\t\t\t\t: 'Local exec frame is not valid JSON.',\n\t\t);\n\t}\n\tif (!isRecord(value)) {\n\t\tthrow new GatewayRuntimeLocalExecProtocolError('Local exec frame must be an object.');\n\t}\n\treturn value;\n}\n\nexport function encodeGatewayRuntimeLocalExecFrame(\n\tframe: GatewayRuntimeLocalExecClientFrame | GatewayRuntimeLocalExecServerFrame,\n): string {\n\treturn `${JSON.stringify(frame)}\\n`;\n}\n\nexport function parseGatewayRuntimeLocalExecClientFrame(\n\tline: string,\n): GatewayRuntimeLocalExecClientFrame {\n\tconst value = parseJsonObject(line);\n\tconst kind = requireString(value.kind, 'kind');\n\tswitch (kind) {\n\t\tcase 'authenticate':\n\t\t\trequireExactKeys(value, ['kind', 'token']);\n\t\t\treturn { kind, token: requireBoundedToken(value.token) };\n\t\tcase 'cancel':\n\t\tcase 'stdin-end':\n\t\t\trequireExactKeys(value, ['kind']);\n\t\t\treturn { kind };\n\t\tcase 'stdin-chunk':\n\t\t\trequireExactKeys(value, ['contentBase64', 'kind']);\n\t\t\treturn { contentBase64: requireCanonicalBase64(value.contentBase64), kind };\n\t\tcase 'terminal-resize':\n\t\t\trequireExactKeys(value, ['columns', 'kind', 'rows']);\n\t\t\treturn {\n\t\t\t\tcolumns: requireTerminalDimension(value.columns, 'columns'),\n\t\t\t\tkind,\n\t\t\t\trows: requireTerminalDimension(value.rows, 'rows'),\n\t\t\t};\n\t\tdefault:\n\t\t\tthrow new GatewayRuntimeLocalExecProtocolError(`Unknown local exec client frame '${kind}'.`);\n\t}\n}\n\nexport function parseGatewayRuntimeLocalExecServerFrame(\n\tline: string,\n): GatewayRuntimeLocalExecServerFrame {\n\tconst value = parseJsonObject(line);\n\tconst kind = requireString(value.kind, 'kind');\n\tswitch (kind) {\n\t\tcase 'accepted':\n\t\tcase 'stderr-end':\n\t\tcase 'stdout-end':\n\t\t\trequireExactKeys(value, ['kind']);\n\t\t\treturn { kind };\n\t\tcase 'stderr-chunk':\n\t\tcase 'stdout-chunk':\n\t\t\trequireExactKeys(value, ['contentBase64', 'kind']);\n\t\t\treturn { contentBase64: requireCanonicalBase64(value.contentBase64), kind };\n\t\tcase 'exited':\n\t\t\trequireExactKeys(value, ['exitCode', 'kind']);\n\t\t\tif (\n\t\t\t\tvalue.exitCode !== null &&\n\t\t\t\t(!Number.isSafeInteger(value.exitCode) ||\n\t\t\t\t\t(value.exitCode as number) < 0 ||\n\t\t\t\t\t(value.exitCode as number) > 255)\n\t\t\t) {\n\t\t\t\tthrow new GatewayRuntimeLocalExecProtocolError(\n\t\t\t\t\t\"Local exec frame field 'exitCode' must be null or an integer from 0 through 255.\",\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn { exitCode: value.exitCode as number | null, kind };\n\t\tcase 'rejected':\n\t\t\trequireExactKeys(value, ['kind', 'message']);\n\t\t\treturn { kind, message: requireString(value.message, 'message') };\n\t\tdefault:\n\t\t\tthrow new GatewayRuntimeLocalExecProtocolError(`Unknown local exec server frame '${kind}'.`);\n\t}\n}\n\nexport class GatewayRuntimeLocalExecLineDecoder {\n\t#buffer = Buffer.alloc(0);\n\n\tpush(chunk: Uint8Array): readonly string[] {\n\t\tif (chunk.byteLength + this.#buffer.byteLength > MAXIMUM_LOCAL_EXEC_FRAME_BYTES) {\n\t\t\tthrow new GatewayRuntimeLocalExecProtocolError(\n\t\t\t\t'Local exec frame batch exceeds the byte limit.',\n\t\t\t);\n\t\t}\n\t\tthis.#buffer = Buffer.concat([this.#buffer, chunk]);\n\t\tconst lines: string[] = [];\n\t\tlet newlineIndex = this.#buffer.indexOf(0x0a);\n\t\twhile (newlineIndex >= 0) {\n\t\t\tconst line = this.#buffer.subarray(0, newlineIndex).toString('utf8');\n\t\t\tthis.#buffer = this.#buffer.subarray(newlineIndex + 1);\n\t\t\tif (Buffer.byteLength(line, 'utf8') > MAXIMUM_LOCAL_EXEC_FRAME_BYTES) {\n\t\t\t\tthrow new GatewayRuntimeLocalExecProtocolError('Local exec frame exceeds the byte limit.');\n\t\t\t}\n\t\t\tif (line.length > 0) lines.push(line);\n\t\t\tnewlineIndex = this.#buffer.indexOf(0x0a);\n\t\t}\n\t\tif (this.#buffer.byteLength > MAXIMUM_LOCAL_EXEC_FRAME_BYTES) {\n\t\t\tthrow new GatewayRuntimeLocalExecProtocolError('Local exec frame exceeds the byte limit.');\n\t\t}\n\t\treturn lines;\n\t}\n}\n","import { randomBytes } from 'node:crypto';\nimport { chmod, mkdtemp, rm } from 'node:fs/promises';\nimport { createServer, type Server, type Socket } from 'node:net';\nimport { join } from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nimport {\n\tGatewayRuntimeLocalExecLineDecoder,\n\tGatewayRuntimeLocalExecProtocolError,\n\tencodeGatewayRuntimeLocalExecFrame,\n\tparseGatewayRuntimeLocalExecClientFrame,\n\ttype GatewayRuntimeLocalExecServerFrame,\n} from './gateway-runtime-local-exec-protocol.js';\n\nexport const GATEWAY_RUNTIME_LOCAL_EXEC_SOCKET_ENV = 'AGENT_VM_LOCAL_EXEC_SOCKET';\nexport const GATEWAY_RUNTIME_LOCAL_EXEC_TOKEN_ENV = 'AGENT_VM_LOCAL_EXEC_TOKEN';\n\nconst DEFAULT_RESERVATION_TIMEOUT_MS = 15_000;\nconst DEFAULT_TEMPORARY_DIRECTORY = '/tmp';\nconst MAXIMUM_STREAM_CHUNK_BYTES = 64 * 1024;\n\nexport type GatewayRuntimeLocalExecReadResult =\n\t| { readonly content: Uint8Array; readonly kind: 'chunk' }\n\t| { readonly kind: 'end' };\n\nexport interface GatewayRuntimeLocalExecOperation {\n\treadonly cancel: () => Promise<void>;\n\treadonly closeStdin: () => Promise<void>;\n\treadonly readStderr: (maximumBytes: number) => Promise<GatewayRuntimeLocalExecReadResult>;\n\treadonly readStdout: (maximumBytes: number) => Promise<GatewayRuntimeLocalExecReadResult>;\n\treadonly resizeTerminal?: (size: {\n\t\treadonly columns: number;\n\t\treadonly rows: number;\n\t}) => Promise<void>;\n\treadonly wait: () => Promise<{ readonly exitCode: number | null }>;\n\treadonly writeStdin: (content: Uint8Array) => Promise<void>;\n}\n\nexport interface GatewayRuntimeLocalExecReservationScheduler {\n\treadonly schedule: (callback: () => void, delayMs: number) => { readonly cancel: () => void };\n}\n\nexport interface GatewayRuntimeLocalExecFinalizeToken {\n\treadonly kind: 'gateway-runtime-local-exec';\n\treadonly reservationId: string;\n}\n\nexport interface GatewayRuntimeLocalExecSpec {\n\treadonly argv: readonly string[];\n\treadonly env: Readonly<Record<string, string>>;\n\treadonly finalizeToken: GatewayRuntimeLocalExecFinalizeToken;\n\treadonly stdinMode: 'pipe-open';\n}\n\nexport interface GatewayRuntimeLocalExecTransportOptions {\n\treadonly helperArgv?: readonly string[];\n\treadonly reservationScheduler?: GatewayRuntimeLocalExecReservationScheduler;\n\treadonly reservationTimeoutMs?: number;\n\treadonly temporaryDirectory?: string;\n}\n\ninterface ReservationRecord {\n\treadonly cancelExpiry: () => void;\n\treadonly operation: GatewayRuntimeLocalExecOperation;\n\treadonly reservationDirectory: string;\n\treadonly reservationId: string;\n\treadonly server: Server;\n\treadonly socketPath: string;\n\treadonly token: string;\n\tconsumed: boolean;\n\tdisposal?: Promise<void>;\n\tfinalized: boolean;\n\tsocket?: Socket;\n}\n\nconst defaultReservationScheduler: GatewayRuntimeLocalExecReservationScheduler = {\n\tschedule(callback, delayMs) {\n\t\tconst timeout = setTimeout(callback, delayMs);\n\t\treturn { cancel: () => clearTimeout(timeout) };\n\t},\n};\n\nfunction validateReservationTimeout(timeoutMs: number): number {\n\tif (!Number.isSafeInteger(timeoutMs) || timeoutMs <= 0 || timeoutMs > 60_000) {\n\t\tthrow new RangeError('Local exec reservation timeout must be an integer from 1 through 60000.');\n\t}\n\treturn timeoutMs;\n}\n\nasync function closeServer(server: Server): Promise<void> {\n\tif (!server.listening) return;\n\tawait new Promise<void>((resolve, reject) => {\n\t\tserver.close((error?: Error) => (error === undefined ? resolve() : reject(error)));\n\t});\n}\n\nasync function writeFrame(\n\tsocket: Socket,\n\tframe: GatewayRuntimeLocalExecServerFrame,\n): Promise<void> {\n\tconst encodedFrame = encodeGatewayRuntimeLocalExecFrame(frame);\n\tif (socket.write(encodedFrame)) return;\n\tawait new Promise<void>((resolve, reject) => {\n\t\tconst cleanup = (): void => {\n\t\t\tsocket.off('drain', handleDrain);\n\t\t\tsocket.off('error', handleError);\n\t\t};\n\t\tconst handleDrain = (): void => {\n\t\t\tcleanup();\n\t\t\tresolve();\n\t\t};\n\t\tconst handleError = (error: Error): void => {\n\t\t\tcleanup();\n\t\t\treject(error);\n\t\t};\n\t\tsocket.once('drain', handleDrain);\n\t\tsocket.once('error', handleError);\n\t});\n}\n\nclass GatewayRuntimeLocalExecFrameWriter {\n\t#pendingWrite = Promise.resolve();\n\treadonly #socket: Socket;\n\n\tconstructor(socket: Socket) {\n\t\tthis.#socket = socket;\n\t}\n\n\tasync write(frame: GatewayRuntimeLocalExecServerFrame): Promise<void> {\n\t\tconst write = this.#pendingWrite.then(async () => await writeFrame(this.#socket, frame));\n\t\tthis.#pendingWrite = write.catch(() => undefined);\n\t\tawait write;\n\t}\n}\n\nasync function endSocket(socket: Socket): Promise<void> {\n\tif (socket.destroyed) return;\n\tawait new Promise<void>((resolve) => socket.end(resolve));\n}\n\nasync function pumpOutput(props: {\n\treadonly frameWriter: GatewayRuntimeLocalExecFrameWriter;\n\treadonly kind: 'stderr' | 'stdout';\n\treadonly operation: GatewayRuntimeLocalExecOperation;\n\treadonly socket: Socket;\n}): Promise<void> {\n\tconst read =\n\t\tprops.kind === 'stdout'\n\t\t\t? props.operation.readStdout.bind(props.operation)\n\t\t\t: props.operation.readStderr.bind(props.operation);\n\tif (props.socket.destroyed) return;\n\tconst result = await read(MAXIMUM_STREAM_CHUNK_BYTES);\n\tif (result.kind === 'end') {\n\t\tawait props.frameWriter.write({ kind: `${props.kind}-end` });\n\t\treturn;\n\t}\n\tawait props.frameWriter.write({\n\t\tcontentBase64: Buffer.from(result.content).toString('base64'),\n\t\tkind: `${props.kind}-chunk`,\n\t});\n\tawait pumpOutput(props);\n}\n\nexport class GatewayRuntimeLocalExecTransport {\n\treadonly #helperArgv: readonly string[];\n\treadonly #reservationScheduler: GatewayRuntimeLocalExecReservationScheduler;\n\treadonly #reservationTimeoutMs: number;\n\treadonly #reservations = new Map<string, ReservationRecord>();\n\treadonly #temporaryDirectory: string;\n\n\tconstructor(options: GatewayRuntimeLocalExecTransportOptions = {}) {\n\t\tthis.#helperArgv =\n\t\t\toptions.helperArgv ??\n\t\t\tObject.freeze([\n\t\t\t\tprocess.execPath,\n\t\t\t\tfileURLToPath(\n\t\t\t\t\tnew URL(\n\t\t\t\t\t\t'./gateway-runtime-local-exec/gateway-runtime-local-exec-helper.js',\n\t\t\t\t\t\timport.meta.url,\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t]);\n\t\tif (this.#helperArgv.length === 0)\n\t\t\tthrow new TypeError('Local exec helper argv cannot be empty.');\n\t\tthis.#reservationScheduler = options.reservationScheduler ?? defaultReservationScheduler;\n\t\tthis.#reservationTimeoutMs = validateReservationTimeout(\n\t\t\toptions.reservationTimeoutMs ?? DEFAULT_RESERVATION_TIMEOUT_MS,\n\t\t);\n\t\tthis.#temporaryDirectory = options.temporaryDirectory ?? DEFAULT_TEMPORARY_DIRECTORY;\n\t}\n\n\tasync reserve(operation: GatewayRuntimeLocalExecOperation): Promise<GatewayRuntimeLocalExecSpec> {\n\t\tconst reservationId = randomBytes(16).toString('hex');\n\t\tconst token = randomBytes(32).toString('base64url');\n\t\tconst reservationDirectory = await mkdtemp(\n\t\t\tjoin(this.#temporaryDirectory, 'agent-vm-local-exec-'),\n\t\t);\n\t\tawait chmod(reservationDirectory, 0o700);\n\t\tconst socketPath = join(reservationDirectory, 'relay.sock');\n\t\tconst server = createServer();\n\t\tconst expiry = this.#reservationScheduler.schedule(() => {\n\t\t\tvoid this.#expireReservation(reservationId).catch(() => undefined);\n\t\t}, this.#reservationTimeoutMs);\n\t\tconst reservation: ReservationRecord = {\n\t\t\tcancelExpiry: expiry.cancel,\n\t\t\tconsumed: false,\n\t\t\tfinalized: false,\n\t\t\toperation,\n\t\t\treservationDirectory,\n\t\t\treservationId,\n\t\t\tserver,\n\t\t\tsocketPath,\n\t\t\ttoken,\n\t\t};\n\t\tthis.#reservations.set(reservationId, reservation);\n\t\tserver.on('connection', (socket) => this.#acceptConnection(reservation, socket));\n\t\ttry {\n\t\t\tawait new Promise<void>((resolve, reject) => {\n\t\t\t\tserver.once('error', reject);\n\t\t\t\tserver.listen(socketPath, () => {\n\t\t\t\t\tserver.off('error', reject);\n\t\t\t\t\tresolve();\n\t\t\t\t});\n\t\t\t});\n\t\t\tawait chmod(socketPath, 0o600);\n\t\t} catch (error: unknown) {\n\t\t\tawait this.#disposeReservation(reservation, true);\n\t\t\tthrow error;\n\t\t}\n\t\treturn {\n\t\t\targv: [...this.#helperArgv],\n\t\t\tenv: {\n\t\t\t\t[GATEWAY_RUNTIME_LOCAL_EXEC_SOCKET_ENV]: socketPath,\n\t\t\t\t[GATEWAY_RUNTIME_LOCAL_EXEC_TOKEN_ENV]: token,\n\t\t\t},\n\t\t\tfinalizeToken: { kind: 'gateway-runtime-local-exec', reservationId },\n\t\t\tstdinMode: 'pipe-open',\n\t\t};\n\t}\n\n\tasync finalize(token: unknown): Promise<void> {\n\t\tconst reservationId =\n\t\t\ttypeof token === 'object' && token !== null ? Reflect.get(token, 'reservationId') : undefined;\n\t\tif (\n\t\t\ttypeof token !== 'object' ||\n\t\t\ttoken === null ||\n\t\t\tReflect.get(token, 'kind') !== 'gateway-runtime-local-exec' ||\n\t\t\ttypeof reservationId !== 'string'\n\t\t) {\n\t\t\treturn;\n\t\t}\n\t\tconst reservation = this.#reservations.get(reservationId);\n\t\tif (reservation === undefined) return;\n\t\tawait this.#disposeReservation(reservation, !reservation.consumed);\n\t}\n\n\tasync close(): Promise<void> {\n\t\tawait Promise.all(\n\t\t\t[...this.#reservations.values()].map(\n\t\t\t\tasync (reservation) => await this.#disposeReservation(reservation, true),\n\t\t\t),\n\t\t);\n\t}\n\n\tasync #expireReservation(reservationId: string): Promise<void> {\n\t\tconst reservation = this.#reservations.get(reservationId);\n\t\tif (reservation === undefined || reservation.consumed) return;\n\t\tawait this.#disposeReservation(reservation, true);\n\t}\n\n\t#acceptConnection(reservation: ReservationRecord, socket: Socket): void {\n\t\tif (reservation.finalized || reservation.consumed) {\n\t\t\tvoid writeFrame(socket, {\n\t\t\t\tkind: 'rejected',\n\t\t\t\tmessage: 'Reservation already consumed.',\n\t\t\t})\n\t\t\t\t.catch(() => undefined)\n\t\t\t\t.finally(() => socket.destroy());\n\t\t\treturn;\n\t\t}\n\t\tconst decoder = new GatewayRuntimeLocalExecLineDecoder();\n\t\tconst connectionState = { authenticated: false };\n\t\tsocket.once('close', () => {\n\t\t\tif (connectionState.authenticated && !reservation.finalized) {\n\t\t\t\tvoid this.#disposeReservation(reservation, true).catch(() => undefined);\n\t\t\t}\n\t\t});\n\t\tsocket.on('data', (chunk: Buffer) => {\n\t\t\tsocket.pause();\n\t\t\tvoid this.#processClientFrames({\n\t\t\t\tchunk,\n\t\t\t\tconnectionState,\n\t\t\t\tdecoder,\n\t\t\t\treservation,\n\t\t\t\tsocket,\n\t\t\t})\n\t\t\t\t.then(() => {\n\t\t\t\t\tif (!socket.destroyed) socket.resume();\n\t\t\t\t})\n\t\t\t\t.catch((error: unknown) => {\n\t\t\t\t\tvoid writeFrame(socket, {\n\t\t\t\t\t\tkind: 'rejected',\n\t\t\t\t\t\tmessage: error instanceof Error ? error.message : 'Invalid local exec frame.',\n\t\t\t\t\t})\n\t\t\t\t\t\t.catch(() => undefined)\n\t\t\t\t\t\t.finally(() => socket.destroy());\n\t\t\t\t});\n\t\t});\n\t}\n\n\tasync #processClientFrames(props: {\n\t\treadonly chunk: Buffer;\n\t\treadonly connectionState: { authenticated: boolean };\n\t\treadonly decoder: GatewayRuntimeLocalExecLineDecoder;\n\t\treadonly reservation: ReservationRecord;\n\t\treadonly socket: Socket;\n\t}): Promise<void> {\n\t\t// oxlint-disable no-await-in-loop -- input frames must preserve order and backpressure.\n\t\tfor (const line of props.decoder.push(props.chunk)) {\n\t\t\tconst frame = parseGatewayRuntimeLocalExecClientFrame(line);\n\t\t\tif (!props.connectionState.authenticated) {\n\t\t\t\tif (\n\t\t\t\t\tframe.kind !== 'authenticate' ||\n\t\t\t\t\tframe.token !== props.reservation.token ||\n\t\t\t\t\tprops.reservation.consumed\n\t\t\t\t) {\n\t\t\t\t\tawait writeFrame(props.socket, {\n\t\t\t\t\t\tkind: 'rejected',\n\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\tframe.kind === 'authenticate' && frame.token === props.reservation.token\n\t\t\t\t\t\t\t\t? 'Reservation already consumed.'\n\t\t\t\t\t\t\t\t: 'Invalid reservation token.',\n\t\t\t\t\t});\n\t\t\t\t\tprops.socket.destroy();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tprops.connectionState.authenticated = true;\n\t\t\t\tprops.reservation.consumed = true;\n\t\t\t\tprops.reservation.cancelExpiry();\n\t\t\t\tprops.reservation.socket = props.socket;\n\t\t\t\tprops.reservation.server.close();\n\t\t\t\tawait writeFrame(props.socket, { kind: 'accepted' });\n\t\t\t\tvoid this.#runAuthenticatedOperation(props.reservation, props.socket).catch(\n\t\t\t\t\t() => undefined,\n\t\t\t\t);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tswitch (frame.kind) {\n\t\t\t\tcase 'authenticate':\n\t\t\t\t\tthrow new GatewayRuntimeLocalExecProtocolError('Duplicate authentication frame.');\n\t\t\t\tcase 'cancel':\n\t\t\t\t\tawait props.reservation.operation.cancel();\n\t\t\t\t\treturn;\n\t\t\t\tcase 'stdin-chunk':\n\t\t\t\t\tawait props.reservation.operation.writeStdin(Buffer.from(frame.contentBase64, 'base64'));\n\t\t\t\t\tcontinue;\n\t\t\t\tcase 'stdin-end':\n\t\t\t\t\tawait props.reservation.operation.closeStdin();\n\t\t\t\t\tcontinue;\n\t\t\t\tcase 'terminal-resize':\n\t\t\t\t\tif (props.reservation.operation.resizeTerminal === undefined) {\n\t\t\t\t\t\tthrow new GatewayRuntimeLocalExecProtocolError('Terminal resize is unavailable.');\n\t\t\t\t\t}\n\t\t\t\t\tawait props.reservation.operation.resizeTerminal({\n\t\t\t\t\t\tcolumns: frame.columns,\n\t\t\t\t\t\trows: frame.rows,\n\t\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\t// oxlint-enable no-await-in-loop\n\t}\n\n\tasync #runAuthenticatedOperation(reservation: ReservationRecord, socket: Socket): Promise<void> {\n\t\ttry {\n\t\t\tconst frameWriter = new GatewayRuntimeLocalExecFrameWriter(socket);\n\t\t\tconst [waitResult] = await Promise.all([\n\t\t\t\treservation.operation.wait(),\n\t\t\t\tpumpOutput({ frameWriter, kind: 'stdout', operation: reservation.operation, socket }),\n\t\t\t\tpumpOutput({ frameWriter, kind: 'stderr', operation: reservation.operation, socket }),\n\t\t\t]);\n\t\t\tif (!socket.destroyed) {\n\t\t\t\tawait frameWriter.write({ exitCode: waitResult.exitCode, kind: 'exited' });\n\t\t\t\tawait endSocket(socket);\n\t\t\t}\n\t\t} catch {\n\t\t\tsocket.destroy();\n\t\t} finally {\n\t\t\tawait this.#disposeReservation(reservation, false);\n\t\t}\n\t}\n\n\tasync #disposeReservation(reservation: ReservationRecord, cancel: boolean): Promise<void> {\n\t\tif (reservation.disposal !== undefined) return await reservation.disposal;\n\t\treservation.disposal = this.#disposeReservationOnce(reservation, cancel);\n\t\tawait reservation.disposal;\n\t}\n\n\tasync #disposeReservationOnce(reservation: ReservationRecord, cancel: boolean): Promise<void> {\n\t\tif (reservation.finalized) return;\n\t\treservation.finalized = true;\n\t\treservation.cancelExpiry();\n\t\tlet cancellationError: unknown;\n\t\tif (cancel) {\n\t\t\ttry {\n\t\t\t\tawait reservation.operation.cancel();\n\t\t\t} catch (error: unknown) {\n\t\t\t\tcancellationError = error;\n\t\t\t}\n\t\t}\n\t\tlet cleanupError: unknown;\n\t\ttry {\n\t\t\treservation.socket?.destroy();\n\t\t\tawait closeServer(reservation.server).catch(() => undefined);\n\t\t\tawait rm(reservation.reservationDirectory, { force: true, recursive: true });\n\t\t} catch (error: unknown) {\n\t\t\tcleanupError = error;\n\t\t} finally {\n\t\t\tthis.#reservations.delete(reservation.reservationId);\n\t\t}\n\t\tif (cancellationError !== undefined && cleanupError !== undefined) {\n\t\t\tthrow new AggregateError(\n\t\t\t\t[cancellationError, cleanupError],\n\t\t\t\t'Local exec cancellation and cleanup both failed.',\n\t\t\t);\n\t\t}\n\t\tif (cancellationError !== undefined) throw cancellationError;\n\t\tif (cleanupError !== undefined) throw cleanupError;\n\t}\n}\n"],"mappings":";;;;;;AAAA,MAAM,iCAAiC,MAAM;AAC7C,MAAM,wCAAwC,KAAK;AACnD,MAAM,iCAAiC;AAkBvC,IAAa,uCAAb,cAA0D,MAAM;CAC/D,YAAY,SAAiB;EAC5B,MAAM,QAAQ;EACd,KAAK,OAAO;;;AAId,SAAS,SAAS,OAA4D;CAC7E,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,MAAM;;AAG5E,SAAS,iBAAiB,OAA0C,MAA+B;CAClG,MAAM,aAAa,OAAO,KAAK,MAAM,CAAC,UAAU;CAChD,MAAM,eAAe,KAAK,UAAU;CACpC,IACC,WAAW,WAAW,aAAa,UACnC,WAAW,MAAM,KAAK,UAAU,QAAQ,aAAa,OAAO,EAE5D,MAAM,IAAI,qCAAqC,+CAA+C;;AAIhG,SAAS,cAAc,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;GACT,KAAKP,cAAc,OAAO,YAAY,cAAc;;EAErD,IAAI,sBAAsB,KAAA,KAAa,iBAAiB,KAAA,GACvD,MAAM,IAAI,eACT,CAAC,mBAAmB,aAAa,EACjC,mDACA;EAEF,IAAI,sBAAsB,KAAA,GAAW,MAAM;EAC3C,IAAI,iBAAiB,KAAA,GAAW,MAAM"}
@@ -1,4 +1,4 @@
1
- import { l as JsonValue } from "./json-value-schema-C-87ATB3.js";
1
+ import { l as JsonValue } from "./json-value-schema-CwDmttWU.js";
2
2
  import { z } from "zod";
3
3
 
4
4
  //#region src/capability-description-surface/models/capability-descriptor-schema.d.ts
@@ -139,4 +139,4 @@ declare const CapabilityDescriptorSchema: z.ZodObject<{
139
139
  type CapabilityDescriptor = z.infer<typeof CapabilityDescriptorSchema>;
140
140
  //#endregion
141
141
  export { ToolSchemaSummarySchema as _, CapabilitySummary as a, ResultExpectation as c, SafeCallingHintSchema as d, ToolSafetySummary as f, ToolSchemaSummary as g, ToolSchemaHintSchema as h, CapabilitySearchMatchSchema as i, ResultExpectationSchema as l, ToolSchemaHint as m, CapabilityDescriptorSchema as n, CapabilitySummarySchema as o, ToolSafetySummarySchema as p, CapabilitySearchMatch as r, JsonSchemaDocumentSchema as s, CapabilityDescriptor as t, SafeCallingHint as u };
142
- //# sourceMappingURL=index-D8uVfMBv.d.ts.map
142
+ //# sourceMappingURL=index-BIvLq827.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-D8uVfMBv.d.ts","names":[],"sources":["../src/capability-description-surface/models/capability-descriptor-schema.ts"],"mappings":";;;;cAQa,wBAAA,EAAwB,CAAA,CAAA,SAAA,CAAA,CAAA,CAAA,SAAA,EAAA,CAAA,CAAA,OAAA,CAAA,SAAA,WAAA,CAAA,CAAA,IAAA,CAAA,iBAAA,CAAA,SAAA;AAAA,cAExB,uBAAA,EAAuB,CAAA,CAAA,SAAA;;;;;;KASxB,iBAAA,GAAoB,CAAA,CAAE,KAAA,QAAa,uBAAA;AAAA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AE,KAAA,QAAa,uBAAA;AAAA,cAElC,oBAAA,EAAoB,CAAA,CAAA,SAAA;;;;;;;KAOrB,cAAA,GAAiB,CAAA,CAAE,KAAA,QAAa,oBAAA;AAAA,cAE/B,uBAAA,EAAuB,CAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAcxB,iBAAA,GAAoB,CAAA,CAAE,KAAA,QAAa,uBAAA;AAAA,cAElC,uBAAA,EAAuB,CAAA,CAAA,SAAA;;;;;;;;;;;;;;;;KAUxB,iBAAA,GAAoB,CAAA,CAAE,KAAA,QAAa,uBAAA;AAAA,cAElC,qBAAA,EAAqB,CAAA,CAAA,SAAA;;;;;;;;;;;KActB,eAAA,GAAkB,CAAA,CAAE,KAAA,QAAa,qBAAA;AAAA,cAEhC,2BAAA,EAA2B,CAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAO5B,qBAAA,GAAwB,CAAA,CAAE,KAAA,QAAa,2BAAA;AAAA,cAEtC,0BAAA,EAA0B,CAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;KAe3B,oBAAA,GAAuB,CAAA,CAAE,KAAA,QAAa,0BAAA"}
@@ -1,6 +1,6 @@
1
- import { c as PortalArtifactReadRequest, i as PortalArtifactReadResourceRequest, u as PortalArtifactReadResult } from "./index-B_xYdo3v.js";
2
- import { S as PortalCallRequest, _ as PortalSearchResult, c as PortalDescribeResult, i as PortalCallResult, p as PortalListResult } from "./portal-call-result-schema-DalyNrfW.js";
3
- import { i as PortalSearchRequest, m as PortalDescribeRequest, s as PortalListRequest } from "./index-B_FqoejO.js";
1
+ import { c as PortalArtifactReadRequest, i as PortalArtifactReadResourceRequest, u as PortalArtifactReadResult } from "./index-DDLN0DE_.js";
2
+ import { P as PortalCallRequest, T as PortalListResult, b as PortalDescribeResult, g as PortalCallResult, k as PortalSearchResult } from "./portal-call-result-schema-CS2rX3oP.js";
3
+ import { i as PortalSearchRequest, m as PortalDescribeRequest, s as PortalListRequest } from "./index-C8O_HiyA.js";
4
4
 
5
5
  //#region src/tool-portal-mcp-client/index.d.ts
6
6
  type ToolPortalMcpResourceContent = {
@@ -66,4 +66,4 @@ declare class ToolPortalMcpClient {
66
66
  }
67
67
  //#endregion
68
68
  export { ToolPortalMcpTransport as a, ToolPortalMcpResourceContent as i, ToolPortalMcpClient as n, ToolPortalMcpClientOptions as r, ToolPortalClientRequestOptions as t };
69
- //# sourceMappingURL=index-yuB9HEo-.d.ts.map
69
+ //# sourceMappingURL=index-BQj9hHds.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-yuB9HEo-.d.ts","names":[],"sources":["../src/tool-portal-mcp-client/index.ts"],"mappings":";;;;;KA2BY,4BAAA;EAAA,SAEA,IAAA;EAAA,SACA,IAAA;EAAA,SACA,SAAA;EAAA,SACA,GAAA;AAAA;EAAA,SAGA,IAAA;EAAA,SACA,SAAA;EAAA,SACA,IAAA;EAAA,SACA,GAAA;AAAA;AAAA,UAGK,sBAAA;EAAA,SACP,QAAA,GACR,IAAA;IAAA,SACU,aAAA;IAAA,SACA,SAAA;IAAA,SACA,IAAA;EAAA,GAEV,OAAA;IAAA,SACU,uBAAA;IAAA,SACA,MAAA,GAAS,WAAA;EAAA,MAEf,OAAA;IAAA,SAAmB,iBAAA;EAAA;EAAA,SACf,KAAA,QAAa,OAAA;EAAA,SACb,OAAA,QAAe,OAAA;EAAA,SACf,YAAA,GACR,OAAA,EAAS,iCAAA,EACT,OAAA;IAAA,SACU,uBAAA;IAAA,SACA,MAAA,GAAS,WAAA;EAAA,MAEf,OAAA;IAAA,SAAmB,QAAA,WAAmB,4BAAA;EAAA;AAAA;AAAA,UAG3B,0BAAA;EAAA,SACP,SAAA,EAAW,sBAAA;AAAA;AAAA,UAGJ,8BAAA;EAAA,SACP,aAAA;EAAA,SACA,uBAAA;EAAA,SACA,MAAA,GAAS,WAAA;AAAA;AAAA,cAab,+BAAA;EAAA;cAGO,SAAA,EAAW,sBAAA;E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,4BAAA;EAAA;AAAA;AAAA,UAG3B,0BAAA;EAAA,SACP,SAAA,EAAW,sBAAA;AAAA;AAAA,UAGJ,8BAAA;EAAA,SACP,aAAA;EAAA,SACA,uBAAA;EAAA,SACA,MAAA,GAAS,WAAA;AAAA;AAAA,cAab,+BAAA;EAAA;cAGO,SAAA,EAAW,sBAAA;EAIjB,IAAA,CACL,OAAA,EAAS,yBAAA,EACT,OAAA,GAAS,8BAAA,GACP,OAAA,CAAQ,wBAAA;AAAA;;;;;;;cAkCC,mBAAA;EAAA;WAEH,SAAA,EAAW,+BAAA;cAER,OAAA,EAAS,0BAAA;EAKf,OAAA,CAAA,GAAW,OAAA;EAIX,KAAA,CAAA,GAAS,OAAA;EAIT,IAAA,CACL,OAAA,EAAS,iBAAA,EACT,OAAA,GAAS,8BAAA,GACP,OAAA,CAAQ,gBAAA;EAYL,MAAA,CACL,OAAA,EAAS,mBAAA,EACT,OAAA,GAAS,8BAAA,GACP,OAAA,CAAQ,kBAAA;EAYL,QAAA,CACL,OAAA,EAAS,qBAAA,EACT,OAAA,GAAS,8BAAA,GACP,OAAA,CAAQ,oBAAA;EAYL,IAAA,CACL,OAAA,EAAS,iBAAA,EACT,OAAA,GAAS,8BAAA,GACP,OAAA,CAAQ,gBAAA;AAAA"}
@@ -23,12 +23,12 @@ type PortalPartialOutputEvent = z.infer<typeof PortalPartialOutputEventSchema>;
23
23
  declare const PortalDiagnosticEventSchema: z.ZodObject<{
24
24
  diagnostic: z.ZodObject<{
25
25
  code: z.ZodEnum<{
26
+ cancelled: "cancelled";
26
27
  approval_required: "approval_required";
27
28
  capability_denied: "capability_denied";
28
29
  validation_failed: "validation_failed";
29
30
  provider_unavailable: "provider_unavailable";
30
31
  execution_failed: "execution_failed";
31
- cancelled: "cancelled";
32
32
  timeout: "timeout";
33
33
  output_truncated: "output_truncated";
34
34
  artifact_unavailable: "artifact_unavailable";
@@ -55,6 +55,7 @@ type PortalCancellationRequestEvent = z.infer<typeof PortalCancellationRequestEv
55
55
  declare const PortalCancellationResultEventSchema: z.ZodObject<{
56
56
  error: z.ZodOptional<z.ZodObject<{
57
57
  code: z.ZodEnum<{
58
+ cancelled: "cancelled";
58
59
  invalid_request: "invalid_request";
59
60
  not_found: "not_found";
60
61
  not_authorized: "not_authorized";
@@ -63,19 +64,18 @@ declare const PortalCancellationResultEventSchema: z.ZodObject<{
63
64
  validation_failed: "validation_failed";
64
65
  provider_unavailable: "provider_unavailable";
65
66
  execution_failed: "execution_failed";
66
- cancelled: "cancelled";
67
67
  timeout: "timeout";
68
68
  }>;
69
69
  message: z.ZodString;
70
70
  retryable: z.ZodOptional<z.ZodBoolean>;
71
71
  safeDiagnostic: z.ZodOptional<z.ZodObject<{
72
72
  code: z.ZodEnum<{
73
+ cancelled: "cancelled";
73
74
  approval_required: "approval_required";
74
75
  capability_denied: "capability_denied";
75
76
  validation_failed: "validation_failed";
76
77
  provider_unavailable: "provider_unavailable";
77
78
  execution_failed: "execution_failed";
78
- cancelled: "cancelled";
79
79
  timeout: "timeout";
80
80
  output_truncated: "output_truncated";
81
81
  artifact_unavailable: "artifact_unavailable";
@@ -93,8 +93,8 @@ declare const PortalCancellationResultEventSchema: z.ZodObject<{
93
93
  id: z.ZodString;
94
94
  kind: z.ZodLiteral<"cancellation_result">;
95
95
  status: z.ZodEnum<{
96
- not_found: "not_found";
97
96
  cancelled: "cancelled";
97
+ not_found: "not_found";
98
98
  already_finished: "already_finished";
99
99
  }>;
100
100
  }, z.core.$strict>;
@@ -117,12 +117,12 @@ declare const PortalEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
117
117
  }, z.core.$strict>, z.ZodObject<{
118
118
  diagnostic: z.ZodObject<{
119
119
  code: z.ZodEnum<{
120
+ cancelled: "cancelled";
120
121
  approval_required: "approval_required";
121
122
  capability_denied: "capability_denied";
122
123
  validation_failed: "validation_failed";
123
124
  provider_unavailable: "provider_unavailable";
124
125
  execution_failed: "execution_failed";
125
- cancelled: "cancelled";
126
126
  timeout: "timeout";
127
127
  output_truncated: "output_truncated";
128
128
  artifact_unavailable: "artifact_unavailable";
@@ -145,6 +145,7 @@ declare const PortalEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
145
145
  }, z.core.$strict>, z.ZodObject<{
146
146
  error: z.ZodOptional<z.ZodObject<{
147
147
  code: z.ZodEnum<{
148
+ cancelled: "cancelled";
148
149
  invalid_request: "invalid_request";
149
150
  not_found: "not_found";
150
151
  not_authorized: "not_authorized";
@@ -153,19 +154,18 @@ declare const PortalEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
153
154
  validation_failed: "validation_failed";
154
155
  provider_unavailable: "provider_unavailable";
155
156
  execution_failed: "execution_failed";
156
- cancelled: "cancelled";
157
157
  timeout: "timeout";
158
158
  }>;
159
159
  message: z.ZodString;
160
160
  retryable: z.ZodOptional<z.ZodBoolean>;
161
161
  safeDiagnostic: z.ZodOptional<z.ZodObject<{
162
162
  code: z.ZodEnum<{
163
+ cancelled: "cancelled";
163
164
  approval_required: "approval_required";
164
165
  capability_denied: "capability_denied";
165
166
  validation_failed: "validation_failed";
166
167
  provider_unavailable: "provider_unavailable";
167
168
  execution_failed: "execution_failed";
168
- cancelled: "cancelled";
169
169
  timeout: "timeout";
170
170
  output_truncated: "output_truncated";
171
171
  artifact_unavailable: "artifact_unavailable";
@@ -183,8 +183,8 @@ declare const PortalEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
183
183
  id: z.ZodString;
184
184
  kind: z.ZodLiteral<"cancellation_result">;
185
185
  status: z.ZodEnum<{
186
- not_found: "not_found";
187
186
  cancelled: "cancelled";
187
+ not_found: "not_found";
188
188
  already_finished: "already_finished";
189
189
  }>;
190
190
  }, z.core.$strict>], "kind">;
@@ -192,24 +192,24 @@ type PortalEvent = z.infer<typeof PortalEventSchema>;
192
192
  //#endregion
193
193
  //#region src/portal-event-surface/models/safe-diagnostic-schema.d.ts
194
194
  declare const SafeDiagnosticCodeSchema: z.ZodEnum<{
195
+ cancelled: "cancelled";
195
196
  approval_required: "approval_required";
196
197
  capability_denied: "capability_denied";
197
198
  validation_failed: "validation_failed";
198
199
  provider_unavailable: "provider_unavailable";
199
200
  execution_failed: "execution_failed";
200
- cancelled: "cancelled";
201
201
  timeout: "timeout";
202
202
  output_truncated: "output_truncated";
203
203
  artifact_unavailable: "artifact_unavailable";
204
204
  }>;
205
205
  declare const SafeDiagnosticSchema: z.ZodObject<{
206
206
  code: z.ZodEnum<{
207
+ cancelled: "cancelled";
207
208
  approval_required: "approval_required";
208
209
  capability_denied: "capability_denied";
209
210
  validation_failed: "validation_failed";
210
211
  provider_unavailable: "provider_unavailable";
211
212
  execution_failed: "execution_failed";
212
- cancelled: "cancelled";
213
213
  timeout: "timeout";
214
214
  output_truncated: "output_truncated";
215
215
  artifact_unavailable: "artifact_unavailable";
@@ -226,4 +226,4 @@ declare const SafeDiagnosticSchema: z.ZodObject<{
226
226
  type SafeDiagnostic = z.infer<typeof SafeDiagnosticSchema>;
227
227
  //#endregion
228
228
  export { PortalCancellationRequestEventSchema as a, PortalDiagnosticEvent as c, PortalEventSchema as d, PortalPartialOutputEvent as f, PortalProgressEventSchema as h, PortalCancellationRequestEvent as i, PortalDiagnosticEventSchema as l, PortalProgressEvent as m, SafeDiagnosticCodeSchema as n, PortalCancellationResultEvent as o, PortalPartialOutputEventSchema as p, SafeDiagnosticSchema as r, PortalCancellationResultEventSchema as s, SafeDiagnostic as t, PortalEvent as u };
229
- //# sourceMappingURL=index-BQ12JshX.d.ts.map
229
+ //# sourceMappingURL=index-Ba_G25p_.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-BQ12JshX.d.ts","names":[],"sources":["../src/portal-event-surface/models/portal-event-schema.ts","../src/portal-event-surface/models/safe-diagnostic-schema.ts"],"mappings":";;;cAMa,yBAAA,EAAyB,CAAA,CAAA,SAAA;;;;;;KAS1B,mBAAA,GAAsB,CAAA,CAAE,KAAA,QAAa,yBAAA;AAAA,cAEpC,8BAAA,EAA8B,CAAA,CAAA,SAAA;;;;;;;;;;;KAU/B,wBAAA,GAA2B,CAAA,CAAE,KAAA,QAAa,8BAAA;AAAA,cAEzC,2BAAA,EAA2B,CAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;KAQ5B,qBAAA,GAAwB,CAAA,CAAE,KAAA,QAAa,2BAAA;AAAA,cAEtC,oCAAA,EAAoC,CAAA,CAAA,SAAA;;;;;KAQrC,8BAAA,GAAiC,CAAA,CAAE,KAAA,QAAa,oCAAA;AAAA,cAE/C,mCAAA,EAAmC,CAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KASpC,6BAAA,GAAgC,CAAA,CAAE,KAAA,QAAa,mCAAA;AAAA,cAE9C,iBAAA,EAAiB,CAAA,CAAA,qBAAA,EAAA,CAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAQlB,WAAA,GAAc,CAAA,CAAE,KAAA,QAAa,iBAAA;;;cClE5B,wBAAA,EAAwB,CAAA,CAAA,OAAA;;;;;;;;;;;cAYxB,oBAAA,EAAoB,CAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;;;KASrB,cAAA,GAAiB,CAAA,CAAE,KAAA,QAAa,oBAAA"}
1
+ {"version":3,"file":"index-Ba_G25p_.d.ts","names":[],"sources":["../src/portal-event-surface/models/portal-event-schema.ts","../src/portal-event-surface/models/safe-diagnostic-schema.ts"],"mappings":";;;cAMa,yBAAA,EAAyB,CAAA,CAAA,SAAA;;;;;;KAS1B,mBAAA,GAAsB,CAAA,CAAE,KAAA,QAAa,yBAAA;AAAA,cAEpC,8BAAA,EAA8B,CAAA,CAAA,SAAA;;;;;;;;;;;KAU/B,wBAAA,GAA2B,CAAA,CAAE,KAAA,QAAa,8BAAA;AAAA,cAEzC,2BAAA,EAA2B,CAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;KAQ5B,qBAAA,GAAwB,CAAA,CAAE,KAAA,QAAa,2BAAA;AAAA,cAEtC,oCAAA,EAAoC,CAAA,CAAA,SAAA;;;;;KAQrC,8BAAA,GAAiC,CAAA,CAAE,KAAA,QAAa,oCAAA;AAAA,cAE/C,mCAAA,EAAmC,CAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KASpC,6BAAA,GAAgC,CAAA,CAAE,KAAA,QAAa,mCAAA;AAAA,cAE9C,iBAAA,EAAiB,CAAA,CAAA,qBAAA,EAAA,CAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAQlB,WAAA,GAAc,CAAA,CAAE,KAAA,QAAa,iBAAA;;;cClE5B,wBAAA,EAAwB,CAAA,CAAA,OAAA;;;;;;;;;;;cAYxB,oBAAA,EAAoB,CAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;;;KASrB,cAAA,GAAiB,CAAA,CAAE,KAAA,QAAa,oBAAA"}
@@ -38,4 +38,4 @@ declare const PortalAdapterEnvelopeSchema: z.ZodObject<{
38
38
  type PortalAdapterEnvelope = z.infer<typeof PortalAdapterEnvelopeSchema>;
39
39
  //#endregion
40
40
  export { TrustedAgentScopeSchema as i, PortalAdapterEnvelopeSchema as n, TrustedAgentScope as r, PortalAdapterEnvelope as t };
41
- //# sourceMappingURL=index-BgKPbuap.d.ts.map
41
+ //# sourceMappingURL=index-Badq9e6i.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-BgKPbuap.d.ts","names":[],"sources":["../src/adapter-boundary/models/portal-adapter-envelope-schema.ts"],"mappings":";;;cAEa,uBAAA,EAAuB,CAAA,CAAA,SAAA;;;;;;;;;;;KASxB,iBAAA,GAAoB,CAAA,CAAE,KAAA,QAAa,uBAAA;AAAA,cAElC,2BAAA,EAA2B,CAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;;;;KAQ5B,qBAAA,GAAwB,CAAA,CAAE,KAAA,QAAa,2BAAA"}
1
+ {"version":3,"file":"index-Badq9e6i.d.ts","names":[],"sources":["../src/adapter-boundary/models/portal-adapter-envelope-schema.ts"],"mappings":";;;cAEa,uBAAA,EAAuB,CAAA,CAAA,SAAA;;;;;;;;;;;KASxB,iBAAA,GAAoB,CAAA,CAAE,KAAA,QAAa,uBAAA;AAAA,cAElC,2BAAA,EAA2B,CAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;;;;KAQ5B,qBAAA,GAAwB,CAAA,CAAE,KAAA,QAAa,2BAAA"}
@@ -24,6 +24,14 @@ type PortableRefinementOperation = {
24
24
  } | {
25
25
  readonly kind: 'maximum-object-entries';
26
26
  readonly maximum: number;
27
+ } | {
28
+ readonly fieldNames: readonly string[];
29
+ readonly kind: 'maximum-code-points';
30
+ readonly maximum: number;
31
+ } | {
32
+ readonly fieldNames: readonly string[];
33
+ readonly kind: 'maximum-utf8-bytes';
34
+ readonly maximum: number;
27
35
  } | {
28
36
  readonly fieldNames: readonly string[];
29
37
  readonly kind: 'reject-reserved-values';
@@ -32,6 +40,10 @@ type PortableRefinementOperation = {
32
40
  readonly kind: 'safe-integer';
33
41
  readonly maximum: number;
34
42
  readonly minimum: number;
43
+ } | {
44
+ readonly fieldName: string;
45
+ readonly kind: 'sorted-unique-object-field-items';
46
+ readonly path: string;
35
47
  } | {
36
48
  readonly kind: 'sorted-unique-string-items';
37
49
  readonly path: string;
@@ -172,6 +184,26 @@ declare const PORTABLE_REFINEMENT_DESCRIPTORS: readonly [{
172
184
  readonly '/requests/*/schemaDetail': "summary";
173
185
  };
174
186
  };
187
+ }, {
188
+ readonly description: "Gateway approval argument previews remain inside the portable UTF-8 byte bound.";
189
+ readonly errorCode: "gateway.approval.arguments-preview.above-maximum";
190
+ readonly identity: "gateway.approval.arguments-preview.utf8-bytes";
191
+ readonly kind: "structural-validation";
192
+ readonly operation: {
193
+ readonly fieldNames: readonly ["argumentsPreview"];
194
+ readonly kind: "maximum-utf8-bytes";
195
+ readonly maximum: 4096;
196
+ };
197
+ }, {
198
+ readonly description: "Namespace discovery summaries remain inside the portable Unicode code-point bound.";
199
+ readonly errorCode: "portal.namespace-discovery.summary-above-maximum";
200
+ readonly identity: "portal.namespace-discovery.summary-code-points";
201
+ readonly kind: "structural-validation";
202
+ readonly operation: {
203
+ readonly fieldNames: readonly ["summary"];
204
+ readonly kind: "maximum-code-points";
205
+ readonly maximum: 500;
206
+ };
175
207
  }, {
176
208
  readonly description: "Gateway attachment metadata cannot repeat an admitted agent identity.";
177
209
  readonly errorCode: "gateway.attachment.duplicate-agent-id";
@@ -182,13 +214,14 @@ declare const PORTABLE_REFINEMENT_DESCRIPTORS: readonly [{
182
214
  readonly path: "configuredAgentIds";
183
215
  };
184
216
  }, {
185
- readonly description: "Managed Agent Projection namespace names must be sorted and unique.";
186
- readonly errorCode: "gateway.managed-agent-projection.namespace-names";
187
- readonly identity: "gateway.managed-agent-projection.namespace-names";
217
+ readonly description: "Managed Agent Projection namespaces must be sorted and unique by namespace.";
218
+ readonly errorCode: "gateway.managed-agent-projection.namespaces";
219
+ readonly identity: "gateway.managed-agent-projection.namespaces";
188
220
  readonly kind: "cross-field-validation";
189
221
  readonly operation: {
190
- readonly kind: "sorted-unique-string-items";
191
- readonly path: "toolPortalNamespaceNames";
222
+ readonly fieldName: "namespace";
223
+ readonly kind: "sorted-unique-object-field-items";
224
+ readonly path: "toolPortalNamespaces";
192
225
  };
193
226
  }, {
194
227
  readonly description: "Binary chunk byte length equals the decoded canonical base64 payload length.";
@@ -248,4 +281,4 @@ declare const PORTABLE_CONTRACT_ADAPTERS: {
248
281
  };
249
282
  //#endregion
250
283
  export { assertPortableContractSchemaIsExportable as a, PORTABLE_REFINEMENT_DESCRIPTORS as c, PortableRefinementKind as d, PortableRefinementOperation as f, PortableContractParseResult as i, PORTABLE_REFINEMENT_IDENTITIES as l, PORTABLE_CONTRACT_PROTOCOL_VERSION as n, createPortableContractSchemaManifest as o, PortableContractAdapter as r, encodeCanonicalJson as s, PORTABLE_CONTRACT_ADAPTERS as t, PortableRefinementDescriptor as u };
251
- //# sourceMappingURL=index-DqMFYBbN.d.ts.map
284
+ //# sourceMappingURL=index-C-QFWaH5.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-C-QFWaH5.d.ts","names":[],"sources":["../src/portable-contracts/portable-refinement-descriptors.ts","../src/portable-contracts/portable-contract-runtime.ts"],"mappings":";;;KAAY,sBAAA;AAAA,KAMA,2BAAA;EAAA,SAEA,IAAA;EAAA,SACA,UAAA;EAAA,SACA,OAAA;AAAA;EAAA,SAEE,IAAA;AAAA;EAAA,SAEF,eAAA;EAAA,SACA,SAAA;EAAA,SACA,IAAA;AAAA;EAAA,SAGA,IAAA;EAAA,SACA,MAAA,EAAQ,QAAA,CAAS,MAAA;AAAA;EAAA,SAGjB,IAAA;EAAA,SACA,iBAAA;EAAA,SACA,oBAAA;EAAA,SACA,0BAAA;EAAA,SACA,uBAAA;AAAA;EAAA,SAGA,IAAA;EAAA,SACA,OAAA;AAAA;EAAA,SAGA,UAAA;EAAA,SACA,IAAA;EAAA,SACA,OAAA;AAAA;EAAA,SAGA,UAAA;EAAA,SACA,IAAA;EAAA,SACA,OAAA;AAAA;EAAA,SAGA,UAAA;EAAA,SACA,IAAA;EAAA,SACA,MAAA;AAAA;EAAA,SAGA,IAAA;EAAA,SACA,OAAA;EAAA,SACA,OAAA;AAAA;EAAA,SAGA,SAAA;EAAA,SACA,IAAA;EAAA,SACA,IAAA;AAAA;EAAA,SAEE,IAAA;EAAA,SAA6C,IAAA;AAAA;EAAA,SAC7C,IAAA;AAAA;EAAA,SACA,IAAA;EAAA,SAAsC,IAAA;AAAA;EAAA,SACtC,UAAA;EAAA,SAAwC,IAAA;AAAA;AAAA,UAErC,4BAAA;EAAA,SACP,WAAA;EAAA,SACA,SAAA;EAAA,SACA,QAAA;EAAA,SACA,IAAA,EAAM,sBAAA;EAAA,SACN,SAAA,EAAW,2BAAA;AAAA;AAAA,cAGR,+BAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAuKA,8BAAA;;;UCnMH,mCAAA;EAAA,SACA,IAAA;EAAA,SACA,UAAA;EAAA,SACA,oBAAA;AAAA;AAAA,UAGA,mCAAA;EAAA,SACA,UAAA;EAAA,SACA,IAAA;EAAA,SACA,oBAAA;AAAA;AAAA,KAGE,2BAAA,GACT,mCAAA,GACA,mCAAA;AAAA,UAEc,uBAAA;EAAA,SACP,KAAA,GAAQ,KAAA,cAAmB,2BAAA;AAAA;AAAA,cAGxB,kCAAA;AAAA,UAWH,gCAAA;EAAA,SACA,MAAA,EAAQ,CAAA,CAAE,OAAA;EAAA,SACV,QAAA;AAAA;AAAA,iBA8EM,wCAAA,CACf,KAAA,EAAO,gCAAA;AAAA,iBAsBQ,mBAAA,CAAoB,KAAA;AAAA,iBA0XpB,oCAAA,CAAA,GAAwC,QAAA,CAAS,MAAA;AAAA,cAqBpD,0BAAA;EAAA,aAKgD,uBAAA;AAAA"}
@@ -32,6 +32,7 @@ type PortalDescribeRequest = z.infer<typeof PortalDescribeRequestSchema>;
32
32
  //#endregion
33
33
  //#region src/portal-call-surface/models/portal-error-schema.d.ts
34
34
  declare const PortalErrorCodeSchema: z.ZodEnum<{
35
+ cancelled: "cancelled";
35
36
  invalid_request: "invalid_request";
36
37
  not_found: "not_found";
37
38
  not_authorized: "not_authorized";
@@ -40,12 +41,12 @@ declare const PortalErrorCodeSchema: z.ZodEnum<{
40
41
  validation_failed: "validation_failed";
41
42
  provider_unavailable: "provider_unavailable";
42
43
  execution_failed: "execution_failed";
43
- cancelled: "cancelled";
44
44
  timeout: "timeout";
45
45
  }>;
46
46
  type PortalErrorCode = z.infer<typeof PortalErrorCodeSchema>;
47
47
  declare const PortalErrorSchema: z.ZodObject<{
48
48
  code: z.ZodEnum<{
49
+ cancelled: "cancelled";
49
50
  invalid_request: "invalid_request";
50
51
  not_found: "not_found";
51
52
  not_authorized: "not_authorized";
@@ -54,19 +55,18 @@ declare const PortalErrorSchema: z.ZodObject<{
54
55
  validation_failed: "validation_failed";
55
56
  provider_unavailable: "provider_unavailable";
56
57
  execution_failed: "execution_failed";
57
- cancelled: "cancelled";
58
58
  timeout: "timeout";
59
59
  }>;
60
60
  message: z.ZodString;
61
61
  retryable: z.ZodOptional<z.ZodBoolean>;
62
62
  safeDiagnostic: z.ZodOptional<z.ZodObject<{
63
63
  code: z.ZodEnum<{
64
+ cancelled: "cancelled";
64
65
  approval_required: "approval_required";
65
66
  capability_denied: "capability_denied";
66
67
  validation_failed: "validation_failed";
67
68
  provider_unavailable: "provider_unavailable";
68
69
  execution_failed: "execution_failed";
69
- cancelled: "cancelled";
70
70
  timeout: "timeout";
71
71
  output_truncated: "output_truncated";
72
72
  artifact_unavailable: "artifact_unavailable";
@@ -149,4 +149,4 @@ interface PortalCallSurfaceJsonSchemas {
149
149
  declare function createPortalCallSurfaceJsonSchemas(): PortalCallSurfaceJsonSchemas;
150
150
  //#endregion
151
151
  export { PortalSearchRequestSchema as a, PortalListRequestSchema as c, PortalErrorCodeSchema as d, PortalErrorSchema as f, PortalDescribeRequestSchema as h, PortalSearchRequest as i, PortalError as l, PortalDescribeRequest as m, createPortalCallSurfaceJsonSchemas as n, PortalListItemRequestSchema as o, PortalDescribeItemRequestSchema as p, PortalSearchItemRequestSchema as r, PortalListRequest as s, PortalCallSurfaceJsonSchemas as t, PortalErrorCode as u };
152
- //# sourceMappingURL=index-B_FqoejO.d.ts.map
152
+ //# sourceMappingURL=index-C8O_HiyA.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-B_FqoejO.d.ts","names":[],"sources":["../src/portal-call-surface/models/portal-describe-request-schema.ts","../src/portal-call-surface/models/portal-error-schema.ts","../src/portal-call-surface/models/portal-list-request-schema.ts","../src/portal-call-surface/models/portal-search-request-schema.ts","../src/portal-call-surface/portal-call-json-schema-exporter.ts"],"mappings":";;;cAQa,+BAAA,EAA+B,CAAA,CAAA,SAAA;;;;;;;;;;;;cAY/B,2BAAA,EAA2B,CAAA,CAAA,SAAA;;;;;;;;;;;;;;;KAa5B,qBAAA,GAAwB,CAAA,CAAE,KAAA,QAAa,2BAAA;;;cC7BtC,qBAAA,EAAqB,CAAA,CAAA,OAAA;;;;;;;;;;;;KAatB,eAAA,GAAkB,CAAA,CAAE,KAAA,QAAa,qBAAA;AAAA,cAEhC,iBAAA,EAAiB,CAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KASlB,WAAA,GAAc,CAAA,CAAE,KAAA,QAAa,iBAAA;;;cCpB5B,2BAAA,EAA2B,CAAA,CAAA,SAAA;;;;;;;;;;;cAW3B,uBAAA,EAAuB,CAAA,CAAA,SAAA;;;;;;;;;;;;;;KAaxB,iBAAA,GAAoB,CAAA,CAAE,KAAA,QAAa,uBAAA;;;cCzBlC,6BAAA,EAA6B,CAAA,CAAA,SAAA;;;;;;;;;;;cAU7B,yBAAA,EAAyB,CAAA,CAAA,SAAA;;;;;;;;;;;;;;KAa1B,mBAAA,GAAsB,CAAA,CAAE,KAAA,QAAa,yBAAA;;;UCvBhC,4BAAA;EAAA,SACP,IAAA,EAAM,MAAA;EAAA,SACN,QAAA,EAAU,MAAA;EAAA,SACV,IAAA,EAAM,MAAA;EAAA,SACN,MAAA,EAAQ,MAAA;AAAA;AAAA,iBAGF,kCAAA,CAAA,GAAsC,4BAAA"}
1
+ {"version":3,"file":"index-C8O_HiyA.d.ts","names":[],"sources":["../src/portal-call-surface/models/portal-describe-request-schema.ts","../src/portal-call-surface/models/portal-error-schema.ts","../src/portal-call-surface/models/portal-list-request-schema.ts","../src/portal-call-surface/models/portal-search-request-schema.ts","../src/portal-call-surface/portal-call-json-schema-exporter.ts"],"mappings":";;;cAQa,+BAAA,EAA+B,CAAA,CAAA,SAAA;;;;;;;;;;;;cAY/B,2BAAA,EAA2B,CAAA,CAAA,SAAA;;;;;;;;;;;;;;;KAa5B,qBAAA,GAAwB,CAAA,CAAE,KAAA,QAAa,2BAAA;;;cC7BtC,qBAAA,EAAqB,CAAA,CAAA,OAAA;;;;;;;;;;;;KAatB,eAAA,GAAkB,CAAA,CAAE,KAAA,QAAa,qBAAA;AAAA,cAEhC,iBAAA,EAAiB,CAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KASlB,WAAA,GAAc,CAAA,CAAE,KAAA,QAAa,iBAAA;;;cCpB5B,2BAAA,EAA2B,CAAA,CAAA,SAAA;;;;;;;;;;;cAW3B,uBAAA,EAAuB,CAAA,CAAA,SAAA;;;;;;;;;;;;;;KAaxB,iBAAA,GAAoB,CAAA,CAAE,KAAA,QAAa,uBAAA;;;cCzBlC,6BAAA,EAA6B,CAAA,CAAA,SAAA;;;;;;;;;;;cAU7B,yBAAA,EAAyB,CAAA,CAAA,SAAA;;;;;;;;;;;;;;KAa1B,mBAAA,GAAsB,CAAA,CAAE,KAAA,QAAa,yBAAA;;;UCvBhC,4BAAA;EAAA,SACP,IAAA,EAAM,MAAA;EAAA,SACN,QAAA,EAAU,MAAA;EAAA,SACV,IAAA,EAAM,MAAA;EAAA,SACN,MAAA,EAAQ,MAAA;AAAA;AAAA,iBAGF,kCAAA,CAAA,GAAsC,4BAAA"}