@mattstack/rt-client 0.15.1 → 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.
@@ -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;
@@ -1276,6 +1291,8 @@ export interface Commands {
1276
1291
  nudge?: {
1277
1292
  session: string;
1278
1293
  };
1294
+ context?: string;
1295
+ origin?: GateOrigin;
1279
1296
  };
1280
1297
  data: {
1281
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
@@ -272,7 +272,7 @@ function paneFocus(a, o = {}) {
272
272
  }
273
273
  function gateOpen(a, o = {}) {
274
274
  const payload = { subject: a.subject, kind: a.kind, questions: a.questions };
275
- for (const k of ["meta", "agent", "pane", "nudge"])
275
+ for (const k of ["meta", "agent", "pane", "nudge", "context", "origin"])
276
276
  if (a[k] !== undefined)
277
277
  payload[k] = a[k];
278
278
  return rtCommand("gate:open", payload, { sockPath: o.sockPath, timeoutMs: o.timeoutMs ?? 1e4 });
@@ -314,6 +314,12 @@ function gateSubscriptions(a, o = {}) {
314
314
  }
315
315
  // src/commands.ts
316
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
+ }
317
323
  var COMMAND_NAMES = [
318
324
  "project-mrs:read",
319
325
  "discussions:read",
@@ -2107,6 +2113,8 @@ export {
2107
2113
  gateSubscriptions,
2108
2114
  gateSubscribe,
2109
2115
  gatePark,
2116
+ gateOptionValue,
2117
+ gateOptionLabel,
2110
2118
  gateOpen,
2111
2119
  gateList,
2112
2120
  gateClose,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mattstack/rt-client",
3
- "version": "0.15.1",
3
+ "version": "0.16.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
package/src/client.ts CHANGED
@@ -451,7 +451,7 @@ export function gateOpen(
451
451
  o: RtClientOptions = {},
452
452
  ): Promise<RtResponse<Commands["gate:open"]["data"]>> {
453
453
  const payload: Record<string, unknown> = { subject: a.subject, kind: a.kind, questions: a.questions };
454
- 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];
455
455
  return rtCommand<Commands["gate:open"]["data"]>("gate:open", payload, { sockPath: o.sockPath, timeoutMs: o.timeoutMs ?? 10_000 });
456
456
  }
457
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;
@@ -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,