postfast-mcp 0.13.0 → 0.14.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.
Files changed (43) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +2 -2
  3. package/dist/core/app.d.ts +0 -8
  4. package/dist/core/app.js +1 -25
  5. package/dist/core/app.js.map +1 -1
  6. package/dist/core/backend-port.d.ts +5 -0
  7. package/dist/core/build-tools.d.ts +26 -11
  8. package/dist/core/build-tools.js +73 -16
  9. package/dist/core/build-tools.js.map +1 -1
  10. package/dist/core/confirm-token.d.ts +12 -6
  11. package/dist/core/confirm-token.js +24 -9
  12. package/dist/core/confirm-token.js.map +1 -1
  13. package/dist/core/index.d.ts +1 -0
  14. package/dist/core/index.js +1 -0
  15. package/dist/core/index.js.map +1 -1
  16. package/dist/core/instructions.js +4 -4
  17. package/dist/core/instructions.js.map +1 -1
  18. package/dist/core/scope-challenge.d.ts +46 -0
  19. package/dist/core/scope-challenge.js +73 -0
  20. package/dist/core/scope-challenge.js.map +1 -0
  21. package/dist/core/shared.d.ts +2 -0
  22. package/dist/core/shared.js +2 -0
  23. package/dist/core/shared.js.map +1 -1
  24. package/dist/core/tool-def.d.ts +11 -1
  25. package/dist/core/tools/accounts.js +7 -0
  26. package/dist/core/tools/accounts.js.map +1 -1
  27. package/dist/core/tools/app.js +5 -0
  28. package/dist/core/tools/app.js.map +1 -1
  29. package/dist/core/tools/inbox-confirm.d.ts +6 -7
  30. package/dist/core/tools/inbox-confirm.js +171 -83
  31. package/dist/core/tools/inbox-confirm.js.map +1 -1
  32. package/dist/core/tools/inbox.js +16 -6
  33. package/dist/core/tools/inbox.js.map +1 -1
  34. package/dist/core/tools/posts.js +6 -0
  35. package/dist/core/tools/posts.js.map +1 -1
  36. package/dist/core/tools/tiktok.js +1 -0
  37. package/dist/core/tools/tiktok.js.map +1 -1
  38. package/dist/core/tools/uploads.js +2 -0
  39. package/dist/core/tools/uploads.js.map +1 -1
  40. package/dist/core/tools/workspaces.js +2 -0
  41. package/dist/core/tools/workspaces.js.map +1 -1
  42. package/dist/stdio/index.js +1 -1
  43. package/package.json +1 -1
@@ -0,0 +1,73 @@
1
+ import { LOOPBACK_HOSTS } from './shared.js';
2
+ /**
3
+ * Thrown by a host's port when the backend refuses a call because the access
4
+ * token lacks a scope. registerCatalogTools() with `scopeChallenge` answers it
5
+ * with insufficientScopeResult() for the tool's own scopes; without that
6
+ * option it is an ordinary tool error carrying this message.
7
+ */
8
+ export class InsufficientScopeError extends Error {
9
+ constructor(message = 'This connection is not authorized for this action.') {
10
+ super(message);
11
+ this.name = 'InsufficientScopeError';
12
+ }
13
+ }
14
+ /** By class or by name, so a second copy of this module in a host's tree still counts. */
15
+ export function isInsufficientScopeError(err) {
16
+ return (err instanceof InsufficientScopeError ||
17
+ err?.name === 'InsufficientScopeError');
18
+ }
19
+ /**
20
+ * Printable ASCII without space, quote or backslash: an RFC 6749 scope-token,
21
+ * and safe inside a quoted header value.
22
+ */
23
+ const isHeaderSafe = (value) => typeof value === 'string' && /^[\x21\x23-\x5B\x5D-\x7E]+$/.test(value);
24
+ /** Throws unless the URL is https (http only on a loopback host) and safe inside a quoted header value. */
25
+ export function assertScopeChallengeOptions(options) {
26
+ const value = options?.resourceMetadataUrl;
27
+ let url;
28
+ try {
29
+ url = new URL(value);
30
+ }
31
+ catch {
32
+ url = undefined;
33
+ }
34
+ const secure = url?.protocol === 'https:' || (url?.protocol === 'http:' && LOOPBACK_HOSTS.has(url.hostname));
35
+ if (!url || !secure || !isHeaderSafe(value)) {
36
+ throw new Error(`scopeChallenge.resourceMetadataUrl must be an https URL, such as https://example.com/.well-known/oauth-protected-resource; got ${JSON.stringify(value)}.`);
37
+ }
38
+ }
39
+ /**
40
+ * The result for a call the token's scopes don't cover: an error whose
41
+ * `_meta["mcp/www_authenticate"]` holds an RFC 6750 insufficient_scope
42
+ * challenge pointing at the protected resource metadata, so a client can ask
43
+ * the user for the missing scopes and retry. The text tells the model the same.
44
+ */
45
+ export function insufficientScopeResult(options) {
46
+ assertScopeChallengeOptions(options);
47
+ // Scope values that could break the header are left out of it.
48
+ const scopes = options.scopes.filter(isHeaderSafe);
49
+ const granted = options.grantedScopes?.filter(isHeaderSafe);
50
+ const missing = granted ? scopes.filter((scope) => !granted.includes(scope)) : [];
51
+ const shown = missing.length ? missing : scopes;
52
+ const needed = shown.length
53
+ ? `the ${shown.join(', ')} permission${shown.length === 1 ? '' : 's'}`
54
+ : 'more permissions';
55
+ const requested = granted ? [...new Set([...granted, ...scopes])] : [];
56
+ const params = [
57
+ `resource_metadata="${options.resourceMetadataUrl}"`,
58
+ 'error="insufficient_scope"',
59
+ `error_description="This action needs ${needed}"`,
60
+ ...(requested.length ? [`scope="${requested.join(' ')}"`] : []),
61
+ ];
62
+ return {
63
+ content: [
64
+ {
65
+ type: 'text',
66
+ text: `This connection doesn't have permission for this action yet: it needs ${needed}. Reconnect PostFast and allow it, then try again.`,
67
+ },
68
+ ],
69
+ isError: true,
70
+ _meta: { 'mcp/www_authenticate': [`Bearer ${params.join(', ')}`] },
71
+ };
72
+ }
73
+ //# sourceMappingURL=scope-challenge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scope-challenge.js","sourceRoot":"","sources":["../../src/core/scope-challenge.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AA8B7C;;;;;GAKG;AACH,MAAM,OAAO,sBAAuB,SAAQ,KAAK;IAC/C,YAAY,OAAO,GAAG,oDAAoD;QACxE,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,wBAAwB,CAAC;IACvC,CAAC;CACF;AAED,0FAA0F;AAC1F,MAAM,UAAU,wBAAwB,CAAC,GAAY;IACnD,OAAO,CACL,GAAG,YAAY,sBAAsB;QACpC,GAA6C,EAAE,IAAI,KAAK,wBAAwB,CAClF,CAAC;AACJ,CAAC;AAED;;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IAClF,MAAM,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC;IAChD,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM;QACzB,CAAC,CAAC,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE;QACtE,CAAC,CAAC,kBAAkB,CAAC;IACvB,MAAM,SAAS,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACvE,MAAM,MAAM,GAAG;QACb,sBAAsB,OAAO,CAAC,mBAAmB,GAAG;QACpD,4BAA4B;QAC5B,wCAAwC,MAAM,GAAG;QACjD,GAAG,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,UAAU,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;KAChE,CAAC;IACF,OAAO;QACL,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,yEAAyE,MAAM,oDAAoD;aAC1I;SACF;QACD,OAAO,EAAE,IAAI;QACb,KAAK,EAAE,EAAE,sBAAsB,EAAE,CAAC,UAAU,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE;KACnE,CAAC;AACJ,CAAC"}
@@ -20,6 +20,8 @@ export declare const DOCUMENT_MIME_TYPES: readonly ["application/pdf", "applicat
20
20
  * upload tools don't take.
21
21
  */
22
22
  export declare function uploadTypeFor(contentType: string): UploadType | undefined;
23
+ /** Hosts where a host-supplied URL may be plain http (local development). */
24
+ export declare const LOOPBACK_HOSTS: Set<string>;
23
25
  /** Some MCP clients stringify complex params — parse them back before validation. */
24
26
  export declare function jsonParse<T extends z.ZodTypeAny>(schema: T): z.ZodPreprocess<T>;
25
27
  /** Optional per-call workspace selector, injected only on the remote binding. */
@@ -60,6 +60,8 @@ export function uploadTypeFor(contentType) {
60
60
  return 'DOCUMENT';
61
61
  return undefined;
62
62
  }
63
+ /** Hosts where a host-supplied URL may be plain http (local development). */
64
+ export const LOOPBACK_HOSTS = new Set(['localhost', '127.0.0.1', '[::1]']);
63
65
  /** Some MCP clients stringify complex params — parse them back before validation. */
64
66
  export function jsonParse(schema) {
65
67
  return z.preprocess((val) => {
@@ -1 +1 @@
1
- {"version":3,"file":"shared.js","sourceRoot":"","sources":["../../src/core/shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,UAAU;IACV,WAAW;IACX,GAAG;IACH,QAAQ;IACR,UAAU;IACV,SAAS;IACT,SAAS;IACT,SAAS;IACT,WAAW;IACX,UAAU;IACV,yBAAyB;CACjB,CAAC;AAEX,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,QAAQ,CAAU,CAAC;AACpF,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,MAAM,EAAE,SAAS,EAAE,QAAQ,CAAU,CAAC;AAClF,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,CAAU,CAAC;AAC9E,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,OAAO,EAAE,WAAW,CAAU,CAAC;AAC/D,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,kBAAkB,EAAE,UAAU,CAAU,CAAC;AAClF,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,kBAAkB;IAClB,aAAa;IACb,UAAU;IACV,UAAU;IACV,YAAY;CACJ,CAAC;AAEX,MAAM,CAAC,MAAM,gB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C;QACH,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,MAAM,CAAC,CAAC;AACb,CAAC;AAED,iFAAiF;AACjF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC;KAC9B,IAAI,EAAE;KACN,QAAQ,EAAE;KACV,QAAQ,CACP,6FAA6F,CAC9F,CAAC"}
@@ -2,6 +2,7 @@ import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
2
2
  import type { ZodRawShape } from 'zod';
3
3
  import type { AppOptions } from './app.js';
4
4
  import type { BackendPort } from './backend-port.js';
5
+ import type { SecurityScheme } from './scope-challenge.js';
5
6
  /** The two deployments a catalog tool can ship in. */
6
7
  export type Binding = 'stdio' | 'remote';
7
8
  /**
@@ -48,11 +49,18 @@ export interface ToolDef {
48
49
  annotations: ToolAnnotations;
49
50
  /** Replaces `annotations` on the remote binding. */
50
51
  remoteAnnotations?: ToolAnnotations;
52
+ /**
53
+ * The OAuth scopes the backend checks for this tool's calls, listed on the
54
+ * remote binding as `securitySchemes`. Empty when any token of the
55
+ * connection may call it. Every tool the remote binding lists declares
56
+ * this; the stdio binding never lists it.
57
+ */
58
+ scopes?: readonly string[];
51
59
  /** Extra tool metadata, e.g. the ChatGPT file-param marker on upload_media. */
52
60
  _meta?: Record<string, unknown>;
53
61
  /** False only for tools that are not scoped to a workspace (list_workspaces). */
54
62
  workspaceScoped?: boolean;
55
- /** The tool signs confirm tokens, so it exists only with BuildToolsOptions.confirmGate. */
63
+ /** The tool signs or redeems confirm tokens, so it exists only with BuildToolsOptions.confirmGate. */
56
64
  needsConfirmSecret?: boolean;
57
65
  /** The tool exists only when the host turns the app on (BuildToolsOptions.app). */
58
66
  appOnly?: boolean;
@@ -88,6 +96,8 @@ export interface ResolvedTool {
88
96
  annotations: ResolvedToolAnnotations;
89
97
  _meta?: Record<string, unknown>;
90
98
  icons?: ToolIcon[];
99
+ /** Remote only: the tool's OAuth scopes, also mirrored in `_meta.securitySchemes`. */
100
+ securitySchemes?: SecurityScheme[];
91
101
  portMethod?: keyof BackendPort;
92
102
  run: ToolDef['run'];
93
103
  toResult?: ToolDef['toResult'];
@@ -8,6 +8,7 @@ export const accountTools = [
8
8
  description: 'List all social media accounts connected to the workspace. Each account includes connectionStatus (CONNECTED or DISABLED) and disabledReason (null unless DISABLED), plus followerCount (latest stored snapshot, a string; absent for platforms without follower data), followerCountUpdatedAt, and inboxCapable (whether the account can appear in the social inbox, i.e. comment ingestion is supported). A DISABLED account will not publish until the user reconnects it — pre-check before scheduling. For a follower trend over time, use get_follower_history.',
9
9
  inputSchema: {},
10
10
  annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: false },
11
+ scopes: ['accounts:read'],
11
12
  run: (port, _args, workspaceId) => port.listAccounts(workspaceId),
12
13
  },
13
14
  {
@@ -20,6 +21,7 @@ export const accountTools = [
20
21
  },
21
22
  // openWorld false: reads boards already stored in our database.
22
23
  annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: false },
24
+ scopes: ['accounts:read'],
23
25
  run: (port, args, workspaceId) => port.listPinterestBoards(args.socialMediaId, workspaceId),
24
26
  },
25
27
  {
@@ -32,6 +34,7 @@ export const accountTools = [
32
34
  },
33
35
  // openWorld false: reads playlists already stored in our database.
34
36
  annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: false },
37
+ scopes: ['accounts:read'],
35
38
  run: (port, args, workspaceId) => port.listYoutubePlaylists(args.socialMediaId, workspaceId),
36
39
  },
37
40
  {
@@ -44,6 +47,7 @@ export const accountTools = [
44
47
  },
45
48
  // openWorld false: reads locations already stored in our database.
46
49
  annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: false },
50
+ scopes: ['accounts:read'],
47
51
  run: (port, args, workspaceId) => port.listGbpLocations(args.socialMediaId, workspaceId),
48
52
  },
49
53
  {
@@ -63,6 +67,7 @@ export const accountTools = [
63
67
  .describe('Range end (ISO 8601). Defaults to now; range is capped at 365 days.'),
64
68
  },
65
69
  annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: false },
70
+ scopes: ['analytics:read'],
66
71
  run: (port, args, workspaceId) => port.getFollowerHistory(args, workspaceId),
67
72
  },
68
73
  {
@@ -74,6 +79,7 @@ export const accountTools = [
74
79
  query: z.string().min(2).describe('Place search text, min 2 characters (e.g. "eiffel tower")'),
75
80
  },
76
81
  annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: true },
82
+ scopes: ['accounts:read'],
77
83
  run: (port, args, workspaceId) => port.searchPlaces(args.query, workspaceId),
78
84
  },
79
85
  {
@@ -121,6 +127,7 @@ export const accountTools = [
121
127
  // destructive: sendEmail delivers a real email that cannot be recalled, and the
122
128
  // minted link grants account-connect access until it expires.
123
129
  annotations: { readOnlyHint: false, destructiveHint: true, openWorldHint: true },
130
+ scopes: ['connectlink:generate'],
124
131
  run: (port, args, workspaceId) => port.generateConnectLink(args, workspaceId),
125
132
  },
126
133
  ];
@@ -1 +1 @@
1
- {"version":3,"file":"accounts.js","sourceRoot":"","sources":["../../../src/core/tools/accounts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGzC,MAAM,CAAC,MAAM,YAAY,GAAc;IACrC;QACE,IAAI,EAAE,eAAe;QACrB,OAAO,EAAE,MAAM;QACf,KAAK,EAAE,eAAe;QACtB,WAAW,EACT,uiBAAuiB;QACziB,WAAW,EAAE,EAAE;QACf,WAAW,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,eAAe,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE;QACjF,GAAG,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,WAAW,CAAC;KAClE;IACD;QACE,IAAI,EAAE,uBAAuB;QAC7B,OAAO,EAAE,MAAM;QACf,KAAK,EAAE,uBAAuB;QAC9B,WAAW,EACT,sKAAsK;QACx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,GAAG,CAAC,EAAE,CAAC;iBACP,OAAO,CAAC,CAAC,CAAC;iBACV,QAAQ,CAAC,uCAAuC,CAAC;YACpD,SAAS,EAAE,CAAC;iBACT,OAAO,EAAE;iBACT,OAAO,CAAC,KAAK,CAAC;iBACd,QAAQ,CACP,OAAO,KAAK,QAAQ;gBAClB,CAAC,CAAC,uFAAuF;gBACzF,CAAC,CAAC,yBAAyB,CAC9B;YACH,KAAK,EAAE,CAAC;iBACL,KAAK,EAAE;iBACP,QAAQ,EAAE;iBACV,QAAQ,CAAC,mDAAmD,CAAC;YAChE,SAAS,EAAE,CAAC;iBACT,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;iBACxB,QAAQ,EAAE;iBACV,QAAQ,EAAE;iBACV,QAAQ,CACP,gKAAgK,CACjK;YACH,WAAW,EAAE,CAAC;iBACX,MAAM,EAAE;iBACR,GAAG,CAAC,IAAI,CAAC;iBACT,QAAQ,EAAE;iBACV,QAAQ,CACP,wVAAwV,CACzV;YACH,UAAU,EAAE,CAAC;iBACV,MAAM,EAAE;iBACR,GAAG,CAAC,GAAG,CAAC;iBACR,QAAQ,EAAE;iBACV,QAAQ,CACP,kHAAkH,CACnH;SACJ,CAAC;QACF,gFAAgF;QAChF,8DAA8D;QAC9D,WAAW,EAAE,EAAE,YAAY,EAAE,KAAK,EAAE,eAAe,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE;QAChF,MAAM,EAAE,CAAC,sBAAsB,CAAC;QAChC,GAAG,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,EAAE,CAC/B,IAAI,CAAC,mBAAmB,CAAC,IAAkC,EAAE,WAAW,CAAC;KAC5E;CACF,CAAC"}
@@ -261,6 +261,8 @@ const calendarTool = (name, title, entrypoint, description) => ({
261
261
  description,
262
262
  inputSchema: { refresh: refreshField },
263
263
  annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: false },
264
+ // The calendar's own call; its workspace list needs no scope.
265
+ scopes: ['posts:read', 'accounts:read'],
264
266
  icons: [APP_ICON],
265
267
  _meta: appToolMeta(entrypoint),
266
268
  portMethod: 'getAppCalendar',
@@ -286,6 +288,7 @@ export const appTools = [
286
288
  postId: z.uuid().describe('The post to open, from the calendar.'),
287
289
  },
288
290
  annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: false },
291
+ scopes: ['posts:read'],
289
292
  _meta: appToolMeta(),
290
293
  portMethod: 'getAppPost',
291
294
  run: (port, args, workspaceId, ctx) => loadPost(port, args, workspaceId, ctx?.app),
@@ -310,6 +313,8 @@ export const appTools = [
310
313
  idempotentHint: false,
311
314
  openWorldHint: false,
312
315
  },
316
+ // Analytics only: any token of the connection may record a button.
317
+ scopes: [],
313
318
  _meta: appToolMeta(),
314
319
  portMethod: 'recordAppAction',
315
320
  run: async (port, args, workspaceId) => {
@@ -1 +1 @@
1
- {"version":3,"file":"app.js","sourceRoot":"","sources":["../../../src/core/tools/app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAmB,MAAM,WAAW,CAAC;AAenE,MAAM,MAAM,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AACnC,6EAA6E;AAC7E,iEAAiE;AACjE,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAC3B,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAC7B,MAAM,WAAW,GAAG,GAAG,CAAC;AACxB,MAAM,YAAY,GAAG,EAAE,CAAC;AACxB,kEAAkE;AAClE,MAAM,aAAa,GAAG,GAAG,CAAC;AAC1B,oFAAoF;AACpF,MAAM,eAAe,GAAG,MAAM,CAAC;AAC/B,kFAAkF;AAClF,MAAM,mBAAmB,GAAG,OAAO,CAAC;AACpC,gFAAgF;AAChF,MAAM,cAAc,GAAG,GAAG,CAAC;AAC3B,MAAM,oBAAoB,GAAG,GAAG,CAAC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E,CAAC,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,GAAG,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,GAAG,EAAE,GAAG,CAAC;QAClF,QAAQ,EAAE,UAAU;KACrB;IACD;QACE,IAAI,EAAE,mBAAmB;QACzB,OAAO,EAAE,QAAQ;QACjB,OAAO,EAAE,IAAI;QACb,KAAK,EAAE,wBAAwB;QAC/B,WAAW,EACT,qNAAqN;QACvN,WAAW,EAAE;YACX,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,QAAQ,CAAC,2BAA2B,CAAC;YACjE,UAAU,EAAE,CAAC;iBACV,IAAI,CAAC,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;iBAC1B,QAAQ,EAAE;iBACV,QAAQ,CAAC,qFAAqF,CAAC;SACnG;QACD,WAAW,EAAE;YACX,YAAY,EAAE,KAAK;YACnB,eAAe,EAAE,KAAK;YACtB,cAAc,EAAE,KAAK;YACrB,aAAa,EAAE,KAAK;SACrB;QACD,mEAAmE;QACnE,MAAM,EAAE,EAAE;QACV,KAAK,EAAE,WAAW,EAAE;QACpB,UAAU,EAAE,iBAAiB;QAC7B,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,EAAE;YACrC,IAAI,CAAC,IAAI,CAAC,eAAe;gBAAE,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;YAChF,MAAM,IAAI,CAAC,eAAe,CAAC,IAAgC,EAAE,WAAW,CAAC,CAAC;YAC1E,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;QAC5B,CAAC;KACF;CACF,CAAC"}
@@ -1,11 +1,10 @@
1
1
  import type { ToolDef } from '../tool-def.js';
2
2
  /**
3
- * Comment replies, Instagram private replies and comment deletions in two
4
- * steps, on the remote binding (where they replace reply_to_inbox_item,
5
- * send_inbox_private_reply and set_inbox_item_state DELETE). prepare returns a preview and a signed token and calls nothing.
6
- * confirm repeats the same values, so the client's approval prompt for the
7
- * destructive call shows the real reply text, and any change fails the
8
- * signature. The token is not tied to a user: confirm runs with the caller's
9
- * own credentials, so the backend still decides who may reply or delete.
3
+ * Comment replies, Instagram private replies and comment deletions on the
4
+ * remote binding, where they replace reply_to_inbox_item,
5
+ * send_inbox_private_reply and set_inbox_item_state DELETE. Each operation is
6
+ * its own pair of tools with its own schema and annotations, and nothing
7
+ * reaches the platform until the second tool runs with a token from its own
8
+ * preview.
10
9
  */
11
10
  export declare const inboxConfirmTools: ToolDef[];
@@ -1,6 +1,5 @@
1
1
  import { z } from 'zod';
2
2
  import { redeem, sign } from '../confirm-token.js';
3
- const CONFIRM_ACTIONS = ['REPLY', 'PRIVATE_REPLY', 'DELETE'];
4
3
  /** The confirm secret, handed to run() by buildTools() when the host passes confirmGate. */
5
4
  function secretOf(ctx) {
6
5
  if (!ctx?.confirmSecret) {
@@ -8,95 +7,184 @@ function secretOf(ctx) {
8
7
  }
9
8
  return ctx.confirmSecret;
10
9
  }
10
+ // A preview changes nothing and calls nothing: it signs a token over exactly what it shows.
11
+ const PREVIEW_ANNOTATIONS = {
12
+ readOnlyHint: true,
13
+ destructiveHint: false,
14
+ openWorldHint: false,
15
+ };
16
+ const SAME = 'Must match the preview exactly.';
11
17
  /**
12
- * Comment replies, Instagram private replies and comment deletions in two
13
- * steps, on the remote binding (where they replace reply_to_inbox_item,
14
- * send_inbox_private_reply and set_inbox_item_state DELETE). prepare returns a preview and a signed token and calls nothing.
15
- * confirm repeats the same values, so the client's approval prompt for the
16
- * destructive call shows the real reply text, and any change fails the
17
- * signature. The token is not tied to a user: confirm runs with the caller's
18
- * own credentials, so the backend still decides who may reply or delete.
18
+ * The two tools of one operation. The preview signs the workspace, item,
19
+ * operation and text and calls nothing. The second tool repeats the same
20
+ * values, so the client's approval prompt shows the real reply text, and any
21
+ * change fails the signature; it redeems the token once, then calls the
22
+ * backend with the caller's own credentials, so the backend still decides who
23
+ * may reply or delete. The token's jti goes along as the idempotency key: the
24
+ * used-token list is per process, and a repeat on another replica of the host,
25
+ * or after a timeout that hid a completed send, must not send twice.
26
+ */
27
+ function commentOperationTools(op) {
28
+ const fieldsOf = (args, workspaceId) => ({
29
+ ws: workspaceId,
30
+ itemId: args.itemId,
31
+ action: op.action,
32
+ ...(op.textDescription ? { text: args.text } : {}),
33
+ });
34
+ return [
35
+ {
36
+ name: op.preview.name,
37
+ binding: 'remote',
38
+ needsConfirmSecret: true,
39
+ title: op.preview.title,
40
+ description: op.preview.description,
41
+ inputSchema: {
42
+ itemId: z.uuid().describe(op.itemIdDescription),
43
+ ...(op.textDescription ? { text: z.string().min(1).describe(op.textDescription) } : {}),
44
+ },
45
+ annotations: PREVIEW_ANNOTATIONS,
46
+ // No backend call, so any token of the connection may preview; the
47
+ // backend checks the operation's scope when the second tool runs.
48
+ scopes: [],
49
+ // Listed only when the port can carry the operation out.
50
+ portMethod: op.perform.portMethod,
51
+ run: async (_port, args, workspaceId, ctx) => {
52
+ const fields = fieldsOf(args, workspaceId);
53
+ if (op.textDescription && !fields.text)
54
+ throw new Error('text is required.');
55
+ const { confirmToken, expiresAt } = sign(fields, secretOf(ctx));
56
+ return {
57
+ preview: {
58
+ action: op.action,
59
+ itemId: fields.itemId,
60
+ ...(fields.text === undefined ? {} : { text: fields.text }),
61
+ ...(workspaceId === undefined ? {} : { workspaceId }),
62
+ },
63
+ confirmToken,
64
+ expiresAt,
65
+ next: op.preview.next,
66
+ };
67
+ },
68
+ },
69
+ {
70
+ name: op.perform.name,
71
+ binding: 'remote',
72
+ needsConfirmSecret: true,
73
+ title: op.perform.title,
74
+ description: op.perform.description,
75
+ inputSchema: {
76
+ confirmToken: z.string().min(1).describe(`The confirmToken from ${op.preview.name}`),
77
+ itemId: z.uuid().describe(SAME),
78
+ ...(op.textDescription ? { text: z.string().min(1).describe(SAME) } : {}),
79
+ },
80
+ annotations: op.perform.annotations,
81
+ scopes: op.perform.scopes,
82
+ portMethod: op.perform.portMethod,
83
+ run: async (port, args, workspaceId, ctx) => {
84
+ const fields = fieldsOf(args, workspaceId);
85
+ // Reserves the token before the platform call; released only if that call throws.
86
+ const { jti, release } = redeem(args.confirmToken, fields, secretOf(ctx));
87
+ try {
88
+ return await op.perform.call(port, fields, workspaceId, `confirm:${jti}`);
89
+ }
90
+ catch (err) {
91
+ release();
92
+ throw err;
93
+ }
94
+ },
95
+ },
96
+ ];
97
+ }
98
+ /**
99
+ * Comment replies, Instagram private replies and comment deletions on the
100
+ * remote binding, where they replace reply_to_inbox_item,
101
+ * send_inbox_private_reply and set_inbox_item_state DELETE. Each operation is
102
+ * its own pair of tools with its own schema and annotations, and nothing
103
+ * reaches the platform until the second tool runs with a token from its own
104
+ * preview.
19
105
  */
20
106
  export const inboxConfirmTools = [
21
- {
22
- name: 'prepare_inbox_action',
23
- binding: 'remote',
24
- needsConfirmSecret: true,
25
- title: 'Prepare Comment Reply or Deletion',
26
- description: "Prepare a reply to a comment, an Instagram private reply, or a comment deletion WITHOUT doing it. REPLY posts publicly under the comment; PRIVATE_REPLY sends an Instagram private reply that arrives as a direct message (one per comment, within 7 days; check the item's canPrivateReply); DELETE removes the comment on the platform permanently (not supported on Threads). Before a reply, check the conversation's canReply and maxReplyLength. Returns a preview and a confirmToken. Then show the user which comment it is (its author and text) and exactly what will happen, and wait for their yes in the conversation before calling confirm_inbox_action, even if they already told you what to write. Nothing reaches the platform in this step.",
27
- inputSchema: {
28
- itemId: z.uuid().describe('The comment item id (from list_inbox_items)'),
29
- action: z
30
- .enum(CONFIRM_ACTIONS)
31
- .describe('REPLY (public, under the comment), PRIVATE_REPLY (Instagram only) or DELETE (permanent)'),
32
- text: z
33
- .string()
34
- .min(1)
35
- .optional()
36
- .describe('Reply text. Required for REPLY and PRIVATE_REPLY; omit for DELETE.'),
107
+ ...commentOperationTools({
108
+ action: 'REPLY',
109
+ itemIdDescription: 'The comment item id to reply under (from list_inbox_items)',
110
+ textDescription: "Reply text. Must fit the conversation's maxReplyLength.",
111
+ preview: {
112
+ name: 'preview_comment_reply',
113
+ title: 'Preview Comment Reply',
114
+ description: "Preview a public reply to a comment WITHOUT sending it. Pass the comment item's id (from list_inbox_items, not the conversation id) and the reply text, after checking the conversation's canReply and maxReplyLength. Returns a preview and a confirmToken; nothing reaches the platform. Then show the user which comment it is (its author and text) and the exact reply, and wait for their yes in the conversation before calling reply_to_comment, even if they already told you what to write. A reply on Threads can't be removed through PostFast afterwards, so say so in the preview.",
115
+ next: 'Show the user which comment this is (author and text) and the exact reply that will appear publicly under it, and wait for their yes in the conversation, even if they already gave you the text. Only then call reply_to_comment with this confirmToken and the same itemId and text, plus the same workspaceId only if you passed one.',
37
116
  },
38
- annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: false },
39
- portMethod: 'replyToInboxItem',
40
- run: async (_port, args, workspaceId, ctx) => {
41
- const action = args.action;
42
- const itemId = args.itemId;
43
- const text = action === 'DELETE' ? undefined : args.text;
44
- if (action !== 'DELETE' && !text) {
45
- throw new Error('text is required for REPLY and PRIVATE_REPLY.');
46
- }
47
- const { confirmToken, expiresAt } = sign({ ws: workspaceId, itemId, action, text }, secretOf(ctx));
48
- return {
49
- preview: {
50
- action,
51
- itemId,
52
- ...(text === undefined ? {} : { text }),
53
- ...(workspaceId === undefined ? {} : { workspaceId }),
54
- },
55
- confirmToken,
56
- expiresAt,
57
- next: 'Show the user which comment this is (author and text) and exactly what will be sent or deleted, and wait for their yes in the conversation, even if they already gave you the text. Only then call confirm_inbox_action with this confirmToken and the same itemId, action and text, plus the same workspaceId only if you passed one.',
58
- };
117
+ perform: {
118
+ name: 'reply_to_comment',
119
+ title: 'Reply to Comment',
120
+ description: 'Post a public reply under a comment, exactly as previewed with preview_comment_reply. Pass its confirmToken with the same itemId and text (and workspaceId, if you used one); anything different is rejected. Call it only after the user has seen the preview and said yes in the conversation. Replies on Threads can\'t be removed through PostFast. A token expires 15 minutes after the preview and works once. Failures return inbox.* codes (for example replyTooLong, replyNotSupported, rateLimited).',
121
+ // Not destructive: a reply adds a comment and changes nothing that exists.
122
+ // Not declared idempotent: it publishes something new. A repeat of the
123
+ // same token sends once only while the host passes the idempotency key on.
124
+ annotations: {
125
+ readOnlyHint: false,
126
+ destructiveHint: false,
127
+ idempotentHint: false,
128
+ openWorldHint: true,
129
+ },
130
+ scopes: ['inbox:reply'],
131
+ portMethod: 'replyToInboxItem',
132
+ call: (port, { itemId, text }, workspaceId, idempotencyKey) => port.replyToInboxItem({ itemId, text: text, idempotencyKey }, workspaceId),
59
133
  },
60
- },
61
- {
62
- name: 'confirm_inbox_action',
63
- binding: 'remote',
64
- needsConfirmSecret: true,
65
- title: 'Confirm Comment Reply or Deletion',
66
- description: 'Carry out a reply or deletion prepared with prepare_inbox_action. Pass its confirmToken with the same itemId, action and text (and workspaceId, if you used one); anything different is rejected. Call it only after the user has seen the preview and said yes in the conversation. Replies on Threads cannot be removed through PostFast, private replies cannot be unsent, and deletions cannot be undone. A token expires 15 minutes after it was prepared and works once. Failures return the underlying inbox.* codes (for example replyTooLong, privateReplyAlreadySent, deleteNotSupported).',
67
- inputSchema: {
68
- confirmToken: z.string().min(1).describe('The confirmToken from prepare_inbox_action'),
69
- itemId: z.uuid().describe('Must match the prepared action exactly.'),
70
- action: z.enum(CONFIRM_ACTIONS).describe('Must match the prepared action exactly.'),
71
- text: z.string().min(1).optional().describe('Must match the prepared action exactly.'),
134
+ }),
135
+ ...commentOperationTools({
136
+ action: 'PRIVATE_REPLY',
137
+ itemIdDescription: 'The Instagram comment item id to reply privately to (canPrivateReply must be true)',
138
+ textDescription: 'Private reply text (max 1,000 bytes)',
139
+ preview: {
140
+ name: 'preview_private_reply',
141
+ title: 'Preview Instagram Private Reply',
142
+ description: "Instagram only: preview a private reply to a comment WITHOUT sending it. It arrives in the commenter's direct messages (possibly in their message requests) and is allowed once per comment, within 7 days of the comment, up to 1,000 bytes; check the comment item's canPrivateReply first (from list_inbox_items). Returns a preview and a confirmToken; nothing is sent. Then show the user which comment it is (its author and text) and the exact message, and wait for their yes in the conversation before calling send_private_reply, even if they already told you what to write.",
143
+ next: "Show the user which comment this is (author and text) and the exact private reply, which arrives in the commenter's direct messages, and wait for their yes in the conversation, even if they already gave you the text. Only then call send_private_reply with this confirmToken and the same itemId and text, plus the same workspaceId only if you passed one.",
72
144
  },
73
- annotations: {
74
- readOnlyHint: false,
75
- destructiveHint: true,
76
- idempotentHint: false,
77
- openWorldHint: true,
145
+ perform: {
146
+ name: 'send_private_reply',
147
+ title: 'Send Instagram Private Reply',
148
+ description: "Instagram only: send a private reply to a comment, exactly as previewed with preview_private_reply. Pass its confirmToken with the same itemId and text (and workspaceId, if you used one); anything different is rejected. Call it only after the user has seen the preview and said yes in the conversation. A private reply can't be unsent, and a comment takes only one: a second fails with inbox.privateReplyAlreadySent. A token expires 15 minutes after the preview and works once. Other failures include privateReplyWindowExpired and privateReplyNotSupported.",
149
+ // Not destructive: it sends a new message and changes nothing that exists.
150
+ // Not idempotent, like reply_to_comment.
151
+ annotations: {
152
+ readOnlyHint: false,
153
+ destructiveHint: false,
154
+ idempotentHint: false,
155
+ openWorldHint: true,
156
+ },
157
+ scopes: ['inbox:reply'],
158
+ portMethod: 'sendInboxPrivateReply',
159
+ call: (port, { itemId, text }, workspaceId, idempotencyKey) => port.sendInboxPrivateReply({ itemId, text: text, idempotencyKey }, workspaceId),
78
160
  },
79
- portMethod: 'replyToInboxItem',
80
- run: async (port, args, workspaceId, ctx) => {
81
- const action = args.action;
82
- const itemId = args.itemId;
83
- const text = action === 'DELETE' ? undefined : args.text;
84
- // Reserves the token before the platform call; released only if that call throws.
85
- const release = redeem(args.confirmToken, { ws: workspaceId, itemId, action, text }, secretOf(ctx));
86
- try {
87
- if (action === 'REPLY') {
88
- return await port.replyToInboxItem({ itemId, text: text }, workspaceId);
89
- }
90
- if (action === 'PRIVATE_REPLY') {
91
- return await port.sendInboxPrivateReply({ itemId, text: text }, workspaceId);
92
- }
93
- return await port.setInboxItemState({ itemId, action: 'DELETE' }, workspaceId);
94
- }
95
- catch (err) {
96
- release();
97
- throw err;
98
- }
161
+ }),
162
+ ...commentOperationTools({
163
+ action: 'DELETE',
164
+ itemIdDescription: 'The comment item id to delete (from list_inbox_items)',
165
+ preview: {
166
+ name: 'preview_comment_deletion',
167
+ title: 'Preview Comment Deletion',
168
+ description: "Preview deleting a comment WITHOUT deleting it. Deleting removes the comment from the platform for good; Threads doesn't support it, so offer to hide the comment with set_inbox_item_state instead. Returns a preview and a confirmToken; nothing changes. Then show the user which comment it is (its author and text) and that it will be deleted permanently, and wait for their yes in the conversation before calling delete_comment.",
169
+ next: 'Show the user which comment this is (author and text) and that it will be deleted from the platform for good, and wait for their yes in the conversation. Only then call delete_comment with this confirmToken and the same itemId, plus the same workspaceId only if you passed one.',
170
+ },
171
+ perform: {
172
+ name: 'delete_comment',
173
+ title: 'Delete Comment',
174
+ description: "Delete a comment from the platform for good, exactly as previewed with preview_comment_deletion. Pass its confirmToken with the same itemId (and workspaceId, if you used one); anything different is rejected. Call it only after the user has seen the preview and said yes in the conversation. Deleting can't be undone. A token expires 15 minutes after the preview and works once. Failures return inbox.* codes (for example deleteNotSupported on Threads).",
175
+ // Destructive: the comment is removed from the platform for good.
176
+ // Idempotent: deleting a comment that is already gone changes nothing more,
177
+ // so this call needs no idempotency key.
178
+ annotations: {
179
+ readOnlyHint: false,
180
+ destructiveHint: true,
181
+ idempotentHint: true,
182
+ openWorldHint: true,
183
+ },
184
+ scopes: ['inbox:manage'],
185
+ portMethod: 'setInboxItemState',
186
+ call: (port, { itemId }, workspaceId) => port.setInboxItemState({ itemId, action: 'DELETE' }, workspaceId),
99
187
  },
100
- },
188
+ }),
101
189
  ];
102
190
  //# sourceMappingURL=inbox-confirm.js.map