@fedify/botkit 0.5.0-dev.210 → 0.5.0-dev.226

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.
Files changed (84) hide show
  1. package/dist/bot-group.test.d.ts +2 -0
  2. package/dist/bot-group.test.js +220 -0
  3. package/dist/bot-group.test.js.map +1 -0
  4. package/dist/bot-impl.d.ts +132 -13
  5. package/dist/bot-impl.d.ts.map +1 -1
  6. package/dist/bot-impl.js +400 -178
  7. package/dist/bot-impl.js.map +1 -1
  8. package/dist/bot-impl.test.js +214 -76
  9. package/dist/bot-impl.test.js.map +1 -1
  10. package/dist/bot.d.ts +94 -48
  11. package/dist/bot.d.ts.map +1 -1
  12. package/dist/bot.js +2 -104
  13. package/dist/bot.js.map +1 -1
  14. package/dist/bot.test.js +59 -0
  15. package/dist/bot.test.js.map +1 -1
  16. package/dist/components/FollowButton.d.ts +3 -1
  17. package/dist/components/FollowButton.d.ts.map +1 -1
  18. package/dist/components/FollowButton.js +2 -2
  19. package/dist/components/FollowButton.js.map +1 -1
  20. package/dist/components/Layout.js +1 -1
  21. package/dist/components/Layout.js.map +1 -1
  22. package/dist/components/Message.d.ts +2 -2
  23. package/dist/deno.js +3 -13
  24. package/dist/deno.js.map +1 -1
  25. package/dist/follow-impl.test.js +3 -3
  26. package/dist/follow-impl.test.js.map +1 -1
  27. package/dist/instance-impl.d.ts +158 -0
  28. package/dist/instance-impl.d.ts.map +1 -0
  29. package/dist/instance-impl.js +603 -0
  30. package/dist/instance-impl.js.map +1 -0
  31. package/dist/instance-impl.test.d.ts +2 -0
  32. package/dist/instance-impl.test.js +103 -0
  33. package/dist/instance-impl.test.js.map +1 -0
  34. package/dist/instance-multi.test.d.ts +2 -0
  35. package/dist/instance-multi.test.js +151 -0
  36. package/dist/instance-multi.test.js.map +1 -0
  37. package/dist/instance-routing.test.d.ts +2 -0
  38. package/dist/instance-routing.test.js +367 -0
  39. package/dist/instance-routing.test.js.map +1 -0
  40. package/dist/instance.d.ts +318 -0
  41. package/dist/instance.d.ts.map +1 -0
  42. package/dist/instance.js +51 -0
  43. package/dist/instance.js.map +1 -0
  44. package/dist/message-impl.d.ts.map +1 -1
  45. package/dist/message-impl.js +17 -10
  46. package/dist/message-impl.js.map +1 -1
  47. package/dist/message-impl.test.js +43 -9
  48. package/dist/message-impl.test.js.map +1 -1
  49. package/dist/mod.d.ts +5 -3
  50. package/dist/mod.js +4 -2
  51. package/dist/pages.d.ts +10 -1
  52. package/dist/pages.d.ts.map +1 -1
  53. package/dist/pages.js +112 -41
  54. package/dist/pages.js.map +1 -1
  55. package/dist/pages.test.d.ts +2 -0
  56. package/dist/pages.test.js +170 -0
  57. package/dist/pages.test.js.map +1 -0
  58. package/dist/repository.d.ts +385 -138
  59. package/dist/repository.d.ts.map +1 -1
  60. package/dist/repository.js +595 -223
  61. package/dist/repository.js.map +1 -1
  62. package/dist/repository.test.js +564 -136
  63. package/dist/repository.test.js.map +1 -1
  64. package/dist/session-impl.d.ts.map +1 -1
  65. package/dist/session-impl.js +13 -4
  66. package/dist/session-impl.js.map +1 -1
  67. package/dist/session-impl.test.d.ts.map +1 -1
  68. package/dist/session-impl.test.js +9 -9
  69. package/dist/session-impl.test.js.map +1 -1
  70. package/dist/session.d.ts +8 -3
  71. package/dist/session.d.ts.map +1 -1
  72. package/dist/text.d.ts.map +1 -1
  73. package/dist/text.js +27 -10
  74. package/dist/text.js.map +1 -1
  75. package/dist/text.test.js +37 -2
  76. package/dist/text.test.js.map +1 -1
  77. package/dist/uri.d.ts +46 -0
  78. package/dist/uri.d.ts.map +1 -0
  79. package/dist/uri.js +64 -0
  80. package/dist/uri.js.map +1 -0
  81. package/dist/uri.test.d.ts +2 -0
  82. package/dist/uri.test.js +93 -0
  83. package/dist/uri.test.js.map +1 -0
  84. package/package.json +6 -2
package/dist/bot.d.ts CHANGED
@@ -10,55 +10,14 @@ import { Application, Application as Application$1, Image, Image as Image$1, Ser
10
10
  import { Software, Software as Software$1 } from "@fedify/fedify/nodeinfo";
11
11
 
12
12
  //#region src/bot.d.ts
13
+
13
14
  /**
14
- * A bot that can interact with the ActivityPub network.
15
+ * The event handlers a bot can register. Assigning a handler to one of
16
+ * these properties makes the bot react to the corresponding ActivityPub
17
+ * activity.
18
+ * @since 0.5.0
15
19
  */
16
- interface Bot<TContextData> {
17
- /**
18
- * An internal Fedify federation instance. Normally you don't need to access
19
- * this directly.
20
- */
21
- readonly federation: Federation<TContextData>;
22
- /**
23
- * The internal identifier for the bot actor. It is used for the actor URI.
24
- */
25
- readonly identifier: string;
26
- /**
27
- * Gets a new session to control the bot for a specific origin and context
28
- * data.
29
- * @param origin The origin of the session. Even if a URL with some path or
30
- * query is passed, only the origin part will be used.
31
- * @param contextData The context data to pass to the federation.
32
- * @returns The session for the origin and context data.
33
- */
34
- getSession(origin: string | URL, contextData: TContextData): Session<TContextData>;
35
- /**
36
- * Gets a new session to control bot for a specific Fedify context.
37
- * @param context The Fedify context of the session.
38
- * @returns The session for the Fedify context.
39
- */
40
- getSession(context: Context<TContextData>): Session<TContextData>;
41
- /**
42
- * The fetch API for handling HTTP requests. You can pass this to an HTTP
43
- * server (e.g., `Deno.serve()`, `Bun.serve()`) to handle incoming requests.
44
- * @param request The request to handle.
45
- * @param contextData The context data to pass to the federation.
46
- * @returns The response to the request.
47
- */
48
- fetch(request: Request, contextData: TContextData): Promise<Response>;
49
- /**
50
- * Defines custom emojis for the bot. The custom emojis are used for
51
- * rendering the bot's profile and posts. The custom emojis are defined
52
- * by their names, and the names are used as the keys of the emojis.
53
- * @param emojis The custom emojis to define. The keys are the names of
54
- * the emojis, and the values are the custom emoji definitions.
55
- * @returns The defined emojis. The keys are the names of the emojis, and
56
- * the values are the emoji objects, which are used for passing
57
- * to the {@link customEmoji} function.
58
- * @throws {TypeError} If any emoji name is invalid or duplicate.
59
- * @since 0.2.0
60
- */
61
- addCustomEmojis<TEmojiName extends string>(emojis: Readonly<Record<TEmojiName, CustomEmoji>>): Readonly<Record<TEmojiName, DeferredCustomEmoji<TContextData>>>;
20
+ interface BotEventHandlers<TContextData> {
62
21
  /**
63
22
  * An event handler for a follow request to the bot.
64
23
  */
@@ -131,6 +90,93 @@ interface Bot<TContextData> {
131
90
  */
132
91
  onVote?: VoteEventHandler<TContextData>;
133
92
  }
93
+ /**
94
+ * A read-only view of a bot actor's identity and profile. It is exposed
95
+ * through {@link Session.bot} so that event handlers can tell which bot they
96
+ * are running as without being able to mutate the bot (e.g. reassign its
97
+ * event handlers).
98
+ * @since 0.5.0
99
+ */
100
+ interface ReadonlyBot {
101
+ /**
102
+ * The internal identifier for the bot actor. It is used for the actor URI.
103
+ */
104
+ readonly identifier: string;
105
+ /**
106
+ * The username of the bot. It is a part of the fediverse handle.
107
+ */
108
+ readonly username: string;
109
+ /**
110
+ * The display name of the bot.
111
+ */
112
+ readonly name?: string;
113
+ /**
114
+ * The type of the bot actor. It is either `Service` or `Application`.
115
+ */
116
+ readonly class: typeof Service$1 | typeof Application$1;
117
+ /**
118
+ * The avatar URL of the bot.
119
+ */
120
+ readonly icon?: URL | Image$1;
121
+ /**
122
+ * The header image URL of the bot.
123
+ */
124
+ readonly image?: URL | Image$1;
125
+ /**
126
+ * How the bot handles incoming follow requests.
127
+ */
128
+ readonly followerPolicy: "accept" | "reject" | "manual";
129
+ }
130
+ /**
131
+ * A bot that can interact with the ActivityPub network.
132
+ */
133
+ interface Bot<TContextData> extends BotEventHandlers<TContextData> {
134
+ /**
135
+ * An internal Fedify federation instance. Normally you don't need to access
136
+ * this directly.
137
+ */
138
+ readonly federation: Federation<TContextData>;
139
+ /**
140
+ * The internal identifier for the bot actor. It is used for the actor URI.
141
+ */
142
+ readonly identifier: string;
143
+ /**
144
+ * Gets a new session to control the bot for a specific origin and context
145
+ * data.
146
+ * @param origin The origin of the session. Even if a URL with some path or
147
+ * query is passed, only the origin part will be used.
148
+ * @param contextData The context data to pass to the federation.
149
+ * @returns The session for the origin and context data.
150
+ */
151
+ getSession(origin: string | URL, contextData: TContextData): Session<TContextData>;
152
+ /**
153
+ * Gets a new session to control bot for a specific Fedify context.
154
+ * @param context The Fedify context of the session.
155
+ * @returns The session for the Fedify context.
156
+ */
157
+ getSession(context: Context<TContextData>): Session<TContextData>;
158
+ /**
159
+ * The fetch API for handling HTTP requests. You can pass this to an HTTP
160
+ * server (e.g., `Deno.serve()`, `Bun.serve()`) to handle incoming requests.
161
+ * @param request The request to handle.
162
+ * @param contextData The context data to pass to the federation.
163
+ * @returns The response to the request.
164
+ */
165
+ fetch(request: Request, contextData: TContextData): Promise<Response>;
166
+ /**
167
+ * Defines custom emojis for the bot. The custom emojis are used for
168
+ * rendering the bot's profile and posts. The custom emojis are defined
169
+ * by their names, and the names are used as the keys of the emojis.
170
+ * @param emojis The custom emojis to define. The keys are the names of
171
+ * the emojis, and the values are the custom emoji definitions.
172
+ * @returns The defined emojis. The keys are the names of the emojis, and
173
+ * the values are the emoji objects, which are used for passing
174
+ * to the {@link customEmoji} function.
175
+ * @throws {TypeError} If any emoji name is invalid or duplicate.
176
+ * @since 0.2.0
177
+ */
178
+ addCustomEmojis<TEmojiName extends string>(emojis: Readonly<Record<TEmojiName, CustomEmoji>>): Readonly<Record<TEmojiName, DeferredCustomEmoji<TContextData>>>;
179
+ }
134
180
  /**
135
181
  * A specialized {@link Bot} tpe that doesn't require context data.
136
182
  */
@@ -280,5 +326,5 @@ interface PagesOptions {
280
326
  declare function createBot<TContextData = void>(options: CreateBotOptions<TContextData>): TContextData extends void ? BotWithVoidContextData : Bot<TContextData>;
281
327
  //# sourceMappingURL=bot.d.ts.map
282
328
  //#endregion
283
- export { Application, Bot, BotWithVoidContextData, CreateBotOptions, Image, PagesOptions, Service, Software, createBot };
329
+ export { Application, Bot, BotEventHandlers, BotWithVoidContextData, CreateBotOptions, Image, PagesOptions, ReadonlyBot, Service, Software, createBot };
284
330
  //# sourceMappingURL=bot.d.ts.map
package/dist/bot.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"bot.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,gBAAgB,QAAQ;;;;;;;;iBASrC,sBAAsB,eAAe,QAAQ;;;;;;;;;;;;;qDAelD,SAAS,OAAO,YAAY,gBACnC,SAAS,OAAO,YAAY,oBAAoB;;;;;UAMpC,sBAAA,SAA+B;;;;;;;;;8BAU3B,yBAEhB;;;;;;sBAOiB,gBAAgB;;;;;;;8BAQR,MAAM;;;;;;;iBAQnB,UAAU,QAAQ;;;;;UAMlB;;;;;;;;;;;;;;;0BAgBS,mBAAiB;;;;;;;;;;;;;qBAgBtB,cAAc;;;;kBAKjB,MAAM;;;;;mBAML,MAAM;;;;;wBAMD,eAAe,yBAAyB;;;;;;;;;;;;;;;eAiBjD;;;;;wBAMS;;;;;;mBAOL;;;;;sBAMG;;;;;;;;;;;;;mBAeH;;;;;UAMF,YAAA;;;;;;;;;;;;;;;;;;iBAwCD,wCACL,iBAAiB,gBACzB,4BAA4B,yBAAyB,IAAI"}
package/dist/bot.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import { Temporal, toTemporalInstant } from "@js-temporal/polyfill";
3
3
  Date.prototype.toTemporalInstant = toTemporalInstant;
4
4
 
5
- import { BotImpl } from "./bot-impl.js";
5
+ import { BotImpl, wrapBotImpl } from "./bot-impl.js";
6
6
  import { Application, Image, Service } from "@fedify/vocab";
7
7
 
8
8
  //#region src/bot.ts
@@ -13,109 +13,7 @@ import { Application, Image, Service } from "@fedify/vocab";
13
13
  */
14
14
  function createBot(options) {
15
15
  const bot = new BotImpl(options);
16
- const wrapper = {
17
- impl: bot,
18
- get federation() {
19
- return bot.federation;
20
- },
21
- get identifier() {
22
- return bot.identifier;
23
- },
24
- getSession(a, b) {
25
- return bot.getSession(a, b);
26
- },
27
- fetch(request, contextData) {
28
- return bot.fetch(request, contextData);
29
- },
30
- addCustomEmojis(emojis) {
31
- return bot.addCustomEmojis(emojis);
32
- },
33
- get onFollow() {
34
- return bot.onFollow;
35
- },
36
- set onFollow(value) {
37
- bot.onFollow = value;
38
- },
39
- get onUnfollow() {
40
- return bot.onUnfollow;
41
- },
42
- set onUnfollow(value) {
43
- bot.onUnfollow = value;
44
- },
45
- get onAcceptFollow() {
46
- return bot.onAcceptFollow;
47
- },
48
- set onAcceptFollow(value) {
49
- bot.onAcceptFollow = value;
50
- },
51
- get onRejectFollow() {
52
- return bot.onRejectFollow;
53
- },
54
- set onRejectFollow(value) {
55
- bot.onRejectFollow = value;
56
- },
57
- get onMention() {
58
- return bot.onMention;
59
- },
60
- set onMention(value) {
61
- bot.onMention = value;
62
- },
63
- get onReply() {
64
- return bot.onReply;
65
- },
66
- set onReply(value) {
67
- bot.onReply = value;
68
- },
69
- get onQuote() {
70
- return bot.onQuote;
71
- },
72
- set onQuote(value) {
73
- bot.onQuote = value;
74
- },
75
- get onMessage() {
76
- return bot.onMessage;
77
- },
78
- set onMessage(value) {
79
- bot.onMessage = value;
80
- },
81
- get onSharedMessage() {
82
- return bot.onSharedMessage;
83
- },
84
- set onSharedMessage(value) {
85
- bot.onSharedMessage = value;
86
- },
87
- get onLike() {
88
- return bot.onLike;
89
- },
90
- set onLike(value) {
91
- bot.onLike = value;
92
- },
93
- get onUnlike() {
94
- return bot.onUnlike;
95
- },
96
- set onUnlike(value) {
97
- bot.onUnlike = value;
98
- },
99
- get onReact() {
100
- return bot.onReact;
101
- },
102
- set onReact(value) {
103
- bot.onReact = value;
104
- },
105
- get onUnreact() {
106
- return bot.onUnreact;
107
- },
108
- set onUnreact(value) {
109
- bot.onUnreact = value;
110
- },
111
- get onVote() {
112
- return bot.onVote;
113
- },
114
- set onVote(value) {
115
- bot.onVote = value;
116
- }
117
- };
118
- return wrapper;
16
+ return wrapBotImpl(bot);
119
17
  }
120
18
 
121
19
  //#endregion
package/dist/bot.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"bot.js","names":["options: CreateBotOptions<TContextData>","b?","emojis: Readonly<Record<TEmojiName, CustomEmoji>>"],"sources":["../src/bot.ts"],"sourcesContent":["// BotKit by Fedify: A framework for creating ActivityPub bots\n// Copyright (C) 2025–2026 Hong Minhee <https://hongminhee.org/>\n//\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU Affero General Public License as\n// published by the Free Software Foundation, either version 3 of the\n// License, or (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU Affero General Public License for more details.\n//\n// You should have received a copy of the GNU Affero General Public License\n// along with this program. If not, see <https://www.gnu.org/licenses/>.\nimport type {\n Context,\n Federation,\n KvStore,\n MessageQueue,\n} from \"@fedify/fedify/federation\";\nimport type { Software } from \"@fedify/fedify/nodeinfo\";\nimport type { Application, Image, Service } from \"@fedify/vocab\";\nimport { BotImpl } from \"./bot-impl.ts\";\nimport type { CustomEmoji, DeferredCustomEmoji } from \"./emoji.ts\";\nimport type {\n AcceptEventHandler,\n FollowEventHandler,\n LikeEventHandler,\n MentionEventHandler,\n MessageEventHandler,\n QuoteEventHandler,\n ReactionEventHandler,\n RejectEventHandler,\n ReplyEventHandler,\n SharedMessageEventHandler,\n UndoneReactionEventHandler,\n UnfollowEventHandler,\n UnlikeEventHandler,\n VoteEventHandler,\n} from \"./events.ts\";\nimport type { Repository } from \"./repository.ts\";\nimport type { Session } from \"./session.ts\";\nimport type { Text } from \"./text.ts\";\nexport { type Software } from \"@fedify/fedify/nodeinfo\";\nexport { Application, Image, Service } from \"@fedify/vocab\";\n\n/**\n * A bot that can interact with the ActivityPub network.\n */\nexport interface Bot<TContextData> {\n /**\n * An internal Fedify federation instance. Normally you don't need to access\n * this directly.\n */\n readonly federation: Federation<TContextData>;\n\n /**\n * The internal identifier for the bot actor. It is used for the actor URI.\n */\n readonly identifier: string;\n\n /**\n * Gets a new session to control the bot for a specific origin and context\n * data.\n * @param origin The origin of the session. Even if a URL with some path or\n * query is passed, only the origin part will be used.\n * @param contextData The context data to pass to the federation.\n * @returns The session for the origin and context data.\n */\n getSession(\n origin: string | URL,\n contextData: TContextData,\n ): Session<TContextData>;\n\n /**\n * Gets a new session to control bot for a specific Fedify context.\n * @param context The Fedify context of the session.\n * @returns The session for the Fedify context.\n */\n getSession(context: Context<TContextData>): Session<TContextData>;\n\n /**\n * The fetch API for handling HTTP requests. You can pass this to an HTTP\n * server (e.g., `Deno.serve()`, `Bun.serve()`) to handle incoming requests.\n * @param request The request to handle.\n * @param contextData The context data to pass to the federation.\n * @returns The response to the request.\n */\n fetch(request: Request, contextData: TContextData): Promise<Response>;\n\n /**\n * Defines custom emojis for the bot. The custom emojis are used for\n * rendering the bot's profile and posts. The custom emojis are defined\n * by their names, and the names are used as the keys of the emojis.\n * @param emojis The custom emojis to define. The keys are the names of\n * the emojis, and the values are the custom emoji definitions.\n * @returns The defined emojis. The keys are the names of the emojis, and\n * the values are the emoji objects, which are used for passing\n * to the {@link customEmoji} function.\n * @throws {TypeError} If any emoji name is invalid or duplicate.\n * @since 0.2.0\n */\n addCustomEmojis<TEmojiName extends string>(\n emojis: Readonly<Record<TEmojiName, CustomEmoji>>,\n ): Readonly<Record<TEmojiName, DeferredCustomEmoji<TContextData>>>;\n\n /**\n * An event handler for a follow request to the bot.\n */\n onFollow?: FollowEventHandler<TContextData>;\n\n /**\n * An event handler for an unfollow event from the bot.\n */\n onUnfollow?: UnfollowEventHandler<TContextData>;\n\n /**\n * An event handler invoked when a follow request the bot sent is accepted.\n */\n onAcceptFollow?: AcceptEventHandler<TContextData>;\n\n /**\n * An event handler invoked when a follow request the bot sent is rejected.\n */\n onRejectFollow?: RejectEventHandler<TContextData>;\n\n /**\n * An event handler for a message mentioned to the bot.\n */\n onMention?: MentionEventHandler<TContextData>;\n\n /**\n * An event handler for a reply to the bot.\n */\n onReply?: ReplyEventHandler<TContextData>;\n\n /**\n * An event handler for a quote of the bot's message.\n * @since 0.2.0\n */\n onQuote?: QuoteEventHandler<TContextData>;\n\n /**\n * An event handler for a message shown to the bot's timeline. To listen\n * to this event, your bot needs to follow others first.\n */\n onMessage?: MessageEventHandler<TContextData>;\n\n /**\n * An event handler for a message shared to the bot. To listen to this event,\n * your bot needs to follow others first.\n */\n onSharedMessage?: SharedMessageEventHandler<TContextData>;\n\n /**\n * An event handler for a like of a message.\n */\n onLike?: LikeEventHandler<TContextData>;\n\n /**\n * An event handler for an undoing of a like of a message.\n */\n onUnlike?: UnlikeEventHandler<TContextData>;\n\n /**\n * An event handler for an emoji reaction to a message.\n * @since 0.2.0\n */\n onReact?: ReactionEventHandler<TContextData>;\n\n /**\n * An event handler for an undoing of an emoji reaction to a message.\n * @since 0.2.0\n */\n onUnreact?: UndoneReactionEventHandler<TContextData>;\n\n /**\n * An event handler for a vote in a poll. This event is only triggered when\n * the bot is the author of the poll, and the vote is made by another actor.\n * If the poll allows multiple selections, this event is triggered multiple\n * times, once for each option selected by the actor.\n *\n * Note that this event can be triggered even if the voter vote an option\n * multiple times or multiple options for a poll that disallows multiple\n * selections. You should validate the vote in the event handler by storing\n * the votes in a persistent store, and checking if the vote is valid.\n * (This behavior can subject to change in the future.)\n * @since 0.3.0\n */\n onVote?: VoteEventHandler<TContextData>;\n}\n\n/**\n * A specialized {@link Bot} tpe that doesn't require context data.\n */\nexport interface BotWithVoidContextData extends Bot<void> {\n /**\n * Gets a new session to control the bot for a specific origin and context\n * data.\n * @param origin The origin of the session. Even if a URL with some path or\n * query is passed, only the origin part will be used.\n * @param contextData The context data to pass to the federation.\n * @returns The session for the origin and context data.\n */\n getSession(\n origin: string | URL,\n contextData: void,\n ): Session<void>;\n\n /**\n * Gets a new session to control bot for a specific Fedify context.\n * @param context The Fedify context of the session.\n * @returns The session for the Fedify context.\n */\n getSession(context: Context<void>): Session<void>;\n\n /**\n * Gets a new session to control the bot for a specific origin and context\n * data.\n * @param origin The origin of the session. Even if a URL with some path or\n * query is passed, only the origin part will be used.\n */\n getSession(origin: string | URL): Session<void>;\n\n /**\n * The fetch API for handling HTTP requests. You can pass this to an HTTP\n * server (e.g., `Deno.serve()`, `Bun.serve()`) to handle incoming requests.\n * @param request The request to handle.\n * @returns The response to the request.\n */\n fetch(request: Request): Promise<Response>;\n}\n\n/**\n * Options for creating a bot.\n */\nexport interface CreateBotOptions<TContextData> {\n /**\n * The internal identifier of the bot. Since it is used for the actor URI,\n * it *should not* be changed after the bot is federated.\n *\n * If omitted, `\"bot\"` will be used.\n * @default `\"bot\"`\n */\n readonly identifier?: string;\n\n /**\n * The type of the bot actor. It should be either `Service` or `Application`.\n *\n * If omitted, `Service` will be used.\n * @default `Service`\n */\n readonly class?: typeof Service | typeof Application;\n\n /**\n * The username of the bot. It will be a part of the fediverse handle.\n * It can be changed after the bot is federated.\n */\n readonly username: string;\n\n /**\n * The display name of the bot. It can be changed after the bot is federated.\n */\n readonly name?: string;\n\n /**\n * The description of the bot. It can be changed after the bot is federated.\n */\n readonly summary?: Text<\"block\", TContextData>;\n\n /**\n * The avatar URL of the bot. It can be changed after the bot is federated.\n */\n readonly icon?: URL | Image;\n\n /**\n * The header image URL of the bot. It can be changed after the bot is\n * federated.\n */\n readonly image?: URL | Image;\n\n /**\n * The custom properties of the bot. It can be changed after the bot is\n * federated.\n */\n readonly properties?: Record<string, Text<\"block\" | \"inline\", TContextData>>;\n\n /**\n * How to handle incoming follow requests. Note that this behavior can be\n * overridden by manually invoking {@link FollowRequest.accept} or\n * {@link FollowRequest.reject} in the {@link Bot.onFollow} event handler.\n *\n * - `\"accept\"` (default): Automatically accept all incoming follow requests.\n * - `\"reject\"`: Automatically reject all incoming follow requests.\n * - `\"manual\"`: Require manual handling of incoming follow requests.\n * @default `\"accept\"`\n */\n readonly followerPolicy?: \"accept\" | \"reject\" | \"manual\";\n\n /**\n * The underlying key-value store to use for storing data.\n */\n readonly kv: KvStore;\n\n /**\n * The underlying repository to use for storing data. If omitted,\n * {@link KvRepository} will be used.\n */\n readonly repository?: Repository;\n\n /**\n * The underlying message queue to use for handling incoming and outgoing\n * activities. If omitted, incoming activities are processed immediately,\n * and outgoing activities are sent immediately.\n */\n readonly queue?: MessageQueue;\n\n /**\n * The software information of the bot. If omitted, the NodeInfo protocol\n * will be unimplemented.\n */\n readonly software?: Software;\n\n /**\n * Whether to trust `X-Forwarded-*` headers. If your bot application is\n * behind an L7 reverse proxy, turn it on.\n *\n * Turned off by default.\n * @default `false`\n */\n readonly behindProxy?: boolean;\n\n /**\n * The options for the web pages of the bot. If omitted, the default options\n * will be used.\n */\n readonly pages?: PagesOptions;\n}\n\n/**\n * Options for the web pages of the bot.\n */\nexport interface PagesOptions {\n /**\n * The color of the theme. It will be used for the theme color of the web\n * pages. The default color is `\"green\"`.\n * @default `\"green\"`\n */\n readonly color?:\n | \"amber\"\n | \"azure\"\n | \"blue\"\n | \"cyan\"\n | \"fuchsia\"\n | \"green\"\n | \"grey\"\n | \"indigo\"\n | \"jade\"\n | \"lime\"\n | \"orange\"\n | \"pink\"\n | \"pumpkin\"\n | \"purple\"\n | \"red\"\n | \"sand\"\n | \"slate\"\n | \"violet\"\n | \"yellow\"\n | \"zinc\";\n\n /**\n * The CSS code for the bot. It will be used for the custom CSS of the web\n * pages.\n */\n readonly css?: string;\n}\n\n/**\n * Creates a {@link Bot} instance.\n * @param options The options for creating the bot.\n * @returns The created bot instance.\n */\nexport function createBot<TContextData = void>(\n options: CreateBotOptions<TContextData>,\n): TContextData extends void ? BotWithVoidContextData : Bot<TContextData> {\n const bot = new BotImpl<TContextData>(options);\n // Since `deno serve` does not recognize a class instance having fetch(),\n // we wrap a BotImpl instance with a plain object.\n // See also https://github.com/denoland/deno/issues/24062\n const wrapper = {\n impl: bot,\n get federation() {\n return bot.federation;\n },\n get identifier() {\n return bot.identifier;\n },\n getSession(a, b?) {\n // @ts-ignore: BotImpl.getSession() implements Bot.getSession()\n return bot.getSession(a, b);\n },\n fetch(request, contextData) {\n return bot.fetch(request, contextData);\n },\n addCustomEmojis<TEmojiName extends string>(\n emojis: Readonly<Record<TEmojiName, CustomEmoji>>,\n ): Readonly<Record<TEmojiName, DeferredCustomEmoji<TContextData>>> {\n return bot.addCustomEmojis(emojis);\n },\n get onFollow() {\n return bot.onFollow;\n },\n set onFollow(value) {\n bot.onFollow = value;\n },\n get onUnfollow() {\n return bot.onUnfollow;\n },\n set onUnfollow(value) {\n bot.onUnfollow = value;\n },\n get onAcceptFollow() {\n return bot.onAcceptFollow;\n },\n set onAcceptFollow(value) {\n bot.onAcceptFollow = value;\n },\n get onRejectFollow() {\n return bot.onRejectFollow;\n },\n set onRejectFollow(value) {\n bot.onRejectFollow = value;\n },\n get onMention() {\n return bot.onMention;\n },\n set onMention(value) {\n bot.onMention = value;\n },\n get onReply() {\n return bot.onReply;\n },\n set onReply(value) {\n bot.onReply = value;\n },\n get onQuote() {\n return bot.onQuote;\n },\n set onQuote(value) {\n bot.onQuote = value;\n },\n get onMessage() {\n return bot.onMessage;\n },\n set onMessage(value) {\n bot.onMessage = value;\n },\n get onSharedMessage() {\n return bot.onSharedMessage;\n },\n set onSharedMessage(value) {\n bot.onSharedMessage = value;\n },\n get onLike() {\n return bot.onLike;\n },\n set onLike(value) {\n bot.onLike = value;\n },\n get onUnlike() {\n return bot.onUnlike;\n },\n set onUnlike(value) {\n bot.onUnlike = value;\n },\n get onReact() {\n return bot.onReact;\n },\n set onReact(value) {\n bot.onReact = value;\n },\n get onUnreact() {\n return bot.onUnreact;\n },\n set onUnreact(value) {\n bot.onUnreact = value;\n },\n get onVote() {\n return bot.onVote;\n },\n set onVote(value) {\n bot.onVote = value;\n },\n } satisfies Bot<TContextData> & { impl: BotImpl<TContextData> };\n // @ts-ignore: the wrapper implements BotWithVoidContextData\n return wrapper;\n}\n"],"mappings":";;;;;;;;;;;;;AA+XA,SAAgB,UACdA,SACwE;CACxE,MAAM,MAAM,IAAI,QAAsB;CAItC,MAAM,UAAU;EACd,MAAM;EACN,IAAI,aAAa;AACf,UAAO,IAAI;EACZ;EACD,IAAI,aAAa;AACf,UAAO,IAAI;EACZ;EACD,WAAW,GAAGC,GAAI;AAEhB,UAAO,IAAI,WAAW,GAAG,EAAE;EA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D,IAAI,UAAU,OAAO;AACnB,OAAI,YAAY;EACjB;EACD,IAAI,SAAS;AACX,UAAO,IAAI;EACZ;EACD,IAAI,OAAO,OAAO;AAChB,OAAI,SAAS;EACd;CACF;AAED,QAAO;AACR"}
1
+ {"version":3,"file":"bot.js","names":["options: CreateBotOptions<TContextData>"],"sources":["../src/bot.ts"],"sourcesContent":["// BotKit by Fedify: A framework for creating ActivityPub bots\n// Copyright (C) 2025–2026 Hong Minhee <https://hongminhee.org/>\n//\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU Affero General Public License as\n// published by the Free Software Foundation, either version 3 of the\n// License, or (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU Affero General Public License for more details.\n//\n// You should have received a copy of the GNU Affero General Public License\n// along with this program. If not, see <https://www.gnu.org/licenses/>.\nimport type {\n Context,\n Federation,\n KvStore,\n MessageQueue,\n} from \"@fedify/fedify/federation\";\nimport type { Software } from \"@fedify/fedify/nodeinfo\";\nimport type { Application, Image, Service } from \"@fedify/vocab\";\nimport { BotImpl, wrapBotImpl } from \"./bot-impl.ts\";\nimport type { CustomEmoji, DeferredCustomEmoji } from \"./emoji.ts\";\nimport type {\n AcceptEventHandler,\n FollowEventHandler,\n LikeEventHandler,\n MentionEventHandler,\n MessageEventHandler,\n QuoteEventHandler,\n ReactionEventHandler,\n RejectEventHandler,\n ReplyEventHandler,\n SharedMessageEventHandler,\n UndoneReactionEventHandler,\n UnfollowEventHandler,\n UnlikeEventHandler,\n VoteEventHandler,\n} from \"./events.ts\";\nimport type { Repository } from \"./repository.ts\";\nimport type { Session } from \"./session.ts\";\nimport type { Text } from \"./text.ts\";\nexport { type Software } from \"@fedify/fedify/nodeinfo\";\nexport { Application, Image, Service } from \"@fedify/vocab\";\n\n/**\n * The event handlers a bot can register. Assigning a handler to one of\n * these properties makes the bot react to the corresponding ActivityPub\n * activity.\n * @since 0.5.0\n */\nexport interface BotEventHandlers<TContextData> {\n /**\n * An event handler for a follow request to the bot.\n */\n onFollow?: FollowEventHandler<TContextData>;\n\n /**\n * An event handler for an unfollow event from the bot.\n */\n onUnfollow?: UnfollowEventHandler<TContextData>;\n\n /**\n * An event handler invoked when a follow request the bot sent is accepted.\n */\n onAcceptFollow?: AcceptEventHandler<TContextData>;\n\n /**\n * An event handler invoked when a follow request the bot sent is rejected.\n */\n onRejectFollow?: RejectEventHandler<TContextData>;\n\n /**\n * An event handler for a message mentioned to the bot.\n */\n onMention?: MentionEventHandler<TContextData>;\n\n /**\n * An event handler for a reply to the bot.\n */\n onReply?: ReplyEventHandler<TContextData>;\n\n /**\n * An event handler for a quote of the bot's message.\n * @since 0.2.0\n */\n onQuote?: QuoteEventHandler<TContextData>;\n\n /**\n * An event handler for a message shown to the bot's timeline. To listen\n * to this event, your bot needs to follow others first.\n */\n onMessage?: MessageEventHandler<TContextData>;\n\n /**\n * An event handler for a message shared to the bot. To listen to this event,\n * your bot needs to follow others first.\n */\n onSharedMessage?: SharedMessageEventHandler<TContextData>;\n\n /**\n * An event handler for a like of a message.\n */\n onLike?: LikeEventHandler<TContextData>;\n\n /**\n * An event handler for an undoing of a like of a message.\n */\n onUnlike?: UnlikeEventHandler<TContextData>;\n\n /**\n * An event handler for an emoji reaction to a message.\n * @since 0.2.0\n */\n onReact?: ReactionEventHandler<TContextData>;\n\n /**\n * An event handler for an undoing of an emoji reaction to a message.\n * @since 0.2.0\n */\n onUnreact?: UndoneReactionEventHandler<TContextData>;\n\n /**\n * An event handler for a vote in a poll. This event is only triggered when\n * the bot is the author of the poll, and the vote is made by another actor.\n * If the poll allows multiple selections, this event is triggered multiple\n * times, once for each option selected by the actor.\n *\n * Note that this event can be triggered even if the voter vote an option\n * multiple times or multiple options for a poll that disallows multiple\n * selections. You should validate the vote in the event handler by storing\n * the votes in a persistent store, and checking if the vote is valid.\n * (This behavior can subject to change in the future.)\n * @since 0.3.0\n */\n onVote?: VoteEventHandler<TContextData>;\n}\n\n/**\n * A read-only view of a bot actor's identity and profile. It is exposed\n * through {@link Session.bot} so that event handlers can tell which bot they\n * are running as without being able to mutate the bot (e.g. reassign its\n * event handlers).\n * @since 0.5.0\n */\nexport interface ReadonlyBot {\n /**\n * The internal identifier for the bot actor. It is used for the actor URI.\n */\n readonly identifier: string;\n\n /**\n * The username of the bot. It is a part of the fediverse handle.\n */\n readonly username: string;\n\n /**\n * The display name of the bot.\n */\n readonly name?: string;\n\n /**\n * The type of the bot actor. It is either `Service` or `Application`.\n */\n readonly class: typeof Service | typeof Application;\n\n /**\n * The avatar URL of the bot.\n */\n readonly icon?: URL | Image;\n\n /**\n * The header image URL of the bot.\n */\n readonly image?: URL | Image;\n\n /**\n * How the bot handles incoming follow requests.\n */\n readonly followerPolicy: \"accept\" | \"reject\" | \"manual\";\n}\n\n/**\n * A bot that can interact with the ActivityPub network.\n */\nexport interface Bot<TContextData> extends BotEventHandlers<TContextData> {\n /**\n * An internal Fedify federation instance. Normally you don't need to access\n * this directly.\n */\n readonly federation: Federation<TContextData>;\n\n /**\n * The internal identifier for the bot actor. It is used for the actor URI.\n */\n readonly identifier: string;\n\n /**\n * Gets a new session to control the bot for a specific origin and context\n * data.\n * @param origin The origin of the session. Even if a URL with some path or\n * query is passed, only the origin part will be used.\n * @param contextData The context data to pass to the federation.\n * @returns The session for the origin and context data.\n */\n getSession(\n origin: string | URL,\n contextData: TContextData,\n ): Session<TContextData>;\n\n /**\n * Gets a new session to control bot for a specific Fedify context.\n * @param context The Fedify context of the session.\n * @returns The session for the Fedify context.\n */\n getSession(context: Context<TContextData>): Session<TContextData>;\n\n /**\n * The fetch API for handling HTTP requests. You can pass this to an HTTP\n * server (e.g., `Deno.serve()`, `Bun.serve()`) to handle incoming requests.\n * @param request The request to handle.\n * @param contextData The context data to pass to the federation.\n * @returns The response to the request.\n */\n fetch(request: Request, contextData: TContextData): Promise<Response>;\n\n /**\n * Defines custom emojis for the bot. The custom emojis are used for\n * rendering the bot's profile and posts. The custom emojis are defined\n * by their names, and the names are used as the keys of the emojis.\n * @param emojis The custom emojis to define. The keys are the names of\n * the emojis, and the values are the custom emoji definitions.\n * @returns The defined emojis. The keys are the names of the emojis, and\n * the values are the emoji objects, which are used for passing\n * to the {@link customEmoji} function.\n * @throws {TypeError} If any emoji name is invalid or duplicate.\n * @since 0.2.0\n */\n addCustomEmojis<TEmojiName extends string>(\n emojis: Readonly<Record<TEmojiName, CustomEmoji>>,\n ): Readonly<Record<TEmojiName, DeferredCustomEmoji<TContextData>>>;\n}\n\n/**\n * A specialized {@link Bot} tpe that doesn't require context data.\n */\nexport interface BotWithVoidContextData extends Bot<void> {\n /**\n * Gets a new session to control the bot for a specific origin and context\n * data.\n * @param origin The origin of the session. Even if a URL with some path or\n * query is passed, only the origin part will be used.\n * @param contextData The context data to pass to the federation.\n * @returns The session for the origin and context data.\n */\n getSession(\n origin: string | URL,\n contextData: void,\n ): Session<void>;\n\n /**\n * Gets a new session to control bot for a specific Fedify context.\n * @param context The Fedify context of the session.\n * @returns The session for the Fedify context.\n */\n getSession(context: Context<void>): Session<void>;\n\n /**\n * Gets a new session to control the bot for a specific origin and context\n * data.\n * @param origin The origin of the session. Even if a URL with some path or\n * query is passed, only the origin part will be used.\n */\n getSession(origin: string | URL): Session<void>;\n\n /**\n * The fetch API for handling HTTP requests. You can pass this to an HTTP\n * server (e.g., `Deno.serve()`, `Bun.serve()`) to handle incoming requests.\n * @param request The request to handle.\n * @returns The response to the request.\n */\n fetch(request: Request): Promise<Response>;\n}\n\n/**\n * Options for creating a bot.\n */\nexport interface CreateBotOptions<TContextData> {\n /**\n * The internal identifier of the bot. Since it is used for the actor URI,\n * it *should not* be changed after the bot is federated.\n *\n * If omitted, `\"bot\"` will be used.\n * @default `\"bot\"`\n */\n readonly identifier?: string;\n\n /**\n * The type of the bot actor. It should be either `Service` or `Application`.\n *\n * If omitted, `Service` will be used.\n * @default `Service`\n */\n readonly class?: typeof Service | typeof Application;\n\n /**\n * The username of the bot. It will be a part of the fediverse handle.\n * It can be changed after the bot is federated.\n */\n readonly username: string;\n\n /**\n * The display name of the bot. It can be changed after the bot is federated.\n */\n readonly name?: string;\n\n /**\n * The description of the bot. It can be changed after the bot is federated.\n */\n readonly summary?: Text<\"block\", TContextData>;\n\n /**\n * The avatar URL of the bot. It can be changed after the bot is federated.\n */\n readonly icon?: URL | Image;\n\n /**\n * The header image URL of the bot. It can be changed after the bot is\n * federated.\n */\n readonly image?: URL | Image;\n\n /**\n * The custom properties of the bot. It can be changed after the bot is\n * federated.\n */\n readonly properties?: Record<string, Text<\"block\" | \"inline\", TContextData>>;\n\n /**\n * How to handle incoming follow requests. Note that this behavior can be\n * overridden by manually invoking {@link FollowRequest.accept} or\n * {@link FollowRequest.reject} in the {@link Bot.onFollow} event handler.\n *\n * - `\"accept\"` (default): Automatically accept all incoming follow requests.\n * - `\"reject\"`: Automatically reject all incoming follow requests.\n * - `\"manual\"`: Require manual handling of incoming follow requests.\n * @default `\"accept\"`\n */\n readonly followerPolicy?: \"accept\" | \"reject\" | \"manual\";\n\n /**\n * The underlying key-value store to use for storing data.\n */\n readonly kv: KvStore;\n\n /**\n * The underlying repository to use for storing data. If omitted,\n * {@link KvRepository} will be used.\n */\n readonly repository?: Repository;\n\n /**\n * The underlying message queue to use for handling incoming and outgoing\n * activities. If omitted, incoming activities are processed immediately,\n * and outgoing activities are sent immediately.\n */\n readonly queue?: MessageQueue;\n\n /**\n * The software information of the bot. If omitted, the NodeInfo protocol\n * will be unimplemented.\n */\n readonly software?: Software;\n\n /**\n * Whether to trust `X-Forwarded-*` headers. If your bot application is\n * behind an L7 reverse proxy, turn it on.\n *\n * Turned off by default.\n * @default `false`\n */\n readonly behindProxy?: boolean;\n\n /**\n * The options for the web pages of the bot. If omitted, the default options\n * will be used.\n */\n readonly pages?: PagesOptions;\n}\n\n/**\n * Options for the web pages of the bot.\n */\nexport interface PagesOptions {\n /**\n * The color of the theme. It will be used for the theme color of the web\n * pages. The default color is `\"green\"`.\n * @default `\"green\"`\n */\n readonly color?:\n | \"amber\"\n | \"azure\"\n | \"blue\"\n | \"cyan\"\n | \"fuchsia\"\n | \"green\"\n | \"grey\"\n | \"indigo\"\n | \"jade\"\n | \"lime\"\n | \"orange\"\n | \"pink\"\n | \"pumpkin\"\n | \"purple\"\n | \"red\"\n | \"sand\"\n | \"slate\"\n | \"violet\"\n | \"yellow\"\n | \"zinc\";\n\n /**\n * The CSS code for the bot. It will be used for the custom CSS of the web\n * pages.\n */\n readonly css?: string;\n}\n\n/**\n * Creates a {@link Bot} instance.\n * @param options The options for creating the bot.\n * @returns The created bot instance.\n */\nexport function createBot<TContextData = void>(\n options: CreateBotOptions<TContextData>,\n): TContextData extends void ? BotWithVoidContextData : Bot<TContextData> {\n const bot = new BotImpl<TContextData>(options);\n // @ts-ignore: the wrapper implements BotWithVoidContextData\n return wrapBotImpl(bot);\n}\n"],"mappings":";;;;;;;;;;;;;AAmbA,SAAgB,UACdA,SACwE;CACxE,MAAM,MAAM,IAAI,QAAsB;AAEtC,QAAO,YAAY,IAAI;AACxB"}
package/dist/bot.test.js CHANGED
@@ -2,6 +2,7 @@
2
2
  import { Temporal, toTemporalInstant } from "@js-temporal/polyfill";
3
3
  Date.prototype.toTemporalInstant = toTemporalInstant;
4
4
 
5
+ import { MemoryRepository } from "./repository.js";
5
6
  import { createBot } from "./bot.js";
6
7
  import { MemoryKvStore } from "@fedify/fedify/federation";
7
8
  import assert from "node:assert";
@@ -75,6 +76,64 @@ test("createBot()", async () => {
75
76
  subject: "acct:bot@example.com"
76
77
  });
77
78
  });
79
+ test("Session.bot is a ReadonlyBot", () => {
80
+ const bot = createBot({
81
+ kv: new MemoryKvStore(),
82
+ username: "readonlybot"
83
+ });
84
+ const session = bot.getSession("https://example.com");
85
+ const view = session.bot;
86
+ assert.deepStrictEqual(view.identifier, "bot");
87
+ assert.deepStrictEqual(view.username, "readonlybot");
88
+ assert.deepStrictEqual(view.followerPolicy, "accept");
89
+ session.bot.onMention = void 0;
90
+ session.bot.repository;
91
+ });
92
+ test("createBot() adopts legacy repository data", async () => {
93
+ const kv = new MemoryKvStore();
94
+ const messageId = "01941f29-7c00-7fe8-ab0a-7b593990a3c0";
95
+ await kv.set(["_botkit", "messages"], [messageId]);
96
+ await kv.set([
97
+ "_botkit",
98
+ "messages",
99
+ messageId
100
+ ], {
101
+ "@context": "https://www.w3.org/ns/activitystreams",
102
+ type: "Create",
103
+ id: `https://example.com/ap/create/${messageId}`,
104
+ actor: "https://example.com/ap/actor/bot",
105
+ object: {
106
+ type: "Note",
107
+ id: `https://example.com/ap/note/${messageId}`,
108
+ content: "Hello, world!"
109
+ }
110
+ });
111
+ const bot = createBot({
112
+ kv,
113
+ username: "bot"
114
+ });
115
+ const { impl } = bot;
116
+ assert.deepStrictEqual(await impl.repository.countMessages(), 1);
117
+ });
118
+ test("createBot() runs Repository.migrate() once", async () => {
119
+ class MigratingMemoryRepository extends MemoryRepository {
120
+ migrated = [];
121
+ migrate(identifier) {
122
+ this.migrated.push(identifier);
123
+ return Promise.resolve();
124
+ }
125
+ }
126
+ const repository = new MigratingMemoryRepository();
127
+ const bot = createBot({
128
+ kv: new MemoryKvStore(),
129
+ repository,
130
+ username: "bot"
131
+ });
132
+ const { impl } = bot;
133
+ await impl.repository.countMessages();
134
+ await impl.repository.countFollowers();
135
+ assert.deepStrictEqual(repository.migrated, ["bot"]);
136
+ });
78
137
 
79
138
  //#endregion
80
139
  //# sourceMappingURL=bot.test.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"bot.test.js","names":["_session: Session<void>","_followRequest: FollowRequest","_follower: Actor","_accepter: Actor","_rejecter: Actor","_message: Message<MessageClass, void>","_message: SharedMessage<MessageClass, void>","_like: Like<void>"],"sources":["../src/bot.test.ts"],"sourcesContent":["// BotKit by Fedify: A framework for creating ActivityPub bots\n// Copyright (C) 2025–2026 Hong Minhee <https://hongminhee.org/>\n//\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU Affero General Public License as\n// published by the Free Software Foundation, either version 3 of the\n// License, or (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU Affero General Public License for more details.\n//\n// You should have received a copy of the GNU Affero General Public License\n// along with this program. If not, see <https://www.gnu.org/licenses/>.\nimport { MemoryKvStore } from \"@fedify/fedify/federation\";\nimport type { Actor } from \"@fedify/vocab\";\nimport assert from \"node:assert\";\nimport { test } from \"node:test\";\nimport type { BotImpl } from \"./bot-impl.ts\";\nimport { createBot } from \"./bot.ts\";\nimport type { FollowRequest } from \"./follow.ts\";\nimport type { Message, MessageClass, SharedMessage } from \"./message.ts\";\nimport type { Like } from \"./reaction.ts\";\nimport type { Session } from \"./session.ts\";\n\ntest(\"createBot()\", async () => {\n const kv = new MemoryKvStore();\n const bot = createBot<void>({ kv, identifier: \"bot-id\", username: \"bot\" });\n const { impl } = bot as unknown as { impl: BotImpl<void> };\n const _federation = bot.federation;\n assert.strictEqual(bot.identifier, \"bot-id\");\n const session = bot.getSession(\"https://example.com\");\n assert.strictEqual(session.actorHandle, \"@bot@example.com\");\n\n function onFollow(_session: Session<void>, _followRequest: FollowRequest) {}\n bot.onFollow = onFollow;\n assert.strictEqual(bot.onFollow, onFollow);\n assert.strictEqual(impl.onFollow, onFollow);\n\n function onUnfollow(_session: Session<void>, _follower: Actor) {}\n bot.onUnfollow = onUnfollow;\n assert.strictEqual(bot.onUnfollow, onUnfollow);\n assert.strictEqual(impl.onUnfollow, onUnfollow);\n\n function onAcceptFollow(_session: Session<void>, _accepter: Actor) {}\n bot.onAcceptFollow = onAcceptFollow;\n assert.strictEqual(bot.onAcceptFollow, onAcceptFollow);\n assert.strictEqual(impl.onAcceptFollow, onAcceptFollow);\n\n function onRejectFollow(_session: Session<void>, _rejecter: Actor) {}\n bot.onRejectFollow = onRejectFollow;\n assert.strictEqual(bot.onRejectFollow, onRejectFollow);\n assert.strictEqual(impl.onRejectFollow, onRejectFollow);\n\n function onMention(\n _session: Session<void>,\n _message: Message<MessageClass, void>,\n ) {}\n bot.onMention = onMention;\n assert.strictEqual(bot.onMention, onMention);\n assert.strictEqual(impl.onMention, onMention);\n\n function onReply(\n _session: Session<void>,\n _message: Message<MessageClass, void>,\n ) {}\n bot.onReply = onReply;\n assert.strictEqual(bot.onReply, onReply);\n assert.strictEqual(impl.onReply, onReply);\n\n function onMessage(\n _session: Session<void>,\n _message: Message<MessageClass, void>,\n ) {}\n bot.onMessage = onMessage;\n assert.strictEqual(bot.onMessage, onMessage);\n assert.strictEqual(impl.onMessage, onMessage);\n\n function onSharedMessage(\n _session: Session<void>,\n _message: SharedMessage<MessageClass, void>,\n ) {}\n bot.onSharedMessage = onSharedMessage;\n assert.strictEqual(bot.onSharedMessage, onSharedMessage);\n assert.strictEqual(impl.onSharedMessage, onSharedMessage);\n\n function onLike(_session: Session<void>, _like: Like<void>) {}\n bot.onLike = onLike;\n assert.strictEqual(bot.onLike, onLike);\n assert.strictEqual(impl.onLike, onLike);\n\n function onUnlike(_session: Session<void>, _like: Like<void>) {}\n bot.onUnlike = onUnlike;\n assert.strictEqual(bot.onUnlike, onUnlike);\n assert.strictEqual(impl.onUnlike, onUnlike);\n\n const response = await bot.fetch(\n new Request(\n \"https://example.com/.well-known/webfinger?resource=acct:bot@example.com\",\n ),\n );\n assert.strictEqual(response.status, 200);\n assert.deepStrictEqual(await response.json(), {\n aliases: [\n \"https://example.com/ap/actor/bot-id\",\n ],\n links: [\n {\n href: \"https://example.com/ap/actor/bot-id\",\n rel: \"self\",\n type: \"application/activity+json\",\n },\n {\n href: \"https://example.com/\",\n rel: \"http://webfinger.net/rel/profile-page\",\n },\n ],\n subject: \"acct:bot@example.com\",\n });\n});\n"],"mappings":";;;;;;;;;;AA0BA,KAAK,eAAe,YAAY;CAC9B,MAAM,KAAK,IAAI;CACf,MAAM,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IAAI,iBAAiB,gBAAgB;AACxD,QAAO,YAAY,KAAK,iBAAiB,gBAAgB;CAEzD,SAAS,OAAON,UAAyBO,OAAmB,CAAE;AAC9D,KAAI,SAAS;AACb,QAAO,YAAY,IAAI,QAAQ,OAAO;AACtC,QAAO,YAAY,KAAK,QAAQ,OAAO;CAEvC,SAAS,SAASP,UAAyBO,OAAmB,CAAE;AAChE,KAAI,WAAW;AACf,QAAO,YAAY,IAAI,UAAU,SAAS;AAC1C,QAAO,YAAY,KAAK,UAAU,SAAS;CAE3C,MAAM,WAAW,MAAM,IAAI,MACzB,IAAI,QACF,2EAEH;AACD,QAAO,YAAY,SAAS,QAAQ,IAAI;AACxC,QAAO,gBAAgB,MAAM,SAAS,MAAM,EAAE;EAC5C,SAAS,CACP,qCACD;EACD,OAAO,CACL;GACE,MAAM;GACN,KAAK;GACL,MAAM;EACP,GACD;GACE,MAAM;GACN,KAAK;EACN,CACF;EACD,SAAS;CACV,EAAC;AACH,EAAC"}
1
+ {"version":3,"file":"bot.test.js","names":["_session: Session<void>","_followRequest: FollowRequest","_follower: Actor","_accepter: Actor","_rejecter: Actor","_message: Message<MessageClass, void>","_message: SharedMessage<MessageClass, void>","_like: Like<void>","view: ReadonlyBot","identifier: string"],"sources":["../src/bot.test.ts"],"sourcesContent":["// BotKit by Fedify: A framework for creating ActivityPub bots\n// Copyright (C) 2025–2026 Hong Minhee <https://hongminhee.org/>\n//\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU Affero General Public License as\n// published by the Free Software Foundation, either version 3 of the\n// License, or (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU Affero General Public License for more details.\n//\n// You should have received a copy of the GNU Affero General Public License\n// along with this program. If not, see <https://www.gnu.org/licenses/>.\nimport { MemoryKvStore } from \"@fedify/fedify/federation\";\nimport type { Actor } from \"@fedify/vocab\";\nimport assert from \"node:assert\";\nimport { test } from \"node:test\";\nimport type { BotImpl } from \"./bot-impl.ts\";\nimport { MemoryRepository } from \"./repository.ts\";\nimport { createBot, type ReadonlyBot } from \"./bot.ts\";\nimport type { FollowRequest } from \"./follow.ts\";\nimport type { Message, MessageClass, SharedMessage } from \"./message.ts\";\nimport type { Like } from \"./reaction.ts\";\nimport type { Session } from \"./session.ts\";\n\ntest(\"createBot()\", async () => {\n const kv = new MemoryKvStore();\n const bot = createBot<void>({ kv, identifier: \"bot-id\", username: \"bot\" });\n const { impl } = bot as unknown as { impl: BotImpl<void> };\n const _federation = bot.federation;\n assert.strictEqual(bot.identifier, \"bot-id\");\n const session = bot.getSession(\"https://example.com\");\n assert.strictEqual(session.actorHandle, \"@bot@example.com\");\n\n function onFollow(_session: Session<void>, _followRequest: FollowRequest) {}\n bot.onFollow = onFollow;\n assert.strictEqual(bot.onFollow, onFollow);\n assert.strictEqual(impl.onFollow, onFollow);\n\n function onUnfollow(_session: Session<void>, _follower: Actor) {}\n bot.onUnfollow = onUnfollow;\n assert.strictEqual(bot.onUnfollow, onUnfollow);\n assert.strictEqual(impl.onUnfollow, onUnfollow);\n\n function onAcceptFollow(_session: Session<void>, _accepter: Actor) {}\n bot.onAcceptFollow = onAcceptFollow;\n assert.strictEqual(bot.onAcceptFollow, onAcceptFollow);\n assert.strictEqual(impl.onAcceptFollow, onAcceptFollow);\n\n function onRejectFollow(_session: Session<void>, _rejecter: Actor) {}\n bot.onRejectFollow = onRejectFollow;\n assert.strictEqual(bot.onRejectFollow, onRejectFollow);\n assert.strictEqual(impl.onRejectFollow, onRejectFollow);\n\n function onMention(\n _session: Session<void>,\n _message: Message<MessageClass, void>,\n ) {}\n bot.onMention = onMention;\n assert.strictEqual(bot.onMention, onMention);\n assert.strictEqual(impl.onMention, onMention);\n\n function onReply(\n _session: Session<void>,\n _message: Message<MessageClass, void>,\n ) {}\n bot.onReply = onReply;\n assert.strictEqual(bot.onReply, onReply);\n assert.strictEqual(impl.onReply, onReply);\n\n function onMessage(\n _session: Session<void>,\n _message: Message<MessageClass, void>,\n ) {}\n bot.onMessage = onMessage;\n assert.strictEqual(bot.onMessage, onMessage);\n assert.strictEqual(impl.onMessage, onMessage);\n\n function onSharedMessage(\n _session: Session<void>,\n _message: SharedMessage<MessageClass, void>,\n ) {}\n bot.onSharedMessage = onSharedMessage;\n assert.strictEqual(bot.onSharedMessage, onSharedMessage);\n assert.strictEqual(impl.onSharedMessage, onSharedMessage);\n\n function onLike(_session: Session<void>, _like: Like<void>) {}\n bot.onLike = onLike;\n assert.strictEqual(bot.onLike, onLike);\n assert.strictEqual(impl.onLike, onLike);\n\n function onUnlike(_session: Session<void>, _like: Like<void>) {}\n bot.onUnlike = onUnlike;\n assert.strictEqual(bot.onUnlike, onUnlike);\n assert.strictEqual(impl.onUnlike, onUnlike);\n\n const response = await bot.fetch(\n new Request(\n \"https://example.com/.well-known/webfinger?resource=acct:bot@example.com\",\n ),\n );\n assert.strictEqual(response.status, 200);\n assert.deepStrictEqual(await response.json(), {\n aliases: [\n \"https://example.com/ap/actor/bot-id\",\n ],\n links: [\n {\n href: \"https://example.com/ap/actor/bot-id\",\n rel: \"self\",\n type: \"application/activity+json\",\n },\n {\n href: \"https://example.com/\",\n rel: \"http://webfinger.net/rel/profile-page\",\n },\n ],\n subject: \"acct:bot@example.com\",\n });\n});\n\ntest(\"Session.bot is a ReadonlyBot\", () => {\n const bot = createBot<void>({\n kv: new MemoryKvStore(),\n username: \"readonlybot\",\n });\n const session = bot.getSession(\"https://example.com\");\n const view: ReadonlyBot = session.bot;\n assert.deepStrictEqual(view.identifier, \"bot\");\n assert.deepStrictEqual(view.username, \"readonlybot\");\n assert.deepStrictEqual(view.followerPolicy, \"accept\");\n\n // Event handlers must not be reachable through the session's bot view:\n // @ts-expect-error: ReadonlyBot does not expose event handlers.\n session.bot.onMention = undefined;\n // @ts-expect-error: ReadonlyBot does not expose the repository.\n session.bot.repository;\n});\n\ntest(\"createBot() adopts legacy repository data\", async () => {\n const kv = new MemoryKvStore();\n // Simulates the unscoped key layout of BotKit 0.4 and earlier:\n const messageId = \"01941f29-7c00-7fe8-ab0a-7b593990a3c0\";\n await kv.set([\"_botkit\", \"messages\"], [messageId]);\n await kv.set([\"_botkit\", \"messages\", messageId], {\n \"@context\": \"https://www.w3.org/ns/activitystreams\",\n type: \"Create\",\n id: `https://example.com/ap/create/${messageId}`,\n actor: \"https://example.com/ap/actor/bot\",\n object: {\n type: \"Note\",\n id: `https://example.com/ap/note/${messageId}`,\n content: \"Hello, world!\",\n },\n });\n const bot = createBot<void>({ kv, username: \"bot\" });\n const { impl } = bot as unknown as { impl: BotImpl<void> };\n // The legacy message is adopted before the first repository operation:\n assert.deepStrictEqual(await impl.repository.countMessages(), 1);\n});\n\ntest(\"createBot() runs Repository.migrate() once\", async () => {\n class MigratingMemoryRepository extends MemoryRepository {\n migrated: string[] = [];\n migrate(identifier: string): Promise<void> {\n this.migrated.push(identifier);\n return Promise.resolve();\n }\n }\n const repository = new MigratingMemoryRepository();\n const bot = createBot<void>({\n kv: new MemoryKvStore(),\n repository,\n username: \"bot\",\n });\n const { impl } = bot as unknown as { impl: BotImpl<void> };\n await impl.repository.countMessages();\n await impl.repository.countFollowers();\n assert.deepStrictEqual(repository.migrated, [\"bot\"]);\n});\n"],"mappings":";;;;;;;;;;;AA2BA,KAAK,eAAe,YAAY;CAC9B,MAAM,KAAK,IAAI;CACf,MAAM,MAAM,UAAgB;EAAE;EAAI,YAAY;EAAU,UAAU;CAAO,EAAC;CAC1E,MAAM,EAAE,MAAM,GAAG;CACjB,MAAM,cAAc,IAAI;AACxB,QAAO,YAAY,IAAI,YAAY,SAAS;CAC5C,MAAM,UAAU,IAAI,WAAW,sBAAsB;AACrD,QAAO,YAAY,QAAQ,aAAa,mBAAmB;CAE3D,SAAS,SAASA,UAAyBC,gBAA+B,CAAE;AAC5E,KAAI,WAAW;AACf,QAAO,YAAY,IAAI,UAAU,SAAS;AAC1C,QA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AAQ,SAAS;EACzB;CACF;CACD,MAAM,aAAa,IAAI;CACvB,MAAM,MAAM,UAAgB;EAC1B,IAAI,IAAI;EACR;EACA,UAAU;CACX,EAAC;CACF,MAAM,EAAE,MAAM,GAAG;AACjB,OAAM,KAAK,WAAW,eAAe;AACrC,OAAM,KAAK,WAAW,gBAAgB;AACtC,QAAO,gBAAgB,WAAW,UAAU,CAAC,KAAM,EAAC;AACrD,EAAC"}
@@ -6,9 +6,11 @@ import * as hono_jsx_jsx_dev_runtime0 from "hono/jsx/jsx-dev-runtime";
6
6
  //#region src/components/FollowButton.d.ts
7
7
  interface FollowButtonProps {
8
8
  readonly bot: BotImpl<unknown>;
9
+ readonly action?: string;
9
10
  }
10
11
  declare function FollowButton({
11
- bot
12
+ bot,
13
+ action
12
14
  }: FollowButtonProps): hono_jsx_jsx_dev_runtime0.JSX.Element;
13
15
  //# sourceMappingURL=FollowButton.d.ts.map
14
16
 
@@ -1 +1 @@
1
- {"version":3,"file":"FollowButton.d.ts","names":[],"sources":["../../src/components/FollowButton.tsx"],"sourcesContent":[],"mappings":";;;;;;UAGiB,iBAAA;gBACD;;iBAGA,YAAA;;GAAsB,oBAAiB,yBAAA,CAAA,GAAA,CAAA"}
1
+ {"version":3,"file":"FollowButton.d.ts","names":[],"sources":["../../src/components/FollowButton.tsx"],"sourcesContent":[],"mappings":";;;;;;UAGiB,iBAAA;gBACD;;;iBAIA,YAAA;;;GAA8B,oBAAiB,yBAAA,CAAA,GAAA,CAAA"}
@@ -5,7 +5,7 @@
5
5
  import { Fragment, jsx, jsxs } from "hono/jsx/jsx-runtime";
6
6
 
7
7
  //#region src/components/FollowButton.tsx
8
- function FollowButton({ bot }) {
8
+ function FollowButton({ bot, action }) {
9
9
  return /* @__PURE__ */ jsxs(Fragment, { children: [
10
10
  /* @__PURE__ */ jsx("button", {
11
11
  id: "follow-btn",
@@ -27,7 +27,7 @@ function FollowButton({ bot }) {
27
27
  onclick: "closeFollowModal()"
28
28
  })]
29
29
  }), /* @__PURE__ */ jsxs("main", { children: [/* @__PURE__ */ jsx("p", { children: "Enter your fediverse handle to follow this account:" }), /* @__PURE__ */ jsxs("form", {
30
- action: "/follow",
30
+ action: action ?? "/follow",
31
31
  method: "post",
32
32
  children: [/* @__PURE__ */ jsx("input", {
33
33
  type: "text",
@@ -1 +1 @@
1
- {"version":3,"file":"FollowButton.js","names":[],"sources":["../../src/components/FollowButton.tsx"],"sourcesContent":["/** @jsxImportSource hono/jsx */\nimport type { BotImpl } from \"../bot-impl.ts\";\n\nexport interface FollowButtonProps {\n readonly bot: BotImpl<unknown>;\n}\n\nexport function FollowButton({ bot }: FollowButtonProps) {\n return (\n <>\n <button\n id=\"follow-btn\"\n type=\"button\"\n style=\"padding: 0.5rem 1rem; background: var(--pico-primary); color: var(--pico-primary-inverse); border: none; border-radius: 0.25rem; cursor: pointer;\"\n onclick=\"showFollowModal()\"\n >\n Follow\n </button>\n <dialog id=\"follow-modal\">\n <article style=\"width: 400px;\">\n <header style=\"display: flex; align-items: center; justify-content:space-between\">\n <h3>Follow {bot.name ?? bot.username}</h3>\n <button\n aria-label=\"Close\"\n rel=\"prev\"\n type=\"button\"\n onclick=\"closeFollowModal()\"\n />\n </header>\n <main>\n <p>Enter your fediverse handle to follow this account:</p>\n <form action=\"/follow\" method=\"post\">\n <input\n type=\"text\"\n id=\"fediverse-handle\"\n name=\"handle\"\n placeholder=\"@username@instance.com\"\n required\n style=\"width: 100%; margin-bottom: 1rem;\"\n />\n <button type=\"submit\" style=\"width: 100%;\">\n Follow\n </button>\n </form>\n </main>\n </article>\n </dialog>\n <script\n dangerouslySetInnerHTML={{\n __html: `\n function showFollowModal() {\n document.getElementById('follow-modal').showModal();\n }\n \n function closeFollowModal() {\n document.getElementById('follow-modal').close();\n }\n `,\n }}\n />\n </>\n );\n}\n"],"mappings":";;;;;;;AAOA,SAAgB,aAAa,EAAE,KAAwB,EAAE;AACvD,wBACE;kBACE,IAAC;GACC,IAAG;GACH,MAAK;GACL,OAAM;GACN,SAAQ;aACT;IAEQ;kBACT,IAAC;GAAO,IAAG;6BACT,KAAC;IAAQ,OAAM;+BACb,KAAC;KAAO,OAAM;gCACZ,KAAC,mBAAG,WAAQ,IAAI,QAAQ,IAAI,YAAc,kBAC1C,IAAC;MACC,cAAW;MACX,KAAI;MACJ,MAAK;MACL,SAAQ;OACR;MACK,kBACT,KAAC,qCACC,IAAC,iBAAE,wDAAuD,kBAC1D,KAAC;KAAK,QAAO;KAAU,QAAO;gCAC5B,IAAC;MACC,MAAK;MACL,IAAG;MACH,MAAK;MACL,aAAY;MACZ;MACA,OAAM;OACN,kBACF,IAAC;MAAO,MAAK;MAAS,OAAM;gBAAe;OAElC;MACJ,IACF;KACC;IACH;kBACT,IAAC,YACC,yBAAyB,EACvB,SAAS;;;;;;;;UASV,IACD;KACD;AAEN"}
1
+ {"version":3,"file":"FollowButton.js","names":[],"sources":["../../src/components/FollowButton.tsx"],"sourcesContent":["/** @jsxImportSource hono/jsx */\nimport type { BotImpl } from \"../bot-impl.ts\";\n\nexport interface FollowButtonProps {\n readonly bot: BotImpl<unknown>;\n readonly action?: string;\n}\n\nexport function FollowButton({ bot, action }: FollowButtonProps) {\n return (\n <>\n <button\n id=\"follow-btn\"\n type=\"button\"\n style=\"padding: 0.5rem 1rem; background: var(--pico-primary); color: var(--pico-primary-inverse); border: none; border-radius: 0.25rem; cursor: pointer;\"\n onclick=\"showFollowModal()\"\n >\n Follow\n </button>\n <dialog id=\"follow-modal\">\n <article style=\"width: 400px;\">\n <header style=\"display: flex; align-items: center; justify-content:space-between\">\n <h3>Follow {bot.name ?? bot.username}</h3>\n <button\n aria-label=\"Close\"\n rel=\"prev\"\n type=\"button\"\n onclick=\"closeFollowModal()\"\n />\n </header>\n <main>\n <p>Enter your fediverse handle to follow this account:</p>\n <form action={action ?? \"/follow\"} method=\"post\">\n <input\n type=\"text\"\n id=\"fediverse-handle\"\n name=\"handle\"\n placeholder=\"@username@instance.com\"\n required\n style=\"width: 100%; margin-bottom: 1rem;\"\n />\n <button type=\"submit\" style=\"width: 100%;\">\n Follow\n </button>\n </form>\n </main>\n </article>\n </dialog>\n <script\n dangerouslySetInnerHTML={{\n __html: `\n function showFollowModal() {\n document.getElementById('follow-modal').showModal();\n }\n \n function closeFollowModal() {\n document.getElementById('follow-modal').close();\n }\n `,\n }}\n />\n </>\n );\n}\n"],"mappings":";;;;;;;AAQA,SAAgB,aAAa,EAAE,KAAK,QAA2B,EAAE;AAC/D,wBACE;kBACE,IAAC;GACC,IAAG;GACH,MAAK;GACL,OAAM;GACN,SAAQ;aACT;IAEQ;kBACT,IAAC;GAAO,IAAG;6BACT,KAAC;IAAQ,OAAM;+BACb,KAAC;KAAO,OAAM;gCACZ,KAAC,mBAAG,WAAQ,IAAI,QAAQ,IAAI,YAAc,kBAC1C,IAAC;MACC,cAAW;MACX,KAAI;MACJ,MAAK;MACL,SAAQ;OACR;MACK,kBACT,KAAC,qCACC,IAAC,iBAAE,wDAAuD,kBAC1D,KAAC;KAAK,QAAQ,UAAU;KAAW,QAAO;gCACxC,IAAC;MACC,MAAK;MACL,IAAG;MACH,MAAK;MACL,aAAY;MACZ;MACA,OAAM;OACN,kBACF,IAAC;MAAO,MAAK;MAAS,OAAM;gBAAe;OAElC;MACJ,IACF;KACC;IACH;kBACT,IAAC,YACC,yBAAyB,EACvB,SAAS;;;;;;;;UASV,IACD;KACD;AAEN"}
@@ -27,7 +27,7 @@ function Layout({ bot, host, title, activityLink, feedLink, children }) {
27
27
  rel: "stylesheet",
28
28
  href: `https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/${cssFilename}`
29
29
  }),
30
- /* @__PURE__ */ jsx("style", { children: bot.pages.css })
30
+ /* @__PURE__ */ jsx("style", { dangerouslySetInnerHTML: { __html: bot.pages.css } })
31
31
  ] }), /* @__PURE__ */ jsx("body", { children })] });
32
32
  }
33
33
 
@@ -1 +1 @@
1
- {"version":3,"file":"Layout.js","names":[],"sources":["../../src/components/Layout.tsx"],"sourcesContent":["// BotKit by Fedify: A framework for creating ActivityPub bots\n// Copyright (C) 2025–2026 Hong Minhee <https://hongminhee.org/>\n//\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU Affero General Public License as\n// published by the Free Software Foundation, either version 3 of the\n// License, or (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU Affero General Public License for more details.\n//\n// You should have received a copy of the GNU Affero General Public License\n// along with this program. If not, see <https://www.gnu.org/licenses/>.\n/** @jsx react-jsx */\n/** @jsxImportSource hono/jsx */\nimport type { JSX } from \"hono/jsx/jsx-runtime\";\nimport type { BotImpl } from \"../bot-impl.ts\";\n\nexport interface LayoutProps extends JSX.ElementChildrenAttribute {\n readonly bot: BotImpl<unknown>;\n readonly host: string;\n readonly title?: string;\n readonly activityLink?: string | URL;\n readonly feedLink?: string | URL;\n}\n\nexport function Layout(\n { bot, host, title, activityLink, feedLink, children }: LayoutProps,\n) {\n const handle = `@${bot.username}@${host}`;\n const cssFilename = bot.pages.color === \"azure\"\n ? `pico.min.css`\n : `pico.${bot.pages.color}.min.css`;\n return (\n <html>\n <head>\n <meta charset=\"utf-8\" />\n <title>\n {title != null && `${title} — `}\n {bot.name == null ? handle : `${bot.name} (${handle})`}\n </title>\n {activityLink &&\n (\n <link\n rel=\"alternate\"\n type=\"application/activity+json\"\n href={activityLink.toString()}\n title=\"ActivityPub\"\n />\n )}\n {feedLink && (\n <link\n rel=\"alternate\"\n type=\"application/atom+xml\"\n href={feedLink.toString()}\n title=\"Atom feed\"\n />\n )}\n <link\n rel=\"stylesheet\"\n href={`https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/${cssFilename}`}\n />\n <style>{bot.pages.css}</style>\n </head>\n <body>\n {children}\n </body>\n </html>\n );\n}\n"],"mappings":";;;;;;;AA4BA,SAAgB,OACd,EAAE,KAAK,MAAM,OAAO,cAAc,UAAU,UAAuB,EACnE;CACA,MAAM,UAAU,GAAG,IAAI,SAAS,GAAG,KAAK;CACxC,MAAM,cAAc,IAAI,MAAM,UAAU,WACnC,iBACA,OAAO,IAAI,MAAM,MAAM;AAC5B,wBACE,KAAC,qCACC,KAAC;kBACC,IAAC,UAAK,SAAQ,UAAU;kBACxB,KAAC,sBACE,SAAS,SAAS,EAAE,MAAM,MAC1B,IAAI,QAAQ,OAAO,UAAU,EAAE,IAAI,KAAK,IAAI,OAAO,MAC9C;EACP,gCAEG,IAAC;GACC,KAAI;GACJ,MAAK;GACL,MAAM,aAAa,UAAU;GAC7B,OAAM;IACN;EAEL,4BACC,IAAC;GACC,KAAI;GACJ,MAAK;GACL,MAAM,SAAS,UAAU;GACzB,OAAM;IACN;kBAEJ,IAAC;GACC,KAAI;GACJ,OAAO,mDAAmD,YAAY;IACtE;kBACF,IAAC,qBAAO,IAAI,MAAM,MAAY;KACzB,kBACP,IAAC,UACE,WACI,IACF;AAEV"}
1
+ {"version":3,"file":"Layout.js","names":[],"sources":["../../src/components/Layout.tsx"],"sourcesContent":["// BotKit by Fedify: A framework for creating ActivityPub bots\n// Copyright (C) 2025–2026 Hong Minhee <https://hongminhee.org/>\n//\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU Affero General Public License as\n// published by the Free Software Foundation, either version 3 of the\n// License, or (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU Affero General Public License for more details.\n//\n// You should have received a copy of the GNU Affero General Public License\n// along with this program. If not, see <https://www.gnu.org/licenses/>.\n/** @jsx react-jsx */\n/** @jsxImportSource hono/jsx */\nimport type { JSX } from \"hono/jsx/jsx-runtime\";\nimport type { BotImpl } from \"../bot-impl.ts\";\n\nexport interface LayoutProps extends JSX.ElementChildrenAttribute {\n readonly bot: BotImpl<unknown>;\n readonly host: string;\n readonly title?: string;\n readonly activityLink?: string | URL;\n readonly feedLink?: string | URL;\n}\n\nexport function Layout(\n { bot, host, title, activityLink, feedLink, children }: LayoutProps,\n) {\n const handle = `@${bot.username}@${host}`;\n const cssFilename = bot.pages.color === \"azure\"\n ? `pico.min.css`\n : `pico.${bot.pages.color}.min.css`;\n return (\n <html>\n <head>\n <meta charset=\"utf-8\" />\n <title>\n {title != null && `${title} — `}\n {bot.name == null ? handle : `${bot.name} (${handle})`}\n </title>\n {activityLink &&\n (\n <link\n rel=\"alternate\"\n type=\"application/activity+json\"\n href={activityLink.toString()}\n title=\"ActivityPub\"\n />\n )}\n {feedLink && (\n <link\n rel=\"alternate\"\n type=\"application/atom+xml\"\n href={feedLink.toString()}\n title=\"Atom feed\"\n />\n )}\n <link\n rel=\"stylesheet\"\n href={`https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/${cssFilename}`}\n />\n <style dangerouslySetInnerHTML={{ __html: bot.pages.css }} />\n </head>\n <body>\n {children}\n </body>\n </html>\n );\n}\n"],"mappings":";;;;;;;AA4BA,SAAgB,OACd,EAAE,KAAK,MAAM,OAAO,cAAc,UAAU,UAAuB,EACnE;CACA,MAAM,UAAU,GAAG,IAAI,SAAS,GAAG,KAAK;CACxC,MAAM,cAAc,IAAI,MAAM,UAAU,WACnC,iBACA,OAAO,IAAI,MAAM,MAAM;AAC5B,wBACE,KAAC,qCACC,KAAC;kBACC,IAAC,UAAK,SAAQ,UAAU;kBACxB,KAAC,sBACE,SAAS,SAAS,EAAE,MAAM,MAC1B,IAAI,QAAQ,OAAO,UAAU,EAAE,IAAI,KAAK,IAAI,OAAO,MAC9C;EACP,gCAEG,IAAC;GACC,KAAI;GACJ,MAAK;GACL,MAAM,aAAa,UAAU;GAC7B,OAAM;IACN;EAEL,4BACC,IAAC;GACC,KAAI;GACJ,MAAK;GACL,MAAM,SAAS,UAAU;GACzB,OAAM;IACN;kBAEJ,IAAC;GACC,KAAI;GACJ,OAAO,mDAAmD,YAAY;IACtE;kBACF,IAAC,WAAM,yBAAyB,EAAE,QAAQ,IAAI,MAAM,IAAK,IAAI;KACxD,kBACP,IAAC,UACE,WACI,IACF;AAEV"}
@@ -2,7 +2,7 @@ import { Temporal, toTemporalInstant } from "@js-temporal/polyfill";
2
2
  Date.prototype.toTemporalInstant = toTemporalInstant;
3
3
  import { MessageClass } from "../message.js";
4
4
  import { Session } from "../session.js";
5
- import * as hono_utils_html3 from "hono/utils/html";
5
+ import * as hono_utils_html4 from "hono/utils/html";
6
6
 
7
7
  //#region src/components/Message.d.ts
8
8
  interface MessageProps {
@@ -12,7 +12,7 @@ interface MessageProps {
12
12
  declare function Message({
13
13
  session,
14
14
  message
15
- }: MessageProps): Promise<hono_utils_html3.HtmlEscapedString>;
15
+ }: MessageProps): Promise<hono_utils_html4.HtmlEscapedString>;
16
16
  declare function renderCustomEmojis(html: string, emojis: Record<string, string>): string;
17
17
  //# sourceMappingURL=Message.d.ts.map
18
18
 
package/dist/deno.js CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  //#region deno.json
6
6
  var name = "@fedify/botkit";
7
- var version = "0.5.0-dev.210+b2371c7b";
7
+ var version = "0.5.0-dev.226+7cde32c7";
8
8
  var license = "AGPL-3.0-only";
9
9
  var exports = {
10
10
  ".": "./src/mod.ts",
@@ -12,6 +12,7 @@ var exports = {
12
12
  "./emoji": "./src/emoji.ts",
13
13
  "./events": "./src/events.ts",
14
14
  "./follow": "./src/follow.ts",
15
+ "./instance": "./src/instance.ts",
15
16
  "./message": "./src/message.ts",
16
17
  "./poll": "./src/poll.ts",
17
18
  "./reaction": "./src/reaction.ts",
@@ -43,16 +44,6 @@ var fmt = { "exclude": [
43
44
  "*.yml",
44
45
  "src/static/*.ts"
45
46
  ] };
46
- var tasks = {
47
- "test": "deno test --allow-env=NODE_V8_COVERAGE,JEST_WORKER_ID --allow-net=hollo.social --parallel",
48
- "test:node": "pnpm install && pnpm test",
49
- "test-all": { "dependencies": [
50
- "check",
51
- "test",
52
- "test:node"
53
- ] },
54
- "coverage": "deno task test --coverage --clean && deno coverage --html"
55
- };
56
47
  var deno_default = {
57
48
  name,
58
49
  version,
@@ -60,8 +51,7 @@ var deno_default = {
60
51
  exports,
61
52
  imports,
62
53
  exclude,
63
- fmt,
64
- tasks
54
+ fmt
65
55
  };
66
56
 
67
57
  //#endregion