@tomradex/plugin-sdk 0.2.18 → 0.2.24

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/dist/im.d.ts CHANGED
@@ -65,6 +65,20 @@ export type ImInbound = {
65
65
  });
66
66
  /** How an adapter writes formatted text. `markdown` passes the common layer's Markdown through unchanged. */
67
67
  export type ImMarkdownDialect = "plain" | "markdown" | "slack" | "telegram-html" | "discord" | "lark" | "dingtalk" | "wecom";
68
+ /** SDK 0.2.20. */
69
+ export interface ImLink {
70
+ label: Localized;
71
+ url: string;
72
+ }
73
+ /** SDK 0.2.20. Something on a connection the person has to fix, such as a permission the bot lacks. */
74
+ export interface ImNotice {
75
+ /** Said once per key, until `clearNotice` withdraws it. */
76
+ key: string;
77
+ text: Localized;
78
+ /** The conversation it happened in hears one line; when it cannot, the paired people's direct chats do. */
79
+ address?: ImAddress;
80
+ link?: ImLink;
81
+ }
68
82
  export interface ImButton {
69
83
  label: string;
70
84
  token: string;
@@ -185,6 +199,41 @@ export interface ImAdapterSession {
185
199
  id: string;
186
200
  name?: string;
187
201
  };
202
+ /**
203
+ * SDK 0.2.20. Links the person may need once the connection is up, such as
204
+ * the one that adds the bot to a server; shown on the connection and in the
205
+ * pairing reply. Older hosts ignore them.
206
+ */
207
+ links?: ImLink[];
208
+ /**
209
+ * SDK 0.2.24. A conversation's name as the platform shows it (`#tomrade-work`, a group's title), for Settings to
210
+ * show instead of its id; null when it has none or the bot may not see it. Older hosts never ask.
211
+ */
212
+ describe?(address: ImAddress): Promise<{
213
+ name?: string;
214
+ } | null>;
215
+ /**
216
+ * SDK 0.2.19. Topics the bot opens itself, when `topics`: one per ticket
217
+ * being worked in a group conversation. Messages people write in one arrive
218
+ * with its `topicId`.
219
+ */
220
+ topics?: {
221
+ open(command: {
222
+ operationId: string;
223
+ address: ImAddress;
224
+ title: string;
225
+ }): Promise<{
226
+ topicId: string;
227
+ }>;
228
+ /** Renames it, and closes it out of the way or opens it again. */
229
+ update(command: {
230
+ address: ImAddress & {
231
+ topicId: string;
232
+ };
233
+ title: string;
234
+ closed: boolean;
235
+ }): Promise<void>;
236
+ };
188
237
  close(): void | Promise<void>;
189
238
  }
190
239
  /** SDK 0.2.5. One value a person copies from the platform's developer console. */
@@ -210,6 +259,11 @@ export interface ImAdapterSetup {
210
259
  text: string;
211
260
  };
212
261
  docsUrl?: string;
262
+ /**
263
+ * SDK 0.2.22. How to start using the connected bot in a group or server, in order; Markdown. Settings shows them
264
+ * under the connection, then what each kind of channel does. Without them it shows generic steps.
265
+ */
266
+ groupSteps?: Localized[];
213
267
  }
214
268
  /** What the platform can do. Fields marked 0.2.5 are optional; leaving them out declares the 0.2.2 behaviour. */
215
269
  export interface ImCapabilities {
@@ -221,6 +275,8 @@ export interface ImCapabilities {
221
275
  maxFileBytes: number;
222
276
  /** SDK 0.2.5. Replies can go into a thread under the triggering message. */
223
277
  threads?: boolean;
278
+ /** SDK 0.2.19. The bot opens a topic per ticket in a group, through `session.topics`. */
279
+ topics?: boolean;
224
280
  reactions?: boolean;
225
281
  typing?: boolean;
226
282
  /** `native`: session.stream. `edit`: throttled edits of one message. `none`: only the final message. */
@@ -254,6 +310,7 @@ export declare const ImCapabilitiesSchema: z.ZodObject<{
254
310
  maxTextLength: z.ZodNumber;
255
311
  maxFileBytes: z.ZodNumber;
256
312
  threads: z.ZodOptional<z.ZodBoolean>;
313
+ topics: z.ZodOptional<z.ZodBoolean>;
257
314
  reactions: z.ZodOptional<z.ZodBoolean>;
258
315
  typing: z.ZodOptional<z.ZodBoolean>;
259
316
  stream: z.ZodOptional<z.ZodEnum<{
@@ -305,6 +362,28 @@ export interface ImAdapter {
305
362
  status(state: ImConnectionState, detail?: string): void;
306
363
  /** Reads only handles explicitly included in a delivery for this connection. */
307
364
  readOutboundFile(id: string): Promise<Uint8Array>;
365
+ /** SDK 0.2.20, absent on older hosts. Shows a notice on the connection and tells it where it happened. */
366
+ notice?(notice: ImNotice): void;
367
+ /** SDK 0.2.20, absent on older hosts. The notice's cause is gone; the same key may be said again. */
368
+ clearNotice?(key: string): void;
369
+ /** SDK 0.2.21, absent on older hosts. The projects a person paired on this connection may give a conversation, the one they used last first; none for anyone else. */
370
+ projects?(actorId: string): {
371
+ id: string;
372
+ name: string;
373
+ }[];
374
+ /**
375
+ * SDK 0.2.21, absent on older hosts. For an adapter's own setup: a paired person makes a group conversation a
376
+ * work channel (a thread per ticket), a status channel (news only) or a chat channel of the project, as the card
377
+ * in a group with no route does, and the conversation is told. One already allowed is left as it is. False when
378
+ * they may not.
379
+ */
380
+ allow?(request: {
381
+ actorId: string;
382
+ address: ImAddress;
383
+ kind: "work" | "status" | "chat";
384
+ projectId: string; /** SDK 0.2.24. The conversation's name, when the adapter knows it. */
385
+ name?: string;
386
+ }): boolean;
308
387
  }): Promise<ImAdapterSession>;
309
388
  }
310
389
  export interface ImApi {
package/dist/im.js CHANGED
@@ -10,6 +10,7 @@ export const ImCapabilitiesSchema = z.object({
10
10
  maxTextLength: z.number().int().min(128),
11
11
  maxFileBytes: z.number().int().min(0),
12
12
  threads: z.boolean().optional(),
13
+ topics: z.boolean().optional(),
13
14
  reactions: z.boolean().optional(),
14
15
  typing: z.boolean().optional(),
15
16
  stream: z.enum(["native", "edit", "none"]).optional(),
@@ -28,6 +29,7 @@ export function resolveImCapabilities(caps) {
28
29
  return {
29
30
  ...parsed,
30
31
  threads: parsed.threads ?? false,
32
+ topics: parsed.topics ?? false,
31
33
  reactions: parsed.reactions ?? false,
32
34
  typing: parsed.typing ?? false,
33
35
  stream: parsed.stream ?? "none",
@@ -222,9 +222,14 @@ export interface LocalAgentAcp<O> {
222
222
  efforts?: string[];
223
223
  /** The agent's own words for a turn it ended on "refusal". */
224
224
  failure?(response: Record<string, any>): string | undefined;
225
- /** Its CLI can also be handed a ticket in a terminal. */
226
- terminal?: boolean;
227
- /** In a terminal it reaches Tomrade only through its user-level connection (`mcpLink`). */
225
+ /**
226
+ * Its CLI can also be handed a ticket in a terminal. SDK 0.2.23: `{ via: "link" }` says it reaches Tomrade
227
+ * there only through its user-level connection (`mcpLink`); absent `via` is `"session"`.
228
+ */
229
+ terminal?: boolean | {
230
+ via?: "session" | "link";
231
+ };
232
+ /** @deprecated since SDK 0.2.23: `terminal: { via: "link" }`. Still read, for plugins built before it. */
228
233
  terminalViaLink?: boolean;
229
234
  }
230
235
  /**
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
2
  /** The contract this SDK describes. A plugin's `engines.sdk` range is checked against the host's. */
3
- export declare const SDK_CONTRACT = "0.2.18";
3
+ export declare const SDK_CONTRACT = "0.2.24";
4
4
  export declare const PLUGIN_ID: RegExp;
5
5
  export declare const NAMESPACE: RegExp;
6
6
  /** The app's own names, and the official publisher's. */
package/dist/manifest.js CHANGED
@@ -2,7 +2,7 @@ import { z } from "zod";
2
2
  import { LANGUAGE_PACK_LIMITS, LanguageEntrySchema } from "./language.js";
3
3
  import { isRange, isVersion } from "./semver.js";
4
4
  /** The contract this SDK describes. A plugin's `engines.sdk` range is checked against the host's. */
5
- export const SDK_CONTRACT = "0.2.18";
5
+ export const SDK_CONTRACT = "0.2.24";
6
6
  export const PLUGIN_ID = /^[a-z0-9][a-z0-9-]{0,38}\/[a-z0-9][a-z0-9-]{0,63}$/;
7
7
  export const NAMESPACE = /^[a-z][a-z0-9_]{1,31}$/;
8
8
  /** The app's own names, and the official publisher's. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tomradex/plugin-sdk",
3
- "version": "0.2.18",
3
+ "version": "0.2.24",
4
4
  "type": "module",
5
5
  "author": "Haoyuan Tang",
6
6
  "engines": {
@@ -29,7 +29,7 @@
29
29
  "dist"
30
30
  ],
31
31
  "dependencies": {
32
- "@tomradex/domain": "0.2.18",
32
+ "@tomradex/domain": "0.2.24",
33
33
  "zod": "^4.4.3"
34
34
  }
35
35
  }