@wiro-ai/wiro-mcp 1.4.1 → 1.5.1
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 +38 -15
- package/dist/client.d.ts +19 -6
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +44 -27
- package/dist/client.js.map +1 -1
- package/dist/instructions.d.ts.map +1 -1
- package/dist/instructions.js +7 -4
- package/dist/instructions.js.map +1 -1
- package/dist/playbooks.d.ts.map +1 -1
- package/dist/playbooks.js +46 -35
- package/dist/playbooks.js.map +1 -1
- package/dist/prompts.d.ts.map +1 -1
- package/dist/prompts.js +3 -2
- package/dist/prompts.js.map +1 -1
- package/dist/tools/apply-agent-skills.d.ts.map +1 -1
- package/dist/tools/apply-agent-skills.js +458 -109
- package/dist/tools/apply-agent-skills.js.map +1 -1
- package/dist/tools/bind-agent-project.d.ts +4 -0
- package/dist/tools/bind-agent-project.d.ts.map +1 -0
- package/dist/tools/bind-agent-project.js +405 -0
- package/dist/tools/bind-agent-project.js.map +1 -0
- package/dist/tools/cancel-agent-message.d.ts.map +1 -1
- package/dist/tools/cancel-agent-message.js +6 -3
- package/dist/tools/cancel-agent-message.js.map +1 -1
- package/dist/tools/cancel-task.js +3 -3
- package/dist/tools/cancel-task.js.map +1 -1
- package/dist/tools/clone-workflow.d.ts.map +1 -1
- package/dist/tools/clone-workflow.js +5 -4
- package/dist/tools/clone-workflow.js.map +1 -1
- package/dist/tools/connect-agent-oauth.d.ts.map +1 -1
- package/dist/tools/connect-agent-oauth.js +161 -40
- package/dist/tools/connect-agent-oauth.js.map +1 -1
- package/dist/tools/control-agent.d.ts.map +1 -1
- package/dist/tools/control-agent.js +109 -36
- package/dist/tools/control-agent.js.map +1 -1
- package/dist/tools/create-workflow.d.ts +3 -0
- package/dist/tools/create-workflow.d.ts.map +1 -1
- package/dist/tools/create-workflow.js +12 -11
- package/dist/tools/create-workflow.js.map +1 -1
- package/dist/tools/delete-agent-session.d.ts.map +1 -1
- package/dist/tools/delete-agent-session.js +18 -12
- package/dist/tools/delete-agent-session.js.map +1 -1
- package/dist/tools/delete-agent.d.ts.map +1 -1
- package/dist/tools/delete-agent.js +12 -9
- package/dist/tools/delete-agent.js.map +1 -1
- package/dist/tools/delete-workflow.d.ts.map +1 -1
- package/dist/tools/delete-workflow.js +5 -4
- package/dist/tools/delete-workflow.js.map +1 -1
- package/dist/tools/deploy-agent.d.ts.map +1 -1
- package/dist/tools/deploy-agent.js +239 -46
- package/dist/tools/deploy-agent.js.map +1 -1
- package/dist/tools/disconnect-agent-oauth.d.ts.map +1 -1
- package/dist/tools/disconnect-agent-oauth.js +32 -12
- package/dist/tools/disconnect-agent-oauth.js.map +1 -1
- package/dist/tools/get-account.d.ts.map +1 -1
- package/dist/tools/get-account.js +148 -42
- package/dist/tools/get-account.js.map +1 -1
- package/dist/tools/get-agent-activity.d.ts.map +1 -1
- package/dist/tools/get-agent-activity.js +185 -35
- package/dist/tools/get-agent-activity.js.map +1 -1
- package/dist/tools/get-agent-conversation.d.ts.map +1 -1
- package/dist/tools/get-agent-conversation.js +57 -35
- package/dist/tools/get-agent-conversation.js.map +1 -1
- package/dist/tools/get-agent-message.d.ts.map +1 -1
- package/dist/tools/get-agent-message.js +6 -4
- package/dist/tools/get-agent-message.js.map +1 -1
- package/dist/tools/get-agent-template.d.ts.map +1 -1
- package/dist/tools/get-agent-template.js +13 -17
- package/dist/tools/get-agent-template.js.map +1 -1
- package/dist/tools/get-model-schema.js +3 -3
- package/dist/tools/get-model-schema.js.map +1 -1
- package/dist/tools/get-my-agent.d.ts.map +1 -1
- package/dist/tools/get-my-agent.js +13 -8
- package/dist/tools/get-my-agent.js.map +1 -1
- package/dist/tools/get-playbook.d.ts.map +1 -1
- package/dist/tools/get-playbook.js +3 -2
- package/dist/tools/get-playbook.js.map +1 -1
- package/dist/tools/get-task-price.js +3 -3
- package/dist/tools/get-task-price.js.map +1 -1
- package/dist/tools/get-task.js +3 -3
- package/dist/tools/get-task.js.map +1 -1
- package/dist/tools/get-workflow.d.ts.map +1 -1
- package/dist/tools/get-workflow.js +38 -19
- package/dist/tools/get-workflow.js.map +1 -1
- package/dist/tools/index.d.ts +3 -1
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +6 -1
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/kill-task.js +3 -3
- package/dist/tools/kill-task.js.map +1 -1
- package/dist/tools/list-agent-skills.d.ts.map +1 -1
- package/dist/tools/list-agent-skills.js +11 -8
- package/dist/tools/list-agent-skills.js.map +1 -1
- package/dist/tools/list-agent-templates.js +4 -4
- package/dist/tools/list-agent-templates.js.map +1 -1
- package/dist/tools/list-my-agents.d.ts.map +1 -1
- package/dist/tools/list-my-agents.js +11 -8
- package/dist/tools/list-my-agents.js.map +1 -1
- package/dist/tools/list-projects.d.ts +4 -0
- package/dist/tools/list-projects.d.ts.map +1 -0
- package/dist/tools/list-projects.js +141 -0
- package/dist/tools/list-projects.js.map +1 -0
- package/dist/tools/list-studio-results.js +3 -3
- package/dist/tools/list-studio-results.js.map +1 -1
- package/dist/tools/list-tasks.js +3 -3
- package/dist/tools/list-tasks.js.map +1 -1
- package/dist/tools/list-workflow-runs.d.ts.map +1 -1
- package/dist/tools/list-workflow-runs.js +6 -4
- package/dist/tools/list-workflow-runs.js.map +1 -1
- package/dist/tools/list-workflows.d.ts.map +1 -1
- package/dist/tools/list-workflows.js +7 -6
- package/dist/tools/list-workflows.js.map +1 -1
- package/dist/tools/manage-agent-billing.d.ts.map +1 -1
- package/dist/tools/manage-agent-billing.js +207 -59
- package/dist/tools/manage-agent-billing.js.map +1 -1
- package/dist/tools/manage-agent-custom-skill.d.ts.map +1 -1
- package/dist/tools/manage-agent-custom-skill.js +119 -15
- package/dist/tools/manage-agent-custom-skill.js.map +1 -1
- package/dist/tools/recommend-model.js +3 -3
- package/dist/tools/recommend-model.js.map +1 -1
- package/dist/tools/resume-workflow-run.d.ts.map +1 -1
- package/dist/tools/resume-workflow-run.js +3 -2
- package/dist/tools/resume-workflow-run.js.map +1 -1
- package/dist/tools/run-model.js +3 -3
- package/dist/tools/run-model.js.map +1 -1
- package/dist/tools/run-workflow.d.ts.map +1 -1
- package/dist/tools/run-workflow.js +3 -2
- package/dist/tools/run-workflow.js.map +1 -1
- package/dist/tools/save-workflow-from-agent.d.ts.map +1 -1
- package/dist/tools/save-workflow-from-agent.js +17 -12
- package/dist/tools/save-workflow-from-agent.js.map +1 -1
- package/dist/tools/schemas.d.ts +32 -26
- package/dist/tools/schemas.d.ts.map +1 -1
- package/dist/tools/schemas.js +67 -0
- package/dist/tools/schemas.js.map +1 -1
- package/dist/tools/search-docs.js +3 -3
- package/dist/tools/search-docs.js.map +1 -1
- package/dist/tools/search-models.js +3 -3
- package/dist/tools/search-models.js.map +1 -1
- package/dist/tools/send-agent-message.d.ts.map +1 -1
- package/dist/tools/send-agent-message.js +30 -9
- package/dist/tools/send-agent-message.js.map +1 -1
- package/dist/tools/set-agent-credentials.d.ts.map +1 -1
- package/dist/tools/set-agent-credentials.js +55 -61
- package/dist/tools/set-agent-credentials.js.map +1 -1
- package/dist/tools/update-agent.d.ts.map +1 -1
- package/dist/tools/update-agent.js +59 -20
- package/dist/tools/update-agent.js.map +1 -1
- package/dist/tools/update-workflow.d.ts +199 -0
- package/dist/tools/update-workflow.d.ts.map +1 -1
- package/dist/tools/update-workflow.js +20 -7
- package/dist/tools/update-workflow.js.map +1 -1
- package/dist/tools/upload-file.js +3 -3
- package/dist/tools/upload-file.js.map +1 -1
- package/dist/tools/wait-for-task.js +3 -3
- package/dist/tools/wait-for-task.js.map +1 -1
- package/dist/tools/wait-for-workflow-run.d.ts +3 -3
- package/dist/tools/wait-for-workflow-run.d.ts.map +1 -1
- package/dist/tools/wait-for-workflow-run.js +7 -6
- package/dist/tools/wait-for-workflow-run.js.map +1 -1
- package/dist/utils/agent-catalog.d.ts +59 -0
- package/dist/utils/agent-catalog.d.ts.map +1 -1
- package/dist/utils/agent-catalog.js +28 -7
- package/dist/utils/agent-catalog.js.map +1 -1
- package/dist/utils/agent-config.d.ts +172 -9
- package/dist/utils/agent-config.d.ts.map +1 -1
- package/dist/utils/agent-config.js +416 -60
- package/dist/utils/agent-config.js.map +1 -1
- package/dist/utils/agent-message.d.ts +36 -14
- package/dist/utils/agent-message.d.ts.map +1 -1
- package/dist/utils/agent-message.js +92 -26
- package/dist/utils/agent-message.js.map +1 -1
- package/dist/utils/agent-targets.d.ts +7 -3
- package/dist/utils/agent-targets.d.ts.map +1 -1
- package/dist/utils/agent-targets.js +35 -23
- package/dist/utils/agent-targets.js.map +1 -1
- package/dist/utils/agent-turns.d.ts +19 -12
- package/dist/utils/agent-turns.d.ts.map +1 -1
- package/dist/utils/agent-turns.js +97 -15
- package/dist/utils/agent-turns.js.map +1 -1
- package/dist/utils/api.d.ts +6 -0
- package/dist/utils/api.d.ts.map +1 -1
- package/dist/utils/api.js +22 -1
- package/dist/utils/api.js.map +1 -1
- package/dist/utils/format.d.ts.map +1 -1
- package/dist/utils/format.js +7 -13
- package/dist/utils/format.js.map +1 -1
- package/dist/utils/json-schema-dialect.d.ts.map +1 -1
- package/dist/utils/json-schema-dialect.js +4 -0
- package/dist/utils/json-schema-dialect.js.map +1 -1
- package/dist/utils/media.d.ts +8 -0
- package/dist/utils/media.d.ts.map +1 -1
- package/dist/utils/media.js +29 -0
- package/dist/utils/media.js.map +1 -1
- package/dist/utils/poll.d.ts +5 -2
- package/dist/utils/poll.d.ts.map +1 -1
- package/dist/utils/poll.js +10 -9
- package/dist/utils/poll.js.map +1 -1
- package/dist/utils/quoted-text.d.ts +28 -0
- package/dist/utils/quoted-text.d.ts.map +1 -0
- package/dist/utils/quoted-text.js +64 -0
- package/dist/utils/quoted-text.js.map +1 -0
- package/dist/utils/studio-runs.d.ts.map +1 -1
- package/dist/utils/studio-runs.js +7 -4
- package/dist/utils/studio-runs.js.map +1 -1
- package/dist/utils/user-agent.d.ts +197 -29
- package/dist/utils/user-agent.d.ts.map +1 -1
- package/dist/utils/user-agent.js +314 -48
- package/dist/utils/user-agent.js.map +1 -1
- package/dist/utils/wiro-project.d.ts +45 -0
- package/dist/utils/wiro-project.d.ts.map +1 -0
- package/dist/utils/wiro-project.js +66 -0
- package/dist/utils/wiro-project.js.map +1 -0
- package/dist/utils/workflow-save.d.ts +22 -1
- package/dist/utils/workflow-save.d.ts.map +1 -1
- package/dist/utils/workflow-save.js +122 -24
- package/dist/utils/workflow-save.js.map +1 -1
- package/dist/utils/workflow.d.ts +26 -13
- package/dist/utils/workflow.d.ts.map +1 -1
- package/dist/utils/workflow.js +51 -20
- package/dist/utils/workflow.js.map +1 -1
- package/dist/utils/workspace.d.ts +30 -4
- package/dist/utils/workspace.d.ts.map +1 -1
- package/dist/utils/workspace.js +95 -12
- package/dist/utils/workspace.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user-agent.d.ts","sourceRoot":"","sources":["../../src/utils/user-agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"user-agent.d.ts","sourceRoot":"","sources":["../../src/utils/user-agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAaxB,OAAO,EAA6B,KAAK,eAAe,EAAE,MAAM,WAAW,CAAC;AAM5E,eAAO,MAAM,mBAAmB,iCAAiC,CAAC;AAElE,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEtD;AAiBD,eAAO,MAAM,sBAAsB,2GAAwB,CAAC;AAC5D,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAwBtE,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,GAAG,IAAI,CAG3E;AAED,wBAAgB,gBAAgB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wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAI1D;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAE3D;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAMtD;AAED,qJAAqJ;AACrJ,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,EAAE,WAAW,UAAQ,EAAE,KAAK,CAAC,EAAE,IAAI,CAAC,YAAY,EAAE,cAAc,GAAG,SAAS,CAAC,GAAG,MAAM,CAsB9I;AAED,4GAA4G;AAC5G,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,IAAI,CAAC,YAAY,EAAE,QAAQ,GAAG,cAAc,GAAG,SAAS,CAAC,EAAE,WAAW,UAAQ,GAAG,MAAM,CAM9H"}
|
package/dist/utils/user-agent.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { WiroApiError } from '../client.js';
|
|
3
|
-
import { ApiResultError, asString, isPlainObject, requireApiSuccess, toNumber, truncate, unixToIso, } from './api.js';
|
|
3
|
+
import { AGENT_NOT_FOUND_TEXT, ApiResultError, asString, isPlainObject, requireApiSuccess, toNumber, truncate, unixToIso, } from './api.js';
|
|
4
4
|
import { pollUntil, reportProgress } from './poll.js';
|
|
5
|
+
import { quotedSpan } from './quoted-text.js';
|
|
5
6
|
// Deployed agents and the agent catalog. Results are rebuilt from an
|
|
6
7
|
// allowlist: only states, labels, prices and settings are returned.
|
|
7
8
|
export const AGENT_DASHBOARD_URL = 'https://wiro.ai/panel/agents';
|
|
@@ -136,7 +137,8 @@ export const subscriptionSchema = z.object({
|
|
|
136
137
|
status: z.string(),
|
|
137
138
|
billing: z.enum(['wallet', 'card']),
|
|
138
139
|
switchingToWallet: z.boolean(),
|
|
139
|
-
amountUsd: z.number().nullable()
|
|
140
|
+
amountUsd: z.number().nullable()
|
|
141
|
+
.describe('What the plan costs every 30 days. For a plan that has ended, the agent\'s monthly price, which is what a renew charges.'),
|
|
140
142
|
periodEndsAt: z.string().optional(),
|
|
141
143
|
daysRemaining: z.number().nullable(),
|
|
142
144
|
cancelAtPeriodEnd: z.boolean(),
|
|
@@ -146,15 +148,18 @@ export const subscriptionSchema = z.object({
|
|
|
146
148
|
/**
|
|
147
149
|
* Whether a plan ends with its current period: true when it ends, false when
|
|
148
150
|
* it renews, null when that is not known. A wallet plan says so itself, and a
|
|
149
|
-
* card plan moving to wallet billing renews from the wallet
|
|
150
|
-
*
|
|
151
|
+
* card plan moving to wallet billing renews from the wallet, even though its
|
|
152
|
+
* card subscription is set to end with the period. Any other card plan is
|
|
153
|
+
* known only when the row carries its card state (cardEnds).
|
|
151
154
|
*/
|
|
152
155
|
export function planEndsWithPeriod(subscription, cardEnds) {
|
|
153
|
-
if (subscription.pendingdowngrade === 'cancel'
|
|
156
|
+
if (subscription.pendingdowngrade === 'cancel')
|
|
154
157
|
return true;
|
|
155
|
-
if (subscription.provider === 'prepaid' || subscription.nextprovider === 'prepaid'
|
|
158
|
+
if (subscription.provider === 'prepaid' || subscription.nextprovider === 'prepaid')
|
|
156
159
|
return false;
|
|
157
|
-
|
|
160
|
+
if (cardEnds === true)
|
|
161
|
+
return true;
|
|
162
|
+
return cardEnds === false ? false : null;
|
|
158
163
|
}
|
|
159
164
|
export function toSubscription(value, cardEnds) {
|
|
160
165
|
if (!isPlainObject(value))
|
|
@@ -184,7 +189,10 @@ export function chargeRoute(subscription) {
|
|
|
184
189
|
return 'card';
|
|
185
190
|
}
|
|
186
191
|
export const creditsSchema = z.object({
|
|
187
|
-
monthly: z.number()
|
|
192
|
+
monthly: z.number()
|
|
193
|
+
.describe('The monthly credits this period grants. A plan change inside a period moves it for the time left, so it can differ from renewal.'),
|
|
194
|
+
renewal: z.number().optional()
|
|
195
|
+
.describe('The monthly credits each renewal grants.'),
|
|
188
196
|
extra: z.number(),
|
|
189
197
|
used: z.number(),
|
|
190
198
|
remaining: z.number(),
|
|
@@ -192,14 +200,22 @@ export const creditsSchema = z.object({
|
|
|
192
200
|
});
|
|
193
201
|
export function toCredits(row) {
|
|
194
202
|
const period = asString(row.creditperiod);
|
|
203
|
+
const renewal = toNumber(row.renewalcredits);
|
|
195
204
|
return {
|
|
196
205
|
monthly: toNumber(row.monthlycredits) ?? 0,
|
|
206
|
+
...(renewal !== null ? { renewal } : {}),
|
|
197
207
|
extra: toNumber(row.extracredits) ?? 0,
|
|
198
208
|
used: toNumber(row.usedcredits) ?? 0,
|
|
199
209
|
remaining: toNumber(row.remainingcredits) ?? 0,
|
|
200
210
|
...(period ? { period } : {}),
|
|
201
211
|
};
|
|
202
212
|
}
|
|
213
|
+
/** The monthly credits as said in a line: those of this period, and those of each renewal when they differ. */
|
|
214
|
+
export function monthlyCreditsText(credits) {
|
|
215
|
+
return credits.renewal !== undefined && credits.renewal !== credits.monthly
|
|
216
|
+
? `${formatCredits(credits.monthly)} credits this period, ${formatCredits(credits.renewal)} from each renewal`
|
|
217
|
+
: `monthly ${formatCredits(credits.monthly)}`;
|
|
218
|
+
}
|
|
203
219
|
// ---------------------------------------------------------------------------
|
|
204
220
|
// Text helpers
|
|
205
221
|
// ---------------------------------------------------------------------------
|
|
@@ -306,10 +322,37 @@ export function summarizeChannels(value) {
|
|
|
306
322
|
};
|
|
307
323
|
});
|
|
308
324
|
}
|
|
325
|
+
/** The titles of the skills that are on, from Detail's skillsmeta. */
|
|
326
|
+
export function activeSkillTitles(row) {
|
|
327
|
+
const meta = isPlainObject(row.skillsmeta) ? row.skillsmeta : {};
|
|
328
|
+
return new Map(Object.entries(meta).flatMap(([name, value]) => {
|
|
329
|
+
const title = isPlainObject(value) ? asString(value.title) : undefined;
|
|
330
|
+
return title && title !== name ? [[name, title]] : [];
|
|
331
|
+
}));
|
|
332
|
+
}
|
|
333
|
+
/** Lists of skill names, such as the skills a paused task waits for: [["a"], ["b", "c"]]. Empty lists and non-names are dropped. */
|
|
334
|
+
export function toSkillGroups(value) {
|
|
335
|
+
if (!Array.isArray(value))
|
|
336
|
+
return [];
|
|
337
|
+
return value
|
|
338
|
+
.filter(Array.isArray)
|
|
339
|
+
.map(group => group.map(name => asString(name)).filter((name) => !!name))
|
|
340
|
+
.filter(group => group.length > 0);
|
|
341
|
+
}
|
|
342
|
+
/** The scheduled task a custom build starts with. It runs only once its text has been written. */
|
|
343
|
+
export const STARTER_TASK_KEY = 'cs-cron-my-scheduled-task';
|
|
309
344
|
export const agentTaskSchema = z.object({
|
|
310
345
|
key: z.string(),
|
|
311
346
|
description: z.string().optional(),
|
|
312
347
|
enabled: z.boolean(),
|
|
348
|
+
notWritten: z.boolean().optional()
|
|
349
|
+
.describe('The starter task whose text was never written. It does not run, even when it shows on, until its text is saved with manage_agent_custom_skill.'),
|
|
350
|
+
ownerSkills: z.array(z.string()).optional()
|
|
351
|
+
.describe('The skills that bring this task.'),
|
|
352
|
+
skillOff: z.boolean().optional()
|
|
353
|
+
.describe('The task is paused because the skills it needs are off: it does not run, even when it shows on, until one skill from each list in offSkills is turned on with apply_agent_skills. Its own on/off state, text and schedule stay as they are.'),
|
|
354
|
+
offSkills: z.array(z.array(z.string())).optional()
|
|
355
|
+
.describe('While skillOff is true, the skills that end the pause, as lists: turn on one skill from each list. The task then runs while the services it needs are connected.'),
|
|
313
356
|
interval: z.string().nullable().optional(),
|
|
314
357
|
source: z.enum(['template', 'skill', 'user']).optional(),
|
|
315
358
|
instructions: z.string().optional(),
|
|
@@ -330,10 +373,16 @@ export function summarizeTasks(value, maxInstructionLength = 300) {
|
|
|
330
373
|
const instructions = asString(task.value) ?? '';
|
|
331
374
|
const shortened = truncate(instructions, maxInstructionLength);
|
|
332
375
|
const source = TASK_SOURCES[asString(task._source) ?? ''];
|
|
376
|
+
const ownerSkills = toStringArray(task._owner_skills);
|
|
377
|
+
const offSkills = toSkillGroups(task._off_skills);
|
|
333
378
|
return {
|
|
334
379
|
key: asString(task.key) ?? '',
|
|
335
380
|
...(description ? { description } : {}),
|
|
336
381
|
enabled: task.enabled !== false,
|
|
382
|
+
...(asString(task.key) === STARTER_TASK_KEY && task._edited === false ? { notWritten: true } : {}),
|
|
383
|
+
...(ownerSkills.length > 0 ? { ownerSkills } : {}),
|
|
384
|
+
...(task._skill_off === true ? { skillOff: true } : {}),
|
|
385
|
+
...(offSkills.length > 0 ? { offSkills } : {}),
|
|
337
386
|
...(interval !== undefined ? { interval: interval || null } : {}),
|
|
338
387
|
...(source ? { source } : {}),
|
|
339
388
|
...(shortened ? { instructions: shortened } : {}),
|
|
@@ -372,7 +421,8 @@ export const agentSummarySchema = z.object({
|
|
|
372
421
|
title: z.string(),
|
|
373
422
|
status: z.number().int().nullable(),
|
|
374
423
|
statusLabel: agentStatusLabelSchema,
|
|
375
|
-
setupRequired: z.boolean()
|
|
424
|
+
setupRequired: z.boolean()
|
|
425
|
+
.describe('Whether the agent waits for setup. list_my_agents goes by the status (6). get_my_agent also checks each required credential and names what is missing.'),
|
|
376
426
|
workspace: z.enum(['personal', 'team']),
|
|
377
427
|
template: agentTemplateRefSchema,
|
|
378
428
|
tier: z.string().optional(),
|
|
@@ -384,13 +434,16 @@ export const agentSummarySchema = z.object({
|
|
|
384
434
|
skills: z.array(z.string()),
|
|
385
435
|
createdAt: z.string().optional(),
|
|
386
436
|
updatedAt: z.string().optional(),
|
|
437
|
+
lastActivityAt: z.string().optional()
|
|
438
|
+
.describe('When the agent\'s newest message was written, on any channel, scheduled runs included. Left out when it has none.'),
|
|
387
439
|
});
|
|
388
440
|
export const agentDetailSchema = agentSummarySchema.extend({
|
|
389
441
|
description: z.string().optional(),
|
|
390
442
|
cover: z.string().optional(),
|
|
391
443
|
categories: z.array(z.string()),
|
|
392
444
|
pricing: tierPricingSchema.nullable(),
|
|
393
|
-
extraCreditPacks: z.array(extraCreditPackSchema)
|
|
445
|
+
extraCreditPacks: z.array(extraCreditPackSchema)
|
|
446
|
+
.describe('The extra credit packs this plan can buy. Only an active Pro plan can buy them, so any other plan lists none.'),
|
|
394
447
|
models: modelSettingsSchema.optional(),
|
|
395
448
|
selectableModels: z.array(selectableModelSchema).optional(),
|
|
396
449
|
enabledCommands: z.array(z.string()).nullable(),
|
|
@@ -439,6 +492,15 @@ function timestamps(row, map) {
|
|
|
439
492
|
}
|
|
440
493
|
return out;
|
|
441
494
|
}
|
|
495
|
+
/**
|
|
496
|
+
* The plan as it is shown. A plan that has ended renews at the agent's monthly
|
|
497
|
+
* price, not at the amount of its last period, so that is its one price.
|
|
498
|
+
*/
|
|
499
|
+
function planOf(row) {
|
|
500
|
+
const plan = toSubscription(row.subscription, row.stripecancelatperiodend);
|
|
501
|
+
const price = toNumber(row.monthlypriceusd);
|
|
502
|
+
return plan && plan.status !== 'active' && price !== null && price > 0 ? { ...plan, amountUsd: price } : plan;
|
|
503
|
+
}
|
|
442
504
|
/** The compact row used by list_my_agents. */
|
|
443
505
|
export function toAgentSummary(row) {
|
|
444
506
|
const status = readAgentStatus(row);
|
|
@@ -456,11 +518,11 @@ export function toAgentSummary(row) {
|
|
|
456
518
|
...(tier ? { tier } : {}),
|
|
457
519
|
monthlyPriceUsd: toNumber(row.monthlypriceusd),
|
|
458
520
|
credits: toCredits(row),
|
|
459
|
-
subscription:
|
|
521
|
+
subscription: planOf(row),
|
|
460
522
|
...(timezone !== undefined ? { timezone } : {}),
|
|
461
523
|
...(sessionMode ? { teamSessionMode: sessionMode } : {}),
|
|
462
524
|
skills: toStringArray(row.skills ?? row.enabledSkills),
|
|
463
|
-
...timestamps(row, { createdAt: 'createdat', updatedAt: 'updatedat' }),
|
|
525
|
+
...timestamps(row, { createdAt: 'createdat', updatedAt: 'updatedat', lastActivityAt: 'lastactivityat' }),
|
|
464
526
|
};
|
|
465
527
|
}
|
|
466
528
|
/** The models an agent can switch to, with their credits per 1M input and output tokens when Wiro lists them. */
|
|
@@ -486,6 +548,34 @@ function selectableModels(tokenRates) {
|
|
|
486
548
|
export function selectableModelSlugs(row) {
|
|
487
549
|
return new Set(selectableModels(row.tokenRates).map(model => model.slug));
|
|
488
550
|
}
|
|
551
|
+
/**
|
|
552
|
+
* The keys of the credentials an agent's setup waits for: a credential with a
|
|
553
|
+
* required field empty, a required credential that holds no value yet, or a
|
|
554
|
+
* required sign-in that is not connected. A custom build's setup waits only for
|
|
555
|
+
* the main credential of each active skill, which skillsmeta lists. Its chat
|
|
556
|
+
* channels are never among them.
|
|
557
|
+
*/
|
|
558
|
+
export function credentialKeysSetupWaitsFor(row) {
|
|
559
|
+
const channelKeys = new Set(summarizeChannels(row.communicationChannels).map(channel => channel.credentialKey));
|
|
560
|
+
const activeKeys = templateRef(row).custom && isPlainObject(row.skillsmeta)
|
|
561
|
+
? new Set(Object.values(row.skillsmeta).filter(isPlainObject)
|
|
562
|
+
.filter(meta => meta.requires_credentials === true)
|
|
563
|
+
.map(meta => asString(meta.credential_key))
|
|
564
|
+
.filter((key) => Boolean(key)))
|
|
565
|
+
: null;
|
|
566
|
+
return new Set(summarizeCredentials(row.credentials, channelKeys)
|
|
567
|
+
// A required credential whose fields are all optional has no empty required
|
|
568
|
+
// field to show, and the setup still waits until it holds a value.
|
|
569
|
+
.filter(credential => credential.requiredMissing
|
|
570
|
+
|| (!credential.optional && !credential.connected && (credential.oauth || (row.setuprequired === true && !credential.filled))))
|
|
571
|
+
.filter(credential => !activeKeys || activeKeys.has(credential.key))
|
|
572
|
+
// A group with no optional flag has no template row and no skill behind it, only saved values left over.
|
|
573
|
+
.filter((credential) => {
|
|
574
|
+
const group = isPlainObject(row.credentials) ? row.credentials[credential.key] : undefined;
|
|
575
|
+
return isPlainObject(group) && typeof group.optional === 'boolean';
|
|
576
|
+
})
|
|
577
|
+
.map(credential => credential.key));
|
|
578
|
+
}
|
|
489
579
|
/**
|
|
490
580
|
* The full view of one deployed agent (Detail, Deploy and Update rows): its
|
|
491
581
|
* status, plan, prices, credits and settings, and the state of each
|
|
@@ -496,20 +586,17 @@ export function toAgentDetail(row) {
|
|
|
496
586
|
const agent = isPlainObject(row.agent) ? row.agent : {};
|
|
497
587
|
const channels = summarizeChannels(row.communicationChannels);
|
|
498
588
|
const channelKeys = new Set(channels.map(channel => channel.credentialKey));
|
|
499
|
-
|
|
589
|
+
// A credential is required and missing exactly when the setup waits for it, so its row and the setup line agree.
|
|
590
|
+
const setupWaitsFor = credentialKeysSetupWaitsFor(row);
|
|
591
|
+
const credentials = summarizeCredentials(row.credentials, channelKeys)
|
|
592
|
+
.map(credential => ({ ...credential, requiredMissing: setupWaitsFor.has(credential.key) }));
|
|
500
593
|
const description = asString(row.description);
|
|
501
594
|
const cover = asString(row.cover) || asString(agent.cover);
|
|
502
595
|
const agentModel = isPlainObject(row.agentModel) ? row.agentModel : undefined;
|
|
503
596
|
const models = selectableModels(row.tokenRates);
|
|
504
|
-
//
|
|
505
|
-
|
|
506
|
-
const
|
|
507
|
-
? new Set(Object.values(row.skillsmeta).filter(isPlainObject)
|
|
508
|
-
.filter(meta => meta.requires_credentials === true)
|
|
509
|
-
.map(meta => asString(meta.credential_key))
|
|
510
|
-
.filter((key) => Boolean(key)))
|
|
511
|
-
: null;
|
|
512
|
-
const packs = Array.isArray(agent.extracreditpacks)
|
|
597
|
+
// Packs are bought only on an active Pro plan, so only that plan lists them.
|
|
598
|
+
const canBuyPacks = summary.tier === 'pro' && summary.subscription?.status === 'active';
|
|
599
|
+
const packs = canBuyPacks && Array.isArray(agent.extracreditpacks)
|
|
513
600
|
? agent.extracreditpacks.filter(isPlainObject).filter(pack => pack.enabled !== false)
|
|
514
601
|
: [];
|
|
515
602
|
return {
|
|
@@ -537,11 +624,8 @@ export function toAgentDetail(row) {
|
|
|
537
624
|
...(models.length > 0 ? { selectableModels: models } : {}),
|
|
538
625
|
enabledCommands: Array.isArray(row.enabledCommands) ? toStringArray(row.enabledCommands) : null,
|
|
539
626
|
credentials,
|
|
540
|
-
// A required sign-in that is not connected also holds back the setup, so it
|
|
541
|
-
// is listed as missing too.
|
|
542
627
|
missingCredentials: credentials
|
|
543
|
-
.filter(credential => credential.requiredMissing
|
|
544
|
-
.filter(credential => !activeKeys || activeKeys.has(credential.key))
|
|
628
|
+
.filter(credential => credential.requiredMissing)
|
|
545
629
|
.map(({ key, title, oauth }) => ({ key, title, oauth })),
|
|
546
630
|
channels,
|
|
547
631
|
scheduledTasks: summarizeTasks(row.scheduledskills),
|
|
@@ -563,8 +647,11 @@ export function formatSubscriptionLine(subscription, plainMember = false) {
|
|
|
563
647
|
: 'No plan. manage_agent_billing with action subscribe starts one.';
|
|
564
648
|
}
|
|
565
649
|
const parts = [`${subscription.status}, billed ${subscription.billing === 'wallet' ? 'from the wallet' : 'by card'}`];
|
|
566
|
-
if (subscription.amountUsd !== null)
|
|
567
|
-
parts.push(
|
|
650
|
+
if (subscription.amountUsd !== null) {
|
|
651
|
+
parts.push(subscription.status === 'expired' && subscription.billing === 'wallet'
|
|
652
|
+
? `a renew charges ${formatUsd(subscription.amountUsd)} per 30 days`
|
|
653
|
+
: `${formatUsd(subscription.amountUsd)} per 30 days`);
|
|
654
|
+
}
|
|
568
655
|
if (subscription.periodEndsAt) {
|
|
569
656
|
const atPeriodEnd = subscription.atPeriodEnd ?? (subscription.cancelAtPeriodEnd ? 'ends' : 'renews');
|
|
570
657
|
if (subscription.status !== 'active') {
|
|
@@ -599,6 +686,10 @@ function noPlanStartHint(agent) {
|
|
|
599
686
|
? 'Its wallet plan has expired; manage_agent_billing with action renew restarts it.'
|
|
600
687
|
: 'manage_agent_billing with action subscribe pays for a plan and starts the agent.');
|
|
601
688
|
}
|
|
689
|
+
/** An agent's title inside a line of this server's own text: on one line, in a code span it cannot close. */
|
|
690
|
+
export function agentTitleSpan(title) {
|
|
691
|
+
return title.trim() ? quotedSpan(title) : 'Untitled agent';
|
|
692
|
+
}
|
|
602
693
|
export function formatAgentSummaryLines(agent, plainMember = false) {
|
|
603
694
|
const template = agent.template.custom
|
|
604
695
|
? 'custom build'
|
|
@@ -607,23 +698,142 @@ export function formatAgentSummaryLines(agent, plainMember = false) {
|
|
|
607
698
|
? `${agent.status === 5 ? 'The start failed or the agent stopped unexpectedly.' : 'It is not running.'} ${noPlanStartHint(agent)}`
|
|
608
699
|
: agentStatusHint(agent.status, plainMember);
|
|
609
700
|
return [
|
|
610
|
-
`**Agent:** ${agent.title} (\`${agent.guid}\`), ${template}, ${agent.workspace} workspace`,
|
|
701
|
+
`**Agent:** ${agentTitleSpan(agent.title)} (\`${agent.guid}\`), ${template}, ${agent.workspace} workspace`,
|
|
611
702
|
`**Status:** ${describeAgentStatus(agent.status)}. ${hint}`,
|
|
612
703
|
`**Plan:** ${agent.tier ?? 'no tier'}; ${formatSubscriptionLine(agent.subscription, plainMember)}`,
|
|
613
|
-
`**Credits:** ${formatCredits(agent.credits.remaining)} left (
|
|
704
|
+
`**Credits:** ${formatCredits(agent.credits.remaining)} left (${monthlyCreditsText(agent.credits)}, extra ${formatCredits(agent.credits.extra)}, used ${formatCredits(agent.credits.used)})`,
|
|
614
705
|
];
|
|
615
706
|
}
|
|
616
707
|
/** Where an entry the list shortens is read in full. */
|
|
617
708
|
function shortenedNote(key) {
|
|
618
709
|
return ` (its text is long; get_my_agent with entry "${key}" shows it in full)`;
|
|
619
710
|
}
|
|
620
|
-
/**
|
|
621
|
-
export function
|
|
622
|
-
return
|
|
711
|
+
/** Names inside a sentence: a, b and c. */
|
|
712
|
+
export function nameList(names, word) {
|
|
713
|
+
return names.length > 1 ? `${names.slice(0, -1).join(', ')} ${word} ${names[names.length - 1]}` : names.join('');
|
|
714
|
+
}
|
|
715
|
+
// The words of skill, task and credential keys that a capital first letter gets wrong, written as the
|
|
716
|
+
// catalog titles write them, and the acronyms written in capitals. The dashboard makes the names it builds
|
|
717
|
+
// from keys with the same list. Only whole words match: roasit stays Roasit.
|
|
718
|
+
const KEY_WORDS = {
|
|
719
|
+
api: 'API',
|
|
720
|
+
cpc: 'CPC',
|
|
721
|
+
cpm: 'CPM',
|
|
722
|
+
crm: 'CRM',
|
|
723
|
+
csv: 'CSV',
|
|
724
|
+
ctr: 'CTR',
|
|
725
|
+
ga4: 'GA4',
|
|
726
|
+
kpi: 'KPI',
|
|
727
|
+
pdf: 'PDF',
|
|
728
|
+
roas: 'ROAS',
|
|
729
|
+
roi: 'ROI',
|
|
730
|
+
rss: 'RSS',
|
|
731
|
+
seo: 'SEO',
|
|
732
|
+
sms: 'SMS',
|
|
733
|
+
ugc: 'UGC',
|
|
734
|
+
url: 'URL',
|
|
735
|
+
aimodels: 'AI Models',
|
|
736
|
+
appstore: 'App Store',
|
|
737
|
+
facebookpage: 'Facebook Page',
|
|
738
|
+
googleads: 'Google Ads',
|
|
739
|
+
googleplay: 'Google Play',
|
|
740
|
+
hubspot: 'HubSpot',
|
|
741
|
+
linkedin: 'LinkedIn',
|
|
742
|
+
metaads: 'Meta Ads',
|
|
743
|
+
sendgrid: 'SendGrid',
|
|
744
|
+
tiktok: 'TikTok',
|
|
745
|
+
tiktokads: 'TikTok Ads',
|
|
746
|
+
twitterx: 'Twitter / X',
|
|
747
|
+
whatsapp: 'WhatsApp',
|
|
748
|
+
woocommerce: 'WooCommerce',
|
|
749
|
+
wordpress: 'WordPress',
|
|
750
|
+
youtube: 'YouTube',
|
|
751
|
+
ad: 'Ad',
|
|
752
|
+
};
|
|
753
|
+
// English words of two letters that keep a capital first letter only; any other word of one or two
|
|
754
|
+
// letters is an abbreviation and is written in capitals.
|
|
755
|
+
const TITLE_CASE_2L = new Set(['my', 'us', 'we', 'me', 'he', 'an', 'at', 'in', 'on', 'of', 'to', 'by', 'do', 'go', 'if', 'is', 'it', 'no', 'or', 'so', 'up', 'am', 'as', 'be', 'oh', 'ok']);
|
|
756
|
+
/**
|
|
757
|
+
* A name made from a key, as the dashboard makes it, for when there is no title: int-brevo-email reads
|
|
758
|
+
* Brevo Email and ga4-attribution-auditor GA4 Attribution Auditor. known: false leaves the list of brands
|
|
759
|
+
* and acronyms out, for a name the customer typed.
|
|
760
|
+
*/
|
|
761
|
+
export function wordsFromKey(key, { known = true } = {}) {
|
|
762
|
+
return key.replace(/^(int|util)-/, '').replace(/-/g, ' ').replace(/\b\w+\b/g, word => {
|
|
763
|
+
const lower = word.toLowerCase();
|
|
764
|
+
if (known && Object.prototype.hasOwnProperty.call(KEY_WORDS, lower))
|
|
765
|
+
return KEY_WORDS[lower];
|
|
766
|
+
if (word.length <= 2 && !TITLE_CASE_2L.has(lower))
|
|
767
|
+
return word.toUpperCase();
|
|
768
|
+
return `${word.charAt(0).toUpperCase()}${word.slice(1)}`;
|
|
769
|
+
});
|
|
770
|
+
}
|
|
771
|
+
/**
|
|
772
|
+
* A custom skill or scheduled task as people see it, by the name the dashboard makes from its key, with the
|
|
773
|
+
* key the tools take: GA4 Attribution Auditor (`cs-cron-ga4-attribution-auditor`). known is false for a task
|
|
774
|
+
* the customer named. A key that is not plain words shows alone.
|
|
775
|
+
*/
|
|
776
|
+
export function taskLabel(key, known = true) {
|
|
777
|
+
const words = key.replace(/^cs-(cron-)?/, '');
|
|
778
|
+
return /^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(words) ? `${wordsFromKey(words, { known })} (${quotedSpan(key)})` : quotedSpan(key);
|
|
623
779
|
}
|
|
624
|
-
/**
|
|
780
|
+
/** Whether a task's name comes from Wiro's words: one the customer created and named reads as typed. */
|
|
781
|
+
export function taskNamedByWiro(task) {
|
|
782
|
+
return !(task.source === 'user' || task.source === 'user-created' || task.userCreated === true) || (task.ownerSkills?.length ?? 0) > 0;
|
|
783
|
+
}
|
|
784
|
+
/**
|
|
785
|
+
* A skill as people see it, by its catalog title, with the name apply_agent_skills takes: Gmail Check
|
|
786
|
+
* (`int-gmail-check`). Without the title, words made from the name stand in for it.
|
|
787
|
+
*/
|
|
788
|
+
export function skillLabel(name, titles) {
|
|
789
|
+
return `${titles?.get(name) ?? wordsFromKey(name)} (\`${name}\`)`;
|
|
790
|
+
}
|
|
791
|
+
/**
|
|
792
|
+
* The skills a paused task waits for, one from each list, by their titles where titles has them: "A",
|
|
793
|
+
* "A or B", or "A and one of B or C". several is true when more than one skill has to come on.
|
|
794
|
+
*/
|
|
795
|
+
function waitedSkills(groups, titles) {
|
|
796
|
+
const lists = groups.map(group => group.map(name => skillLabel(name, titles))).filter(list => list.length > 0);
|
|
797
|
+
if (lists.length === 0)
|
|
798
|
+
return { text: 'a skill it needs', several: false };
|
|
799
|
+
if (lists.length === 1)
|
|
800
|
+
return { text: nameList(lists[0], 'or'), several: false };
|
|
801
|
+
return { text: nameList(lists.map(list => (list.length === 1 ? list[0] : `one of ${nameList(list, 'or')}`)), 'and'), several: true };
|
|
802
|
+
}
|
|
803
|
+
/**
|
|
804
|
+
* Why a paused task does not run, as a clause that names the skills to turn on (offSkills, one from each
|
|
805
|
+
* list). Its own on/off state stays as it is: a task that is on runs again once they are on, and one that is
|
|
806
|
+
* off also needs turning on.
|
|
807
|
+
*/
|
|
808
|
+
export function skillOffText(task, titles) {
|
|
809
|
+
const waited = waitedSkills(task.offSkills ?? [], titles);
|
|
810
|
+
return task.enabled
|
|
811
|
+
? `it is paused until ${waited.text} ${waited.several ? 'are' : 'is'} on`
|
|
812
|
+
: `it also needs ${waited.text} turned on to run`;
|
|
813
|
+
}
|
|
814
|
+
/** A task that waits for skills (lists, one from each) as a sentence with a space before it: " `key` stays paused until A is on." */
|
|
815
|
+
export function waitingTaskSentence(key, groups, titles, verb = 'stays paused') {
|
|
816
|
+
const waited = waitedSkills(groups, titles);
|
|
817
|
+
return ` ${taskLabel(key)} ${verb} until ${waited.text} ${waited.several ? 'are' : 'is'} on.`;
|
|
818
|
+
}
|
|
819
|
+
/**
|
|
820
|
+
* The paused tasks among these, each as a sentence that names the skills to turn on, with a space before it.
|
|
821
|
+
* A saved credential turns such a task on, but it stays paused until they are on; verb says it otherwise,
|
|
822
|
+
* such as "is paused" for a task the change at hand paused.
|
|
823
|
+
*/
|
|
824
|
+
export function skillOffTasksNote(tasks, titles, verb = 'stays paused') {
|
|
825
|
+
return tasks.filter(task => task.skillOff).map(task => waitingTaskSentence(task.key, task.offSkills ?? [], titles, verb)).join('');
|
|
826
|
+
}
|
|
827
|
+
/**
|
|
828
|
+
* A scheduled task as a list line: name and key, on or off, schedule and description, then shortenedNote if its text
|
|
829
|
+
* was cut. titles names the skills a paused task waits for as people see them.
|
|
830
|
+
*/
|
|
831
|
+
export function formatScheduledTaskLine(task, shortenedNote = '', titles) {
|
|
832
|
+
return `- ${taskLabel(task.key, taskNamedByWiro(task))} ${task.enabled ? 'on' : 'off'}${task.notWritten ? ' (its text is not written yet, so it does not run)' : ''}${task.skillOff ? ` (${skillOffText(task, titles)})` : ''}${task.interval ? `, ${task.interval}` : ''}${task.description ? `: ${quotedSpan(task.description)}` : ''}${task.instructionsTruncated ? shortenedNote : ''}`;
|
|
833
|
+
}
|
|
834
|
+
/** A custom instruction as a list line: name and key, on or off and description, then shortenedNote if its text was cut. */
|
|
625
835
|
export function formatCustomInstructionLine(task, shortenedNote = '') {
|
|
626
|
-
return `-
|
|
836
|
+
return `- ${taskLabel(task.key, taskNamedByWiro(task))} ${task.enabled ? 'on' : 'off'}${task.description ? `: ${quotedSpan(task.description)}` : ''}${task.instructionsTruncated ? shortenedNote : ''}`;
|
|
627
837
|
}
|
|
628
838
|
function formatRate(credits) {
|
|
629
839
|
return credits.toLocaleString('en-US', { maximumFractionDigits: 3 });
|
|
@@ -649,8 +859,11 @@ function formatModelsLine(agent) {
|
|
|
649
859
|
}
|
|
650
860
|
return parts.length > 0 ? `**Models:** ${parts.join(' ')}` : null;
|
|
651
861
|
}
|
|
652
|
-
|
|
862
|
+
/** titles names skills as people see them: the agent's own (activeSkillTitles) and those a paused task waits for (pausedSkillTitles). */
|
|
863
|
+
export function formatAgentDetail(agent, plainMember = false, titles) {
|
|
653
864
|
const lines = formatAgentSummaryLines(agent, plainMember);
|
|
865
|
+
if (agent.lastActivityAt)
|
|
866
|
+
lines.push(`**Last activity:** ${agent.lastActivityAt}`);
|
|
654
867
|
if (agent.pricing) {
|
|
655
868
|
// Today's Starter and Pro prices for this agent's own skills, which can
|
|
656
869
|
// differ from its template's and from the price its plan pays.
|
|
@@ -669,7 +882,7 @@ export function formatAgentDetail(agent, plainMember = false) {
|
|
|
669
882
|
: '**Setup required:** yes');
|
|
670
883
|
}
|
|
671
884
|
if (agent.skills.length > 0)
|
|
672
|
-
lines.push(`**Skills:** ${agent.skills.join(', ')}`);
|
|
885
|
+
lines.push(`**Skills:** ${agent.skills.map(name => skillLabel(name, titles)).join(', ')}`);
|
|
673
886
|
if (agent.channels.length > 0) {
|
|
674
887
|
lines.push(`**Channels:** ${agent.channels.map(channel => `${channel.title} ${channel.enabled ? 'on' : channel.configured ? 'configured' : 'off'}`).join(', ')}`);
|
|
675
888
|
}
|
|
@@ -678,10 +891,10 @@ export function formatAgentDetail(agent, plainMember = false) {
|
|
|
678
891
|
for (const credential of agent.credentials) {
|
|
679
892
|
const state = credential.connected
|
|
680
893
|
? 'connected'
|
|
681
|
-
: credential.
|
|
682
|
-
? '
|
|
683
|
-
: credential.
|
|
684
|
-
? '
|
|
894
|
+
: credential.requiredMissing
|
|
895
|
+
? (credential.oauth ? 'not connected (required)' : 'missing (required)')
|
|
896
|
+
: credential.filled
|
|
897
|
+
? 'filled'
|
|
685
898
|
: 'not set';
|
|
686
899
|
lines.push(`- ${credential.title} (\`${credential.key}\`): ${state}${credential.optional ? ', optional' : ''}`);
|
|
687
900
|
}
|
|
@@ -689,7 +902,7 @@ export function formatAgentDetail(agent, plainMember = false) {
|
|
|
689
902
|
if (agent.scheduledTasks.length > 0) {
|
|
690
903
|
lines.push('', '### Scheduled tasks', '');
|
|
691
904
|
for (const task of agent.scheduledTasks)
|
|
692
|
-
lines.push(formatScheduledTaskLine(task, shortenedNote(task.key)));
|
|
905
|
+
lines.push(formatScheduledTaskLine(task, shortenedNote(task.key), titles));
|
|
693
906
|
}
|
|
694
907
|
if (agent.customInstructions.length > 0) {
|
|
695
908
|
lines.push('', '### Custom instructions', '');
|
|
@@ -738,7 +951,7 @@ export async function readAgentDetail(client, guid, signal) {
|
|
|
738
951
|
const body = requireApiSuccess(await client.post('/UserAgent/Detail', { guid }, signal), 'The agent could not be read.');
|
|
739
952
|
const rows = Array.isArray(body.useragents) ? body.useragents.filter(isPlainObject) : [];
|
|
740
953
|
if (!rows[0])
|
|
741
|
-
throw new Error(
|
|
954
|
+
throw new Error(AGENT_NOT_FOUND_TEXT);
|
|
742
955
|
return rows[0];
|
|
743
956
|
}
|
|
744
957
|
// Every Detail read prices the agent, so polling stays slower than for tasks.
|
|
@@ -762,12 +975,25 @@ export async function waitForAgentToSettle(client, guid, waitSeconds, extra, fal
|
|
|
762
975
|
elapsedMs: result.elapsedMs,
|
|
763
976
|
};
|
|
764
977
|
}
|
|
978
|
+
/** The credential that holds the Wiro project an agent runs models with. */
|
|
979
|
+
export const WIRO_PROJECT_CREDENTIAL = 'wiro';
|
|
980
|
+
/** The call that connects a Wiro project to an agent. It shows the project first; lead says why it comes now. */
|
|
981
|
+
export function bindProjectStep(agentGuid, lead) {
|
|
982
|
+
return {
|
|
983
|
+
tool: 'bind_agent_project',
|
|
984
|
+
arguments: { agent_guid: agentGuid },
|
|
985
|
+
reason: `${lead} This shows the project first and changes nothing without confirm: true, and no key is needed.`,
|
|
986
|
+
};
|
|
987
|
+
}
|
|
765
988
|
/** The call that starts on the first missing credential, with every argument it needs. */
|
|
766
989
|
export function missingCredentialStep(agent) {
|
|
767
990
|
const missing = agent.missingCredentials[0];
|
|
768
991
|
if (!missing)
|
|
769
992
|
return undefined;
|
|
770
993
|
const keys = agent.missingCredentials.map(item => item.key).join(', ');
|
|
994
|
+
if (missing.key === WIRO_PROJECT_CREDENTIAL) {
|
|
995
|
+
return bindProjectStep(agent.guid, `Provide the missing credentials (${keys}), starting with ${missing.title}.`);
|
|
996
|
+
}
|
|
771
997
|
return missing.oauth
|
|
772
998
|
? {
|
|
773
999
|
tool: 'connect_agent_oauth',
|
|
@@ -825,9 +1051,16 @@ export function nextStepForAgent(agent, waitSeconds, plainMember = false) {
|
|
|
825
1051
|
}
|
|
826
1052
|
// Refusals known to leave the wallet untouched.
|
|
827
1053
|
const PRE_CHARGE_CODES = new Set([95, 96, 97, 99, 101, 102, 103, 104, 105, 106, 107, 108, 109]);
|
|
1054
|
+
const WALLET_NOT_READ = /could not retrieve wallet balance/i;
|
|
1055
|
+
/** Whether a refusal says the wallet could not be read, which says nothing about what it holds. */
|
|
1056
|
+
export function isWalletNotRead(error) {
|
|
1057
|
+
return error instanceof ApiResultError && WALLET_NOT_READ.test(error.message);
|
|
1058
|
+
}
|
|
1059
|
+
/** The words after such a refusal. No funds are asked for: the wallet may hold plenty. */
|
|
1060
|
+
export const WALLET_NOT_READ_NOTE = 'Wiro could not read the balance just now. That is not a low balance, and nothing was charged. Try again in a moment; if it keeps saying so, get_account shows the wallet.';
|
|
828
1061
|
const PRE_CHARGE_REFUSALS = [
|
|
829
1062
|
/insufficient wallet balance/i,
|
|
830
|
-
|
|
1063
|
+
WALLET_NOT_READ,
|
|
831
1064
|
/wallet deduction failed/i,
|
|
832
1065
|
/subscription (is )?already active/i,
|
|
833
1066
|
/already on (the )?(pro|starter) tier/i,
|
|
@@ -844,6 +1077,9 @@ const PRE_CHARGE_REFUSALS = [
|
|
|
844
1077
|
/switch to (the )?(team|personal) context|belongs to a different team/i,
|
|
845
1078
|
/^request parameter \[/i,
|
|
846
1079
|
/mutually exclusive|agent terms acceptance|customskills must be|skill key may only contain/i,
|
|
1080
|
+
/^unknown skill: /i,
|
|
1081
|
+
/^the tier change could not be saved\./i,
|
|
1082
|
+
/^we couldn't (schedule|undo) the cancellation\./i,
|
|
847
1083
|
/enabledchannels is not accepted|credentials must be an object|credential field|is missing required fields/i,
|
|
848
1084
|
/chat mode is not accepted|is managed by (wiro|the connection flow)|^agent-[a-z-]+$/i,
|
|
849
1085
|
/^failed to deploy agent|failed to save communication channel settings|failed to save custom skill/i,
|
|
@@ -856,15 +1092,35 @@ export function isPreChargeRefusal(error) {
|
|
|
856
1092
|
return true;
|
|
857
1093
|
return PRE_CHARGE_REFUSALS.some(pattern => pattern.test(error.message.trim()));
|
|
858
1094
|
}
|
|
1095
|
+
const CHARGED_START = 'The wallet was charged ';
|
|
1096
|
+
const CHARGED_END = /, but the (tier change|renewal) did not finish\. Please contact support and do not try again\.$/;
|
|
1097
|
+
/**
|
|
1098
|
+
* Whether a result:false answer says what the wallet paid. Its sentence is the
|
|
1099
|
+
* whole outcome: it is shown as it is, and the call is not repeated.
|
|
1100
|
+
*/
|
|
1101
|
+
export function isKnownPaidOutcome(error) {
|
|
1102
|
+
if (!(error instanceof ApiResultError))
|
|
1103
|
+
return false;
|
|
1104
|
+
const message = error.message.trim();
|
|
1105
|
+
return message.startsWith(CHARGED_START) && CHARGED_END.test(message);
|
|
1106
|
+
}
|
|
1107
|
+
/**
|
|
1108
|
+
* Whether a result:false answer carries code 110. Its answer is the whole outcome:
|
|
1109
|
+
* the change is reported as failed, what the agent and the wallet show is read by
|
|
1110
|
+
* hand, and the call is not repeated.
|
|
1111
|
+
*/
|
|
1112
|
+
export function isKnownFailedChange(error) {
|
|
1113
|
+
return error instanceof ApiResultError && error.codes.some(code => Number(code) === 110);
|
|
1114
|
+
}
|
|
859
1115
|
/**
|
|
860
1116
|
* After a paid request was sent, whether it may still have gone through.
|
|
861
|
-
* Only the known refusals
|
|
862
|
-
*
|
|
863
|
-
* leaves it open.
|
|
1117
|
+
* Only the known refusals, an answer that says what the wallet paid or carries
|
|
1118
|
+
* code 110, and client errors (other than a timeout or rate limit) settle it; any
|
|
1119
|
+
* other answer, a network failure or a server error leaves it open.
|
|
864
1120
|
*/
|
|
865
1121
|
export function outcomeUnknown(error) {
|
|
866
1122
|
if (error instanceof ApiResultError)
|
|
867
|
-
return !isPreChargeRefusal(error);
|
|
1123
|
+
return !isPreChargeRefusal(error) && !isKnownPaidOutcome(error) && !isKnownFailedChange(error);
|
|
868
1124
|
if (error instanceof WiroApiError) {
|
|
869
1125
|
return error.status >= 500 || error.status === 408 || error.status === 429;
|
|
870
1126
|
}
|
|
@@ -894,4 +1150,14 @@ export function settledStatusAdvice(status, plainMember = false, agent) {
|
|
|
894
1150
|
return agentStatusHint(status, plainMember);
|
|
895
1151
|
}
|
|
896
1152
|
}
|
|
1153
|
+
/** Advice for a read, which cannot tell whether a start came first: a stopped agent gets what holds now. */
|
|
1154
|
+
export function readStatusAdvice(agent, plainMember = false) {
|
|
1155
|
+
if (agent.status !== 0)
|
|
1156
|
+
return settledStatusAdvice(agent.status, plainMember, agent);
|
|
1157
|
+
if (plainMember)
|
|
1158
|
+
return `The agent is stopped. On this team agent, ${TEAM_AGENT_MANAGERS} can start it.`;
|
|
1159
|
+
return startNeedsPlan(agent)
|
|
1160
|
+
? `The agent is stopped. ${noPlanStartHint(agent)}`
|
|
1161
|
+
: 'The agent is stopped. control_agent with action start starts it.';
|
|
1162
|
+
}
|
|
897
1163
|
//# sourceMappingURL=user-agent.js.map
|