@agent-vm/agent-portal-sdk 0.0.134 → 0.0.135
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/contract-fixtures/portable-contracts/gateway/managed-agent-projection-hermes-valid.fixture.json +4 -2
- package/contract-fixtures/portable-contracts/gateway/managed-agent-projection-long-namespace-name.fixture.json +34 -0
- package/contract-fixtures/portable-contracts/gateway/managed-agent-projection-namespace-names-code-point-order.fixture.json +30 -0
- package/contract-fixtures/portable-contracts/gateway/managed-agent-projection-namespace-names-code-point-reverse.fixture.json +26 -0
- package/contract-fixtures/portable-contracts/gateway/managed-agent-projection-namespace-names-duplicate.fixture.json +20 -0
- package/contract-fixtures/portable-contracts/gateway/managed-agent-projection-namespace-names-unsorted.fixture.json +20 -0
- package/contract-fixtures/portable-contracts/gateway/managed-agent-projection-old-authority-rejected.fixture.json +2 -1
- package/contract-fixtures/portable-contracts/gateway/managed-agent-projection-openclaw-valid.fixture.json +4 -2
- package/contract-fixtures/portable-contracts/gateway/managed-agent-projection-self-root-rejected.fixture.json +2 -1
- package/contract-fixtures/portable-contracts/gateway/managed-agent-projection-work-root-rejected.fixture.json +2 -1
- package/dist/adapter-boundary/index.d.ts +1 -1
- package/dist/approval-surface/index.d.ts +1 -1
- package/dist/approval-surface/index.js +1 -1
- package/dist/{approval-surface-en5VAY5h.js → approval-surface-z5JUqa0K.js} +3 -3
- package/dist/{approval-surface-en5VAY5h.js.map → approval-surface-z5JUqa0K.js.map} +1 -1
- package/dist/artifact-surface/index.d.ts +1 -1
- package/dist/artifact-surface/index.js +1 -1
- package/dist/{artifact-surface-BstQxq6b.js → artifact-surface-BIDasG5x.js} +2 -2
- package/dist/{artifact-surface-BstQxq6b.js.map → artifact-surface-BIDasG5x.js.map} +1 -1
- package/dist/capability-description-surface/index.d.ts +1 -1
- package/dist/capability-description-surface/index.js +2 -2
- package/dist/capability-description-surface-CyPgad9d.js +2 -0
- package/dist/{capability-descriptor-schema-zRnfGjBc.js → capability-descriptor-schema-DmzUtpji.js} +4 -11
- package/dist/capability-descriptor-schema-DmzUtpji.js.map +1 -0
- package/dist/capability-reference-schema-K7qXJgEa.js +12 -0
- package/dist/capability-reference-schema-K7qXJgEa.js.map +1 -0
- package/dist/cli/tool-portal.js +146 -76
- package/dist/cli/tool-portal.js.map +1 -1
- package/dist/contracts/index.d.ts +2 -2
- package/dist/contracts/index.js +2 -2
- package/dist/{contracts-RgGW0RX2.js → contracts-3pjrcMjD.js} +40 -9
- package/dist/{contracts-RgGW0RX2.js.map → contracts-3pjrcMjD.js.map} +1 -1
- package/dist/gateway-runtime-client/index.d.ts +4 -4
- package/dist/gateway-runtime-client/index.js +5 -5
- package/dist/gateway-runtime-local-exec/gateway-runtime-local-exec-helper.js +1 -1
- package/dist/gateway-runtime-local-exec/index.js +1 -1
- package/dist/{gateway-runtime-local-exec-transport-B1hy2A3Q.js → gateway-runtime-local-exec-transport-DjxMXdT9.js} +1 -1
- package/dist/{gateway-runtime-local-exec-transport-B1hy2A3Q.js.map → gateway-runtime-local-exec-transport-DjxMXdT9.js.map} +1 -1
- package/dist/{index-B5hgm1KH.d.ts → index-B_xYdo3v.d.ts} +2 -2
- package/dist/{index-B5hgm1KH.d.ts.map → index-B_xYdo3v.d.ts.map} +1 -1
- package/dist/{index-BmH68K78.d.ts → index-BgKPbuap.d.ts} +1 -1
- package/dist/{index-BmH68K78.d.ts.map → index-BgKPbuap.d.ts.map} +1 -1
- package/dist/{index-BaIwC_bf.d.ts → index-BoYiYKiy.d.ts} +1 -1
- package/dist/{index-BaIwC_bf.d.ts.map → index-BoYiYKiy.d.ts.map} +1 -1
- package/dist/{index-C-NPMMvc.d.ts → index-C5NhyO2R.d.ts} +4 -2
- package/dist/{index-C-NPMMvc.d.ts.map → index-C5NhyO2R.d.ts.map} +1 -1
- package/dist/{index-D23bIrnr.d.ts → index-CscGl_Rj.d.ts} +4 -4
- package/dist/{index-D23bIrnr.d.ts.map → index-CscGl_Rj.d.ts.map} +1 -1
- package/dist/{index-M78OuWx6.d.ts → index-Cwtgu-ga.d.ts} +1 -1
- package/dist/{index-M78OuWx6.d.ts.map → index-Cwtgu-ga.d.ts.map} +1 -1
- package/dist/{index-ByAhyVbI.d.ts → index-D8uVfMBv.d.ts} +2 -2
- package/dist/{index-ByAhyVbI.d.ts.map → index-D8uVfMBv.d.ts.map} +1 -1
- package/dist/{index-DKBSYuxW.d.ts → index-DqMFYBbN.d.ts} +13 -1
- package/dist/index-DqMFYBbN.d.ts.map +1 -0
- package/dist/{index-95IydGBz.d.ts → index-DvcQs-mM.d.ts} +1 -1
- package/dist/{index-95IydGBz.d.ts.map → index-DvcQs-mM.d.ts.map} +1 -1
- package/dist/{index-Dj4galCJ.d.ts → index-dKXgrOwm.d.ts} +1 -1
- package/dist/{index-Dj4galCJ.d.ts.map → index-dKXgrOwm.d.ts.map} +1 -1
- package/dist/index.d.ts +12 -12
- package/dist/index.js +16 -14
- package/dist/{json-value-schema-hdPkabRZ.js → json-value-schema-BGfMDOGA.js} +2 -2
- package/dist/{json-value-schema-hdPkabRZ.js.map → json-value-schema-BGfMDOGA.js.map} +1 -1
- package/dist/{json-value-schema-M87sjwWL.d.ts → json-value-schema-C-87ATB3.d.ts} +1 -1
- package/dist/{json-value-schema-M87sjwWL.d.ts.map → json-value-schema-C-87ATB3.d.ts.map} +1 -1
- package/dist/{node-tool-portal-mcp-transport-Cl2VKbLY.js → node-tool-portal-mcp-transport-CnB8MCW2.js} +1 -1
- package/dist/{node-tool-portal-mcp-transport-Cl2VKbLY.js.map → node-tool-portal-mcp-transport-CnB8MCW2.js.map} +1 -1
- package/dist/portable-contracts/index.d.ts +1 -1
- package/dist/portable-contracts/index.js +2 -2
- package/dist/{portable-contracts-Bca33zVa.js → portable-contracts-C5rtqe-H.js} +11 -12
- package/dist/portable-contracts-C5rtqe-H.js.map +1 -0
- package/dist/{portable-refinement-authoring-ZSmR-amG.js → portable-refinement-authoring-CvlKRs_Z.js} +11 -1
- package/dist/portable-refinement-authoring-CvlKRs_Z.js.map +1 -0
- package/dist/{portal-call-request-schema-Cp6CMGs9.js → portal-call-request-schema-DYxcWijW.js} +4 -4
- package/dist/{portal-call-request-schema-Cp6CMGs9.js.map → portal-call-request-schema-DYxcWijW.js.map} +1 -1
- package/dist/{portal-call-result-schema-DoE_YCtv.d.ts → portal-call-result-schema-CGopcrjJ.d.ts} +2 -2
- package/dist/{portal-call-result-schema-DoE_YCtv.d.ts.map → portal-call-result-schema-CGopcrjJ.d.ts.map} +1 -1
- package/dist/{portal-call-result-schema-ByxHRCEN.js → portal-call-result-schema-CVWMGu2y.js} +6 -5
- package/dist/{portal-call-result-schema-ByxHRCEN.js.map → portal-call-result-schema-CVWMGu2y.js.map} +1 -1
- package/dist/portal-call-surface/index.d.ts +2 -2
- package/dist/portal-call-surface/index.js +4 -4
- package/dist/{portal-call-surface-DjZVquFt.js → portal-call-surface-B_oQxm5X.js} +7 -6
- package/dist/{portal-call-surface-DjZVquFt.js.map → portal-call-surface-B_oQxm5X.js.map} +1 -1
- package/dist/{portal-error-schema-CQHgoFq4.js → portal-error-schema-BCALC7xt.js} +2 -21
- package/dist/portal-error-schema-BCALC7xt.js.map +1 -0
- package/dist/portal-event-surface/index.d.ts +1 -1
- package/dist/portal-event-surface/index.js +2 -2
- package/dist/{portal-event-surface-CdScrgoN.js → portal-event-surface-DSWv7Kgi.js} +3 -2
- package/dist/{portal-event-surface-CdScrgoN.js.map → portal-event-surface-DSWv7Kgi.js.map} +1 -1
- package/dist/request-id-schema-DGLLX-tp.js +23 -0
- package/dist/request-id-schema-DGLLX-tp.js.map +1 -0
- package/dist/testing/index.d.ts +2 -2
- package/dist/testing/index.js +2 -2
- package/dist/tool-portal-mcp-client/index.d.ts +1 -1
- package/dist/tool-portal-mcp-client/index.js +1 -1
- package/dist/tool-portal-mcp-client/node-tool-portal-mcp-transport.d.ts +1 -1
- package/dist/tool-portal-mcp-client/node-tool-portal-mcp-transport.js +1 -1
- package/dist/{tool-portal-mcp-client-DwJF-48Y.js → tool-portal-mcp-client-nMGxqQ-A.js} +5 -5
- package/dist/{tool-portal-mcp-client-DwJF-48Y.js.map → tool-portal-mcp-client-nMGxqQ-A.js.map} +1 -1
- package/package.json +3 -1
- package/portable-contract-schema-manifest.json +11 -1
- package/dist/capability-description-surface-BdzknTKT.js +0 -2
- package/dist/capability-descriptor-schema-zRnfGjBc.js.map +0 -1
- package/dist/index-DKBSYuxW.d.ts.map +0 -1
- package/dist/portable-contracts-Bca33zVa.js.map +0 -1
- package/dist/portable-refinement-authoring-ZSmR-amG.js.map +0 -1
- package/dist/portal-error-schema-CQHgoFq4.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { d as PortalListResultSchema, i as PortalCallResultSchema, m as PortalSearchResultSchema, s as PortalDescribeResultSchema } from "./portal-call-result-schema-
|
|
2
|
-
import { a as PortalArtifactReadRequestSchema, o as PortalArtifactReadResultSchema, r as createPortalArtifactReadResourceRequest } from "./artifact-surface-
|
|
3
|
-
import { r as PortalCallRequestSchema } from "./portal-call-request-schema-
|
|
4
|
-
import { a as PortalListRequestSchema, r as PortalSearchRequestSchema, s as PortalDescribeRequestSchema } from "./portal-call-surface-
|
|
1
|
+
import { d as PortalListResultSchema, i as PortalCallResultSchema, m as PortalSearchResultSchema, s as PortalDescribeResultSchema } from "./portal-call-result-schema-CVWMGu2y.js";
|
|
2
|
+
import { a as PortalArtifactReadRequestSchema, o as PortalArtifactReadResultSchema, r as createPortalArtifactReadResourceRequest } from "./artifact-surface-BIDasG5x.js";
|
|
3
|
+
import { r as PortalCallRequestSchema } from "./portal-call-request-schema-DYxcWijW.js";
|
|
4
|
+
import { a as PortalListRequestSchema, r as PortalSearchRequestSchema, s as PortalDescribeRequestSchema } from "./portal-call-surface-B_oQxm5X.js";
|
|
5
5
|
//#region src/tool-portal-mcp-client/index.ts
|
|
6
6
|
const canonicalBase64Pattern = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/u;
|
|
7
7
|
function decodedBase64ByteLength(contentBase64) {
|
|
@@ -87,4 +87,4 @@ var ToolPortalMcpClient = class {
|
|
|
87
87
|
//#endregion
|
|
88
88
|
export { ToolPortalMcpClient as t };
|
|
89
89
|
|
|
90
|
-
//# sourceMappingURL=tool-portal-mcp-client-
|
|
90
|
+
//# sourceMappingURL=tool-portal-mcp-client-nMGxqQ-A.js.map
|
package/dist/{tool-portal-mcp-client-DwJF-48Y.js.map → tool-portal-mcp-client-nMGxqQ-A.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-portal-mcp-client-
|
|
1
|
+
{"version":3,"file":"tool-portal-mcp-client-nMGxqQ-A.js","names":["#transport"],"sources":["../src/tool-portal-mcp-client/index.ts"],"sourcesContent":["import {\n\tcreatePortalArtifactReadResourceRequest,\n\tPortalArtifactReadRequestSchema,\n\tPortalArtifactReadResultSchema,\n\ttype PortalArtifactReadRequest,\n\ttype PortalArtifactReadResourceRequest,\n\ttype PortalArtifactReadResult,\n} from '../artifact-surface/index.js';\nimport {\n\tPortalCallRequestSchema,\n\tPortalCallResultSchema,\n\tPortalDescribeRequestSchema,\n\tPortalDescribeResultSchema,\n\tPortalListRequestSchema,\n\tPortalListResultSchema,\n\tPortalSearchRequestSchema,\n\tPortalSearchResultSchema,\n\ttype PortalCallRequest,\n\ttype PortalCallResult,\n\ttype PortalDescribeRequest,\n\ttype PortalDescribeResult,\n\ttype PortalListRequest,\n\ttype PortalListResult,\n\ttype PortalSearchRequest,\n\ttype PortalSearchResult,\n} from '../portal-call-surface/index.js';\n\nexport type ToolPortalMcpResourceContent =\n\t| {\n\t\t\treadonly blob: string;\n\t\t\treadonly kind: 'blob';\n\t\t\treadonly mediaType?: string;\n\t\t\treadonly uri: string;\n\t }\n\t| {\n\t\t\treadonly kind: 'text';\n\t\t\treadonly mediaType?: string;\n\t\t\treadonly text: string;\n\t\t\treadonly uri: string;\n\t };\n\nexport interface ToolPortalMcpTransport {\n\treadonly callTool: (\n\t\tcall: {\n\t\t\treadonly approvalToken?: string;\n\t\t\treadonly arguments: unknown;\n\t\t\treadonly name: string;\n\t\t},\n\t\toptions?: {\n\t\t\treadonly resultGraceAfterAbortMs?: number;\n\t\t\treadonly signal?: AbortSignal;\n\t\t},\n\t) => Promise<{ readonly structuredContent?: unknown }>;\n\treadonly close: () => Promise<void>;\n\treadonly connect: () => Promise<void>;\n\treadonly readResource: (\n\t\trequest: PortalArtifactReadResourceRequest,\n\t\toptions?: {\n\t\t\treadonly resultGraceAfterAbortMs?: number;\n\t\t\treadonly signal?: AbortSignal;\n\t\t},\n\t) => Promise<{ readonly contents: readonly ToolPortalMcpResourceContent[] }>;\n}\n\nexport interface ToolPortalMcpClientOptions {\n\treadonly transport: ToolPortalMcpTransport;\n}\n\nexport interface ToolPortalClientRequestOptions {\n\treadonly approvalToken?: string;\n\treadonly resultGraceAfterAbortMs?: number;\n\treadonly signal?: AbortSignal;\n}\n\nconst canonicalBase64Pattern = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/u;\n\nfunction decodedBase64ByteLength(contentBase64: string): number {\n\tif (!canonicalBase64Pattern.test(contentBase64)) {\n\t\tthrow new TypeError('Tool Portal MCP artifact content is not canonical base64.');\n\t}\n\tconst paddingBytes = contentBase64.endsWith('==') ? 2 : contentBase64.endsWith('=') ? 1 : 0;\n\treturn (contentBase64.length / 4) * 3 - paddingBytes;\n}\n\nclass ToolPortalMcpArtifactOperations {\n\treadonly #transport: ToolPortalMcpTransport;\n\n\tconstructor(transport: ToolPortalMcpTransport) {\n\t\tthis.#transport = transport;\n\t}\n\n\tasync read(\n\t\trequest: PortalArtifactReadRequest,\n\t\toptions: ToolPortalClientRequestOptions = {},\n\t): Promise<PortalArtifactReadResult> {\n\t\tconst validatedRequest = PortalArtifactReadRequestSchema.parse(request);\n\t\tconst resourceRequest = createPortalArtifactReadResourceRequest(validatedRequest);\n\t\tconst response = await this.#transport.readResource(resourceRequest, options);\n\t\tconst content = response.contents.length === 1 ? response.contents[0] : undefined;\n\t\tif (\n\t\t\tcontent === undefined ||\n\t\t\tcontent.kind !== 'blob' ||\n\t\t\tcontent.uri !== resourceRequest.uri ||\n\t\t\tcontent.mediaType === undefined\n\t\t) {\n\t\t\tthrow new TypeError('Tool Portal MCP artifact read returned an invalid resource.');\n\t\t}\n\t\tconst returnedBytes = decodedBase64ByteLength(content.blob);\n\t\tif (returnedBytes > validatedRequest.maxBytes) {\n\t\t\tthrow new TypeError('Tool Portal MCP artifact read exceeded the requested byte range.');\n\t\t}\n\t\treturn PortalArtifactReadResultSchema.parse({\n\t\t\tcontentBase64: content.blob,\n\t\t\tmediaType: content.mediaType,\n\t\t\toffsetBytes: validatedRequest.offsetBytes,\n\t\t\treference: validatedRequest.reference,\n\t\t\ttruncated:\n\t\t\t\tvalidatedRequest.offsetBytes + returnedBytes < validatedRequest.reference.byteLength,\n\t\t});\n\t}\n}\n\n/**\n * Standard-MCP projection of the bounded Tool Portal surface.\n *\n * The transport is injected so this subpath remains independent from the\n * Gateway-runtime UDS client and its Node-specific dependencies.\n */\nexport class ToolPortalMcpClient {\n\treadonly #transport: ToolPortalMcpTransport;\n\treadonly artifacts: ToolPortalMcpArtifactOperations;\n\n\tconstructor(options: ToolPortalMcpClientOptions) {\n\t\tthis.#transport = options.transport;\n\t\tthis.artifacts = new ToolPortalMcpArtifactOperations(this.#transport);\n\t}\n\n\tasync connect(): Promise<void> {\n\t\tawait this.#transport.connect();\n\t}\n\n\tasync close(): Promise<void> {\n\t\tawait this.#transport.close();\n\t}\n\n\tasync list(\n\t\trequest: PortalListRequest,\n\t\toptions: ToolPortalClientRequestOptions = {},\n\t): Promise<PortalListResult> {\n\t\tconst validatedRequest = PortalListRequestSchema.parse(request);\n\t\tconst response = await this.#transport.callTool(\n\t\t\t{\n\t\t\t\targuments: validatedRequest,\n\t\t\t\tname: 'tool_portal_list',\n\t\t\t},\n\t\t\toptions,\n\t\t);\n\t\treturn PortalListResultSchema.parse(response.structuredContent);\n\t}\n\n\tasync search(\n\t\trequest: PortalSearchRequest,\n\t\toptions: ToolPortalClientRequestOptions = {},\n\t): Promise<PortalSearchResult> {\n\t\tconst validatedRequest = PortalSearchRequestSchema.parse(request);\n\t\tconst response = await this.#transport.callTool(\n\t\t\t{\n\t\t\t\targuments: validatedRequest,\n\t\t\t\tname: 'tool_portal_search',\n\t\t\t},\n\t\t\toptions,\n\t\t);\n\t\treturn PortalSearchResultSchema.parse(response.structuredContent);\n\t}\n\n\tasync describe(\n\t\trequest: PortalDescribeRequest,\n\t\toptions: ToolPortalClientRequestOptions = {},\n\t): Promise<PortalDescribeResult> {\n\t\tconst validatedRequest = PortalDescribeRequestSchema.parse(request);\n\t\tconst response = await this.#transport.callTool(\n\t\t\t{\n\t\t\t\targuments: validatedRequest,\n\t\t\t\tname: 'tool_portal_describe',\n\t\t\t},\n\t\t\toptions,\n\t\t);\n\t\treturn PortalDescribeResultSchema.parse(response.structuredContent);\n\t}\n\n\tasync call(\n\t\trequest: PortalCallRequest,\n\t\toptions: ToolPortalClientRequestOptions = {},\n\t): Promise<PortalCallResult> {\n\t\tconst validatedRequest = PortalCallRequestSchema.parse(request);\n\t\tconst response = await this.#transport.callTool(\n\t\t\t{\n\t\t\t\t...(options.approvalToken === undefined ? {} : { approvalToken: options.approvalToken }),\n\t\t\t\targuments: validatedRequest,\n\t\t\t\tname: 'tool_portal_call',\n\t\t\t},\n\t\t\toptions,\n\t\t);\n\t\treturn PortalCallResultSchema.parse(response.structuredContent);\n\t}\n}\n"],"mappings":";;;;;AA0EA,MAAM,yBAAyB;AAE/B,SAAS,wBAAwB,eAA+B;CAC/D,IAAI,CAAC,uBAAuB,KAAK,cAAc,EAC9C,MAAM,IAAI,UAAU,4DAA4D;CAEjF,MAAM,eAAe,cAAc,SAAS,KAAK,GAAG,IAAI,cAAc,SAAS,IAAI,GA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;;CAGhE,MAAM,OACL,SACA,UAA0C,EAAE,EACd;EAC9B,MAAM,mBAAmB,0BAA0B,MAAM,QAAQ;EACjE,MAAM,WAAW,MAAM,KAAKA,WAAW,SACtC;GACC,WAAW;GACX,MAAM;GACN,EACD,QACA;EACD,OAAO,yBAAyB,MAAM,SAAS,kBAAkB;;CAGlE,MAAM,SACL,SACA,UAA0C,EAAE,EACZ;EAChC,MAAM,mBAAmB,4BAA4B,MAAM,QAAQ;EACnE,MAAM,WAAW,MAAM,KAAKA,WAAW,SACtC;GACC,WAAW;GACX,MAAM;GACN,EACD,QACA;EACD,OAAO,2BAA2B,MAAM,SAAS,kBAAkB;;CAGpE,MAAM,KACL,SACA,UAA0C,EAAE,EAChB;EAC5B,MAAM,mBAAmB,wBAAwB,MAAM,QAAQ;EAC/D,MAAM,WAAW,MAAM,KAAKA,WAAW,SACtC;GACC,GAAI,QAAQ,kBAAkB,KAAA,IAAY,EAAE,GAAG,EAAE,eAAe,QAAQ,eAAe;GACvF,WAAW;GACX,MAAM;GACN,EACD,QACA;EACD,OAAO,uBAAuB,MAAM,SAAS,kBAAkB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-vm/agent-portal-sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.135",
|
|
4
4
|
"description": "Portal-neutral Zod contracts and helpers for agent-facing capability surfaces.",
|
|
5
5
|
"homepage": "https://github.com/ShravanSunder/agent-vm#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -87,6 +87,8 @@
|
|
|
87
87
|
},
|
|
88
88
|
"dependencies": {
|
|
89
89
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
90
|
+
"@optique/core": "1.2.0",
|
|
91
|
+
"@optique/zod": "1.2.0",
|
|
90
92
|
"zod": "^4.4.3"
|
|
91
93
|
},
|
|
92
94
|
"devDependencies": {
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
"protocolVersion": 1,
|
|
3
3
|
"refinements": [
|
|
4
4
|
"gateway.attachment.unique-agent-ids",
|
|
5
|
+
"gateway.managed-agent-projection.namespace-names",
|
|
5
6
|
"portal.artifact-read.default-truncated",
|
|
6
7
|
"portal.batch.unique-item-ids",
|
|
7
8
|
"portal.describe.default-includes",
|
|
@@ -3380,6 +3381,14 @@
|
|
|
3380
3381
|
"minLength": 1,
|
|
3381
3382
|
"maxLength": 256
|
|
3382
3383
|
},
|
|
3384
|
+
"toolPortalNamespaceNames": {
|
|
3385
|
+
"readOnly": true,
|
|
3386
|
+
"type": "array",
|
|
3387
|
+
"items": {
|
|
3388
|
+
"type": "string",
|
|
3389
|
+
"minLength": 1
|
|
3390
|
+
}
|
|
3391
|
+
},
|
|
3383
3392
|
"toolPortalProfileId": {
|
|
3384
3393
|
"type": "string",
|
|
3385
3394
|
"minLength": 1,
|
|
@@ -3390,11 +3399,12 @@
|
|
|
3390
3399
|
"agentId",
|
|
3391
3400
|
"frameworkIdentity",
|
|
3392
3401
|
"profileAssignmentRevision",
|
|
3402
|
+
"toolPortalNamespaceNames",
|
|
3393
3403
|
"toolPortalProfileId"
|
|
3394
3404
|
],
|
|
3395
3405
|
"additionalProperties": false
|
|
3396
3406
|
},
|
|
3397
|
-
"refinementIdentities": []
|
|
3407
|
+
"refinementIdentities": ["gateway.managed-agent-projection.namespace-names"]
|
|
3398
3408
|
},
|
|
3399
3409
|
"gateway.trusted-invocation-context": {
|
|
3400
3410
|
"jsonSchema": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"capability-descriptor-schema-zRnfGjBc.js","names":[],"sources":["../src/contract-primitives/models/capability-reference-schema.ts","../src/capability-description-surface/models/capability-descriptor-schema.ts"],"sourcesContent":["import { z } from 'zod';\n\nexport const NamespaceNameSchema = z.string().min(1);\nexport const CapabilityNameSchema = z.string().min(1);\n\nexport const CapabilityReferenceSchema = z\n\t.object({\n\t\tnamespace: NamespaceNameSchema,\n\t\tname: CapabilityNameSchema,\n\t})\n\t.strict();\n\nexport type CapabilityReference = z.infer<typeof CapabilityReferenceSchema>;\n","import { z } from 'zod';\n\nimport {\n\tCapabilityNameSchema,\n\tNamespaceNameSchema,\n} from '../../contract-primitives/models/capability-reference-schema.js';\nimport { JsonValueSchema } from '../../contract-primitives/models/json-value-schema.js';\n\nexport const JsonSchemaDocumentSchema = z.record(z.string(), JsonValueSchema);\n\nexport const ToolSchemaSummarySchema = z\n\t.object({\n\t\toptional: z.array(z.string()),\n\t\tpropertyCount: z.number().int().nonnegative(),\n\t\trequired: z.array(z.string()),\n\t\ttype: z.string().min(1),\n\t})\n\t.strict();\n\nexport type ToolSchemaSummary = z.infer<typeof ToolSchemaSummarySchema>;\n\nexport const ToolSafetySummarySchema = z\n\t.object({\n\t\tdestructiveHint: z.boolean().optional(),\n\t\treadOnlyHint: z.boolean().optional(),\n\t})\n\t.strict();\n\nexport type ToolSafetySummary = z.infer<typeof ToolSafetySummarySchema>;\n\nexport const ToolSchemaHintSchema = z\n\t.object({\n\t\tmessage: z.string().max(500),\n\t\tnext: z.enum(['call_ready', 'describe_before_call']),\n\t})\n\t.strict();\n\nexport type ToolSchemaHint = z.infer<typeof ToolSchemaHintSchema>;\n\nexport const CapabilitySummarySchema = z\n\t.object({\n\t\tdescription: z.string().optional(),\n\t\tinput: ToolSchemaSummarySchema,\n\t\tnamespace: NamespaceNameSchema,\n\t\toutput: ToolSchemaSummarySchema.optional(),\n\t\tsafety: ToolSafetySummarySchema,\n\t\tschemaHint: ToolSchemaHintSchema.optional(),\n\t\ttitle: z.string().min(1).optional(),\n\t\tname: CapabilityNameSchema,\n\t\ttoolRef: z.string().min(1),\n\t})\n\t.strict();\n\nexport type CapabilitySummary = z.infer<typeof CapabilitySummarySchema>;\n\nexport const ResultExpectationSchema = z\n\t.object({\n\t\tcanReturnArtifacts: z.boolean().default(false),\n\t\tcanStream: z.boolean().default(false),\n\t\tkind: z.enum(['json', 'text', 'binary_artifact', 'mixed']),\n\t\toutputJsonSchema: JsonSchemaDocumentSchema.optional(),\n\t\ttruncation: z.enum(['none', 'possible', 'expected']).default('possible'),\n\t})\n\t.strict();\n\nexport type ResultExpectation = z.infer<typeof ResultExpectationSchema>;\n\nexport const SafeCallingHintSchema = z\n\t.object({\n\t\tcode: z.enum([\n\t\t\t'describe_before_call',\n\t\t\t'approval_may_be_required',\n\t\t\t'read_only',\n\t\t\t'write_or_external_effect',\n\t\t\t'large_output_possible',\n\t\t\t'artifact_output_possible',\n\t\t]),\n\t\tmessage: z.string().max(500),\n\t})\n\t.strict();\n\nexport type SafeCallingHint = z.infer<typeof SafeCallingHintSchema>;\n\nexport const CapabilitySearchMatchSchema = CapabilitySummarySchema.extend({\n\tinputSchema: JsonSchemaDocumentSchema.optional(),\n\toutputSchema: JsonSchemaDocumentSchema.optional(),\n\trelationshipHints: z.array(JsonValueSchema).optional(),\n\tschemaFieldMatches: z.array(JsonValueSchema).optional(),\n}).strict();\n\nexport type CapabilitySearchMatch = z.infer<typeof CapabilitySearchMatchSchema>;\n\nexport const CapabilityDescriptorSchema = z\n\t.object({\n\t\tannotations: JsonSchemaDocumentSchema.default({}),\n\t\tinputSchema: JsonSchemaDocumentSchema.optional(),\n\t\tnamespace: NamespaceNameSchema,\n\t\toutputSchema: JsonSchemaDocumentSchema.optional(),\n\t\trelated: z.array(JsonValueSchema).default([]),\n\t\tschemaHint: ToolSchemaHintSchema.optional(),\n\t\tname: CapabilityNameSchema,\n\t\ttoolRef: z.string().min(1),\n\t\ttypescriptHelper: z.string().optional(),\n\t\tzod: JsonSchemaDocumentSchema.optional(),\n\t})\n\t.strict();\n\nexport type CapabilityDescriptor = z.infer<typeof CapabilityDescriptorSchema>;\n"],"mappings":";;;AAEA,MAAa,sBAAsB,EAAE,QAAQ,CAAC,IAAI,EAAE;AACpD,MAAa,uBAAuB,EAAE,QAAQ,CAAC,IAAI,EAAE;AAErD,MAAa,4BAA4B,EACvC,OAAO;CACP,WAAW;CACX,MAAM;CACN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ACnC,OAAO;CACP,MAAM,EAAE,KAAK;EACZ;EACA;EACA;EACA;EACA;EACA;EACA,CAAC;CACF,SAAS,EAAE,QAAQ,CAAC,IAAI,IAAI;CAC5B,CAAC,CACD,QAAQ;AAIV,MAAa,8BAA8B,wBAAwB,OAAO;CACzE,aAAa,yBAAyB,UAAU;CAChD,cAAc,yBAAyB,UAAU;CACjD,mBAAmB,EAAE,MAAM,gBAAgB,CAAC,UAAU;CACtD,oBAAoB,EAAE,MAAM,gBAAgB,CAAC,UAAU;CACvD,CAAC,CAAC,QAAQ;AAIX,MAAa,6BAA6B,EACxC,OAAO;CACP,aAAa,yBAAyB,QAAQ,EAAE,CAAC;CACjD,aAAa,yBAAyB,UAAU;CAChD,WAAW;CACX,cAAc,yBAAyB,UAAU;CACjD,SAAS,EAAE,MAAM,gBAAgB,CAAC,QAAQ,EAAE,CAAC;CAC7C,YAAY,qBAAqB,UAAU;CAC3C,MAAM;CACN,SAAS,EAAE,QAAQ,CAAC,IAAI,EAAE;CAC1B,kBAAkB,EAAE,QAAQ,CAAC,UAAU;CACvC,KAAK,yBAAyB,UAAU;CACxC,CAAC,CACD,QAAQ"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-DKBSYuxW.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,OA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["../src/portable-contracts/portable-contract-runtime.ts"],"sourcesContent":["import { z } from 'zod';\n\nimport {\n\tArtifactReferenceSchema,\n\tPortalArtifactReadRequestSchema,\n\tPortalArtifactReadResultSchema,\n} from '../artifact-surface/index.js';\nimport { JsonValueSchema } from '../contract-primitives/index.js';\nimport {\n\tGatewayRuntimeAttachmentMetadataSchema,\n\tGatewayRuntimeTrustedInvocationContextSchema,\n\tManagedAgentProjectionSchema,\n\tSANDBOX_METHOD_CONTRACTS,\n\tSandboxOperationControlResultSchema,\n\tSandboxOperationIdentitySchema,\n\tSandboxRetainedResultLookupRequestSchema,\n\tSandboxRetainedResultLookupResultSchema,\n} from '../contracts/index.js';\nimport {\n\tPortalCallItemResultSchema,\n\tPortalCallRequestSchema,\n\tPortalCallResultSchema,\n\tPortalDescribeRequestSchema,\n\tPortalDescribeResultSchema,\n\tPortalListRequestSchema,\n\tPortalListResultSchema,\n\tPortalSearchRequestSchema,\n\tPortalSearchResultSchema,\n} from '../portal-call-surface/index.js';\nimport { PortalProgressEventSchema } from '../portal-event-surface/index.js';\nimport { portableRefinementIdentityForCheck } from './portable-refinement-authoring.js';\nimport { PORTABLE_REFINEMENT_IDENTITIES } from './portable-refinement-descriptors.js';\nexport {\n\tPORTABLE_REFINEMENT_DESCRIPTORS,\n\tPORTABLE_REFINEMENT_IDENTITIES,\n} from './portable-refinement-descriptors.js';\n\ninterface PortableAcceptedContractParseResult {\n\treadonly kind: 'accepted';\n\treadonly normalized: unknown;\n\treadonly refinementIdentities: readonly string[];\n}\n\ninterface PortableRejectedContractParseResult {\n\treadonly errorCodes: readonly string[];\n\treadonly kind: 'rejected';\n\treadonly refinementIdentities: readonly string[];\n}\n\nexport type PortableContractParseResult =\n\t| PortableAcceptedContractParseResult\n\t| PortableRejectedContractParseResult;\n\nexport interface PortableContractAdapter {\n\treadonly parse: (input: unknown) => PortableContractParseResult;\n}\n\nexport const PORTABLE_CONTRACT_PROTOCOL_VERSION = 1;\n\ninterface PortableContractDefinition {\n\treadonly refinementIdentities: readonly string[];\n\treadonly resolveRefinementIdentities?: (props: {\n\t\treadonly input: unknown;\n\t\treadonly parseSucceeded: boolean;\n\t}) => readonly string[];\n\treadonly schema: z.ZodType;\n}\n\ninterface PortableSchemaExportabilityProps {\n\treadonly schema: z.ZodType;\n\treadonly schemaId: string;\n}\n\nfunction isUnknownRecord(value: unknown): value is Record<string, unknown> {\n\treturn typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nfunction isZodSchema(value: unknown): value is z.ZodType {\n\treturn isUnknownRecord(value) && isUnknownRecord(value['_zod']) && 'def' in value['_zod'];\n}\n\nfunction containsUnsafeInteger(value: unknown): boolean {\n\tif (typeof value === 'number') return Number.isInteger(value) && !Number.isSafeInteger(value);\n\tif (Array.isArray(value)) return value.some((item) => containsUnsafeInteger(item));\n\tif (isUnknownRecord(value)) {\n\t\treturn Object.values(value).some((childValue) => containsUnsafeInteger(childValue));\n\t}\n\treturn false;\n}\n\nfunction inspectPortableSchemaNode(props: {\n\treadonly node: unknown;\n\treadonly schemaId: string;\n\treadonly visited: Set<object>;\n}): void {\n\tif ((typeof props.node !== 'object' && typeof props.node !== 'function') || props.node === null) {\n\t\treturn;\n\t}\n\tif (props.visited.has(props.node)) {\n\t\treturn;\n\t}\n\tprops.visited.add(props.node);\n\n\tif (isZodSchema(props.node)) {\n\t\t// oxlint-disable-next-line no-underscore-dangle -- Zod v4 core definitions are required for the portable-authoring structural guard.\n\t\tconst definition: unknown = props.node._zod.def;\n\t\tif (isUnknownRecord(definition) && definition['type'] === 'transform') {\n\t\t\tthrow new Error(\n\t\t\t\t`Portable schema ${props.schemaId} contains an anonymous or unregistered transform.`,\n\t\t\t);\n\t\t}\n\t\tif (isUnknownRecord(definition) && Array.isArray(definition['checks'])) {\n\t\t\tfor (const check of definition['checks']) {\n\t\t\t\tif (\n\t\t\t\t\tisUnknownRecord(check) &&\n\t\t\t\t\tisUnknownRecord(check['_zod']) &&\n\t\t\t\t\tisUnknownRecord(check['_zod']['def']) &&\n\t\t\t\t\tcheck['_zod']['def']['check'] === 'custom'\n\t\t\t\t) {\n\t\t\t\t\tif (portableRefinementIdentityForCheck(check) !== undefined) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t`Portable schema ${props.schemaId} contains an anonymous or unregistered refinement.`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tinspectPortableSchemaNode({\n\t\t\tnode: definition,\n\t\t\tschemaId: props.schemaId,\n\t\t\tvisited: props.visited,\n\t\t});\n\t\treturn;\n\t}\n\n\tif (Array.isArray(props.node)) {\n\t\tfor (const child of props.node) {\n\t\t\tinspectPortableSchemaNode({ node: child, schemaId: props.schemaId, visited: props.visited });\n\t\t}\n\t\treturn;\n\t}\n\n\tfor (const child of Object.values(props.node)) {\n\t\tinspectPortableSchemaNode({ node: child, schemaId: props.schemaId, visited: props.visited });\n\t}\n}\n\nexport function assertPortableContractSchemaIsExportable(\n\tprops: PortableSchemaExportabilityProps,\n): void {\n\tinspectPortableSchemaNode({ node: props.schema, schemaId: props.schemaId, visited: new Set() });\n}\n\nfunction normalizeCanonicalJsonValue(value: unknown): unknown {\n\tif (typeof value === 'number') {\n\t\treturn Object.is(value, -0) ? 0 : value;\n\t}\n\tif (Array.isArray(value)) {\n\t\treturn value.map((item) => normalizeCanonicalJsonValue(item));\n\t}\n\tif (isUnknownRecord(value)) {\n\t\treturn Object.fromEntries(\n\t\t\tObject.entries(value)\n\t\t\t\t.toSorted(([leftKey], [rightKey]) => leftKey.localeCompare(rightKey))\n\t\t\t\t.map(([key, childValue]) => [key, normalizeCanonicalJsonValue(childValue)]),\n\t\t);\n\t}\n\treturn value;\n}\n\nexport function encodeCanonicalJson(value: unknown): string {\n\tconst encodedValue = JSON.stringify(normalizeCanonicalJsonValue(value));\n\tif (encodedValue === undefined) {\n\t\tthrow new Error('Canonical JSON input must be JSON-serializable.');\n\t}\n\treturn encodedValue;\n}\n\nfunction mapPortableIssue(props: {\n\treadonly input: unknown;\n\treadonly issue: z.core.$ZodIssue;\n\treadonly schemaId: string;\n}): string {\n\tif (props.schemaId === 'portal.call.item-result') {\n\t\tconst firstPathSegment = props.issue.path?.[0];\n\t\tif (\n\t\t\tfirstPathSegment === 'outcome' ||\n\t\t\tfirstPathSegment === 'operationId' ||\n\t\t\tfirstPathSegment === 'owningGeneration'\n\t\t) {\n\t\t\treturn 'portal.result.outcome-algebra';\n\t\t}\n\t\tif (props.issue.code === 'unrecognized_keys' || props.issue.code === 'invalid_union') {\n\t\t\treturn 'portal.result.status-shape';\n\t\t}\n\t}\n\n\tif (props.issue.code === 'unrecognized_keys') {\n\t\treturn 'portable.object.unknown-field';\n\t}\n\tif (\n\t\tprops.issue.code === 'invalid_type' &&\n\t\tprops.issue.path?.length === 1 &&\n\t\tisUnknownRecord(props.input) &&\n\t\ttypeof props.issue.path[0] === 'string' &&\n\t\t!(props.issue.path[0] in props.input)\n\t) {\n\t\treturn 'portable.object.missing-field';\n\t}\n\tif (\n\t\tprops.issue.code === 'invalid_format' &&\n\t\t'format' in props.issue &&\n\t\tprops.issue.format === 'starts_with'\n\t) {\n\t\treturn 'portable.string.pattern';\n\t}\n\tif (props.issue.code === 'too_big' && props.issue.origin === 'number') {\n\t\treturn 'portable.number.above-maximum';\n\t}\n\tif (props.issue.code === 'custom') {\n\t\tif (props.issue.message.includes('decoded canonical base64 content')) {\n\t\t\treturn 'sandbox.binary-chunk.byte-length-mismatch';\n\t\t}\n\t\tif (props.issue.message.includes('duplicate variable name')) {\n\t\t\treturn 'sandbox.environment-variable.duplicate-name';\n\t\t}\n\t\tif (props.issue.message.includes('duplicate configured agent id')) {\n\t\t\treturn 'gateway.attachment.duplicate-agent-id';\n\t\t}\n\t\tif (props.issue.message.includes('server-selected work root')) {\n\t\t\treturn 'sandbox.path.not-work-relative';\n\t\t}\n\t\tif (props.issue.message.startsWith('Duplicate portal item id')) {\n\t\t\treturn 'portal.batch.unique-item-ids';\n\t\t}\n\t\tif (props.issue.message.includes('reserved object property name')) {\n\t\t\treturn 'portal.request-id.not-reserved';\n\t\t}\n\t\tif (props.issue.message.includes('maximum number of entries')) {\n\t\t\treturn 'portable.object.above-maximum';\n\t\t}\n\t\tif (props.issue.message.includes('ok must match item statuses')) {\n\t\t\treturn 'portal.result.aggregate-status';\n\t\t}\n\t}\n\treturn `portable.zod.${props.issue.code}`;\n}\n\nfunction createPortableContractAdapter(props: {\n\treadonly definition: PortableContractDefinition;\n\treadonly schemaId: string;\n}): PortableContractAdapter {\n\treturn {\n\t\tparse: (input): PortableContractParseResult => {\n\t\t\tif (containsUnsafeInteger(input)) {\n\t\t\t\treturn {\n\t\t\t\t\terrorCodes: ['portable.number.unsafe-integer'],\n\t\t\t\t\tkind: 'rejected',\n\t\t\t\t\trefinementIdentities: [\n\t\t\t\t\t\t...new Set([...props.definition.refinementIdentities, 'portal.number.safe-integer']),\n\t\t\t\t\t].toSorted((leftIdentity, rightIdentity) => leftIdentity.localeCompare(rightIdentity)),\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst parsed = props.definition.schema.safeParse(input);\n\t\t\tconst refinementIdentities = (\n\t\t\t\tprops.definition.resolveRefinementIdentities?.({\n\t\t\t\t\tinput,\n\t\t\t\t\tparseSucceeded: parsed.success,\n\t\t\t\t}) ?? props.definition.refinementIdentities\n\t\t\t).toSorted((leftIdentity, rightIdentity) => leftIdentity.localeCompare(rightIdentity));\n\t\t\tif (!parsed.success) {\n\t\t\t\tconst errorCodes =\n\t\t\t\t\tprops.schemaId === 'portal.call.item-result' &&\n\t\t\t\t\tisUnknownRecord(input) &&\n\t\t\t\t\tcallItemHasStatusShapeConflict(input)\n\t\t\t\t\t\t? ['portal.result.status-shape']\n\t\t\t\t\t\t: [\n\t\t\t\t\t\t\t\t...new Set(\n\t\t\t\t\t\t\t\t\tparsed.error.issues.map((issue) =>\n\t\t\t\t\t\t\t\t\t\tmapPortableIssue({ input, issue, schemaId: props.schemaId }),\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t].toSorted((leftCode, rightCode) => leftCode.localeCompare(rightCode));\n\t\t\t\treturn {\n\t\t\t\t\terrorCodes,\n\t\t\t\t\tkind: 'rejected',\n\t\t\t\t\trefinementIdentities,\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tkind: 'accepted',\n\t\t\t\tnormalized: normalizeCanonicalJsonValue(parsed.data),\n\t\t\t\trefinementIdentities,\n\t\t\t};\n\t\t},\n\t};\n}\n\nfunction callItemHasStatusShapeConflict(input: Record<string, unknown>): boolean {\n\treturn (\n\t\t(input['status'] === 'ok' && 'error' in input) ||\n\t\t(input['status'] === 'error' && 'value' in input)\n\t);\n}\n\nconst portableContractDefinitions = {\n\t'portal.artifact.read-request': {\n\t\trefinementIdentities: [],\n\t\tschema: PortalArtifactReadRequestSchema,\n\t},\n\t'portal.artifact.read-result': {\n\t\trefinementIdentities: ['portal.artifact-read.default-truncated'],\n\t\tschema: PortalArtifactReadResultSchema,\n\t},\n\t'portal.artifact.reference': {\n\t\trefinementIdentities: [],\n\t\tschema: ArtifactReferenceSchema,\n\t},\n\t'portal.call.item-result': {\n\t\trefinementIdentities: ['portal.request-id.not-reserved', 'portal.result.outcome-algebra'],\n\t\tresolveRefinementIdentities: ({ input }): readonly string[] => {\n\t\t\treturn isUnknownRecord(input) &&\n\t\t\t\t!callItemHasStatusShapeConflict(input) &&\n\t\t\t\t('outcome' in input || !('operationId' in input))\n\t\t\t\t? ['portal.request-id.not-reserved', 'portal.result.outcome-algebra']\n\t\t\t\t: ['portal.request-id.not-reserved'];\n\t\t},\n\t\tschema: PortalCallItemResultSchema,\n\t},\n\t'portal.call.request': {\n\t\trefinementIdentities: [\n\t\t\t'portal.batch.unique-item-ids',\n\t\t\t'portal.json.canonical',\n\t\t\t'portal.request-id.not-reserved',\n\t\t],\n\t\tresolveRefinementIdentities: ({ parseSucceeded }): readonly string[] => {\n\t\t\treturn parseSucceeded\n\t\t\t\t? [\n\t\t\t\t\t\t'portal.batch.unique-item-ids',\n\t\t\t\t\t\t'portal.json.canonical',\n\t\t\t\t\t\t'portal.request-id.not-reserved',\n\t\t\t\t\t]\n\t\t\t\t: ['portal.batch.unique-item-ids', 'portal.request-id.not-reserved'];\n\t\t},\n\t\tschema: PortalCallRequestSchema,\n\t},\n\t'portal.call.result': {\n\t\trefinementIdentities: [\n\t\t\t'portal.request-id.not-reserved',\n\t\t\t'portal.result.aggregate-status',\n\t\t\t'portal.result.outcome-algebra',\n\t\t],\n\t\tschema: PortalCallResultSchema,\n\t},\n\t'portal.describe.request': {\n\t\trefinementIdentities: [\n\t\t\t'portal.batch.unique-item-ids',\n\t\t\t'portal.describe.default-includes',\n\t\t\t'portal.request-id.not-reserved',\n\t\t],\n\t\tschema: PortalDescribeRequestSchema,\n\t},\n\t'portal.describe.result': {\n\t\trefinementIdentities: ['portal.request-id.not-reserved', 'portal.result.aggregate-status'],\n\t\tschema: PortalDescribeResultSchema,\n\t},\n\t'portal.json-value': {\n\t\trefinementIdentities: ['portal.json.canonical', 'portal.json.max-object-entries'],\n\t\tresolveRefinementIdentities: ({ input }): readonly string[] => {\n\t\t\treturn isUnknownRecord(input) && Object.keys(input).length > 1_000\n\t\t\t\t? ['portal.json.canonical', 'portal.json.max-object-entries']\n\t\t\t\t: ['portal.json.canonical'];\n\t\t},\n\t\tschema: JsonValueSchema,\n\t},\n\t'portal.list.request': {\n\t\trefinementIdentities: [\n\t\t\t'portal.batch.unique-item-ids',\n\t\t\t'portal.list.default-limit',\n\t\t\t'portal.request-id.not-reserved',\n\t\t],\n\t\tschema: PortalListRequestSchema,\n\t},\n\t'portal.list.result': {\n\t\trefinementIdentities: ['portal.request-id.not-reserved', 'portal.result.aggregate-status'],\n\t\tschema: PortalListResultSchema,\n\t},\n\t'portal.progress.event': {\n\t\trefinementIdentities: ['portal.request-id.not-reserved'],\n\t\tschema: PortalProgressEventSchema,\n\t},\n\t'portal.search.request': {\n\t\trefinementIdentities: [\n\t\t\t'portal.batch.unique-item-ids',\n\t\t\t'portal.request-id.not-reserved',\n\t\t\t'portal.search.default-limit',\n\t\t\t'portal.search.default-schema-detail',\n\t\t],\n\t\tschema: PortalSearchRequestSchema,\n\t},\n\t'portal.search.result': {\n\t\trefinementIdentities: ['portal.request-id.not-reserved', 'portal.result.aggregate-status'],\n\t\tschema: PortalSearchResultSchema,\n\t},\n} as const satisfies Readonly<Record<string, PortableContractDefinition>>;\n\nconst canonicalGatewayContractDefinitions = {\n\t'gateway.attachment.metadata': {\n\t\trefinementIdentities: ['gateway.attachment.unique-agent-ids'],\n\t\tschema: GatewayRuntimeAttachmentMetadataSchema,\n\t},\n\t'gateway.managed-agent-projection': {\n\t\trefinementIdentities: [],\n\t\tschema: ManagedAgentProjectionSchema,\n\t},\n\t'gateway.trusted-invocation-context': {\n\t\trefinementIdentities: [],\n\t\tschema: GatewayRuntimeTrustedInvocationContextSchema,\n\t},\n\t'sandbox.operation.control-result': {\n\t\trefinementIdentities: ['portal.result.outcome-algebra'],\n\t\tschema: SandboxOperationControlResultSchema,\n\t},\n\t'sandbox.operation.identity': {\n\t\trefinementIdentities: [],\n\t\tschema: SandboxOperationIdentitySchema,\n\t},\n\t'sandbox.retained-result.lookup-request': {\n\t\trefinementIdentities: [],\n\t\tschema: SandboxRetainedResultLookupRequestSchema,\n\t},\n\t'sandbox.retained-result.lookup-result': {\n\t\trefinementIdentities: ['portal.result.outcome-algebra'],\n\t\tschema: SandboxRetainedResultLookupResultSchema,\n\t},\n} as const satisfies Readonly<Record<string, PortableContractDefinition>>;\n\ninterface SandboxMethodPortableContractMetadata {\n\treadonly requestRefinementIdentities: readonly string[];\n\treadonly requestSchemaId: string;\n\treadonly resultRefinementIdentities: readonly string[];\n\treadonly resultSchemaId: string;\n}\n\nfunction resolveSandboxMethodPortableContractMetadata(props: {\n\treadonly method: string;\n\treadonly requestOnlyRefinementIdentities: readonly string[];\n\treadonly sharedRefinementIdentities: readonly string[];\n}): SandboxMethodPortableContractMetadata {\n\tif (props.method === 'sandbox.retained-result.lookup') {\n\t\treturn {\n\t\t\trequestRefinementIdentities: [\n\t\t\t\t...props.sharedRefinementIdentities,\n\t\t\t\t...props.requestOnlyRefinementIdentities,\n\t\t\t],\n\t\t\trequestSchemaId: 'sandbox.retained-result.lookup-request',\n\t\t\tresultRefinementIdentities: [\n\t\t\t\t...props.sharedRefinementIdentities,\n\t\t\t\t'portal.result.outcome-algebra',\n\t\t\t],\n\t\t\tresultSchemaId: 'sandbox.retained-result.lookup-result',\n\t\t};\n\t}\n\treturn {\n\t\trequestRefinementIdentities: [\n\t\t\t...props.sharedRefinementIdentities,\n\t\t\t...props.requestOnlyRefinementIdentities,\n\t\t],\n\t\trequestSchemaId: `${props.method}.request`,\n\t\tresultRefinementIdentities: props.sharedRefinementIdentities,\n\t\tresultSchemaId: `${props.method}.result`,\n\t};\n}\n\nfunction createSandboxMethodContractDefinitions(): Readonly<\n\tRecord<string, PortableContractDefinition>\n> {\n\tconst contractDefinitions: Record<string, PortableContractDefinition> = {};\n\tfor (const [method, contracts] of Object.entries(SANDBOX_METHOD_CONTRACTS)) {\n\t\tconst refinementIdentities: string[] = method.startsWith('sandbox.environment.')\n\t\t\t? ['sandbox.path.work-relative']\n\t\t\t: [];\n\t\tconst requestOnlyRefinementIdentities =\n\t\t\tmethod === 'sandbox.exec.start' || method === 'sandbox.process.start'\n\t\t\t\t? ['sandbox.environment-variable.unique-names']\n\t\t\t\t: [];\n\t\tif (\n\t\t\t[\n\t\t\t\t'sandbox.fs.read',\n\t\t\t\t'sandbox.fs.write',\n\t\t\t\t'sandbox.process.logs',\n\t\t\t\t'sandbox.stream.read',\n\t\t\t\t'sandbox.stream.write',\n\t\t\t].includes(method)\n\t\t) {\n\t\t\trefinementIdentities.push('sandbox.binary-chunk.byte-length');\n\t\t}\n\t\tconst metadata = resolveSandboxMethodPortableContractMetadata({\n\t\t\tmethod,\n\t\t\trequestOnlyRefinementIdentities,\n\t\t\tsharedRefinementIdentities: refinementIdentities,\n\t\t});\n\t\tcontractDefinitions[metadata.requestSchemaId] = {\n\t\t\trefinementIdentities: metadata.requestRefinementIdentities,\n\t\t\tschema: contracts.request,\n\t\t};\n\t\tcontractDefinitions[metadata.resultSchemaId] = {\n\t\t\trefinementIdentities: metadata.resultRefinementIdentities,\n\t\t\tschema: contracts.result,\n\t\t};\n\t}\n\treturn contractDefinitions;\n}\n\nconst sandboxMethodContractDefinitions = createSandboxMethodContractDefinitions();\n\nconst allPortableContractDefinitions: Readonly<Record<string, PortableContractDefinition>> = {\n\t...portableContractDefinitions,\n\t...canonicalGatewayContractDefinitions,\n\t...sandboxMethodContractDefinitions,\n};\n\nfor (const [schemaId, definition] of Object.entries(allPortableContractDefinitions)) {\n\tassertPortableContractSchemaIsExportable({ schema: definition.schema, schemaId });\n}\n\nexport function createPortableContractSchemaManifest(): Readonly<Record<string, unknown>> {\n\treturn {\n\t\tprotocolVersion: PORTABLE_CONTRACT_PROTOCOL_VERSION,\n\t\trefinements: PORTABLE_REFINEMENT_IDENTITIES,\n\t\tschemas: Object.fromEntries(\n\t\t\tObject.entries(allPortableContractDefinitions).map(([schemaId, definition]) => [\n\t\t\t\tschemaId,\n\t\t\t\t{\n\t\t\t\t\tjsonSchema: z.toJSONSchema(definition.schema, {\n\t\t\t\t\t\tio: 'input',\n\t\t\t\t\t\tunrepresentable: 'any',\n\t\t\t\t\t}),\n\t\t\t\t\trefinementIdentities: definition.refinementIdentities.toSorted(\n\t\t\t\t\t\t(leftIdentity, rightIdentity) => leftIdentity.localeCompare(rightIdentity),\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t]),\n\t\t),\n\t};\n}\n\nexport const PORTABLE_CONTRACT_ADAPTERS = Object.fromEntries(\n\tObject.entries(allPortableContractDefinitions).map(([schemaId, definition]) => [\n\t\tschemaId,\n\t\tcreatePortableContractAdapter({ definition, schemaId }),\n\t]),\n) satisfies Readonly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CAAC,UAAU,gBAAgB,CAC9E,UACA;GACC,YAAY,EAAE,aAAa,WAAW,QAAQ;IAC7C,IAAI;IACJ,iBAAiB;IACjB,CAAC;GACF,sBAAsB,WAAW,qBAAqB,UACpD,cAAc,kBAAkB,aAAa,cAAc,cAAc,CAC1E;GACD,CACD,CAAC,CACF;EACD;;AAGF,MAAa,6BAA6B,OAAO,YAChD,OAAO,QAAQ,+BAA+B,CAAC,KAAK,CAAC,UAAU,gBAAgB,CAC9E,UACA,8BAA8B;CAAE;CAAY;CAAU,CAAC,CACvD,CAAC,CACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"portable-refinement-authoring-ZSmR-amG.js","names":[],"sources":["../src/portable-contracts/portable-refinement-descriptors.ts","../src/portable-contracts/portable-refinement-authoring.ts"],"sourcesContent":["export type PortableRefinementKind =\n\t| 'canonical-normalization'\n\t| 'cross-field-validation'\n\t| 'default'\n\t| 'structural-validation';\n\nexport type PortableRefinementOperation =\n\t| {\n\t\t\treadonly kind: 'aggregate-status';\n\t\t\treadonly itemsField: string;\n\t\t\treadonly okField: string;\n\t }\n\t| { readonly kind: 'decoded-base64-byte-length' }\n\t| {\n\t\t\treadonly collectionPaths: readonly string[];\n\t\t\treadonly fieldName: string;\n\t\t\treadonly kind: 'unique-field';\n\t }\n\t| {\n\t\t\treadonly kind: 'default-values';\n\t\t\treadonly values: Readonly<Record<string, boolean | number | string>>;\n\t }\n\t| {\n\t\t\treadonly kind: 'canonical-json';\n\t\t\treadonly maximumArrayItems: number;\n\t\t\treadonly maximumObjectEntries: number;\n\t\t\treadonly maximumObjectKeyCharacters: number;\n\t\t\treadonly maximumStringCharacters: number;\n\t }\n\t| {\n\t\t\treadonly kind: 'maximum-object-entries';\n\t\t\treadonly maximum: number;\n\t }\n\t| {\n\t\t\treadonly fieldNames: readonly string[];\n\t\t\treadonly kind: 'reject-reserved-values';\n\t\t\treadonly values: readonly string[];\n\t }\n\t| {\n\t\t\treadonly kind: 'safe-integer';\n\t\t\treadonly maximum: number;\n\t\t\treadonly minimum: number;\n\t }\n\t| { readonly kind: 'terminal-outcome-algebra' }\n\t| { readonly kind: 'unique-string-items'; readonly path: string }\n\t| { readonly fieldNames: readonly string[]; readonly kind: 'work-relative-path' };\n\nexport interface PortableRefinementDescriptor {\n\treadonly description: string;\n\treadonly errorCode?: string;\n\treadonly identity: string;\n\treadonly kind: PortableRefinementKind;\n\treadonly operation: PortableRefinementOperation;\n}\n\nexport const PORTABLE_REFINEMENT_DESCRIPTORS = [\n\t{\n\t\tdescription: 'Artifact reads default omitted truncation state to false.',\n\t\tidentity: 'portal.artifact-read.default-truncated',\n\t\tkind: 'default',\n\t\toperation: { kind: 'default-values', values: { '/truncated': false } },\n\t},\n\t{\n\t\tdescription: 'Every item id in one portal batch must be unique.',\n\t\terrorCode: 'portal.batch.unique-item-ids',\n\t\tidentity: 'portal.batch.unique-item-ids',\n\t\tkind: 'cross-field-validation',\n\t\toperation: { collectionPaths: ['calls', 'requests'], fieldName: 'id', kind: 'unique-field' },\n\t},\n\t{\n\t\tdescription: 'Describe requests apply the portable inclusion defaults.',\n\t\tidentity: 'portal.describe.default-includes',\n\t\tkind: 'default',\n\t\toperation: {\n\t\t\tkind: 'default-values',\n\t\t\tvalues: {\n\t\t\t\t'/requests/*/includeJsonSchema': true,\n\t\t\t\t'/requests/*/includeRelated': true,\n\t\t\t\t'/requests/*/includeTypescriptHelper': false,\n\t\t\t\t'/requests/*/includeZod': false,\n\t\t\t},\n\t\t},\n\t},\n\t{\n\t\tdescription: 'JSON values use sorted object keys and normalize negative zero.',\n\t\tidentity: 'portal.json.canonical',\n\t\tkind: 'canonical-normalization',\n\t\toperation: {\n\t\t\tkind: 'canonical-json',\n\t\t\tmaximumArrayItems: 1_000,\n\t\t\tmaximumObjectEntries: 1_000,\n\t\t\tmaximumObjectKeyCharacters: 256,\n\t\t\tmaximumStringCharacters: 64 * 1_024,\n\t\t},\n\t},\n\t{\n\t\tdescription: 'JSON objects cannot contain more than one thousand entries.',\n\t\terrorCode: 'portable.object.above-maximum',\n\t\tidentity: 'portal.json.max-object-entries',\n\t\tkind: 'structural-validation',\n\t\toperation: { kind: 'maximum-object-entries', maximum: 1_000 },\n\t},\n\t{\n\t\tdescription: 'List requests default omitted limits to twenty items.',\n\t\tidentity: 'portal.list.default-limit',\n\t\tkind: 'default',\n\t\toperation: { kind: 'default-values', values: { '/requests/*/limit': 20 } },\n\t},\n\t{\n\t\tdescription: 'Portable integer values remain inside the interoperable safe-integer range.',\n\t\terrorCode: 'portable.number.unsafe-integer',\n\t\tidentity: 'portal.number.safe-integer',\n\t\tkind: 'structural-validation',\n\t\toperation: {\n\t\t\tkind: 'safe-integer',\n\t\t\tmaximum: Number.MAX_SAFE_INTEGER,\n\t\t\tminimum: Number.MIN_SAFE_INTEGER,\n\t\t},\n\t},\n\t{\n\t\tdescription: 'Portal request ids cannot use reserved object property names.',\n\t\terrorCode: 'portal.request-id.not-reserved',\n\t\tidentity: 'portal.request-id.not-reserved',\n\t\tkind: 'structural-validation',\n\t\toperation: {\n\t\t\tfieldNames: ['id', 'requestId'],\n\t\t\tkind: 'reject-reserved-values',\n\t\t\tvalues: ['__proto__', 'constructor', 'prototype'],\n\t\t},\n\t},\n\t{\n\t\tdescription: 'Aggregate success must equal the success of every result item.',\n\t\terrorCode: 'portal.result.aggregate-status',\n\t\tidentity: 'portal.result.aggregate-status',\n\t\tkind: 'cross-field-validation',\n\t\toperation: { itemsField: 'items', kind: 'aggregate-status', okField: 'ok' },\n\t},\n\t{\n\t\tdescription: 'Call results use the normative terminal outcome algebra.',\n\t\terrorCode: 'portal.result.outcome-algebra',\n\t\tidentity: 'portal.result.outcome-algebra',\n\t\tkind: 'structural-validation',\n\t\toperation: { kind: 'terminal-outcome-algebra' },\n\t},\n\t{\n\t\tdescription: 'Search requests default omitted limits to ten items.',\n\t\tidentity: 'portal.search.default-limit',\n\t\tkind: 'default',\n\t\toperation: { kind: 'default-values', values: { '/requests/*/limit': 10 } },\n\t},\n\t{\n\t\tdescription: 'Search requests default omitted schema detail to summary.',\n\t\tidentity: 'portal.search.default-schema-detail',\n\t\tkind: 'default',\n\t\toperation: {\n\t\t\tkind: 'default-values',\n\t\t\tvalues: { '/requests/*/schemaDetail': 'summary' },\n\t\t},\n\t},\n\t{\n\t\tdescription: 'Gateway attachment metadata cannot repeat an admitted agent identity.',\n\t\terrorCode: 'gateway.attachment.duplicate-agent-id',\n\t\tidentity: 'gateway.attachment.unique-agent-ids',\n\t\tkind: 'cross-field-validation',\n\t\toperation: { kind: 'unique-string-items', path: 'configuredAgentIds' },\n\t},\n\t{\n\t\tdescription: 'Binary chunk byte length equals the decoded canonical base64 payload length.',\n\t\terrorCode: 'sandbox.binary-chunk.byte-length-mismatch',\n\t\tidentity: 'sandbox.binary-chunk.byte-length',\n\t\tkind: 'cross-field-validation',\n\t\toperation: { kind: 'decoded-base64-byte-length' },\n\t},\n\t{\n\t\tdescription: 'Direct Sandbox environment variable names must be unique.',\n\t\terrorCode: 'sandbox.environment-variable.duplicate-name',\n\t\tidentity: 'sandbox.environment-variable.unique-names',\n\t\tkind: 'cross-field-validation',\n\t\toperation: {\n\t\t\tcollectionPaths: ['environmentVariables'],\n\t\t\tfieldName: 'name',\n\t\t\tkind: 'unique-field',\n\t\t},\n\t},\n\t{\n\t\tdescription: 'Sandbox paths are relative to the server-selected work root.',\n\t\terrorCode: 'sandbox.path.not-work-relative',\n\t\tidentity: 'sandbox.path.work-relative',\n\t\tkind: 'structural-validation',\n\t\toperation: {\n\t\t\tfieldNames: ['destinationPath', 'logicalCwd', 'path', 'sourcePath'],\n\t\t\tkind: 'work-relative-path',\n\t\t},\n\t},\n] as const satisfies readonly PortableRefinementDescriptor[];\n\nexport const PORTABLE_REFINEMENT_IDENTITIES: readonly string[] =\n\tPORTABLE_REFINEMENT_DESCRIPTORS.map((descriptor) => descriptor.identity).toSorted(\n\t\t(leftIdentity, rightIdentity) => leftIdentity.localeCompare(rightIdentity),\n\t);\n","import type { z } from 'zod';\n\nimport { PORTABLE_REFINEMENT_DESCRIPTORS } from './portable-refinement-descriptors.js';\n\nconst portableRefinementIdentities: ReadonlySet<string> = new Set(\n\tPORTABLE_REFINEMENT_DESCRIPTORS.map((descriptor) => descriptor.identity),\n);\nconst portableRefinementIdentityByCheck = new WeakMap<object, string>();\n\nexport interface PortableSuperRefinementProps<TSchema extends z.ZodType> {\n\treadonly refinement: (value: z.output<TSchema>, context: z.RefinementCtx) => void;\n\treadonly refinementIdentity: string;\n\treadonly schema: TSchema;\n}\n\nexport function withPortableSuperRefinement<TSchema extends z.ZodType>(\n\tprops: PortableSuperRefinementProps<TSchema>,\n): TSchema {\n\tif (!portableRefinementIdentities.has(props.refinementIdentity)) {\n\t\tthrow new Error(`Portable refinement ${props.refinementIdentity} is not registered.`);\n\t}\n\t// oxlint-disable-next-line no-underscore-dangle -- Zod v4 exposes schema definitions through its library-author core contract.\n\tconst existingChecks = new Set(props.schema._zod.def.checks ?? []);\n\tconst refinedSchema = props.schema.superRefine(props.refinement);\n\t// oxlint-disable-next-line no-underscore-dangle -- Match the one check added by the named authoring helper.\n\tconst addedChecks = (refinedSchema._zod.def.checks ?? []).filter(\n\t\t(check) => !existingChecks.has(check),\n\t);\n\tif (addedChecks.length !== 1) {\n\t\tthrow new Error(\n\t\t\t`Portable refinement ${props.refinementIdentity} must add exactly one Zod check.`,\n\t\t);\n\t}\n\tconst addedCheck = addedChecks[0];\n\tif (addedCheck === undefined) {\n\t\tthrow new Error(`Portable refinement ${props.refinementIdentity} added no Zod check.`);\n\t}\n\tportableRefinementIdentityByCheck.set(addedCheck, props.refinementIdentity);\n\treturn refinedSchema;\n}\n\nexport function portableRefinementIdentityForCheck(check: object): string | undefined {\n\treturn portableRefinementIdentityByCheck.get(check);\n}\n"],"mappings":";AAuDA,MAAa,kCAAkC;CAC9C;EACC,aAAa;EACb,UAAU;EACV,MAAM;EACN,WAAW;GAAE,MAAM;GAAkB,QAAQ,EAAE,cAAc,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AAmB,sBAAsB;CAEvF,kCAAkC,IAAI,YAAY,MAAM,mBAAmB;CAC3E,OAAO;;AAGR,SAAgB,mCAAmC,OAAmC;CACrF,OAAO,kCAAkC,IAAI,MAAM"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"portal-error-schema-CQHgoFq4.js","names":[],"sources":["../src/contract-primitives/models/request-id-schema.ts","../src/portal-event-surface/models/safe-diagnostic-schema.ts","../src/portal-call-surface/models/portal-error-schema.ts"],"sourcesContent":["import { z } from 'zod';\n\nimport { withPortableSuperRefinement } from '../../portable-contracts/portable-refinement-authoring.js';\n\nconst reservedRequestIds = new Set(['__proto__', 'constructor', 'prototype']);\n\nexport const RequestIdSchema = withPortableSuperRefinement({\n\trefinement: (id, context) => {\n\t\tif (reservedRequestIds.has(id)) {\n\t\t\tcontext.addIssue({\n\t\t\t\tcode: 'custom',\n\t\t\t\tmessage: 'Portal request id uses a reserved object property name.',\n\t\t\t});\n\t\t}\n\t},\n\trefinementIdentity: 'portal.request-id.not-reserved',\n\tschema: z.string().min(1),\n});\n\nexport const ItemIdSchema = RequestIdSchema;\n","import { z } from 'zod';\n\nexport const SafeDiagnosticCodeSchema = z.enum([\n\t'provider_unavailable',\n\t'capability_denied',\n\t'approval_required',\n\t'validation_failed',\n\t'execution_failed',\n\t'output_truncated',\n\t'timeout',\n\t'cancelled',\n\t'artifact_unavailable',\n]);\n\nexport const SafeDiagnosticSchema = z\n\t.object({\n\t\tcode: SafeDiagnosticCodeSchema,\n\t\tlevel: z.enum(['debug', 'info', 'warn', 'error']),\n\t\tsafeMessage: z.string().max(500),\n\t\tsafeParams: z.record(z.string(), z.union([z.string(), z.number(), z.boolean()])).optional(),\n\t})\n\t.strict();\n\nexport type SafeDiagnostic = z.infer<typeof SafeDiagnosticSchema>;\n","import { z } from 'zod';\n\nimport { SafeDiagnosticSchema } from '../../portal-event-surface/models/safe-diagnostic-schema.js';\n\nexport const PortalErrorCodeSchema = z.enum([\n\t'invalid_request',\n\t'not_found',\n\t'not_authorized',\n\t'approval_required',\n\t'capability_denied',\n\t'validation_failed',\n\t'provider_unavailable',\n\t'execution_failed',\n\t'cancelled',\n\t'timeout',\n]);\n\nexport type PortalErrorCode = z.infer<typeof PortalErrorCodeSchema>;\n\nexport const PortalErrorSchema = z\n\t.object({\n\t\tcode: PortalErrorCodeSchema,\n\t\tmessage: z.string().min(1).max(500),\n\t\tretryable: z.boolean().optional(),\n\t\tsafeDiagnostic: SafeDiagnosticSchema.optional(),\n\t})\n\t.strict();\n\nexport type PortalError = z.infer<typeof PortalErrorSchema>;\n"],"mappings":";;;AAIA,MAAM,qBAAqB,IAAI,IAAI;CAAC;CAAa;CAAe;CAAY,CAAC;AAE7E,MAAa,kBAAkB,4BAA4B;CAC1D,aAAa,IAAI,YAAY;EAC5B,IAAI,mBAAmB,IAAI,GAAG,EAC7B,QAAQ,SAAS;GAChB,MAAM;GACN,SAAS;GACT,CAAC;;CAGJ,oBAAoB;CACpB,QAAQ,EAAE,QAAQ,CAAC,IAAI,EAAE;CACzB,CAAC;AAEF,MAAa,eAAe;;;ACjB5B,MAAa,2BAA2B,EAAE,KAAK;CAC9C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA,CAAC;AAEF,MAAa,uBAAuB,EAClC,OAAO;CACP,MAAM;CACN,OAAO,EAAE,KAAK;EAAC;EAAS;EAAQ;EAAQ;EAAQ,CAAC;CACjD,aAAa,EAAE,QAAQ,CAAC,IAAI,IAAI;CAChC,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,MAAM;EAAC,EAAE,QAAQ;EAAE,EAAE,QAAQ;EAAE,EAAE,SAAS;EAAC,CAAC,CAAC,CAAC,UAAU;CAC3F,CAAC,CACD,QAAQ;;;ACjBV,MAAa,wBAAwB,EAAE,KAAK;CAC3C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA,CAAC;AAIF,MAAa,oBAAoB,EAC/B,OAAO;CACP,MAAM;CACN,SAAS,EAAE,QAAQ,CAAC,IAAI,EAAE,CAAC,IAAI,IAAI;CACnC,WAAW,EAAE,SAAS,CAAC,UAAU;CACjC,gBAAgB,qBAAqB,UAAU;CAC/C,CAAC,CACD,QAAQ"}
|