post-engineer-mcp 1.52.671 → 1.53.662
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -2
- package/dist/account-shapes.d.ts +2 -0
- package/dist/account-shapes.js +0 -12
- package/dist/account-shapes.js.map +1 -1
- package/dist/action-tool.d.ts +0 -15
- package/dist/action-tool.js +0 -15
- package/dist/action-tool.js.map +1 -1
- package/dist/analytics.js +0 -39
- package/dist/analytics.js.map +1 -1
- package/dist/client-base-url.d.ts +2 -0
- package/dist/client-base-url.js +23 -0
- package/dist/client-base-url.js.map +1 -0
- package/dist/client-batch.js.map +1 -1
- package/dist/client-billing.js +0 -11
- package/dist/client-billing.js.map +1 -1
- package/dist/client-experiments.js +0 -9
- package/dist/client-experiments.js.map +1 -1
- package/dist/client-posts.js +0 -7
- package/dist/client-posts.js.map +1 -1
- package/dist/client-prompts.js +0 -2
- package/dist/client-prompts.js.map +1 -1
- package/dist/client-publish-existing.js +0 -13
- package/dist/client-publish-existing.js.map +1 -1
- package/dist/client-publish-uploaded.d.ts +0 -5
- package/dist/client-publish-uploaded.js +0 -48
- package/dist/client-publish-uploaded.js.map +1 -1
- package/dist/client-publishing-accounts.js +0 -7
- package/dist/client-publishing-accounts.js.map +1 -1
- package/dist/client-telegram.d.ts +4 -0
- package/dist/client-telegram.js +13 -0
- package/dist/client-telegram.js.map +1 -0
- package/dist/client-tool-config.js +0 -7
- package/dist/client-tool-config.js.map +1 -1
- package/dist/client-types.d.ts +11 -87
- package/dist/client-user-media.d.ts +0 -28
- package/dist/client-user-media.js +0 -42
- package/dist/client-user-media.js.map +1 -1
- package/dist/client-video-task.js +0 -5
- package/dist/client-video-task.js.map +1 -1
- package/dist/client.js +6 -119
- package/dist/client.js.map +1 -1
- package/dist/cloned-voice-client.d.ts +0 -8
- package/dist/cloned-voice-client.js +0 -49
- package/dist/cloned-voice-client.js.map +1 -1
- package/dist/cloned-voice-tools.d.ts +0 -5
- package/dist/cloned-voice-tools.js +0 -7
- package/dist/cloned-voice-tools.js.map +1 -1
- package/dist/connect-account.d.ts +14 -0
- package/dist/connect-account.js +47 -26
- package/dist/connect-account.js.map +1 -1
- package/dist/contract-response.js +0 -12
- package/dist/contract-response.js.map +1 -1
- package/dist/contracts/accounts.d.ts +114 -11
- package/dist/contracts/accounts.js +32 -56
- package/dist/contracts/accounts.js.map +1 -1
- package/dist/contracts/billing.d.ts +0 -14
- package/dist/contracts/billing.js +0 -26
- package/dist/contracts/billing.js.map +1 -1
- package/dist/contracts/endpoint.d.ts +0 -11
- package/dist/contracts/endpoint.js +0 -4
- package/dist/contracts/endpoint.js.map +1 -1
- package/dist/contracts/experiments.d.ts +0 -20
- package/dist/contracts/experiments.js +0 -34
- package/dist/contracts/experiments.js.map +1 -1
- package/dist/contracts/media.d.ts +0 -19
- package/dist/contracts/media.js +0 -58
- package/dist/contracts/media.js.map +1 -1
- package/dist/contracts/metrics.d.ts +6 -15
- package/dist/contracts/metrics.js +0 -74
- package/dist/contracts/metrics.js.map +1 -1
- package/dist/contracts/personas.d.ts +98 -19
- package/dist/contracts/personas.js +24 -93
- package/dist/contracts/personas.js.map +1 -1
- package/dist/contracts/posts.d.ts +9 -11
- package/dist/contracts/posts.js +1 -17
- package/dist/contracts/posts.js.map +1 -1
- package/dist/contracts/prompts.d.ts +0 -11
- package/dist/contracts/prompts.js +0 -15
- package/dist/contracts/prompts.js.map +1 -1
- package/dist/contracts/providers.d.ts +4 -17
- package/dist/contracts/providers.js +5 -30
- package/dist/contracts/providers.js.map +1 -1
- package/dist/contracts/schedule-warnings.d.ts +2 -0
- package/dist/contracts/schedule-warnings.js +0 -3
- package/dist/contracts/schedule-warnings.js.map +1 -1
- package/dist/contracts/schedule.d.ts +7 -14
- package/dist/contracts/schedule.js +1 -46
- package/dist/contracts/schedule.js.map +1 -1
- package/dist/contracts/tool-config.d.ts +0 -11
- package/dist/contracts/tool-config.js +0 -26
- package/dist/contracts/tool-config.js.map +1 -1
- package/dist/contracts/upload-types.d.ts +0 -3
- package/dist/contracts/upload-types.js +0 -10
- package/dist/contracts/upload-types.js.map +1 -1
- package/dist/contracts/video-tasks.d.ts +0 -23
- package/dist/contracts/video-tasks.js +0 -42
- package/dist/contracts/video-tasks.js.map +1 -1
- package/dist/contracts/videos.d.ts +40 -38
- package/dist/contracts/videos.js +3 -137
- package/dist/contracts/videos.js.map +1 -1
- package/dist/contracts/voices.d.ts +0 -24
- package/dist/contracts/voices.js +0 -34
- package/dist/contracts/voices.js.map +1 -1
- package/dist/direct-publish-form.js +0 -15
- package/dist/direct-publish-form.js.map +1 -1
- package/dist/direct-publish-narrowing.js +0 -5
- package/dist/direct-publish-narrowing.js.map +1 -1
- package/dist/errors.d.ts +0 -35
- package/dist/errors.js +0 -48
- package/dist/errors.js.map +1 -1
- package/dist/generate-video.d.ts +48 -4
- package/dist/generate-video.js +2 -6
- package/dist/generate-video.js.map +1 -1
- package/dist/http-auth.d.ts +0 -1
- package/dist/http-auth.js +0 -37
- package/dist/http-auth.js.map +1 -1
- package/dist/http-rate-limit.d.ts +0 -1
- package/dist/http-rate-limit.js +0 -18
- package/dist/http-rate-limit.js.map +1 -1
- package/dist/http-transport.js +0 -95
- package/dist/http-transport.js.map +1 -1
- package/dist/http-web.js +0 -16
- package/dist/http-web.js.map +1 -1
- package/dist/image-guards.d.ts +0 -4
- package/dist/image-guards.js +0 -11
- package/dist/image-guards.js.map +1 -1
- package/dist/index.js +0 -20
- package/dist/index.js.map +1 -1
- package/dist/intent-accounts.js +1 -6
- package/dist/intent-accounts.js.map +1 -1
- package/dist/intent-content.js +0 -7
- package/dist/intent-content.js.map +1 -1
- package/dist/intent-library.js +0 -4
- package/dist/intent-library.js.map +1 -1
- package/dist/intent-personas.js +0 -10
- package/dist/intent-personas.js.map +1 -1
- package/dist/intent-tool-config.js +0 -5
- package/dist/intent-tool-config.js.map +1 -1
- package/dist/intent-video.js +0 -5
- package/dist/intent-video.js.map +1 -1
- package/dist/intent-voices.js +0 -6
- package/dist/intent-voices.js.map +1 -1
- package/dist/language.d.ts +0 -8
- package/dist/language.js +0 -11
- package/dist/language.js.map +1 -1
- package/dist/limits.d.ts +1 -79
- package/dist/limits.js +1 -79
- package/dist/limits.js.map +1 -1
- package/dist/music-mood-field.js +0 -25
- package/dist/music-mood-field.js.map +1 -1
- package/dist/persona-avatar.d.ts +0 -13
- package/dist/persona-avatar.js +0 -40
- package/dist/persona-avatar.js.map +1 -1
- package/dist/persona-create.d.ts +96 -0
- package/dist/persona-create.js +39 -0
- package/dist/persona-create.js.map +1 -0
- package/dist/persona-cta-shape.d.ts +16 -0
- package/dist/persona-cta-shape.js +45 -0
- package/dist/persona-cta-shape.js.map +1 -0
- package/dist/persona-delete.js +0 -1
- package/dist/persona-delete.js.map +1 -1
- package/dist/persona-update.d.ts +26 -0
- package/dist/persona-update.js +2 -6
- package/dist/persona-update.js.map +1 -1
- package/dist/progress-poll-hint.d.ts +0 -6
- package/dist/progress-poll-hint.js +0 -15
- package/dist/progress-poll-hint.js.map +1 -1
- package/dist/prompts.js +0 -12
- package/dist/prompts.js.map +1 -1
- package/dist/public-ip.js +25 -58
- package/dist/public-ip.js.map +1 -1
- package/dist/publish-direct-shape.d.ts +2 -0
- package/dist/publish-direct-shape.js +0 -4
- package/dist/publish-direct-shape.js.map +1 -1
- package/dist/publish-existing-shape.d.ts +0 -7
- package/dist/publish-existing-shape.js +0 -26
- package/dist/publish-existing-shape.js.map +1 -1
- package/dist/publish-notices.js +0 -2
- package/dist/publish-notices.js.map +1 -1
- package/dist/publish-uploaded-shape.d.ts +2 -0
- package/dist/publish-uploaded-shape.js +0 -7
- package/dist/publish-uploaded-shape.js.map +1 -1
- package/dist/recipe-session.d.ts +0 -4
- package/dist/recipe-session.js +0 -17
- package/dist/recipe-session.js.map +1 -1
- package/dist/refs.d.ts +0 -11
- package/dist/refs.js +1 -15
- package/dist/refs.js.map +1 -1
- package/dist/remote-shapes.d.ts +52 -2
- package/dist/remote-shapes.js +2 -16
- package/dist/remote-shapes.js.map +1 -1
- package/dist/require-api-key.js +0 -2
- package/dist/require-api-key.js.map +1 -1
- package/dist/require-publishing-accounts.js +0 -7
- package/dist/require-publishing-accounts.js.map +1 -1
- package/dist/require-title.js +0 -4
- package/dist/require-title.js.map +1 -1
- package/dist/schedule-shapes.js +0 -19
- package/dist/schedule-shapes.js.map +1 -1
- package/dist/script-segments.d.ts +1 -5
- package/dist/script-segments.js +1 -54
- package/dist/script-segments.js.map +1 -1
- package/dist/secret-redaction.js +0 -4
- package/dist/secret-redaction.js.map +1 -1
- package/dist/segment-media.js +0 -22
- package/dist/segment-media.js.map +1 -1
- package/dist/segment-text.js +0 -18
- package/dist/segment-text.js.map +1 -1
- package/dist/single-video-shape.d.ts +35 -1
- package/dist/single-video-shape.js +7 -18
- package/dist/single-video-shape.js.map +1 -1
- package/dist/slot-detail-present.d.ts +67 -0
- package/dist/slot-detail-present.js +47 -0
- package/dist/slot-detail-present.js.map +1 -0
- package/dist/tool-annotations.js.map +1 -1
- package/dist/tools-batch.d.ts +51 -3
- package/dist/tools-batch.js +0 -17
- package/dist/tools-batch.js.map +1 -1
- package/dist/tools-call.d.ts +0 -1
- package/dist/tools-call.js +0 -1
- package/dist/tools-call.js.map +1 -1
- package/dist/tools-experiments.d.ts +6 -3
- package/dist/tools-experiments.js +1 -31
- package/dist/tools-experiments.js.map +1 -1
- package/dist/tools-list-stats.d.ts +0 -4
- package/dist/tools-list-stats.js +0 -5
- package/dist/tools-list-stats.js.map +1 -1
- package/dist/tools-pinterest.js +0 -10
- package/dist/tools-pinterest.js.map +1 -1
- package/dist/tools-posts.d.ts +2 -0
- package/dist/tools-posts.js +0 -9
- package/dist/tools-posts.js.map +1 -1
- package/dist/tools-prompts.js +0 -23
- package/dist/tools-prompts.js.map +1 -1
- package/dist/tools-publish-existing.js +0 -17
- package/dist/tools-publish-existing.js.map +1 -1
- package/dist/tools-publish-uploaded.js +0 -8
- package/dist/tools-publish-uploaded.js.map +1 -1
- package/dist/tools-publishing-accounts.js +1 -11
- package/dist/tools-publishing-accounts.js.map +1 -1
- package/dist/tools-single-video.d.ts +2 -4
- package/dist/tools-single-video.js +2 -55
- package/dist/tools-single-video.js.map +1 -1
- package/dist/tools-tool-config.js +0 -13
- package/dist/tools-tool-config.js.map +1 -1
- package/dist/tools-user-media.js +0 -5
- package/dist/tools-user-media.js.map +1 -1
- package/dist/tools.d.ts +2 -76
- package/dist/tools.js +5 -131
- package/dist/tools.js.map +1 -1
- package/dist/video-task-tools.d.ts +0 -2
- package/dist/video-task-tools.js +0 -43
- package/dist/video-task-tools.js.map +1 -1
- package/dist/video-type.d.ts +0 -10
- package/dist/video-type.js +0 -17
- package/dist/video-type.js.map +1 -1
- package/dist/voice-filters.d.ts +0 -27
- package/dist/voice-filters.js +0 -62
- package/dist/voice-filters.js.map +1 -1
- package/package.json +1 -1
|
@@ -27,18 +27,11 @@ export const CreateClonedVoiceShape = {
|
|
|
27
27
|
.describe('Clean background noise from the recording before cloning (recommended true; false for studio audio)'),
|
|
28
28
|
};
|
|
29
29
|
export const CREATE_CLONE_AUDIO_SOURCE_MESSAGE = 'Send exactly one of audioUrl or audioPath.';
|
|
30
|
-
// The tool registers the raw shape (no object-level refine), so the handler
|
|
31
|
-
// re-parses with this schema to enforce exactly one audio source.
|
|
32
30
|
export const CreateClonedVoiceSchema = z
|
|
33
31
|
.object(CreateClonedVoiceShape)
|
|
34
32
|
.refine((args) => (args.audioUrl === undefined) !== (args.audioPath === undefined), {
|
|
35
33
|
message: CREATE_CLONE_AUDIO_SOURCE_MESSAGE,
|
|
36
34
|
});
|
|
37
|
-
/** voices (action: create_clone) over HTTP: audioUrl only — a local audioPath would
|
|
38
|
-
* resolve on the MCP server's filesystem, not on the agent's machine.
|
|
39
|
-
* The SDK strips unknown keys before the handler runs, so a smuggled
|
|
40
|
-
* audioPath is dropped (never read), not loudly rejected; the strict
|
|
41
|
-
* re-parse is defense-in-depth for direct handler callers only. */
|
|
42
35
|
export const CreateClonedVoiceRemoteShape = {
|
|
43
36
|
audioUrl: z
|
|
44
37
|
.string()
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cloned-voice-tools.js","sourceRoot":"","sources":["../src/cloned-voice-tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EACL,yBAAyB,EACzB,wBAAwB,EACxB,iBAAiB,EACjB,cAAc,EACd,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,GAElB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,iBAAiB,EAAwB,MAAM,iBAAiB,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAE,0BAA0B,EAAE,MAAM,eAAe,CAAC;AAC9E,OAAO,EACL,4BAA4B,EAC5B,4BAA4B,EAC5B,kBAAkB,GACnB,MAAM,aAAa,CAAC;AAErB,MAAM,CAAC,MAAM,qBAAqB,GAAG,EAAE,CAAC;AAExC,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC;AAEtE,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,QAAQ,EAAE,CAAC;SACR,MAAM,EAAE;SACR,GAAG,EAAE;SACL,QAAQ,EAAE;SACV,QAAQ,CACP,yEAAyE,kBAAkB,iDAAiD,CAC7I;IACH,SAAS,EAAE,CAAC;SACT,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,EAAE;SACV,QAAQ,CACP,oGAAoG,kBAAkB,iDAAiD,CACxK;IACH,QAAQ,EAAE,CAAC;SACR,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,MAAM,CAAC,iBAAiB,EAAE,EAAE,OAAO,EAAE,0BAA0B,EAAE,CAAC;SAClE,QAAQ,CAAC,qEAAqE,CAAC;IAClF,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ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CAAC,EACD,uBAAuB,EACvB,kCAAkC,CACnC,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,MAA0B,EAC1B,IAA0C;IAE1C,OAAO,iBAAiB,CAAC,GAAG,EAAE,CAAC,cAAc,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,EAAE,sBAAsB,CAAC,CAAC;AAC/F,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,MAA0B,EAC1B,IAA6C;IAE7C,OAAO,iBAAiB,CACtB,GAAG,EAAE,CAAC,iBAAiB,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,EAC7C,uBAAuB,EACvB,sBAAsB,CACvB,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAC5C,MAA0B,EAC1B,IAA8C;IAE9C,OAAO,iBAAiB,CACtB,GAAG,EAAE,CAAC,kBAAkB,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,EACxE,yBAAyB,CAC1B,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,MAA0B,EAC1B,IAA6C;IAE7C,OAAO,iBAAiB,CACtB,GAAG,EAAE,CAAC,iBAAiB,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,EACxD,wBAAwB,CACzB,CAAC;AACJ,CAAC"}
|
|
@@ -13,6 +13,7 @@ export declare const ConnectAccountShape: {
|
|
|
13
13
|
"3speak": "3speak";
|
|
14
14
|
rumble: "rumble";
|
|
15
15
|
fanvue: "fanvue";
|
|
16
|
+
telegram: "telegram";
|
|
16
17
|
}>;
|
|
17
18
|
handle: z.ZodOptional<z.ZodString>;
|
|
18
19
|
appPassword: z.ZodOptional<z.ZodString>;
|
|
@@ -20,6 +21,12 @@ export declare const ConnectAccountShape: {
|
|
|
20
21
|
postingKey: z.ZodOptional<z.ZodString>;
|
|
21
22
|
channelId: z.ZodOptional<z.ZodString>;
|
|
22
23
|
accessToken: z.ZodOptional<z.ZodString>;
|
|
24
|
+
botToken: z.ZodOptional<z.ZodString>;
|
|
25
|
+
chatId: z.ZodOptional<z.ZodString>;
|
|
26
|
+
chatType: z.ZodOptional<z.ZodEnum<{
|
|
27
|
+
channel: "channel";
|
|
28
|
+
group: "group";
|
|
29
|
+
}>>;
|
|
23
30
|
};
|
|
24
31
|
export declare const ConnectAccountSchema: z.ZodObject<{
|
|
25
32
|
provider: z.ZodEnum<{
|
|
@@ -33,6 +40,7 @@ export declare const ConnectAccountSchema: z.ZodObject<{
|
|
|
33
40
|
"3speak": "3speak";
|
|
34
41
|
rumble: "rumble";
|
|
35
42
|
fanvue: "fanvue";
|
|
43
|
+
telegram: "telegram";
|
|
36
44
|
}>;
|
|
37
45
|
handle: z.ZodOptional<z.ZodString>;
|
|
38
46
|
appPassword: z.ZodOptional<z.ZodString>;
|
|
@@ -40,5 +48,11 @@ export declare const ConnectAccountSchema: z.ZodObject<{
|
|
|
40
48
|
postingKey: z.ZodOptional<z.ZodString>;
|
|
41
49
|
channelId: z.ZodOptional<z.ZodString>;
|
|
42
50
|
accessToken: z.ZodOptional<z.ZodString>;
|
|
51
|
+
botToken: z.ZodOptional<z.ZodString>;
|
|
52
|
+
chatId: z.ZodOptional<z.ZodString>;
|
|
53
|
+
chatType: z.ZodOptional<z.ZodEnum<{
|
|
54
|
+
channel: "channel";
|
|
55
|
+
group: "group";
|
|
56
|
+
}>>;
|
|
43
57
|
}, z.core.$strip>;
|
|
44
58
|
export declare function handleConnectAccount(client: PostEngineerClient, args: z.infer<typeof ConnectAccountSchema>): Promise<McpToolResponse>;
|
package/dist/connect-account.js
CHANGED
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
// accounts (action: connect): shape, schema and handler.
|
|
2
|
-
//
|
|
3
|
-
// Extracted from tools.ts so tools.ts stays under the file-size ratchet.
|
|
4
|
-
// Re-exported from tools.ts, so existing import sites (`./tools.js`) keep
|
|
5
|
-
// working, including the personas and accounts registration (intent-*.ts).
|
|
6
1
|
import { z } from 'zod';
|
|
2
|
+
import { connectTelegramAccount } from './client-telegram.js';
|
|
7
3
|
import { SOCIAL_PROVIDERS, isOAuthConnectProvider } from './contracts/providers.js';
|
|
8
4
|
import { getErrorMessage } from './errors.js';
|
|
5
|
+
import { redactSecretFromError } from './secret-redaction.js';
|
|
9
6
|
import { handleLibraryCall } from './tools-call.js';
|
|
10
|
-
// A credential present but blank is rejected with the same message the
|
|
11
|
-
// route uses — the route trims and rejects blanks, so the tool does too.
|
|
12
7
|
function nonBlank(message) {
|
|
13
8
|
return z
|
|
14
9
|
.string()
|
|
@@ -17,22 +12,18 @@ function nonBlank(message) {
|
|
|
17
12
|
}
|
|
18
13
|
export const ConnectAccountShape = {
|
|
19
14
|
provider: z.enum(SOCIAL_PROVIDERS).describe('The social platform to connect'),
|
|
20
|
-
handle: nonBlank('Bluesky handle is required.').optional().describe('
|
|
21
|
-
appPassword: nonBlank('Bluesky app password is required.').optional().describe('
|
|
22
|
-
username: nonBlank('Hive username is required.').optional().describe('
|
|
23
|
-
postingKey: nonBlank('Hive posting key is required.').optional().describe('
|
|
24
|
-
channelId: nonBlank('Rumble channel ID is required.').optional().describe('
|
|
25
|
-
accessToken: nonBlank('Rumble access token is required.').optional().describe('
|
|
15
|
+
handle: nonBlank('Bluesky handle is required.').optional().describe('bluesky only: the handle (e.g. user.bsky.social).'),
|
|
16
|
+
appPassword: nonBlank('Bluesky app password is required.').optional().describe('bluesky only: an app password (Settings > App passwords). Never logged.'),
|
|
17
|
+
username: nonBlank('Hive username is required.').optional().describe('3speak only: the Hive username.'),
|
|
18
|
+
postingKey: nonBlank('Hive posting key is required.').optional().describe('3speak only: the Hive posting key (never the owner/active/master key). Never logged.'),
|
|
19
|
+
channelId: nonBlank('Rumble channel ID is required.').optional().describe('rumble only: the channel ID.'),
|
|
20
|
+
accessToken: nonBlank('Rumble access token is required.').optional().describe('rumble only: the upload access token (from bd@rumble.com). Never logged.'),
|
|
21
|
+
botToken: nonBlank('Telegram bot token is required.').optional().describe('telegram only: the @BotFather bot token. Never logged.'),
|
|
22
|
+
chatId: nonBlank('Telegram chat ID or @username is required.').optional().describe('telegram only: @username or numeric chat ID.'),
|
|
23
|
+
chatType: z.enum(['channel', 'group']).optional().describe('telegram only: channel or group.'),
|
|
26
24
|
};
|
|
27
25
|
export const ConnectAccountSchema = z.object(ConnectAccountShape);
|
|
28
26
|
export async function handleConnectAccount(client, args) {
|
|
29
|
-
// One handler per direct-connect network (a record, not a chain): a new
|
|
30
|
-
// direct-connect network fails the typecheck until it has a handler,
|
|
31
|
-
// instead of falling through to the OAuth URL path. Bluesky and 3Speak
|
|
32
|
-
// project the upstream response to named fields; Rumble shares
|
|
33
|
-
// handleLibraryCall, which renders the same success/error text. Built
|
|
34
|
-
// inside the handler so the parity check, which follows calls from the
|
|
35
|
-
// action's own body, sees each network's client call.
|
|
36
27
|
const DIRECT_CONNECT_HANDLERS = {
|
|
37
28
|
bluesky: async (client, args) => {
|
|
38
29
|
if (!args.handle || !args.appPassword) {
|
|
@@ -48,8 +39,6 @@ export async function handleConnectAccount(client, args) {
|
|
|
48
39
|
}
|
|
49
40
|
try {
|
|
50
41
|
const result = await client.connectBlueskyAccount(args.handle, args.appPassword);
|
|
51
|
-
// Project the upstream response to named fields: stringifying the
|
|
52
|
-
// whole body would surface any field the route adds later.
|
|
53
42
|
const { accountId, did } = result;
|
|
54
43
|
return {
|
|
55
44
|
content: [
|
|
@@ -86,8 +75,6 @@ export async function handleConnectAccount(client, args) {
|
|
|
86
75
|
}
|
|
87
76
|
try {
|
|
88
77
|
const result = await client.connectThreespeakAccount(args.username, args.postingKey);
|
|
89
|
-
// Project the upstream response to named fields: stringifying the
|
|
90
|
-
// whole body would surface any field the route adds later.
|
|
91
78
|
const { accountId, username } = result;
|
|
92
79
|
return {
|
|
93
80
|
content: [
|
|
@@ -126,6 +113,42 @@ export async function handleConnectAccount(client, args) {
|
|
|
126
113
|
const accessToken = args.accessToken;
|
|
127
114
|
return handleLibraryCall(() => client.connectRumbleAccount(channelId, accessToken), 'connecting Rumble account', 'Rumble account connected successfully');
|
|
128
115
|
},
|
|
116
|
+
telegram: async (client, args) => {
|
|
117
|
+
if (!args.botToken || !args.chatId || !args.chatType) {
|
|
118
|
+
return {
|
|
119
|
+
content: [
|
|
120
|
+
{
|
|
121
|
+
type: 'text',
|
|
122
|
+
text: 'Error: Telegram requires botToken, chatId and chatType (channel or group).',
|
|
123
|
+
},
|
|
124
|
+
],
|
|
125
|
+
isError: true,
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
try {
|
|
129
|
+
const result = await connectTelegramAccount(client, args.botToken, args.chatId, args.chatType);
|
|
130
|
+
const { accountId, chatId, chatType, title } = result;
|
|
131
|
+
return {
|
|
132
|
+
content: [
|
|
133
|
+
{
|
|
134
|
+
type: 'text',
|
|
135
|
+
text: `Telegram account connected successfully: chatId=${chatId} chatType=${chatType} title=${title} accountId=${accountId}`,
|
|
136
|
+
},
|
|
137
|
+
],
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
catch (error) {
|
|
141
|
+
return {
|
|
142
|
+
content: [
|
|
143
|
+
{
|
|
144
|
+
type: 'text',
|
|
145
|
+
text: `Error connecting Telegram account: ${getErrorMessage(redactSecretFromError(error, args.botToken))}`,
|
|
146
|
+
},
|
|
147
|
+
],
|
|
148
|
+
isError: true,
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
},
|
|
129
152
|
};
|
|
130
153
|
if (!isOAuthConnectProvider(args.provider)) {
|
|
131
154
|
return DIRECT_CONNECT_HANDLERS[args.provider](client, args);
|
|
@@ -144,8 +167,6 @@ export async function handleConnectAccount(client, args) {
|
|
|
144
167
|
};
|
|
145
168
|
}
|
|
146
169
|
const result = parsed.data;
|
|
147
|
-
// Never echo a non-https URL as a "open in your browser" authorization
|
|
148
|
-
// link: z.string().url() accepts any scheme, including javascript:.
|
|
149
170
|
if (new URL(result.auth_url).protocol !== 'https:') {
|
|
150
171
|
return {
|
|
151
172
|
content: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connect-account.js","sourceRoot":"","sources":["../src/connect-account.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"connect-account.js","sourceRoot":"","sources":["../src/connect-account.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAA8B,MAAM,0BAA0B,CAAC;AAChH,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAwB,MAAM,iBAAiB,CAAC;AAE1E,SAAS,QAAQ,CAAC,OAAe;IAC/B,OAAO,CAAC;SACL,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;AAC7D,CAAC;AAED,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,QAAQ,CAAC,gCAAgC,CAAC;IAC7E,MAAM,EAAE,QAAQ,CAAC,6BAA6B,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,mDAAmD,CAAC;IACxH,WAAW,EAAE,QAAQ,CAAC,mCAAmC,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,yEAAyE,CAAC;IACzJ,QAAQ,EAAE,QAAQ,CA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OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,4DAA4D;qBACnE;iBACF;gBACD,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;QACD,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EACF,mBAAmB,IAAI,CAAC,QAAQ,uJAAuJ;wBACvL,GAAG,MAAM,CAAC,QAAQ,MAAM;wBACxB,kGAAkG;iBACrG;aACF;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,oCAAoC,eAAe,CAAC,KAAK,CAAC,EAAE;iBACnE;aACF;YACD,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -1,15 +1,3 @@
|
|
|
1
|
-
//---------------
|
|
2
|
-
// Response side of a shared endpoint contract (shared/contracts/*). The
|
|
3
|
-
// request sites stay literal `client.request(path, init)` calls in each
|
|
4
|
-
// client-*.ts module, because the MCP parity gate proves reachability from
|
|
5
|
-
// those literals. The contract types the request input (BodyOf/QueryOf at
|
|
6
|
-
// the function signature) and this helper parses the response: a malformed
|
|
7
|
-
// 200 is an error, never a silent success.
|
|
8
|
-
//---------------
|
|
9
|
-
// A malformed 200 is an error, never a silent success. It carries its
|
|
10
|
-
// own class so a caller that joins several reads (personas get,
|
|
11
|
-
// generate_video) can degrade that one read to null/no-binding while a
|
|
12
|
-
// transport failure still fails the whole call.
|
|
13
1
|
export class MalformedContractResponseError extends Error {
|
|
14
2
|
}
|
|
15
3
|
export function parseContractResponse(endpoint, raw) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract-response.js","sourceRoot":"","sources":["../src/contract-response.ts"],"names":[],"mappings":"AAEA,
|
|
1
|
+
{"version":3,"file":"contract-response.js","sourceRoot":"","sources":["../src/contract-response.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,8BAA+B,SAAQ,KAAK;CAAG;AAE5D,MAAM,UAAU,qBAAqB,CACnC,QAA4D,EAC5D,GAAY;IAEZ,MAAM,MAAM,GAAG,QAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IAChD,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QACrC,MAAM,KAAK,GAAG,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC9D,MAAM,IAAI,8BAA8B,CACtC,2BAA2B,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,IAAI,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,CACxG,CAAC;IACJ,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,CAAC;AACrB,CAAC"}
|
|
@@ -7,10 +7,6 @@ export interface EndpointDefinition<Body extends z.ZodType | undefined, Query ex
|
|
|
7
7
|
query?: Query;
|
|
8
8
|
response: Response;
|
|
9
9
|
}
|
|
10
|
-
/** Define one endpoint contract. The literal path is preserved in the type
|
|
11
|
-
* so ParamsOf can read its `:param` segments. `Body`/`Query` default to
|
|
12
|
-
* `undefined` so an omitted optional schema stays `undefined` (not the
|
|
13
|
-
* bare `ZodType`) in the returned definition. */
|
|
14
10
|
export declare function defineEndpoint<Body extends z.ZodType | undefined = undefined, Query extends z.ZodType | undefined = undefined, Response extends z.ZodType = z.ZodType, Path extends string = string>(config: {
|
|
15
11
|
method: EndpointMethod;
|
|
16
12
|
path: Path;
|
|
@@ -18,26 +14,19 @@ export declare function defineEndpoint<Body extends z.ZodType | undefined = unde
|
|
|
18
14
|
query?: Query;
|
|
19
15
|
response: Response;
|
|
20
16
|
}): EndpointDefinition<Body, Query, Response, Path>;
|
|
21
|
-
/** Request body input type (`z.input` of the `body` schema). Indexed
|
|
22
|
-
* access is used (not infer) so an optional `body?` property keeps its
|
|
23
|
-
* schema type instead of widening to `unknown`. */
|
|
24
17
|
export type BodyOf<Endpoint extends {
|
|
25
18
|
body?: z.ZodType | undefined;
|
|
26
19
|
}> = [
|
|
27
20
|
Exclude<Endpoint['body'], undefined>
|
|
28
21
|
] extends [never] ? never : Exclude<Endpoint['body'], undefined> extends z.ZodType ? z.input<Exclude<Endpoint['body'], undefined>> : never;
|
|
29
|
-
/** Query input type (`z.input` of the `query` schema). */
|
|
30
22
|
export type QueryOf<Endpoint extends {
|
|
31
23
|
query?: z.ZodType | undefined;
|
|
32
24
|
}> = [
|
|
33
25
|
Exclude<Endpoint['query'], undefined>
|
|
34
26
|
] extends [never] ? never : Exclude<Endpoint['query'], undefined> extends z.ZodType ? z.input<Exclude<Endpoint['query'], undefined>> : never;
|
|
35
|
-
/** Response output type (`z.output` of the `response` schema). */
|
|
36
27
|
export type ResponseOf<Endpoint extends {
|
|
37
28
|
response: z.ZodType;
|
|
38
29
|
}> = Endpoint['response'] extends z.ZodType ? z.output<Endpoint['response']> : never;
|
|
39
|
-
/** Path params from a path template: each `:name` segment becomes a
|
|
40
|
-
* `string` field. A path without segments is an empty record. */
|
|
41
30
|
export type ParamsOf<Path extends string> = Path extends `${string}:${infer Rest}` ? Rest extends `${infer Name}/${infer After}` ? {
|
|
42
31
|
[Key in Name]: string;
|
|
43
32
|
} & ParamsOf<`/${After}`> : {
|
|
@@ -193,6 +182,25 @@ export declare const FanvueAccountSchema: z.ZodObject<{
|
|
|
193
182
|
accountName: z.ZodNullable<z.ZodString>;
|
|
194
183
|
profilePictureUrl: z.ZodOptional<z.ZodString>;
|
|
195
184
|
}, z.core.$strip>;
|
|
185
|
+
export declare const TelegramAccountSchema: z.ZodObject<{
|
|
186
|
+
connectedAt: z.ZodNumber;
|
|
187
|
+
lastUsed: z.ZodNumber;
|
|
188
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
189
|
+
error: "error";
|
|
190
|
+
ok: "ok";
|
|
191
|
+
}>>;
|
|
192
|
+
provider: z.ZodLiteral<"telegram">;
|
|
193
|
+
recordId: z.ZodString;
|
|
194
|
+
providerAccountId: z.ZodString;
|
|
195
|
+
accountName: z.ZodNullable<z.ZodString>;
|
|
196
|
+
chatType: z.ZodOptional<z.ZodEnum<{
|
|
197
|
+
channel: "channel";
|
|
198
|
+
group: "group";
|
|
199
|
+
supergroup: "supergroup";
|
|
200
|
+
}>>;
|
|
201
|
+
username: z.ZodOptional<z.ZodString>;
|
|
202
|
+
botUsername: z.ZodOptional<z.ZodString>;
|
|
203
|
+
}, z.core.$strip>;
|
|
196
204
|
export declare const PublicAccountItemSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
197
205
|
statistics: z.ZodOptional<z.ZodObject<{
|
|
198
206
|
subscriberCount: z.ZodOptional<z.ZodString>;
|
|
@@ -332,6 +340,24 @@ export declare const PublicAccountItemSchema: z.ZodDiscriminatedUnion<[z.ZodObje
|
|
|
332
340
|
providerAccountId: z.ZodString;
|
|
333
341
|
accountName: z.ZodNullable<z.ZodString>;
|
|
334
342
|
profilePictureUrl: z.ZodOptional<z.ZodString>;
|
|
343
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
344
|
+
connectedAt: z.ZodNumber;
|
|
345
|
+
lastUsed: z.ZodNumber;
|
|
346
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
347
|
+
error: "error";
|
|
348
|
+
ok: "ok";
|
|
349
|
+
}>>;
|
|
350
|
+
provider: z.ZodLiteral<"telegram">;
|
|
351
|
+
recordId: z.ZodString;
|
|
352
|
+
providerAccountId: z.ZodString;
|
|
353
|
+
accountName: z.ZodNullable<z.ZodString>;
|
|
354
|
+
chatType: z.ZodOptional<z.ZodEnum<{
|
|
355
|
+
channel: "channel";
|
|
356
|
+
group: "group";
|
|
357
|
+
supergroup: "supergroup";
|
|
358
|
+
}>>;
|
|
359
|
+
username: z.ZodOptional<z.ZodString>;
|
|
360
|
+
botUsername: z.ZodOptional<z.ZodString>;
|
|
335
361
|
}, z.core.$strip>], "provider">;
|
|
336
362
|
export type PublicAccountItem = z.infer<typeof PublicAccountItemSchema>;
|
|
337
363
|
export declare const ConnectUrlBodySchema: z.ZodObject<{
|
|
@@ -357,6 +383,14 @@ export declare const RumbleConnectBodySchema: z.ZodObject<{
|
|
|
357
383
|
channelId: z.ZodString;
|
|
358
384
|
accessToken: z.ZodString;
|
|
359
385
|
}, z.core.$strip>;
|
|
386
|
+
export declare const TelegramConnectBodySchema: z.ZodObject<{
|
|
387
|
+
botToken: z.ZodString;
|
|
388
|
+
chatId: z.ZodString;
|
|
389
|
+
chatType: z.ZodEnum<{
|
|
390
|
+
channel: "channel";
|
|
391
|
+
group: "group";
|
|
392
|
+
}>;
|
|
393
|
+
}, z.core.$strip>;
|
|
360
394
|
export declare const DisconnectAccountQuerySchema: z.ZodObject<{
|
|
361
395
|
provider: z.ZodString;
|
|
362
396
|
providerAccountId: z.ZodString;
|
|
@@ -536,6 +570,24 @@ export declare const ListSocialAccountsResponseSchema: z.ZodObject<{
|
|
|
536
570
|
providerAccountId: z.ZodString;
|
|
537
571
|
accountName: z.ZodNullable<z.ZodString>;
|
|
538
572
|
profilePictureUrl: z.ZodOptional<z.ZodString>;
|
|
573
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
574
|
+
connectedAt: z.ZodNumber;
|
|
575
|
+
lastUsed: z.ZodNumber;
|
|
576
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
577
|
+
error: "error";
|
|
578
|
+
ok: "ok";
|
|
579
|
+
}>>;
|
|
580
|
+
provider: z.ZodLiteral<"telegram">;
|
|
581
|
+
recordId: z.ZodString;
|
|
582
|
+
providerAccountId: z.ZodString;
|
|
583
|
+
accountName: z.ZodNullable<z.ZodString>;
|
|
584
|
+
chatType: z.ZodOptional<z.ZodEnum<{
|
|
585
|
+
channel: "channel";
|
|
586
|
+
group: "group";
|
|
587
|
+
supergroup: "supergroup";
|
|
588
|
+
}>>;
|
|
589
|
+
username: z.ZodOptional<z.ZodString>;
|
|
590
|
+
botUsername: z.ZodOptional<z.ZodString>;
|
|
539
591
|
}, z.core.$strip>], "provider">>;
|
|
540
592
|
message: z.ZodString;
|
|
541
593
|
}, z.core.$strip>;
|
|
@@ -563,6 +615,17 @@ export declare const RumbleConnectResponseSchema: z.ZodObject<{
|
|
|
563
615
|
accountId: z.ZodString;
|
|
564
616
|
channelId: z.ZodString;
|
|
565
617
|
}, z.core.$strip>;
|
|
618
|
+
export declare const TelegramConnectResponseSchema: z.ZodObject<{
|
|
619
|
+
success: z.ZodLiteral<true>;
|
|
620
|
+
accountId: z.ZodString;
|
|
621
|
+
chatId: z.ZodString;
|
|
622
|
+
chatType: z.ZodEnum<{
|
|
623
|
+
channel: "channel";
|
|
624
|
+
group: "group";
|
|
625
|
+
supergroup: "supergroup";
|
|
626
|
+
}>;
|
|
627
|
+
title: z.ZodString;
|
|
628
|
+
}, z.core.$strip>;
|
|
566
629
|
export declare const PinterestBoardSchema: z.ZodObject<{
|
|
567
630
|
id: z.ZodString;
|
|
568
631
|
name: z.ZodString;
|
|
@@ -586,6 +649,7 @@ export declare const PersonaPublishingAccountsSchema: z.ZodObject<{
|
|
|
586
649
|
'3speak': z.ZodArray<z.ZodString>;
|
|
587
650
|
rumble: z.ZodArray<z.ZodString>;
|
|
588
651
|
fanvue: z.ZodArray<z.ZodString>;
|
|
652
|
+
telegram: z.ZodArray<z.ZodString>;
|
|
589
653
|
}, z.core.$strip>;
|
|
590
654
|
export type PersonaPublishingAccounts = z.infer<typeof PersonaPublishingAccountsSchema>;
|
|
591
655
|
export declare const PersonaPublishingAccountsResponseSchema: z.ZodObject<{
|
|
@@ -601,6 +665,7 @@ export declare const PersonaPublishingAccountsResponseSchema: z.ZodObject<{
|
|
|
601
665
|
'3speak': z.ZodArray<z.ZodString>;
|
|
602
666
|
rumble: z.ZodArray<z.ZodString>;
|
|
603
667
|
fanvue: z.ZodArray<z.ZodString>;
|
|
668
|
+
telegram: z.ZodArray<z.ZodString>;
|
|
604
669
|
}, z.core.$strip>;
|
|
605
670
|
}, z.core.$strip>;
|
|
606
671
|
export type PersonaPublishingAccountsResponse = z.infer<typeof PersonaPublishingAccountsResponseSchema>;
|
|
@@ -745,6 +810,24 @@ export declare const listSocialAccounts: EndpointDefinition<undefined, undefined
|
|
|
745
810
|
providerAccountId: z.ZodString;
|
|
746
811
|
accountName: z.ZodNullable<z.ZodString>;
|
|
747
812
|
profilePictureUrl: z.ZodOptional<z.ZodString>;
|
|
813
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
814
|
+
connectedAt: z.ZodNumber;
|
|
815
|
+
lastUsed: z.ZodNumber;
|
|
816
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
817
|
+
error: "error";
|
|
818
|
+
ok: "ok";
|
|
819
|
+
}>>;
|
|
820
|
+
provider: z.ZodLiteral<"telegram">;
|
|
821
|
+
recordId: z.ZodString;
|
|
822
|
+
providerAccountId: z.ZodString;
|
|
823
|
+
accountName: z.ZodNullable<z.ZodString>;
|
|
824
|
+
chatType: z.ZodOptional<z.ZodEnum<{
|
|
825
|
+
channel: "channel";
|
|
826
|
+
group: "group";
|
|
827
|
+
supergroup: "supergroup";
|
|
828
|
+
}>>;
|
|
829
|
+
username: z.ZodOptional<z.ZodString>;
|
|
830
|
+
botUsername: z.ZodOptional<z.ZodString>;
|
|
748
831
|
}, z.core.$strip>], "provider">>;
|
|
749
832
|
message: z.ZodString;
|
|
750
833
|
}, z.core.$strip>, "/api/account">;
|
|
@@ -792,6 +875,24 @@ export declare const connectRumbleAccount: EndpointDefinition<z.ZodObject<{
|
|
|
792
875
|
accountId: z.ZodString;
|
|
793
876
|
channelId: z.ZodString;
|
|
794
877
|
}, z.core.$strip>, "/api/rumble-connect">;
|
|
878
|
+
export declare const connectTelegramAccount: EndpointDefinition<z.ZodObject<{
|
|
879
|
+
botToken: z.ZodString;
|
|
880
|
+
chatId: z.ZodString;
|
|
881
|
+
chatType: z.ZodEnum<{
|
|
882
|
+
channel: "channel";
|
|
883
|
+
group: "group";
|
|
884
|
+
}>;
|
|
885
|
+
}, z.core.$strip>, undefined, z.ZodObject<{
|
|
886
|
+
success: z.ZodLiteral<true>;
|
|
887
|
+
accountId: z.ZodString;
|
|
888
|
+
chatId: z.ZodString;
|
|
889
|
+
chatType: z.ZodEnum<{
|
|
890
|
+
channel: "channel";
|
|
891
|
+
group: "group";
|
|
892
|
+
supergroup: "supergroup";
|
|
893
|
+
}>;
|
|
894
|
+
title: z.ZodString;
|
|
895
|
+
}, z.core.$strip>, "/api/telegram-connect">;
|
|
795
896
|
export declare const listPinterestBoards: EndpointDefinition<undefined, z.ZodObject<{
|
|
796
897
|
accountId: z.ZodString;
|
|
797
898
|
}, z.core.$strict>, z.ZodObject<{
|
|
@@ -816,6 +917,7 @@ export declare const getPersonaPublishingAccounts: EndpointDefinition<undefined,
|
|
|
816
917
|
'3speak': z.ZodArray<z.ZodString>;
|
|
817
918
|
rumble: z.ZodArray<z.ZodString>;
|
|
818
919
|
fanvue: z.ZodArray<z.ZodString>;
|
|
920
|
+
telegram: z.ZodArray<z.ZodString>;
|
|
819
921
|
}, z.core.$strip>;
|
|
820
922
|
}, z.core.$strip>, "/api/persona/publishing-accounts">;
|
|
821
923
|
export declare const setPersonaPublishingAccounts: EndpointDefinition<z.ZodObject<{
|
|
@@ -835,5 +937,6 @@ export declare const setPersonaPublishingAccounts: EndpointDefinition<z.ZodObjec
|
|
|
835
937
|
'3speak': z.ZodArray<z.ZodString>;
|
|
836
938
|
rumble: z.ZodArray<z.ZodString>;
|
|
837
939
|
fanvue: z.ZodArray<z.ZodString>;
|
|
940
|
+
telegram: z.ZodArray<z.ZodString>;
|
|
838
941
|
}, z.core.$strip>;
|
|
839
942
|
}, z.core.$strip>, "/api/persona/publishing-accounts">;
|
|
@@ -1,41 +1,11 @@
|
|
|
1
1
|
// GENERATED from shared/contracts — do not edit.
|
|
2
2
|
// Run `node scripts/sync-contracts.mjs` from the repo root to regenerate.
|
|
3
|
-
//---------------
|
|
4
|
-
// accounts — the social-accounts contract, shared by the web routes and
|
|
5
|
-
// the MCP accounts tools.
|
|
6
|
-
//
|
|
7
|
-
// GET /api/account lists the caller's connected accounts (no tokens);
|
|
8
|
-
// DELETE disconnects one; POST /api/account/connect-url mints an OAuth
|
|
9
|
-
// URL for the seven OAuth providers (Bluesky takes an app password and
|
|
10
|
-
// Rumble a manual access token instead); POST /api/bluesky-connect,
|
|
11
|
-
// /api/threespeak-connect and /api/rumble-connect connect those three;
|
|
12
|
-
// GET /api/pinterest/boards lists one Pinterest account's boards; and
|
|
13
|
-
// GET/PUT /api/persona/publishing-accounts read/replace a persona's
|
|
14
|
-
// bound publishing accounts.
|
|
15
|
-
//
|
|
16
|
-
// The connect routes validate credentials by hand (JSON and, for
|
|
17
|
-
// Bluesky, multipart) with stable messages; the contract body schemas
|
|
18
|
-
// mirror those messages, pinned by the MCP tool-schema equivalence
|
|
19
|
-
// test. The publishing-accounts PUT normalizes server-side (unknown
|
|
20
|
-
// providers rejected, ids trimmed/deduped, empties dropped, at least
|
|
21
|
-
// one bound account required) — the contract body schema mirrors what
|
|
22
|
-
// the MCP sends, and those server rules stay server-side.
|
|
23
|
-
//---------------
|
|
24
3
|
import { z } from 'zod';
|
|
25
|
-
/** Define one endpoint contract. The literal path is preserved in the type
|
|
26
|
-
* so ParamsOf can read its `:param` segments. `Body`/`Query` default to
|
|
27
|
-
* `undefined` so an omitted optional schema stays `undefined` (not the
|
|
28
|
-
* bare `ZodType`) in the returned definition. */
|
|
29
4
|
export function defineEndpoint(config) {
|
|
30
5
|
return config;
|
|
31
6
|
}
|
|
32
7
|
import { OAUTH_CONNECT_PROVIDERS, SOCIAL_PROVIDERS } from './providers.js';
|
|
33
8
|
export const ACCOUNT_SYNC_STATUSES = ['ok', 'error'];
|
|
34
|
-
//---------------
|
|
35
|
-
// Public account items — what GET /api/account returns, mirroring
|
|
36
|
-
// apps/web/lib/providers/registry.ts (PublicAccountItem) and
|
|
37
|
-
// apps/web/lib/types.ts (AccountData, InstagramAccountData). No tokens.
|
|
38
|
-
//---------------
|
|
39
9
|
const accountStatus = z.enum(ACCOUNT_SYNC_STATUSES).optional();
|
|
40
10
|
const accountTimestamps = { connectedAt: z.number(), lastUsed: z.number(), status: accountStatus };
|
|
41
11
|
export const YoutubeAccountSchema = z.object({
|
|
@@ -135,6 +105,16 @@ export const FanvueAccountSchema = z.object({
|
|
|
135
105
|
profilePictureUrl: z.string().optional(),
|
|
136
106
|
...accountTimestamps,
|
|
137
107
|
});
|
|
108
|
+
export const TelegramAccountSchema = z.object({
|
|
109
|
+
provider: z.literal('telegram'),
|
|
110
|
+
recordId: z.string(),
|
|
111
|
+
providerAccountId: z.string(),
|
|
112
|
+
accountName: z.string().nullable(),
|
|
113
|
+
chatType: z.enum(['channel', 'group', 'supergroup']).optional(),
|
|
114
|
+
username: z.string().optional(),
|
|
115
|
+
botUsername: z.string().optional(),
|
|
116
|
+
...accountTimestamps,
|
|
117
|
+
});
|
|
138
118
|
export const PublicAccountItemSchema = z.discriminatedUnion('provider', [
|
|
139
119
|
YoutubeAccountSchema,
|
|
140
120
|
InstagramAccountSchema,
|
|
@@ -146,18 +126,14 @@ export const PublicAccountItemSchema = z.discriminatedUnion('provider', [
|
|
|
146
126
|
ThreespeakAccountSchema,
|
|
147
127
|
RumbleAccountSchema,
|
|
148
128
|
FanvueAccountSchema,
|
|
129
|
+
TelegramAccountSchema,
|
|
149
130
|
]);
|
|
150
|
-
// A non-blank credential field: the routes trim and reject blanks with
|
|
151
|
-
// the same message, so the schema does too.
|
|
152
131
|
function nonBlank(message) {
|
|
153
132
|
return z
|
|
154
133
|
.string()
|
|
155
134
|
.min(1, message)
|
|
156
135
|
.refine((value) => value.trim().length > 0, { message });
|
|
157
136
|
}
|
|
158
|
-
//---------------
|
|
159
|
-
// Request bodies — mirror the routes' hand-rolled validation.
|
|
160
|
-
//---------------
|
|
161
137
|
export const ConnectUrlBodySchema = z.object({
|
|
162
138
|
provider: z.enum(OAUTH_CONNECT_PROVIDERS),
|
|
163
139
|
});
|
|
@@ -173,6 +149,13 @@ export const RumbleConnectBodySchema = z.object({
|
|
|
173
149
|
channelId: nonBlank('Rumble channel ID is required.'),
|
|
174
150
|
accessToken: nonBlank('Rumble access token is required.'),
|
|
175
151
|
});
|
|
152
|
+
export const TelegramConnectBodySchema = z.object({
|
|
153
|
+
botToken: nonBlank('Telegram bot token is required.'),
|
|
154
|
+
chatId: nonBlank('Telegram chat ID or @username is required.'),
|
|
155
|
+
chatType: z.enum(['channel', 'group'], {
|
|
156
|
+
error: () => 'chatType must be channel or group.',
|
|
157
|
+
}),
|
|
158
|
+
});
|
|
176
159
|
export const DisconnectAccountQuerySchema = z.strictObject({
|
|
177
160
|
provider: z.string(),
|
|
178
161
|
providerAccountId: z.string(),
|
|
@@ -186,11 +169,6 @@ export const GetPersonaPublishingAccountsQuerySchema = z.strictObject({
|
|
|
186
169
|
export const SetPersonaPublishingAccountsBodySchema = z.object({
|
|
187
170
|
accounts: z.record(z.string(), z.array(z.string().min(1))),
|
|
188
171
|
});
|
|
189
|
-
//---------------
|
|
190
|
-
// Query parsers — the validators the routes call, mirroring their
|
|
191
|
-
// 400 messages exactly (metrics.ts pattern). The query schemas above
|
|
192
|
-
// are descriptive (raw strings); these are the validators.
|
|
193
|
-
//---------------
|
|
194
172
|
const UUID_SHAPE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
195
173
|
export function parseDisconnectAccountQuery(params) {
|
|
196
174
|
const provider = params.get('provider');
|
|
@@ -208,16 +186,8 @@ export function parseListPinterestBoardsQuery(params) {
|
|
|
208
186
|
if (accountId === null || accountId.trim() === '') {
|
|
209
187
|
return { ok: false, error: 'accountId is required.' };
|
|
210
188
|
}
|
|
211
|
-
// The route looks the token up by the trimmed id.
|
|
212
189
|
return { ok: true, accountId: accountId.trim() };
|
|
213
190
|
}
|
|
214
|
-
// Placeholder/sentinel ids (e.g. 'p-1' from an unthinking caller — the
|
|
215
|
-
// production warnings were `invalid input syntax for type uuid: "p-1"`)
|
|
216
|
-
// never reach Postgres: a stable validation 400 answers them with a
|
|
217
|
-
// machine-readable field, instead of a PostgREST error the UI can't
|
|
218
|
-
// classify and PostHog can't group (same convention as issue #216).
|
|
219
|
-
// Same canonical-shape check the engine's SAFE_TASK_ID enforces upstream:
|
|
220
|
-
// a uuid-shaped string (any version layout the DB generates).
|
|
221
191
|
export function parsePersonaPublishingAccountsQuery(params) {
|
|
222
192
|
const personaId = params.get('personaId');
|
|
223
193
|
if (!personaId)
|
|
@@ -226,9 +196,6 @@ export function parsePersonaPublishingAccountsQuery(params) {
|
|
|
226
196
|
return { ok: false, error: 'personaId must be a UUID.' };
|
|
227
197
|
return { ok: true, personaId };
|
|
228
198
|
}
|
|
229
|
-
//---------------
|
|
230
|
-
// Response views.
|
|
231
|
-
//---------------
|
|
232
199
|
export const ListSocialAccountsResponseSchema = z.object({
|
|
233
200
|
authenticated: z.literal(true),
|
|
234
201
|
accounts: z.array(PublicAccountItemSchema),
|
|
@@ -256,6 +223,13 @@ export const RumbleConnectResponseSchema = z.object({
|
|
|
256
223
|
accountId: z.string(),
|
|
257
224
|
channelId: z.string(),
|
|
258
225
|
});
|
|
226
|
+
export const TelegramConnectResponseSchema = z.object({
|
|
227
|
+
success: z.literal(true),
|
|
228
|
+
accountId: z.string(),
|
|
229
|
+
chatId: z.string(),
|
|
230
|
+
chatType: z.enum(['channel', 'group', 'supergroup']),
|
|
231
|
+
title: z.string(),
|
|
232
|
+
});
|
|
259
233
|
export const PinterestBoardSchema = z.object({
|
|
260
234
|
id: z.string(),
|
|
261
235
|
name: z.string(),
|
|
@@ -264,8 +238,6 @@ export const ListPinterestBoardsResponseSchema = z.object({
|
|
|
264
238
|
success: z.literal(true),
|
|
265
239
|
boards: z.array(PinterestBoardSchema),
|
|
266
240
|
});
|
|
267
|
-
// Every known provider is always present (possibly empty) — the GET
|
|
268
|
-
// returns the full map, never a partial one.
|
|
269
241
|
export const PersonaPublishingAccountsSchema = z.object({
|
|
270
242
|
youtube: z.array(z.string()),
|
|
271
243
|
instagram: z.array(z.string()),
|
|
@@ -277,14 +249,12 @@ export const PersonaPublishingAccountsSchema = z.object({
|
|
|
277
249
|
'3speak': z.array(z.string()),
|
|
278
250
|
rumble: z.array(z.string()),
|
|
279
251
|
fanvue: z.array(z.string()),
|
|
252
|
+
telegram: z.array(z.string()),
|
|
280
253
|
});
|
|
281
254
|
export const PersonaPublishingAccountsResponseSchema = z.object({
|
|
282
255
|
success: z.literal(true),
|
|
283
256
|
defaults: PersonaPublishingAccountsSchema,
|
|
284
257
|
});
|
|
285
|
-
//---------------
|
|
286
|
-
// Endpoints.
|
|
287
|
-
//---------------
|
|
288
258
|
export const listSocialAccounts = defineEndpoint({
|
|
289
259
|
method: 'GET',
|
|
290
260
|
path: '/api/account',
|
|
@@ -320,6 +290,12 @@ export const connectRumbleAccount = defineEndpoint({
|
|
|
320
290
|
body: RumbleConnectBodySchema,
|
|
321
291
|
response: RumbleConnectResponseSchema,
|
|
322
292
|
});
|
|
293
|
+
export const connectTelegramAccount = defineEndpoint({
|
|
294
|
+
method: 'POST',
|
|
295
|
+
path: '/api/telegram-connect',
|
|
296
|
+
body: TelegramConnectBodySchema,
|
|
297
|
+
response: TelegramConnectResponseSchema,
|
|
298
|
+
});
|
|
323
299
|
export const listPinterestBoards = defineEndpoint({
|
|
324
300
|
method: 'GET',
|
|
325
301
|
path: '/api/pinterest/boards',
|