@mattstack/rt-client 0.6.2 → 0.7.0
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 +2 -2
- package/dist/client.d.ts +17 -0
- package/dist/commands.d.ts +25 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +17 -1
- package/package.json +1 -1
- package/src/client.ts +24 -2
- package/src/commands.ts +7 -1
- package/src/index.ts +2 -0
package/README.md
CHANGED
|
@@ -100,8 +100,8 @@ const stop = createRelay({ // one daemon sub
|
|
|
100
100
|
| --- | --- |
|
|
101
101
|
| `chatSignIn` / `chatSignOut` / `chatAway` / `chatBack` / `chatPulse` | presence: the buddy-list row and its heartbeats |
|
|
102
102
|
| `chatBuddies` / `chatWho` / `chatRooms` | the roster, one room's members, a handle's rooms |
|
|
103
|
-
| `chatJoin` / `chatLeave` | membership (`wakeOn: mention \| all \| none`) |
|
|
104
|
-
| `chatPost` / `chatDm` / `chatRead` / `chatMessages` / `chatMark` | messages: post, DM, read-and-advance, page, advance the cursor |
|
|
103
|
+
| `chatJoin` / `chatLeave` / `chatArchive` | membership (`wakeOn: mention \| all \| none`); archive parks a room for everyone until a post revives it |
|
|
104
|
+
| `chatPost` / `chatDm` / `chatDmOpen` / `chatRead` / `chatMessages` / `chatMark` | messages: post, DM, open a DM room without posting, read-and-advance, page, advance the cursor |
|
|
105
105
|
| `chatArm` / `chatTouch` / `chatDisarm` / `chatUnreadWaking` | the tail's wake protocol; the CLI's `rt chat tail` uses these |
|
|
106
106
|
| `paneList` / `panePeek` / `paneSpawn` / `paneAccounts` / `paneDirectories` | herdr panes: list with presence joined, peek a screen, start claude in a tab, cswap accounts, directory suggestions |
|
|
107
107
|
| `chatInvite` | type `/chat:join <room>` into a pane; `accepted`, `queued` or `refused` |
|
package/dist/client.d.ts
CHANGED
|
@@ -76,6 +76,7 @@ export declare function chatRead(a: {
|
|
|
76
76
|
}>>;
|
|
77
77
|
export declare function chatRooms(a: {
|
|
78
78
|
handle: string;
|
|
79
|
+
includeArchived?: boolean;
|
|
79
80
|
}, o?: RtClientOptions): Promise<RtResponse<{
|
|
80
81
|
rooms: RoomSummary[];
|
|
81
82
|
}>>;
|
|
@@ -171,6 +172,22 @@ export declare function chatDm(a: {
|
|
|
171
172
|
id: number;
|
|
172
173
|
recipients: string[];
|
|
173
174
|
}>>;
|
|
175
|
+
export declare function chatArchive(a: {
|
|
176
|
+
room: string;
|
|
177
|
+
handle: string;
|
|
178
|
+
archived: boolean;
|
|
179
|
+
}, o?: RtClientOptions): Promise<RtResponse<{
|
|
180
|
+
room: string;
|
|
181
|
+
archivedAt: number | null;
|
|
182
|
+
}>>;
|
|
183
|
+
export declare function chatDmOpen(a: {
|
|
184
|
+
from: string;
|
|
185
|
+
to: string;
|
|
186
|
+
sessionId?: string;
|
|
187
|
+
}, o?: RtClientOptions): Promise<RtResponse<{
|
|
188
|
+
room: string;
|
|
189
|
+
created: boolean;
|
|
190
|
+
}>>;
|
|
174
191
|
export declare function eventsHead(o?: RtClientOptions): Promise<RtResponse<{
|
|
175
192
|
cursor: number;
|
|
176
193
|
}>>;
|
package/dist/commands.d.ts
CHANGED
|
@@ -129,6 +129,8 @@ export interface RoomSummary {
|
|
|
129
129
|
};
|
|
130
130
|
/** Set only by chat:rooms's left join against chat_room_defaults; undefined for a room never stamped a default (every DM room included). */
|
|
131
131
|
defaultWake?: WakeMode;
|
|
132
|
+
/** Set only when chat:rooms was asked for archived rooms; absent on an open room. */
|
|
133
|
+
archivedAt?: number;
|
|
132
134
|
}
|
|
133
135
|
/**
|
|
134
136
|
* Duplicated shape on purpose, same reasoning as ChatMember/ChatMessage
|
|
@@ -471,6 +473,7 @@ export interface Commands {
|
|
|
471
473
|
"chat:rooms": {
|
|
472
474
|
payload: {
|
|
473
475
|
handle: string;
|
|
476
|
+
includeArchived?: boolean;
|
|
474
477
|
};
|
|
475
478
|
data: {
|
|
476
479
|
rooms: RoomSummary[];
|
|
@@ -611,6 +614,28 @@ export interface Commands {
|
|
|
611
614
|
recipients: string[];
|
|
612
615
|
};
|
|
613
616
|
};
|
|
617
|
+
"chat:archive": {
|
|
618
|
+
payload: {
|
|
619
|
+
room: string;
|
|
620
|
+
handle: string;
|
|
621
|
+
archived: boolean;
|
|
622
|
+
};
|
|
623
|
+
data: {
|
|
624
|
+
room: string;
|
|
625
|
+
archivedAt: number | null;
|
|
626
|
+
};
|
|
627
|
+
};
|
|
628
|
+
"chat:dm-open": {
|
|
629
|
+
payload: {
|
|
630
|
+
from: string;
|
|
631
|
+
to: string;
|
|
632
|
+
sessionId?: string;
|
|
633
|
+
};
|
|
634
|
+
data: {
|
|
635
|
+
room: string;
|
|
636
|
+
created: boolean;
|
|
637
|
+
};
|
|
638
|
+
};
|
|
614
639
|
"agent:start": {
|
|
615
640
|
payload: {
|
|
616
641
|
repo: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { rtCommand, DEFAULT_SOCK } from "./transport.ts";
|
|
2
2
|
export type { RtResponse, RtClientOptions } from "./transport.ts";
|
|
3
|
-
export { readProjectMRs, readDiscussions, readMrsByBranch, readBranchCache, resolveForgeToken, listRuns, getRun, abandonRun, chatJoin, chatLeave, chatPost, chatRead, chatRooms, chatWho, chatMark, chatMessages, chatArm, chatTouch, chatDisarm, chatUnreadWaking, chatSignIn, chatSignOut, chatAway, chatBack, chatBuddies, chatPulse, chatDm, eventsHead, agentStart, agentResume, agentGet, agentList, paneList, panePeek, paneSpawn, paneAccounts, paneDirectories, chatInvite, } from "./client.ts";
|
|
3
|
+
export { readProjectMRs, readDiscussions, readMrsByBranch, readBranchCache, resolveForgeToken, listRuns, getRun, abandonRun, chatJoin, chatLeave, chatPost, chatRead, chatRooms, chatWho, chatMark, chatMessages, chatArm, chatTouch, chatDisarm, chatUnreadWaking, chatSignIn, chatSignOut, chatAway, chatBack, chatBuddies, chatPulse, chatDm, chatArchive, chatDmOpen, eventsHead, agentStart, agentResume, agentGet, agentList, paneList, panePeek, paneSpawn, paneAccounts, paneDirectories, chatInvite, } from "./client.ts";
|
|
4
4
|
export { COMMAND_NAMES } from "./commands.ts";
|
|
5
5
|
export type { Discussion, DemandDecl, ProjectMRsScope, ProjectMRsData, DiscussionsData, MrByBranchEntry, MrByBranchData, BranchEnrichment, Commands, CommandName, ForgeSlug, ForgeTokenData, Attention, RunSummary, RunStageRow, RunFieldRow, RunDecisionRow, RunDetail, WakeMode, ChatMember, ChatMessage, RoomSummary, BuddyStatus, PresenceRow, AgentRecord, AgentSurface, AgentStatus, ChatPane, PaneAccount, PaneDirectory, InviteResult, } from "./commands.ts";
|
|
6
6
|
export { subscribe, createRelay, DEFAULT_WS_URL } from "./relay.ts";
|
package/dist/index.js
CHANGED
|
@@ -95,7 +95,10 @@ function chatRead(a, o = {}) {
|
|
|
95
95
|
return rtCommand("chat:read", payload, { sockPath: o.sockPath, timeoutMs: o.timeoutMs ?? 1e4 });
|
|
96
96
|
}
|
|
97
97
|
function chatRooms(a, o = {}) {
|
|
98
|
-
|
|
98
|
+
const payload = { handle: a.handle };
|
|
99
|
+
if (a.includeArchived === true)
|
|
100
|
+
payload.includeArchived = true;
|
|
101
|
+
return rtCommand("chat:rooms", payload, { sockPath: o.sockPath, timeoutMs: o.timeoutMs ?? 1e4 });
|
|
99
102
|
}
|
|
100
103
|
function chatWho(a, o = {}) {
|
|
101
104
|
return rtCommand("chat:who", { room: a.room }, { sockPath: o.sockPath, timeoutMs: o.timeoutMs ?? 1e4 });
|
|
@@ -186,6 +189,15 @@ function chatDm(a, o = {}) {
|
|
|
186
189
|
payload.sessionId = a.sessionId;
|
|
187
190
|
return rtCommand("chat:dm", payload, { sockPath: o.sockPath, timeoutMs: o.timeoutMs ?? 1e4 });
|
|
188
191
|
}
|
|
192
|
+
function chatArchive(a, o = {}) {
|
|
193
|
+
return rtCommand("chat:archive", { room: a.room, handle: a.handle, archived: a.archived }, { sockPath: o.sockPath, timeoutMs: o.timeoutMs ?? 1e4 });
|
|
194
|
+
}
|
|
195
|
+
function chatDmOpen(a, o = {}) {
|
|
196
|
+
const payload = { from: a.from, to: a.to };
|
|
197
|
+
if (a.sessionId !== undefined)
|
|
198
|
+
payload.sessionId = a.sessionId;
|
|
199
|
+
return rtCommand("chat:dm-open", payload, { sockPath: o.sockPath, timeoutMs: o.timeoutMs ?? 1e4 });
|
|
200
|
+
}
|
|
189
201
|
function eventsHead(o = {}) {
|
|
190
202
|
return rtCommand("events:head", {}, { sockPath: o.sockPath, timeoutMs: o.timeoutMs ?? 1e4 });
|
|
191
203
|
}
|
|
@@ -280,6 +292,8 @@ var COMMAND_NAMES = [
|
|
|
280
292
|
"chat:buddies",
|
|
281
293
|
"chat:pulse",
|
|
282
294
|
"chat:dm",
|
|
295
|
+
"chat:archive",
|
|
296
|
+
"chat:dm-open",
|
|
283
297
|
"agent:start",
|
|
284
298
|
"agent:resume",
|
|
285
299
|
"agent:get",
|
|
@@ -1772,12 +1786,14 @@ export {
|
|
|
1772
1786
|
chatLeave,
|
|
1773
1787
|
chatJoin,
|
|
1774
1788
|
chatInvite,
|
|
1789
|
+
chatDmOpen,
|
|
1775
1790
|
chatDm,
|
|
1776
1791
|
chatDisarm,
|
|
1777
1792
|
chatBuddies,
|
|
1778
1793
|
chatBack,
|
|
1779
1794
|
chatAway,
|
|
1780
1795
|
chatArm,
|
|
1796
|
+
chatArchive,
|
|
1781
1797
|
allDefs,
|
|
1782
1798
|
agentStart,
|
|
1783
1799
|
agentResume,
|
package/package.json
CHANGED
package/src/client.ts
CHANGED
|
@@ -186,10 +186,12 @@ export function chatRead(
|
|
|
186
186
|
}
|
|
187
187
|
|
|
188
188
|
export function chatRooms(
|
|
189
|
-
a: { handle: string },
|
|
189
|
+
a: { handle: string; includeArchived?: boolean },
|
|
190
190
|
o: RtClientOptions = {},
|
|
191
191
|
): Promise<RtResponse<{ rooms: RoomSummary[] }>> {
|
|
192
|
-
|
|
192
|
+
const payload: Record<string, unknown> = { handle: a.handle };
|
|
193
|
+
if (a.includeArchived === true) payload.includeArchived = true;
|
|
194
|
+
return rtCommand<{ rooms: RoomSummary[] }>("chat:rooms", payload, { sockPath: o.sockPath, timeoutMs: o.timeoutMs ?? 10_000 });
|
|
193
195
|
}
|
|
194
196
|
|
|
195
197
|
export function chatWho(
|
|
@@ -323,6 +325,26 @@ export function chatDm(
|
|
|
323
325
|
return rtCommand<{ room: string; id: number; recipients: string[] }>("chat:dm", payload, { sockPath: o.sockPath, timeoutMs: o.timeoutMs ?? 10_000 });
|
|
324
326
|
}
|
|
325
327
|
|
|
328
|
+
export function chatArchive(
|
|
329
|
+
a: { room: string; handle: string; archived: boolean },
|
|
330
|
+
o: RtClientOptions = {},
|
|
331
|
+
): Promise<RtResponse<{ room: string; archivedAt: number | null }>> {
|
|
332
|
+
return rtCommand<{ room: string; archivedAt: number | null }>(
|
|
333
|
+
"chat:archive",
|
|
334
|
+
{ room: a.room, handle: a.handle, archived: a.archived },
|
|
335
|
+
{ sockPath: o.sockPath, timeoutMs: o.timeoutMs ?? 10_000 },
|
|
336
|
+
);
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
export function chatDmOpen(
|
|
340
|
+
a: { from: string; to: string; sessionId?: string },
|
|
341
|
+
o: RtClientOptions = {},
|
|
342
|
+
): Promise<RtResponse<{ room: string; created: boolean }>> {
|
|
343
|
+
const payload: Record<string, unknown> = { from: a.from, to: a.to };
|
|
344
|
+
if (a.sessionId !== undefined) payload.sessionId = a.sessionId;
|
|
345
|
+
return rtCommand<{ room: string; created: boolean }>("chat:dm-open", payload, { sockPath: o.sockPath, timeoutMs: o.timeoutMs ?? 10_000 });
|
|
346
|
+
}
|
|
347
|
+
|
|
326
348
|
export function eventsHead(o: RtClientOptions = {}): Promise<RtResponse<{ cursor: number }>> {
|
|
327
349
|
return rtCommand<{ cursor: number }>("events:head", {}, { sockPath: o.sockPath, timeoutMs: o.timeoutMs ?? 10_000 });
|
|
328
350
|
}
|
package/src/commands.ts
CHANGED
|
@@ -121,6 +121,8 @@ export interface RoomSummary {
|
|
|
121
121
|
participants?: { a: string; b: string };
|
|
122
122
|
/** Set only by chat:rooms's left join against chat_room_defaults; undefined for a room never stamped a default (every DM room included). */
|
|
123
123
|
defaultWake?: WakeMode;
|
|
124
|
+
/** Set only when chat:rooms was asked for archived rooms; absent on an open room. */
|
|
125
|
+
archivedAt?: number;
|
|
124
126
|
}
|
|
125
127
|
|
|
126
128
|
/**
|
|
@@ -283,7 +285,7 @@ export interface Commands {
|
|
|
283
285
|
"chat:leave": { payload: { room: string; handle: string }; data: Record<string, never> };
|
|
284
286
|
"chat:post": { payload: { room: string; handle: string; body: string; mentions?: string[] }; data: { id: number; recipients: string[] } };
|
|
285
287
|
"chat:read": { payload: { handle: string; room?: string; limit?: number; sinceMs?: number }; data: { rooms: { room: string; messages: ChatMessage[] }[] } };
|
|
286
|
-
"chat:rooms": { payload: { handle: string }; data: { rooms: RoomSummary[] } };
|
|
288
|
+
"chat:rooms": { payload: { handle: string; includeArchived?: boolean }; data: { rooms: RoomSummary[] } };
|
|
287
289
|
"chat:who": { payload: { room: string }; data: { members: ChatMember[] } };
|
|
288
290
|
"chat:mark": { payload: { handle: string; room?: string }; data: Record<string, never> };
|
|
289
291
|
"chat:messages": { payload: { room: string; before?: number; limit?: number }; data: { messages: ChatMessage[] } };
|
|
@@ -308,6 +310,8 @@ export interface Commands {
|
|
|
308
310
|
data: { unread: { dms: number; mentions: number; rooms: number }; status: BuddyStatus };
|
|
309
311
|
};
|
|
310
312
|
"chat:dm": { payload: { from: string; to: string; body: string; sessionId?: string }; data: { room: string; id: number; recipients: string[] } };
|
|
313
|
+
"chat:archive": { payload: { room: string; handle: string; archived: boolean }; data: { room: string; archivedAt: number | null } };
|
|
314
|
+
"chat:dm-open": { payload: { from: string; to: string; sessionId?: string }; data: { room: string; created: boolean } };
|
|
311
315
|
|
|
312
316
|
// ─── Agent handoff (rt agent) ────────────────────────────────────────────
|
|
313
317
|
"agent:start": { payload: { repo: string; cwd: string; prompt?: string; surface?: AgentSurface; model?: string; effort?: string; account?: string; label?: string; caller?: string; workspace?: string; tab?: string; extraArgs?: string }; data: AgentRecord };
|
|
@@ -359,6 +363,8 @@ export const COMMAND_NAMES: readonly CommandName[] = [
|
|
|
359
363
|
"chat:buddies",
|
|
360
364
|
"chat:pulse",
|
|
361
365
|
"chat:dm",
|
|
366
|
+
"chat:archive",
|
|
367
|
+
"chat:dm-open",
|
|
362
368
|
"agent:start",
|
|
363
369
|
"agent:resume",
|
|
364
370
|
"agent:get",
|