@dvina/sdk 5.0.32 → 5.0.37

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.
@@ -1,8 +1,8 @@
1
1
  import { UIMessage, DefaultChatTransport } from 'ai';
2
- import { D as DvinaSdk, C as ChatMessage, a as ChatMessageConnection } from '../_generated_sdk-DyruM-7a.js';
2
+ import { D as DvinaSdk, C as ChatMessage, a as ChatMessageConnection } from '../_generated_sdk-B4e8pKtm.js';
3
3
  import '../types-yxD7snVR.js';
4
4
  import 'graphql';
5
- import '../connection-zk_rmepe.js';
5
+ import '../connection-HOna02nB.js';
6
6
  import 'dexie';
7
7
  import '../error-aFALORBM.js';
8
8
  import '../billing/index.js';
@@ -22,7 +22,8 @@ type DvinaTaskStatus = 'running' | DvinaTurnOutcome;
22
22
  /**
23
23
  * What a turn waits for before it goes on by itself, in the same reply: the AI service answering again (`service`),
24
24
  * Dvina's computer starting (`computer`), the user's Mac coming back online (`desktop`), the usage window resetting
25
- * (`quota`, at `until`), a connected app signed in to again (`reconnect`, the app in `app`), or the user's computer
25
+ * (`quota`, at `until`), an app signed in to (`reconnect`, the app in `app`: again, or the first time with `connect`),
26
+ * or the user's computer
26
27
  * unlocked again for a step that sees its screen (`locked`). Only `reconnect` and `quota` are the user's to act on in
27
28
  * Dvina; the others ask nothing of it.
28
29
  */
@@ -38,12 +39,19 @@ type DvinaTurnHold = {
38
39
  app?: string;
39
40
  /** The app's name as the user knows it, for `reconnect`. */
40
41
  appName?: string;
42
+ /** For `reconnect`: the app was never connected, so the user connects it, rather than signing in to it again. */
43
+ connect?: boolean;
41
44
  };
42
45
  /** Metadata attached to every Dvina chat message. */
43
46
  type DvinaMessageMetadata = {
44
47
  createdAt?: string;
45
48
  /** When an assistant message finished streaming. */
46
49
  finishedAt?: string;
50
+ /**
51
+ * How long the reply worked (ms), over all its turns: never the time it waited between them (for the user's answer
52
+ * or approval, an app to be connected). What the app says as the run's duration.
53
+ */
54
+ workedMs?: number;
47
55
  /** The reply was stopped by the user before it finished. */
48
56
  stopped?: boolean;
49
57
  /** Why the model ended the reply's last step, as the AI SDK reports it (`stop`, `length`, `tool-calls`, …). */
@@ -55,6 +63,11 @@ type DvinaMessageMetadata = {
55
63
  outcome?: DvinaTurnOutcome;
56
64
  /** Why an `incomplete` or `failed` turn ended: `budget` (step or token limit), `error`, or a finish reason. */
57
65
  outcomeReason?: string;
66
+ /**
67
+ * When the reader closed the card of a task's reply that ended needing them ("Not now"): the reply waits on them no
68
+ * more, on any device, and is never asked again; only a later reply that asks again does.
69
+ */
70
+ dismissedAt?: string;
58
71
  /** The ask-supervisor call whose question was sent to the supervisor (sent once per call, kept across restarts). */
59
72
  askSentFor?: string;
60
73
  /**
@@ -139,6 +152,17 @@ type DvinaMessageMetadata = {
139
152
  * panel shows that message's own words; a message the supervisor added on its own has none.
140
153
  */
141
154
  triggeredBy?: string;
155
+ /**
156
+ * On a message a task chat received from the supervisor on its own, with no message of the user's behind it (it
157
+ * answered the task's question for the user, or passed it another task's word): the run it starts goes on with the
158
+ * user's request, so its report updates that request's report in place, as one row (Muhammed 2026-11-03).
159
+ */
160
+ followUp?: boolean;
161
+ /**
162
+ * On a hidden input of the main chat: its reply is Dvina's own business, stored hidden and never drawn (the turn on a
163
+ * task's question, which it answers for the user from what they said, or leaves to the question's card).
164
+ */
165
+ unseenReply?: boolean;
142
166
  /**
143
167
  * On an assistant reply: the user's predicted next message, shown in an empty composer (ghost text), and when
144
168
  * it was predicted; `null` when none fits. Absent until the client asks for it.
@@ -261,6 +285,22 @@ type DvinaDataParts = {
261
285
  artifactCount?: number;
262
286
  /** Tasks Dvina started in the call. */
263
287
  taskCount?: number;
288
+ /**
289
+ * A call Dvina made because the user asked for it ("call me when…"): its reason line and how it went. A ring
290
+ * that was answered is the call itself; one missed, declined or held (quiet hours, the day's cap, the user in
291
+ * the app) is a quiet line with "Call back" and "Don't call me for this again".
292
+ */
293
+ incoming?: {
294
+ /** The call-kind schedule it came from: "Don't call me for this again" cancels it. */
295
+ scheduleId?: string;
296
+ attemptId: string;
297
+ reason: string;
298
+ outcome: 'Answered' | 'Declined' | 'Missed' | 'Notified' | 'Shown';
299
+ /** Why it did not ring (`quiet-hours`, `daily-cap`, `in-app`…); absent when it rang. */
300
+ held?: string;
301
+ /** Its schedule paused after this one (three missed calls in a row). */
302
+ turnedOff?: boolean;
303
+ };
264
304
  };
265
305
  /**
266
306
  * A chat, task or thread someone shared with the reader: its card in their main chat, at the moment it was
@@ -415,6 +455,15 @@ type DvinaDataParts = {
415
455
  * Unknown to older apps, which show the task as before.
416
456
  */
417
457
  'goal-evaluation': DvinaGoalEvaluation;
458
+ /**
459
+ * What the model read as a failed tool call's result (`toolCallId`), word for word: its errorText is a code the
460
+ * app words, so the next turns send the call as it was sent, and the provider's cache of the conversation holds.
461
+ * Internal: never drawn.
462
+ */
463
+ 'tool-error': {
464
+ toolCallId: string;
465
+ text: string;
466
+ };
418
467
  };
419
468
  /** What a goal's run is doing. */
420
469
  type DvinaGoalStatus = 'proposed' | 'pursuing'
@@ -501,6 +550,13 @@ type DvinaUIMessage = UIMessage<DvinaMessageMetadata, DvinaDataParts>;
501
550
  type DvinaToolMetadata = {
502
551
  toolKit?: string;
503
552
  };
553
+ /** What a stored message says of the messages it links to, as a reply's task is read from them. */
554
+ type DvinaMessageLinks = {
555
+ inResponseToId?: string | null;
556
+ referencedChatId?: string | null;
557
+ };
558
+ /** replyTargetSteps over the messages in hand: `links` reads one by id (undefined when it is not there). */
559
+ declare function replyTargetIn(message: DvinaUIMessage | undefined, links: (messageId: string) => DvinaMessageLinks | null | undefined): string | undefined;
504
560
 
505
561
  type DvinaChatTransportOptions = {
506
562
  /** API origin including protocol, e.g. `https://api.dvina.ai`. */
@@ -533,7 +589,7 @@ declare function createDvinaChatTransport(options: DvinaChatTransportOptions): D
533
589
  declare function createDvinaTemporaryChatTransport(options: DvinaChatTransportOptions): DefaultChatTransport<DvinaUIMessage>;
534
590
 
535
591
  /** The chat actions of the SDK, as the functions below call them. */
536
- type DvinaChatActionsSdk = Pick<DvinaSdk, 'sendChatMessageWhileRunning' | 'chatNextPrompt' | 'stopChat' | 'grantChatApproval' | 'respondChatApproval' | 'answerChatQuestion' | 'returnToMainChat' | 'startChatDay'>;
592
+ type DvinaChatActionsSdk = Pick<DvinaSdk, 'sendChatMessageWhileRunning' | 'chatNextPrompt' | 'stopChat' | 'grantChatApproval' | 'respondChatApproval' | 'answerChatQuestion' | 'dismissTaskQuestion' | 'returnToMainChat' | 'startChatDay'>;
537
593
  /**
538
594
  * Sends a user message while the chat's turn runs: the server stores it at once (every device shows it) and answers it
539
595
  * with the chat's next turn, without cutting the running reply off. Sending it again under the same id changes nothing,
@@ -565,6 +621,12 @@ declare function respondDvinaApproval(sdk: DvinaChatActionsSdk, chatId: string,
565
621
  }): Promise<DvinaAnswerOutcome>;
566
622
  /** Answers a chat's waiting question from outside the chat (a notification's reply): one answer list per question. */
567
623
  declare function answerDvinaQuestion(sdk: DvinaChatActionsSdk, chatId: string, toolCallId: string, answers: string[][]): Promise<DvinaAnswerOutcome>;
624
+ /**
625
+ * The reader's "Not now" on the card of a task whose run ended needing them: that run (the task's latest reply,
626
+ * `replyId`) waits on them no more, on every device, and is not asked again. A task that asked again since keeps its
627
+ * new wait (the server changes nothing then).
628
+ */
629
+ declare function dismissDvinaTaskQuestion(sdk: DvinaChatActionsSdk, taskChatId: string, replyId: string): Promise<void>;
568
630
  /**
569
631
  * Tells the server the user is back (the app opened or came to the foreground): the results that finished while
570
632
  * they were away arrive as one summary in the main chat. Idempotent within one absence.
@@ -626,4 +688,4 @@ type DvinaLazyToolOutput = {
626
688
  /** The held-back output a tool part carries instead of its output, or `null` for a whole output. */
627
689
  declare function lazyToolOutputOf(output: unknown): DvinaLazyToolOutput | null;
628
690
 
629
- export { type DvinaAnswerOutcome, type DvinaChatActionsSdk, type DvinaChatMessageNode, type DvinaChatTransportOptions, type DvinaDataParts, type DvinaGoal, type DvinaGoalCriterion, type DvinaGoalEvaluation, type DvinaGoalStatus, type DvinaHoldReason, type DvinaLazyToolOutput, type DvinaMessageMetadata, type DvinaMessagePage, type DvinaMessageRoute, type DvinaTaskStatus, type DvinaToolMetadata, type DvinaTurnHold, type DvinaTurnOutcome, type DvinaUIMessage, MAX_MESSAGE_PAGE, answerDvinaQuestion, createDvinaChatTransport, createDvinaTemporaryChatTransport, dvinaMessagePageOf, dvinaUIMessageOf, fetchAllDvinaChatMessages, fetchDvinaNextPrompt, grantDvinaTaskApproval, lazyToolOutputOf, postDvinaChatMessage, respondDvinaApproval, returnToDvinaMainChat, startDvinaDay, stopDvinaChat };
691
+ export { type DvinaAnswerOutcome, type DvinaChatActionsSdk, type DvinaChatMessageNode, type DvinaChatTransportOptions, type DvinaDataParts, type DvinaGoal, type DvinaGoalCriterion, type DvinaGoalEvaluation, type DvinaGoalStatus, type DvinaHoldReason, type DvinaLazyToolOutput, type DvinaMessageLinks, type DvinaMessageMetadata, type DvinaMessagePage, type DvinaMessageRoute, type DvinaTaskStatus, type DvinaToolMetadata, type DvinaTurnHold, type DvinaTurnOutcome, type DvinaUIMessage, MAX_MESSAGE_PAGE, answerDvinaQuestion, createDvinaChatTransport, createDvinaTemporaryChatTransport, dismissDvinaTaskQuestion, dvinaMessagePageOf, dvinaUIMessageOf, fetchAllDvinaChatMessages, fetchDvinaNextPrompt, grantDvinaTaskApproval, lazyToolOutputOf, postDvinaChatMessage, replyTargetIn, respondDvinaApproval, returnToDvinaMainChat, startDvinaDay, stopDvinaChat };
package/dist/ai/index.js CHANGED
@@ -1 +1 @@
1
- import {a}from'../chunk-32KGDH2Q.js';import {b as b$1,c}from'../chunk-37LLNIGO.js';import'../chunk-EK7ODJWE.js';import {DefaultChatTransport}from'ai';function S(e){let t=`${e.apiUrl.replace(/\/+$/,"")}/api/chat`;return new DefaultChatTransport({api:t,fetch:h(l(e)),prepareSendMessagesRequest:({id:a,messages:n,trigger:r,messageId:o,body:s})=>({api:`${t}/${encodeURIComponent(a)}`,body:{...s,trigger:r,messageId:o,message:n[n.length-1]}}),prepareReconnectToStreamRequest:({id:a})=>({api:`${t}/${encodeURIComponent(a)}/stream`})})}function w(e){return new DefaultChatTransport({api:`${e.apiUrl.replace(/\/+$/,"")}/api/temporary-chat`,fetch:h(l(e))})}var _=[1e3,2e3,4e3,8e3,15e3,3e4],x=429,E=6e4;function h(e,t=_,a=[503]){return async(n,r)=>{for(let o of t){let s=await e(n,r).catch(u=>{if(r?.signal?.aborted||!(u instanceof TypeError))throw u;return null}),i=s?.status===x;if(s&&!i&&!a.includes(s.status))return s;await s?.body?.cancel().catch(()=>{}),await R(i?P(s,o):o,r?.signal??void 0);}return e(n,r)}}function P(e,t){let a=Number.NaN;return e.headers.forEach((n,r)=>{Number.isNaN(a)&&r.toLowerCase().startsWith("retry-after")&&(a=Number(n));}),Number.isFinite(a)&&a>0?Math.min(Math.max(a*1e3,t),E):t}function R(e,t){return new Promise((a,n)=>{if(t?.aborted)return n(t.reason);let r=setTimeout(()=>{t?.removeEventListener("abort",o),a();},e),o=()=>{clearTimeout(r),n(t?.reason);};t?.addEventListener("abort",o,{once:true});})}var O=a();function l(e){let t=e.fetch??globalThis.fetch.bind(globalThis),a=async(n,r,o)=>{let s=new Headers(r?.headers);s.set("Authorization",`Bearer ${await e.getToken({forceRefresh:o})}`);let i=O();i&&!s.has("x-user-timezone")&&s.set("x-user-timezone",i);let u=e.getLanguage?.();return u&&!s.has("x-preferred-language")&&s.set("x-preferred-language",u),t(n,{...r,headers:s})};return async(n,r)=>{let o=await a(n,r,false);return o.status===401?a(n,r,true):o}}async function I(e,t,a,n){await p(()=>e.sendChatMessageWhileRunning({chatId:t,message:a}),{statuses:q,rateLimited:true,signal:n});}async function N(e,t){let a=await p(()=>e.chatNextPrompt({chatId:t}),{delaysMs:[1e3,3e3]});return typeof a=="string"&&a.trim()?a:null}async function U(e,t){await p(()=>e.stopChat({chatId:t}),{statuses:f});}async function k(e,t,a){await p(()=>e.grantChatApproval({chatId:t,toolName:a}),{statuses:f,signal:AbortSignal.timeout(A)});}function L(e,t,a,n){return M(()=>e.respondChatApproval({chatId:t,toolCallId:a,approved:n.approved,always:n.always}))}function z(e,t,a,n){return M(()=>e.answerChatQuestion({chatId:t,toolCallId:a,answers:n}))}async function G(e){await e.returnToMainChat();}async function j(e){return {started:await e.startChatDay()}}async function M(e){try{return await p(e,{statuses:f,signal:AbortSignal.timeout(A)}),"sent"}catch(t){if(Y(t))return "answered-elsewhere";throw t}}function Y(e){return e instanceof b$1&&e.errors.some(t=>t.message===D||t.extensions?.code===D)}var D="NOT_WAITING";function W(e){return e instanceof c?e.status===T:e instanceof b$1&&e.errors.some(t=>/ThrottlerException|Too Many Requests/i.test(t.message)||t.extensions?.code==="TOO_MANY_REQUESTS"||t.extensions?.originalError?.statusCode===T)}var $=[1e3,2e3,4e3,8e3,15e3,3e4],Q=[503],q=[500,502,503,504],T=429,f=[502,503,504],A=9e4,y=0;async function p(e,{delaysMs:t=$,statuses:a=Q,rateLimited:n=false,signal:r}={}){let o=s=>s instanceof c&&(s.status===y||a.includes(s.status??y))||n&&W(s);for(let s of t){try{return await C(e(),r)}catch(i){if(r?.aborted||!o(i))throw i}await F(s,r);}return C(e(),r)}function C(e,t){return t?t.aborted?Promise.reject(t.reason):new Promise((a,n)=>{let r=()=>n(t.reason);t.addEventListener("abort",r,{once:true}),e.then(a,n).finally(()=>t.removeEventListener("abort",r));}):e}function F(e,t){return new Promise((a,n)=>{if(t?.aborted)return n(t.reason);let r=setTimeout(()=>{t?.removeEventListener("abort",o),a();},e),o=()=>{clearTimeout(r),n(t?.reason);};t?.addEventListener("abort",o,{once:true});})}function v(e){return {id:e.id,role:e.role,parts:e.parts??[],...e.metadata?{metadata:e.metadata}:{}}}function H(e){let{pageInfo:t}=e;return {messages:e.nodes.map(v),hasOlder:t.hasPreviousPage,hasNewer:t.hasNextPage,...t.startCursor?{startCursor:t.startCursor}:{},...t.endCursor?{endCursor:t.endCursor}:{}}}var b=200;async function X(e,t,{pageSize:a=b}={}){let n=[],r;for(;;){let o=await e.chatMessages({...t,first:a,after:r}).fetch();n.push(...o.nodes.map(v));let s=o.pageInfo.endCursor??void 0;if(!o.pageInfo.hasNextPage||!s||s===r)return n;r=s;}}function B(e){if(!e||typeof e!="object"||!("dvinaLazyOutput"in e))return null;let t=e.dvinaLazyOutput;if(!t||typeof t!="object")return null;let{bytes:a,preview:n,urls:r}=t;return {bytes:typeof a=="number"?a:0,preview:typeof n=="string"?n:"",urls:Array.isArray(r)?r.filter(o=>typeof o=="string"):[]}}export{b as MAX_MESSAGE_PAGE,z as answerDvinaQuestion,S as createDvinaChatTransport,w as createDvinaTemporaryChatTransport,H as dvinaMessagePageOf,v as dvinaUIMessageOf,X as fetchAllDvinaChatMessages,N as fetchDvinaNextPrompt,k as grantDvinaTaskApproval,B as lazyToolOutputOf,I as postDvinaChatMessage,L as respondDvinaApproval,G as returnToDvinaMainChat,j as startDvinaDay,U as stopDvinaChat};
1
+ import {a}from'../chunk-32KGDH2Q.js';import {b as b$1,c as c$1}from'../chunk-37LLNIGO.js';import'../chunk-EK7ODJWE.js';import {DefaultChatTransport}from'ai';function*k(e,{named:t=true}={}){if(e?.role!=="user")return;if(t&&e.metadata?.inResponseToTaskChatId)return e.metadata.inResponseToTaskChatId;let n=e.metadata?.inResponseToId??void 0;for(let a=0;n&&a<2;a++){let s=yield n;if(s?.referencedChatId)return s.referencedChatId;n=s?.inResponseToId??void 0;}}function f(e,t){let n=k(e),a=n.next();for(;!a.done;)a=n.next(t(a.value));return a.value}function A(e){let t=`${e.apiUrl.replace(/\/+$/,"")}/api/chat`;return new DefaultChatTransport({api:t,fetch:D(T(e)),prepareSendMessagesRequest:({id:n,messages:a,trigger:s,messageId:i,body:r})=>({api:`${t}/${encodeURIComponent(n)}`,body:{...r,trigger:s,messageId:i,message:a[a.length-1]}}),prepareReconnectToStreamRequest:({id:n})=>({api:`${t}/${encodeURIComponent(n)}/stream`})})}function S(e){return new DefaultChatTransport({api:`${e.apiUrl.replace(/\/+$/,"")}/api/temporary-chat`,fetch:D(T(e))})}var w=[1e3,2e3,4e3,8e3,15e3,3e4],R=429,P=6e4;function D(e,t=w,n=[503]){return async(a,s)=>{for(let i of t){let r=await e(a,s).catch(d=>{if(s?.signal?.aborted||!(d instanceof TypeError))throw d;return null}),o=r?.status===R;if(r&&!o&&!n.includes(r.status))return r;await r?.body?.cancel().catch(()=>{}),await E(o?_(r,i):i,s?.signal??void 0);}return e(a,s)}}function _(e,t){let n=Number.NaN;return e.headers.forEach((a,s)=>{Number.isNaN(n)&&s.toLowerCase().startsWith("retry-after")&&(n=Number(a));}),Number.isFinite(n)&&n>0?Math.min(Math.max(n*1e3,t),P):t}function E(e,t){return new Promise((n,a)=>{if(t?.aborted)return a(t.reason);let s=setTimeout(()=>{t?.removeEventListener("abort",i),n();},e),i=()=>{clearTimeout(s),a(t?.reason);};t?.addEventListener("abort",i,{once:true});})}var O=a();function T(e){let t=e.fetch??globalThis.fetch.bind(globalThis),n=async(a,s,i)=>{let r=new Headers(s?.headers);r.set("Authorization",`Bearer ${await e.getToken({forceRefresh:i})}`);let o=O();o&&!r.has("x-user-timezone")&&r.set("x-user-timezone",o);let d=e.getLanguage?.();return d&&!r.has("x-preferred-language")&&r.set("x-preferred-language",d),t(a,{...s,headers:r})};return async(a,s)=>{let i=await n(a,s,false);return i.status===401?n(a,s,true):i}}async function U(e,t,n,a){await u(()=>e.sendChatMessageWhileRunning({chatId:t,message:n}),{statuses:F,rateLimited:true,signal:a});}async function N(e,t){let n=await u(()=>e.chatNextPrompt({chatId:t}),{delaysMs:[1e3,3e3]});return typeof n=="string"&&n.trim()?n:null}async function L(e,t){await u(()=>e.stopChat({chatId:t}),{statuses:g});}async function G(e,t,n){await u(()=>e.grantChatApproval({chatId:t,toolName:n}),{statuses:g,signal:AbortSignal.timeout(c)});}function z(e,t,n,a){return I(()=>e.respondChatApproval({chatId:t,toolCallId:n,approved:a.approved,always:a.always}))}function j(e,t,n,a){return I(()=>e.answerChatQuestion({chatId:t,toolCallId:n,answers:a}))}async function H(e,t,n){await u(()=>e.dismissTaskQuestion({chatId:t,messageId:n}),{statuses:g,signal:AbortSignal.timeout(c)});}async function Q(e){await e.returnToMainChat();}async function Y(e){return {started:await e.startChatDay()}}async function I(e){try{return await u(e,{statuses:g,signal:AbortSignal.timeout(c)}),"sent"}catch(t){if(W(t))return "answered-elsewhere";throw t}}function W(e){return e instanceof b$1&&e.errors.some(t=>t.message===b||t.extensions?.code===b)}var b="NOT_WAITING";function $(e){return e instanceof c$1?e.status===y:e instanceof b$1&&e.errors.some(t=>/ThrottlerException|Too Many Requests/i.test(t.message)||t.extensions?.code==="TOO_MANY_REQUESTS"||t.extensions?.originalError?.statusCode===y)}var q=[1e3,2e3,4e3,8e3,15e3,3e4],B=[503],F=[500,502,503,504],y=429,g=[502,503,504],c=9e4,C=0;async function u(e,{delaysMs:t=q,statuses:n=B,rateLimited:a=false,signal:s}={}){let i=r=>r instanceof c$1&&(r.status===C||n.includes(r.status??C))||a&&$(r);for(let r of t){try{return await M(e(),s)}catch(o){if(s?.aborted||!i(o))throw o}await X(r,s);}return M(e(),s)}function M(e,t){return t?t.aborted?Promise.reject(t.reason):new Promise((n,a)=>{let s=()=>a(t.reason);t.addEventListener("abort",s,{once:true}),e.then(n,a).finally(()=>t.removeEventListener("abort",s));}):e}function X(e,t){return new Promise((n,a)=>{if(t?.aborted)return a(t.reason);let s=setTimeout(()=>{t?.removeEventListener("abort",i),n();},e),i=()=>{clearTimeout(s),a(t?.reason);};t?.addEventListener("abort",i,{once:true});})}function m(e){return {id:e.id,role:e.role,parts:e.parts??[],...e.metadata?{metadata:e.metadata}:{}}}function K(e){let{pageInfo:t}=e;return {messages:e.nodes.map(m),hasOlder:t.hasPreviousPage,hasNewer:t.hasNextPage,...t.startCursor?{startCursor:t.startCursor}:{},...t.endCursor?{endCursor:t.endCursor}:{}}}var x=200;async function V(e,t,{pageSize:n=x}={}){let a=[],s;for(;;){let i=await e.chatMessages({...t,first:n,after:s}).fetch();a.push(...i.nodes.map(m));let r=i.pageInfo.endCursor??void 0;if(!i.pageInfo.hasNextPage||!r||r===s)return a;s=r;}}function J(e){if(!e||typeof e!="object"||!("dvinaLazyOutput"in e))return null;let t=e.dvinaLazyOutput;if(!t||typeof t!="object")return null;let{bytes:n,preview:a,urls:s}=t;return {bytes:typeof n=="number"?n:0,preview:typeof a=="string"?a:"",urls:Array.isArray(s)?s.filter(i=>typeof i=="string"):[]}}export{x as MAX_MESSAGE_PAGE,j as answerDvinaQuestion,A as createDvinaChatTransport,S as createDvinaTemporaryChatTransport,H as dismissDvinaTaskQuestion,K as dvinaMessagePageOf,m as dvinaUIMessageOf,V as fetchAllDvinaChatMessages,N as fetchDvinaNextPrompt,G as grantDvinaTaskApproval,J as lazyToolOutputOf,U as postDvinaChatMessage,f as replyTargetIn,z as respondDvinaApproval,Q as returnToDvinaMainChat,Y as startDvinaDay,L as stopDvinaChat};