@noodleseed/assistant 1.7.0 → 1.9.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.
Files changed (50) hide show
  1. package/README.md +101 -22
  2. package/dist/{appearance-DowzFJjh.d.cts → appearance-Cc-eqSbp.d.cts} +1 -1
  3. package/dist/{appearance-DowzFJjh.d.ts → appearance-Cc-eqSbp.d.ts} +1 -1
  4. package/dist/{chunk-UXPKSCID.js → chunk-3YYTUJPJ.js} +2 -2
  5. package/dist/{chunk-35A7REQX.js → chunk-4B3XXGRP.js} +256 -91
  6. package/dist/chunk-4B3XXGRP.js.map +1 -0
  7. package/dist/{chunk-NSBPE2FW.js → chunk-5FUTL2UF.js} +6 -1
  8. package/dist/chunk-BLMJHF7U.js +544 -0
  9. package/dist/chunk-BLMJHF7U.js.map +1 -0
  10. package/dist/chunk-RYQBXTLR.js +9089 -0
  11. package/dist/chunk-RYQBXTLR.js.map +1 -0
  12. package/dist/{client-D2Y9UFh3.d.cts → client-B803xZVn.d.ts} +44 -2
  13. package/dist/{client-DBuETUVD.d.ts → client-CsmtpD1z.d.cts} +44 -2
  14. package/dist/client.cjs +22976 -92
  15. package/dist/client.cjs.map +1 -1
  16. package/dist/client.d.cts +3 -2
  17. package/dist/client.d.ts +3 -2
  18. package/dist/client.js +3 -2
  19. package/dist/index.cjs +10750 -2212
  20. package/dist/index.cjs.map +1 -1
  21. package/dist/index.d.cts +4 -3
  22. package/dist/index.d.ts +4 -3
  23. package/dist/index.js +4 -4
  24. package/dist/react/client.cjs +23688 -0
  25. package/dist/react/client.cjs.map +1 -0
  26. package/dist/react/client.d.cts +24 -0
  27. package/dist/react/client.d.ts +24 -0
  28. package/dist/react/client.js +76 -0
  29. package/dist/react/client.js.map +1 -0
  30. package/dist/react.cjs +10803 -2215
  31. package/dist/react.cjs.map +1 -1
  32. package/dist/react.d.cts +23 -4
  33. package/dist/react.d.ts +23 -4
  34. package/dist/react.js +64 -14
  35. package/dist/react.js.map +1 -1
  36. package/dist/server.d.cts +1 -1
  37. package/dist/server.d.ts +1 -1
  38. package/dist/server.js +1 -1
  39. package/dist/token-Y6KCR3JT.js +70 -0
  40. package/dist/token-Y6KCR3JT.js.map +1 -0
  41. package/dist/token-util-XFYMRPAB.js +6 -0
  42. package/dist/{v4-2UXPDMWJ.js → v4-KBRL3YLO.js} +3 -3
  43. package/dist/v4-KBRL3YLO.js.map +1 -0
  44. package/package.json +14 -3
  45. package/dist/chunk-35A7REQX.js.map +0 -1
  46. package/dist/chunk-7E5HINN4.js +0 -713
  47. package/dist/chunk-7E5HINN4.js.map +0 -1
  48. /package/dist/{chunk-UXPKSCID.js.map → chunk-3YYTUJPJ.js.map} +0 -0
  49. /package/dist/{chunk-NSBPE2FW.js.map → chunk-5FUTL2UF.js.map} +0 -0
  50. /package/dist/{v4-2UXPDMWJ.js.map → token-util-XFYMRPAB.js.map} +0 -0
@@ -1,4 +1,5 @@
1
- import { a as AssistantConfiguration } from './appearance-DowzFJjh.cjs';
1
+ import { A as AssistantConfiguration } from './appearance-Cc-eqSbp.js';
2
+ import { ChatStatus, UIMessage } from 'ai';
2
3
 
3
4
  type AssistantJsonValue = string | number | boolean | null | readonly AssistantJsonValue[] | {
4
5
  readonly [key: string]: AssistantJsonValue;
@@ -122,6 +123,43 @@ interface AssistantUnrecognizedEvent {
122
123
  /** Closed event union for the DOM-free client; unknown future SSE names remain observable safely. */
123
124
  type AssistantClientEvent = AssistantContentEvent | AssistantToolProposedEvent | AssistantInputRequestedEvent | AssistantInteractionResolvedEvent | AssistantToolCompletedEvent | AssistantViewAvailableEvent | AssistantErrorEvent | AssistantDoneEvent | NamedEvent<'interaction_proposed', AssistantLegacyInteractionProposedDetail> | AssistantClientLifecycleEvent | AssistantUnrecognizedEvent;
124
125
 
126
+ type AssistantInteractionStatus = 'pending' | 'submitting' | 'accepted' | 'declined' | 'cancelled';
127
+ interface AssistantConfirmationData {
128
+ readonly id: string;
129
+ readonly tool?: string;
130
+ readonly title?: string;
131
+ readonly description?: string;
132
+ readonly arguments?: AssistantJsonValue;
133
+ readonly reviewSchema?: Readonly<Record<string, unknown>>;
134
+ readonly expiresAt?: string;
135
+ readonly requiresConfirmation?: true;
136
+ readonly turnId?: string;
137
+ readonly status: AssistantInteractionStatus;
138
+ }
139
+ type AssistantInputRequestData = AssistantInputRequestedDetail & {
140
+ readonly status: AssistantInteractionStatus;
141
+ };
142
+ type AssistantToolResultData = AssistantToolCompletedDetail;
143
+ type AssistantViewData = AssistantViewAvailableDetail;
144
+ type AssistantUIDataTypes = {
145
+ readonly confirmation: AssistantConfirmationData;
146
+ readonly 'input-request': AssistantInputRequestData;
147
+ readonly 'tool-result': AssistantToolResultData;
148
+ readonly view: AssistantViewData;
149
+ };
150
+ /** AI SDK UI message shape used by the DOM-free client and customer-owned renderers. */
151
+ type AssistantUIMessage = UIMessage<undefined, AssistantUIDataTypes>;
152
+ interface AssistantChatError {
153
+ readonly name: string;
154
+ readonly message: string;
155
+ readonly detail?: AssistantErrorDetail;
156
+ }
157
+ interface AssistantChatState {
158
+ readonly status: ChatStatus;
159
+ readonly messages: readonly AssistantUIMessage[];
160
+ readonly error?: AssistantChatError;
161
+ }
162
+
125
163
  type AssistantContextValue = string | number | boolean | null;
126
164
  type AssistantContext = Readonly<Record<string, AssistantContextValue>>;
127
165
  interface AssistantClientContext {
@@ -163,6 +201,10 @@ interface CreateAssistantClientOptions<TPageContext extends AssistantPageContext
163
201
  }
164
202
  interface AssistantClient<TPageContext extends AssistantPageContext = AssistantContext> {
165
203
  subscribe(listener: (event: AssistantClientEvent) => void): () => void;
204
+ /** Subscribe to detached AI SDK UIMessage state; the listener receives the current state immediately. */
205
+ subscribeChat(listener: (state: AssistantChatState) => void): () => void;
206
+ /** Read a detached snapshot suitable for a framework-owned renderer. */
207
+ getChatState(): AssistantChatState;
166
208
  connect(): Promise<void>;
167
209
  sendMessage(message: string): Promise<void>;
168
210
  respond(id: string, response: AssistantInteractionResponse): Promise<void>;
@@ -184,4 +226,4 @@ declare class AssistantClientError extends Error {
184
226
  }
185
227
  declare function createAssistantClient<TPageContext extends AssistantPageContext = AssistantContext>(options: CreateAssistantClientOptions<TPageContext>): AssistantClient<TPageContext>;
186
228
 
187
- export { type AssistantPageContext as A, type AssistantToolProposedDetail as B, type AssistantToolProposedEvent as C, type AssistantUnrecognizedEvent as D, type CreateAssistantClientOptions as E, createAssistantClient as F, type AssistantContext as a, type AssistantModelContextUpdate as b, type AssistantClientEvent as c, type AssistantErrorDetail as d, type AssistantViewAvailableDetail as e, type AssistantInteractionResponse as f, type AssistantEvent as g, type AssistantViewAvailableEvent as h, type AssistantClient as i, type AssistantClientContext as j, AssistantClientError as k, type AssistantClientLifecycleEvent as l, type AssistantContentDetail as m, type AssistantContentEvent as n, type AssistantContextValue as o, type AssistantDoneEvent as p, type AssistantErrorEvent as q, type AssistantErrorEventDetail as r, type AssistantInputRequestedDetail as s, type AssistantInputRequestedEvent as t, type AssistantInteractionResolvedDetail as u, type AssistantInteractionResolvedEvent as v, type AssistantJsonValue as w, type AssistantSessionResponse as x, type AssistantToolCompletedDetail as y, type AssistantToolCompletedEvent as z };
229
+ export { type AssistantPageContext as A, type AssistantInteractionStatus as B, type CreateAssistantClientOptions as C, type AssistantJsonValue as D, type AssistantSessionResponse as E, type AssistantToolCompletedDetail as F, type AssistantToolCompletedEvent as G, type AssistantToolProposedDetail as H, type AssistantToolProposedEvent as I, type AssistantToolResultData as J, type AssistantUIDataTypes as K, type AssistantUIMessage as L, type AssistantUnrecognizedEvent as M, type AssistantViewData as N, createAssistantClient as O, type AssistantContext as a, type AssistantChatState as b, type AssistantClient as c, type AssistantViewAvailableDetail as d, type AssistantModelContextUpdate as e, type AssistantClientEvent as f, type AssistantErrorDetail as g, type AssistantInteractionResponse as h, type AssistantEvent as i, type AssistantViewAvailableEvent as j, type AssistantChatError as k, type AssistantClientContext as l, AssistantClientError as m, type AssistantClientLifecycleEvent as n, type AssistantConfirmationData as o, type AssistantContentDetail as p, type AssistantContentEvent as q, type AssistantContextValue as r, type AssistantDoneEvent as s, type AssistantErrorEvent as t, type AssistantErrorEventDetail as u, type AssistantInputRequestData as v, type AssistantInputRequestedDetail as w, type AssistantInputRequestedEvent as x, type AssistantInteractionResolvedDetail as y, type AssistantInteractionResolvedEvent as z };
@@ -1,4 +1,5 @@
1
- import { a as AssistantConfiguration } from './appearance-DowzFJjh.js';
1
+ import { A as AssistantConfiguration } from './appearance-Cc-eqSbp.cjs';
2
+ import { ChatStatus, UIMessage } from 'ai';
2
3
 
3
4
  type AssistantJsonValue = string | number | boolean | null | readonly AssistantJsonValue[] | {
4
5
  readonly [key: string]: AssistantJsonValue;
@@ -122,6 +123,43 @@ interface AssistantUnrecognizedEvent {
122
123
  /** Closed event union for the DOM-free client; unknown future SSE names remain observable safely. */
123
124
  type AssistantClientEvent = AssistantContentEvent | AssistantToolProposedEvent | AssistantInputRequestedEvent | AssistantInteractionResolvedEvent | AssistantToolCompletedEvent | AssistantViewAvailableEvent | AssistantErrorEvent | AssistantDoneEvent | NamedEvent<'interaction_proposed', AssistantLegacyInteractionProposedDetail> | AssistantClientLifecycleEvent | AssistantUnrecognizedEvent;
124
125
 
126
+ type AssistantInteractionStatus = 'pending' | 'submitting' | 'accepted' | 'declined' | 'cancelled';
127
+ interface AssistantConfirmationData {
128
+ readonly id: string;
129
+ readonly tool?: string;
130
+ readonly title?: string;
131
+ readonly description?: string;
132
+ readonly arguments?: AssistantJsonValue;
133
+ readonly reviewSchema?: Readonly<Record<string, unknown>>;
134
+ readonly expiresAt?: string;
135
+ readonly requiresConfirmation?: true;
136
+ readonly turnId?: string;
137
+ readonly status: AssistantInteractionStatus;
138
+ }
139
+ type AssistantInputRequestData = AssistantInputRequestedDetail & {
140
+ readonly status: AssistantInteractionStatus;
141
+ };
142
+ type AssistantToolResultData = AssistantToolCompletedDetail;
143
+ type AssistantViewData = AssistantViewAvailableDetail;
144
+ type AssistantUIDataTypes = {
145
+ readonly confirmation: AssistantConfirmationData;
146
+ readonly 'input-request': AssistantInputRequestData;
147
+ readonly 'tool-result': AssistantToolResultData;
148
+ readonly view: AssistantViewData;
149
+ };
150
+ /** AI SDK UI message shape used by the DOM-free client and customer-owned renderers. */
151
+ type AssistantUIMessage = UIMessage<undefined, AssistantUIDataTypes>;
152
+ interface AssistantChatError {
153
+ readonly name: string;
154
+ readonly message: string;
155
+ readonly detail?: AssistantErrorDetail;
156
+ }
157
+ interface AssistantChatState {
158
+ readonly status: ChatStatus;
159
+ readonly messages: readonly AssistantUIMessage[];
160
+ readonly error?: AssistantChatError;
161
+ }
162
+
125
163
  type AssistantContextValue = string | number | boolean | null;
126
164
  type AssistantContext = Readonly<Record<string, AssistantContextValue>>;
127
165
  interface AssistantClientContext {
@@ -163,6 +201,10 @@ interface CreateAssistantClientOptions<TPageContext extends AssistantPageContext
163
201
  }
164
202
  interface AssistantClient<TPageContext extends AssistantPageContext = AssistantContext> {
165
203
  subscribe(listener: (event: AssistantClientEvent) => void): () => void;
204
+ /** Subscribe to detached AI SDK UIMessage state; the listener receives the current state immediately. */
205
+ subscribeChat(listener: (state: AssistantChatState) => void): () => void;
206
+ /** Read a detached snapshot suitable for a framework-owned renderer. */
207
+ getChatState(): AssistantChatState;
166
208
  connect(): Promise<void>;
167
209
  sendMessage(message: string): Promise<void>;
168
210
  respond(id: string, response: AssistantInteractionResponse): Promise<void>;
@@ -184,4 +226,4 @@ declare class AssistantClientError extends Error {
184
226
  }
185
227
  declare function createAssistantClient<TPageContext extends AssistantPageContext = AssistantContext>(options: CreateAssistantClientOptions<TPageContext>): AssistantClient<TPageContext>;
186
228
 
187
- export { type AssistantPageContext as A, type AssistantToolProposedDetail as B, type AssistantToolProposedEvent as C, type AssistantUnrecognizedEvent as D, type CreateAssistantClientOptions as E, createAssistantClient as F, type AssistantContext as a, type AssistantModelContextUpdate as b, type AssistantClientEvent as c, type AssistantErrorDetail as d, type AssistantViewAvailableDetail as e, type AssistantInteractionResponse as f, type AssistantEvent as g, type AssistantViewAvailableEvent as h, type AssistantClient as i, type AssistantClientContext as j, AssistantClientError as k, type AssistantClientLifecycleEvent as l, type AssistantContentDetail as m, type AssistantContentEvent as n, type AssistantContextValue as o, type AssistantDoneEvent as p, type AssistantErrorEvent as q, type AssistantErrorEventDetail as r, type AssistantInputRequestedDetail as s, type AssistantInputRequestedEvent as t, type AssistantInteractionResolvedDetail as u, type AssistantInteractionResolvedEvent as v, type AssistantJsonValue as w, type AssistantSessionResponse as x, type AssistantToolCompletedDetail as y, type AssistantToolCompletedEvent as z };
229
+ export { type AssistantPageContext as A, type AssistantInteractionStatus as B, type CreateAssistantClientOptions as C, type AssistantJsonValue as D, type AssistantSessionResponse as E, type AssistantToolCompletedDetail as F, type AssistantToolCompletedEvent as G, type AssistantToolProposedDetail as H, type AssistantToolProposedEvent as I, type AssistantToolResultData as J, type AssistantUIDataTypes as K, type AssistantUIMessage as L, type AssistantUnrecognizedEvent as M, type AssistantViewData as N, createAssistantClient as O, type AssistantContext as a, type AssistantChatState as b, type AssistantClient as c, type AssistantViewAvailableDetail as d, type AssistantModelContextUpdate as e, type AssistantClientEvent as f, type AssistantErrorDetail as g, type AssistantInteractionResponse as h, type AssistantEvent as i, type AssistantViewAvailableEvent as j, type AssistantChatError as k, type AssistantClientContext as l, AssistantClientError as m, type AssistantClientLifecycleEvent as n, type AssistantConfirmationData as o, type AssistantContentDetail as p, type AssistantContentEvent as q, type AssistantContextValue as r, type AssistantDoneEvent as s, type AssistantErrorEvent as t, type AssistantErrorEventDetail as u, type AssistantInputRequestData as v, type AssistantInputRequestedDetail as w, type AssistantInputRequestedEvent as x, type AssistantInteractionResolvedDetail as y, type AssistantInteractionResolvedEvent as z };