@everyai/cli 0.8.0 → 0.9.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 +6 -2
- package/dist/commands/aliases.js +148 -14
- package/dist/commands/docs.js +8 -1
- package/dist/commands/tools.js +42 -6
- package/dist/index.js +84 -32
- package/dist/lib/output.js +8 -0
- package/dist/lib/policy.js +20 -3
- package/dist/lib/recipients.js +60 -0
- package/package.json +1 -1
- package/skills/use-every/SKILL.md +28 -14
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@ One-shot invoice example with inline args:
|
|
|
18
18
|
```bash
|
|
19
19
|
every invoice list --status overdue --json
|
|
20
20
|
every tool call create_invoice \
|
|
21
|
-
--arg command='{"operation_id":"<uuid>","party":{"kind":"company","id":"
|
|
21
|
+
--arg command='{"operation_id":"<uuid>","party":{"kind":"company","id":"<company_id>"},"line_items":[{"description":"Strategy work","quantity":1,"unit_price":1500}]}' \
|
|
22
22
|
--yes \
|
|
23
23
|
--json
|
|
24
24
|
```
|
|
@@ -67,16 +67,20 @@ every tool call <name> [--args file.json|-] [--arg k=v ...] [--yes] [--allow-des
|
|
|
67
67
|
|
|
68
68
|
# Curated aliases (same gates, nicer flags)
|
|
69
69
|
every invoice list [--status <s>] [--search <q>] [--limit <n>]
|
|
70
|
+
every invoice create (--company <name> | --person <name> | --company-id <id> | --person-id <id>) --amount <n>
|
|
71
|
+
# write: needs --yes
|
|
70
72
|
every invoice send <invoice_id> # destructive: needs --yes --allow-destructive
|
|
71
73
|
every deal list [--stage <s>] [--search <q>]
|
|
72
74
|
every deal move <deal_id> <stage> # write: needs --yes
|
|
73
|
-
every
|
|
75
|
+
every person list [--search <q>] # People
|
|
74
76
|
|
|
75
77
|
# Teach your coding agent to use all of this well
|
|
76
78
|
every skills install claude # → .claude/skills/use-every/
|
|
77
79
|
every skills install codex # → .agents/skills/use-every/
|
|
78
80
|
```
|
|
79
81
|
|
|
82
|
+
Deprecated aliases still work and print a one-line note to stderr: `every contact list` (use `every person list`) and `every invoice create --client <name>` / `--client-id <id>` (use `--company`, `--company-id` or `--person-id`). They are hidden from help and `every docs`.
|
|
83
|
+
|
|
80
84
|
## Signing up
|
|
81
85
|
|
|
82
86
|
`every signup` creates an Every account, or signs an existing user in, through a single browser authorization. It never opens a separate sign-up page and never waits for Enter, so a coding agent can run it on the user's behalf without a TTY:
|
package/dist/commands/aliases.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { randomUUID } from 'node:crypto';
|
|
2
2
|
import { CliError } from '../lib/errors.js';
|
|
3
3
|
import { ExitCode } from '../lib/exit-codes.js';
|
|
4
|
+
import { documentKind, preservedExclusions, record, recipientBinding, recipientLines } from '../lib/recipients.js';
|
|
4
5
|
import { executeToolCall, invokeToolCall, } from './tools.js';
|
|
5
6
|
const INVOICE_STATUSES = new Set(['draft', 'issued', 'void']);
|
|
6
7
|
const PAYMENT_STATUSES = new Set(['unpaid', 'paid', 'overdue', 'partial']);
|
|
@@ -190,20 +191,24 @@ export function parseClientCandidates(result) {
|
|
|
190
191
|
...parseClientCandidatesFromText(textFromContent(result.content)),
|
|
191
192
|
]);
|
|
192
193
|
}
|
|
193
|
-
|
|
194
|
+
const PARTY_ID_FLAG = {
|
|
195
|
+
company: '--company-id',
|
|
196
|
+
person: '--person-id',
|
|
197
|
+
};
|
|
198
|
+
function partyCandidatesMessage(kind, query, candidates) {
|
|
194
199
|
return [
|
|
195
|
-
`Multiple ${
|
|
200
|
+
`Multiple ${kind === 'person' ? 'People' : 'Companies'} matching "${query}".`,
|
|
196
201
|
...candidates.map((candidate) => `${candidate.client_id} ${candidate.name}`),
|
|
197
|
-
|
|
202
|
+
`Re-run with ${PARTY_ID_FLAG[kind]} <id>`,
|
|
198
203
|
].join('\n');
|
|
199
204
|
}
|
|
200
|
-
// --client is the deprecated alias for --company (the
|
|
201
|
-
//
|
|
205
|
+
// --client is the deprecated alias for --company (the CLI's older word for the
|
|
206
|
+
// invoice recipient); --person resolves via the People half of the same schema.
|
|
202
207
|
function selectParty(opts) {
|
|
203
208
|
const companyName = nonEmpty(opts.company) ?? nonEmpty(opts.client);
|
|
204
209
|
const personName = nonEmpty(opts.person);
|
|
205
210
|
if (companyName && personName) {
|
|
206
|
-
throw new CliError('Use only one of --company
|
|
211
|
+
throw new CliError('Use only one of --company or --person to resolve the invoice recipient', ExitCode.USAGE, 'usage');
|
|
207
212
|
}
|
|
208
213
|
if (personName)
|
|
209
214
|
return { kind: 'person', name: personName };
|
|
@@ -211,14 +216,52 @@ function selectParty(opts) {
|
|
|
211
216
|
return { kind: 'company', name: companyName };
|
|
212
217
|
return undefined;
|
|
213
218
|
}
|
|
214
|
-
|
|
219
|
+
function selectPartyId(opts) {
|
|
220
|
+
const given = [];
|
|
221
|
+
const companyId = nonEmpty(opts.companyId);
|
|
222
|
+
const personId = nonEmpty(opts.personId);
|
|
215
223
|
const clientId = nonEmpty(opts.clientId);
|
|
224
|
+
if (companyId)
|
|
225
|
+
given.push({ kind: 'company', id: companyId, flag: '--company-id' });
|
|
226
|
+
if (personId)
|
|
227
|
+
given.push({ kind: 'person', id: personId, flag: '--person-id' });
|
|
228
|
+
if (clientId)
|
|
229
|
+
given.push({ kind: undefined, id: clientId, flag: '--client-id' });
|
|
230
|
+
if (given.length > 1) {
|
|
231
|
+
throw new CliError(`Use only one of --company-id or --person-id (got ${given.map((entry) => entry.flag).join(' and ')})`, ExitCode.USAGE, 'usage');
|
|
232
|
+
}
|
|
233
|
+
return given[0];
|
|
234
|
+
}
|
|
235
|
+
async function resolveClient(opts, partyName) {
|
|
236
|
+
const partyId = selectPartyId(opts);
|
|
216
237
|
const selector = selectParty(opts);
|
|
217
|
-
if (
|
|
218
|
-
|
|
238
|
+
if (partyId) {
|
|
239
|
+
if (partyId.kind && selector && selector.kind !== partyId.kind) {
|
|
240
|
+
throw new CliError(`${partyId.flag} names a ${partyId.kind}; use ${PARTY_ID_FLAG[selector.kind]} for a ${selector.kind}`, ExitCode.USAGE, 'usage');
|
|
241
|
+
}
|
|
242
|
+
return {
|
|
243
|
+
client_id: partyId.id,
|
|
244
|
+
kind: partyId.kind ?? selector?.kind ?? 'company',
|
|
245
|
+
name: selector?.name ?? null,
|
|
246
|
+
};
|
|
219
247
|
}
|
|
220
248
|
if (!selector) {
|
|
221
|
-
|
|
249
|
+
if (partyName) {
|
|
250
|
+
const matches = [];
|
|
251
|
+
for (const kind of ['company', 'person']) {
|
|
252
|
+
const tool = kind === 'company' ? 'list_companies' : 'list_people';
|
|
253
|
+
const result = await invokeToolCall(tool, opts, async () => ({ query: partyName }));
|
|
254
|
+
matches.push(...parseClientCandidates(result).map((candidate) => ({ ...candidate, kind })));
|
|
255
|
+
}
|
|
256
|
+
if (matches.length === 1)
|
|
257
|
+
return matches[0];
|
|
258
|
+
throw new CliError(matches.length === 0 ? `No Person or Company matching "${partyName}".` : [
|
|
259
|
+
`Multiple People or Companies match "${partyName}".`,
|
|
260
|
+
...matches.map((candidate) => `${candidate.kind} ${candidate.client_id} ${candidate.name}`),
|
|
261
|
+
'Re-run with --company-id <id> or --person-id <id>.',
|
|
262
|
+
].join('\n'), ExitCode.NOT_FOUND, 'not_found', { candidates: matches });
|
|
263
|
+
}
|
|
264
|
+
throw new CliError('One of --company, --person, --company-id, or --person-id is required', ExitCode.USAGE, 'usage');
|
|
222
265
|
}
|
|
223
266
|
const tool = selector.kind === 'person' ? 'list_people' : 'list_companies';
|
|
224
267
|
const label = selector.kind;
|
|
@@ -232,7 +275,7 @@ async function resolveClient(opts) {
|
|
|
232
275
|
if (candidates.length === 0) {
|
|
233
276
|
throw new CliError(`No ${label} matching "${selector.name}". Run: every tool call ${tool} --json`, ExitCode.NOT_FOUND, 'not_found');
|
|
234
277
|
}
|
|
235
|
-
throw new CliError(partyCandidatesMessage(
|
|
278
|
+
throw new CliError(partyCandidatesMessage(selector.kind, selector.name, candidates), ExitCode.NOT_FOUND, 'not_found', { candidates });
|
|
236
279
|
}
|
|
237
280
|
export async function invoiceListCommand(opts = {}) {
|
|
238
281
|
const args = {};
|
|
@@ -243,7 +286,99 @@ export async function invoiceListCommand(opts = {}) {
|
|
|
243
286
|
await executeToolCall('list_invoices', opts, async () => args);
|
|
244
287
|
}
|
|
245
288
|
export async function invoiceSendCommand(invoiceId, opts = {}) {
|
|
246
|
-
await
|
|
289
|
+
await documentSendCommand('invoice', invoiceId, opts);
|
|
290
|
+
}
|
|
291
|
+
export async function proposalSendCommand(proposalId, opts = {}) {
|
|
292
|
+
await documentSendCommand('proposal', proposalId, opts);
|
|
293
|
+
}
|
|
294
|
+
async function documentSendCommand(kind, id, opts) {
|
|
295
|
+
if (opts.expectDigest !== undefined && !/^[a-f0-9]{64}$/.test(opts.expectDigest)) {
|
|
296
|
+
throw new CliError('--expect-digest must be the 64-character digest from the approved preview.', ExitCode.USAGE, 'usage');
|
|
297
|
+
}
|
|
298
|
+
let preview = {};
|
|
299
|
+
let binding;
|
|
300
|
+
await executeToolCall(`send_${kind}`, opts, async () => ({ [`${kind}_id`]: id, recipients: binding }), (data) => ({ ...data, preview }), {
|
|
301
|
+
recipientConfirmation: true,
|
|
302
|
+
beforeConfirmation: async () => {
|
|
303
|
+
const result = await invokeToolCall('preview_document_send', opts, async () => ({ document_kind: kind, document_id: id }));
|
|
304
|
+
preview = record(result.structured_content);
|
|
305
|
+
if (preview.document_id !== id || preview.document_kind !== kind) {
|
|
306
|
+
throw new CliError('The server returned a preview for a different document or kind. No document was sent.', ExitCode.GENERIC, 'send_preview_mismatch');
|
|
307
|
+
}
|
|
308
|
+
binding = recipientBinding(preview.recipients);
|
|
309
|
+
process.stderr.write(`${recipientLines(preview)}\n`);
|
|
310
|
+
if (opts.expectDigest !== undefined && binding.digest !== opts.expectDigest) {
|
|
311
|
+
throw new CliError('The recipient digest does not match --expect-digest. Review these recipients and get approval before you send again.', ExitCode.GENERIC, 'send_preparation_stale', { expected_digest: opts.expectDigest, actual_digest: binding.digest });
|
|
312
|
+
}
|
|
313
|
+
},
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
function recipientPartyArgs(party, kind) {
|
|
317
|
+
return { party_kind: party.kind, party_id: party.client_id, document_kind: kind, kind };
|
|
318
|
+
}
|
|
319
|
+
export async function recipientsGetCommand(party, opts = {}) {
|
|
320
|
+
const kind = documentKind(opts.kind);
|
|
321
|
+
const resolved = await resolveClient(opts, party);
|
|
322
|
+
await executeToolCall('get_recipient_defaults', opts, async () => recipientPartyArgs(resolved, kind), undefined, undefined, (data) => recipientLines(record(data.structured_content)));
|
|
323
|
+
}
|
|
324
|
+
function resolveRecipientMethod(value, methods) {
|
|
325
|
+
const matches = methods.filter((method) => method.id === value ||
|
|
326
|
+
[method.delivery_address, method.normalized_value, method.value].some((address) => typeof address === 'string' && address.toLowerCase() === value.toLowerCase()));
|
|
327
|
+
if (matches.length !== 1 || typeof matches[0].id !== 'string') {
|
|
328
|
+
throw new CliError(matches.length > 1
|
|
329
|
+
? `Multiple eligible methods match "${value}". Use a method ID.`
|
|
330
|
+
: `No eligible email method matches "${value}". Run every recipients get first.`, ExitCode.USAGE, 'usage', { candidates: matches });
|
|
331
|
+
}
|
|
332
|
+
return matches[0].id;
|
|
333
|
+
}
|
|
334
|
+
export async function recipientsSetCommand(party, opts = {}) {
|
|
335
|
+
const kind = documentKind(opts.kind);
|
|
336
|
+
const to = nonEmpty(opts.to);
|
|
337
|
+
if (!to)
|
|
338
|
+
throw new CliError('--to is required', ExitCode.USAGE, 'usage');
|
|
339
|
+
if (opts.clearCc && opts.cc?.length) {
|
|
340
|
+
throw new CliError('Use --cc or --clear-cc, not both.', ExitCode.USAGE, 'usage');
|
|
341
|
+
}
|
|
342
|
+
let args = {};
|
|
343
|
+
await executeToolCall('set_recipient_defaults', opts, async () => args, undefined, {
|
|
344
|
+
beforeConfirmation: async () => {
|
|
345
|
+
const resolved = await resolveClient(opts, party);
|
|
346
|
+
const partyArgs = recipientPartyArgs(resolved, kind);
|
|
347
|
+
const defaults = record((await invokeToolCall('get_recipient_defaults', opts, async () => partyArgs)).structured_content);
|
|
348
|
+
if (!Number.isInteger(defaults.version) || Number(defaults.version) < 0 || !Array.isArray(defaults.eligible_methods)) {
|
|
349
|
+
throw new CliError('The server returned invalid recipient defaults. No defaults were changed.');
|
|
350
|
+
}
|
|
351
|
+
const noneIds = preservedExclusions(defaults);
|
|
352
|
+
const methods = defaults.eligible_methods.map(record);
|
|
353
|
+
const toId = resolveRecipientMethod(to, methods);
|
|
354
|
+
const currentCc = record(defaults.effective).cc_method_ids ?? defaults.cc_method_ids;
|
|
355
|
+
if (opts.cc === undefined && !opts.clearCc && !Array.isArray(currentCc)) {
|
|
356
|
+
throw new CliError('The current CC recipients are unavailable. Use --cc or --clear-cc explicitly.');
|
|
357
|
+
}
|
|
358
|
+
const ccIds = opts.clearCc ? [] : opts.cc
|
|
359
|
+
? opts.cc.map((value) => resolveRecipientMethod(value, methods))
|
|
360
|
+
: currentCc.filter((id) => id !== toId);
|
|
361
|
+
if (ccIds.includes(toId) || new Set(ccIds).size !== ccIds.length) {
|
|
362
|
+
throw new CliError('Select each recipient once. To and CC must use different methods.', ExitCode.USAGE, 'usage');
|
|
363
|
+
}
|
|
364
|
+
if ([toId, ...ccIds].some((id) => noneIds.includes(id))) {
|
|
365
|
+
throw new CliError('A selected method is excluded. This command preserves exclusions. Change the exclusion explicitly before you select it.', ExitCode.USAGE, 'usage');
|
|
366
|
+
}
|
|
367
|
+
const selected = [toId, ...ccIds].map((id) => {
|
|
368
|
+
resolveRecipientMethod(id, methods);
|
|
369
|
+
return methods.find((method) => method.id === id);
|
|
370
|
+
});
|
|
371
|
+
args = { ...partyArgs, command: {
|
|
372
|
+
operation_id: randomUUID(), expected_version: defaults.version,
|
|
373
|
+
to_method_id: toId, cc_method_ids: ccIds,
|
|
374
|
+
none_method_ids: noneIds,
|
|
375
|
+
} };
|
|
376
|
+
process.stderr.write(`${recipientLines({ eligible_methods: methods, recipient_preview: {
|
|
377
|
+
to: selected[0].delivery_address,
|
|
378
|
+
cc: selected.slice(1).map((method) => method.delivery_address),
|
|
379
|
+
} })}\n`);
|
|
380
|
+
},
|
|
381
|
+
}, (data) => recipientLines(record(data.structured_content)));
|
|
247
382
|
}
|
|
248
383
|
export async function invoiceCreateCommand(opts = {}) {
|
|
249
384
|
const amount = parsePositiveNumber(opts.amount, '--amount');
|
|
@@ -287,11 +422,10 @@ export async function dealMoveCommand(dealId, stage, opts = {}) {
|
|
|
287
422
|
assertDealStage(stage);
|
|
288
423
|
await executeToolCall('move_deal_stage', opts, async () => ({ deal_id: dealId, stage }));
|
|
289
424
|
}
|
|
290
|
-
export async function
|
|
425
|
+
export async function personListCommand(opts = {}) {
|
|
291
426
|
const args = {};
|
|
292
427
|
if (opts.search !== undefined)
|
|
293
428
|
args[NETWORK_SEARCH_QUERY_PARAM] = opts.search;
|
|
294
429
|
addLimit(args, opts.limit);
|
|
295
|
-
// list_contacts is retired; list_people is the live People/Companies replacement.
|
|
296
430
|
await executeToolCall('list_people', opts, async () => args);
|
|
297
431
|
}
|
package/dist/commands/docs.js
CHANGED
|
@@ -18,9 +18,16 @@ function commandLine(command, parents) {
|
|
|
18
18
|
const parts = [names.join(' '), ...argumentUsage(command), ...optionFlags(command)];
|
|
19
19
|
return parts.join(' ').replace(/\s+/g, ' ').trim();
|
|
20
20
|
}
|
|
21
|
+
// Deprecated aliases (e.g. `every contact`) are registered hidden; like hidden
|
|
22
|
+
// options, they stay out of the offline docs so agents learn only current names.
|
|
23
|
+
function isHidden(command) {
|
|
24
|
+
return command._hidden === true;
|
|
25
|
+
}
|
|
21
26
|
function walkCommands(command, parents = []) {
|
|
22
27
|
const line = commandLine(command, parents);
|
|
23
|
-
const children = command.commands
|
|
28
|
+
const children = command.commands
|
|
29
|
+
.filter((child) => !isHidden(child))
|
|
30
|
+
.flatMap((child) => walkCommands(child, [...parents, command.name()]));
|
|
24
31
|
return [line, ...children];
|
|
25
32
|
}
|
|
26
33
|
export function commandTree(program) {
|
package/dist/commands/tools.js
CHANGED
|
@@ -4,6 +4,7 @@ import { CliError } from '../lib/errors.js';
|
|
|
4
4
|
import { ExitCode } from '../lib/exit-codes.js';
|
|
5
5
|
import { callTool, listTools } from '../lib/mcp.js';
|
|
6
6
|
import { emit } from '../lib/output.js';
|
|
7
|
+
import { recipientBinding, recipientLines } from '../lib/recipients.js';
|
|
7
8
|
import { classify, promptForTool, requirementDescription, requirementFor, } from '../lib/policy.js';
|
|
8
9
|
import { activeCredentialIsApiKey } from '../lib/auth/api-key.js';
|
|
9
10
|
import { getToken } from '../lib/auth/tokens.js';
|
|
@@ -17,6 +18,15 @@ import { parseMcpGateMetadata, SERVER_CONFIRMATION_ARG, withoutMcpGateMarker, }
|
|
|
17
18
|
*/
|
|
18
19
|
export const SIGNUP_INCOMPLETE_GUIDANCE = 'Finish signup first: run `every signup status` to see what is needed, confirm the ' +
|
|
19
20
|
'organization name with the user, then run `every signup complete --org-name "<name>" --yes`.';
|
|
21
|
+
const RECIPIENT_ERROR_MESSAGES = {
|
|
22
|
+
send_preparation_stale: 'The recipients changed after the preview. Run the command again to see the new recipients.',
|
|
23
|
+
recipient_required: 'Choose a To recipient with every recipients set <party> --kind invoice|proposal --to <email-or-id> before you send.',
|
|
24
|
+
recipient_model_quiet: 'Recipient changes and sends are paused. Try again later.',
|
|
25
|
+
recipient_model_unavailable: 'The recipient service is unavailable. Try again later.',
|
|
26
|
+
};
|
|
27
|
+
function recipientErrorCode(message) {
|
|
28
|
+
return message.trim().replace(/^Error executing tool ['"]?(?:send_invoice|send_proposal|preview_document_send|get_recipient_defaults|set_recipient_defaults)['"]?:\s*/, '');
|
|
29
|
+
}
|
|
20
30
|
function emitCommand(data, human, opts) {
|
|
21
31
|
if (opts.json)
|
|
22
32
|
emit(data, { json: true, staging: opts.staging });
|
|
@@ -253,10 +263,11 @@ export async function invokeToolCall(name, opts = {}, argsFactory = async () =>
|
|
|
253
263
|
const requirement = requirementFor(classification.level, {
|
|
254
264
|
interactive,
|
|
255
265
|
yes: opts.yes,
|
|
256
|
-
allowDestructive: opts.allowDestructive,
|
|
266
|
+
allowDestructive: opts.allowDestructive || hooks.recipientConfirmation,
|
|
257
267
|
readOnlyMode,
|
|
258
268
|
});
|
|
259
|
-
|
|
269
|
+
const needsRecipientYes = hooks.recipientConfirmation && !interactive && !opts.yes && !readOnlyMode;
|
|
270
|
+
if (!requirement.allowed && !needsRecipientYes) {
|
|
260
271
|
throw new CliError(requirement.denialMessage ?? 'Tool call denied by policy.', ExitCode.PERMISSION, 'permission');
|
|
261
272
|
}
|
|
262
273
|
const gated = classification.level !== 'read';
|
|
@@ -264,8 +275,12 @@ export async function invokeToolCall(name, opts = {}, argsFactory = async () =>
|
|
|
264
275
|
const userinfo = gated ? await resolveWriteTarget(baseUrl) : undefined;
|
|
265
276
|
const target = gated ? targetLabel(userinfo, environment) : undefined;
|
|
266
277
|
let locallyConfirmed = opts.yes === true;
|
|
278
|
+
await hooks.beforeConfirmation?.();
|
|
279
|
+
if (needsRecipientYes) {
|
|
280
|
+
throw new CliError('Re-run with --yes to send to these recipients.', ExitCode.USAGE, 'usage');
|
|
281
|
+
}
|
|
267
282
|
if (requirement.prompt) {
|
|
268
|
-
const confirmed = await promptForTool(name, classification.level, requirement.prompt, target);
|
|
283
|
+
const confirmed = await promptForTool(name, classification.level, hooks.recipientConfirmation ? 'confirm' : requirement.prompt, target);
|
|
269
284
|
if (!confirmed) {
|
|
270
285
|
throw new CliError('Tool call cancelled.', ExitCode.PERMISSION, 'permission');
|
|
271
286
|
}
|
|
@@ -286,6 +301,12 @@ export async function invokeToolCall(name, opts = {}, argsFactory = async () =>
|
|
|
286
301
|
if (timeout)
|
|
287
302
|
throw timeout;
|
|
288
303
|
}
|
|
304
|
+
if (err instanceof CliError && err.code === 'generic') {
|
|
305
|
+
const code = recipientErrorCode(err.message);
|
|
306
|
+
if (RECIPIENT_ERROR_MESSAGES[code]) {
|
|
307
|
+
throw new CliError(RECIPIENT_ERROR_MESSAGES[code], err.exitCode, code, err.details);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
289
310
|
throw err;
|
|
290
311
|
}
|
|
291
312
|
};
|
|
@@ -330,6 +351,11 @@ export async function invokeToolCall(name, opts = {}, argsFactory = async () =>
|
|
|
330
351
|
next_steps: ['every signup status --json', 'every signup complete --org-name "<name>" --yes --json'],
|
|
331
352
|
});
|
|
332
353
|
}
|
|
354
|
+
// Some server exceptions return only their exact typed code as text.
|
|
355
|
+
const recipientCode = toolError?.code ?? recipientErrorCode(rawMessage);
|
|
356
|
+
if (RECIPIENT_ERROR_MESSAGES[recipientCode]) {
|
|
357
|
+
throw new CliError(RECIPIENT_ERROR_MESSAGES[recipientCode], ExitCode.GENERIC, recipientCode, toolError ? { tool_error: toolError } : undefined);
|
|
358
|
+
}
|
|
333
359
|
if (toolError) {
|
|
334
360
|
throw new CliError(rawMessage, ExitCode.GENERIC, toolError.code, { tool_error: toolError });
|
|
335
361
|
}
|
|
@@ -349,11 +375,21 @@ function structuredToolError(structured) {
|
|
|
349
375
|
return undefined;
|
|
350
376
|
return { ...error, code };
|
|
351
377
|
}
|
|
352
|
-
export async function executeToolCall(name, opts = {}, argsFactory = async () => ({}), augmentData = (data) => data) {
|
|
353
|
-
const data = await augmentData(await invokeToolCall(name, opts, argsFactory));
|
|
354
|
-
emitCommand(data,
|
|
378
|
+
export async function executeToolCall(name, opts = {}, argsFactory = async () => ({}), augmentData = (data) => data, hooks = {}, human = toolCallHuman) {
|
|
379
|
+
const data = await augmentData(await invokeToolCall(name, opts, argsFactory, hooks));
|
|
380
|
+
emitCommand(data, human(data), opts);
|
|
355
381
|
await maybeShowSkillHint();
|
|
356
382
|
}
|
|
357
383
|
export async function toolCallCommand(name, opts = {}) {
|
|
384
|
+
if (name === 'send_invoice' || name === 'send_proposal') {
|
|
385
|
+
const args = await assembleArgs(opts);
|
|
386
|
+
const binding = recipientBinding(args.recipients, 'argument');
|
|
387
|
+
await executeToolCall(name, opts, async () => args, undefined, {
|
|
388
|
+
beforeConfirmation: async () => {
|
|
389
|
+
process.stderr.write(`${recipientLines({ recipients: binding })}\n`);
|
|
390
|
+
},
|
|
391
|
+
});
|
|
392
|
+
return;
|
|
393
|
+
}
|
|
358
394
|
await executeToolCall(name, opts, () => assembleArgs(opts));
|
|
359
395
|
}
|
package/dist/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { readFileSync } from 'node:fs';
|
|
3
|
-
import { Command, CommanderError } from 'commander';
|
|
3
|
+
import { Command, CommanderError, Option } from 'commander';
|
|
4
4
|
import { pingCommand } from './commands/ping.js';
|
|
5
5
|
import { docsCommand } from './commands/docs.js';
|
|
6
6
|
import { authStatusCommand, loginCommand, logoutCommand, orgCommand, orgSwitchCommand, whoamiCommand, } from './commands/auth.js';
|
|
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 { dealListCommand, dealMoveCommand, invoiceCreateCommand, invoiceListCommand, invoiceSendCommand, personListCommand, proposalSendCommand, recipientsGetCommand, recipientsSetCommand, } from './commands/aliases.js';
|
|
11
11
|
import { skillsInstallCommand, skillsListCommand } from './commands/skills.js';
|
|
12
12
|
import { CliError } from './lib/errors.js';
|
|
13
|
-
import { emit, emitError } from './lib/output.js';
|
|
13
|
+
import { deprecationNote, emit, emitError } from './lib/output.js';
|
|
14
14
|
import { ExitCode } from './lib/exit-codes.js';
|
|
15
15
|
import { runDefaultFirstRunMenu } from './lib/first-run.js';
|
|
16
16
|
const pkg = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8'));
|
|
@@ -168,7 +168,7 @@ withGlobalOptions(toolsCommand
|
|
|
168
168
|
});
|
|
169
169
|
});
|
|
170
170
|
const toolCommand = withGlobalOptions(program.command('tool').description('Invoke a single Every MCP tool'));
|
|
171
|
-
function collectOption(value, previous) {
|
|
171
|
+
function collectOption(value, previous = []) {
|
|
172
172
|
previous.push(value);
|
|
173
173
|
return previous;
|
|
174
174
|
}
|
|
@@ -223,15 +223,23 @@ const invoiceCommand = withToolExecutionOptions(withGlobalOptions(program
|
|
|
223
223
|
].join('\n'))));
|
|
224
224
|
withGlobalOptions(withToolExecutionOptions(invoiceCommand
|
|
225
225
|
.command('create')
|
|
226
|
-
.description('Create a simple draft invoice')
|
|
227
|
-
.option('--
|
|
228
|
-
.option('--
|
|
229
|
-
.option('--
|
|
230
|
-
.option('--
|
|
226
|
+
.description('Create a simple draft invoice for a Company or a Person')
|
|
227
|
+
.option('--company <name>', 'Company name to resolve via list_companies')
|
|
228
|
+
.option('--person <name>', 'Person name to resolve via list_people')
|
|
229
|
+
.option('--company-id <id>', 'Company id; skips name resolution')
|
|
230
|
+
.option('--person-id <id>', 'Person id; skips name resolution')
|
|
231
|
+
.addOption(new Option('--client <name>', 'deprecated alias for --company').hideHelp())
|
|
232
|
+
.addOption(new Option('--client-id <id>', 'deprecated: use --company-id or --person-id').hideHelp())
|
|
231
233
|
.requiredOption('--amount <n>', 'unit price for the single line item')
|
|
232
234
|
.option('--description <text>', 'line item description')
|
|
233
235
|
.option('--quantity <q>', 'line item quantity'))).action(async (_options, command) => {
|
|
234
236
|
const opts = command.optsWithGlobals();
|
|
237
|
+
if (opts.client !== undefined) {
|
|
238
|
+
deprecationNote('`--client` is deprecated; use `--company` (or `--person` for a Person).');
|
|
239
|
+
}
|
|
240
|
+
if (opts.clientId !== undefined) {
|
|
241
|
+
deprecationNote('`--client-id` is deprecated; use `--company-id` or `--person-id`.');
|
|
242
|
+
}
|
|
235
243
|
await invoiceCreateCommand({
|
|
236
244
|
json: opts.json,
|
|
237
245
|
staging: opts.staging,
|
|
@@ -243,6 +251,8 @@ withGlobalOptions(withToolExecutionOptions(invoiceCommand
|
|
|
243
251
|
client: opts.client,
|
|
244
252
|
company: opts.company,
|
|
245
253
|
person: opts.person,
|
|
254
|
+
companyId: opts.companyId,
|
|
255
|
+
personId: opts.personId,
|
|
246
256
|
clientId: opts.clientId,
|
|
247
257
|
amount: opts.amount,
|
|
248
258
|
description: opts.description,
|
|
@@ -271,19 +281,49 @@ withGlobalOptions(withToolExecutionOptions(invoiceCommand
|
|
|
271
281
|
});
|
|
272
282
|
withGlobalOptions(withToolExecutionOptions(invoiceCommand
|
|
273
283
|
.command('send')
|
|
274
|
-
.description('
|
|
284
|
+
.description('Preview recipients, confirm, and send an invoice')
|
|
285
|
+
.option('--expect-digest <digest>', 'require the digest from the approved recipient preview')
|
|
275
286
|
.argument('<invoice_id>', 'invoice id'))).action(async (invoiceId, _options, command) => {
|
|
276
287
|
const opts = command.optsWithGlobals();
|
|
277
288
|
await invoiceSendCommand(invoiceId, {
|
|
278
289
|
json: opts.json,
|
|
279
290
|
staging: opts.staging,
|
|
280
|
-
noCache: opts.
|
|
291
|
+
noCache: opts.cache === false,
|
|
281
292
|
yes: opts.yes,
|
|
282
293
|
allowDestructive: opts.allowDestructive,
|
|
283
294
|
readOnly: opts.readOnly,
|
|
284
295
|
timeout: opts.timeout,
|
|
296
|
+
expectDigest: opts.expectDigest,
|
|
285
297
|
});
|
|
286
298
|
});
|
|
299
|
+
const proposalCommand = withToolExecutionOptions(withGlobalOptions(program.command('proposal').description('Work with proposals')));
|
|
300
|
+
withGlobalOptions(withToolExecutionOptions(proposalCommand.command('send').description('Preview recipients, confirm, and send a proposal')
|
|
301
|
+
.option('--expect-digest <digest>', 'require the digest from the approved recipient preview')
|
|
302
|
+
.argument('<proposal>', 'proposal id'))).action(async (proposal, _options, command) => {
|
|
303
|
+
const opts = command.optsWithGlobals();
|
|
304
|
+
await proposalSendCommand(proposal, { ...opts, noCache: opts.cache === false });
|
|
305
|
+
});
|
|
306
|
+
const recipientsCommand = withToolExecutionOptions(withGlobalOptions(program.command('recipients').description('Read or set invoice and proposal recipients')));
|
|
307
|
+
for (const action of ['get', 'set']) {
|
|
308
|
+
const command = withGlobalOptions(withToolExecutionOptions(recipientsCommand.command(action).description(`${action === 'get' ? 'Read' : 'Set'} exact To and CC recipients`)
|
|
309
|
+
.argument('<party>', 'Person or Company name')
|
|
310
|
+
.requiredOption('--kind <kind>', 'invoice or proposal')
|
|
311
|
+
.option('--company <name>', 'Company name to resolve via list_companies')
|
|
312
|
+
.option('--person <name>', 'Person name to resolve via list_people')
|
|
313
|
+
.option('--company-id <id>', 'Company id; skips name resolution')
|
|
314
|
+
.option('--person-id <id>', 'Person id; skips name resolution')));
|
|
315
|
+
if (action === 'set') {
|
|
316
|
+
command.requiredOption('--to <email-or-id>', 'To email address or eligible method id')
|
|
317
|
+
.option('--cc <email-or-id>', 'CC email address or eligible method id; repeat for more recipients', collectOption)
|
|
318
|
+
.option('--clear-cc', 'remove all CC recipients');
|
|
319
|
+
}
|
|
320
|
+
command.action(async (party, _options, cmd) => {
|
|
321
|
+
const opts = cmd.optsWithGlobals();
|
|
322
|
+
// Commander represents --no-cache as cache:false.
|
|
323
|
+
opts.noCache = opts.cache === false;
|
|
324
|
+
await (action === 'get' ? recipientsGetCommand : recipientsSetCommand)(party, opts);
|
|
325
|
+
});
|
|
326
|
+
}
|
|
287
327
|
const dealCommand = withToolExecutionOptions(withGlobalOptions(program
|
|
288
328
|
.command('deal')
|
|
289
329
|
.description('Work with deals')
|
|
@@ -324,28 +364,40 @@ withGlobalOptions(withToolExecutionOptions(dealCommand
|
|
|
324
364
|
timeout: opts.timeout,
|
|
325
365
|
});
|
|
326
366
|
});
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
367
|
+
/**
|
|
368
|
+
* Register `list` under `every person` and under the hidden, deprecated
|
|
369
|
+
* `every contact` alias ("contact" is retired vocabulary: the product's people
|
|
370
|
+
* model is People and Companies).
|
|
371
|
+
*/
|
|
372
|
+
function addPersonListCommand(parent, deprecation) {
|
|
373
|
+
withGlobalOptions(withToolExecutionOptions(parent
|
|
374
|
+
.command('list')
|
|
375
|
+
.description('List People')
|
|
376
|
+
.option('--search <q>', 'search People by name, email, phone, or employer')
|
|
377
|
+
.option('--limit <n>', 'maximum number of People to return'))).action(async (_options, command) => {
|
|
378
|
+
if (deprecation)
|
|
379
|
+
deprecationNote(deprecation);
|
|
380
|
+
const opts = command.optsWithGlobals();
|
|
381
|
+
await personListCommand({
|
|
382
|
+
json: opts.json,
|
|
383
|
+
staging: opts.staging,
|
|
384
|
+
noCache: opts.noCache,
|
|
385
|
+
yes: opts.yes,
|
|
386
|
+
allowDestructive: opts.allowDestructive,
|
|
387
|
+
readOnly: opts.readOnly,
|
|
388
|
+
timeout: opts.timeout,
|
|
389
|
+
search: opts.search,
|
|
390
|
+
limit: opts.limit,
|
|
391
|
+
});
|
|
347
392
|
});
|
|
348
|
-
}
|
|
393
|
+
}
|
|
394
|
+
addPersonListCommand(withToolExecutionOptions(withGlobalOptions(program
|
|
395
|
+
.command('person')
|
|
396
|
+
.description('Work with People')
|
|
397
|
+
.addHelpText('after', TOOL_CALL_HELP))));
|
|
398
|
+
addPersonListCommand(withToolExecutionOptions(withGlobalOptions(program
|
|
399
|
+
.command('contact', { hidden: true })
|
|
400
|
+
.description('Deprecated alias for every person'))), '`every contact` is deprecated; use `every person`.');
|
|
349
401
|
const policyCommand = withGlobalOptions(program.command('policy').description('Explain local tool safety policy'));
|
|
350
402
|
withGlobalOptions(policyCommand
|
|
351
403
|
.command('explain')
|
package/dist/lib/output.js
CHANGED
|
@@ -69,3 +69,11 @@ export function emitError(message, code, opts = {}, details = {}) {
|
|
|
69
69
|
process.stderr.write(rendered + '\n');
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
|
+
/**
|
|
73
|
+
* One-line deprecation note for a renamed command or flag. It goes to stderr in
|
|
74
|
+
* every mode, like the one-time skills tip, so `--json` stdout stays a single
|
|
75
|
+
* envelope while an agent reading stderr still learns the current name.
|
|
76
|
+
*/
|
|
77
|
+
export function deprecationNote(message) {
|
|
78
|
+
process.stderr.write(`Note: ${message}\n`);
|
|
79
|
+
}
|
package/dist/lib/policy.js
CHANGED
|
@@ -58,8 +58,25 @@ function overrideClassification(name) {
|
|
|
58
58
|
reason: 'approve_pending_deal activates a deal and queues its plan; hard to undo, so pin write tier regardless of server annotation drift.',
|
|
59
59
|
};
|
|
60
60
|
}
|
|
61
|
+
if (name === 'set_recipient_defaults') {
|
|
62
|
+
return {
|
|
63
|
+
level: 'destructive',
|
|
64
|
+
source: 'override',
|
|
65
|
+
reason: 'set_recipient_defaults changes the audience for future document sends. Require destructive confirmation regardless of server annotations.',
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
// approve_prospect is the owner/bookkeeper review action next to
|
|
69
|
+
// approve_pending_deal (the path open to API keys); pin it the same way.
|
|
70
|
+
if (name === 'approve_prospect') {
|
|
71
|
+
return {
|
|
72
|
+
level: 'write',
|
|
73
|
+
source: 'override',
|
|
74
|
+
reason: 'approve_prospect promotes a pending prospect into an active Deal; hard to undo, so pin write tier regardless of server annotation drift.',
|
|
75
|
+
};
|
|
76
|
+
}
|
|
61
77
|
// Deal tools (admin MCP, shipped 2026-09-03; create_client_deal renamed to
|
|
62
|
-
// create_delivery_deal in the 2026-09-09 People/Companies retirement
|
|
78
|
+
// create_delivery_deal in the 2026-09-09 People/Companies retirement, and
|
|
79
|
+
// set_deal_title to set_deal_name in the 2026-10 naming alignment). None
|
|
63
80
|
// match the send_/delete_/void_/cancel_ name patterns, so without these
|
|
64
81
|
// entries their tier would rest entirely on server annotations.
|
|
65
82
|
if (name === 'create_delivery_deal') {
|
|
@@ -69,11 +86,11 @@ function overrideClassification(name) {
|
|
|
69
86
|
reason: 'create_delivery_deal opens a new won deal for a Person or Company and makes the caller its delivery lead; pin write tier regardless of server annotation drift.',
|
|
70
87
|
};
|
|
71
88
|
}
|
|
72
|
-
if (name === '
|
|
89
|
+
if (name === 'set_deal_name') {
|
|
73
90
|
return {
|
|
74
91
|
level: 'write',
|
|
75
92
|
source: 'override',
|
|
76
|
-
reason: '
|
|
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.',
|
|
77
94
|
};
|
|
78
95
|
}
|
|
79
96
|
if (name === 'link_deal_item') {
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { CliError } from './errors.js';
|
|
2
|
+
import { ExitCode } from './exit-codes.js';
|
|
3
|
+
export function documentKind(value) {
|
|
4
|
+
if (value !== 'invoice' && value !== 'proposal') {
|
|
5
|
+
throw new CliError('--kind must be invoice or proposal', ExitCode.USAGE, 'usage');
|
|
6
|
+
}
|
|
7
|
+
return value;
|
|
8
|
+
}
|
|
9
|
+
export function record(value) {
|
|
10
|
+
return value && typeof value === 'object' && !Array.isArray(value)
|
|
11
|
+
? value
|
|
12
|
+
: {};
|
|
13
|
+
}
|
|
14
|
+
/** Validate the server object without changing any binding field. */
|
|
15
|
+
export function recipientBinding(value, source = 'preview') {
|
|
16
|
+
const binding = record(value);
|
|
17
|
+
if (Object.keys(binding).sort().join(',') !== 'cc,digest,to' ||
|
|
18
|
+
typeof binding.digest !== 'string' || !/^[a-f0-9]{64}$/.test(binding.digest) ||
|
|
19
|
+
typeof binding.to !== 'string' || binding.to.length === 0 ||
|
|
20
|
+
!Array.isArray(binding.cc) || !binding.cc.every((address) => typeof address === 'string')) {
|
|
21
|
+
if (source === 'argument') {
|
|
22
|
+
throw new CliError('Document sends require a recipients binding with exactly {digest, to, cc} from preview_document_send.', ExitCode.USAGE, 'usage');
|
|
23
|
+
}
|
|
24
|
+
throw new CliError('The server returned an invalid recipient preview. No document was sent.');
|
|
25
|
+
}
|
|
26
|
+
return binding;
|
|
27
|
+
}
|
|
28
|
+
/** Older servers omit model_state but return the complete exclusion list. */
|
|
29
|
+
export function preservedExclusions(defaults) {
|
|
30
|
+
const ids = defaults.none_method_ids;
|
|
31
|
+
const state = defaults.model_state;
|
|
32
|
+
if (!Array.isArray(ids) || !ids.every((id) => typeof id === 'string' &&
|
|
33
|
+
/^[a-f0-9]{8}(?:-[a-f0-9]{4}){3}-[a-f0-9]{12}$/i.test(id))) {
|
|
34
|
+
throw new CliError('The server cannot confirm current recipient exclusions. No defaults were changed.', ExitCode.PERMISSION, 'recipient_exclusions_unavailable');
|
|
35
|
+
}
|
|
36
|
+
if ((state !== undefined && state !== 'v1' && state !== 'v2') || (state === 'v2' && ids.length > 0)) {
|
|
37
|
+
throw new CliError('This recipient model cannot preserve the existing exclusions. No defaults were changed.', ExitCode.PERMISSION, 'recipient_exclusions_unavailable', { model_state: state });
|
|
38
|
+
}
|
|
39
|
+
return ids;
|
|
40
|
+
}
|
|
41
|
+
/** Use transport addresses as authority. Optional display details supply names only. */
|
|
42
|
+
export function recipientLines(data) {
|
|
43
|
+
const envelope = record(data.recipients ?? data.recipient_preview);
|
|
44
|
+
const details = record(data.recipient_details);
|
|
45
|
+
const detailRows = [details.to, ...(Array.isArray(details.cc) ? details.cc : [])].map(record);
|
|
46
|
+
const methods = (Array.isArray(data.eligible_methods) ? data.eligible_methods : []).map(record);
|
|
47
|
+
const line = (role, address) => {
|
|
48
|
+
const detail = detailRows.find((entry) => entry.address === address);
|
|
49
|
+
const method = methods.find((entry) => entry.delivery_address === address);
|
|
50
|
+
const name = detail?.owner_name ?? record(method?.owner).name;
|
|
51
|
+
return `${role}: ${typeof name === 'string' && name ? name : 'Name unavailable'} <${address}>`;
|
|
52
|
+
};
|
|
53
|
+
const cc = Array.isArray(envelope.cc) ? envelope.cc : [];
|
|
54
|
+
return [
|
|
55
|
+
typeof envelope.to === 'string' ? line('To', envelope.to) : 'To: none',
|
|
56
|
+
...cc.map((address) => line('CC', String(address))),
|
|
57
|
+
...(cc.length === 0 ? ['CC: none'] : []),
|
|
58
|
+
...(envelope.error ? [`Recipient error: ${envelope.error}`] : []),
|
|
59
|
+
].join('\n');
|
|
60
|
+
}
|
package/package.json
CHANGED
|
@@ -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, or mentions their Every workspace.
|
|
4
4
|
metadata:
|
|
5
|
-
every-skill-version: "
|
|
5
|
+
every-skill-version: "4"
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Use Every
|
|
@@ -94,7 +94,7 @@ Never assume the bound workspace. When the user names a different workspace, run
|
|
|
94
94
|
Creating a proposal or invoice automatically records activity on a matching deal when exactly one deal/party (Person or Company) matches. After an Every creation command, never double-log that action:
|
|
95
95
|
|
|
96
96
|
```bash
|
|
97
|
-
every invoice create --
|
|
97
|
+
every invoice create --company-id <company_id> --amount 100 --yes --json
|
|
98
98
|
every tool call create_proposal --args proposal.json --yes --json
|
|
99
99
|
```
|
|
100
100
|
|
|
@@ -113,15 +113,15 @@ Pipeline stages are `lead`, `opportunity`, `won`, and `lost`:
|
|
|
113
113
|
every deal move <deal_id> won --yes --json
|
|
114
114
|
```
|
|
115
115
|
|
|
116
|
-
Moving to `won` requires the deal to already be linked to a Person or Company. If the command errors because no party is assigned, assign one first (e.g. via `create_deal`'s `party`, or by
|
|
116
|
+
Moving to `won` requires the deal to already be linked to a Person or Company. If the command errors because no party is assigned, assign one first (e.g. via `create_deal`'s `party`, or by linking a Person or Company to the deal in the Every app), then retry the same command.
|
|
117
117
|
|
|
118
118
|
### Invoice rates and tax
|
|
119
119
|
|
|
120
|
-
Treat `unit_price` as the per-unit rate, not the line total. The simple CLI's `--amount` maps to that per-unit rate:
|
|
120
|
+
Treat `unit_price` as the per-unit rate, not the line total. The simple CLI's `--amount` maps to that per-unit rate. Name the recipient with `--company-id` or `--person-id` (or `--company`/`--person` to resolve a name):
|
|
121
121
|
|
|
122
122
|
```bash
|
|
123
|
-
every invoice create --
|
|
124
|
-
every tool call create_invoice --arg command='{"operation_id":"<uuid>","party":{"kind":"company","id":"<
|
|
123
|
+
every invoice create --company-id <company_id> --description "Workshop" --quantity 3 --amount 100 --yes --json
|
|
124
|
+
every tool call create_invoice --arg command='{"operation_id":"<uuid>","party":{"kind":"company","id":"<company_id>"},"line_items":[{"description":"Workshop","quantity":3,"unit_price":100}]}' --yes --json
|
|
125
125
|
```
|
|
126
126
|
|
|
127
127
|
Leave `sales_tax_applied` unset so the business default applies. Never add tax as a line item. When currency, tax, or timezone matters, read settings first with `every tool call business_settings --json`; let Every compute tax, numbering, due dates, and totals.
|
|
@@ -139,15 +139,25 @@ Conversion creates a linked DRAFT invoice. Review the returned invoice ID, then
|
|
|
139
139
|
|
|
140
140
|
```bash
|
|
141
141
|
every tool call view_invoice --arg identifier=<invoice_id> --json
|
|
142
|
-
every invoice send <invoice_id> --
|
|
142
|
+
every invoice send <invoice_id> --expect-digest <preview_digest> --yes --json
|
|
143
143
|
```
|
|
144
144
|
|
|
145
|
+
### Voiding an invoice
|
|
146
|
+
|
|
147
|
+
`void_invoice` (`invoice_id`, `expected_updated_at` from `view_invoice`, a fresh `operation_id`) voids an invoice: its status becomes void and it can no longer be paid, but the invoice and its history remain. It never deletes. It is destructive, so it needs explicit approval and both destructive flags.
|
|
148
|
+
|
|
149
|
+
### Invoice and proposal sends
|
|
150
|
+
|
|
151
|
+
Call `preview_document_send` before approval. Show the exact To and CC first, with one name and exact email per line. Show `CC: none` if empty. Never add a CC without a request.
|
|
152
|
+
|
|
153
|
+
After the owner approves those recipients, send with `--expect-digest <preview_digest>` and `--yes`. Both send aliases compare a fresh preview with that digest. A mismatch stops the send and shows the new recipients. Get approval for the new preview before another send. Direct send tools require the exact approved `{digest, to, cc}` binding and both destructive flags.
|
|
154
|
+
|
|
145
155
|
### Invoice re-sends
|
|
146
156
|
|
|
147
157
|
`send_invoice` re-sends the invoice email itself; it does not send custom reminder copy. For an overdue follow-up, confirm with the user, re-send the invoice, and give any custom message separately for the user to send:
|
|
148
158
|
|
|
149
159
|
```bash
|
|
150
|
-
every invoice send <invoice_id> --
|
|
160
|
+
every invoice send <invoice_id> --expect-digest <preview_digest> --yes --json
|
|
151
161
|
```
|
|
152
162
|
|
|
153
163
|
### Gmail is draft-first
|
|
@@ -164,15 +174,19 @@ Calendar tools operate on the user's personal calendar. Confirm attendees and ti
|
|
|
164
174
|
|
|
165
175
|
### Scheduled tasks report in-app, never in this session
|
|
166
176
|
|
|
167
|
-
`every tool call create_scheduled_task ...` sets up a saved instruction that runs on a cadence (once/daily/weekly/monthly). Results and any notifications always arrive in the Every app (Daily Brief / notifications) and by email if enabled — never back in this CLI session, so don't tell the user to expect output here.
|
|
177
|
+
`every tool call create_scheduled_task ...` sets up a saved instruction that runs on a cadence (once/daily/weekly/monthly). Results and any notifications always arrive in the Every app (Daily Brief / notifications) and by email if enabled — never back in this CLI session, so don't tell the user to expect output here. If the user later asks what a task produced, read its latest stored result with `get_scheduled_task_result` (see Stored briefs and reports).
|
|
178
|
+
|
|
179
|
+
### Prospects and deal details
|
|
180
|
+
|
|
181
|
+
Use `list_prospects`, `view_prospect` (`prospect_id`), and `network_summary` (optional `target_id`) to research the user's network. Treat the returned personal and relationship context as private; these tools do not contact prospects.
|
|
168
182
|
|
|
169
|
-
|
|
183
|
+
A prospect awaiting review becomes a deal with `approve_prospect` (`prospect_id`), the owner/bookkeeper review action; `approve_pending_deal` (`deal_id`) does the same for agents running under an API key. A prospect joins an existing deal with `merge_prospect` (`prospect_id`, `into_deal_id`), or is rejected with `reject_prospect`. Rejecting is destructive: it suppresses the Person across every target in the workspace, so say so before asking for approval. `list_prospects` lists rejected prospects with `status=rejected`.
|
|
170
184
|
|
|
171
|
-
|
|
185
|
+
Rename a deal with `set_deal_name` (`deal_id`, `name`). Record an expected amount on a deal with no proposal or invoice yet with `set_deal_value_estimate` (`deal_id`, `target_value`); call it a value estimate.
|
|
172
186
|
|
|
173
187
|
### Stored briefs and reports
|
|
174
188
|
|
|
175
|
-
`get_daily_brief` and `
|
|
189
|
+
`get_daily_brief` and `get_scheduled_task_result` read stored artifacts for the authenticated caller only; do not imply they regenerate or share a brief or a result. `get_scheduled_task_result` returns the latest completed result of one of the user's scheduled tasks: take the `task_id` from `list_scheduled_tasks`. It does not run the task, and `result` can be null when no run has completed yet. Use `get_financial_report` for the server-computed financial view and preserve its reported period and currency; its `entities` sections are `invoices`, `payments`, `expenses`, `proposals`, and `recurring`.
|
|
176
190
|
|
|
177
191
|
### Recurring invoices
|
|
178
192
|
|
|
@@ -227,7 +241,7 @@ Convert an accepted proposal:
|
|
|
227
241
|
every tool call view_proposal --arg identifier=<proposal_id> --json
|
|
228
242
|
every tool call convert_proposal_to_invoice --arg proposal_id=<proposal_id> --yes --json
|
|
229
243
|
every tool call view_invoice --arg identifier=<invoice_id> --json
|
|
230
|
-
every invoice send <invoice_id> --
|
|
244
|
+
every invoice send <invoice_id> --expect-digest <preview_digest> --yes --json
|
|
231
245
|
```
|
|
232
246
|
|
|
233
247
|
Stop if the proposal is not issued/approved. Review the linked draft and obtain approval before sending.
|
|
@@ -235,7 +249,7 @@ Stop if the proposal is not issued/approved. Review the linked draft and obtain
|
|
|
235
249
|
Intake a new lead:
|
|
236
250
|
|
|
237
251
|
```bash
|
|
238
|
-
every
|
|
252
|
+
every person list --search "person@example.com" --json
|
|
239
253
|
every tool call create_person --args person.json --yes --json
|
|
240
254
|
every tool call create_deal --args deal.json --yes --json
|
|
241
255
|
```
|