@burdenoff/fe-libs 2026.925.9 → 2026.926.2

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.
@@ -74,14 +74,68 @@ export declare function buildAssistantProgress(messages: AssistantRawMessage[],
74
74
  * earlier assistant message counts as this turn's, and the PREVIOUS completed
75
75
  * reply is shown — and charged — as the answer on the first poll.
76
76
  *
77
- * - A new session has said nothing yet, so 0 is exact: no retry needed.
77
+ * - ★ A new session — one THIS attempt created — is not read at all: 0 is
78
+ * exact (BOFF-7801). Creating it posts at most ONE message, the mode's
79
+ * context, and that is a no-reply USER message (the agent's
80
+ * `injectModeContext`; opencode returns before its model loop on
81
+ * `noReply`). No assistant message predates the prompt, and only an
82
+ * assistant message can be taken for the reply. The read cost a round trip
83
+ * (0.9–1.6s in prod) ahead of every first prompt and changed no poll: that
84
+ * context message is the session's first, so no `since` and its old value
85
+ * select the same set.
78
86
  * - A reused one that fails — or lists NOTHING, which a session that has
79
87
  * answered before cannot truthfully do (a misrouted or stale read) — is
80
88
  * read once more. Empty twice is believed: the session is genuinely empty
81
89
  * (its first prompt never went out). Failing twice fails the turn, with the
82
90
  * first error (a temporary outcome the person can retry).
91
+ *
92
+ * `readAhead`: the first read, already under way (`startSessionReadAhead`).
93
+ * It stands in for the FIRST read only. The second is always a fresh fetch —
94
+ * a read-ahead that came back empty or failed is exactly the read not trusted.
95
+ * Its floor is the session as of when it was STARTED — before the session
96
+ * check, not after it. See `startSessionReadAhead` for what that admits.
83
97
  */
84
- export declare function snapshotReplyFloor(fetchPrior: () => Promise<AssistantRawMessage[]>, sessionIsNew: boolean): Promise<number>;
98
+ export declare function snapshotReplyFloor(fetchPrior: () => Promise<AssistantRawMessage[]>, sessionIsNew: boolean, readAhead?: Promise<AssistantRawMessage[]> | null): Promise<number>;
99
+ /**
100
+ * ★ BOFF-7801: a REUSED session's pre-prompt read, started alongside the check
101
+ * that the session is still alive — the two were strictly serial round trips
102
+ * (0.6–1.3s each in prod) ahead of every follow-up prompt.
103
+ *
104
+ * Tagged with the sandbox and session it reads, and those are the ids handed
105
+ * to `read`: the tag cannot name one session while the read fetched another.
106
+ * `readAheadFor` releases it only to a prompt bound for that same session.
107
+ *
108
+ * ★ What the overlap costs. Both are accepted, and neither is a new kind of
109
+ * fault:
110
+ *
111
+ * - The floor is one check round trip OLDER. The read used to be taken after
112
+ * the check returned; now it is taken as the check is sent. A message the
113
+ * session gains in between is newer than the floor, so it is taken for THIS
114
+ * turn's reply: an earlier turn's loop still finishing (a
115
+ * `continuesInBackground` build; a turn stopped while its sandbox was still
116
+ * starting, whose prompt still goes out), or another tab on the session.
117
+ * That was already true of any message written after the old floor; this
118
+ * widens the window by the check (0.6–1.3s). Closing it means matching the
119
+ * reply to this turn's own user message (`parentID`) instead of by time.
120
+ * - It is speculative: it is sent before the check can say whether the
121
+ * session is alive. A stored session found dead or in another mode costs
122
+ * this one discarded read, repaid by the new session's skipped read
123
+ * (`snapshotReplyFloor`) whenever the create succeeds, so no path that
124
+ * reaches a prompt makes more calls than before. An attempt that then fails
125
+ * BEFORE prompting (the create refused, the trusted-cache plan rethrowing,
126
+ * the turn abandoned) is left one read up. And a transport failure is
127
+ * retried like any gateway call (`executeSandboxGraphQL`), alongside the
128
+ * check's own retries: up to two more requests, never a longer wait —
129
+ * nothing awaits a discarded read.
130
+ */
131
+ export interface SessionReadAhead {
132
+ sandboxId: string;
133
+ sessionId: string;
134
+ messages: Promise<AssistantRawMessage[]>;
135
+ }
136
+ export declare function startSessionReadAhead(sandboxId: string, sessionId: string, read: (sandboxId: string, sessionId: string) => Promise<AssistantRawMessage[]>): SessionReadAhead;
137
+ /** The read-ahead's messages — only for the session the prompt is sent to. */
138
+ export declare function readAheadFor(readAhead: SessionReadAhead | null, sandboxId: string, sessionId: string): Promise<AssistantRawMessage[]> | null;
85
139
  /** Where a turn's first answer text is, while it is still only a candidate. */
86
140
  export interface FirstTextTracker {
87
141
  messageId: string | null;
@@ -1 +1 @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AgB,CAAC;IAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAc3D"}
@@ -29,31 +29,42 @@ function a(a, o, s) {
29
29
  ...p ? { pendingWrite: p } : {}
30
30
  };
31
31
  }
32
- async function o(e, t) {
33
- let r = (e) => e.reduce((e, t) => Math.max(e, n(t)), 0), i = null;
32
+ async function o(e, t, r = null) {
33
+ if (t) return 0;
34
+ let i = (e) => e.reduce((e, t) => Math.max(e, n(t)), 0), a = null;
34
35
  try {
35
- let n = await e();
36
- if (n.length > 0 || t) return r(n);
36
+ let t = await (r ?? e());
37
+ if (t.length > 0) return i(t);
37
38
  } catch (e) {
38
- if (t) return 0;
39
- i = e;
39
+ a = e;
40
40
  }
41
41
  try {
42
- return r(await e());
42
+ return i(await e());
43
43
  } catch (e) {
44
- throw i ?? e;
44
+ throw a ?? e;
45
45
  }
46
46
  }
47
- var s = {
47
+ function s(e, t, n) {
48
+ let r = (async () => n(e, t))();
49
+ return r.catch(() => void 0), {
50
+ sandboxId: e,
51
+ sessionId: t,
52
+ messages: r
53
+ };
54
+ }
55
+ function c(e, t, n) {
56
+ return e?.sandboxId === t && e.sessionId === n ? e.messages : null;
57
+ }
58
+ var l = {
48
59
  messageId: null,
49
60
  at: null
50
61
  };
51
- function c(e, t, n) {
62
+ function u(e, t, n) {
52
63
  let r = t.messageId ?? null, i = e;
53
64
  t.hasText ? (e.at === null || e.messageId !== r) && (i = {
54
65
  messageId: r,
55
66
  at: n
56
- }) : i = s;
67
+ }) : i = l;
57
68
  let a = t.done && i.at !== null && i.messageId === r ? i.at : null;
58
69
  return {
59
70
  tracker: i,
@@ -61,4 +72,4 @@ function c(e, t, n) {
61
72
  };
62
73
  }
63
74
  //#endregion
64
- export { s as NO_FIRST_TEXT, a as buildAssistantProgress, o as snapshotReplyFloor, c as trackFirstText };
75
+ export { l as NO_FIRST_TEXT, a as buildAssistantProgress, c as readAheadFor, o as snapshotReplyFloor, s as startSessionReadAhead, u as trackFirstText };
@@ -1 +1 @@
1
- {"version":3,"file":"AssistantChatArea.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/ui/AssistantChatArea.tsx"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,EAAE,EACR,MAAM,OAAO,CAAC;AAmIf,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AA+EvE;;;;;GAKG;AACH,MAAM,WAAW,sBAAsB;IACrC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;;;;;;;;OAYG;IACH,WAAW,CAAC,EAAE,oBAAoB,CAAC;CACpC;AAED,eAAO,MAAM,iBAAiB,EAAE,EAAE,CAAC,sBAAsB,CA6qGxD,CAAC"}
1
+ {"version":3,"file":"AssistantChatArea.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/ui/AssistantChatArea.tsx"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,EAAE,EACR,MAAM,OAAO,CAAC;AAsIf,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AA+EvE;;;;;GAKG;AACH,MAAM,WAAW,sBAAsB;IACrC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;;;;;;;;OAYG;IACH,WAAW,CAAC,EAAE,oBAAoB,CAAC;CACpC;AAED,eAAO,MAAM,iBAAiB,EAAE,EAAE,CAAC,sBAAsB,CAktGxD,CAAC"}