@weave-kit/engine 1.3.0 → 1.4.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 +12 -0
- package/README.md +4 -4
- package/dist/adapters/mcp/http.d.ts +3 -0
- package/dist/adapters/mcp/http.d.ts.map +1 -1
- package/dist/adapters/mcp/http.js +27 -2
- package/dist/adapters/mcp/http.js.map +1 -1
- package/dist/adapters/mcp/index.d.ts +14 -1
- package/dist/adapters/mcp/index.d.ts.map +1 -1
- package/dist/adapters/mcp/index.js +8 -0
- package/dist/adapters/mcp/index.js.map +1 -1
- package/dist/adapters/mcp/prompts.d.ts +25 -0
- package/dist/adapters/mcp/prompts.d.ts.map +1 -0
- package/dist/adapters/mcp/prompts.js +32 -0
- package/dist/adapters/mcp/prompts.js.map +1 -0
- package/dist/core/i18n/ar.d.ts.map +1 -1
- package/dist/core/i18n/ar.js +2 -0
- package/dist/core/i18n/ar.js.map +1 -1
- package/dist/core/i18n/de.d.ts.map +1 -1
- package/dist/core/i18n/de.js +2 -0
- package/dist/core/i18n/de.js.map +1 -1
- package/dist/core/i18n/en.d.ts +2 -0
- package/dist/core/i18n/en.d.ts.map +1 -1
- package/dist/core/i18n/en.js +2 -0
- package/dist/core/i18n/en.js.map +1 -1
- package/dist/core/i18n/es.d.ts.map +1 -1
- package/dist/core/i18n/es.js +2 -0
- package/dist/core/i18n/es.js.map +1 -1
- package/dist/core/i18n/fr.d.ts.map +1 -1
- package/dist/core/i18n/fr.js +2 -0
- package/dist/core/i18n/fr.js.map +1 -1
- package/dist/core/i18n/hi.d.ts.map +1 -1
- package/dist/core/i18n/hi.js +2 -0
- package/dist/core/i18n/hi.js.map +1 -1
- package/dist/core/i18n/id.d.ts.map +1 -1
- package/dist/core/i18n/id.js +2 -0
- package/dist/core/i18n/id.js.map +1 -1
- package/dist/core/i18n/ja.d.ts.map +1 -1
- package/dist/core/i18n/ja.js +2 -0
- package/dist/core/i18n/ja.js.map +1 -1
- package/dist/core/i18n/ko.d.ts.map +1 -1
- package/dist/core/i18n/ko.js +2 -0
- package/dist/core/i18n/ko.js.map +1 -1
- package/dist/core/i18n/pt.d.ts.map +1 -1
- package/dist/core/i18n/pt.js +2 -0
- package/dist/core/i18n/pt.js.map +1 -1
- package/dist/core/i18n/ru.d.ts.map +1 -1
- package/dist/core/i18n/ru.js +2 -0
- package/dist/core/i18n/ru.js.map +1 -1
- package/dist/core/i18n/vi.d.ts.map +1 -1
- package/dist/core/i18n/vi.js +2 -0
- package/dist/core/i18n/vi.js.map +1 -1
- package/dist/core/i18n/zh-hant.d.ts.map +1 -1
- package/dist/core/i18n/zh-hant.js +2 -0
- package/dist/core/i18n/zh-hant.js.map +1 -1
- package/dist/core/i18n/zh.d.ts.map +1 -1
- package/dist/core/i18n/zh.js +2 -0
- package/dist/core/i18n/zh.js.map +1 -1
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +1 -0
- package/dist/core/index.js.map +1 -1
- package/dist/core/prompts/catalog.d.ts +13 -0
- package/dist/core/prompts/catalog.d.ts.map +1 -0
- package/dist/core/prompts/catalog.js +156 -0
- package/dist/core/prompts/catalog.js.map +1 -0
- package/dist/core/prompts/index.d.ts +3 -0
- package/dist/core/prompts/index.d.ts.map +1 -0
- package/dist/core/prompts/index.js +3 -0
- package/dist/core/prompts/index.js.map +1 -0
- package/dist/core/prompts/values.d.ts +21 -0
- package/dist/core/prompts/values.d.ts.map +1 -0
- package/dist/core/prompts/values.js +23 -0
- package/dist/core/prompts/values.js.map +1 -0
- package/dist/core/provider/index.d.ts +1 -0
- package/dist/core/provider/index.d.ts.map +1 -1
- package/dist/core/provider/index.js +1 -0
- package/dist/core/provider/index.js.map +1 -1
- package/dist/core/provider/prompts/index.d.ts +3 -0
- package/dist/core/provider/prompts/index.d.ts.map +1 -0
- package/dist/core/provider/prompts/index.js +2 -0
- package/dist/core/provider/prompts/index.js.map +1 -0
- package/dist/core/provider/prompts/types.d.ts +58 -0
- package/dist/core/provider/prompts/types.d.ts.map +1 -0
- package/dist/core/provider/prompts/types.js +17 -0
- package/dist/core/provider/prompts/types.js.map +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { describeObject } from '../object/describe.js';
|
|
2
|
+
import { resolvePermissionFor } from '../rbac/index.js';
|
|
3
|
+
import { SchemaError } from '../types/errors.js';
|
|
4
|
+
import { BUILTIN_PROMPTS } from './values.js';
|
|
5
|
+
/**
|
|
6
|
+
* Built-in MCP prompts, derived from the schema (not authored business content),
|
|
7
|
+
* so a headless engine can still guide an agent to use its own tool surface:
|
|
8
|
+
*
|
|
9
|
+
* explore_data → the list_objects → describe_object → search_records flow
|
|
10
|
+
* object_guide(object) → one object's descriptor + which tools to use
|
|
11
|
+
* build_filter(object) → how to shape a search_records filter
|
|
12
|
+
* run_workflow(object) → the object's workflow transitions
|
|
13
|
+
*
|
|
14
|
+
* The surface is RBAC-filtered per identity (only readable objects appear), and
|
|
15
|
+
* every render re-checks the identity's permissions (list + get, like the tool
|
|
16
|
+
* surface). Instruction text is English (matching the tool descriptions); the
|
|
17
|
+
* schema payload is language-neutral JSON.
|
|
18
|
+
*/
|
|
19
|
+
const OBJECT_ARG_DESC = 'object name (see list_objects)';
|
|
20
|
+
function text(message) {
|
|
21
|
+
return { role: 'user', content: { type: 'text', text: message } };
|
|
22
|
+
}
|
|
23
|
+
/** objects the identity may read (mirrors `list_objects`) */
|
|
24
|
+
function readableObjects(registry, roles) {
|
|
25
|
+
return registry.list().filter((def) => resolvePermissionFor(registry, def, roles)?.read !== undefined);
|
|
26
|
+
}
|
|
27
|
+
/** the built-in prompts visible to the identity (empty when it can read nothing) */
|
|
28
|
+
export function builtinPromptDescriptors(registry, roles) {
|
|
29
|
+
const readable = readableObjects(registry, roles);
|
|
30
|
+
if (readable.length === 0)
|
|
31
|
+
return [];
|
|
32
|
+
const prompts = [
|
|
33
|
+
{
|
|
34
|
+
name: BUILTIN_PROMPTS.EXPLORE,
|
|
35
|
+
description: 'Step-by-step guide to explore data with the built-in tools',
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
name: BUILTIN_PROMPTS.OBJECT_GUIDE,
|
|
39
|
+
description: 'Guidance for working with one object (fields, relations and your permissions)',
|
|
40
|
+
arguments: [{ name: 'object', description: OBJECT_ARG_DESC, required: true }],
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: BUILTIN_PROMPTS.BUILD_FILTER,
|
|
44
|
+
description: 'How to build a search_records filter for one object',
|
|
45
|
+
arguments: [{ name: 'object', description: OBJECT_ARG_DESC, required: true }],
|
|
46
|
+
},
|
|
47
|
+
];
|
|
48
|
+
if (readable.some((def) => def.workflow !== undefined)) {
|
|
49
|
+
prompts.push({
|
|
50
|
+
name: BUILTIN_PROMPTS.RUN_WORKFLOW,
|
|
51
|
+
description: 'How to fire a workflow transition on one object',
|
|
52
|
+
arguments: [{ name: 'object', description: OBJECT_ARG_DESC, required: true }],
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
return prompts;
|
|
56
|
+
}
|
|
57
|
+
function requireArg(args, key, name, locale) {
|
|
58
|
+
const value = args[key];
|
|
59
|
+
if (typeof value !== 'string' || value.length === 0) {
|
|
60
|
+
throw new SchemaError('prompt.args.invalid', { name, detail: `missing required argument "${key}"` }, locale);
|
|
61
|
+
}
|
|
62
|
+
return value;
|
|
63
|
+
}
|
|
64
|
+
function exploreText() {
|
|
65
|
+
return [
|
|
66
|
+
'Explore the data available to you through the WeaveKit tools.',
|
|
67
|
+
'',
|
|
68
|
+
'1. Call list_objects to see the objects your identity can read.',
|
|
69
|
+
'2. Call describe_object for one to get its fields, relations and your permissions.',
|
|
70
|
+
'3. Call search_records (with a filter/sort/limit) to read rows — rows are already scoped to what you may see.',
|
|
71
|
+
'4. Use get_record for one row, and create_record / update_record / delete_record to write (only permitted fields).',
|
|
72
|
+
'',
|
|
73
|
+
'Start with list_objects and tell me what you find.',
|
|
74
|
+
].join('\n');
|
|
75
|
+
}
|
|
76
|
+
function objectGuideText(descriptor, name) {
|
|
77
|
+
return [
|
|
78
|
+
`Work with the "${name}" object.`,
|
|
79
|
+
'',
|
|
80
|
+
'Metadata (schema + your permissions):',
|
|
81
|
+
JSON.stringify(descriptor, null, 2),
|
|
82
|
+
'',
|
|
83
|
+
'Guidance:',
|
|
84
|
+
`- Read rows with search_records (object="${name}"); fetch one with get_record (id = the record id).`,
|
|
85
|
+
'- Write with create_record / update_record / delete_record; only fields your role permits are accepted.',
|
|
86
|
+
'- Row scope is applied automatically; use describe_object to refresh this metadata at any time.',
|
|
87
|
+
].join('\n');
|
|
88
|
+
}
|
|
89
|
+
function buildFilterText(name, fields) {
|
|
90
|
+
const lines = fields.map((f) => `- ${f.name} (${f.type})`);
|
|
91
|
+
return [
|
|
92
|
+
`Build a search_records filter for "${name}".`,
|
|
93
|
+
'',
|
|
94
|
+
'Readable fields:',
|
|
95
|
+
...lines,
|
|
96
|
+
'',
|
|
97
|
+
'Filter shape: { "<field>": <value> } for equality, or { "<field>": { "<op>": <value> } } for an operator',
|
|
98
|
+
'(eq, ne, gt, gte, lt, lte, in, contains, like). Multiple fields are AND\u2019d; use { "$or": [ ... ] } for OR.',
|
|
99
|
+
'sort is an array of { field, direction } (asc | desc).',
|
|
100
|
+
`Call search_records with object="${name}" and your filter.`,
|
|
101
|
+
].join('\n');
|
|
102
|
+
}
|
|
103
|
+
function runWorkflowText(name, workflow) {
|
|
104
|
+
return [
|
|
105
|
+
`Fire a workflow transition on "${name}".`,
|
|
106
|
+
'',
|
|
107
|
+
'Workflow (states + transitions):',
|
|
108
|
+
JSON.stringify(workflow, null, 2),
|
|
109
|
+
'',
|
|
110
|
+
`Call workflow_transition with object="${name}", id=<record id>, and action=<a transition allowed from the`,
|
|
111
|
+
'record\u2019s current state and by your role \u2014 see describe_object \u2192 workflow).',
|
|
112
|
+
].join('\n');
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Render a built-in prompt. Throws `prompt.args.invalid` (missing/empty arg or a
|
|
116
|
+
* non-workflow object for `run_workflow`), `data.objectUnknown` (unknown object)
|
|
117
|
+
* or `rbac.denied.read` (identity may not read the object) — mapping to a
|
|
118
|
+
* protocol error at the MCP layer.
|
|
119
|
+
*/
|
|
120
|
+
export function renderBuiltinPrompt(registry, name, args, roles, locale) {
|
|
121
|
+
switch (name) {
|
|
122
|
+
case BUILTIN_PROMPTS.EXPLORE:
|
|
123
|
+
return { description: 'Explore the available data', messages: [text(exploreText())] };
|
|
124
|
+
case BUILTIN_PROMPTS.OBJECT_GUIDE: {
|
|
125
|
+
const object = requireArg(args, 'object', name, locale);
|
|
126
|
+
const descriptor = describeObject(registry, object, roles, locale);
|
|
127
|
+
return {
|
|
128
|
+
description: `Work with the "${object}" object`,
|
|
129
|
+
messages: [text(objectGuideText(descriptor, object))],
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
case BUILTIN_PROMPTS.BUILD_FILTER: {
|
|
133
|
+
const object = requireArg(args, 'object', name, locale);
|
|
134
|
+
const descriptor = describeObject(registry, object, roles, locale);
|
|
135
|
+
const fields = descriptor.fields.filter((f) => f.virtual !== true).map((f) => ({ name: f.name, type: f.type }));
|
|
136
|
+
return {
|
|
137
|
+
description: `Build a search_records filter for "${object}"`,
|
|
138
|
+
messages: [text(buildFilterText(object, fields))],
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
case BUILTIN_PROMPTS.RUN_WORKFLOW: {
|
|
142
|
+
const object = requireArg(args, 'object', name, locale);
|
|
143
|
+
const descriptor = describeObject(registry, object, roles, locale);
|
|
144
|
+
if (descriptor.workflow === undefined) {
|
|
145
|
+
throw new SchemaError('prompt.args.invalid', { name, detail: `object "${object}" has no workflow` }, locale);
|
|
146
|
+
}
|
|
147
|
+
return {
|
|
148
|
+
description: `Fire a workflow transition on "${object}"`,
|
|
149
|
+
messages: [text(runWorkflowText(object, descriptor.workflow))],
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
default:
|
|
153
|
+
throw new SchemaError('prompt.notFound', { name }, locale);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
//# sourceMappingURL=catalog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalog.js","sourceRoot":"","sources":["../../../src/core/prompts/catalog.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAExD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C;;;;;;;;;;;;;GAaG;AAEH,MAAM,eAAe,GAAG,gCAAgC,CAAC;AAEzD,SAAS,IAAI,CAAC,OAAe;IAC3B,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC;AACpE,CAAC;AAED,6DAA6D;AAC7D,SAAS,eAAe,CAAC,QAAwB,EAAE,KAAwB;IACzE,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,oBAAoB,CAAC,QAAQ,EAAE,GAAG,EAAE,KAAK,CAAC,EAAE,IAAI,KAAK,SAAS,CAAC,CAAC;AACzG,CAAC;AAED,oFAAoF;AACpF,MAAM,UAAU,wBAAwB,CAAC,QAAwB,EAAE,KAAwB;IACzF,MAAM,QAAQ,GAAG,eAAe,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IAClD,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAErC,MAAM,OAAO,GAAuB;QAClC;YACE,IAAI,EAAE,eAAe,CAAC,OA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ACJ,CAAC;QACD,KAAK,eAAe,CAAC,YAAY,CAAC,CAAC,CAAC;YAClC,MAAM,MAAM,GAAG,UAAU,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;YACxD,MAAM,UAAU,GAAG,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;YACnE,IAAI,UAAU,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;gBACtC,MAAM,IAAI,WAAW,CAAC,qBAAqB,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,MAAM,mBAAmB,EAAE,EAAE,MAAM,CAAC,CAAC;YAC/G,CAAC;YACD,OAAO;gBACL,WAAW,EAAE,kCAAkC,MAAM,GAAG;gBACxD,QAAQ,EAAE,CAAC,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC;aAC/D,CAAC;QACJ,CAAC;QACD;YACE,MAAM,IAAI,WAAW,CAAC,iBAAiB,EAAE,EAAE,IAAI,EAAE,EAAE,MAAM,CAAC,CAAC;IAC/D,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/prompts/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/prompts/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in prompt names — single source of truth (`as const`, see AGENTS.md).
|
|
3
|
+
*
|
|
4
|
+
* The engine's built-in prompts are **schema-derived and identity-filtered**
|
|
5
|
+
* (see `catalog.ts`); they teach an agent to use the engine's own tool surface.
|
|
6
|
+
* A host provider must not reuse these names (`isBuiltinPromptName`).
|
|
7
|
+
*/
|
|
8
|
+
export declare const BUILTIN_PROMPTS: {
|
|
9
|
+
/** meta guide: list_objects → describe_object → search_records */
|
|
10
|
+
readonly EXPLORE: "explore_data";
|
|
11
|
+
/** embed one object's descriptor + tool guidance */
|
|
12
|
+
readonly OBJECT_GUIDE: "object_guide";
|
|
13
|
+
/** how to build a `search_records` filter for one object */
|
|
14
|
+
readonly BUILD_FILTER: "build_filter";
|
|
15
|
+
/** how to fire a workflow transition on one object */
|
|
16
|
+
readonly RUN_WORKFLOW: "run_workflow";
|
|
17
|
+
};
|
|
18
|
+
export type BuiltinPrompt = typeof BUILTIN_PROMPTS[keyof typeof BUILTIN_PROMPTS];
|
|
19
|
+
/** true when a name is a reserved built-in prompt (a provider may not override it) */
|
|
20
|
+
export declare function isBuiltinPromptName(name: string): boolean;
|
|
21
|
+
//# sourceMappingURL=values.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"values.d.ts","sourceRoot":"","sources":["../../../src/core/prompts/values.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,eAAe;IAC1B,kEAAkE;;IAElE,oDAAoD;;IAEpD,4DAA4D;;IAE5D,sDAAsD;;CAE9C,CAAC;AACX,MAAM,MAAM,aAAa,GAAG,OAAO,eAAe,CAAC,MAAM,OAAO,eAAe,CAAC,CAAC;AAIjF,sFAAsF;AACtF,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEzD"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in prompt names — single source of truth (`as const`, see AGENTS.md).
|
|
3
|
+
*
|
|
4
|
+
* The engine's built-in prompts are **schema-derived and identity-filtered**
|
|
5
|
+
* (see `catalog.ts`); they teach an agent to use the engine's own tool surface.
|
|
6
|
+
* A host provider must not reuse these names (`isBuiltinPromptName`).
|
|
7
|
+
*/
|
|
8
|
+
export const BUILTIN_PROMPTS = {
|
|
9
|
+
/** meta guide: list_objects → describe_object → search_records */
|
|
10
|
+
EXPLORE: 'explore_data',
|
|
11
|
+
/** embed one object's descriptor + tool guidance */
|
|
12
|
+
OBJECT_GUIDE: 'object_guide',
|
|
13
|
+
/** how to build a `search_records` filter for one object */
|
|
14
|
+
BUILD_FILTER: 'build_filter',
|
|
15
|
+
/** how to fire a workflow transition on one object */
|
|
16
|
+
RUN_WORKFLOW: 'run_workflow',
|
|
17
|
+
};
|
|
18
|
+
const builtinNames = Object.values(BUILTIN_PROMPTS);
|
|
19
|
+
/** true when a name is a reserved built-in prompt (a provider may not override it) */
|
|
20
|
+
export function isBuiltinPromptName(name) {
|
|
21
|
+
return builtinNames.includes(name);
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=values.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"values.js","sourceRoot":"","sources":["../../../src/core/prompts/values.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,kEAAkE;IAClE,OAAO,EAAE,cAAc;IACvB,oDAAoD;IACpD,YAAY,EAAE,cAAc;IAC5B,4DAA4D;IAC5D,YAAY,EAAE,cAAc;IAC5B,sDAAsD;IACtD,YAAY,EAAE,cAAc;CACpB,CAAC;AAGX,MAAM,YAAY,GAAsB,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;AAEvE,sFAAsF;AACtF,MAAM,UAAU,mBAAmB,CAAC,IAAY;IAC9C,OAAO,YAAY,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AACrC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/provider/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/provider/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/provider/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/provider/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/provider/prompts/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,cAAc,EACd,UAAU,EACV,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,aAAa,EACb,eAAe,GAChB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/core/provider/prompts/index.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP prompts seam.
|
|
3
|
+
*
|
|
4
|
+
* MCP exposes three primitives: **tools** (the model calls), **resources** (the
|
|
5
|
+
* app/user attaches context) and **prompts** (the *user* triggers a template
|
|
6
|
+
* that expands into a set of messages). Prompts are inherently user-facing and
|
|
7
|
+
* often business-flavored, so the engine does not author them: it ships a small
|
|
8
|
+
* set of **schema-derived** built-in prompts (see `core/prompts`) and lets a host
|
|
9
|
+
* inject its own via this provider seam.
|
|
10
|
+
*
|
|
11
|
+
* The engine treats provider content as opaque (it only keeps the shape) — a
|
|
12
|
+
* console/enterprise/plugin supplies the business templates. With no provider
|
|
13
|
+
* configured only the built-in prompts are exposed.
|
|
14
|
+
*/
|
|
15
|
+
/** one argument a prompt accepts (MCP arguments are always strings) */
|
|
16
|
+
export interface PromptArgument {
|
|
17
|
+
name: string;
|
|
18
|
+
description?: string;
|
|
19
|
+
required?: boolean;
|
|
20
|
+
}
|
|
21
|
+
/** the roles a prompt message may carry (mirrors the MCP protocol) */
|
|
22
|
+
export type PromptRole = 'user' | 'assistant';
|
|
23
|
+
/** one message a prompt expands to */
|
|
24
|
+
export interface PromptMessage {
|
|
25
|
+
role: PromptRole;
|
|
26
|
+
content: {
|
|
27
|
+
type: 'text';
|
|
28
|
+
text: string;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
/** a prompt as advertised by `prompts/list` */
|
|
32
|
+
export interface PromptDescriptor {
|
|
33
|
+
name: string;
|
|
34
|
+
description?: string;
|
|
35
|
+
arguments?: PromptArgument[];
|
|
36
|
+
}
|
|
37
|
+
/** the expansion of a prompt, returned by `prompts/get` */
|
|
38
|
+
export interface PromptResult {
|
|
39
|
+
description?: string;
|
|
40
|
+
messages: PromptMessage[];
|
|
41
|
+
}
|
|
42
|
+
/** the identity context a provider filters by (never a secret) */
|
|
43
|
+
export interface PromptSubject {
|
|
44
|
+
subjectId: string;
|
|
45
|
+
roles: string[];
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* A host-injected prompt provider. `list` returns the descriptors visible to
|
|
49
|
+
* the subject; `get` expands one (return `null` for an unknown name so the
|
|
50
|
+
* engine can answer `prompt.notFound`). Both may be async.
|
|
51
|
+
*/
|
|
52
|
+
export interface PromptsProvider {
|
|
53
|
+
list(ctx: PromptSubject): PromptDescriptor[] | Promise<PromptDescriptor[]>;
|
|
54
|
+
get(name: string, args: Record<string, string>, ctx: PromptSubject): PromptResult | null | Promise<PromptResult | null>;
|
|
55
|
+
}
|
|
56
|
+
/** contract version for `PromptsProvider` implementers (stable seam) */
|
|
57
|
+
export declare const PROMPTS_API = 1;
|
|
58
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/core/provider/prompts/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,uEAAuE;AACvE,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,sEAAsE;AACtE,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,WAAW,CAAC;AAE9C,sCAAsC;AACtC,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,UAAU,CAAC;IACjB,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;CACzC;AAED,+CAA+C;AAC/C,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,cAAc,EAAE,CAAC;CAC9B;AAED,2DAA2D;AAC3D,MAAM,WAAW,YAAY;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,aAAa,EAAE,CAAC;CAC3B;AAED,kEAAkE;AAClE,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAED;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,CAAC,GAAG,EAAE,aAAa,GAAG,gBAAgB,EAAE,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAAC;IAC3E,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,GAAG,EAAE,aAAa,GAAG,YAAY,GAAG,IAAI,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC;CACzH;AAED,wEAAwE;AACxE,eAAO,MAAM,WAAW,IAAI,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP prompts seam.
|
|
3
|
+
*
|
|
4
|
+
* MCP exposes three primitives: **tools** (the model calls), **resources** (the
|
|
5
|
+
* app/user attaches context) and **prompts** (the *user* triggers a template
|
|
6
|
+
* that expands into a set of messages). Prompts are inherently user-facing and
|
|
7
|
+
* often business-flavored, so the engine does not author them: it ships a small
|
|
8
|
+
* set of **schema-derived** built-in prompts (see `core/prompts`) and lets a host
|
|
9
|
+
* inject its own via this provider seam.
|
|
10
|
+
*
|
|
11
|
+
* The engine treats provider content as opaque (it only keeps the shape) — a
|
|
12
|
+
* console/enterprise/plugin supplies the business templates. With no provider
|
|
13
|
+
* configured only the built-in prompts are exposed.
|
|
14
|
+
*/
|
|
15
|
+
/** contract version for `PromptsProvider` implementers (stable seam) */
|
|
16
|
+
export const PROMPTS_API = 1;
|
|
17
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/core/provider/prompts/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AA+CH,wEAAwE;AACxE,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC"}
|
package/dist/version.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** engine version — single source of truth for CLI, ops routes and MCP metadata */
|
|
2
|
-
export declare const version = "1.
|
|
2
|
+
export declare const version = "1.4.0";
|
|
3
3
|
/**
|
|
4
4
|
* Frozen public-contract version (G1). Bump only on a **breaking** change to the
|
|
5
5
|
* frozen surface (schema/workflow format, REST routes, MCP tool names, event
|
package/dist/version.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** engine version — single source of truth for CLI, ops routes and MCP metadata */
|
|
2
|
-
export const version = '1.
|
|
2
|
+
export const version = '1.4.0';
|
|
3
3
|
/**
|
|
4
4
|
* Frozen public-contract version (G1). Bump only on a **breaking** change to the
|
|
5
5
|
* frozen surface (schema/workflow format, REST routes, MCP tool names, event
|