blink 1.1.25 → 1.1.26

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,4 +1,4 @@
1
1
  import "../../types-DUs3b5a3.cjs";
2
- import { StreamResponseFormatHeader } from "../../index.browser-DB9UGGdN.cjs";
3
- import { APIServerURLEnvironmentVariable, CapabilitiesResponse, Client, ClientOptions, streamSSE } from "../../index-orp-VO8g.cjs";
2
+ import { StreamResponseFormatHeader } from "../../index.browser-B55rTc1_.cjs";
3
+ import { APIServerURLEnvironmentVariable, CapabilitiesResponse, Client, ClientOptions, streamSSE } from "../../index-D6U7_pC6.cjs";
4
4
  export { APIServerURLEnvironmentVariable, CapabilitiesResponse, Client, ClientOptions, StreamResponseFormatHeader, streamSSE };
@@ -1,4 +1,4 @@
1
1
  import "../../types-keN8L-ZK.js";
2
- import { StreamResponseFormatHeader } from "../../index.browser-yBhWIAxZ.js";
3
- import { APIServerURLEnvironmentVariable, CapabilitiesResponse, Client, ClientOptions, streamSSE } from "../../index-BXZCP58f.js";
2
+ import { StreamResponseFormatHeader } from "../../index.browser-BWaJSg--.js";
3
+ import { APIServerURLEnvironmentVariable, CapabilitiesResponse, Client, ClientOptions, streamSSE } from "../../index-DyEJiovi.js";
4
4
  export { APIServerURLEnvironmentVariable, CapabilitiesResponse, Client, ClientOptions, StreamResponseFormatHeader, streamSSE };
@@ -1,3 +1,3 @@
1
1
  import { AgentChat, AgentOtel, AgentStore, Chat, ChatEvent, ChatHandler, ChatResponse, ID, NewMessage, SendBehavior, SendOptions, UpsertedChat } from "../types-DUs3b5a3.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-DB9UGGdN.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-B55rTc1_.cjs";
3
3
  export { AgentChat, AgentOtel, AgentStore, Chat, ChatEvent, ChatHandler, ChatResponse, ContextFromTools, ExtractUIOptions, ID, NewMessage, SendBehavior, SendOptions, StreamResponseFormat, StreamResponseFormatHeader, ToolApprovalOutput, ToolSetWithApproval, ToolWithApproval, ToolWithContext, UIEvent, UIHandler, UIOptionSelect, UIOptionSelectValue, UIOptions, UIOptionsSchema, UpsertedChat, WithUIOptions, isToolApprovalOutput, lastUIOptions, toolWithApproval, tools, withResponseFormat };
@@ -1,3 +1,3 @@
1
1
  import { AgentChat, AgentOtel, AgentStore, Chat, ChatEvent, ChatHandler, ChatResponse, ID, NewMessage, SendBehavior, SendOptions, UpsertedChat } from "../types-keN8L-ZK.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-yBhWIAxZ.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-BWaJSg--.js";
3
3
  export { AgentChat, AgentOtel, AgentStore, Chat, ChatEvent, ChatHandler, ChatResponse, ContextFromTools, ExtractUIOptions, ID, NewMessage, SendBehavior, SendOptions, StreamResponseFormat, StreamResponseFormatHeader, ToolApprovalOutput, ToolSetWithApproval, ToolWithApproval, ToolWithContext, UIEvent, UIHandler, UIOptionSelect, UIOptionSelectValue, UIOptions, UIOptionsSchema, UpsertedChat, WithUIOptions, isToolApprovalOutput, lastUIOptions, toolWithApproval, tools, withResponseFormat };
@@ -1,5 +1,5 @@
1
1
  import { ID } from "./types-DUs3b5a3.cjs";
2
- import { UIOptions, UIOptionsSchema } from "./index.browser-DB9UGGdN.cjs";
2
+ import { UIOptions, UIOptionsSchema } from "./index.browser-B55rTc1_.cjs";
3
3
  import { UIMessage, UIMessageChunk } from "ai";
4
4
 
5
5
  //#region src/agent/constants.d.ts
@@ -1,5 +1,5 @@
1
1
  import { ID } from "./types-keN8L-ZK.js";
2
- import { UIOptions, UIOptionsSchema } from "./index.browser-yBhWIAxZ.js";
2
+ import { UIOptions, UIOptionsSchema } from "./index.browser-BWaJSg--.js";
3
3
  import { UIMessage, UIMessageChunk } from "ai";
4
4
 
5
5
  //#region src/agent/constants.d.ts
@@ -105,6 +105,7 @@ type ToolSetWithApproval<TOOLS extends ToolSet> = { [K in keyof TOOLS]: ToolWith
105
105
  * @returns The wrapped tool.
106
106
  */
107
107
  declare function toolWithApproval<INPUT, OUTPUT>(tool: ToolWithApproval<INPUT, OUTPUT>): ToolWithApproval<INPUT, OUTPUT>;
108
+ type ToolSetWithPrefix<TOOLS extends ToolSet, PREFIX extends string> = { [K in keyof TOOLS as `${PREFIX}${K & string}`]: K extends string ? TOOLS[K] : never };
108
109
  /**
109
110
  * Tools are helpers for managing tools.
110
111
  */
@@ -145,7 +146,7 @@ declare const tools: Readonly<{
145
146
  * @param prefix The prefix to add to the tools.
146
147
  * @returns The prefixed tool set.
147
148
  */
148
- prefix(tools: ToolSet, prefix: string): ToolSet;
149
+ prefix<PREFIX extends string, TOOLS extends ToolSet>(tools: TOOLS, prefix: PREFIX): ToolSetWithPrefix<TOOLS, PREFIX>;
149
150
  }>;
150
151
  type ToolsWithContext = Record<string, Tool & {
151
152
  withContext(context: unknown): Tool;
@@ -105,6 +105,7 @@ type ToolSetWithApproval<TOOLS extends ToolSet> = { [K in keyof TOOLS]: ToolWith
105
105
  * @returns The wrapped tool.
106
106
  */
107
107
  declare function toolWithApproval<INPUT, OUTPUT>(tool: ToolWithApproval<INPUT, OUTPUT>): ToolWithApproval<INPUT, OUTPUT>;
108
+ type ToolSetWithPrefix<TOOLS extends ToolSet, PREFIX extends string> = { [K in keyof TOOLS as `${PREFIX}${K & string}`]: K extends string ? TOOLS[K] : never };
108
109
  /**
109
110
  * Tools are helpers for managing tools.
110
111
  */
@@ -145,7 +146,7 @@ declare const tools: Readonly<{
145
146
  * @param prefix The prefix to add to the tools.
146
147
  * @returns The prefixed tool set.
147
148
  */
148
- prefix(tools: ToolSet, prefix: string): ToolSet;
149
+ prefix<PREFIX extends string, TOOLS extends ToolSet>(tools: TOOLS, prefix: PREFIX): ToolSetWithPrefix<TOOLS, PREFIX>;
149
150
  }>;
150
151
  type ToolsWithContext = Record<string, Tool & {
151
152
  withContext(context: unknown): Tool;
@@ -1,6 +1,6 @@
1
1
  import "../types-DUs3b5a3.cjs";
2
- import { UIOptions, UIOptionsSchema } from "../index.browser-DB9UGGdN.cjs";
3
- import { CapabilitiesResponse, Client } from "../index-orp-VO8g.cjs";
2
+ import { UIOptions, UIOptionsSchema } from "../index.browser-B55rTc1_.cjs";
3
+ import { CapabilitiesResponse, Client } from "../index-D6U7_pC6.cjs";
4
4
  import { UIMessage } from "ai";
5
5
  import * as react0 from "react";
6
6
 
@@ -1,6 +1,6 @@
1
1
  import "../types-keN8L-ZK.js";
2
- import { UIOptions, UIOptionsSchema } from "../index.browser-yBhWIAxZ.js";
3
- import { CapabilitiesResponse, Client } from "../index-BXZCP58f.js";
2
+ import { UIOptions, UIOptionsSchema } from "../index.browser-BWaJSg--.js";
3
+ import { CapabilitiesResponse, Client } from "../index-DyEJiovi.js";
4
4
  import { UIMessage } from "ai";
5
5
  import * as react0 from "react";
6
6
 
package/dist/cli/index.js CHANGED
@@ -17,7 +17,7 @@ Expecting one of '${n.join(`', '`)}'`);return this._lifeCycleHooks[e]?this._life
17
17
  - if the default executable name is not suitable, use the executableFile option to supply a custom name or path
18
18
  - ${r}`;throw Error(i)}_executeSubCommand(e,t){t=t.slice();let n=!1,s=[`.js`,`.ts`,`.tsx`,`.mjs`,`.cjs`];function c(e,t){let n=i.resolve(e,t);if(a.existsSync(n))return n;if(s.includes(i.extname(t)))return;let r=s.find(e=>a.existsSync(`${n}${e}`));if(r)return`${n}${r}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let u=e._executableFile||`${this._name}-${e._name}`,d=this._executableDir||``;if(this._scriptPath){let e;try{e=a.realpathSync(this._scriptPath)}catch{e=this._scriptPath}d=i.resolve(i.dirname(e),d)}if(d){let t=c(d,u);if(!t&&!e._executableFile&&this._scriptPath){let n=i.basename(this._scriptPath,i.extname(this._scriptPath));n!==this._name&&(t=c(d,`${n}-${e._name}`))}u=t||u}n=s.includes(i.extname(u));let f;o.platform===`win32`?(this._checkForMissingExecutable(u,d,e._name),t.unshift(u),t=g(o.execArgv).concat(t),f=r.spawn(o.execPath,t,{stdio:`inherit`})):n?(t.unshift(u),t=g(o.execArgv).concat(t),f=r.spawn(o.argv[0],t,{stdio:`inherit`})):f=r.spawn(u,t,{stdio:`inherit`}),f.killed||[`SIGUSR1`,`SIGUSR2`,`SIGTERM`,`SIGINT`,`SIGHUP`].forEach(e=>{o.on(e,()=>{f.killed===!1&&f.exitCode===null&&f.kill(e)})});let p=this._exitCallback;f.on(`close`,e=>{e??=1,p?p(new l(e,`commander.executeSubCommandAsync`,`(close)`)):o.exit(e)}),f.on(`error`,t=>{if(t.code===`ENOENT`)this._checkForMissingExecutable(u,d,e._name);else if(t.code===`EACCES`)throw Error(`'${u}' not executable`);if(!p)o.exit(1);else{let e=new l(1,`commander.executeSubCommandAsync`,`(error)`);e.nestedError=t,p(e)}}),this.runningCommand=f}_dispatchSubcommand(e,t,n){let r=this._findCommand(e);r||this.help({error:!0}),r._prepareForParse();let i;return i=this._chainOrCallSubCommandHook(i,r,`preSubcommand`),i=this._chainOrCall(i,()=>{if(r._executableHandler)this._executeSubCommand(r,t.concat(n));else return r._parseCommand(t,n)}),i}_dispatchHelpCommand(e){e||this.help();let t=this._findCommand(e);return t&&!t._executableHandler&&t.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??`--help`])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,t)=>{e.required&&this.args[t]==null&&this.missingArgument(e.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let e=(e,t,n)=>{let r=t;if(t!==null&&e.parseArg){let i=`error: command-argument value '${t}' is invalid for argument '${e.name()}'.`;r=this._callParseArg(e,t,n,i)}return r};this._checkNumberOfArguments();let t=[];this.registeredArguments.forEach((n,r)=>{let i=n.defaultValue;n.variadic?r<this.args.length?(i=this.args.slice(r),n.parseArg&&(i=i.reduce((t,r)=>e(n,r,t),n.defaultValue))):i===void 0&&(i=[]):r<this.args.length&&(i=this.args[r],n.parseArg&&(i=e(n,i,n.defaultValue))),t[r]=i}),this.processedArgs=t}_chainOrCall(e,t){return e?.then&&typeof e.then==`function`?e.then(()=>t()):t()}_chainOrCallHooks(e,t){let n=e,r=[];return this._getCommandAndAncestors().reverse().filter(e=>e._lifeCycleHooks[t]!==void 0).forEach(e=>{e._lifeCycleHooks[t].forEach(t=>{r.push({hookedCommand:e,callback:t})})}),t===`postAction`&&r.reverse(),r.forEach(e=>{n=this._chainOrCall(n,()=>e.callback(e.hookedCommand,this))}),n}_chainOrCallSubCommandHook(e,t,n){let r=e;return this._lifeCycleHooks[n]!==void 0&&this._lifeCycleHooks[n].forEach(e=>{r=this._chainOrCall(r,()=>e(this,t))}),r}_parseCommand(e,t){let n=this.parseOptions(t);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(n.operands),t=n.unknown,this.args=e.concat(t),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),t);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(t),this._dispatchSubcommand(this._defaultCommandName,e,t);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(n.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let r=()=>{n.unknown.length>0&&this.unknownOption(n.unknown[0])},i=`command:${this.name()}`;if(this._actionHandler){r(),this._processArguments();let n;return n=this._chainOrCallHooks(n,`preAction`),n=this._chainOrCall(n,()=>this._actionHandler(this.processedArgs)),this.parent&&(n=this._chainOrCall(n,()=>{this.parent.emit(i,e,t)})),n=this._chainOrCallHooks(n,`postAction`),n}if(this.parent?.listenerCount(i))r(),this._processArguments(),this.parent.emit(i,e,t);else if(e.length){if(this._findCommand(`*`))return this._dispatchSubcommand(`*`,e,t);this.listenerCount(`command:*`)?this.emit(`command:*`,e,t):this.commands.length?this.unknownCommand():(r(),this._processArguments())}else this.commands.length?(r(),this.help({error:!0})):(r(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(t=>t._name===e||t._aliases.includes(e))}_findOption(e){return this.options.find(t=>t.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(t=>{t.mandatory&&e.getOptionValue(t.attributeName())===void 0&&e.missingMandatoryOptionValue(t)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(e=>{let t=e.attributeName();return this.getOptionValue(t)===void 0?!1:this.getOptionValueSource(t)!==`default`});e.filter(e=>e.conflictsWith.length>0).forEach(t=>{let n=e.find(e=>t.conflictsWith.includes(e.attributeName()));n&&this._conflictingOption(t,n)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let t=[],n=[],r=t;function i(e){return e.length>1&&e[0]===`-`}let a=e=>/^-\d*\.?\d+(e[+-]?\d+)?$/.test(e)?!this._getCommandAndAncestors().some(e=>e.options.map(e=>e.short).some(e=>/^-\d$/.test(e))):!1,o=null,s=null,c=0;for(;c<e.length||s;){let l=s??e[c++];if(s=null,l===`--`){r===n&&r.push(l),r.push(...e.slice(c));break}if(o&&(!i(l)||a(l))){this.emit(`option:${o.name()}`,l);continue}if(o=null,i(l)){let t=this._findOption(l);if(t){if(t.required){let n=e[c++];n===void 0&&this.optionMissingArgument(t),this.emit(`option:${t.name()}`,n)}else if(t.optional){let n=null;c<e.length&&(!i(e[c])||a(e[c]))&&(n=e[c++]),this.emit(`option:${t.name()}`,n)}else this.emit(`option:${t.name()}`);o=t.variadic?t:null;continue}}if(l.length>2&&l[0]===`-`&&l[1]!==`-`){let e=this._findOption(`-${l[1]}`);if(e){e.required||e.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${e.name()}`,l.slice(2)):(this.emit(`option:${e.name()}`),s=`-${l.slice(2)}`);continue}}if(/^--[^=]+=/.test(l)){let e=l.indexOf(`=`),t=this._findOption(l.slice(0,e));if(t&&(t.required||t.optional)){this.emit(`option:${t.name()}`,l.slice(e+1));continue}}if(r===t&&i(l)&&!(this.commands.length===0&&a(l))&&(r=n),(this._enablePositionalOptions||this._passThroughOptions)&&t.length===0&&n.length===0){if(this._findCommand(l)){t.push(l),n.push(...e.slice(c));break}else if(this._getHelpCommand()&&l===this._getHelpCommand().name()){t.push(l,...e.slice(c));break}else if(this._defaultCommandName){n.push(l,...e.slice(c));break}}if(this._passThroughOptions){r.push(l,...e.slice(c));break}r.push(l)}return{operands:t,unknown:n}}opts(){if(this._storeOptionsAsProperties){let e={},t=this.options.length;for(let n=0;n<t;n++){let t=this.options[n].attributeName();e[t]=t===this._versionOptionName?this._version:this[t]}return e}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((e,t)=>Object.assign(e,t.opts()),{})}error(e,t){this._outputConfiguration.outputError(`${e}\n`,this._outputConfiguration.writeErr),typeof this._showHelpAfterError==`string`?this._outputConfiguration.writeErr(`${this._showHelpAfterError}\n`):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
19
19
  `),this.outputHelp({error:!0}));let n=t||{},r=n.exitCode||1,i=n.code||`commander.error`;this._exit(r,i,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in o.env){let t=e.attributeName();(this.getOptionValue(t)===void 0||[`default`,`config`,`env`].includes(this.getOptionValueSource(t)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,o.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new p(this.options),t=e=>this.getOptionValue(e)!==void 0&&![`default`,`implied`].includes(this.getOptionValueSource(e));this.options.filter(n=>n.implied!==void 0&&t(n.attributeName())&&e.valueFromOption(this.getOptionValue(n.attributeName()),n)).forEach(e=>{Object.keys(e.implied).filter(e=>!t(e)).forEach(t=>{this.setOptionValueWithSource(t,e.implied[t],`implied`)})})}missingArgument(e){let t=`error: missing required argument '${e}'`;this.error(t,{code:`commander.missingArgument`})}optionMissingArgument(e){let t=`error: option '${e.flags}' argument missing`;this.error(t,{code:`commander.optionMissingArgument`})}missingMandatoryOptionValue(e){let t=`error: required option '${e.flags}' not specified`;this.error(t,{code:`commander.missingMandatoryOptionValue`})}_conflictingOption(e,t){let n=e=>{let t=e.attributeName(),n=this.getOptionValue(t),r=this.options.find(e=>e.negate&&t===e.attributeName()),i=this.options.find(e=>!e.negate&&t===e.attributeName());return r&&(r.presetArg===void 0&&n===!1||r.presetArg!==void 0&&n===r.presetArg)?r:i||e},r=e=>{let t=n(e),r=t.attributeName();return this.getOptionValueSource(r)===`env`?`environment variable '${t.envVar}'`:`option '${t.flags}'`},i=`error: ${r(e)} cannot be used with ${r(t)}`;this.error(i,{code:`commander.conflictingOption`})}unknownOption(e){if(this._allowUnknownOption)return;let t=``;if(e.startsWith(`--`)&&this._showSuggestionAfterError){let n=[],r=this;do{let e=r.createHelp().visibleOptions(r).filter(e=>e.long).map(e=>e.long);n=n.concat(e),r=r.parent}while(r&&!r._enablePositionalOptions);t=m(e,n)}let n=`error: unknown option '${e}'${t}`;this.error(n,{code:`commander.unknownOption`})}_excessArguments(e){if(this._allowExcessArguments)return;let t=this.registeredArguments.length,n=t===1?``:`s`,r=`error: too many arguments${this.parent?` for '${this.name()}'`:``}. Expected ${t} argument${n} but got ${e.length}.`;this.error(r,{code:`commander.excessArguments`})}unknownCommand(){let e=this.args[0],t=``;if(this._showSuggestionAfterError){let n=[];this.createHelp().visibleCommands(this).forEach(e=>{n.push(e.name()),e.alias()&&n.push(e.alias())}),t=m(e,n)}let n=`error: unknown command '${e}'${t}`;this.error(n,{code:`commander.unknownCommand`})}version(e,t,n){if(e===void 0)return this._version;this._version=e,t||=`-V, --version`,n||=`output the version number`;let r=this.createOption(t,n);return this._versionOptionName=r.attributeName(),this._registerOption(r),this.on(`option:`+r.name(),()=>{this._outputConfiguration.writeOut(`${e}\n`),this._exit(0,`commander.version`,e)}),this}description(e,t){return e===void 0&&t===void 0?this._description:(this._description=e,t&&(this._argsDescription=t),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let t=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(t=this.commands[this.commands.length-1]),e===t._name)throw Error(`Command alias can't be the same as its name`);let n=this.parent?._findCommand(e);if(n){let t=[n.name()].concat(n.aliases()).join(`|`);throw Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${t}'`)}return t._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(e=>this.alias(e)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let e=this.registeredArguments.map(e=>c(e));return[].concat(this.options.length||this._helpOption!==null?`[options]`:[],this.commands.length?`[command]`:[],this.registeredArguments.length?e:[]).join(` `)}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}helpGroup(e){return e===void 0?this._helpGroupHeading??``:(this._helpGroupHeading=e,this)}commandsGroup(e){return e===void 0?this._defaultCommandGroup??``:(this._defaultCommandGroup=e,this)}optionsGroup(e){return e===void 0?this._defaultOptionGroup??``:(this._defaultOptionGroup=e,this)}_initOptionGroup(e){this._defaultOptionGroup&&!e.helpGroupHeading&&e.helpGroup(this._defaultOptionGroup)}_initCommandGroup(e){this._defaultCommandGroup&&!e.helpGroup()&&e.helpGroup(this._defaultCommandGroup)}nameFromFilename(e){return this._name=i.basename(e,i.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let t=this.createHelp(),n=this._getOutputContext(e);t.prepareContext({error:n.error,helpWidth:n.helpWidth,outputHasColors:n.hasColors});let r=t.formatHelp(this,t);return n.hasColors?r:this._outputConfiguration.stripColor(r)}_getOutputContext(e){e||={};let t=!!e.error,n,r,i;return t?(n=e=>this._outputConfiguration.writeErr(e),r=this._outputConfiguration.getErrHasColors(),i=this._outputConfiguration.getErrHelpWidth()):(n=e=>this._outputConfiguration.writeOut(e),r=this._outputConfiguration.getOutHasColors(),i=this._outputConfiguration.getOutHelpWidth()),{error:t,write:e=>(r||(e=this._outputConfiguration.stripColor(e)),n(e)),hasColors:r,helpWidth:i}}outputHelp(e){let t;typeof e==`function`&&(t=e,e=void 0);let n=this._getOutputContext(e),r={error:n.error,write:n.write,command:this};this._getCommandAndAncestors().reverse().forEach(e=>e.emit(`beforeAllHelp`,r)),this.emit(`beforeHelp`,r);let i=this.helpInformation({error:n.error});if(t&&(i=t(i),typeof i!=`string`&&!Buffer.isBuffer(i)))throw Error(`outputHelp callback must return a string or a Buffer`);n.write(i),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit(`afterHelp`,r),this._getCommandAndAncestors().forEach(e=>e.emit(`afterAllHelp`,r))}helpOption(e,t){return typeof e==`boolean`?(e?(this._helpOption===null&&(this._helpOption=void 0),this._defaultOptionGroup&&this._initOptionGroup(this._getHelpOption())):this._helpOption=null,this):(this._helpOption=this.createOption(e??`-h, --help`,t??`display help for command`),(e||t)&&this._initOptionGroup(this._helpOption),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this._initOptionGroup(e),this}help(e){this.outputHelp(e);let t=Number(o.exitCode??0);t===0&&e&&typeof e!=`function`&&e.error&&(t=1),this._exit(t,`commander.help`,`(outputHelp)`)}addHelpText(e,t){let n=[`beforeAll`,`before`,`after`,`afterAll`];if(!n.includes(e))throw Error(`Unexpected value for position to addHelpText.
20
- Expecting one of '${n.join(`', '`)}'`);let r=`${e}Help`;return this.on(r,e=>{let n;n=typeof t==`function`?t({error:e.error,command:e.command}):t,n&&e.write(`${n}\n`)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(e=>t.is(e))&&(this.outputHelp(),this._exit(0,`commander.helpDisplayed`,`(outputHelp)`))}};function g(e){return e.map(e=>{if(!e.startsWith(`--inspect`))return e;let t,n=`127.0.0.1`,r=`9229`,i;return(i=e.match(/^(--inspect(-brk)?)$/))===null?(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))===null?(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=i[1],n=i[3],r=i[4]):(t=i[1],/^\d+$/.test(i[3])?r=i[3]:n=i[3]):t=i[1],t&&r!==`0`?`${t}=${n}:${parseInt(r)+1}`:e})}function _(){if(o.env.NO_COLOR||o.env.FORCE_COLOR===`0`||o.env.FORCE_COLOR===`false`)return!1;if(o.env.FORCE_COLOR||o.env.CLICOLOR_FORCE!==void 0)return!0}e.Command=h,e.useColor=_}));const{program:M,createCommand:N,createArgument:oe,createOption:se,CommanderError:ce,InvalidArgumentError:P,InvalidOptionArgumentError:le,Command:ue,Argument:F,Option:de,Help:I}=n(e((e=>{let{Argument:t}=O(),{Command:n}=ae(),{CommanderError:r,InvalidArgumentError:i}=D(),{Help:a}=k(),{Option:o}=A();e.program=new n,e.createCommand=e=>new n(e),e.createOption=(e,t)=>new o(e,t),e.createArgument=(e,n)=>new t(e,n),e.Command=n,e.Option=o,e.Argument=t,e.Help=a,e.CommanderError=r,e.InvalidArgumentError=i,e.InvalidOptionArgumentError=i}))(),1).default;var L=`1.1.25`;async function R(e){e||=process.cwd();let t=s(e);await t.build({cwd:e,entry:t.entry,outdir:t.outdir,watch:!1,onStart:()=>{console.log(`Building agent...`)},onResult:e=>{`error`in e&&(console.error(e.error),process.exit(1));for(let t of e.warnings)console.warn(t.message);console.log(`Built agent to ${e.entry}`)}})}var z=n(o(),1),B=n(g(),1);async function V(e,t){e||=process.cwd();let n=process.env.CI===`true`||!process.stdout.isTTY;await a(e);let r=await m(),o=new c({authToken:r,fetch:(e,t)=>{let n=new Headers(t?.headers);return n.set(`x-blink-cli-version`,L),fetch(e,{...t,headers:n})}}),l=await i(e,`package.json`);if(!l)throw Error(`package.json not found`);let g=await T(l,`utf-8`),v=JSON.parse(g),y=te(l),C=x(y,`.blink`,`config.json`),D={};if(ne(C)){let e=await T(C,`utf-8`);D=JSON.parse(e)}process.env.BLINK_ORGANIZATION_ID&&(D.organizationId=process.env.BLINK_ORGANIZATION_ID),process.env.BLINK_AGENT_ID&&(D.agentId=process.env.BLINK_AGENT_ID);let O;if(D?.organizationId)try{O=(await o.organizations.get(D.organizationId)).name}catch{D.organizationId=void 0}if(!D?.organizationId){let e=await o.organizations.list();if(e.length===1)D.organizationId=e[0].id,O=e[0].name;else if(n)throw Error(`Multiple organizations found. To use CI mode, please deploy in interactive mode first to select an organization and generate .blink/config.json`);else{let t=await f({message:`Which organization should contain this agent?`,options:e.map(e=>({value:e.id,label:e.name}))});if(d(t))return;D.organizationId=t,O=e.find(e=>e.id===t).name,console.log()}}let k,A=!1,j=!1;if(D?.agentId)try{k=(await o.agents.get(D.agentId)).name}catch{D.agentId=void 0}if(!D?.agentId)try{let e=await o.organizations.agents.get({organization_id:D.organizationId,agent_name:v.name});D.agentId=e.id,k=e.name}catch{A=!0,k=v.name}A?console.log(h.bold(`blink■`)+` creating agent `+O+`/`+k):console.log(h.bold(`blink■`)+` deploying agent `+O+`/`+k);let ae=Date.now(),M=s(y),N=await new Promise((e,t)=>{M.build({cwd:y,entry:M.entry,outdir:M.outdir,watch:!1,onStart:()=>{},onResult:t=>{e(t)}}).catch(t)});if(!N)throw Error(`Failed to build agent`);if(`error`in N)throw Error(N.error.message);let oe=Date.now()-ae;console.log(h.gray(`Built ${h.dim(`(${oe}ms)`)}`));let se=await w(N.outdir),ce=Object.fromEntries(se.map(e=>[x(N.outdir,e),e])),P=x(e,`README.md`);await H(P)&&(ce[P]=`README.md`);let le=await me(y),ue=Object.fromEntries(le.map(e=>[e,S(y,e)])),F=Object.entries(ce),de=Object.entries(ue),I=[...F,...de],R=I.length,z=0,B=0,V=0,K=Array(R);await pe(I,10,async([e,t],n)=>{let r=(await E(e)).size,i=++z;G(`${h.dim(`[${i}/${R}]`)} Uploading ${t} (${W(r)})...`);let a=await T(e),s=await o.files.upload(new File([Buffer.from(a)],t));K[n]={path:t,id:s.id},B+=1,V+=r}),G(h.gray(`Uploaded ${R} ${R===1?`file`:`files`} ${h.dim(`(${W(V)})`)}`)),process.stdout.write(`
20
+ Expecting one of '${n.join(`', '`)}'`);let r=`${e}Help`;return this.on(r,e=>{let n;n=typeof t==`function`?t({error:e.error,command:e.command}):t,n&&e.write(`${n}\n`)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(e=>t.is(e))&&(this.outputHelp(),this._exit(0,`commander.helpDisplayed`,`(outputHelp)`))}};function g(e){return e.map(e=>{if(!e.startsWith(`--inspect`))return e;let t,n=`127.0.0.1`,r=`9229`,i;return(i=e.match(/^(--inspect(-brk)?)$/))===null?(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))===null?(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=i[1],n=i[3],r=i[4]):(t=i[1],/^\d+$/.test(i[3])?r=i[3]:n=i[3]):t=i[1],t&&r!==`0`?`${t}=${n}:${parseInt(r)+1}`:e})}function _(){if(o.env.NO_COLOR||o.env.FORCE_COLOR===`0`||o.env.FORCE_COLOR===`false`)return!1;if(o.env.FORCE_COLOR||o.env.CLICOLOR_FORCE!==void 0)return!0}e.Command=h,e.useColor=_}));const{program:M,createCommand:N,createArgument:oe,createOption:se,CommanderError:ce,InvalidArgumentError:P,InvalidOptionArgumentError:le,Command:ue,Argument:F,Option:de,Help:I}=n(e((e=>{let{Argument:t}=O(),{Command:n}=ae(),{CommanderError:r,InvalidArgumentError:i}=D(),{Help:a}=k(),{Option:o}=A();e.program=new n,e.createCommand=e=>new n(e),e.createOption=(e,t)=>new o(e,t),e.createArgument=(e,n)=>new t(e,n),e.Command=n,e.Option=o,e.Argument=t,e.Help=a,e.CommanderError=r,e.InvalidArgumentError=i,e.InvalidOptionArgumentError=i}))(),1).default;var L=`1.1.26`;async function R(e){e||=process.cwd();let t=s(e);await t.build({cwd:e,entry:t.entry,outdir:t.outdir,watch:!1,onStart:()=>{console.log(`Building agent...`)},onResult:e=>{`error`in e&&(console.error(e.error),process.exit(1));for(let t of e.warnings)console.warn(t.message);console.log(`Built agent to ${e.entry}`)}})}var z=n(o(),1),B=n(g(),1);async function V(e,t){e||=process.cwd();let n=process.env.CI===`true`||!process.stdout.isTTY;await a(e);let r=await m(),o=new c({authToken:r,fetch:(e,t)=>{let n=new Headers(t?.headers);return n.set(`x-blink-cli-version`,L),fetch(e,{...t,headers:n})}}),l=await i(e,`package.json`);if(!l)throw Error(`package.json not found`);let g=await T(l,`utf-8`),v=JSON.parse(g),y=te(l),C=x(y,`.blink`,`config.json`),D={};if(ne(C)){let e=await T(C,`utf-8`);D=JSON.parse(e)}process.env.BLINK_ORGANIZATION_ID&&(D.organizationId=process.env.BLINK_ORGANIZATION_ID),process.env.BLINK_AGENT_ID&&(D.agentId=process.env.BLINK_AGENT_ID);let O;if(D?.organizationId)try{O=(await o.organizations.get(D.organizationId)).name}catch{D.organizationId=void 0}if(!D?.organizationId){let e=await o.organizations.list();if(e.length===1)D.organizationId=e[0].id,O=e[0].name;else if(n)throw Error(`Multiple organizations found. To use CI mode, please deploy in interactive mode first to select an organization and generate .blink/config.json`);else{let t=await f({message:`Which organization should contain this agent?`,options:e.map(e=>({value:e.id,label:e.name}))});if(d(t))return;D.organizationId=t,O=e.find(e=>e.id===t).name,console.log()}}let k,A=!1,j=!1;if(D?.agentId)try{k=(await o.agents.get(D.agentId)).name}catch{D.agentId=void 0}if(!D?.agentId)try{let e=await o.organizations.agents.get({organization_id:D.organizationId,agent_name:v.name});D.agentId=e.id,k=e.name}catch{A=!0,k=v.name}A?console.log(h.bold(`blink■`)+` creating agent `+O+`/`+k):console.log(h.bold(`blink■`)+` deploying agent `+O+`/`+k);let ae=Date.now(),M=s(y),N=await new Promise((e,t)=>{M.build({cwd:y,entry:M.entry,outdir:M.outdir,watch:!1,onStart:()=>{},onResult:t=>{e(t)}}).catch(t)});if(!N)throw Error(`Failed to build agent`);if(`error`in N)throw Error(N.error.message);let oe=Date.now()-ae;console.log(h.gray(`Built ${h.dim(`(${oe}ms)`)}`));let se=await w(N.outdir),ce=Object.fromEntries(se.map(e=>[x(N.outdir,e),e])),P=x(e,`README.md`);await H(P)&&(ce[P]=`README.md`);let le=await me(y),ue=Object.fromEntries(le.map(e=>[e,S(y,e)])),F=Object.entries(ce),de=Object.entries(ue),I=[...F,...de],R=I.length,z=0,B=0,V=0,K=Array(R);await pe(I,10,async([e,t],n)=>{let r=(await E(e)).size,i=++z;G(`${h.dim(`[${i}/${R}]`)} Uploading ${t} (${W(r)})...`);let a=await T(e),s=await o.files.upload(new File([Buffer.from(a)],t));K[n]={path:t,id:s.id},B+=1,V+=r}),G(h.gray(`Uploaded ${R} ${R===1?`file`:`files`} ${h.dim(`(${W(V)})`)}`)),process.stdout.write(`
21
21
  `);let q=K.filter(Boolean),he=q.slice(0,F.length),ge=q.slice(F.length),J=await U(x(e,`.env.production`));if(A){let t=x(e,`.env.local`),r=x(e,`.env.production`),i=await U(t),a=Object.keys(i).filter(e=>!J[e]);if(a.length>0)if(n)console.log(h.yellow(`Warning:`)+` Missing ${a.length} var${a.length===1?``:`s`} in .env.production: ${a.join(`, `)}`),console.log(h.dim(` Skipping in CI mode. Set these in .env.production if needed.`));else{console.log(`
22
22
  `+h.cyan(`Environment Variables`)),console.log(h.dim(` Missing ${a.length} var${a.length===1?``:`s`} in .env.production: ${a.join(`, `)}`));let e=await p({message:`Copy missing vars from .env.local to .env.production?`,initialValue:!0});if(d(e))return;if(console.log(),e){for(let e of a)J[e]=i[e];await re(r,`# Environment variables for production deployment\n${Object.entries(J).map(([e,t])=>`${e}=${t}`).join(`
23
23
  `)}`,`utf-8`)}}let o=_(e);if(o)if(n)console.log(h.dim(` Skipping webhook tunnel migration in CI mode`));else{let e=`https://${o}.blink.host`;console.log(`
@@ -1,2 +1,2 @@
1
- import { Agent, AgentChat, AgentOtel, AgentStore, Chat, ChatEvent, ChatHandler, ChatResponse, ContextFromTools, ErrorHandler, ExtractUIOptions, ID, NewMessage, RequestHandler, SendBehavior, SendOptions, ServeOptions, StreamResponseFormat, StreamResponseFormatHeader, ToolApprovalOutput, ToolSetWithApproval, ToolWithApproval, ToolWithContext, UIEvent, UIHandler, UIOptionSelect, UIOptionSelectValue, UIOptions, UIOptionsSchema, UpsertedChat, WithUIOptions, agent, api, isToolApprovalOutput, lastUIOptions, toolWithApproval, tools, waitUntil, withResponseFormat } from "../index.node-CFw4ITad.cjs";
1
+ import { Agent, AgentChat, AgentOtel, AgentStore, Chat, ChatEvent, ChatHandler, ChatResponse, ContextFromTools, ErrorHandler, ExtractUIOptions, ID, NewMessage, RequestHandler, SendBehavior, SendOptions, ServeOptions, StreamResponseFormat, StreamResponseFormatHeader, ToolApprovalOutput, ToolSetWithApproval, ToolWithApproval, ToolWithContext, UIEvent, UIHandler, UIOptionSelect, UIOptionSelectValue, UIOptions, UIOptionsSchema, UpsertedChat, WithUIOptions, agent, api, isToolApprovalOutput, lastUIOptions, toolWithApproval, tools, waitUntil, withResponseFormat } from "../index.node-GxEx2hd7.cjs";
2
2
  export { Agent, AgentChat, AgentOtel, AgentStore, Chat, ChatEvent, ChatHandler, ChatResponse, ContextFromTools, ErrorHandler, ExtractUIOptions, ID, NewMessage, RequestHandler, SendBehavior, SendOptions, ServeOptions, StreamResponseFormat, StreamResponseFormatHeader, ToolApprovalOutput, ToolSetWithApproval, ToolWithApproval, ToolWithContext, UIEvent, UIHandler, UIOptionSelect, UIOptionSelectValue, UIOptions, UIOptionsSchema, UpsertedChat, WithUIOptions, agent, api, isToolApprovalOutput, lastUIOptions, toolWithApproval, tools, waitUntil, withResponseFormat };
@@ -1,2 +1,2 @@
1
- import { Agent, AgentChat, AgentOtel, AgentStore, Chat, ChatEvent, ChatHandler, ChatResponse, ContextFromTools, ErrorHandler, ExtractUIOptions, ID, NewMessage, RequestHandler, SendBehavior, SendOptions, ServeOptions, StreamResponseFormat, StreamResponseFormatHeader, ToolApprovalOutput, ToolSetWithApproval, ToolWithApproval, ToolWithContext, UIEvent, UIHandler, UIOptionSelect, UIOptionSelectValue, UIOptions, UIOptionsSchema, UpsertedChat, WithUIOptions, agent, api, isToolApprovalOutput, lastUIOptions, toolWithApproval, tools, waitUntil, withResponseFormat } from "../index.node-D5_czyKY.js";
1
+ import { Agent, AgentChat, AgentOtel, AgentStore, Chat, ChatEvent, ChatHandler, ChatResponse, ContextFromTools, ErrorHandler, ExtractUIOptions, ID, NewMessage, RequestHandler, SendBehavior, SendOptions, ServeOptions, StreamResponseFormat, StreamResponseFormatHeader, ToolApprovalOutput, ToolSetWithApproval, ToolWithApproval, ToolWithContext, UIEvent, UIHandler, UIOptionSelect, UIOptionSelectValue, UIOptions, UIOptionsSchema, UpsertedChat, WithUIOptions, agent, api, isToolApprovalOutput, lastUIOptions, toolWithApproval, tools, waitUntil, withResponseFormat } from "../index.node-BbqFCkOX.js";
2
2
  export { Agent, AgentChat, AgentOtel, AgentStore, Chat, ChatEvent, ChatHandler, ChatResponse, ContextFromTools, ErrorHandler, ExtractUIOptions, ID, NewMessage, RequestHandler, SendBehavior, SendOptions, ServeOptions, StreamResponseFormat, StreamResponseFormatHeader, ToolApprovalOutput, ToolSetWithApproval, ToolWithApproval, ToolWithContext, UIEvent, UIHandler, UIOptionSelect, UIOptionSelectValue, UIOptions, UIOptionsSchema, UpsertedChat, WithUIOptions, agent, api, isToolApprovalOutput, lastUIOptions, toolWithApproval, tools, waitUntil, withResponseFormat };
@@ -460,6 +460,7 @@ type ToolSetWithApproval<TOOLS extends ToolSet> = { [K in keyof TOOLS]: ToolWith
460
460
  * @returns The wrapped tool.
461
461
  */
462
462
  declare function toolWithApproval<INPUT, OUTPUT>(tool: ToolWithApproval<INPUT, OUTPUT>): ToolWithApproval<INPUT, OUTPUT>;
463
+ type ToolSetWithPrefix<TOOLS extends ToolSet, PREFIX extends string> = { [K in keyof TOOLS as `${PREFIX}${K & string}`]: K extends string ? TOOLS[K] : never };
463
464
  /**
464
465
  * Tools are helpers for managing tools.
465
466
  */
@@ -500,7 +501,7 @@ declare const tools: Readonly<{
500
501
  * @param prefix The prefix to add to the tools.
501
502
  * @returns The prefixed tool set.
502
503
  */
503
- prefix(tools: ToolSet, prefix: string): ToolSet;
504
+ prefix<PREFIX extends string, TOOLS extends ToolSet>(tools: TOOLS, prefix: PREFIX): ToolSetWithPrefix<TOOLS, PREFIX>;
504
505
  }>;
505
506
  type ToolsWithContext = Record<string, Tool & {
506
507
  withContext(context: unknown): Tool;
@@ -460,6 +460,7 @@ type ToolSetWithApproval<TOOLS extends ToolSet> = { [K in keyof TOOLS]: ToolWith
460
460
  * @returns The wrapped tool.
461
461
  */
462
462
  declare function toolWithApproval<INPUT, OUTPUT>(tool: ToolWithApproval<INPUT, OUTPUT>): ToolWithApproval<INPUT, OUTPUT>;
463
+ type ToolSetWithPrefix<TOOLS extends ToolSet, PREFIX extends string> = { [K in keyof TOOLS as `${PREFIX}${K & string}`]: K extends string ? TOOLS[K] : never };
463
464
  /**
464
465
  * Tools are helpers for managing tools.
465
466
  */
@@ -500,7 +501,7 @@ declare const tools: Readonly<{
500
501
  * @param prefix The prefix to add to the tools.
501
502
  * @returns The prefixed tool set.
502
503
  */
503
- prefix(tools: ToolSet, prefix: string): ToolSet;
504
+ prefix<PREFIX extends string, TOOLS extends ToolSet>(tools: TOOLS, prefix: PREFIX): ToolSetWithPrefix<TOOLS, PREFIX>;
504
505
  }>;
505
506
  type ToolsWithContext = Record<string, Tool & {
506
507
  withContext(context: unknown): Tool;
@@ -1,4 +1,4 @@
1
- import { ID, UIOptions, UIOptionsSchema } from "../index.node-CFw4ITad.cjs";
1
+ import { ID, UIOptions, UIOptionsSchema } from "../index.node-GxEx2hd7.cjs";
2
2
  import { BuildLog, BuildResult } from "../index-DYOqnOdZ.cjs";
3
3
  import { UIMessage, UIMessageChunk } from "ai";
4
4
  import * as react0 from "react";
@@ -1,4 +1,4 @@
1
- import { ID, UIOptions, UIOptionsSchema } from "../index.node-D5_czyKY.js";
1
+ import { ID, UIOptions, UIOptionsSchema } from "../index.node-BbqFCkOX.js";
2
2
  import { BuildLog, BuildResult } from "../index-B4OXlWm3.js";
3
3
  import { UIMessage, UIMessageChunk } from "ai";
4
4
  import * as react0 from "react";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blink",
3
- "version": "1.1.25",
3
+ "version": "1.1.26",
4
4
  "description": "Blink is a tool for building and deploying AI agents.",
5
5
  "type": "module",
6
6
  "bin": {