@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/README.md
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Reddit
|
|
2
|
+
|
|
3
|
+
OpenTabs plugin for Reddit — gives AI agents access to Reddit through your authenticated browser session.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
opentabs plugin install reddit
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Or install globally via npm:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install -g @opentabs-dev/opentabs-plugin-reddit
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Setup
|
|
18
|
+
|
|
19
|
+
1. Open [www.reddit.com](https://www.reddit.com) in Chrome and log in
|
|
20
|
+
2. Open the OpenTabs side panel — the Reddit plugin should appear as **ready**
|
|
21
|
+
|
|
22
|
+
## Tools (15)
|
|
23
|
+
|
|
24
|
+
### User (2)
|
|
25
|
+
|
|
26
|
+
| Tool | Description | Type |
|
|
27
|
+
|---|---|---|
|
|
28
|
+
| `get_me` | Get the current user profile | Read |
|
|
29
|
+
| `get_user` | Get a user profile | Read |
|
|
30
|
+
|
|
31
|
+
### Posts (4)
|
|
32
|
+
|
|
33
|
+
| Tool | Description | Type |
|
|
34
|
+
|---|---|---|
|
|
35
|
+
| `list_posts` | List posts from a subreddit | Read |
|
|
36
|
+
| `get_post` | Get a post and its comments | Read |
|
|
37
|
+
| `search_posts` | Search Reddit posts | Read |
|
|
38
|
+
| `submit_post` | Submit a new post | Write |
|
|
39
|
+
|
|
40
|
+
### Comments (1)
|
|
41
|
+
|
|
42
|
+
| Tool | Description | Type |
|
|
43
|
+
|---|---|---|
|
|
44
|
+
| `submit_comment` | Post a comment or reply | Write |
|
|
45
|
+
|
|
46
|
+
### Actions (2)
|
|
47
|
+
|
|
48
|
+
| Tool | Description | Type |
|
|
49
|
+
|---|---|---|
|
|
50
|
+
| `vote` | Vote on a post or comment | Write |
|
|
51
|
+
| `save` | Save or unsave a post/comment | Write |
|
|
52
|
+
|
|
53
|
+
### Subreddits (4)
|
|
54
|
+
|
|
55
|
+
| Tool | Description | Type |
|
|
56
|
+
|---|---|---|
|
|
57
|
+
| `get_subreddit` | Get subreddit details | Read |
|
|
58
|
+
| `search_subreddits` | Search subreddits | Read |
|
|
59
|
+
| `list_subscriptions` | List subscribed subreddits | Read |
|
|
60
|
+
| `subscribe` | Subscribe or unsubscribe from a subreddit | Write |
|
|
61
|
+
|
|
62
|
+
### Messages (2)
|
|
63
|
+
|
|
64
|
+
| Tool | Description | Type |
|
|
65
|
+
|---|---|---|
|
|
66
|
+
| `send_message` | Send a private message | Write |
|
|
67
|
+
| `read_inbox` | Read inbox messages | Read |
|
|
68
|
+
|
|
69
|
+
## How It Works
|
|
70
|
+
|
|
71
|
+
This plugin runs inside your Reddit tab through the [OpenTabs](https://opentabs.dev) Chrome extension. It uses your existing browser session — no API tokens or OAuth apps required. All operations happen as you, with your permissions.
|
|
72
|
+
|
|
73
|
+
## License
|
|
74
|
+
|
|
75
|
+
MIT
|
package/dist/adapter.iife.js
CHANGED
|
@@ -265,6 +265,8 @@
|
|
|
265
265
|
* (e.g., 'https://github.com'), not a match pattern.
|
|
266
266
|
*/
|
|
267
267
|
homepage;
|
|
268
|
+
/** Typed configuration schema — declares settings that users provide via config.json or the side panel. */
|
|
269
|
+
configSchema;
|
|
268
270
|
};
|
|
269
271
|
|
|
270
272
|
// src/reddit-api.ts
|
|
@@ -14229,6 +14231,145 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
14229
14231
|
// node_modules/zod/v4/classic/external.js
|
|
14230
14232
|
config(en_default());
|
|
14231
14233
|
|
|
14234
|
+
// src/tools/delete-thing.ts
|
|
14235
|
+
var deleteThing = defineTool({
|
|
14236
|
+
name: "delete",
|
|
14237
|
+
displayName: "Delete Post/Comment",
|
|
14238
|
+
description: "Permanently delete a post or comment. Only the author can delete their own content. This action cannot be undone.",
|
|
14239
|
+
summary: "Delete a post or comment",
|
|
14240
|
+
icon: "trash",
|
|
14241
|
+
group: "Actions",
|
|
14242
|
+
input: external_exports.object({
|
|
14243
|
+
id: external_exports.string().min(1).describe('Fullname of the post or comment to delete (e.g., "t3_abc123" for a post, "t1_xyz" for a comment)')
|
|
14244
|
+
}),
|
|
14245
|
+
output: external_exports.object({
|
|
14246
|
+
success: external_exports.boolean().describe("Whether the deletion was successful")
|
|
14247
|
+
}),
|
|
14248
|
+
handle: async (params) => {
|
|
14249
|
+
await redditPost("/api/del", { id: params.id });
|
|
14250
|
+
return { success: true };
|
|
14251
|
+
}
|
|
14252
|
+
});
|
|
14253
|
+
|
|
14254
|
+
// src/tools/edit-text.ts
|
|
14255
|
+
var editText = defineTool({
|
|
14256
|
+
name: "edit_text",
|
|
14257
|
+
displayName: "Edit Post/Comment",
|
|
14258
|
+
description: "Edit the body text of a self-post or comment. Only the author can edit their own content. Link posts cannot be edited.",
|
|
14259
|
+
summary: "Edit a post or comment",
|
|
14260
|
+
icon: "edit",
|
|
14261
|
+
group: "Actions",
|
|
14262
|
+
input: external_exports.object({
|
|
14263
|
+
thing_id: external_exports.string().min(1).describe('Fullname of the post or comment to edit (e.g., "t3_abc123" for a post, "t1_xyz" for a comment)'),
|
|
14264
|
+
text: external_exports.string().min(1).describe("New body text (supports Reddit markdown)")
|
|
14265
|
+
}),
|
|
14266
|
+
output: external_exports.object({
|
|
14267
|
+
success: external_exports.boolean().describe("Whether the edit was applied"),
|
|
14268
|
+
body: external_exports.string().describe("Updated body text as returned by Reddit")
|
|
14269
|
+
}),
|
|
14270
|
+
handle: async (params) => {
|
|
14271
|
+
const data = await redditPost("/api/editusertext", {
|
|
14272
|
+
thing_id: params.thing_id,
|
|
14273
|
+
text: params.text
|
|
14274
|
+
});
|
|
14275
|
+
if (data.json.errors.length > 0) {
|
|
14276
|
+
const errorMsg = data.json.errors.map((e) => e[1]).join("; ");
|
|
14277
|
+
throw ToolError.validation(`Reddit API error: ${errorMsg}`);
|
|
14278
|
+
}
|
|
14279
|
+
const thing = data.json.data?.things[0]?.data;
|
|
14280
|
+
return {
|
|
14281
|
+
success: true,
|
|
14282
|
+
body: thing?.contentText ?? params.text
|
|
14283
|
+
};
|
|
14284
|
+
}
|
|
14285
|
+
});
|
|
14286
|
+
|
|
14287
|
+
// src/tools/get-comment-thread.ts
|
|
14288
|
+
var commentSchema = external_exports.object({
|
|
14289
|
+
id: external_exports.string().describe("Comment ID"),
|
|
14290
|
+
name: external_exports.string().describe('Comment fullname (e.g., "t1_abc123")'),
|
|
14291
|
+
author: external_exports.string().describe("Comment author username"),
|
|
14292
|
+
body: external_exports.string().describe("Comment body text (markdown)"),
|
|
14293
|
+
score: external_exports.number().describe("Comment score"),
|
|
14294
|
+
created_utc: external_exports.number().describe("Comment creation time as Unix timestamp"),
|
|
14295
|
+
parent_id: external_exports.string().describe("Parent thing fullname (t3_ for post, t1_ for parent comment)"),
|
|
14296
|
+
depth: external_exports.number().describe("Nesting depth (0 = top-level reply)"),
|
|
14297
|
+
is_submitter: external_exports.boolean().describe("Whether the commenter is the post author (OP)")
|
|
14298
|
+
});
|
|
14299
|
+
var flattenComments = (children, maxDepth) => {
|
|
14300
|
+
const result = [];
|
|
14301
|
+
for (const child of children) {
|
|
14302
|
+
if (child.kind !== "t1") continue;
|
|
14303
|
+
result.push(child.data);
|
|
14304
|
+
if (child.data.replies && typeof child.data.replies === "object" && child.data.depth < maxDepth) {
|
|
14305
|
+
result.push(...flattenComments(child.data.replies.data.children, maxDepth));
|
|
14306
|
+
}
|
|
14307
|
+
}
|
|
14308
|
+
return result;
|
|
14309
|
+
};
|
|
14310
|
+
var getCommentThread = defineTool({
|
|
14311
|
+
name: "get_comment_thread",
|
|
14312
|
+
displayName: "Get Comment Thread",
|
|
14313
|
+
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.",
|
|
14314
|
+
summary: "Get a comment and its replies",
|
|
14315
|
+
icon: "message-square",
|
|
14316
|
+
group: "Comments",
|
|
14317
|
+
input: external_exports.object({
|
|
14318
|
+
subreddit: external_exports.string().min(1).describe("Subreddit name without r/ prefix"),
|
|
14319
|
+
post_id: external_exports.string().min(1).describe('Post ID without t3_ prefix (e.g., "1ki00n1")'),
|
|
14320
|
+
comment_id: external_exports.string().min(1).describe('Comment ID without t1_ prefix (e.g., "o9z5cx1") \u2014 the comment to focus on'),
|
|
14321
|
+
depth: external_exports.number().int().min(0).max(10).optional().describe("Max reply nesting depth below the target comment (default 8)"),
|
|
14322
|
+
limit: external_exports.number().int().min(0).max(500).optional().describe("Max number of child comments to return (default 100)")
|
|
14323
|
+
}),
|
|
14324
|
+
output: external_exports.object({
|
|
14325
|
+
comment: commentSchema.describe("The target comment"),
|
|
14326
|
+
replies: external_exports.array(commentSchema).describe("Flattened array of nested replies with depth info")
|
|
14327
|
+
}),
|
|
14328
|
+
handle: async (params) => {
|
|
14329
|
+
const queryParams = {
|
|
14330
|
+
comment: params.comment_id,
|
|
14331
|
+
depth: String((params.depth ?? 8) + 1),
|
|
14332
|
+
limit: String(params.limit ?? 100)
|
|
14333
|
+
};
|
|
14334
|
+
const data = await redditGet(
|
|
14335
|
+
`/r/${params.subreddit}/comments/${params.post_id}.json`,
|
|
14336
|
+
queryParams
|
|
14337
|
+
);
|
|
14338
|
+
const commentChildren = data[1]?.data.children ?? [];
|
|
14339
|
+
const targetChild = commentChildren.find((c) => c.kind === "t1" && c.data.id === params.comment_id);
|
|
14340
|
+
if (!targetChild || targetChild.kind !== "t1") {
|
|
14341
|
+
throw ToolError.notFound(`Comment ${params.comment_id} not found in post ${params.post_id}`);
|
|
14342
|
+
}
|
|
14343
|
+
const target = targetChild.data;
|
|
14344
|
+
const maxDepth = target.depth + (params.depth ?? 8);
|
|
14345
|
+
const replies = target.replies && typeof target.replies === "object" ? flattenComments(target.replies.data.children, maxDepth) : [];
|
|
14346
|
+
return {
|
|
14347
|
+
comment: {
|
|
14348
|
+
id: target.id,
|
|
14349
|
+
name: target.name,
|
|
14350
|
+
author: target.author,
|
|
14351
|
+
body: target.body,
|
|
14352
|
+
score: target.score,
|
|
14353
|
+
created_utc: target.created_utc,
|
|
14354
|
+
parent_id: target.parent_id,
|
|
14355
|
+
depth: target.depth,
|
|
14356
|
+
is_submitter: target.is_submitter
|
|
14357
|
+
},
|
|
14358
|
+
replies: replies.map((c) => ({
|
|
14359
|
+
id: c.id,
|
|
14360
|
+
name: c.name,
|
|
14361
|
+
author: c.author,
|
|
14362
|
+
body: c.body,
|
|
14363
|
+
score: c.score,
|
|
14364
|
+
created_utc: c.created_utc,
|
|
14365
|
+
parent_id: c.parent_id,
|
|
14366
|
+
depth: c.depth,
|
|
14367
|
+
is_submitter: c.is_submitter
|
|
14368
|
+
}))
|
|
14369
|
+
};
|
|
14370
|
+
}
|
|
14371
|
+
});
|
|
14372
|
+
|
|
14232
14373
|
// src/tools/get-me.ts
|
|
14233
14374
|
var getMe = defineTool({
|
|
14234
14375
|
name: "get_me",
|
|
@@ -14267,7 +14408,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
14267
14408
|
});
|
|
14268
14409
|
|
|
14269
14410
|
// src/tools/get-post.ts
|
|
14270
|
-
var
|
|
14411
|
+
var commentSchema2 = external_exports.object({
|
|
14271
14412
|
id: external_exports.string().describe("Comment ID"),
|
|
14272
14413
|
name: external_exports.string().describe('Comment fullname (e.g., "t1_abc123")'),
|
|
14273
14414
|
author: external_exports.string().describe("Comment author username"),
|
|
@@ -14278,13 +14419,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
14278
14419
|
depth: external_exports.number().describe("Nesting depth (0 = top-level reply)"),
|
|
14279
14420
|
is_submitter: external_exports.boolean().describe("Whether the commenter is the post author (OP)")
|
|
14280
14421
|
});
|
|
14281
|
-
var
|
|
14422
|
+
var flattenComments2 = (children, maxDepth) => {
|
|
14282
14423
|
const result = [];
|
|
14283
14424
|
for (const child of children) {
|
|
14284
14425
|
if (child.kind !== "t1") continue;
|
|
14285
14426
|
result.push(child.data);
|
|
14286
14427
|
if (child.data.replies && typeof child.data.replies === "object" && child.data.depth < maxDepth) {
|
|
14287
|
-
result.push(...
|
|
14428
|
+
result.push(...flattenComments2(child.data.replies.data.children, maxDepth));
|
|
14288
14429
|
}
|
|
14289
14430
|
}
|
|
14290
14431
|
return result;
|
|
@@ -14319,7 +14460,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
14319
14460
|
is_self: external_exports.boolean().describe("Whether this is a text post"),
|
|
14320
14461
|
created_utc: external_exports.number().describe("Creation timestamp")
|
|
14321
14462
|
}),
|
|
14322
|
-
comments: external_exports.array(
|
|
14463
|
+
comments: external_exports.array(commentSchema2).describe("Flattened array of comments with depth info")
|
|
14323
14464
|
}),
|
|
14324
14465
|
handle: async (params) => {
|
|
14325
14466
|
const queryParams = {
|
|
@@ -14337,7 +14478,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
14337
14478
|
if (!postData) {
|
|
14338
14479
|
throw ToolError.notFound("Post not found");
|
|
14339
14480
|
}
|
|
14340
|
-
const comments =
|
|
14481
|
+
const comments = flattenComments2(data[1]?.data.children ?? [], params.comment_depth ?? 3);
|
|
14341
14482
|
return {
|
|
14342
14483
|
post: {
|
|
14343
14484
|
id: postData.id,
|
|
@@ -14449,6 +14590,77 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
14449
14590
|
}
|
|
14450
14591
|
});
|
|
14451
14592
|
|
|
14593
|
+
// src/tools/hide.ts
|
|
14594
|
+
var hide = defineTool({
|
|
14595
|
+
name: "hide",
|
|
14596
|
+
displayName: "Hide/Unhide Post",
|
|
14597
|
+
description: "Hide or unhide a post from your feed. Hidden posts no longer appear in listings but can be viewed directly.",
|
|
14598
|
+
summary: "Hide or unhide a post",
|
|
14599
|
+
icon: "eye-off",
|
|
14600
|
+
group: "Actions",
|
|
14601
|
+
input: external_exports.object({
|
|
14602
|
+
id: external_exports.string().min(1).describe('Fullname of the post to hide (e.g., "t3_abc123")'),
|
|
14603
|
+
unhide: external_exports.boolean().optional().describe("Set to true to unhide instead of hide (default: false)")
|
|
14604
|
+
}),
|
|
14605
|
+
output: external_exports.object({
|
|
14606
|
+
success: external_exports.boolean().describe("Whether the action was successful")
|
|
14607
|
+
}),
|
|
14608
|
+
handle: async (params) => {
|
|
14609
|
+
const endpoint = params.unhide ? "/api/unhide" : "/api/hide";
|
|
14610
|
+
await redditPost(endpoint, { id: params.id });
|
|
14611
|
+
return { success: true };
|
|
14612
|
+
}
|
|
14613
|
+
});
|
|
14614
|
+
|
|
14615
|
+
// src/tools/list-popular-subreddits.ts
|
|
14616
|
+
var listPopularSubreddits = defineTool({
|
|
14617
|
+
name: "list_popular_subreddits",
|
|
14618
|
+
displayName: "List Popular Subreddits",
|
|
14619
|
+
description: 'List popular, new, or default subreddits. Use category "popular" for most popular, "new" for newest, or "default" for default subreddits.',
|
|
14620
|
+
summary: "List popular subreddits",
|
|
14621
|
+
icon: "trending-up",
|
|
14622
|
+
group: "Subreddits",
|
|
14623
|
+
input: external_exports.object({
|
|
14624
|
+
category: external_exports.enum(["popular", "new", "default"]).optional().describe('Subreddit category to list (default "popular")'),
|
|
14625
|
+
limit: external_exports.number().int().min(1).max(100).optional().describe("Number of results (default 25, max 100)"),
|
|
14626
|
+
after: external_exports.string().optional().describe("Pagination cursor for the next page")
|
|
14627
|
+
}),
|
|
14628
|
+
output: external_exports.object({
|
|
14629
|
+
subreddits: external_exports.array(
|
|
14630
|
+
external_exports.object({
|
|
14631
|
+
display_name: external_exports.string().describe("Subreddit name"),
|
|
14632
|
+
title: external_exports.string().describe("Subreddit title"),
|
|
14633
|
+
subscribers: external_exports.number().describe("Subscriber count"),
|
|
14634
|
+
active_user_count: external_exports.number().describe("Active users online"),
|
|
14635
|
+
url: external_exports.string().describe("Subreddit URL path"),
|
|
14636
|
+
public_description: external_exports.string().describe("Short description"),
|
|
14637
|
+
over18: external_exports.boolean().describe("NSFW flag")
|
|
14638
|
+
})
|
|
14639
|
+
).describe("Subreddits"),
|
|
14640
|
+
after: external_exports.string().nullable().describe("Pagination cursor for next page")
|
|
14641
|
+
}),
|
|
14642
|
+
handle: async (params) => {
|
|
14643
|
+
const category = params.category ?? "popular";
|
|
14644
|
+
const queryParams = {
|
|
14645
|
+
limit: String(params.limit ?? 25)
|
|
14646
|
+
};
|
|
14647
|
+
if (params.after) queryParams.after = params.after;
|
|
14648
|
+
const data = await redditGet(`/subreddits/${category}.json`, queryParams);
|
|
14649
|
+
return {
|
|
14650
|
+
subreddits: data.data.children.map((child) => ({
|
|
14651
|
+
display_name: child.data.display_name,
|
|
14652
|
+
title: child.data.title,
|
|
14653
|
+
subscribers: child.data.subscribers,
|
|
14654
|
+
active_user_count: child.data.active_user_count ?? 0,
|
|
14655
|
+
url: child.data.url,
|
|
14656
|
+
public_description: child.data.public_description ?? "",
|
|
14657
|
+
over18: child.data.over18
|
|
14658
|
+
})),
|
|
14659
|
+
after: data.data.after ?? null
|
|
14660
|
+
};
|
|
14661
|
+
}
|
|
14662
|
+
});
|
|
14663
|
+
|
|
14452
14664
|
// src/tools/list-posts.ts
|
|
14453
14665
|
var postSchema = external_exports.object({
|
|
14454
14666
|
id: external_exports.string().describe("Post ID (without t3_ prefix)"),
|
|
@@ -14563,6 +14775,77 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
14563
14775
|
}
|
|
14564
14776
|
});
|
|
14565
14777
|
|
|
14778
|
+
// src/tools/list-user-content.ts
|
|
14779
|
+
var contentItemSchema = external_exports.object({
|
|
14780
|
+
kind: external_exports.string().describe('"t3" for post, "t1" for comment'),
|
|
14781
|
+
id: external_exports.string().describe("Item ID"),
|
|
14782
|
+
name: external_exports.string().describe("Item fullname"),
|
|
14783
|
+
author: external_exports.string().describe("Author username"),
|
|
14784
|
+
subreddit: external_exports.string().describe("Subreddit name"),
|
|
14785
|
+
score: external_exports.number().describe("Score"),
|
|
14786
|
+
created_utc: external_exports.number().describe("Creation timestamp"),
|
|
14787
|
+
permalink: external_exports.string().describe("Reddit permalink"),
|
|
14788
|
+
title: external_exports.string().nullable().describe("Post title (null for comments)"),
|
|
14789
|
+
selftext: external_exports.string().nullable().describe("Post body (null for comments)"),
|
|
14790
|
+
body: external_exports.string().nullable().describe("Comment body (null for posts)"),
|
|
14791
|
+
link_title: external_exports.string().nullable().describe("Parent post title (for comments)"),
|
|
14792
|
+
link_id: external_exports.string().nullable().describe("Parent post fullname, e.g. t3_abc123 (for comments)"),
|
|
14793
|
+
parent_id: external_exports.string().nullable().describe("Parent comment/post fullname (for comments)"),
|
|
14794
|
+
num_comments: external_exports.number().nullable().describe("Comment count (for posts)")
|
|
14795
|
+
});
|
|
14796
|
+
var listUserContent = defineTool({
|
|
14797
|
+
name: "list_user_content",
|
|
14798
|
+
displayName: "List User Content",
|
|
14799
|
+
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.`,
|
|
14800
|
+
summary: "List a user's posts, comments, or saved items",
|
|
14801
|
+
icon: "list",
|
|
14802
|
+
group: "User",
|
|
14803
|
+
input: external_exports.object({
|
|
14804
|
+
username: external_exports.string().min(1).describe("Reddit username (without u/ prefix)"),
|
|
14805
|
+
where: external_exports.enum(["overview", "submitted", "comments", "saved", "upvoted", "downvoted", "hidden", "gilded"]).describe("Content type to list"),
|
|
14806
|
+
sort: external_exports.enum(["hot", "new", "top", "controversial"]).optional().describe('Sort order (default "new")'),
|
|
14807
|
+
t: external_exports.enum(["hour", "day", "week", "month", "year", "all"]).optional().describe('Time period for "top" and "controversial" sort'),
|
|
14808
|
+
limit: external_exports.number().int().min(1).max(100).optional().describe("Number of results (default 25, max 100)"),
|
|
14809
|
+
after: external_exports.string().optional().describe("Pagination cursor for the next page")
|
|
14810
|
+
}),
|
|
14811
|
+
output: external_exports.object({
|
|
14812
|
+
items: external_exports.array(contentItemSchema).describe("User content items"),
|
|
14813
|
+
after: external_exports.string().nullable().describe("Pagination cursor for next page")
|
|
14814
|
+
}),
|
|
14815
|
+
handle: async (params) => {
|
|
14816
|
+
const queryParams = {
|
|
14817
|
+
limit: String(params.limit ?? 25)
|
|
14818
|
+
};
|
|
14819
|
+
if (params.sort) queryParams.sort = params.sort;
|
|
14820
|
+
if (params.t) queryParams.t = params.t;
|
|
14821
|
+
if (params.after) queryParams.after = params.after;
|
|
14822
|
+
const data = await redditGet(
|
|
14823
|
+
`/user/${params.username}/${params.where}.json`,
|
|
14824
|
+
queryParams
|
|
14825
|
+
);
|
|
14826
|
+
return {
|
|
14827
|
+
items: data.data.children.map((child) => ({
|
|
14828
|
+
kind: child.kind,
|
|
14829
|
+
id: child.data.id,
|
|
14830
|
+
name: child.data.name,
|
|
14831
|
+
author: child.data.author ?? "",
|
|
14832
|
+
subreddit: child.data.subreddit ?? "",
|
|
14833
|
+
score: child.data.score ?? 0,
|
|
14834
|
+
created_utc: child.data.created_utc,
|
|
14835
|
+
permalink: child.data.permalink,
|
|
14836
|
+
title: child.data.title ?? null,
|
|
14837
|
+
selftext: child.data.selftext ?? null,
|
|
14838
|
+
body: child.data.body ?? null,
|
|
14839
|
+
link_title: child.data.link_title ?? null,
|
|
14840
|
+
link_id: child.data.link_id ?? null,
|
|
14841
|
+
parent_id: child.data.parent_id ?? null,
|
|
14842
|
+
num_comments: child.data.num_comments ?? null
|
|
14843
|
+
})),
|
|
14844
|
+
after: data.data.after ?? null
|
|
14845
|
+
};
|
|
14846
|
+
}
|
|
14847
|
+
});
|
|
14848
|
+
|
|
14566
14849
|
// src/tools/read-inbox.ts
|
|
14567
14850
|
var readInbox = defineTool({
|
|
14568
14851
|
name: "read_inbox",
|
|
@@ -14614,6 +14897,30 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
14614
14897
|
}
|
|
14615
14898
|
});
|
|
14616
14899
|
|
|
14900
|
+
// src/tools/report.ts
|
|
14901
|
+
var report = defineTool({
|
|
14902
|
+
name: "report",
|
|
14903
|
+
displayName: "Report",
|
|
14904
|
+
description: "Report a post or comment to the subreddit moderators for rule violations.",
|
|
14905
|
+
summary: "Report a post or comment",
|
|
14906
|
+
icon: "flag",
|
|
14907
|
+
group: "Actions",
|
|
14908
|
+
input: external_exports.object({
|
|
14909
|
+
thing_id: external_exports.string().min(1).describe('Fullname of the post or comment to report (e.g., "t3_abc123" or "t1_xyz")'),
|
|
14910
|
+
reason: external_exports.string().min(1).describe("Reason for the report")
|
|
14911
|
+
}),
|
|
14912
|
+
output: external_exports.object({
|
|
14913
|
+
success: external_exports.boolean().describe("Whether the report was submitted")
|
|
14914
|
+
}),
|
|
14915
|
+
handle: async (params) => {
|
|
14916
|
+
await redditPost("/api/report", {
|
|
14917
|
+
thing_id: params.thing_id,
|
|
14918
|
+
reason: params.reason
|
|
14919
|
+
});
|
|
14920
|
+
return { success: true };
|
|
14921
|
+
}
|
|
14922
|
+
});
|
|
14923
|
+
|
|
14617
14924
|
// src/tools/save.ts
|
|
14618
14925
|
var save = defineTool({
|
|
14619
14926
|
name: "save",
|
|
@@ -14934,11 +15241,18 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
14934
15241
|
searchPosts,
|
|
14935
15242
|
submitPost,
|
|
14936
15243
|
submitComment,
|
|
15244
|
+
getCommentThread,
|
|
15245
|
+
editText,
|
|
15246
|
+
deleteThing,
|
|
14937
15247
|
vote,
|
|
14938
15248
|
save,
|
|
15249
|
+
hide,
|
|
15250
|
+
report,
|
|
15251
|
+
listUserContent,
|
|
14939
15252
|
getSubreddit,
|
|
14940
15253
|
searchSubreddits,
|
|
14941
15254
|
listSubscriptions,
|
|
15255
|
+
listPopularSubreddits,
|
|
14942
15256
|
subscribe,
|
|
14943
15257
|
getUser,
|
|
14944
15258
|
sendMessage,
|
|
@@ -14957,7 +15271,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
14957
15271
|
};
|
|
14958
15272
|
var src_default = new RedditPlugin();
|
|
14959
15273
|
|
|
14960
|
-
// dist/
|
|
15274
|
+
// dist/_adapter_entry_344d4fb8-80ec-4428-8e67-473b136c90be.ts
|
|
14961
15275
|
if (!globalThis.__openTabs) {
|
|
14962
15276
|
globalThis.__openTabs = {};
|
|
14963
15277
|
} else {
|
|
@@ -15173,5 +15487,5 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15173
15487
|
};
|
|
15174
15488
|
delete src_default.onDeactivate;
|
|
15175
15489
|
}
|
|
15176
|
-
})();(function(){var o=(globalThis).__openTabs;if(o&&o.adapters&&o.adapters["reddit"]){var a=o.adapters["reddit"];a.__adapterHash="
|
|
15490
|
+
})();(function(){var o=(globalThis).__openTabs;if(o&&o.adapters&&o.adapters["reddit"]){var a=o.adapters["reddit"];a.__adapterHash="7dc28e95496e5caf6c03ada6f479afbdccadc333334653f591509dae45599c2f";if(a.tools&&Array.isArray(a.tools)){for(var i=0;i<a.tools.length;i++){Object.freeze(a.tools[i]);}Object.freeze(a.tools);}Object.freeze(a);Object.defineProperty(o.adapters,"reddit",{value:a,writable:false,configurable:false,enumerable:true});Object.defineProperty(o,"adapters",{value:o.adapters,writable:false,configurable:false});}})();
|
|
15177
15491
|
//# sourceMappingURL=adapter.iife.js.map
|