@framers/agentos-ext-tool-multi-channel-post 0.1.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/LICENSE ADDED
@@ -0,0 +1,98 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
10
+
11
+ "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
12
+
13
+ "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
14
+
15
+ "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
16
+
17
+ "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
18
+
19
+ "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
20
+
21
+ "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
22
+
23
+ "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
24
+
25
+ "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
26
+
27
+ "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
28
+
29
+ 2. Grant of Copyright License.
30
+
31
+ Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
32
+
33
+ 3. Grant of Patent License.
34
+
35
+ Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
36
+
37
+ 4. Redistribution.
38
+
39
+ You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
40
+
41
+ (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
42
+
43
+ (b) You must cause any modified files to carry prominent notices stating that You changed the files; and
44
+
45
+ (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
46
+
47
+ (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
48
+
49
+ You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
50
+
51
+ 5. Submission of Contributions.
52
+
53
+ Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
54
+
55
+ 6. Trademarks.
56
+
57
+ This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
58
+
59
+ 7. Disclaimer of Warranty.
60
+
61
+ Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
62
+
63
+ 8. Limitation of Liability.
64
+
65
+ In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
66
+
67
+ 9. Accepting Warranty or Additional Liability.
68
+
69
+ While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
70
+
71
+ END OF TERMS AND CONDITIONS
72
+
73
+ APPENDIX: How to apply the Apache License to your work.
74
+
75
+ To apply the Apache License to your work, attach the following
76
+ boilerplate notice, with the fields enclosed by brackets "[]"
77
+ replaced with your own identifying information. (Don't include
78
+ the brackets!) The text should be enclosed in the appropriate
79
+ comment syntax for the file format. We also recommend that a
80
+ file or class name and description of purpose be included on the
81
+ same "printed page" as the copyright notice for easier
82
+ identification within third-party archives.
83
+
84
+ Copyright (c) 2025 Framers
85
+
86
+ Licensed under the Apache License, Version 2.0 (the "License");
87
+ you may not use this file except in compliance with the License.
88
+ You may obtain a copy of the License at
89
+
90
+ http://www.apache.org/licenses/LICENSE-2.0
91
+
92
+ Unless required by applicable law or agreed to in writing, software
93
+ distributed under the License is distributed on an "AS IS" BASIS,
94
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
95
+ See the License for the specific language governing permissions and
96
+ limitations under the License.
97
+
98
+
@@ -0,0 +1,128 @@
1
+ /**
2
+ * @fileoverview Multi-Channel Post Tool — publish adapted content to N platforms.
3
+ *
4
+ * This tool acts as an orchestrator that delegates to per-platform post tools
5
+ * (twitterPost, instagramPost, linkedinPost, etc.) and aggregates results.
6
+ * It adapts content for each platform's constraints before posting.
7
+ */
8
+ export interface MultiChannelPostInput {
9
+ /** Base content to publish. */
10
+ content: string;
11
+ /** Target platforms (e.g., ['twitter', 'linkedin', 'instagram']). */
12
+ platforms: string[];
13
+ /** Optional per-platform content overrides. */
14
+ adaptations?: Record<string, string>;
15
+ /** Optional media URLs to attach. */
16
+ mediaUrls?: string[];
17
+ /** Optional per-platform argument overrides passed to the platform tool. */
18
+ platformConfigs?: Record<string, Record<string, unknown>>;
19
+ /** Optional hashtags to include (adapted per platform). */
20
+ hashtags?: string[];
21
+ /** Optional: if true, don't actually post — just show adapted content. */
22
+ dryRun?: boolean;
23
+ }
24
+ export interface PlatformPostResult {
25
+ platform: string;
26
+ success: boolean;
27
+ postId?: string;
28
+ url?: string;
29
+ adaptedContent?: string;
30
+ error?: string;
31
+ }
32
+ export interface MultiChannelPostOutput {
33
+ totalPlatforms: number;
34
+ successful: number;
35
+ failed: number;
36
+ results: PlatformPostResult[];
37
+ }
38
+ export type ToolExecutorFn = (toolName: string, args: Record<string, unknown>) => Promise<{
39
+ success: boolean;
40
+ data?: Record<string, unknown>;
41
+ error?: string;
42
+ }>;
43
+ export declare class MultiChannelPostTool {
44
+ readonly id = "multiChannelPost";
45
+ readonly name = "multiChannelPost";
46
+ readonly displayName = "Post to Multiple Platforms";
47
+ readonly description: string;
48
+ readonly category = "social";
49
+ readonly version = "0.1.0";
50
+ readonly hasSideEffects = true;
51
+ readonly inputSchema: {
52
+ type: "object";
53
+ properties: {
54
+ content: {
55
+ type: string;
56
+ description: string;
57
+ };
58
+ platforms: {
59
+ type: string;
60
+ items: {
61
+ type: string;
62
+ };
63
+ description: string;
64
+ };
65
+ adaptations: {
66
+ type: string;
67
+ additionalProperties: {
68
+ type: string;
69
+ };
70
+ description: string;
71
+ };
72
+ mediaUrls: {
73
+ type: string;
74
+ items: {
75
+ type: string;
76
+ };
77
+ description: string;
78
+ };
79
+ platformConfigs: {
80
+ type: string;
81
+ additionalProperties: {
82
+ type: string;
83
+ additionalProperties: boolean;
84
+ };
85
+ description: string;
86
+ };
87
+ hashtags: {
88
+ type: string;
89
+ items: {
90
+ type: string;
91
+ };
92
+ description: string;
93
+ };
94
+ dryRun: {
95
+ type: string;
96
+ description: string;
97
+ };
98
+ };
99
+ required: string[];
100
+ };
101
+ /** Platform character limits for basic truncation. */
102
+ private static readonly PLATFORM_LIMITS;
103
+ /** Platform hashtag conventions. */
104
+ private static readonly HASHTAG_STYLE;
105
+ /** Platform name -> per-platform post tool name. */
106
+ private static readonly TOOL_NAME_MAP;
107
+ private toolExecutor?;
108
+ setToolExecutor(executor: ToolExecutorFn): void;
109
+ execute(args: MultiChannelPostInput): Promise<{
110
+ success: boolean;
111
+ data?: MultiChannelPostOutput;
112
+ error?: string;
113
+ }>;
114
+ /** Adapt content for a specific platform's constraints and conventions. */
115
+ private adaptForPlatform;
116
+ /** Map platform to its per-platform post tool name. */
117
+ private getPostToolName;
118
+ /** Build platform-specific tool arguments. */
119
+ private buildToolArgs;
120
+ private getOptionalString;
121
+ private getOptionalStringArray;
122
+ private getOptionalNumber;
123
+ private getOptionalBoolean;
124
+ private requireString;
125
+ private requireNumber;
126
+ private requireStringArray;
127
+ }
128
+ //# sourceMappingURL=MultiChannelPostTool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MultiChannelPostTool.d.ts","sourceRoot":"","sources":["../src/MultiChannelPostTool.ts"],"names":[],"mappings":"AACA;;;;;;GAMG;AAMH,MAAM,WAAW,qBAAqB;IACpC,+BAA+B;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,qEAAqE;IACrE,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,+CAA+C;IAC/C,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,qCAAqC;IACrC,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,4EAA4E;IAC5E,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAC1D,2DAA2D;IAC3D,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,0EAA0E;IAC1E,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM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C,OAAO,CACX,IAAI,EAAE,qBAAqB,GAC1B,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,IAAI,CAAC,EAAE,sBAAsB,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAqE/E,2EAA2E;IAC3E,OAAO,CAAC,gBAAgB;IAgCxB,uDAAuD;IACvD,OAAO,CAAC,eAAe;IAIvB,8CAA8C;IAC9C,OAAO,CAAC,aAAa;IAoKrB,OAAO,CAAC,iBAAiB;IAIzB,OAAO,CAAC,sBAAsB;IAM9B,OAAO,CAAC,iBAAiB;IAIzB,OAAO,CAAC,kBAAkB;IAI1B,OAAO,CAAC,aAAa;IAKrB,OAAO,CAAC,aAAa;IAKrB,OAAO,CAAC,kBAAkB;CAI3B"}
@@ -0,0 +1,366 @@
1
+ // @ts-nocheck
2
+ /**
3
+ * @fileoverview Multi-Channel Post Tool — publish adapted content to N platforms.
4
+ *
5
+ * This tool acts as an orchestrator that delegates to per-platform post tools
6
+ * (twitterPost, instagramPost, linkedinPost, etc.) and aggregates results.
7
+ * It adapts content for each platform's constraints before posting.
8
+ */
9
+ /* ------------------------------------------------------------------ */
10
+ /* MultiChannelPostTool */
11
+ /* ------------------------------------------------------------------ */
12
+ export class MultiChannelPostTool {
13
+ id = 'multiChannelPost';
14
+ name = 'multiChannelPost';
15
+ displayName = 'Post to Multiple Platforms';
16
+ description = 'Publish content to multiple social media platforms simultaneously with automatic ' +
17
+ 'platform-specific content adaptation. Supports Twitter, Instagram, Reddit, YouTube, ' +
18
+ 'TikTok, Pinterest, LinkedIn, Facebook, Threads, Bluesky, Mastodon.';
19
+ category = 'social';
20
+ version = '0.1.0';
21
+ hasSideEffects = true;
22
+ inputSchema = {
23
+ type: 'object',
24
+ properties: {
25
+ content: {
26
+ type: 'string',
27
+ description: 'Base content text to publish across platforms',
28
+ },
29
+ platforms: {
30
+ type: 'array',
31
+ items: { type: 'string' },
32
+ description: 'Target platforms: twitter, instagram, reddit, youtube, tiktok, pinterest, linkedin, facebook, threads, bluesky, mastodon',
33
+ },
34
+ adaptations: {
35
+ type: 'object',
36
+ additionalProperties: { type: 'string' },
37
+ description: 'Optional per-platform content overrides (platform name -> custom text)',
38
+ },
39
+ mediaUrls: {
40
+ type: 'array',
41
+ items: { type: 'string' },
42
+ description: 'Media URLs or file paths to attach',
43
+ },
44
+ platformConfigs: {
45
+ type: 'object',
46
+ additionalProperties: {
47
+ type: 'object',
48
+ additionalProperties: true,
49
+ },
50
+ description: 'Optional per-platform tool argument overrides (e.g. subreddit, boardId, videoUrl, communityId).',
51
+ },
52
+ hashtags: {
53
+ type: 'array',
54
+ items: { type: 'string' },
55
+ description: 'Hashtags to include (adapted per platform conventions)',
56
+ },
57
+ dryRun: {
58
+ type: 'boolean',
59
+ description: 'If true, return adapted content without posting',
60
+ },
61
+ },
62
+ required: ['content', 'platforms'],
63
+ };
64
+ /* -------------------------------------------------------------- */
65
+ /* Platform metadata */
66
+ /* -------------------------------------------------------------- */
67
+ /** Platform character limits for basic truncation. */
68
+ static PLATFORM_LIMITS = {
69
+ twitter: 280,
70
+ threads: 500,
71
+ bluesky: 300,
72
+ mastodon: 500,
73
+ farcaster: 320,
74
+ instagram: 2200,
75
+ tiktok: 2200,
76
+ pinterest: 500,
77
+ linkedin: 3000,
78
+ facebook: 63206,
79
+ reddit: 40000,
80
+ youtube: 5000,
81
+ devto: 100000,
82
+ medium: 100000,
83
+ };
84
+ /** Platform hashtag conventions. */
85
+ static HASHTAG_STYLE = {
86
+ twitter: 'inline',
87
+ instagram: 'footer',
88
+ linkedin: 'footer',
89
+ facebook: 'inline',
90
+ threads: 'inline',
91
+ mastodon: 'inline',
92
+ tiktok: 'inline',
93
+ reddit: 'none',
94
+ bluesky: 'none',
95
+ pinterest: 'none',
96
+ youtube: 'inline',
97
+ };
98
+ /** Platform name -> per-platform post tool name. */
99
+ static TOOL_NAME_MAP = {
100
+ twitter: 'twitterPost',
101
+ instagram: 'instagramPost',
102
+ reddit: 'redditSubmitPost',
103
+ youtube: 'youtubeUpload',
104
+ tiktok: 'tiktokUpload',
105
+ pinterest: 'pinterestPin',
106
+ linkedin: 'linkedinPost',
107
+ facebook: 'facebookPost',
108
+ threads: 'threadsPost',
109
+ bluesky: 'blueskyPost',
110
+ mastodon: 'mastodonPost',
111
+ farcaster: 'farcasterCast',
112
+ lemmy: 'lemmyPost',
113
+ };
114
+ /* -------------------------------------------------------------- */
115
+ /* Tool executor — set by the orchestrator that loads this ext */
116
+ /* -------------------------------------------------------------- */
117
+ toolExecutor;
118
+ setToolExecutor(executor) {
119
+ this.toolExecutor = executor;
120
+ }
121
+ /* -------------------------------------------------------------- */
122
+ /* execute() */
123
+ /* -------------------------------------------------------------- */
124
+ async execute(args) {
125
+ const results = [];
126
+ for (const platform of args.platforms) {
127
+ const adaptedContent = args.adaptations?.[platform] ??
128
+ this.adaptForPlatform(args.content, platform, args.hashtags);
129
+ // Dry-run mode: collect adapted content without posting.
130
+ if (args.dryRun) {
131
+ results.push({ platform, success: true, adaptedContent });
132
+ continue;
133
+ }
134
+ try {
135
+ const toolName = this.getPostToolName(platform);
136
+ const toolArgs = this.buildToolArgs(platform, adaptedContent, args.mediaUrls, args.platformConfigs?.[platform]);
137
+ if (this.toolExecutor) {
138
+ const result = await this.toolExecutor(toolName, toolArgs);
139
+ results.push({
140
+ platform,
141
+ success: result.success,
142
+ postId: (result.data?.id ?? result.data?.postId),
143
+ url: result.data?.url,
144
+ adaptedContent,
145
+ error: result.error,
146
+ });
147
+ }
148
+ else {
149
+ results.push({
150
+ platform,
151
+ success: false,
152
+ adaptedContent,
153
+ error: `No tool executor available. Platform tool "${toolName}" cannot be invoked.`,
154
+ });
155
+ }
156
+ }
157
+ catch (err) {
158
+ const message = err instanceof Error ? err.message : String(err);
159
+ results.push({
160
+ platform,
161
+ success: false,
162
+ adaptedContent,
163
+ error: message,
164
+ });
165
+ }
166
+ }
167
+ const successful = results.filter((r) => r.success).length;
168
+ return {
169
+ success: successful > 0,
170
+ data: {
171
+ totalPlatforms: args.platforms.length,
172
+ successful,
173
+ failed: args.platforms.length - successful,
174
+ results,
175
+ },
176
+ };
177
+ }
178
+ /* -------------------------------------------------------------- */
179
+ /* Content adaptation */
180
+ /* -------------------------------------------------------------- */
181
+ /** Adapt content for a specific platform's constraints and conventions. */
182
+ adaptForPlatform(content, platform, hashtags) {
183
+ const limit = MultiChannelPostTool.PLATFORM_LIMITS[platform] ?? 5000;
184
+ const hashtagStyle = MultiChannelPostTool.HASHTAG_STYLE[platform] ?? 'none';
185
+ let text = content;
186
+ // Append hashtags according to platform convention.
187
+ if (hashtags?.length && hashtagStyle !== 'none') {
188
+ const tags = hashtags.map((t) => (t.startsWith('#') ? t : `#${t}`));
189
+ if (hashtagStyle === 'footer') {
190
+ text = text + '\n\n' + tags.join(' ');
191
+ }
192
+ else {
193
+ text = text + ' ' + tags.join(' ');
194
+ }
195
+ }
196
+ // Truncate if the text exceeds the platform limit.
197
+ if (text.length > limit) {
198
+ text = text.substring(0, limit - 3) + '...';
199
+ }
200
+ return text;
201
+ }
202
+ /* -------------------------------------------------------------- */
203
+ /* Tool name / args mapping */
204
+ /* -------------------------------------------------------------- */
205
+ /** Map platform to its per-platform post tool name. */
206
+ getPostToolName(platform) {
207
+ return MultiChannelPostTool.TOOL_NAME_MAP[platform] ?? `${platform}Post`;
208
+ }
209
+ /** Build platform-specific tool arguments. */
210
+ buildToolArgs(platform, content, mediaUrls, platformConfig) {
211
+ const config = platformConfig ?? {};
212
+ const mediaUrl = this.getOptionalString(config['mediaUrl']) ?? mediaUrls?.[0];
213
+ const mediaPath = this.getOptionalString(config['mediaPath']) ?? mediaUrl;
214
+ switch (platform) {
215
+ case 'twitter':
216
+ return { text: content, mediaPath };
217
+ case 'instagram':
218
+ return {
219
+ caption: content,
220
+ imageUrls: this.requireStringArray(this.getOptionalStringArray(config['imageUrls']) ?? mediaUrls, 'instagram requires imageUrls (provide mediaUrls or platformConfigs.instagram.imageUrls)'),
221
+ };
222
+ case 'reddit': {
223
+ const type = this.getOptionalString(config['type']) ??
224
+ (mediaUrl ? 'image' : 'text');
225
+ const title = this.getOptionalString(config['title']) ??
226
+ content.substring(0, 300);
227
+ const bodyContent = this.getOptionalString(config['content']) ??
228
+ (type === 'image' || type === 'link'
229
+ ? this.requireString(mediaUrl, `reddit ${type} post requires a URL (provide mediaUrls or platformConfigs.reddit.content)`)
230
+ : content);
231
+ return {
232
+ subreddit: this.getOptionalString(config['subreddit']) ?? 'self',
233
+ title,
234
+ content: bodyContent,
235
+ type,
236
+ pollOptions: this.getOptionalStringArray(config['pollOptions']),
237
+ pollDurationDays: this.getOptionalNumber(config['pollDurationDays']),
238
+ flairId: this.getOptionalString(config['flairId']),
239
+ nsfw: this.getOptionalBoolean(config['nsfw']),
240
+ spoiler: this.getOptionalBoolean(config['spoiler']),
241
+ };
242
+ }
243
+ case 'youtube':
244
+ return {
245
+ videoUrl: this.requireString(this.getOptionalString(config['videoUrl']) ?? mediaUrl, 'youtube requires videoUrl (provide mediaUrls or platformConfigs.youtube.videoUrl)'),
246
+ title: this.getOptionalString(config['title']) ??
247
+ content.substring(0, 100),
248
+ description: this.getOptionalString(config['description']) ?? content,
249
+ tags: this.getOptionalStringArray(config['tags']),
250
+ categoryId: this.getOptionalString(config['categoryId']),
251
+ privacyStatus: this.getOptionalString(config['privacyStatus']),
252
+ mimeType: this.getOptionalString(config['mimeType']),
253
+ };
254
+ case 'tiktok':
255
+ return {
256
+ videoUrl: this.requireString(this.getOptionalString(config['videoUrl']) ?? mediaUrl, 'tiktok requires videoUrl (provide mediaUrls or platformConfigs.tiktok.videoUrl)'),
257
+ caption: this.getOptionalString(config['caption']) ?? content,
258
+ hashtags: this.getOptionalStringArray(config['hashtags']),
259
+ privacyLevel: this.getOptionalString(config['privacyLevel']),
260
+ disableComment: this.getOptionalBoolean(config['disableComment']),
261
+ disableDuet: this.getOptionalBoolean(config['disableDuet']),
262
+ disableStitch: this.getOptionalBoolean(config['disableStitch']),
263
+ coverTimestampMs: this.getOptionalNumber(config['coverTimestampMs']),
264
+ };
265
+ case 'pinterest': {
266
+ const mediaUrlsForCarousel = this.getOptionalStringArray(config['mediaUrls']);
267
+ return {
268
+ boardId: this.requireString(this.getOptionalString(config['boardId']), 'pinterest requires boardId (provide platformConfigs.pinterest.boardId)'),
269
+ title: this.getOptionalString(config['title']) ??
270
+ content.substring(0, 100),
271
+ description: this.getOptionalString(config['description']) ?? content,
272
+ link: this.getOptionalString(config['link']),
273
+ mediaType: this.getOptionalString(config['mediaType']) ??
274
+ (mediaUrlsForCarousel && mediaUrlsForCarousel.length > 1
275
+ ? 'carousel'
276
+ : 'image'),
277
+ mediaUrl: this.requireString(this.getOptionalString(config['mediaUrl']) ?? mediaUrl, 'pinterest requires mediaUrl (provide mediaUrls or platformConfigs.pinterest.mediaUrl)'),
278
+ mediaUrls: mediaUrlsForCarousel,
279
+ coverImageUrl: this.getOptionalString(config['coverImageUrl']),
280
+ altText: this.getOptionalString(config['altText']),
281
+ hashtags: this.getOptionalStringArray(config['hashtags']),
282
+ };
283
+ }
284
+ case 'linkedin':
285
+ return { text: content, mediaPath };
286
+ case 'facebook':
287
+ return {
288
+ text: content,
289
+ mediaPath,
290
+ link: this.getOptionalString(config['link']),
291
+ mediaType: this.getOptionalString(config['mediaType']),
292
+ pageId: this.getOptionalString(config['pageId']),
293
+ };
294
+ case 'threads':
295
+ return {
296
+ text: content,
297
+ imageUrl: this.getOptionalString(config['imageUrl']) ?? mediaUrl,
298
+ videoUrl: this.getOptionalString(config['videoUrl']),
299
+ carouselItems: config['carouselItems'],
300
+ };
301
+ case 'bluesky':
302
+ return {
303
+ text: content,
304
+ imagePaths: this.getOptionalStringArray(config['imagePaths']),
305
+ langs: this.getOptionalStringArray(config['langs']),
306
+ };
307
+ case 'mastodon':
308
+ return {
309
+ text: content,
310
+ mediaPath,
311
+ spoilerText: this.getOptionalString(config['spoilerText']),
312
+ visibility: this.getOptionalString(config['visibility']),
313
+ sensitive: this.getOptionalBoolean(config['sensitive']),
314
+ language: this.getOptionalString(config['language']),
315
+ };
316
+ case 'farcaster':
317
+ return {
318
+ text: content,
319
+ embeds: this.getOptionalStringArray(config['embeds']) ??
320
+ (mediaUrl ? [mediaUrl] : undefined),
321
+ channelId: this.getOptionalString(config['channelId']),
322
+ };
323
+ case 'lemmy':
324
+ return {
325
+ communityId: this.requireNumber(this.getOptionalNumber(config['communityId']), 'lemmy requires communityId (provide platformConfigs.lemmy.communityId)'),
326
+ name: this.getOptionalString(config['name']) ??
327
+ content.substring(0, 200),
328
+ body: this.getOptionalString(config['body']) ?? content,
329
+ url: this.getOptionalString(config['url']) ?? mediaUrl,
330
+ };
331
+ default:
332
+ return { text: content, mediaPath };
333
+ }
334
+ }
335
+ getOptionalString(value) {
336
+ return typeof value === 'string' && value.trim() !== '' ? value : undefined;
337
+ }
338
+ getOptionalStringArray(value) {
339
+ if (!Array.isArray(value))
340
+ return undefined;
341
+ const values = value.filter((v) => typeof v === 'string' && v.trim() !== '');
342
+ return values.length ? values : undefined;
343
+ }
344
+ getOptionalNumber(value) {
345
+ return typeof value === 'number' && Number.isFinite(value) ? value : undefined;
346
+ }
347
+ getOptionalBoolean(value) {
348
+ return typeof value === 'boolean' ? value : undefined;
349
+ }
350
+ requireString(value, error) {
351
+ if (!value)
352
+ throw new Error(error);
353
+ return value;
354
+ }
355
+ requireNumber(value, error) {
356
+ if (typeof value !== 'number')
357
+ throw new Error(error);
358
+ return value;
359
+ }
360
+ requireStringArray(value, error) {
361
+ if (!value || value.length === 0)
362
+ throw new Error(error);
363
+ return value;
364
+ }
365
+ }
366
+ //# sourceMappingURL=MultiChannelPostTool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MultiChannelPostTool.js","sourceRoot":"","sources":["../src/MultiChannelPostTool.ts"],"names":[],"mappings":"AAAA,cAAc;AACd;;;;;;GAMG;AAgDH,wEAAwE;AACxE,yEAAyE;AACzE,wEAAwE;AAExE,MAAM,OAAO,oB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AAK,CAAC,MAAM,KAAK,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC;QACzD,OAAO,KAAK,CAAC;IACf,CAAC"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Multi-Channel Post Extension Pack — publish adapted content to N social platforms.
3
+ */
4
+ export interface ExtensionContext {
5
+ options?: Record<string, unknown>;
6
+ secrets?: Record<string, string>;
7
+ getSecret?: (key: string) => string | undefined;
8
+ logger?: {
9
+ info: (msg: string) => void;
10
+ };
11
+ }
12
+ export interface ExtensionPack {
13
+ name: string;
14
+ version: string;
15
+ descriptors: Array<{
16
+ id: string;
17
+ kind: string;
18
+ priority?: number;
19
+ payload: unknown;
20
+ }>;
21
+ onActivate?: () => Promise<void>;
22
+ onDeactivate?: () => Promise<void>;
23
+ }
24
+ export declare function createExtensionPack(context: ExtensionContext): ExtensionPack;
25
+ export { MultiChannelPostTool } from './MultiChannelPostTool.js';
26
+ export type { MultiChannelPostInput, MultiChannelPostOutput, PlatformPostResult, ToolExecutorFn, } from './MultiChannelPostTool.js';
27
+ export default createExtensionPack;
28
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA;;GAEG;AAQH,MAAM,WAAW,gBAAgB;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IAChD,MAAM,CAAC,EAAE;QAAE,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;KAAE,CAAC;CAC1C;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,KAAK,CAAC;QACjB,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,OAAO,CAAC;KAClB,CAAC,CAAC;IACH,UAAU,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACjC,YAAY,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACpC;AAMD,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,gBAAgB,GAAG,aAAa,CAiB5E;AAMD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,YAAY,EACV,qBAAqB,EACrB,sBAAsB,EACtB,kBAAkB,EAClB,cAAc,GACf,MAAM,2BAA2B,CAAC;AAEnC,eAAe,mBAAmB,CAAC"}