@tangle-network/agent-app 1.0.23 → 1.0.25

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.
@@ -5,11 +5,8 @@
5
5
  * section's data. The frame answers to the content area's width: from 60rem
6
6
  * the links are a sticky 13rem column beside a 48rem column of cards, and
7
7
  * below that a sticky 56px tab strip whose current tab is kept in view.
8
- *
9
- * Navigation responds at once: the clicked link becomes current before the
10
- * route resolves, nothing dims, and a thin progress line shows only after the
11
- * pending delay. A `#hash` scrolls its section (or row) into view and focuses
12
- * its heading.
8
+ * Navigation responds at once, and a `#hash` scrolls its section (or row)
9
+ * into view and focuses its heading.
13
10
  */
14
11
  import { type AnchorHTMLAttributes, type ComponentType, type ReactNode } from 'react';
15
12
  /** An icon component such as a `lucide-react` icon. It shows only in the column. */
@@ -3,19 +3,13 @@
3
3
  * sense saved together (a set of spend caps). Save is the primary action only
4
4
  * while there are changes; a refusal shows its sentence here and the edits
5
5
  * stay. "Saved" shows for two seconds after `state` becomes `saved`, as a
6
- * row's does.
6
+ * row's does. The bar stays in reach while it has something to report.
7
7
  *
8
- * The bar stays in reach while it has something to report: unsaved changes, a
9
- * refusal, "Saved", or a `summary` the product shows after a save.
10
- *
11
- * - `placement="footer"` (the default): pass it as a `SettingsSection` footer.
12
- * On a narrow card the footer sticks to the bottom of the screen while the
13
- * bar reports, so Save stays in reach while the person scrolls the fields
8
+ * - `placement="footer"` (the default): a `SettingsSection` footer, sticky to
9
+ * the screen's bottom on a narrow card while the bar reports.
10
+ * - `placement="group"`: after the last of several cards one save covers; its
11
+ * own card, sticky to the screen's bottom at every width, over every card
14
12
  * above it.
15
- * - `placement="group"`: one save covers several cards. Render the bar after
16
- * the last of them, in the same column. It is its own card on the muted
17
- * plane and, while it reports, stays at the bottom of the screen at every
18
- * width, over every card above it, until the person scrolls past it.
19
13
  */
20
14
  import { type ReactNode } from 'react';
21
15
  export interface SettingsSaveBarProps {
@@ -23,6 +17,8 @@ export interface SettingsSaveBarProps {
23
17
  changes: number;
24
18
  /** Replaces the "2 unsaved changes" count. */
25
19
  summary?: ReactNode;
20
+ /** Why the edits cannot be saved yet, naming the field. Replaces the count and disables Save while there are changes. */
21
+ invalid?: ReactNode;
26
22
  onDiscard: () => void;
27
23
  onSave: () => void;
28
24
  state: 'idle' | 'saving' | 'saved' | 'failed';
@@ -35,4 +31,4 @@ export interface SettingsSaveBarProps {
35
31
  /** `footer` in one card's footer; `group` after the several cards one save covers. */
36
32
  placement?: 'footer' | 'group';
37
33
  }
38
- export declare function SettingsSaveBar({ changes, summary, onDiscard, onSave, state, error, saveLabel, disabledReason, placement, }: SettingsSaveBarProps): import("react").JSX.Element;
34
+ export declare function SettingsSaveBar({ changes, summary, invalid, onDiscard, onSave, state, error, saveLabel, disabledReason, placement, }: SettingsSaveBarProps): import("react").JSX.Element;
@@ -1,9 +1,7 @@
1
1
  /**
2
2
  * One save that covers several cards, as an agent profile's does: its
3
- * instructions, model and knowledge are one versioned record. The group save
4
- * bar follows the last card it saves and, while it has something to report,
5
- * stays at the bottom of the screen over every card above it. The story
6
- * renders it and `scripts/prove-settings-pages.mjs` drives it.
3
+ * instructions, model and knowledge are one versioned record, and the group
4
+ * save bar follows the last card it saves.
7
5
  */
8
6
  export declare function SaveGroupDemo({ saveDelayMs }: {
9
7
  saveDelayMs?: number;
@@ -8,9 +8,9 @@
8
8
  * {type:'turn'|'metadata'|'error'|'turn_status', ...} (route-level)
9
9
  * {type:'interaction', data:{request}} (sidecar ask)
10
10
  *
11
- * Replayed lines carry an extra `seq` — transparently ignored. Works for
12
- * router-backed and sandbox-backed chats alike: anything producing these
13
- * lines (live pump, queued follow, resume replay) feeds the same callbacks.
11
+ * Replayed lines carry an extra `seq` — `consumeChatStream` tracks the last
12
+ * one so `streamChatTurn` can resume a dropped replay from the tail instead of
13
+ * replaying the whole turn.
14
14
  */
15
15
  import { type ChatInteraction, type InteractionCancelData } from './chat-interactions.js';
16
16
  import { type ChatPlan } from '../plans/index.js';
@@ -149,15 +149,23 @@ export interface ConsumeChatStreamResult {
149
149
  turnId: string | null;
150
150
  /** True when any text/reasoning/tool activity was received. */
151
151
  receivedContent: boolean;
152
+ /** The last `seq` a replayed line stamped (0 when none did): a resume after
153
+ * a replay continues from here; after a live stream it starts from 0. */
154
+ lastSeq: number;
152
155
  }
153
156
  /** Parse one NDJSON line into the callbacks. Exposed for tests. */
154
157
  export declare function dispatchChatStreamLine(line: string, cb: ChatStreamCallbacks): {
155
158
  turnId?: string;
156
159
  receivedContent: boolean;
160
+ /** The line's stamped buffer ordinal, when it carried a positive one. */
161
+ seq?: number;
157
162
  };
158
163
  /** Drain one NDJSON body into the callbacks. Throws on transport failure
159
- * (caller decides whether to resume). */
160
- export declare function consumeChatStream(body: ReadableStream<Uint8Array>, cb: ChatStreamCallbacks): Promise<ConsumeChatStreamResult>;
164
+ * (caller decides whether to resume). `seen` accumulates the last stamped seq
165
+ * as lines arrive so it survives this stream dropping. */
166
+ export declare function consumeChatStream(body: ReadableStream<Uint8Array>, cb: ChatStreamCallbacks, seen?: {
167
+ lastSeq: number;
168
+ }): Promise<ConsumeChatStreamResult>;
161
169
  /** Define options for managing and resuming streaming chat interactions with callbacks */
162
170
  export interface StreamChatOptions {
163
171
  /** Start the turn (POST the chat request); must return a streaming Response. */
@@ -166,12 +174,22 @@ export interface StreamChatOptions {
166
174
  resume?: (turnId: string, fromSeq: number) => Promise<Response>;
167
175
  callbacks: ChatStreamCallbacks;
168
176
  /** Called before a resume replays from 0 so the UI can reset accumulated
169
- * turn state (text, reasoning, tool chips). */
177
+ * turn state. A tail resume (fromSeq > 0) keeps it and does not call this. */
170
178
  onResetForResume?: () => void;
179
+ /** Automatic reconnects after transport drops before the turn fails with the
180
+ * last transport error. Default 5. */
181
+ maxReconnects?: number;
182
+ /** Milliseconds to wait before reconnect attempt N (0-based); default
183
+ * {@link defaultReconnectDelayMs}. */
184
+ reconnectDelayMs?: (attempt: number) => number;
171
185
  }
186
+ /** The default reconnect schedule: exponential from 500ms with ±50% jitter, capped at 8s. */
187
+ export declare function defaultReconnectDelayMs(attempt: number, rand?: () => number): number;
172
188
  /**
173
- * Run one chat turn with automatic single-shot resume: if the transport drops
174
- * mid-turn and the server announced a turnId, reset and replay the buffered
175
- * turn. Server-side the turn keeps running either way (queued runner).
189
+ * Run one chat turn with bounded automatic resume: reconnect with backoff and
190
+ * resume from the last stamped seq — a live drop resets and replays from 0, a
191
+ * replay drop resumes the tail only, one reasoning tracker across all of it.
192
+ * The turn keeps running server-side (queued runner); once the reconnect
193
+ * budget is spent the last transport error surfaces.
176
194
  */
177
195
  export declare function streamChatTurn(opts: StreamChatOptions): Promise<ConsumeChatStreamResult>;
@@ -57,6 +57,7 @@ import {
57
57
  createInteractionAnswerSubmitter,
58
58
  createMemoryInteractionAttemptStore,
59
59
  createSessionInteractionAttemptStore,
60
+ defaultReconnectDelayMs,
60
61
  describeProvenance,
61
62
  describeProvenanceSourceStatus,
62
63
  diffRecordGridProposal,
@@ -151,7 +152,7 @@ import {
151
152
  withoutRecordGridCreated,
152
153
  withoutRecordGridRemoved,
153
154
  withoutRecordGridUpdate
154
- } from "../chunk-GN5JME4V.js";
155
+ } from "../chunk-3VEXCVZB.js";
155
156
  import {
156
157
  useInfiniteScroll
157
158
  } from "../chunk-UHSUY6H6.js";
@@ -446,6 +447,7 @@ export {
446
447
  createMemoryInteractionAttemptStore,
447
448
  createSessionInteractionAttemptStore,
448
449
  dedupeQuestionInteractionsByContent,
450
+ defaultReconnectDelayMs,
449
451
  describeProvenance,
450
452
  describeProvenanceSourceStatus,
451
453
  dictationErrorMessage,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/agent-app",
3
- "version": "1.0.23",
3
+ "version": "1.0.25",
4
4
  "packageManager": "pnpm@11.28.8",
5
5
  "description": "Build agent applications with typed chat, tools, sandboxes, integrations, billing, and evaluation.",
6
6
  "keywords": [