@amalgm/tools 0.1.3 → 0.1.4
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/PURPOSE.md +32 -8
- package/README.md +22 -0
- package/dist/apply-definition.d.ts +12 -0
- package/dist/apply-definition.js +33 -0
- package/dist/artifact-files.d.ts +1 -1
- package/dist/artifact-files.js +4 -3
- package/dist/artifacts.d.ts +5 -5
- package/dist/artifacts.js +5 -5
- package/dist/definition.js +10 -0
- package/dist/deployment-files.d.ts +10 -0
- package/dist/deployment-files.js +38 -0
- package/dist/deployment-types.d.ts +32 -0
- package/dist/deployment-types.js +1 -0
- package/dist/deployments.d.ts +19 -0
- package/dist/deployments.js +98 -0
- package/dist/host-mcp-tool.d.ts +8 -0
- package/dist/host-mcp-tool.js +40 -0
- package/dist/http.js +6 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +3 -1
- package/dist/mcp-server.d.ts +2 -1
- package/dist/mcp-server.js +3 -2
- package/dist/mcp.d.ts +2 -1
- package/dist/mcp.js +33 -21
- package/dist/notifications.js +4 -3
- package/dist/schema.js +15 -0
- package/dist/store.d.ts +17 -4
- package/dist/store.js +105 -41
- package/dist/toolbox-deployments.d.ts +30 -0
- package/dist/toolbox-deployments.js +125 -0
- package/dist/toolbox-projection.d.ts +13 -0
- package/dist/toolbox-projection.js +41 -0
- package/dist/toolbox-view.d.ts +35 -0
- package/dist/toolbox-view.js +75 -0
- package/dist/toolbox.d.ts +13 -5
- package/dist/toolbox.js +88 -111
- package/dist/types.d.ts +30 -1
- package/dist/updates.d.ts +2 -1
- package/dist/updates.js +12 -1
- package/docs/ENGINE_INTEGRATION.md +5 -2
- package/package.json +1 -1
package/dist/toolbox.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import type { ActionDefinition, ActionPatch, ActionRecord, ApplyResult, CallOptions, Catalog, LoadoutInput, ToolDefinition, ToolboxOptions, ToolPatch, ToolQuery, ToolRecord, ToolResult } from './types.js';
|
|
1
|
+
import type { ActionDefinition, ActionPatch, ActionRecord, ApplyResult, CallOptions, Catalog, LoadoutInput, ToolDefinition, ToolboxOptions, ToolDeployment, ToolDeploymentActivation, ToolDeploymentSnapshot, ToolDeploymentSurface, ToolPatch, ToolQuery, ToolRecord, ToolResult } from './types.js';
|
|
2
2
|
declare class Toolbox {
|
|
3
3
|
private readonly store;
|
|
4
|
-
private readonly
|
|
4
|
+
private readonly deploymentService;
|
|
5
|
+
private readonly projection;
|
|
5
6
|
private readonly system;
|
|
6
7
|
private readonly drivers;
|
|
7
|
-
private readonly
|
|
8
|
+
private readonly view;
|
|
8
9
|
constructor(options?: ToolboxOptions);
|
|
9
10
|
catalog(): Catalog;
|
|
10
11
|
list(loadout?: LoadoutInput): Array<{
|
|
@@ -35,12 +36,19 @@ declare class Toolbox {
|
|
|
35
36
|
updateAction(actionId: string, patch: ActionPatch): Promise<ActionRecord>;
|
|
36
37
|
setStatus(recordId: string, status: 'enabled' | 'disabled'): Promise<ToolRecord | ActionRecord>;
|
|
37
38
|
remove(recordId: string): Promise<ToolRecord | ActionRecord>;
|
|
39
|
+
currentDeployment(toolId: string): ToolDeployment | null;
|
|
40
|
+
deployment(deploymentId: string): ToolDeployment | null;
|
|
41
|
+
deploymentHistory(toolId: string): ToolDeployment[];
|
|
42
|
+
deploymentSnapshot(): ToolDeploymentSnapshot;
|
|
43
|
+
/** Apply an officially ordered remote activation without emitting it again. */
|
|
44
|
+
activateDeployment(activation: ToolDeploymentActivation): Promise<ApplyResult | null>;
|
|
45
|
+
/** Replace local materialization during Live hydration or gap recovery. */
|
|
46
|
+
applyDeploymentSnapshot(snapshot: ToolDeploymentSnapshot): Promise<void>;
|
|
47
|
+
deploymentSurface(): ToolDeploymentSurface;
|
|
38
48
|
connections(loadout?: LoadoutInput): ToolRecord[];
|
|
39
49
|
call(actionId: string, input?: unknown, options?: CallOptions): Promise<ToolResult>;
|
|
40
50
|
hasDriver(tool: ToolRecord): boolean;
|
|
41
51
|
callMcp(name: string, input?: unknown, options?: CallOptions): Promise<ToolResult>;
|
|
42
|
-
private changed;
|
|
43
|
-
private driverFor;
|
|
44
52
|
close(): void;
|
|
45
53
|
}
|
|
46
54
|
export { Toolbox };
|
package/dist/toolbox.js
CHANGED
|
@@ -2,16 +2,19 @@ import os from 'node:os';
|
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { resolveProductStateDir } from '@amalgm/core/identity';
|
|
4
4
|
import { apiDriver } from './api-driver.js';
|
|
5
|
+
import { applyDefinition } from './apply-definition.js';
|
|
5
6
|
import { ArtifactFiles } from './artifact-files.js';
|
|
6
|
-
import {
|
|
7
|
+
import { preserveProjectionTime } from './artifacts.js';
|
|
7
8
|
import { cliDriver } from './cli-driver.js';
|
|
9
|
+
import { DeploymentFiles } from './deployment-files.js';
|
|
10
|
+
import { deploymentRevisionId } from './deployments.js';
|
|
8
11
|
import { normalizeDefinition } from './definition.js';
|
|
9
|
-
import { assertMcpNamesUnique, id
|
|
10
|
-
import { validateInput } from './input.js';
|
|
11
|
-
import { callableActions, queryTools, resolveAction, resolveCallableAction } from './query.js';
|
|
12
|
-
import { findSelected, selected } from './selection.js';
|
|
12
|
+
import { assertMcpNamesUnique, id } from './ids.js';
|
|
13
13
|
import { Store } from './store.js';
|
|
14
|
-
import {
|
|
14
|
+
import { ToolboxDeployments } from './toolbox-deployments.js';
|
|
15
|
+
import { ToolboxProjection } from './toolbox-projection.js';
|
|
16
|
+
import { ToolboxView } from './toolbox-view.js';
|
|
17
|
+
import { removeAction, updateAction, updateTool, upsertAction } from './updates.js';
|
|
15
18
|
function defaultDatabase(options) {
|
|
16
19
|
if (options.databaseFile)
|
|
17
20
|
return path.resolve(options.databaseFile);
|
|
@@ -29,16 +32,17 @@ function defaultDatabase(options) {
|
|
|
29
32
|
}
|
|
30
33
|
class Toolbox {
|
|
31
34
|
store;
|
|
32
|
-
|
|
35
|
+
deploymentService;
|
|
36
|
+
projection;
|
|
33
37
|
system;
|
|
34
38
|
drivers = new Map();
|
|
35
|
-
|
|
39
|
+
view;
|
|
36
40
|
constructor(options = {}) {
|
|
37
41
|
const databaseFile = defaultDatabase(options);
|
|
38
42
|
this.store = new Store(databaseFile);
|
|
39
|
-
|
|
40
|
-
const
|
|
41
|
-
|
|
43
|
+
const artifacts = new ArtifactFiles(path.dirname(databaseFile));
|
|
44
|
+
const deploymentFiles = new DeploymentFiles(path.resolve(options.deploymentDir || options.stateDir || path.dirname(databaseFile)));
|
|
45
|
+
const priorIndex = artifacts.readIndex();
|
|
42
46
|
for (const driver of [cliDriver, apiDriver, ...(options.drivers || [])])
|
|
43
47
|
this.drivers.set(driver.type, driver);
|
|
44
48
|
const tools = [];
|
|
@@ -51,9 +55,27 @@ class Toolbox {
|
|
|
51
55
|
actions.push(...normalized.actions.map((action) => preserveProjectionTime(action, priorIndex?.toolActions[action.id])));
|
|
52
56
|
}
|
|
53
57
|
assertMcpNamesUnique(actions);
|
|
54
|
-
this.system = {
|
|
55
|
-
|
|
56
|
-
|
|
58
|
+
this.system = {
|
|
59
|
+
version: 1,
|
|
60
|
+
revision: 0,
|
|
61
|
+
revisionId: deploymentRevisionId({ heads: {}, systemTools: tools, systemActions: actions }),
|
|
62
|
+
deployments: {},
|
|
63
|
+
tools,
|
|
64
|
+
actions,
|
|
65
|
+
};
|
|
66
|
+
this.projection = new ToolboxProjection(artifacts, () => this.catalog(), options.onChange);
|
|
67
|
+
this.deploymentService = new ToolboxDeployments({
|
|
68
|
+
store: this.store,
|
|
69
|
+
files: deploymentFiles,
|
|
70
|
+
systemTools: this.system.tools,
|
|
71
|
+
systemActions: this.system.actions,
|
|
72
|
+
project: (toolId) => this.projection.changed(toolId),
|
|
73
|
+
replaceProjection: (previousToolIds) => this.projection.replaced(previousToolIds),
|
|
74
|
+
...(options.onDeployment ? { onDeployment: options.onDeployment } : {}),
|
|
75
|
+
});
|
|
76
|
+
this.deploymentService.adoptLegacy();
|
|
77
|
+
this.view = new ToolboxView(() => this.catalog(), this.drivers);
|
|
78
|
+
this.projection.boot();
|
|
57
79
|
}
|
|
58
80
|
catalog() {
|
|
59
81
|
const persisted = this.store.catalog();
|
|
@@ -62,67 +84,37 @@ class Toolbox {
|
|
|
62
84
|
const userActions = persisted.actions.filter((action) => !systemIds.has(action.toolId));
|
|
63
85
|
const catalog = {
|
|
64
86
|
version: 1, revision: persisted.revision,
|
|
87
|
+
revisionId: deploymentRevisionId({
|
|
88
|
+
heads: persisted.deployments,
|
|
89
|
+
systemTools: this.system.tools,
|
|
90
|
+
systemActions: this.system.actions,
|
|
91
|
+
}),
|
|
92
|
+
deployments: persisted.deployments,
|
|
65
93
|
tools: [...this.system.tools, ...userTools].sort((a, b) => a.id.localeCompare(b.id)),
|
|
66
94
|
actions: [...this.system.actions, ...userActions].sort((a, b) => a.id.localeCompare(b.id)),
|
|
67
95
|
};
|
|
68
96
|
assertMcpNamesUnique(catalog.actions);
|
|
69
97
|
return catalog;
|
|
70
98
|
}
|
|
71
|
-
list(loadout) {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
if (loadout !== undefined && actions.length === 0)
|
|
77
|
-
return [];
|
|
78
|
-
return [{ tool, actions }];
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
query(filters = {}) { return queryTools(this, filters); }
|
|
82
|
-
callable(loadout, filters = {}) { return callableActions(this, loadout, filters); }
|
|
83
|
-
get(toolId) {
|
|
84
|
-
const value = id(toolId, 'tool id');
|
|
85
|
-
const catalog = this.catalog();
|
|
86
|
-
const tool = catalog.tools.find((candidate) => candidate.id === value);
|
|
87
|
-
return tool ? { tool, actions: catalog.actions.filter((action) => action.toolId === value) } : null;
|
|
88
|
-
}
|
|
89
|
-
action(actionId) {
|
|
90
|
-
const value = id(actionId, 'action id');
|
|
91
|
-
return this.catalog().actions.find((action) => action.id === value) || null;
|
|
92
|
-
}
|
|
99
|
+
list(loadout) { return this.view.list(loadout); }
|
|
100
|
+
query(filters = {}) { return this.view.query(filters); }
|
|
101
|
+
callable(loadout, filters = {}) { return this.view.callable(loadout, filters); }
|
|
102
|
+
get(toolId) { return this.view.get(toolId); }
|
|
103
|
+
action(actionId) { return this.view.action(actionId); }
|
|
93
104
|
resolve(toolId, actionReference, loadout) {
|
|
94
|
-
return
|
|
105
|
+
return this.view.resolve(toolId, actionReference, loadout);
|
|
95
106
|
}
|
|
96
107
|
resolveCallable(toolId, actionReference, loadout, filters = {}) {
|
|
97
|
-
return
|
|
108
|
+
return this.view.resolveCallable(toolId, actionReference, loadout, filters);
|
|
98
109
|
}
|
|
99
110
|
async apply(definition) {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
const normalized = normalizeDefinition(definition, existing || undefined);
|
|
108
|
-
normalized.actions = normalized.actions.map((action) => ({
|
|
109
|
-
...action, createdAt: oldActions.get(action.id)?.createdAt || action.createdAt,
|
|
110
|
-
}));
|
|
111
|
-
const candidateActions = [
|
|
112
|
-
...this.system.actions,
|
|
113
|
-
...this.store.catalog().actions.filter((action) => action.toolId !== normalized.tool.id),
|
|
114
|
-
...normalized.actions,
|
|
115
|
-
];
|
|
116
|
-
assertMcpNamesUnique(candidateActions);
|
|
117
|
-
const unchanged = existing && portableRecordSemantic(existing) === portableRecordSemantic(normalized.tool)
|
|
118
|
-
&& normalized.actions.length === oldActions.size
|
|
119
|
-
&& normalized.actions.every((action) => portableRecordSemantic(action)
|
|
120
|
-
=== portableRecordSemantic(oldActions.get(action.id)));
|
|
121
|
-
if (unchanged)
|
|
122
|
-
return { tool: existing, actions: [...oldActions.values()].sort((a, b) => a.id.localeCompare(b.id)) };
|
|
123
|
-
const result = this.store.apply(normalized);
|
|
124
|
-
await this.changed(normalized.tool.id);
|
|
125
|
-
return result;
|
|
111
|
+
return applyDefinition({
|
|
112
|
+
definition,
|
|
113
|
+
store: this.store,
|
|
114
|
+
deployments: this.deploymentService,
|
|
115
|
+
systemTools: this.system.tools,
|
|
116
|
+
systemActions: this.system.actions,
|
|
117
|
+
});
|
|
126
118
|
}
|
|
127
119
|
async update(toolId, patch) {
|
|
128
120
|
return updateTool(this, toolId, patch);
|
|
@@ -138,65 +130,50 @@ class Toolbox {
|
|
|
138
130
|
if (this.system.tools.some((tool) => tool.id === value)
|
|
139
131
|
|| this.system.actions.some((action) => action.id === value))
|
|
140
132
|
throw new Error(`System record is immutable: ${value}`);
|
|
141
|
-
const
|
|
142
|
-
if (
|
|
133
|
+
const tool = this.get(value);
|
|
134
|
+
if (tool)
|
|
135
|
+
return tool.tool.status === status ? tool.tool : (await this.update(value, { status })).tool;
|
|
136
|
+
const action = this.action(value);
|
|
137
|
+
if (!action)
|
|
143
138
|
throw new Error(`Unknown tool or action: ${value}`);
|
|
144
|
-
|
|
145
|
-
return updated;
|
|
139
|
+
return action.status === status ? action : this.updateAction(value, { status });
|
|
146
140
|
}
|
|
147
141
|
async remove(recordId) {
|
|
148
142
|
const value = id(recordId, 'record id');
|
|
149
143
|
if (this.system.tools.some((tool) => tool.id === value)
|
|
150
144
|
|| this.system.actions.some((action) => action.id === value))
|
|
151
145
|
throw new Error(`System record is immutable: ${value}`);
|
|
152
|
-
const
|
|
153
|
-
if (
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
146
|
+
const tool = this.get(value);
|
|
147
|
+
if (tool) {
|
|
148
|
+
await this.deploymentService.activateLocal(null, value);
|
|
149
|
+
return tool.tool;
|
|
150
|
+
}
|
|
151
|
+
return removeAction(this, value);
|
|
152
|
+
}
|
|
153
|
+
currentDeployment(toolId) { return this.deploymentService.current(toolId); }
|
|
154
|
+
deployment(deploymentId) { return this.deploymentService.get(deploymentId); }
|
|
155
|
+
deploymentHistory(toolId) { return this.deploymentService.history(toolId); }
|
|
156
|
+
deploymentSnapshot() { return this.deploymentService.snapshot(); }
|
|
157
|
+
/** Apply an officially ordered remote activation without emitting it again. */
|
|
158
|
+
async activateDeployment(activation) {
|
|
159
|
+
return this.deploymentService.activateRemote(activation);
|
|
160
|
+
}
|
|
161
|
+
/** Replace local materialization during Live hydration or gap recovery. */
|
|
162
|
+
async applyDeploymentSnapshot(snapshot) {
|
|
163
|
+
return this.deploymentService.applySnapshot(snapshot);
|
|
164
|
+
}
|
|
165
|
+
deploymentSurface() {
|
|
166
|
+
return this.deploymentService.surface();
|
|
157
167
|
}
|
|
158
168
|
connections(loadout) {
|
|
159
|
-
|
|
160
|
-
const ids = loadout === undefined ? null : new Set(Array.isArray(loadout) ? loadout : loadout.toolIds);
|
|
161
|
-
return catalog.tools.filter((tool) => {
|
|
162
|
-
if (tool.status !== 'enabled' || tool.source.type !== 'mcp' || tool.origin === 'system')
|
|
163
|
-
return false;
|
|
164
|
-
if (!ids)
|
|
165
|
-
return true;
|
|
166
|
-
return ids.has(tool.id) || catalog.actions.some((action) => action.toolId === tool.id && ids.has(action.id));
|
|
167
|
-
});
|
|
169
|
+
return this.view.connections(loadout);
|
|
168
170
|
}
|
|
169
171
|
async call(actionId, input = {}, options = {}) {
|
|
170
|
-
|
|
171
|
-
if (!resolved)
|
|
172
|
-
throw new Error(`Action is unavailable: ${actionId}`);
|
|
173
|
-
const driver = this.driverFor(resolved.tool);
|
|
174
|
-
if (!driver)
|
|
175
|
-
throw new Error(`No ${resolved.tool.source.type} driver is configured for ${resolved.tool.id}`);
|
|
176
|
-
return driver.call({ ...resolved, input: validateInput(resolved.action.inputSchema, input), options });
|
|
177
|
-
}
|
|
178
|
-
hasDriver(tool) { return this.driverFor(tool) !== null; }
|
|
179
|
-
async callMcp(name, input = {}, options = {}) {
|
|
180
|
-
const resolved = selected(this.catalog(), options.loadout).find(({ action }) => mcpName(action) === name);
|
|
181
|
-
if (!resolved)
|
|
182
|
-
throw new Error(`Unknown MCP tool: ${name}`);
|
|
183
|
-
return this.call(resolved.action.id, input, options);
|
|
184
|
-
}
|
|
185
|
-
async changed(toolId) {
|
|
186
|
-
const catalog = this.catalog();
|
|
187
|
-
const tool = catalog.tools.find((candidate) => candidate.id === toolId);
|
|
188
|
-
if (tool && tool.origin !== 'system') {
|
|
189
|
-
this.artifacts.writeTool({ tool, actions: catalog.actions.filter((action) => action.toolId === toolId) });
|
|
190
|
-
}
|
|
191
|
-
else if (!tool) {
|
|
192
|
-
this.artifacts.removeTool(toolId);
|
|
193
|
-
}
|
|
194
|
-
this.artifacts.writeIndex(catalog);
|
|
195
|
-
await this.onChange?.(catalog);
|
|
172
|
+
return this.view.call(actionId, input, options);
|
|
196
173
|
}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
return
|
|
174
|
+
hasDriver(tool) { return this.view.hasDriver(tool); }
|
|
175
|
+
async callMcp(name, input = {}, options = {}) {
|
|
176
|
+
return this.view.callMcp(name, input, options);
|
|
200
177
|
}
|
|
201
178
|
close() { this.store.close(); }
|
|
202
179
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Writable } from 'node:stream';
|
|
2
|
+
import type { ToolDeploymentActivation } from './deployment-types.js';
|
|
2
3
|
type JsonSchema = {
|
|
3
4
|
type: 'object';
|
|
4
5
|
properties?: Record<string, {
|
|
@@ -41,6 +42,8 @@ interface McpSource extends BaseSource {
|
|
|
41
42
|
args?: string[];
|
|
42
43
|
cwd?: string;
|
|
43
44
|
serverName?: string;
|
|
45
|
+
/** Absolute path mounted by the composing host for `transport: host`. */
|
|
46
|
+
route?: string;
|
|
44
47
|
secretHeaders?: SecretReferences;
|
|
45
48
|
secretEnv?: SecretReferences;
|
|
46
49
|
}
|
|
@@ -109,7 +112,12 @@ interface ActionRecord extends Omit<ActionDefinition, 'id' | 'status' | 'inputSc
|
|
|
109
112
|
}
|
|
110
113
|
interface Catalog {
|
|
111
114
|
version: 1;
|
|
115
|
+
/** Local materialization counter. Never used as immutable authority. */
|
|
112
116
|
revision: number;
|
|
117
|
+
/** Exact digest of current user deployments and system projections. */
|
|
118
|
+
revisionId: string;
|
|
119
|
+
/** Current deployment id per stable user tool, including tombstones. */
|
|
120
|
+
deployments: Record<string, string>;
|
|
113
121
|
tools: ToolRecord[];
|
|
114
122
|
actions: ActionRecord[];
|
|
115
123
|
}
|
|
@@ -151,9 +159,13 @@ interface ToolDriver {
|
|
|
151
159
|
interface ToolboxOptions {
|
|
152
160
|
stateDir?: string;
|
|
153
161
|
databaseFile?: string;
|
|
162
|
+
/** Portable immutable deployment documents; may differ from databaseFile. */
|
|
163
|
+
deploymentDir?: string;
|
|
154
164
|
systemTools?: ToolDefinition[];
|
|
155
165
|
drivers?: ToolDriver[];
|
|
156
166
|
onChange?: (catalog: Catalog) => void | Promise<void>;
|
|
167
|
+
/** Outbound local Live operation. Remote application never calls it. */
|
|
168
|
+
onDeployment?: (activation: ToolDeploymentActivation) => void | Promise<void>;
|
|
157
169
|
}
|
|
158
170
|
interface McpTool {
|
|
159
171
|
name: string;
|
|
@@ -164,9 +176,26 @@ interface McpTool {
|
|
|
164
176
|
interface McpOptions extends CallOptions {
|
|
165
177
|
includeManagement?: boolean;
|
|
166
178
|
}
|
|
179
|
+
interface HostMcpToolDescriptor {
|
|
180
|
+
name: string;
|
|
181
|
+
description?: string;
|
|
182
|
+
inputSchema?: JsonSchema;
|
|
183
|
+
}
|
|
184
|
+
interface HostMcpToolDefinitionInput {
|
|
185
|
+
id: string;
|
|
186
|
+
name: string;
|
|
187
|
+
description?: string;
|
|
188
|
+
serverName: string;
|
|
189
|
+
route: string;
|
|
190
|
+
tools: readonly HostMcpToolDescriptor[];
|
|
191
|
+
owner?: string;
|
|
192
|
+
display?: Record<string, unknown>;
|
|
193
|
+
metadata?: Record<string, unknown>;
|
|
194
|
+
}
|
|
167
195
|
interface CliIo {
|
|
168
196
|
stdout?: Writable;
|
|
169
197
|
stderr?: Writable;
|
|
170
198
|
toolbox?: import('./toolbox.js').Toolbox;
|
|
171
199
|
}
|
|
172
|
-
export type { ActionDefinition, ActionRecord, ActionTarget, ApiSource, ApiTarget, ApplyResult, CallOptions, Catalog, CliIo, CliSource, CliTarget, DriverCall, JsonSchema, Loadout, LoadoutInput, McpOptions, McpSource, McpTarget, McpTool, Origin, SecretResolver, Status, ToolDefinition, ToolDriver, ToolboxOptions, ToolRecord, ToolResult, ToolPatch, ActionPatch, ToolQuery, ToolSource, ToolType, };
|
|
200
|
+
export type { ActionDefinition, ActionRecord, ActionTarget, ApiSource, ApiTarget, ApplyResult, CallOptions, Catalog, CliIo, CliSource, CliTarget, DriverCall, HostMcpToolDefinitionInput, HostMcpToolDescriptor, JsonSchema, Loadout, LoadoutInput, McpOptions, McpSource, McpTarget, McpTool, Origin, SecretResolver, Status, ToolDefinition, ToolDriver, ToolboxOptions, ToolRecord, ToolResult, ToolPatch, ActionPatch, ToolQuery, ToolSource, ToolType, };
|
|
201
|
+
export type { ToolDeployment, ToolDeploymentActivation, ToolDeploymentSnapshot, ToolDeploymentSurface, } from './deployment-types.js';
|
package/dist/updates.d.ts
CHANGED
|
@@ -4,4 +4,5 @@ type UpdatePort = Pick<Toolbox, 'action' | 'apply' | 'get'>;
|
|
|
4
4
|
declare function updateTool(toolbox: UpdatePort, toolId: string, patch: ToolPatch): Promise<ApplyResult>;
|
|
5
5
|
declare function upsertAction(toolbox: UpdatePort, toolId: string, definition: ActionDefinition): Promise<ActionRecord>;
|
|
6
6
|
declare function updateAction(toolbox: UpdatePort, actionId: string, patch: ActionPatch): Promise<ActionRecord>;
|
|
7
|
-
|
|
7
|
+
declare function removeAction(toolbox: UpdatePort, actionId: string): Promise<ActionRecord>;
|
|
8
|
+
export { removeAction, updateAction, updateTool, upsertAction };
|
package/dist/updates.js
CHANGED
|
@@ -54,4 +54,15 @@ async function updateAction(toolbox, actionId, patch) {
|
|
|
54
54
|
metadata: mergedObject(definition.metadata, patch.metadata),
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
|
-
|
|
57
|
+
async function removeAction(toolbox, actionId) {
|
|
58
|
+
const action = toolbox.action(actionId);
|
|
59
|
+
if (!action)
|
|
60
|
+
throw new Error(`Unknown action: ${actionId}`);
|
|
61
|
+
const current = toolbox.get(action.toolId);
|
|
62
|
+
await toolbox.apply({
|
|
63
|
+
...toolDefinition(current),
|
|
64
|
+
actions: current.actions.filter((candidate) => candidate.id !== actionId).map(actionDefinition),
|
|
65
|
+
});
|
|
66
|
+
return action;
|
|
67
|
+
}
|
|
68
|
+
export { removeAction, updateAction, updateTool, upsertAction };
|
|
@@ -8,6 +8,7 @@ second registry.
|
|
|
8
8
|
|
|
9
9
|
- tool and action definition, validation, identity, and persistence;
|
|
10
10
|
- atomic apply, enable, disable, and removal behavior;
|
|
11
|
+
- immutable deployment history, current heads, and the Tools Live surface;
|
|
11
12
|
- loadout selection semantics and deterministic MCP action names;
|
|
12
13
|
- CLI and HTTP API execution drivers and output bounds;
|
|
13
14
|
- SDK, CLI, Toolbox management MCP tools, and action MCP projection;
|
|
@@ -18,7 +19,8 @@ second registry.
|
|
|
18
19
|
- first-party action implementations supplied as `systemTools` and drivers;
|
|
19
20
|
- authenticated capability context and the execution-time secret resolver;
|
|
20
21
|
- the long-lived MCP connection/session host;
|
|
21
|
-
-
|
|
22
|
+
- the machine-local SQLite path, portable deployment directory, Live binding,
|
|
23
|
+
state-event projection, REST shape translation, UI composition, and one-time
|
|
22
24
|
import from Engine's superseded Toolbox tables or JSON file.
|
|
23
25
|
|
|
24
26
|
Agents owns agent records and their loadout ids. Tools treats those ids as
|
|
@@ -26,7 +28,8 @@ input to product-owned selection. Neither product is allowed to rewrite the
|
|
|
26
28
|
other through a Core adapter.
|
|
27
29
|
|
|
28
30
|
Engine adapters call one `Toolbox` instance. They do not write its SQLite
|
|
29
|
-
database or independently normalize, select,
|
|
31
|
+
database, synchronize database pages, or independently normalize, select,
|
|
32
|
+
name, deploy, or execute tool actions.
|
|
30
33
|
An absent loadout must be passed as `undefined`; an explicitly empty loadout
|
|
31
34
|
must be passed as `[]`.
|
|
32
35
|
|