@pagelines/sdk 1.0.516 → 1.0.518

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.
@@ -96,14 +96,6 @@ export declare class AgentChatController extends SettingsObject<AgentChatControl
96
96
  onConnect?: () => void;
97
97
  }): Promise<void>;
98
98
  endConversation(): Promise<void>;
99
- /**
100
- * Start a fresh conversation — clears the visible transcript and unsets
101
- * conversationId so the next send creates a new thread on the server.
102
- * Prior session stays in DB for history; only the in-memory view resets.
103
- * Use when an issue bubble (billing, error) is blocking the current
104
- * conversation and the user wants a clean slate after resolving it.
105
- */
106
- newConversation(): void;
107
99
  sendChatMessage(message: string, attachments?: ChatAttachment[]): Promise<void>;
108
100
  private buildHistory;
109
101
  /** Seed the controller with previously-loaded messages (e.g. from a server thread). */
@@ -111,8 +103,6 @@ export declare class AgentChatController extends SettingsObject<AgentChatControl
111
103
  conversationId: string;
112
104
  messages: ChatMessage[];
113
105
  }): void;
114
- /** Reset conversation state so the next message starts a fresh server session. */
115
- resetConversation(): void;
116
106
  destroy(): Promise<void>;
117
107
  }
118
108
  export {};
@@ -35,9 +35,9 @@ export interface TextConnectionState {
35
35
  /**
36
36
  * Set when the server emits a persistent `bucket: 'account'` issue
37
37
  * (billing past-due, credit limit, budget cap). Stays true until the
38
- * user starts a new conversation further sends are blocked because
39
- * retrying just hits the same error and looks like the product is
40
- * silently failing. Cleared by newConversation().
38
+ * controller is recreated or the chat reloads after account state changes;
39
+ * retrying before then just hits the same error and looks like the product
40
+ * is silently failing.
41
41
  */
42
42
  accountGated?: boolean;
43
43
  }
@@ -30,8 +30,8 @@ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {
30
30
  quality?: "high" | "low" | "standard" | undefined;
31
31
  createdAt?: string | undefined;
32
32
  updatedAt?: string | undefined;
33
- type?: "image" | "audio" | "video" | "document" | undefined;
34
- mediaType?: "image" | "audio" | "video" | "document" | undefined;
33
+ type?: "audio" | "document" | "image" | "video" | undefined;
34
+ mediaType?: "audio" | "document" | "image" | "video" | undefined;
35
35
  className?: string | undefined;
36
36
  width?: number | undefined;
37
37
  height?: number | undefined;
@@ -53,8 +53,8 @@ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {
53
53
  quality?: "high" | "low" | "standard" | undefined;
54
54
  createdAt?: string | undefined;
55
55
  updatedAt?: string | undefined;
56
- type?: "image" | "audio" | "video" | "document" | undefined;
57
- mediaType?: "image" | "audio" | "video" | "document" | undefined;
56
+ type?: "audio" | "document" | "image" | "video" | undefined;
57
+ mediaType?: "audio" | "document" | "image" | "video" | undefined;
58
58
  className?: string | undefined;
59
59
  width?: number | undefined;
60
60
  height?: number | undefined;
@@ -68,12 +68,11 @@ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {
68
68
  handle: string;
69
69
  }[] | null | undefined;
70
70
  model?: string | null | undefined;
71
- lastActivityAt?: string | null | undefined;
71
+ lastActiveAt?: string | null | undefined;
72
72
  lastMessageAt?: string | null | undefined;
73
73
  instanceId?: string | null | undefined;
74
74
  instanceProvider?: string | null | undefined;
75
75
  imageVersion?: string | null | undefined;
76
- deployEnv?: string | undefined;
77
76
  runtime?: string | undefined;
78
77
  botServerUrl?: string | null | undefined;
79
78
  desiredStatus?: "active" | "stopped" | null | undefined;
@@ -94,6 +93,14 @@ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {
94
93
  liveStatus?: "error" | "stopped" | "unknown" | "running" | "starting" | "stopping" | "warming" | "never_started" | "unreachable" | "not-deployed" | undefined;
95
94
  sinceAt?: string | undefined;
96
95
  errorReason?: string | undefined;
96
+ blocker?: {
97
+ bucket: "error" | "account";
98
+ code: "billing_no_plan" | "billing_past_due" | "billing_runaway_cap" | "billing_budget_reached" | "agent_not_deployed" | "agent_boot_failed" | "agent_unreachable" | "agent_wake_timeout" | "stream_timeout" | "stream_disconnect" | "empty_stream" | "rate_limit";
99
+ title: string;
100
+ actionLabel: string;
101
+ actionUrl: string;
102
+ help?: string | undefined;
103
+ } | undefined;
97
104
  }) => any;
98
105
  }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
99
106
  onCreated?: ((agent: {
@@ -123,8 +130,8 @@ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {
123
130
  quality?: "high" | "low" | "standard" | undefined;
124
131
  createdAt?: string | undefined;
125
132
  updatedAt?: string | undefined;
126
- type?: "image" | "audio" | "video" | "document" | undefined;
127
- mediaType?: "image" | "audio" | "video" | "document" | undefined;
133
+ type?: "audio" | "document" | "image" | "video" | undefined;
134
+ mediaType?: "audio" | "document" | "image" | "video" | undefined;
128
135
  className?: string | undefined;
129
136
  width?: number | undefined;
130
137
  height?: number | undefined;
@@ -146,8 +153,8 @@ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {
146
153
  quality?: "high" | "low" | "standard" | undefined;
147
154
  createdAt?: string | undefined;
148
155
  updatedAt?: string | undefined;
149
- type?: "image" | "audio" | "video" | "document" | undefined;
150
- mediaType?: "image" | "audio" | "video" | "document" | undefined;
156
+ type?: "audio" | "document" | "image" | "video" | undefined;
157
+ mediaType?: "audio" | "document" | "image" | "video" | undefined;
151
158
  className?: string | undefined;
152
159
  width?: number | undefined;
153
160
  height?: number | undefined;
@@ -161,12 +168,11 @@ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {
161
168
  handle: string;
162
169
  }[] | null | undefined;
163
170
  model?: string | null | undefined;
164
- lastActivityAt?: string | null | undefined;
171
+ lastActiveAt?: string | null | undefined;
165
172
  lastMessageAt?: string | null | undefined;
166
173
  instanceId?: string | null | undefined;
167
174
  instanceProvider?: string | null | undefined;
168
175
  imageVersion?: string | null | undefined;
169
- deployEnv?: string | undefined;
170
176
  runtime?: string | undefined;
171
177
  botServerUrl?: string | null | undefined;
172
178
  desiredStatus?: "active" | "stopped" | null | undefined;
@@ -187,6 +193,14 @@ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {
187
193
  liveStatus?: "error" | "stopped" | "unknown" | "running" | "starting" | "stopping" | "warming" | "never_started" | "unreachable" | "not-deployed" | undefined;
188
194
  sinceAt?: string | undefined;
189
195
  errorReason?: string | undefined;
196
+ blocker?: {
197
+ bucket: "error" | "account";
198
+ code: "billing_no_plan" | "billing_past_due" | "billing_runaway_cap" | "billing_budget_reached" | "agent_not_deployed" | "agent_boot_failed" | "agent_unreachable" | "agent_wake_timeout" | "stream_timeout" | "stream_disconnect" | "empty_stream" | "rate_limit";
199
+ title: string;
200
+ actionLabel: string;
201
+ actionUrl: string;
202
+ help?: string | undefined;
203
+ } | undefined;
190
204
  }) => any) | undefined;
191
205
  }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
192
206
  export default _default;
package/dist/api.d.ts CHANGED
@@ -1,5 +1,4 @@
1
- import { Hono } from 'hono';
2
- import { hc } from 'hono/client';
1
+ import { ApiResponse } from '@pagelines/core';
3
2
  export interface RefreshFetchHooks {
4
3
  getDeviceId: () => string | null;
5
4
  onAccessTokenRefreshed: (token: string) => void;
@@ -15,19 +14,4 @@ export interface ApiClientSettings {
15
14
  * Centralizes the isDev/apiBase/production URL logic used across SDK clients.
16
15
  */
17
16
  export declare function resolveApiBase(apiBase?: string, isDev?: boolean): string;
18
- /**
19
- * Create fully typed Hono RPC client for PageLines SDK
20
- *
21
- * @template TAppType - The Hono app type from the server (enables full type safety)
22
- * @param settings - Configuration for API base URL and environment
23
- * @param responseHandler - Optional handler to process ApiResponse for auto user/token updates
24
- * @returns Typed Hono client with response interceptor
25
- *
26
- * @example
27
- * ```typescript
28
- * import type { SDKAppType } from '@/modules/main/server'
29
- * const client = createApiClient<SDKAppType>({ isDev: true })
30
- * const response = await client.api.auth['check-email'].$post({ json: { email } })
31
- * ```
32
- */
33
- export declare function createApiClient<TAppType extends Hono = any>(settings: ApiClientSettings, responseHandler?: (response: any) => void, refreshHooks?: RefreshFetchHooks): ReturnType<typeof hc<TAppType>>;
17
+ export declare function createApiFetch(settings: ApiClientSettings, responseHandler?: (response: ApiResponse) => void, refreshHooks?: RefreshFetchHooks): typeof globalThis.fetch;
@@ -27,9 +27,11 @@ export declare class ChatClient {
27
27
  onStatus?: (status: string) => void;
28
28
  }): Promise<void>;
29
29
  /**
30
- * Authenticated chat — substrate-backed (POST /api/messages + SSE on
31
- * /api/chat/:agentId/stream). Same callback contract as the legacy
32
- * `chatStream` so callers don't need to know which transport runs underneath.
30
+ * Authenticated chat — substrate-backed:
31
+ * POST /api/conversations, open SSE from that conversation's latest
32
+ * sequence, then POST /api/messages. Opening the stream before send keeps
33
+ * fast working_state / message_delta frames from outrunning the subscriber.
34
+ * Same callback contract as `chatStream` so callers don't need transport details.
33
35
  * Mirrors `src/modules/agent/client.ts → sendChatMessageStream`.
34
36
  */
35
37
  chatStreamAuthenticated(args: {
@@ -1,12 +1,8 @@
1
- import { hc } from 'hono/client';
2
- import { SDKAppType } from '../types/SDKAppType.stub';
3
1
  import { AgentConfig, ApiResponse, EnrichedUser, LogHelper } from '@pagelines/core';
4
2
  import { ComputedRef, Ref } from 'vue';
5
3
  import { SDKStorage } from '../sdkStorage';
6
4
  export interface SDKContext {
7
- api: ReturnType<typeof hc<SDKAppType>> extends {
8
- api: infer A;
9
- } ? A : any;
5
+ apiFetch: typeof globalThis.fetch;
10
6
  apiBase?: string;
11
7
  isDev: boolean;
12
8
  activeUser: Ref<EnrichedUser | undefined>;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Conversation-membership wire-shape contracts.
3
+ *
4
+ * The fixtures below use `satisfies ApiResponse<T>` so a contract drift in
5
+ * `@pagelines/core/wire` fails *compile*, not production. If the server's
6
+ * `ApiResponse` envelope evolves OR an inner shape changes
7
+ * (`ConversationSummary`, `ConversationUpdatedEvent`, `MessageSearchResult`),
8
+ * these literals stop type-checking and the SDK/iOS owner gets a CI red light
9
+ * with a one-line update instead of a runtime decode failure on devices.
10
+ *
11
+ * See plans/testing/testing.md → "Pin the wire shape between server and
12
+ * clients" — the same pattern as `sdk-token-capture.test.ts`.
13
+ */
14
+ export {};
@@ -39,8 +39,8 @@ export declare function getDemoAgentByHandle(handle: string): Partial<{
39
39
  quality?: "high" | "low" | "standard" | undefined;
40
40
  createdAt?: string | undefined;
41
41
  updatedAt?: string | undefined;
42
- type?: "image" | "audio" | "video" | "document" | undefined;
43
- mediaType?: "image" | "audio" | "video" | "document" | undefined;
42
+ type?: "audio" | "document" | "image" | "video" | undefined;
43
+ mediaType?: "audio" | "document" | "image" | "video" | undefined;
44
44
  className?: string | undefined;
45
45
  width?: number | undefined;
46
46
  height?: number | undefined;
@@ -62,8 +62,8 @@ export declare function getDemoAgentByHandle(handle: string): Partial<{
62
62
  quality?: "high" | "low" | "standard" | undefined;
63
63
  createdAt?: string | undefined;
64
64
  updatedAt?: string | undefined;
65
- type?: "image" | "audio" | "video" | "document" | undefined;
66
- mediaType?: "image" | "audio" | "video" | "document" | undefined;
65
+ type?: "audio" | "document" | "image" | "video" | undefined;
66
+ mediaType?: "audio" | "document" | "image" | "video" | undefined;
67
67
  className?: string | undefined;
68
68
  width?: number | undefined;
69
69
  height?: number | undefined;
@@ -77,12 +77,11 @@ export declare function getDemoAgentByHandle(handle: string): Partial<{
77
77
  handle: string;
78
78
  }[] | null | undefined;
79
79
  model?: string | null | undefined;
80
- lastActivityAt?: string | null | undefined;
80
+ lastActiveAt?: string | null | undefined;
81
81
  lastMessageAt?: string | null | undefined;
82
82
  instanceId?: string | null | undefined;
83
83
  instanceProvider?: string | null | undefined;
84
84
  imageVersion?: string | null | undefined;
85
- deployEnv?: string | undefined;
86
85
  runtime?: string | undefined;
87
86
  botServerUrl?: string | null | undefined;
88
87
  desiredStatus?: "active" | "stopped" | null | undefined;
@@ -103,5 +102,13 @@ export declare function getDemoAgentByHandle(handle: string): Partial<{
103
102
  liveStatus?: "error" | "stopped" | "unknown" | "running" | "starting" | "stopping" | "warming" | "never_started" | "unreachable" | "not-deployed" | undefined;
104
103
  sinceAt?: string | undefined;
105
104
  errorReason?: string | undefined;
105
+ blocker?: {
106
+ bucket: "error" | "account";
107
+ code: "billing_no_plan" | "billing_past_due" | "billing_runaway_cap" | "billing_budget_reached" | "agent_not_deployed" | "agent_boot_failed" | "agent_unreachable" | "agent_wake_timeout" | "stream_timeout" | "stream_disconnect" | "empty_stream" | "rate_limit";
108
+ title: string;
109
+ actionLabel: string;
110
+ actionUrl: string;
111
+ help?: string | undefined;
112
+ } | undefined;
106
113
  }> | undefined;
107
114
  export { staticAgents } from '@/modules/agent/static/data';