@mattstack/rt-client 0.15.0 → 0.16.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 CHANGED
@@ -105,10 +105,7 @@ export declare function chatWho(a: {
105
105
  }, o?: RtClientOptions): Promise<RtResponse<{
106
106
  members: ChatMember[];
107
107
  }>>;
108
- export declare function chatMark(a: {
109
- handle: string;
110
- room?: string;
111
- }, o?: RtClientOptions): Promise<RtResponse<Record<string, never>>>;
108
+ export declare function chatMark(a: Commands["chat:mark"]["payload"], o?: RtClientOptions): Promise<RtResponse<Commands["chat:mark"]["data"]>>;
112
109
  export declare function chatMessages(a: {
113
110
  room: string;
114
111
  before?: number;
@@ -102,12 +102,25 @@ export interface EventsBusEvent {
102
102
  value gates-store.ts's release tracking (CAS winner or loser) reacts to. */
103
103
  export declare const GATE_BY_PANE = "pane";
104
104
  export type GateStatus = "open" | "answered" | "parked" | "closed";
105
+ export type GateOption = string | {
106
+ value: string;
107
+ label: string;
108
+ };
109
+ export interface GateOrigin {
110
+ paneId?: string;
111
+ tabId?: string;
112
+ runId?: string;
113
+ worktree?: string;
114
+ presentation?: "form" | "wait";
115
+ }
105
116
  export interface GateQuestion {
106
117
  id: string;
107
118
  label: string;
108
119
  multi: boolean;
109
- options: string[];
120
+ options: GateOption[];
110
121
  }
122
+ export declare function gateOptionValue(o: GateOption): string;
123
+ export declare function gateOptionLabel(o: GateOption): string;
111
124
  export interface GateAnswer {
112
125
  answers: Record<string, string | string[] | {
113
126
  value: string | string[];
@@ -122,6 +135,8 @@ export interface GateRow {
122
135
  kind: string;
123
136
  questions: GateQuestion[];
124
137
  meta: Record<string, unknown> | null;
138
+ context?: string | null;
139
+ origin?: GateOrigin | null;
125
140
  status: GateStatus;
126
141
  answer: GateAnswer | null;
127
142
  openedAt: number;
@@ -869,6 +884,7 @@ export interface Commands {
869
884
  payload: {
870
885
  handle: string;
871
886
  room?: string;
887
+ upto?: number;
872
888
  };
873
889
  data: Record<string, never>;
874
890
  };
@@ -1275,6 +1291,8 @@ export interface Commands {
1275
1291
  nudge?: {
1276
1292
  session: string;
1277
1293
  };
1294
+ context?: string;
1295
+ origin?: GateOrigin;
1278
1296
  };
1279
1297
  data: {
1280
1298
  id: string;
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
3
  export { readProjectMRs, readDiscussions, readMrsByBranch, readBranchCache, resolveForgeToken, listRuns, getRun, abandonRun, chatJoin, chatLeave, chatAck, chatClaim, chatRelease, chatPost, chatRead, chatRooms, chatWho, chatMark, chatMessages, chatSignIn, chatSignOut, chatAway, chatBack, chatBuddies, chatDm, chatArchive, chatDmOpen, eventsHead, eventsEmit, eventsWait, eventsList, agentStart, agentResume, agentGet, agentList, paneList, panePeek, paneSpawn, paneAccounts, paneDirectories, chatInvite, paneSend, paneFocus, gateOpen, gateAnswer, gateWait, gateList, gatePark, gateClose, gateSubscribe, gateUnsubscribe, gateSubscriptions, } from "./client.ts";
4
- export { COMMAND_NAMES, GATE_BY_PANE } 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, ChatClaimOutcome, RoomSummary, BuddyStatus, PresenceRow, AgentRecord, AgentSurface, AgentStatus, ChatPane, PaneAccount, PaneDirectory, InviteResult, PaneDelivery, PaneSendResult, PaneFocusResult, GateStatus, GateQuestion, GateAnswer, GateRow, GateSubscription, } from "./commands.ts";
4
+ export { COMMAND_NAMES, GATE_BY_PANE, gateOptionValue, gateOptionLabel } 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, ChatClaimOutcome, RoomSummary, BuddyStatus, PresenceRow, AgentRecord, AgentSurface, AgentStatus, ChatPane, PaneAccount, PaneDirectory, InviteResult, PaneDelivery, PaneSendResult, PaneFocusResult, GateStatus, GateOption, GateOrigin, GateQuestion, GateAnswer, GateRow, GateSubscription, } 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
@@ -118,6 +118,8 @@ function chatMark(a, o = {}) {
118
118
  const payload = { handle: a.handle };
119
119
  if (a.room !== undefined)
120
120
  payload.room = a.room;
121
+ if (a.upto !== undefined)
122
+ payload.upto = a.upto;
121
123
  return rtCommand("chat:mark", payload, { sockPath: o.sockPath, timeoutMs: o.timeoutMs ?? 1e4 });
122
124
  }
123
125
  function chatMessages(a, o = {}) {
@@ -270,7 +272,7 @@ function paneFocus(a, o = {}) {
270
272
  }
271
273
  function gateOpen(a, o = {}) {
272
274
  const payload = { subject: a.subject, kind: a.kind, questions: a.questions };
273
- for (const k of ["meta", "agent", "pane", "nudge"])
275
+ for (const k of ["meta", "agent", "pane", "nudge", "context", "origin"])
274
276
  if (a[k] !== undefined)
275
277
  payload[k] = a[k];
276
278
  return rtCommand("gate:open", payload, { sockPath: o.sockPath, timeoutMs: o.timeoutMs ?? 1e4 });
@@ -312,6 +314,12 @@ function gateSubscriptions(a, o = {}) {
312
314
  }
313
315
  // src/commands.ts
314
316
  var GATE_BY_PANE = "pane";
317
+ function gateOptionValue(o) {
318
+ return typeof o === "string" ? o : o.value;
319
+ }
320
+ function gateOptionLabel(o) {
321
+ return typeof o === "string" ? o : o.label || o.value;
322
+ }
315
323
  var COMMAND_NAMES = [
316
324
  "project-mrs:read",
317
325
  "discussions:read",
@@ -1051,6 +1059,14 @@ var REGISTRY = [
1051
1059
  merge: "deep",
1052
1060
  description: "This developer's triage user-intent flags (which triage sweeps run automatically); a sibling flat key of board.triage.doctorSkill, not its container — the board reader assembles the two independently."
1053
1061
  },
1062
+ {
1063
+ key: "board.reReview",
1064
+ type: "object",
1065
+ scopes: ["user", "team"],
1066
+ merge: "deep",
1067
+ default: { enabled: true },
1068
+ description: "Gate for the board's automatic re-review sweep ({enabled}); rt's cron.triage step installs the board-triage trigger only while this is on. A fresh key, not an ownership-latch port, so a default is fine here."
1069
+ },
1054
1070
  {
1055
1071
  key: "board.agent.account",
1056
1072
  type: "string",
@@ -2097,6 +2113,8 @@ export {
2097
2113
  gateSubscriptions,
2098
2114
  gateSubscribe,
2099
2115
  gatePark,
2116
+ gateOptionValue,
2117
+ gateOptionLabel,
2100
2118
  gateOpen,
2101
2119
  gateList,
2102
2120
  gateClose,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mattstack/rt-client",
3
- "version": "0.15.0",
3
+ "version": "0.16.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
package/src/client.ts CHANGED
@@ -223,12 +223,13 @@ export function chatWho(
223
223
  }
224
224
 
225
225
  export function chatMark(
226
- a: { handle: string; room?: string },
226
+ a: Commands["chat:mark"]["payload"],
227
227
  o: RtClientOptions = {},
228
- ): Promise<RtResponse<Record<string, never>>> {
228
+ ): Promise<RtResponse<Commands["chat:mark"]["data"]>> {
229
229
  const payload: Record<string, unknown> = { handle: a.handle };
230
230
  if (a.room !== undefined) payload.room = a.room;
231
- return rtCommand<Record<string, never>>("chat:mark", payload, { sockPath: o.sockPath, timeoutMs: o.timeoutMs ?? 10_000 });
231
+ if (a.upto !== undefined) payload.upto = a.upto;
232
+ return rtCommand<Commands["chat:mark"]["data"]>("chat:mark", payload, { sockPath: o.sockPath, timeoutMs: o.timeoutMs ?? 10_000 });
232
233
  }
233
234
 
234
235
  export function chatMessages(
@@ -450,7 +451,7 @@ export function gateOpen(
450
451
  o: RtClientOptions = {},
451
452
  ): Promise<RtResponse<Commands["gate:open"]["data"]>> {
452
453
  const payload: Record<string, unknown> = { subject: a.subject, kind: a.kind, questions: a.questions };
453
- for (const k of ["meta", "agent", "pane", "nudge"] as const) if (a[k] !== undefined) payload[k] = a[k];
454
+ for (const k of ["meta", "agent", "pane", "nudge", "context", "origin"] as const) if (a[k] !== undefined) payload[k] = a[k];
454
455
  return rtCommand<Commands["gate:open"]["data"]>("gate:open", payload, { sockPath: o.sockPath, timeoutMs: o.timeoutMs ?? 10_000 });
455
456
  }
456
457
 
package/src/commands.ts CHANGED
@@ -95,11 +95,27 @@ export interface EventsBusEvent { id: number; topic: string; payload: unknown; e
95
95
  export const GATE_BY_PANE = "pane";
96
96
 
97
97
  export type GateStatus = "open" | "answered" | "parked" | "closed";
98
- export interface GateQuestion { id: string; label: string; multi: boolean; options: string[] }
98
+ export type GateOption = string | { value: string; label: string };
99
+ export interface GateOrigin {
100
+ paneId?: string;
101
+ tabId?: string;
102
+ runId?: string;
103
+ worktree?: string;
104
+ presentation?: "form" | "wait";
105
+ }
106
+ export interface GateQuestion { id: string; label: string; multi: boolean; options: GateOption[] }
107
+ export function gateOptionValue(o: GateOption): string {
108
+ return typeof o === "string" ? o : o.value;
109
+ }
110
+ export function gateOptionLabel(o: GateOption): string {
111
+ return typeof o === "string" ? o : (o.label || o.value);
112
+ }
99
113
  export interface GateAnswer { answers: Record<string, string | string[] | { value: string | string[]; note?: string }>; by: string; answeredAt: number }
100
114
  export interface GateRow {
101
115
  id: string; subject: string; kind: string;
102
116
  questions: GateQuestion[]; meta: Record<string, unknown> | null;
117
+ context?: string | null;
118
+ origin?: GateOrigin | null;
103
119
  status: GateStatus; answer: GateAnswer | null;
104
120
  openedAt: number; parkedAt: number | null; closedAt: number | null;
105
121
  closedReason: "abandoned" | "superseded" | "pruned" | null;
@@ -472,7 +488,7 @@ export interface Commands {
472
488
  "chat:read": { payload: { handle: string; room?: string; limit?: number; sinceMs?: number }; data: { rooms: { room: string; messages: ChatMessage[] }[] } };
473
489
  "chat:rooms": { payload: { handle: string; includeArchived?: boolean }; data: { rooms: RoomSummary[] } };
474
490
  "chat:who": { payload: { room: string }; data: { members: ChatMember[] } };
475
- "chat:mark": { payload: { handle: string; room?: string }; data: Record<string, never> };
491
+ "chat:mark": { payload: { handle: string; room?: string; upto?: number }; data: Record<string, never> };
476
492
  "chat:messages": { payload: { room: string; before?: number; limit?: number }; data: { messages: ChatMessage[] } };
477
493
 
478
494
  // A session id keys these to one signed-in handle, not a room-membership
@@ -574,7 +590,7 @@ export interface Commands {
574
590
  "freshness:reconcile": { payload: Record<string, never>; data: unknown };
575
591
 
576
592
  // ─── Gate facility (BOARD-20/21) ─────────────────────────────────────────
577
- "gate:open": { payload: { subject: string; kind: string; questions: GateQuestion[]; meta?: Record<string, unknown>; agent?: string; pane?: string; nudge?: { session: string } }; data: { id: string; supersededId: string | null } };
593
+ "gate:open": { payload: { subject: string; kind: string; questions: GateQuestion[]; meta?: Record<string, unknown>; agent?: string; pane?: string; nudge?: { session: string }; context?: string; origin?: GateOrigin }; data: { id: string; supersededId: string | null } };
578
594
  /**
579
595
  * A CAS loss is a DEFINED OUTCOME, not an error: `ok:true` with
580
596
  * `conflict:true` and the WINNING row, so every consumer gets the winner
package/src/index.ts CHANGED
@@ -56,7 +56,7 @@ export {
56
56
  gateSubscriptions,
57
57
  } from "./client.ts";
58
58
 
59
- export { COMMAND_NAMES, GATE_BY_PANE } from "./commands.ts";
59
+ export { COMMAND_NAMES, GATE_BY_PANE, gateOptionValue, gateOptionLabel } from "./commands.ts";
60
60
  export type {
61
61
  Discussion,
62
62
  DemandDecl,
@@ -94,6 +94,8 @@ export type {
94
94
  PaneSendResult,
95
95
  PaneFocusResult,
96
96
  GateStatus,
97
+ GateOption,
98
+ GateOrigin,
97
99
  GateQuestion,
98
100
  GateAnswer,
99
101
  GateRow,
@@ -473,6 +473,14 @@ export const REGISTRY: readonly SettingDef[] = [
473
473
  merge: "deep",
474
474
  description: "This developer's triage user-intent flags (which triage sweeps run automatically); a sibling flat key of board.triage.doctorSkill, not its container — the board reader assembles the two independently.",
475
475
  },
476
+ {
477
+ key: "board.reReview",
478
+ type: "object",
479
+ scopes: ["user", "team"],
480
+ merge: "deep",
481
+ default: { enabled: true },
482
+ description: "Gate for the board's automatic re-review sweep ({enabled}); rt's cron.triage step installs the board-triage trigger only while this is on. A fresh key, not an ownership-latch port, so a default is fine here.",
483
+ },
476
484
 
477
485
  // --- board (machine) ---------------------------------------------------
478
486
  {