@decocms/bindings 1.0.1-alpha.26 → 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 +2 -1
- package/src/well-known/assistant.ts +11 -5
- package/src/well-known/prompt.ts +104 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@decocms/bindings",
|
|
3
|
-
"version": "1.0.1-alpha.
|
|
3
|
+
"version": "1.0.1-alpha.27",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"check": "tsc --noEmit",
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"./client": "./src/core/client/index.ts",
|
|
20
20
|
"./mcp": "./src/well-known/mcp.ts",
|
|
21
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": {
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Any MCP that implements this binding can provide configurable AI assistants
|
|
6
6
|
* with a system prompt and runtime configuration (gateway + model).
|
|
7
7
|
*
|
|
8
|
-
* This binding uses collection bindings for
|
|
8
|
+
* This binding uses collection bindings for full CRUD operations.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import { z } from "zod";
|
|
@@ -25,7 +25,9 @@ export const AssistantSchema = BaseCollectionEntitySchema.extend({
|
|
|
25
25
|
* Assistant avatar.
|
|
26
26
|
* Can be a regular URL or a data URI.
|
|
27
27
|
*/
|
|
28
|
-
avatar: z
|
|
28
|
+
avatar: z
|
|
29
|
+
.string()
|
|
30
|
+
.describe("URL or data URI to the assistant's avatar image"),
|
|
29
31
|
|
|
30
32
|
/**
|
|
31
33
|
* System prompt that defines the assistant's behavior.
|
|
@@ -57,8 +59,8 @@ export const AssistantSchema = BaseCollectionEntitySchema.extend({
|
|
|
57
59
|
/**
|
|
58
60
|
* ASSISTANT Collection Binding
|
|
59
61
|
*
|
|
60
|
-
* Collection bindings for assistants
|
|
61
|
-
* Provides LIST
|
|
62
|
+
* Collection bindings for assistants.
|
|
63
|
+
* Provides full CRUD operations (LIST, GET, CREATE, UPDATE, DELETE) for AI assistants.
|
|
62
64
|
*/
|
|
63
65
|
export const ASSISTANTS_COLLECTION_BINDING = createCollectionBindings(
|
|
64
66
|
"assistant",
|
|
@@ -74,8 +76,12 @@ export const ASSISTANTS_COLLECTION_BINDING = createCollectionBindings(
|
|
|
74
76
|
* Required tools:
|
|
75
77
|
* - COLLECTION_ASSISTANT_LIST: List available AI assistants with their configurations
|
|
76
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
|
|
77
84
|
*/
|
|
78
85
|
export const ASSISTANTS_BINDING = [
|
|
79
86
|
...ASSISTANTS_COLLECTION_BINDING,
|
|
80
87
|
] as const satisfies Binder;
|
|
81
|
-
|
|
@@ -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
|
+
|