posterly-mcp-server 0.52.1 → 0.53.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -26,6 +26,9 @@ export function formatSignedUploadBatch(batch, requested) {
26
26
  continue;
27
27
  lines.push(` ${key}: ${headers[key]}`);
28
28
  }
29
+ if (slot.content_type_pinned === true) {
30
+ lines.push(' Content-Type is locked: send exactly the Content-Type above or storage rejects the PUT with 403.');
31
+ }
29
32
  lines.push(` Public URL after upload: ${slot.public_url}`);
30
33
  if (slot.expires_at && (!earliestExpiry || slot.expires_at < earliestExpiry)) {
31
34
  earliestExpiry = slot.expires_at;
@@ -37,12 +40,15 @@ export function formatSignedUploadBatch(batch, requested) {
37
40
  }
38
41
  lines.push('');
39
42
  });
43
+ if (batch.slots.some((slot) => slot.ok && slot.content_type_pinned === true)) {
44
+ lines.push('Slots marked "Content-Type is locked" accept only a PUT whose Content-Type header is exactly the one shown (curl --data-binary needs -H "Content-Type: ...").');
45
+ }
40
46
  lines.push(`PUT each file, then pass public_url to create_post / create_posts_batch. Slots expire at ${earliestExpiry ?? 'the expires_at time returned (15 minutes)'}, call again for fresh slots.`);
41
47
  return lines.join('\n');
42
48
  }
43
49
  export const createSignedUploadTool = {
44
50
  name: 'create_signed_upload',
45
- description: 'Create signed upload URLs for larger images, videos or PDFs, 1 to 20 files per call. Accepts JPEG, PNG, GIF, WebP, MP4, MOV, WebM, and PDF up to 50MB (a PDF is for LinkedIn document posts); HEIC is not accepted. For one file pass filename, content_type and size. For several pass files: [{filename, content_type, size}] (up to 20) and get one slot per file, with any file that fails reported in place. PUT the raw bytes of each file to its upload_url (object storage) with the returned headers, then pass public_url to create_post / create_posts_batch. For a PDF, create the post with post_type document, media_url set to that public_url and a document_title in settings (LinkedIn only). Slots expire in 15 minutes.',
51
+ description: 'Create signed upload URLs for larger images, videos or PDFs, 1 to 20 files per call. Accepts JPEG, PNG, GIF, WebP, MP4, MOV, WebM, and PDF up to 50MB (a PDF is for LinkedIn document posts); HEIC is not accepted. For one file pass filename, content_type and size. For several pass files: [{filename, content_type, size}] (up to 20) and get one slot per file, with any file that fails reported in place. PUT the raw bytes of each file to its upload_url (object storage) with the returned headers, then pass public_url to create_post / create_posts_batch. For a PDF, create the post with post_type document, media_url set to that public_url and a document_title in settings (LinkedIn only). Pinning is available per request with pin_content_type: true, which locks each slot to the content_type you declare (a PUT with any other Content-Type then fails with 403). posterly may turn it on by default in the future, so always send the Content-Type header returned with the slot. Slots expire in 15 minutes.',
46
52
  inputSchema: z.object({
47
53
  filename: z.string().optional().describe('Single file: filename with extension, e.g. launch-video.mp4. Omit when using files.'),
48
54
  content_type: z.string().optional().describe('Single file: MIME type, e.g. video/mp4. Omit when using files.'),
@@ -53,6 +59,10 @@ export const createSignedUploadTool = {
53
59
  .max(20)
54
60
  .optional()
55
61
  .describe('Batch: 1 to 20 files, each with filename, content_type and size. Use instead of the single-file fields.'),
62
+ pin_content_type: z
63
+ .boolean()
64
+ .optional()
65
+ .describe('Optional. true locks each slot to the declared content_type so a PUT with any other Content-Type fails with 403. Send the returned Content-Type header exactly.'),
56
66
  workspace_id: z.string().optional().describe('Optional. The workspace this acts in and whose plan pays (from whoami). Needed only when your connection can act in several workspaces.'),
57
67
  }),
58
68
  async execute(client, input) {
@@ -60,13 +70,27 @@ export const createSignedUploadTool = {
60
70
  if (input.filename !== undefined || input.content_type !== undefined || input.size !== undefined) {
61
71
  throw new Error('Pass either files or the single-file fields (filename, content_type, size), not both.');
62
72
  }
63
- const batch = await client.getSignedUploadUrls(input.files, input.workspace_id);
73
+ const batch = await client.getSignedUploadUrls(input.files, input.workspace_id, input.pin_content_type === true);
64
74
  return formatSignedUploadBatch(batch, input.files);
65
75
  }
66
76
  if (!input.filename || !input.content_type || !input.size) {
67
77
  throw new Error('Provide filename, content_type and size for one file, or files for a batch of up to 20.');
68
78
  }
69
- const signed = await client.getSignedUploadUrl(input.filename, input.content_type, input.size, input.workspace_id);
79
+ const signed = await client.getSignedUploadUrl(input.filename, input.content_type, input.size, input.workspace_id, input.pin_content_type === true);
80
+ if (signed.content_type_pinned === true) {
81
+ const headers = signed.headers || {};
82
+ const contentTypeKey = Object.keys(headers).find((key) => key.toLowerCase() === 'content-type');
83
+ const sendType = contentTypeKey ? headers[contentTypeKey] : input.content_type;
84
+ return [
85
+ 'Signed upload created.',
86
+ `• Upload URL: ${signed.upload_url}`,
87
+ `• Token: ${signed.token}`,
88
+ `• Storage path: ${signed.path}`,
89
+ `• Content-Type to send: ${sendType}`,
90
+ `• Public URL after upload: ${signed.public_url}`,
91
+ 'Content-Type is locked: PUT the raw file bytes to the upload URL with exactly the Content-Type above (curl --data-binary needs -H "Content-Type: ..."), or storage rejects it with 403. Then pass public_url to create_post.',
92
+ ].join('\n');
93
+ }
70
94
  return [
71
95
  'Signed upload created.',
72
96
  `• Upload URL: ${signed.upload_url}`,
@@ -3,15 +3,15 @@ import { mdKeyValue, mdSection, mdTitle } from '../lib/format.js';
3
3
  const TIER_VALUES = ['starter', 'pro', 'power_user', 'agency'];
4
4
  function formatDowngraded(result) {
5
5
  return [
6
- mdTitle('Subscription downgrade scheduled'),
6
+ mdTitle('Subscription downgraded'),
7
7
  mdSection('Details', mdKeyValue([
8
- ['New tier at next renewal', result.tier],
8
+ ['New tier (limits apply now, lower price from the next renewal)', result.tier],
9
9
  ])),
10
10
  ].join('\n\n');
11
11
  }
12
12
  export const downgradeSubscriptionTool = {
13
13
  name: 'downgrade_subscription',
14
- description: "Downgrade the authenticated user's posterly subscription one tier (or to an explicit lower `tier`) at the next renewal with no proration. Billing action; requires the billing:write scope. Only call after the user explicitly confirms.",
14
+ description: "Move the subscription down one tier (or to an explicit lower `tier`) now: the lower limits and credits apply right away, the lower price starts at the next renewal, and the rest of the current period is not refunded. Strictly downward only. Requires billing:write. Only call after the user explicitly confirms.",
15
15
  inputSchema: z.object({
16
16
  tier: z.enum(TIER_VALUES).optional().describe('Optional explicit target tier. Omit to drop one tier automatically.'),
17
17
  confirm: z.literal(true).describe('Must be true after the user explicitly confirms the downgrade.'),
@@ -1,7 +1,55 @@
1
1
  import { z } from 'zod';
2
- import { formatDateTime, mdKeyValue, mdSection, mdTitle } from '../lib/format.js';
3
- function formatSubscription(result) {
2
+ import { formatDateTime, mdBullets, mdKeyValue, mdSection, mdTitle } from '../lib/format.js';
3
+ import { formatExtraAccountsPaymentPending, intervalWord, usdFromCents } from './manage-extra-account.js';
4
+ function formatConnectedAccounts(accounts) {
5
+ if (!accounts || typeof accounts.limit !== 'number' || !Number.isFinite(accounts.limit))
6
+ return null;
7
+ const used = typeof accounts.used === 'number' && Number.isFinite(accounts.used)
8
+ ? Math.max(0, Math.floor(accounts.used))
9
+ : 0;
10
+ if (accounts.limit < 0)
11
+ return `${used} of unlimited`;
12
+ return `${used} of ${accounts.limit}`;
13
+ }
14
+ /** The Agency extra-accounts block (owner only). Same wording as the hosted endpoint. */
15
+ function formatExtraAccountsSection(state, directoryProfile = false) {
16
+ const word = intervalWord(state.interval);
17
+ const price = state.price_per_account_cents === null || state.price_per_account_cents === undefined
18
+ ? 'n/a'
19
+ : `${usdFromCents(state.price_per_account_cents)} per extra account per ${word}`;
20
+ const rows = [
21
+ ['Included with Agency', state.included_accounts],
22
+ ['Granted by posterly', state.admin_granted_accounts],
23
+ ['Paid extra accounts', state.paid_extra_accounts],
24
+ ['Account limit', state.account_limit],
25
+ ['Connected accounts in use', state.accounts_in_use],
26
+ ];
27
+ if (!directoryProfile)
28
+ rows.push(['Price', price]);
29
+ rows.push(['Current extra accounts cost', state.recurring_cents === null || state.recurring_cents === undefined ? 'n/a' : `${usdFromCents(state.recurring_cents)} per ${word}`]);
30
+ if (!directoryProfile) {
31
+ rows.push(['Minimum purchase', `${state.min_purchase} accounts at a time, no maximum`]);
32
+ rows.push(['Lowest total you can set now', state.min_paid_extra_accounts]);
33
+ }
34
+ rows.push(['On a trial', state.trialing ? 'yes, no charge until the trial ends' : 'no']);
35
+ if (!directoryProfile) {
36
+ rows.push(['Can change now', state.eligible
37
+ ? 'yes, with manage_extra_account'
38
+ : `no (${state.code || 'not eligible'}). ${state.reason || 'Extra accounts are not available for this subscription right now.'}`]);
39
+ }
40
+ return mdSection('Extra accounts', mdKeyValue(rows));
41
+ }
42
+ /**
43
+ * `directoryProfile` is the Claude directory profile: its catalog has no
44
+ * billing mutations, so the output is facts only (no tool names, no offers,
45
+ * no money steps) plus one line pointing at the billing page.
46
+ */
47
+ function formatSubscription(result, options_) {
4
48
  const sub = result.subscription;
49
+ const connectedAccounts = formatConnectedAccounts(sub.accounts);
50
+ const directoryProfile = options_?.directoryProfile === true;
51
+ const options = directoryProfile ? [] : Array.isArray(sub.upgrade_options) ? sub.upgrade_options : [];
52
+ const steps = directoryProfile ? [] : Array.isArray(sub.next_steps) ? sub.next_steps : [];
5
53
  return [
6
54
  mdTitle('posterly subscription'),
7
55
  mdSection('Details', mdKeyValue([
@@ -12,15 +60,31 @@ function formatSubscription(result) {
12
60
  ['Trial ends', sub.trial_ends_at ? formatDateTime(sub.trial_ends_at) : 'n/a'],
13
61
  ['Paused at', sub.paused_at ? formatDateTime(sub.paused_at) : 'n/a'],
14
62
  ['Pause resumes at', sub.pause_resumes_at ? formatDateTime(sub.pause_resumes_at) : 'n/a'],
63
+ ...(connectedAccounts ? [['Connected accounts', connectedAccounts]] : []),
15
64
  ])),
16
- ].join('\n\n');
65
+ sub.extra_accounts ? formatExtraAccountsSection(sub.extra_accounts, directoryProfile) : '',
66
+ sub.extra_accounts?.payment_pending ? formatExtraAccountsPaymentPending(sub.extra_accounts.payment_pending) : '',
67
+ directoryProfile
68
+ ? `Plan and billing changes are made on the billing page: ${typeof sub.billing_url === 'string' && sub.billing_url ? sub.billing_url : 'https://www.poster.ly/dashboard/account/billing'}`
69
+ : '',
70
+ options.length
71
+ ? mdSection('Plans you can move to', mdBullets(options.map((o) => `${o.name}: $${o.monthly_price}/month or $${o.yearly_price}/year, ${o.max_accounts} connected accounts, ${o.included_credits} AI credits a month`)))
72
+ : '',
73
+ steps.length
74
+ ? mdSection('Next steps', steps.map((step, index) => [
75
+ `${index + 1}. ${step.text}`,
76
+ step.tool ? ` Tool: ${step.tool}${step.params ? ` ${JSON.stringify(step.params)}` : ''}` : '',
77
+ ].filter(Boolean).join('\n')).join('\n'))
78
+ : '',
79
+ ].filter(Boolean).join('\n\n');
17
80
  }
18
81
  export const getSubscriptionTool = {
19
82
  name: 'get_subscription',
20
- description: "Get the authenticated user's posterly subscription: status, tier, cancel-at-period-end, current period end, trial end, and pause state. Read-only. Requires the billing:read scope.",
83
+ description: "Get the authenticated user's posterly subscription: status, tier, cancel-at-period-end, period end, trial end and pause state. Also reports connected accounts in use and the account limit for the workspace this caller is acting in (plan tier plus any extra slots). Call this FIRST for \"upgrade\", \"change plan\", \"add accounts\" or \"how many accounts\": it returns the plans above this user's with prices, limits and credits, the Agency extra-accounts state (owners), and the exact next steps, ending at the billing page. Read-only. Requires the billing:read scope.",
21
84
  inputSchema: z.object({}),
22
85
  async execute(client) {
23
86
  const result = await client.getSubscription();
24
- return formatSubscription(result);
87
+ // Same switch index.ts uses to drop the billing mutations from the catalog.
88
+ return formatSubscription(result, { directoryProfile: process.env.POSTERLY_DIRECTORY_PROFILE === 'claude' });
25
89
  },
26
90
  };
@@ -0,0 +1,48 @@
1
+ import { z } from 'zod';
2
+ import type { ExtraAccountsPaymentPending, ExtraAccountsQuote, PosterlyClient } from '../lib/api-client.js';
3
+ import { type ToolContext } from '../lib/tool-runtime.js';
4
+ export declare function usdFromCents(cents: number | null | undefined): string;
5
+ export declare function intervalWord(interval: unknown): string;
6
+ /** Same wording as the hosted endpoint (lib/mcp/http-tools.ts). */
7
+ export declare function formatExtraAccountsPaymentPending(pending: ExtraAccountsPaymentPending | null | undefined): string;
8
+ export declare function formatExtraAccountsQuote(q: ExtraAccountsQuote): string;
9
+ type ManageExtraAccountInput = {
10
+ action: 'set';
11
+ extra_accounts: number;
12
+ workspace_id?: string;
13
+ expected_current_extra_accounts?: number;
14
+ expected_interval?: 'month' | 'year';
15
+ confirm?: boolean;
16
+ preview_id?: string;
17
+ };
18
+ export declare const manageExtraAccountTool: {
19
+ name: string;
20
+ description: string;
21
+ inputSchema: z.ZodObject<{
22
+ action: z.ZodEnum<["set"]>;
23
+ extra_accounts: z.ZodNumber;
24
+ workspace_id: z.ZodOptional<z.ZodString>;
25
+ expected_current_extra_accounts: z.ZodOptional<z.ZodNumber>;
26
+ expected_interval: z.ZodOptional<z.ZodEnum<["month", "year"]>>;
27
+ confirm: z.ZodOptional<z.ZodBoolean>;
28
+ preview_id: z.ZodOptional<z.ZodString>;
29
+ }, "strip", z.ZodTypeAny, {
30
+ action: "set";
31
+ extra_accounts: number;
32
+ workspace_id?: string | undefined;
33
+ confirm?: boolean | undefined;
34
+ preview_id?: string | undefined;
35
+ expected_current_extra_accounts?: number | undefined;
36
+ expected_interval?: "month" | "year" | undefined;
37
+ }, {
38
+ action: "set";
39
+ extra_accounts: number;
40
+ workspace_id?: string | undefined;
41
+ confirm?: boolean | undefined;
42
+ preview_id?: string | undefined;
43
+ expected_current_extra_accounts?: number | undefined;
44
+ expected_interval?: "month" | "year" | undefined;
45
+ }>;
46
+ execute(client: PosterlyClient, input: ManageExtraAccountInput, ctx: ToolContext): Promise<string>;
47
+ };
48
+ export {};
@@ -0,0 +1,161 @@
1
+ import { createHash } from 'node:crypto';
2
+ import { z } from 'zod';
3
+ import { formatDateTime, mdKeyValue, mdSection, mdTitle } from '../lib/format.js';
4
+ import { previewThenConfirm, readForPreview, validateArgs } from '../lib/tool-runtime.js';
5
+ export function usdFromCents(cents) {
6
+ const n = typeof cents === 'number' && Number.isFinite(cents) ? Math.round(cents) : 0;
7
+ return `$${(n / 100).toFixed(2)}`;
8
+ }
9
+ export function intervalWord(interval) {
10
+ return interval === 'year' ? 'year' : 'month';
11
+ }
12
+ /** Same wording as the hosted endpoint (lib/mcp/http-tools.ts). */
13
+ export function formatExtraAccountsPaymentPending(pending) {
14
+ if (!pending)
15
+ return '';
16
+ return mdSection('Payment waiting', [
17
+ mdKeyValue([
18
+ ['Requested extra accounts', pending.requested_extra_accounts],
19
+ ['Amount due', pending.amount_due_cents === null || pending.amount_due_cents === undefined ? 'n/a' : usdFromCents(pending.amount_due_cents)],
20
+ ['Expires', pending.expires_at ? formatDateTime(pending.expires_at) : 'n/a'],
21
+ ['Payment link', pending.hosted_invoice_url || 'not available, finish it in Billing'],
22
+ ]),
23
+ 'Nothing has been added yet. The accounts apply automatically once this invoice is paid. Until then posterly will not accept another change.',
24
+ ].join('\n\n'));
25
+ }
26
+ export function formatExtraAccountsQuote(q) {
27
+ const word = intervalWord(q.interval);
28
+ const verb = q.kind === 'none' ? 'No change' : q.kind === 'increase' ? 'Add accounts' : q.kind === 'remove' ? 'Remove all extra accounts' : 'Lower extra accounts';
29
+ const chargeLine = q.kind === 'increase'
30
+ ? (q.trialing
31
+ ? 'Nothing is charged today because the subscription is on a trial. Billing starts when the trial ends.'
32
+ : `The saved card on file is charged ${q.charge_today || usdFromCents(q.charge_today_cents)} today (prorated for the rest of this billing period) when this is confirmed. If the card needs confirmation or declines, nothing is added and a payment link is returned instead.`)
33
+ : q.kind === 'none'
34
+ ? 'Nothing changes and nothing is charged.'
35
+ : 'Nothing is charged and nothing is refunded for the rest of this billing period. The lower limit applies right away.';
36
+ return [
37
+ mdSection(verb, mdKeyValue([
38
+ ['Extra accounts now', q.current_extra_accounts],
39
+ ['Extra accounts after', q.new_extra_accounts],
40
+ ['Account limit after', q.account_limit_after],
41
+ ['Connected accounts in use', q.accounts_in_use],
42
+ ['Charge today', q.kind === 'increase' ? (q.trialing ? '$0.00 (trial)' : q.charge_today || usdFromCents(q.charge_today_cents)) : '$0.00'],
43
+ ['New recurring cost', `${q.new_recurring || usdFromCents(q.new_recurring_cents)} per ${word} for ${q.new_extra_accounts} extra accounts (${usdFromCents(q.price_per_account_cents)} each)`],
44
+ ])),
45
+ chargeLine,
46
+ ].join('\n\n');
47
+ }
48
+ export const manageExtraAccountTool = {
49
+ name: 'manage_extra_account',
50
+ description: 'Buy, raise, lower, or remove Agency extra-account slots. MONEY: raising charges the saved card. Owner only; billing:write. action=set (extra_accounts = desired TOTAL, 0 removes all; add 20+ at a time). Call without confirm for the quote and preview_id; after the user agrees, call with confirm=true, that preview_id and the expected_ fields from the quote. 3D Secure or a decline returns a payment link; nothing is added.',
51
+ inputSchema: z.object({
52
+ action: z.enum(['set']),
53
+ extra_accounts: z.number().int().min(0),
54
+ workspace_id: z.string().optional(),
55
+ expected_current_extra_accounts: z.number().int().min(0).optional(),
56
+ expected_interval: z.enum(['month', 'year']).optional(),
57
+ confirm: z.boolean().optional(),
58
+ preview_id: z.string().optional(),
59
+ }),
60
+ async execute(client, input, ctx) {
61
+ const { args } = validateArgs(ctx, 'manage_extra_account', input);
62
+ const call = args;
63
+ const workspace = call.workspace_id ? { workspace_id: call.workspace_id } : {};
64
+ // A preview is only issued for a change posterly can actually make: price
65
+ // it first, and answer a failed quote with an error and NO preview_id. The
66
+ // quote's current total and interval are pinned into the previewed args,
67
+ // so the confirm must repeat them and the API refuses a stale quote.
68
+ let quote = null;
69
+ let previewArgs = args;
70
+ if (call.confirm !== true) {
71
+ const read = await readForPreview(() => client.quoteExtraAccounts({ extra_accounts: call.extra_accounts, ...workspace }));
72
+ if (!read.ok) {
73
+ throw new Error([
74
+ 'No preview: this change cannot be made right now.',
75
+ read.error,
76
+ 'Nothing was changed and no preview_id was issued. Tell the user why, and fix the cause first (for example disconnect accounts, finish the pending payment, or pick at least 20 more than the current total).',
77
+ ].join('\n\n'));
78
+ }
79
+ quote = read.data.quote;
80
+ previewArgs = {
81
+ ...args,
82
+ expected_current_extra_accounts: quote.current_extra_accounts,
83
+ expected_interval: quote.interval,
84
+ };
85
+ }
86
+ return previewThenConfirm({
87
+ tool: 'manage_extra_account',
88
+ action: 'set',
89
+ args: previewArgs,
90
+ nonce: true,
91
+ legacyRefusal: 'Refusing to change extra accounts without confirm=true after explicit user confirmation.',
92
+ ctx,
93
+ describe: async () => [
94
+ formatExtraAccountsQuote(quote),
95
+ quote.kind === 'none' ? '' : 'Only confirm after the user has seen the price and agreed. The change is billed to the saved card, not to anything the user types here.',
96
+ mdSection('Fields to repeat on confirm', mdKeyValue([
97
+ ['extra_accounts', quote.new_extra_accounts],
98
+ ['expected_current_extra_accounts', quote.current_extra_accounts],
99
+ ['expected_interval', quote.interval],
100
+ ])),
101
+ ].filter(Boolean).join('\n\n'),
102
+ run: async () => {
103
+ if (typeof call.expected_current_extra_accounts !== 'number' || !call.expected_interval) {
104
+ throw new Error('Confirm needs expected_current_extra_accounts and expected_interval from the preview. Get a new preview.');
105
+ }
106
+ // The same preview_id always maps to the same request_id, so a replayed
107
+ // confirm can never buy twice.
108
+ const requestId = typeof call.preview_id === 'string' && call.preview_id
109
+ ? `mcp-${createHash('sha256').update(call.preview_id).digest('hex').slice(0, 40)}`
110
+ : undefined;
111
+ const result = await client.setExtraAccounts({
112
+ extra_accounts: call.extra_accounts,
113
+ expected_current_extra_accounts: call.expected_current_extra_accounts,
114
+ expected_interval: call.expected_interval,
115
+ ...(requestId ? { request_id: requestId } : {}),
116
+ ...workspace,
117
+ });
118
+ return formatExtraAccountsResult(result);
119
+ },
120
+ });
121
+ },
122
+ };
123
+ function formatExtraAccountsResult(d) {
124
+ if (d.status === 'payment_required') {
125
+ return [
126
+ mdTitle('Payment needed: nothing was added yet'),
127
+ 'The saved card needs confirmation (3D Secure) or was declined, so posterly did not add the accounts. Send the user to the payment link. The accounts apply automatically once it is paid.',
128
+ mdKeyValue([
129
+ ['Requested extra accounts', d.requested_extra_accounts],
130
+ ['Account limit once paid', d.account_limit_after_payment],
131
+ ['Amount due', d.payment_pending?.amount_due_cents === null || d.payment_pending?.amount_due_cents === undefined ? 'n/a' : usdFromCents(d.payment_pending.amount_due_cents)],
132
+ ['Link expires', d.payment_pending?.expires_at ? formatDateTime(d.payment_pending.expires_at) : 'n/a'],
133
+ ['Payment link', d.hosted_invoice_url || 'not available, ask the user to finish it in Billing'],
134
+ ]),
135
+ 'Call get_subscription afterwards to confirm the new limit.',
136
+ ].join('\n\n');
137
+ }
138
+ if (d.status === 'unchanged') {
139
+ return [
140
+ mdTitle('No change needed'),
141
+ `The workspace already has ${d.extra_accounts} extra accounts. The account limit is ${d.account_limit}.`,
142
+ ].join('\n\n');
143
+ }
144
+ const word = intervalWord(d.interval);
145
+ const headline = d.extra_accounts === 0
146
+ ? 'Removed all extra accounts'
147
+ : d.kind === 'increase'
148
+ ? `Added ${d.extra_accounts - d.previous_extra_accounts} extra accounts`
149
+ : `Lowered extra accounts to ${d.extra_accounts}`;
150
+ return [
151
+ mdTitle(headline),
152
+ `The account limit is now ${d.account_limit}.`,
153
+ mdKeyValue([
154
+ ['Extra accounts', `${d.previous_extra_accounts} to ${d.extra_accounts}`],
155
+ ['Included with Agency', d.included_accounts],
156
+ ['Connected accounts in use', d.accounts_in_use],
157
+ ['Recurring cost', `${usdFromCents(d.recurring_cents)} per ${word} (${usdFromCents(d.price_per_account_cents)} per extra account)`],
158
+ ]),
159
+ d.kind === 'increase' ? 'The prorated amount was charged to the saved card.' : '',
160
+ ].filter(Boolean).join('\n\n');
161
+ }
@@ -33,7 +33,7 @@ export declare const manageWorkspaceMemberTool: {
33
33
  preview_id: z.ZodOptional<z.ZodString>;
34
34
  }, "strip", z.ZodTypeAny, {
35
35
  workspace_id: string;
36
- action: "invite" | "update" | "remove";
36
+ action: "remove" | "invite" | "update";
37
37
  confirm?: boolean | undefined;
38
38
  preview_id?: string | undefined;
39
39
  email?: string | undefined;
@@ -45,7 +45,7 @@ export declare const manageWorkspaceMemberTool: {
45
45
  api_access?: boolean | undefined;
46
46
  }, {
47
47
  workspace_id: string;
48
- action: "invite" | "update" | "remove";
48
+ action: "remove" | "invite" | "update";
49
49
  confirm?: boolean | undefined;
50
50
  preview_id?: string | undefined;
51
51
  email?: string | undefined;
@@ -80,9 +80,9 @@ declare const instagramSettingsSchema: z.ZodObject<{
80
80
  option_d?: string | undefined;
81
81
  }>>;
82
82
  }, "strip", z.ZodTypeAny, {
83
+ kind?: "none" | "poll" | "comment_prompt" | undefined;
83
84
  type?: "none" | "poll" | "comment_prompt" | undefined;
84
85
  options?: string[] | undefined;
85
- kind?: "none" | "poll" | "comment_prompt" | undefined;
86
86
  extended_duration?: boolean | undefined;
87
87
  poll_attachment?: {
88
88
  options?: string[] | undefined;
@@ -92,9 +92,9 @@ declare const instagramSettingsSchema: z.ZodObject<{
92
92
  option_d?: string | undefined;
93
93
  } | undefined;
94
94
  }, {
95
+ kind?: "none" | "poll" | "comment_prompt" | undefined;
95
96
  type?: "none" | "poll" | "comment_prompt" | undefined;
96
97
  options?: string[] | undefined;
97
- kind?: "none" | "poll" | "comment_prompt" | undefined;
98
98
  extended_duration?: boolean | undefined;
99
99
  poll_attachment?: {
100
100
  options?: string[] | undefined;
@@ -161,9 +161,9 @@ declare const instagramSettingsSchema: z.ZodObject<{
161
161
  option_d?: string | undefined;
162
162
  } | undefined;
163
163
  caption_addon?: {
164
+ kind?: "none" | "poll" | "comment_prompt" | undefined;
164
165
  type?: "none" | "poll" | "comment_prompt" | undefined;
165
166
  options?: string[] | undefined;
166
- kind?: "none" | "poll" | "comment_prompt" | undefined;
167
167
  extended_duration?: boolean | undefined;
168
168
  poll_attachment?: {
169
169
  options?: string[] | undefined;
@@ -211,9 +211,9 @@ declare const instagramSettingsSchema: z.ZodObject<{
211
211
  option_d?: string | undefined;
212
212
  } | undefined;
213
213
  caption_addon?: {
214
+ kind?: "none" | "poll" | "comment_prompt" | undefined;
214
215
  type?: "none" | "poll" | "comment_prompt" | undefined;
215
216
  options?: string[] | undefined;
216
- kind?: "none" | "poll" | "comment_prompt" | undefined;
217
217
  extended_duration?: boolean | undefined;
218
218
  poll_attachment?: {
219
219
  options?: string[] | undefined;
@@ -785,9 +785,9 @@ export declare const updatePostTool: {
785
785
  option_d?: string | undefined;
786
786
  }>>;
787
787
  }, "strip", z.ZodTypeAny, {
788
+ kind?: "none" | "poll" | "comment_prompt" | undefined;
788
789
  type?: "none" | "poll" | "comment_prompt" | undefined;
789
790
  options?: string[] | undefined;
790
- kind?: "none" | "poll" | "comment_prompt" | undefined;
791
791
  extended_duration?: boolean | undefined;
792
792
  poll_attachment?: {
793
793
  options?: string[] | undefined;
@@ -797,9 +797,9 @@ export declare const updatePostTool: {
797
797
  option_d?: string | undefined;
798
798
  } | undefined;
799
799
  }, {
800
+ kind?: "none" | "poll" | "comment_prompt" | undefined;
800
801
  type?: "none" | "poll" | "comment_prompt" | undefined;
801
802
  options?: string[] | undefined;
802
- kind?: "none" | "poll" | "comment_prompt" | undefined;
803
803
  extended_duration?: boolean | undefined;
804
804
  poll_attachment?: {
805
805
  options?: string[] | undefined;
@@ -866,9 +866,9 @@ export declare const updatePostTool: {
866
866
  option_d?: string | undefined;
867
867
  } | undefined;
868
868
  caption_addon?: {
869
+ kind?: "none" | "poll" | "comment_prompt" | undefined;
869
870
  type?: "none" | "poll" | "comment_prompt" | undefined;
870
871
  options?: string[] | undefined;
871
- kind?: "none" | "poll" | "comment_prompt" | undefined;
872
872
  extended_duration?: boolean | undefined;
873
873
  poll_attachment?: {
874
874
  options?: string[] | undefined;
@@ -916,9 +916,9 @@ export declare const updatePostTool: {
916
916
  option_d?: string | undefined;
917
917
  } | undefined;
918
918
  caption_addon?: {
919
+ kind?: "none" | "poll" | "comment_prompt" | undefined;
919
920
  type?: "none" | "poll" | "comment_prompt" | undefined;
920
921
  options?: string[] | undefined;
921
- kind?: "none" | "poll" | "comment_prompt" | undefined;
922
922
  extended_duration?: boolean | undefined;
923
923
  poll_attachment?: {
924
924
  options?: string[] | undefined;
@@ -1434,9 +1434,9 @@ export declare const updatePostTool: {
1434
1434
  option_d?: string | undefined;
1435
1435
  } | undefined;
1436
1436
  caption_addon?: {
1437
+ kind?: "none" | "poll" | "comment_prompt" | undefined;
1437
1438
  type?: "none" | "poll" | "comment_prompt" | undefined;
1438
1439
  options?: string[] | undefined;
1439
- kind?: "none" | "poll" | "comment_prompt" | undefined;
1440
1440
  extended_duration?: boolean | undefined;
1441
1441
  poll_attachment?: {
1442
1442
  options?: string[] | undefined;
@@ -1652,9 +1652,9 @@ export declare const updatePostTool: {
1652
1652
  option_d?: string | undefined;
1653
1653
  } | undefined;
1654
1654
  caption_addon?: {
1655
+ kind?: "none" | "poll" | "comment_prompt" | undefined;
1655
1656
  type?: "none" | "poll" | "comment_prompt" | undefined;
1656
1657
  options?: string[] | undefined;
1657
- kind?: "none" | "poll" | "comment_prompt" | undefined;
1658
1658
  extended_duration?: boolean | undefined;
1659
1659
  poll_attachment?: {
1660
1660
  options?: string[] | undefined;
@@ -88,9 +88,9 @@ export declare const validatePostInputSchema: import("zod").ZodObject<{
88
88
  option_d?: string | undefined;
89
89
  }>>;
90
90
  }, "strip", import("zod").ZodTypeAny, {
91
+ kind?: "none" | "poll" | "comment_prompt" | undefined;
91
92
  type?: "none" | "poll" | "comment_prompt" | undefined;
92
93
  options?: string[] | undefined;
93
- kind?: "none" | "poll" | "comment_prompt" | undefined;
94
94
  extended_duration?: boolean | undefined;
95
95
  poll_attachment?: {
96
96
  options?: string[] | undefined;
@@ -100,9 +100,9 @@ export declare const validatePostInputSchema: import("zod").ZodObject<{
100
100
  option_d?: string | undefined;
101
101
  } | undefined;
102
102
  }, {
103
+ kind?: "none" | "poll" | "comment_prompt" | undefined;
103
104
  type?: "none" | "poll" | "comment_prompt" | undefined;
104
105
  options?: string[] | undefined;
105
- kind?: "none" | "poll" | "comment_prompt" | undefined;
106
106
  extended_duration?: boolean | undefined;
107
107
  poll_attachment?: {
108
108
  options?: string[] | undefined;
@@ -168,9 +168,9 @@ export declare const validatePostInputSchema: import("zod").ZodObject<{
168
168
  option_d?: string | undefined;
169
169
  } | undefined;
170
170
  caption_addon?: {
171
+ kind?: "none" | "poll" | "comment_prompt" | undefined;
171
172
  type?: "none" | "poll" | "comment_prompt" | undefined;
172
173
  options?: string[] | undefined;
173
- kind?: "none" | "poll" | "comment_prompt" | undefined;
174
174
  extended_duration?: boolean | undefined;
175
175
  poll_attachment?: {
176
176
  options?: string[] | undefined;
@@ -217,9 +217,9 @@ export declare const validatePostInputSchema: import("zod").ZodObject<{
217
217
  option_d?: string | undefined;
218
218
  } | undefined;
219
219
  caption_addon?: {
220
+ kind?: "none" | "poll" | "comment_prompt" | undefined;
220
221
  type?: "none" | "poll" | "comment_prompt" | undefined;
221
222
  options?: string[] | undefined;
222
- kind?: "none" | "poll" | "comment_prompt" | undefined;
223
223
  extended_duration?: boolean | undefined;
224
224
  poll_attachment?: {
225
225
  options?: string[] | undefined;
@@ -727,9 +727,9 @@ export declare const validatePostInputSchema: import("zod").ZodObject<{
727
727
  option_d?: string | undefined;
728
728
  } | undefined;
729
729
  caption_addon?: {
730
+ kind?: "none" | "poll" | "comment_prompt" | undefined;
730
731
  type?: "none" | "poll" | "comment_prompt" | undefined;
731
732
  options?: string[] | undefined;
732
- kind?: "none" | "poll" | "comment_prompt" | undefined;
733
733
  extended_duration?: boolean | undefined;
734
734
  poll_attachment?: {
735
735
  options?: string[] | undefined;
@@ -938,9 +938,9 @@ export declare const validatePostInputSchema: import("zod").ZodObject<{
938
938
  option_d?: string | undefined;
939
939
  } | undefined;
940
940
  caption_addon?: {
941
+ kind?: "none" | "poll" | "comment_prompt" | undefined;
941
942
  type?: "none" | "poll" | "comment_prompt" | undefined;
942
943
  options?: string[] | undefined;
943
- kind?: "none" | "poll" | "comment_prompt" | undefined;
944
944
  extended_duration?: boolean | undefined;
945
945
  poll_attachment?: {
946
946
  options?: string[] | undefined;
@@ -1196,9 +1196,9 @@ export declare const validatePostTool: {
1196
1196
  option_d?: string | undefined;
1197
1197
  }>>;
1198
1198
  }, "strip", import("zod").ZodTypeAny, {
1199
+ kind?: "none" | "poll" | "comment_prompt" | undefined;
1199
1200
  type?: "none" | "poll" | "comment_prompt" | undefined;
1200
1201
  options?: string[] | undefined;
1201
- kind?: "none" | "poll" | "comment_prompt" | undefined;
1202
1202
  extended_duration?: boolean | undefined;
1203
1203
  poll_attachment?: {
1204
1204
  options?: string[] | undefined;
@@ -1208,9 +1208,9 @@ export declare const validatePostTool: {
1208
1208
  option_d?: string | undefined;
1209
1209
  } | undefined;
1210
1210
  }, {
1211
+ kind?: "none" | "poll" | "comment_prompt" | undefined;
1211
1212
  type?: "none" | "poll" | "comment_prompt" | undefined;
1212
1213
  options?: string[] | undefined;
1213
- kind?: "none" | "poll" | "comment_prompt" | undefined;
1214
1214
  extended_duration?: boolean | undefined;
1215
1215
  poll_attachment?: {
1216
1216
  options?: string[] | undefined;
@@ -1276,9 +1276,9 @@ export declare const validatePostTool: {
1276
1276
  option_d?: string | undefined;
1277
1277
  } | undefined;
1278
1278
  caption_addon?: {
1279
+ kind?: "none" | "poll" | "comment_prompt" | undefined;
1279
1280
  type?: "none" | "poll" | "comment_prompt" | undefined;
1280
1281
  options?: string[] | undefined;
1281
- kind?: "none" | "poll" | "comment_prompt" | undefined;
1282
1282
  extended_duration?: boolean | undefined;
1283
1283
  poll_attachment?: {
1284
1284
  options?: string[] | undefined;
@@ -1325,9 +1325,9 @@ export declare const validatePostTool: {
1325
1325
  option_d?: string | undefined;
1326
1326
  } | undefined;
1327
1327
  caption_addon?: {
1328
+ kind?: "none" | "poll" | "comment_prompt" | undefined;
1328
1329
  type?: "none" | "poll" | "comment_prompt" | undefined;
1329
1330
  options?: string[] | undefined;
1330
- kind?: "none" | "poll" | "comment_prompt" | undefined;
1331
1331
  extended_duration?: boolean | undefined;
1332
1332
  poll_attachment?: {
1333
1333
  options?: string[] | undefined;
@@ -1835,9 +1835,9 @@ export declare const validatePostTool: {
1835
1835
  option_d?: string | undefined;
1836
1836
  } | undefined;
1837
1837
  caption_addon?: {
1838
+ kind?: "none" | "poll" | "comment_prompt" | undefined;
1838
1839
  type?: "none" | "poll" | "comment_prompt" | undefined;
1839
1840
  options?: string[] | undefined;
1840
- kind?: "none" | "poll" | "comment_prompt" | undefined;
1841
1841
  extended_duration?: boolean | undefined;
1842
1842
  poll_attachment?: {
1843
1843
  options?: string[] | undefined;
@@ -2046,9 +2046,9 @@ export declare const validatePostTool: {
2046
2046
  option_d?: string | undefined;
2047
2047
  } | undefined;
2048
2048
  caption_addon?: {
2049
+ kind?: "none" | "poll" | "comment_prompt" | undefined;
2049
2050
  type?: "none" | "poll" | "comment_prompt" | undefined;
2050
2051
  options?: string[] | undefined;
2051
- kind?: "none" | "poll" | "comment_prompt" | undefined;
2052
2052
  extended_duration?: boolean | undefined;
2053
2053
  poll_attachment?: {
2054
2054
  options?: string[] | undefined;