@matatbread/matbot-core 0.2.5 → 0.2.7
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
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"node",
|
|
5
5
|
"browser"
|
|
6
6
|
],
|
|
7
|
-
"version": "0.2.
|
|
7
|
+
"version": "0.2.7",
|
|
8
8
|
"engines": {
|
|
9
9
|
"node": ">=24.0.0"
|
|
10
10
|
},
|
|
@@ -35,10 +35,10 @@
|
|
|
35
35
|
"access": "public"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@matatbread/matbot-plugin-api": "^0.2.
|
|
38
|
+
"@matatbread/matbot-plugin-api": "^0.2.7"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"typescript": "^
|
|
41
|
+
"typescript": "^6.0.3"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
44
|
"typecheck": "tsc --noEmit"
|
|
@@ -114,6 +114,15 @@ export class LookupKnowledgeIndex implements KnowledgeIndex {
|
|
|
114
114
|
this.docs.add(entry);
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
+
async remove(id: string): Promise<void> {
|
|
118
|
+
for (const existing of this.docs) {
|
|
119
|
+
if (existing.id === id) {
|
|
120
|
+
this.docs.delete(existing);
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
117
126
|
async search(
|
|
118
127
|
terms: Array<{ term: string; context?: string }>,
|
|
119
128
|
_signal: AbortSignal,
|
package/src/loader.ts
CHANGED
|
@@ -118,7 +118,7 @@ export async function loadPlugins(
|
|
|
118
118
|
),
|
|
119
119
|
);
|
|
120
120
|
|
|
121
|
-
const toLoad: { spec: string; importSpec: string; name?: string; runtimes?: readonly Runtime[] }[] = [];
|
|
121
|
+
const toLoad: { spec: string; importSpec: string; resolvedUrl: string; name?: string; runtimes?: readonly Runtime[] }[] = [];
|
|
122
122
|
for (let i = 0; i < reqs.length; i++) {
|
|
123
123
|
const { spec, importSpec, name } = reqs[i]!;
|
|
124
124
|
const runtimes = declared[i];
|
|
@@ -132,6 +132,10 @@ export async function loadPlugins(
|
|
|
132
132
|
toLoad.push({
|
|
133
133
|
spec,
|
|
134
134
|
importSpec: freshImportSpec(spec, importSpec, bustCache),
|
|
135
|
+
// The resolved location WITHOUT the reload cache-bust stamp — a stable `file:`/bare URL a
|
|
136
|
+
// consumer can map back to source (e.g. skills_compiler building a types program over the
|
|
137
|
+
// live plugin set). Falls back to the bare spec when the host pre-resolved nothing.
|
|
138
|
+
resolvedUrl: importSpec ?? spec,
|
|
135
139
|
...(name !== undefined ? { name } : {}),
|
|
136
140
|
...(runtimes !== undefined ? { runtimes } : {}),
|
|
137
141
|
});
|
|
@@ -211,7 +215,8 @@ export async function loadPlugins(
|
|
|
211
215
|
const plugin: MatbotPlugin = {
|
|
212
216
|
...spec_obj,
|
|
213
217
|
name,
|
|
214
|
-
specifier:
|
|
218
|
+
specifier: spec,
|
|
219
|
+
resolvedUrl: toLoad[i]!.resolvedUrl,
|
|
215
220
|
...(source !== undefined ? { source } : {}),
|
|
216
221
|
...(runtimes !== undefined ? { matbotRuntime: runtimes } : {}),
|
|
217
222
|
};
|
package/src/security/vault.ts
CHANGED
|
@@ -37,7 +37,8 @@ export class VaultImpl implements Vault {
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
async writeSecret(name: string, value: string): Promise<void> {
|
|
40
|
-
this.store.
|
|
40
|
+
if (value === '') this.store.delete(name);
|
|
41
|
+
else this.store.set(name, value);
|
|
41
42
|
}
|
|
42
43
|
|
|
43
44
|
hasKey(name: string): boolean {
|
package/src/single-turn.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import type { Tool, ToolExecutor,
|
|
1
|
+
import type { Tool, ToolExecutor, ToolResultOf, ToolContext, MatbotMachine } from '@matatbread/matbot-plugin-api';
|
|
2
|
+
|
|
3
|
+
declare module '@matatbread/matbot-plugin-api' {
|
|
4
|
+
interface ToolResults {
|
|
5
|
+
single_turn: { text: string }; // the consulted provider's reply text
|
|
6
|
+
}
|
|
7
|
+
}
|
|
2
8
|
|
|
3
9
|
/**
|
|
4
10
|
* Exposes {@link MatbotMachine.singleTurn} to the model: a one-shot completion against a configured
|
|
@@ -12,9 +18,9 @@ import type { Tool, ToolExecutor, ToolContext, ToolEvent, MatbotMachine } from '
|
|
|
12
18
|
* a core service (`singleTurn`); core is also the one cross-runtime home both the node app and the
|
|
13
19
|
* browser bundle register it from — the tool-plugin barrel (where `plugin`/`provider` live) is node-only.
|
|
14
20
|
*/
|
|
15
|
-
export function createSingleTurnTool(services: MatbotMachine): Tool {
|
|
16
|
-
const executor: ToolExecutor = {
|
|
17
|
-
async *execute(input: unknown, ctx: ToolContext)
|
|
21
|
+
export function createSingleTurnTool(services: MatbotMachine): Tool<ToolResultOf<'single_turn'>> {
|
|
22
|
+
const executor: ToolExecutor<ToolResultOf<'single_turn'>> = {
|
|
23
|
+
async *execute(input: unknown, ctx: ToolContext) {
|
|
18
24
|
const args = input as { provider?: string; prompt?: string; system?: string };
|
|
19
25
|
if (typeof args.prompt !== 'string') { yield { type: 'error', message: 'single_turn requires a string "prompt".' }; return; }
|
|
20
26
|
const provider = args.provider ?? ctx.provider;
|