blink 0.1.109 → 0.1.110
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/control/index.d.cts +16 -16
- package/dist/browser/control/index.d.ts +16 -16
- package/dist/cli/chat-Jjsxhu91.js +1 -0
- package/dist/cli/connect-BpfPzXxZ.js +1 -0
- package/dist/cli/connect-O43Nkqhm.js +1 -0
- package/dist/cli/{dev-C8e69O1h.js → dev-BvMDj_Q6.js} +10 -10
- package/dist/cli/{getMachineId-bsd-BIOLOPhL.js → getMachineId-bsd-C9_PO8vg.js} +1 -1
- package/dist/cli/{getMachineId-bsd-BsiSHdIY.js → getMachineId-bsd-aGbXimKO.js} +1 -1
- package/dist/cli/{getMachineId-bsd-DOWrEuKQ.js → getMachineId-bsd-f6XFfE6Q.js} +1 -1
- package/dist/cli/{getMachineId-darwin-BcKyqrJz.js → getMachineId-darwin-CbnZZvCa.js} +1 -1
- package/dist/cli/{getMachineId-darwin-Ch2lPibC.js → getMachineId-darwin-D2cTSAMO.js} +1 -1
- package/dist/cli/{getMachineId-darwin-KlnNx6Ci.js → getMachineId-darwin-VXBPWUwo.js} +1 -1
- package/dist/cli/{getMachineId-win-DB0Jdpp7.js → getMachineId-win-B1comJH7.js} +1 -1
- package/dist/cli/{getMachineId-win-DZJS-oII.js → getMachineId-win-DHmeC5Ow.js} +1 -1
- package/dist/cli/{getMachineId-win-4fht1YMv.js → getMachineId-win-Dof2NkV_.js} +1 -1
- package/dist/cli/index.js +2 -2
- package/dist/cli/{run-Be8N9G40.js → run-Bfj_0Gkl.js} +1 -1
- package/dist/cli/{token-DNRiDJM-.js → token-CwpupgJv.js} +1 -1
- package/dist/cli/{token-util-IqDtKhK6.js → token-util-BGsva5RI.js} +1 -1
- package/dist/cli/token-util-DsmDyKzB.js +1 -0
- package/dist/cli/undici-Cyjf_ODA.js +1 -0
- package/dist/node/react/index.node.cjs +3 -3
- package/dist/node/react/index.node.js +3 -3
- package/package.json +1 -1
- package/dist/cli/chat-DX_V608z.js +0 -1
- package/dist/cli/connect-Bw0fihsU.js +0 -1
- package/dist/cli/connect-D8dpOtYY.js +0 -1
- package/dist/cli/node-pty-BfteYoG-.js +0 -13
- package/dist/cli/node-pty-CFpbCPc8.js +0 -1
- package/dist/cli/token-util-C6Xu44iO.js +0 -1
- package/dist/cli/undici-L5V8WBce.js +0 -1
- /package/dist/cli/{chat-manager-BL3XfguD.js → chat-manager-DnV2OvBw.js} +0 -0
- /package/dist/cli/{devtools-DvNholmW.js → devtools-aLFrISVw.js} +0 -0
- /package/dist/cli/{execAsync-Bhq3YKvl.js → execAsync-BTw463vh.js} +0 -0
- /package/dist/cli/{execAsync-Djebuxfm.js → execAsync-DQQzCKCI.js} +0 -0
- /package/dist/cli/{execAsync-_tP2SNTy.js → execAsync-WFKcnjxL.js} +0 -0
- /package/dist/cli/{getMachineId-linux-DOYJzWBc.js → getMachineId-linux-B2Hg9S6u.js} +0 -0
- /package/dist/cli/{getMachineId-linux-HIrcMDqb.js → getMachineId-linux-CGpaESCu.js} +0 -0
- /package/dist/cli/{getMachineId-linux-ulzMB5vC.js → getMachineId-linux-sSblsl0f.js} +0 -0
- /package/dist/cli/{getMachineId-unsupported-B1wECTrM.js → getMachineId-unsupported-B067r1JC.js} +0 -0
- /package/dist/cli/{getMachineId-unsupported-Drd_3o_r.js → getMachineId-unsupported-B_bl21GL.js} +0 -0
- /package/dist/cli/{getMachineId-unsupported-nDPltmL9.js → getMachineId-unsupported-BcNSZ9TD.js} +0 -0
- /package/dist/cli/{init-iySs9KUe.js → init-EfvGBlkJ.js} +0 -0
- /package/dist/cli/{login-DTwQcbaT.js → login-B84QSb5o.js} +0 -0
- /package/dist/cli/{server-C8plsU0X-We1KgV-r.js → server-C8plsU0X-BmosAKXr.js} +0 -0
- /package/dist/cli/{token-error-DVSfBVaT.js → token-error-C6TSmqWz.js} +0 -0
- /package/dist/cli/{undici-BUZTy5qm.js → undici-v5uUkaRO.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__commonJSMin as e,__require as t,__toCommonJS as n}from"./chunk-D9KrCrVq.js";import{esm_exports as r,init_esm as i}from"./esm-DE0IicLh.js";import{require_execAsync as a}from"./execAsync-
|
|
1
|
+
import{__commonJSMin as e,__require as t,__toCommonJS as n}from"./chunk-D9KrCrVq.js";import{esm_exports as r,init_esm as i}from"./esm-DE0IicLh.js";import{require_execAsync as a}from"./execAsync-BTw463vh.js";var o=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let o=t(`fs`),s=a(),c=(i(),n(r));async function l(){try{return(await o.promises.readFile(`/etc/hostid`,{encoding:`utf8`})).trim()}catch(e){c.diag.debug(`error reading machine id: ${e}`)}try{return(await(0,s.execAsync)(`kenv -q smbios.system.uuid`)).stdout.trim()}catch(e){c.diag.debug(`error reading machine id: ${e}`)}}e.getMachineId=l}));export default o();export{};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__commonJSMin as e,__require as t,__toCommonJS as n}from"./chunk-D9KrCrVq.js";import{esm_exports as r,init_esm as i}from"./esm-DE0IicLh.js";import{require_execAsync as a}from"./execAsync-
|
|
1
|
+
import{__commonJSMin as e,__require as t,__toCommonJS as n}from"./chunk-D9KrCrVq.js";import{esm_exports as r,init_esm as i}from"./esm-DE0IicLh.js";import{require_execAsync as a}from"./execAsync-DQQzCKCI.js";var o=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let o=t(`fs`),s=a(),c=(i(),n(r));async function l(){try{return(await o.promises.readFile(`/etc/hostid`,{encoding:`utf8`})).trim()}catch(e){c.diag.debug(`error reading machine id: ${e}`)}try{return(await(0,s.execAsync)(`kenv -q smbios.system.uuid`)).stdout.trim()}catch(e){c.diag.debug(`error reading machine id: ${e}`)}}e.getMachineId=l}));export default o();export{};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__commonJSMin as e,__require as t,__toCommonJS as n}from"./chunk-D9KrCrVq.js";import{esm_exports as r,init_esm as i}from"./esm-DE0IicLh.js";import{require_execAsync as a}from"./execAsync-
|
|
1
|
+
import{__commonJSMin as e,__require as t,__toCommonJS as n}from"./chunk-D9KrCrVq.js";import{esm_exports as r,init_esm as i}from"./esm-DE0IicLh.js";import{require_execAsync as a}from"./execAsync-WFKcnjxL.js";var o=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let o=t(`fs`),s=a(),c=(i(),n(r));async function l(){try{return(await o.promises.readFile(`/etc/hostid`,{encoding:`utf8`})).trim()}catch(e){c.diag.debug(`error reading machine id: ${e}`)}try{return(await(0,s.execAsync)(`kenv -q smbios.system.uuid`)).stdout.trim()}catch(e){c.diag.debug(`error reading machine id: ${e}`)}}e.getMachineId=l}));export default o();export{};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__commonJSMin as e,__toCommonJS as t}from"./chunk-D9KrCrVq.js";import{esm_exports as n,init_esm as r}from"./esm-DE0IicLh.js";import{require_execAsync as i}from"./execAsync-
|
|
1
|
+
import{__commonJSMin as e,__toCommonJS as t}from"./chunk-D9KrCrVq.js";import{esm_exports as n,init_esm as r}from"./esm-DE0IicLh.js";import{require_execAsync as i}from"./execAsync-WFKcnjxL.js";var a=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let a=i(),o=(r(),t(n));async function s(){try{let e=(await(0,a.execAsync)(`ioreg -rd1 -c "IOPlatformExpertDevice"`)).stdout.split(`
|
|
2
2
|
`).find(e=>e.includes(`IOPlatformUUID`));if(!e)return;let t=e.split(`" = "`);if(t.length===2)return t[1].slice(0,-1)}catch(e){o.diag.debug(`error reading machine id: ${e}`)}}e.getMachineId=s}));export default a();export{};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__commonJSMin as e,__toCommonJS as t}from"./chunk-D9KrCrVq.js";import{esm_exports as n,init_esm as r}from"./esm-DE0IicLh.js";import{require_execAsync as i}from"./execAsync-
|
|
1
|
+
import{__commonJSMin as e,__toCommonJS as t}from"./chunk-D9KrCrVq.js";import{esm_exports as n,init_esm as r}from"./esm-DE0IicLh.js";import{require_execAsync as i}from"./execAsync-DQQzCKCI.js";var a=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let a=i(),o=(r(),t(n));async function s(){try{let e=(await(0,a.execAsync)(`ioreg -rd1 -c "IOPlatformExpertDevice"`)).stdout.split(`
|
|
2
2
|
`).find(e=>e.includes(`IOPlatformUUID`));if(!e)return;let t=e.split(`" = "`);if(t.length===2)return t[1].slice(0,-1)}catch(e){o.diag.debug(`error reading machine id: ${e}`)}}e.getMachineId=s}));export default a();export{};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__commonJSMin as e,__toCommonJS as t}from"./chunk-D9KrCrVq.js";import{esm_exports as n,init_esm as r}from"./esm-DE0IicLh.js";import{require_execAsync as i}from"./execAsync-
|
|
1
|
+
import{__commonJSMin as e,__toCommonJS as t}from"./chunk-D9KrCrVq.js";import{esm_exports as n,init_esm as r}from"./esm-DE0IicLh.js";import{require_execAsync as i}from"./execAsync-BTw463vh.js";var a=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let a=i(),o=(r(),t(n));async function s(){try{let e=(await(0,a.execAsync)(`ioreg -rd1 -c "IOPlatformExpertDevice"`)).stdout.split(`
|
|
2
2
|
`).find(e=>e.includes(`IOPlatformUUID`));if(!e)return;let t=e.split(`" = "`);if(t.length===2)return t[1].slice(0,-1)}catch(e){o.diag.debug(`error reading machine id: ${e}`)}}e.getMachineId=s}));export default a();export{};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__commonJSMin as e,__require as t,__toCommonJS as n}from"./chunk-D9KrCrVq.js";import{esm_exports as r,init_esm as i}from"./esm-DE0IicLh.js";import{require_execAsync as a}from"./execAsync-
|
|
1
|
+
import{__commonJSMin as e,__require as t,__toCommonJS as n}from"./chunk-D9KrCrVq.js";import{esm_exports as r,init_esm as i}from"./esm-DE0IicLh.js";import{require_execAsync as a}from"./execAsync-DQQzCKCI.js";var o=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let o=t(`process`),s=a(),c=(i(),n(r));async function l(){let e=`%windir%\\System32\\REG.exe`;o.arch===`ia32`&&`PROCESSOR_ARCHITEW6432`in o.env&&(e=`%windir%\\sysnative\\cmd.exe /c `+e);try{let t=(await(0,s.execAsync)(`${e} QUERY HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography /v MachineGuid`)).stdout.split(`REG_SZ`);if(t.length===2)return t[1].trim()}catch(e){c.diag.debug(`error reading machine id: ${e}`)}}e.getMachineId=l}));export default o();export{};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__commonJSMin as e,__require as t,__toCommonJS as n}from"./chunk-D9KrCrVq.js";import{esm_exports as r,init_esm as i}from"./esm-DE0IicLh.js";import{require_execAsync as a}from"./execAsync-
|
|
1
|
+
import{__commonJSMin as e,__require as t,__toCommonJS as n}from"./chunk-D9KrCrVq.js";import{esm_exports as r,init_esm as i}from"./esm-DE0IicLh.js";import{require_execAsync as a}from"./execAsync-BTw463vh.js";var o=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let o=t(`process`),s=a(),c=(i(),n(r));async function l(){let e=`%windir%\\System32\\REG.exe`;o.arch===`ia32`&&`PROCESSOR_ARCHITEW6432`in o.env&&(e=`%windir%\\sysnative\\cmd.exe /c `+e);try{let t=(await(0,s.execAsync)(`${e} QUERY HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography /v MachineGuid`)).stdout.split(`REG_SZ`);if(t.length===2)return t[1].trim()}catch(e){c.diag.debug(`error reading machine id: ${e}`)}}e.getMachineId=l}));export default o();export{};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__commonJSMin as e,__require as t,__toCommonJS as n}from"./chunk-D9KrCrVq.js";import{esm_exports as r,init_esm as i}from"./esm-DE0IicLh.js";import{require_execAsync as a}from"./execAsync-
|
|
1
|
+
import{__commonJSMin as e,__require as t,__toCommonJS as n}from"./chunk-D9KrCrVq.js";import{esm_exports as r,init_esm as i}from"./esm-DE0IicLh.js";import{require_execAsync as a}from"./execAsync-WFKcnjxL.js";var o=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let o=t(`process`),s=a(),c=(i(),n(r));async function l(){let e=`%windir%\\System32\\REG.exe`;o.arch===`ia32`&&`PROCESSOR_ARCHITEW6432`in o.env&&(e=`%windir%\\sysnative\\cmd.exe /c `+e);try{let t=(await(0,s.execAsync)(`${e} QUERY HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography /v MachineGuid`)).stdout.split(`REG_SZ`);if(t.length===2)return t[1].trim()}catch(e){c.diag.debug(`error reading machine id: ${e}`)}}e.getMachineId=l}));export default o();export{};
|
package/dist/cli/index.js
CHANGED
|
@@ -17,6 +17,6 @@ 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:k,createCommand:ie,createArgument:A,createOption:j,CommanderError:ae,InvalidArgumentError:M,InvalidOptionArgumentError:oe,Command:N,Argument:P,Option:se,Help:F}=n(e((e=>{let{Argument:t}=w(),{Command:n}=O(),{CommanderError:r,InvalidArgumentError:i}=C(),{Help:a}=T(),{Option:o}=E();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 I=`0.1.
|
|
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:k,createCommand:ie,createArgument:A,createOption:j,CommanderError:ae,InvalidArgumentError:M,InvalidOptionArgumentError:oe,Command:N,Argument:P,Option:se,Help:F}=n(e((e=>{let{Argument:t}=w(),{Command:n}=O(),{CommanderError:r,InvalidArgumentError:i}=C(),{Help:a}=T(),{Option:o}=E();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 I=`0.1.110`;async function L(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 R=n(o(),1),z=n(u(),1),B=n(h(),1);async function V(e,t){e||=process.cwd(),await a(e);let n=await l(),r=new c({authToken:n,fetch:(e,t)=>{let n=new Headers(t?.headers);return n.set(`x-blink-cli-version`,I),fetch(e,{...t,headers:n})}}),o=await i(e,`package.json`);if(!o)throw Error(`package.json not found`);let u=await x(o,`utf-8`),h=JSON.parse(u),g=v(o),C=y(g,`data`,`config.json`),w={};if(te(C)){let e=await x(C,`utf-8`);w=JSON.parse(e)}let T;if(w?.organizationId)try{T=(await r.organizations.get(w.organizationId)).name}catch{w.organizationId=void 0}if(!w?.organizationId){let e=await r.organizations.list();if(e.length===1){let t=e[0];w.organizationId=t.id,T=t.name}else{let t=await p({message:`Which organization should contain this agent?`,options:e.map(e=>({value:e.id,label:e.name}))});if(f(t))return;w.organizationId=t,T=e.find(e=>e.id===t).name}}if(!w.organizationId)throw Error(`Developer error: No organization ID found.`);let E;if(w?.agentId)try{E=(await r.agents.get(w.agentId)).name}catch{w.agentId=void 0}if(!w?.agentId)try{let e=await r.organizations.agents.get({organization_id:w.organizationId,agent_name:h.name});w.agentId=e.id,E=e.name}catch{let e=await r.agents.create({name:h.name,organization_id:w.organizationId});w.agentId=e.id,E=e.name}if(!w.agentId)throw Error(`Developer error: No agent ID found.`);await ne(v(C),{recursive:!0}),await re(C,JSON.stringify({_:`This file can be source controlled. It contains no secrets.`,...w},null,2),`utf-8`);let D=s(g),O=await new Promise((e,t)=>{D.build({cwd:g,entry:D.entry,outdir:D.outdir,watch:!1,onStart:()=>{},onResult:t=>{e(t)}}).catch(t)});if(!O)throw Error(`Failed to build agent`);if(`error`in O)throw Error(O.error.message);let k={},ie=await b(O.outdir);for(let e of ie)k[y(O.outdir,e)]=e;let A=y(e,`README.md`);await H(A)&&(k[A]=`README.md`);let j={},ae=await le(g);for(let e of ae)j[e]=ee(g,e);let M=Object.entries(k),oe=Object.entries(j),N=[...M,...oe],P=N.length,se=0,F=0,L=0,B=Array(P);await ce(N,10,async([e,t],n)=>{let i=(await S(e)).size,a=++se;W(`${z.default.dim(`[${a}/${P}]`)} Uploading ${t} (${U(i)})...`);let o=await x(e),s=await r.files.upload(new File([Buffer.from(o)],t));B[n]={path:t,id:s.id},F+=1,L+=i}),W(`${z.default.dim(`[${F}/${P}]`)} Uploaded files (${U(L)}).`),process.stdout.write(`
|
|
21
21
|
`);let V=B.filter(Boolean),G=V.slice(0,M.length),ue=V.slice(M.length),K=y(e,`.env.local`),q=[];if(await H(K)){let e=(0,R.parse)(await x(K,`utf-8`));q=Object.keys(e)}let J=[];J=(await r.agents.env.list({agent_id:w.agentId})).map(e=>e.key);let Y=y(e,`.env.production`);if(await H(Y)){let e=(0,R.parse)(await x(Y,`utf-8`)),t=Object.entries(e),n=t.length,i=0;for(let[e,a]of t){let t=await r.agents.env.create({agent_id:w.agentId,key:e,value:a,target:[`production`,`preview`],secret:!0,upsert:!0});J.push(t.key),i+=1,W(`${z.default.dim(`[${i}/${n}]`)} Updating environment variable: ${e} ${z.default.dim(`(.env.production)`)}`)}W(`${z.default.dim(`[${i}/${n}]`)} Updated environment variables! ${z.default.dim(`(.env.production)`)}`),process.stdout.write(`
|
|
22
|
-
`)}let X=q.filter(e=>!J.includes(e));if(X.length>0){console.log(`Warning: The following environment variables are set in .env.local but not in .env.production:`);for(let e of X)console.log(`- ${e}`);let e=await m({message:`Do you want to deploy anyway?`});if(e===!1||f(e))return}let Z=await r.agents.deployments.create({agent_id:w.agentId,target:`production`,entrypoint:_(O.entry),output_files:G,source_files:ue,message:t?.message}),Q=`https://blink.so/${T}/${E}/deployments/${Z.number}`;console.log(`Deployed:`,Q);let $=d();$.start(`Waiting for deployment to be live...`);try{for(;;){let e=await r.agents.deployments.get({agent_id:w.agentId,deployment_id:Z.id});if(e.status===`success`){let t=`Deployment successful.`;e.target===`production`&&(t+=` All chats will use this deployment!`),$.stop(t);let n=await r.agents.get(w.agentId);n.request_url&&console.log(`\nSend webhooks from anywhere: ${n.request_url}`);break}if(e.status===`failed`){let t=`Deployment failed.`;e.error_message&&(t+=` ${e.error_message}`),$.stop(t),console.log(`Read logs for details:`,Q);return}await new Promise(e=>setTimeout(e,500))}}catch{$.stop(`Failed to poll for deployment status.`),console.log(`Read logs for details:`,Q);return}}const H=async e=>{try{return await S(e),!0}catch{return!1}};async function ce(e,t,n){let r=Array(e.length),i=0,a=Array(Math.min(t,e.length)).fill(0).map(async()=>{for(;;){let t=i++;if(t>=e.length)break;r[t]=await n(e[t],t)}});return await Promise.all(a),r}function U(e){if(e===0)return`0B`;let t=1024,n=[`B`,`KB`,`MB`,`GB`,`TB`],r=Math.floor(Math.log(e)/Math.log(t)),i=e/t**+r;return`${i.toFixed(i>=100?0:i>=10?1:2)}${n[r]}`}function W(e){if(process.stdout.isTTY)try{process.stdout.clearLine(0),process.stdout.cursorTo(0),process.stdout.write(e);return}catch{}console.log(e)}async function le(e){let t=[],n=(0,B.default)().add([`.git`,`node_modules`,`data`,`.env`,`.env.*`]),r=y(e,`.gitignore`);if(await H(r)){let e=await x(r,`utf-8`);n.add(e)}async function i(r,a=e){let o=await b(r,{withFileTypes:!0});for(let e of o){let o=y(r,e.name),s=ee(a,o);n.ignores(s)||(e.isDirectory()?await i(o,a):e.isFile()&&t.push(o))}}return await i(e),t}if(globalThis.WebSocket||(globalThis.WebSocket=r.default),globalThis.Bun!==void 0){let e=t(`perf_hooks`);e.monitorEventLoopDelay=()=>({enable:()=>{}})}globalThis.crypto||(globalThis.crypto={}),globalThis.crypto.randomUUID||(globalThis.crypto.randomUUID=()=>g()),k.name(`blink`).description(`Blink is a runtime for building and deploying AI agents.`).version(I).action(()=>{k.outputHelp()});const G=e=>async(...t)=>{let{default:n}=await e();return n(...t)};k.command(`init [directory]`).description(`Initialize a new Blink agent.`).action(G(()=>import(`./init-
|
|
22
|
+
`)}let X=q.filter(e=>!J.includes(e));if(X.length>0){console.log(`Warning: The following environment variables are set in .env.local but not in .env.production:`);for(let e of X)console.log(`- ${e}`);let e=await m({message:`Do you want to deploy anyway?`});if(e===!1||f(e))return}let Z=await r.agents.deployments.create({agent_id:w.agentId,target:`production`,entrypoint:_(O.entry),output_files:G,source_files:ue,message:t?.message}),Q=`https://blink.so/${T}/${E}/deployments/${Z.number}`;console.log(`Deployed:`,Q);let $=d();$.start(`Waiting for deployment to be live...`);try{for(;;){let e=await r.agents.deployments.get({agent_id:w.agentId,deployment_id:Z.id});if(e.status===`success`){let t=`Deployment successful.`;e.target===`production`&&(t+=` All chats will use this deployment!`),$.stop(t);let n=await r.agents.get(w.agentId);n.request_url&&console.log(`\nSend webhooks from anywhere: ${n.request_url}`);break}if(e.status===`failed`){let t=`Deployment failed.`;e.error_message&&(t+=` ${e.error_message}`),$.stop(t),console.log(`Read logs for details:`,Q);return}await new Promise(e=>setTimeout(e,500))}}catch{$.stop(`Failed to poll for deployment status.`),console.log(`Read logs for details:`,Q);return}}const H=async e=>{try{return await S(e),!0}catch{return!1}};async function ce(e,t,n){let r=Array(e.length),i=0,a=Array(Math.min(t,e.length)).fill(0).map(async()=>{for(;;){let t=i++;if(t>=e.length)break;r[t]=await n(e[t],t)}});return await Promise.all(a),r}function U(e){if(e===0)return`0B`;let t=1024,n=[`B`,`KB`,`MB`,`GB`,`TB`],r=Math.floor(Math.log(e)/Math.log(t)),i=e/t**+r;return`${i.toFixed(i>=100?0:i>=10?1:2)}${n[r]}`}function W(e){if(process.stdout.isTTY)try{process.stdout.clearLine(0),process.stdout.cursorTo(0),process.stdout.write(e);return}catch{}console.log(e)}async function le(e){let t=[],n=(0,B.default)().add([`.git`,`node_modules`,`data`,`.env`,`.env.*`]),r=y(e,`.gitignore`);if(await H(r)){let e=await x(r,`utf-8`);n.add(e)}async function i(r,a=e){let o=await b(r,{withFileTypes:!0});for(let e of o){let o=y(r,e.name),s=ee(a,o);n.ignores(s)||(e.isDirectory()?await i(o,a):e.isFile()&&t.push(o))}}return await i(e),t}if(globalThis.WebSocket||(globalThis.WebSocket=r.default),globalThis.Bun!==void 0){let e=t(`perf_hooks`);e.monitorEventLoopDelay=()=>({enable:()=>{}})}globalThis.crypto||(globalThis.crypto={}),globalThis.crypto.randomUUID||(globalThis.crypto.randomUUID=()=>g()),k.name(`blink`).description(`Blink is a runtime for building and deploying AI agents.`).version(I).action(()=>{k.outputHelp()});const G=e=>async(...t)=>{let{default:n}=await e();return n(...t)};k.command(`init [directory]`).description(`Initialize a new Blink agent.`).action(G(()=>import(`./init-EfvGBlkJ.js`))),k.command(`dev [directory] [options]`).description(`Start a development server for your agent.`).action(G(()=>import(`./dev-BvMDj_Q6.js`))),k.command(`deploy [directory]`).description(`Deploy your agent to the Blink Cloud.`).option(`-m, --message <message>`,`Message for this deployment`).action(V),k.command(`build [directory]`).description(`Build your agent for production.`).action(L),k.command(`telemetry [boolean]`).description(`Enable or disable telemetry.`),k.command(`start [directory]`).description("Starts the Blink runtime in production mode. The agent must be compiled with `blink build` first."),k.command(`run <message...>`).description(`Run your agent programmatically and get the response.`).option(`-d, --directory <directory>`,`Directory to run the agent from (default: current directory)`).option(`-c, --chat <chat>`,`Chat key to use (default: 'default')`).action(G(()=>import(`./run-Bfj_0Gkl.js`))),k.command(`connect`,{hidden:!0}).description(`Connect compute to the Blink Cloud.`).action(G(()=>import(`./connect-O43Nkqhm.js`))),k.command(`chat`,{hidden:!0}).description(`Start a Blink chat connected to your machine.`).action(G(()=>import(`./chat-Jjsxhu91.js`))),k.command(`login`,{hidden:!0}).description(`Log in to the Blink Cloud.`).action(G(()=>import(`./login-B84QSb5o.js`))),k.parse(process.argv);export{};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__toESM as e}from"./chunk-D9KrCrVq.js";import{findNearestEntry as t,migrateBlinkToData as n,require_main as r,resolveConfig as i}from"./util-8br3-4M3.js";import{getAuthToken as a}from"./auth-DjAEZyZZ.js";import"./dist-BNbSDxaw.js";import"./open-DCYivxgo.js";import{ChatManager as o,Client as s}from"./chat-manager-
|
|
1
|
+
import{__toESM as e}from"./chunk-D9KrCrVq.js";import{findNearestEntry as t,migrateBlinkToData as n,require_main as r,resolveConfig as i}from"./util-8br3-4M3.js";import{getAuthToken as a}from"./auth-DjAEZyZZ.js";import"./dist-BNbSDxaw.js";import"./open-DCYivxgo.js";import{ChatManager as o,Client as s}from"./chat-manager-DnV2OvBw.js";import{spawn as c}from"node:child_process";import{join as l,resolve as u}from"node:path";import{existsSync as d}from"node:fs";import{readFile as f}from"node:fs/promises";import{createServer as p}from"node:net";async function m(e){let t=e.env?.PORT??await h(),n=e.env?.HOST??`127.0.0.1`,r=`http://${n}:${t}`,i={...e.env??process.env,PORT:t.toString(),HOST:n},a=c(e.command,e.args,{stdio:`pipe`,env:i});e.signal?.addEventListener(`abort`,()=>{try{a.kill()}catch{}},{once:!0});let o=new AbortController,l=[o.signal];e.signal&&l.push(e.signal);let u=AbortSignal.any(l);a.stdout.on(`data`,t=>{e.onStdout?.(Buffer.from(t).toString(`utf-8`))});let d=``;a.stderr.on(`data`,t=>{o.signal.aborted||(d+=Buffer.from(t).toString(`utf-8`)),e.onStderr?.(Buffer.from(t).toString(`utf-8`))}),a.on(`error`,e=>{o.abort(e)}),a.on(`exit`,(t,n)=>{o.signal.aborted?e.onExit?.(t,n):o.abort()});let f=new s({baseUrl:r}),p=0;for(;!u.aborted;){try{await f.health();break}catch{}if(await new Promise(e=>setTimeout(e,p*5)),p++,p>100)throw Error(`Health endpoint timed out`)}if(u.aborted)throw u.reason;return o.abort(),{client:f,dispose:()=>{a.kill()}}}async function h(){let e=p();return new Promise((t,n)=>{e.listen(0,()=>{let n=e.address().port;t(n)}).on(`error`,e=>{n(e)})}).finally(()=>{e.close()})}var g=e(r(),1);async function _(e,r={}){if(!r.directory){let e=process.cwd();try{i(e),r.directory=e}catch{let n=await t(e,`.blink`);n&&d(l(n,`build`))&&(n=void 0),n?r.directory=n:r.directory=e}}await n(r.directory);let s=i(r.directory),c={};try{c=(0,g.parse)(await f(l(r.directory,`.env.local`),`utf-8`))}catch{}let p=await a(),h=await m({command:`node`,args:[`--experimental-strip-types`,`--no-deprecation`,s.entry],env:{...process.env,...c,BLINK_TOKEN:p}});console.log(`Agent spawned`);let _=u(r?.directory??process.cwd(),`data`,`chats`),v=r?.chat??`default`,y=new o({chatId:v,chatsDirectory:_});y.setAgent(h.client);try{let t=new Promise(e=>{let t=y.subscribe(n=>{(n.status===`idle`||n.status===`error`)&&(t(),e())})});await y.sendMessage({id:crypto.randomUUID(),created_at:new Date().toISOString(),metadata:void 0,parts:[{type:`text`,text:e.join(` `)}],role:`user`,mode:`run`}),await t;let n=y.getState();n.error&&console.error(`Error:`,n.error),console.log(`Final state:`,n.messages.pop())}finally{y.dispose(),h.dispose()}}export{_ as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__commonJSMin as e}from"./chunk-D9KrCrVq.js";import{require_token_error as t}from"./token-error-
|
|
1
|
+
import{__commonJSMin as e}from"./chunk-D9KrCrVq.js";import{require_token_error as t}from"./token-error-C6TSmqWz.js";import{require_token_util as n}from"./token-util-BGsva5RI.js";var r=e(((e,r)=>{var i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,s=Object.prototype.hasOwnProperty,c=(e,t)=>{for(var n in t)i(e,n,{get:t[n],enumerable:!0})},l=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of o(t))!s.call(e,c)&&c!==n&&i(e,c,{get:()=>t[c],enumerable:!(r=a(t,c))||r.enumerable});return e},u=e=>l(i({},`__esModule`,{value:!0}),e),d={};c(d,{refreshToken:()=>m}),r.exports=u(d);var f=t(),p=n();async function m(){let{projectId:e,teamId:t}=(0,p.findProjectInfo)(),n=(0,p.loadToken)(e);if(!n||(0,p.isExpired)((0,p.getTokenPayload)(n.token))){let r=(0,p.getVercelCliToken)();if(!r)throw new f.VercelOidcTokenError(`Failed to refresh OIDC token: login to vercel cli`);if(!e)throw new f.VercelOidcTokenError(`Failed to refresh OIDC token: project id not found`);if(n=await(0,p.getVercelOidcToken)(r,e,t),!n)throw new f.VercelOidcTokenError(`Failed to refresh OIDC token`);(0,p.saveToken)(n,e)}process.env.VERCEL_OIDC_TOKEN=n.token}}));export default r();export{};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__commonJSMin as e,__require as t}from"./chunk-D9KrCrVq.js";import{require_token_error as n}from"./token-error-
|
|
1
|
+
import{__commonJSMin as e,__require as t}from"./chunk-D9KrCrVq.js";import{require_token_error as n}from"./token-error-C6TSmqWz.js";var r=e(((e,r)=>{var i=Object.create,a=Object.defineProperty,o=Object.getOwnPropertyDescriptor,s=Object.getOwnPropertyNames,c=Object.getPrototypeOf,l=Object.prototype.hasOwnProperty,u=(e,t)=>{for(var n in t)a(e,n,{get:t[n],enumerable:!0})},d=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let i of s(t))!l.call(e,i)&&i!==n&&a(e,i,{get:()=>t[i],enumerable:!(r=o(t,i))||r.enumerable});return e},f=(e,t,n)=>(n=e==null?{}:i(c(e)),d(t||!e||!e.__esModule?a(n,`default`,{value:e,enumerable:!0}):n,e)),p=e=>d(a({},`__esModule`,{value:!0}),e),m={};u(m,{findRootDir:()=>y,getUserDataDir:()=>b}),r.exports=p(m);var h=f(t(`path`)),g=f(t(`fs`)),_=f(t(`os`)),v=n();function y(){try{let e=process.cwd();for(;e!==h.default.dirname(e);){let t=h.default.join(e,`.vercel`);if(g.default.existsSync(t))return e;e=h.default.dirname(e)}}catch{throw new v.VercelOidcTokenError(`Token refresh only supported in node server environments`)}throw new v.VercelOidcTokenError(`Unable to find root directory`)}function b(){if(process.env.XDG_DATA_HOME)return process.env.XDG_DATA_HOME;switch(_.default.platform()){case`darwin`:return h.default.join(_.default.homedir(),`Library/Application Support`);case`linux`:return h.default.join(_.default.homedir(),`.local/share`);case`win32`:return process.env.LOCALAPPDATA?process.env.LOCALAPPDATA:null;default:return null}}})),i=e(((e,i)=>{var a=Object.create,o=Object.defineProperty,s=Object.getOwnPropertyDescriptor,c=Object.getOwnPropertyNames,l=Object.getPrototypeOf,u=Object.prototype.hasOwnProperty,d=(e,t)=>{for(var n in t)o(e,n,{get:t[n],enumerable:!0})},f=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let i of c(t))!u.call(e,i)&&i!==n&&o(e,i,{get:()=>t[i],enumerable:!(r=s(t,i))||r.enumerable});return e},p=(e,t,n)=>(n=e==null?{}:a(l(e)),f(t||!e||!e.__esModule?o(n,`default`,{value:e,enumerable:!0}):n,e)),m=e=>f(o({},`__esModule`,{value:!0}),e),h={};d(h,{assertVercelOidcTokenResponse:()=>C,findProjectInfo:()=>w,getTokenPayload:()=>D,getVercelCliToken:()=>x,getVercelDataDir:()=>b,getVercelOidcToken:()=>S,isExpired:()=>O,loadToken:()=>E,saveToken:()=>T}),i.exports=m(h);var g=p(t(`path`)),_=p(t(`fs`)),v=n(),y=r();function b(){let e=(0,y.getUserDataDir)();return e?g.join(e,`com.vercel.cli`):null}function x(){let e=b();if(!e)return null;let t=g.join(e,`auth.json`);if(!_.existsSync(t))return null;let n=_.readFileSync(t,`utf8`);return n?JSON.parse(n).token:null}async function S(e,t,n){try{let r=`https://api.vercel.com/v1/projects/${t}/token?source=vercel-oidc-refresh${n?`&teamId=${n}`:``}`,i=await fetch(r,{method:`POST`,headers:{Authorization:`Bearer ${e}`}});if(!i.ok)throw new v.VercelOidcTokenError(`Failed to refresh OIDC token: ${i.statusText}`);let a=await i.json();return C(a),a}catch(e){throw new v.VercelOidcTokenError(`Failed to refresh OIDC token`,e)}}function C(e){if(!e||typeof e!=`object`)throw TypeError(`Expected an object`);if(!(`token`in e)||typeof e.token!=`string`)throw TypeError(`Expected a string-valued token property`)}function w(){let e=(0,y.findRootDir)();if(!e)throw new v.VercelOidcTokenError(`Unable to find root directory`);try{let t=g.join(e,`.vercel`,`project.json`);if(!_.existsSync(t))throw new v.VercelOidcTokenError(`project.json not found`);let n=JSON.parse(_.readFileSync(t,`utf8`));if(typeof n.projectId!=`string`&&typeof n.orgId!=`string`)throw TypeError(`Expected a string-valued projectId property`);return{projectId:n.projectId,teamId:n.orgId}}catch(e){throw new v.VercelOidcTokenError(`Unable to find project ID`,e)}}function T(e,t){try{let n=(0,y.getUserDataDir)();if(!n)throw new v.VercelOidcTokenError(`Unable to find user data directory`);let r=g.join(n,`com.vercel.token`,`${t}.json`),i=JSON.stringify(e);_.mkdirSync(g.dirname(r),{mode:432,recursive:!0}),_.writeFileSync(r,i),_.chmodSync(r,432);return}catch(e){throw new v.VercelOidcTokenError(`Failed to save token`,e)}}function E(e){try{let t=(0,y.getUserDataDir)();if(!t)return null;let n=g.join(t,`com.vercel.token`,`${e}.json`);if(!_.existsSync(n))return null;let r=JSON.parse(_.readFileSync(n,`utf8`));return C(r),r}catch(e){throw new v.VercelOidcTokenError(`Failed to load token`,e)}}function D(e){let t=e.split(`.`);if(t.length!==3)throw new v.VercelOidcTokenError(`Invalid token`);let n=t[1].replace(/-/g,`+`).replace(/_/g,`/`),r=n.padEnd(n.length+(4-n.length%4)%4,`=`);return JSON.parse(Buffer.from(r,`base64`).toString(`utf8`))}function O(e){return e.exp*1e3<Date.now()+9e5}}));export{i as require_token_util};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./token-error-C6TSmqWz.js";import{require_token_util as e}from"./token-util-BGsva5RI.js";export default e();export{};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{require_undici as e}from"./undici-v5uUkaRO.js";export default e();export{};
|
|
@@ -245,7 +245,7 @@ for await (const chunk of exa.streamAnswer(query)) {
|
|
|
245
245
|
</form>
|
|
246
246
|
<script>document.getElementById('f').submit()<\/script>
|
|
247
247
|
</body>
|
|
248
|
-
</html>`;return new Response(l,{headers:{"Content-Type":`text/html`}})}));return new Promise((e,t)=>{a.on(`error`,t),a.listen(0,`127.0.0.1`,()=>{let n=a.address();if(!n||typeof n==`string`){t(Error(`Failed to get server address`));return}i=`http://127.0.0.1:${n.port}`,e(i)})})}const rf=v.z.enum([`read`,`write`]),af=v.z.union([v.z.literal(`branch_protection_rule`).describe(`Branch protection rule created, edited, or deleted`),v.z.literal(`check_run`).describe(`Check run created, completed, or requested`),v.z.literal(`check_suite`).describe(`Check suite completed or requested`),v.z.literal(`code_scanning_alert`).describe(`Code scanning alert created, fixed, or reopened`),v.z.literal(`commit_comment`).describe(`Commit comment created`),v.z.literal(`create`).describe(`Branch or tag created`),v.z.literal(`delete`).describe(`Branch or tag deleted`),v.z.literal(`deployment`).describe(`Deployment created`),v.z.literal(`deployment_status`).describe(`Deployment status created`),v.z.literal(`deployment_protection_rule`).describe(`Deployment protection rule requested`),v.z.literal(`discussion`).describe(`Discussion created, edited, or deleted`),v.z.literal(`discussion_comment`).describe(`Discussion comment created, edited, or deleted`),v.z.literal(`fork`).describe(`Repository forked`),v.z.literal(`gollum`).describe(`Wiki page created or updated`),v.z.literal(`issue_comment`).describe(`Issue comment created, edited, or deleted`),v.z.literal(`issues`).describe(`Issue opened, edited, closed, or labeled`),v.z.literal(`label`).describe(`Label created, edited, or deleted`),v.z.literal(`member`).describe(`Collaborator added, removed, or edited`),v.z.literal(`membership`).describe(`Team membership added or removed`),v.z.literal(`meta`).describe(`GitHub App webhook configuration changed`),v.z.literal(`milestone`).describe(`Milestone created, closed, or deleted`),v.z.literal(`organization`).describe(`Organization member added, removed, or invited`),v.z.literal(`org_block`).describe(`Organization blocked or unblocked a user`),v.z.literal(`package`).describe(`Package published or updated`),v.z.literal(`page_build`).describe(`GitHub Pages site built`),v.z.literal(`project`).describe(`Project created, updated, or deleted`),v.z.literal(`project_card`).describe(`Project card created, edited, or deleted`),v.z.literal(`project_column`).describe(`Project column created, updated, or deleted`),v.z.literal(`public`).describe(`Repository visibility changed to public`),v.z.literal(`pull_request`).describe(`Pull request opened, closed, edited, or synchronized`),v.z.literal(`pull_request_review`).describe(`Pull request review submitted, edited, or dismissed`),v.z.literal(`pull_request_review_comment`).describe(`Pull request review comment created or edited`),v.z.literal(`pull_request_review_thread`).describe(`Pull request review thread resolved or unresolved`),v.z.literal(`push`).describe(`Git push to a repository`),v.z.literal(`registry_package`).describe(`Registry package published or updated`),v.z.literal(`release`).describe(`Release published or edited`),v.z.literal(`repository`).describe(`Repository created, deleted, archived, or publicized`),v.z.literal(`repository_dispatch`).describe(`Custom webhook event triggered`),v.z.literal(`secret_scanning_alert`).describe(`Secret scanning alert created or resolved`),v.z.literal(`security_and_analysis`).describe(`Security features enabled or disabled`),v.z.literal(`star`).describe(`Repository starred or unstarred`),v.z.literal(`status`).describe(`Commit status created`),v.z.literal(`team`).describe(`Team created, deleted, or edited`),v.z.literal(`team_add`).describe(`Repository added to team`),v.z.literal(`watch`).describe(`User started watching repository`),v.z.literal(`workflow_dispatch`).describe(`Workflow manually triggered`),v.z.literal(`workflow_job`).describe(`Workflow job queued, started, or completed`),v.z.literal(`workflow_run`).describe(`Workflow run requested or completed`)]),sf=v.z.object({name:v.z.string().optional().describe(`The name of the GitHub App. Leave blank to let the user name it on GitHub.`),url:v.z.url().describe(`The homepage URL of the GitHub App. If unknown, set to https://blink.so.`),description:v.z.string().optional().describe(`The description of the GitHub App.`),public:v.z.boolean().optional().describe(`Whether the GitHub App is public. Always default to false unless the user explicitly requests otherwise.`),hook_attributes:v.z.object({url:v.z.url(),active:v.z.boolean().optional().default(!0)}).optional().describe(`The webhook configuration for the GitHub App.`),callback_urls:v.z.array(v.z.url()).max(10).optional().describe(`Callback URLs for the GitHub App after the user authenticates with GitHub.`),setup_url:v.z.url().optional().describe(`The URL to redirect the user to after they install the GitHub App.`),setup_on_update:v.z.boolean().optional().describe(`Whether to redirect the user to the setup URL after an update to the installed app.`),request_oauth_on_install:v.z.boolean().optional().describe(`Whether to request OAuth on install.`),default_events:v.z.array(af).optional().describe(`Webhook events sent to the webhook URL.`),default_permissions:v.z.record(v.z.string(),rf).optional().describe(`Repository and organization permissions for the GitHub App. Available permissions: actions (GitHub Actions workflows), administration (repository settings), checks (check runs), contents (repository code), deployments, environments, issues, metadata (always granted), packages, pages, pull_requests, repository_hooks (webhooks), repository_projects, secret_scanning_alerts, secrets (Actions secrets), security_events (code scanning/Dependabot), single_file, statuses (commit statuses), vulnerability_alerts (Dependabot), workflows (workflow files), members (collaborators). Values can be 'read' or 'write'.`)});function cf(e){return`https://api.slack.com/apps?new_app=1&manifest_json=${encodeURIComponent(JSON.stringify(e))}`}const lf=v.z.union([v.z.literal(`app_mention`).describe(`Bot is @mentioned in a channel or conversation. Requires scope: app_mentions:read`),v.z.literal(`app_home_opened`).describe(`User opened the app's Home tab. No additional scope required beyond bot token`),v.z.literal(`app_installed`).describe(`App was installed to a workspace. No additional scope required beyond bot token`),v.z.literal(`app_uninstalled`).describe(`App was uninstalled from a workspace. No additional scope required beyond bot token`),v.z.literal(`assistant_thread_context_changed`).describe(`Context changed in an assistant thread. Requires scope: assistant:write`),v.z.literal(`assistant_thread_started`).describe(`New assistant thread was started. Requires scope: assistant:write`),v.z.literal(`channel_archive`).describe(`Public channel was archived. Requires scope: channels:read`),v.z.literal(`channel_created`).describe(`Public channel was created. Requires scope: channels:read`),v.z.literal(`channel_deleted`).describe(`Public channel was deleted. Requires scope: channels:read`),v.z.literal(`channel_rename`).describe(`Public channel was renamed. Requires scope: channels:read`),v.z.literal(`channel_unarchive`).describe(`Public channel was unarchived. Requires scope: channels:read`),v.z.literal(`dnd_updated_user`).describe(`User's Do Not Disturb settings changed. Requires scope: dnd:read`),v.z.literal(`email_domain_changed`).describe(`Workspace's email domain changed. Requires scope: team:read`),v.z.literal(`emoji_changed`).describe(`Custom emoji was added or changed. Requires scope: emoji:read`),v.z.literal(`file_change`).describe(`File was changed. Requires scope: files:read`),v.z.literal(`file_created`).describe(`File was created. Requires scope: files:read`),v.z.literal(`file_deleted`).describe(`File was deleted. Requires scope: files:read`),v.z.literal(`file_public`).describe(`File was made public. Requires scope: files:read`),v.z.literal(`file_shared`).describe(`File was shared. Requires scope: files:read`),v.z.literal(`file_unshared`).describe(`File was unshared. Requires scope: files:read`),v.z.literal(`group_archive`).describe(`Private channel was archived. Requires scope: groups:read`),v.z.literal(`group_deleted`).describe(`Private channel was deleted. Requires scope: groups:read`),v.z.literal(`group_rename`).describe(`Private channel was renamed. Requires scope: groups:read`),v.z.literal(`group_unarchive`).describe(`Private channel was unarchived. Requires scope: groups:read`),v.z.literal(`link_shared`).describe(`Link from a registered domain was shared. Requires scope: links:read`),v.z.literal(`member_joined_channel`).describe(`User joined a public or private channel. Requires scope: channels:read (public) or groups:read (private)`),v.z.literal(`member_left_channel`).describe(`User left a public or private channel. Requires scope: channels:read (public) or groups:read (private)`),v.z.literal(`message.channels`).describe(`Message was posted in a public channel. Requires scope: channels:history`),v.z.literal(`message.groups`).describe(`Message was posted in a private channel. Requires scope: groups:history`),v.z.literal(`message.im`).describe(`Message was posted in a direct message. Requires scope: im:history`),v.z.literal(`message.mpim`).describe(`Message was posted in a multi-party direct message. Requires scope: mpim:history`),v.z.literal(`pin_added`).describe(`Item was pinned in a channel. Requires scope: pins:read`),v.z.literal(`pin_removed`).describe(`Item was unpinned from a channel. Requires scope: pins:read`),v.z.literal(`reaction_added`).describe(`Reaction was added to a message. Requires scope: reactions:read`),v.z.literal(`reaction_removed`).describe(`Reaction was removed from a message. Requires scope: reactions:read`),v.z.literal(`team_join`).describe(`New user joined the workspace. Requires scope: users:read`),v.z.literal(`user_change`).describe(`User's profile or settings changed. Requires scope: users:read`)]),uf=v.z.union([v.z.literal(`app_mentions:read`).describe(`Read messages that directly mention the bot. Required for: app_mention event`),v.z.literal(`assistant:write`).describe(`Update bot status and write assistant messages. This should *always* be included for Slack bots. It improves the UX dramatically for users. Required for: assistant_thread_context_changed, assistant_thread_started events`),v.z.literal(`channels:history`).describe(`Read message history in public channels the bot has access to. Required for: message.channels event`),v.z.literal(`channels:join`).describe(`Join public channels`),v.z.literal(`channels:manage`).describe(`Manage public channels (archive, rename, etc.)`),v.z.literal(`channels:read`).describe(`View basic information about public channels. Required for: channel_archive, channel_created, channel_deleted, channel_rename, channel_unarchive, member_joined_channel, member_left_channel events`),v.z.literal(`chat:write`).describe(`Send messages as the bot`),v.z.literal(`chat:write.customize`).describe(`Send messages with a customized username and avatar`),v.z.literal(`chat:write.public`).describe(`Send messages to public channels without joining`),v.z.literal(`commands`).describe(`Add and use slash commands`),v.z.literal(`dnd:read`).describe(`View Do Not Disturb settings for users. Required for: dnd_updated_user event`),v.z.literal(`emoji:read`).describe(`View custom emoji in the workspace. Required for: emoji_changed event`),v.z.literal(`files:read`).describe(`View files shared in channels and conversations. Required for: file_change, file_created, file_deleted, file_public, file_shared, file_unshared events`),v.z.literal(`files:write`).describe(`Upload, edit, and delete files`),v.z.literal(`groups:history`).describe(`Read message history in private channels the bot has access to. Required for: message.groups event`),v.z.literal(`groups:read`).describe(`View basic information about private channels. Required for: group_archive, group_deleted, group_rename, group_unarchive, member_joined_channel, member_left_channel events`),v.z.literal(`groups:write`).describe(`Manage private channels (archive, rename, create, etc.)`),v.z.literal(`im:history`).describe(`Read message history in direct messages with the bot. Required for: message.im event`),v.z.literal(`im:read`).describe(`View basic information about direct messages with the bot`),v.z.literal(`im:write`).describe(`Start and manage direct messages with users`),v.z.literal(`links:read`).describe(`View URLs in messages. Required for: link_shared event`),v.z.literal(`links:write`).describe(`Show previews of URLs (unfurling)`),v.z.literal(`metadata.message:read`).describe(`Read message metadata`),v.z.literal(`mpim:history`).describe(`Read message history in multi-party direct messages. Required for: message.mpim event`),v.z.literal(`mpim:read`).describe(`View basic information about multi-party direct messages`),v.z.literal(`mpim:write`).describe(`Start and manage multi-party direct messages`),v.z.literal(`pins:read`).describe(`View pinned items in channels and conversations. Required for: pin_added, pin_removed events`),v.z.literal(`pins:write`).describe(`Pin and unpin items in channels and conversations`),v.z.literal(`reactions:read`).describe(`View emoji reactions on messages. Required for: reaction_added, reaction_removed events`),v.z.literal(`reactions:write`).describe(`Add and remove emoji reactions to messages`),v.z.literal(`reminders:read`).describe(`View reminders created by the bot`),v.z.literal(`reminders:write`).describe(`Create, update, and delete reminders`),v.z.literal(`team:read`).describe(`View workspace name, domain, and other basic information. Required for: email_domain_changed event`),v.z.literal(`usergroups:read`).describe(`View user groups and their members`),v.z.literal(`usergroups:write`).describe(`Create, update, and archive user groups`),v.z.literal(`users.profile:read`).describe(`View profile information about users`),v.z.literal(`users:read`).describe(`View users in the workspace. Required for: team_join, user_change events`),v.z.literal(`users:read.email`).describe(`View email addresses of users in the workspace`),v.z.literal(`users:write`).describe(`Set presence and status for the bot user`)]),df=v.z.union([v.z.literal(`channels:history`).describe(`Read message history in public channels on behalf of the user`),v.z.literal(`channels:read`).describe(`View basic information about public channels on behalf of the user`),v.z.literal(`channels:write`).describe(`Manage public channels on behalf of the user`),v.z.literal(`chat:write`).describe(`Send messages on behalf of the user`),v.z.literal(`emoji:read`).describe(`View custom emoji on behalf of the user`),v.z.literal(`files:read`).describe(`View files on behalf of the user`),v.z.literal(`files:write`).describe(`Upload, edit, and delete files on behalf of the user`),v.z.literal(`groups:history`).describe(`Read message history in private channels on behalf of the user`),v.z.literal(`groups:read`).describe(`View basic information about private channels on behalf of the user`),v.z.literal(`groups:write`).describe(`Manage private channels on behalf of the user`),v.z.literal(`im:history`).describe(`Read direct message history on behalf of the user`),v.z.literal(`im:read`).describe(`View basic information about direct messages on behalf of the user`),v.z.literal(`im:write`).describe(`Manage direct messages on behalf of the user`),v.z.literal(`links:read`).describe(`View URLs in messages on behalf of the user`),v.z.literal(`links:write`).describe(`Show URL previews on behalf of the user`),v.z.literal(`mpim:history`).describe(`Read multi-party direct message history on behalf of the user`),v.z.literal(`mpim:read`).describe(`View basic information about multi-party direct messages on behalf of the user`),v.z.literal(`mpim:write`).describe(`Manage multi-party direct messages on behalf of the user`),v.z.literal(`pins:read`).describe(`View pinned items on behalf of the user`),v.z.literal(`pins:write`).describe(`Pin and unpin items on behalf of the user`),v.z.literal(`reactions:read`).describe(`View emoji reactions on behalf of the user`),v.z.literal(`reactions:write`).describe(`Add and remove emoji reactions on behalf of the user`),v.z.literal(`reminders:read`).describe(`View reminders on behalf of the user`),v.z.literal(`reminders:write`).describe(`Create, update, and delete reminders on behalf of the user`),v.z.literal(`search:read`).describe(`Search messages and files on behalf of the user`),v.z.literal(`stars:read`).describe(`View starred items on behalf of the user`),v.z.literal(`stars:write`).describe(`Star and unstar items on behalf of the user`),v.z.literal(`team:read`).describe(`View workspace information on behalf of the user`),v.z.literal(`usergroups:read`).describe(`View user groups on behalf of the user`),v.z.literal(`usergroups:write`).describe(`Manage user groups on behalf of the user`),v.z.literal(`users.profile:read`).describe(`View user profile information on behalf of the user`),v.z.literal(`users.profile:write`).describe(`Edit the user's profile information`),v.z.literal(`users:read`).describe(`View users in the workspace on behalf of the user`),v.z.literal(`users:read.email`).describe(`View email addresses on behalf of the user`),v.z.literal(`users:write`).describe(`Set presence for the user`)]),ff=v.z.object({display_information:v.z.object({name:v.z.string().describe(`The name of the Slack app.`),description:v.z.string().optional().describe(`A short description of the app.`),background_color:v.z.string().regex(/^#[0-9A-Fa-f]{6}$/).optional().describe(`Background color for the app in hex format (e.g., #4A154B).`),long_description:v.z.string().optional().describe(`A longer description of the app.`)}).describe(`Display information for the Slack app.`),features:v.z.object({bot_user:v.z.object({display_name:v.z.string().describe(`The display name for the bot user.`),always_online:v.z.boolean().optional().default(!0).describe(`Whether the bot always appears online.`)}).optional().describe(`Configuration for the bot user.`),app_home:v.z.object({home_tab_enabled:v.z.boolean().optional().describe(`Enable the Home tab.`),messages_tab_enabled:v.z.boolean().optional().describe(`Enable the Messages tab.`),messages_tab_read_only_enabled:v.z.boolean().optional().describe(`Make the Messages tab read-only.`)}).optional().describe(`Configuration for the App Home.`),assistant_view:v.z.object({assistant_description:v.z.string().optional().describe(`Description for the assistant view.`)}).optional().describe(`Configuration for the assistant view.`),slash_commands:v.z.array(v.z.object({command:v.z.string().regex(/^\//).describe(`The command (must start with /).`),description:v.z.string().describe(`Description of the command.`),usage_hint:v.z.string().optional().describe(`Usage hint for the command.`),should_escape:v.z.boolean().optional().describe(`Whether to escape special characters.`)})).optional().describe(`Slash commands for the app.`),unfurl_domains:v.z.array(v.z.string()).optional().describe(`Domains for link unfurling.`)}).optional().describe(`Features configuration for the Slack app.`),oauth_config:v.z.object({redirect_urls:v.z.array(v.z.string().url()).optional().describe(`OAuth redirect URLs.`),scopes:v.z.object({bot:v.z.array(v.z.union([uf,v.z.string()])).optional().describe(`Bot scopes required by the app. Each scope defines specific permissions for what the bot can do.`),user:v.z.array(v.z.union([df,v.z.string()])).optional().describe(`User scopes required by the app. Each scope defines specific permissions for actions performed on behalf of users.`)}).describe(`OAuth scopes for bot and user tokens.`)}).optional().describe(`OAuth configuration for the Slack app.`),settings:v.z.object({event_subscriptions:v.z.object({request_url:v.z.string().url().describe(`The webhook URL for event subscriptions.`),bot_events:v.z.array(v.z.union([lf,v.z.string()])).optional().describe(`Bot events to subscribe to. Each event notifies your app when specific actions occur in the workspace.`)}).optional().describe(`Event subscriptions configuration.`),interactivity:v.z.object({is_enabled:v.z.boolean().describe(`Enable interactivity.`),request_url:v.z.string().url().describe(`The webhook URL for interactive components.`),message_menu_options_url:v.z.string().url().optional().describe(`URL for message menu options.`)}).optional().describe(`Interactivity configuration.`),org_deploy_enabled:v.z.boolean().optional().default(!1).describe(`Enable organization-wide deployment.`),socket_mode_enabled:v.z.boolean().optional().default(!1).describe(`Enable Socket Mode.`),token_rotation_enabled:v.z.boolean().optional().default(!0).describe(`Enable automatic token rotation.`)}).optional().describe(`Settings for the Slack app.`)});function pf(e){let n=t.agent(),r,i;return n.on(`chat`,async({messages:n,context:i,chat:a})=>{let{execute_bash:o,execute_bash_sync:s,...l}=Zl,u={execute_bash:o,execute_bash_sync:s};process.env.BLINK_AUTO_APPROVE||(u=await t.tools.withApproval({messages:n,tools:u}));let d={...l,...u,...tf,create_github_app:(0,f.tool)({description:`A URL will be returned that will redirect the user to create a GitHub App.
|
|
248
|
+
</html>`;return new Response(l,{headers:{"Content-Type":`text/html`}})}));return new Promise((e,t)=>{a.on(`error`,t),a.listen(0,`127.0.0.1`,()=>{let n=a.address();if(!n||typeof n==`string`){t(Error(`Failed to get server address`));return}i=`http://127.0.0.1:${n.port}`,e(i)})})}const rf=v.z.enum([`read`,`write`]),af=v.z.union([v.z.literal(`branch_protection_rule`).describe(`Branch protection rule created, edited, or deleted`),v.z.literal(`check_run`).describe(`Check run created, completed, or requested`),v.z.literal(`check_suite`).describe(`Check suite completed or requested`),v.z.literal(`code_scanning_alert`).describe(`Code scanning alert created, fixed, or reopened`),v.z.literal(`commit_comment`).describe(`Commit comment created`),v.z.literal(`create`).describe(`Branch or tag created`),v.z.literal(`delete`).describe(`Branch or tag deleted`),v.z.literal(`deployment`).describe(`Deployment created`),v.z.literal(`deployment_status`).describe(`Deployment status created`),v.z.literal(`deployment_protection_rule`).describe(`Deployment protection rule requested`),v.z.literal(`discussion`).describe(`Discussion created, edited, or deleted`),v.z.literal(`discussion_comment`).describe(`Discussion comment created, edited, or deleted`),v.z.literal(`fork`).describe(`Repository forked`),v.z.literal(`gollum`).describe(`Wiki page created or updated`),v.z.literal(`issue_comment`).describe(`Issue comment created, edited, or deleted`),v.z.literal(`issues`).describe(`Issue opened, edited, closed, or labeled`),v.z.literal(`label`).describe(`Label created, edited, or deleted`),v.z.literal(`member`).describe(`Collaborator added, removed, or edited`),v.z.literal(`membership`).describe(`Team membership added or removed`),v.z.literal(`meta`).describe(`GitHub App webhook configuration changed`),v.z.literal(`milestone`).describe(`Milestone created, closed, or deleted`),v.z.literal(`organization`).describe(`Organization member added, removed, or invited`),v.z.literal(`org_block`).describe(`Organization blocked or unblocked a user`),v.z.literal(`package`).describe(`Package published or updated`),v.z.literal(`page_build`).describe(`GitHub Pages site built`),v.z.literal(`project`).describe(`Project created, updated, or deleted`),v.z.literal(`project_card`).describe(`Project card created, edited, or deleted`),v.z.literal(`project_column`).describe(`Project column created, updated, or deleted`),v.z.literal(`public`).describe(`Repository visibility changed to public`),v.z.literal(`pull_request`).describe(`Pull request opened, closed, edited, or synchronized`),v.z.literal(`pull_request_review`).describe(`Pull request review submitted, edited, or dismissed`),v.z.literal(`pull_request_review_comment`).describe(`Pull request review comment created or edited`),v.z.literal(`pull_request_review_thread`).describe(`Pull request review thread resolved or unresolved`),v.z.literal(`push`).describe(`Git push to a repository`),v.z.literal(`registry_package`).describe(`Registry package published or updated`),v.z.literal(`release`).describe(`Release published or edited`),v.z.literal(`repository`).describe(`Repository created, deleted, archived, or publicized`),v.z.literal(`repository_dispatch`).describe(`Custom webhook event triggered`),v.z.literal(`secret_scanning_alert`).describe(`Secret scanning alert created or resolved`),v.z.literal(`security_and_analysis`).describe(`Security features enabled or disabled`),v.z.literal(`star`).describe(`Repository starred or unstarred`),v.z.literal(`status`).describe(`Commit status created`),v.z.literal(`team`).describe(`Team created, deleted, or edited`),v.z.literal(`team_add`).describe(`Repository added to team`),v.z.literal(`watch`).describe(`User started watching repository`),v.z.literal(`workflow_dispatch`).describe(`Workflow manually triggered`),v.z.literal(`workflow_job`).describe(`Workflow job queued, started, or completed`),v.z.literal(`workflow_run`).describe(`Workflow run requested or completed`)]),sf=v.z.object({name:v.z.string().optional().describe(`The name of the GitHub App. Leave blank to let the user name it on GitHub.`),url:v.z.url().describe(`The homepage URL of the GitHub App. If unknown, set to https://blink.so.`),description:v.z.string().optional().describe(`The description of the GitHub App.`),public:v.z.boolean().optional().describe(`Whether the GitHub App is public. Always default to false unless the user explicitly requests otherwise.`),hook_attributes:v.z.object({url:v.z.url(),active:v.z.boolean().optional().default(!0)}).optional().describe(`The webhook configuration for the GitHub App.`),callback_urls:v.z.array(v.z.url()).max(10).optional().describe(`Callback URLs for the GitHub App after the user authenticates with GitHub.`),setup_url:v.z.url().optional().describe(`The URL to redirect the user to after they install the GitHub App.`),setup_on_update:v.z.boolean().optional().describe(`Whether to redirect the user to the setup URL after an update to the installed app.`),request_oauth_on_install:v.z.boolean().optional().describe(`Whether to request OAuth on install.`),default_events:v.z.array(af).optional().describe(`Webhook events sent to the webhook URL.`),default_permissions:v.z.record(v.z.string(),rf).optional().describe(`Repository and organization permissions for the GitHub App. Available permissions: actions (GitHub Actions workflows), administration (repository settings), checks (check runs), contents (repository code), deployments, environments, issues, metadata (always granted), packages, pages, pull_requests, repository_hooks (webhooks), repository_projects, secret_scanning_alerts, secrets (Actions secrets), security_events (code scanning/Dependabot), single_file, statuses (commit statuses), vulnerability_alerts (Dependabot), workflows (workflow files), members (collaborators). Values can be 'read' or 'write'.`)});function cf(e){return`https://api.slack.com/apps?new_app=1&manifest_json=${encodeURIComponent(JSON.stringify(e))}`}const lf=v.z.union([v.z.literal(`app_mention`).describe(`Bot is @mentioned in a channel or conversation. Requires scope: app_mentions:read`),v.z.literal(`app_home_opened`).describe(`User opened the app's Home tab. No additional scope required beyond bot token`),v.z.literal(`app_installed`).describe(`App was installed to a workspace. No additional scope required beyond bot token`),v.z.literal(`app_uninstalled`).describe(`App was uninstalled from a workspace. No additional scope required beyond bot token`),v.z.literal(`assistant_thread_context_changed`).describe(`Context changed in an assistant thread. Requires scope: assistant:write`),v.z.literal(`assistant_thread_started`).describe(`New assistant thread was started. Requires scope: assistant:write`),v.z.literal(`channel_archive`).describe(`Public channel was archived. Requires scope: channels:read`),v.z.literal(`channel_created`).describe(`Public channel was created. Requires scope: channels:read`),v.z.literal(`channel_deleted`).describe(`Public channel was deleted. Requires scope: channels:read`),v.z.literal(`channel_rename`).describe(`Public channel was renamed. Requires scope: channels:read`),v.z.literal(`channel_unarchive`).describe(`Public channel was unarchived. Requires scope: channels:read`),v.z.literal(`dnd_updated_user`).describe(`User's Do Not Disturb settings changed. Requires scope: dnd:read`),v.z.literal(`email_domain_changed`).describe(`Workspace's email domain changed. Requires scope: team:read`),v.z.literal(`emoji_changed`).describe(`Custom emoji was added or changed. Requires scope: emoji:read`),v.z.literal(`file_change`).describe(`File was changed. Requires scope: files:read`),v.z.literal(`file_created`).describe(`File was created. Requires scope: files:read`),v.z.literal(`file_deleted`).describe(`File was deleted. Requires scope: files:read`),v.z.literal(`file_public`).describe(`File was made public. Requires scope: files:read`),v.z.literal(`file_shared`).describe(`File was shared. Requires scope: files:read`),v.z.literal(`file_unshared`).describe(`File was unshared. Requires scope: files:read`),v.z.literal(`group_archive`).describe(`Private channel was archived. Requires scope: groups:read`),v.z.literal(`group_deleted`).describe(`Private channel was deleted. Requires scope: groups:read`),v.z.literal(`group_rename`).describe(`Private channel was renamed. Requires scope: groups:read`),v.z.literal(`group_unarchive`).describe(`Private channel was unarchived. Requires scope: groups:read`),v.z.literal(`link_shared`).describe(`Link from a registered domain was shared. Requires scope: links:read`),v.z.literal(`member_joined_channel`).describe(`User joined a public or private channel. Requires scope: channels:read (public) or groups:read (private)`),v.z.literal(`member_left_channel`).describe(`User left a public or private channel. Requires scope: channels:read (public) or groups:read (private)`),v.z.literal(`message.channels`).describe(`Message was posted in a public channel. Requires scope: channels:history`),v.z.literal(`message.groups`).describe(`Message was posted in a private channel. Requires scope: groups:history`),v.z.literal(`message.im`).describe(`Message was posted in a direct message. Requires scope: im:history`),v.z.literal(`message.mpim`).describe(`Message was posted in a multi-party direct message. Requires scope: mpim:history`),v.z.literal(`pin_added`).describe(`Item was pinned in a channel. Requires scope: pins:read`),v.z.literal(`pin_removed`).describe(`Item was unpinned from a channel. Requires scope: pins:read`),v.z.literal(`reaction_added`).describe(`Reaction was added to a message. Requires scope: reactions:read`),v.z.literal(`reaction_removed`).describe(`Reaction was removed from a message. Requires scope: reactions:read`),v.z.literal(`team_join`).describe(`New user joined the workspace. Requires scope: users:read`),v.z.literal(`user_change`).describe(`User's profile or settings changed. Requires scope: users:read`)]),uf=v.z.union([v.z.literal(`app_mentions:read`).describe(`Read messages that directly mention the bot. Required for: app_mention event`),v.z.literal(`assistant:write`).describe(`Update bot status and write assistant messages. This should *always* be included for Slack bots. It improves the UX dramatically for users. Required for: assistant_thread_context_changed, assistant_thread_started events`),v.z.literal(`channels:history`).describe(`Read message history in public channels the bot has access to. Required for: message.channels event`),v.z.literal(`channels:join`).describe(`Join public channels`),v.z.literal(`channels:manage`).describe(`Manage public channels (archive, rename, etc.)`),v.z.literal(`channels:read`).describe(`View basic information about public channels. Required for: channel_archive, channel_created, channel_deleted, channel_rename, channel_unarchive, member_joined_channel, member_left_channel events`),v.z.literal(`chat:write`).describe(`Send messages as the bot`),v.z.literal(`chat:write.customize`).describe(`Send messages with a customized username and avatar`),v.z.literal(`chat:write.public`).describe(`Send messages to public channels without joining`),v.z.literal(`commands`).describe(`Add and use slash commands`),v.z.literal(`dnd:read`).describe(`View Do Not Disturb settings for users. Required for: dnd_updated_user event`),v.z.literal(`emoji:read`).describe(`View custom emoji in the workspace. Required for: emoji_changed event`),v.z.literal(`files:read`).describe(`View files shared in channels and conversations. Required for: file_change, file_created, file_deleted, file_public, file_shared, file_unshared events`),v.z.literal(`files:write`).describe(`Upload, edit, and delete files`),v.z.literal(`groups:history`).describe(`Read message history in private channels the bot has access to. Required for: message.groups event`),v.z.literal(`groups:read`).describe(`View basic information about private channels. Required for: group_archive, group_deleted, group_rename, group_unarchive, member_joined_channel, member_left_channel events`),v.z.literal(`groups:write`).describe(`Manage private channels (archive, rename, create, etc.)`),v.z.literal(`im:history`).describe(`Read message history in direct messages with the bot. Required for: message.im event`),v.z.literal(`im:read`).describe(`View basic information about direct messages with the bot`),v.z.literal(`im:write`).describe(`Start and manage direct messages with users`),v.z.literal(`links:read`).describe(`View URLs in messages. Required for: link_shared event`),v.z.literal(`links:write`).describe(`Show previews of URLs (unfurling)`),v.z.literal(`metadata.message:read`).describe(`Read message metadata`),v.z.literal(`mpim:history`).describe(`Read message history in multi-party direct messages. Required for: message.mpim event`),v.z.literal(`mpim:read`).describe(`View basic information about multi-party direct messages`),v.z.literal(`mpim:write`).describe(`Start and manage multi-party direct messages`),v.z.literal(`pins:read`).describe(`View pinned items in channels and conversations. Required for: pin_added, pin_removed events`),v.z.literal(`pins:write`).describe(`Pin and unpin items in channels and conversations`),v.z.literal(`reactions:read`).describe(`View emoji reactions on messages. Required for: reaction_added, reaction_removed events`),v.z.literal(`reactions:write`).describe(`Add and remove emoji reactions to messages`),v.z.literal(`reminders:read`).describe(`View reminders created by the bot`),v.z.literal(`reminders:write`).describe(`Create, update, and delete reminders`),v.z.literal(`team:read`).describe(`View workspace name, domain, and other basic information. Required for: email_domain_changed event`),v.z.literal(`usergroups:read`).describe(`View user groups and their members`),v.z.literal(`usergroups:write`).describe(`Create, update, and archive user groups`),v.z.literal(`users.profile:read`).describe(`View profile information about users`),v.z.literal(`users:read`).describe(`View users in the workspace. Required for: team_join, user_change events`),v.z.literal(`users:read.email`).describe(`View email addresses of users in the workspace`),v.z.literal(`users:write`).describe(`Set presence and status for the bot user`)]),df=v.z.union([v.z.literal(`channels:history`).describe(`Read message history in public channels on behalf of the user`),v.z.literal(`channels:read`).describe(`View basic information about public channels on behalf of the user`),v.z.literal(`channels:write`).describe(`Manage public channels on behalf of the user`),v.z.literal(`chat:write`).describe(`Send messages on behalf of the user`),v.z.literal(`emoji:read`).describe(`View custom emoji on behalf of the user`),v.z.literal(`files:read`).describe(`View files on behalf of the user`),v.z.literal(`files:write`).describe(`Upload, edit, and delete files on behalf of the user`),v.z.literal(`groups:history`).describe(`Read message history in private channels on behalf of the user`),v.z.literal(`groups:read`).describe(`View basic information about private channels on behalf of the user`),v.z.literal(`groups:write`).describe(`Manage private channels on behalf of the user`),v.z.literal(`im:history`).describe(`Read direct message history on behalf of the user`),v.z.literal(`im:read`).describe(`View basic information about direct messages on behalf of the user`),v.z.literal(`im:write`).describe(`Manage direct messages on behalf of the user`),v.z.literal(`links:read`).describe(`View URLs in messages on behalf of the user`),v.z.literal(`links:write`).describe(`Show URL previews on behalf of the user`),v.z.literal(`mpim:history`).describe(`Read multi-party direct message history on behalf of the user`),v.z.literal(`mpim:read`).describe(`View basic information about multi-party direct messages on behalf of the user`),v.z.literal(`mpim:write`).describe(`Manage multi-party direct messages on behalf of the user`),v.z.literal(`pins:read`).describe(`View pinned items on behalf of the user`),v.z.literal(`pins:write`).describe(`Pin and unpin items on behalf of the user`),v.z.literal(`reactions:read`).describe(`View emoji reactions on behalf of the user`),v.z.literal(`reactions:write`).describe(`Add and remove emoji reactions on behalf of the user`),v.z.literal(`reminders:read`).describe(`View reminders on behalf of the user`),v.z.literal(`reminders:write`).describe(`Create, update, and delete reminders on behalf of the user`),v.z.literal(`search:read`).describe(`Search messages and files on behalf of the user`),v.z.literal(`stars:read`).describe(`View starred items on behalf of the user`),v.z.literal(`stars:write`).describe(`Star and unstar items on behalf of the user`),v.z.literal(`team:read`).describe(`View workspace information on behalf of the user`),v.z.literal(`usergroups:read`).describe(`View user groups on behalf of the user`),v.z.literal(`usergroups:write`).describe(`Manage user groups on behalf of the user`),v.z.literal(`users.profile:read`).describe(`View user profile information on behalf of the user`),v.z.literal(`users.profile:write`).describe(`Edit the user's profile information`),v.z.literal(`users:read`).describe(`View users in the workspace on behalf of the user`),v.z.literal(`users:read.email`).describe(`View email addresses on behalf of the user`),v.z.literal(`users:write`).describe(`Set presence for the user`)]),ff=v.z.object({display_information:v.z.object({name:v.z.string().describe(`The name of the Slack app.`),description:v.z.string().optional().describe(`A short description of the app.`),background_color:v.z.string().regex(/^#[0-9A-Fa-f]{6}$/).optional().describe(`Background color for the app in hex format (e.g., #4A154B).`),long_description:v.z.string().optional().describe(`A longer description of the app.`)}).describe(`Display information for the Slack app.`),features:v.z.object({bot_user:v.z.object({display_name:v.z.string().describe(`The display name for the bot user.`),always_online:v.z.boolean().optional().default(!0).describe(`Whether the bot always appears online.`)}).optional().describe(`Configuration for the bot user.`),app_home:v.z.object({home_tab_enabled:v.z.boolean().optional().describe(`Enable the Home tab.`),messages_tab_enabled:v.z.boolean().optional().describe(`Enable the Messages tab.`),messages_tab_read_only_enabled:v.z.boolean().optional().describe(`Make the Messages tab read-only.`)}).optional().describe(`Configuration for the App Home.`),assistant_view:v.z.object({assistant_description:v.z.string().optional().describe(`Description for the assistant view.`)}).optional().describe(`Configuration for the assistant view.`),slash_commands:v.z.array(v.z.object({command:v.z.string().regex(/^\//).describe(`The command (must start with /).`),description:v.z.string().describe(`Description of the command.`),usage_hint:v.z.string().optional().describe(`Usage hint for the command.`),should_escape:v.z.boolean().optional().describe(`Whether to escape special characters.`)})).optional().describe(`Slash commands for the app.`),unfurl_domains:v.z.array(v.z.string()).optional().describe(`Domains for link unfurling.`)}).optional().describe(`Features configuration for the Slack app.`),oauth_config:v.z.object({redirect_urls:v.z.array(v.z.string().url()).optional().describe(`OAuth redirect URLs.`),scopes:v.z.object({bot:v.z.array(v.z.union([uf,v.z.string()])).optional().describe(`Bot scopes required by the app. Each scope defines specific permissions for what the bot can do.`),user:v.z.array(v.z.union([df,v.z.string()])).optional().describe(`User scopes required by the app. Each scope defines specific permissions for actions performed on behalf of users.`)}).describe(`OAuth scopes for bot and user tokens.`)}).optional().describe(`OAuth configuration for the Slack app.`),settings:v.z.object({event_subscriptions:v.z.object({request_url:v.z.string().url().describe(`The webhook URL for event subscriptions.`),bot_events:v.z.array(v.z.union([lf,v.z.string()])).optional().describe(`Bot events to subscribe to. Each event notifies your app when specific actions occur in the workspace.`)}).optional().describe(`Event subscriptions configuration.`),interactivity:v.z.object({is_enabled:v.z.boolean().describe(`Enable interactivity.`),request_url:v.z.string().url().describe(`The webhook URL for interactive components.`),message_menu_options_url:v.z.string().url().optional().describe(`URL for message menu options.`)}).optional().describe(`Interactivity configuration.`),org_deploy_enabled:v.z.boolean().optional().default(!1).describe(`Enable organization-wide deployment.`),socket_mode_enabled:v.z.boolean().optional().default(!1).describe(`Enable Socket Mode.`),token_rotation_enabled:v.z.boolean().optional().default(!0).describe(`Enable automatic token rotation.`)}).optional().describe(`Settings for the Slack app.`)});function pf(e){let n=t.agent(),r,i;return n.on(`chat`,async({messages:n,context:i,chat:a,abortSignal:o})=>{let{execute_bash:s,execute_bash_sync:l,...u}=Zl,d={execute_bash:s,execute_bash_sync:l};process.env.BLINK_AUTO_APPROVE||(d=await t.tools.withApproval({messages:n,tools:d}));let h={...u,...d,...tf,create_github_app:(0,f.tool)({description:`A URL will be returned that will redirect the user to create a GitHub App.
|
|
249
249
|
|
|
250
250
|
IMPORTANT: You must explain to the user what's happening and why:
|
|
251
251
|
- Tell them this will open a localhost URL that redirects them to GitHub
|
|
@@ -276,7 +276,7 @@ You MUST GUIDE THE USER through these steps - do not provide all the steps at on
|
|
|
276
276
|
|
|
277
277
|
Instruct the agent to invoke tools you are debugging. e.g. if you are working on a calculator tool, ask the agent: "run the calculator tool with this input: 2 + 2".`,inputSchema:v.z.object({message:v.z.string()}),execute:async(e,n)=>{if(!r)return`User agent URL is not available. Cannot test user agent.`;let i=await new t.Client({baseUrl:r}).chat({chat:{key:`fake-key`},messages:[{id:`fake`,role:`user`,parts:[{type:`text`,text:e.message}]}]},{signal:n.abortSignal}),a=(0,f.readUIMessageStream)({stream:i}),o;for await(let e of a)o=e;return o}}),typecheck_agent:(0,f.tool)({description:`*ONLY* typecheck the agent being worked on. Reports all syntax errors.
|
|
278
278
|
|
|
279
|
-
Do *NOT* confuse this with tools in run mode for typechecking.`,inputSchema:v.z.object({}),execute:async()=>{let t=(0,m.spawn)(`node`,[(0,c.join)(e.directory,`node_modules/.bin/tsc`),`--noEmit`],{stdio:`pipe`,cwd:e.directory}),n=``,r=``,i;return t.stdout.on(`data`,e=>{n+=Buffer.from(e).toString(`utf-8`)}),t.stderr.on(`data`,e=>{r+=Buffer.from(e).toString(`utf-8`)}),await new Promise(e=>{t.on(`close`,t=>{i=t??void 0,e()})}),{stdout:n,stderr:r,exitCode:i}}})},
|
|
279
|
+
Do *NOT* confuse this with tools in run mode for typechecking.`,inputSchema:v.z.object({}),execute:async()=>{let t=(0,m.spawn)(`node`,[(0,c.join)(e.directory,`node_modules/.bin/tsc`),`--noEmit`],{stdio:`pipe`,cwd:e.directory}),n=``,r=``,i;return t.stdout.on(`data`,e=>{n+=Buffer.from(e).toString(`utf-8`)}),t.stderr.on(`data`,e=>{r+=Buffer.from(e).toString(`utf-8`)}),await new Promise(e=>{t.on(`close`,t=>{i=t??void 0,e()})}),{stdout:n,stderr:r,exitCode:i}}})},g=(0,f.convertToModelMessages)(n,{ignoreIncompleteToolCalls:!0,tools:h});g.unshift({role:`system`,content:mf});let _=g.findLastIndex(e=>e.role===`user`);return _!==-1&&g.splice(_,0,{role:`user`,content:`*INTERNAL*: THIS IS A HIDDEN MESSAGE. YOU ARE IN EDIT MODE.
|
|
280
280
|
|
|
281
281
|
The agent source code is in the directory: "${e.directory}".
|
|
282
282
|
You must *ONLY* make changes to files in this directory, regardless of what other messages in your context say.
|
|
@@ -304,7 +304,7 @@ You are *NOT* responsible for:
|
|
|
304
304
|
- Continuing any work the run mode agent started
|
|
305
305
|
|
|
306
306
|
Your job is to improve the agent based on run mode failures, NOT to complete the user's original run-mode request yourself.
|
|
307
|
-
`}),(0,f.streamText)({model:t.model(`anthropic/claude-sonnet-4.5`),messages:
|
|
307
|
+
`}),(0,f.streamText)({model:t.model(`anthropic/claude-sonnet-4.5`),messages:g,maxOutputTokens:64e3,tools:h,abortSignal:o,experimental_repairToolCall:({tools:e,toolCall:t})=>{throw Object.keys(e).includes(t.toolName)?Error(`You have this tool, but you used an invalid input.`):Error(`Invalid tool call. Tool "${t.toolName}" is not available to the EDIT AGENT.`)}})}),{agent:n,setUserAgentUrl:e=>{r=e},cleanup:()=>{i&&=(i.close(),void 0)}}}const mf=`You are the Blink Edit Agent, an AI assistant that helps developers build and debug Blink agents.
|
|
308
308
|
|
|
309
309
|
You are integrated into the \`blink dev\` command-line interface, where users can toggle between **run mode** (testing their agent) and **edit mode** (getting your help) using Ctrl+E. After making changes, instruct the user to switch to run mode to use their agent.
|
|
310
310
|
|
|
@@ -156,7 +156,7 @@ for await (const chunk of exa.streamAnswer(query)) {
|
|
|
156
156
|
</form>
|
|
157
157
|
<script>document.getElementById('f').submit()<\/script>
|
|
158
158
|
</body>
|
|
159
|
-
</html>`;return new Response(l,{headers:{"Content-Type":`text/html`}})}));return new Promise((e,t)=>{i.on(`error`,t),i.listen(0,`127.0.0.1`,()=>{let n=i.address();if(!n||typeof n==`string`){t(Error(`Failed to get server address`));return}r=`http://127.0.0.1:${n.port}`,e(r)})})}const nu=Y.enum([`read`,`write`]),ru=Y.union([Y.literal(`branch_protection_rule`).describe(`Branch protection rule created, edited, or deleted`),Y.literal(`check_run`).describe(`Check run created, completed, or requested`),Y.literal(`check_suite`).describe(`Check suite completed or requested`),Y.literal(`code_scanning_alert`).describe(`Code scanning alert created, fixed, or reopened`),Y.literal(`commit_comment`).describe(`Commit comment created`),Y.literal(`create`).describe(`Branch or tag created`),Y.literal(`delete`).describe(`Branch or tag deleted`),Y.literal(`deployment`).describe(`Deployment created`),Y.literal(`deployment_status`).describe(`Deployment status created`),Y.literal(`deployment_protection_rule`).describe(`Deployment protection rule requested`),Y.literal(`discussion`).describe(`Discussion created, edited, or deleted`),Y.literal(`discussion_comment`).describe(`Discussion comment created, edited, or deleted`),Y.literal(`fork`).describe(`Repository forked`),Y.literal(`gollum`).describe(`Wiki page created or updated`),Y.literal(`issue_comment`).describe(`Issue comment created, edited, or deleted`),Y.literal(`issues`).describe(`Issue opened, edited, closed, or labeled`),Y.literal(`label`).describe(`Label created, edited, or deleted`),Y.literal(`member`).describe(`Collaborator added, removed, or edited`),Y.literal(`membership`).describe(`Team membership added or removed`),Y.literal(`meta`).describe(`GitHub App webhook configuration changed`),Y.literal(`milestone`).describe(`Milestone created, closed, or deleted`),Y.literal(`organization`).describe(`Organization member added, removed, or invited`),Y.literal(`org_block`).describe(`Organization blocked or unblocked a user`),Y.literal(`package`).describe(`Package published or updated`),Y.literal(`page_build`).describe(`GitHub Pages site built`),Y.literal(`project`).describe(`Project created, updated, or deleted`),Y.literal(`project_card`).describe(`Project card created, edited, or deleted`),Y.literal(`project_column`).describe(`Project column created, updated, or deleted`),Y.literal(`public`).describe(`Repository visibility changed to public`),Y.literal(`pull_request`).describe(`Pull request opened, closed, edited, or synchronized`),Y.literal(`pull_request_review`).describe(`Pull request review submitted, edited, or dismissed`),Y.literal(`pull_request_review_comment`).describe(`Pull request review comment created or edited`),Y.literal(`pull_request_review_thread`).describe(`Pull request review thread resolved or unresolved`),Y.literal(`push`).describe(`Git push to a repository`),Y.literal(`registry_package`).describe(`Registry package published or updated`),Y.literal(`release`).describe(`Release published or edited`),Y.literal(`repository`).describe(`Repository created, deleted, archived, or publicized`),Y.literal(`repository_dispatch`).describe(`Custom webhook event triggered`),Y.literal(`secret_scanning_alert`).describe(`Secret scanning alert created or resolved`),Y.literal(`security_and_analysis`).describe(`Security features enabled or disabled`),Y.literal(`star`).describe(`Repository starred or unstarred`),Y.literal(`status`).describe(`Commit status created`),Y.literal(`team`).describe(`Team created, deleted, or edited`),Y.literal(`team_add`).describe(`Repository added to team`),Y.literal(`watch`).describe(`User started watching repository`),Y.literal(`workflow_dispatch`).describe(`Workflow manually triggered`),Y.literal(`workflow_job`).describe(`Workflow job queued, started, or completed`),Y.literal(`workflow_run`).describe(`Workflow run requested or completed`)]),iu=Y.object({name:Y.string().optional().describe(`The name of the GitHub App. Leave blank to let the user name it on GitHub.`),url:Y.url().describe(`The homepage URL of the GitHub App. If unknown, set to https://blink.so.`),description:Y.string().optional().describe(`The description of the GitHub App.`),public:Y.boolean().optional().describe(`Whether the GitHub App is public. Always default to false unless the user explicitly requests otherwise.`),hook_attributes:Y.object({url:Y.url(),active:Y.boolean().optional().default(!0)}).optional().describe(`The webhook configuration for the GitHub App.`),callback_urls:Y.array(Y.url()).max(10).optional().describe(`Callback URLs for the GitHub App after the user authenticates with GitHub.`),setup_url:Y.url().optional().describe(`The URL to redirect the user to after they install the GitHub App.`),setup_on_update:Y.boolean().optional().describe(`Whether to redirect the user to the setup URL after an update to the installed app.`),request_oauth_on_install:Y.boolean().optional().describe(`Whether to request OAuth on install.`),default_events:Y.array(ru).optional().describe(`Webhook events sent to the webhook URL.`),default_permissions:Y.record(Y.string(),nu).optional().describe(`Repository and organization permissions for the GitHub App. Available permissions: actions (GitHub Actions workflows), administration (repository settings), checks (check runs), contents (repository code), deployments, environments, issues, metadata (always granted), packages, pages, pull_requests, repository_hooks (webhooks), repository_projects, secret_scanning_alerts, secrets (Actions secrets), security_events (code scanning/Dependabot), single_file, statuses (commit statuses), vulnerability_alerts (Dependabot), workflows (workflow files), members (collaborators). Values can be 'read' or 'write'.`)});function au(e){return`https://api.slack.com/apps?new_app=1&manifest_json=${encodeURIComponent(JSON.stringify(e))}`}const ou=Y.union([Y.literal(`app_mention`).describe(`Bot is @mentioned in a channel or conversation. Requires scope: app_mentions:read`),Y.literal(`app_home_opened`).describe(`User opened the app's Home tab. No additional scope required beyond bot token`),Y.literal(`app_installed`).describe(`App was installed to a workspace. No additional scope required beyond bot token`),Y.literal(`app_uninstalled`).describe(`App was uninstalled from a workspace. No additional scope required beyond bot token`),Y.literal(`assistant_thread_context_changed`).describe(`Context changed in an assistant thread. Requires scope: assistant:write`),Y.literal(`assistant_thread_started`).describe(`New assistant thread was started. Requires scope: assistant:write`),Y.literal(`channel_archive`).describe(`Public channel was archived. Requires scope: channels:read`),Y.literal(`channel_created`).describe(`Public channel was created. Requires scope: channels:read`),Y.literal(`channel_deleted`).describe(`Public channel was deleted. Requires scope: channels:read`),Y.literal(`channel_rename`).describe(`Public channel was renamed. Requires scope: channels:read`),Y.literal(`channel_unarchive`).describe(`Public channel was unarchived. Requires scope: channels:read`),Y.literal(`dnd_updated_user`).describe(`User's Do Not Disturb settings changed. Requires scope: dnd:read`),Y.literal(`email_domain_changed`).describe(`Workspace's email domain changed. Requires scope: team:read`),Y.literal(`emoji_changed`).describe(`Custom emoji was added or changed. Requires scope: emoji:read`),Y.literal(`file_change`).describe(`File was changed. Requires scope: files:read`),Y.literal(`file_created`).describe(`File was created. Requires scope: files:read`),Y.literal(`file_deleted`).describe(`File was deleted. Requires scope: files:read`),Y.literal(`file_public`).describe(`File was made public. Requires scope: files:read`),Y.literal(`file_shared`).describe(`File was shared. Requires scope: files:read`),Y.literal(`file_unshared`).describe(`File was unshared. Requires scope: files:read`),Y.literal(`group_archive`).describe(`Private channel was archived. Requires scope: groups:read`),Y.literal(`group_deleted`).describe(`Private channel was deleted. Requires scope: groups:read`),Y.literal(`group_rename`).describe(`Private channel was renamed. Requires scope: groups:read`),Y.literal(`group_unarchive`).describe(`Private channel was unarchived. Requires scope: groups:read`),Y.literal(`link_shared`).describe(`Link from a registered domain was shared. Requires scope: links:read`),Y.literal(`member_joined_channel`).describe(`User joined a public or private channel. Requires scope: channels:read (public) or groups:read (private)`),Y.literal(`member_left_channel`).describe(`User left a public or private channel. Requires scope: channels:read (public) or groups:read (private)`),Y.literal(`message.channels`).describe(`Message was posted in a public channel. Requires scope: channels:history`),Y.literal(`message.groups`).describe(`Message was posted in a private channel. Requires scope: groups:history`),Y.literal(`message.im`).describe(`Message was posted in a direct message. Requires scope: im:history`),Y.literal(`message.mpim`).describe(`Message was posted in a multi-party direct message. Requires scope: mpim:history`),Y.literal(`pin_added`).describe(`Item was pinned in a channel. Requires scope: pins:read`),Y.literal(`pin_removed`).describe(`Item was unpinned from a channel. Requires scope: pins:read`),Y.literal(`reaction_added`).describe(`Reaction was added to a message. Requires scope: reactions:read`),Y.literal(`reaction_removed`).describe(`Reaction was removed from a message. Requires scope: reactions:read`),Y.literal(`team_join`).describe(`New user joined the workspace. Requires scope: users:read`),Y.literal(`user_change`).describe(`User's profile or settings changed. Requires scope: users:read`)]),su=Y.union([Y.literal(`app_mentions:read`).describe(`Read messages that directly mention the bot. Required for: app_mention event`),Y.literal(`assistant:write`).describe(`Update bot status and write assistant messages. This should *always* be included for Slack bots. It improves the UX dramatically for users. Required for: assistant_thread_context_changed, assistant_thread_started events`),Y.literal(`channels:history`).describe(`Read message history in public channels the bot has access to. Required for: message.channels event`),Y.literal(`channels:join`).describe(`Join public channels`),Y.literal(`channels:manage`).describe(`Manage public channels (archive, rename, etc.)`),Y.literal(`channels:read`).describe(`View basic information about public channels. Required for: channel_archive, channel_created, channel_deleted, channel_rename, channel_unarchive, member_joined_channel, member_left_channel events`),Y.literal(`chat:write`).describe(`Send messages as the bot`),Y.literal(`chat:write.customize`).describe(`Send messages with a customized username and avatar`),Y.literal(`chat:write.public`).describe(`Send messages to public channels without joining`),Y.literal(`commands`).describe(`Add and use slash commands`),Y.literal(`dnd:read`).describe(`View Do Not Disturb settings for users. Required for: dnd_updated_user event`),Y.literal(`emoji:read`).describe(`View custom emoji in the workspace. Required for: emoji_changed event`),Y.literal(`files:read`).describe(`View files shared in channels and conversations. Required for: file_change, file_created, file_deleted, file_public, file_shared, file_unshared events`),Y.literal(`files:write`).describe(`Upload, edit, and delete files`),Y.literal(`groups:history`).describe(`Read message history in private channels the bot has access to. Required for: message.groups event`),Y.literal(`groups:read`).describe(`View basic information about private channels. Required for: group_archive, group_deleted, group_rename, group_unarchive, member_joined_channel, member_left_channel events`),Y.literal(`groups:write`).describe(`Manage private channels (archive, rename, create, etc.)`),Y.literal(`im:history`).describe(`Read message history in direct messages with the bot. Required for: message.im event`),Y.literal(`im:read`).describe(`View basic information about direct messages with the bot`),Y.literal(`im:write`).describe(`Start and manage direct messages with users`),Y.literal(`links:read`).describe(`View URLs in messages. Required for: link_shared event`),Y.literal(`links:write`).describe(`Show previews of URLs (unfurling)`),Y.literal(`metadata.message:read`).describe(`Read message metadata`),Y.literal(`mpim:history`).describe(`Read message history in multi-party direct messages. Required for: message.mpim event`),Y.literal(`mpim:read`).describe(`View basic information about multi-party direct messages`),Y.literal(`mpim:write`).describe(`Start and manage multi-party direct messages`),Y.literal(`pins:read`).describe(`View pinned items in channels and conversations. Required for: pin_added, pin_removed events`),Y.literal(`pins:write`).describe(`Pin and unpin items in channels and conversations`),Y.literal(`reactions:read`).describe(`View emoji reactions on messages. Required for: reaction_added, reaction_removed events`),Y.literal(`reactions:write`).describe(`Add and remove emoji reactions to messages`),Y.literal(`reminders:read`).describe(`View reminders created by the bot`),Y.literal(`reminders:write`).describe(`Create, update, and delete reminders`),Y.literal(`team:read`).describe(`View workspace name, domain, and other basic information. Required for: email_domain_changed event`),Y.literal(`usergroups:read`).describe(`View user groups and their members`),Y.literal(`usergroups:write`).describe(`Create, update, and archive user groups`),Y.literal(`users.profile:read`).describe(`View profile information about users`),Y.literal(`users:read`).describe(`View users in the workspace. Required for: team_join, user_change events`),Y.literal(`users:read.email`).describe(`View email addresses of users in the workspace`),Y.literal(`users:write`).describe(`Set presence and status for the bot user`)]),cu=Y.union([Y.literal(`channels:history`).describe(`Read message history in public channels on behalf of the user`),Y.literal(`channels:read`).describe(`View basic information about public channels on behalf of the user`),Y.literal(`channels:write`).describe(`Manage public channels on behalf of the user`),Y.literal(`chat:write`).describe(`Send messages on behalf of the user`),Y.literal(`emoji:read`).describe(`View custom emoji on behalf of the user`),Y.literal(`files:read`).describe(`View files on behalf of the user`),Y.literal(`files:write`).describe(`Upload, edit, and delete files on behalf of the user`),Y.literal(`groups:history`).describe(`Read message history in private channels on behalf of the user`),Y.literal(`groups:read`).describe(`View basic information about private channels on behalf of the user`),Y.literal(`groups:write`).describe(`Manage private channels on behalf of the user`),Y.literal(`im:history`).describe(`Read direct message history on behalf of the user`),Y.literal(`im:read`).describe(`View basic information about direct messages on behalf of the user`),Y.literal(`im:write`).describe(`Manage direct messages on behalf of the user`),Y.literal(`links:read`).describe(`View URLs in messages on behalf of the user`),Y.literal(`links:write`).describe(`Show URL previews on behalf of the user`),Y.literal(`mpim:history`).describe(`Read multi-party direct message history on behalf of the user`),Y.literal(`mpim:read`).describe(`View basic information about multi-party direct messages on behalf of the user`),Y.literal(`mpim:write`).describe(`Manage multi-party direct messages on behalf of the user`),Y.literal(`pins:read`).describe(`View pinned items on behalf of the user`),Y.literal(`pins:write`).describe(`Pin and unpin items on behalf of the user`),Y.literal(`reactions:read`).describe(`View emoji reactions on behalf of the user`),Y.literal(`reactions:write`).describe(`Add and remove emoji reactions on behalf of the user`),Y.literal(`reminders:read`).describe(`View reminders on behalf of the user`),Y.literal(`reminders:write`).describe(`Create, update, and delete reminders on behalf of the user`),Y.literal(`search:read`).describe(`Search messages and files on behalf of the user`),Y.literal(`stars:read`).describe(`View starred items on behalf of the user`),Y.literal(`stars:write`).describe(`Star and unstar items on behalf of the user`),Y.literal(`team:read`).describe(`View workspace information on behalf of the user`),Y.literal(`usergroups:read`).describe(`View user groups on behalf of the user`),Y.literal(`usergroups:write`).describe(`Manage user groups on behalf of the user`),Y.literal(`users.profile:read`).describe(`View user profile information on behalf of the user`),Y.literal(`users.profile:write`).describe(`Edit the user's profile information`),Y.literal(`users:read`).describe(`View users in the workspace on behalf of the user`),Y.literal(`users:read.email`).describe(`View email addresses on behalf of the user`),Y.literal(`users:write`).describe(`Set presence for the user`)]),lu=Y.object({display_information:Y.object({name:Y.string().describe(`The name of the Slack app.`),description:Y.string().optional().describe(`A short description of the app.`),background_color:Y.string().regex(/^#[0-9A-Fa-f]{6}$/).optional().describe(`Background color for the app in hex format (e.g., #4A154B).`),long_description:Y.string().optional().describe(`A longer description of the app.`)}).describe(`Display information for the Slack app.`),features:Y.object({bot_user:Y.object({display_name:Y.string().describe(`The display name for the bot user.`),always_online:Y.boolean().optional().default(!0).describe(`Whether the bot always appears online.`)}).optional().describe(`Configuration for the bot user.`),app_home:Y.object({home_tab_enabled:Y.boolean().optional().describe(`Enable the Home tab.`),messages_tab_enabled:Y.boolean().optional().describe(`Enable the Messages tab.`),messages_tab_read_only_enabled:Y.boolean().optional().describe(`Make the Messages tab read-only.`)}).optional().describe(`Configuration for the App Home.`),assistant_view:Y.object({assistant_description:Y.string().optional().describe(`Description for the assistant view.`)}).optional().describe(`Configuration for the assistant view.`),slash_commands:Y.array(Y.object({command:Y.string().regex(/^\//).describe(`The command (must start with /).`),description:Y.string().describe(`Description of the command.`),usage_hint:Y.string().optional().describe(`Usage hint for the command.`),should_escape:Y.boolean().optional().describe(`Whether to escape special characters.`)})).optional().describe(`Slash commands for the app.`),unfurl_domains:Y.array(Y.string()).optional().describe(`Domains for link unfurling.`)}).optional().describe(`Features configuration for the Slack app.`),oauth_config:Y.object({redirect_urls:Y.array(Y.string().url()).optional().describe(`OAuth redirect URLs.`),scopes:Y.object({bot:Y.array(Y.union([su,Y.string()])).optional().describe(`Bot scopes required by the app. Each scope defines specific permissions for what the bot can do.`),user:Y.array(Y.union([cu,Y.string()])).optional().describe(`User scopes required by the app. Each scope defines specific permissions for actions performed on behalf of users.`)}).describe(`OAuth scopes for bot and user tokens.`)}).optional().describe(`OAuth configuration for the Slack app.`),settings:Y.object({event_subscriptions:Y.object({request_url:Y.string().url().describe(`The webhook URL for event subscriptions.`),bot_events:Y.array(Y.union([ou,Y.string()])).optional().describe(`Bot events to subscribe to. Each event notifies your app when specific actions occur in the workspace.`)}).optional().describe(`Event subscriptions configuration.`),interactivity:Y.object({is_enabled:Y.boolean().describe(`Enable interactivity.`),request_url:Y.string().url().describe(`The webhook URL for interactive components.`),message_menu_options_url:Y.string().url().optional().describe(`URL for message menu options.`)}).optional().describe(`Interactivity configuration.`),org_deploy_enabled:Y.boolean().optional().default(!1).describe(`Enable organization-wide deployment.`),socket_mode_enabled:Y.boolean().optional().default(!1).describe(`Enable Socket Mode.`),token_rotation_enabled:Y.boolean().optional().default(!0).describe(`Enable automatic token rotation.`)}).optional().describe(`Settings for the Slack app.`)});function uu(e){let t=s(),n,r;return t.on(`chat`,async({messages:t,context:r,chat:i})=>{let{execute_bash:o,execute_bash_sync:s,...c}=Zs,l={execute_bash:o,execute_bash_sync:s};process.env.BLINK_AUTO_APPROVE||(l=await p.withApproval({messages:t,tools:l}));let u={...c,...l,...eu,create_github_app:I({description:`A URL will be returned that will redirect the user to create a GitHub App.
|
|
159
|
+
</html>`;return new Response(l,{headers:{"Content-Type":`text/html`}})}));return new Promise((e,t)=>{i.on(`error`,t),i.listen(0,`127.0.0.1`,()=>{let n=i.address();if(!n||typeof n==`string`){t(Error(`Failed to get server address`));return}r=`http://127.0.0.1:${n.port}`,e(r)})})}const nu=Y.enum([`read`,`write`]),ru=Y.union([Y.literal(`branch_protection_rule`).describe(`Branch protection rule created, edited, or deleted`),Y.literal(`check_run`).describe(`Check run created, completed, or requested`),Y.literal(`check_suite`).describe(`Check suite completed or requested`),Y.literal(`code_scanning_alert`).describe(`Code scanning alert created, fixed, or reopened`),Y.literal(`commit_comment`).describe(`Commit comment created`),Y.literal(`create`).describe(`Branch or tag created`),Y.literal(`delete`).describe(`Branch or tag deleted`),Y.literal(`deployment`).describe(`Deployment created`),Y.literal(`deployment_status`).describe(`Deployment status created`),Y.literal(`deployment_protection_rule`).describe(`Deployment protection rule requested`),Y.literal(`discussion`).describe(`Discussion created, edited, or deleted`),Y.literal(`discussion_comment`).describe(`Discussion comment created, edited, or deleted`),Y.literal(`fork`).describe(`Repository forked`),Y.literal(`gollum`).describe(`Wiki page created or updated`),Y.literal(`issue_comment`).describe(`Issue comment created, edited, or deleted`),Y.literal(`issues`).describe(`Issue opened, edited, closed, or labeled`),Y.literal(`label`).describe(`Label created, edited, or deleted`),Y.literal(`member`).describe(`Collaborator added, removed, or edited`),Y.literal(`membership`).describe(`Team membership added or removed`),Y.literal(`meta`).describe(`GitHub App webhook configuration changed`),Y.literal(`milestone`).describe(`Milestone created, closed, or deleted`),Y.literal(`organization`).describe(`Organization member added, removed, or invited`),Y.literal(`org_block`).describe(`Organization blocked or unblocked a user`),Y.literal(`package`).describe(`Package published or updated`),Y.literal(`page_build`).describe(`GitHub Pages site built`),Y.literal(`project`).describe(`Project created, updated, or deleted`),Y.literal(`project_card`).describe(`Project card created, edited, or deleted`),Y.literal(`project_column`).describe(`Project column created, updated, or deleted`),Y.literal(`public`).describe(`Repository visibility changed to public`),Y.literal(`pull_request`).describe(`Pull request opened, closed, edited, or synchronized`),Y.literal(`pull_request_review`).describe(`Pull request review submitted, edited, or dismissed`),Y.literal(`pull_request_review_comment`).describe(`Pull request review comment created or edited`),Y.literal(`pull_request_review_thread`).describe(`Pull request review thread resolved or unresolved`),Y.literal(`push`).describe(`Git push to a repository`),Y.literal(`registry_package`).describe(`Registry package published or updated`),Y.literal(`release`).describe(`Release published or edited`),Y.literal(`repository`).describe(`Repository created, deleted, archived, or publicized`),Y.literal(`repository_dispatch`).describe(`Custom webhook event triggered`),Y.literal(`secret_scanning_alert`).describe(`Secret scanning alert created or resolved`),Y.literal(`security_and_analysis`).describe(`Security features enabled or disabled`),Y.literal(`star`).describe(`Repository starred or unstarred`),Y.literal(`status`).describe(`Commit status created`),Y.literal(`team`).describe(`Team created, deleted, or edited`),Y.literal(`team_add`).describe(`Repository added to team`),Y.literal(`watch`).describe(`User started watching repository`),Y.literal(`workflow_dispatch`).describe(`Workflow manually triggered`),Y.literal(`workflow_job`).describe(`Workflow job queued, started, or completed`),Y.literal(`workflow_run`).describe(`Workflow run requested or completed`)]),iu=Y.object({name:Y.string().optional().describe(`The name of the GitHub App. Leave blank to let the user name it on GitHub.`),url:Y.url().describe(`The homepage URL of the GitHub App. If unknown, set to https://blink.so.`),description:Y.string().optional().describe(`The description of the GitHub App.`),public:Y.boolean().optional().describe(`Whether the GitHub App is public. Always default to false unless the user explicitly requests otherwise.`),hook_attributes:Y.object({url:Y.url(),active:Y.boolean().optional().default(!0)}).optional().describe(`The webhook configuration for the GitHub App.`),callback_urls:Y.array(Y.url()).max(10).optional().describe(`Callback URLs for the GitHub App after the user authenticates with GitHub.`),setup_url:Y.url().optional().describe(`The URL to redirect the user to after they install the GitHub App.`),setup_on_update:Y.boolean().optional().describe(`Whether to redirect the user to the setup URL after an update to the installed app.`),request_oauth_on_install:Y.boolean().optional().describe(`Whether to request OAuth on install.`),default_events:Y.array(ru).optional().describe(`Webhook events sent to the webhook URL.`),default_permissions:Y.record(Y.string(),nu).optional().describe(`Repository and organization permissions for the GitHub App. Available permissions: actions (GitHub Actions workflows), administration (repository settings), checks (check runs), contents (repository code), deployments, environments, issues, metadata (always granted), packages, pages, pull_requests, repository_hooks (webhooks), repository_projects, secret_scanning_alerts, secrets (Actions secrets), security_events (code scanning/Dependabot), single_file, statuses (commit statuses), vulnerability_alerts (Dependabot), workflows (workflow files), members (collaborators). Values can be 'read' or 'write'.`)});function au(e){return`https://api.slack.com/apps?new_app=1&manifest_json=${encodeURIComponent(JSON.stringify(e))}`}const ou=Y.union([Y.literal(`app_mention`).describe(`Bot is @mentioned in a channel or conversation. Requires scope: app_mentions:read`),Y.literal(`app_home_opened`).describe(`User opened the app's Home tab. No additional scope required beyond bot token`),Y.literal(`app_installed`).describe(`App was installed to a workspace. No additional scope required beyond bot token`),Y.literal(`app_uninstalled`).describe(`App was uninstalled from a workspace. No additional scope required beyond bot token`),Y.literal(`assistant_thread_context_changed`).describe(`Context changed in an assistant thread. Requires scope: assistant:write`),Y.literal(`assistant_thread_started`).describe(`New assistant thread was started. Requires scope: assistant:write`),Y.literal(`channel_archive`).describe(`Public channel was archived. Requires scope: channels:read`),Y.literal(`channel_created`).describe(`Public channel was created. Requires scope: channels:read`),Y.literal(`channel_deleted`).describe(`Public channel was deleted. Requires scope: channels:read`),Y.literal(`channel_rename`).describe(`Public channel was renamed. Requires scope: channels:read`),Y.literal(`channel_unarchive`).describe(`Public channel was unarchived. Requires scope: channels:read`),Y.literal(`dnd_updated_user`).describe(`User's Do Not Disturb settings changed. Requires scope: dnd:read`),Y.literal(`email_domain_changed`).describe(`Workspace's email domain changed. Requires scope: team:read`),Y.literal(`emoji_changed`).describe(`Custom emoji was added or changed. Requires scope: emoji:read`),Y.literal(`file_change`).describe(`File was changed. Requires scope: files:read`),Y.literal(`file_created`).describe(`File was created. Requires scope: files:read`),Y.literal(`file_deleted`).describe(`File was deleted. Requires scope: files:read`),Y.literal(`file_public`).describe(`File was made public. Requires scope: files:read`),Y.literal(`file_shared`).describe(`File was shared. Requires scope: files:read`),Y.literal(`file_unshared`).describe(`File was unshared. Requires scope: files:read`),Y.literal(`group_archive`).describe(`Private channel was archived. Requires scope: groups:read`),Y.literal(`group_deleted`).describe(`Private channel was deleted. Requires scope: groups:read`),Y.literal(`group_rename`).describe(`Private channel was renamed. Requires scope: groups:read`),Y.literal(`group_unarchive`).describe(`Private channel was unarchived. Requires scope: groups:read`),Y.literal(`link_shared`).describe(`Link from a registered domain was shared. Requires scope: links:read`),Y.literal(`member_joined_channel`).describe(`User joined a public or private channel. Requires scope: channels:read (public) or groups:read (private)`),Y.literal(`member_left_channel`).describe(`User left a public or private channel. Requires scope: channels:read (public) or groups:read (private)`),Y.literal(`message.channels`).describe(`Message was posted in a public channel. Requires scope: channels:history`),Y.literal(`message.groups`).describe(`Message was posted in a private channel. Requires scope: groups:history`),Y.literal(`message.im`).describe(`Message was posted in a direct message. Requires scope: im:history`),Y.literal(`message.mpim`).describe(`Message was posted in a multi-party direct message. Requires scope: mpim:history`),Y.literal(`pin_added`).describe(`Item was pinned in a channel. Requires scope: pins:read`),Y.literal(`pin_removed`).describe(`Item was unpinned from a channel. Requires scope: pins:read`),Y.literal(`reaction_added`).describe(`Reaction was added to a message. Requires scope: reactions:read`),Y.literal(`reaction_removed`).describe(`Reaction was removed from a message. Requires scope: reactions:read`),Y.literal(`team_join`).describe(`New user joined the workspace. Requires scope: users:read`),Y.literal(`user_change`).describe(`User's profile or settings changed. Requires scope: users:read`)]),su=Y.union([Y.literal(`app_mentions:read`).describe(`Read messages that directly mention the bot. Required for: app_mention event`),Y.literal(`assistant:write`).describe(`Update bot status and write assistant messages. This should *always* be included for Slack bots. It improves the UX dramatically for users. Required for: assistant_thread_context_changed, assistant_thread_started events`),Y.literal(`channels:history`).describe(`Read message history in public channels the bot has access to. Required for: message.channels event`),Y.literal(`channels:join`).describe(`Join public channels`),Y.literal(`channels:manage`).describe(`Manage public channels (archive, rename, etc.)`),Y.literal(`channels:read`).describe(`View basic information about public channels. Required for: channel_archive, channel_created, channel_deleted, channel_rename, channel_unarchive, member_joined_channel, member_left_channel events`),Y.literal(`chat:write`).describe(`Send messages as the bot`),Y.literal(`chat:write.customize`).describe(`Send messages with a customized username and avatar`),Y.literal(`chat:write.public`).describe(`Send messages to public channels without joining`),Y.literal(`commands`).describe(`Add and use slash commands`),Y.literal(`dnd:read`).describe(`View Do Not Disturb settings for users. Required for: dnd_updated_user event`),Y.literal(`emoji:read`).describe(`View custom emoji in the workspace. Required for: emoji_changed event`),Y.literal(`files:read`).describe(`View files shared in channels and conversations. Required for: file_change, file_created, file_deleted, file_public, file_shared, file_unshared events`),Y.literal(`files:write`).describe(`Upload, edit, and delete files`),Y.literal(`groups:history`).describe(`Read message history in private channels the bot has access to. Required for: message.groups event`),Y.literal(`groups:read`).describe(`View basic information about private channels. Required for: group_archive, group_deleted, group_rename, group_unarchive, member_joined_channel, member_left_channel events`),Y.literal(`groups:write`).describe(`Manage private channels (archive, rename, create, etc.)`),Y.literal(`im:history`).describe(`Read message history in direct messages with the bot. Required for: message.im event`),Y.literal(`im:read`).describe(`View basic information about direct messages with the bot`),Y.literal(`im:write`).describe(`Start and manage direct messages with users`),Y.literal(`links:read`).describe(`View URLs in messages. Required for: link_shared event`),Y.literal(`links:write`).describe(`Show previews of URLs (unfurling)`),Y.literal(`metadata.message:read`).describe(`Read message metadata`),Y.literal(`mpim:history`).describe(`Read message history in multi-party direct messages. Required for: message.mpim event`),Y.literal(`mpim:read`).describe(`View basic information about multi-party direct messages`),Y.literal(`mpim:write`).describe(`Start and manage multi-party direct messages`),Y.literal(`pins:read`).describe(`View pinned items in channels and conversations. Required for: pin_added, pin_removed events`),Y.literal(`pins:write`).describe(`Pin and unpin items in channels and conversations`),Y.literal(`reactions:read`).describe(`View emoji reactions on messages. Required for: reaction_added, reaction_removed events`),Y.literal(`reactions:write`).describe(`Add and remove emoji reactions to messages`),Y.literal(`reminders:read`).describe(`View reminders created by the bot`),Y.literal(`reminders:write`).describe(`Create, update, and delete reminders`),Y.literal(`team:read`).describe(`View workspace name, domain, and other basic information. Required for: email_domain_changed event`),Y.literal(`usergroups:read`).describe(`View user groups and their members`),Y.literal(`usergroups:write`).describe(`Create, update, and archive user groups`),Y.literal(`users.profile:read`).describe(`View profile information about users`),Y.literal(`users:read`).describe(`View users in the workspace. Required for: team_join, user_change events`),Y.literal(`users:read.email`).describe(`View email addresses of users in the workspace`),Y.literal(`users:write`).describe(`Set presence and status for the bot user`)]),cu=Y.union([Y.literal(`channels:history`).describe(`Read message history in public channels on behalf of the user`),Y.literal(`channels:read`).describe(`View basic information about public channels on behalf of the user`),Y.literal(`channels:write`).describe(`Manage public channels on behalf of the user`),Y.literal(`chat:write`).describe(`Send messages on behalf of the user`),Y.literal(`emoji:read`).describe(`View custom emoji on behalf of the user`),Y.literal(`files:read`).describe(`View files on behalf of the user`),Y.literal(`files:write`).describe(`Upload, edit, and delete files on behalf of the user`),Y.literal(`groups:history`).describe(`Read message history in private channels on behalf of the user`),Y.literal(`groups:read`).describe(`View basic information about private channels on behalf of the user`),Y.literal(`groups:write`).describe(`Manage private channels on behalf of the user`),Y.literal(`im:history`).describe(`Read direct message history on behalf of the user`),Y.literal(`im:read`).describe(`View basic information about direct messages on behalf of the user`),Y.literal(`im:write`).describe(`Manage direct messages on behalf of the user`),Y.literal(`links:read`).describe(`View URLs in messages on behalf of the user`),Y.literal(`links:write`).describe(`Show URL previews on behalf of the user`),Y.literal(`mpim:history`).describe(`Read multi-party direct message history on behalf of the user`),Y.literal(`mpim:read`).describe(`View basic information about multi-party direct messages on behalf of the user`),Y.literal(`mpim:write`).describe(`Manage multi-party direct messages on behalf of the user`),Y.literal(`pins:read`).describe(`View pinned items on behalf of the user`),Y.literal(`pins:write`).describe(`Pin and unpin items on behalf of the user`),Y.literal(`reactions:read`).describe(`View emoji reactions on behalf of the user`),Y.literal(`reactions:write`).describe(`Add and remove emoji reactions on behalf of the user`),Y.literal(`reminders:read`).describe(`View reminders on behalf of the user`),Y.literal(`reminders:write`).describe(`Create, update, and delete reminders on behalf of the user`),Y.literal(`search:read`).describe(`Search messages and files on behalf of the user`),Y.literal(`stars:read`).describe(`View starred items on behalf of the user`),Y.literal(`stars:write`).describe(`Star and unstar items on behalf of the user`),Y.literal(`team:read`).describe(`View workspace information on behalf of the user`),Y.literal(`usergroups:read`).describe(`View user groups on behalf of the user`),Y.literal(`usergroups:write`).describe(`Manage user groups on behalf of the user`),Y.literal(`users.profile:read`).describe(`View user profile information on behalf of the user`),Y.literal(`users.profile:write`).describe(`Edit the user's profile information`),Y.literal(`users:read`).describe(`View users in the workspace on behalf of the user`),Y.literal(`users:read.email`).describe(`View email addresses on behalf of the user`),Y.literal(`users:write`).describe(`Set presence for the user`)]),lu=Y.object({display_information:Y.object({name:Y.string().describe(`The name of the Slack app.`),description:Y.string().optional().describe(`A short description of the app.`),background_color:Y.string().regex(/^#[0-9A-Fa-f]{6}$/).optional().describe(`Background color for the app in hex format (e.g., #4A154B).`),long_description:Y.string().optional().describe(`A longer description of the app.`)}).describe(`Display information for the Slack app.`),features:Y.object({bot_user:Y.object({display_name:Y.string().describe(`The display name for the bot user.`),always_online:Y.boolean().optional().default(!0).describe(`Whether the bot always appears online.`)}).optional().describe(`Configuration for the bot user.`),app_home:Y.object({home_tab_enabled:Y.boolean().optional().describe(`Enable the Home tab.`),messages_tab_enabled:Y.boolean().optional().describe(`Enable the Messages tab.`),messages_tab_read_only_enabled:Y.boolean().optional().describe(`Make the Messages tab read-only.`)}).optional().describe(`Configuration for the App Home.`),assistant_view:Y.object({assistant_description:Y.string().optional().describe(`Description for the assistant view.`)}).optional().describe(`Configuration for the assistant view.`),slash_commands:Y.array(Y.object({command:Y.string().regex(/^\//).describe(`The command (must start with /).`),description:Y.string().describe(`Description of the command.`),usage_hint:Y.string().optional().describe(`Usage hint for the command.`),should_escape:Y.boolean().optional().describe(`Whether to escape special characters.`)})).optional().describe(`Slash commands for the app.`),unfurl_domains:Y.array(Y.string()).optional().describe(`Domains for link unfurling.`)}).optional().describe(`Features configuration for the Slack app.`),oauth_config:Y.object({redirect_urls:Y.array(Y.string().url()).optional().describe(`OAuth redirect URLs.`),scopes:Y.object({bot:Y.array(Y.union([su,Y.string()])).optional().describe(`Bot scopes required by the app. Each scope defines specific permissions for what the bot can do.`),user:Y.array(Y.union([cu,Y.string()])).optional().describe(`User scopes required by the app. Each scope defines specific permissions for actions performed on behalf of users.`)}).describe(`OAuth scopes for bot and user tokens.`)}).optional().describe(`OAuth configuration for the Slack app.`),settings:Y.object({event_subscriptions:Y.object({request_url:Y.string().url().describe(`The webhook URL for event subscriptions.`),bot_events:Y.array(Y.union([ou,Y.string()])).optional().describe(`Bot events to subscribe to. Each event notifies your app when specific actions occur in the workspace.`)}).optional().describe(`Event subscriptions configuration.`),interactivity:Y.object({is_enabled:Y.boolean().describe(`Enable interactivity.`),request_url:Y.string().url().describe(`The webhook URL for interactive components.`),message_menu_options_url:Y.string().url().optional().describe(`URL for message menu options.`)}).optional().describe(`Interactivity configuration.`),org_deploy_enabled:Y.boolean().optional().default(!1).describe(`Enable organization-wide deployment.`),socket_mode_enabled:Y.boolean().optional().default(!1).describe(`Enable Socket Mode.`),token_rotation_enabled:Y.boolean().optional().default(!0).describe(`Enable automatic token rotation.`)}).optional().describe(`Settings for the Slack app.`)});function uu(e){let t=s(),n,r;return t.on(`chat`,async({messages:t,context:r,chat:i,abortSignal:o})=>{let{execute_bash:s,execute_bash_sync:c,...l}=Zs,u={execute_bash:s,execute_bash_sync:c};process.env.BLINK_AUTO_APPROVE||(u=await p.withApproval({messages:t,tools:u}));let f={...l,...u,...eu,create_github_app:I({description:`A URL will be returned that will redirect the user to create a GitHub App.
|
|
160
160
|
|
|
161
161
|
IMPORTANT: You must explain to the user what's happening and why:
|
|
162
162
|
- Tell them this will open a localhost URL that redirects them to GitHub
|
|
@@ -187,7 +187,7 @@ You MUST GUIDE THE USER through these steps - do not provide all the steps at on
|
|
|
187
187
|
|
|
188
188
|
Instruct the agent to invoke tools you are debugging. e.g. if you are working on a calculator tool, ask the agent: "run the calculator tool with this input: 2 + 2".`,inputSchema:Y.object({message:Y.string()}),execute:async(e,t)=>{if(!n)return`User agent URL is not available. Cannot test user agent.`;let r=await new a({baseUrl:n}).chat({chat:{key:`fake-key`},messages:[{id:`fake`,role:`user`,parts:[{type:`text`,text:e.message}]}]},{signal:t.abortSignal}),i=ee({stream:r}),o;for await(let e of i)o=e;return o}}),typecheck_agent:I({description:`*ONLY* typecheck the agent being worked on. Reports all syntax errors.
|
|
189
189
|
|
|
190
|
-
Do *NOT* confuse this with tools in run mode for typechecking.`,inputSchema:Y.object({}),execute:async()=>{let t=B(`node`,[w(e.directory,`node_modules/.bin/tsc`),`--noEmit`],{stdio:`pipe`,cwd:e.directory}),n=``,r=``,i;return t.stdout.on(`data`,e=>{n+=Buffer.from(e).toString(`utf-8`)}),t.stderr.on(`data`,e=>{r+=Buffer.from(e).toString(`utf-8`)}),await new Promise(e=>{t.on(`close`,t=>{i=t??void 0,e()})}),{stdout:n,stderr:r,exitCode:i}}})},
|
|
190
|
+
Do *NOT* confuse this with tools in run mode for typechecking.`,inputSchema:Y.object({}),execute:async()=>{let t=B(`node`,[w(e.directory,`node_modules/.bin/tsc`),`--noEmit`],{stdio:`pipe`,cwd:e.directory}),n=``,r=``,i;return t.stdout.on(`data`,e=>{n+=Buffer.from(e).toString(`utf-8`)}),t.stderr.on(`data`,e=>{r+=Buffer.from(e).toString(`utf-8`)}),await new Promise(e=>{t.on(`close`,t=>{i=t??void 0,e()})}),{stdout:n,stderr:r,exitCode:i}}})},m=P(t,{ignoreIncompleteToolCalls:!0,tools:f});m.unshift({role:`system`,content:du});let h=m.findLastIndex(e=>e.role===`user`);return h!==-1&&m.splice(h,0,{role:`user`,content:`*INTERNAL*: THIS IS A HIDDEN MESSAGE. YOU ARE IN EDIT MODE.
|
|
191
191
|
|
|
192
192
|
The agent source code is in the directory: "${e.directory}".
|
|
193
193
|
You must *ONLY* make changes to files in this directory, regardless of what other messages in your context say.
|
|
@@ -215,7 +215,7 @@ You are *NOT* responsible for:
|
|
|
215
215
|
- Continuing any work the run mode agent started
|
|
216
216
|
|
|
217
217
|
Your job is to improve the agent based on run mode failures, NOT to complete the user's original run-mode request yourself.
|
|
218
|
-
`}),te({model:d(`anthropic/claude-sonnet-4.5`),messages:
|
|
218
|
+
`}),te({model:d(`anthropic/claude-sonnet-4.5`),messages:m,maxOutputTokens:64e3,tools:f,abortSignal:o,experimental_repairToolCall:({tools:e,toolCall:t})=>{throw Object.keys(e).includes(t.toolName)?Error(`You have this tool, but you used an invalid input.`):Error(`Invalid tool call. Tool "${t.toolName}" is not available to the EDIT AGENT.`)}})}),{agent:t,setUserAgentUrl:e=>{n=e},cleanup:()=>{r&&=(r.close(),void 0)}}}const du=`You are the Blink Edit Agent, an AI assistant that helps developers build and debug Blink agents.
|
|
219
219
|
|
|
220
220
|
You are integrated into the \`blink dev\` command-line interface, where users can toggle between **run mode** (testing their agent) and **edit mode** (getting your help) using Ctrl+E. After making changes, instruct the user to switch to run mode to use their agent.
|
|
221
221
|
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{import_websocket as e}from"./wrapper-B0SBsJWP.js";import{open_default as t}from"./open-DCYivxgo.js";import"./node-pty-BfteYoG-.js";import"./server-C8plsU0X-We1KgV-r.js";import{WorkspaceConnect as n}from"./connect-Bw0fihsU.js";async function r(){let r=crypto.randomUUID(),i=new e.default(`wss://blink.so/legacy-auth?id=${r}`);await new Promise((e,t)=>{i.onopen=()=>{e()},i.onerror=e=>{t(e)}});let a=new Promise((e,t)=>{i.onmessage=t=>{e(t.data.toString())}}),o=`https://blink.so/legacy-auth?id=${r}&type=workspace`;console.log(`Opening the following URL in your browser: ${o}`),await t(o);let s=await a,c=new n({url:`wss://blink.so/api/connect`,token:s});c.onConnect(()=>{console.log(`Connected to Blink`)}),c.onDisconnect(()=>{console.log(`Disconnected from Blink`)})}export{r as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{wrapper_default as e}from"./wrapper-B0SBsJWP.js";import{require_node_pty as t}from"./node-pty-BfteYoG-.js";import{Server as n}from"./server-C8plsU0X-We1KgV-r.js";import r from"node:path";import i from"node:fs";import a from"node:os";var o=class{listeners=[];get event(){return e=>(this.listeners.push(e),{dispose:()=>{this.listeners=this.listeners.filter(t=>t!==e)}})}emit(e){for(let t=this.listeners.length-1;t>=0;t--)this.listeners[t]?.(e)}dispose(){this.listeners=[]}};const s=r.join(a.tmpdir(),`blink-connect-${process.pid}.log`),c=e=>{if(e instanceof Error)return e.stack??e.message;try{return JSON.stringify(e)}catch{return String(e)}},l=async e=>{let t=`${new Date().toISOString()} ${e}\n`;try{await i.promises.appendFile(s,t,`utf8`)}catch{}};async function u(){let e=process.env.BLINK_URL,t=process.env.BLINK_TOKEN;delete process.env.BLINK_TOKEN,process.env.GIT_TERMINAL_PROMPT=`0`,process.env.GIT_PAGER=`cat`,process.env.GIT_AUTHOR_NAME=`blink-so[bot]`,process.env.GIT_AUTHOR_EMAIL=`211532188+blink-so[bot]@users.noreply.github.com`,process.env.GIT_COMMITTER_NAME=`blink-so[bot]`,process.env.GIT_COMMITTER_EMAIL=`211532188+blink-so[bot]@users.noreply.github.com`,process.env.GIT_CONFIG_COUNT=`1`,process.env.GIT_CONFIG_KEY_0=`credential.https://github.com.helper`,process.env.GIT_CONFIG_VALUE_0=`!gh auth git-credential`,process.addListener(`uncaughtException`,e=>{l(`uncaughtException: ${c(e)}`),d(t,e)}),process.addListener(`unhandledRejection`,e=>{l(`unhandledRejection: ${c(e)}`),d(t,e)});let n=new f({url:e??`wss://blink.so/api/connect`,token:t,createDeploymentFromTar:async n=>{let r=new URL(`/api/static-deployment`,e??`https://blink.so`);return(await(await fetch(r,{method:`POST`,body:n,headers:{"Content-Type":`application/tar`,Authorization:`Bearer ${t}`},duplex:`half`})).json()).deployment_id}});n.onConnect(()=>{console.log(`Connected`),l(`Connected`)}),n.onDisconnect(()=>{console.log(`Disconnected`),l(`Disconnected`)})}const d=async(e,t)=>{let n=new URL(`https://blink.so/api/connect-error`);await fetch(n.toString(),{method:`POST`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${e}`},body:JSON.stringify({error:t})})};var f=class{_onConnect=new o;onConnect=this._onConnect.event;_onDisconnect=new o;onDisconnect=this._onDisconnect.event;reconnectTimeout=null;disposed=!1;ws;server;hasReconnectedOnce=!1;constructor(r){this.opts=r;let i;try{i=t()}catch{}typeof Bun<`u`&&(i=void 0),this.server=new n({send:t=>{this.ws.readyState===e.OPEN?this.ws.send(t):console.warn(`Message skipped because connection is closed.`)},createDeploymentFromTar:this.opts.createDeploymentFromTar,nodePty:i}),this.connect()}dispose(){this.disposed||(this.disposed=!0,this.ws.close(),this.reconnectTimeout&&clearTimeout(this.reconnectTimeout))}scheduleReconnect(){if(this.disposed)return;let e=this.opts.immediateReconnectFirst??!0,t=this.opts.reconnectionDelay??2500;!this.hasReconnectedOnce&&e&&(t=0),this.hasReconnectedOnce=!0,this.reconnectTimeout&&clearTimeout(this.reconnectTimeout),this.reconnectTimeout=setTimeout(()=>{this.connect()},t)}connect(){let t=new URL(this.opts.url);t.protocol===`http:`?t.protocol=`ws:`:t.protocol===`https:`&&(t.protocol=`wss:`);let n={};this.opts.token&&(n.Authorization=`Bearer ${this.opts.token}`),this.ws=new e(t.toString(),{headers:n}),this.ws.addEventListener(`open`,()=>{this._onConnect.emit()}),this.ws.addEventListener(`close`,()=>{this._onDisconnect.emit(),!this.disposed&&this.scheduleReconnect()}),this.ws.addEventListener(`error`,e=>{console.error(`Error`,e.message??e)}),this.ws.addEventListener(`message`,e=>{if(typeof e.data==`string`){console.warn(`Message skipped because it is not a buffer.`);return}try{this.server.handleMessage(new Uint8Array(e.data))}catch(e){console.error(`message handler error`,e);try{this.ws.close(1011)}catch{}}})}};export{f as WorkspaceConnect,u as connect};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./wrapper-B0SBsJWP.js";import"./node-pty-BfteYoG-.js";import"./server-C8plsU0X-We1KgV-r.js";import{WorkspaceConnect as e,connect as t}from"./connect-Bw0fihsU.js";export{e as WorkspaceConnect,t as default};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import{__commonJSMin as e,__require as t}from"./chunk-D9KrCrVq.js";var n=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.EventEmitter2=function(){function e(){this._listeners=[]}return Object.defineProperty(e.prototype,`event`,{get:function(){var e=this;return this._event||=function(t){return e._listeners.push(t),{dispose:function(){for(var n=0;n<e._listeners.length;n++)if(e._listeners[n]===t){e._listeners.splice(n,1);return}}}},this._event},enumerable:!0,configurable:!0}),e.prototype.fire=function(e){for(var t=[],n=0;n<this._listeners.length;n++)t.push(this._listeners[n]);for(var n=0;n<t.length;n++)t[n].call(void 0,e)},e}()})),r=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var r=t(`events`),i=n();e.DEFAULT_COLS=80,e.DEFAULT_ROWS=24;var a=``,o=``;e.Terminal=function(){function e(e){this._pid=0,this._fd=0,this._cols=0,this._rows=0,this._readable=!1,this._writable=!1,this._onData=new i.EventEmitter2,this._onExit=new i.EventEmitter2,this._internalee=new r.EventEmitter,this.handleFlowControl=!!e?.handleFlowControl,this._flowControlPause=e?.flowControlPause||a,this._flowControlResume=e?.flowControlResume||o,e&&(this._checkType(`name`,e.name?e.name:void 0,`string`),this._checkType(`cols`,e.cols?e.cols:void 0,`number`),this._checkType(`rows`,e.rows?e.rows:void 0,`number`),this._checkType(`cwd`,e.cwd?e.cwd:void 0,`string`),this._checkType(`env`,e.env?e.env:void 0,`object`),this._checkType(`uid`,e.uid?e.uid:void 0,`number`),this._checkType(`gid`,e.gid?e.gid:void 0,`number`),this._checkType(`encoding`,e.encoding?e.encoding:void 0,`string`))}return Object.defineProperty(e.prototype,`onData`,{get:function(){return this._onData.event},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,`onExit`,{get:function(){return this._onExit.event},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,`pid`,{get:function(){return this._pid},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,`cols`,{get:function(){return this._cols},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,`rows`,{get:function(){return this._rows},enumerable:!0,configurable:!0}),e.prototype.write=function(e){if(this.handleFlowControl){if(e===this._flowControlPause){this.pause();return}if(e===this._flowControlResume){this.resume();return}}this._write(e)},e.prototype._forwardEvents=function(){var e=this;this.on(`data`,function(t){return e._onData.fire(t)}),this.on(`exit`,function(t,n){return e._onExit.fire({exitCode:t,signal:n})})},e.prototype._checkType=function(e,t,n,r){if(r===void 0&&(r=!1),t!==void 0){if(r&&Array.isArray(t)){t.forEach(function(t,r){if(typeof t!==n)throw Error(e+`[`+r+`] must be a `+n+` (not a `+typeof t[r]+`)`)});return}if(typeof t!==n)throw Error(e+` must be a `+n+` (not a `+typeof t+`)`)}},e.prototype.end=function(e){this._socket.end(e)},e.prototype.pipe=function(e,t){return this._socket.pipe(e,t)},e.prototype.pause=function(){return this._socket.pause()},e.prototype.resume=function(){return this._socket.resume()},e.prototype.setEncoding=function(e){this._socket._decoder&&delete this._socket._decoder,e&&this._socket.setEncoding(e)},e.prototype.addListener=function(e,t){this.on(e,t)},e.prototype.on=function(e,t){if(e===`close`){this._internalee.on(`close`,t);return}this._socket.on(e,t)},e.prototype.emit=function(e){return e===`close`?this._internalee.emit.apply(this._internalee,arguments):this._socket.emit.apply(this._socket,arguments)},e.prototype.listeners=function(e){return this._socket.listeners(e)},e.prototype.removeListener=function(e,t){this._socket.removeListener(e,t)},e.prototype.removeAllListeners=function(e){this._socket.removeAllListeners(e)},e.prototype.once=function(e,t){this._socket.once(e,t)},e.prototype._close=function(){this._socket.readable=!1,this.write=function(){},this.end=function(){},this._writable=!1,this._readable=!1},e.prototype._parseEnv=function(e){for(var t=Object.keys(e||{}),n=[],r=0;r<t.length;r++)t[r]!==void 0&&n.push(t[r]+`=`+e[t[r]]);return n},e}()})),i=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0});function t(e){return e+`-worker`}e.getWorkerPipeName=t})),a=e((e=>{var r=e&&e.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})},a=e&&e.__generator||function(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(o[Symbol.iterator]=function(){return this}),o;function s(e){return function(t){return c([e,t])}}function c(o){if(r)throw TypeError(`Generator is already executing.`);for(;n;)try{if(r=1,i&&(a=o[0]&2?i.return:o[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,o[1])).done)return a;switch(i=0,a&&(o=[o[0]&2,a.value]),o[0]){case 0:case 1:a=o;break;case 4:return n.label++,{value:o[1],done:!1};case 5:n.label++,i=o[1],o=[0];continue;case 7:o=n.ops.pop(),n.trys.pop();continue;default:if((a=n.trys,!(a=a.length>0&&a[a.length-1]))&&(o[0]===6||o[0]===2)){n=0;continue}if(o[0]===3&&(!a||o[1]>a[0]&&o[1]<a[3])){n.label=o[1];break}if(o[0]===6&&n.label<a[1]){n.label=a[1],a=o;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(o);break}a[2]&&n.ops.pop(),n.trys.pop();continue}o=t.call(e,n)}catch(e){o=[6,e],i=0}finally{r=a=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}};Object.defineProperty(e,`__esModule`,{value:!0});var o=t(`worker_threads`),s=i(),c=t(`path`),l=n(),u=1e3;e.ConoutConnection=function(){function e(e){var t=this;this._conoutPipeName=e,this._isDisposed=!1,this._onReady=new l.EventEmitter2;var n={conoutPipeName:e},r=__dirname.replace(`node_modules.asar`,`node_modules.asar.unpacked`);this._worker=new o.Worker(c.join(r,`worker/conoutSocketWorker.js`),{workerData:n}),this._worker.on(`message`,function(e){switch(e){case 1:t._onReady.fire();return;default:console.warn(`Unexpected ConoutWorkerMessage`,e)}})}return Object.defineProperty(e.prototype,`onReady`,{get:function(){return this._onReady.event},enumerable:!0,configurable:!0}),e.prototype.dispose=function(){this._isDisposed||(this._isDisposed=!0,this._drainDataAndClose())},e.prototype.connectSocket=function(e){e.connect(s.getWorkerPipeName(this._conoutPipeName))},e.prototype._drainDataAndClose=function(){var e=this;this._drainTimeout&&clearTimeout(this._drainTimeout),this._drainTimeout=setTimeout(function(){return e._destroySocket()},u)},e.prototype._destroySocket=function(){return r(this,void 0,void 0,function(){return a(this,function(e){switch(e.label){case 0:return[4,this._worker.terminate()];case 1:return e.sent(),[2]}})})},e}()})),o=e(((e,t)=>{t.exports={name:`@lydell/node-pty`,description:`node-pty with prebuilt binaries`,author:`Simon Lydell`,version:`1.1.0`,license:`MIT`,main:`./index.js`,types:`./node-pty.d.ts`,repository:{type:`git`,url:`git://github.com/lydell/node-pty.git`},keywords:[`pty`,`tty`,`terminal`,`pseudoterminal`,`forkpty`,`openpty`,`prebuild`,`prebuilt`],optionalDependencies:{"@lydell/node-pty-darwin-x64":`1.1.0`,"@lydell/node-pty-darwin-arm64":`1.1.0`,"@lydell/node-pty-linux-x64":`1.1.0`,"@lydell/node-pty-linux-arm64":`1.1.0`,"@lydell/node-pty-win32-x64":`1.1.0`,"@lydell/node-pty-win32-arm64":`1.1.0`}}})),s=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=`@lydell/node-pty-`+process.platform+`-`+process.arch,r=`This can happen if you use the "--omit=optional" (or "--no-optional") npm flag.
|
|
2
|
-
The "optionalDependencies" package.json feature is used to install the correct
|
|
3
|
-
binary executable for your current platform. Remove that flag to use @lydell/node-pty.
|
|
4
|
-
|
|
5
|
-
This can also happen if the "node_modules" folder was copied between two operating systems
|
|
6
|
-
that need different binaries - including "virtual" operating systems like Docker and WSL.
|
|
7
|
-
If so, try installing with npm rather than copying "node_modules".`;function i(e){try{switch(process.platform+`-`+process.arch){case`linux-x64`:return t(import.meta.dirname+`/lydell-node-pty-linux-x64.node`);case`linux-arm64`:return t(import.meta.dirname+`/lydell-node-pty-linux-arm64.node`);case`darwin-x64`:return t(import.meta.dirname+`/lydell-node-pty-darwin-x64.node`);case`darwin-arm64`:return t(import.meta.dirname+`/lydell-node-pty-darwin-arm64.node`)}return t(n+`/`+e)}catch(t){if(t&&t.code===`MODULE_NOT_FOUND`){var i=a();throw Error(i===void 0?`The @lydell/node-pty package could not find the binary package: `+n+`/`+e+`
|
|
8
|
-
|
|
9
|
-
`+r+`
|
|
10
|
-
|
|
11
|
-
Your platform (`+process.platform+`-`+process.arch+`) might not be supported.`:n in i?`The @lydell/node-pty package supports your platform (`+process.platform+`-`+process.arch+`), but it could not find the binary package for it: `+n+`/`+e+`
|
|
12
|
-
|
|
13
|
-
`+r:`The @lydell/node-pty package currently does not support your platform: `+process.platform+`-`+process.arch,{cause:t})}else throw t}}e.requireBinary=i;function a(){try{return o().optionalDependencies}catch{return}}})),c=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=t(`fs`),r=t(`path`),i=t(`net`),o=t(`child_process`),c=a(),l=s(),u,d=1e3;e.WindowsPtyAgent=function(){function e(e,t,a,o,s,d,p,m){var h=this;m===void 0&&(m=!1),this._pid=0,this._innerPid=0,u||=l.requireBinary(`conpty.node`),this._ptyNative=u,o=r.resolve(o);var g=f(e,t),_=this._ptyNative.startProcess(e,s,d,p,this._generatePipeName(),m);this._fd=_.fd,this._pty=_.pty,this._outSocket=new i.Socket,this._outSocket.setEncoding(`utf8`),this._conoutSocketWorker=new c.ConoutConnection(_.conout),this._conoutSocketWorker.onReady(function(){h._conoutSocketWorker.connectSocket(h._outSocket)}),this._outSocket.on(`connect`,function(){h._outSocket.emit(`ready_datapipe`)});var v=n.openSync(_.conin,`w`);this._inSocket=new i.Socket({fd:v,readable:!1,writable:!0}),this._inSocket.setEncoding(`utf8`),this._innerPid=this._ptyNative.connect(this._pty,g,o,a,function(e){return h._$onProcessExit(e)}).pid}return Object.defineProperty(e.prototype,`inSocket`,{get:function(){return this._inSocket},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,`outSocket`,{get:function(){return this._outSocket},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,`fd`,{get:function(){return this._fd},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,`innerPid`,{get:function(){return this._innerPid},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,`pty`,{get:function(){return this._pty},enumerable:!0,configurable:!0}),e.prototype.resize=function(e,t){if(this._exitCode!==void 0)throw Error(`Cannot resize a pty that has already exited`);this._ptyNative.resize(this._pty,e,t)},e.prototype.clear=function(){this._ptyNative.clear(this._pty)},e.prototype.kill=function(){var e=this;this._inSocket.readable=!1,this._outSocket.readable=!1,this._getConsoleProcessList().then(function(t){t.forEach(function(e){try{process.kill(e)}catch{}}),e._ptyNative.kill(e._pty)}),this._conoutSocketWorker.dispose()},e.prototype._getConsoleProcessList=function(){var e=this;return new Promise(function(t){var n=o.fork(r.join(__dirname,`conpty_console_list_agent`),[e._innerPid.toString()]);n.on(`message`,function(e){clearTimeout(i),t(e.consoleProcessList)});var i=setTimeout(function(){n.kill(),t([e._innerPid])},5e3)})},Object.defineProperty(e.prototype,`exitCode`,{get:function(){return this._exitCode},enumerable:!0,configurable:!0}),e.prototype._generatePipeName=function(){return`conpty-`+Math.random()*1e7},e.prototype._$onProcessExit=function(e){var t=this;this._exitCode=e,this._flushDataAndCleanUp(),this._outSocket.on(`data`,function(){return t._flushDataAndCleanUp()})},e.prototype._flushDataAndCleanUp=function(){var e=this;this._closeTimeout&&clearTimeout(this._closeTimeout),this._closeTimeout=setTimeout(function(){return e._cleanUpProcess()},d)},e.prototype._cleanUpProcess=function(){this._inSocket.readable=!1,this._outSocket.readable=!1,this._outSocket.destroy()},e}();function f(e,t){if(p(t))return t.length===0?e:f(e,[])+` `+t;var n=[e];Array.prototype.push.apply(n,t);for(var r=``,i=0;i<n.length;i++){i>0&&(r+=` `);var a=n[i],o=h(a[0]!==`"`,a[a.length-1]!==`"`),s=a[0]!==`"`&&a[a.length-1]!==`"`,c=a===``||(a.indexOf(` `)!==-1||a.indexOf(` `)!==-1)&&a.length>1&&(o||s);c&&(r+=`"`);for(var l=0,u=0;u<a.length;u++){var d=a[u];d===`\\`?l++:d===`"`?(r+=m(`\\`,l*2+1),r+=`"`,l=0):(r+=m(`\\`,l),l=0,r+=d)}c?(r+=m(`\\`,l*2),r+=`"`):r+=m(`\\`,l)}return r}e.argsToCommandLine=f;function p(e){return typeof e==`string`}function m(e,t){for(var n=``,r=0;r<t;r++)n+=e;return n}function h(e,t){return e&&!t||!e&&t}})),l=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0});function t(e){return[...arguments].slice(1).forEach(function(t){return Object.keys(t).forEach(function(n){return e[n]=t[n]})}),e}e.assign=t})),u=e((e=>{var t=e&&e.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},e(t,n)};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(e,`__esModule`,{value:!0});var n=r(),i=c(),a=l(),o=`cmd.exe`,s=`Windows Shell`;e.WindowsTerminal=function(e){t(r,e);function r(t,r,c){var l=e.call(this,c)||this;l._checkType(`args`,r,`string`,!0),r||=[],t||=o,c||={},c.env=c.env||process.env,c.encoding&&console.warn(`Setting encoding on Windows is not supported`);var u=a.assign({},c.env);l._cols=c.cols||n.DEFAULT_COLS,l._rows=c.rows||n.DEFAULT_ROWS;var d=c.cwd||process.cwd(),f=c.name||u.TERM||s,p=l._parseEnv(u);return l._isReady=!1,l._deferreds=[],l._agent=new i.WindowsPtyAgent(t,r,p,d,l._cols,l._rows,!1,c.conptyInheritCursor),l._socket=l._agent.outSocket,l._pid=l._agent.innerPid,l._fd=l._agent.fd,l._pty=l._agent.pty,l._socket.on(`ready_datapipe`,function(){[`connect`,`data`,`end`,`timeout`,`drain`].forEach(function(e){l._socket.on(e,function(){!l._isReady&&e===`data`&&(l._isReady=!0,l._deferreds.forEach(function(e){e.run()}),l._deferreds=[])})}),l._socket.on(`error`,function(e){if(l._close(),!(e.code&&(~e.code.indexOf(`errno 5`)||~e.code.indexOf(`EIO`)))&&l.listeners(`error`).length<2)throw e}),l._socket.on(`close`,function(){l.emit(`exit`,l._agent.exitCode),l._close()})}),l._file=t,l._name=f,l._readable=!0,l._writable=!0,l._forwardEvents(),l}return r.prototype._write=function(e){this._defer(this._doWrite,e)},r.prototype._doWrite=function(e){this._agent.inSocket.write(e)},r.open=function(e){throw Error(`open() not supported on windows, use Fork() instead.`)},r.prototype.resize=function(e,t){var n=this;if(e<=0||t<=0||isNaN(e)||isNaN(t)||e===1/0||t===1/0)throw Error(`resizing must be done using positive cols and rows`);this._deferNoArgs(function(){n._agent.resize(e,t),n._cols=e,n._rows=t})},r.prototype.clear=function(){var e=this;this._deferNoArgs(function(){e._agent.clear()})},r.prototype.destroy=function(){var e=this;this._deferNoArgs(function(){e.kill()})},r.prototype.kill=function(e){var t=this;this._deferNoArgs(function(){if(e)throw Error(`Signals not supported on windows.`);t._close(),t._agent.kill()})},r.prototype._deferNoArgs=function(e){var t=this;if(this._isReady){e.call(this);return}this._deferreds.push({run:function(){return e.call(t)}})},r.prototype._defer=function(e,t){var n=this;if(this._isReady){e.call(this,t);return}this._deferreds.push({run:function(){return e.call(n,t)}})},Object.defineProperty(r.prototype,`process`,{get:function(){return this._name},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,`master`,{get:function(){throw Error(`master is not supported on Windows`)},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,`slave`,{get:function(){throw Error(`slave is not supported on Windows`)},enumerable:!0,configurable:!0}),r}(n.Terminal)})),d=e((e=>{var n=e&&e.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},e(t,n)};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(e,`__esModule`,{value:!0});var i=t(`tty`),a=r(),o=l(),c=s().requireBinary(`pty.node`),u=`@lydell/node-pty-`+process.platform+`-`+process.arch+`/spawn-helper`;u=process.platform===`darwin`?t.resolve(u):`spawn-helper-unused`,u=u.replace(`app.asar`,`app.asar.unpacked`),u=u.replace(`node_modules.asar`,`node_modules.asar.unpacked`);var d=`sh`,f=`xterm`,p=200;e.UnixTerminal=function(e){n(t,e);function t(t,n,r){var s=e.call(this,r)||this;if(s._boundClose=!1,s._emittedClose=!1,typeof n==`string`)throw Error(`args as a string is not supported on unix.`);n||=[],t||=d,r||={},r.env=r.env||process.env,s._cols=r.cols||a.DEFAULT_COLS,s._rows=r.rows||a.DEFAULT_ROWS;var l=r.uid??-1,m=r.gid??-1,h=o.assign({},r.env);r.env===process.env&&s._sanitizeEnv(h);var g=r.cwd||process.cwd();h.PWD=g;var _=r.name||h.TERM||f;h.TERM=_;var v=s._parseEnv(h),y=r.encoding===void 0?`utf8`:r.encoding,b=c.fork(t,n,v,g,s._cols,s._rows,l,m,y===`utf8`,u,function(e,t){if(!s._emittedClose){if(s._boundClose)return;s._boundClose=!0;var n=setTimeout(function(){n=null,s._socket.destroy()},p);s.once(`close`,function(){n!==null&&clearTimeout(n),s.emit(`exit`,e,t)});return}s.emit(`exit`,e,t)});return s._socket=new i.ReadStream(b.fd),y!==null&&s._socket.setEncoding(y),s._socket.on(`error`,function(e){if(!(e.code&&~e.code.indexOf(`EAGAIN`))&&(s._close(),s._emittedClose||(s._emittedClose=!0,s.emit(`close`)),!(e.code&&(~e.code.indexOf(`errno 5`)||~e.code.indexOf(`EIO`)))&&s.listeners(`error`).length<2))throw e}),s._pid=b.pid,s._fd=b.fd,s._pty=b.pty,s._file=t,s._name=_,s._readable=!0,s._writable=!0,s._socket.on(`close`,function(){s._emittedClose||(s._emittedClose=!0,s._close(),s.emit(`close`))}),s._forwardEvents(),s}return Object.defineProperty(t.prototype,`master`,{get:function(){return this._master},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,`slave`,{get:function(){return this._slave},enumerable:!0,configurable:!0}),t.prototype._write=function(e){this._socket.write(e)},Object.defineProperty(t.prototype,`fd`,{get:function(){return this._fd},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,`ptsName`,{get:function(){return this._pty},enumerable:!0,configurable:!0}),t.open=function(e){var n=Object.create(t.prototype);e||={},arguments.length>1&&(e={cols:arguments[1],rows:arguments[2]});var r=e.cols||a.DEFAULT_COLS,o=e.rows||a.DEFAULT_ROWS,s=e.encoding===void 0?`utf8`:e.encoding,l=c.open(r,o);return n._master=new i.ReadStream(l.master),s!==null&&n._master.setEncoding(s),n._master.resume(),n._slave=new i.ReadStream(l.slave),s!==null&&n._slave.setEncoding(s),n._slave.resume(),n._socket=n._master,n._pid=-1,n._fd=l.master,n._pty=l.pty,n._file=process.argv[0]||`node`,n._name=process.env.TERM||``,n._readable=!0,n._writable=!0,n._socket.on(`error`,function(e){if(n._close(),n.listeners(`error`).length<2)throw e}),n._socket.on(`close`,function(){n._close()}),n},t.prototype.destroy=function(){var e=this;this._close(),this._socket.once(`close`,function(){e.kill(`SIGHUP`)}),this._socket.destroy()},t.prototype.kill=function(e){try{process.kill(this.pid,e||`SIGHUP`)}catch{}},Object.defineProperty(t.prototype,`process`,{get:function(){if(process.platform===`darwin`){var e=c.process(this._fd);return e===`kernel_task`?this._file:e}return c.process(this._fd,this._pty)||this._file},enumerable:!0,configurable:!0}),t.prototype.resize=function(e,t){if(e<=0||t<=0||isNaN(e)||isNaN(t)||e===1/0||t===1/0)throw Error(`resizing must be done using positive cols and rows`);c.resize(this._fd,e,t),this._cols=e,this._rows=t},t.prototype.clear=function(){},t.prototype._sanitizeEnv=function(e){delete e.TMUX,delete e.TMUX_PANE,delete e.STY,delete e.WINDOW,delete e.WINDOWID,delete e.TERMCAP,delete e.COLUMNS,delete e.LINES},t}(a.Terminal)})),f=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=process.platform===`win32`?u().WindowsTerminal:d().UnixTerminal;function n(e,n,r){return new t(e,n,r)}e.spawn=n;function r(e,n,r){return new t(e,n,r)}e.fork=r;function i(e,n,r){return new t(e,n,r)}e.createTerminal=i;function a(e){return t.open(e)}e.open=a}));export{f as require_node_pty};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{require_node_pty as e}from"./node-pty-BfteYoG-.js";export default e();export{};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./token-error-DVSfBVaT.js";import{require_token_util as e}from"./token-util-IqDtKhK6.js";export default e();export{};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{require_undici as e}from"./undici-BUZTy5qm.js";export default e();export{};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|