@decocms/bindings 0.2.1 → 0.2.3
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/dist/browser/agents.js +29 -0
- package/dist/browser/agents.js.map +1 -0
- package/dist/browser/chunk-6QEXJ7XW.js +48564 -0
- package/dist/browser/chunk-6QEXJ7XW.js.map +1 -0
- package/dist/browser/chunk-WKNVAFKE.js +2176 -0
- package/dist/browser/chunk-WKNVAFKE.js.map +1 -0
- package/dist/browser/chunk-XWLBKKHZ.js +127 -0
- package/dist/browser/chunk-XWLBKKHZ.js.map +1 -0
- package/dist/browser/chunk-ZX4ZDU2T.js +58 -0
- package/dist/browser/chunk-ZX4ZDU2T.js.map +1 -0
- package/dist/browser/client.js +9 -0
- package/dist/browser/client.js.map +1 -0
- package/dist/{well-known → browser}/collections.js +2 -1
- package/dist/browser/connection.js +8 -0
- package/dist/browser/connection.js.map +1 -0
- package/dist/browser/index.js +10 -0
- package/dist/browser/index.js.map +1 -0
- package/dist/browser/language-model.js +205 -0
- package/dist/browser/language-model.js.map +1 -0
- package/dist/client.d.ts +12 -0
- package/dist/client.js +54 -0
- package/dist/client.js.map +1 -0
- package/dist/{well-known/collections.d.ts → collections.d.ts} +120 -5
- package/dist/{chunk-JMM4EZYL.js → collections.js} +2 -2
- package/dist/collections.js.map +1 -0
- package/dist/connection.d.ts +30 -0
- package/dist/connection.js +3 -0
- package/dist/connection.js.map +1 -0
- package/dist/index.d.ts +6 -2
- package/dist/index.js +262 -1
- package/dist/index.js.map +1 -1
- package/dist/language-model.d.ts +3228 -0
- package/dist/language-model.js +628 -0
- package/dist/language-model.js.map +1 -0
- package/dist/models.d.ts +2071 -0
- package/dist/models.js +111 -0
- package/dist/models.js.map +1 -0
- package/dist/node/agents.d.ts +903 -0
- package/dist/node/agents.js +27 -0
- package/dist/node/agents.js.map +1 -0
- package/dist/node/chunk-BLCFITZG.js +56 -0
- package/dist/node/chunk-BLCFITZG.js.map +1 -0
- package/dist/node/chunk-QMQMPK7Q.js +50 -0
- package/dist/node/chunk-QMQMPK7Q.js.map +1 -0
- package/dist/node/chunk-QP7AQCEP.js +23478 -0
- package/dist/node/chunk-QP7AQCEP.js.map +1 -0
- package/dist/node/chunk-T2DG7334.js +125 -0
- package/dist/node/chunk-T2DG7334.js.map +1 -0
- package/dist/node/client.d.ts +12 -0
- package/dist/node/client.js +7 -0
- package/dist/node/client.js.map +1 -0
- package/dist/node/collections.d.ts +537 -0
- package/dist/node/collections.js +4 -0
- package/dist/node/collections.js.map +1 -0
- package/dist/node/connection.d.ts +30 -0
- package/dist/node/connection.js +6 -0
- package/dist/node/connection.js.map +1 -0
- package/dist/node/index.d.ts +94 -0
- package/dist/node/index.js +8 -0
- package/dist/node/index.js.map +1 -0
- package/dist/node/language-model.d.ts +2840 -0
- package/dist/node/language-model.js +203 -0
- package/dist/node/language-model.js.map +1 -0
- package/package.json +45 -16
- package/dist/chunk-JMM4EZYL.js.map +0 -1
- package/dist/well-known/models.d.ts +0 -127
- package/dist/well-known/models.js +0 -46
- package/dist/well-known/models.js.map +0 -1
- package/src/core/binder.ts +0 -226
- package/src/index.ts +0 -15
- package/src/well-known/collections.ts +0 -363
- package/src/well-known/models.ts +0 -87
- /package/dist/{well-known → browser}/collections.js.map +0 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { BaseCollectionEntitySchema, createCollectionBindings } from './chunk-T2DG7334.js';
|
|
2
|
+
import { init_esm_shims } from './chunk-QMQMPK7Q.js';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
|
|
5
|
+
// src/well-known/agents.ts
|
|
6
|
+
init_esm_shims();
|
|
7
|
+
var AgentSchema = BaseCollectionEntitySchema.extend({
|
|
8
|
+
// Agent-specific fields
|
|
9
|
+
description: z.string().describe("Brief description of the agent's purpose"),
|
|
10
|
+
instructions: z.string().describe("System instructions that define the agent's behavior"),
|
|
11
|
+
tool_set: z.record(z.string(), z.array(z.string())).describe(
|
|
12
|
+
"Map of connection IDs to arrays of allowed tool names for this agent"
|
|
13
|
+
),
|
|
14
|
+
avatar: z.string().url().describe("URL to the agent's avatar image")
|
|
15
|
+
});
|
|
16
|
+
var AGENTS_COLLECTION_BINDING = createCollectionBindings(
|
|
17
|
+
"agents",
|
|
18
|
+
AgentSchema,
|
|
19
|
+
{ readOnly: true }
|
|
20
|
+
);
|
|
21
|
+
var AGENTS_BINDING = [
|
|
22
|
+
...AGENTS_COLLECTION_BINDING
|
|
23
|
+
];
|
|
24
|
+
|
|
25
|
+
export { AGENTS_BINDING, AGENTS_COLLECTION_BINDING, AgentSchema };
|
|
26
|
+
//# sourceMappingURL=agents.js.map
|
|
27
|
+
//# sourceMappingURL=agents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/well-known/agents.ts"],"names":[],"mappings":";;;;;AAAA,cAAA,EAAA;AAsBO,IAAM,WAAA,GAAc,2BAA2B,MAAA,CAAO;AAAA;AAAA,EAE3D,WAAA,EAAa,CAAA,CAAE,MAAA,EAAO,CAAE,SAAS,0CAA0C,CAAA;AAAA,EAC3E,YAAA,EAAc,CAAA,CACX,MAAA,EAAO,CACP,SAAS,sDAAsD,CAAA;AAAA,EAClE,QAAA,EAAU,CAAA,CACP,MAAA,CAAO,CAAA,CAAE,MAAA,EAAO,EAAG,CAAA,CAAE,KAAA,CAAM,CAAA,CAAE,MAAA,EAAQ,CAAC,CAAA,CACtC,QAAA;AAAA,IACC;AAAA,GACF;AAAA,EACF,QAAQ,CAAA,CAAE,MAAA,GAAS,GAAA,EAAI,CAAE,SAAS,iCAAiC;AACrE,CAAC;AAQM,IAAM,yBAAA,GAA4B,wBAAA;AAAA,EACvC,QAAA;AAAA,EACA,WAAA;AAAA,EACA,EAAE,UAAU,IAAA;AACd;AAYO,IAAM,cAAA,GAAiB;AAAA,EAC5B,GAAG;AACL","file":"agents.js","sourcesContent":["/**\n * Agents Well-Known Binding\n *\n * Defines the interface for AI agent providers.\n * Any MCP that implements this binding can provide configurable AI agents\n * with custom instructions and tool access controls.\n *\n * This binding uses collection bindings for LIST and GET operations (read-only).\n */\n\nimport { z } from \"zod\";\nimport type { Binder } from \"../core/binder\";\nimport {\n BaseCollectionEntitySchema,\n createCollectionBindings,\n} from \"./collections\";\n\n/**\n * Agent entity schema for AI agents\n * Extends BaseCollectionEntitySchema with agent-specific fields\n * Base schema already includes: id, title, created_at, updated_at, created_by, updated_by\n */\nexport const AgentSchema = BaseCollectionEntitySchema.extend({\n // Agent-specific fields\n description: z.string().describe(\"Brief description of the agent's purpose\"),\n instructions: z\n .string()\n .describe(\"System instructions that define the agent's behavior\"),\n tool_set: z\n .record(z.string(), z.array(z.string()))\n .describe(\n \"Map of connection IDs to arrays of allowed tool names for this agent\",\n ),\n avatar: z.string().url().describe(\"URL to the agent's avatar image\"),\n});\n\n/**\n * AGENTS Collection Binding\n *\n * Collection bindings for agents (read-only).\n * Provides LIST and GET operations for AI agents.\n */\nexport const AGENTS_COLLECTION_BINDING = createCollectionBindings(\n \"agents\",\n AgentSchema,\n { readOnly: true },\n);\n\n/**\n * AGENTS Binding\n *\n * Defines the interface for AI agent providers.\n * Any MCP that implements this binding can provide configurable AI agents.\n *\n * Required tools:\n * - COLLECTION_AGENTS_LIST: List available AI agents with their configurations\n * - COLLECTION_AGENTS_GET: Get a single agent by ID (includes instructions and tool_set)\n */\nexport const AGENTS_BINDING = [\n ...AGENTS_COLLECTION_BINDING,\n] as const satisfies Binder;\n"]}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { init_esm_shims } from './chunk-QMQMPK7Q.js';
|
|
2
|
+
import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
|
|
3
|
+
|
|
4
|
+
// src/core/client/http-client-transport.ts
|
|
5
|
+
init_esm_shims();
|
|
6
|
+
var HTTPClientTransport = class extends StreamableHTTPClientTransport {
|
|
7
|
+
constructor(url, opts) {
|
|
8
|
+
super(url, opts);
|
|
9
|
+
}
|
|
10
|
+
send(message, options) {
|
|
11
|
+
const mockAction = getMockActionFor(message);
|
|
12
|
+
if (mockAction?.type === "emit") {
|
|
13
|
+
this.onmessage?.(mockAction.message);
|
|
14
|
+
return Promise.resolve();
|
|
15
|
+
}
|
|
16
|
+
if (mockAction?.type === "suppress") {
|
|
17
|
+
return Promise.resolve();
|
|
18
|
+
}
|
|
19
|
+
return super.send(message, options);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
function getMockActionFor(message) {
|
|
23
|
+
const m = message;
|
|
24
|
+
if (!m || typeof m !== "object" || !("method" in m)) return null;
|
|
25
|
+
switch (m.method) {
|
|
26
|
+
case "initialize": {
|
|
27
|
+
const protocolVersion = m?.params?.protocolVersion;
|
|
28
|
+
if (!protocolVersion) return null;
|
|
29
|
+
return {
|
|
30
|
+
type: "emit",
|
|
31
|
+
message: {
|
|
32
|
+
result: {
|
|
33
|
+
protocolVersion,
|
|
34
|
+
capabilities: { tools: {} },
|
|
35
|
+
serverInfo: { name: "deco-chat-server", version: "1.0.0" }
|
|
36
|
+
},
|
|
37
|
+
jsonrpc: m.jsonrpc ?? "2.0",
|
|
38
|
+
// @ts-expect-error - id is not typed
|
|
39
|
+
id: m.id
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
case "notifications/roots/list_changed":
|
|
44
|
+
case "notifications/initialized":
|
|
45
|
+
case "notifications/cancelled":
|
|
46
|
+
case "notifications/progress": {
|
|
47
|
+
return { type: "suppress" };
|
|
48
|
+
}
|
|
49
|
+
default:
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export { HTTPClientTransport };
|
|
55
|
+
//# sourceMappingURL=chunk-BLCFITZG.js.map
|
|
56
|
+
//# sourceMappingURL=chunk-BLCFITZG.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/core/client/http-client-transport.ts"],"names":[],"mappings":";;;;AAA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,CAAE;AAAA;AACR,OACF;AAAA,IACF;AAAA,IACA,KAAK,kCAAA;AAAA,IACL,KAAK,2BAAA;AAAA,IACL,KAAK,yBAAA;AAAA,IACL,KAAK,wBAAA,EAA0B;AAC7B,MAAA,OAAO,EAAE,MAAM,UAAA,EAAW;AAAA,IAC5B;AAAA,IACA;AACE,MAAA,OAAO,IAAA;AAAA;AAEb","file":"chunk-BLCFITZG.js","sourcesContent":["import type { JSONRPCMessage } from \"@modelcontextprotocol/sdk/types.js\";\nimport {\n StreamableHTTPClientTransport,\n type StreamableHTTPClientTransportOptions,\n} from \"@modelcontextprotocol/sdk/client/streamableHttp.js\";\n\nexport class HTTPClientTransport extends StreamableHTTPClientTransport {\n constructor(url: URL, opts?: StreamableHTTPClientTransportOptions) {\n super(url, opts);\n }\n\n override send(\n message: JSONRPCMessage,\n options?: {\n resumptionToken?: string;\n onresumptiontoken?: (token: string) => void;\n },\n ): Promise<void> {\n const mockAction = getMockActionFor(message);\n if (mockAction?.type === \"emit\") {\n this.onmessage?.(mockAction.message);\n return Promise.resolve();\n }\n if (mockAction?.type === \"suppress\") {\n return Promise.resolve();\n }\n return super.send(message, options);\n }\n}\n\ntype MockAction =\n | { type: \"emit\"; message: JSONRPCMessage }\n | { type: \"suppress\" };\n\nfunction getMockActionFor(message: JSONRPCMessage): MockAction | null {\n const m = message;\n if (!m || typeof m !== \"object\" || !(\"method\" in m)) return null;\n\n switch (m.method) {\n case \"initialize\": {\n const protocolVersion = m?.params?.protocolVersion;\n if (!protocolVersion) return null;\n return {\n type: \"emit\",\n message: {\n result: {\n protocolVersion,\n capabilities: { tools: {} },\n serverInfo: { name: \"deco-chat-server\", version: \"1.0.0\" },\n },\n jsonrpc: m.jsonrpc ?? \"2.0\",\n // @ts-expect-error - id is not typed\n id: m.id,\n } as JSONRPCMessage,\n };\n }\n case \"notifications/roots/list_changed\":\n case \"notifications/initialized\":\n case \"notifications/cancelled\":\n case \"notifications/progress\": {\n return { type: \"suppress\" };\n }\n default:\n return null;\n }\n}\n"]}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import 'path';
|
|
2
|
+
import 'url';
|
|
3
|
+
|
|
4
|
+
var __create = Object.create;
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
11
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
12
|
+
}) : x)(function(x) {
|
|
13
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
14
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
15
|
+
});
|
|
16
|
+
var __esm = (fn, res) => function __init() {
|
|
17
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
18
|
+
};
|
|
19
|
+
var __commonJS = (cb, mod) => function __require2() {
|
|
20
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
21
|
+
};
|
|
22
|
+
var __export = (target, all) => {
|
|
23
|
+
for (var name in all)
|
|
24
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
25
|
+
};
|
|
26
|
+
var __copyProps = (to, from, except, desc) => {
|
|
27
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
28
|
+
for (let key of __getOwnPropNames(from))
|
|
29
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
30
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
31
|
+
}
|
|
32
|
+
return to;
|
|
33
|
+
};
|
|
34
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
35
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
36
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
37
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
38
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
39
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
40
|
+
mod
|
|
41
|
+
));
|
|
42
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
43
|
+
var init_esm_shims = __esm({
|
|
44
|
+
"../../node_modules/tsup/assets/esm_shims.js"() {
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
export { __commonJS, __esm, __export, __require, __toCommonJS, __toESM, init_esm_shims };
|
|
49
|
+
//# sourceMappingURL=chunk-QMQMPK7Q.js.map
|
|
50
|
+
//# sourceMappingURL=chunk-QMQMPK7Q.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../node_modules/tsup/assets/esm_shims.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAA,cAAA,GAAA,KAAA,CAAA;AAAA,EAAA,6CAAA,GAAA;AAAA,EAAA;AAAA,CAAA","file":"chunk-QMQMPK7Q.js","sourcesContent":["// Shim globals in esm bundle\nimport path from 'node:path'\nimport { fileURLToPath } from 'node:url'\n\nconst getFilename = () => fileURLToPath(import.meta.url)\nconst getDirname = () => path.dirname(getFilename())\n\nexport const __dirname = /* @__PURE__ */ getDirname()\nexport const __filename = /* @__PURE__ */ getFilename()\n"]}
|