blink 0.1.74 → 0.1.76
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.
- package/dist/browser/agent/client/index.cjs +11 -11
- package/dist/browser/agent/client/index.d.cts +3 -3
- package/dist/browser/agent/client/index.d.ts +3 -3
- package/dist/browser/agent/client/index.js +11 -11
- package/dist/browser/agent/index.browser.d.cts +2 -2
- package/dist/browser/agent/index.browser.d.ts +2 -2
- package/dist/browser/{chat-B5eFQu26.d.cts → chat-B3FNVJ5h.d.cts} +1 -1
- package/dist/browser/{chat-BN7SYTWY.d.ts → chat-DDcZEZzi.d.ts} +1 -1
- package/dist/browser/control/index.d.cts +1 -1
- package/dist/browser/control/index.d.ts +1 -1
- package/dist/browser/{index-B5faDAC2.d.ts → index-B5ywu36Q.d.ts} +2 -2
- package/dist/browser/{index-C-GJWB97.d.cts → index-CiKnRuyK.d.cts} +2 -2
- package/dist/browser/{index.browser-CnGab8Yp.d.cts → index.browser-Bivj_NTA.d.cts} +1 -1
- package/dist/browser/{index.browser-BUMCZUeQ.d.ts → index.browser-BzfJXoff.d.ts} +1 -1
- package/dist/browser/{index.node-mda_IL6K.cjs → index.node-BrnIuz4k.cjs} +1 -1
- package/dist/browser/{index.node-DJv-HF6j.js → index.node-CbQFCWTr.js} +1 -1
- package/dist/browser/react/index.cjs +1 -1
- package/dist/browser/react/index.d.cts +3 -3
- package/dist/browser/react/index.d.ts +3 -3
- package/dist/browser/react/index.js +1 -1
- package/dist/cli/auth-BfmMOPP_.js +74 -0
- package/dist/cli/{chat-L0VBV1Zr.js → chat-CChZ6Dgt.js} +1 -1
- package/dist/cli/{connect-Cxa-uIEb.js → connect-D8IAxl-3.js} +3 -3
- package/dist/cli/connect-DSyrG7KH.js +1 -0
- package/dist/cli/{dev-CMwHkKBI.js → dev-IdmzRYNF.js} +62 -56
- package/dist/cli/{getMachineId-bsd-BZVr5tA4.js → getMachineId-bsd-Qx2HBGoH.js} +1 -1
- package/dist/cli/{getMachineId-darwin-CovNSxTh.js → getMachineId-darwin--C6ZfZar.js} +1 -1
- package/dist/cli/{getMachineId-linux-UJ7XEIYa.js → getMachineId-linux-DLLDRjuc.js} +1 -1
- package/dist/cli/{getMachineId-unsupported-DfUiEY7G.js → getMachineId-unsupported-C3vmCtXX.js} +1 -1
- package/dist/cli/{getMachineId-win-DYgilU22.js → getMachineId-win-CPTJv39f.js} +1 -1
- package/dist/cli/{util-D3Iuwmav.js → ignore-BSx5uoz9.js} +1 -1
- package/dist/cli/index.js +4 -4
- package/dist/cli/{init-B6vWokUI.js → init-D-601hh-.js} +2 -2
- package/dist/cli/login-CxmH7hHe.js +1 -0
- package/dist/cli/undici-DD9e2s8L.js +1 -0
- package/dist/node/agent/index.node.cjs +26 -6
- package/dist/node/agent/index.node.d.cts +2 -2
- package/dist/node/agent/index.node.d.ts +2 -2
- package/dist/node/agent/index.node.js +26 -6
- package/dist/node/{index.node-iaeCqAo6.d.cts → index.node-CI1vYz48.d.ts} +22 -4
- package/dist/node/{index.node-BBpGHHxe.d.ts → index.node-rD4Zd2xs.d.cts} +22 -4
- package/dist/node/test.d.cts +1 -1
- package/dist/node/test.d.ts +1 -1
- package/package.json +3 -2
- package/dist/cli/auth-BUNIOupD.js +0 -30
- package/dist/cli/connect-BHyGYU8L.js +0 -1
- package/dist/cli/dist-NqrnQGst.js +0 -45
- package/dist/cli/login-DKW_KVCA.js +0 -1
- package/dist/cli/undici-jJcag_Yq.js +0 -1
- /package/dist/cli/{devtools-BS9tk1Y9.js → devtools-BLozvXLU.js} +0 -0
- /package/dist/cli/{esm-DmR1E1ox.js → esm-Dh_XeXMF.js} +0 -0
- /package/dist/cli/{events-CWgtj8lb.js → events-NKQ6g4j7.js} +0 -0
- /package/dist/cli/{execAsync-q2CSWc1b.js → execAsync-Bms0M8aD.js} +0 -0
- /package/dist/cli/{open-CSMQaj0E.js → open-FpexaS6S.js} +0 -0
- /package/dist/cli/{undici-BG07ys6c.js → undici-DSA55kyn.js} +0 -0
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Chat, ChatBehavior, ChatContext, ChatEvent, ChatHandler, ChatResponse, Context, EnsuredChat, MessageOptions, StoreContext } from "../chat-
|
|
2
|
-
import { ContextFromTools, ExtractUIOptions, StreamResponseFormat, StreamResponseFormatHeader, ToolApprovalOutput, ToolSetWithApproval, ToolWithApproval, ToolWithContext, UIEvent, UIHandler, UIOptionSelect, UIOptionSelectValue, UIOptions, UIOptionsSchema, WithUIOptions, isToolApprovalOutput, lastUIOptions, toolWithApproval, tools, withResponseFormat } from "../index.browser-
|
|
1
|
+
import { Chat, ChatBehavior, ChatContext, ChatEvent, ChatHandler, ChatResponse, Context, EnsuredChat, MessageOptions, StoreContext } from "../chat-B3FNVJ5h.cjs";
|
|
2
|
+
import { ContextFromTools, ExtractUIOptions, StreamResponseFormat, StreamResponseFormatHeader, ToolApprovalOutput, ToolSetWithApproval, ToolWithApproval, ToolWithContext, UIEvent, UIHandler, UIOptionSelect, UIOptionSelectValue, UIOptions, UIOptionsSchema, WithUIOptions, isToolApprovalOutput, lastUIOptions, toolWithApproval, tools, withResponseFormat } from "../index.browser-Bivj_NTA.cjs";
|
|
3
3
|
export { Chat, ChatBehavior, ChatContext, ChatEvent, ChatHandler, ChatResponse, Context, ContextFromTools, EnsuredChat, ExtractUIOptions, MessageOptions, StoreContext, StreamResponseFormat, StreamResponseFormatHeader, ToolApprovalOutput, ToolSetWithApproval, ToolWithApproval, ToolWithContext, UIEvent, UIHandler, UIOptionSelect, UIOptionSelectValue, UIOptions, UIOptionsSchema, WithUIOptions, isToolApprovalOutput, lastUIOptions, toolWithApproval, tools, withResponseFormat };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Chat, ChatBehavior, ChatContext, ChatEvent, ChatHandler, ChatResponse, Context, EnsuredChat, MessageOptions, StoreContext } from "../chat-
|
|
2
|
-
import { ContextFromTools, ExtractUIOptions, StreamResponseFormat, StreamResponseFormatHeader, ToolApprovalOutput, ToolSetWithApproval, ToolWithApproval, ToolWithContext, UIEvent, UIHandler, UIOptionSelect, UIOptionSelectValue, UIOptions, UIOptionsSchema, WithUIOptions, isToolApprovalOutput, lastUIOptions, toolWithApproval, tools, withResponseFormat } from "../index.browser-
|
|
1
|
+
import { Chat, ChatBehavior, ChatContext, ChatEvent, ChatHandler, ChatResponse, Context, EnsuredChat, MessageOptions, StoreContext } from "../chat-DDcZEZzi.js";
|
|
2
|
+
import { ContextFromTools, ExtractUIOptions, StreamResponseFormat, StreamResponseFormatHeader, ToolApprovalOutput, ToolSetWithApproval, ToolWithApproval, ToolWithContext, UIEvent, UIHandler, UIOptionSelect, UIOptionSelectValue, UIOptions, UIOptionsSchema, WithUIOptions, isToolApprovalOutput, lastUIOptions, toolWithApproval, tools, withResponseFormat } from "../index.browser-BzfJXoff.js";
|
|
3
3
|
export { Chat, ChatBehavior, ChatContext, ChatEvent, ChatHandler, ChatResponse, Context, ContextFromTools, EnsuredChat, ExtractUIOptions, MessageOptions, StoreContext, StreamResponseFormat, StreamResponseFormatHeader, ToolApprovalOutput, ToolSetWithApproval, ToolWithApproval, ToolWithContext, UIEvent, UIHandler, UIOptionSelect, UIOptionSelectValue, UIOptions, UIOptionsSchema, WithUIOptions, isToolApprovalOutput, lastUIOptions, toolWithApproval, tools, withResponseFormat };
|
|
@@ -116,7 +116,7 @@ interface MessageOptions {
|
|
|
116
116
|
readonly createdAt?: Date;
|
|
117
117
|
}
|
|
118
118
|
interface ChatEvent<MESSAGE extends UIMessage> {
|
|
119
|
-
readonly
|
|
119
|
+
readonly chat: Chat;
|
|
120
120
|
readonly messages: MESSAGE[];
|
|
121
121
|
readonly abortSignal?: AbortSignal;
|
|
122
122
|
readonly context: Context;
|
|
@@ -116,7 +116,7 @@ interface MessageOptions {
|
|
|
116
116
|
readonly createdAt?: Date;
|
|
117
117
|
}
|
|
118
118
|
interface ChatEvent<MESSAGE extends UIMessage> {
|
|
119
|
-
readonly
|
|
119
|
+
readonly chat: Chat;
|
|
120
120
|
readonly messages: MESSAGE[];
|
|
121
121
|
readonly abortSignal?: AbortSignal;
|
|
122
122
|
readonly context: Context;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Context, MessageOptions } from "../chat-
|
|
1
|
+
import { Context, MessageOptions } from "../chat-B3FNVJ5h.cjs";
|
|
2
2
|
import { UIMessage } from "ai";
|
|
3
3
|
import * as hono_utils_http_status0 from "hono/utils/http-status";
|
|
4
4
|
import * as hono_types0 from "hono/types";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Context, MessageOptions } from "../chat-
|
|
1
|
+
import { Context, MessageOptions } from "../chat-DDcZEZzi.js";
|
|
2
2
|
import { UIMessage } from "ai";
|
|
3
3
|
import * as hono_utils_http_status0 from "hono/utils/http-status";
|
|
4
4
|
import * as hono_types0 from "hono/types";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Chat } from "./chat-
|
|
2
|
-
import { UIOptions, UIOptionsSchema } from "./index.browser-
|
|
1
|
+
import { Chat } from "./chat-DDcZEZzi.js";
|
|
2
|
+
import { UIOptions, UIOptionsSchema } from "./index.browser-BzfJXoff.js";
|
|
3
3
|
import { UIMessage, UIMessageChunk } from "ai";
|
|
4
4
|
|
|
5
5
|
//#region src/agent/client/index.d.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Chat } from "./chat-
|
|
2
|
-
import { UIOptions, UIOptionsSchema } from "./index.browser-
|
|
1
|
+
import { Chat } from "./chat-B3FNVJ5h.cjs";
|
|
2
|
+
import { UIOptions, UIOptionsSchema } from "./index.browser-Bivj_NTA.cjs";
|
|
3
3
|
import { UIMessage, UIMessageChunk } from "ai";
|
|
4
4
|
|
|
5
5
|
//#region src/agent/client/index.d.ts
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const e=require(`./index.browser-09e-NXpn.cjs`),t=require(`./validator-CvSEfFnI.cjs`),n=new t.Hono().post(`/chat`,t.validator(`json`,e=>({messages:e.messages,chat:e.chat})),async t=>{let n=t.env.listeners.chat,r=t.req.valid(`json`);for(let a of n){let n;try{n=await a({
|
|
1
|
+
const e=require(`./index.browser-09e-NXpn.cjs`),t=require(`./validator-CvSEfFnI.cjs`),n=new t.Hono().post(`/chat`,t.validator(`json`,e=>({messages:e.messages,chat:e.chat})),async t=>{let n=t.env.listeners.chat,r=t.req.valid(`json`);for(let a of n){let n;try{n=await a({chat:r.chat,messages:r.messages,abortSignal:t.req.raw.signal,context:t.env.context})}catch(t){if(t instanceof e.CustomChatResponseError)n=t.response;else throw t}if(!n)continue;if(n instanceof Response)return n;let o;if(n instanceof ReadableStream)o=n;else if(typeof n==`object`&&`toUIMessageStream`in n)o=n.toUIMessageStream({messageMetadata:({part:e})=>{switch(e.type){case`finish`:return{totalUsage:e.totalUsage};case`finish-step`:return{usage:e.usage,model:e.response.modelId}}}});else throw Error(`Invalid chat handler result! Must be a Response, ReadableStream, or toUIMessageStream function.`);return new Response(o.pipeThrough(new TransformStream({transform(e,t){t.enqueue(`data: ${JSON.stringify(e)}\n\n`)},flush(e){e.enqueue(`data: [DONE]
|
|
2
2
|
|
|
3
3
|
`)}})).pipeThrough(new TextEncoderStream),{headers:i})}return t.json({error:`No chat handlers found.`},404)}).get(`/capabilities`,async e=>{let t=e.env.listeners,n={ui:t.ui.length>0,chat:t.chat.length>0,request:t.request.length>0,error:t.error.length>0};return e.json(n,200)}).get(`/health`,async e=>e.body(`OK`,200)).get(`/ui`,async e=>{let t=e.req.query(`selected_options`),n;if(t)try{n=JSON.parse(t)}catch{return e.json({error:`Invalid selected_options query parameter!`},400)}let r=e.env.listeners.ui;for(let t of r){let r=await t({selectedOptions:n});if(!r)continue;return e.json(r,200)}return e.json({error:`No UI listener returned a response`},404)}),r=new t.Hono().route(`/_agent`,n).all(`*`,async e=>{let t=e.env.listeners.request;for(let n of t){let t=await n(e.req.raw,e.env.context);if(t)return t}return e.json({error:`No request handlers found.`},404)}),i={"content-type":`text/event-stream`,"cache-control":`no-cache, no-transform`,connection:`keep-alive`,"x-accel-buffering":`no`};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{CustomChatResponseError as e}from"./index.browser-0KfCzcI7.js";import{Hono as t,validator as n}from"./validator-DOrmtI_l.js";import"http";const r=new t().post(`/chat`,n(`json`,e=>({messages:e.messages,chat:e.chat})),async t=>{let n=t.env.listeners.chat,r=t.req.valid(`json`);for(let a of n){let n;try{n=await a({
|
|
1
|
+
import{CustomChatResponseError as e}from"./index.browser-0KfCzcI7.js";import{Hono as t,validator as n}from"./validator-DOrmtI_l.js";import"http";const r=new t().post(`/chat`,n(`json`,e=>({messages:e.messages,chat:e.chat})),async t=>{let n=t.env.listeners.chat,r=t.req.valid(`json`);for(let a of n){let n;try{n=await a({chat:r.chat,messages:r.messages,abortSignal:t.req.raw.signal,context:t.env.context})}catch(t){if(t instanceof e)n=t.response;else throw t}if(!n)continue;if(n instanceof Response)return n;let o;if(n instanceof ReadableStream)o=n;else if(typeof n==`object`&&`toUIMessageStream`in n)o=n.toUIMessageStream({messageMetadata:({part:e})=>{switch(e.type){case`finish`:return{totalUsage:e.totalUsage};case`finish-step`:return{usage:e.usage,model:e.response.modelId}}}});else throw Error(`Invalid chat handler result! Must be a Response, ReadableStream, or toUIMessageStream function.`);return new Response(o.pipeThrough(new TransformStream({transform(e,t){t.enqueue(`data: ${JSON.stringify(e)}\n\n`)},flush(e){e.enqueue(`data: [DONE]
|
|
2
2
|
|
|
3
3
|
`)}})).pipeThrough(new TextEncoderStream),{headers:i})}return t.json({error:`No chat handlers found.`},404)}).get(`/capabilities`,async e=>{let t=e.env.listeners,n={ui:t.ui.length>0,chat:t.chat.length>0,request:t.request.length>0,error:t.error.length>0};return e.json(n,200)}).get(`/health`,async e=>e.body(`OK`,200)).get(`/ui`,async e=>{let t=e.req.query(`selected_options`),n;if(t)try{n=JSON.parse(t)}catch{return e.json({error:`Invalid selected_options query parameter!`},400)}let r=e.env.listeners.ui;for(let t of r){let r=await t({selectedOptions:n});if(!r)continue;return e.json(r,200)}return e.json({error:`No UI listener returned a response`},404)});new t().route(`/_agent`,r).all(`*`,async e=>{let t=e.env.listeners.request;for(let n of t){let t=await n(e.req.raw,e.env.context);if(t)return t}return e.json({error:`No request handlers found.`},404)});const i={"content-type":`text/event-stream`,"cache-control":`no-cache, no-transform`,connection:`keep-alive`,"x-accel-buffering":`no`};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`../index.browser-09e-NXpn.cjs`);require(`../validator-CvSEfFnI.cjs`),require(`../index.node-
|
|
1
|
+
const e=require(`../index.browser-09e-NXpn.cjs`);require(`../validator-CvSEfFnI.cjs`),require(`../index.node-BrnIuz4k.cjs`);let t=require(`react`);t=e.__toESM(t);function n({agent:n,capabilities:r,messages:i}){let[a,o]=(0,t.useState)(void 0),[s,c]=(0,t.useState)(!0),[l,u]=(0,t.useState)(void 0),d=(0,t.useRef)(l);(0,t.useEffect)(()=>{d.current=l},[l]);let[f,p]=(0,t.useState)(()=>e.lastUIOptions(i));(0,t.useEffect)(()=>{p(t=>{let n=e.lastUIOptions(i);return JSON.stringify(n)===JSON.stringify(t)?t:n})},[i]);let[m,h]=(0,t.useState)(void 0),g=(0,t.useCallback)((e,t)=>{if(!d.current)return!1;let n=d.current[e];return n?n.values.some(e=>e.id===t):!1},[]),_=(0,t.useCallback)(e=>{h(t=>{let n={...f,...t,...e};for(let[e,t]of Object.entries(n))g(e,t)||delete n[e];for(let[e,t]of Object.entries(d.current??{}))!n[e]&&t.defaultValue!==void 0&&(n[e]=t.defaultValue);return JSON.stringify(n)===JSON.stringify(t)?t:n})},[f,g]);(0,t.useEffect)(()=>{if(!f&&!l){h(void 0);return}_()},[f,l,_]);let v=(0,t.useRef)(void 0),y=(0,t.useRef)(void 0);(0,t.useEffect)(()=>{n!==y.current&&(y.current=n,u(void 0),h(void 0),o(void 0),c(!0),v.current=void 0)},[n]),(0,t.useEffect)(()=>{if(r&&!r.ui||!n){u(void 0),h(void 0),o(void 0),v.current=void 0;return}let e=m?JSON.stringify(m):``;if(v.current===e){c(!1),o(void 0);return}let t=new AbortController;return c(!0),o(void 0),n.ui(m?{selectedOptions:m}:{},{signal:t.signal}).then(n=>{t.signal.aborted||(u(e=>JSON.stringify(e)===JSON.stringify(n)?e:n),v.current=e)}).catch(e=>{t.signal.aborted||o(e instanceof Error?e:Error(String(e)))}).finally(()=>{c(!1)}),()=>{t.abort()}},[n,r,m]);let b=(0,t.useCallback)((e,t)=>{_({[e]:t})},[_]);return{schema:l,options:m,setOption:b,loading:s,error:a}}exports.useOptions=n;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import "../chat-
|
|
2
|
-
import { UIOptions, UIOptionsSchema } from "../index.browser-
|
|
3
|
-
import { CapabilitiesResponse, Client } from "../index-
|
|
1
|
+
import "../chat-B3FNVJ5h.cjs";
|
|
2
|
+
import { UIOptions, UIOptionsSchema } from "../index.browser-Bivj_NTA.cjs";
|
|
3
|
+
import { CapabilitiesResponse, Client } from "../index-CiKnRuyK.cjs";
|
|
4
4
|
import { UIMessage } from "ai";
|
|
5
5
|
|
|
6
6
|
//#region src/react/use-options.d.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import "../chat-
|
|
2
|
-
import { UIOptions, UIOptionsSchema } from "../index.browser-
|
|
3
|
-
import { CapabilitiesResponse, Client } from "../index-
|
|
1
|
+
import "../chat-DDcZEZzi.js";
|
|
2
|
+
import { UIOptions, UIOptionsSchema } from "../index.browser-BzfJXoff.js";
|
|
3
|
+
import { CapabilitiesResponse, Client } from "../index-B5ywu36Q.js";
|
|
4
4
|
import { UIMessage } from "ai";
|
|
5
5
|
|
|
6
6
|
//#region src/react/use-options.d.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{lastUIOptions as e}from"../index.browser-0KfCzcI7.js";import"../validator-DOrmtI_l.js";import"../index.node-
|
|
1
|
+
import{lastUIOptions as e}from"../index.browser-0KfCzcI7.js";import"../validator-DOrmtI_l.js";import"../index.node-CbQFCWTr.js";import{useCallback as t,useEffect as n,useRef as r,useState as i}from"react";function a({agent:a,capabilities:o,messages:s}){let[c,l]=i(void 0),[u,d]=i(!0),[f,p]=i(void 0),m=r(f);n(()=>{m.current=f},[f]);let[h,g]=i(()=>e(s));n(()=>{g(t=>{let n=e(s);return JSON.stringify(n)===JSON.stringify(t)?t:n})},[s]);let[_,v]=i(void 0),y=t((e,t)=>{if(!m.current)return!1;let n=m.current[e];return n?n.values.some(e=>e.id===t):!1},[]),b=t(e=>{v(t=>{let n={...h,...t,...e};for(let[e,t]of Object.entries(n))y(e,t)||delete n[e];for(let[e,t]of Object.entries(m.current??{}))!n[e]&&t.defaultValue!==void 0&&(n[e]=t.defaultValue);return JSON.stringify(n)===JSON.stringify(t)?t:n})},[h,y]);n(()=>{if(!h&&!f){v(void 0);return}b()},[h,f,b]);let x=r(void 0),S=r(void 0);n(()=>{a!==S.current&&(S.current=a,p(void 0),v(void 0),l(void 0),d(!0),x.current=void 0)},[a]),n(()=>{if(o&&!o.ui||!a){p(void 0),v(void 0),l(void 0),x.current=void 0;return}let e=_?JSON.stringify(_):``;if(x.current===e){d(!1),l(void 0);return}let t=new AbortController;return d(!0),l(void 0),a.ui(_?{selectedOptions:_}:{},{signal:t.signal}).then(n=>{t.signal.aborted||(p(e=>JSON.stringify(e)===JSON.stringify(n)?e:n),x.current=e)}).catch(e=>{t.signal.aborted||l(e instanceof Error?e:Error(String(e)))}).finally(()=>{d(!1)}),()=>{t.abort()}},[a,o,_]);let C=t((e,t)=>{b({[e]:t})},[b]);return{schema:f,options:_,setOption:C,loading:u,error:c}}export{a as useOptions};
|