@opentabs-dev/opentabs-plugin-reddit 0.0.76 → 0.0.77
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 +75 -0
- package/dist/adapter.iife.js +321 -7
- package/dist/adapter.iife.js.map +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -1
- package/dist/tools/delete-thing.d.ts +7 -0
- package/dist/tools/delete-thing.d.ts.map +1 -0
- package/dist/tools/delete-thing.js +25 -0
- package/dist/tools/delete-thing.js.map +1 -0
- package/dist/tools/edit-text.d.ts +9 -0
- package/dist/tools/edit-text.d.ts.map +1 -0
- package/dist/tools/edit-text.js +38 -0
- package/dist/tools/edit-text.js.map +1 -0
- package/dist/tools/get-comment-thread.d.ts +32 -0
- package/dist/tools/get-comment-thread.d.ts.map +1 -0
- package/dist/tools/get-comment-thread.js +94 -0
- package/dist/tools/get-comment-thread.js.map +1 -0
- package/dist/tools/hide.d.ts +8 -0
- package/dist/tools/hide.d.ts.map +1 -0
- package/dist/tools/hide.js +24 -0
- package/dist/tools/hide.js.map +1 -0
- package/dist/tools/list-popular-subreddits.d.ts +22 -0
- package/dist/tools/list-popular-subreddits.d.ts.map +1 -0
- package/dist/tools/list-popular-subreddits.js +55 -0
- package/dist/tools/list-popular-subreddits.js.map +1 -0
- package/dist/tools/list-user-content.d.ts +50 -0
- package/dist/tools/list-user-content.d.ts.map +1 -0
- package/dist/tools/list-user-content.js +78 -0
- package/dist/tools/list-user-content.js.map +1 -0
- package/dist/tools/report.d.ts +8 -0
- package/dist/tools/report.d.ts.map +1 -0
- package/dist/tools/report.js +26 -0
- package/dist/tools/report.js.map +1 -0
- package/dist/tools.json +666 -11
- package/package.json +10 -4
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE/D,cAAM,YAAa,SAAQ,cAAc;IACvC,QAAQ,CAAC,IAAI,YAAY;IACzB,QAAQ,CAAC,WAAW,gCAAgC;IACpD,SAAkB,WAAW,YAAY;IACzC,QAAQ,CAAC,WAAW,WAA4E;IAChG,SAAkB,QAAQ,4BAA4B;IACtD,QAAQ,CAAC,KAAK,EAAE,cAAc,EAAE,CAuB9B;IAEF;;;;;OAKG;IACG,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC;CAIlC;;AAED,wBAAkC"}
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import { isAuthenticated, waitForAuth } from './reddit-api.js';
|
|
2
|
+
import { deleteThing } from './tools/delete-thing.js';
|
|
3
|
+
import { editText } from './tools/edit-text.js';
|
|
4
|
+
import { getCommentThread } from './tools/get-comment-thread.js';
|
|
2
5
|
import { getMe } from './tools/get-me.js';
|
|
3
6
|
import { getPost } from './tools/get-post.js';
|
|
4
7
|
import { getSubreddit } from './tools/get-subreddit.js';
|
|
5
8
|
import { getUser } from './tools/get-user.js';
|
|
9
|
+
import { hide } from './tools/hide.js';
|
|
10
|
+
import { listPopularSubreddits } from './tools/list-popular-subreddits.js';
|
|
6
11
|
import { listPosts } from './tools/list-posts.js';
|
|
7
12
|
import { listSubscriptions } from './tools/list-subscriptions.js';
|
|
13
|
+
import { listUserContent } from './tools/list-user-content.js';
|
|
8
14
|
import { readInbox } from './tools/read-inbox.js';
|
|
15
|
+
import { report } from './tools/report.js';
|
|
9
16
|
import { save } from './tools/save.js';
|
|
10
17
|
import { searchPosts } from './tools/search-posts.js';
|
|
11
18
|
import { searchSubreddits } from './tools/search-subreddits.js';
|
|
@@ -28,11 +35,18 @@ class RedditPlugin extends OpenTabsPlugin {
|
|
|
28
35
|
searchPosts,
|
|
29
36
|
submitPost,
|
|
30
37
|
submitComment,
|
|
38
|
+
getCommentThread,
|
|
39
|
+
editText,
|
|
40
|
+
deleteThing,
|
|
31
41
|
vote,
|
|
32
42
|
save,
|
|
43
|
+
hide,
|
|
44
|
+
report,
|
|
45
|
+
listUserContent,
|
|
33
46
|
getSubreddit,
|
|
34
47
|
searchSubreddits,
|
|
35
48
|
listSubscriptions,
|
|
49
|
+
listPopularSubreddits,
|
|
36
50
|
subscribe,
|
|
37
51
|
getUser,
|
|
38
52
|
sendMessage,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO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QACJ,MAAM;QACN,eAAe;QACf,YAAY;QACZ,gBAAgB;QAChB,iBAAiB;QACjB,qBAAqB;QACrB,SAAS;QACT,OAAO;QACP,WAAW;QACX,SAAS;KACV,CAAC;IAEF;;;;;OAKG;IACH,KAAK,CAAC,OAAO;QACX,IAAI,eAAe,EAAE;YAAE,OAAO,IAAI,CAAC;QACnC,OAAO,WAAW,EAAE,CAAC;IACvB,CAAC;CACF;AAED,eAAe,IAAI,YAAY,EAAE,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const deleteThing: import("@opentabs-dev/plugin-sdk").ToolDefinition<z.ZodObject<{
|
|
3
|
+
id: z.ZodString;
|
|
4
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
5
|
+
success: z.ZodBoolean;
|
|
6
|
+
}, z.core.$strip>>;
|
|
7
|
+
//# sourceMappingURL=delete-thing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete-thing.d.ts","sourceRoot":"","sources":["../../src/tools/delete-thing.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,WAAW;;;;kBAqBtB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { redditPost } from '../reddit-api.js';
|
|
2
|
+
import { defineTool } from '@opentabs-dev/plugin-sdk';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
export const deleteThing = defineTool({
|
|
5
|
+
name: 'delete',
|
|
6
|
+
displayName: 'Delete Post/Comment',
|
|
7
|
+
description: 'Permanently delete a post or comment. Only the author can delete their own content. This action cannot be undone.',
|
|
8
|
+
summary: 'Delete a post or comment',
|
|
9
|
+
icon: 'trash',
|
|
10
|
+
group: 'Actions',
|
|
11
|
+
input: z.object({
|
|
12
|
+
id: z
|
|
13
|
+
.string()
|
|
14
|
+
.min(1)
|
|
15
|
+
.describe('Fullname of the post or comment to delete (e.g., "t3_abc123" for a post, "t1_xyz" for a comment)'),
|
|
16
|
+
}),
|
|
17
|
+
output: z.object({
|
|
18
|
+
success: z.boolean().describe('Whether the deletion was successful'),
|
|
19
|
+
}),
|
|
20
|
+
handle: async (params) => {
|
|
21
|
+
await redditPost('/api/del', { id: params.id });
|
|
22
|
+
return { success: true };
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
//# sourceMappingURL=delete-thing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete-thing.js","sourceRoot":"","sources":["../../src/tools/delete-thing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,WAAW,GAAG,UAAU,CAAC;IACpC,IAAI,EAAE,QAAQ;IACd,WAAW,EAAE,qBAAqB;IAClC,WAAW,EACT,mHAAmH;IACrH,OAAO,EAAE,0BAA0B;IACnC,IAAI,EAAE,OAAO;IACb,KAAK,EAAE,SAAS;IAChB,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,EAAE,EAAE,CAAC;aACF,MAAM,EAAE;aACR,GAAG,CAAC,CAAC,CAAC;aACN,QAAQ,CAAC,kGAAkG,CAAC;KAChH,CAAC;IACF,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,CAAC,qCAAqC,CAAC;KACrE,CAAC;IACF,MAAM,EAAE,KAAK,EAAC,MAAM,EAAC,EAAE;QACrB,MAAM,UAAU,CAAwB,UAAU,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC;QACvE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC3B,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const editText: import("@opentabs-dev/plugin-sdk").ToolDefinition<z.ZodObject<{
|
|
3
|
+
thing_id: z.ZodString;
|
|
4
|
+
text: z.ZodString;
|
|
5
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
6
|
+
success: z.ZodBoolean;
|
|
7
|
+
body: z.ZodString;
|
|
8
|
+
}, z.core.$strip>>;
|
|
9
|
+
//# sourceMappingURL=edit-text.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edit-text.d.ts","sourceRoot":"","sources":["../../src/tools/edit-text.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAcxB,eAAO,MAAM,QAAQ;;;;;;kBAoCnB,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { redditPost } from '../reddit-api.js';
|
|
2
|
+
import { ToolError, defineTool } from '@opentabs-dev/plugin-sdk';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
export const editText = defineTool({
|
|
5
|
+
name: 'edit_text',
|
|
6
|
+
displayName: 'Edit Post/Comment',
|
|
7
|
+
description: 'Edit the body text of a self-post or comment. Only the author can edit their own content. Link posts cannot be edited.',
|
|
8
|
+
summary: 'Edit a post or comment',
|
|
9
|
+
icon: 'edit',
|
|
10
|
+
group: 'Actions',
|
|
11
|
+
input: z.object({
|
|
12
|
+
thing_id: z
|
|
13
|
+
.string()
|
|
14
|
+
.min(1)
|
|
15
|
+
.describe('Fullname of the post or comment to edit (e.g., "t3_abc123" for a post, "t1_xyz" for a comment)'),
|
|
16
|
+
text: z.string().min(1).describe('New body text (supports Reddit markdown)'),
|
|
17
|
+
}),
|
|
18
|
+
output: z.object({
|
|
19
|
+
success: z.boolean().describe('Whether the edit was applied'),
|
|
20
|
+
body: z.string().describe('Updated body text as returned by Reddit'),
|
|
21
|
+
}),
|
|
22
|
+
handle: async (params) => {
|
|
23
|
+
const data = await redditPost('/api/editusertext', {
|
|
24
|
+
thing_id: params.thing_id,
|
|
25
|
+
text: params.text,
|
|
26
|
+
});
|
|
27
|
+
if (data.json.errors.length > 0) {
|
|
28
|
+
const errorMsg = data.json.errors.map(e => e[1]).join('; ');
|
|
29
|
+
throw ToolError.validation(`Reddit API error: ${errorMsg}`);
|
|
30
|
+
}
|
|
31
|
+
const thing = data.json.data?.things[0]?.data;
|
|
32
|
+
return {
|
|
33
|
+
success: true,
|
|
34
|
+
body: thing?.contentText ?? params.text,
|
|
35
|
+
};
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
//# sourceMappingURL=edit-text.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edit-text.js","sourceRoot":"","sources":["../../src/tools/edit-text.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAcxB,MAAM,CAAC,MAAM,QAAQ,GAAG,UAAU,CAAC;IACjC,IAAI,EAAE,WAAW;IACjB,WAAW,EAAE,mBAAmB;IAChC,WAAW,EACT,wHAAwH;IAC1H,OAAO,EAAE,wBAAwB;IACjC,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,SAAS;IAChB,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,QAAQ,EAAE,CAAC;aACR,MAAM,EAAE;aACR,GAAG,CAAC,CAAC,CAAC;aACN,QAAQ,CAAC,gGAAgG,CAAC;QAC7G,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,0CAA0C,CAAC;KAC7E,CAAC;IACF,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,CAAC,8BAA8B,CAAC;QAC7D,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,yCAAyC,CAAC;KACrE,CAAC;IACF,MAAM,EAAE,KAAK,EAAC,MAAM,EAAC,EAAE;QACrB,MAAM,IAAI,GAAG,MAAM,UAAU,CAAe,mBAAmB,EAAE;YAC/D,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,IAAI,EAAE,MAAM,CAAC,IAAI;SAClB,CAAC,CAAC;QAEH,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAChC,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC5D,MAAM,SAAS,CAAC,UAAU,CAAC,qBAAqB,QAAQ,EAAE,CAAC,CAAC;QAC9D,CAAC;QAED,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC;QAC9C,OAAO;YACL,OAAO,EAAE,IAAI;YACb,IAAI,EAAE,KAAK,EAAE,WAAW,IAAI,MAAM,CAAC,IAAI;SACxC,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const getCommentThread: import("@opentabs-dev/plugin-sdk").ToolDefinition<z.ZodObject<{
|
|
3
|
+
subreddit: z.ZodString;
|
|
4
|
+
post_id: z.ZodString;
|
|
5
|
+
comment_id: z.ZodString;
|
|
6
|
+
depth: z.ZodOptional<z.ZodNumber>;
|
|
7
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
8
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
9
|
+
comment: z.ZodObject<{
|
|
10
|
+
id: z.ZodString;
|
|
11
|
+
name: z.ZodString;
|
|
12
|
+
author: z.ZodString;
|
|
13
|
+
body: z.ZodString;
|
|
14
|
+
score: z.ZodNumber;
|
|
15
|
+
created_utc: z.ZodNumber;
|
|
16
|
+
parent_id: z.ZodString;
|
|
17
|
+
depth: z.ZodNumber;
|
|
18
|
+
is_submitter: z.ZodBoolean;
|
|
19
|
+
}, z.core.$strip>;
|
|
20
|
+
replies: z.ZodArray<z.ZodObject<{
|
|
21
|
+
id: z.ZodString;
|
|
22
|
+
name: z.ZodString;
|
|
23
|
+
author: z.ZodString;
|
|
24
|
+
body: z.ZodString;
|
|
25
|
+
score: z.ZodNumber;
|
|
26
|
+
created_utc: z.ZodNumber;
|
|
27
|
+
parent_id: z.ZodString;
|
|
28
|
+
depth: z.ZodNumber;
|
|
29
|
+
is_submitter: z.ZodBoolean;
|
|
30
|
+
}, z.core.$strip>>;
|
|
31
|
+
}, z.core.$strip>>;
|
|
32
|
+
//# sourceMappingURL=get-comment-thread.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-comment-thread.d.ts","sourceRoot":"","sources":["../../src/tools/get-comment-thread.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAoDxB,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBA4E3B,CAAC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { redditGet } from '../reddit-api.js';
|
|
2
|
+
import { ToolError, defineTool } from '@opentabs-dev/plugin-sdk';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
const commentSchema = z.object({
|
|
5
|
+
id: z.string().describe('Comment ID'),
|
|
6
|
+
name: z.string().describe('Comment fullname (e.g., "t1_abc123")'),
|
|
7
|
+
author: z.string().describe('Comment author username'),
|
|
8
|
+
body: z.string().describe('Comment body text (markdown)'),
|
|
9
|
+
score: z.number().describe('Comment score'),
|
|
10
|
+
created_utc: z.number().describe('Comment creation time as Unix timestamp'),
|
|
11
|
+
parent_id: z.string().describe('Parent thing fullname (t3_ for post, t1_ for parent comment)'),
|
|
12
|
+
depth: z.number().describe('Nesting depth (0 = top-level reply)'),
|
|
13
|
+
is_submitter: z.boolean().describe('Whether the commenter is the post author (OP)'),
|
|
14
|
+
});
|
|
15
|
+
const flattenComments = (children, maxDepth) => {
|
|
16
|
+
const result = [];
|
|
17
|
+
for (const child of children) {
|
|
18
|
+
if (child.kind !== 't1')
|
|
19
|
+
continue;
|
|
20
|
+
result.push(child.data);
|
|
21
|
+
if (child.data.replies && typeof child.data.replies === 'object' && child.data.depth < maxDepth) {
|
|
22
|
+
result.push(...flattenComments(child.data.replies.data.children, maxDepth));
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return result;
|
|
26
|
+
};
|
|
27
|
+
export const getCommentThread = defineTool({
|
|
28
|
+
name: 'get_comment_thread',
|
|
29
|
+
displayName: 'Get Comment Thread',
|
|
30
|
+
description: 'Get a specific comment and its nested replies. Focuses the comment tree on a particular comment, returning its full reply chain regardless of nesting depth. Use this to read deeply nested conversations that get_post may truncate.',
|
|
31
|
+
summary: 'Get a comment and its replies',
|
|
32
|
+
icon: 'message-square',
|
|
33
|
+
group: 'Comments',
|
|
34
|
+
input: z.object({
|
|
35
|
+
subreddit: z.string().min(1).describe('Subreddit name without r/ prefix'),
|
|
36
|
+
post_id: z.string().min(1).describe('Post ID without t3_ prefix (e.g., "1ki00n1")'),
|
|
37
|
+
comment_id: z.string().min(1).describe('Comment ID without t1_ prefix (e.g., "o9z5cx1") — the comment to focus on'),
|
|
38
|
+
depth: z
|
|
39
|
+
.number()
|
|
40
|
+
.int()
|
|
41
|
+
.min(0)
|
|
42
|
+
.max(10)
|
|
43
|
+
.optional()
|
|
44
|
+
.describe('Max reply nesting depth below the target comment (default 8)'),
|
|
45
|
+
limit: z.number().int().min(0).max(500).optional().describe('Max number of child comments to return (default 100)'),
|
|
46
|
+
}),
|
|
47
|
+
output: z.object({
|
|
48
|
+
comment: commentSchema.describe('The target comment'),
|
|
49
|
+
replies: z.array(commentSchema).describe('Flattened array of nested replies with depth info'),
|
|
50
|
+
}),
|
|
51
|
+
handle: async (params) => {
|
|
52
|
+
const queryParams = {
|
|
53
|
+
comment: params.comment_id,
|
|
54
|
+
depth: String((params.depth ?? 8) + 1),
|
|
55
|
+
limit: String(params.limit ?? 100),
|
|
56
|
+
};
|
|
57
|
+
const data = await redditGet(`/r/${params.subreddit}/comments/${params.post_id}.json`, queryParams);
|
|
58
|
+
const commentChildren = data[1]?.data.children ?? [];
|
|
59
|
+
const targetChild = commentChildren.find(c => c.kind === 't1' && c.data.id === params.comment_id);
|
|
60
|
+
if (!targetChild || targetChild.kind !== 't1') {
|
|
61
|
+
throw ToolError.notFound(`Comment ${params.comment_id} not found in post ${params.post_id}`);
|
|
62
|
+
}
|
|
63
|
+
const target = targetChild.data;
|
|
64
|
+
const maxDepth = target.depth + (params.depth ?? 8);
|
|
65
|
+
const replies = target.replies && typeof target.replies === 'object'
|
|
66
|
+
? flattenComments(target.replies.data.children, maxDepth)
|
|
67
|
+
: [];
|
|
68
|
+
return {
|
|
69
|
+
comment: {
|
|
70
|
+
id: target.id,
|
|
71
|
+
name: target.name,
|
|
72
|
+
author: target.author,
|
|
73
|
+
body: target.body,
|
|
74
|
+
score: target.score,
|
|
75
|
+
created_utc: target.created_utc,
|
|
76
|
+
parent_id: target.parent_id,
|
|
77
|
+
depth: target.depth,
|
|
78
|
+
is_submitter: target.is_submitter,
|
|
79
|
+
},
|
|
80
|
+
replies: replies.map(c => ({
|
|
81
|
+
id: c.id,
|
|
82
|
+
name: c.name,
|
|
83
|
+
author: c.author,
|
|
84
|
+
body: c.body,
|
|
85
|
+
score: c.score,
|
|
86
|
+
created_utc: c.created_utc,
|
|
87
|
+
parent_id: c.parent_id,
|
|
88
|
+
depth: c.depth,
|
|
89
|
+
is_submitter: c.is_submitter,
|
|
90
|
+
})),
|
|
91
|
+
};
|
|
92
|
+
},
|
|
93
|
+
});
|
|
94
|
+
//# sourceMappingURL=get-comment-thread.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-comment-thread.js","sourceRoot":"","sources":["../../src/tools/get-comment-thread.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAyBxB,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7B,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,YAAY,CAAC;IACrC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,sCAAsC,CAAC;IACjE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,yBAAyB,CAAC;IACtD,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,8BAA8B,CAAC;IACzD,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,eAAe,CAAC;IAC3C,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,yCAAyC,CAAC;IAC3E,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,8DAA8D,CAAC;IAC9F,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,qCAAqC,CAAC;IACjE,YAAY,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,CAAC,+CAA+C,CAAC;CACpF,CAAC,CAAC;AAEH,MAAM,eAAe,GAAG,CACtB,QAAsD,EACtD,QAAgB,EACM,EAAE;IACxB,MAAM,MAAM,GAAyB,EAAE,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
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const hide: import("@opentabs-dev/plugin-sdk").ToolDefinition<z.ZodObject<{
|
|
3
|
+
id: z.ZodString;
|
|
4
|
+
unhide: z.ZodOptional<z.ZodBoolean>;
|
|
5
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
6
|
+
success: z.ZodBoolean;
|
|
7
|
+
}, z.core.$strip>>;
|
|
8
|
+
//# sourceMappingURL=hide.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hide.d.ts","sourceRoot":"","sources":["../../src/tools/hide.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,IAAI;;;;;kBAoBf,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { redditPost } from '../reddit-api.js';
|
|
2
|
+
import { defineTool } from '@opentabs-dev/plugin-sdk';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
export const hide = defineTool({
|
|
5
|
+
name: 'hide',
|
|
6
|
+
displayName: 'Hide/Unhide Post',
|
|
7
|
+
description: 'Hide or unhide a post from your feed. Hidden posts no longer appear in listings but can be viewed directly.',
|
|
8
|
+
summary: 'Hide or unhide a post',
|
|
9
|
+
icon: 'eye-off',
|
|
10
|
+
group: 'Actions',
|
|
11
|
+
input: z.object({
|
|
12
|
+
id: z.string().min(1).describe('Fullname of the post to hide (e.g., "t3_abc123")'),
|
|
13
|
+
unhide: z.boolean().optional().describe('Set to true to unhide instead of hide (default: false)'),
|
|
14
|
+
}),
|
|
15
|
+
output: z.object({
|
|
16
|
+
success: z.boolean().describe('Whether the action was successful'),
|
|
17
|
+
}),
|
|
18
|
+
handle: async (params) => {
|
|
19
|
+
const endpoint = params.unhide ? '/api/unhide' : '/api/hide';
|
|
20
|
+
await redditPost(endpoint, { id: params.id });
|
|
21
|
+
return { success: true };
|
|
22
|
+
},
|
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
+
import { z } from 'zod';
|
|
2
|
+
export declare const listPopularSubreddits: import("@opentabs-dev/plugin-sdk").ToolDefinition<z.ZodObject<{
|
|
3
|
+
category: z.ZodOptional<z.ZodEnum<{
|
|
4
|
+
default: "default";
|
|
5
|
+
new: "new";
|
|
6
|
+
popular: "popular";
|
|
7
|
+
}>>;
|
|
8
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
9
|
+
after: z.ZodOptional<z.ZodString>;
|
|
10
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
11
|
+
subreddits: z.ZodArray<z.ZodObject<{
|
|
12
|
+
display_name: z.ZodString;
|
|
13
|
+
title: z.ZodString;
|
|
14
|
+
subscribers: z.ZodNumber;
|
|
15
|
+
active_user_count: z.ZodNumber;
|
|
16
|
+
url: z.ZodString;
|
|
17
|
+
public_description: z.ZodString;
|
|
18
|
+
over18: z.ZodBoolean;
|
|
19
|
+
}, z.core.$strip>>;
|
|
20
|
+
after: z.ZodNullable<z.ZodString>;
|
|
21
|
+
}, z.core.$strip>>;
|
|
22
|
+
//# sourceMappingURL=list-popular-subreddits.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-popular-subreddits.d.ts","sourceRoot":"","sources":["../../src/tools/list-popular-subreddits.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAaxB,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;kBAsDhC,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { redditGet } from '../reddit-api.js';
|
|
2
|
+
import { defineTool } from '@opentabs-dev/plugin-sdk';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
export const listPopularSubreddits = defineTool({
|
|
5
|
+
name: 'list_popular_subreddits',
|
|
6
|
+
displayName: 'List Popular Subreddits',
|
|
7
|
+
description: 'List popular, new, or default subreddits. Use category "popular" for most popular, "new" for newest, or "default" for default subreddits.',
|
|
8
|
+
summary: 'List popular subreddits',
|
|
9
|
+
icon: 'trending-up',
|
|
10
|
+
group: 'Subreddits',
|
|
11
|
+
input: z.object({
|
|
12
|
+
category: z
|
|
13
|
+
.enum(['popular', 'new', 'default'])
|
|
14
|
+
.optional()
|
|
15
|
+
.describe('Subreddit category to list (default "popular")'),
|
|
16
|
+
limit: z.number().int().min(1).max(100).optional().describe('Number of results (default 25, max 100)'),
|
|
17
|
+
after: z.string().optional().describe('Pagination cursor for the next page'),
|
|
18
|
+
}),
|
|
19
|
+
output: z.object({
|
|
20
|
+
subreddits: z
|
|
21
|
+
.array(z.object({
|
|
22
|
+
display_name: z.string().describe('Subreddit name'),
|
|
23
|
+
title: z.string().describe('Subreddit title'),
|
|
24
|
+
subscribers: z.number().describe('Subscriber count'),
|
|
25
|
+
active_user_count: z.number().describe('Active users online'),
|
|
26
|
+
url: z.string().describe('Subreddit URL path'),
|
|
27
|
+
public_description: z.string().describe('Short description'),
|
|
28
|
+
over18: z.boolean().describe('NSFW flag'),
|
|
29
|
+
}))
|
|
30
|
+
.describe('Subreddits'),
|
|
31
|
+
after: z.string().nullable().describe('Pagination cursor for next page'),
|
|
32
|
+
}),
|
|
33
|
+
handle: async (params) => {
|
|
34
|
+
const category = params.category ?? 'popular';
|
|
35
|
+
const queryParams = {
|
|
36
|
+
limit: String(params.limit ?? 25),
|
|
37
|
+
};
|
|
38
|
+
if (params.after)
|
|
39
|
+
queryParams.after = params.after;
|
|
40
|
+
const data = await redditGet(`/subreddits/${category}.json`, queryParams);
|
|
41
|
+
return {
|
|
42
|
+
subreddits: data.data.children.map(child => ({
|
|
43
|
+
display_name: child.data.display_name,
|
|
44
|
+
title: child.data.title,
|
|
45
|
+
subscribers: child.data.subscribers,
|
|
46
|
+
active_user_count: child.data.active_user_count ?? 0,
|
|
47
|
+
url: child.data.url,
|
|
48
|
+
public_description: child.data.public_description ?? '',
|
|
49
|
+
over18: child.data.over18,
|
|
50
|
+
})),
|
|
51
|
+
after: data.data.after ?? null,
|
|
52
|
+
};
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
//# sourceMappingURL=list-popular-subreddits.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-popular-subreddits.js","sourceRoot":"","sources":["../../src/tools/list-popular-subreddits.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAaxB,MAAM,CAAC,MAAM,qBAAqB,GAAG,UAAU,CAAC;IAC9C,IAAI,EAAE,yBAAyB;IAC/B,WAAW,EAAE,yBAAyB;IACtC,WAAW,EACT,2IAA2I;IAC7I,OAAO,EAAE,yBAAyB;IAClC,IAAI,EAAE,aAAa;IACnB,KAAK,EAAE,YAAY;IACnB,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,QAAQ,EAAE,CAAC;aACR,IAAI,CAAC,CAAC,SAAS,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;aACnC,QAAQ,EAAE;aACV,QAAQ,CAAC,gDAAgD,CAAC;QAC7D,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,yCAAyC,CAAC;QACtG,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,qCAAqC,CAAC;KAC7E,CAAC;IACF,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,UAAU,EAAE,CAAC;aACV,KAAK,CACJ,CAAC,CAAC,MAAM,CAAC;YACP,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,gBAAgB,CAAC;YACnD,KAAK,EAAE,CAAC,C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AAW;gBACnC,iBAAiB,EAAE,KAAK,CAAC,IAAI,CAAC,iBAAiB,IAAI,CAAC;gBACpD,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,GAAG;gBACnB,kBAAkB,EAAE,KAAK,CAAC,IAAI,CAAC,kBAAkB,IAAI,EAAE;gBACvD,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,MAAM;aAC1B,CAAC,CAAC;YACH,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI;SAC/B,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const listUserContent: import("@opentabs-dev/plugin-sdk").ToolDefinition<z.ZodObject<{
|
|
3
|
+
username: z.ZodString;
|
|
4
|
+
where: z.ZodEnum<{
|
|
5
|
+
comments: "comments";
|
|
6
|
+
overview: "overview";
|
|
7
|
+
submitted: "submitted";
|
|
8
|
+
saved: "saved";
|
|
9
|
+
upvoted: "upvoted";
|
|
10
|
+
downvoted: "downvoted";
|
|
11
|
+
hidden: "hidden";
|
|
12
|
+
gilded: "gilded";
|
|
13
|
+
}>;
|
|
14
|
+
sort: z.ZodOptional<z.ZodEnum<{
|
|
15
|
+
top: "top";
|
|
16
|
+
new: "new";
|
|
17
|
+
controversial: "controversial";
|
|
18
|
+
hot: "hot";
|
|
19
|
+
}>>;
|
|
20
|
+
t: z.ZodOptional<z.ZodEnum<{
|
|
21
|
+
hour: "hour";
|
|
22
|
+
day: "day";
|
|
23
|
+
week: "week";
|
|
24
|
+
month: "month";
|
|
25
|
+
year: "year";
|
|
26
|
+
all: "all";
|
|
27
|
+
}>>;
|
|
28
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
29
|
+
after: z.ZodOptional<z.ZodString>;
|
|
30
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
31
|
+
items: z.ZodArray<z.ZodObject<{
|
|
32
|
+
kind: z.ZodString;
|
|
33
|
+
id: z.ZodString;
|
|
34
|
+
name: z.ZodString;
|
|
35
|
+
author: z.ZodString;
|
|
36
|
+
subreddit: z.ZodString;
|
|
37
|
+
score: z.ZodNumber;
|
|
38
|
+
created_utc: z.ZodNumber;
|
|
39
|
+
permalink: z.ZodString;
|
|
40
|
+
title: z.ZodNullable<z.ZodString>;
|
|
41
|
+
selftext: z.ZodNullable<z.ZodString>;
|
|
42
|
+
body: z.ZodNullable<z.ZodString>;
|
|
43
|
+
link_title: z.ZodNullable<z.ZodString>;
|
|
44
|
+
link_id: z.ZodNullable<z.ZodString>;
|
|
45
|
+
parent_id: z.ZodNullable<z.ZodString>;
|
|
46
|
+
num_comments: z.ZodNullable<z.ZodNumber>;
|
|
47
|
+
}, z.core.$strip>>;
|
|
48
|
+
after: z.ZodNullable<z.ZodString>;
|
|
49
|
+
}, z.core.$strip>>;
|
|
50
|
+
//# sourceMappingURL=list-user-content.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-user-content.d.ts","sourceRoot":"","sources":["../../src/tools/list-user-content.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAyCxB,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBA2D1B,CAAC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { redditGet } from '../reddit-api.js';
|
|
2
|
+
import { defineTool } from '@opentabs-dev/plugin-sdk';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
const contentItemSchema = z.object({
|
|
5
|
+
kind: z.string().describe('"t3" for post, "t1" for comment'),
|
|
6
|
+
id: z.string().describe('Item ID'),
|
|
7
|
+
name: z.string().describe('Item fullname'),
|
|
8
|
+
author: z.string().describe('Author username'),
|
|
9
|
+
subreddit: z.string().describe('Subreddit name'),
|
|
10
|
+
score: z.number().describe('Score'),
|
|
11
|
+
created_utc: z.number().describe('Creation timestamp'),
|
|
12
|
+
permalink: z.string().describe('Reddit permalink'),
|
|
13
|
+
title: z.string().nullable().describe('Post title (null for comments)'),
|
|
14
|
+
selftext: z.string().nullable().describe('Post body (null for comments)'),
|
|
15
|
+
body: z.string().nullable().describe('Comment body (null for posts)'),
|
|
16
|
+
link_title: z.string().nullable().describe('Parent post title (for comments)'),
|
|
17
|
+
link_id: z.string().nullable().describe('Parent post fullname, e.g. t3_abc123 (for comments)'),
|
|
18
|
+
parent_id: z.string().nullable().describe('Parent comment/post fullname (for comments)'),
|
|
19
|
+
num_comments: z.number().nullable().describe('Comment count (for posts)'),
|
|
20
|
+
});
|
|
21
|
+
export const listUserContent = defineTool({
|
|
22
|
+
name: 'list_user_content',
|
|
23
|
+
displayName: 'List User Content',
|
|
24
|
+
description: 'Browse a user\'s posts, comments, or saved items. Use "submitted" for posts, "comments" for comments, "saved" for saved items (own profile only), "upvoted"/"downvoted" for voted items (own profile only), or "overview" for both posts and comments.',
|
|
25
|
+
summary: "List a user's posts, comments, or saved items",
|
|
26
|
+
icon: 'list',
|
|
27
|
+
group: 'User',
|
|
28
|
+
input: z.object({
|
|
29
|
+
username: z.string().min(1).describe('Reddit username (without u/ prefix)'),
|
|
30
|
+
where: z
|
|
31
|
+
.enum(['overview', 'submitted', 'comments', 'saved', 'upvoted', 'downvoted', 'hidden', 'gilded'])
|
|
32
|
+
.describe('Content type to list'),
|
|
33
|
+
sort: z.enum(['hot', 'new', 'top', 'controversial']).optional().describe('Sort order (default "new")'),
|
|
34
|
+
t: z
|
|
35
|
+
.enum(['hour', 'day', 'week', 'month', 'year', 'all'])
|
|
36
|
+
.optional()
|
|
37
|
+
.describe('Time period for "top" and "controversial" sort'),
|
|
38
|
+
limit: z.number().int().min(1).max(100).optional().describe('Number of results (default 25, max 100)'),
|
|
39
|
+
after: z.string().optional().describe('Pagination cursor for the next page'),
|
|
40
|
+
}),
|
|
41
|
+
output: z.object({
|
|
42
|
+
items: z.array(contentItemSchema).describe('User content items'),
|
|
43
|
+
after: z.string().nullable().describe('Pagination cursor for next page'),
|
|
44
|
+
}),
|
|
45
|
+
handle: async (params) => {
|
|
46
|
+
const queryParams = {
|
|
47
|
+
limit: String(params.limit ?? 25),
|
|
48
|
+
};
|
|
49
|
+
if (params.sort)
|
|
50
|
+
queryParams.sort = params.sort;
|
|
51
|
+
if (params.t)
|
|
52
|
+
queryParams.t = params.t;
|
|
53
|
+
if (params.after)
|
|
54
|
+
queryParams.after = params.after;
|
|
55
|
+
const data = await redditGet(`/user/${params.username}/${params.where}.json`, queryParams);
|
|
56
|
+
return {
|
|
57
|
+
items: data.data.children.map(child => ({
|
|
58
|
+
kind: child.kind,
|
|
59
|
+
id: child.data.id,
|
|
60
|
+
name: child.data.name,
|
|
61
|
+
author: child.data.author ?? '',
|
|
62
|
+
subreddit: child.data.subreddit ?? '',
|
|
63
|
+
score: child.data.score ?? 0,
|
|
64
|
+
created_utc: child.data.created_utc,
|
|
65
|
+
permalink: child.data.permalink,
|
|
66
|
+
title: child.data.title ?? null,
|
|
67
|
+
selftext: child.data.selftext ?? null,
|
|
68
|
+
body: child.data.body ?? null,
|
|
69
|
+
link_title: child.data.link_title ?? null,
|
|
70
|
+
link_id: child.data.link_id ?? null,
|
|
71
|
+
parent_id: child.data.parent_id ?? null,
|
|
72
|
+
num_comments: child.data.num_comments ?? null,
|
|
73
|
+
})),
|
|
74
|
+
after: data.data.after ?? null,
|
|
75
|
+
};
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
//# sourceMappingURL=list-user-content.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-user-content.js","sourceRoot":"","sources":["../../src/tools/list-user-content.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAuBxB,MAAM,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AAK,CAAC,IAAI,CAAC,WAAW;gBACnC,SAAS,EAAE,KAAK,CAAC,IAAI,CAAC,SAAS;gBAC/B,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI;gBAC/B,QAAQ,EAAE,KAAK,CAAC,IAAI,CAAC,QAAQ,IAAI,IAAI;gBACrC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI;gBAC7B,UAAU,EAAE,KAAK,CAAC,IAAI,CAAC,UAAU,IAAI,IAAI;gBACzC,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,OAAO,IAAI,IAAI;gBACnC,SAAS,EAAE,KAAK,CAAC,IAAI,CAAC,SAAS,IAAI,IAAI;gBACvC,YAAY,EAAE,KAAK,CAAC,IAAI,CAAC,YAAY,IAAI,IAAI;aAC9C,CAAC,CAAC;YACH,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI;SAC/B,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const report: import("@opentabs-dev/plugin-sdk").ToolDefinition<z.ZodObject<{
|
|
3
|
+
thing_id: z.ZodString;
|
|
4
|
+
reason: z.ZodString;
|
|
5
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
6
|
+
success: z.ZodBoolean;
|
|
7
|
+
}, z.core.$strip>>;
|
|
8
|
+
//# sourceMappingURL=report.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../../src/tools/report.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,MAAM;;;;;kBAqBjB,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { redditPost } from '../reddit-api.js';
|
|
2
|
+
import { defineTool } from '@opentabs-dev/plugin-sdk';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
export const report = defineTool({
|
|
5
|
+
name: 'report',
|
|
6
|
+
displayName: 'Report',
|
|
7
|
+
description: 'Report a post or comment to the subreddit moderators for rule violations.',
|
|
8
|
+
summary: 'Report a post or comment',
|
|
9
|
+
icon: 'flag',
|
|
10
|
+
group: 'Actions',
|
|
11
|
+
input: z.object({
|
|
12
|
+
thing_id: z.string().min(1).describe('Fullname of the post or comment to report (e.g., "t3_abc123" or "t1_xyz")'),
|
|
13
|
+
reason: z.string().min(1).describe('Reason for the report'),
|
|
14
|
+
}),
|
|
15
|
+
output: z.object({
|
|
16
|
+
success: z.boolean().describe('Whether the report was submitted'),
|
|
17
|
+
}),
|
|
18
|
+
handle: async (params) => {
|
|
19
|
+
await redditPost('/api/report', {
|
|
20
|
+
thing_id: params.thing_id,
|
|
21
|
+
reason: params.reason,
|
|
22
|
+
});
|
|
23
|
+
return { success: true };
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
//# sourceMappingURL=report.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"report.js","sourceRoot":"","sources":["../../src/tools/report.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,MAAM,GAAG,UAAU,CAAC;IAC/B,IAAI,EAAE,QAAQ;IACd,WAAW,EAAE,QAAQ;IACrB,WAAW,EAAE,2EAA2E;IACxF,OAAO,EAAE,0BAA0B;IACnC,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,SAAS;IAChB,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,2EAA2E,CAAC;QACjH,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,uBAAuB,CAAC;KAC5D,CAAC;IACF,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,CAAC,kCAAkC,CAAC;KAClE,CAAC;IACF,MAAM,EAAE,KAAK,EAAC,MAAM,EAAC,EAAE;QACrB,MAAM,UAAU,CAAwB,aAAa,EAAE;YACrD,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,MAAM,EAAE,MAAM,CAAC,MAAM;SACtB,CAAC,CAAC;QACH,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC3B,CAAC;CACF,CAAC,CAAC"}
|