jeo-code 0.12.7 → 0.12.8

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.
@@ -0,0 +1,82 @@
1
+ export type MessengerPlatform = "discord" | "telegram" | "slack";
2
+
3
+ export interface MessengerMessage {
4
+ platform: MessengerPlatform;
5
+ accountId: string;
6
+ channelId: string;
7
+ senderId: string;
8
+ messageId: string;
9
+ text: string;
10
+ /** Discord guild snowflake. Absent for DMs. */
11
+ guildId?: string;
12
+ threadId?: string;
13
+ /** Platform-level conversation identifier when the conversation is not a Discord thread. */
14
+ conversationId?: string;
15
+ parentChannelId?: string;
16
+ direct: boolean;
17
+ mentioned: boolean;
18
+ attachments?: { url: string; filename: string; size: number }[];
19
+ }
20
+
21
+ /** Report a short, human-readable description of the work in progress. */
22
+ export type MessengerActivityReporter = (text: string) => void;
23
+
24
+ export interface MessengerAdapter {
25
+ platform: MessengerPlatform;
26
+ start(onMessage: (message: MessengerMessage) => Promise<void>, signal: AbortSignal): Promise<void>;
27
+ send(message: MessengerMessage, text: string, signal?: AbortSignal): Promise<void>;
28
+ prepare?(message: MessengerMessage, signal?: AbortSignal): Promise<MessengerMessage>;
29
+ status?(
30
+ message: MessengerMessage,
31
+ status: "processing" | "success" | "failure",
32
+ signal?: AbortSignal,
33
+ ): Promise<void>;
34
+ /**
35
+ * Show `text` (one sanitized line) as the request's single in-progress status, editing it in place on
36
+ * later calls; `undefined` removes it. The gateway serializes and throttles calls per request.
37
+ */
38
+ activity?(message: MessengerMessage, text: string | undefined, signal?: AbortSignal): Promise<void>;
39
+ }
40
+
41
+ export interface MessengerPlatformConfig {
42
+ tokenEnv: string;
43
+ appTokenEnv?: string;
44
+ allowedUserIds: string[];
45
+ allowedChannelIds?: string[];
46
+ /** Dedicated operator-approved directory for Discord output files. */
47
+ artifactDir?: string;
48
+ }
49
+
50
+ export interface MessengerConfig {
51
+ cwd: string;
52
+ sessionDir: string;
53
+ toolNames: string[];
54
+ platforms: Partial<Record<MessengerPlatform, MessengerPlatformConfig>>;
55
+ }
56
+
57
+ export interface MessengerTransportDeps {
58
+ fetch?: typeof fetch;
59
+ WebSocket?: typeof WebSocket;
60
+ }
61
+
62
+ export type MessengerReply = (
63
+ message: MessengerMessage,
64
+ signal: AbortSignal,
65
+ onActivity?: MessengerActivityReporter,
66
+ ) => Promise<string>;
67
+
68
+ /** A partially initialized runtime must not be retried inside a live gateway. */
69
+ export class MessengerFatalError extends Error {
70
+ constructor() {
71
+ super("Messenger session initialization failed; restart required");
72
+ this.name = "MessengerFatalError";
73
+ }
74
+ }
75
+
76
+ export function isRecord(value: unknown): value is Record<string, unknown> {
77
+ return typeof value === "object" && value !== null && !Array.isArray(value);
78
+ }
79
+
80
+ export function isEnoent(error: unknown): boolean {
81
+ return isRecord(error) && error.code === "ENOENT";
82
+ }
@@ -50,6 +50,7 @@ export const SLASH_COMMAND_DETAILS: readonly SlashCommandInfo[] = [
50
50
  { command: "/subagent", usage: "/subagent [role]", description: "Show the current subagent composition (per-role model · thinking · steps); alias of /agents", group: "subagents" },
51
51
  { command: "/view", usage: "/view <file> [a-b]", description: "Render a file with line numbers + light highlight", group: "code" },
52
52
  { command: "/diff", usage: "/diff [file]", description: "Render `git diff` with +/- coloring", group: "code" },
53
+ { command: "/discord", usage: "/discord relay <allowed-channel-id|off> | control on --allow-full-control | control off", description: "Control Discord session access or local response relay", group: "session" },
53
54
  { command: "/find", usage: "/find <glob>", description: "List files matching a glob", group: "code" },
54
55
  { command: "/search", usage: "/search <pat> [glob]", description: "Search the repo for a pattern", group: "code" },
55
56
 
@@ -332,4 +333,3 @@ export function tabCompleteSelection(line: string, matches: readonly string[], s
332
333
  const pick = matches[selected >= 0 && selected < matches.length ? selected : 0]!;
333
334
  return line.slice(0, trigger.start) + `${pick} `;
334
335
  }
335
-