@pagelines/sdk 1.0.448 → 1.0.449

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,18 @@ import { AgentMode, ChatAttachment, ChatMessage, TextConnectionState, Agent } fr
5
5
  /**
6
6
  * Structured error payload surfaced by the chat stream. Matches the
7
7
  * ApiResponse contract in plans/standards/api.md — consumers switch on
8
- * `code` (stable identifier), render `error` (user-facing copy).
8
+ * `code` (stable identifier), render `error` (user-facing copy). When
9
+ * the server emits a ChatIssueWireFrame (chat-gate.ts), the bucket +
10
+ * actionLabel + actionUrl triad lets the UI render a CTA inside the
11
+ * error bubble.
9
12
  */
10
13
  export interface ChatStreamError {
11
14
  code: string;
12
15
  error: string;
16
+ bucket?: 'account' | 'error';
17
+ actionLabel?: string;
18
+ actionUrl?: string;
19
+ help?: string;
13
20
  }
14
21
  export type ChatStreamFn = (args: {
15
22
  message: string;
@@ -62,6 +69,14 @@ export declare class AgentChatController extends SettingsObject<AgentChatControl
62
69
  onConnect?: () => void;
63
70
  }): Promise<void>;
64
71
  endConversation(): Promise<void>;
72
+ /**
73
+ * Start a fresh conversation — clears the visible transcript and unsets
74
+ * conversationId so the next send creates a new thread on the server.
75
+ * Prior session stays in DB for history; only the in-memory view resets.
76
+ * Use when an issue bubble (billing, error) is blocking the current
77
+ * conversation and the user wants a clean slate after resolving it.
78
+ */
79
+ newConversation(): void;
65
80
  sendChatMessage(message: string, attachments?: ChatAttachment[]): Promise<void>;
66
81
  private buildHistory;
67
82
  /** Seed the controller with previously-loaded messages (e.g. from a server thread). */
@@ -7,12 +7,20 @@ export interface ChatAttachment {
7
7
  mimeType: string;
8
8
  mediaId?: string;
9
9
  }
10
+ export interface ChatMessageIssue {
11
+ code: string;
12
+ bucket: 'account' | 'error';
13
+ actionLabel: string;
14
+ actionUrl: string;
15
+ help?: string;
16
+ }
10
17
  export interface ChatMessage {
11
18
  id: string;
12
19
  text: string;
13
20
  sender: 'user' | 'agent' | 'system';
14
21
  timestamp: string;
15
22
  attachments?: ChatAttachment[];
23
+ issue?: ChatMessageIssue;
16
24
  }
17
25
  export interface TextConnectionState {
18
26
  isActive: boolean;
@@ -20,6 +28,14 @@ export interface TextConnectionState {
20
28
  isThinking: boolean;
21
29
  connectionStatus: 'connecting' | 'connected' | 'disconnected' | 'error';
22
30
  error?: string;
31
+ /**
32
+ * Set when the server emits a persistent `bucket: 'account'` issue
33
+ * (billing past-due, credit limit, budget cap). Stays true until the
34
+ * user starts a new conversation — further sends are blocked because
35
+ * retrying just hits the same error and looks like the product is
36
+ * silently failing. Cleared by newConversation().
37
+ */
38
+ accountGated?: boolean;
23
39
  }
24
40
  export declare const AGENT_MODES: readonly [{
25
41
  readonly mode: "self";