@everyai/cli 0.11.0 → 0.12.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 CHANGED
@@ -43,7 +43,7 @@ Codex's repo-scoped marketplace location is `.agents/plugins/marketplace.json`.
43
43
  The CLI talks to the same Every MCP server (`admin-mcp.every.ai`) and inherits its full tool surface automatically — new tools appear with no CLI upgrade. What the CLI adds:
44
44
 
45
45
  - **Portability** — one install + one login covers every agent and machine context; remote-MCP config is per-host, per-format, and often impossible in CI.
46
- - **Safety gates** — reads run freely; writes require `--yes`; destructive actions (sends, deletes, voids, payments) additionally require `--allow-destructive`; `--read-only` (or `EVERY_READ_ONLY=1`) locks everything else out. Classifications are enforced locally — including for tools whose server annotations are too optimistic. `every tool call deal_outreach` is destructive for all of its actions because it can send a deal's message. The short commands gate by action: `every deal outreach edit` and `cancel` are writes, and `every deal outreach send` is destructive. `update_deal` is a write. When trusted MCP metadata asks for an ordinary-write text confirmation, the CLI forwards the server's exact phrase and retries once.
46
+ - **Safety gates** — reads run freely; writes require `--yes`; destructive actions (sends, deletes, voids, payments) additionally require `--allow-destructive`; `--read-only` (or `EVERY_READ_ONLY=1`) locks everything else out. Classifications are enforced locally — including for tools whose server annotations are too optimistic. `every tool call deal_outreach` is destructive for all of its actions because it can send a deal's message. The short commands gate by action: `every deal outreach draft`, `redraft`, `edit` and `cancel` are writes, and `every deal outreach send` is destructive. `update_deal` is a write. When trusted MCP metadata asks for an ordinary-write text confirmation, the CLI forwards the server's exact phrase and retries once.
47
47
  - **Deterministic output** — a stable `--json` envelope and exit-code taxonomy an agent can parse and branch on.
48
48
 
49
49
  ## Commands
@@ -94,8 +94,10 @@ every deal update <deal_id> [--name <name>] [--value <n>] [--owner <owner>]
94
94
  [--person-id <id> | --company-id <id>] [--add-member <id> ...] [--remove-member <id> ...]
95
95
  # write: needs --yes; a flag you leave out does not change
96
96
  every deal move <deal_id> <stage> # write: needs --yes; stage = key or label
97
+ every deal outreach draft <deal_id> [--channel email|linkedin|instagram] --yes
98
+ every deal outreach redraft <deal_id> --draft-version <v> [--instruction <text>] --yes
97
99
  every deal outreach edit <deal_id> [--subject <text>] [--body <text> | --body-file <path>]
98
- [--recipient <email>] [--thread <id|new>] # write: needs --yes
100
+ [--recipient <email>] [--thread <id|new>] [--cc <email> ... | --clear-cc] [--draft-version <v>] --yes
99
101
  every deal outreach send <deal_id> [--draft-version <v>]
100
102
  # destructive: needs --yes --allow-destructive;
101
103
  # the owner then approves the send in Every
@@ -1,4 +1,4 @@
1
- import { randomUUID } from 'node:crypto';
1
+ import { createHash, randomUUID } from 'node:crypto';
2
2
  import { readFile } from 'node:fs/promises';
3
3
  import { approvalsUrlForBaseUrl, resolveBaseUrl } from '../lib/config.js';
4
4
  import { CliError } from '../lib/errors.js';
@@ -280,8 +280,31 @@ async function readBody(opts) {
280
280
  throw usage(`Could not read --body-file: ${detail}`);
281
281
  }
282
282
  }
283
+ export async function outreachDraftCommand(dealId, opts) {
284
+ const args = { deal_id: requireId(dealId, '<deal_id>'), action: 'draft', ...(opts.channel ? { channel: opts.channel } : {}) };
285
+ await withApprovalLink(opts, () => executeToolCall('deal_outreach', opts, async () => args, undefined, { level: 'write' }));
286
+ }
287
+ // A name-based UUIDv8 keeps the same operation ID when a CLI process restarts after a timeout.
288
+ function redraftOperationId(dealId, draftVersion, instruction) {
289
+ const hash = createHash('sha256').update(JSON.stringify(['every-deal-redraft', dealId, draftVersion, instruction])).digest();
290
+ hash[6] = (hash[6] & 0x0f) | 0x80;
291
+ hash[8] = (hash[8] & 0x3f) | 0x80;
292
+ const hex = hash.toString('hex', 0, 16);
293
+ return [hex.slice(0, 8), hex.slice(8, 12), hex.slice(12, 16), hex.slice(16, 20), hex.slice(20)].join('-');
294
+ }
295
+ export async function outreachRedraftCommand(dealId, opts) {
296
+ const id = requireId(dealId, '<deal_id>');
297
+ const version = requireId(opts.draftVersion, '--draft-version');
298
+ const args = {
299
+ deal_id: id, action: 'redraft', draft_version: version, instruction: opts.instruction ?? '',
300
+ operation_id: opts.operationId ?? redraftOperationId(id, version, opts.instruction ?? ''),
301
+ };
302
+ await withApprovalLink(opts, () => executeToolCall('deal_outreach', opts, async () => args, undefined, { level: 'write' }));
303
+ }
283
304
  export async function outreachEditCommand(dealId, opts = {}) {
284
305
  const id = requireId(dealId, '<deal_id>');
306
+ if (opts.cc && opts.clearCc)
307
+ throw usage('Use --cc or --clear-cc, not both');
285
308
  const body = await readBody(opts);
286
309
  const changes = {};
287
310
  if (opts.subject !== undefined)
@@ -292,13 +315,18 @@ export async function outreachEditCommand(dealId, opts = {}) {
292
315
  changes.recipient = opts.recipient.trim();
293
316
  if (opts.thread !== undefined)
294
317
  changes.thread_id = opts.thread.trim();
318
+ if (opts.cc || opts.clearCc)
319
+ changes.cc = opts.cc ?? [];
295
320
  if (Object.keys(changes).length === 0) {
296
- throw usage('Nothing to change. Pass at least one of --subject, --body, --body-file, --recipient or --thread');
321
+ throw usage('Nothing to change. Pass at least one of --cc, --clear-cc, --subject, --body, --body-file, --recipient or --thread');
297
322
  }
298
323
  const draftVersion = nonEmpty(opts.draftVersion);
299
- const args = { deal_id: id, action: 'edit', ...changes, ...(draftVersion ? { draft_version: draftVersion } : {}) };
324
+ const args = async () => ({
325
+ deal_id: id, action: 'edit', ...changes,
326
+ draft_version: draftVersion ?? (await readDraft(id, opts)).draft_version,
327
+ });
300
328
  // Edit changes only the stored draft: an ordinary write, as `deal move` is.
301
- await withApprovalLink(opts, () => executeToolCall('deal_outreach', opts, async () => args, undefined, { level: 'write' }));
329
+ await withApprovalLink(opts, () => executeToolCall('deal_outreach', opts, args, undefined, { level: 'write' }));
302
330
  }
303
331
  export async function outreachCancelCommand(dealId, opts = {}) {
304
332
  const id = requireId(dealId, '<deal_id>');
@@ -321,6 +349,10 @@ export function outreachPreviewLines(preview) {
321
349
  return [
322
350
  `Channel: ${preview.channel}`,
323
351
  `To: ${preview.to ?? 'the recipient on the draft'}`,
352
+ ...(preview.channel === 'email' ? [
353
+ `Delivery: ${preview.delivery_mode ?? 'unavailable'}`,
354
+ `Cc: ${preview.cc_emails === null ? 'unavailable' : preview.cc_emails.join(', ') || '(none)'}`,
355
+ ] : []),
324
356
  ...(preview.subject !== null ? [`Subject: ${preview.subject}`] : []),
325
357
  `Draft version: ${preview.draft_version}`,
326
358
  '',
@@ -342,6 +374,8 @@ async function readDraft(dealId, opts) {
342
374
  const text = (key) => (typeof fields[key] === 'string' ? fields[key] : null);
343
375
  return {
344
376
  channel: text('channel') ?? 'message',
377
+ delivery_mode: text('delivery_mode'),
378
+ cc_emails: Array.isArray(fields.cc_emails) && fields.cc_emails.every((v) => typeof v === 'string') ? fields.cc_emails : null,
345
379
  to: text('to') ?? text('profile_url') ?? text('recipient_name'),
346
380
  subject: text('subject'),
347
381
  body: text('body'),
@@ -60,7 +60,7 @@ export function conventionsBlock() {
60
60
  ' destructive: requires typed confirmation interactively or --yes --allow-destructive non-interactively',
61
61
  ' ai-mediated: server-enforced read-only, but gated because it routes through Every AI; prefer deterministic tools',
62
62
  ' human approval: never auto-retries; approve in Every, then re-run the identical command',
63
- ' short commands gate by action: deal outreach edit and cancel are writes, deal outreach send is destructive',
63
+ ' short commands gate by action: deal outreach draft, redraft, edit and cancel are writes, deal outreach send is destructive',
64
64
  ' (every tool call deal_outreach stays destructive for every action)',
65
65
  '',
66
66
  'Short commands:',
package/dist/index.js CHANGED
@@ -7,7 +7,7 @@ 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 { approvalsCommand, companyCreateCommand, companyListCommand, companyViewCommand, dealCreateCommand, dealUpdateCommand, dealViewCommand, outreachCancelCommand, outreachEditCommand, outreachSendCommand, personCreateCommand, personViewCommand, } from './commands/crm.js';
10
+ import { approvalsCommand, companyCreateCommand, companyListCommand, companyViewCommand, dealCreateCommand, dealUpdateCommand, dealViewCommand, outreachCancelCommand, outreachEditCommand, outreachDraftCommand, outreachRedraftCommand, outreachSendCommand, personCreateCommand, personViewCommand, } from './commands/crm.js';
11
11
  import { dealListCommand, dealMoveCommand, dealStagesCommand, invoiceCreateCommand, invoiceListCommand, invoiceSendCommand, personListCommand, proposalSendCommand, recipientsGetCommand, recipientsSetCommand, } from './commands/aliases.js';
12
12
  import { skillsInstallCommand, skillsListCommand } from './commands/skills.js';
13
13
  import { CliError } from './lib/errors.js';
@@ -445,7 +445,24 @@ withGlobalOptions(withToolExecutionOptions(dealCommand
445
445
  removeMember: opts.removeMember,
446
446
  });
447
447
  });
448
- const outreachCommand = withToolExecutionOptions(withGlobalOptions(dealCommand.command('outreach').description("Edit, send, or cancel a deal's message")));
448
+ const outreachCommand = withToolExecutionOptions(withGlobalOptions(dealCommand.command('outreach').description("Draft, redraft, edit, send, or cancel a deal's message")));
449
+ withGlobalOptions(withToolExecutionOptions(outreachCommand.command('draft')
450
+ .description("Write and save an unsent message on the deal's primary channel")
451
+ .argument('<deal_id>', 'deal id')
452
+ .option('--channel <channel>', 'use email, linkedin, or instagram instead of the primary channel'))).action(async (dealId, _options, command) => {
453
+ const opts = command.optsWithGlobals();
454
+ await outreachDraftCommand(dealId, { ...executionOptions(opts), channel: opts.channel });
455
+ });
456
+ withGlobalOptions(withToolExecutionOptions(outreachCommand.command('redraft')
457
+ .description('Rewrite the saved draft using optional instructions')
458
+ .argument('<deal_id>', 'deal id')
459
+ .requiredOption('--draft-version <v>', 'version from every deal view <deal_id> --draft')
460
+ .option('--instruction <text>', 'what to change in the message, audience, or email thread')
461
+ .option('--operation-id <uuid>', 'reuse an existing operation ID; identical commands use a stable ID automatically'))).action(async (dealId, _options, command) => {
462
+ const opts = command.optsWithGlobals();
463
+ await outreachRedraftCommand(dealId, { ...executionOptions(opts), draftVersion: opts.draftVersion,
464
+ instruction: opts.instruction, operationId: opts.operationId });
465
+ });
449
466
  withGlobalOptions(withToolExecutionOptions(outreachCommand
450
467
  .command('edit')
451
468
  .description("Edit the deal's unsent draft (write: needs --yes)")
@@ -454,8 +471,10 @@ withGlobalOptions(withToolExecutionOptions(outreachCommand
454
471
  .option('--body <text>', 'new message text')
455
472
  .option('--body-file <path>', 'read the new message text from a file; - for stdin')
456
473
  .option('--recipient <email>', 'new email recipient: an email of a Person on the deal')
474
+ .option('--cc <email>', 'replace the email Cc list; repeat for each address', collectOption)
475
+ .option('--clear-cc', 'remove all copied recipients')
457
476
  .option('--thread <id>', 'Gmail thread of the deal to reply in, or "new"')
458
- .option('--draft-version <v>', 'refuse the edit if the draft changed since this version'))).action(async (dealId, _options, command) => {
477
+ .option('--draft-version <v>', 'bind the edit to this version; otherwise read the current version first'))).action(async (dealId, _options, command) => {
459
478
  const opts = command.optsWithGlobals();
460
479
  await outreachEditCommand(dealId, {
461
480
  ...executionOptions(opts),
@@ -464,6 +483,8 @@ withGlobalOptions(withToolExecutionOptions(outreachCommand
464
483
  bodyFile: opts.bodyFile,
465
484
  recipient: opts.recipient,
466
485
  thread: opts.thread,
486
+ cc: opts.cc,
487
+ clearCc: opts.clearCc,
467
488
  draftVersion: opts.draftVersion,
468
489
  });
469
490
  });
@@ -154,7 +154,7 @@ function overrideClassification(name) {
154
154
  */
155
155
  export function shortCommandNote(name) {
156
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). ' +
157
+ return 'The short commands gate by action: draft, redraft, edit and cancel are writes (--yes). ' +
158
158
  '`every deal outreach send` is destructive (--yes --allow-destructive). `every tool call deal_outreach` stays destructive for every action.';
159
159
  }
160
160
  return undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everyai/cli",
3
- "version": "0.11.0",
3
+ "version": "0.12.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/Every-AI-Inc/everyai-cli.git"
@@ -2,7 +2,7 @@
2
2
  name: use-every
3
3
  description: Drive the Every AI CLI (`every`) to manage the user's service business — invoices, People, Companies, proposals, deals, pipeline, payments, services, custom fields, and scheduled tasks. Use when the user asks “who owes me money?”, wants a lead or deal follow-up, asks to sign up for Every, asks to look up, create, update, convert, or send a business record, mentions their Every workspace, or asks an agent to run their deals and prospects on a schedule.
4
4
  metadata:
5
- every-skill-version: "8"
5
+ every-skill-version: "9"
6
6
  ---
7
7
 
8
8
  # Use Every
@@ -86,7 +86,9 @@ Each short command calls one tool, with the same `--json` envelope, exit codes a
86
86
  | `every deal create (--person-id <id> \| --company-id <id> \| --name <name> [--email <email>]) [--stage] [--deal-name] [--value] [--owner] [--goal]` | `create_deal` |
87
87
  | `every deal update <deal_id> [--name] [--value] [--owner] [--person-id \| --company-id] [--add-member <id>] [--remove-member <id>]` | `update_deal` |
88
88
  | `every deal list [--attention <reason>] [--stale-days <n>] [--owner <owner> \| --mine] [--since <time>] [--sort last_activity_at]` | `list_deals` |
89
- | `every deal outreach edit <deal_id> [--subject] [--body \| --body-file <path>] [--recipient <email>] [--thread <id\|new>]` | `deal_outreach` `action=edit` (write) |
89
+ | `every deal outreach draft <deal_id> [--channel email\|linkedin\|instagram]` | `deal_outreach` `action=draft` (write) |
90
+ | `every deal outreach redraft <deal_id> --draft-version <v> [--instruction <text>]` | `deal_outreach` `action=redraft` (write) |
91
+ | `every deal outreach edit <deal_id> [--subject] [--body \| --body-file <path>] [--recipient <email>] [--thread <id\|new>] [--cc <email> ... \| --clear-cc] [--draft-version <v>]` | `deal_outreach` `action=edit` (write) |
90
92
  | `every deal outreach send <deal_id> [--draft-version <v>]` | `view_deal` draft, then `deal_outreach` `action=send` (destructive) |
91
93
  | `every deal outreach cancel <deal_id> --send-id <id>` | `deal_outreach` `action=cancel` (write) |
92
94
  | `every approvals [--all]` | `get_workspace_priorities` `pending_approvals` |
@@ -354,7 +356,7 @@ Find the deals that need work in one call per filter, with no per-deal poll:
354
356
 
355
357
  ## 4. Follow-ups
356
358
 
357
- 1. Edit the deal's draft: `deal_outreach` with `action=edit`, `deal_id`, and the changed `subject`, `body`, `recipient` or `thread_id`. `recipient` must be an email address of a Person on the deal. `thread_id` is a Gmail thread of the deal, or `new` for a new email. A LinkedIn or Instagram draft has only a `body`. The result gives the new `draft_version`.
359
+ 1. To write a new message on the primary channel, run `every deal outreach draft`. To revise a saved message, read its `draft_version` and run `every deal outreach redraft` with that version and the owner's instruction. Repeat the identical redraft command to resume after a timeout. For a manual edit: `deal_outreach` with `action=edit`, `deal_id`, and the changed `subject`, `body`, `recipient`, `cc` or `thread_id`. Email edits require the version from the draft read. `recipient` must be an email address of a Person on the deal. `thread_id` is a Gmail thread of the deal, or `new` for a new email. A LinkedIn or Instagram draft has only a `body`. The result gives the new `draft_version`.
358
360
  2. Request the send: `deal_outreach` with `action=send`, `deal_id` and that `draft_version`, and nothing else. The send goes out on the draft's channel: email, LinkedIn direct message or Instagram direct message. Only the deal owner can send. It records on the plan step and on the timeline.
359
361
  3. Use `action=cancel` with `send_id` (from `view_deal` `auto_sends`) to stop a scheduled or held send. Every has no send at a time that you choose.
360
362
  4. If the tool refuses the channel (the owner's social account is not connected, or the channel has no integrated send), it returns the text. Put the text and the recipient in the run report for the owner to send by hand. After the owner confirms that it went out, record it with `log_deal_activity` (`completed_plan_action_id` set to the step id, `plan_action_outcome=completed`).