@mattstack/rt-client 0.7.0 → 0.9.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/dist/client.d.ts +3 -12
- package/dist/commands.d.ts +20 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +16 -6
- package/package.json +1 -1
- package/src/client.ts +18 -6
- package/src/commands.ts +10 -3
- package/src/index.ts +3 -0
package/dist/client.d.ts
CHANGED
|
@@ -121,18 +121,7 @@ export declare function chatUnreadWaking(a: {
|
|
|
121
121
|
maxId: number;
|
|
122
122
|
}[];
|
|
123
123
|
}>>;
|
|
124
|
-
export declare function chatSignIn(a:
|
|
125
|
-
sessionId: string;
|
|
126
|
-
baseHandle: string;
|
|
127
|
-
cwd?: string;
|
|
128
|
-
repo?: string;
|
|
129
|
-
branch?: string;
|
|
130
|
-
pane?: string;
|
|
131
|
-
statusText?: string;
|
|
132
|
-
}, o?: RtClientOptions): Promise<RtResponse<{
|
|
133
|
-
handle: string;
|
|
134
|
-
reclaimed: boolean;
|
|
135
|
-
}>>;
|
|
124
|
+
export declare function chatSignIn(a: Commands["chat:sign-in"]["payload"], o?: RtClientOptions): Promise<RtResponse<Commands["chat:sign-in"]["data"]>>;
|
|
136
125
|
export declare function chatSignOut(a: {
|
|
137
126
|
sessionId: string;
|
|
138
127
|
}, o?: RtClientOptions): Promise<RtResponse<Record<string, never>>>;
|
|
@@ -208,3 +197,5 @@ export declare function paneSpawn(a: Commands["pane:spawn"]["payload"], o?: RtCl
|
|
|
208
197
|
export declare function paneAccounts(o?: RtClientOptions): Promise<RtResponse<Commands["pane:accounts"]["data"]>>;
|
|
209
198
|
export declare function paneDirectories(a: Commands["pane:directories"]["payload"], o?: RtClientOptions): Promise<RtResponse<Commands["pane:directories"]["data"]>>;
|
|
210
199
|
export declare function chatInvite(a: Commands["chat:invite"]["payload"], o?: RtClientOptions): Promise<RtResponse<Commands["chat:invite"]["data"]>>;
|
|
200
|
+
/** A working target holds the connection through its prompt wait, so the budget matches chatInvite's 30s. */
|
|
201
|
+
export declare function paneSend(a: Commands["pane:send"]["payload"], o?: RtClientOptions): Promise<RtResponse<Commands["pane:send"]["data"]>>;
|
package/dist/commands.d.ts
CHANGED
|
@@ -186,6 +186,13 @@ export interface InviteResult {
|
|
|
186
186
|
delivered: "accepted" | "queued" | "refused";
|
|
187
187
|
reason?: string;
|
|
188
188
|
}
|
|
189
|
+
/** Duplicated shape on purpose: mirrors lib/daemon/inject.ts's InjectResult. */
|
|
190
|
+
export type PaneDelivery = "accepted" | "queued" | "refused";
|
|
191
|
+
export interface PaneSendResult {
|
|
192
|
+
paneId: string;
|
|
193
|
+
delivered: PaneDelivery;
|
|
194
|
+
reason?: string;
|
|
195
|
+
}
|
|
189
196
|
export type Attention = {
|
|
190
197
|
needs: boolean;
|
|
191
198
|
reason: "failed" | "stale" | "stranded" | "blocked" | null;
|
|
@@ -541,10 +548,11 @@ export interface Commands {
|
|
|
541
548
|
}[];
|
|
542
549
|
};
|
|
543
550
|
};
|
|
551
|
+
/** No `baseHandle` means "draw me a first name": the daemon picks the least recently used pool name no live session holds. */
|
|
544
552
|
"chat:sign-in": {
|
|
545
553
|
payload: {
|
|
546
554
|
sessionId: string;
|
|
547
|
-
baseHandle
|
|
555
|
+
baseHandle?: string;
|
|
548
556
|
cwd?: string;
|
|
549
557
|
repo?: string;
|
|
550
558
|
branch?: string;
|
|
@@ -553,6 +561,7 @@ export interface Commands {
|
|
|
553
561
|
};
|
|
554
562
|
data: {
|
|
555
563
|
handle: string;
|
|
564
|
+
baseHandle: string;
|
|
556
565
|
reclaimed: boolean;
|
|
557
566
|
};
|
|
558
567
|
};
|
|
@@ -658,6 +667,8 @@ export interface Commands {
|
|
|
658
667
|
id: string;
|
|
659
668
|
prompt?: string;
|
|
660
669
|
surface?: AgentSurface;
|
|
670
|
+
workspace?: string;
|
|
671
|
+
tab?: string;
|
|
661
672
|
};
|
|
662
673
|
data: AgentRecord;
|
|
663
674
|
};
|
|
@@ -729,6 +740,14 @@ export interface Commands {
|
|
|
729
740
|
ready: boolean;
|
|
730
741
|
};
|
|
731
742
|
};
|
|
743
|
+
"pane:send": {
|
|
744
|
+
payload: {
|
|
745
|
+
paneId: string;
|
|
746
|
+
text: string;
|
|
747
|
+
callerPane?: string;
|
|
748
|
+
};
|
|
749
|
+
data: PaneSendResult;
|
|
750
|
+
};
|
|
732
751
|
}
|
|
733
752
|
export type CommandName = keyof Commands;
|
|
734
753
|
export declare const COMMAND_NAMES: readonly CommandName[];
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
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, chatArchive, chatDmOpen, 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, paneSend, } from "./client.ts";
|
|
4
4
|
export { COMMAND_NAMES } from "./commands.ts";
|
|
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";
|
|
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, PaneDelivery, PaneSendResult, } from "./commands.ts";
|
|
6
6
|
export { subscribe, createRelay, DEFAULT_WS_URL } from "./relay.ts";
|
|
7
7
|
export type { RelayEventType } from "./relay.ts";
|
|
8
8
|
export { daemonHealth } from "./health.ts";
|
package/dist/index.js
CHANGED
|
@@ -146,7 +146,9 @@ function chatUnreadWaking(a, o = {}) {
|
|
|
146
146
|
return rtCommand("chat:unread-waking", payload, { sockPath: o.sockPath, timeoutMs: o.timeoutMs ?? 1e4 });
|
|
147
147
|
}
|
|
148
148
|
function chatSignIn(a, o = {}) {
|
|
149
|
-
const payload = { sessionId: a.sessionId
|
|
149
|
+
const payload = { sessionId: a.sessionId };
|
|
150
|
+
if (a.baseHandle !== undefined)
|
|
151
|
+
payload.baseHandle = a.baseHandle;
|
|
150
152
|
if (a.cwd !== undefined)
|
|
151
153
|
payload.cwd = a.cwd;
|
|
152
154
|
if (a.repo !== undefined)
|
|
@@ -211,10 +213,10 @@ function agentStart(a, o = {}) {
|
|
|
211
213
|
}
|
|
212
214
|
function agentResume(a, o = {}) {
|
|
213
215
|
const payload = { id: a.id };
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
216
|
+
for (const k of ["prompt", "surface", "workspace", "tab"]) {
|
|
217
|
+
if (a[k] !== undefined)
|
|
218
|
+
payload[k] = a[k];
|
|
219
|
+
}
|
|
218
220
|
return rtCommand("agent:resume", payload, { sockPath: o.sockPath, timeoutMs: o.timeoutMs ?? 30000 });
|
|
219
221
|
}
|
|
220
222
|
function agentGet(a, o = {}) {
|
|
@@ -259,6 +261,12 @@ function chatInvite(a, o = {}) {
|
|
|
259
261
|
payload.callerPane = a.callerPane;
|
|
260
262
|
return rtCommand("chat:invite", payload, { sockPath: o.sockPath, timeoutMs: o.timeoutMs ?? 30000 });
|
|
261
263
|
}
|
|
264
|
+
function paneSend(a, o = {}) {
|
|
265
|
+
const payload = { paneId: a.paneId, text: a.text };
|
|
266
|
+
if (a.callerPane !== undefined)
|
|
267
|
+
payload.callerPane = a.callerPane;
|
|
268
|
+
return rtCommand("pane:send", payload, { sockPath: o.sockPath, timeoutMs: o.timeoutMs ?? 30000 });
|
|
269
|
+
}
|
|
262
270
|
// src/commands.ts
|
|
263
271
|
var COMMAND_NAMES = [
|
|
264
272
|
"project-mrs:read",
|
|
@@ -303,7 +311,8 @@ var COMMAND_NAMES = [
|
|
|
303
311
|
"pane:peek",
|
|
304
312
|
"pane:accounts",
|
|
305
313
|
"pane:directories",
|
|
306
|
-
"pane:spawn"
|
|
314
|
+
"pane:spawn",
|
|
315
|
+
"pane:send"
|
|
307
316
|
];
|
|
308
317
|
// src/relay.ts
|
|
309
318
|
var DEFAULT_WS_URL = "ws://127.0.0.1:9401/ws";
|
|
@@ -1752,6 +1761,7 @@ export {
|
|
|
1752
1761
|
readBranchCache,
|
|
1753
1762
|
parseIdentity,
|
|
1754
1763
|
paneSpawn,
|
|
1764
|
+
paneSend,
|
|
1755
1765
|
panePeek,
|
|
1756
1766
|
paneList,
|
|
1757
1767
|
paneDirectories,
|
package/package.json
CHANGED
package/src/client.ts
CHANGED
|
@@ -261,16 +261,17 @@ export function chatUnreadWaking(
|
|
|
261
261
|
// ─── Presence ──────────────────────────────────────────────────────────
|
|
262
262
|
|
|
263
263
|
export function chatSignIn(
|
|
264
|
-
a:
|
|
264
|
+
a: Commands["chat:sign-in"]["payload"],
|
|
265
265
|
o: RtClientOptions = {},
|
|
266
|
-
): Promise<RtResponse<
|
|
267
|
-
const payload: Record<string, unknown> = { sessionId: a.sessionId
|
|
266
|
+
): Promise<RtResponse<Commands["chat:sign-in"]["data"]>> {
|
|
267
|
+
const payload: Record<string, unknown> = { sessionId: a.sessionId };
|
|
268
|
+
if (a.baseHandle !== undefined) payload.baseHandle = a.baseHandle;
|
|
268
269
|
if (a.cwd !== undefined) payload.cwd = a.cwd;
|
|
269
270
|
if (a.repo !== undefined) payload.repo = a.repo;
|
|
270
271
|
if (a.branch !== undefined) payload.branch = a.branch;
|
|
271
272
|
if (a.pane !== undefined) payload.pane = a.pane;
|
|
272
273
|
if (a.statusText !== undefined) payload.statusText = a.statusText;
|
|
273
|
-
return rtCommand<
|
|
274
|
+
return rtCommand<Commands["chat:sign-in"]["data"]>("chat:sign-in", payload, { sockPath: o.sockPath, timeoutMs: o.timeoutMs ?? 10_000 });
|
|
274
275
|
}
|
|
275
276
|
|
|
276
277
|
export function chatSignOut(
|
|
@@ -365,8 +366,9 @@ export function agentResume(
|
|
|
365
366
|
a: Commands["agent:resume"]["payload"], o: RtClientOptions = {},
|
|
366
367
|
): Promise<RtResponse<AgentRecord>> {
|
|
367
368
|
const payload: Record<string, unknown> = { id: a.id };
|
|
368
|
-
|
|
369
|
-
|
|
369
|
+
for (const k of ["prompt", "surface", "workspace", "tab"] as const) {
|
|
370
|
+
if (a[k] !== undefined) payload[k] = a[k];
|
|
371
|
+
}
|
|
370
372
|
return rtCommand<AgentRecord>("agent:resume", payload, { sockPath: o.sockPath, timeoutMs: o.timeoutMs ?? 30_000 });
|
|
371
373
|
}
|
|
372
374
|
|
|
@@ -422,3 +424,13 @@ export function chatInvite(
|
|
|
422
424
|
if (a.callerPane !== undefined) payload.callerPane = a.callerPane;
|
|
423
425
|
return rtCommand<Commands["chat:invite"]["data"]>("chat:invite", payload, { sockPath: o.sockPath, timeoutMs: o.timeoutMs ?? 30_000 });
|
|
424
426
|
}
|
|
427
|
+
|
|
428
|
+
/** A working target holds the connection through its prompt wait, so the budget matches chatInvite's 30s. */
|
|
429
|
+
export function paneSend(
|
|
430
|
+
a: Commands["pane:send"]["payload"],
|
|
431
|
+
o: RtClientOptions = {},
|
|
432
|
+
): Promise<RtResponse<Commands["pane:send"]["data"]>> {
|
|
433
|
+
const payload: Record<string, unknown> = { paneId: a.paneId, text: a.text };
|
|
434
|
+
if (a.callerPane !== undefined) payload.callerPane = a.callerPane;
|
|
435
|
+
return rtCommand<Commands["pane:send"]["data"]>("pane:send", payload, { sockPath: o.sockPath, timeoutMs: o.timeoutMs ?? 30_000 });
|
|
436
|
+
}
|
package/src/commands.ts
CHANGED
|
@@ -167,6 +167,10 @@ export interface PaneAccount { slot: number; email: string; alias?: string; head
|
|
|
167
167
|
export interface PaneDirectory { path: string; repo: string; branch?: string }
|
|
168
168
|
export interface InviteResult { paneId: string; delivered: "accepted" | "queued" | "refused"; reason?: string }
|
|
169
169
|
|
|
170
|
+
/** Duplicated shape on purpose: mirrors lib/daemon/inject.ts's InjectResult. */
|
|
171
|
+
export type PaneDelivery = "accepted" | "queued" | "refused";
|
|
172
|
+
export interface PaneSendResult { paneId: string; delivered: PaneDelivery; reason?: string }
|
|
173
|
+
|
|
170
174
|
// SKILLS-53: one judgment, computed once in rt, so the console and the tray
|
|
171
175
|
// never derive two verdicts that can disagree.
|
|
172
176
|
export type Attention = {
|
|
@@ -296,9 +300,10 @@ export interface Commands {
|
|
|
296
300
|
|
|
297
301
|
// A session id keys these to one signed-in handle, not a room-membership
|
|
298
302
|
// handle string.
|
|
303
|
+
/** No `baseHandle` means "draw me a first name": the daemon picks the least recently used pool name no live session holds. */
|
|
299
304
|
"chat:sign-in": {
|
|
300
|
-
payload: { sessionId: string; baseHandle
|
|
301
|
-
data: { handle: string; reclaimed: boolean };
|
|
305
|
+
payload: { sessionId: string; baseHandle?: string; cwd?: string; repo?: string; branch?: string; pane?: string; statusText?: string };
|
|
306
|
+
data: { handle: string; baseHandle: string; reclaimed: boolean };
|
|
302
307
|
};
|
|
303
308
|
"chat:sign-out": { payload: { sessionId: string }; data: Record<string, never> };
|
|
304
309
|
"chat:away": { payload: { sessionId: string; text: string }; data: Record<string, never> };
|
|
@@ -315,7 +320,7 @@ export interface Commands {
|
|
|
315
320
|
|
|
316
321
|
// ─── Agent handoff (rt agent) ────────────────────────────────────────────
|
|
317
322
|
"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 };
|
|
318
|
-
"agent:resume": { payload: { id: string; prompt?: string; surface?: AgentSurface }; data: AgentRecord };
|
|
323
|
+
"agent:resume": { payload: { id: string; prompt?: string; surface?: AgentSurface; workspace?: string; tab?: string }; data: AgentRecord };
|
|
319
324
|
"agent:get": { payload: { id: string }; data: AgentRecord };
|
|
320
325
|
"agent:list": { payload: { repo?: string }; data: { agents: AgentRecord[] } };
|
|
321
326
|
"chat:invite": { payload: { paneId: string; room: string; note?: string; from: string; callerPane?: string }; data: InviteResult };
|
|
@@ -327,6 +332,7 @@ export interface Commands {
|
|
|
327
332
|
payload: { cwd: string; account?: string; model?: string; effort?: string; prompt?: string; workspace?: string };
|
|
328
333
|
data: { pane: ChatPane; ready: boolean };
|
|
329
334
|
};
|
|
335
|
+
"pane:send": { payload: { paneId: string; text: string; callerPane?: string }; data: PaneSendResult };
|
|
330
336
|
}
|
|
331
337
|
|
|
332
338
|
export type CommandName = keyof Commands;
|
|
@@ -375,4 +381,5 @@ export const COMMAND_NAMES: readonly CommandName[] = [
|
|
|
375
381
|
"pane:accounts",
|
|
376
382
|
"pane:directories",
|
|
377
383
|
"pane:spawn",
|
|
384
|
+
"pane:send",
|
|
378
385
|
];
|
package/src/index.ts
CHANGED
|
@@ -42,6 +42,7 @@ export {
|
|
|
42
42
|
paneAccounts,
|
|
43
43
|
paneDirectories,
|
|
44
44
|
chatInvite,
|
|
45
|
+
paneSend,
|
|
45
46
|
} from "./client.ts";
|
|
46
47
|
|
|
47
48
|
export { COMMAND_NAMES } from "./commands.ts";
|
|
@@ -77,6 +78,8 @@ export type {
|
|
|
77
78
|
PaneAccount,
|
|
78
79
|
PaneDirectory,
|
|
79
80
|
InviteResult,
|
|
81
|
+
PaneDelivery,
|
|
82
|
+
PaneSendResult,
|
|
80
83
|
} from "./commands.ts";
|
|
81
84
|
|
|
82
85
|
export { subscribe, createRelay, DEFAULT_WS_URL } from "./relay.ts";
|