@agentproto/connector 0.1.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/LICENSE +21 -0
- package/dist/descriptor.d.ts +91 -0
- package/dist/descriptor.mjs +3 -0
- package/dist/descriptor.mjs.map +1 -0
- package/dist/index.d.ts +54 -0
- package/dist/index.mjs +58 -0
- package/dist/index.mjs.map +1 -0
- package/dist/requirements.d.ts +30 -0
- package/dist/requirements.mjs +3 -0
- package/dist/requirements.mjs.map +1 -0
- package/package.json +77 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Jeremy André and agentproto contributors
|
|
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,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ConnectorMcpDescriptor — the portable, host-agnostic description of an MCP
|
|
3
|
+
* connector: how its MCP server runs / is reached. Lifted out of guilde (where
|
|
4
|
+
* it lived as a private flat-bag interface) so ANYONE — not just guilde — can
|
|
5
|
+
* describe an MCP connector against the open standard.
|
|
6
|
+
*
|
|
7
|
+
* It is a discriminated union over `kind` so each kind carries only its valid
|
|
8
|
+
* fields (the guilde original was a flat optional-bag where every field could
|
|
9
|
+
* appear on any kind). The four kinds:
|
|
10
|
+
*
|
|
11
|
+
* - `hosted` — the platform runs the MCP server; creds passed in.
|
|
12
|
+
* - `sandbox` — ephemeral per-install process spawned from a package /
|
|
13
|
+
* entry point (DXT-parallel).
|
|
14
|
+
* - `external` — the user points the platform at their own MCP URL.
|
|
15
|
+
* - `local-daemon` — the MCP server runs on the user's own agentproto daemon
|
|
16
|
+
* and is reached over a reverse tunnel. No URL / no creds
|
|
17
|
+
* on the descriptor — dispatch is pinned to a daemon
|
|
18
|
+
* identity and routed by `importAlias`.
|
|
19
|
+
*
|
|
20
|
+
* What does NOT live here: catalog/marketplace metadata (category, logo,
|
|
21
|
+
* vendor, billing, auth-method UI), vault wiring, DB persistence, and any
|
|
22
|
+
* host-specific resolution (e.g. guilde's bureau device-link). Those stay in
|
|
23
|
+
* the consumer (guilde's `ConnectorProviderConfig` wraps this via its `mcp`
|
|
24
|
+
* field). This type is just the runnable description.
|
|
25
|
+
*/
|
|
26
|
+
/** Fields common to every connector kind. */
|
|
27
|
+
interface ConnectorMcpBase {
|
|
28
|
+
/** URL-safe slug used when assigning this connector to agents / operators. */
|
|
29
|
+
slug: string;
|
|
30
|
+
/** Set when auth is delegated to an OAuth provider (provider slug). */
|
|
31
|
+
oauthProvider?: string;
|
|
32
|
+
}
|
|
33
|
+
/** The platform runs the MCP server at a known URL; credentials are injected. */
|
|
34
|
+
interface HostedConnectorMcp extends ConnectorMcpBase {
|
|
35
|
+
kind: "hosted";
|
|
36
|
+
/**
|
|
37
|
+
* MCP endpoint URL. A host MAY template this (e.g. guilde injects its
|
|
38
|
+
* public base URL) — the descriptor carries the resolved-or-templated value.
|
|
39
|
+
*/
|
|
40
|
+
serverUrl: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Ephemeral per-install process spawned from a package / entry point — the
|
|
44
|
+
* DXT-parallel local-process model. Fields mirror a minimal process spec.
|
|
45
|
+
*/
|
|
46
|
+
interface SandboxConnectorMcp extends ConnectorMcpBase {
|
|
47
|
+
kind: "sandbox";
|
|
48
|
+
/** Runtime the entry point targets. */
|
|
49
|
+
runtime?: "node" | "python";
|
|
50
|
+
/** Entry point (file / module) the runtime executes. */
|
|
51
|
+
entryPoint?: string;
|
|
52
|
+
/** Extra arguments passed to the entry point. */
|
|
53
|
+
args?: string[];
|
|
54
|
+
/** Static (non-secret) environment for the spawned process. Secrets reach
|
|
55
|
+
* the process via the connector's credential requirements, not here. */
|
|
56
|
+
env?: Record<string, string>;
|
|
57
|
+
/** npm/PyPI package the entry point lives in, when applicable. */
|
|
58
|
+
packageName?: string;
|
|
59
|
+
}
|
|
60
|
+
/** The user points the platform at their own already-running MCP server. */
|
|
61
|
+
interface ExternalConnectorMcp extends ConnectorMcpBase {
|
|
62
|
+
kind: "external";
|
|
63
|
+
/** Optional default; usually supplied by the user at install time. */
|
|
64
|
+
serverUrl?: string;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* The MCP server runs on the user's own agentproto daemon and is reached over
|
|
68
|
+
* a reverse tunnel. No URL / creds on the descriptor — dispatch is pinned to a
|
|
69
|
+
* daemon identity and routed by `importAlias`.
|
|
70
|
+
*/
|
|
71
|
+
interface LocalDaemonConnectorMcp extends ConnectorMcpBase {
|
|
72
|
+
kind: "local-daemon";
|
|
73
|
+
/** Alias the user's daemon imports this MCP under (e.g. "bureau"). */
|
|
74
|
+
importAlias: string;
|
|
75
|
+
/**
|
|
76
|
+
* Tunnel provider this connector rides on — referenced BY SLUG only (one of
|
|
77
|
+
* `@agentproto/runtime`'s built-in tunnel slugs, e.g. `cloudflare-quick` /
|
|
78
|
+
* `cloudflare-named` / `ngrok`, or any third-party
|
|
79
|
+
* `@scope/agentproto-adapter-<slug>`). Resolution to a live provider is the
|
|
80
|
+
* consumer's runtime concern (`resolveTunnelProvider`) — keeping this type
|
|
81
|
+
* out of the runtime layer. Optional: hosts that run a single shared reverse
|
|
82
|
+
* tunnel for all local-daemon connectors leave it unset.
|
|
83
|
+
*/
|
|
84
|
+
tunnelProvider?: string;
|
|
85
|
+
}
|
|
86
|
+
/** Discriminated union over the four connector kinds. */
|
|
87
|
+
type ConnectorMcpDescriptor = HostedConnectorMcp | SandboxConnectorMcp | ExternalConnectorMcp | LocalDaemonConnectorMcp;
|
|
88
|
+
/** All connector kind discriminants. */
|
|
89
|
+
type ConnectorMcpKind = ConnectorMcpDescriptor["kind"];
|
|
90
|
+
|
|
91
|
+
export type { ConnectorMcpDescriptor, ConnectorMcpKind, ExternalConnectorMcp, HostedConnectorMcp, LocalDaemonConnectorMcp, SandboxConnectorMcp };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"descriptor.mjs"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { ConnectorMcpDescriptor, ExternalConnectorMcp, HostedConnectorMcp, LocalDaemonConnectorMcp, SandboxConnectorMcp } from './descriptor.js';
|
|
2
|
+
export { ConnectorMcpKind } from './descriptor.js';
|
|
3
|
+
export { ConnectorCredentialRequirement, ConnectorSecretKind } from './requirements.js';
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
import '@agentproto/adapter-kit';
|
|
6
|
+
import '@agentproto/secrets/exposure';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Type guards + a zod schema for {@link ConnectorMcpDescriptor}. The guards are
|
|
10
|
+
* the ergonomic narrowing path in TS; the schema is for runtime validation at
|
|
11
|
+
* trust boundaries (parsing a descriptor from JSON / an API / a config file).
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
declare const isHostedConnector: (d: ConnectorMcpDescriptor) => d is HostedConnectorMcp;
|
|
15
|
+
declare const isSandboxConnector: (d: ConnectorMcpDescriptor) => d is SandboxConnectorMcp;
|
|
16
|
+
declare const isExternalConnector: (d: ConnectorMcpDescriptor) => d is ExternalConnectorMcp;
|
|
17
|
+
declare const isLocalDaemonConnector: (d: ConnectorMcpDescriptor) => d is LocalDaemonConnectorMcp;
|
|
18
|
+
/** Runtime validator for a {@link ConnectorMcpDescriptor}. */
|
|
19
|
+
declare const connectorMcpSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
20
|
+
kind: z.ZodLiteral<"hosted">;
|
|
21
|
+
slug: z.ZodString;
|
|
22
|
+
oauthProvider: z.ZodOptional<z.ZodString>;
|
|
23
|
+
serverUrl: z.ZodString;
|
|
24
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
25
|
+
kind: z.ZodLiteral<"sandbox">;
|
|
26
|
+
slug: z.ZodString;
|
|
27
|
+
oauthProvider: z.ZodOptional<z.ZodString>;
|
|
28
|
+
runtime: z.ZodOptional<z.ZodEnum<{
|
|
29
|
+
node: "node";
|
|
30
|
+
python: "python";
|
|
31
|
+
}>>;
|
|
32
|
+
entryPoint: z.ZodOptional<z.ZodString>;
|
|
33
|
+
args: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
34
|
+
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
35
|
+
packageName: z.ZodOptional<z.ZodString>;
|
|
36
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
37
|
+
kind: z.ZodLiteral<"external">;
|
|
38
|
+
slug: z.ZodString;
|
|
39
|
+
oauthProvider: z.ZodOptional<z.ZodString>;
|
|
40
|
+
serverUrl: z.ZodOptional<z.ZodString>;
|
|
41
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
42
|
+
kind: z.ZodLiteral<"local-daemon">;
|
|
43
|
+
slug: z.ZodString;
|
|
44
|
+
oauthProvider: z.ZodOptional<z.ZodString>;
|
|
45
|
+
importAlias: z.ZodString;
|
|
46
|
+
tunnelProvider: z.ZodOptional<z.ZodString>;
|
|
47
|
+
}, z.core.$strip>], "kind">;
|
|
48
|
+
/** Parse + validate an unknown value as a {@link ConnectorMcpDescriptor}.
|
|
49
|
+
* Throws (zod error) on mismatch. */
|
|
50
|
+
declare function parseConnectorMcp(value: unknown): ConnectorMcpDescriptor;
|
|
51
|
+
/** Non-throwing variant — returns null on mismatch. */
|
|
52
|
+
declare function safeParseConnectorMcp(value: unknown): ConnectorMcpDescriptor | null;
|
|
53
|
+
|
|
54
|
+
export { ConnectorMcpDescriptor, ExternalConnectorMcp, HostedConnectorMcp, LocalDaemonConnectorMcp, SandboxConnectorMcp, connectorMcpSchema, isExternalConnector, isHostedConnector, isLocalDaemonConnector, isSandboxConnector, parseConnectorMcp, safeParseConnectorMcp };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @agentproto/connector v0.1.0-alpha
|
|
5
|
+
* ConnectorMcpDescriptor — portable description of an MCP connector.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
var isKind = (d, kind) => d.kind === kind;
|
|
9
|
+
var isHostedConnector = (d) => isKind(d, "hosted");
|
|
10
|
+
var isSandboxConnector = (d) => isKind(d, "sandbox");
|
|
11
|
+
var isExternalConnector = (d) => isKind(d, "external");
|
|
12
|
+
var isLocalDaemonConnector = (d) => isKind(d, "local-daemon");
|
|
13
|
+
var hostedSchema = z.object({
|
|
14
|
+
kind: z.literal("hosted"),
|
|
15
|
+
slug: z.string().min(1),
|
|
16
|
+
oauthProvider: z.string().optional(),
|
|
17
|
+
serverUrl: z.string().min(1)
|
|
18
|
+
});
|
|
19
|
+
var sandboxSchema = z.object({
|
|
20
|
+
kind: z.literal("sandbox"),
|
|
21
|
+
slug: z.string().min(1),
|
|
22
|
+
oauthProvider: z.string().optional(),
|
|
23
|
+
runtime: z.enum(["node", "python"]).optional(),
|
|
24
|
+
entryPoint: z.string().optional(),
|
|
25
|
+
args: z.array(z.string()).optional(),
|
|
26
|
+
env: z.record(z.string(), z.string()).optional(),
|
|
27
|
+
packageName: z.string().optional()
|
|
28
|
+
});
|
|
29
|
+
var externalSchema = z.object({
|
|
30
|
+
kind: z.literal("external"),
|
|
31
|
+
slug: z.string().min(1),
|
|
32
|
+
oauthProvider: z.string().optional(),
|
|
33
|
+
serverUrl: z.string().optional()
|
|
34
|
+
});
|
|
35
|
+
var localDaemonSchema = z.object({
|
|
36
|
+
kind: z.literal("local-daemon"),
|
|
37
|
+
slug: z.string().min(1),
|
|
38
|
+
oauthProvider: z.string().optional(),
|
|
39
|
+
importAlias: z.string().min(1),
|
|
40
|
+
tunnelProvider: z.string().optional()
|
|
41
|
+
});
|
|
42
|
+
var connectorMcpSchema = z.discriminatedUnion("kind", [
|
|
43
|
+
hostedSchema,
|
|
44
|
+
sandboxSchema,
|
|
45
|
+
externalSchema,
|
|
46
|
+
localDaemonSchema
|
|
47
|
+
]);
|
|
48
|
+
function parseConnectorMcp(value) {
|
|
49
|
+
return connectorMcpSchema.parse(value);
|
|
50
|
+
}
|
|
51
|
+
function safeParseConnectorMcp(value) {
|
|
52
|
+
const result = connectorMcpSchema.safeParse(value);
|
|
53
|
+
return result.success ? result.data : null;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export { connectorMcpSchema, isExternalConnector, isHostedConnector, isLocalDaemonConnector, isSandboxConnector, parseConnectorMcp, safeParseConnectorMcp };
|
|
57
|
+
//# sourceMappingURL=index.mjs.map
|
|
58
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/guards.ts"],"names":[],"mappings":";;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AA,GAAU,MAAA,CAAO,IAAA,GAAO,IAAA;AACxC","file":"index.mjs","sourcesContent":["/**\n * Type guards + a zod schema for {@link ConnectorMcpDescriptor}. The guards are\n * the ergonomic narrowing path in TS; the schema is for runtime validation at\n * trust boundaries (parsing a descriptor from JSON / an API / a config file).\n */\n\nimport { z } from \"zod\"\nimport type {\n ConnectorMcpDescriptor,\n ConnectorMcpKind,\n HostedConnectorMcp,\n SandboxConnectorMcp,\n ExternalConnectorMcp,\n LocalDaemonConnectorMcp,\n} from \"./descriptor.js\"\n\n// ── type guards ────────────────────────────────────────────────────────────\n\nconst isKind = <K extends ConnectorMcpKind>(\n d: ConnectorMcpDescriptor,\n kind: K,\n): d is Extract<ConnectorMcpDescriptor, { kind: K }> => d.kind === kind\n\nexport const isHostedConnector = (\n d: ConnectorMcpDescriptor,\n): d is HostedConnectorMcp => isKind(d, \"hosted\")\n\nexport const isSandboxConnector = (\n d: ConnectorMcpDescriptor,\n): d is SandboxConnectorMcp => isKind(d, \"sandbox\")\n\nexport const isExternalConnector = (\n d: ConnectorMcpDescriptor,\n): d is ExternalConnectorMcp => isKind(d, \"external\")\n\nexport const isLocalDaemonConnector = (\n d: ConnectorMcpDescriptor,\n): d is LocalDaemonConnectorMcp => isKind(d, \"local-daemon\")\n\n// ── zod schema ───────────────────────────────────────────────────────────────\n\nconst hostedSchema = z.object({\n kind: z.literal(\"hosted\"),\n slug: z.string().min(1),\n oauthProvider: z.string().optional(),\n serverUrl: z.string().min(1),\n})\n\nconst sandboxSchema = z.object({\n kind: z.literal(\"sandbox\"),\n slug: z.string().min(1),\n oauthProvider: z.string().optional(),\n runtime: z.enum([\"node\", \"python\"]).optional(),\n entryPoint: z.string().optional(),\n args: z.array(z.string()).optional(),\n env: z.record(z.string(), z.string()).optional(),\n packageName: z.string().optional(),\n})\n\nconst externalSchema = z.object({\n kind: z.literal(\"external\"),\n slug: z.string().min(1),\n oauthProvider: z.string().optional(),\n serverUrl: z.string().optional(),\n})\n\nconst localDaemonSchema = z.object({\n kind: z.literal(\"local-daemon\"),\n slug: z.string().min(1),\n oauthProvider: z.string().optional(),\n importAlias: z.string().min(1),\n tunnelProvider: z.string().optional(),\n})\n\n/** Runtime validator for a {@link ConnectorMcpDescriptor}. */\nexport const connectorMcpSchema = z.discriminatedUnion(\"kind\", [\n hostedSchema,\n sandboxSchema,\n externalSchema,\n localDaemonSchema,\n])\n\n// Compile-time proof that the zod schema and the hand-written union stay in\n// sync: if either drifts, one of these assertions stops being `true` and the\n// build fails. It also means `schema.parse()` already returns a value\n// assignable to ConnectorMcpDescriptor — so the parse helpers need no cast.\ntype Expect<T extends true> = T\ntype _SchemaInfersType = Expect<\n z.infer<typeof connectorMcpSchema> extends ConnectorMcpDescriptor ? true : false\n>\ntype _TypeMatchesSchema = Expect<\n ConnectorMcpDescriptor extends z.infer<typeof connectorMcpSchema> ? true : false\n>\n\n/** Parse + validate an unknown value as a {@link ConnectorMcpDescriptor}.\n * Throws (zod error) on mismatch. */\nexport function parseConnectorMcp(value: unknown): ConnectorMcpDescriptor {\n return connectorMcpSchema.parse(value)\n}\n\n/** Non-throwing variant — returns null on mismatch. */\nexport function safeParseConnectorMcp(\n value: unknown,\n): ConnectorMcpDescriptor | null {\n const result = connectorMcpSchema.safeParse(value)\n return result.success ? result.data : null\n}\n"]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { SetupField } from '@agentproto/adapter-kit';
|
|
2
|
+
import { SecretExposure } from '@agentproto/secrets/exposure';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Credential requirements for a connector — what the user must supply and how
|
|
6
|
+
* each value reaches the runtime that needs it.
|
|
7
|
+
*
|
|
8
|
+
* Deliberately reuses two existing agentproto vocabularies rather than
|
|
9
|
+
* inventing a third:
|
|
10
|
+
* - `SetupField` (`@agentproto/adapter-kit`) — the same "field to collect"
|
|
11
|
+
* shape the tunnel-provider setup flow uses (name / description / required /
|
|
12
|
+
* sensitive). One vocabulary for every credential input across the project.
|
|
13
|
+
* - `SecretExposure` (`@agentproto/secrets`) — how a collected value is
|
|
14
|
+
* exposed to the runtime (env var / file / egress placeholder).
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/** Coarse classification of a credential — informs storage / UI affordances. */
|
|
18
|
+
type ConnectorSecretKind = "api_key" | "oauth_token" | "json_cred" | "cert" | "signing_key";
|
|
19
|
+
/** One credential a connector needs + how it is exposed to the runtime. */
|
|
20
|
+
interface ConnectorCredentialRequirement {
|
|
21
|
+
/** The field the user fills (reuses the tunnel-setup field vocabulary). */
|
|
22
|
+
field: SetupField;
|
|
23
|
+
/** Coarse kind hint for storage / UI. */
|
|
24
|
+
secretKind?: ConnectorSecretKind;
|
|
25
|
+
/** How the collected value reaches the runtime (env / file / egress).
|
|
26
|
+
* Omit when the host derives exposure from `secretKind` / context. */
|
|
27
|
+
exposures?: SecretExposure[];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export type { ConnectorCredentialRequirement, ConnectorSecretKind };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"requirements.mjs"}
|
package/package.json
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@agentproto/connector",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "@agentproto/connector — ConnectorMcpDescriptor: the portable, host-agnostic description of an MCP connector (how its server runs / is reached + what credentials it needs).",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"agentproto",
|
|
7
|
+
"connector",
|
|
8
|
+
"mcp",
|
|
9
|
+
"descriptor"
|
|
10
|
+
],
|
|
11
|
+
"homepage": "https://agentproto.sh",
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "https://github.com/agentproto/ts",
|
|
15
|
+
"directory": "packages/connector"
|
|
16
|
+
},
|
|
17
|
+
"bugs": {
|
|
18
|
+
"url": "https://github.com/agentproto/ts/issues"
|
|
19
|
+
},
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"type": "module",
|
|
22
|
+
"main": "dist/index.mjs",
|
|
23
|
+
"module": "dist/index.mjs",
|
|
24
|
+
"types": "dist/index.d.ts",
|
|
25
|
+
"exports": {
|
|
26
|
+
".": {
|
|
27
|
+
"types": "./dist/index.d.ts",
|
|
28
|
+
"import": "./dist/index.mjs",
|
|
29
|
+
"default": "./dist/index.mjs"
|
|
30
|
+
},
|
|
31
|
+
"./descriptor": {
|
|
32
|
+
"types": "./dist/descriptor.d.ts",
|
|
33
|
+
"import": "./dist/descriptor.mjs",
|
|
34
|
+
"default": "./dist/descriptor.mjs"
|
|
35
|
+
},
|
|
36
|
+
"./requirements": {
|
|
37
|
+
"types": "./dist/requirements.d.ts",
|
|
38
|
+
"import": "./dist/requirements.mjs",
|
|
39
|
+
"default": "./dist/requirements.mjs"
|
|
40
|
+
},
|
|
41
|
+
"./package.json": "./package.json"
|
|
42
|
+
},
|
|
43
|
+
"files": [
|
|
44
|
+
"dist",
|
|
45
|
+
"README.md",
|
|
46
|
+
"LICENSE"
|
|
47
|
+
],
|
|
48
|
+
"publishConfig": {
|
|
49
|
+
"access": "public"
|
|
50
|
+
},
|
|
51
|
+
"dependencies": {
|
|
52
|
+
"@agentproto/adapter-kit": "0.1.0",
|
|
53
|
+
"@agentproto/secrets": "0.1.0-alpha.0"
|
|
54
|
+
},
|
|
55
|
+
"peerDependencies": {
|
|
56
|
+
"zod": ">=3.0.0"
|
|
57
|
+
},
|
|
58
|
+
"devDependencies": {
|
|
59
|
+
"@types/node": "^25.6.2",
|
|
60
|
+
"tsup": "^8.5.1",
|
|
61
|
+
"typescript": "^5.9.3",
|
|
62
|
+
"vitest": "^3.2.4",
|
|
63
|
+
"zod": "^4.4.3",
|
|
64
|
+
"@agentproto/tooling": "0.1.0-alpha.0"
|
|
65
|
+
},
|
|
66
|
+
"engines": {
|
|
67
|
+
"node": ">=20.9.0"
|
|
68
|
+
},
|
|
69
|
+
"scripts": {
|
|
70
|
+
"dev": "tsup --watch",
|
|
71
|
+
"build": "tsup",
|
|
72
|
+
"clean": "rm -rf dist",
|
|
73
|
+
"check-types": "tsc --noEmit",
|
|
74
|
+
"test": "vitest run --passWithNoTests",
|
|
75
|
+
"test:watch": "vitest"
|
|
76
|
+
}
|
|
77
|
+
}
|