@wiro-ai/wiro-mcp 1.3.3 → 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/README.md +173 -16
- package/dist/client.d.ts +10 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +39 -20
- package/dist/client.js.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/instructions.d.ts +2 -0
- package/dist/instructions.d.ts.map +1 -0
- package/dist/instructions.js +25 -0
- package/dist/instructions.js.map +1 -0
- package/dist/playbooks.d.ts +8 -0
- package/dist/playbooks.d.ts.map +1 -0
- package/dist/playbooks.js +665 -0
- package/dist/playbooks.js.map +1 -0
- package/dist/prompts.d.ts +4 -0
- package/dist/prompts.d.ts.map +1 -0
- package/dist/prompts.js +133 -0
- package/dist/prompts.js.map +1 -0
- package/dist/server.d.ts +9 -2
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +9 -3
- package/dist/server.js.map +1 -1
- package/dist/tools/apply-agent-skills.d.ts +4 -0
- package/dist/tools/apply-agent-skills.d.ts.map +1 -0
- package/dist/tools/apply-agent-skills.js +545 -0
- package/dist/tools/apply-agent-skills.js.map +1 -0
- package/dist/tools/cancel-agent-message.d.ts +4 -0
- package/dist/tools/cancel-agent-message.d.ts.map +1 -0
- package/dist/tools/cancel-agent-message.js +126 -0
- package/dist/tools/cancel-agent-message.js.map +1 -0
- package/dist/tools/cancel-task.js +3 -3
- package/dist/tools/cancel-task.js.map +1 -1
- package/dist/tools/clone-workflow.d.ts +4 -0
- package/dist/tools/clone-workflow.d.ts.map +1 -0
- package/dist/tools/clone-workflow.js +83 -0
- package/dist/tools/clone-workflow.js.map +1 -0
- package/dist/tools/connect-agent-oauth.d.ts +4 -0
- package/dist/tools/connect-agent-oauth.d.ts.map +1 -0
- package/dist/tools/connect-agent-oauth.js +508 -0
- package/dist/tools/connect-agent-oauth.js.map +1 -0
- package/dist/tools/control-agent.d.ts +4 -0
- package/dist/tools/control-agent.d.ts.map +1 -0
- package/dist/tools/control-agent.js +274 -0
- package/dist/tools/control-agent.js.map +1 -0
- package/dist/tools/create-workflow.d.ts +100 -0
- package/dist/tools/create-workflow.d.ts.map +1 -0
- package/dist/tools/create-workflow.js +103 -0
- package/dist/tools/create-workflow.js.map +1 -0
- package/dist/tools/delete-agent-session.d.ts +6 -0
- package/dist/tools/delete-agent-session.d.ts.map +1 -0
- package/dist/tools/delete-agent-session.js +134 -0
- package/dist/tools/delete-agent-session.js.map +1 -0
- package/dist/tools/delete-agent.d.ts +4 -0
- package/dist/tools/delete-agent.d.ts.map +1 -0
- package/dist/tools/delete-agent.js +144 -0
- package/dist/tools/delete-agent.js.map +1 -0
- package/dist/tools/delete-workflow.d.ts +4 -0
- package/dist/tools/delete-workflow.d.ts.map +1 -0
- package/dist/tools/delete-workflow.js +77 -0
- package/dist/tools/delete-workflow.js.map +1 -0
- package/dist/tools/deploy-agent.d.ts +4 -0
- package/dist/tools/deploy-agent.d.ts.map +1 -0
- package/dist/tools/deploy-agent.js +455 -0
- package/dist/tools/deploy-agent.js.map +1 -0
- package/dist/tools/disconnect-agent-oauth.d.ts +4 -0
- package/dist/tools/disconnect-agent-oauth.d.ts.map +1 -0
- package/dist/tools/disconnect-agent-oauth.js +118 -0
- package/dist/tools/disconnect-agent-oauth.js.map +1 -0
- package/dist/tools/get-account.d.ts +4 -0
- package/dist/tools/get-account.d.ts.map +1 -0
- package/dist/tools/get-account.js +110 -0
- package/dist/tools/get-account.js.map +1 -0
- package/dist/tools/get-agent-activity.d.ts +4 -0
- package/dist/tools/get-agent-activity.d.ts.map +1 -0
- package/dist/tools/get-agent-activity.js +383 -0
- package/dist/tools/get-agent-activity.js.map +1 -0
- package/dist/tools/get-agent-conversation.d.ts +4 -0
- package/dist/tools/get-agent-conversation.d.ts.map +1 -0
- package/dist/tools/get-agent-conversation.js +224 -0
- package/dist/tools/get-agent-conversation.js.map +1 -0
- package/dist/tools/get-agent-message.d.ts +4 -0
- package/dist/tools/get-agent-message.d.ts.map +1 -0
- package/dist/tools/get-agent-message.js +68 -0
- package/dist/tools/get-agent-message.js.map +1 -0
- package/dist/tools/get-agent-template.d.ts +4 -0
- package/dist/tools/get-agent-template.d.ts.map +1 -0
- package/dist/tools/get-agent-template.js +107 -0
- package/dist/tools/get-agent-template.js.map +1 -0
- package/dist/tools/get-model-schema.d.ts +5 -1
- package/dist/tools/get-model-schema.d.ts.map +1 -1
- package/dist/tools/get-model-schema.js +136 -8
- package/dist/tools/get-model-schema.js.map +1 -1
- package/dist/tools/get-my-agent.d.ts +4 -0
- package/dist/tools/get-my-agent.d.ts.map +1 -0
- package/dist/tools/get-my-agent.js +78 -0
- package/dist/tools/get-my-agent.js.map +1 -0
- package/dist/tools/get-playbook.d.ts +3 -0
- package/dist/tools/get-playbook.d.ts.map +1 -0
- package/dist/tools/get-playbook.js +50 -0
- package/dist/tools/get-playbook.js.map +1 -0
- package/dist/tools/get-task-price.d.ts.map +1 -1
- package/dist/tools/get-task-price.js +42 -15
- package/dist/tools/get-task-price.js.map +1 -1
- package/dist/tools/get-task.d.ts.map +1 -1
- package/dist/tools/get-task.js +4 -3
- package/dist/tools/get-task.js.map +1 -1
- package/dist/tools/get-workflow.d.ts +9 -0
- package/dist/tools/get-workflow.d.ts.map +1 -0
- package/dist/tools/get-workflow.js +99 -0
- package/dist/tools/get-workflow.js.map +1 -0
- package/dist/tools/index.d.ts +62 -2
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +127 -14
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/kill-task.d.ts.map +1 -1
- package/dist/tools/kill-task.js +10 -6
- package/dist/tools/kill-task.js.map +1 -1
- package/dist/tools/list-agent-skills.d.ts +4 -0
- package/dist/tools/list-agent-skills.d.ts.map +1 -0
- package/dist/tools/list-agent-skills.js +242 -0
- package/dist/tools/list-agent-skills.js.map +1 -0
- package/dist/tools/list-agent-templates.d.ts +4 -0
- package/dist/tools/list-agent-templates.d.ts.map +1 -0
- package/dist/tools/list-agent-templates.js +110 -0
- package/dist/tools/list-agent-templates.js.map +1 -0
- package/dist/tools/list-my-agents.d.ts +4 -0
- package/dist/tools/list-my-agents.d.ts.map +1 -0
- package/dist/tools/list-my-agents.js +90 -0
- package/dist/tools/list-my-agents.js.map +1 -0
- package/dist/tools/list-studio-results.d.ts +4 -0
- package/dist/tools/list-studio-results.d.ts.map +1 -0
- package/dist/tools/list-studio-results.js +95 -0
- package/dist/tools/list-studio-results.js.map +1 -0
- package/dist/tools/list-tasks.d.ts.map +1 -1
- package/dist/tools/list-tasks.js +7 -5
- package/dist/tools/list-tasks.js.map +1 -1
- package/dist/tools/list-workflow-runs.d.ts +4 -0
- package/dist/tools/list-workflow-runs.d.ts.map +1 -0
- package/dist/tools/list-workflow-runs.js +110 -0
- package/dist/tools/list-workflow-runs.js.map +1 -0
- package/dist/tools/list-workflows.d.ts +4 -0
- package/dist/tools/list-workflows.d.ts.map +1 -0
- package/dist/tools/list-workflows.js +143 -0
- package/dist/tools/list-workflows.js.map +1 -0
- package/dist/tools/manage-agent-billing.d.ts +4 -0
- package/dist/tools/manage-agent-billing.d.ts.map +1 -0
- package/dist/tools/manage-agent-billing.js +764 -0
- package/dist/tools/manage-agent-billing.js.map +1 -0
- package/dist/tools/manage-agent-custom-skill.d.ts +4 -0
- package/dist/tools/manage-agent-custom-skill.d.ts.map +1 -0
- package/dist/tools/manage-agent-custom-skill.js +537 -0
- package/dist/tools/manage-agent-custom-skill.js.map +1 -0
- package/dist/tools/recommend-model.d.ts.map +1 -1
- package/dist/tools/recommend-model.js +6 -5
- package/dist/tools/recommend-model.js.map +1 -1
- package/dist/tools/resume-workflow-run.d.ts +4 -0
- package/dist/tools/resume-workflow-run.d.ts.map +1 -0
- package/dist/tools/resume-workflow-run.js +69 -0
- package/dist/tools/resume-workflow-run.js.map +1 -0
- package/dist/tools/run-model.d.ts.map +1 -1
- package/dist/tools/run-model.js +39 -3
- package/dist/tools/run-model.js.map +1 -1
- package/dist/tools/run-workflow.d.ts +6 -0
- package/dist/tools/run-workflow.d.ts.map +1 -0
- package/dist/tools/run-workflow.js +132 -0
- package/dist/tools/run-workflow.js.map +1 -0
- package/dist/tools/save-workflow-from-agent.d.ts +4 -0
- package/dist/tools/save-workflow-from-agent.d.ts.map +1 -0
- package/dist/tools/save-workflow-from-agent.js +283 -0
- package/dist/tools/save-workflow-from-agent.js.map +1 -0
- package/dist/tools/schemas.d.ts +62 -12
- package/dist/tools/schemas.d.ts.map +1 -1
- package/dist/tools/schemas.js +17 -3
- package/dist/tools/schemas.js.map +1 -1
- package/dist/tools/search-models.js +6 -6
- package/dist/tools/search-models.js.map +1 -1
- package/dist/tools/send-agent-message.d.ts +4 -0
- package/dist/tools/send-agent-message.d.ts.map +1 -0
- package/dist/tools/send-agent-message.js +156 -0
- package/dist/tools/send-agent-message.js.map +1 -0
- package/dist/tools/set-agent-credentials.d.ts +4 -0
- package/dist/tools/set-agent-credentials.d.ts.map +1 -0
- package/dist/tools/set-agent-credentials.js +529 -0
- package/dist/tools/set-agent-credentials.js.map +1 -0
- package/dist/tools/update-agent.d.ts +4 -0
- package/dist/tools/update-agent.d.ts.map +1 -0
- package/dist/tools/update-agent.js +178 -0
- package/dist/tools/update-agent.js.map +1 -0
- package/dist/tools/update-workflow.d.ts +201 -0
- package/dist/tools/update-workflow.d.ts.map +1 -0
- package/dist/tools/update-workflow.js +168 -0
- package/dist/tools/update-workflow.js.map +1 -0
- package/dist/tools/upload-file.d.ts.map +1 -1
- package/dist/tools/upload-file.js +4 -3
- package/dist/tools/upload-file.js.map +1 -1
- package/dist/tools/wait-for-workflow-run.d.ts +259 -0
- package/dist/tools/wait-for-workflow-run.d.ts.map +1 -0
- package/dist/tools/wait-for-workflow-run.js +190 -0
- package/dist/tools/wait-for-workflow-run.js.map +1 -0
- package/dist/types.d.ts +22 -4
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/utils/agent-catalog.d.ts +1256 -0
- package/dist/utils/agent-catalog.d.ts.map +1 -0
- package/dist/utils/agent-catalog.js +388 -0
- package/dist/utils/agent-catalog.js.map +1 -0
- package/dist/utils/agent-config.d.ts +441 -0
- package/dist/utils/agent-config.d.ts.map +1 -0
- package/dist/utils/agent-config.js +1667 -0
- package/dist/utils/agent-config.js.map +1 -0
- package/dist/utils/agent-message.d.ts +115 -0
- package/dist/utils/agent-message.d.ts.map +1 -0
- package/dist/utils/agent-message.js +246 -0
- package/dist/utils/agent-message.js.map +1 -0
- package/dist/utils/agent-targets.d.ts +76 -0
- package/dist/utils/agent-targets.d.ts.map +1 -0
- package/dist/utils/agent-targets.js +408 -0
- package/dist/utils/agent-targets.js.map +1 -0
- package/dist/utils/agent-turns.d.ts +354 -0
- package/dist/utils/agent-turns.d.ts.map +1 -0
- package/dist/utils/agent-turns.js +623 -0
- package/dist/utils/agent-turns.js.map +1 -0
- package/dist/utils/api.d.ts +40 -0
- package/dist/utils/api.d.ts.map +1 -0
- package/dist/utils/api.js +111 -0
- package/dist/utils/api.js.map +1 -0
- package/dist/utils/format.d.ts +42 -1
- package/dist/utils/format.d.ts.map +1 -1
- package/dist/utils/format.js +173 -14
- package/dist/utils/format.js.map +1 -1
- package/dist/utils/media.d.ts +28 -0
- package/dist/utils/media.d.ts.map +1 -0
- package/dist/utils/media.js +65 -0
- package/dist/utils/media.js.map +1 -0
- package/dist/utils/poll.d.ts +39 -0
- package/dist/utils/poll.d.ts.map +1 -0
- package/dist/utils/poll.js +111 -0
- package/dist/utils/poll.js.map +1 -0
- package/dist/utils/remote-file.js +2 -2
- package/dist/utils/remote-file.js.map +1 -1
- package/dist/utils/structured.d.ts +2 -0
- package/dist/utils/structured.d.ts.map +1 -1
- package/dist/utils/structured.js +10 -10
- package/dist/utils/structured.js.map +1 -1
- package/dist/utils/studio-runs.d.ts +87 -0
- package/dist/utils/studio-runs.d.ts.map +1 -0
- package/dist/utils/studio-runs.js +167 -0
- package/dist/utils/studio-runs.js.map +1 -0
- package/dist/utils/user-agent.d.ts +1140 -0
- package/dist/utils/user-agent.d.ts.map +1 -0
- package/dist/utils/user-agent.js +802 -0
- package/dist/utils/user-agent.js.map +1 -0
- package/dist/utils/workflow-agent.d.ts +151 -0
- package/dist/utils/workflow-agent.d.ts.map +1 -0
- package/dist/utils/workflow-agent.js +292 -0
- package/dist/utils/workflow-agent.js.map +1 -0
- package/dist/utils/workflow-artifacts.d.ts +160 -0
- package/dist/utils/workflow-artifacts.d.ts.map +1 -0
- package/dist/utils/workflow-artifacts.js +801 -0
- package/dist/utils/workflow-artifacts.js.map +1 -0
- package/dist/utils/workflow-save.d.ts +123 -0
- package/dist/utils/workflow-save.d.ts.map +1 -0
- package/dist/utils/workflow-save.js +734 -0
- package/dist/utils/workflow-save.js.map +1 -0
- package/dist/utils/workflow.d.ts +559 -0
- package/dist/utils/workflow.d.ts.map +1 -0
- package/dist/utils/workflow.js +613 -0
- package/dist/utils/workflow.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,455 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ApiResultError, asString, errorResult, errorText, hasErrorCode, isPlainObject, requireApiSuccess, toNumber, } from '../utils/api.js';
|
|
3
|
+
import { DEFAULT_WAIT_SECONDS } from '../utils/poll.js';
|
|
4
|
+
import { deployedAgentSchema, describeAgentStatus, formatCredits, formatUsd, isGuid, nextStepForAgent, outcomeUnknown, readAgentDetail, sameAmount, toAgentDetail, toDeployedAgent, toStringArray, } from '../utils/user-agent.js';
|
|
5
|
+
import { resolveDeployCustomSkills } from '../utils/agent-config.js';
|
|
6
|
+
import { toSkillSummary, toTemplateDetail } from '../utils/agent-catalog.js';
|
|
7
|
+
import { nextActionSchema } from './schemas.js';
|
|
8
|
+
const PAID_FROM = 'The Wiro wallet of the connected project\'s workspace: the team wallet for a team '
|
|
9
|
+
+ 'project, otherwise the personal wallet.';
|
|
10
|
+
const quoteCustomSkillSchema = z.object({
|
|
11
|
+
key: z.string(),
|
|
12
|
+
kind: z.enum(['skill', 'scheduled_task']),
|
|
13
|
+
interval: z.string().optional(),
|
|
14
|
+
enabled: z.boolean().optional(),
|
|
15
|
+
replacesTemplateEntry: z.boolean(),
|
|
16
|
+
});
|
|
17
|
+
const quoteSchema = z.object({
|
|
18
|
+
kind: z.enum(['template', 'custom']),
|
|
19
|
+
template: z.object({ guid: z.string(), slug: z.string(), title: z.string() }).optional(),
|
|
20
|
+
title: z.string(),
|
|
21
|
+
tier: z.enum(['starter', 'pro']),
|
|
22
|
+
priceUsd: z.number(),
|
|
23
|
+
monthlyCredits: z.number(),
|
|
24
|
+
paidFrom: z.string(),
|
|
25
|
+
skills: z.array(z.string()).optional(),
|
|
26
|
+
credentialsNeeded: z.array(z.object({ key: z.string(), title: z.string() })),
|
|
27
|
+
customSkills: z.array(quoteCustomSkillSchema).optional(),
|
|
28
|
+
});
|
|
29
|
+
const customSkillSchema = z.object({
|
|
30
|
+
key: z.string().min(1).max(70)
|
|
31
|
+
.describe('The entry\'s key: a full key (cs-... or cs-cron-...) or a bare slug such as "weekly-report" (lowercase letters, digits, single dashes). A bare slug names the template\'s own entry of that name when it has one; otherwise it becomes cs-<slug>, or cs-cron-<slug> with interval.'),
|
|
32
|
+
value: z.string().max(20_000).optional()
|
|
33
|
+
.describe('The instruction text the agent follows, or the prompt a scheduled task runs. Required for a new entry. Leave it out for an entry that comes with the template: a custom skill then keeps the template\'s text, and a scheduled task always runs the template\'s own prompt, so only its interval and enabled can change.'),
|
|
34
|
+
description: z.string().max(500).optional()
|
|
35
|
+
.describe('Short description shown in the dashboard.'),
|
|
36
|
+
interval: z.string().max(100).optional()
|
|
37
|
+
.describe('A 5-field cron expression in the agent\'s timezone (UTC until changed with update_agent), for example "0 9 * * 1-5". Setting it makes the entry a scheduled task. Left out, a scheduled task that comes with the template keeps the template\'s schedule.'),
|
|
38
|
+
enabled: z.boolean().optional()
|
|
39
|
+
.describe('Whether the entry is on (default true). false turns off a scheduled task that comes with the template.'),
|
|
40
|
+
});
|
|
41
|
+
const deployedCustomSkillSchema = z.object({
|
|
42
|
+
key: z.string(),
|
|
43
|
+
kind: z.enum(['skill', 'scheduled_task']),
|
|
44
|
+
interval: z.string().nullable().optional(),
|
|
45
|
+
enabled: z.boolean().optional(),
|
|
46
|
+
onAgent: z.boolean(),
|
|
47
|
+
});
|
|
48
|
+
function customSkillLine(skill, fromTemplate) {
|
|
49
|
+
const details = [
|
|
50
|
+
skill.kind === 'scheduled_task' ? 'scheduled task' : 'custom skill',
|
|
51
|
+
skill.interval ? `runs on "${skill.interval}"` : null,
|
|
52
|
+
skill.enabled === false ? 'turned off' : null,
|
|
53
|
+
fromTemplate ? 'replaces the template\'s entry' : null,
|
|
54
|
+
].filter(Boolean).join(', ');
|
|
55
|
+
return `\`${skill.key}\` (${details})`;
|
|
56
|
+
}
|
|
57
|
+
function quoteText(quote) {
|
|
58
|
+
const what = quote.kind === 'template'
|
|
59
|
+
? `${quote.title}, from the template ${quote.template?.title ?? ''} (\`${quote.template?.slug ?? ''}\`)`
|
|
60
|
+
: `${quote.title}, a custom build${quote.skills?.length ? ` with ${quote.skills.join(', ')}` : ' with no extra skills'}`;
|
|
61
|
+
const lines = [
|
|
62
|
+
'## Deployment quote (nothing charged yet)',
|
|
63
|
+
'',
|
|
64
|
+
`- Agent: ${what}`,
|
|
65
|
+
`- Tier: ${quote.tier === 'pro' ? 'Pro' : 'Starter'}`,
|
|
66
|
+
`- Price: ${formatUsd(quote.priceUsd)} now, then ${formatUsd(quote.priceUsd)} every 30 days until the plan is cancelled`,
|
|
67
|
+
`- Monthly credits: ${formatCredits(quote.monthlyCredits)}. They pay for the agent's chat and scheduled tasks (100 credits = $1). Model runs it starts, for images, videos or voice calls, are billed to the wallet of the Wiro API key saved on the agent.`,
|
|
68
|
+
`- Paid from: ${quote.paidFrom} get_account shows the balance.`,
|
|
69
|
+
];
|
|
70
|
+
if (quote.customSkills?.length) {
|
|
71
|
+
const scheduled = quote.customSkills.some(skill => skill.kind === 'scheduled_task');
|
|
72
|
+
lines.push(`- Custom skills and scheduled tasks: ${quote.customSkills.map(skill => customSkillLine(skill, skill.replacesTemplateEntry)).join('; ')}.${scheduled ? ' Scheduled tasks run in UTC until the time zone is changed, and every run spends the agent\'s credits.' : ''}`);
|
|
73
|
+
}
|
|
74
|
+
if (quote.credentialsNeeded.length > 0) {
|
|
75
|
+
lines.push(`- After deployment the user must provide: ${quote.credentialsNeeded.map(item => `${item.title} (\`${item.key}\`)`).join(', ')}`);
|
|
76
|
+
}
|
|
77
|
+
return lines.join('\n');
|
|
78
|
+
}
|
|
79
|
+
/** Where each requested custom skill ended up on the new agent. */
|
|
80
|
+
function deployedCustomSkills(agent, requested) {
|
|
81
|
+
const tasks = [...agent.scheduledTasks, ...agent.customInstructions];
|
|
82
|
+
return requested.map(skill => {
|
|
83
|
+
const found = tasks.find(task => task.key === skill.key);
|
|
84
|
+
return {
|
|
85
|
+
key: skill.key,
|
|
86
|
+
kind: skill.kind,
|
|
87
|
+
...(found ? { interval: found.interval ?? null, enabled: found.enabled } : {}),
|
|
88
|
+
onAgent: found !== undefined,
|
|
89
|
+
};
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
function deployedText(agent, quote, chargedUsd, customSkills) {
|
|
93
|
+
const lines = [
|
|
94
|
+
'## Agent deployed',
|
|
95
|
+
'',
|
|
96
|
+
`- Agent: ${agent.title} (\`${agent.guid}\`)`,
|
|
97
|
+
`- Status: ${describeAgentStatus(agent.status)}. It starts on its own; get_my_agent with wait_seconds follows it.`,
|
|
98
|
+
`- Charged: ${formatUsd(chargedUsd ?? quote.priceUsd)} from the wallet. The plan renews every 30 days until it is cancelled.`,
|
|
99
|
+
`- Monthly credits: ${formatCredits(agent.credits.monthly || quote.monthlyCredits)}`,
|
|
100
|
+
];
|
|
101
|
+
const saved = customSkills.filter(skill => skill.onAgent);
|
|
102
|
+
const missing = customSkills.filter(skill => !skill.onAgent);
|
|
103
|
+
if (saved.length > 0)
|
|
104
|
+
lines.push(`- Custom skills saved: ${saved.map(skill => customSkillLine(skill)).join('; ')}`);
|
|
105
|
+
if (missing.length > 0) {
|
|
106
|
+
lines.push(`- Not found on the new agent: ${missing.map(skill => `\`${skill.key}\``).join(', ')}. get_my_agent shows its custom skills; manage_agent_custom_skill adds them.`);
|
|
107
|
+
}
|
|
108
|
+
if (agent.missingCredentials.length > 0) {
|
|
109
|
+
lines.push(`- Missing credentials: ${agent.missingCredentials.map(item => `${item.title} (\`${item.key}\`)`).join(', ')}. Skills that need them fail until they are set.`);
|
|
110
|
+
}
|
|
111
|
+
lines.push(`- Dashboard: ${agent.dashboardUrl}`);
|
|
112
|
+
return lines.join('\n');
|
|
113
|
+
}
|
|
114
|
+
export function registerDeployAgent(server, client) {
|
|
115
|
+
server.registerTool('deploy_agent', {
|
|
116
|
+
title: 'Deploy a Wiro agent',
|
|
117
|
+
description: 'Deploy a new agent from a template or as a custom build from chosen skills. In a team '
|
|
118
|
+
+ 'workspace only a team admin can deploy; anyone else is refused before anything is created or charged. This costs '
|
|
119
|
+
+ 'money: the first 30 days are paid from the Wiro wallet of the connected project\'s workspace '
|
|
120
|
+
+ '(a team project pays from the team wallet), and the plan renews from that wallet every 30 '
|
|
121
|
+
+ 'days until it is cancelled. Without confirm: true the tool only returns the exact quote. Show it to '
|
|
122
|
+
+ 'the user, get their approval, then repeat the call with confirm: true and confirm_charge_usd set to '
|
|
123
|
+
+ 'the quoted price; if the price changed in between, nothing is charged and a new quote comes back. '
|
|
124
|
+
+ 'Never repeat a confirmed deploy that timed out or whose outcome is unknown without checking '
|
|
125
|
+
+ 'list_my_agents first. A refusal that says nothing was created or charged, such as one for balance, '
|
|
126
|
+
+ 'can be confirmed again once its cause is fixed and the user says yes. The '
|
|
127
|
+
+ 'agent starts on its own after deployment. Credentials can be added later with set_agent_credentials '
|
|
128
|
+
+ 'or connect_agent_oauth, but skills that need them do not work until then. A custom build also gets '
|
|
129
|
+
+ 'the scheduled tasks its skills come with, or a starter task on Mondays at 10:00. To change a template\'s '
|
|
130
|
+
+ 'skills, deploy it first and then use apply_agent_skills. get_playbook describes the whole flow.',
|
|
131
|
+
inputSchema: {
|
|
132
|
+
template: z.string().min(1).max(200).optional()
|
|
133
|
+
.describe('Template slug or guid from list_agent_templates. Leave it out for a custom build.'),
|
|
134
|
+
custom: z.boolean().default(false)
|
|
135
|
+
.describe('true for a custom build from `skills` instead of a template.'),
|
|
136
|
+
skills: z.array(z.string().min(1).max(100)).max(60).optional()
|
|
137
|
+
.describe('Custom build only: skill names from list_agent_skills. Skills they depend on are added and priced automatically. An empty list deploys an agent with no extra skills at the minimum price.'),
|
|
138
|
+
title: z.string().trim().min(1).max(200).optional()
|
|
139
|
+
.describe('Name of the new agent. Required for a custom build. A template deploy defaults to the template title.'),
|
|
140
|
+
tier: z.enum(['starter', 'pro'])
|
|
141
|
+
.describe('Plan tier. Pro has a larger monthly credit pool and is the only tier that can buy extra credit packs.'),
|
|
142
|
+
description: z.string().max(5_000).optional()
|
|
143
|
+
.describe('Optional description of the agent.'),
|
|
144
|
+
cover: z.string().url().max(2_048).optional()
|
|
145
|
+
.describe('Optional https image URL for the agent cover. A template deploy shows the template cover when it is left out.'),
|
|
146
|
+
credentials: z.record(z.string(), z.record(z.string(), z.unknown())).optional()
|
|
147
|
+
.describe('Optional credential values stored at deployment, keyed by credential key and then field key, for example {"telegram": {"bottoken": "...", "allowedusers": ["123456789"]}}. A chat channel group must contain every required field. Values are never shown back. Other credentials are better set after deployment with set_agent_credentials, which reports field errors.'),
|
|
148
|
+
custom_skills: z.array(customSkillSchema).max(20).optional()
|
|
149
|
+
.describe('Optional custom instructions or scheduled tasks added at deployment, or changes to the ones the template comes with. They are checked before the quote.'),
|
|
150
|
+
confirm_charge_usd: z.number().min(0).max(100_000).optional()
|
|
151
|
+
.describe('With confirm: true, the price the user approved, from the quote\'s nextAction (quote.priceUsd). Required to deploy. If a fresh quote no longer matches it, nothing is charged and the new quote is returned.'),
|
|
152
|
+
confirm: z.boolean().default(false)
|
|
153
|
+
.describe('false returns only the quote. true deploys the agent and charges the wallet. Set it only after the user approved the quoted price.'),
|
|
154
|
+
},
|
|
155
|
+
outputSchema: {
|
|
156
|
+
stage: z.enum(['quote', 'deployed', 'duplicate', 'retry_later']),
|
|
157
|
+
quote: quoteSchema,
|
|
158
|
+
priceChanged: z.boolean().optional(),
|
|
159
|
+
agent: deployedAgentSchema.optional(),
|
|
160
|
+
existingAgentGuid: z.string().optional(),
|
|
161
|
+
chargedUsd: z.number().nullable().optional(),
|
|
162
|
+
customSkills: z.array(deployedCustomSkillSchema).optional(),
|
|
163
|
+
message: z.string(),
|
|
164
|
+
nextAction: nextActionSchema.optional(),
|
|
165
|
+
},
|
|
166
|
+
annotations: {
|
|
167
|
+
readOnlyHint: false,
|
|
168
|
+
destructiveHint: true,
|
|
169
|
+
idempotentHint: false,
|
|
170
|
+
openWorldHint: true,
|
|
171
|
+
},
|
|
172
|
+
}, async (args, extra) => {
|
|
173
|
+
let deploySent = false;
|
|
174
|
+
try {
|
|
175
|
+
const { template, custom, tier, confirm } = args;
|
|
176
|
+
const templateRef = template?.trim();
|
|
177
|
+
if (templateRef && custom)
|
|
178
|
+
throw new Error('Pass either template or custom: true, not both.');
|
|
179
|
+
if (!templateRef && !custom) {
|
|
180
|
+
throw new Error('Pass template (a slug or guid from list_agent_templates), or custom: true with skills from list_agent_skills.');
|
|
181
|
+
}
|
|
182
|
+
if (args.skills && !custom) {
|
|
183
|
+
throw new Error('skills are only used for a custom build. Deploy the template first, then change its skills with apply_agent_skills.');
|
|
184
|
+
}
|
|
185
|
+
if (custom && !args.title)
|
|
186
|
+
throw new Error('title is required for a custom build.');
|
|
187
|
+
const requestedCustomSkills = args.custom_skills ?? [];
|
|
188
|
+
// Keys, schedules and empty texts are checked before anything is read.
|
|
189
|
+
const syntax = resolveDeployCustomSkills(requestedCustomSkills, null);
|
|
190
|
+
if (syntax.errors.length > 0) {
|
|
191
|
+
throw new Error(`Nothing was deployed. Fix custom_skills:\n\n- ${syntax.errors.join('\n- ')}`);
|
|
192
|
+
}
|
|
193
|
+
let quote;
|
|
194
|
+
let agentGuid;
|
|
195
|
+
let templateTasks = [];
|
|
196
|
+
const skillNames = [...new Set(args.skills ?? [])];
|
|
197
|
+
if (templateRef) {
|
|
198
|
+
const body = requireApiSuccess(await client.post('/Agent/Detail', {
|
|
199
|
+
...(isGuid(templateRef) ? { guid: templateRef } : { slug: templateRef }),
|
|
200
|
+
...(requestedCustomSkills.length > 0 ? { type: 'full' } : {}),
|
|
201
|
+
}, extra.signal), 'The agent template could not be read.');
|
|
202
|
+
const row = Array.isArray(body.agents) ? body.agents.find(isPlainObject) : undefined;
|
|
203
|
+
if (!row)
|
|
204
|
+
throw new Error(`No agent template was found for "${templateRef}".`);
|
|
205
|
+
const detail = toTemplateDetail(row);
|
|
206
|
+
if (!detail.pricing) {
|
|
207
|
+
throw new Error('This template cannot be priced right now, so it cannot be deployed. Try again later.');
|
|
208
|
+
}
|
|
209
|
+
agentGuid = detail.guid;
|
|
210
|
+
templateTasks = [...(detail.scheduledTasks ?? []), ...(detail.customInstructions ?? [])];
|
|
211
|
+
const price = detail.pricing[tier];
|
|
212
|
+
quote = {
|
|
213
|
+
kind: 'template',
|
|
214
|
+
template: { guid: detail.guid, slug: detail.slug, title: detail.title },
|
|
215
|
+
title: args.title ?? detail.title,
|
|
216
|
+
tier,
|
|
217
|
+
priceUsd: price.priceUsd,
|
|
218
|
+
monthlyCredits: price.monthlyCredits,
|
|
219
|
+
paidFrom: PAID_FROM,
|
|
220
|
+
credentialsNeeded: detail.requiredCredentials.map(item => ({ key: item.key, title: item.title })),
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
else {
|
|
224
|
+
const found = new Map();
|
|
225
|
+
const readSkills = async (names) => {
|
|
226
|
+
const list = requireApiSuccess(await client.post('/Skills/List', { name_in: names }, extra.signal), 'The skill list could not be read.');
|
|
227
|
+
for (const skill of (Array.isArray(list.skills) ? list.skills : []).filter(isPlainObject).map(toSkillSummary)) {
|
|
228
|
+
found.set(skill.name, skill);
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
if (skillNames.length > 0) {
|
|
232
|
+
// Every name is checked against the registry first, so an unknown
|
|
233
|
+
// skill is refused before anything is deployed or charged.
|
|
234
|
+
await readSkills(skillNames);
|
|
235
|
+
const unknown = skillNames.filter(name => !found.has(name));
|
|
236
|
+
if (unknown.length > 0) {
|
|
237
|
+
throw new Error(`Unknown skill${unknown.length > 1 ? 's' : ''}: ${unknown.join(', ')}. Use names from list_agent_skills.`);
|
|
238
|
+
}
|
|
239
|
+
const deprecated = skillNames.filter(name => found.get(name)?.deprecated);
|
|
240
|
+
if (deprecated.length > 0) {
|
|
241
|
+
throw new Error(`Deprecated skill${deprecated.length > 1 ? 's' : ''}: ${deprecated.map(name => {
|
|
242
|
+
const replacement = found.get(name)?.replacement;
|
|
243
|
+
return replacement ? `${name} (use ${replacement})` : name;
|
|
244
|
+
}).join(', ')}.`);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
const preview = requireApiSuccess(await client.post('/UserAgent/PricingPreview', {
|
|
248
|
+
draft: true,
|
|
249
|
+
skills: skillNames,
|
|
250
|
+
tier,
|
|
251
|
+
}, extra.signal), 'The price of this build could not be computed.');
|
|
252
|
+
const priceUsd = toNumber(preview.totalPriceUsd);
|
|
253
|
+
const monthlyCredits = toNumber(preview.totalMonthlyCredits);
|
|
254
|
+
if (priceUsd === null || monthlyCredits === null) {
|
|
255
|
+
throw new Error('The price of this build could not be computed. Try again later.');
|
|
256
|
+
}
|
|
257
|
+
const enabled = toStringArray(preview.enabledSkills);
|
|
258
|
+
const build = enabled.length > 0 ? enabled : skillNames;
|
|
259
|
+
// The quoted build includes the skills the named ones depend on, and
|
|
260
|
+
// their credentials are needed too.
|
|
261
|
+
const unread = build.filter(name => !found.has(name));
|
|
262
|
+
if (unread.length > 0)
|
|
263
|
+
await readSkills(unread);
|
|
264
|
+
const credentialsNeeded = new Map();
|
|
265
|
+
for (const name of build) {
|
|
266
|
+
const skill = found.get(name);
|
|
267
|
+
if (skill?.requiresCredentials && skill.credentialKey && !credentialsNeeded.has(skill.credentialKey)) {
|
|
268
|
+
credentialsNeeded.set(skill.credentialKey, `${skill.title} credentials`);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
quote = {
|
|
272
|
+
kind: 'custom',
|
|
273
|
+
title: args.title ?? '',
|
|
274
|
+
tier,
|
|
275
|
+
priceUsd,
|
|
276
|
+
monthlyCredits,
|
|
277
|
+
paidFrom: PAID_FROM,
|
|
278
|
+
skills: build,
|
|
279
|
+
credentialsNeeded: [...credentialsNeeded].map(([key, title]) => ({ key, title })),
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
const resolved = resolveDeployCustomSkills(requestedCustomSkills, templateTasks);
|
|
283
|
+
if (resolved.errors.length > 0) {
|
|
284
|
+
throw new Error(`Nothing was deployed. Fix custom_skills:\n\n- ${resolved.errors.join('\n- ')}`);
|
|
285
|
+
}
|
|
286
|
+
const customSkills = resolved.skills;
|
|
287
|
+
if (customSkills.length > 0) {
|
|
288
|
+
quote.customSkills = customSkills.map(skill => ({
|
|
289
|
+
key: skill.key,
|
|
290
|
+
kind: skill.kind,
|
|
291
|
+
...(skill.interval !== undefined ? { interval: skill.interval } : {}),
|
|
292
|
+
...(skill.enabled !== undefined ? { enabled: skill.enabled } : {}),
|
|
293
|
+
replacesTemplateEntry: skill.fromTemplate,
|
|
294
|
+
}));
|
|
295
|
+
}
|
|
296
|
+
const { credentials, confirm: _confirm, ...repeat } = args;
|
|
297
|
+
const hasCredentials = credentials !== undefined && Object.keys(credentials).length > 0;
|
|
298
|
+
const credentialsNote = hasCredentials ? ' Pass the same credentials again; they are not repeated here.' : '';
|
|
299
|
+
const confirmCall = (reason) => ({
|
|
300
|
+
tool: 'deploy_agent',
|
|
301
|
+
arguments: { ...repeat, confirm_charge_usd: quote.priceUsd, confirm: true },
|
|
302
|
+
reason: `${reason}${credentialsNote}`,
|
|
303
|
+
});
|
|
304
|
+
const approved = args.confirm_charge_usd;
|
|
305
|
+
const priceChanged = confirm && approved !== undefined && !sameAmount(quote.priceUsd, approved);
|
|
306
|
+
if (!confirm || approved === undefined || priceChanged) {
|
|
307
|
+
const lead = !confirm
|
|
308
|
+
? ''
|
|
309
|
+
: priceChanged
|
|
310
|
+
? `The price changed since the quote: it is now ${formatUsd(quote.priceUsd)}, and the user approved ${formatUsd(approved)}. Nothing was deployed or charged. Show the new price to the user and ask again.\n\n`
|
|
311
|
+
: 'Nothing was deployed: confirm_charge_usd is missing. It is the price the user approved, and it must be sent with confirm: true.\n\n';
|
|
312
|
+
return {
|
|
313
|
+
content: [{
|
|
314
|
+
type: 'text',
|
|
315
|
+
text: `${lead}${quoteText(quote)}\n\nAsk the user to approve this charge. Then call deploy_agent again with the same arguments plus confirm_charge_usd ${quote.priceUsd} and confirm: true.${credentialsNote}`,
|
|
316
|
+
}],
|
|
317
|
+
structuredContent: {
|
|
318
|
+
stage: 'quote',
|
|
319
|
+
quote,
|
|
320
|
+
...(priceChanged ? { priceChanged: true } : {}),
|
|
321
|
+
message: priceChanged
|
|
322
|
+
? 'Nothing was charged. The price changed since the quote; this is the new price of the deployment.'
|
|
323
|
+
: 'Nothing was charged. This is the exact price of the deployment.',
|
|
324
|
+
nextAction: confirmCall('Ask the user to approve this charge first.'),
|
|
325
|
+
},
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
const deployBody = {
|
|
329
|
+
...(agentGuid ? { agentguid: agentGuid } : { custom: true }),
|
|
330
|
+
title: quote.title,
|
|
331
|
+
tier,
|
|
332
|
+
useprepaid: true,
|
|
333
|
+
...(args.description ? { description: args.description } : {}),
|
|
334
|
+
...(args.cover ? { cover: args.cover } : {}),
|
|
335
|
+
...(custom ? { skills: Object.fromEntries(skillNames.map(name => [name, true])) } : {}),
|
|
336
|
+
...(credentials && Object.keys(credentials).length > 0 ? { credentials } : {}),
|
|
337
|
+
...(customSkills.length > 0
|
|
338
|
+
? {
|
|
339
|
+
customskills: customSkills.map(entry => ({
|
|
340
|
+
key: entry.key,
|
|
341
|
+
...(entry.value !== undefined ? { value: entry.value } : {}),
|
|
342
|
+
...(entry.description !== undefined ? { description: entry.description } : {}),
|
|
343
|
+
...(entry.interval !== undefined ? { interval: entry.interval } : {}),
|
|
344
|
+
...(entry.enabled !== undefined ? { enabled: entry.enabled } : {}),
|
|
345
|
+
// A key the template already has overrides it; any other key is the user's own.
|
|
346
|
+
_user_created: !entry.fromTemplate,
|
|
347
|
+
})),
|
|
348
|
+
}
|
|
349
|
+
: {}),
|
|
350
|
+
};
|
|
351
|
+
deploySent = true;
|
|
352
|
+
const response = await client.post('/UserAgent/Deploy', deployBody, extra.signal);
|
|
353
|
+
let body;
|
|
354
|
+
try {
|
|
355
|
+
body = requireApiSuccess(response, 'The agent could not be deployed.');
|
|
356
|
+
}
|
|
357
|
+
catch (error) {
|
|
358
|
+
if (!hasErrorCode(error, 99))
|
|
359
|
+
throw error;
|
|
360
|
+
const existingGuid = asString(error.body.existingUserAgentGuid);
|
|
361
|
+
let existing;
|
|
362
|
+
if (existingGuid) {
|
|
363
|
+
try {
|
|
364
|
+
existing = toAgentDetail(await readAgentDetail(client, existingGuid, extra.signal));
|
|
365
|
+
}
|
|
366
|
+
catch {
|
|
367
|
+
// The guid is still worth reporting when the row cannot be read.
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
// Wiro refuses a second deploy of the same template within about 10
|
|
371
|
+
// seconds. An agent the user gave its own title is a new agent, so the
|
|
372
|
+
// text says to wait and repeat; without a title of its own it counts
|
|
373
|
+
// as a repeat.
|
|
374
|
+
const existingTitle = existing?.title ?? /identical agent \("([^"]*)"\)/.exec(error.message)?.[1];
|
|
375
|
+
if (quote.kind === 'template' && args.title !== undefined && existingTitle !== undefined && existingTitle !== quote.title) {
|
|
376
|
+
const message = `Wiro refused this deploy because another agent from the same template ("${existingTitle}") was deployed a few seconds ago. That check only blocks deploys made within about 10 seconds of each other, so nothing was created or charged for "${quote.title}". Wait about 10 seconds, then repeat the call.`;
|
|
377
|
+
return {
|
|
378
|
+
content: [{ type: 'text', text: `## Deploy not made yet\n\n${message}` }],
|
|
379
|
+
structuredContent: {
|
|
380
|
+
stage: 'retry_later',
|
|
381
|
+
quote,
|
|
382
|
+
message,
|
|
383
|
+
nextAction: confirmCall(`Wait about 10 seconds first. The user already approved this charge, and it was not made.`),
|
|
384
|
+
},
|
|
385
|
+
};
|
|
386
|
+
}
|
|
387
|
+
const unpaid = existing && existing.status === 6 && !existing.subscription;
|
|
388
|
+
const message = 'Wiro refused this deploy because an identical one was made a few seconds ago, so '
|
|
389
|
+
+ 'nothing new was created or charged. Do not call deploy_agent again for it.'
|
|
390
|
+
+ (existingGuid ? ` The existing agent is ${existingGuid}.` : '')
|
|
391
|
+
+ (unpaid
|
|
392
|
+
? ' It has no paid plan: manage_agent_billing with action subscribe pays for it, or delete_agent removes it.'
|
|
393
|
+
: '');
|
|
394
|
+
return {
|
|
395
|
+
content: [{ type: 'text', text: `## Duplicate deploy\n\n${message}${existing ? `\n\nStatus: ${describeAgentStatus(existing.status)}` : ''}` }],
|
|
396
|
+
structuredContent: {
|
|
397
|
+
stage: 'duplicate',
|
|
398
|
+
quote,
|
|
399
|
+
...(existing ? { agent: toDeployedAgent(existing) } : {}),
|
|
400
|
+
...(existingGuid ? { existingAgentGuid: existingGuid } : {}),
|
|
401
|
+
message,
|
|
402
|
+
...(existingGuid
|
|
403
|
+
? {
|
|
404
|
+
nextAction: {
|
|
405
|
+
tool: 'get_my_agent',
|
|
406
|
+
arguments: { agent_guid: existingGuid },
|
|
407
|
+
reason: 'Check the agent that already exists instead of deploying again.',
|
|
408
|
+
},
|
|
409
|
+
}
|
|
410
|
+
: {}),
|
|
411
|
+
},
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
const created = Array.isArray(body.useragents) ? body.useragents.find(isPlainObject) : undefined;
|
|
415
|
+
const createdGuid = created ? asString(created.guid) : undefined;
|
|
416
|
+
if (!created || !createdGuid) {
|
|
417
|
+
throw new Error('Wiro reported a successful deploy but returned no agent. Check list_my_agents before trying again.');
|
|
418
|
+
}
|
|
419
|
+
let row = created;
|
|
420
|
+
try {
|
|
421
|
+
row = await readAgentDetail(client, createdGuid, extra.signal);
|
|
422
|
+
}
|
|
423
|
+
catch {
|
|
424
|
+
// The deploy response already describes the new agent.
|
|
425
|
+
}
|
|
426
|
+
const agent = toAgentDetail(row);
|
|
427
|
+
const chargedUsd = toNumber(created.monthlypriceusd) ?? quote.priceUsd;
|
|
428
|
+
const nextStep = nextStepForAgent(agent, DEFAULT_WAIT_SECONDS);
|
|
429
|
+
const savedCustomSkills = deployedCustomSkills(agent, customSkills);
|
|
430
|
+
return {
|
|
431
|
+
content: [{ type: 'text', text: deployedText(agent, quote, chargedUsd, savedCustomSkills) }],
|
|
432
|
+
structuredContent: {
|
|
433
|
+
stage: 'deployed',
|
|
434
|
+
quote,
|
|
435
|
+
agent: toDeployedAgent(agent),
|
|
436
|
+
chargedUsd,
|
|
437
|
+
...(savedCustomSkills.length > 0 ? { customSkills: savedCustomSkills } : {}),
|
|
438
|
+
message: `Deployed and charged ${formatUsd(chargedUsd)}. The plan renews every 30 days until it is cancelled.`,
|
|
439
|
+
...(nextStep ? { nextAction: nextStep } : {}),
|
|
440
|
+
},
|
|
441
|
+
};
|
|
442
|
+
}
|
|
443
|
+
catch (error) {
|
|
444
|
+
if (deploySent && !extra.signal.aborted && outcomeUnknown(error)) {
|
|
445
|
+
return errorResult(new Error(`${errorText(error)}\n\nThe deploy request was sent and the answer does not show whether it went through, so the agent may have been created and charged. `
|
|
446
|
+
+ 'Check list_my_agents before trying again.'));
|
|
447
|
+
}
|
|
448
|
+
if (error instanceof ApiResultError && /insufficient wallet balance/i.test(error.message)) {
|
|
449
|
+
return errorResult(new Error(`${error.message}\n\nNothing was created or charged. Give the user the amounts above. Funds are added at https://wiro.ai/panel/wallet/deposit/credit-card (for a team project, select that team in the dashboard first); once the user has added them and says yes, confirm the same quote again.`));
|
|
450
|
+
}
|
|
451
|
+
return errorResult(error);
|
|
452
|
+
}
|
|
453
|
+
});
|
|
454
|
+
}
|
|
455
|
+
//# sourceMappingURL=deploy-agent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deploy-agent.js","sourceRoot":"","sources":["../../src/tools/deploy-agent.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,cAAc,EACd,QAAQ,EACR,WAAW,EACX,SAAS,EACT,YAAY,EACZ,aAAa,EACb,iBAAiB,EACjB,QAAQ,GAET,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,aAAa,EACb,SAAS,EACT,MAAM,EACN,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,UAAU,EACV,aAAa,EACb,eAAe,EACf,aAAa,GAGd,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,yBAAyB,EAAoD,MAAM,0BAA0B,CAAC;AACvH,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAqB,MAAM,2BAA2B,CAAC;AAChG,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD,MAAM,SAAS,GAAG,oFAAoF;MAClG,yCAAyC,CAAC;AAE9C,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;IACf,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC;IACzC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC/B,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IAC/B,qBAAqB,EAAE,C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AAC,CAAC,CAAC,EAAE,CAAC;oBAC5E,OAAO,EAAE,wBAAwB,SAAS,CAAC,UAAU,CAAC,wDAAwD;oBAC9G,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;iBAC9C;aACF,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,UAAU,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,IAAI,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC;gBACjE,OAAO,WAAW,CAAC,IAAI,KAAK,CAC1B,GAAG,SAAS,CAAC,KAAK,CAAC,wIAAwI;sBACzJ,2CAA2C,CAC9C,CAAC,CAAC;YACL,CAAC;YACD,IAAI,KAAK,YAAY,cAAc,IAAI,8BAA8B,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC;gBAC1F,OAAO,WAAW,CAAC,IAAI,KAAK,CAAC,GAAG,KAAK,CAAC,OAAO,kRAAkR,CAAC,CAAC,CAAC;YACpU,CAAC;YACD,OAAO,WAAW,CAAC,KAAK,CAAC,CAAC;QAC5B,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import type { WiroClient } from '../client.js';
|
|
3
|
+
export declare function registerDisconnectAgentOauth(server: McpServer, client: WiroClient): void;
|
|
4
|
+
//# sourceMappingURL=disconnect-agent-oauth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"disconnect-agent-oauth.d.ts","sourceRoot":"","sources":["../../src/tools/disconnect-agent-oauth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEzE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AA6B/C,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,GAAG,IAAI,CAqGxF"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { errorResult, errorText, requireApiSuccess } from '../utils/api.js';
|
|
3
|
+
import { loadCredentialMeta, readOAuthStatus, } from '../utils/agent-config.js';
|
|
4
|
+
import { nextActionSchema } from './schemas.js';
|
|
5
|
+
const accountSchema = z.object({ id: z.string(), name: z.string() });
|
|
6
|
+
const outputSchema = {
|
|
7
|
+
agentGuid: z.string(),
|
|
8
|
+
credential: z.string(),
|
|
9
|
+
title: z.string(),
|
|
10
|
+
disconnected: z.boolean(),
|
|
11
|
+
connectedBefore: z.boolean().nullable(),
|
|
12
|
+
accounts: z.array(accountSchema),
|
|
13
|
+
willClear: z.string(),
|
|
14
|
+
message: z.string(),
|
|
15
|
+
nextAction: nextActionSchema.optional(),
|
|
16
|
+
};
|
|
17
|
+
function describeClear(title, ownAppKept) {
|
|
18
|
+
return `The saved ${title} sign-in, its selected accounts and the connection's settings are removed`
|
|
19
|
+
+ `${ownAppKept ? '; your own app keys are kept for reconnecting' : ''}. Scheduled tasks that need ${title} stop running, `
|
|
20
|
+
+ `and a running agent restarts. Reconnecting needs connect_agent_oauth again, usually with a new ${title} sign-in.`;
|
|
21
|
+
}
|
|
22
|
+
export function registerDisconnectAgentOauth(server, client) {
|
|
23
|
+
server.registerTool('disconnect_agent_oauth', {
|
|
24
|
+
title: 'Disconnect an agent integration',
|
|
25
|
+
description: 'Disconnect a sign-in based integration (for example Google Ads, Meta Ads or '
|
|
26
|
+
+ 'HubSpot) from a deployed agent. Call it without confirm first: it shows what is '
|
|
27
|
+
+ 'connected and what will be removed, and changes nothing. After the user agrees, call '
|
|
28
|
+
+ 'again with confirm: true. The saved sign-in, the selected accounts and the connection\'s '
|
|
29
|
+
+ 'settings are cleared (your own app keys are kept), the provider is asked to revoke the '
|
|
30
|
+
+ 'access where it supports that, scheduled tasks that need the integration stop running, '
|
|
31
|
+
+ 'and a running agent restarts. It cannot be undone; reconnect with connect_agent_oauth. '
|
|
32
|
+
+ 'For plain credentials such as Telegram, clear fields with set_agent_credentials instead.',
|
|
33
|
+
inputSchema: {
|
|
34
|
+
agent_guid: z.string().min(1).describe('The deployed agent\'s guid, from list_my_agents.'),
|
|
35
|
+
credential: z.string().min(1).describe('The integration\'s credential key, for example "google-ads" or "meta-ads".'),
|
|
36
|
+
confirm: z.boolean().default(false)
|
|
37
|
+
.describe('false (default) only shows what would be removed. true disconnects.'),
|
|
38
|
+
},
|
|
39
|
+
outputSchema,
|
|
40
|
+
annotations: {
|
|
41
|
+
readOnlyHint: false,
|
|
42
|
+
destructiveHint: true,
|
|
43
|
+
idempotentHint: true,
|
|
44
|
+
openWorldHint: true,
|
|
45
|
+
},
|
|
46
|
+
}, async ({ agent_guid, credential: rawCredential, confirm }, extra) => {
|
|
47
|
+
try {
|
|
48
|
+
const credential = rawCredential.trim();
|
|
49
|
+
const meta = await loadCredentialMeta(client, credential, extra.signal);
|
|
50
|
+
if (!meta)
|
|
51
|
+
return errorResult(new Error(`Unknown credential "${credential}".`));
|
|
52
|
+
if (!meta.oauth) {
|
|
53
|
+
return errorResult(new Error(`${meta.title} is not a sign-in connection. Clear its fields with set_agent_credentials instead.`));
|
|
54
|
+
}
|
|
55
|
+
const ownAppKept = meta.fields.some(field => field.oauthManaged && field.onlyInModes?.includes('own'));
|
|
56
|
+
const willClear = describeClear(meta.title, ownAppKept);
|
|
57
|
+
let before = null;
|
|
58
|
+
try {
|
|
59
|
+
before = await readOAuthStatus(client, agent_guid, credential, meta.oauth.picker, extra.signal);
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
if (!confirm)
|
|
63
|
+
throw error;
|
|
64
|
+
}
|
|
65
|
+
const accounts = before?.accounts ?? [];
|
|
66
|
+
const connectedBefore = before ? before.connected || before.connectedAt !== '' : null;
|
|
67
|
+
if (!confirm) {
|
|
68
|
+
const message = connectedBefore
|
|
69
|
+
? `${meta.title} is connected${accounts.length > 0 ? ` for ${accounts.map(account => account.name || account.id).join(', ')}` : ''}. ${willClear}`
|
|
70
|
+
: `${meta.title} does not look connected on this agent. Disconnecting still clears any saved ${meta.title} settings.`;
|
|
71
|
+
return {
|
|
72
|
+
content: [{ type: 'text', text: `## Disconnect ${meta.title}?\n\n${message}\n\nNothing has changed yet. After the user agrees, call disconnect_agent_oauth again with confirm: true.` }],
|
|
73
|
+
structuredContent: {
|
|
74
|
+
agentGuid: agent_guid,
|
|
75
|
+
credential,
|
|
76
|
+
title: meta.title,
|
|
77
|
+
disconnected: false,
|
|
78
|
+
connectedBefore,
|
|
79
|
+
accounts,
|
|
80
|
+
willClear,
|
|
81
|
+
message,
|
|
82
|
+
nextAction: {
|
|
83
|
+
tool: 'disconnect_agent_oauth',
|
|
84
|
+
arguments: { agent_guid, credential, confirm: true },
|
|
85
|
+
reason: 'Ask the user to confirm this first.',
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
requireApiSuccess(await client.post('/UserAgentOAuth/OAuthDisconnect', {
|
|
91
|
+
useragentguid: agent_guid,
|
|
92
|
+
credentialkey: credential,
|
|
93
|
+
}, extra.signal), `Could not disconnect ${meta.title}.`);
|
|
94
|
+
const message = `${meta.title} is disconnected. ${willClear}`;
|
|
95
|
+
return {
|
|
96
|
+
content: [{ type: 'text', text: `## ${meta.title} disconnected\n\n${message}` }],
|
|
97
|
+
structuredContent: {
|
|
98
|
+
agentGuid: agent_guid,
|
|
99
|
+
credential,
|
|
100
|
+
title: meta.title,
|
|
101
|
+
disconnected: true,
|
|
102
|
+
connectedBefore,
|
|
103
|
+
accounts,
|
|
104
|
+
willClear,
|
|
105
|
+
message,
|
|
106
|
+
},
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
catch (error) {
|
|
110
|
+
const message = errorText(error);
|
|
111
|
+
// The hint follows Wiro's message as a paragraph of its own, as in connect_agent_oauth.
|
|
112
|
+
return errorResult(new Error(/not found or unauthorized/i.test(message)
|
|
113
|
+
? `${message}\n\nIntegrations can only be changed with a project created by the person who deployed the agent: connect this server with such a project, by its API key or a browser sign-in.`
|
|
114
|
+
: message));
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=disconnect-agent-oauth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"disconnect-agent-oauth.js","sourceRoot":"","sources":["../../src/tools/disconnect-agent-oauth.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,iBAAiB,EAAoB,MAAM,iBAAiB,CAAC;AAC9F,OAAO,EACL,kBAAkB,EAClB,eAAe,GAEhB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AAErE,MAAM,YAAY,GAAG;IACnB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;IACtB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,YAAY,EAAE,CAAC,CAAC,OAAO,EAAE;IACzB,eAAe,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IACvC,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC;IAChC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,UAAU,EAAE,gBAAgB,CAAC,QAAQ,EAAE;CACx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