@decocms/bindings 1.0.1-alpha.25 → 1.0.1-alpha.27

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decocms/bindings",
3
- "version": "1.0.1-alpha.25",
3
+ "version": "1.0.1-alpha.27",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "check": "tsc --noEmit",
@@ -18,7 +18,8 @@
18
18
  "./connection": "./src/core/connection.ts",
19
19
  "./client": "./src/core/client/index.ts",
20
20
  "./mcp": "./src/well-known/mcp.ts",
21
- "./agent": "./src/well-known/agent.ts",
21
+ "./assistant": "./src/well-known/assistant.ts",
22
+ "./prompt": "./src/well-known/prompt.ts",
22
23
  "./workflow": "./src/well-known/workflow.ts"
23
24
  },
24
25
  "engines": {
@@ -0,0 +1,87 @@
1
+ /**
2
+ * Assistants Well-Known Binding
3
+ *
4
+ * Defines the interface for AI assistant providers.
5
+ * Any MCP that implements this binding can provide configurable AI assistants
6
+ * with a system prompt and runtime configuration (gateway + model).
7
+ *
8
+ * This binding uses collection bindings for full CRUD operations.
9
+ */
10
+
11
+ import { z } from "zod";
12
+ import type { Binder } from "../core/binder";
13
+ import {
14
+ BaseCollectionEntitySchema,
15
+ createCollectionBindings,
16
+ } from "./collections";
17
+
18
+ /**
19
+ * Assistant entity schema for AI assistants
20
+ * Extends BaseCollectionEntitySchema with assistant-specific fields
21
+ * Base schema already includes: id, title, created_at, updated_at, created_by, updated_by
22
+ */
23
+ export const AssistantSchema = BaseCollectionEntitySchema.extend({
24
+ /**
25
+ * Assistant avatar.
26
+ * Can be a regular URL or a data URI.
27
+ */
28
+ avatar: z
29
+ .string()
30
+ .describe("URL or data URI to the assistant's avatar image"),
31
+
32
+ /**
33
+ * System prompt that defines the assistant's behavior.
34
+ */
35
+ system_prompt: z
36
+ .string()
37
+ .describe("System prompt that defines the assistant's behavior"),
38
+
39
+ /**
40
+ * Selected gateway for this assistant (single gateway).
41
+ * This gateway determines which MCP tools are exposed to chat.
42
+ */
43
+ gateway_id: z.string().describe("Gateway ID to use for this assistant"),
44
+
45
+ /**
46
+ * Selected model for this assistant (model id + the connection where it lives).
47
+ * This allows the UI/runtime to call the correct model provider connection.
48
+ */
49
+ model: z
50
+ .object({
51
+ id: z.string().describe("Model ID"),
52
+ connectionId: z
53
+ .string()
54
+ .describe("Connection ID that provides the model"),
55
+ })
56
+ .describe("Selected model reference for this assistant"),
57
+ });
58
+
59
+ /**
60
+ * ASSISTANT Collection Binding
61
+ *
62
+ * Collection bindings for assistants.
63
+ * Provides full CRUD operations (LIST, GET, CREATE, UPDATE, DELETE) for AI assistants.
64
+ */
65
+ export const ASSISTANTS_COLLECTION_BINDING = createCollectionBindings(
66
+ "assistant",
67
+ AssistantSchema,
68
+ );
69
+
70
+ /**
71
+ * ASSISTANTS Binding
72
+ *
73
+ * Defines the interface for AI assistant providers.
74
+ * Any MCP that implements this binding can provide configurable AI assistants.
75
+ *
76
+ * Required tools:
77
+ * - COLLECTION_ASSISTANT_LIST: List available AI assistants with their configurations
78
+ * - COLLECTION_ASSISTANT_GET: Get a single assistant by ID (includes system_prompt, gateway_id, model)
79
+ *
80
+ * Optional tools:
81
+ * - COLLECTION_ASSISTANT_CREATE: Create a new assistant
82
+ * - COLLECTION_ASSISTANT_UPDATE: Update an existing assistant
83
+ * - COLLECTION_ASSISTANT_DELETE: Delete an assistant
84
+ */
85
+ export const ASSISTANTS_BINDING = [
86
+ ...ASSISTANTS_COLLECTION_BINDING,
87
+ ] as const satisfies Binder;
@@ -0,0 +1,104 @@
1
+ /**
2
+ * Prompts Well-Known Binding
3
+ *
4
+ * Defines the interface for prompt providers.
5
+ * Any MCP that implements this binding can expose prompts as a collection.
6
+ *
7
+ * This binding uses collection bindings for full CRUD operations.
8
+ */
9
+
10
+ import { z } from "zod";
11
+ import type { Binder } from "../core/binder";
12
+ import { BaseCollectionEntitySchema, createCollectionBindings } from "./collections";
13
+
14
+ /**
15
+ * Schema for prompt arguments that can be passed when getting a prompt
16
+ */
17
+ export const PromptArgumentSchema = z.object({
18
+ name: z.string().describe("Argument name"),
19
+ description: z.string().optional().describe("Argument description"),
20
+ required: z.boolean().optional().describe("Whether argument is required"),
21
+ });
22
+ export type PromptArgument = z.infer<typeof PromptArgumentSchema>;
23
+
24
+ /**
25
+ * Schema for prompt icons for display in user interfaces
26
+ */
27
+ export const PromptIconSchema = z.object({
28
+ src: z.string().url().describe("Icon URL"),
29
+ mimeType: z.string().optional().describe("Icon MIME type"),
30
+ sizes: z.array(z.string()).optional().describe("Icon sizes"),
31
+ });
32
+ export type PromptIcon = z.infer<typeof PromptIconSchema>;
33
+
34
+ /**
35
+ * Schema for content within a prompt message
36
+ */
37
+ export const PromptMessageContentSchema = z.object({
38
+ type: z.enum(["text", "image", "audio", "resource"]).describe("Content type"),
39
+ text: z.string().optional().describe("Text content"),
40
+ data: z.string().optional().describe("Base64-encoded data for image/audio"),
41
+ mimeType: z.string().optional().describe("MIME type for image/audio/resource"),
42
+ resource: z
43
+ .object({
44
+ uri: z.string().describe("Resource URI"),
45
+ mimeType: z.string().optional().describe("Resource MIME type"),
46
+ text: z.string().optional().describe("Resource text content"),
47
+ blob: z.string().optional().describe("Base64-encoded resource blob"),
48
+ })
49
+ .optional()
50
+ .describe("Embedded resource"),
51
+ });
52
+ export type PromptMessageContent = z.infer<typeof PromptMessageContentSchema>;
53
+
54
+ /**
55
+ * Schema for a message in a prompt
56
+ */
57
+ export const PromptMessageSchema = z.object({
58
+ role: z.enum(["user", "assistant"]).describe("Message role"),
59
+ content: PromptMessageContentSchema.describe("Message content"),
60
+ });
61
+ export type PromptMessage = z.infer<typeof PromptMessageSchema>;
62
+
63
+ /**
64
+ * Full prompt entity schema extending base collection fields
65
+ */
66
+ export const PromptSchema = BaseCollectionEntitySchema.extend({
67
+ arguments: z
68
+ .array(PromptArgumentSchema)
69
+ .optional()
70
+ .describe("Arguments that can be passed when getting this prompt"),
71
+ icons: z
72
+ .array(PromptIconSchema)
73
+ .optional()
74
+ .describe("Icons for display in user interfaces"),
75
+ messages: z.array(PromptMessageSchema).describe("Prompt messages template"),
76
+ });
77
+ export type Prompt = z.infer<typeof PromptSchema>;
78
+
79
+ /**
80
+ * PROMPT Collection Binding
81
+ *
82
+ * Collection bindings for prompts.
83
+ * Provides full CRUD operations (LIST, GET, CREATE, UPDATE, DELETE) for prompts.
84
+ */
85
+ export const PROMPTS_COLLECTION_BINDING = createCollectionBindings(
86
+ "prompt",
87
+ PromptSchema,
88
+ );
89
+
90
+ /**
91
+ * PROMPTS Binding
92
+ *
93
+ * Required tools:
94
+ * - COLLECTION_PROMPT_LIST
95
+ * - COLLECTION_PROMPT_GET
96
+ *
97
+ * Optional tools:
98
+ * - COLLECTION_PROMPT_CREATE
99
+ * - COLLECTION_PROMPT_UPDATE
100
+ * - COLLECTION_PROMPT_DELETE
101
+ */
102
+ export const PROMPTS_BINDING = [...PROMPTS_COLLECTION_BINDING] as const satisfies Binder;
103
+
104
+
@@ -1,78 +0,0 @@
1
- /**
2
- * Agents Well-Known Binding
3
- *
4
- * Defines the interface for AI agent providers.
5
- * Any MCP that implements this binding can provide configurable AI agents
6
- * with a system prompt and runtime configuration (gateway + model).
7
- *
8
- * This binding uses collection bindings for LIST and GET operations.
9
- */
10
-
11
- import { z } from "zod";
12
- import type { Binder } from "../core/binder";
13
- import {
14
- BaseCollectionEntitySchema,
15
- createCollectionBindings,
16
- } from "./collections";
17
-
18
- /**
19
- * Agent entity schema for AI agents
20
- * Extends BaseCollectionEntitySchema with agent-specific fields
21
- * Base schema already includes: id, title, created_at, updated_at, created_by, updated_by
22
- */
23
- export const AgentSchema = BaseCollectionEntitySchema.extend({
24
- /**
25
- * Agent avatar.
26
- * Can be a regular URL or a data URI.
27
- */
28
- avatar: z.string().describe("URL or data URI to the agent's avatar image"),
29
-
30
- /**
31
- * System prompt that defines the agent's behavior.
32
- */
33
- system_prompt: z
34
- .string()
35
- .describe("System prompt that defines the agent's behavior"),
36
-
37
- /**
38
- * Selected gateway for this agent (single gateway).
39
- * This gateway determines which MCP tools are exposed to chat.
40
- */
41
- gateway_id: z.string().describe("Gateway ID to use for this agent"),
42
-
43
- /**
44
- * Selected model for this agent (model id + the connection where it lives).
45
- * This allows the UI/runtime to call the correct model provider connection.
46
- */
47
- model: z
48
- .object({
49
- id: z.string().describe("Model ID"),
50
- connectionId: z.string().describe("Connection ID that provides the model"),
51
- })
52
- .describe("Selected model reference for this agent"),
53
- });
54
-
55
- /**
56
- * AGENT Collection Binding
57
- *
58
- * Collection bindings for agents (read-only).
59
- * Provides LIST and GET operations for AI agents.
60
- */
61
- export const AGENTS_COLLECTION_BINDING = createCollectionBindings(
62
- "agent",
63
- AgentSchema,
64
- );
65
-
66
- /**
67
- * AGENTS Binding
68
- *
69
- * Defines the interface for AI agent providers.
70
- * Any MCP that implements this binding can provide configurable AI agents.
71
- *
72
- * Required tools:
73
- * - COLLECTION_AGENT_LIST: List available AI agents with their configurations
74
- * - COLLECTION_AGENT_GET: Get a single agent by ID (includes system_prompt, gateway_id, model)
75
- */
76
- export const AGENTS_BINDING = [
77
- ...AGENTS_COLLECTION_BINDING,
78
- ] as const satisfies Binder;