@wiro-ai/wiro-mcp 1.3.4 → 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 +12 -0
- 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 +38 -1
- package/dist/utils/format.d.ts.map +1 -1
- package/dist/utils/format.js +162 -13
- 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 +9 -6
- 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,408 @@
|
|
|
1
|
+
import { WiroApiError } from '../client.js';
|
|
2
|
+
import { ApiResultError, apiErrorMessage, asString, hasErrorCode, isPlainObject, requireApiSuccess, toNumber, } from './api.js';
|
|
3
|
+
import { newSessionKey, sessionKeyProblem } from './agent-message.js';
|
|
4
|
+
import { fetchPublicFile } from './remote-file.js';
|
|
5
|
+
const ENDPOINTS = {
|
|
6
|
+
studio: {
|
|
7
|
+
send: '/Studio/Message/Send',
|
|
8
|
+
sendForm: '/Studio/Message/SendForm',
|
|
9
|
+
detail: '/Studio/Message/Detail',
|
|
10
|
+
history: '/Studio/Message/History',
|
|
11
|
+
sessions: '/Studio/Message/Sessions',
|
|
12
|
+
cancel: '/Studio/Message/Cancel',
|
|
13
|
+
// ClearSession deletes the history and always moves the agent to a fresh
|
|
14
|
+
// memory; DeleteSession does that only for "default".
|
|
15
|
+
deleteSession: '/Studio/Message/ClearSession',
|
|
16
|
+
status: '/Studio/Status',
|
|
17
|
+
},
|
|
18
|
+
'workflow-agent': {
|
|
19
|
+
send: '/StudioWorkflow/Message/Send',
|
|
20
|
+
sendForm: '/StudioWorkflow/Message/SendForm',
|
|
21
|
+
detail: '/StudioWorkflow/Message/Detail',
|
|
22
|
+
history: '/StudioWorkflow/Message/History',
|
|
23
|
+
sessions: '/StudioWorkflow/Message/Sessions',
|
|
24
|
+
cancel: '/StudioWorkflow/Message/Cancel',
|
|
25
|
+
deleteSession: '/StudioWorkflow/Message/DeleteSession',
|
|
26
|
+
status: '/StudioWorkflow/Status',
|
|
27
|
+
},
|
|
28
|
+
deployed: {
|
|
29
|
+
send: '/UserAgent/Message/Send',
|
|
30
|
+
sendForm: '/UserAgent/Message/Send',
|
|
31
|
+
detail: '/UserAgent/Message/Detail',
|
|
32
|
+
history: '/UserAgent/Message/History',
|
|
33
|
+
sessions: '/UserAgent/Message/Sessions',
|
|
34
|
+
cancel: '/UserAgent/Message/Cancel',
|
|
35
|
+
deleteSession: '/UserAgent/Message/DeleteSession',
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
export const AGENT_INPUT_DESCRIPTION = 'Which agent: "studio" (Wiro Studio, the media agent that runs '
|
|
39
|
+
+ 'models for you), "workflow-agent" (the Workflow Agent, which designs Wiro workflows) or the '
|
|
40
|
+
+ 'guid of one of your deployed agents (from list_my_agents).';
|
|
41
|
+
export const WORKFLOW_AGENT_MAX_MESSAGE_BYTES = 16 * 1024;
|
|
42
|
+
const WORKFLOW_SESSION_PATTERN = /^[A-Za-z0-9._:-]+$/;
|
|
43
|
+
// Wiro prefixes the session names an API key uses with the Workflow Agent and
|
|
44
|
+
// keeps the whole name within 128 characters, so names sent from here stay
|
|
45
|
+
// within 100. Names that already exist can be longer and are read as they are.
|
|
46
|
+
const WORKFLOW_SEND_SESSION_MAX = 100;
|
|
47
|
+
const AGENT_GUID_PATTERN = /^[A-Za-z0-9][A-Za-z0-9_-]{2,127}$/;
|
|
48
|
+
const PRODUCT_UNAVAILABLE_PATTERN = /^agent (is|has no remaining|not found)|not configured/i;
|
|
49
|
+
export const BARE_UNAVAILABLE_PATTERN = /temporarily unavailable/i;
|
|
50
|
+
export const BACKGROUND_REPLY_PATTERN = /working on it in the background/i;
|
|
51
|
+
// A turn that spawns sub-agents or yields to them ends before their work does.
|
|
52
|
+
// Its reply is then often the agent's own waiting line, which no pattern finds.
|
|
53
|
+
const BACKGROUND_TOOLS = new Set(['sessions_spawn', 'sessions_yield']);
|
|
54
|
+
/** Whether a finished turn handed (part of) its work to sub-agents that deliver later. */
|
|
55
|
+
export function isBackgroundHandOff(reply, tools) {
|
|
56
|
+
// A spawn or yield that failed handed nothing over.
|
|
57
|
+
return BACKGROUND_REPLY_PATTERN.test(reply ?? '')
|
|
58
|
+
|| tools.some(tool => BACKGROUND_TOOLS.has(tool.name) && tool.status !== 'error');
|
|
59
|
+
}
|
|
60
|
+
export function resolveAgentTarget(input) {
|
|
61
|
+
const value = input.trim();
|
|
62
|
+
const lower = value.toLowerCase();
|
|
63
|
+
if (lower === 'studio') {
|
|
64
|
+
return { kind: 'studio', agent: 'studio', name: 'Studio', label: 'Studio' };
|
|
65
|
+
}
|
|
66
|
+
if (lower === 'workflow-agent' || lower === 'workflow_agent' || lower === 'workflowagent') {
|
|
67
|
+
return { kind: 'workflow-agent', agent: 'workflow-agent', name: 'The Workflow Agent', label: 'the Workflow Agent' };
|
|
68
|
+
}
|
|
69
|
+
if (!AGENT_GUID_PATTERN.test(value)) {
|
|
70
|
+
throw new Error('agent must be "studio", "workflow-agent" or the guid of one of your deployed agents. '
|
|
71
|
+
+ 'list_my_agents shows the guids.');
|
|
72
|
+
}
|
|
73
|
+
return { kind: 'deployed', agent: value, agentGuid: value, name: 'Your agent', label: 'your agent' };
|
|
74
|
+
}
|
|
75
|
+
export function agentEndpoint(target, operation) {
|
|
76
|
+
const path = ENDPOINTS[target.kind][operation];
|
|
77
|
+
if (!path)
|
|
78
|
+
throw new Error(`${target.name} does not support this action.`);
|
|
79
|
+
return path;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Why a session name cannot be used with this agent, or null. Sending checks
|
|
83
|
+
* the shorter Workflow Agent limit; reading, cancelling and deleting address a
|
|
84
|
+
* session that already exists, so Wiro decides about its length.
|
|
85
|
+
*/
|
|
86
|
+
export function agentSessionProblem(target, session, use = 'read') {
|
|
87
|
+
const problem = sessionKeyProblem(session);
|
|
88
|
+
if (problem)
|
|
89
|
+
return problem;
|
|
90
|
+
if (target.kind !== 'workflow-agent')
|
|
91
|
+
return null;
|
|
92
|
+
if (!WORKFLOW_SESSION_PATTERN.test(session)) {
|
|
93
|
+
return 'A Workflow Agent session name may contain only letters, digits, ".", "_", ":" and "-".';
|
|
94
|
+
}
|
|
95
|
+
if (use === 'send' && session.length > WORKFLOW_SEND_SESSION_MAX) {
|
|
96
|
+
return 'A Workflow Agent session name may contain only letters, digits, ".", "_", ":" and "-", '
|
|
97
|
+
+ `and at most ${WORKFLOW_SEND_SESSION_MAX} characters (Wiro adds a prefix of its own to sessions started `
|
|
98
|
+
+ 'with an API key).';
|
|
99
|
+
}
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Studio shares the user's wiro.ai chat history, so a message without a
|
|
104
|
+
* session opens a new one instead of landing in their main Studio chat. The
|
|
105
|
+
* Workflow Agent keeps an API key's sessions apart from the user's own chats
|
|
106
|
+
* on wiro.ai; a new session keeps unrelated requests apart there too. A
|
|
107
|
+
* deployed agent's "default" session is its owner's own chat.
|
|
108
|
+
*/
|
|
109
|
+
export function resolveSendSession(target, session) {
|
|
110
|
+
if (session === undefined || session.trim() === '') {
|
|
111
|
+
if (target.kind === 'deployed')
|
|
112
|
+
return { session: 'default', created: false };
|
|
113
|
+
return { session: newSessionKey('mcp'), created: true };
|
|
114
|
+
}
|
|
115
|
+
const problem = agentSessionProblem(target, session, 'send');
|
|
116
|
+
if (problem)
|
|
117
|
+
throw new Error(problem);
|
|
118
|
+
return { session, created: false };
|
|
119
|
+
}
|
|
120
|
+
/** The session to address a stored message with. */
|
|
121
|
+
export function resolveReadSession(target, session) {
|
|
122
|
+
if (session === undefined || session.trim() === '') {
|
|
123
|
+
// Studio and the Workflow Agent read a missing session as "default" (for the
|
|
124
|
+
// Workflow Agent, the API key's own main session); a deployed agent can
|
|
125
|
+
// find the message by its id alone.
|
|
126
|
+
return target.kind === 'deployed' ? undefined : 'default';
|
|
127
|
+
}
|
|
128
|
+
const problem = agentSessionProblem(target, session);
|
|
129
|
+
if (problem)
|
|
130
|
+
throw new Error(problem);
|
|
131
|
+
return session;
|
|
132
|
+
}
|
|
133
|
+
export function agentRequestBody(target, session, fields = {}) {
|
|
134
|
+
const body = { ...fields };
|
|
135
|
+
if (target.kind === 'deployed')
|
|
136
|
+
body.useragentguid = target.agentGuid;
|
|
137
|
+
if (session !== undefined)
|
|
138
|
+
body.sessionkey = session;
|
|
139
|
+
return body;
|
|
140
|
+
}
|
|
141
|
+
export const WORKFLOW_AGENT_KEY_REFUSED = 'The Workflow Agent did not accept this API key (HTTP 403: '
|
|
142
|
+
+ 'Bearer authentication is required). It is available on wiro.ai. From here you can still build '
|
|
143
|
+
+ 'and change workflows directly with create_workflow and update_workflow.';
|
|
144
|
+
/** Turns HTTP refusals that only mean "not available to this caller" into readable answers. */
|
|
145
|
+
export function mapAgentHttpError(target, error) {
|
|
146
|
+
if (!(error instanceof WiroApiError) || error.status !== 403 || target.kind === 'deployed') {
|
|
147
|
+
return error;
|
|
148
|
+
}
|
|
149
|
+
if (/must be a member of this team/i.test(error.responseBody)) {
|
|
150
|
+
return new ApiResultError(`${target.kind === 'studio' ? 'Studio' : 'The Workflow Agent'} refused this API key (HTTP 403): the key belongs `
|
|
151
|
+
+ 'to a team project, and the person who created it is no longer a member of that team. Ask a team admin '
|
|
152
|
+
+ 'for a new key, or use a key from a project you can still access.', [403], {});
|
|
153
|
+
}
|
|
154
|
+
if (target.kind !== 'workflow-agent')
|
|
155
|
+
return error;
|
|
156
|
+
if (/bearer authentication is required/i.test(error.responseBody)) {
|
|
157
|
+
return new ApiResultError(WORKFLOW_AGENT_KEY_REFUSED, [403], {});
|
|
158
|
+
}
|
|
159
|
+
if (/workspace is not available/i.test(error.responseBody)) {
|
|
160
|
+
return new ApiResultError('The Workflow Agent refused the workspace of the connected project (HTTP 403). The connected project '
|
|
161
|
+
+ 'decides the workspace: connect with a project from the workspace you want to work in, by its API key '
|
|
162
|
+
+ 'or a browser sign-in.', [403], {});
|
|
163
|
+
}
|
|
164
|
+
return error;
|
|
165
|
+
}
|
|
166
|
+
export async function callAgent(client, target, operation, body, signal) {
|
|
167
|
+
const path = agentEndpoint(target, operation);
|
|
168
|
+
try {
|
|
169
|
+
return await client.post(path, body, signal);
|
|
170
|
+
}
|
|
171
|
+
catch (error) {
|
|
172
|
+
throw mapAgentHttpError(target, error);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
export async function callAgentForm(client, target, form, signal) {
|
|
176
|
+
const path = agentEndpoint(target, 'sendForm');
|
|
177
|
+
try {
|
|
178
|
+
return await client.postForm(path, form, signal);
|
|
179
|
+
}
|
|
180
|
+
catch (error) {
|
|
181
|
+
throw mapAgentHttpError(target, error);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
/** One stored message row, or ApiResultError("Message not found"). */
|
|
185
|
+
export async function readAgentMessage(client, target, messageId, session, signal) {
|
|
186
|
+
const body = agentRequestBody(target, session, { messageguid: messageId });
|
|
187
|
+
const response = await callAgent(client, target, 'detail', body, signal);
|
|
188
|
+
requireApiSuccess(response, 'Message not found');
|
|
189
|
+
const data = response.data;
|
|
190
|
+
if (!isPlainObject(data)) {
|
|
191
|
+
throw new ApiResultError('Message not found', [], response);
|
|
192
|
+
}
|
|
193
|
+
return data;
|
|
194
|
+
}
|
|
195
|
+
// ─── Send refusals ──────────────────────────────────────────────────
|
|
196
|
+
const DEPLOYED_STATUS_HELP = {
|
|
197
|
+
0: 'Your agent is stopped. Start it with control_agent (action "start"), wait until get_my_agent '
|
|
198
|
+
+ 'shows it running, then send the message again.',
|
|
199
|
+
1: 'Your agent is stopping. Wait a moment, check get_my_agent, and start it again with control_agent '
|
|
200
|
+
+ 'if you still need it.',
|
|
201
|
+
2: 'Your agent is queued to start, which can take a while. Wait until get_my_agent shows it running, then send the message again.',
|
|
202
|
+
3: 'Your agent is starting. Wait 30 to 60 seconds and send the message again; get_my_agent shows when it is running.',
|
|
203
|
+
5: 'Your agent is in an error state. Restart it with control_agent (action "restart"); '
|
|
204
|
+
+ 'get_agent_activity (logs) can show what went wrong.',
|
|
205
|
+
6: 'Your agent\'s setup is incomplete. get_my_agent lists the missing credentials or connections; '
|
|
206
|
+
+ 'complete them with set_agent_credentials or connect_agent_oauth, then start the agent. If get_my_agent '
|
|
207
|
+
+ 'shows no active plan, pay for one with manage_agent_billing (action subscribe), which returns the price first.',
|
|
208
|
+
};
|
|
209
|
+
/** Chat models a caller may pick for Studio or the Workflow Agent. */
|
|
210
|
+
export async function readSelectableModels(client, target, signal) {
|
|
211
|
+
if (target.kind === 'deployed')
|
|
212
|
+
return null;
|
|
213
|
+
try {
|
|
214
|
+
const status = requireApiSuccess(await callAgent(client, target, 'status', {}, signal), '');
|
|
215
|
+
const rates = status.tokenRates;
|
|
216
|
+
if (!isPlainObject(rates) || !isPlainObject(rates.models))
|
|
217
|
+
return null;
|
|
218
|
+
const models = Object.entries(rates.models)
|
|
219
|
+
.filter(([, meta]) => isPlainObject(meta) && meta.selectable === true)
|
|
220
|
+
.map(([key]) => key);
|
|
221
|
+
const agentModel = status.agentModel;
|
|
222
|
+
const defaultModel = asString(rates.default_model)
|
|
223
|
+
?? (isPlainObject(agentModel) ? asString(agentModel.chatModel) : undefined);
|
|
224
|
+
return { models, ...(defaultModel ? { defaultModel } : {}) };
|
|
225
|
+
}
|
|
226
|
+
catch {
|
|
227
|
+
return null;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
function formatUsd(value) {
|
|
231
|
+
return `$${value.toFixed(2)}`;
|
|
232
|
+
}
|
|
233
|
+
/** Where to look before sending a message again whose fate is unknown. */
|
|
234
|
+
function checkBeforeResending(target, session) {
|
|
235
|
+
return `Check get_agent_conversation with agent "${target.agent}" and session "${session}" before sending it again.`;
|
|
236
|
+
}
|
|
237
|
+
/** A readable explanation for a Send that Wiro refused. */
|
|
238
|
+
export async function explainSendRefusal(client, target, response, session, signal) {
|
|
239
|
+
const error = new ApiResultError(apiErrorMessage(response, 'The message was not accepted.'), (response.errors ?? [])
|
|
240
|
+
.map(item => item?.code)
|
|
241
|
+
.filter((code) => code !== undefined && code !== null), response);
|
|
242
|
+
const message = error.message;
|
|
243
|
+
// A bare "temporarily unavailable" answer leaves open whether the turn was
|
|
244
|
+
// queued, so the text says to check before sending again.
|
|
245
|
+
if (BARE_UNAVAILABLE_PATTERN.test(message)
|
|
246
|
+
&& response.agentstatus === undefined && response.agentbalance === undefined) {
|
|
247
|
+
return `${target.name} is temporarily unavailable. The message may still have been queued. `
|
|
248
|
+
+ checkBeforeResending(target, session);
|
|
249
|
+
}
|
|
250
|
+
if (target.kind !== 'deployed' && hasErrorCode(error, 97)) {
|
|
251
|
+
const walletUsd = toNumber(response.walletUsd);
|
|
252
|
+
const minimum = toNumber(response.minTopup) ?? 10;
|
|
253
|
+
return `${target.name} needs at least ${formatUsd(minimum)} in the Wiro wallet of the connected project's `
|
|
254
|
+
+ `workspace to start a turn${walletUsd === null ? '' : `; the wallet has ${formatUsd(walletUsd)}`}. `
|
|
255
|
+
+ `Funds are added at https://wiro.ai/panel/wallet/deposit/credit-card (for a team project, select that team in the dashboard first); then send the message again. The ${formatUsd(minimum)} is a minimum to start, `
|
|
256
|
+
+ 'not a spending cap. get_account shows the current balance.';
|
|
257
|
+
}
|
|
258
|
+
if (target.kind !== 'deployed'
|
|
259
|
+
&& (response.agentstatus !== undefined || response.agentbalance !== undefined
|
|
260
|
+
|| PRODUCT_UNAVAILABLE_PATTERN.test(message))) {
|
|
261
|
+
// Status and credit numbers here are not the caller's own, so they are not repeated.
|
|
262
|
+
return `${target.name} is temporarily unavailable. Please try again shortly.`;
|
|
263
|
+
}
|
|
264
|
+
if (/invalid model|selectable model allowlist/i.test(message)) {
|
|
265
|
+
const lines = [message];
|
|
266
|
+
const selectable = await readSelectableModels(client, target, signal);
|
|
267
|
+
if (selectable && selectable.models.length > 0) {
|
|
268
|
+
lines.push(`Models you can choose: ${selectable.models.join(', ')}`
|
|
269
|
+
+ (selectable.defaultModel ? ` (default: ${selectable.defaultModel}).` : '.'));
|
|
270
|
+
}
|
|
271
|
+
lines.push('Send again with one of these, or leave model out to use the default.');
|
|
272
|
+
return lines.join('\n');
|
|
273
|
+
}
|
|
274
|
+
if (target.kind === 'deployed') {
|
|
275
|
+
const balance = response.agentbalance;
|
|
276
|
+
if (isPlainObject(balance)) {
|
|
277
|
+
const monthly = toNumber(balance.monthlycredits);
|
|
278
|
+
const extra = toNumber(balance.extracredits);
|
|
279
|
+
const used = toNumber(balance.usedcredits);
|
|
280
|
+
return 'Your agent has no credits left'
|
|
281
|
+
+ (monthly !== null || extra !== null || used !== null
|
|
282
|
+
? ` (monthly ${monthly ?? 0}, extra ${extra ?? 0}, used ${used ?? 0})`
|
|
283
|
+
: '')
|
|
284
|
+
+ '. Renew the subscription or buy a credit pack with manage_agent_billing, then send the message again.';
|
|
285
|
+
}
|
|
286
|
+
const status = toNumber(response.agentstatus);
|
|
287
|
+
if (status !== null) {
|
|
288
|
+
return DEPLOYED_STATUS_HELP[status] ?? `${message} Check the agent with get_my_agent.`;
|
|
289
|
+
}
|
|
290
|
+
if (/agent not found or access denied/i.test(message)) {
|
|
291
|
+
return `${message}. Check the guid with list_my_agents. The connected project reaches only the agents of its own `
|
|
292
|
+
+ 'workspace (personal or team).';
|
|
293
|
+
}
|
|
294
|
+
if (/belongs to a team|personal workspace|different team/i.test(message)) {
|
|
295
|
+
return `${message} The connected project decides the workspace: connect with a project from the agent's workspace, by its API key or a browser sign-in.`;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
if (/reserved sessionkey/i.test(message)) {
|
|
299
|
+
return 'That session name is reserved by Wiro. Choose another session name.';
|
|
300
|
+
}
|
|
301
|
+
if (/too many files/i.test(message)) {
|
|
302
|
+
return `${message}. Send at most 8 attachments per message.`;
|
|
303
|
+
}
|
|
304
|
+
if (/file format invalid/i.test(message)) {
|
|
305
|
+
return `${message}. Attach a supported image, video, audio or document file.`;
|
|
306
|
+
}
|
|
307
|
+
return message;
|
|
308
|
+
}
|
|
309
|
+
/** Wording for a Send that failed before Wiro answered. Never retried. */
|
|
310
|
+
export function sendTransportError(target, error, session) {
|
|
311
|
+
if (error instanceof ApiResultError)
|
|
312
|
+
return error;
|
|
313
|
+
if (error instanceof WiroApiError && error.status === 413) {
|
|
314
|
+
return new Error('An attachment is too large for Wiro (HTTP 413). Each file must be at most '
|
|
315
|
+
+ `${target.kind === 'workflow-agent' ? '50' : '100'} MB.`);
|
|
316
|
+
}
|
|
317
|
+
if (error instanceof WiroApiError && error.status >= 400 && error.status < 500) {
|
|
318
|
+
return error;
|
|
319
|
+
}
|
|
320
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
321
|
+
return new Error(`The send request did not complete (${reason}). The message may still have been queued. `
|
|
322
|
+
+ checkBeforeResending(target, session));
|
|
323
|
+
}
|
|
324
|
+
/** Wording for a Send that Wiro accepted without saying which message it queued. */
|
|
325
|
+
export function sendWithoutIdError(target, session) {
|
|
326
|
+
return new Error('Wiro accepted the message but returned no message id. ' + checkBeforeResending(target, session));
|
|
327
|
+
}
|
|
328
|
+
// ─── Attachments ────────────────────────────────────────────────────
|
|
329
|
+
export const MAX_ATTACHMENTS = 8;
|
|
330
|
+
const ATTACHMENT_TOTAL_BYTES = 200 * 1024 * 1024;
|
|
331
|
+
const EXTENSION_BY_TYPE = {
|
|
332
|
+
'image/png': 'png',
|
|
333
|
+
'image/jpeg': 'jpg',
|
|
334
|
+
'image/webp': 'webp',
|
|
335
|
+
'image/gif': 'gif',
|
|
336
|
+
'image/heic': 'heic',
|
|
337
|
+
'image/svg+xml': 'svg',
|
|
338
|
+
'video/mp4': 'mp4',
|
|
339
|
+
'video/webm': 'webm',
|
|
340
|
+
'video/quicktime': 'mov',
|
|
341
|
+
'audio/mpeg': 'mp3',
|
|
342
|
+
'audio/mp3': 'mp3',
|
|
343
|
+
'audio/wav': 'wav',
|
|
344
|
+
'audio/x-wav': 'wav',
|
|
345
|
+
'audio/wave': 'wav',
|
|
346
|
+
'audio/mp4': 'm4a',
|
|
347
|
+
'audio/x-m4a': 'm4a',
|
|
348
|
+
'application/pdf': 'pdf',
|
|
349
|
+
'text/plain': 'txt',
|
|
350
|
+
'text/csv': 'csv',
|
|
351
|
+
'text/markdown': 'md',
|
|
352
|
+
};
|
|
353
|
+
const TYPE_BY_EXTENSION = Object.fromEntries(Object.entries(EXTENSION_BY_TYPE).map(([type, extension]) => [extension, type]));
|
|
354
|
+
/** A file name with the right extension, which Wiro uses to accept or refuse the upload. */
|
|
355
|
+
export function attachmentFileName(url, contentType, index) {
|
|
356
|
+
let base = '';
|
|
357
|
+
try {
|
|
358
|
+
const segment = new URL(url).pathname.split('/').filter(Boolean).pop() ?? '';
|
|
359
|
+
base = decodeURIComponent(segment);
|
|
360
|
+
}
|
|
361
|
+
catch {
|
|
362
|
+
base = '';
|
|
363
|
+
}
|
|
364
|
+
base = base.replace(/[^A-Za-z0-9._ -]/g, '_').replace(/^[.\s]+/, '').slice(0, 120);
|
|
365
|
+
const type = (contentType ?? '').split(';')[0]?.trim().toLowerCase() ?? '';
|
|
366
|
+
const hasExtension = /\.[A-Za-z0-9]{2,5}$/.test(base);
|
|
367
|
+
if (base && hasExtension)
|
|
368
|
+
return base;
|
|
369
|
+
const extension = EXTENSION_BY_TYPE[type];
|
|
370
|
+
const stem = base || `attachment-${index + 1}`;
|
|
371
|
+
return extension ? `${stem}.${extension}` : stem;
|
|
372
|
+
}
|
|
373
|
+
function attachmentContentType(name, header) {
|
|
374
|
+
const type = (header ?? '').split(';')[0]?.trim().toLowerCase();
|
|
375
|
+
if (type && type !== 'application/octet-stream')
|
|
376
|
+
return type;
|
|
377
|
+
const extension = name.split('.').pop()?.toLowerCase() ?? '';
|
|
378
|
+
return TYPE_BY_EXTENSION[extension] ?? 'application/octet-stream';
|
|
379
|
+
}
|
|
380
|
+
/** Downloads every URL before anything is sent, so a bad URL never leaves half a turn behind. */
|
|
381
|
+
export async function downloadAttachments(target, urls) {
|
|
382
|
+
if (urls.length > MAX_ATTACHMENTS) {
|
|
383
|
+
throw new Error(`Send at most ${MAX_ATTACHMENTS} attachments per message.`);
|
|
384
|
+
}
|
|
385
|
+
const maxBytes = (target.kind === 'workflow-agent' ? 50 : 100) * 1024 * 1024;
|
|
386
|
+
const files = [];
|
|
387
|
+
let total = 0;
|
|
388
|
+
for (const [index, url] of urls.entries()) {
|
|
389
|
+
const remote = await fetchPublicFile(url, { maxBytes });
|
|
390
|
+
total += remote.data.length;
|
|
391
|
+
if (total > ATTACHMENT_TOTAL_BYTES) {
|
|
392
|
+
throw new Error('The attachments add up to more than 200 MB. Send fewer or smaller files.');
|
|
393
|
+
}
|
|
394
|
+
const name = attachmentFileName(url, remote.contentType, index);
|
|
395
|
+
files.push({ name, contentType: attachmentContentType(name, remote.contentType), data: remote.data });
|
|
396
|
+
}
|
|
397
|
+
return files;
|
|
398
|
+
}
|
|
399
|
+
export function buildMessageForm(fields, files) {
|
|
400
|
+
const form = new FormData();
|
|
401
|
+
for (const [key, value] of Object.entries(fields))
|
|
402
|
+
form.append(key, value);
|
|
403
|
+
for (const file of files) {
|
|
404
|
+
form.append('attachments', new Blob([file.data], { type: file.contentType }), file.name);
|
|
405
|
+
}
|
|
406
|
+
return form;
|
|
407
|
+
}
|
|
408
|
+
//# sourceMappingURL=agent-targets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-targets.js","sourceRoot":"","sources":["../../src/utils/agent-targets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,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