aimeat 1.9.4 → 1.9.5
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/dist/locales/en.json +15 -6
- package/dist/locales/fi.json +25 -16
- package/dist/public/llms-template.txt +13 -2
- package/dist/public/views/profile/agents-tab.js +73 -19
- package/dist/scripts/audit-mcp-tools.d.ts +18 -0
- package/dist/scripts/audit-mcp-tools.d.ts.map +1 -0
- package/dist/scripts/audit-mcp-tools.js +164 -0
- package/dist/scripts/audit-mcp-tools.js.map +1 -0
- package/dist/src/cli/connect/auth.d.ts.map +1 -1
- package/dist/src/cli/connect/auth.js +142 -21
- package/dist/src/cli/connect/auth.js.map +1 -1
- package/dist/src/cli/connect/mcp/tools/agent-messages.d.ts +1 -0
- package/dist/src/cli/connect/mcp/tools/agent-messages.d.ts.map +1 -1
- package/dist/src/cli/connect/mcp/tools/agent-messages.js +12 -5
- package/dist/src/cli/connect/mcp/tools/agent-messages.js.map +1 -1
- package/dist/src/cli/connect/mcp/tools/agent-tasks.d.ts +3 -0
- package/dist/src/cli/connect/mcp/tools/agent-tasks.d.ts.map +1 -1
- package/dist/src/cli/connect/mcp/tools/agent-tasks.js +31 -10
- package/dist/src/cli/connect/mcp/tools/agent-tasks.js.map +1 -1
- package/dist/src/cli/connect/mcp/tools/agent-telemetry.d.ts +11 -0
- package/dist/src/cli/connect/mcp/tools/agent-telemetry.d.ts.map +1 -0
- package/dist/src/cli/connect/mcp/tools/agent-telemetry.js +24 -0
- package/dist/src/cli/connect/mcp/tools/agent-telemetry.js.map +1 -0
- package/dist/src/cli/connect/mcp/tools/core.d.ts +5 -0
- package/dist/src/cli/connect/mcp/tools/core.d.ts.map +1 -1
- package/dist/src/cli/connect/mcp/tools/core.js +15 -3
- package/dist/src/cli/connect/mcp/tools/core.js.map +1 -1
- package/dist/src/cli/connect/mcp/tools/index.d.ts +2 -0
- package/dist/src/cli/connect/mcp/tools/index.d.ts.map +1 -1
- package/dist/src/cli/connect/mcp/tools/index.js +4 -0
- package/dist/src/cli/connect/mcp/tools/index.js.map +1 -1
- package/dist/src/cli/connect/mcp/tools/onboarding.d.ts +14 -0
- package/dist/src/cli/connect/mcp/tools/onboarding.d.ts.map +1 -0
- package/dist/src/cli/connect/mcp/tools/onboarding.js +44 -0
- package/dist/src/cli/connect/mcp/tools/onboarding.js.map +1 -0
- package/dist/src/cli/connect/send.d.ts.map +1 -1
- package/dist/src/cli/connect/send.js +6 -5
- package/dist/src/cli/connect/send.js.map +1 -1
- package/dist/src/cli/connect/skill-bundle.d.ts +9 -1
- package/dist/src/cli/connect/skill-bundle.d.ts.map +1 -1
- package/dist/src/cli/connect/skill-bundle.js +208 -4
- package/dist/src/cli/connect/skill-bundle.js.map +1 -1
- package/dist/src/cli/connect/tool-call.d.ts +43 -0
- package/dist/src/cli/connect/tool-call.d.ts.map +1 -0
- package/dist/src/cli/connect/tool-call.js +878 -0
- package/dist/src/cli/connect/tool-call.js.map +1 -0
- package/dist/src/index.js +125 -30
- package/dist/src/index.js.map +1 -1
- package/dist/src/mcp/agent-onboarding.d.ts +20 -0
- package/dist/src/mcp/agent-onboarding.d.ts.map +1 -0
- package/dist/src/mcp/agent-onboarding.js +199 -0
- package/dist/src/mcp/agent-onboarding.js.map +1 -0
- package/dist/src/mcp/agent-tasks.d.ts +4 -2
- package/dist/src/mcp/agent-tasks.d.ts.map +1 -1
- package/dist/src/mcp/agent-tasks.js +42 -24
- package/dist/src/mcp/agent-tasks.js.map +1 -1
- package/dist/src/mcp/agent-telemetry.d.ts +18 -0
- package/dist/src/mcp/agent-telemetry.d.ts.map +1 -0
- package/dist/src/mcp/agent-telemetry.js +45 -0
- package/dist/src/mcp/agent-telemetry.js.map +1 -0
- package/dist/src/mcp/catalog/definitions.d.ts +42 -0
- package/dist/src/mcp/catalog/definitions.d.ts.map +1 -0
- package/dist/src/mcp/catalog/definitions.js +825 -0
- package/dist/src/mcp/catalog/definitions.js.map +1 -0
- package/dist/src/mcp/core.d.ts +1 -0
- package/dist/src/mcp/core.d.ts.map +1 -1
- package/dist/src/mcp/core.js +31 -2
- package/dist/src/mcp/core.js.map +1 -1
- package/dist/src/mcp/index.d.ts +1 -0
- package/dist/src/mcp/index.d.ts.map +1 -1
- package/dist/src/mcp/index.js +5 -0
- package/dist/src/mcp/index.js.map +1 -1
- package/dist/src/routes/agent-directives.d.ts +1 -0
- package/dist/src/routes/agent-directives.d.ts.map +1 -1
- package/dist/src/routes/agent-directives.js +3 -0
- package/dist/src/routes/agent-directives.js.map +1 -1
- package/dist/src/routes/agent-integration.js +1 -1
- package/dist/src/routes/agent-integration.js.map +1 -1
- package/dist/src/routes/agents.d.ts +14 -0
- package/dist/src/routes/agents.d.ts.map +1 -1
- package/dist/src/routes/agents.js +68 -0
- package/dist/src/routes/agents.js.map +1 -1
- package/dist/src/routes/auth.d.ts +14 -0
- package/dist/src/routes/auth.d.ts.map +1 -1
- package/dist/src/routes/auth.js +23 -1
- package/dist/src/routes/auth.js.map +1 -1
- package/dist/src/routes/bootstrap.d.ts +1 -0
- package/dist/src/routes/bootstrap.d.ts.map +1 -1
- package/dist/src/routes/bootstrap.js +3 -1
- package/dist/src/routes/bootstrap.js.map +1 -1
- package/dist/src/routes/libs.d.ts +9 -0
- package/dist/src/routes/libs.d.ts.map +1 -1
- package/dist/src/routes/libs.js +54 -24
- package/dist/src/routes/libs.js.map +1 -1
- package/dist/src/routes/memory.d.ts +1 -0
- package/dist/src/routes/memory.d.ts.map +1 -1
- package/dist/src/routes/memory.js +3 -1
- package/dist/src/routes/memory.js.map +1 -1
- package/dist/src/routes/prompts.d.ts +1 -0
- package/dist/src/routes/prompts.d.ts.map +1 -1
- package/dist/src/routes/prompts.js +3 -1
- package/dist/src/routes/prompts.js.map +1 -1
- package/dist/src/services/agent-post-onboarding.d.ts +31 -0
- package/dist/src/services/agent-post-onboarding.d.ts.map +1 -0
- package/dist/src/services/agent-post-onboarding.js +101 -0
- package/dist/src/services/agent-post-onboarding.js.map +1 -0
- package/dist/src/services/prompt-defaults.d.ts +23 -19
- package/dist/src/services/prompt-defaults.d.ts.map +1 -1
- package/dist/src/services/prompt-defaults.js +43 -37
- package/dist/src/services/prompt-defaults.js.map +1 -1
- package/dist/src/services/skill-bundle/generator.d.ts +8 -0
- package/dist/src/services/skill-bundle/generator.d.ts.map +1 -1
- package/dist/src/services/skill-bundle/generator.js +145 -48
- package/dist/src/services/skill-bundle/generator.js.map +1 -1
- package/dist/src/services/skill-bundle/generic-adapter.d.ts +5 -0
- package/dist/src/services/skill-bundle/generic-adapter.d.ts.map +1 -1
- package/dist/src/services/skill-bundle/generic-adapter.js +35 -15
- package/dist/src/services/skill-bundle/generic-adapter.js.map +1 -1
- package/dist/src/services/skill-bundle/hermes-adapter.d.ts +5 -0
- package/dist/src/services/skill-bundle/hermes-adapter.d.ts.map +1 -1
- package/dist/src/services/skill-bundle/hermes-adapter.js +26 -10
- package/dist/src/services/skill-bundle/hermes-adapter.js.map +1 -1
- package/package.json +3 -2
|
@@ -0,0 +1,878 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file tool-call.ts
|
|
3
|
+
* @description Shell fallback for connector tools. Provides `aimeat connect tools`,
|
|
4
|
+
* `aimeat connect schema`, and `aimeat connect call` for runtimes that can run
|
|
5
|
+
* commands but cannot use MCP directly.
|
|
6
|
+
* @structure
|
|
7
|
+
* - CONNECT_CLI_TOOLS -- initial REST-backed tool catalog for Hello Integration
|
|
8
|
+
* - runToolList() -- prints CLI-callable tool names
|
|
9
|
+
* - runToolSchema() -- prints plain JSON input schema metadata
|
|
10
|
+
* - runToolCall() -- loads JSON input and invokes the matching REST-backed handler
|
|
11
|
+
* @usage
|
|
12
|
+
* aimeat connect tools
|
|
13
|
+
* aimeat connect schema aimeat_onboarding_status
|
|
14
|
+
* aimeat connect call aimeat_message_send --json input.json
|
|
15
|
+
* @version-history
|
|
16
|
+
* v1.0.0 -- 2026-05-28 -- Add initial shell fallback for agent lifecycle tools
|
|
17
|
+
* v1.1.0 -- 2026-05-28 -- Read public tool metadata from the shared MCP catalog
|
|
18
|
+
* v1.2.0 -- 2026-05-28 -- Add app, extension, and cortex CLI fallback handlers
|
|
19
|
+
* v1.3.0 -- 2026-05-28 -- Add core memory, work, wallet, board, storage, and admin handlers
|
|
20
|
+
* v1.4.0 -- 2026-05-28 -- Add remaining connector MCP handlers to CLI fallback
|
|
21
|
+
* v1.5.0 -- 2026-05-28 -- Add memory tags and owner-scope listing support
|
|
22
|
+
*/
|
|
23
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
24
|
+
import { CLI_FALLBACK_TOOL_DEFINITIONS, getAimeatToolDefinition } from '../../mcp/catalog/definitions.js';
|
|
25
|
+
import { AimeatClient as Client } from './api-client.js';
|
|
26
|
+
import { loadConfig } from './config.js';
|
|
27
|
+
function requiredString(input, key) {
|
|
28
|
+
const value = input[key];
|
|
29
|
+
if (typeof value !== 'string' || value.trim() === '')
|
|
30
|
+
throw new Error(`Missing required string field: ${key}`);
|
|
31
|
+
return value;
|
|
32
|
+
}
|
|
33
|
+
function optionalString(input, key) {
|
|
34
|
+
const value = input[key];
|
|
35
|
+
return typeof value === 'string' && value.trim() !== '' ? value : undefined;
|
|
36
|
+
}
|
|
37
|
+
function optionalNumber(input, key) {
|
|
38
|
+
const value = input[key];
|
|
39
|
+
if (typeof value === 'number' && Number.isFinite(value))
|
|
40
|
+
return value;
|
|
41
|
+
if (typeof value === 'string' && value.trim() !== '') {
|
|
42
|
+
const parsed = Number(value);
|
|
43
|
+
if (Number.isFinite(parsed))
|
|
44
|
+
return parsed;
|
|
45
|
+
}
|
|
46
|
+
return undefined;
|
|
47
|
+
}
|
|
48
|
+
function optionalBoolean(input, key) {
|
|
49
|
+
const value = input[key];
|
|
50
|
+
if (typeof value === 'boolean')
|
|
51
|
+
return value;
|
|
52
|
+
if (typeof value === 'string') {
|
|
53
|
+
const normalized = value.trim().toLowerCase();
|
|
54
|
+
if (normalized === 'true')
|
|
55
|
+
return true;
|
|
56
|
+
if (normalized === 'false')
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
return undefined;
|
|
60
|
+
}
|
|
61
|
+
function requiredValue(input, key) {
|
|
62
|
+
if (!(key in input))
|
|
63
|
+
throw new Error(`Missing required field: ${key}`);
|
|
64
|
+
return input[key];
|
|
65
|
+
}
|
|
66
|
+
function optionalRecord(input, key) {
|
|
67
|
+
const value = input[key];
|
|
68
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value) ? value : undefined;
|
|
69
|
+
}
|
|
70
|
+
function requiredRecord(input, key) {
|
|
71
|
+
const value = input[key];
|
|
72
|
+
if (typeof value === 'object' && value !== null && !Array.isArray(value))
|
|
73
|
+
return value;
|
|
74
|
+
if (typeof value === 'string') {
|
|
75
|
+
const parsed = JSON.parse(value);
|
|
76
|
+
if (typeof parsed === 'object' && parsed !== null && !Array.isArray(parsed))
|
|
77
|
+
return parsed;
|
|
78
|
+
}
|
|
79
|
+
throw new Error(`Missing required object field: ${key}`);
|
|
80
|
+
}
|
|
81
|
+
function optionalArray(input, key) {
|
|
82
|
+
const value = input[key];
|
|
83
|
+
return Array.isArray(value) ? value : undefined;
|
|
84
|
+
}
|
|
85
|
+
function requiredArray(input, key) {
|
|
86
|
+
const value = input[key];
|
|
87
|
+
if (Array.isArray(value))
|
|
88
|
+
return value;
|
|
89
|
+
throw new Error(`Missing required array field: ${key}`);
|
|
90
|
+
}
|
|
91
|
+
function query(params) {
|
|
92
|
+
const search = new URLSearchParams();
|
|
93
|
+
for (const [key, value] of Object.entries(params)) {
|
|
94
|
+
if (value !== undefined)
|
|
95
|
+
search.set(key, String(value));
|
|
96
|
+
}
|
|
97
|
+
const serialized = search.toString();
|
|
98
|
+
return serialized ? `?${serialized}` : '';
|
|
99
|
+
}
|
|
100
|
+
function taskTodoPayload(input) {
|
|
101
|
+
const todos = optionalArray(input, 'todos') ?? [];
|
|
102
|
+
return {
|
|
103
|
+
todos: todos.map((rawTodo, index) => {
|
|
104
|
+
const todo = typeof rawTodo === 'object' && rawTodo !== null ? rawTodo : {};
|
|
105
|
+
const title = typeof todo.title === 'string' ? todo.title : `TODO ${index + 1}`;
|
|
106
|
+
return {
|
|
107
|
+
id: `todo-${index + 1}`,
|
|
108
|
+
order: index + 1,
|
|
109
|
+
title,
|
|
110
|
+
description: typeof todo.description === 'string' ? todo.description : '',
|
|
111
|
+
environment: 'agent',
|
|
112
|
+
environment_reason: 'The connected agent can perform this step through AIMEAT tools.',
|
|
113
|
+
verification: typeof todo.verification === 'string' ? todo.verification : '',
|
|
114
|
+
estimate_minutes: typeof todo.estimate_minutes === 'number' ? todo.estimate_minutes : undefined,
|
|
115
|
+
status: 'pending',
|
|
116
|
+
};
|
|
117
|
+
}),
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
export const CONNECT_CLI_TOOLS = [
|
|
121
|
+
{
|
|
122
|
+
name: 'aimeat_handbook_get',
|
|
123
|
+
description: 'Get the agent operating handbook or one handbook module.',
|
|
124
|
+
input: { module: { type: 'string', description: 'Optional handbook module name, such as tasks or messages.' } },
|
|
125
|
+
handler: ({ client }, input) => client.get(optionalString(input, 'module')
|
|
126
|
+
? `/v1/agents/me/handbook/${encodeURIComponent(optionalString(input, 'module'))}`
|
|
127
|
+
: '/v1/agents/me/handbook'),
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
name: 'aimeat_onboarding_status',
|
|
131
|
+
description: 'View required Hello Integration status and next-step hints.',
|
|
132
|
+
input: {},
|
|
133
|
+
handler: ({ client, agentPath }) => client.get(`/v1/agents/${agentPath}/onboarding`),
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
name: 'aimeat_onboarding_identify_platform',
|
|
137
|
+
description: 'Confirm the connected agent runtime/platform for Hello Integration.',
|
|
138
|
+
input: {
|
|
139
|
+
platform: { type: 'string', required: true, description: 'Runtime/platform name, for example hermes, claude, vscode, or generic.' },
|
|
140
|
+
platform_version: { type: 'string', description: 'Runtime/platform version if known.' },
|
|
141
|
+
},
|
|
142
|
+
handler: ({ client, agentPath }, input) => client.post(`/v1/agents/${agentPath}/onboarding/step/identify_platform`, {
|
|
143
|
+
platform: requiredString(input, 'platform'),
|
|
144
|
+
...(optionalString(input, 'platform_version') ? { platform_version: optionalString(input, 'platform_version') } : {}),
|
|
145
|
+
}),
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
name: 'aimeat_onboarding_confirm_skill_installed',
|
|
149
|
+
description: 'Confirm the local skill bundle is available for Hello Integration.',
|
|
150
|
+
input: {
|
|
151
|
+
platform: { type: 'string', required: true, description: 'Runtime/platform using the bundle.' },
|
|
152
|
+
version: { type: 'string', required: true, description: 'Bundle version, or local when no version is shown.' },
|
|
153
|
+
},
|
|
154
|
+
handler: ({ client, agentPath }, input) => client.post(`/v1/agents/${agentPath}/onboarding/step/install_skill`, {
|
|
155
|
+
platform: requiredString(input, 'platform'),
|
|
156
|
+
version: requiredString(input, 'version'),
|
|
157
|
+
}),
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
name: 'aimeat_onboarding_confirm_directives_read',
|
|
161
|
+
description: 'Confirm the agent has read its AIMEAT handbook/directives.',
|
|
162
|
+
input: { confirmed: { type: 'boolean', description: 'Set true after reading the handbook/directives.' } },
|
|
163
|
+
handler: ({ client, agentPath }, input) => client.post(`/v1/agents/${agentPath}/onboarding/step/read_directives`, {
|
|
164
|
+
confirmed: typeof input.confirmed === 'boolean' ? input.confirmed : true,
|
|
165
|
+
}),
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
name: 'aimeat_onboarding_declare_services',
|
|
169
|
+
description: 'Optionally declare services/capabilities exposed by this agent.',
|
|
170
|
+
input: { services: { type: 'array', description: 'Optional array of service objects with name and description.' } },
|
|
171
|
+
handler: ({ client, agentPath }, input) => client.post(`/v1/agents/${agentPath}/onboarding/step/declare_services`, {
|
|
172
|
+
services: optionalArray(input, 'services') ?? [],
|
|
173
|
+
}),
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
name: 'aimeat_agent_capabilities_report',
|
|
177
|
+
description: 'Report technical and domain capabilities to the node.',
|
|
178
|
+
input: {
|
|
179
|
+
technical: { type: 'array', description: 'Array of technical capabilities: { name, type }.' },
|
|
180
|
+
domain: { type: 'array', description: 'Array of domain expertise strings.' },
|
|
181
|
+
languages: { type: 'array', description: 'Array of language codes.' },
|
|
182
|
+
modules_loaded: { type: 'array', description: 'Optional loaded handbook/module names.' },
|
|
183
|
+
limitations: { type: 'array', description: 'Optional known limitations.' },
|
|
184
|
+
},
|
|
185
|
+
handler: ({ client, agentPath }, input) => client.put(`/v1/agents/${agentPath}/capabilities`, {
|
|
186
|
+
technical: optionalArray(input, 'technical') ?? [],
|
|
187
|
+
domain: optionalArray(input, 'domain') ?? [],
|
|
188
|
+
...(optionalArray(input, 'languages') ? { languages: optionalArray(input, 'languages') } : {}),
|
|
189
|
+
...(optionalArray(input, 'modules_loaded') ? { modules_loaded: optionalArray(input, 'modules_loaded') } : {}),
|
|
190
|
+
...(optionalArray(input, 'limitations') ? { limitations: optionalArray(input, 'limitations') } : {}),
|
|
191
|
+
}),
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
name: 'aimeat_agent_activity',
|
|
195
|
+
description: 'View agent activity statistics.',
|
|
196
|
+
input: {
|
|
197
|
+
days: { type: 'number', description: 'Number of days of history to retrieve.' },
|
|
198
|
+
granularity: { type: 'string', enum: ['daily', 'hourly'], description: 'History granularity.' },
|
|
199
|
+
},
|
|
200
|
+
handler: ({ client, agentPath }, input) => client.get(`/v1/agents/${agentPath}/activity${query({
|
|
201
|
+
days: typeof input.days === 'number' ? input.days : undefined,
|
|
202
|
+
granularity: optionalString(input, 'granularity'),
|
|
203
|
+
})}`),
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
name: 'aimeat_agent_telemetry_report',
|
|
207
|
+
description: 'Report agent telemetry to the node.',
|
|
208
|
+
input: {
|
|
209
|
+
type: { type: 'string', enum: ['llm_call', 'tool_call', 'agent_report'], description: 'Telemetry event type.' },
|
|
210
|
+
data: { type: 'object', description: 'Telemetry data such as tokens, duration, or tool name.' },
|
|
211
|
+
session_id: { type: 'string', description: 'Optional runtime session identifier.' },
|
|
212
|
+
task_id: { type: 'string', description: 'Optional related AIMEAT task id.' },
|
|
213
|
+
},
|
|
214
|
+
handler: ({ client, agentPath }, input) => client.post(`/v1/agents/${agentPath}/telemetry`, {
|
|
215
|
+
type: optionalString(input, 'type') ?? 'agent_report',
|
|
216
|
+
data: optionalRecord(input, 'data') ?? {},
|
|
217
|
+
...(optionalString(input, 'session_id') ? { session_id: optionalString(input, 'session_id') } : {}),
|
|
218
|
+
...(optionalString(input, 'task_id') ? { task_id: optionalString(input, 'task_id') } : {}),
|
|
219
|
+
}),
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
name: 'aimeat_message_inbox',
|
|
223
|
+
description: 'Get pending inbound messages.',
|
|
224
|
+
input: {},
|
|
225
|
+
handler: ({ client, agentPath }) => client.get(`/v1/agents/${agentPath}/messages/inbox`),
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
name: 'aimeat_message_send',
|
|
229
|
+
description: 'Send an outbound message from the connected agent to the owner conversation.',
|
|
230
|
+
input: {
|
|
231
|
+
content: { type: 'string', description: 'Message content.' },
|
|
232
|
+
body: { type: 'string', description: 'Message content alias for older callers.' },
|
|
233
|
+
linked_task_id: { type: 'string', description: 'Optional linked task identifier.' },
|
|
234
|
+
metadata: { type: 'object', description: 'Optional metadata object.' },
|
|
235
|
+
},
|
|
236
|
+
handler: ({ client, agentPath }, input) => {
|
|
237
|
+
const content = optionalString(input, 'content') ?? optionalString(input, 'body');
|
|
238
|
+
if (!content)
|
|
239
|
+
throw new Error('Missing required field: content');
|
|
240
|
+
return client.post(`/v1/agents/${agentPath}/messages`, {
|
|
241
|
+
content,
|
|
242
|
+
direction: 'outbound',
|
|
243
|
+
...(optionalString(input, 'linked_task_id') ? { linked_task_id: optionalString(input, 'linked_task_id') } : {}),
|
|
244
|
+
...(optionalRecord(input, 'metadata') ? { metadata: optionalRecord(input, 'metadata') } : {}),
|
|
245
|
+
});
|
|
246
|
+
},
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
name: 'aimeat_task_list',
|
|
250
|
+
description: 'List tasks for the connected agent.',
|
|
251
|
+
input: { status: { type: 'string', description: 'Optional task status filter.' } },
|
|
252
|
+
handler: ({ client, agentPath }, input) => client.get(`/v1/agents/${agentPath}/tasks${query({ status: optionalString(input, 'status') })}`),
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
name: 'aimeat_task_get',
|
|
256
|
+
description: 'Get task detail.',
|
|
257
|
+
input: { task_id: { type: 'string', required: true, description: 'Task identifier.' } },
|
|
258
|
+
handler: ({ client, agentPath }, input) => client.get(`/v1/agents/${agentPath}/tasks/${encodeURIComponent(requiredString(input, 'task_id'))}`),
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
name: 'aimeat_task_propose_todos',
|
|
262
|
+
description: 'Propose TODOs for a queued task before owner approval or onboarding auto-start.',
|
|
263
|
+
input: {
|
|
264
|
+
task_id: { type: 'string', required: true, description: 'Task identifier.' },
|
|
265
|
+
todos: { type: 'array', required: true, description: 'Array of TODOs with title, optional description, verification, and estimate_minutes.' },
|
|
266
|
+
},
|
|
267
|
+
handler: ({ client, agentPath }, input) => client.patch(`/v1/agents/${agentPath}/tasks/${encodeURIComponent(requiredString(input, 'task_id'))}`, taskTodoPayload(input)),
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
name: 'aimeat_task_event',
|
|
271
|
+
description: 'Append a progress event to a task.',
|
|
272
|
+
input: {
|
|
273
|
+
task_id: { type: 'string', required: true, description: 'Task identifier.' },
|
|
274
|
+
type: { type: 'string', required: true, description: 'Event type.' },
|
|
275
|
+
message: { type: 'string', required: true, description: 'Event message.' },
|
|
276
|
+
details: { type: 'object', description: 'Optional event details.' },
|
|
277
|
+
},
|
|
278
|
+
handler: ({ client, agentPath }, input) => client.post(`/v1/agents/${agentPath}/tasks/${encodeURIComponent(requiredString(input, 'task_id'))}/event`, {
|
|
279
|
+
type: requiredString(input, 'type'),
|
|
280
|
+
message: requiredString(input, 'message'),
|
|
281
|
+
...(optionalRecord(input, 'details') ? { details: optionalRecord(input, 'details') } : {}),
|
|
282
|
+
}),
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
name: 'aimeat_task_todo',
|
|
286
|
+
description: 'Update a TODO item status within a task.',
|
|
287
|
+
input: {
|
|
288
|
+
task_id: { type: 'string', required: true, description: 'Task identifier.' },
|
|
289
|
+
todo_id: { type: 'string', required: true, description: 'TODO item identifier.' },
|
|
290
|
+
status: { type: 'string', required: true, enum: ['pending', 'active', 'done', 'failed', 'skipped'], description: 'New TODO status.' },
|
|
291
|
+
},
|
|
292
|
+
handler: ({ client, agentPath }, input) => client.patch(`/v1/agents/${agentPath}/tasks/${encodeURIComponent(requiredString(input, 'task_id'))}/todos/${encodeURIComponent(requiredString(input, 'todo_id'))}`, { status: requiredString(input, 'status') }),
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
name: 'aimeat_task_complete',
|
|
296
|
+
description: 'Complete an active task.',
|
|
297
|
+
input: {
|
|
298
|
+
task_id: { type: 'string', required: true, description: 'Task identifier.' },
|
|
299
|
+
message: { type: 'string', description: 'Completion message.' },
|
|
300
|
+
summary: { type: 'string', description: 'Completion message alias for older callers.' },
|
|
301
|
+
},
|
|
302
|
+
handler: ({ client, agentPath }, input) => client.post(`/v1/agents/${agentPath}/tasks/${encodeURIComponent(requiredString(input, 'task_id'))}/complete`, {
|
|
303
|
+
message: optionalString(input, 'message') ?? optionalString(input, 'summary') ?? 'Task completed',
|
|
304
|
+
}),
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
name: 'aimeat_task_fail',
|
|
308
|
+
description: 'Fail an active task with a reason.',
|
|
309
|
+
input: {
|
|
310
|
+
task_id: { type: 'string', required: true, description: 'Task identifier.' },
|
|
311
|
+
reason: { type: 'string', description: 'Failure reason alias for message.' },
|
|
312
|
+
message: { type: 'string', description: 'Failure message.' },
|
|
313
|
+
},
|
|
314
|
+
handler: ({ client, agentPath }, input) => client.post(`/v1/agents/${agentPath}/tasks/${encodeURIComponent(requiredString(input, 'task_id'))}/fail`, {
|
|
315
|
+
message: optionalString(input, 'message') ?? optionalString(input, 'reason') ?? 'Task failed',
|
|
316
|
+
}),
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
name: 'aimeat_memory_read',
|
|
320
|
+
handler: ({ client }, input) => client.get(`/v1/memory/${encodeURIComponent(requiredString(input, 'key'))}`),
|
|
321
|
+
},
|
|
322
|
+
{
|
|
323
|
+
name: 'aimeat_memory_write',
|
|
324
|
+
handler: ({ client }, input) => {
|
|
325
|
+
const body = { key: requiredString(input, 'key'), value: requiredValue(input, 'value') };
|
|
326
|
+
const visibility = optionalString(input, 'visibility');
|
|
327
|
+
const ttlHours = optionalNumber(input, 'ttl_hours');
|
|
328
|
+
if (visibility)
|
|
329
|
+
body.visibility = visibility;
|
|
330
|
+
const tags = optionalArray(input, 'tags');
|
|
331
|
+
if (tags)
|
|
332
|
+
body.tags = tags;
|
|
333
|
+
if (ttlHours !== undefined)
|
|
334
|
+
body.ttl_hours = ttlHours;
|
|
335
|
+
return client.post('/v1/memory', body);
|
|
336
|
+
},
|
|
337
|
+
},
|
|
338
|
+
{
|
|
339
|
+
name: 'aimeat_memory_list',
|
|
340
|
+
handler: ({ client }, input) => {
|
|
341
|
+
const tags = optionalArray(input, 'tags')?.filter((tag) => typeof tag === 'string');
|
|
342
|
+
return client.get(`/v1/memory${query({
|
|
343
|
+
prefix: optionalString(input, 'prefix'),
|
|
344
|
+
visibility: optionalString(input, 'visibility'),
|
|
345
|
+
tags: tags?.length ? tags.join(',') : undefined,
|
|
346
|
+
owner_scope: optionalBoolean(input, 'owner_scope') ? 'true' : undefined,
|
|
347
|
+
limit: optionalNumber(input, 'limit'),
|
|
348
|
+
})}`);
|
|
349
|
+
},
|
|
350
|
+
},
|
|
351
|
+
{
|
|
352
|
+
name: 'aimeat_memory_search',
|
|
353
|
+
handler: ({ client }, input) => client.get(`/v1/memory/search${query({ q: requiredString(input, 'query') })}`),
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
name: 'aimeat_catalogue_search',
|
|
357
|
+
handler: ({ client }, input) => client.get(`/v1/catalogue${query({ q: optionalString(input, 'query') })}`),
|
|
358
|
+
},
|
|
359
|
+
{
|
|
360
|
+
name: 'aimeat_agent_profile',
|
|
361
|
+
handler: ({ client }, input) => client.get(`/v1/agents/${encodeURIComponent(requiredString(input, 'gaii'))}`),
|
|
362
|
+
},
|
|
363
|
+
{
|
|
364
|
+
name: 'aimeat_action_execute',
|
|
365
|
+
handler: ({ client }, input) => {
|
|
366
|
+
const body = { action_id: requiredString(input, 'action_id') };
|
|
367
|
+
const actionInput = optionalRecord(input, 'input');
|
|
368
|
+
if (actionInput)
|
|
369
|
+
body.input = actionInput;
|
|
370
|
+
return client.post('/v1/work/request', body);
|
|
371
|
+
},
|
|
372
|
+
},
|
|
373
|
+
{
|
|
374
|
+
name: 'aimeat_work_inbox',
|
|
375
|
+
handler: ({ client }) => client.get('/v1/work/inbox'),
|
|
376
|
+
},
|
|
377
|
+
{
|
|
378
|
+
name: 'aimeat_work_accept',
|
|
379
|
+
handler: ({ client }, input) => client.post(`/v1/work/${encodeURIComponent(requiredString(input, 'tracking_code'))}/accept`),
|
|
380
|
+
},
|
|
381
|
+
{
|
|
382
|
+
name: 'aimeat_work_deliver',
|
|
383
|
+
handler: ({ client }, input) => client.post(`/v1/work/${encodeURIComponent(requiredString(input, 'tracking_code'))}/deliver`, { result: requiredValue(input, 'result') }),
|
|
384
|
+
},
|
|
385
|
+
{
|
|
386
|
+
name: 'aimeat_wallet_balance',
|
|
387
|
+
handler: ({ client }) => client.get('/v1/wallet'),
|
|
388
|
+
},
|
|
389
|
+
{
|
|
390
|
+
name: 'aimeat_board_read',
|
|
391
|
+
handler: ({ client }, input) => client.get(`/v1/boards/${encodeURIComponent(requiredString(input, 'board_id'))}/posts`),
|
|
392
|
+
},
|
|
393
|
+
{
|
|
394
|
+
name: 'aimeat_board_post',
|
|
395
|
+
handler: ({ client }, input) => client.post(`/v1/boards/${encodeURIComponent(requiredString(input, 'board_id'))}/posts`, { title: requiredString(input, 'title'), body: requiredString(input, 'body') }),
|
|
396
|
+
},
|
|
397
|
+
{
|
|
398
|
+
name: 'aimeat_storage_upload',
|
|
399
|
+
handler: ({ client }, input) => {
|
|
400
|
+
const body = { key: requiredString(input, 'key'), content: requiredString(input, 'content') };
|
|
401
|
+
const mimeType = optionalString(input, 'mime_type');
|
|
402
|
+
if (mimeType)
|
|
403
|
+
body.mime_type = mimeType;
|
|
404
|
+
return client.post('/v1/storage', body);
|
|
405
|
+
},
|
|
406
|
+
},
|
|
407
|
+
{
|
|
408
|
+
name: 'aimeat_storage_download',
|
|
409
|
+
handler: ({ client }, input) => client.get(`/v1/storage/${encodeURIComponent(requiredString(input, 'key'))}`),
|
|
410
|
+
},
|
|
411
|
+
{
|
|
412
|
+
name: 'aimeat_admin_stats',
|
|
413
|
+
handler: ({ client }) => client.get('/v1/admin/stats'),
|
|
414
|
+
},
|
|
415
|
+
{
|
|
416
|
+
name: 'aimeat_admin_agents',
|
|
417
|
+
handler: ({ client }) => client.get('/v1/admin/agents'),
|
|
418
|
+
},
|
|
419
|
+
{
|
|
420
|
+
name: 'aimeat_admin_config',
|
|
421
|
+
handler: ({ client }) => client.get('/v1/admin/config'),
|
|
422
|
+
},
|
|
423
|
+
{
|
|
424
|
+
name: 'aimeat_board_list',
|
|
425
|
+
handler: ({ client }) => client.get('/v1/boards'),
|
|
426
|
+
},
|
|
427
|
+
{
|
|
428
|
+
name: 'aimeat_board_create',
|
|
429
|
+
handler: ({ client }, input) => {
|
|
430
|
+
const body = { name: requiredString(input, 'name') };
|
|
431
|
+
const description = optionalString(input, 'description');
|
|
432
|
+
const visibility = optionalString(input, 'visibility');
|
|
433
|
+
if (description)
|
|
434
|
+
body.description = description;
|
|
435
|
+
if (visibility)
|
|
436
|
+
body.visibility = visibility;
|
|
437
|
+
return client.post('/v1/boards', body);
|
|
438
|
+
},
|
|
439
|
+
},
|
|
440
|
+
{
|
|
441
|
+
name: 'aimeat_board_subscribe',
|
|
442
|
+
handler: ({ client }, input) => client.post(`/v1/boards/${encodeURIComponent(requiredString(input, 'board_id'))}/subscribe`),
|
|
443
|
+
},
|
|
444
|
+
{
|
|
445
|
+
name: 'aimeat_board_react',
|
|
446
|
+
handler: ({ client }, input) => client.post(`/v1/boards/${encodeURIComponent(requiredString(input, 'board_id'))}/posts/${encodeURIComponent(requiredString(input, 'post_id'))}/react`, { emoji: requiredString(input, 'emoji') }),
|
|
447
|
+
},
|
|
448
|
+
{
|
|
449
|
+
name: 'aimeat_board_reply',
|
|
450
|
+
handler: ({ client }, input) => client.post(`/v1/boards/${encodeURIComponent(requiredString(input, 'board_id'))}/posts/${encodeURIComponent(requiredString(input, 'post_id'))}/replies`, { body: requiredString(input, 'body') }),
|
|
451
|
+
},
|
|
452
|
+
{
|
|
453
|
+
name: 'aimeat_board_members',
|
|
454
|
+
handler: ({ client }, input) => client.patch(`/v1/boards/${encodeURIComponent(requiredString(input, 'board_id'))}/members`, { members: requiredArray(input, 'members') }),
|
|
455
|
+
},
|
|
456
|
+
{
|
|
457
|
+
name: 'aimeat_board_delete',
|
|
458
|
+
handler: ({ client }, input) => client.delete(`/v1/boards/${encodeURIComponent(requiredString(input, 'board_id'))}`),
|
|
459
|
+
},
|
|
460
|
+
{
|
|
461
|
+
name: 'aimeat_capabilities_list',
|
|
462
|
+
handler: ({ client }, input) => client.get(`/v1/capabilities${query({ q: optionalString(input, 'query') })}`),
|
|
463
|
+
},
|
|
464
|
+
{
|
|
465
|
+
name: 'aimeat_capabilities_get',
|
|
466
|
+
handler: ({ client }, input) => client.get(`/v1/capabilities/${encodeURIComponent(requiredString(input, 'id'))}`),
|
|
467
|
+
},
|
|
468
|
+
{
|
|
469
|
+
name: 'aimeat_capabilities_invoke',
|
|
470
|
+
handler: ({ client }, input) => client.post(`/v1/capabilities/${encodeURIComponent(requiredString(input, 'id'))}/invoke`, optionalRecord(input, 'input') ?? {}),
|
|
471
|
+
},
|
|
472
|
+
{
|
|
473
|
+
name: 'aimeat_capabilities_create',
|
|
474
|
+
handler: ({ client }, input) => client.post('/v1/capabilities', {
|
|
475
|
+
name: requiredString(input, 'name'),
|
|
476
|
+
description: requiredString(input, 'description'),
|
|
477
|
+
type: requiredString(input, 'type'),
|
|
478
|
+
}),
|
|
479
|
+
},
|
|
480
|
+
{
|
|
481
|
+
name: 'aimeat_capabilities_update',
|
|
482
|
+
handler: ({ client }, input) => {
|
|
483
|
+
const body = {};
|
|
484
|
+
const name = optionalString(input, 'name');
|
|
485
|
+
const description = optionalString(input, 'description');
|
|
486
|
+
if (name)
|
|
487
|
+
body.name = name;
|
|
488
|
+
if (description)
|
|
489
|
+
body.description = description;
|
|
490
|
+
return client.put(`/v1/capabilities/${encodeURIComponent(requiredString(input, 'id'))}`, body);
|
|
491
|
+
},
|
|
492
|
+
},
|
|
493
|
+
{
|
|
494
|
+
name: 'aimeat_capabilities_delete',
|
|
495
|
+
handler: ({ client }, input) => client.delete(`/v1/capabilities/${encodeURIComponent(requiredString(input, 'id'))}`),
|
|
496
|
+
},
|
|
497
|
+
{
|
|
498
|
+
name: 'aimeat_capabilities_vouch',
|
|
499
|
+
handler: ({ client }, input) => client.post(`/v1/capabilities/${encodeURIComponent(requiredString(input, 'id'))}/vouch`, {}),
|
|
500
|
+
},
|
|
501
|
+
{
|
|
502
|
+
name: 'aimeat_catalogue_agents',
|
|
503
|
+
handler: ({ client }, input) => client.get(`/v1/catalogue/agents${query({ q: optionalString(input, 'query') })}`),
|
|
504
|
+
},
|
|
505
|
+
{
|
|
506
|
+
name: 'aimeat_catalogue_boards',
|
|
507
|
+
handler: ({ client }) => client.get('/v1/catalogue/boards'),
|
|
508
|
+
},
|
|
509
|
+
{
|
|
510
|
+
name: 'aimeat_catalogue_directory',
|
|
511
|
+
handler: ({ client }, input) => client.get(`/v1/catalogue/directory${query({ q: optionalString(input, 'query') })}`),
|
|
512
|
+
},
|
|
513
|
+
{
|
|
514
|
+
name: 'aimeat_consent_grant',
|
|
515
|
+
handler: ({ client }, input) => {
|
|
516
|
+
const body = { recipient: requiredString(input, 'recipient'), keys: requiredArray(input, 'keys') };
|
|
517
|
+
const purpose = optionalString(input, 'purpose');
|
|
518
|
+
if (purpose)
|
|
519
|
+
body.purpose = purpose;
|
|
520
|
+
return client.post('/v1/consent', body);
|
|
521
|
+
},
|
|
522
|
+
},
|
|
523
|
+
{
|
|
524
|
+
name: 'aimeat_consent_list',
|
|
525
|
+
handler: ({ client }) => client.get('/v1/consent'),
|
|
526
|
+
},
|
|
527
|
+
{
|
|
528
|
+
name: 'aimeat_consent_revoke',
|
|
529
|
+
handler: ({ client }, input) => client.delete(`/v1/consent/${encodeURIComponent(requiredString(input, 'id'))}`),
|
|
530
|
+
},
|
|
531
|
+
{
|
|
532
|
+
name: 'aimeat_flag_report',
|
|
533
|
+
handler: ({ client }, input) => client.post('/v1/flags', {
|
|
534
|
+
target_type: requiredString(input, 'target_type'),
|
|
535
|
+
target_id: requiredString(input, 'target_id'),
|
|
536
|
+
reason: requiredString(input, 'reason'),
|
|
537
|
+
}),
|
|
538
|
+
},
|
|
539
|
+
{
|
|
540
|
+
name: 'aimeat_group_list',
|
|
541
|
+
handler: ({ client }) => client.get('/v1/groups'),
|
|
542
|
+
},
|
|
543
|
+
{
|
|
544
|
+
name: 'aimeat_group_get',
|
|
545
|
+
handler: ({ client }, input) => client.get(`/v1/groups/${encodeURIComponent(requiredString(input, 'id'))}`),
|
|
546
|
+
},
|
|
547
|
+
{
|
|
548
|
+
name: 'aimeat_group_create',
|
|
549
|
+
handler: ({ client }, input) => {
|
|
550
|
+
const body = { name: requiredString(input, 'name') };
|
|
551
|
+
const description = optionalString(input, 'description');
|
|
552
|
+
if (description)
|
|
553
|
+
body.description = description;
|
|
554
|
+
return client.post('/v1/groups', body);
|
|
555
|
+
},
|
|
556
|
+
},
|
|
557
|
+
{
|
|
558
|
+
name: 'aimeat_group_add_member',
|
|
559
|
+
handler: ({ client }, input) => {
|
|
560
|
+
const body = { identifier: requiredString(input, 'identifier') };
|
|
561
|
+
const role = optionalString(input, 'role');
|
|
562
|
+
if (role)
|
|
563
|
+
body.role = role;
|
|
564
|
+
return client.post(`/v1/groups/${encodeURIComponent(requiredString(input, 'id'))}/members`, body);
|
|
565
|
+
},
|
|
566
|
+
},
|
|
567
|
+
{
|
|
568
|
+
name: 'aimeat_group_remove_member',
|
|
569
|
+
handler: ({ client }, input) => client.delete(`/v1/groups/${encodeURIComponent(requiredString(input, 'id'))}/members/${encodeURIComponent(requiredString(input, 'identifier'))}`),
|
|
570
|
+
},
|
|
571
|
+
{
|
|
572
|
+
name: 'aimeat_instance_list',
|
|
573
|
+
handler: ({ client }) => client.get('/v1/instances'),
|
|
574
|
+
},
|
|
575
|
+
{
|
|
576
|
+
name: 'aimeat_instance_create',
|
|
577
|
+
handler: ({ client }, input) => {
|
|
578
|
+
const body = { name: requiredString(input, 'name') };
|
|
579
|
+
const template = optionalString(input, 'template');
|
|
580
|
+
if (template)
|
|
581
|
+
body.template = template;
|
|
582
|
+
return client.post('/v1/instances', body);
|
|
583
|
+
},
|
|
584
|
+
},
|
|
585
|
+
{
|
|
586
|
+
name: 'aimeat_instance_status',
|
|
587
|
+
handler: ({ client }, input) => client.get(`/v1/instances/${encodeURIComponent(requiredString(input, 'id'))}/status`),
|
|
588
|
+
},
|
|
589
|
+
{
|
|
590
|
+
name: 'aimeat_knowledge_list',
|
|
591
|
+
handler: ({ client }) => client.get('/v1/catalogue/knowledge'),
|
|
592
|
+
},
|
|
593
|
+
{
|
|
594
|
+
name: 'aimeat_knowledge_get',
|
|
595
|
+
handler: ({ client }, input) => client.get(`/v1/knowledge/${encodeURIComponent(requiredString(input, 'id'))}`),
|
|
596
|
+
},
|
|
597
|
+
{
|
|
598
|
+
name: 'aimeat_knowledge_contribute',
|
|
599
|
+
handler: ({ client }, input) => client.post(`/v1/knowledge/${encodeURIComponent(requiredString(input, 'id'))}/contribute`, {
|
|
600
|
+
entry_key: requiredString(input, 'entry_key'),
|
|
601
|
+
content: requiredString(input, 'content'),
|
|
602
|
+
}),
|
|
603
|
+
},
|
|
604
|
+
{
|
|
605
|
+
name: 'aimeat_knowledge_links',
|
|
606
|
+
handler: ({ client }, input) => client.get(`/v1/knowledge/${encodeURIComponent(requiredString(input, 'id'))}/links`),
|
|
607
|
+
},
|
|
608
|
+
{
|
|
609
|
+
name: 'aimeat_memory_read_public',
|
|
610
|
+
handler: ({ client }, input) => client.get(`/v1/memory/${encodeURIComponent(requiredString(input, 'gaii'))}/${encodeURIComponent(requiredString(input, 'key'))}`),
|
|
611
|
+
},
|
|
612
|
+
{
|
|
613
|
+
name: 'aimeat_organism_list',
|
|
614
|
+
handler: ({ client }) => client.get('/v1/organisms'),
|
|
615
|
+
},
|
|
616
|
+
{
|
|
617
|
+
name: 'aimeat_organism_get',
|
|
618
|
+
handler: ({ client }, input) => client.get(`/v1/organisms/${encodeURIComponent(requiredString(input, 'id'))}`),
|
|
619
|
+
},
|
|
620
|
+
{
|
|
621
|
+
name: 'aimeat_organism_join',
|
|
622
|
+
handler: ({ client }, input) => client.post(`/v1/organisms/${encodeURIComponent(requiredString(input, 'id'))}/join`),
|
|
623
|
+
},
|
|
624
|
+
{
|
|
625
|
+
name: 'aimeat_organism_leave',
|
|
626
|
+
handler: ({ client }, input) => client.post(`/v1/organisms/${encodeURIComponent(requiredString(input, 'id'))}/leave`),
|
|
627
|
+
},
|
|
628
|
+
{
|
|
629
|
+
name: 'aimeat_organism_members',
|
|
630
|
+
handler: ({ client }, input) => client.get(`/v1/organisms/${encodeURIComponent(requiredString(input, 'id'))}/members`),
|
|
631
|
+
},
|
|
632
|
+
{
|
|
633
|
+
name: 'aimeat_wallet_transactions',
|
|
634
|
+
handler: ({ client }, input) => client.get(`/v1/wallet/transactions${query({ limit: optionalNumber(input, 'limit') })}`),
|
|
635
|
+
},
|
|
636
|
+
{
|
|
637
|
+
name: 'aimeat_app_publish',
|
|
638
|
+
description: 'Publish an app package.',
|
|
639
|
+
input: {
|
|
640
|
+
name: { type: 'string', required: true, description: 'App name.' },
|
|
641
|
+
description: { type: 'string', required: true, description: 'App description.' },
|
|
642
|
+
content: { type: 'string', required: true, description: 'App content.' },
|
|
643
|
+
},
|
|
644
|
+
handler: ({ client }, input) => client.post('/v1/packages', {
|
|
645
|
+
name: requiredString(input, 'name'),
|
|
646
|
+
description: requiredString(input, 'description'),
|
|
647
|
+
content: requiredString(input, 'content'),
|
|
648
|
+
}),
|
|
649
|
+
},
|
|
650
|
+
{
|
|
651
|
+
name: 'aimeat_app_list',
|
|
652
|
+
description: 'List available apps.',
|
|
653
|
+
input: { query: { type: 'string', description: 'Search query.' } },
|
|
654
|
+
handler: ({ client }, input) => client.get(`/v1/packages${query({ q: optionalString(input, 'query') })}`),
|
|
655
|
+
},
|
|
656
|
+
{
|
|
657
|
+
name: 'aimeat_app_get',
|
|
658
|
+
description: 'Get app detail by group ID.',
|
|
659
|
+
input: { group_id: { type: 'string', required: true, description: 'App group identifier.' } },
|
|
660
|
+
handler: ({ client }, input) => client.get(`/v1/packages/${encodeURIComponent(requiredString(input, 'group_id'))}`),
|
|
661
|
+
},
|
|
662
|
+
{
|
|
663
|
+
name: 'aimeat_app_delete',
|
|
664
|
+
description: 'Archive an app version.',
|
|
665
|
+
input: {
|
|
666
|
+
group_id: { type: 'string', required: true, description: 'App group identifier.' },
|
|
667
|
+
version: { type: 'string', required: true, description: 'Version to archive.' },
|
|
668
|
+
},
|
|
669
|
+
handler: ({ client }, input) => client.delete(`/v1/packages/${encodeURIComponent(requiredString(input, 'group_id'))}/versions/${encodeURIComponent(requiredString(input, 'version'))}`),
|
|
670
|
+
},
|
|
671
|
+
{
|
|
672
|
+
name: 'aimeat_app_versions',
|
|
673
|
+
description: 'List app version history.',
|
|
674
|
+
input: { group_id: { type: 'string', required: true, description: 'App group identifier.' } },
|
|
675
|
+
handler: ({ client }, input) => client.get(`/v1/packages/${encodeURIComponent(requiredString(input, 'group_id'))}/versions`),
|
|
676
|
+
},
|
|
677
|
+
{
|
|
678
|
+
name: 'aimeat_extension_list',
|
|
679
|
+
description: 'List installed extensions.',
|
|
680
|
+
input: {},
|
|
681
|
+
handler: ({ client }) => client.get('/v1/extensions'),
|
|
682
|
+
},
|
|
683
|
+
{
|
|
684
|
+
name: 'aimeat_extension_invoke',
|
|
685
|
+
description: 'Invoke an extension action.',
|
|
686
|
+
input: {
|
|
687
|
+
name: { type: 'string', required: true, description: 'Extension name.' },
|
|
688
|
+
action_id: { type: 'string', required: true, description: 'Action identifier.' },
|
|
689
|
+
input: { type: 'object', description: 'Input parameters.' },
|
|
690
|
+
},
|
|
691
|
+
handler: ({ client }, input) => client.post(`/v1/ext/${encodeURIComponent(requiredString(input, 'name'))}/${encodeURIComponent(requiredString(input, 'action_id'))}`, optionalRecord(input, 'input') ?? {}),
|
|
692
|
+
},
|
|
693
|
+
{
|
|
694
|
+
name: 'aimeat_extension_install',
|
|
695
|
+
description: 'Install an extension from a manifest.',
|
|
696
|
+
input: {
|
|
697
|
+
name: { type: 'string', required: true, description: 'Extension name.' },
|
|
698
|
+
manifest: { type: 'object', required: true, description: 'Extension manifest object.' },
|
|
699
|
+
},
|
|
700
|
+
handler: ({ client }, input) => client.post('/v1/extensions', {
|
|
701
|
+
name: requiredString(input, 'name'),
|
|
702
|
+
manifest: requiredRecord(input, 'manifest'),
|
|
703
|
+
}),
|
|
704
|
+
},
|
|
705
|
+
{
|
|
706
|
+
name: 'aimeat_extension_activate',
|
|
707
|
+
description: 'Activate an installed extension.',
|
|
708
|
+
input: { name: { type: 'string', required: true, description: 'Extension name.' } },
|
|
709
|
+
handler: ({ client }, input) => client.post(`/v1/extensions/${encodeURIComponent(requiredString(input, 'name'))}/activate`),
|
|
710
|
+
},
|
|
711
|
+
{
|
|
712
|
+
name: 'aimeat_extension_deactivate',
|
|
713
|
+
description: 'Deactivate an extension.',
|
|
714
|
+
input: { name: { type: 'string', required: true, description: 'Extension name.' } },
|
|
715
|
+
handler: ({ client }, input) => client.post(`/v1/extensions/${encodeURIComponent(requiredString(input, 'name'))}/deactivate`),
|
|
716
|
+
},
|
|
717
|
+
{
|
|
718
|
+
name: 'aimeat_extension_delete',
|
|
719
|
+
description: 'Uninstall an extension.',
|
|
720
|
+
input: { name: { type: 'string', required: true, description: 'Extension name.' } },
|
|
721
|
+
handler: ({ client }, input) => client.delete(`/v1/extensions/${encodeURIComponent(requiredString(input, 'name'))}`),
|
|
722
|
+
},
|
|
723
|
+
{
|
|
724
|
+
name: 'aimeat_extension_get',
|
|
725
|
+
description: 'Get extension details.',
|
|
726
|
+
input: { name: { type: 'string', required: true, description: 'Extension name.' } },
|
|
727
|
+
handler: ({ client }, input) => client.get(`/v1/extensions/${encodeURIComponent(requiredString(input, 'name'))}`),
|
|
728
|
+
},
|
|
729
|
+
{
|
|
730
|
+
name: 'aimeat_cortex_list',
|
|
731
|
+
description: 'List installed cortex models.',
|
|
732
|
+
input: {},
|
|
733
|
+
handler: ({ client }) => client.get('/v1/cortex'),
|
|
734
|
+
},
|
|
735
|
+
{
|
|
736
|
+
name: 'aimeat_cortex_install',
|
|
737
|
+
description: 'Install a cortex model from a manifest.',
|
|
738
|
+
input: {
|
|
739
|
+
name: { type: 'string', required: true, description: 'Cortex name.' },
|
|
740
|
+
manifest: { type: 'object', required: true, description: 'Cortex manifest object.' },
|
|
741
|
+
},
|
|
742
|
+
handler: ({ client }, input) => client.post('/v1/cortex', {
|
|
743
|
+
name: requiredString(input, 'name'),
|
|
744
|
+
manifest: requiredRecord(input, 'manifest'),
|
|
745
|
+
}),
|
|
746
|
+
},
|
|
747
|
+
{
|
|
748
|
+
name: 'aimeat_cortex_activate',
|
|
749
|
+
description: 'Activate a cortex model.',
|
|
750
|
+
input: { name: { type: 'string', required: true, description: 'Cortex name.' } },
|
|
751
|
+
handler: ({ client }, input) => client.post(`/v1/cortex/${encodeURIComponent(requiredString(input, 'name'))}/activate`),
|
|
752
|
+
},
|
|
753
|
+
{
|
|
754
|
+
name: 'aimeat_cortex_deactivate',
|
|
755
|
+
description: 'Deactivate a cortex model.',
|
|
756
|
+
input: { name: { type: 'string', required: true, description: 'Cortex name.' } },
|
|
757
|
+
handler: ({ client }, input) => client.post(`/v1/cortex/${encodeURIComponent(requiredString(input, 'name'))}/deactivate`),
|
|
758
|
+
},
|
|
759
|
+
{
|
|
760
|
+
name: 'aimeat_cortex_delete',
|
|
761
|
+
description: 'Delete a cortex model.',
|
|
762
|
+
input: { name: { type: 'string', required: true, description: 'Cortex name.' } },
|
|
763
|
+
handler: ({ client }, input) => client.delete(`/v1/cortex/${encodeURIComponent(requiredString(input, 'name'))}`),
|
|
764
|
+
},
|
|
765
|
+
];
|
|
766
|
+
function getTool(name) {
|
|
767
|
+
return CONNECT_CLI_TOOLS.find(tool => tool.name === name);
|
|
768
|
+
}
|
|
769
|
+
function getCliToolMetadata(name) {
|
|
770
|
+
const definition = getAimeatToolDefinition(name);
|
|
771
|
+
return definition?.visibility.cliFallback ? definition : undefined;
|
|
772
|
+
}
|
|
773
|
+
function printJson(value) {
|
|
774
|
+
console.log(JSON.stringify(value, null, 2));
|
|
775
|
+
}
|
|
776
|
+
function loadJsonSource(flags) {
|
|
777
|
+
if (flags.stdin === 'true')
|
|
778
|
+
return null;
|
|
779
|
+
const source = flags.json ?? flags.data;
|
|
780
|
+
if (!source || source === 'true')
|
|
781
|
+
return '{}';
|
|
782
|
+
const trimmed = source.trim();
|
|
783
|
+
if (trimmed.startsWith('{') || trimmed.startsWith('['))
|
|
784
|
+
return trimmed;
|
|
785
|
+
if (!existsSync(source))
|
|
786
|
+
throw new Error(`Input JSON file not found: ${source}`);
|
|
787
|
+
return readFileSync(source, 'utf-8');
|
|
788
|
+
}
|
|
789
|
+
async function readStdin() {
|
|
790
|
+
const chunks = [];
|
|
791
|
+
for await (const chunk of process.stdin) {
|
|
792
|
+
chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
|
|
793
|
+
}
|
|
794
|
+
return Buffer.concat(chunks).toString('utf-8');
|
|
795
|
+
}
|
|
796
|
+
function expandFileReferences(value) {
|
|
797
|
+
if (typeof value === 'string' && value.startsWith('@file:')) {
|
|
798
|
+
return readFileSync(value.slice('@file:'.length), 'utf-8');
|
|
799
|
+
}
|
|
800
|
+
if (Array.isArray(value))
|
|
801
|
+
return value.map(item => expandFileReferences(item));
|
|
802
|
+
if (typeof value === 'object' && value !== null) {
|
|
803
|
+
const expanded = {};
|
|
804
|
+
for (const [key, child] of Object.entries(value))
|
|
805
|
+
expanded[key] = expandFileReferences(child);
|
|
806
|
+
return expanded;
|
|
807
|
+
}
|
|
808
|
+
return value;
|
|
809
|
+
}
|
|
810
|
+
async function readInput(flags) {
|
|
811
|
+
const raw = flags.stdin === 'true' ? await readStdin() : loadJsonSource(flags);
|
|
812
|
+
const trimmed = raw?.trim() ?? '{}';
|
|
813
|
+
if (!trimmed)
|
|
814
|
+
return {};
|
|
815
|
+
const parsed = JSON.parse(trimmed);
|
|
816
|
+
if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed)) {
|
|
817
|
+
throw new Error('Tool input must be a JSON object.');
|
|
818
|
+
}
|
|
819
|
+
return expandFileReferences(parsed);
|
|
820
|
+
}
|
|
821
|
+
export function runToolList(flags) {
|
|
822
|
+
const tools = CLI_FALLBACK_TOOL_DEFINITIONS
|
|
823
|
+
.filter(tool => tool.visibility.cliFallback)
|
|
824
|
+
.map(tool => ({ name: tool.name, description: tool.description }));
|
|
825
|
+
if (flags.json === 'true') {
|
|
826
|
+
printJson({ tools });
|
|
827
|
+
return;
|
|
828
|
+
}
|
|
829
|
+
for (const tool of tools)
|
|
830
|
+
console.log(`${tool.name}\n ${tool.description}`);
|
|
831
|
+
}
|
|
832
|
+
export function runToolSchema(toolName) {
|
|
833
|
+
if (!toolName) {
|
|
834
|
+
console.error('Usage: aimeat connect schema <tool-name>');
|
|
835
|
+
process.exitCode = 1;
|
|
836
|
+
return;
|
|
837
|
+
}
|
|
838
|
+
const tool = getCliToolMetadata(toolName);
|
|
839
|
+
if (!tool || !getTool(toolName)) {
|
|
840
|
+
console.error(`Unknown CLI-callable tool: ${toolName}`);
|
|
841
|
+
process.exitCode = 1;
|
|
842
|
+
return;
|
|
843
|
+
}
|
|
844
|
+
printJson(tool);
|
|
845
|
+
}
|
|
846
|
+
export async function runToolCall(toolName, flags) {
|
|
847
|
+
if (!toolName) {
|
|
848
|
+
console.error('Usage: aimeat connect call <tool-name> --json input.json');
|
|
849
|
+
process.exitCode = 1;
|
|
850
|
+
return;
|
|
851
|
+
}
|
|
852
|
+
const tool = getTool(toolName);
|
|
853
|
+
const metadata = getCliToolMetadata(toolName);
|
|
854
|
+
if (!tool || !metadata) {
|
|
855
|
+
console.error(`Unknown CLI-callable tool: ${toolName}`);
|
|
856
|
+
process.exitCode = 1;
|
|
857
|
+
return;
|
|
858
|
+
}
|
|
859
|
+
try {
|
|
860
|
+
const config = loadConfig();
|
|
861
|
+
if (!config)
|
|
862
|
+
throw new Error('Not configured. Run: npx aimeat connect');
|
|
863
|
+
const client = await Client.fromConfig();
|
|
864
|
+
const input = await readInput(flags);
|
|
865
|
+
const response = await tool.handler({ client, config, agentPath: encodeURIComponent(config.agent) }, input);
|
|
866
|
+
if (!response.ok) {
|
|
867
|
+
console.error(JSON.stringify(response.error ?? response, null, 2));
|
|
868
|
+
process.exitCode = 1;
|
|
869
|
+
return;
|
|
870
|
+
}
|
|
871
|
+
printJson(response.data ?? response);
|
|
872
|
+
}
|
|
873
|
+
catch (error) {
|
|
874
|
+
console.error(error.message);
|
|
875
|
+
process.exitCode = 1;
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
//# sourceMappingURL=tool-call.js.map
|