@framers/agentos-ext-channel-reddit 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 +98 -0
- package/dist/RedditChannelAdapter.d.ts +30 -0
- package/dist/RedditChannelAdapter.d.ts.map +1 -0
- package/dist/RedditChannelAdapter.js +195 -0
- package/dist/RedditChannelAdapter.js.map +1 -0
- package/dist/RedditService.d.ts +135 -0
- package/dist/RedditService.d.ts.map +1 -0
- package/dist/RedditService.js +420 -0
- package/dist/RedditService.js.map +1 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +110 -0
- package/dist/index.js.map +1 -0
- package/dist/tools/analytics.d.ts +96 -0
- package/dist/tools/analytics.d.ts.map +1 -0
- package/dist/tools/analytics.js +81 -0
- package/dist/tools/analytics.js.map +1 -0
- package/dist/tools/comment.d.ts +56 -0
- package/dist/tools/comment.d.ts.map +1 -0
- package/dist/tools/comment.js +72 -0
- package/dist/tools/comment.js.map +1 -0
- package/dist/tools/inbox.d.ts +103 -0
- package/dist/tools/inbox.d.ts.map +1 -0
- package/dist/tools/inbox.js +137 -0
- package/dist/tools/inbox.js.map +1 -0
- package/dist/tools/search.d.ts +106 -0
- package/dist/tools/search.d.ts.map +1 -0
- package/dist/tools/search.js +113 -0
- package/dist/tools/search.js.map +1 -0
- package/dist/tools/submitPost.d.ts +99 -0
- package/dist/tools/submitPost.d.ts.map +1 -0
- package/dist/tools/submitPost.js +109 -0
- package/dist/tools/submitPost.js.map +1 -0
- package/dist/tools/subscribe.d.ts +57 -0
- package/dist/tools/subscribe.d.ts.map +1 -0
- package/dist/tools/subscribe.js +73 -0
- package/dist/tools/subscribe.js.map +1 -0
- package/dist/tools/trending.d.ts +98 -0
- package/dist/tools/trending.d.ts.map +1 -0
- package/dist/tools/trending.js +107 -0
- package/dist/tools/trending.js.map +1 -0
- package/dist/tools/vote.d.ts +57 -0
- package/dist/tools/vote.d.ts.map +1 -0
- package/dist/tools/vote.js +73 -0
- package/dist/tools/vote.js.map +1 -0
- package/manifest.json +73 -0
- package/package.json +51 -0
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview ITool for searching Reddit posts and subreddits via the Reddit channel adapter.
|
|
3
|
+
*/
|
|
4
|
+
import type { ITool, ToolExecutionContext, ToolExecutionResult } from '@framers/agentos';
|
|
5
|
+
import type { RedditService } from '../RedditService';
|
|
6
|
+
export declare class RedditSearchTool implements ITool {
|
|
7
|
+
private readonly service;
|
|
8
|
+
readonly id = "redditSearch";
|
|
9
|
+
readonly name = "reddit.search";
|
|
10
|
+
readonly displayName = "Reddit Search";
|
|
11
|
+
readonly description = "Search for posts across Reddit or within a specific subreddit. Supports sorting, time filtering, and result limits.";
|
|
12
|
+
readonly category = "social";
|
|
13
|
+
readonly version = "0.1.0";
|
|
14
|
+
readonly hasSideEffects = false;
|
|
15
|
+
readonly inputSchema: {
|
|
16
|
+
type: "object";
|
|
17
|
+
required: readonly ["query"];
|
|
18
|
+
properties: {
|
|
19
|
+
query: {
|
|
20
|
+
type: string;
|
|
21
|
+
description: string;
|
|
22
|
+
};
|
|
23
|
+
subreddit: {
|
|
24
|
+
type: string;
|
|
25
|
+
description: string;
|
|
26
|
+
};
|
|
27
|
+
sort: {
|
|
28
|
+
type: string;
|
|
29
|
+
enum: string[];
|
|
30
|
+
description: string;
|
|
31
|
+
};
|
|
32
|
+
time: {
|
|
33
|
+
type: string;
|
|
34
|
+
enum: string[];
|
|
35
|
+
description: string;
|
|
36
|
+
};
|
|
37
|
+
limit: {
|
|
38
|
+
type: string;
|
|
39
|
+
description: string;
|
|
40
|
+
minimum: number;
|
|
41
|
+
maximum: number;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
readonly outputSchema: {
|
|
46
|
+
type: "object";
|
|
47
|
+
properties: {
|
|
48
|
+
results: {
|
|
49
|
+
type: string;
|
|
50
|
+
description: string;
|
|
51
|
+
items: {
|
|
52
|
+
type: string;
|
|
53
|
+
properties: {
|
|
54
|
+
id: {
|
|
55
|
+
type: string;
|
|
56
|
+
};
|
|
57
|
+
title: {
|
|
58
|
+
type: string;
|
|
59
|
+
};
|
|
60
|
+
author: {
|
|
61
|
+
type: string;
|
|
62
|
+
};
|
|
63
|
+
subreddit: {
|
|
64
|
+
type: string;
|
|
65
|
+
};
|
|
66
|
+
score: {
|
|
67
|
+
type: string;
|
|
68
|
+
};
|
|
69
|
+
numComments: {
|
|
70
|
+
type: string;
|
|
71
|
+
};
|
|
72
|
+
url: {
|
|
73
|
+
type: string;
|
|
74
|
+
};
|
|
75
|
+
permalink: {
|
|
76
|
+
type: string;
|
|
77
|
+
};
|
|
78
|
+
createdUtc: {
|
|
79
|
+
type: string;
|
|
80
|
+
};
|
|
81
|
+
selftext: {
|
|
82
|
+
type: string;
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
count: {
|
|
88
|
+
type: string;
|
|
89
|
+
description: string;
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
constructor(service: RedditService);
|
|
94
|
+
execute(args: {
|
|
95
|
+
query: string;
|
|
96
|
+
subreddit?: string;
|
|
97
|
+
sort?: 'relevance' | 'hot' | 'top' | 'new' | 'comments';
|
|
98
|
+
time?: 'hour' | 'day' | 'week' | 'month' | 'year' | 'all';
|
|
99
|
+
limit?: number;
|
|
100
|
+
}, _context: ToolExecutionContext): Promise<ToolExecutionResult>;
|
|
101
|
+
validateArgs(args: Record<string, any>): {
|
|
102
|
+
isValid: boolean;
|
|
103
|
+
errors?: string[];
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=search.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/tools/search.ts"],"names":[],"mappings":"AACA;;GAEG;AAEH,O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it posts and subreddits via the Reddit channel adapter.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.RedditSearchTool = void 0;
|
|
8
|
+
class RedditSearchTool {
|
|
9
|
+
constructor(service) {
|
|
10
|
+
this.service = service;
|
|
11
|
+
this.id = 'redditSearch';
|
|
12
|
+
this.name = 'reddit.search';
|
|
13
|
+
this.displayName = 'Reddit Search';
|
|
14
|
+
this.description = 'Search for posts across Reddit or within a specific subreddit. Supports sorting, time filtering, and result limits.';
|
|
15
|
+
this.category = 'social';
|
|
16
|
+
this.version = '0.1.0';
|
|
17
|
+
this.hasSideEffects = false;
|
|
18
|
+
this.inputSchema = {
|
|
19
|
+
type: 'object',
|
|
20
|
+
required: ['query'],
|
|
21
|
+
properties: {
|
|
22
|
+
query: { type: 'string', description: 'Search query string' },
|
|
23
|
+
subreddit: {
|
|
24
|
+
type: 'string',
|
|
25
|
+
description: 'Optional subreddit to search within (without r/ prefix)',
|
|
26
|
+
},
|
|
27
|
+
sort: {
|
|
28
|
+
type: 'string',
|
|
29
|
+
enum: ['relevance', 'hot', 'top', 'new', 'comments'],
|
|
30
|
+
description: 'Sort order for results (default: relevance)',
|
|
31
|
+
},
|
|
32
|
+
time: {
|
|
33
|
+
type: 'string',
|
|
34
|
+
enum: ['hour', 'day', 'week', 'month', 'year', 'all'],
|
|
35
|
+
description: 'Time filter for results (default: all)',
|
|
36
|
+
},
|
|
37
|
+
limit: {
|
|
38
|
+
type: 'number',
|
|
39
|
+
description: 'Maximum number of results to return (1-100, default: 25)',
|
|
40
|
+
minimum: 1,
|
|
41
|
+
maximum: 100,
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
this.outputSchema = {
|
|
46
|
+
type: 'object',
|
|
47
|
+
properties: {
|
|
48
|
+
results: {
|
|
49
|
+
type: 'array',
|
|
50
|
+
description: 'Search results',
|
|
51
|
+
items: {
|
|
52
|
+
type: 'object',
|
|
53
|
+
properties: {
|
|
54
|
+
id: { type: 'string' },
|
|
55
|
+
title: { type: 'string' },
|
|
56
|
+
author: { type: 'string' },
|
|
57
|
+
subreddit: { type: 'string' },
|
|
58
|
+
score: { type: 'number' },
|
|
59
|
+
numComments: { type: 'number' },
|
|
60
|
+
url: { type: 'string' },
|
|
61
|
+
permalink: { type: 'string' },
|
|
62
|
+
createdUtc: { type: 'number' },
|
|
63
|
+
selftext: { type: 'string' },
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
count: { type: 'number', description: 'Number of results returned' },
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
async execute(args, _context) {
|
|
72
|
+
try {
|
|
73
|
+
const results = await this.service.search(args.query, {
|
|
74
|
+
subreddit: args.subreddit,
|
|
75
|
+
sort: args.sort,
|
|
76
|
+
time: args.time,
|
|
77
|
+
limit: args.limit,
|
|
78
|
+
});
|
|
79
|
+
return {
|
|
80
|
+
success: true,
|
|
81
|
+
output: {
|
|
82
|
+
results,
|
|
83
|
+
count: results.length,
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
catch (error) {
|
|
88
|
+
return { success: false, error: error.message };
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
validateArgs(args) {
|
|
92
|
+
const errors = [];
|
|
93
|
+
if (!args.query)
|
|
94
|
+
errors.push('query is required');
|
|
95
|
+
else if (typeof args.query !== 'string')
|
|
96
|
+
errors.push('query must be a string');
|
|
97
|
+
if (args.sort && !['relevance', 'hot', 'top', 'new', 'comments'].includes(args.sort)) {
|
|
98
|
+
errors.push('sort must be one of: relevance, hot, top, new, comments');
|
|
99
|
+
}
|
|
100
|
+
if (args.time && !['hour', 'day', 'week', 'month', 'year', 'all'].includes(args.time)) {
|
|
101
|
+
errors.push('time must be one of: hour, day, week, month, year, all');
|
|
102
|
+
}
|
|
103
|
+
if (args.limit !== undefined) {
|
|
104
|
+
if (typeof args.limit !== 'number')
|
|
105
|
+
errors.push('limit must be a number');
|
|
106
|
+
else if (args.limit < 1 || args.limit > 100)
|
|
107
|
+
errors.push('limit must be between 1 and 100');
|
|
108
|
+
}
|
|
109
|
+
return { isValid: errors.length === 0, errors };
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
exports.RedditSearchTool = RedditSearchTool;
|
|
113
|
+
//# sourceMappingURL=search.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.js","sourceRoot":"","sources":["../../src/tools/search.ts"],"names":[],"mappings":";AAAA,cAAc;AACd;;GAEG;;;AAKH,MAAa,gBAAgB;IAgE3B,YAA6B,OAAsB;QAAtB,YAAO,GAAP,OAAO,CAAe;QA/DnC,OAAE,GAAG,cAAc,CAAC;QACpB,SAAI,GAAG,eAAe,CAAC;QACvB,gBAAW,GAAG,eAAe,CAAC;QAC9B,gBAAW,GACzB,qHAAqH,CAAC;QACxG,aAAQ,GAAG,QAAQ,CAAC;QACpB,YAAO,GAAG,OAAO,CAAC;QAClB,mBAAc,GAAG,KAAK,CAAC;QAEvB,gBAAW,GAAG;YAC5B,IAAI,EAAE,QAAiB;YACvB,QAAQ,EAAE,CAAC,OAAO,CAAU;YAC5B,UAAU,EAAE;gBACV,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,qBAAqB,EAAE;gBAC7D,SAAS,EAAE;oBACT,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,yDAAyD;iBACvE;gBACD,IAAI,EAAE;oBACJ,IAAI,EAAE,QAAQ;oBACd,IAAI,EAAE,CAAC,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,CAAC;oBACpD,WAAW,EAAE,6CAA6C;iBAC3D;gBACD,IAAI,EAAE;oBACJ,IAAI,EAAE,QAAQ;oBACd,IAAI,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAA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,CAAC,CAAC;iBACrE,IAAI,IAAI,CAAC,KAAK,GAAG,CAAC,IAAI,IAAI,CAAC,KAAK,GAAG,GAAG;gBAAE,MAAM,CAAC,IAAI,CAAC,iCAAiC,CAAC,CAAC;QAC9F,CAAC;QACD,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IAClD,CAAC;CACF;AAhHD,4CAgHC"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview ITool for submitting posts to a subreddit via the Reddit channel adapter.
|
|
3
|
+
*/
|
|
4
|
+
import type { ITool, ToolExecutionContext, ToolExecutionResult } from '@framers/agentos';
|
|
5
|
+
import type { RedditService } from '../RedditService';
|
|
6
|
+
export declare class RedditSubmitPostTool implements ITool {
|
|
7
|
+
private readonly service;
|
|
8
|
+
readonly id = "redditSubmitPost";
|
|
9
|
+
readonly name = "reddit.post";
|
|
10
|
+
readonly displayName = "Submit Reddit Post";
|
|
11
|
+
readonly description = "Submit a new post to a subreddit. Supports text, link, image, and poll post types.";
|
|
12
|
+
readonly category = "social";
|
|
13
|
+
readonly version = "0.1.0";
|
|
14
|
+
readonly hasSideEffects = true;
|
|
15
|
+
readonly inputSchema: {
|
|
16
|
+
type: "object";
|
|
17
|
+
required: readonly ["subreddit", "title", "content", "type"];
|
|
18
|
+
properties: {
|
|
19
|
+
subreddit: {
|
|
20
|
+
type: string;
|
|
21
|
+
description: string;
|
|
22
|
+
};
|
|
23
|
+
title: {
|
|
24
|
+
type: string;
|
|
25
|
+
description: string;
|
|
26
|
+
};
|
|
27
|
+
content: {
|
|
28
|
+
type: string;
|
|
29
|
+
description: string;
|
|
30
|
+
};
|
|
31
|
+
type: {
|
|
32
|
+
type: string;
|
|
33
|
+
enum: string[];
|
|
34
|
+
description: string;
|
|
35
|
+
};
|
|
36
|
+
pollOptions: {
|
|
37
|
+
type: string;
|
|
38
|
+
description: string;
|
|
39
|
+
items: {
|
|
40
|
+
type: string;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
pollDurationDays: {
|
|
44
|
+
type: string;
|
|
45
|
+
description: string;
|
|
46
|
+
};
|
|
47
|
+
flairId: {
|
|
48
|
+
type: string;
|
|
49
|
+
description: string;
|
|
50
|
+
};
|
|
51
|
+
nsfw: {
|
|
52
|
+
type: string;
|
|
53
|
+
description: string;
|
|
54
|
+
};
|
|
55
|
+
spoiler: {
|
|
56
|
+
type: string;
|
|
57
|
+
description: string;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
readonly outputSchema: {
|
|
62
|
+
type: "object";
|
|
63
|
+
properties: {
|
|
64
|
+
id: {
|
|
65
|
+
type: string;
|
|
66
|
+
description: string;
|
|
67
|
+
};
|
|
68
|
+
name: {
|
|
69
|
+
type: string;
|
|
70
|
+
description: string;
|
|
71
|
+
};
|
|
72
|
+
url: {
|
|
73
|
+
type: string;
|
|
74
|
+
description: string;
|
|
75
|
+
};
|
|
76
|
+
permalink: {
|
|
77
|
+
type: string;
|
|
78
|
+
description: string;
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
constructor(service: RedditService);
|
|
83
|
+
execute(args: {
|
|
84
|
+
subreddit: string;
|
|
85
|
+
title: string;
|
|
86
|
+
content: string;
|
|
87
|
+
type: 'text' | 'link' | 'image' | 'poll';
|
|
88
|
+
pollOptions?: string[];
|
|
89
|
+
pollDurationDays?: number;
|
|
90
|
+
flairId?: string;
|
|
91
|
+
nsfw?: boolean;
|
|
92
|
+
spoiler?: boolean;
|
|
93
|
+
}, _context: ToolExecutionContext): Promise<ToolExecutionResult>;
|
|
94
|
+
validateArgs(args: Record<string, any>): {
|
|
95
|
+
isValid: boolean;
|
|
96
|
+
errors?: string[];
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=submitPost.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"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AA;KAAE;CAgBjF"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
/**
|
|
4
|
+
* @fileoverview ITool for submitting posts to a subreddit via the Reddit channel adapter.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.RedditSubmitPostTool = void 0;
|
|
8
|
+
class RedditSubmitPostTool {
|
|
9
|
+
constructor(service) {
|
|
10
|
+
this.service = service;
|
|
11
|
+
this.id = 'redditSubmitPost';
|
|
12
|
+
this.name = 'reddit.post';
|
|
13
|
+
this.displayName = 'Submit Reddit Post';
|
|
14
|
+
this.description = 'Submit a new post to a subreddit. Supports text, link, image, and poll post types.';
|
|
15
|
+
this.category = 'social';
|
|
16
|
+
this.version = '0.1.0';
|
|
17
|
+
this.hasSideEffects = true;
|
|
18
|
+
this.inputSchema = {
|
|
19
|
+
type: 'object',
|
|
20
|
+
required: ['subreddit', 'title', 'content', 'type'],
|
|
21
|
+
properties: {
|
|
22
|
+
subreddit: { type: 'string', description: 'Target subreddit name (without r/ prefix)' },
|
|
23
|
+
title: { type: 'string', description: 'Post title (max 300 characters)' },
|
|
24
|
+
content: {
|
|
25
|
+
type: 'string',
|
|
26
|
+
description: 'Post body text (for text/poll), URL (for link/image)',
|
|
27
|
+
},
|
|
28
|
+
type: {
|
|
29
|
+
type: 'string',
|
|
30
|
+
enum: ['text', 'link', 'image', 'poll'],
|
|
31
|
+
description: 'Post type: text, link, image, or poll',
|
|
32
|
+
},
|
|
33
|
+
pollOptions: {
|
|
34
|
+
type: 'array',
|
|
35
|
+
description: 'Poll answer options (required for poll type)',
|
|
36
|
+
items: { type: 'string' },
|
|
37
|
+
},
|
|
38
|
+
pollDurationDays: {
|
|
39
|
+
type: 'number',
|
|
40
|
+
description: 'Poll duration in days (1-7, default 3)',
|
|
41
|
+
},
|
|
42
|
+
flairId: { type: 'string', description: 'Optional flair ID for the post' },
|
|
43
|
+
nsfw: { type: 'boolean', description: 'Mark post as NSFW' },
|
|
44
|
+
spoiler: { type: 'boolean', description: 'Mark post as spoiler' },
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
this.outputSchema = {
|
|
48
|
+
type: 'object',
|
|
49
|
+
properties: {
|
|
50
|
+
id: { type: 'string', description: 'Post ID' },
|
|
51
|
+
name: { type: 'string', description: 'Reddit fullname (e.g. t3_abc123)' },
|
|
52
|
+
url: { type: 'string', description: 'Full URL to the post' },
|
|
53
|
+
permalink: { type: 'string', description: 'Reddit permalink' },
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
async execute(args, _context) {
|
|
58
|
+
try {
|
|
59
|
+
if (args.title.length > 300) {
|
|
60
|
+
throw new Error('Post title exceeds 300 character limit');
|
|
61
|
+
}
|
|
62
|
+
if (args.type === 'poll' && (!args.pollOptions || args.pollOptions.length < 2)) {
|
|
63
|
+
throw new Error('Poll posts require at least 2 poll options');
|
|
64
|
+
}
|
|
65
|
+
const result = await this.service.submitPost({
|
|
66
|
+
subreddit: args.subreddit,
|
|
67
|
+
title: args.title,
|
|
68
|
+
content: args.content,
|
|
69
|
+
type: args.type,
|
|
70
|
+
pollOptions: args.pollOptions,
|
|
71
|
+
pollDurationDays: args.pollDurationDays,
|
|
72
|
+
flairId: args.flairId,
|
|
73
|
+
nsfw: args.nsfw,
|
|
74
|
+
spoiler: args.spoiler,
|
|
75
|
+
});
|
|
76
|
+
return {
|
|
77
|
+
success: true,
|
|
78
|
+
output: result,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
return { success: false, error: error.message };
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
validateArgs(args) {
|
|
86
|
+
const errors = [];
|
|
87
|
+
if (!args.subreddit)
|
|
88
|
+
errors.push('subreddit is required');
|
|
89
|
+
if (!args.title)
|
|
90
|
+
errors.push('title is required');
|
|
91
|
+
else if (typeof args.title !== 'string')
|
|
92
|
+
errors.push('title must be a string');
|
|
93
|
+
else if (args.title.length > 300)
|
|
94
|
+
errors.push('title exceeds 300 character limit');
|
|
95
|
+
if (!args.content && args.content !== '')
|
|
96
|
+
errors.push('content is required');
|
|
97
|
+
if (!args.type)
|
|
98
|
+
errors.push('type is required');
|
|
99
|
+
else if (!['text', 'link', 'image', 'poll'].includes(args.type)) {
|
|
100
|
+
errors.push('type must be one of: text, link, image, poll');
|
|
101
|
+
}
|
|
102
|
+
if (args.type === 'poll' && (!args.pollOptions || !Array.isArray(args.pollOptions) || args.pollOptions.length < 2)) {
|
|
103
|
+
errors.push('poll type requires at least 2 pollOptions');
|
|
104
|
+
}
|
|
105
|
+
return { isValid: errors.length === 0, errors };
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
exports.RedditSubmitPostTool = RedditSubmitPostTool;
|
|
109
|
+
//# sourceMappingURL=submitPost.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"submitPost.js","sourceRoot":"","sources":["../../src/tools/submitPost.ts"],"names":[],"mappings":";AAAA,cAAc;AACd;;GAEG;;;AAKH,MAAa,oBAAoB;IAkD/B,YAA6B,OAAsB;QAAtB,YAAO,GAAP,OAAO,CAAe;QAjDnC,OAAE,GAAG,kBAAkB,CAAC;QACxB,SAAI,GAAG,aAAa,CAAC;QACrB,gBAAW,GAAG,oBAAoB,CAAC;QACnC,gBAAW,GACzB,oFAAoF,CAAC;QACvE,aAAQ,GAAG,QAAQ,CAAC;QACpB,YAAO,GAAG,OAAO,CAAC;QAClB,mBAAc,GAAG,IAAI,CAAC;QAEtB,gBAAW,GAAG;YAC5B,IAAI,EAAE,QAAiB;YACvB,QAAQ,EAAE,CAAC,WAAW,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,CAAU;YAC5D,UAAU,EAAE;gBACV,SAAS,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,2CAA2C,EAAE;gBACvF,KAA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,CAAC,KAAK,KAAK,QAAQ;YAAE,MAAM,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;aAC1E,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,GAAG;YAAE,MAAM,CAAC,IAAI,CAAC,mCAAmC,CAAC,CAAC;QACnF,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,KAAK,EAAE;YAAE,MAAM,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;QAC7E,IAAI,CAAC,IAAI,CAAC,IAAI;YAAE,MAAM,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;aAC3C,IAAI,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YAChE,MAAM,CAAC,IAAI,CAAC,8CAA8C,CAAC,CAAC;QAC9D,CAAC;QACD,IAAI,IAAI,CAAC,IAAI,KAAK,MAAM,IAAI,CAAC,CAAC,IAAI,CAAC,WAAW,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,IAAI,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,EAAE,CAAC;YACnH,MAAM,CAAC,IAAI,CAAC,2CAA2C,CAAC,CAAC;QAC3D,CAAC;QACD,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IAClD,CAAC;CACF;AAhHD,oDAgHC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview ITool for subscribing to or unsubscribing from subreddits via the Reddit channel adapter.
|
|
3
|
+
*/
|
|
4
|
+
import type { ITool, ToolExecutionContext, ToolExecutionResult } from '@framers/agentos';
|
|
5
|
+
import type { RedditService } from '../RedditService';
|
|
6
|
+
export declare class RedditSubscribeTool implements ITool {
|
|
7
|
+
private readonly service;
|
|
8
|
+
readonly id = "redditSubscribe";
|
|
9
|
+
readonly name = "reddit.subscribe";
|
|
10
|
+
readonly displayName = "Reddit Subscribe";
|
|
11
|
+
readonly description = "Subscribe to (join) or unsubscribe from (leave) a subreddit.";
|
|
12
|
+
readonly category = "social";
|
|
13
|
+
readonly version = "0.1.0";
|
|
14
|
+
readonly hasSideEffects = true;
|
|
15
|
+
readonly inputSchema: {
|
|
16
|
+
type: "object";
|
|
17
|
+
required: readonly ["subreddit", "action"];
|
|
18
|
+
properties: {
|
|
19
|
+
subreddit: {
|
|
20
|
+
type: string;
|
|
21
|
+
description: string;
|
|
22
|
+
};
|
|
23
|
+
action: {
|
|
24
|
+
type: string;
|
|
25
|
+
enum: string[];
|
|
26
|
+
description: string;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
readonly outputSchema: {
|
|
31
|
+
type: "object";
|
|
32
|
+
properties: {
|
|
33
|
+
success: {
|
|
34
|
+
type: string;
|
|
35
|
+
description: string;
|
|
36
|
+
};
|
|
37
|
+
subreddit: {
|
|
38
|
+
type: string;
|
|
39
|
+
description: string;
|
|
40
|
+
};
|
|
41
|
+
action: {
|
|
42
|
+
type: string;
|
|
43
|
+
description: string;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
constructor(service: RedditService);
|
|
48
|
+
execute(args: {
|
|
49
|
+
subreddit: string;
|
|
50
|
+
action: 'subscribe' | 'unsubscribe';
|
|
51
|
+
}, _context: ToolExecutionContext): Promise<ToolExecutionResult>;
|
|
52
|
+
validateArgs(args: Record<string, any>): {
|
|
53
|
+
isValid: boolean;
|
|
54
|
+
errors?: string[];
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=subscribe.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscribe.d.ts","sourceRoot":"","sources":["../../src/tools/subscribe.ts"],"names":[],"mappings":"AACA;;GAEG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACzF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEtD,qBAAa,mBAAoB,YAAW,KAAK;IAmCnC,OAAO,CAAC,QAAQ,CAAC,OAAO;IAlCpC,SAAgB,EAAE,qBAAqB;IACvC,SAAgB,IAAI,sBAAsB;IAC1C,SAAgB,WAAW,sBAAsB;IACjD,SAAgB,WAAW,kEACsC;IACjE,SAAgB,QAAQ,YAAY;IACpC,SAAgB,OAAO,WAAW;IAClC,SAAgB,cAAc,QAAQ;IAEtC,SAAgB,WAAW;;;;;;;;;;;;;;MAczB;IAEF,SAAgB,YAAY;;;;;;;;;;;;;;;;MAO1B;gBAE2B,OAAO,EAAE,aAAa;IAE7C,OAAO,CACX,IAAI,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,WAAW,GAAG,aAAa,CAAA;KAAE,EAChE,QAAQ,EAAE,oBAAoB,GAC7B,OAAO,CAAC,mBAAmB,CAAC;IAiB/B,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE;CAUjF"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
/**
|
|
4
|
+
* @fileoverview ITool for subscribing to or unsubscribing from subreddits via the Reddit channel adapter.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.RedditSubscribeTool = void 0;
|
|
8
|
+
class RedditSubscribeTool {
|
|
9
|
+
constructor(service) {
|
|
10
|
+
this.service = service;
|
|
11
|
+
this.id = 'redditSubscribe';
|
|
12
|
+
this.name = 'reddit.subscribe';
|
|
13
|
+
this.displayName = 'Reddit Subscribe';
|
|
14
|
+
this.description = 'Subscribe to (join) or unsubscribe from (leave) a subreddit.';
|
|
15
|
+
this.category = 'social';
|
|
16
|
+
this.version = '0.1.0';
|
|
17
|
+
this.hasSideEffects = true;
|
|
18
|
+
this.inputSchema = {
|
|
19
|
+
type: 'object',
|
|
20
|
+
required: ['subreddit', 'action'],
|
|
21
|
+
properties: {
|
|
22
|
+
subreddit: {
|
|
23
|
+
type: 'string',
|
|
24
|
+
description: 'Subreddit name to subscribe/unsubscribe (without r/ prefix)',
|
|
25
|
+
},
|
|
26
|
+
action: {
|
|
27
|
+
type: 'string',
|
|
28
|
+
enum: ['subscribe', 'unsubscribe'],
|
|
29
|
+
description: 'Action to perform: subscribe (join) or unsubscribe (leave)',
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
this.outputSchema = {
|
|
34
|
+
type: 'object',
|
|
35
|
+
properties: {
|
|
36
|
+
success: { type: 'boolean', description: 'Whether the action was successful' },
|
|
37
|
+
subreddit: { type: 'string', description: 'The subreddit acted upon' },
|
|
38
|
+
action: { type: 'string', description: 'The action performed' },
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
async execute(args, _context) {
|
|
43
|
+
try {
|
|
44
|
+
await this.service.subscribe(args.subreddit, args.action);
|
|
45
|
+
return {
|
|
46
|
+
success: true,
|
|
47
|
+
output: {
|
|
48
|
+
success: true,
|
|
49
|
+
subreddit: args.subreddit,
|
|
50
|
+
action: args.action,
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
return { success: false, error: error.message };
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
validateArgs(args) {
|
|
59
|
+
const errors = [];
|
|
60
|
+
if (!args.subreddit)
|
|
61
|
+
errors.push('subreddit is required');
|
|
62
|
+
else if (typeof args.subreddit !== 'string')
|
|
63
|
+
errors.push('subreddit must be a string');
|
|
64
|
+
if (!args.action)
|
|
65
|
+
errors.push('action is required');
|
|
66
|
+
else if (!['subscribe', 'unsubscribe'].includes(args.action)) {
|
|
67
|
+
errors.push('action must be one of: subscribe, unsubscribe');
|
|
68
|
+
}
|
|
69
|
+
return { isValid: errors.length === 0, errors };
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
exports.RedditSubscribeTool = RedditSubscribeTool;
|
|
73
|
+
//# sourceMappingURL=subscribe.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscribe.js","sourceRoot":"","sources":["../../src/tools/subscribe.ts"],"names":[],"mappings":";AAAA,cAAc;AACd;;GAEG;;;AAKH,MAAa,mBAAmB;IAmC9B,YAA6B,OAAsB;QAAtB,YAAO,GAAP,OAAO,CAAe;QAlCnC,OAAE,GAAG,iBAAiB,CAAC;QACvB,SAAI,GAAG,kBAAkB,CAAC;QAC1B,gBAAW,GAAG,kBAAkB,CAAC;QACjC,gBAAW,GACzB,8DAA8D,CAAC;QACjD,aAAQ,GAAG,QAAQ,CAAC;QACpB,YAAO,GAAG,OAAO,CAAC;QAClB,mBAAc,GAAG,IAAI,CAAC;QAEtB,gBAAW,GAAG;YAC5B,IAAI,EAAE,QAAiB;YACvB,QAAQ,EAAE,CAAC,WAAW,EAAE,QAAQ,CAAU;YAC1C,UAAU,EAAE;gBACV,SAAS,EAAE;oBACT,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,6DAA6D;iBAC3E;gBACD,MAAM,EAAE;oBACN,IAAI,EAAE,QAAQ;oBACd,IAAI,EAAE,CAAC,WAAW,EAAE,aAAa,CAAC;oBAClC,WAAW,EAAE,4DAA4D;iBAC1E;aACF;SACF,CAAC;QAEc,iBAAY,GAAG;YAC7B,IAAI,EAAE,QAAiB;YACvB,UAAU,EAAE;gBACV,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,mCAAmC,EAAE;gBAC9E,SAAS,EAAE,EAA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