@shipfox/api-agent-access-dto 20.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,7 @@
1
+ # @shipfox/api-agent-access-dto
2
+
3
+ ## 20.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - ba481d6: Add the dormant agent-access MCP gateway foundation and shared tool response contracts.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Shipfox
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,2 @@
1
+ export { AGENT_ACCESS_ERROR_CODE_MAX_LENGTH, AGENT_ACCESS_ERROR_MESSAGE_MAX_LENGTH, type AgentAccessEnvelopeDto, type AgentAccessErrorDto, type AgentAccessJsonSchema, type AgentAccessObjectSchema, agentAccessEnvelopeJsonSchema, agentAccessEnvelopeSchema, agentAccessErrorSchema, agentAccessOutputSchema, } from './schemas/envelope.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kCAAkC,EAClC,qCAAqC,EACrC,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC5B,6BAA6B,EAC7B,yBAAyB,EACzB,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,uBAAuB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export { AGENT_ACCESS_ERROR_CODE_MAX_LENGTH, AGENT_ACCESS_ERROR_MESSAGE_MAX_LENGTH, agentAccessEnvelopeJsonSchema, agentAccessEnvelopeSchema, agentAccessErrorSchema, agentAccessOutputSchema } from './schemas/envelope.js';
2
+
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export {\n AGENT_ACCESS_ERROR_CODE_MAX_LENGTH,\n AGENT_ACCESS_ERROR_MESSAGE_MAX_LENGTH,\n type AgentAccessEnvelopeDto,\n type AgentAccessErrorDto,\n type AgentAccessJsonSchema,\n type AgentAccessObjectSchema,\n agentAccessEnvelopeJsonSchema,\n agentAccessEnvelopeSchema,\n agentAccessErrorSchema,\n agentAccessOutputSchema,\n} from './schemas/envelope.js';\n"],"names":["AGENT_ACCESS_ERROR_CODE_MAX_LENGTH","AGENT_ACCESS_ERROR_MESSAGE_MAX_LENGTH","agentAccessEnvelopeJsonSchema","agentAccessEnvelopeSchema","agentAccessErrorSchema","agentAccessOutputSchema"],"mappings":"AAAA,SACEA,kCAAkC,EAClCC,qCAAqC,EAKrCC,6BAA6B,EAC7BC,yBAAyB,EACzBC,sBAAsB,EACtBC,uBAAuB,QAClB,wBAAwB"}
@@ -0,0 +1,76 @@
1
+ import { z } from 'zod';
2
+ export declare const AGENT_ACCESS_ERROR_CODE_MAX_LENGTH = 128;
3
+ export declare const AGENT_ACCESS_ERROR_MESSAGE_MAX_LENGTH = 2048;
4
+ /** A bounded error payload shared by every agent-access tool. */
5
+ export declare const agentAccessErrorSchema: z.ZodObject<{
6
+ code: z.ZodString;
7
+ message: z.ZodOptional<z.ZodString>;
8
+ retry_after_seconds: z.ZodOptional<z.ZodNumber>;
9
+ }, z.core.$strict>;
10
+ export type AgentAccessErrorDto = z.infer<typeof agentAccessErrorSchema>;
11
+ /**
12
+ * The wire envelope for both successful and failed tool calls. The relation
13
+ * between `ok` and the optional payload is checked at runtime below rather
14
+ * than represented as a top-level JSON-schema union.
15
+ */
16
+ export declare const agentAccessEnvelopeSchema: z.ZodObject<{
17
+ ok: z.ZodBoolean;
18
+ result: z.ZodOptional<z.ZodUnknown>;
19
+ error: z.ZodOptional<z.ZodObject<{
20
+ code: z.ZodString;
21
+ message: z.ZodOptional<z.ZodString>;
22
+ retry_after_seconds: z.ZodOptional<z.ZodNumber>;
23
+ }, z.core.$strict>>;
24
+ response_truncated: z.ZodOptional<z.ZodBoolean>;
25
+ response_total_bytes: z.ZodOptional<z.ZodNumber>;
26
+ }, z.core.$strict>;
27
+ export type AgentAccessEnvelopeDto = z.infer<typeof agentAccessEnvelopeSchema>;
28
+ export interface AgentAccessJsonSchema {
29
+ readonly type?: string;
30
+ readonly [key: string]: unknown;
31
+ }
32
+ export interface AgentAccessObjectSchema extends AgentAccessJsonSchema {
33
+ readonly type: 'object';
34
+ }
35
+ /** JSON Schema form used in MCP tool descriptors. It intentionally has no top-level oneOf. */
36
+ export declare const agentAccessEnvelopeJsonSchema: {
37
+ readonly type: 'object';
38
+ readonly properties: {
39
+ readonly ok: {
40
+ readonly type: 'boolean';
41
+ };
42
+ readonly result: {};
43
+ readonly error: {
44
+ readonly type: 'object';
45
+ readonly properties: {
46
+ readonly code: {
47
+ readonly type: 'string';
48
+ readonly minLength: 1;
49
+ readonly maxLength: 128;
50
+ };
51
+ readonly message: {
52
+ readonly type: 'string';
53
+ readonly maxLength: 2048;
54
+ };
55
+ readonly retry_after_seconds: {
56
+ readonly type: 'integer';
57
+ readonly minimum: 1;
58
+ };
59
+ };
60
+ readonly required: readonly ['code'];
61
+ readonly additionalProperties: false;
62
+ };
63
+ readonly response_truncated: {
64
+ readonly type: 'boolean';
65
+ };
66
+ readonly response_total_bytes: {
67
+ readonly type: 'integer';
68
+ readonly minimum: 0;
69
+ };
70
+ };
71
+ readonly required: readonly ["ok"];
72
+ readonly additionalProperties: false;
73
+ };
74
+ /** Adds a tool-specific result schema while preserving the common envelope. */
75
+ export declare function agentAccessOutputSchema(resultSchema?: AgentAccessJsonSchema): AgentAccessObjectSchema;
76
+ //# sourceMappingURL=envelope.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"envelope.d.ts","sourceRoot":"","sources":["../../src/schemas/envelope.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,eAAO,MAAM,kCAAkC,MAAM,CAAC;AACtD,eAAO,MAAM,qCAAqC,OAAO,CAAC;AAI1D,iEAAiE;AACjE,eAAO,MAAM,sBAAsB;;;;kBAMxB,CAAC;AAEZ,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEzE;;;;GAIG;AACH,eAAO,MAAM,yBAAyB;;;;;;;;;;kBAsClC,CAAC;AAEL,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE/E,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACjC;AAED,MAAM,WAAW,uBAAwB,SAAQ,qBAAqB;IACpE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;CACzB;AAmBD,8FAA8F;AAC9F,eAAO,MAAM,6BAA6B;mBAClC,QAAQ;;;qBAlBT,IAAI,EAAE,SAAS;;;;qBAGlB,IAAI,EAAE,QAAQ;qBACd,UAAU;yBACR,IAAI;6BAAG,IAAI,EAAE,QAAQ;6BAAE,SAAS,EAAE,CAAC;6BAAE,SAAS;;yBAC9C,OAAO;6BAAG,IAAI,EAAE,QAAQ;6BAAE,SAAS;;yBACnC,mBAAmB;6BAAG,IAAI,EAAE,SAAS;6BAAE,OAAO,EAAE,CAAC;;;qBAEnD,QAAQ,YAAG,MAAM;qBACjB,oBAAoB;;;qBAED,IAAI,EAAE,SAAS;;;qBACb,IAAI,EAAE,SAAS;qBAAE,OAAO,EAAE,CAAC;;;;;CASR,CAAC;AAE7C,+EAA+E;AAC/E,wBAAgB,uBAAuB,CACrC,YAAY,GAAE,qBAA0B,GACvC,uBAAuB,CAKzB"}
@@ -0,0 +1,111 @@
1
+ import { z } from 'zod';
2
+ export const AGENT_ACCESS_ERROR_CODE_MAX_LENGTH = 128;
3
+ export const AGENT_ACCESS_ERROR_MESSAGE_MAX_LENGTH = 2048;
4
+ const agentAccessErrorCodeSchema = z.string().min(1).max(AGENT_ACCESS_ERROR_CODE_MAX_LENGTH);
5
+ /** A bounded error payload shared by every agent-access tool. */ export const agentAccessErrorSchema = z.object({
6
+ code: agentAccessErrorCodeSchema,
7
+ message: z.string().max(AGENT_ACCESS_ERROR_MESSAGE_MAX_LENGTH).optional(),
8
+ retry_after_seconds: z.number().int().min(1).optional()
9
+ }).strict();
10
+ /**
11
+ * The wire envelope for both successful and failed tool calls. The relation
12
+ * between `ok` and the optional payload is checked at runtime below rather
13
+ * than represented as a top-level JSON-schema union.
14
+ */ export const agentAccessEnvelopeSchema = z.object({
15
+ ok: z.boolean(),
16
+ result: z.unknown().optional(),
17
+ error: agentAccessErrorSchema.optional(),
18
+ response_truncated: z.boolean().optional(),
19
+ response_total_bytes: z.number().int().min(0).optional()
20
+ }).strict().superRefine((value, context)=>{
21
+ if (value.ok && value.result === undefined) {
22
+ context.addIssue({
23
+ code: 'custom',
24
+ path: [
25
+ 'result'
26
+ ],
27
+ message: 'Successful responses must include result'
28
+ });
29
+ }
30
+ if (value.ok && value.error !== undefined) {
31
+ context.addIssue({
32
+ code: 'custom',
33
+ path: [
34
+ 'error'
35
+ ],
36
+ message: 'Successful responses must not include error'
37
+ });
38
+ }
39
+ if (!value.ok && value.error === undefined) {
40
+ context.addIssue({
41
+ code: 'custom',
42
+ path: [
43
+ 'error'
44
+ ],
45
+ message: 'Failed responses must include error'
46
+ });
47
+ }
48
+ if (!value.ok && value.result !== undefined) {
49
+ context.addIssue({
50
+ code: 'custom',
51
+ path: [
52
+ 'result'
53
+ ],
54
+ message: 'Failed responses must not include result'
55
+ });
56
+ }
57
+ });
58
+ const agentAccessEnvelopeProperties = {
59
+ ok: {
60
+ type: 'boolean'
61
+ },
62
+ result: {},
63
+ error: {
64
+ type: 'object',
65
+ properties: {
66
+ code: {
67
+ type: 'string',
68
+ minLength: 1,
69
+ maxLength: AGENT_ACCESS_ERROR_CODE_MAX_LENGTH
70
+ },
71
+ message: {
72
+ type: 'string',
73
+ maxLength: AGENT_ACCESS_ERROR_MESSAGE_MAX_LENGTH
74
+ },
75
+ retry_after_seconds: {
76
+ type: 'integer',
77
+ minimum: 1
78
+ }
79
+ },
80
+ required: [
81
+ 'code'
82
+ ],
83
+ additionalProperties: false
84
+ },
85
+ response_truncated: {
86
+ type: 'boolean'
87
+ },
88
+ response_total_bytes: {
89
+ type: 'integer',
90
+ minimum: 0
91
+ }
92
+ };
93
+ /** JSON Schema form used in MCP tool descriptors. It intentionally has no top-level oneOf. */ export const agentAccessEnvelopeJsonSchema = {
94
+ type: 'object',
95
+ properties: agentAccessEnvelopeProperties,
96
+ required: [
97
+ 'ok'
98
+ ],
99
+ additionalProperties: false
100
+ };
101
+ /** Adds a tool-specific result schema while preserving the common envelope. */ export function agentAccessOutputSchema(resultSchema = {}) {
102
+ return {
103
+ ...agentAccessEnvelopeJsonSchema,
104
+ properties: {
105
+ ...agentAccessEnvelopeProperties,
106
+ result: resultSchema
107
+ }
108
+ };
109
+ }
110
+
111
+ //# sourceMappingURL=envelope.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/schemas/envelope.ts"],"sourcesContent":["import {z} from 'zod';\n\nexport const AGENT_ACCESS_ERROR_CODE_MAX_LENGTH = 128;\nexport const AGENT_ACCESS_ERROR_MESSAGE_MAX_LENGTH = 2048;\n\nconst agentAccessErrorCodeSchema = z.string().min(1).max(AGENT_ACCESS_ERROR_CODE_MAX_LENGTH);\n\n/** A bounded error payload shared by every agent-access tool. */\nexport const agentAccessErrorSchema = z\n .object({\n code: agentAccessErrorCodeSchema,\n message: z.string().max(AGENT_ACCESS_ERROR_MESSAGE_MAX_LENGTH).optional(),\n retry_after_seconds: z.number().int().min(1).optional(),\n })\n .strict();\n\nexport type AgentAccessErrorDto = z.infer<typeof agentAccessErrorSchema>;\n\n/**\n * The wire envelope for both successful and failed tool calls. The relation\n * between `ok` and the optional payload is checked at runtime below rather\n * than represented as a top-level JSON-schema union.\n */\nexport const agentAccessEnvelopeSchema = z\n .object({\n ok: z.boolean(),\n result: z.unknown().optional(),\n error: agentAccessErrorSchema.optional(),\n response_truncated: z.boolean().optional(),\n response_total_bytes: z.number().int().min(0).optional(),\n })\n .strict()\n .superRefine((value, context) => {\n if (value.ok && value.result === undefined) {\n context.addIssue({\n code: 'custom',\n path: ['result'],\n message: 'Successful responses must include result',\n });\n }\n if (value.ok && value.error !== undefined) {\n context.addIssue({\n code: 'custom',\n path: ['error'],\n message: 'Successful responses must not include error',\n });\n }\n if (!value.ok && value.error === undefined) {\n context.addIssue({\n code: 'custom',\n path: ['error'],\n message: 'Failed responses must include error',\n });\n }\n if (!value.ok && value.result !== undefined) {\n context.addIssue({\n code: 'custom',\n path: ['result'],\n message: 'Failed responses must not include result',\n });\n }\n });\n\nexport type AgentAccessEnvelopeDto = z.infer<typeof agentAccessEnvelopeSchema>;\n\nexport interface AgentAccessJsonSchema {\n readonly type?: string;\n readonly [key: string]: unknown;\n}\n\nexport interface AgentAccessObjectSchema extends AgentAccessJsonSchema {\n readonly type: 'object';\n}\n\nconst agentAccessEnvelopeProperties = {\n ok: {type: 'boolean'},\n result: {},\n error: {\n type: 'object',\n properties: {\n code: {type: 'string', minLength: 1, maxLength: AGENT_ACCESS_ERROR_CODE_MAX_LENGTH},\n message: {type: 'string', maxLength: AGENT_ACCESS_ERROR_MESSAGE_MAX_LENGTH},\n retry_after_seconds: {type: 'integer', minimum: 1},\n },\n required: ['code'],\n additionalProperties: false,\n },\n response_truncated: {type: 'boolean'},\n response_total_bytes: {type: 'integer', minimum: 0},\n} as const;\n\n/** JSON Schema form used in MCP tool descriptors. It intentionally has no top-level oneOf. */\nexport const agentAccessEnvelopeJsonSchema = {\n type: 'object',\n properties: agentAccessEnvelopeProperties,\n required: ['ok'],\n additionalProperties: false,\n} as const satisfies AgentAccessObjectSchema;\n\n/** Adds a tool-specific result schema while preserving the common envelope. */\nexport function agentAccessOutputSchema(\n resultSchema: AgentAccessJsonSchema = {},\n): AgentAccessObjectSchema {\n return {\n ...agentAccessEnvelopeJsonSchema,\n properties: {...agentAccessEnvelopeProperties, result: resultSchema},\n };\n}\n"],"names":["z","AGENT_ACCESS_ERROR_CODE_MAX_LENGTH","AGENT_ACCESS_ERROR_MESSAGE_MAX_LENGTH","agentAccessErrorCodeSchema","string","min","max","agentAccessErrorSchema","object","code","message","optional","retry_after_seconds","number","int","strict","agentAccessEnvelopeSchema","ok","boolean","result","unknown","error","response_truncated","response_total_bytes","superRefine","value","context","undefined","addIssue","path","agentAccessEnvelopeProperties","type","properties","minLength","maxLength","minimum","required","additionalProperties","agentAccessEnvelopeJsonSchema","agentAccessOutputSchema","resultSchema"],"mappings":"AAAA,SAAQA,CAAC,QAAO,MAAM;AAEtB,OAAO,MAAMC,qCAAqC,IAAI;AACtD,OAAO,MAAMC,wCAAwC,KAAK;AAE1D,MAAMC,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