@wiro-ai/wiro-mcp 1.5.7 → 1.6.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.
Files changed (95) hide show
  1. package/README.md +15 -13
  2. package/dist/client.d.ts +4 -0
  3. package/dist/client.d.ts.map +1 -1
  4. package/dist/client.js +6 -1
  5. package/dist/client.js.map +1 -1
  6. package/dist/instructions.js +2 -2
  7. package/dist/instructions.js.map +1 -1
  8. package/dist/playbooks.d.ts.map +1 -1
  9. package/dist/playbooks.js +45 -40
  10. package/dist/playbooks.js.map +1 -1
  11. package/dist/prompts.js +3 -3
  12. package/dist/prompts.js.map +1 -1
  13. package/dist/tools/apply-agent-skills.d.ts.map +1 -1
  14. package/dist/tools/apply-agent-skills.js +102 -639
  15. package/dist/tools/apply-agent-skills.js.map +1 -1
  16. package/dist/tools/connect-agent-oauth.d.ts.map +1 -1
  17. package/dist/tools/connect-agent-oauth.js +260 -111
  18. package/dist/tools/connect-agent-oauth.js.map +1 -1
  19. package/dist/tools/control-agent.d.ts.map +1 -1
  20. package/dist/tools/control-agent.js +20 -9
  21. package/dist/tools/control-agent.js.map +1 -1
  22. package/dist/tools/deploy-agent.d.ts.map +1 -1
  23. package/dist/tools/deploy-agent.js +54 -28
  24. package/dist/tools/deploy-agent.js.map +1 -1
  25. package/dist/tools/get-agent-activity.d.ts.map +1 -1
  26. package/dist/tools/get-agent-activity.js +3 -1
  27. package/dist/tools/get-agent-activity.js.map +1 -1
  28. package/dist/tools/get-agent-conversation.d.ts.map +1 -1
  29. package/dist/tools/get-agent-conversation.js +15 -0
  30. package/dist/tools/get-agent-conversation.js.map +1 -1
  31. package/dist/tools/get-agent-message.d.ts.map +1 -1
  32. package/dist/tools/get-agent-message.js +8 -1
  33. package/dist/tools/get-agent-message.js.map +1 -1
  34. package/dist/tools/get-agent-template.d.ts.map +1 -1
  35. package/dist/tools/get-agent-template.js +11 -9
  36. package/dist/tools/get-agent-template.js.map +1 -1
  37. package/dist/tools/get-my-agent.js +4 -4
  38. package/dist/tools/get-my-agent.js.map +1 -1
  39. package/dist/tools/list-agent-skills.d.ts.map +1 -1
  40. package/dist/tools/list-agent-skills.js +22 -17
  41. package/dist/tools/list-agent-skills.js.map +1 -1
  42. package/dist/tools/list-agent-templates.d.ts.map +1 -1
  43. package/dist/tools/list-agent-templates.js +16 -10
  44. package/dist/tools/list-agent-templates.js.map +1 -1
  45. package/dist/tools/list-my-agents.d.ts.map +1 -1
  46. package/dist/tools/list-my-agents.js +2 -2
  47. package/dist/tools/list-my-agents.js.map +1 -1
  48. package/dist/tools/manage-agent-billing.d.ts.map +1 -1
  49. package/dist/tools/manage-agent-billing.js +476 -187
  50. package/dist/tools/manage-agent-billing.js.map +1 -1
  51. package/dist/tools/send-agent-message.d.ts.map +1 -1
  52. package/dist/tools/send-agent-message.js +49 -2
  53. package/dist/tools/send-agent-message.js.map +1 -1
  54. package/dist/tools/set-agent-credentials.d.ts.map +1 -1
  55. package/dist/tools/set-agent-credentials.js +24 -6
  56. package/dist/tools/set-agent-credentials.js.map +1 -1
  57. package/dist/tools/update-agent.d.ts.map +1 -1
  58. package/dist/tools/update-agent.js +12 -2
  59. package/dist/tools/update-agent.js.map +1 -1
  60. package/dist/utils/agent-catalog.d.ts +18 -14
  61. package/dist/utils/agent-catalog.d.ts.map +1 -1
  62. package/dist/utils/agent-catalog.js +4 -11
  63. package/dist/utils/agent-catalog.js.map +1 -1
  64. package/dist/utils/agent-config.d.ts +98 -45
  65. package/dist/utils/agent-config.d.ts.map +1 -1
  66. package/dist/utils/agent-config.js +246 -147
  67. package/dist/utils/agent-config.js.map +1 -1
  68. package/dist/utils/agent-message.d.ts +46 -0
  69. package/dist/utils/agent-message.d.ts.map +1 -1
  70. package/dist/utils/agent-message.js +22 -3
  71. package/dist/utils/agent-message.js.map +1 -1
  72. package/dist/utils/agent-setup.d.ts +134 -0
  73. package/dist/utils/agent-setup.d.ts.map +1 -0
  74. package/dist/utils/agent-setup.js +608 -0
  75. package/dist/utils/agent-setup.js.map +1 -0
  76. package/dist/utils/agent-targets.d.ts.map +1 -1
  77. package/dist/utils/agent-targets.js +9 -2
  78. package/dist/utils/agent-targets.js.map +1 -1
  79. package/dist/utils/agent-turns.d.ts +63 -0
  80. package/dist/utils/agent-turns.d.ts.map +1 -1
  81. package/dist/utils/agent-turns.js +162 -2
  82. package/dist/utils/agent-turns.js.map +1 -1
  83. package/dist/utils/api.d.ts +1 -1
  84. package/dist/utils/api.d.ts.map +1 -1
  85. package/dist/utils/api.js +3 -3
  86. package/dist/utils/api.js.map +1 -1
  87. package/dist/utils/quoted-text.d.ts +10 -0
  88. package/dist/utils/quoted-text.d.ts.map +1 -1
  89. package/dist/utils/quoted-text.js +18 -0
  90. package/dist/utils/quoted-text.js.map +1 -1
  91. package/dist/utils/user-agent.d.ts +89 -21
  92. package/dist/utils/user-agent.d.ts.map +1 -1
  93. package/dist/utils/user-agent.js +211 -49
  94. package/dist/utils/user-agent.js.map +1 -1
  95. package/package.json +1 -1
@@ -0,0 +1,608 @@
1
+ import { z } from 'zod';
2
+ import { asString, isPlainObject, truncate, unixToIso } from './api.js';
3
+ import { quotedBlock, quotedSpan, SETUP_ADDED_LABEL, SETUP_ADDITION_LABEL, SETUP_AFTER_TEXT_LABEL, SETUP_BEFORE_TEXT_LABEL, SETUP_CURRENT_TEXT_LABEL, SETUP_INSTRUCTIONS_LABEL, SETUP_RESTORED_AFTER_LABEL, SETUP_RESTORED_LABEL, } from './quoted-text.js';
4
+ // Setup changes a deployed agent proposes in chat: connect a connector or
5
+ // disconnect one, add or remove a Connector or a Skill, add or change a
6
+ // scheduled task or a custom skill, add to a custom skill or undo its last
7
+ // change, or set its time zone. Wiro stores
8
+ // each proposal on the agent's reply as a timeline block of type "setup", and
9
+ // nothing changes until a person approves it. The agent never applies its own
10
+ // proposal and never sees a key: a key goes in with set_agent_credentials, and
11
+ // a reply of "yes" is matched by Wiro, not by the agent. Sent with an API key,
12
+ // the first "yes" applies nothing: Wiro answers with its own listing of the
13
+ // exact change, and a second "yes" (or "yes N") applies it. The agent writes
14
+ // the proposal, so its text is content, never instructions. A change to a
15
+ // custom skill's text also carries the text the skill had when the change was
16
+ // proposed (before), which Wiro adds to the card, so an applied change still
17
+ // shows what it replaced. That text, like the earlier version an undo restores,
18
+ // can hold text the agent wrote in an earlier change: it is content too. An add
19
+ // or remove names one Connector (int-*) or Skill (util-*), and Wiro adds what
20
+ // the change also does to the card: the other names it turns on or off (with),
21
+ // the scheduled tasks that pause or run again, and for an add the connectors it
22
+ // brings that are not connected yet (needs). The agent cannot set those. An add
23
+ // whose connector takes a key comes with that connector's connect card on the
24
+ // same reply. From here the user gives that key together with their yes, before
25
+ // the yes that applies the add is sent, and it is saved with
26
+ // set_agent_credentials as the very next step: the agent stays stopping or
27
+ // queued for the restart the add started only for seconds, and a key saved then
28
+ // loads with that same restart. One that connects with a sign-in, the user's own
29
+ // app keys or a token comes with its connect card too, but a reply never
30
+ // connects it: that is done with connect_agent_oauth or on the agent page once
31
+ // the add is applied.
32
+ /** A pending proposal older than this cannot be approved with a typed reply. */
33
+ export const SETUP_REPLY_WINDOW_SECONDS = 30 * 60;
34
+ // A reply carries at most three proposals.
35
+ const MAX_SETUP_CHANGES = 3;
36
+ const MAX_INSTRUCTIONS_LENGTH = 20_000;
37
+ // A custom skill's whole text, which Wiro writes on a proposal (the text before
38
+ // the change, or the earlier version an undo restores), can be longer than the
39
+ // instructions an agent writes. The same cap as manage_agent_custom_skill's value.
40
+ const MAX_SKILL_TEXT_LENGTH = 100_000;
41
+ const MAX_LINE_LENGTH = 300;
42
+ export const SETUP_CHANGE_KINDS = ['connect', 'schedule', 'skill', 'timezone', 'disconnect', 'add', 'remove'];
43
+ export const SETUP_CHANGE_STATUSES = ['pending', 'applied', 'dismissed', 'failed'];
44
+ // The custom skill actions that change its text and carry the text from before the change.
45
+ const SKILL_TEXT_ACTIONS = ['update', 'append', 'revert'];
46
+ // The kinds that turn a Connector (int-*) or a Skill (util-*) on or off, by its name.
47
+ const REGISTRY_KINDS = ['add', 'remove'];
48
+ const REGISTRY_NAME = /^(?:int|util)-[a-z0-9]+(?:-[a-z0-9]+)*$/;
49
+ const SCHEDULED_TASK_KEY = /^cs-cron-[a-z0-9]+(?:-[a-z0-9]+)*$/;
50
+ const CONNECTOR_KEY = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
51
+ const MAX_NAME_LENGTH = 64;
52
+ // What Wiro writes on an add or remove card, at most: the other names it turns on or off, the
53
+ // scheduled tasks that pause or run again, and the connectors still to connect.
54
+ const MAX_WITH = 12;
55
+ const MAX_TASKS = 20;
56
+ const MAX_NEEDS = 3;
57
+ // How a connector an add brings is connected: its key, a sign-in with Wiro's app, the user's own app keys and
58
+ // then a sign-in, a token that Wiro checks, or a setup on the agent page (files, service accounts, a Wiro project).
59
+ export const SETUP_NEED_MODES = ['key', 'signin', 'appkeys', 'token', 'page'];
60
+ // The modes whose connect card a reply never connects.
61
+ const SIGN_IN_NEED_MODES = ['signin', 'appkeys', 'token'];
62
+ /** Whether a connector connects with a sign-in, the user's own app keys or a token, which a reply never does. */
63
+ export function isSignInNeedMode(mode) {
64
+ return mode !== undefined && SIGN_IN_NEED_MODES.includes(mode);
65
+ }
66
+ export const CHAT_SETUP_MODES = ['off', 'webchat', 'all'];
67
+ /** What each chat_setup value allows, said the same way by every tool that sets or shows it. */
68
+ export const CHAT_SETUP_DESCRIPTION = 'Setup from chat lets the agent propose setup changes in its chat (connect or '
69
+ + 'disconnect a service, add or remove a Connector or Skill, scheduled tasks, custom skills and its time zone); '
70
+ + 'nothing changes until an agent admin approves the proposal. "all" (the '
71
+ + 'default) allows it in the Wiro web chat and in messages sent with an API key, such as from this MCP server; '
72
+ + '"webchat" only in the Wiro web chat; "off" turns it off. Messages sent with an API key act with the key '
73
+ + 'owner\'s rights, so an agent shared with customers or many people usually uses "webchat" or "off".';
74
+ const setupNeedSchema = z.object({
75
+ connector: z.string(),
76
+ title: z.string().optional(),
77
+ mode: z.enum(SETUP_NEED_MODES).optional(),
78
+ });
79
+ export const setupChangeSchema = z.object({
80
+ id: z.string(),
81
+ kind: z.enum(SETUP_CHANGE_KINDS),
82
+ action: z.string().optional(),
83
+ connector: z.string().optional(),
84
+ key: z.string().optional()
85
+ .describe('Schedule and skill: the scheduled task\'s or custom skill\'s key. Add and remove: the name of the '
86
+ + 'Connector (int-*) or Skill (util-*) the change turns on or off.'),
87
+ title: z.string().optional(),
88
+ cron: z.string().optional(),
89
+ instructions: z.string().optional()
90
+ .describe('The scheduled task\'s or custom skill\'s text: the whole new text (create, update), only the text to '
91
+ + 'add at the end of the skill (append), or the earlier version an undo restores (revert), which Wiro takes '
92
+ + 'from the skill\'s history.'),
93
+ before: z.string().optional()
94
+ .describe('Custom skill update, append and revert: the skill\'s text when the change was proposed. Wiro adds it '
95
+ + 'to the proposal; the agent cannot set it. It stays as it is once the change is applied, so it shows what '
96
+ + 'the change replaced.'),
97
+ timezone: z.string().optional(),
98
+ with: z.array(z.string()).optional()
99
+ .describe('Add and remove: the other Connectors and Skills, by name, that the change also turns on (add) or '
100
+ + 'off (remove). Wiro adds it to the proposal; the agent cannot set it.'),
101
+ pauses: z.array(z.string()).optional()
102
+ .describe('Add and remove: the scheduled tasks, by key, that pause with the change. Wiro adds it.'),
103
+ resumes: z.array(z.string()).optional()
104
+ .describe('Add and remove: the scheduled tasks, by key, that run again with the change. Wiro adds it.'),
105
+ needs: z.array(setupNeedSchema).optional()
106
+ .describe('Add: the connectors the change brings that are not connected yet, and how each one connects: key '
107
+ + '(its key, saved with set_agent_credentials, never in a chat message), signin (a sign-in with Wiro\'s app), '
108
+ + 'appkeys (the user\'s own app keys, then a sign-in), token (a token that Wiro checks), each of these three '
109
+ + 'with connect_agent_oauth or on the agent page, or page (set up on the agent page). Wiro adds it.'),
110
+ note: z.string().optional(),
111
+ status: z.enum(SETUP_CHANGE_STATUSES),
112
+ proposedAt: z.string().optional(),
113
+ actedAt: z.string().optional(),
114
+ error: z.string().optional(),
115
+ });
116
+ export const setupResultSchema = z.object({
117
+ applied: z.array(z.string()),
118
+ dismissed: z.array(z.string()),
119
+ failed: z.array(z.object({ id: z.string(), error: z.string().optional() })),
120
+ restarting: z.boolean(),
121
+ });
122
+ function shortLine(value) {
123
+ const text = asString(value)?.replace(/\s+/g, ' ').trim();
124
+ return text ? truncate(text, MAX_LINE_LENGTH) : undefined;
125
+ }
126
+ /** The distinct names of a list Wiro writes on an add or remove, at most max; anything else in it is left out. */
127
+ function nameList(value, pattern, max, except) {
128
+ if (!Array.isArray(value))
129
+ return [];
130
+ const names = [];
131
+ for (const item of value) {
132
+ if (names.length === max)
133
+ break;
134
+ const name = typeof item === 'string' ? item.trim() : '';
135
+ if (name && name.length <= MAX_NAME_LENGTH && pattern.test(name) && name !== except && !names.includes(name))
136
+ names.push(name);
137
+ }
138
+ return names;
139
+ }
140
+ /** The connectors an add brings that are not connected yet, as Wiro wrote them. A mode this version does not know is left out. */
141
+ function needList(value) {
142
+ if (!Array.isArray(value))
143
+ return [];
144
+ const needs = [];
145
+ for (const item of value) {
146
+ if (needs.length === MAX_NEEDS)
147
+ break;
148
+ if (!isPlainObject(item))
149
+ continue;
150
+ const connector = asString(item.connector)?.trim();
151
+ if (!connector || connector.length > MAX_NAME_LENGTH || !CONNECTOR_KEY.test(connector) || connector.startsWith('sys-')
152
+ || needs.some(need => need.connector === connector))
153
+ continue;
154
+ const title = shortLine(item.title);
155
+ const mode = asString(item.mode);
156
+ needs.push({
157
+ connector,
158
+ ...(title ? { title } : {}),
159
+ ...(SETUP_NEED_MODES.includes(mode ?? '') ? { mode: mode } : {}),
160
+ });
161
+ }
162
+ return needs;
163
+ }
164
+ /**
165
+ * An add or a remove: one Connector or Skill by its name, with what Wiro wrote on the proposal about what
166
+ * the change also does. The proposal has no title for the name, so the name is what is shown, and fields of
167
+ * other kinds are left out. A name that is not a Connector's or a Skill's is a shape this version does not know.
168
+ */
169
+ function toRegistryChange(value, id, kind, status) {
170
+ const key = asString(value.key)?.trim();
171
+ if (!key || key.length > MAX_NAME_LENGTH || !REGISTRY_NAME.test(key))
172
+ return undefined;
173
+ const withNames = nameList(value.with, REGISTRY_NAME, MAX_WITH, key);
174
+ const pauses = nameList(value.pauses, SCHEDULED_TASK_KEY, MAX_TASKS);
175
+ const resumes = nameList(value.resumes, SCHEDULED_TASK_KEY, MAX_TASKS);
176
+ // Only an add brings connectors.
177
+ const needs = kind === 'add' ? needList(value.needs) : [];
178
+ const note = shortLine(value.note);
179
+ const proposedAt = unixToIso(value.createdat);
180
+ const actedAt = unixToIso(value.actedat);
181
+ const error = status === 'failed' ? shortLine(value.error) : undefined;
182
+ return {
183
+ id,
184
+ kind,
185
+ status,
186
+ key,
187
+ ...(withNames.length > 0 ? { with: withNames } : {}),
188
+ ...(pauses.length > 0 ? { pauses } : {}),
189
+ ...(resumes.length > 0 ? { resumes } : {}),
190
+ ...(needs.length > 0 ? { needs } : {}),
191
+ ...(note ? { note } : {}),
192
+ ...(proposedAt ? { proposedAt } : {}),
193
+ ...(actedAt ? { actedAt } : {}),
194
+ ...(error ? { error } : {}),
195
+ };
196
+ }
197
+ /**
198
+ * The public part of one stored proposal, or undefined for a shape this
199
+ * version does not know. Who proposed or approved it is left out.
200
+ */
201
+ export function toSetupChange(value) {
202
+ if (!isPlainObject(value))
203
+ return undefined;
204
+ const id = asString(value.id);
205
+ const kind = asString(value.kind);
206
+ if (!id || !SETUP_CHANGE_KINDS.includes(kind ?? ''))
207
+ return undefined;
208
+ const rawStatus = asString(value.status);
209
+ // A card stored before outcomes were recorded has no status: it is pending.
210
+ const status = rawStatus === undefined
211
+ ? 'pending'
212
+ : SETUP_CHANGE_STATUSES.includes(rawStatus) ? rawStatus : undefined;
213
+ if (!status)
214
+ return undefined;
215
+ if (REGISTRY_KINDS.includes(kind ?? ''))
216
+ return toRegistryChange(value, id, kind, status);
217
+ const action = shortLine(value.action);
218
+ const skillText = kind === 'skill' && SKILL_TEXT_ACTIONS.includes(action ?? '');
219
+ const instructions = asString(value.instructions);
220
+ const before = skillText ? asString(value.before) : undefined;
221
+ // An undo's text is the skill's earlier version, which Wiro puts on the card, so it can be longer than an agent's
222
+ // instructions.
223
+ const instructionsCap = skillText && action === 'revert' ? MAX_SKILL_TEXT_LENGTH : MAX_INSTRUCTIONS_LENGTH;
224
+ const fields = {
225
+ action,
226
+ connector: shortLine(value.connector),
227
+ key: shortLine(value.key),
228
+ title: shortLine(value.title),
229
+ cron: shortLine(value.cron),
230
+ instructions: instructions?.trim() ? truncate(instructions, instructionsCap) : undefined,
231
+ before: before?.trim() ? truncate(before, MAX_SKILL_TEXT_LENGTH) : undefined,
232
+ timezone: shortLine(value.timezone),
233
+ note: shortLine(value.note),
234
+ proposedAt: unixToIso(value.createdat),
235
+ actedAt: unixToIso(value.actedat),
236
+ error: status === 'failed' ? shortLine(value.error) : undefined,
237
+ };
238
+ return {
239
+ id,
240
+ kind: kind,
241
+ status,
242
+ ...Object.fromEntries(Object.entries(fields).filter(([, field]) => field !== undefined)),
243
+ };
244
+ }
245
+ /** The proposals in a list of timeline blocks that are already in order, each once. */
246
+ export function setupChangesFromBlocks(blocks) {
247
+ const changes = [];
248
+ for (const block of blocks) {
249
+ if (block.type !== 'setup')
250
+ continue;
251
+ const change = toSetupChange(block.setup);
252
+ // A live block and its stored copy can both be listed; the later one is the newer state.
253
+ const index = change ? changes.findIndex(item => item.id === change.id) : -1;
254
+ if (change && index >= 0)
255
+ changes[index] = change;
256
+ else if (change && changes.length < MAX_SETUP_CHANGES)
257
+ changes.push(change);
258
+ }
259
+ return changes;
260
+ }
261
+ /** Send's own report of a reply Wiro handled as an answer to a setup proposal. */
262
+ export function toSetupResult(value) {
263
+ if (!isPlainObject(value))
264
+ return undefined;
265
+ const ids = (list) => (Array.isArray(list)
266
+ ? list.map(item => asString(item)).filter((item) => Boolean(item))
267
+ : []);
268
+ const failed = Array.isArray(value.failed)
269
+ ? value.failed.filter(isPlainObject).flatMap((item) => {
270
+ const id = asString(item.id);
271
+ const error = shortLine(item.error);
272
+ return id ? [{ id, ...(error ? { error } : {}) }] : [];
273
+ })
274
+ : [];
275
+ return {
276
+ applied: ids(value.applied),
277
+ dismissed: ids(value.dismissed),
278
+ failed,
279
+ restarting: value.restarting === true,
280
+ };
281
+ }
282
+ /** Whether Wiro's answer applied, turned down or failed anything, or restarts the agent. */
283
+ export function setupResultActed(result) {
284
+ return result.applied.length > 0 || result.dismissed.length > 0 || result.failed.length > 0 || result.restarting;
285
+ }
286
+ /**
287
+ * How many proposals Wiro's answer lists, read from the stored answer. A
288
+ * typed approval sent with an API key, or one that could mean several
289
+ * proposals, applies nothing at first: Wiro answers with the exact changes
290
+ * instead, and only a later "yes" (or "yes N") applies one of them. 0 for any
291
+ * other row.
292
+ */
293
+ export function listedSetupCount(row) {
294
+ const metadata = isPlainObject(row.metadata) ? row.metadata : undefined;
295
+ if (asString(metadata?.type) !== 'setup_result' || !Array.isArray(metadata?.listed))
296
+ return 0;
297
+ return Math.min(metadata.listed.filter(id => asString(id)).length, MAX_SETUP_CHANGES);
298
+ }
299
+ /** What to do with Wiro's listing, said the same way by the note and the Next line. */
300
+ export const SETUP_LISTING_RULE = 'Show the listing to the user, and send "yes" (or "yes N" for change N) again '
301
+ + 'only after the user agrees to exactly that change. Never send yes on your own.';
302
+ // Wiro's own answer to a setup reply is written for a person typing in the chat, so it can ask for a key as the
303
+ // next reply, always on a line of its own that starts with Wiro's words: "Next: paste your Serper key as your
304
+ // reply.", the last line of a listing that takes the key in place of the yes, or the count of connect cards that
305
+ // still need their keys. Text the agent wrote never starts a line there: a title is one line inside Wiro's own
306
+ // sentence, such as "Card 1: Create scheduled task ... (title: ...)", and the proposal's text is quoted on lines
307
+ // that start with ">". So only the start of a line is read, and a title cannot ask for a key in Wiro's name.
308
+ const KEY_AS_REPLY_LINES = [
309
+ /^Next: paste your .{1,100}? key as your reply\b/i,
310
+ /^Reply with your .{1,100}? key to add /i,
311
+ /^\d+ connector cards still need their keys\b/i,
312
+ ];
313
+ /** Whether Wiro's answer to a setup reply asks for a key as the next chat reply. */
314
+ export function asksKeyAsReply(answer) {
315
+ return typeof answer === 'string'
316
+ && answer.split(/\r?\n/).some(line => KEY_AS_REPLY_LINES.some(pattern => pattern.test(line.trim())));
317
+ }
318
+ /** What to do when Wiro's answer asks for a key as the next reply, said the same way by the note and the Next line. */
319
+ export const SETUP_KEY_RULE = 'Never send a key in a chat message: save it right away with set_agent_credentials, under '
320
+ + 'the connector the agent\'s proposal names. Saved while the agent is still stopping or queued for its restart, the '
321
+ + 'key loads with that same restart; saved once the agent is starting again, it restarts the agent a second time.';
322
+ /** The same for a listing that offers to take the key in place of the yes. */
323
+ export const SETUP_LISTING_KEY_RULE = 'The listing offers to take a key as the reply. Never send a key in a chat '
324
+ + 'message: ask the user for the key together with their yes, before you send that yes. Then send "yes" to apply '
325
+ + 'the change and save the key with set_agent_credentials as the very next step, so it loads with the same restart; '
326
+ + 'a key saved later restarts the agent again.';
327
+ /** Whether a pending proposal can still be approved with a typed reply. */
328
+ export function isApprovableByReply(change, nowMs = Date.now()) {
329
+ if (change.status !== 'pending')
330
+ return false;
331
+ const proposed = change.proposedAt ? Date.parse(change.proposedAt) : NaN;
332
+ // Without a time the server decides; it refuses a proposal that is too old.
333
+ return Number.isNaN(proposed) || nowMs - proposed < SETUP_REPLY_WINDOW_SECONDS * 1000;
334
+ }
335
+ const SCHEDULE_VERBS = {
336
+ create: 'Create the scheduled task',
337
+ update: 'Change the scheduled task',
338
+ pause: 'Pause the scheduled task',
339
+ resume: 'Resume the scheduled task',
340
+ delete: 'Delete the scheduled task',
341
+ };
342
+ const SKILL_VERBS = {
343
+ create: 'Add the custom skill',
344
+ update: 'Change the custom skill',
345
+ disable: 'Turn off the custom skill',
346
+ enable: 'Turn on the custom skill',
347
+ append: 'Add to the custom skill',
348
+ revert: 'Undo the last change to the custom skill',
349
+ };
350
+ /** What an add or a remove turns on or off: a Connector for an int-* name, else a Skill. */
351
+ function registryWord(key) {
352
+ return key?.startsWith('int-') ? 'Connector' : 'Skill';
353
+ }
354
+ /** One line that names the change, such as "Create the scheduled task `cs-cron-weekly-report`". */
355
+ export function setupChangeHeadline(change) {
356
+ switch (change.kind) {
357
+ case 'connect':
358
+ return `Connect ${quotedSpan(change.connector ?? '')}`;
359
+ case 'disconnect':
360
+ return `Disconnect ${quotedSpan(change.connector ?? '')}`;
361
+ case 'add':
362
+ return `Add ${registryWord(change.key)} ${quotedSpan(change.key ?? '')}`;
363
+ case 'remove':
364
+ return `Remove ${registryWord(change.key)} ${quotedSpan(change.key ?? '')}`;
365
+ case 'schedule':
366
+ return `${SCHEDULE_VERBS[change.action ?? ''] ?? 'Change the scheduled task'} ${quotedSpan(change.key ?? '')}`;
367
+ case 'skill':
368
+ return `${SKILL_VERBS[change.action ?? ''] ?? 'Change the custom skill'} ${quotedSpan(change.key ?? '')}`;
369
+ default:
370
+ return `Set the agent's time zone to ${quotedSpan(change.timezone ?? '')}`;
371
+ }
372
+ }
373
+ function isSkillAction(change, action) {
374
+ return change.kind === 'skill' && change.action === action;
375
+ }
376
+ /** The label of a proposal's own text, before it is applied or after. */
377
+ function changeTextLabel(change, applied) {
378
+ if (isSkillAction(change, 'append'))
379
+ return applied ? SETUP_ADDED_LABEL : SETUP_ADDITION_LABEL;
380
+ if (isSkillAction(change, 'revert'))
381
+ return applied ? SETUP_RESTORED_AFTER_LABEL : SETUP_RESTORED_LABEL;
382
+ return applied ? SETUP_AFTER_TEXT_LABEL : SETUP_INSTRUCTIONS_LABEL;
383
+ }
384
+ /**
385
+ * Whether a settled change is shown with the skill's text before and after it:
386
+ * an applied change to a custom skill's text that carries both.
387
+ */
388
+ function showsBeforeAndAfter(change) {
389
+ return change.status === 'applied' && change.before !== undefined && change.instructions !== undefined;
390
+ }
391
+ // How each connector an add brings is connected once the add is applied.
392
+ const NEED_HOW = {
393
+ key: 'its key. Ask the user for it together with their yes to this change, and save it with set_agent_credentials '
394
+ + 'as soon as this change is applied (one restart then loads both), never in a chat message',
395
+ signin: 'sign in on the agent page, or with connect_agent_oauth',
396
+ appkeys: 'the user\'s own app keys, then a sign-in, on the agent page or with set_agent_credentials and then '
397
+ + 'connect_agent_oauth, never in a chat message',
398
+ token: 'its token, which Wiro checks, on the agent page or with set_agent_credentials and then connect_agent_oauth, '
399
+ + 'never in a chat message',
400
+ page: 'set up on the agent page',
401
+ };
402
+ function needLine(need) {
403
+ const name = need.title ? `${quotedSpan(need.title)} (${quotedSpan(need.connector)})` : quotedSpan(need.connector);
404
+ return need.mode ? `${name}: ${NEED_HOW[need.mode]}` : name;
405
+ }
406
+ /**
407
+ * What an add or a remove also does, as Wiro wrote it on the proposal: the other names it turns on or off,
408
+ * the scheduled tasks that run again or pause, the connectors an add still needs connected, and for a
409
+ * Connector's remove that its saved key stays.
410
+ */
411
+ function registryChangeLines(change) {
412
+ if (change.kind !== 'add' && change.kind !== 'remove')
413
+ return [];
414
+ const add = change.kind === 'add';
415
+ const names = (list) => list.map(name => quotedSpan(name)).join(', ');
416
+ const lines = [];
417
+ if (change.with)
418
+ lines.push(`- Also turns ${add ? 'on' : 'off'}: ${names(change.with)}`);
419
+ const resumes = change.resumes ? [`- Scheduled tasks that run again: ${names(change.resumes)}`] : [];
420
+ const pauses = change.pauses ? [`- Scheduled tasks that pause: ${names(change.pauses)}`] : [];
421
+ lines.push(...(add ? [...resumes, ...pauses] : [...pauses, ...resumes]));
422
+ if (change.needs)
423
+ lines.push('- Still to connect once it is on:', ...change.needs.map(need => ` - ${needLine(need)}`));
424
+ if (!add && change.key?.startsWith('int-')) {
425
+ lines.push('- Its saved key stays saved, if it has one: adding it back needs no new key. Only a disconnect '
426
+ + 'removes a key.');
427
+ }
428
+ return lines;
429
+ }
430
+ /**
431
+ * The pending add on the same reply that brings this connect card's connector with a key, a sign-in, the user's
432
+ * own app keys or a token (the add-and-connect pair Wiro makes): its number and how the connector connects, or
433
+ * undefined.
434
+ */
435
+ function pairedAdd(change, pending) {
436
+ if (change.kind !== 'connect' || !change.connector)
437
+ return undefined;
438
+ for (const [index, other] of pending.entries()) {
439
+ if (other.kind !== 'add')
440
+ continue;
441
+ const need = connectNeed(other, change.connector);
442
+ if (need?.mode)
443
+ return { number: index + 1, mode: need.mode };
444
+ }
445
+ return undefined;
446
+ }
447
+ /** The need of an add for this connector when a connect card connects it: by key, a sign-in, app keys or a token. */
448
+ function connectNeed(add, connector) {
449
+ return add.needs?.find(candidate => candidate.connector === connector
450
+ && (candidate.mode === 'key' || isSignInNeedMode(candidate.mode)));
451
+ }
452
+ /**
453
+ * The add on the same reply that brought this connect card's connector and is applied already, with how the
454
+ * connector connects. Wiro keeps what the add needed on it, and its connect card waits until the connector is
455
+ * connected.
456
+ */
457
+ function appliedPairedAdd(change, changes) {
458
+ if (change.kind !== 'connect' || !change.connector)
459
+ return undefined;
460
+ for (const other of changes) {
461
+ if (other.kind !== 'add' || other.status !== 'applied')
462
+ continue;
463
+ const need = connectNeed(other, change.connector);
464
+ if (need?.mode)
465
+ return { add: other, mode: need.mode };
466
+ }
467
+ return undefined;
468
+ }
469
+ /**
470
+ * How a connect card's connector connects, as the add on its reply that brings it says, whether that add is still
471
+ * pending or applied already. Undefined when no add on the reply brings it.
472
+ */
473
+ export function connectCardMode(change, changes) {
474
+ const pending = changes.filter(other => other.status === 'pending');
475
+ return pairedAdd(change, pending)?.mode ?? appliedPairedAdd(change, changes)?.mode;
476
+ }
477
+ function pendingChangeLines(change, index, nowMs, pending, changes) {
478
+ const lines = [`#### Proposed change ${index + 1}: ${setupChangeHeadline(change)}`, ''];
479
+ if (change.title)
480
+ lines.push(`- Title: ${quotedSpan(change.title)}`);
481
+ if (change.cron) {
482
+ lines.push(`- Schedule: ${quotedSpan(change.cron)} (cron: minute, hour, day of month, month, weekday; in the `
483
+ + 'agent\'s time zone)');
484
+ }
485
+ const paired = pairedAdd(change, pending);
486
+ const applied = paired ? undefined : appliedPairedAdd(change, changes);
487
+ if (paired?.mode === 'key') {
488
+ lines.push(`- Connects what proposed change ${paired.number} adds. Ask the user for the key together with their yes to `
489
+ + `change ${paired.number}. Once change ${paired.number} is applied, save the key with set_agent_credentials at once, `
490
+ + 'never in a chat message: one restart then loads both.');
491
+ }
492
+ else if (paired) {
493
+ lines.push(`- Connects what proposed change ${paired.number} adds, once it is applied: ${NEED_HOW[paired.mode]}. `
494
+ + 'A reply does not connect it.');
495
+ }
496
+ else if (applied && isSignInNeedMode(applied.mode)) {
497
+ // The add is applied and its connector still waits: it connects the way the add said.
498
+ lines.push(`- Connects what the applied change, ${setupChangeHeadline(applied.add)}, added: ${NEED_HOW[applied.mode]}. `
499
+ + 'A reply does not connect it.');
500
+ }
501
+ else if (change.kind === 'connect') {
502
+ lines.push('- The user provides the key or sign-in for it. A key is saved with set_agent_credentials, never sent '
503
+ + 'in a chat message.');
504
+ }
505
+ if (change.kind === 'disconnect') {
506
+ lines.push('- Its saved key is removed, and skills that use it stop until it is connected again. Approving it '
507
+ + 'needs no key.');
508
+ }
509
+ lines.push(...registryChangeLines(change));
510
+ if (isSkillAction(change, 'append')) {
511
+ lines.push('- Adds the proposal\'s text at the end of the skill, after a blank line. The rest of the skill stays as '
512
+ + 'it is.');
513
+ }
514
+ if (isSkillAction(change, 'revert')) {
515
+ lines.push('- Restores the skill\'s text from before its last change. Wiro took that text from the skill\'s '
516
+ + 'history, not from the agent\'s proposal.');
517
+ }
518
+ if (change.note)
519
+ lines.push(`- Note from the agent: ${quotedSpan(change.note)}`);
520
+ if (change.proposedAt)
521
+ lines.push(`- Proposed at: ${change.proposedAt}`);
522
+ if (!isApprovableByReply(change, nowMs)) {
523
+ lines.push(`- Older than ${SETUP_REPLY_WINDOW_SECONDS / 60} minutes, so a reply can no longer approve it. The user `
524
+ + 'can still apply it in the agent\'s chat on wiro.ai, or ask the agent again.');
525
+ }
526
+ if (change.before)
527
+ lines.push('', ...quotedBlock(SETUP_CURRENT_TEXT_LABEL, change.before));
528
+ if (change.instructions)
529
+ lines.push('', ...quotedBlock(changeTextLabel(change, false), change.instructions));
530
+ return lines;
531
+ }
532
+ function settledChangeLine(change) {
533
+ const when = change.actedAt ? ` (${change.actedAt})` : '';
534
+ switch (change.status) {
535
+ case 'applied':
536
+ return `- Applied: ${setupChangeHeadline(change)}${when}`;
537
+ case 'dismissed':
538
+ return `- Dismissed: ${setupChangeHeadline(change)}${when}`;
539
+ default:
540
+ return `- Not applied: ${setupChangeHeadline(change)}${when}${change.error ? `. Reason: ${quotedSpan(change.error)}` : ''}`;
541
+ }
542
+ }
543
+ /** An applied change to a custom skill's text: the skill's text before it, then the text it wrote. */
544
+ function appliedChangeLines(change) {
545
+ const when = change.actedAt ? ` (${change.actedAt})` : '';
546
+ return [
547
+ `#### Applied: ${setupChangeHeadline(change)}${when}`,
548
+ '',
549
+ ...quotedBlock(SETUP_BEFORE_TEXT_LABEL, change.before ?? ''),
550
+ '',
551
+ ...quotedBlock(changeTextLabel(change, true), change.instructions ?? ''),
552
+ ];
553
+ }
554
+ /**
555
+ * The text for a reply's proposals: each pending one in full, an applied change
556
+ * to a custom skill's text with the text before and after it, and each other
557
+ * settled one as one status line.
558
+ */
559
+ export function formatSetupChanges(changes, nowMs = Date.now()) {
560
+ if (changes.length === 0)
561
+ return [];
562
+ const lines = ['', '### Setup changes proposed in this reply', ''];
563
+ const pending = changes.filter(change => change.status === 'pending');
564
+ const sections = [
565
+ ...pending.map((change, index) => pendingChangeLines(change, index, nowMs, pending, changes)),
566
+ ...changes.filter(showsBeforeAndAfter).map(appliedChangeLines),
567
+ ];
568
+ sections.forEach((section, index) => {
569
+ if (index > 0)
570
+ lines.push('');
571
+ lines.push(...section);
572
+ });
573
+ const settled = changes.filter(change => change.status !== 'pending' && !showsBeforeAndAfter(change));
574
+ if (settled.length > 0) {
575
+ if (sections.length > 0)
576
+ lines.push('');
577
+ lines.push(...settled.map(settledChangeLine));
578
+ }
579
+ return lines;
580
+ }
581
+ /** One line per proposal, for a conversation listing. */
582
+ export function setupChangeSummaryLines(changes) {
583
+ return changes.map((change) => {
584
+ if (change.status === 'pending') {
585
+ return `- Proposed setup change (pending): ${setupChangeHeadline(change)}. get_agent_message with this message id shows it in full.`;
586
+ }
587
+ return showsBeforeAndAfter(change)
588
+ ? `${settledChangeLine(change)}. get_agent_message with this message id shows the skill's text before and after it.`
589
+ : settledChangeLine(change);
590
+ });
591
+ }
592
+ /** A chat_setup value from an agent row, or undefined when the row does not say. */
593
+ export function readChatSetupMode(value) {
594
+ const mode = asString(value);
595
+ return CHAT_SETUP_MODES.includes(mode ?? '') ? mode : undefined;
596
+ }
597
+ /** How get_my_agent names a chat_setup value. */
598
+ export function chatSetupLabel(mode) {
599
+ switch (mode) {
600
+ case 'off':
601
+ return 'off';
602
+ case 'webchat':
603
+ return 'Wiro web chat only (`webchat`)';
604
+ default:
605
+ return 'Wiro web chat and API messages (`all`)';
606
+ }
607
+ }
608
+ //# sourceMappingURL=agent-setup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-setup.js","sourceRoot":"","sources":["../../src/utils/agent-setup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACxE,OAAO,EACL,WAAW,EACX,UAAU,EACV,iBAAiB,EACjB,oBAAoB,EACpB,sBAAsB,EACtB,uBAAuB,EACvB,wBAAwB,EACxB,wBAAwB,EACxB,0BAA0B,EAC1B,oBAAoB,GACrB,MAAM,kBAAkB,CAAC;AAE1B,0EAA0E;AAC1E,wEAAwE;AACxE,2EAA2E;AAC3E,4CAA4C;AAC5C,8EAA8E;AAC9E,8EAA8E;AAC9E,+EAA+E;AAC/E,+EAA+E;AAC/E,4EAA4E;AAC5E,6EAA6E;AAC7E,0EAA0E;AAC1E,8EAA8E;AAC9E,6EAA6E;AAC7E,gFAAgF;AAChF,gFAAgF;AAChF,8EAA8E;AAC9E,+EAA+E;AAC/E,gFAA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