@everyai/cli 0.9.0 → 0.10.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 +35 -5
- package/dist/commands/aliases.js +219 -15
- package/dist/commands/crm.js +453 -0
- package/dist/commands/docs.js +6 -0
- package/dist/commands/policy.js +4 -1
- package/dist/commands/tools.js +2 -2
- package/dist/index.js +227 -6
- package/dist/lib/config.js +9 -0
- package/dist/lib/mcp.js +43 -2
- package/dist/lib/policy.js +32 -0
- package/dist/lib/table.js +41 -0
- package/package.json +1 -1
- package/skills/use-every/SKILL.md +150 -7
package/dist/index.js
CHANGED
|
@@ -7,7 +7,8 @@ import { authStatusCommand, loginCommand, logoutCommand, orgCommand, orgSwitchCo
|
|
|
7
7
|
import { policyExplainCommand } from './commands/policy.js';
|
|
8
8
|
import { signupCommand, signupCompleteCommand, signupStatusCommand, } from './commands/signup.js';
|
|
9
9
|
import { toolCallCommand, toolsDescribeCommand, toolsListCommand, } from './commands/tools.js';
|
|
10
|
-
import {
|
|
10
|
+
import { approvalsCommand, companyCreateCommand, companyListCommand, companyViewCommand, dealCreateCommand, dealUpdateCommand, dealViewCommand, outreachCancelCommand, outreachEditCommand, outreachSendCommand, personCreateCommand, personViewCommand, } from './commands/crm.js';
|
|
11
|
+
import { dealListCommand, dealMoveCommand, dealStagesCommand, invoiceCreateCommand, invoiceListCommand, invoiceSendCommand, personListCommand, proposalSendCommand, recipientsGetCommand, recipientsSetCommand, } from './commands/aliases.js';
|
|
11
12
|
import { skillsInstallCommand, skillsListCommand } from './commands/skills.js';
|
|
12
13
|
import { CliError } from './lib/errors.js';
|
|
13
14
|
import { deprecationNote, emit, emitError } from './lib/output.js';
|
|
@@ -180,6 +181,19 @@ function withToolExecutionOptions(cmd) {
|
|
|
180
181
|
.option('--read-only', 'deny write, destructive, and AI-mediated tool calls')
|
|
181
182
|
.option('--timeout <secs>', 'tool call timeout in seconds');
|
|
182
183
|
}
|
|
184
|
+
/** The tool execution options of a parsed command, for the short commands. */
|
|
185
|
+
function executionOptions(opts) {
|
|
186
|
+
return {
|
|
187
|
+
json: opts.json,
|
|
188
|
+
staging: opts.staging,
|
|
189
|
+
// Commander represents --no-cache as cache:false.
|
|
190
|
+
noCache: opts.cache === false,
|
|
191
|
+
yes: opts.yes,
|
|
192
|
+
allowDestructive: opts.allowDestructive,
|
|
193
|
+
readOnly: opts.readOnly,
|
|
194
|
+
timeout: opts.timeout,
|
|
195
|
+
};
|
|
196
|
+
}
|
|
183
197
|
const TOOL_CALL_HELP = [
|
|
184
198
|
'',
|
|
185
199
|
'Fastest full-tool argument forms:',
|
|
@@ -331,9 +345,15 @@ const dealCommand = withToolExecutionOptions(withGlobalOptions(program
|
|
|
331
345
|
withGlobalOptions(withToolExecutionOptions(dealCommand
|
|
332
346
|
.command('list')
|
|
333
347
|
.description('List deals')
|
|
334
|
-
.option('--stage <s>', 'deal stage filter')
|
|
348
|
+
.option('--stage <s>', 'deal stage filter: a key or label from `every deal stages`')
|
|
335
349
|
.option('--search <q>', 'deal search query')
|
|
336
|
-
.option('--limit <n>', 'maximum number of deals to return')
|
|
350
|
+
.option('--limit <n>', 'maximum number of deals to return')
|
|
351
|
+
.option('--attention <reason>', 'only deals that need work: needs_reply, step_due, draft_ready, stale; repeat or use a comma list', collectOption)
|
|
352
|
+
.option('--stale-days <n>', 'only deals with no activity for at least this many days')
|
|
353
|
+
.option('--owner <owner>', 'only deals owned by: me, a teammate\'s email, or a user id')
|
|
354
|
+
.option('--mine', 'only your deals (same as --owner me)')
|
|
355
|
+
.option('--since <time>', 'only deals changed at or after this ISO 8601 time')
|
|
356
|
+
.option('--sort <field>', 'sort order: last_activity_at'))).action(async (_options, command) => {
|
|
337
357
|
const opts = command.optsWithGlobals();
|
|
338
358
|
await dealListCommand({
|
|
339
359
|
json: opts.json,
|
|
@@ -346,13 +366,116 @@ withGlobalOptions(withToolExecutionOptions(dealCommand
|
|
|
346
366
|
stage: opts.stage,
|
|
347
367
|
search: opts.search,
|
|
348
368
|
limit: opts.limit,
|
|
369
|
+
attention: opts.attention,
|
|
370
|
+
staleDays: opts.staleDays,
|
|
371
|
+
owner: opts.owner,
|
|
372
|
+
mine: opts.mine,
|
|
373
|
+
since: opts.since,
|
|
374
|
+
sort: opts.sort,
|
|
349
375
|
});
|
|
350
376
|
});
|
|
377
|
+
withGlobalOptions(withToolExecutionOptions(dealCommand
|
|
378
|
+
.command('view')
|
|
379
|
+
.description('Show one deal')
|
|
380
|
+
.argument('<deal_id>', 'deal id')
|
|
381
|
+
.option('--plan', 'add every open plan step')
|
|
382
|
+
.option('--draft', 'add the unsent draft and its draft version')
|
|
383
|
+
.option('--auto-sends', 'add scheduled and recent sends'))).action(async (dealId, _options, command) => {
|
|
384
|
+
const opts = command.optsWithGlobals();
|
|
385
|
+
await dealViewCommand(dealId, { ...executionOptions(opts), plan: opts.plan, draft: opts.draft, autoSends: opts.autoSends });
|
|
386
|
+
});
|
|
387
|
+
withGlobalOptions(withToolExecutionOptions(dealCommand
|
|
388
|
+
.command('create')
|
|
389
|
+
.description('Create a deal with an existing Person or Company, or with a new Person')
|
|
390
|
+
.option('--person-id <id>', 'existing Person id')
|
|
391
|
+
.option('--company-id <id>', 'existing Company id')
|
|
392
|
+
.option('--name <name>', 'name of a new Person (when no id is given)')
|
|
393
|
+
.option('--email <email>', 'email of a new Person')
|
|
394
|
+
.option('--stage <s>', 'stage key or label (default: Lead)')
|
|
395
|
+
.option('--deal-name <name>', 'what the deal is called, for example "Q3 brand refresh"')
|
|
396
|
+
.option('--value <amount>', 'expected value in the workspace currency')
|
|
397
|
+
.option('--owner <owner>', 'deal owner: me, a teammate\'s email, or a user id')
|
|
398
|
+
.option('--goal <text>', 'what the deal sells, in one or two sentences'))).action(async (_options, command) => {
|
|
399
|
+
const opts = command.optsWithGlobals();
|
|
400
|
+
await dealCreateCommand({
|
|
401
|
+
...executionOptions(opts),
|
|
402
|
+
personId: opts.personId,
|
|
403
|
+
companyId: opts.companyId,
|
|
404
|
+
name: opts.name,
|
|
405
|
+
email: opts.email,
|
|
406
|
+
stage: opts.stage,
|
|
407
|
+
dealName: opts.dealName,
|
|
408
|
+
value: opts.value,
|
|
409
|
+
owner: opts.owner,
|
|
410
|
+
goal: opts.goal,
|
|
411
|
+
});
|
|
412
|
+
});
|
|
413
|
+
withGlobalOptions(withToolExecutionOptions(dealCommand
|
|
414
|
+
.command('update')
|
|
415
|
+
.description('Change deal fields; a flag you leave out does not change')
|
|
416
|
+
.argument('<deal_id>', 'deal id')
|
|
417
|
+
.option('--name <name>', 'what the deal is called; "" resets the default name')
|
|
418
|
+
.option('--value <amount>', 'expected value; 0 clears it')
|
|
419
|
+
.option('--owner <owner>', 'new owner: me, a teammate\'s email, or a user id')
|
|
420
|
+
.option('--person-id <id>', 'set the deal\'s Person')
|
|
421
|
+
.option('--company-id <id>', 'set the deal\'s Company')
|
|
422
|
+
.option('--add-member <id>', 'add a teammate (user id or email); repeatable', collectOption)
|
|
423
|
+
.option('--remove-member <id>', 'remove a teammate (user id or email); waits for approval in Every; repeatable', collectOption))).action(async (dealId, _options, command) => {
|
|
424
|
+
const opts = command.optsWithGlobals();
|
|
425
|
+
await dealUpdateCommand(dealId, {
|
|
426
|
+
...executionOptions(opts),
|
|
427
|
+
name: opts.name,
|
|
428
|
+
value: opts.value,
|
|
429
|
+
owner: opts.owner,
|
|
430
|
+
personId: opts.personId,
|
|
431
|
+
companyId: opts.companyId,
|
|
432
|
+
addMember: opts.addMember,
|
|
433
|
+
removeMember: opts.removeMember,
|
|
434
|
+
});
|
|
435
|
+
});
|
|
436
|
+
const outreachCommand = withToolExecutionOptions(withGlobalOptions(dealCommand.command('outreach').description("Edit, send, or cancel a deal's message")));
|
|
437
|
+
withGlobalOptions(withToolExecutionOptions(outreachCommand
|
|
438
|
+
.command('edit')
|
|
439
|
+
.description("Edit the deal's unsent draft (write: needs --yes)")
|
|
440
|
+
.argument('<deal_id>', 'deal id')
|
|
441
|
+
.option('--subject <text>', 'new email subject')
|
|
442
|
+
.option('--body <text>', 'new message text')
|
|
443
|
+
.option('--body-file <path>', 'read the new message text from a file; - for stdin')
|
|
444
|
+
.option('--recipient <email>', 'new email recipient: an email of a Person on the deal')
|
|
445
|
+
.option('--thread <id>', 'Gmail thread of the deal to reply in, or "new"')
|
|
446
|
+
.option('--draft-version <v>', 'refuse the edit if the draft changed since this version'))).action(async (dealId, _options, command) => {
|
|
447
|
+
const opts = command.optsWithGlobals();
|
|
448
|
+
await outreachEditCommand(dealId, {
|
|
449
|
+
...executionOptions(opts),
|
|
450
|
+
subject: opts.subject,
|
|
451
|
+
body: opts.body,
|
|
452
|
+
bodyFile: opts.bodyFile,
|
|
453
|
+
recipient: opts.recipient,
|
|
454
|
+
thread: opts.thread,
|
|
455
|
+
draftVersion: opts.draftVersion,
|
|
456
|
+
});
|
|
457
|
+
});
|
|
458
|
+
withGlobalOptions(withToolExecutionOptions(outreachCommand
|
|
459
|
+
.command('send')
|
|
460
|
+
.description("Preview, confirm, and send the deal's draft; the owner approves it in Every (destructive)")
|
|
461
|
+
.argument('<deal_id>', 'deal id')
|
|
462
|
+
.option('--draft-version <v>', 'send this exact draft version without reading the draft first'))).action(async (dealId, _options, command) => {
|
|
463
|
+
const opts = command.optsWithGlobals();
|
|
464
|
+
await outreachSendCommand(dealId, { ...executionOptions(opts), draftVersion: opts.draftVersion });
|
|
465
|
+
});
|
|
466
|
+
withGlobalOptions(withToolExecutionOptions(outreachCommand
|
|
467
|
+
.command('cancel')
|
|
468
|
+
.description('Stop a scheduled or held send (write: needs --yes)')
|
|
469
|
+
.argument('<deal_id>', 'deal id')
|
|
470
|
+
.requiredOption('--send-id <id>', 'send id from every deal view <deal_id> --auto-sends'))).action(async (dealId, _options, command) => {
|
|
471
|
+
const opts = command.optsWithGlobals();
|
|
472
|
+
await outreachCancelCommand(dealId, { ...executionOptions(opts), sendId: opts.sendId });
|
|
473
|
+
});
|
|
351
474
|
withGlobalOptions(withToolExecutionOptions(dealCommand
|
|
352
475
|
.command('move')
|
|
353
476
|
.description('Move a deal to another stage')
|
|
354
477
|
.argument('<deal_id>', 'deal id')
|
|
355
|
-
.argument('<stage>', 'target stage'))).action(async (dealId, stage, _options, command) => {
|
|
478
|
+
.argument('<stage>', 'target stage: a key or label from `every deal stages`'))).action(async (dealId, stage, _options, command) => {
|
|
356
479
|
const opts = command.optsWithGlobals();
|
|
357
480
|
await dealMoveCommand(dealId, stage, {
|
|
358
481
|
json: opts.json,
|
|
@@ -364,6 +487,20 @@ withGlobalOptions(withToolExecutionOptions(dealCommand
|
|
|
364
487
|
timeout: opts.timeout,
|
|
365
488
|
});
|
|
366
489
|
});
|
|
490
|
+
withGlobalOptions(withToolExecutionOptions(dealCommand
|
|
491
|
+
.command('stages')
|
|
492
|
+
.description("List this workspace's pipeline stages (label, key, role, criteria)"))).action(async (_options, command) => {
|
|
493
|
+
const opts = command.optsWithGlobals();
|
|
494
|
+
await dealStagesCommand({
|
|
495
|
+
json: opts.json,
|
|
496
|
+
staging: opts.staging,
|
|
497
|
+
noCache: opts.noCache,
|
|
498
|
+
yes: opts.yes,
|
|
499
|
+
allowDestructive: opts.allowDestructive,
|
|
500
|
+
readOnly: opts.readOnly,
|
|
501
|
+
timeout: opts.timeout,
|
|
502
|
+
});
|
|
503
|
+
});
|
|
367
504
|
/**
|
|
368
505
|
* Register `list` under `every person` and under the hidden, deprecated
|
|
369
506
|
* `every contact` alias ("contact" is retired vocabulary: the product's people
|
|
@@ -391,10 +528,94 @@ function addPersonListCommand(parent, deprecation) {
|
|
|
391
528
|
});
|
|
392
529
|
});
|
|
393
530
|
}
|
|
394
|
-
|
|
531
|
+
const personCommand = withToolExecutionOptions(withGlobalOptions(program
|
|
395
532
|
.command('person')
|
|
396
533
|
.description('Work with People')
|
|
397
|
-
.addHelpText('after', TOOL_CALL_HELP)))
|
|
534
|
+
.addHelpText('after', TOOL_CALL_HELP)));
|
|
535
|
+
addPersonListCommand(personCommand);
|
|
536
|
+
withGlobalOptions(withToolExecutionOptions(personCommand
|
|
537
|
+
.command('view')
|
|
538
|
+
.description('Show one Person')
|
|
539
|
+
.argument('<person_id>', 'Person id'))).action(async (personId, _options, command) => {
|
|
540
|
+
await personViewCommand(personId, executionOptions(command.optsWithGlobals()));
|
|
541
|
+
});
|
|
542
|
+
withGlobalOptions(withToolExecutionOptions(personCommand
|
|
543
|
+
.command('create')
|
|
544
|
+
.description('Create a Person (write: needs --yes); search with every person list first')
|
|
545
|
+
.requiredOption('--name <name>', 'full name')
|
|
546
|
+
.option('--email <email>', 'primary email')
|
|
547
|
+
.option('--phone <phone>', 'primary phone')
|
|
548
|
+
.option('--job-title <title>', 'job title')
|
|
549
|
+
.option('--company <name>', 'employer name as text')
|
|
550
|
+
.option('--location <text>', 'location')
|
|
551
|
+
.option('--headline <text>', 'short headline')
|
|
552
|
+
.option('--industry <text>', 'industry')
|
|
553
|
+
.option('--address <text>', 'postal address')
|
|
554
|
+
.option('--notes <text>', 'notes'))).action(async (_options, command) => {
|
|
555
|
+
const opts = command.optsWithGlobals();
|
|
556
|
+
await personCreateCommand({
|
|
557
|
+
...executionOptions(opts),
|
|
558
|
+
name: opts.name,
|
|
559
|
+
email: opts.email,
|
|
560
|
+
phone: opts.phone,
|
|
561
|
+
jobTitle: opts.jobTitle,
|
|
562
|
+
company: opts.company,
|
|
563
|
+
location: opts.location,
|
|
564
|
+
headline: opts.headline,
|
|
565
|
+
industry: opts.industry,
|
|
566
|
+
address: opts.address,
|
|
567
|
+
notes: opts.notes,
|
|
568
|
+
});
|
|
569
|
+
});
|
|
570
|
+
const companyCommand = withToolExecutionOptions(withGlobalOptions(program
|
|
571
|
+
.command('company')
|
|
572
|
+
.description('Work with Companies')
|
|
573
|
+
.addHelpText('after', TOOL_CALL_HELP)));
|
|
574
|
+
withGlobalOptions(withToolExecutionOptions(companyCommand
|
|
575
|
+
.command('list')
|
|
576
|
+
.description('List Companies')
|
|
577
|
+
.option('--search <q>', 'search Companies by name, email, phone, or industry')
|
|
578
|
+
.option('--limit <n>', 'maximum number of Companies to return (up to 100)'))).action(async (_options, command) => {
|
|
579
|
+
const opts = command.optsWithGlobals();
|
|
580
|
+
await companyListCommand({ ...executionOptions(opts), search: opts.search, limit: opts.limit });
|
|
581
|
+
});
|
|
582
|
+
withGlobalOptions(withToolExecutionOptions(companyCommand
|
|
583
|
+
.command('view')
|
|
584
|
+
.description('Show one Company')
|
|
585
|
+
.argument('<company_id>', 'Company id'))).action(async (companyId, _options, command) => {
|
|
586
|
+
await companyViewCommand(companyId, executionOptions(command.optsWithGlobals()));
|
|
587
|
+
});
|
|
588
|
+
withGlobalOptions(withToolExecutionOptions(companyCommand
|
|
589
|
+
.command('create')
|
|
590
|
+
.description('Create a Company (write: needs --yes); search with every company list first')
|
|
591
|
+
.requiredOption('--name <name>', 'Company name')
|
|
592
|
+
.option('--email <email>', 'primary email')
|
|
593
|
+
.option('--phone <phone>', 'primary phone')
|
|
594
|
+
.option('--website <url>', 'website')
|
|
595
|
+
.option('--industry <text>', 'industry')
|
|
596
|
+
.option('--address <text>', 'postal address')
|
|
597
|
+
.option('--lead-source <text>', 'where the Company came from')
|
|
598
|
+
.option('--notes <text>', 'notes'))).action(async (_options, command) => {
|
|
599
|
+
const opts = command.optsWithGlobals();
|
|
600
|
+
await companyCreateCommand({
|
|
601
|
+
...executionOptions(opts),
|
|
602
|
+
name: opts.name,
|
|
603
|
+
email: opts.email,
|
|
604
|
+
phone: opts.phone,
|
|
605
|
+
website: opts.website,
|
|
606
|
+
industry: opts.industry,
|
|
607
|
+
address: opts.address,
|
|
608
|
+
leadSource: opts.leadSource,
|
|
609
|
+
notes: opts.notes,
|
|
610
|
+
});
|
|
611
|
+
});
|
|
612
|
+
withGlobalOptions(withToolExecutionOptions(program
|
|
613
|
+
.command('approvals')
|
|
614
|
+
.description('List requests that wait for approval in Every (read only)')
|
|
615
|
+
.option('--all', 'show every request of the last 24 hours, from every connection'))).action(async (_options, command) => {
|
|
616
|
+
const opts = command.optsWithGlobals();
|
|
617
|
+
await approvalsCommand({ ...executionOptions(opts), all: opts.all });
|
|
618
|
+
});
|
|
398
619
|
addPersonListCommand(withToolExecutionOptions(withGlobalOptions(program
|
|
399
620
|
.command('contact', { hidden: true })
|
|
400
621
|
.description('Deprecated alias for every person'))), '`every contact` is deprecated; use `every person`.');
|
package/dist/lib/config.js
CHANGED
|
@@ -18,6 +18,9 @@ export const STAGING_BASE_URL = 'https://admin-mcp-staging.up.railway.app';
|
|
|
18
18
|
/** Where an org admin mints, inspects and revokes org API keys. */
|
|
19
19
|
export const PROD_API_KEYS_URL = 'https://app.every.ai/settings/api-keys';
|
|
20
20
|
export const STAGING_API_KEYS_URL = 'https://app.staging.every.ai/settings/api-keys';
|
|
21
|
+
/** Where a person approves or cancels the requests that wait for approval. */
|
|
22
|
+
export const PROD_APPROVALS_URL = 'https://app.every.ai/settings/approvals';
|
|
23
|
+
export const STAGING_APPROVALS_URL = 'https://app.staging.every.ai/settings/approvals';
|
|
21
24
|
/**
|
|
22
25
|
* Resolve the MCP base URL to target.
|
|
23
26
|
*
|
|
@@ -57,3 +60,9 @@ export function apiKeysUrlForBaseUrl(baseUrl) {
|
|
|
57
60
|
? STAGING_API_KEYS_URL
|
|
58
61
|
: PROD_API_KEYS_URL;
|
|
59
62
|
}
|
|
63
|
+
/** The web-app page where a person approves the requests that a given MCP base URL holds. */
|
|
64
|
+
export function approvalsUrlForBaseUrl(baseUrl) {
|
|
65
|
+
return environmentNameForBaseUrl(baseUrl) === 'staging'
|
|
66
|
+
? STAGING_APPROVALS_URL
|
|
67
|
+
: PROD_APPROVALS_URL;
|
|
68
|
+
}
|
package/dist/lib/mcp.js
CHANGED
|
@@ -123,6 +123,48 @@ async function unauthorizedError(response, baseUrl, token) {
|
|
|
123
123
|
}
|
|
124
124
|
return new CliError(apiKeyRejectedMessage(baseUrl, reason), ExitCode.AUTH, 'auth');
|
|
125
125
|
}
|
|
126
|
+
/**
|
|
127
|
+
* Explain a non-401 refusal with the server's own words when it sent them.
|
|
128
|
+
*
|
|
129
|
+
* admin-mcp refuses some requests on purpose with an RFC 6750 style body,
|
|
130
|
+
* for example `{"error":"workspace_not_selected","error_description":"..."}`
|
|
131
|
+
* (403) or `{"error":"org_binding_unavailable",...}` (503). The description
|
|
132
|
+
* already tells the user what to do, so the CLI shows it. A body that is not
|
|
133
|
+
* that shape keeps the generic "HTTP <status>" message. The exit code and the
|
|
134
|
+
* machine `code` come from the status only, so scripts see no change.
|
|
135
|
+
*/
|
|
136
|
+
async function httpStatusError(response, method, url) {
|
|
137
|
+
const classified = classifyHttpStatus(response.status);
|
|
138
|
+
let raw = '';
|
|
139
|
+
try {
|
|
140
|
+
raw = await response.text();
|
|
141
|
+
}
|
|
142
|
+
catch {
|
|
143
|
+
// A body that cannot be read falls back to the status message.
|
|
144
|
+
}
|
|
145
|
+
const reason = authErrorReasonFromBody(raw);
|
|
146
|
+
const serverError = serverErrorCode(raw);
|
|
147
|
+
const details = { http_status: response.status };
|
|
148
|
+
if (serverError !== undefined)
|
|
149
|
+
details.server_error = serverError;
|
|
150
|
+
const message = reason === undefined
|
|
151
|
+
? `MCP ${method} failed for ${url}: HTTP ${response.status}`
|
|
152
|
+
: `${reason} (HTTP ${response.status})`;
|
|
153
|
+
return new CliError(message, classified.exitCode, classified.code, details);
|
|
154
|
+
}
|
|
155
|
+
function serverErrorCode(raw) {
|
|
156
|
+
try {
|
|
157
|
+
const body = JSON.parse(raw);
|
|
158
|
+
if (!body || typeof body !== 'object' || Array.isArray(body))
|
|
159
|
+
return undefined;
|
|
160
|
+
const value = body.error;
|
|
161
|
+
// A machine code only: short and without spaces, so it is safe in --json.
|
|
162
|
+
return typeof value === 'string' && /^[a-z0-9_.-]{1,64}$/i.test(value) ? value : undefined;
|
|
163
|
+
}
|
|
164
|
+
catch {
|
|
165
|
+
return undefined;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
126
168
|
export async function mcpCall(baseUrl, token, method, params = {}, { timeoutMs = DEFAULT_MCP_TIMEOUT_MS } = {}) {
|
|
127
169
|
const url = mcpUrl(baseUrl);
|
|
128
170
|
let response;
|
|
@@ -154,8 +196,7 @@ export async function mcpCall(baseUrl, token, method, params = {}, { timeoutMs =
|
|
|
154
196
|
throw await unauthorizedError(response, baseUrl, token);
|
|
155
197
|
}
|
|
156
198
|
if (!response.ok) {
|
|
157
|
-
|
|
158
|
-
throw new CliError(`MCP ${method} failed for ${url}: HTTP ${response.status}`, classified.exitCode, classified.code);
|
|
199
|
+
throw await httpStatusError(response, method, url);
|
|
159
200
|
}
|
|
160
201
|
return parseJsonRpcResponse(await response.text(), params);
|
|
161
202
|
}
|
package/dist/lib/policy.js
CHANGED
|
@@ -93,6 +93,25 @@ function overrideClassification(name) {
|
|
|
93
93
|
reason: 'set_deal_name renames a deal, or clears the name back to the system default; pin write tier regardless of server annotation drift.',
|
|
94
94
|
};
|
|
95
95
|
}
|
|
96
|
+
// Agent CRM automation tools (2026-11). update_deal replaces set_deal_name and
|
|
97
|
+
// set_deal_value_estimate. deal_outreach edits, sends, schedules and cancels
|
|
98
|
+
// the deal's outbound message. Its name does not match send_ or cancel_, and
|
|
99
|
+
// one tool has one local tier, so the send action sets the tier for all
|
|
100
|
+
// actions.
|
|
101
|
+
if (name === 'update_deal') {
|
|
102
|
+
return {
|
|
103
|
+
level: 'write',
|
|
104
|
+
source: 'override',
|
|
105
|
+
reason: 'update_deal changes the name, value estimate, owner, party, members or goal of a deal; pin write tier regardless of server annotation drift.',
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
if (name === 'deal_outreach') {
|
|
109
|
+
return {
|
|
110
|
+
level: 'destructive',
|
|
111
|
+
source: 'override',
|
|
112
|
+
reason: 'deal_outreach can send or schedule a message to real recipients on email, LinkedIn or Instagram; sending has external impact, so every action needs destructive confirmation.',
|
|
113
|
+
};
|
|
114
|
+
}
|
|
96
115
|
if (name === 'link_deal_item') {
|
|
97
116
|
return {
|
|
98
117
|
level: 'write',
|
|
@@ -127,6 +146,19 @@ function overrideClassification(name) {
|
|
|
127
146
|
}
|
|
128
147
|
return undefined;
|
|
129
148
|
}
|
|
149
|
+
/**
|
|
150
|
+
* How the short commands gate a tool that has more than one action. The tool
|
|
151
|
+
* keeps one tier for `every tool call`, because that path cannot know the
|
|
152
|
+
* action before the call. A short command knows its action, so it gates by
|
|
153
|
+
* action.
|
|
154
|
+
*/
|
|
155
|
+
export function shortCommandNote(name) {
|
|
156
|
+
if (name === 'deal_outreach') {
|
|
157
|
+
return 'The short commands gate by action: `every deal outreach edit` and `every deal outreach cancel` are writes (--yes). ' +
|
|
158
|
+
'`every deal outreach send` is destructive (--yes --allow-destructive). `every tool call deal_outreach` stays destructive for every action.';
|
|
159
|
+
}
|
|
160
|
+
return undefined;
|
|
161
|
+
}
|
|
130
162
|
export function classify(tool) {
|
|
131
163
|
const overridden = overrideClassification(tool.name);
|
|
132
164
|
if (overridden)
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plain-text tables for human output, in the same layout as `every tools list`
|
|
3
|
+
* and `every deal stages`: a header row, a dash row, then one row per record.
|
|
4
|
+
* The last column is not padded. A cell longer than its column width ends in
|
|
5
|
+
* "...".
|
|
6
|
+
*/
|
|
7
|
+
/** One line of text: whitespace collapses, and a long value ends in "...". */
|
|
8
|
+
export function cell(value, max = 60) {
|
|
9
|
+
if (value === null || value === undefined)
|
|
10
|
+
return '';
|
|
11
|
+
const text = String(value).replace(/\s+/g, ' ').trim();
|
|
12
|
+
return text.length > max ? `${text.slice(0, Math.max(0, max - 3))}...` : text;
|
|
13
|
+
}
|
|
14
|
+
export function renderTable(columns, rows) {
|
|
15
|
+
const widths = columns.map((column, index) => {
|
|
16
|
+
const longest = Math.max(column.header.length, ...rows.map((row) => (row[index] ?? '').length));
|
|
17
|
+
return column.max === undefined ? longest : Math.min(column.max, longest);
|
|
18
|
+
});
|
|
19
|
+
const last = columns.length - 1;
|
|
20
|
+
const line = (cells) => cells
|
|
21
|
+
.map((value, index) => {
|
|
22
|
+
const text = cell(value, columns[index].max ?? Number.MAX_SAFE_INTEGER);
|
|
23
|
+
return index === last ? text : text.padEnd(widths[index]);
|
|
24
|
+
})
|
|
25
|
+
.join(' ')
|
|
26
|
+
.trimEnd();
|
|
27
|
+
return [
|
|
28
|
+
line(columns.map((column) => column.header)),
|
|
29
|
+
line(widths.map((width) => '-'.repeat(width))),
|
|
30
|
+
...rows.map(line),
|
|
31
|
+
].join('\n');
|
|
32
|
+
}
|
|
33
|
+
/** An ISO time as `YYYY-MM-DD HH:MM` (UTC), or the value as given when it does not parse. */
|
|
34
|
+
export function shortTime(value) {
|
|
35
|
+
if (typeof value !== 'string' || !value.trim())
|
|
36
|
+
return '';
|
|
37
|
+
const time = Date.parse(value);
|
|
38
|
+
if (Number.isNaN(time))
|
|
39
|
+
return value;
|
|
40
|
+
return new Date(time).toISOString().slice(0, 16).replace('T', ' ');
|
|
41
|
+
}
|