limixbot 0.3.105 → 0.3.106
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/cli.js +1 -1
- package/dist/assets/{ActivityPanel-Cbm_MV4_.js → ActivityPanel-CCcPfgz5.js} +1 -1
- package/dist/assets/{App-CdDhOj9Z.js → App-zBBulOuW.js} +11 -11
- package/dist/assets/{AppEventEditor-Cbwuipry.js → AppEventEditor-DwF0_M1b.js} +1 -1
- package/dist/assets/{BotSettingsDialog-C8LF47q9.js → BotSettingsDialog-DxU0bbvL.js} +1 -1
- package/dist/assets/{BrowserPanel-Xb2e7PXu.js → BrowserPanel-BhTErfef.js} +1 -1
- package/dist/assets/{BrowserProfilesManager-BNS5E_18.js → BrowserProfilesManager-Db3HtlGT.js} +1 -1
- package/dist/assets/{CloudAddDialog-f84YQfvX.js → CloudAddDialog-kamEe44b.js} +1 -1
- package/dist/assets/{ComputerFilesPane-BsZ9OtSJ.js → ComputerFilesPane-CcKrhxHb.js} +1 -1
- package/dist/assets/{ComputerPanel-a3_n-Lx2.js → ComputerPanel-xvhrDI3V.js} +2 -2
- package/dist/assets/{DataPanel-C3buf1SP.js → DataPanel-U-hn3L__.js} +1 -1
- package/dist/assets/{GrokMoveDialog-B43cbS0W.js → GrokMoveDialog-DUq8KP9G.js} +1 -1
- package/dist/assets/{InspectorPanel-Cs9FS_iX.js → InspectorPanel-USPl8hOG.js} +1 -1
- package/dist/assets/{KeyboardShortcutsModal-C1Yic9QC.js → KeyboardShortcutsModal-p9ysRLk1.js} +1 -1
- package/dist/assets/{LimixResizeHandles-DKF6WDfT.js → LimixResizeHandles-BKWnbJ2i.js} +1 -1
- package/dist/assets/{LiveDesktop-xm24_62C.js → LiveDesktop-DhWsbWD4.js} +1 -1
- package/dist/assets/{LocalVmWorkspace-B91eNABI.js → LocalVmWorkspace-CmUPQxAR.js} +1 -1
- package/dist/assets/{MacLocalControl-CurQWXB4.js → MacLocalControl-BhwfZLHm.js} +1 -1
- package/dist/assets/{MarkdownFilePreview-8kMe2rTR.js → MarkdownFilePreview-CuhD_8FB.js} +1 -1
- package/dist/assets/{NewBotDialog-dJmhmATK.js → NewBotDialog-wcLErpXf.js} +1 -1
- package/dist/assets/{PhoneAppDialog-CGplah7d.js → PhoneAppDialog-DgId8RUc.js} +1 -1
- package/dist/assets/{PluginsPanel-Boc4Pd3r.js → PluginsPanel-mk1MGvXs.js} +1 -1
- package/dist/assets/{ProIntroduction-J0r_kMie.js → ProIntroduction-BYE3bQsp.js} +1 -1
- package/dist/assets/{RemoteAgentSettingsPanel-lJv8UpKf.js → RemoteAgentSettingsPanel-CKiEG2R6.js} +1 -1
- package/dist/assets/{RoomPanel-C0PK6RRW.js → RoomPanel-DOg2_LNg.js} +1 -1
- package/dist/assets/{RoutinesPage-DMdxfslh.js → RoutinesPage-BsAHR1A_.js} +1 -1
- package/dist/assets/{SettingsModal-DtTIkNSu.js → SettingsModal-B2079ETl.js} +1 -1
- package/dist/assets/{ShareTeamDialog-BVjQQgRH.js → ShareTeamDialog-do0hDEeZ.js} +1 -1
- package/dist/assets/{SignedInSites--OK-tl6k.js → SignedInSites-GP2V7pnE.js} +1 -1
- package/dist/assets/{TeamLibraryPanel-bC-6F_Y3.js → TeamLibraryPanel-DZT4YTMk.js} +1 -1
- package/dist/assets/{TeamMapPage-4zEXJFbR.js → TeamMapPage-D0E4dgpI.js} +1 -1
- package/dist/assets/{TriggersPage-BT6g9Qzg.js → TriggersPage-DjLrZqK8.js} +1 -1
- package/dist/assets/{VisibilitySection-CxIPRF7z.js → VisibilitySection-D1WhMCk7.js} +1 -1
- package/dist/assets/{WebhookTrigger-DkFSYsbI.js → WebhookTrigger-DhQjWpWp.js} +1 -1
- package/dist/assets/{WorksOnGrid-Cl8JsM01.js → WorksOnGrid-BXuGA0Sp.js} +1 -1
- package/dist/assets/{core-6oEBX5E0.js → core-B3DZ2YZD.js} +1 -1
- package/dist/assets/{import-name-lXRpvJU5.js → import-name-DMgD6yXZ.js} +1 -1
- package/dist/assets/{index-Dv79GO2D.js → index-Bi9hjnIk.js} +2 -2
- package/dist/assets/{index-DJS0AZbc.js → index-DSJo2jnB.js} +1 -1
- package/dist/assets/{mcp-servers-CQx7iElK.js → mcp-servers-B7A4aRDZ.js} +1 -1
- package/dist/assets/{new-bot-DDzAckAK.js → new-bot-OFavyOJo.js} +1 -1
- package/dist/assets/{org-library-DpkG9WUs.js → org-library-D--Qr-TG.js} +1 -1
- package/dist/assets/{package-format-CQ9ehT0X.js → package-format-CamEIwIj.js} +1 -1
- package/dist/assets/{remote-desktop-panel-C-3gtWIh.js → remote-desktop-panel-D_S7gQya.js} +1 -1
- package/dist/index.html +1 -1
- package/dist-server/cloud-home-start.js +3 -3
- package/dist-server/index.js +102 -97
- package/dist-server/{openmausbot.js → limixbot.js} +78 -78
- package/dist-server/package.json +1 -1
- package/dist-server/pair-cli.js +78 -78
- package/dist-server/server/bot-api-host.js +11 -8
- package/dist-server/server/bot-channels/engine.js +17 -2
- package/dist-server/server/browser-relay.js +1 -1
- package/dist-server/server/caddy.js +1 -1
- package/dist-server/server/cli-invocation.js +5 -5
- package/dist-server/server/cli-usage.js +25 -25
- package/dist-server/server/cli.js +3 -3
- package/dist-server/server/container-computer.js +1 -1
- package/dist-server/server/drivers/antigravity-acp.js +1 -1
- package/dist-server/server/enterprise.js +2 -2
- package/dist-server/server/fleet.js +1 -1
- package/dist-server/server/headless/main.js +27 -27
- package/dist-server/server/index.js +10 -4
- package/dist-server/server/move-freeze.js +2 -2
- package/dist-server/server/package-export.js +3 -3
- package/dist-server/server/sentinel/paths.js +1 -1
- package/dist-server/server/service-cli.js +6 -6
- package/dist-server/server/service-unit.js +5 -5
- package/dist-server/server/tts/system-voices.js +1 -1
- package/dist-server/server/update-check.js +4 -4
- package/dist-server/server/workspace-backup.js +2 -2
- package/dist-server/server-launcher.js +3 -2
- package/dist-server/workspace-backup.worker.js +5 -5
- package/package.json +1 -1
- /package/dist-server/server/{openmausbot.js → limixbot.js} +0 -0
package/dist-server/pair-cli.js
CHANGED
|
@@ -1241,7 +1241,7 @@ K_TRUST=owner on a shared workspace: every bot's shell can change settings and a
|
|
|
1241
1241
|
threadId","composio","connectorTools","connectorScopes","mcpServers","toolsOff"])}});import{randomUUID as randomUUID3}from"node:crypto";import{closeSync,constants,fstatSync,fsyncSync,lstatSync,openSync,readFileSync,renameSync,unlinkSync,writeFileSync}from"node:fs";function sleepSync(ms2){Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,ms2)}function renameWithRetry(tmp,path3,rename4=renameSync){for(let attempt=0;;attempt+=1)try{rename4(tmp,path3);return}catch(e){let code=e.code;if(!code||!RETRYABLE_RENAME_CODES.has(code)||attempt>=RENAME_RETRY_DELAYS_MS.length)throw e;sleepSync(
|
|
1242
1242
|
RENAME_RETRY_DELAYS_MS[attempt])}}function writeFileAtomic(path3,data,options2={}){let tmp=`${path3}.${process.pid}.${randomUUID3()}.tmp`,fd=null;try{fd=openSync(tmp,"w",options2.mode),writeFileSync(fd,data),options2.durable!==!1&&fsyncSync(fd),closeSync(fd),fd=null,renameWithRetry(tmp,path3)}catch(e){if(fd!==null)try{closeSync(fd)}catch{}try{unlinkSync(tmp)}catch{}throw e}}function holdsExactly(path3,data,mode){let fd=null;try{if(process.platform==="win32"){if(!lstatSync(path3).isFile())return!1;
|
|
1243
1243
|
fd=openSync(path3,"r")}else fd=openSync(path3,constants.O_RDONLY|constants.O_NOFOLLOW|constants.O_NONBLOCK);let stat9=fstatSync(fd);if(!stat9.isFile()||stat9.size!==Buffer.byteLength(data))return!1;let uid=process.getuid?.();return uid!==void 0&&stat9.uid!==uid||mode!==void 0&&process.platform!=="win32"&&(stat9.mode&511&~mode)!==0?!1:readFileSync(fd).equals(Buffer.from(data))}catch{return!1}finally{if(fd!==null)try{closeSync(fd)}catch{}}}function writeFileAtomicIfChanged(path3,data,options2={}){
|
|
1244
|
-
return holdsExactly(path3,data,options2.mode)?!1:(writeFileAtomic(path3,data,options2),!0)}var RENAME_RETRY_DELAYS_MS,RETRYABLE_RENAME_CODES,init_atomic=__esm({"server/atomic.ts"(){"use strict";RENAME_RETRY_DELAYS_MS=[5,10,20,40,80],RETRYABLE_RENAME_CODES=new Set(["EPERM","EACCES","EBUSY"])}});function cliPrefix(env=process.env,script=process.argv[1]??""){let fixed=env.OMB_CLI_PREFIX?.trim();return fixed||(env.npm_lifecycle_event==="omb"?"pnpm omb":/[\\/]_npx[\\/]/.test(script)?"npx
|
|
1244
|
+
return holdsExactly(path3,data,options2.mode)?!1:(writeFileAtomic(path3,data,options2),!0)}var RENAME_RETRY_DELAYS_MS,RETRYABLE_RENAME_CODES,init_atomic=__esm({"server/atomic.ts"(){"use strict";RENAME_RETRY_DELAYS_MS=[5,10,20,40,80],RETRYABLE_RENAME_CODES=new Set(["EPERM","EACCES","EBUSY"])}});function cliPrefix(env=process.env,script=process.argv[1]??""){let fixed=env.OMB_CLI_PREFIX?.trim();return fixed||(env.npm_lifecycle_event==="omb"?"pnpm omb":/[\\/]_npx[\\/]/.test(script)?"npx limixbot":"limixbot")}function cliCommand(rest,env,script){return`${cliPrefix(env,script)} ${rest}`}var init_cli_invocation=__esm({"server/cli-invocation.ts"(){"use strict"}});var en_default2,init_en2=__esm({"src/locales/en.json"(){en_default2={"server.moves.connectorStayedMail":"{name} stayed on {computer} when your bots moved to My Cloud, so bots here can't read or send mail through it. It keeps its accounts on {computer}, and it can't reach a mail server from here. To read and send mail from My Cloud, connect your mailbox under Connected apps.","server.moves.connectorStayedProgram":"{name} stayed on {computer} when your bots moved to My Cloud, so bots here can't us\
|
|
1245
1245
|
e it. It needs {program}, which My Cloud doesn't have.","server.moves.connectorStayedHere":"{name} stayed on {computer} when your bots moved to My Cloud, so bots here can't use it. It uses files or an address only {computer} has.","server.moves.webhookMoved":'Now that I live on {place}, my webhook "{name}" has a new address. Open Automations, choose Copy address on "{name}", and paste it into the app that sends to it.',"server.teammates.sameRequest":"Another teammate asked the same a moment ago,\
|
|
1246
1246
|
so this gets that answer instead of a second one.","server.reports.sent":"Sent to the Limix Bot team (report {report}).","server.reports.sentReply":"Sent to the Limix Bot team (report {report}). We'll reply to {contact}.","server.reports.sentLater":"Sent to the Limix Bot team (report {report}) after an earlier try did not go through.","server.reports.sentLaterReply":"Sent to the Limix Bot team (report {report}) after an earlier try did not go through. We'll reply to {contact}.","server.reports.\
|
|
1247
1247
|
notYet":"Not sent yet: {why}. The report is saved and goes on its own {when}, so there is no need to send it again.","server.reports.why.limited":"the Limix Bot team takes only a few reports an hour from each app","server.reports.why.offline":"the Limix Bot team's server could not be reached","server.reports.why.busy":"the Limix Bot team's server could not take it right now","server.reports.when.minute":"in about {count} minute","server.reports.when.minutes":"in about {count} minutes","server.re\
|
|
@@ -1423,53 +1423,53 @@ type:"string"},team:{type:"string"},section:{type:"string"}},positionals:1},"set
|
|
|
1423
1423
|
type:"boolean"}},positionals:1},events:{options:{thread:{type:"string",multiple:!0},job:{type:"string"},"until-settled":{type:"boolean"},kind:{type:"string"},since:{type:"string"},screens:{type:"boolean"},jsonl:{type:"boolean"}},positionals:0},"team apply":{options:{"dry-run":{type:"boolean"},check:{type:"boolean"},prune:{type:"boolean"},"rotate-secrets":{type:"boolean"},"wait-idle":{type:"string"}},positionals:1},"team export":{options:{team:{type:"string",multiple:!0},out:{type:"string"}},positionals:0},
|
|
1424
1424
|
"engine set":{options:{"key-env":{type:"string"},"key-file":{type:"string"},"base-url":{type:"string"},"only-claude-api":{type:"boolean"},install:{type:"boolean"},rotate:{type:"boolean"},"dry-run":{type:"boolean"}},positionals:1},"engine list":{options:{},positionals:0},connect:{options:{code:{type:"string"},out:{type:"string"},label:{type:"string"},client:{type:"boolean"},force:{type:"boolean"}},positionals:1},mcp:{options:{},positionals:0},"token create":{options:{out:{type:"string"},scope:{type:"\
|
|
1425
1425
|
string"},expires:{type:"string"},force:{type:"boolean"}},positionals:1},"token list":{options:{},positionals:0},"token revoke":{options:{},positionals:1}},HEADLESS_VERBS=new Set(Object.keys(VERBS).map(verb=>verb.split(" ")[0])),MUTATING_VERBS=new Set(["send","send-channel","run","interrupt","new-bot","new-channel","set-model","edit","team apply","engine set","token create","token revoke"]),SUBCOMMANDS=new Map([["team",["apply","export"]],["engine",["set","list"]],["token",["create","list","revok\
|
|
1426
|
-
e"]]]);flag=(flags,name)=>{let value=flags[name];return typeof value=="string"?value:void 0};DURATION=/^(\d+(?:\.\d+)?)(ms|s|m|h|d)?$/,DAY=24*36e5,UNIT={ms:1,s:1e3,m:6e4,h:36e5,d:DAY};describeMs=ms2=>ms2===0?"0s":ms2>DAY&&ms2%DAY===0?`${ms2/DAY}d`:ms2%36e5===0?`${ms2/36e5}h`:ms2%6e4===0?`${ms2/6e4}m`:ms2%1e3===0?`${ms2/1e3}s`:`${ms2}ms`,SIZE=/^(\d+(?:\.\d+)?)\s*(b|kb|mb|gb)?$/i,SIZE_UNIT={b:1,kb:1e3,mb:1e6,gb:1e9}}});function usage(prefix="
|
|
1427
|
-
`).map(line3=>line3.replace(/^(\s+)
|
|
1426
|
+
e"]]]);flag=(flags,name)=>{let value=flags[name];return typeof value=="string"?value:void 0};DURATION=/^(\d+(?:\.\d+)?)(ms|s|m|h|d)?$/,DAY=24*36e5,UNIT={ms:1,s:1e3,m:6e4,h:36e5,d:DAY};describeMs=ms2=>ms2===0?"0s":ms2>DAY&&ms2%DAY===0?`${ms2/DAY}d`:ms2%36e5===0?`${ms2/36e5}h`:ms2%6e4===0?`${ms2/6e4}m`:ms2%1e3===0?`${ms2/1e3}s`:`${ms2}ms`,SIZE=/^(\d+(?:\.\d+)?)\s*(b|kb|mb|gb)?$/i,SIZE_UNIT={b:1,kb:1e3,mb:1e6,gb:1e9}}});function usage(prefix="limixbot"){return USAGE.split(`
|
|
1427
|
+
`).map(line3=>line3.replace(/^(\s+)limixbot(?= )/,`$1${prefix}`)).join(`
|
|
1428
1428
|
`)}var HEADLESS_USAGE,USAGE,init_cli_usage=__esm({"server/cli-usage.ts"(){"use strict";init_args();HEADLESS_USAGE=`Drive a running workspace (scripts, CI, other agents):
|
|
1429
1429
|
limixbot doctor check the server answers and an engine is ready
|
|
1430
1430
|
limixbot doctor --host check this Linux machine can run a server (exit 7 if not)
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1431
|
+
limixbot bots | channels | models your bots, your rooms, the engines and their models
|
|
1432
|
+
limixbot run BOT "do this" give a bot one job and wait until it and every teammate it asked are done
|
|
1433
|
+
limixbot send BOT "text" send one message and return at once
|
|
1434
|
+
limixbot wait BOT wait on work already running
|
|
1435
|
+
limixbot messages BOT the latest messages of a conversation
|
|
1436
|
+
limixbot interrupt BOT [--tree] press Stop (--tree: and every teammate on its job)
|
|
1437
|
+
limixbot export BOT --out DIR write a job's transcripts, files and screens to DIR
|
|
1438
|
+
limixbot events [--job THREAD] the server's live events as JSON lines
|
|
1439
|
+
limixbot team apply FILE make the workspace match a team file (team export writes one)
|
|
1440
|
+
limixbot engine set claude --key-env ANTHROPIC_API_KEY give it an engine without a screen
|
|
1441
1441
|
limixbot connect URL --code CODE --out FILE get a token for a workspace elsewhere
|
|
1442
|
-
|
|
1443
|
-
|
|
1442
|
+
limixbot token create NAME --out FILE [--expires 90d] a token for CI that ends on its date (token list, token revoke ID)
|
|
1443
|
+
limixbot new-bot | new-channel | set-model | edit | mcp
|
|
1444
1444
|
|
|
1445
1445
|
Server: --url URL (or OPENMAUSBOT_URL), --port N (or OMB_PORT), else this computer's.
|
|
1446
1446
|
Token: OPENMAUSBOT_TOKEN or --token-file FILE. --json prints one JSON document;
|
|
1447
|
-
progress goes to stderr (--quiet drops it). limixbot help VERB for the details.`;USAGE=`
|
|
1447
|
+
progress goes to stderr (--quiet drops it). limixbot help VERB for the details.`;USAGE=`limixbot \u2014 your team of AI bots, ready in a few steps
|
|
1448
1448
|
|
|
1449
|
-
|
|
1449
|
+
limixbot set up once, then open your workspace
|
|
1450
1450
|
limixbot setup [--data-dir DIR]
|
|
1451
1451
|
limixbot start [the same options as serve]
|
|
1452
1452
|
limixbot serve [--port 8799] [--data-dir DIR] [--label NAME]
|
|
1453
1453
|
[--public-url https://host | --domain HOST | --tunnel | --tailscale] [--lan] [--relay]
|
|
1454
1454
|
limixbot pair [--label NAME] [--phone [ios|android]] [--ttl 24h] [--public-url https://host]
|
|
1455
|
-
|
|
1455
|
+
limixbot devices [revoke ID]
|
|
1456
1456
|
limixbot status
|
|
1457
|
-
|
|
1457
|
+
limixbot --version
|
|
1458
1458
|
limixbot login [--email you@example.com] [--relay]
|
|
1459
1459
|
limixbot logout
|
|
1460
|
-
|
|
1460
|
+
limixbot access list | add EMAIL [--chat-only] | remove EMAIL
|
|
1461
1461
|
limixbot service install [the same way-in options as serve] [--port N] [--data-dir DIR] | uninstall
|
|
1462
1462
|
[--sentinel] (the health scan below, every two minutes, instead of the server)
|
|
1463
|
-
|
|
1463
|
+
limixbot sentinel [--data-dir DIR] [--out DIR] [--once] [--json] (read-only health scan; see --help)
|
|
1464
1464
|
limixbot browser install [--with-deps] | status
|
|
1465
|
-
|
|
1465
|
+
limixbot fleet init --domain HOST [--operator USER] | create NAME --admin EMAIL [--member EMAIL] [--brand FILE]
|
|
1466
1466
|
[--anthropic-key-file FILE] [--cap USD] [--license-key KEY] [--memory 1G]
|
|
1467
1467
|
| list | users NAME add|remove EMAIL [--chat-only] | suspend NAME | resume NAME
|
|
1468
1468
|
| delete NAME --yes [--keep-data] | upgrade (all take --dry-run)
|
|
1469
1469
|
| agent [--socket PATH] [--group USER] (root; installed by init --operator)
|
|
1470
1470
|
|
|
1471
1471
|
setup choose AI access and optional phone access; keep existing bots and chats
|
|
1472
|
-
start same as
|
|
1472
|
+
start same as limixbot: use your saved settings and open the workspace
|
|
1473
1473
|
serve starts the server without prompts; in a terminal it prints a pairing
|
|
1474
1474
|
code, the link to paste into the desktop app (\uFF0B \u2192 Connect to a
|
|
1475
1475
|
server) and a QR for a phone
|
|
@@ -1534,8 +1534,8 @@ Ways in (pick one; --lan can join any):
|
|
|
1534
1534
|
|
|
1535
1535
|
${HEADLESS_USAGE}
|
|
1536
1536
|
|
|
1537
|
-
Install once with \`npm install -g
|
|
1538
|
-
Or run without a global install: \`npx
|
|
1537
|
+
Install once with \`npm install -g limixbot\`, then type \`limixbot\`.
|
|
1538
|
+
Or run without a global install: \`npx limixbot\`. Node 24+ is required.
|
|
1539
1539
|
`}});var require_QRMode=__commonJS({"node_modules/.pnpm/qrcode-terminal@0.12.0/node_modules/qrcode-terminal/vendor/QRCode/QRMode.js"(exports,module){module.exports={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8}}});var require_QR8bitByte=__commonJS({"node_modules/.pnpm/qrcode-terminal@0.12.0/node_modules/qrcode-terminal/vendor/QRCode/QR8bitByte.js"(exports,module){var QRMode=require_QRMode();function QR8bitByte(data){this.mode=QRMode.MODE_8BIT_BYTE,this.data=data}QR8bitByte.prototype={getLength:function(){return this.data.length},write:function(buffer){for(var i2=0;i2<this.data.length;i2++)buffer.put(this.data.charCodeAt(i2),8)}};module.exports=QR8bitByte}});var require_QRMath=__commonJS({"node_modules/.pnpm/qrcode-terminal@0.12.0/node_modules/qrcode-terminal/vendor/QRCode/QRMath.js"(exports,module){var QRMath={glog:function(n3){if(n3<1)throw new Error("glog("+n3+")");return QRMath.LOG_TABLE[n3]},gexp:function(n3){for(;n3<0;)n3+=255;for(;n3>=256;)n3-=255;return QRMath.EXP_TABLE[n3]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)};for(i2=0;i2<8;i2++)QRMath.EXP_TABLE[i2]=1<<i2;var i2;for(i2=8;i2<256;i2++)QRMath.EXP_TABLE[i2]=QRMath.EXP_TABLE[i2-4]^
|
|
1540
1540
|
QRMath.EXP_TABLE[i2-5]^QRMath.EXP_TABLE[i2-6]^QRMath.EXP_TABLE[i2-8];var i2;for(i2=0;i2<255;i2++)QRMath.LOG_TABLE[QRMath.EXP_TABLE[i2]]=i2;var i2;module.exports=QRMath}});var require_QRPolynomial=__commonJS({"node_modules/.pnpm/qrcode-terminal@0.12.0/node_modules/qrcode-terminal/vendor/QRCode/QRPolynomial.js"(exports,module){var QRMath=require_QRMath();function QRPolynomial(num,shift){if(num.length===void 0)throw new Error(num.length+"/"+shift);for(var offset=0;offset<num.length&&num[offset]===0;)offset++;this.num=new Array(num.length-offset+shift);for(var i2=0;i2<num.length-offset;i2++)this.num[i2]=num[i2+offset]}QRPolynomial.prototype={get:function(index2){return this.
|
|
1541
1541
|
num[index2]},getLength:function(){return this.num.length},multiply:function(e){for(var num=new Array(this.getLength()+e.getLength()-1),i2=0;i2<this.getLength();i2++)for(var j2=0;j2<e.getLength();j2++)num[i2+j2]^=QRMath.gexp(QRMath.glog(this.get(i2))+QRMath.glog(e.get(j2)));return new QRPolynomial(num,0)},mod:function(e){if(this.getLength()-e.getLength()<0)return this;for(var ratio=QRMath.glog(this.get(0))-QRMath.glog(e.get(0)),num=new Array(this.getLength()),i2=0;i2<this.getLength();i2++)num[i2]=
|
|
@@ -3022,15 +3022,15 @@ owner.pid);return created===null?!0:created<owner.createdAt}function unlinkExact
|
|
|
3022
3022
|
stale data-directory lease."))return!0;let current=readReaper(reaperPath,expected.token);if(current){if(!sameMachine(current))throw leaseError(`A stale Limix Bot data-directory lease is being recovered on another machine. Recovery record: ${JSON.stringify(reaperPath)}.`);if(ownerIsAlive(current))return!1;reaperPath=successorReaperPath(leasePath,expected.token,current.token)}}throw leaseError("Limix Bot could not recover the stale data-directory lease after repeated interrupted attempts.")}function retireDeadOwner(leasePath,expected){
|
|
3023
3023
|
if(!claimReaperAuthority(leasePath,expected))return!1;let current=readOwner(leasePath);if(!current||current.token!==expected.token)return!0;if(!sameMachine(current))throw leaseError(`The stale Limix Bot data-directory lease changed ownership to another machine. Lease record: ${JSON.stringify(leasePath)}.`);return ownerIsAlive(current)?!1:(unlinkExact(leasePath,"Limix Bot could not retire the stale data-directory lease."),!0)}function validateDataDir(dataDir){if(typeof dataDir!="string"||dataDir.
|
|
3024
3024
|
trim().length===0||/[\r\n\0]/.test(dataDir))throw leaseError("Limix Bot cannot lease an invalid data directory.");return dataDir}function prepareDataDir(dataDir,legacyDataDir){if(validateDataDir(dataDir),legacyDataDir!==void 0&&(validateDataDir(legacyDataDir),!existsSync23(dataDir)&&existsSync23(legacyDataDir)))try{renameSync9(legacyDataDir,dataDir)}catch{}try{mkdirSync17(dataDir,{recursive:!0,mode:448})}catch(error62){throw leaseError("Limix Bot cannot create its data directory.",error62)}return join38(
|
|
3025
|
-
dataDir,LEASE_NAME)}function assertNoLiveDelegatedChild(dataDir,t2){let
|
|
3026
|
-
|
|
3027
|
-
pid}-${owner.token}`;try{writeFileSync11(candidatePath,`${JSON.stringify(owner)}
|
|
3025
|
+
dataDir,LEASE_NAME)}function assertNoLiveDelegatedChild(dataDir,t2){for(let path3 of[join38(dataDir,DELEGATED_CHILD_DIR,LEASE_NAME),join38(dataDir,DELEGATED_CHILD_DIR,LEGACY_LEASE_NAME),join38(dataDir,".openmausbot-server-child",LEGACY_LEASE_NAME),join38(dataDir,LEGACY_LEASE_NAME)])assertStoppedLease(path3,t2)}function assertStoppedLease(childLeasePath,t2){let child=readOwner(childLeasePath);if(child){if(!sameMachine(child))throw leaseError(`This Limix Bot data directory still has a delegated se\
|
|
3026
|
+
rver on another machine. Delegated server lease: ${JSON.stringify(childLeasePath)}.${otherMachineAdvice(childLeasePath,t2)}`);if(ownerIsAlive(child))throw leaseError(`Limix Bot's previous server process ${child.pid} is still shutting down. Try again shortly.`)}}function capabilityFor(owner){return`v1:${owner.pid}:${owner.token}`}function acquireDataDirLeaseInternal(dataDir,options2={}){let leasePath=prepareDataDir(dataDir,options2.legacyDataDir);options2.guardDelegatedChild!==!1&&assertNoLiveDelegatedChild(
|
|
3027
|
+
dataDir,options2.t);let owner={version:1,pid:process.pid,host:hostname5(),token:randomUUID6(),createdAt:Date.now(),boot:bootSession(),uptime:uptimeMs(),...processIdentity()},candidatePath=`${leasePath}.candidate-${owner.pid}-${owner.token}`;try{writeFileSync11(candidatePath,`${JSON.stringify(owner)}
|
|
3028
3028
|
`,{flag:"wx",mode:384,flush:!0})}catch(error62){throw leaseError("Limix Bot cannot prepare its data-directory lease.",error62)}let acquired=!1;try{for(;;){try{linkSync(candidatePath,leasePath),acquired=!0;break}catch(error62){if(error62?.code!=="EEXIST")throw leaseError("Limix Bot cannot acquire its data-directory lease.",error62)}let current=readOwner(leasePath);if(current){if(!sameMachine(current))throw leaseError(`This Limix Bot data directory is already owned by a process on another machine.\
|
|
3029
3029
|
Lease record: ${JSON.stringify(leasePath)}.${otherMachineAdvice(leasePath,options2.t)}`);if(ownerIsAlive(current))throw leaseError(`Limix Bot is already using this data directory (process ${current.pid}). Close the other instance first. If no Limix Bot is running, delete this lease record and start again: ${JSON.stringify(leasePath)}.`);if(!retireDeadOwner(leasePath,current))throw leaseError("A stale Limix Bot data-directory lease is already being recovered; try again shortly.")}}}finally{unlinkExact(
|
|
3030
3030
|
candidatePath,"Limix Bot could not remove its lease candidate.")}if(!acquired)throw leaseError("Limix Bot could not acquire its data-directory lease.");let released=!1;return Object.freeze({ownerPid:owner.pid,delegated:!1,release(){if(released)return!1;options2.guardDelegatedChild!==!1&&assertNoLiveDelegatedChild(dataDir);let current=readOwner(leasePath);if(!current||current.pid!==owner.pid||current.host!==owner.host||current.token!==owner.token)throw leaseError("Limix Bot will not release a dat\
|
|
3031
3031
|
a-directory lease owned by another process.");try{unlinkSync4(leasePath)}catch(error62){throw leaseError("Limix Bot could not release its data-directory lease.",error62)}return released=!0,!0},utilityServerLeaseEnvironment(){if(released)throw leaseError("Limix Bot cannot delegate a released data-directory lease.");return Object.freeze({[CHILD_LEASE_ENV]:capabilityFor(owner)})}})}function acquireDataDirLease(dataDir,options2={}){return acquireDataDirLeaseInternal(dataDir,options2)}var LEASE_NAME,
|
|
3032
|
-
DELEGATED_CHILD_DIR,CHILD_LEASE_ENV,UUID2,MAX_PID,MAX_BOOT_ID,MAX_REAPER_GENERATIONS,DataDirLeaseError,cachedBootSession,cachedPidNamespace,init_data_dir_lease=__esm({"electron/data-dir-lease.mjs"(){"use strict";LEASE_NAME="openmausbot-server.lease",DELEGATED_CHILD_DIR=".limixbot-server-child",CHILD_LEASE_ENV="OPENMAUSBOT_INTERNAL_DATA_DIR_LEASE",UUID2=/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/,MAX_PID=2147483647,
|
|
3033
|
-
class extends Error{name="DataDirLeaseError"}}});var init_data_dir_lease2=__esm({"server/data-dir-lease.ts"(){"use strict";init_data_dir_lease()}});function versionFromProbe(stdout2,stderr){let out=(stdout2??"").trim();return out||((stderr??"").trim().split(/\r\n|\n|\r/,1)[0]?.trim()??"")||null}function notThisCli(cli,name){return`\`${cli}\` is not ${name}'s CLI: it answered --version as another program.`}function parseVersionTriple(value){let match=/(\d+)\.(\d+)\.(\d+)/.exec(value);return match?[Number(match[1]),Number(match[2]),Number(match[3])]:null}function versionAtLeast(installed,floor){for(let i2=0;i2<3;i2+=1)if(installed[i2]!==floor[i2])
|
|
3032
|
+
LEGACY_LEASE_NAME,DELEGATED_CHILD_DIR,CHILD_LEASE_ENV,UUID2,MAX_PID,MAX_BOOT_ID,MAX_REAPER_GENERATIONS,DataDirLeaseError,cachedBootSession,cachedPidNamespace,init_data_dir_lease=__esm({"electron/data-dir-lease.mjs"(){"use strict";LEASE_NAME="limixbot-server.lease",LEGACY_LEASE_NAME="openmausbot-server.lease",DELEGATED_CHILD_DIR=".limixbot-server-child",CHILD_LEASE_ENV="OPENMAUSBOT_INTERNAL_DATA_DIR_LEASE",UUID2=/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/,MAX_PID=2147483647,
|
|
3033
|
+
MAX_BOOT_ID=128,MAX_REAPER_GENERATIONS=128,DataDirLeaseError=class extends Error{name="DataDirLeaseError"}}});var init_data_dir_lease2=__esm({"server/data-dir-lease.ts"(){"use strict";init_data_dir_lease()}});function versionFromProbe(stdout2,stderr){let out=(stdout2??"").trim();return out||((stderr??"").trim().split(/\r\n|\n|\r/,1)[0]?.trim()??"")||null}function notThisCli(cli,name){return`\`${cli}\` is not ${name}'s CLI: it answered --version as another program.`}function parseVersionTriple(value){let match=/(\d+)\.(\d+)\.(\d+)/.exec(value);return match?[Number(match[1]),Number(match[2]),Number(match[3])]:null}function versionAtLeast(installed,floor){for(let i2=0;i2<3;i2+=1)if(installed[i2]!==floor[i2])
|
|
3034
3034
|
return installed[i2]>floor[i2];return!0}var init_version_probe=__esm({"server/drivers/acp/version-probe.ts"(){"use strict"}});function cliProbeEnvironment(){let env={...process.env,PATH:augmentedPath()};stripWorkspaceCredentialEnv(env);for(let key2 of PROVIDER_CREDENTIAL_ENV)delete env[key2];return env}var init_cli_probe=__esm({"server/cli-probe.ts"(){"use strict";init_config3();init_contracts();init_version_probe();init_env_path();init_procs()}});import{createReadStream,createWriteStream as createWriteStream2}from"node:fs";import{mkdir as mkdir3,open as open2,writeFile}from"node:fs/promises";import{join as join39}from"node:path";import{Transform}from"node:stream";import{pipeline as pipeline2}from"node:stream/promises";import{createInflateRaw}from"node:zlib";async function readZipDirectory(path3,maxEntries){let handle=await open2(path3,"r");try{let info=await handle.stat(),tailBytes=Math.min(info.size,MAX_EOCD_BYTES),tail2=Buffer.alloc(tailBytes),
|
|
3035
3035
|
tailOffset=info.size-tailBytes;if((await handle.read(tail2,0,tailBytes,tailOffset)).bytesRead!==tailBytes)throw new Error("The verified archive was truncated.");let eocd=-1;for(let cursor4=tail2.length-22;cursor4>=0;cursor4-=1)if(tail2.readUInt32LE(cursor4)===EOCD_SIGNATURE&&cursor4+22+tail2.readUInt16LE(cursor4+20)===tail2.length){eocd=cursor4;break}if(eocd<0)throw new Error("The verified archive has no valid ZIP directory.");let disk=tail2.readUInt16LE(eocd+4),directoryDisk=tail2.readUInt16LE(
|
|
3036
3036
|
eocd+6),diskEntries=tail2.readUInt16LE(eocd+8),entryCount=tail2.readUInt16LE(eocd+10),directoryBytes=tail2.readUInt32LE(eocd+12),directoryOffset=tail2.readUInt32LE(eocd+16),eocdOffset=tailOffset+eocd;if(disk!==0||directoryDisk!==0||diskEntries!==entryCount||entryCount>maxEntries||directoryBytes===4294967295||directoryOffset===4294967295||directoryOffset+directoryBytes>eocdOffset)throw new Error("The verified archive uses an unsupported ZIP layout.");let directory=Buffer.alloc(directoryBytes);if((await handle.
|
|
@@ -4102,7 +4102,7 @@ visit4),result2}function catalogFromAntigravityConfigOptions(configOptions2,fall
|
|
|
4102
4102
|
input2.profile,input2.cwd??input2.profile.directory);try{await client.initialize(remaining(),deadline),await client.request("authenticate",{methodId:"oauth-personal"},remaining());let session=await client.request("session/new",{cwd:input2.cwd??input2.profile.directory,mcpServers:[]},remaining()),catalog=catalogFromAntigravityConfigOptions(session?.configOptions,input2.fallbackDefault);if(!catalog)throw new Error("Antigravity did not return a model catalog for this Google account.");let budget=Math.
|
|
4103
4103
|
min(VARIANT_SURVEY_MS,deadline-Date.now());if(budget<=0)return catalog;let surveyed=await surveyModelVariants((method,params)=>client.request(method,params,budget),session,budget);return{...catalog,options:catalog.options.map(option=>{let variants=surveyed.get(option.id);return!option.variants?.length&&variants?.length?{...option,variants}:option})}}finally{client.close()}}function isValidAntigravityInitializeResult(initialized,expectedVersion){if(!initialized||initialized.protocolVersion!==1)return!1;
|
|
4104
4104
|
let name=initialized.agentInfo?.name;if(name!=="antigravity-acp"&&name!=="Google Antigravity")return!1;let actualVersion=initialized.agentInfo?.version;if(typeof actualVersion!="string")return!1;let normalizedActual=actualVersion.replace(/^agy_acp_server_/u,"").trim(),normalizedExpected=expectedVersion.replace(/^agy_acp_server_/u,"").trim();if(actualVersion!==expectedVersion&&normalizedActual!==normalizedExpected)return!1;let advertised=value=>value===!0||typeof value=="object"&&value!==null&&!Array.
|
|
4105
|
-
isArray(value);return!(initialized.agentCapabilities?.loadSession!==!0||!advertised(initialized.agentCapabilities?.sessionCapabilities?.resume)||!advertised(initialized.agentCapabilities?.auth?.logout)||!Array.isArray(initialized.authMethods)||!initialized.authMethods.some(method=>method?.id==="oauth-personal"))}async function validateAntigravityRuntime(runtime,expectedVersion){let profileDirectory=await mkdtemp(join59(tmpdir6(),"
|
|
4105
|
+
isArray(value);return!(initialized.agentCapabilities?.loadSession!==!0||!advertised(initialized.agentCapabilities?.sessionCapabilities?.resume)||!advertised(initialized.agentCapabilities?.auth?.logout)||!Array.isArray(initialized.authMethods)||!initialized.authMethods.some(method=>method?.id==="oauth-personal"))}async function validateAntigravityRuntime(runtime,expectedVersion){let profileDirectory=await mkdtemp(join59(tmpdir6(),"limix-antigravity-verify-")),client,tempDirectory,failed2=!1,failure2;
|
|
4106
4106
|
try{let profile=await prepareAntigravityProfile({instanceId:`verify-${randomUUID10()}`,runtime,profileDirectory,tempDirectory:antigravityTempDir(DATA_DIR,VERIFICATION_TEMP_KEY)});tempDirectory=profile.tempDirectory,client=new AntigravityAcpClient(runtime,profile,profileDirectory);let initialized=await client.initialize();if(!isValidAntigravityInitializeResult(initialized,expectedVersion))throw new Error("The download did not identify as the expected Google Antigravity ACP release.")}catch(error62){
|
|
4107
4107
|
failed2=!0,failure2=error62}let stopped=!client;try{if(client&&(stopped=await client.closeAndWait(),!stopped))throw new Error("Antigravity did not shut down after runtime verification.")}catch(error62){failed2||(failed2=!0,failure2=error62)}if(stopped&&(await rm3(profileDirectory,{recursive:!0,force:!0,maxRetries:4,retryDelay:250}).catch(error62=>{console.warn(`antigravity: could not remove verification files ${profileDirectory}: ${error62 instanceof Error?error62.message:String(error62)}`)}),tempDirectory&&
|
|
4108
4108
|
await sweepAntigravityTemp(VERIFICATION_TEMP_KEY).catch(error62=>{console.warn(`antigravity: could not clear verification files: ${error62 instanceof Error?error62.message:String(error62)}`)})),failed2)throw failure2}var ANTIGRAVITY_AUTH_PREFIX,AUTH_TIMEOUT_MS,STARTUP_TIMEOUT_MS,STARTUP_CAP_MS,UNPACK_COUNT_BUDGET_MS,VARIANT_SURVEY_MS,MAX_PROTOCOL_LINE_BYTES,MAX_DIAGNOSTIC_LINE_CHARS,GRACEFUL_EXIT_MS,REMOVED_ENVIRONMENT_KEYS,BROWSER_MARKER,browserHelperSource,AntigravityAcpClient,AntigravityAuthController,
|
|
@@ -8544,17 +8544,17 @@ init_token();T2="TARGET is a bot or room by name or id, or --bot ID, --channel I
|
|
|
8544
8544
|
limixbot doctor --host [--data-dir DIR] [--port 8799] [--domain HOST]
|
|
8545
8545
|
Check this Linux machine can run the server and the bots' sandbox: the system, Docker or Podman, user
|
|
8546
8546
|
namespaces, seccomp, cgroup v2, free disk, size, ports and the clock. Each problem says its fix.
|
|
8547
|
-
Exit 0 ready (warnings allowed), 7 something is missing. On macOS and Windows it says it is for Linux.`,bots:`
|
|
8548
|
-
Your bots and what each is doing.`,channels:`
|
|
8549
|
-
Your rooms (group chats) and who is in them.`,models:`
|
|
8550
|
-
The engines and the models each offers (use them as INSTANCE/MODEL).`,messages:`
|
|
8547
|
+
Exit 0 ready (warnings allowed), 7 something is missing. On macOS and Windows it says it is for Linux.`,bots:`limixbot bots
|
|
8548
|
+
Your bots and what each is doing.`,channels:`limixbot channels
|
|
8549
|
+
Your rooms (group chats) and who is in them.`,models:`limixbot models
|
|
8550
|
+
The engines and the models each offers (use them as INSTANCE/MODEL).`,messages:`limixbot messages TARGET [--limit 30]
|
|
8551
8551
|
The latest messages of a conversation (at most 200).
|
|
8552
|
-
${T2}`,send:`
|
|
8552
|
+
${T2}`,send:`limixbot send TARGET (TEXT | --text TEXT | --message-file FILE | -) [--task new|current|ID] [--title T] [--send-id ID] [--dry-run]
|
|
8553
8553
|
Send one message and return at once. It goes to the conversation the bot or room has open (--task current,
|
|
8554
8554
|
the default), to a new one (--task new, titled by --title or the message's first line), or to --task ID.
|
|
8555
8555
|
It says which conversation it went to. The same --send-id never sends twice.
|
|
8556
|
-
${T2}`,"send-channel":`
|
|
8557
|
-
The same as send, for a room named by id.`,run:`
|
|
8556
|
+
${T2}`,"send-channel":`limixbot send-channel --channel ID (TEXT | --text TEXT) [--task new|current|ID] [--title T] [--dry-run]
|
|
8557
|
+
The same as send, for a room named by id.`,run:`limixbot run TARGET (TEXT | --message-file FILE | -) [--task new|current|ID] [--title T]
|
|
8558
8558
|
[--wait job|turn|none] [--timeout 30m] [--on-input exit|wait|stop] [--on-timeout leave|stop]
|
|
8559
8559
|
[--strict] [--export DIR [--force]]
|
|
8560
8560
|
Give a bot or room one job and wait until it, and every teammate it asked, is done.
|
|
@@ -8564,45 +8564,45 @@ limixbot doctor --host [--data-dir DIR] [--port 8799] [--domain HOST]
|
|
|
8564
8564
|
--on-input: exit (3) when someone must answer, wait for the answer, or stop the job.
|
|
8565
8565
|
--on-timeout: leave the work running, or stop it. --strict: a teammate that failed fails the run.
|
|
8566
8566
|
Exit 0 done, 1 failed or stopped, 3 needs you, 4 timed out, 130 Ctrl-C (the work keeps running).
|
|
8567
|
-
${T2}`,wait:`
|
|
8567
|
+
${T2}`,wait:`limixbot wait TARGET [--for job|turn] [--timeout 30m] [--on-input \u2026] [--on-timeout \u2026] [--strict] [--since MS]
|
|
8568
8568
|
Wait on a conversation already running (after run --wait none, Ctrl-C or a restarted CI step).
|
|
8569
8569
|
--since MS (which run prints) keeps watching the same job, so one that ended meanwhile reports how.
|
|
8570
8570
|
Nothing running: it returns at once (exit 0). Same exit codes as run.
|
|
8571
|
-
${T2}`,interrupt:`
|
|
8571
|
+
${T2}`,interrupt:`limixbot interrupt TARGET [--tree] [--dry-run]
|
|
8572
8572
|
Press Stop on a conversation. --tree also stops every teammate still working on its job.
|
|
8573
|
-
${T2}`,"new-bot":`
|
|
8574
|
-
Make a bot.`,"new-channel":`
|
|
8575
|
-
Make a room from bots, by name or id.`,"set-model":`
|
|
8576
|
-
Change an idle bot's model (or one idle conversation's, with --task).`,edit:`
|
|
8577
|
-
Rewrite an earlier message of yours and have the bot answer again from there.`,export:`
|
|
8573
|
+
${T2}`,"new-bot":`limixbot new-bot NAME [--title T] [--team T] [--model INSTANCE/MODEL] [--effort E]
|
|
8574
|
+
Make a bot.`,"new-channel":`limixbot new-channel NAME --members A,B [--team T]
|
|
8575
|
+
Make a room from bots, by name or id.`,"set-model":`limixbot set-model BOT --model INSTANCE/MODEL [--effort E] [--task ID] [--dry-run]
|
|
8576
|
+
Change an idle bot's model (or one idle conversation's, with --task).`,edit:`limixbot edit BOT --message ID (TEXT | --text TEXT) [--task ID] [--dry-run]
|
|
8577
|
+
Rewrite an earlier message of yours and have the bot answer again from there.`,export:`limixbot export TARGET --out DIR [--root ID] [--since MS] [--max-files 200] [--max-screens 100] [--max-bytes 500MB] [--force]
|
|
8578
8578
|
Write a conversation's job to DIR: the job tree, every transcript (secrets removed),
|
|
8579
8579
|
the files its replies link to, and screen captures. --root keeps one job.
|
|
8580
|
-
${T2}`,events:`
|
|
8580
|
+
${T2}`,events:`limixbot events [--thread ID]\u2026 [--job THREAD_ID [--until-settled]] [--kind K,\u2026] [--since CURSOR] [--screens] [--jsonl]
|
|
8581
8581
|
The server's live events, one JSON line each: messages, threads, bots and rooms, or the kinds --kind names
|
|
8582
8582
|
(--kind message,runtime adds token-level events to messages).
|
|
8583
|
-
--job follows the threads of one conversation's job; --until-settled ends with it.`,team:"
|
|
8583
|
+
--job follows the threads of one conversation's job; --until-settled ends with it.`,team:"limixbot team apply FILE | team export --out FILE (see help team apply, help team export)","team apply":`limixbot team apply FILE [--dry-run | --check] [--prune] [--rotate-secrets] [--wait-idle 2m]
|
|
8584
8584
|
Make the workspace match a team file (YAML or JSON): teams and briefs, bots, skills, Chiefs,
|
|
8585
8585
|
rooms and engines. Prints the plan, then applies it; a second apply prints "No changes.".
|
|
8586
8586
|
--dry-run only prints the plan; --check exits 6 if anything would change. --prune deletes bots
|
|
8587
8587
|
and rooms the file leaves out, in teams marked prune: true. Keys come from { env } or { file },
|
|
8588
|
-
and a key already set is kept unless --rotate-secrets. docs/headless-cli.md has the format.`,"team export":`
|
|
8588
|
+
and a key already set is kept unless --rotate-secrets. docs/headless-cli.md has the format.`,"team export":`limixbot team export [--team NAME]\u2026 --out FILE
|
|
8589
8589
|
Write the workspace (or some teams) as a team file; skills go beside it, keys as placeholders,
|
|
8590
|
-
and a key written into a soul, brief or skill is taken out.`,engine:"
|
|
8590
|
+
and a key written into a soul, brief or skill is taken out.`,engine:"limixbot engine set KIND \u2026 | engine list (see help engine set)","engine set":`limixbot engine set KIND (--key-env VAR | --key-file FILE) [--base-url URL] [--only-claude-api] [--install] [--rotate] [--dry-run]
|
|
8591
8591
|
Give the workspace an engine key: claude, openai, openrouter, openai-compatible, xai, groq, greenference, modelgo, mistral or cerebras.
|
|
8592
8592
|
The key is never printed. One already set is kept unless --rotate. --install installs the engine's
|
|
8593
8593
|
command if it is not running already, so a script can run this on every start.
|
|
8594
|
-
claude: the key runs every Claude bot; --only-claude-api keeps it to "Claude (API key)" bots.`,"engine list":`
|
|
8594
|
+
claude: the key runs every Claude bot; --only-claude-api keeps it to "Claude (API key)" bots.`,"engine list":`limixbot engine list
|
|
8595
8595
|
The engines, whether each is ready, and which keys are set (never their values).`,connect:`limixbot connect [URL] [--code CODE] --out FILE [--label NAME] [--client] [--force]
|
|
8596
8596
|
Get a token for a workspace you reach over the network, saved to FILE (only you can read it).
|
|
8597
8597
|
On this computer's own server the code is made for you; elsewhere, get one from Settings \u2192 Phone.
|
|
8598
|
-
Then use it: --url URL --token-file FILE (or OPENMAUSBOT_URL and OPENMAUSBOT_TOKEN).`,mcp:`
|
|
8599
|
-
Serve the Limix Bot MCP tools on stdin and stdout, for an agent (docs/mcp-server.md).`,token:"
|
|
8598
|
+
Then use it: --url URL --token-file FILE (or OPENMAUSBOT_URL and OPENMAUSBOT_TOKEN).`,mcp:`limixbot mcp
|
|
8599
|
+
Serve the Limix Bot MCP tools on stdin and stdout, for an agent (docs/mcp-server.md).`,token:"limixbot token create NAME --out FILE \u2026 | token list | token revoke ID (see help token create)","token create":`limixbot token create NAME --out FILE [--scope client|admin] [--expires 90d] [--force]
|
|
8600
8600
|
An access token for CI and scripts, saved to FILE (only you can read it) and never printed.
|
|
8601
8601
|
It ends on its date (--expires, at most the server's session limit: 180 days unless OMB_SESSION_MAX_DAYS)
|
|
8602
8602
|
and never renews. --scope client (the default) can chat and answer approvals; admin can change settings.
|
|
8603
|
-
Then: --url URL --token-file FILE. It is listed with
|
|
8604
|
-
The access tokens, their scope, when each ends and when it was last used (never the token).`,"token revoke":`
|
|
8605
|
-
End an access token at once (
|
|
8603
|
+
Then: --url URL --token-file FILE. It is listed with limixbot sessions too.`,"token list":`limixbot token list
|
|
8604
|
+
The access tokens, their scope, when each ends and when it was last used (never the token).`,"token revoke":`limixbot token revoke ID
|
|
8605
|
+
End an access token at once (limixbot token list shows the ids).`},VERBS2={doctor,bots:list3,channels:list3,models:list3,messages,send,"send-channel":send,run:runVerb,wait:waitVerb,interrupt,"new-bot":newBot,"new-channel":newChannel,"set-model":setModel,edit,export:exportVerb,events:eventsVerb,"team apply":teamApplyVerb,"team export":teamExportVerb,"engine set":engineVerb,"engine list":engineVerb,connect:connectVerb,"token create":tokenVerb,"token list":tokenVerb,"token revoke":tokenVerb};STOPS_WAITING_ON_CTRL_C=
|
|
8606
8606
|
new Set(["run","wait","events"])}});import{spawn as spawn11}from"node:child_process";import{randomBytes as randomBytes11}from"node:crypto";import{closeSync as closeSync18,existsSync as existsSync44,mkdirSync as mkdirSync47,openSync as openSync17,readFileSync as readFileSync68}from"node:fs";import{homedir as homedir33}from"node:os";import{dirname as dirname43,join as join109,resolve as resolve35}from"node:path";import{createInterface as createInterface2}from"node:readline/promises";import{fileURLToPath as fileURLToPath3}from"node:url";var B64U_FIELD=/^[A-Za-z0-9_-]+$/,RELAY_HOST=/^relay[1-9][0-9]?\.openmausbot\.com$/;function encodePairingE2E(descriptor){if(!descriptor||descriptor.v!==1||typeof descriptor.k!="string"||descriptor.k.length!==87||!B64U_FIELD.test(descriptor.k))return null;let relay=typeof descriptor.h=="string"&&Array.isArray(descriptor.r)&&descriptor.r.length>=1&&descriptor.r.length<=4&&descriptor.h.length===22&&B64U_FIELD.test(descriptor.h)&&descriptor.r.every(node3=>RELAY_HOST.test(node3))?{h:descriptor.h,r:descriptor.
|
|
8607
8607
|
r}:{},json3=JSON.stringify({v:1,k:descriptor.k,...relay}),encoded=btoa(json3).replaceAll("+","-").replaceAll("/","_").replace(/=+$/,"");return encoded.length<=1024?encoded:null}var MAX_PAIRING_HOSTS=8,ENDPOINT_KINDS=new Set(["hosted","tailnet","lan","bonjour"]);function qrEndpoints(endpoints){let seen=new Set,valid=[];for(let endpoint of endpoints??[])if(!(!endpoint||!ENDPOINT_KINDS.has(endpoint.kind)||!Number.isInteger(endpoint.priority)||endpoint.priority<0||endpoint.priority>1e6))try{let parsed=new URL(
|
|
8608
8608
|
endpoint.url),expectedProtocol=endpoint.kind==="hosted"?"https:":"http:",explicitPort=parsed.port?Number(parsed.port):null,hostname6=parsed.hostname.toLowerCase().replace(/\.$/,"");if(parsed.protocol!==expectedProtocol||hostname6.split(".").includes("")||endpoint.kind==="tailnet"&&!hostname6.endsWith(".ts.net")||explicitPort!==null&&(!Number.isInteger(explicitPort)||explicitPort<1||explicitPort>65535)||parsed.username||parsed.password||parsed.pathname!=="/"||parsed.search||parsed.hash||seen.has(
|
|
@@ -8733,9 +8733,9 @@ arm64":{name:`caddy_${CADDY_VERSION}_mac_arm64.tar.gz`,sha512:"3190ae0df98b59ab4
|
|
|
8733
8733
|
if(!dir)continue;let candidate=join4(dir,executable);if(exists(candidate))return candidate}return null}async function ensureCaddy(options2){let platform=options2.platform??process.platform,found=resolveCaddyBinary({dataDir:options2.dataDir,env:options2.env,platform,arch:options2.arch});if(found)return found;if(platform==="win32")throw new Error("--domain is not available on Windows yet; put your own HTTPS proxy in front (docs/self-hosting.md)");let target2=caddyTarget(platform,options2.arch),asset=options2.
|
|
8734
8734
|
asset??CADDY_ASSETS[target2];if(!asset)throw new Error(`Caddy publishes no build for ${target2}`);let destination=pinnedCaddyPath(options2.dataDir,platform,options2.arch),directory=join4(destination,"..");mkdirSync(directory,{recursive:!0,mode:448});let url3=asset.url??`https://github.com/caddyserver/caddy/releases/download/v${CADDY_VERSION}/${asset.name}`;options2.log?.(`downloading Caddy ${CADDY_VERSION} once (about 15 MB, digest pinned) into ${directory}`);let controller=new AbortController,timer2=setTimeout(
|
|
8735
8735
|
()=>controller.abort(),DOWNLOAD_TIMEOUT_MS);timer2.unref?.();let body;try{let response=await(options2.fetchImpl??fetch)(url3,{redirect:"follow",signal:controller.signal});if(!response.ok)throw new Error(`the Caddy download failed (HTTP ${response.status})`);body=Buffer.from(await response.arrayBuffer())}finally{clearTimeout(timer2)}if(createHash("sha512").update(body).digest("hex")!==asset.sha512)throw new Error("the Caddy download failed its SHA-512 check; nothing was installed");let scratch=mkdtempSync(
|
|
8736
|
-
join4(tmpdir(),"
|
|
8737
|
-
|
|
8738
|
-
|
|
8736
|
+
join4(tmpdir(),"limix-caddy-"));try{let archive=join4(scratch,asset.name);if(writeFileSync2(archive,body,{mode:384}),spawnSync("tar",["-xzf",archive,"-C",scratch,"caddy"],{stdio:"ignore"}).status!==0)throw new Error("the Caddy archive could not be extracted (is `tar` installed?)");let staging=`${destination}.${randomBytes(6).toString("hex")}.part`;renameSync2(join4(scratch,"caddy"),staging),chmodSync(staging,493),renameSync2(staging,destination)}finally{rmSync(scratch,{recursive:!0,force:!0})}return destination}
|
|
8737
|
+
function caddyfileFor(input2){return["# Written by limixbot serve --domain. Edit the command, not this file.","{"," admin off"," log {"," level WARN"," }","}","",`${input2.domain} {`," encode zstd gzip",""," # Webhook ingress has its own per-hook secrets and is meant for third parties."," handle /hooks/* {",` reverse_proxy 127.0.0.1:${input2.webhookPort}`," }",""," handle {",` reverse_proxy 127.0.0.1:${input2.appPort} {`," # SSE: stream events as they arrive"," flush_interval -1"," }"," \
|
|
8738
|
+
}","}",""].join(`
|
|
8739
8739
|
`)}function portPermissionRefused(output2){return/permission denied|bind: operation not permitted|EACCES/i.test(output2)&&/:80|:443|listen/i.test(output2)}function portPermissionHint(binary2){return process.platform==="linux"?`Caddy may not bind ports 80 and 443 as this user. Grant it once with:
|
|
8740
8740
|
sudo setcap 'cap_net_bind_service=+ep' ${binary2}
|
|
8741
8741
|
then run the same command again. (A service unit can grant the same capability.)`:"Caddy may not bind ports 80 and 443 as this user. Run the server as an administrator, or put your own HTTPS proxy in front."}async function startCaddy(options2){let home2=join4(options2.dataDir,"caddy");mkdirSync(join4(home2,"data"),{recursive:!0,mode:448}),mkdirSync(join4(home2,"config"),{recursive:!0,mode:448});let configFile=join4(home2,"Caddyfile");writeFileSync2(configFile,caddyfileFor(options2),{mode:384});let child=spawn2(
|
|
@@ -8745,17 +8745,17 @@ options2.binary,["run","--config",configFile,"--adapter","caddyfile"],{env:{...o
|
|
|
8745
8745
|
`);throw new Error(`Caddy stopped right after starting (exit ${settled.code}).
|
|
8746
8746
|
${reason}`)}return{configFile,exited,stop:async()=>{child.exitCode!==null||child.signalCode!==null||(child.kill("SIGTERM"),await Promise.race([exited,new Promise(r2=>setTimeout(r2,5e3))]),child.exitCode===null&&child.signalCode===null&&child.kill("SIGKILL"))}}}function normalizeDomainOption(raw){let value=raw.trim().toLowerCase().replace(/^https?:\/\//,"").replace(/\/+$/,""),label2=/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/;return!value||value.length>253||!value.includes(".")||/[\s/:@?#]/.test(value)||
|
|
8747
8747
|
!value.split(".").every(part=>label2.test(part))?{error:"--domain takes a bare hostname such as maus.example.com"}:/(?:^|\.)(?:localhost|local|internal|invalid)$/.test(value)?{error:"--domain needs a public domain name that resolves to this machine"}:value}import{spawnSync as spawnSync2}from"node:child_process";import{existsSync as existsSync4,mkdirSync as mkdirSync2,readFileSync as readFileSync2,writeFileSync as writeFileSync3}from"node:fs";import{homedir as homedir3}from"node:os";import{dirname as dirname4,join as join7}from"node:path";import{homedir,userInfo}from"node:os";import{posix}from"node:path";var{basename:basename3,dirname:dirname2,join:join5}=posix,SYSTEMD_UNIT_NAME="openmausbot.service",LAUNCHD_LABEL="com.openmausbot.serve";function quoteSystemd(value){return/[\s"\\]/.test(value)?`"${value.replace(/[\\"]/g,"\\$&")}"`:value}function needsStripTypes(script){return script.endsWith(".ts")}function serviceCommand(spec){return[spec.node,...needsStripTypes(spec.script)?["--experimental-strip-types"]:[],spec.script,"serve",
|
|
8748
|
-
...spec.serveArgs]}function systemdUnit(spec){let lines2=["# Written by `
|
|
8748
|
+
...spec.serveArgs]}function systemdUnit(spec){let lines2=["# Written by `limixbot service install`. Re-run it to change the options.","[Unit]",`Description=Limix Bot${spec.label?` (${spec.label})`:""}`,"After=network-online.target","Wants=network-online.target","","[Service]","Type=simple",`User=${spec.user}`,`WorkingDirectory=${spec.home}`,`Environment=HOME=${spec.home}`,`Environment=OMB_DATA_DIR=${spec.dataDir}`,...spec.cliPrefix?[`Environment=${quoteSystemd(`OMB_CLI_PREFIX=${spec.cliPrefix}`)}`]:
|
|
8749
8749
|
[],`ExecStart=${serviceCommand(spec).map(quoteSystemd).join(" ")}`,"Restart=always","RestartSec=3","KillMode=mixed","TimeoutStopSec=30"];return spec.bindsLowPorts&&(lines2.push("# serve --domain: Caddy binds ports 80 and 443 without running as root."),lines2.push("AmbientCapabilities=CAP_NET_BIND_SERVICE"),lines2.push("CapabilityBoundingSet=CAP_NET_BIND_SERVICE")),lines2.push("","[Install]","WantedBy=multi-user.target",""),lines2.join(`
|
|
8750
8750
|
`)}function xml(value){return value.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function launchdPlist(spec){let args=serviceCommand(spec).map(arg=>` <string>${xml(arg)}</string>`).join(`
|
|
8751
8751
|
`);return['<?xml version="1.0" encoding="UTF-8"?>','<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">','<plist version="1.0">',"<dict>"," <key>Label</key>",` <string>${LAUNCHD_LABEL}</string>`," <key>ProgramArguments</key>"," <array>",args," </array>"," <key>EnvironmentVariables</key>"," <dict>"," <key>HOME</key>",` <string>${xml(spec.home)}</string>`," <key>OMB_DATA_DIR</key>",` <string>${xml(spec.dataDir)}</string>`,...spec.cliPrefix?[" \
|
|
8752
8752
|
<key>OMB_CLI_PREFIX</key>",` <string>${xml(spec.cliPrefix)}</string>`]:[]," <key>PATH</key>"," <string>/usr/local/bin:/opt/homebrew/bin:/usr/bin:/bin</string>"," </dict>"," <key>WorkingDirectory</key>",` <string>${xml(spec.home)}</string>`," <key>RunAtLoad</key>"," <true/>"," <key>KeepAlive</key>"," <true/>"," <key>StandardOutPath</key>",` <string>${xml(join5(spec.dataDir,"logs","service.log"))}</string>`," <key>StandardErrorPath</key>",` <string>${xml(join5(spec.dataDir,"logs","service.log"))}\
|
|
8753
8753
|
</string>`,"</dict>","</plist>",""].join(`
|
|
8754
|
-
`)}function unstableInstallWarning(script){let normalized=script.replace(/\\/g,"/");return/\/_npx\//.test(normalized)||/\/\.npm\/_npx\//.test(normalized)?`this command runs from an npx cache (${dirname2(script)}), which npm may delete at any time. Install it permanently first (npm install -g
|
|
8754
|
+
`)}function unstableInstallWarning(script){let normalized=script.replace(/\\/g,"/");return/\/_npx\//.test(normalized)||/\/\.npm\/_npx\//.test(normalized)?`this command runs from an npx cache (${dirname2(script)}), which npm may delete at any time. Install it permanently first (npm install -g limixbot) and run \`limixbot service install\` from that install.`:null}function servicePlan(platform,dataDir,home2=homedir()){if(platform==="linux"){let installed=`/etc/systemd/system/${SYSTEMD_UNIT_NAME}`;
|
|
8755
8755
|
return{file:join5(dataDir,SYSTEMD_UNIT_NAME),installed,activate:[`sudo install -m 644 ${join5(dataDir,SYSTEMD_UNIT_NAME)} ${installed}`,"sudo systemctl daemon-reload",`sudo systemctl enable --now ${basename3(SYSTEMD_UNIT_NAME,".service")}`],deactivate:[`sudo systemctl disable --now ${basename3(SYSTEMD_UNIT_NAME,".service")}`,`sudo rm ${installed}`,"sudo systemctl daemon-reload"]}}if(platform==="darwin"){let installed=join5(home2,"Library","LaunchAgents",`${LAUNCHD_LABEL}.plist`);return{file:join5(
|
|
8756
8756
|
dataDir,`${LAUNCHD_LABEL}.plist`),installed,activate:[`mkdir -p ${dirname2(installed)} && cp ${join5(dataDir,`${LAUNCHD_LABEL}.plist`)} ${installed}`,`launchctl bootstrap gui/$(id -u) ${installed}`],deactivate:[`launchctl bootout gui/$(id -u)/${LAUNCHD_LABEL}`,`rm ${installed}`]}}return null}var SENTINEL_LAUNCHD_LABEL="com.openmausbot.sentinel",SENTINEL_SYSTEMD_NAME="openmausbot-sentinel",SENTINEL_INTERVAL_SECONDS=120;function shippedSentinelCli(platform,home2,exists,hasSentinel=()=>!0){return(platform===
|
|
8757
|
-
"darwin"?["/Applications/
|
|
8758
|
-
-
|
|
8757
|
+
"darwin"?["/Applications/Limix Bot.app",join5(home2,"Applications","Limix Bot.app")].map(app=>({node:join5(app,"Contents","MacOS","Limix Bot"),script:join5(app,"Contents","Resources","server","limixbot.js")})):platform==="linux"?[{node:"/opt/OpenMausBot/openmausbot",script:"/opt/OpenMausBot/resources/server/limixbot.js"}]:[]).find(cli=>exists(cli.node)&&exists(cli.script)&&hasSentinel(cli.script))??null}function sentinelCommand(spec){return[spec.node,...needsStripTypes(spec.script)?["--experimen\
|
|
8758
|
+
tal-strip-types"]:[],spec.script,"sentinel","--once","--data-dir",spec.dataDir,"--out",spec.out]}function shellArg(value){return/^[\w@%+=:,./~-]+$/.test(value)?value:`'${value.replace(/'/g,"'\\''")}'`}function sentinelLaunchdPlist(spec){for(let[label2,value]of[["home",spec.home],["node",spec.node],["script",spec.script],["data dir",spec.dataDir],["output",spec.out]])assertUnitValue(label2,value);let args=sentinelCommand(spec).map(arg=>` <string>${xml(arg)}</string>`).join(`
|
|
8759
8759
|
`),log2=xml(join5(spec.out,"sentinel.log"));return['<?xml version="1.0" encoding="UTF-8"?>','<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">','<plist version="1.0">',"<dict>"," <key>Label</key>",` <string>${SENTINEL_LAUNCHD_LABEL}</string>`," <key>ProgramArguments</key>"," <array>",args," </array>"," <key>EnvironmentVariables</key>"," <dict>"," <key>HOME</key>",` <string>${xml(spec.home)}</string>`,...spec.electronRunAsNode?[" <key>ELECTR\
|
|
8760
8760
|
ON_RUN_AS_NODE</key>"," <string>1</string>"]:[]," </dict>"," <key>StartInterval</key>",` <integer>${SENTINEL_INTERVAL_SECONDS}</integer>`," <key>RunAtLoad</key>"," <true/>"," <key>ProcessType</key>"," <string>Background</string>"," <key>LowPriorityIO</key>"," <true/>"," <key>StandardOutPath</key>",` <string>${log2}</string>`," <key>StandardErrorPath</key>",` <string>${log2}</string>`,"</dict>","</plist>",""].join(`
|
|
8761
8761
|
`)}function assertUnitValue(label2,value){if(/[\r\n\0]/.test(value))throw new Error(`the ${label2} path contains a line break or NUL, which a service file cannot hold; choose a path without one`)}function systemdQuoted(value,command=!1){let escaped2=value.replace(/[\\"]/g,"\\$&").replace(/%/g,"%%");return`"${command?escaped2.replace(/\$/g,"$$$$"):escaped2}"`}function sentinelSystemdService(spec){for(let[label2,value]of[["home",spec.home],["node",spec.node],["script",spec.script],["data dir",spec.
|
|
@@ -8766,24 +8766,24 @@ dataDir],["output",spec.out]])assertUnitValue(label2,value);return["# Written by
|
|
|
8766
8766
|
`systemctl --user disable --now ${SENTINEL_SYSTEMD_NAME}.timer`,`rm ${files.map(file2=>shellArg(file2.installed)).join(" ")}`,"systemctl --user daemon-reload"]}}if(platform==="darwin"){let name=`${SENTINEL_LAUNCHD_LABEL}.plist`,installed=join5(home2,"Library","LaunchAgents",name);return{files:[{name,installed}],activate:[`mkdir -p ${shellArg(dirname2(installed))} && cp ${shellArg(join5(out,name))} ${shellArg(installed)}`,`launchctl bootstrap gui/$(id -u) ${shellArg(installed)}`],deactivate:[`lau\
|
|
8767
8767
|
nchctl bootout gui/$(id -u)/${SENTINEL_LAUNCHD_LABEL}`,`rm ${shellArg(installed)}`]}}return null}function sentinelUnitCommand(text13){let args,plist=/<key>ProgramArguments<\/key>\s*<array>([\s\S]*?)<\/array>/.exec(text13);if(plist)args=[...plist[1].matchAll(/<string>([\s\S]*?)<\/string>/g)].map(m3=>m3[1].replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&"));else{let exec2=/^ExecStart=(.*)$/m.exec(text13);if(!exec2)return null;args=[...exec2[1].matchAll(/"((?:[^"\\]|\\.)*)"|(\S+)/g)].map(
|
|
8768
8768
|
m3=>m3[1]!==void 0?m3[1].replace(/\\(.)/g,"$1").replace(/%%/g,"%").replace(/\$\$/g,"$"):m3[2])}let at2=args.indexOf("sentinel");return at2>=2?{node:args[0],script:args[at2-1]}:null}function checkSentinelInstall(platform,home2,fs4){let plan=sentinelServicePlan(platform,"",home2);if(!plan)return{status:"unsupported"};let unit=plan.files[0].installed;if(!fs4.exists(unit))return{status:"not_installed",unit};let command;try{command=sentinelUnitCommand(fs4.read(unit))}catch{command=null}if(!command)return{
|
|
8769
|
-
status:"unreadable",unit};let missing=[command.node,command.script,...plan.files.slice(1).map(file2=>file2.installed)].filter(path3=>!fs4.exists(path3));return missing.length?{status:"stale",unit,...command,missing}:{status:"ok",unit,...command}}function currentUser(){try{return userInfo().username}catch{return process.env.USER||process.env.USERNAME||"openmausbot"}}import{createHash as createHash2}from"node:crypto";import{existsSync as existsSync3,realpathSync}from"node:fs";import{homedir as homedir2}from"node:os";import{basename as basename4,dirname as dirname3,join as join6,posix as posix2,resolve as resolve2,win32}from"node:path";var FOLDER="
|
|
8769
|
+
status:"unreadable",unit};let missing=[command.node,command.script,...plan.files.slice(1).map(file2=>file2.installed)].filter(path3=>!fs4.exists(path3));return missing.length?{status:"stale",unit,...command,missing}:{status:"ok",unit,...command}}function currentUser(){try{return userInfo().username}catch{return process.env.USER||process.env.USERNAME||"openmausbot"}}import{createHash as createHash2}from"node:crypto";import{existsSync as existsSync3,realpathSync}from"node:fs";import{homedir as homedir2}from"node:os";import{basename as basename4,dirname as dirname3,join as join6,posix as posix2,resolve as resolve2,win32}from"node:path";var FOLDER="limixbot-sentinel";function defaultSentinelOut(dataDir,platform=process.platform,home2=homedir2(),env=process.env){let path3=platform==="win32"?win32:posix2,state=env.XDG_STATE_HOME&&path3.isAbsolute(env.XDG_STATE_HOME)?
|
|
8770
8770
|
env.XDG_STATE_HOME:path3.join(home2,".local","state"),base2=platform==="darwin"?path3.join(home2,"Library","Application Support",FOLDER):platform==="win32"?path3.join(env.LOCALAPPDATA||path3.join(home2,"AppData","Local"),FOLDER):path3.join(state,FOLDER),resolved2=path3.resolve(dataDir);return resolved2===path3.join(home2,".limixbot")?base2:path3.join(base2,`data-${createHash2("sha256").update(resolved2).digest("hex").slice(0,12)}`)}function resolveThroughLinks(path3){let missing=[],current=resolve2(
|
|
8771
8771
|
path3);for(;;)try{return join6(realpathSync(current),...missing.reverse())}catch{let parent=dirname3(current);if(parent===current)return resolve2(path3);missing.push(basename4(current)),current=parent}}function enclosingRepo(dir){for(let current=dir;;current=dirname3(current)){if(existsSync3(join6(current,".git")))return current;if(dirname3(current)===current)return null}}function outRefusal(out,dataDir){let target2=resolveThroughLinks(out),repo=enclosingRepo(target2);return repo?`refusing to wr\
|
|
8772
8772
|
ite issues inside the git repository at ${repo}; pass --out with a folder outside it`:isInside(target2,resolveThroughLinks(dataDir))?`refusing to write issues inside the data dir ${dataDir}; leave out --out for the default, or pass a folder outside it`:null}function isInside(child,parent,platform=process.platform){let path3=platform==="win32"?win32:posix2,relative12=path3.relative(path3.resolve(parent),path3.resolve(child));return relative12===""||!relative12.startsWith("..")&&!path3.isAbsolute(
|
|
8773
8773
|
relative12)}init_cli_invocation();function serviceServeArgs(input2){let args=["--port",String(input2.port),"--data-dir",input2.dataDir];return input2.domain?args.push("--domain",input2.domain):input2.tunnel?args.push("--tunnel"):input2.tailscale&&args.push("--tailscale"),input2.publicUrl&&!input2.domain&&!input2.tunnel&&args.push("--public-url",input2.publicUrl),input2.lan&&args.push("--lan"),input2.relay&&!input2.tunnel&&args.push("--relay"),input2.label&&args.push("--label",input2.label),args}function runServiceCommand(input2,io2){
|
|
8774
8774
|
let platform=input2.platform??process.platform,home2=input2.home??homedir3();if(input2.sentinel)return runSentinelService(input2,platform,home2,io2);let plan=servicePlan(platform,input2.dataDir,home2);if(!plan)return io2.error("services are written for Linux (systemd) and macOS (launchd); on Windows, use Task Scheduler to run `limixbot serve` at startup"),1;if(input2.action==="uninstall"){io2.log("to stop and remove the service:");for(let line3 of plan.deactivate)io2.log(` ${line3}`);return 0}let script=input2.
|
|
8775
|
-
script;if(unstableInstallWarning(script)){let pinned=pinnedCopy(input2,io2);if(!pinned)return 1;script=pinned}let spec={node:input2.node,script,serveArgs:serviceServeArgs(input2),dataDir:input2.dataDir,user:input2.user??currentUser(),home:home2,bindsLowPorts:!!input2.domain,...input2.label?{label:input2.label}:{},...script!==input2.script?{cliPrefix:"npx
|
|
8775
|
+
script;if(unstableInstallWarning(script)){let pinned=pinnedCopy(input2,io2);if(!pinned)return 1;script=pinned}let spec={node:input2.node,script,serveArgs:serviceServeArgs(input2),dataDir:input2.dataDir,user:input2.user??currentUser(),home:home2,bindsLowPorts:!!input2.domain,...input2.label?{label:input2.label}:{},...script!==input2.script?{cliPrefix:"npx limixbot"}:{}},rendered=platform==="darwin"?launchdPlist(spec):systemdUnit(spec);mkdirSync2(input2.dataDir,{recursive:!0,mode:448}),writeFileSync3(
|
|
8776
8776
|
plan.file,rendered,{mode:420}),io2.log(`wrote ${plan.file}`),io2.log(""),io2.log(platform==="darwin"?"to install and start it (runs at login):":"to install and start it (runs at boot, restarts if it stops):");for(let line3 of plan.activate)io2.log(` ${line3}`);return io2.log(""),input2.domain&&platform==="linux"&&io2.log("the unit grants Caddy the capability for ports 80 and 443, so no setcap is needed under the service"),io2.log(`logs: ${platform==="darwin"?`${input2.dataDir}/logs/service.log`:
|
|
8777
8777
|
"journalctl -u openmausbot -f"}`),io2.log(`change options later by running \`${cliCommand("service install")}\` again with the new ones, then: ${platform==="darwin"?plan.activate[1]:"sudo systemctl daemon-reload && sudo systemctl restart openmausbot"}`),0}function pinnedCopy(input2,io2){let version2;try{version2=JSON.parse(readFileSync2(join7(dirname4(input2.script),"..","package.json"),"utf8")).version}catch{version2=void 0}let prefix=join7(input2.dataDir,"app",version2??"latest"),command=`npm \
|
|
8778
|
-
install --prefix ${prefix}
|
|
8779
|
-
|
|
8778
|
+
install --prefix ${prefix} limixbot@${version2??"latest"}`;io2.log(`this run comes from npx's cache, which npm prunes: installing limixbot ${version2??""} into ${prefix} for the service`.replace(" "," "));let installed=(input2.installCopy??installWithNpm)(prefix,version2??"latest"),script=join7(prefix,"node_modules","limixbot","dist-server","limixbot.js");return installed&&(input2.exists??existsSync4)(script)?script:(io2.error(`could not install that copy. Run this, then the same service instal\
|
|
8779
|
+
l command again from it:
|
|
8780
8780
|
${command}
|
|
8781
|
-
node ${script} service install \u2026`),null)}function installWithNpm(prefix,version2){mkdirSync2(prefix,{recursive:!0,mode:448});let npm=process.platform==="win32"?"npm.cmd":"npm";return spawnSync2(npm,["install","--prefix",prefix,`
|
|
8781
|
+
node ${script} service install \u2026`),null)}function installWithNpm(prefix,version2){mkdirSync2(prefix,{recursive:!0,mode:448});let npm=process.platform==="win32"?"npm.cmd":"npm";return spawnSync2(npm,["install","--prefix",prefix,`limixbot@${version2}`,"--no-audit","--no-fund"],{stdio:"inherit"}).status===0}function bundleHasSentinel(script){try{return readFileSync2(script,"utf8").includes("--check-install")}catch{return!1}}function runSentinelService(input2,platform,home2,io2){let out=input2.
|
|
8782
8782
|
sentinelOut??defaultSentinelOut(input2.dataDir,platform,home2,input2.env??process.env),plan=sentinelServicePlan(platform,out,home2);if(!plan){let command=sentinelCommand({...input2,out}).map(arg=>`\\"${arg}\\"`).join(" ");return io2.error("services are written for Linux (systemd) and macOS (launchd); on Windows, use Task Scheduler to run Sentinel every two minutes:"),io2.error(` schtasks /Create /SC MINUTE /MO 2 /TN "Limix Bot Sentinel" /TR "${command}"`),1}if(input2.action==="uninstall"){io2.log(
|
|
8783
8783
|
"to stop and remove the Sentinel schedule:");for(let line3 of plan.deactivate)io2.log(` ${line3}`);return 0}let refusal3=outRefusal(out,input2.dataDir);if(refusal3)return io2.error(refusal3),1;let shipped=shippedSentinelCli(platform,home2,input2.exists??existsSync4,input2.hasSentinel??bundleHasSentinel);if(!shipped){let warning=unstableInstallWarning(input2.script);if(warning)return io2.error(warning),1}let spec=shipped?{...shipped,electronRunAsNode:!0,dataDir:input2.dataDir,home:home2,out}:{node:input2.
|
|
8784
8784
|
node,script:input2.script,dataDir:input2.dataDir,home:home2,out};io2.log(shipped?`runs the desktop app's own CLI: ${shipped.script}`:`runs ${input2.script} with ${input2.node}; if either moves (a new checkout, a Node upgrade), run this again`);let rendered;try{rendered=platform==="darwin"?{[plan.files[0].name]:sentinelLaunchdPlist(spec)}:{[plan.files[0].name]:sentinelSystemdService(spec),[plan.files[1].name]:sentinelSystemdTimer()}}catch(error62){return io2.error(error62 instanceof Error?error62.
|
|
8785
8785
|
message:String(error62)),1}mkdirSync2(out,{recursive:!0,mode:448});for(let file2 of plan.files)writeFileSync3(join7(out,file2.name),rendered[file2.name],{mode:420}),io2.log(`wrote ${join7(out,file2.name)}`);io2.log(""),io2.log("to install it (a read-only health scan every two minutes, at login and after):");for(let line3 of plan.activate)io2.log(` ${line3}`);return io2.log(""),io2.log(`issues: ${join7(out,"issues.jsonl")}`),io2.log(`logs: ${platform==="darwin"?join7(out,"sentinel.log"):"journal\
|
|
8786
|
-
ctl --user -u openmausbot-sentinel"}`),io2.log("after an app update or a Node upgrade, check the schedule still points at both:
|
|
8786
|
+
ctl --user -u openmausbot-sentinel"}`),io2.log("after an app update or a Node upgrade, check the schedule still points at both: limixbot sentinel --check-install"),0}import{existsSync as existsSync6,readFileSync as readFileSync5,statSync as statSync3}from"node:fs";import{homedir as homedir4}from"node:os";import{join as join11,resolve as resolve3}from"node:path";import{createHash as createHash4}from"node:crypto";import{readdirSync as readdirSync2,statSync as statSync2}from"node:fs";import{join as join10}from"node:path";import{createHash as createHash3}from"node:crypto";var MAX_TEXT=240;function normalizeSignatureText(text13){return text13.replace(/"[^"\n]*"|(?<![\w])'[^'\n]*'(?![\w])|`[^`\n]*`/g,"<q>").replace(/\b[a-z][a-z0-9+.-]*:\/\/\S+/gi,"<url>").replace(/\b[\w.+-]+@[\w-]+(?:\.[\w-]+)+\b/g,"<email>").replace(/\b[A-Za-z]:\\[^\s:]+/g,"<path>").replace(/(?:~|\.{1,2})?(?:\/[^\s/:'",)]+)+\/?/g,"<path>").replace(/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/gi,"<id>").replace(/\b(?=[0-9a-f]*\d)(?=[0-9a-f]*[a-f])[0-9a-f]{8,}\b/gi,
|
|
8787
8787
|
"<id>").replace(/\b[a-z]{1,6}[_-](?=[\w-]*\d)[\w-]{4,}\b/gi,"<id>").replace(/\b\d+(?:[.,:]\d+)*\b/g,"<n>").replace(/\s+/g," ").trim().slice(0,MAX_TEXT)}var MAX_TITLE=160;function capTitle(title){return title.slice(0,MAX_TITLE)}var SHELL_ERROR_CLASSES=[[/\btimed?[ -]?out\b|\btimeout\b/i,"timed out"],[/command not found|is not recognized as an internal or external command/i,"command not found"],[/syntax error|unexpected token|unexpected EOF|parse error/i,"syntax error"],[/no such file or directory|\bENOENT\b|cannot find the path/i,
|
|
8788
8788
|
"no such file"],[/permission denied|\bEACCES\b/i,"permission denied"],[/operation not permitted|\bEPERM\b/i,"operation not permitted"],[/connection refused|could not resolve host|network is unreachable|\bECONNREFUSED\b|\bENOTFOUND\b/i,"network error"],[/out of memory|cannot allocate memory|\bENOMEM\b/i,"out of memory"],[/\bkilled\b|\bSIGKILL\b|\bSIGTERM\b|terminated by signal/i,"killed"],[/user (?:rejected|denied|doesn't want)|was denied|not allowed/i,"denied"]],EXIT_CODE=/\bexit(?:ed with)?(?: code| status)?\s*[:=]?\s*(-?\d+)/i;
|
|
8789
8789
|
function failureKey(tool,text13){if(toolOrigin(tool)==="shell"){let errorClass=SHELL_ERROR_CLASSES.find(([pattern])=>pattern.test(text13))?.[1],code=errorClass==="timed out"?void 0:EXIT_CODE.exec(text13)?.[1],title=[code!==void 0?`exit ${code}`:null,errorClass??(code===void 0?"failed":null)].filter(Boolean).join(": ");return{key:`${code??""}
|
|
@@ -8899,7 +8899,7 @@ workspace),mode:420},{kind:"run",argv:["systemctl","reload","caddy"],why:"serve
|
|
|
8899
8899
|
registry:registry2,steps:[{kind:"run",argv:["systemctl","disable","--now",`openmausbot@${workspace.slug}.service`],why:"stop the workspace"},{kind:"remove",path:join12(layout.caddyDir,`${workspace.slug}.caddy`)},{kind:"run",argv:["systemctl","reload","caddy"],why:"stop serving its address"},{kind:"remove",path:join12(layout.instancesDir,`${workspace.slug}.env`)},{kind:"remove",path:join12(unitsDir,`openmausbot@${workspace.slug}.service.d`,"limits.conf")},{kind:"write",path:layout.fenceFile,content:fenceRules(
|
|
8900
8900
|
Object.values(registry2.workspaces)),mode:384},{kind:"run",argv:["nft","-f",layout.fenceFile],why:input2.keepData?"keep the retained account's fence":"drop its fence rule"},...input2.keepData?[{kind:"note",text:"keeping the disabled workspace's account, home and name reserved; operator recovery is required before reuse"}]:[{kind:"run",argv:["userdel","--remove",fleetUser(workspace.slug)],why:"remove the account and everything it owned"}],{kind:"write",path:layout.registryFile,content:`${JSON.stringify(
|
|
8901
8901
|
registry2,null,2)}
|
|
8902
|
-
`,mode:384}]}}function upgradePlan(input2){let running4=Object.values(input2.registry.workspaces).filter(workspace=>workspace.status==="running").sort((a2,b3)=>a2.slug.localeCompare(b3.slug));return[{kind:"run",argv:["npm","install","-g","
|
|
8902
|
+
`,mode:384}]}}function upgradePlan(input2){let running4=Object.values(input2.registry.workspaces).filter(workspace=>workspace.status==="running").sort((a2,b3)=>a2.slug.localeCompare(b3.slug));return[{kind:"run",argv:["npm","install","-g","limixbot@latest"],why:"install the release every workspace runs from"},...running4.map(workspace=>({kind:"run",argv:["systemctl","restart",`openmausbot@${workspace.slug}.service`],why:`restart ${workspace.slug} on the new release`})),...running4.map(workspace=>({
|
|
8903
8903
|
kind:"health",url:`http://127.0.0.1:${workspace.port}/api/health`,why:`wait for ${workspace.slug}`}))]}function applySignIn(configText,action2,email3,chatOnly){let entry=email3.trim().toLowerCase();assertEmailOrDomain(entry);let raw={},parsed=JSON.parse(configText||"{}");parsed&&typeof parsed=="object"&&!Array.isArray(parsed)&&(raw={...parsed});let current=raw.signIn&&typeof raw.signIn=="object"?raw.signIn:{},list5=value=>Array.isArray(value)?value.map(item=>String(item).trim().toLowerCase()).filter(
|
|
8904
8904
|
Boolean):[],without=items=>items.filter(item=>item!==entry),admins=without(list5(current.admins)),members2=without(list5(current.members));if(action2==="remove"){if(admins.length+members2.length===list5(current.admins).length+list5(current.members).length)throw new Error(`${entry} is not on the list`);if(!admins.length)throw new Error("a workspace needs at least one admin; add another admin first");return{config:`${JSON.stringify({...raw,signIn:{admins,members:members2}},null,2)}
|
|
8905
8905
|
`,summary:`${entry} was removed from the allow-list; existing email sessions are rechecked against the remaining entries`}}let next=chatOnly?{admins,members:[...members2,entry]}:{admins:[...admins,entry],members:members2};if(!next.admins.length)throw new Error("a workspace needs at least one admin; add another admin first");return{config:`${JSON.stringify({...raw,signIn:next},null,2)}
|
|
@@ -9117,11 +9117,11 @@ return{error:"browser needs an action: install or status"};if(options2.command==
|
|
|
9117
9117
|
"users"&&!options2.fleetUserAction)return{error:"fleet users needs: NAME add|remove EMAIL [--chat-only]"};if(options2.cap!==void 0&&(!Number.isFinite(options2.cap)||options2.cap<0))return{error:"--cap must be a dollar amount of 0 or more"}}return options2}function defaultIo(){return{log:line3=>console.log(line3),error:line3=>console.error(line3),ask:async question=>{let rl=createInterface2({input:process.stdin,output:process.stdout});try{return await rl.question(question)}finally{rl.close()}}}}function serverVersion2(here=HERE2){
|
|
9118
9118
|
try{let parsed=JSON.parse(readFileSync68(resolve35(here,"..","package.json"),"utf8")),version2=typeof parsed=="object"&&parsed!==null?Reflect.get(parsed,"version"):void 0;return typeof version2=="string"&&version2?version2:"0.0.0"}catch{return"0.0.0"}}var message4=error62=>error62 instanceof Error?error62.message:String(error62),serveOwnerToken;async function api(port,path3,init={}){let headers={"content-type":"application/json","x-openmausbot-cli":"1",...serveOwnerToken?{"x-openmausbot-cli-owne\
|
|
9119
9119
|
r":serveOwnerToken}:{}},res=await fetch(`http://127.0.0.1:${port}${path3}`,{method:init.method,body:init.body,headers,signal:AbortSignal.timeout(3e3)}),body=await res.json().catch(()=>({}));return{status:res.status,body}}var SERVICE_TRUST_HELP="This server does not treat commands on this computer as its owner (OMB_LOOPBACK_TRUST=service, or a hosted workspace), so it will not pair devices or list sessions for them. Sign in as an admin and use Settings \u2192 Remote access, let people sign in with the\
|
|
9120
|
-
ir email (
|
|
9121
|
-
|
|
9122
|
-
|
|
9123
|
-
|
|
9124
|
-
|
|
9120
|
+
ir email (limixbot access add you@example.com), or restart the server with OMB_LOOPBACK_TRUST=owner.";function refusedAsService(status2,body){return status2===403&&typeof body?.error=="string"&&/shared server|Sign in through the workspace portal/.test(body.error)}async function serverUp(port,pid){try{let{status:status2,body}=await api(port,"/api/health");return status2===200&&body?.app==="openmausbot"&&(pid===void 0||body.pid===pid)}catch{return!1}}async function isWorkspaceRunning(options2){try{
|
|
9121
|
+
let{status:status2,body}=await api(options2.port,"/api/health");if(status2!==200||body?.app!=="openmausbot")return!1;let expected=readFileSync68(join109(options2.dataDir,"environment-id"),"utf8").trim(),descriptor=await api(options2.port,"/.well-known/openmausbot/environment");return/^[0-9a-f-]{36}$/i.test(expected)&&descriptor.status===200&&descriptor.body?.environmentId===expected}catch{return!1}}async function openDashboard(port,env=process.env){if(env.SSH_CONNECTION||env.SSH_TTY||process.platform===
|
|
9122
|
+
"linux"&&!env.DISPLAY&&!env.WAYLAND_DISPLAY)return!1;let url3=`http://127.0.0.1:${port}`,command=process.platform==="darwin"?"open":process.platform==="win32"?"rundll32.exe":"xdg-open",args=process.platform==="win32"?["url.dll,FileProtocolHandler",url3]:[url3];return new Promise(done=>{let child=spawn11(command,args,{stdio:"ignore",windowsHide:!0}),timer2=setTimeout(()=>{child.kill(),done(!1)},3e3);child.once("error",()=>{clearTimeout(timer2),done(!1)}),child.once("exit",code=>{clearTimeout(timer2),
|
|
9123
|
+
done(code===0)})})}var answersAsMausBot=async origin=>typeof(await fetch(`${origin}/.well-known/openmausbot/environment`,{signal:AbortSignal.timeout(3e3)}).then(r2=>r2.json()).catch(()=>null))?.environmentId=="string";async function verifyPhoneEndpoint(port,origin){return!!normalizePhoneOrigin(origin)&&(await checkReach(port,origin)).ok}function applyStartupPreferences(options2,saved){if(options2.local)return{...options2,tunnel:!1,tailscale:!1,publicUrl:void 0,phone:void 0};if(!saved||options2.tunnel||
|
|
9124
|
+
options2.tailscale||options2.publicUrl)return options2;if(options2.relay&&saved.access==="tunnel")throw new Error(RELAY_NOT_WITH_TUNNEL);if(saved.access==="public-url"&&(!saved.publicUrl||!normalizePhoneOrigin(saved.publicUrl)))throw new Error(`The saved phone address is not a valid HTTPS origin. Run ${cliCommand("setup")} to correct it, or ${cliCommand("--local")} to start only on this computer.`);return{...options2,tunnel:saved.access==="tunnel",tailscale:saved.access==="tailscale",publicUrl:saved.
|
|
9125
9125
|
access==="public-url"?saved.publicUrl:void 0,phone:saved.access==="local"?void 0:saved.phone}}function startupPreferences(options2){let access2=options2.local?"local":options2.tunnel?"tunnel":options2.tailscale?"tailscale":options2.publicUrl?"public-url":"local",publicUrl=access2==="public-url"?normalizePhoneOrigin(options2.publicUrl):null;if(access2==="public-url"&&!publicUrl)throw new Error("Use an HTTPS origin without a password, path or query for saved phone access. The address was not saved\
|
|
9126
9126
|
.");return{access:access2,...publicUrl?{publicUrl}:{},...!options2.local&&options2.phone?{phone:options2.phone}:{}}}async function showPhonePairing(options2,origin,log2){if(options2.relay)return showRelayPairing({tty:process.stdout.isTTY===!0,status:async()=>(await api(options2.port,"/api/auth/pairing")).body?.relay,mint:()=>mintPairing(options2.port,{client:!0,label:options2.label??(options2.phone==="android"?"Android":"iPhone / iPad"),phone:options2.phone??"ios"}),log:log2,prefix:cliPrefix()});
|
|
9127
9127
|
let ready=!!origin&&await verifyPhoneEndpoint(options2.port,origin);if(!ready)return log2("Phone access is not reachable yet. Limix Bot is ready on this computer; no phone pairing code was created."),log2(`Check the HTTPS connection, then run ${cliCommand("pair")} again with the same --data-dir and --port.`),!1;for(let line3 of phonePairingInstructions(options2.phone??"ios",{origin,ready}))log2(line3);return log2(await mintPairing(options2.port,{client:!0,label:options2.label??(options2.phone===
|
|
@@ -9140,10 +9140,10 @@ json&&fleetCredential()?io2.log(`Limix Bot web address: managed by the fleet (${
|
|
|
9140
9140
|
null||Array.isArray(parsed))throw new Error("not an object");raw=Object.fromEntries(Object.entries(parsed))}catch(error62){return io2.error(`${file2} could not be read (${message4(error62)}); fix it before changing who can sign in`),1}let current=typeof raw.signIn=="object"&&raw.signIn!==null?Object(raw.signIn):{},list5=value=>parseAllowList(Array.isArray(value)?value.map(String).join(","):""),admins=list5(Reflect.get(current,"admins")),members2=list5(Reflect.get(current,"members")),overridden=Object.
|
|
9141
9141
|
keys(signInFromEnv()).length>0,write=async next=>{if(mkdirSync47(options2.dataDir,{recursive:!0,mode:448}),writeFileAtomic(file2,`${JSON.stringify({...raw,signIn:next},null,2)}
|
|
9142
9142
|
`,{mode:384}),!sharedSignIn({admins,members:members2})&&!sharedSignIn(next)&&!hostedWorkspaceConfigured())return;let decisions=raw.decisions&&typeof raw.decisions=="object"?raw.decisions.retentionDays:void 0;bindDecisionRetention(()=>decisionRetentionDays(typeof decisions=="number"?decisions:void 0));let changed2=["admins","members"].filter(key2=>next[key2].join(",")!==(key2==="admins"?admins:members2).join(","));appendAdminAction(options2.dataDir,{category:"people",action:"people.update",target:{
|
|
9143
|
-
kind:"settings"},actor:{kind:"cli"},changed:changed2.map(key2=>`signIn.${key2}`),before:Object.fromEntries(changed2.map(key2=>[`signIn.${key2}`,key2==="admins"?admins:members2])),after:Object.fromEntries(changed2.map(key2=>[`signIn.${key2}`,next[key2]]))}),await flushAdminActivity(options2.dataDir)};if(options2.accessAction==="list"){if(!admins.length&&!members2.length)return io2.log("nobody can sign in with an email yet; pairing codes only. Add someone with:
|
|
9144
|
-
|
|
9145
|
-
|
|
9146
|
-
|
|
9143
|
+
kind:"settings"},actor:{kind:"cli"},changed:changed2.map(key2=>`signIn.${key2}`),before:Object.fromEntries(changed2.map(key2=>[`signIn.${key2}`,key2==="admins"?admins:members2])),after:Object.fromEntries(changed2.map(key2=>[`signIn.${key2}`,next[key2]]))}),await flushAdminActivity(options2.dataDir)};if(options2.accessAction==="list"){if(!admins.length&&!members2.length)return io2.log("nobody can sign in with an email yet; pairing codes only. Add someone with: limixbot access add you@example.com"),
|
|
9144
|
+
0;for(let entry2 of admins)io2.log(`${entry2.padEnd(40)} full access`);for(let entry2 of members2)io2.log(`${entry2.padEnd(40)} chat and approvals`);return overridden&&io2.log("(OMB_SIGNIN_EMAILS / OMB_SIGNIN_MEMBER_EMAILS are set in the environment and win over this list while the server runs)"),0}let entry=(options2.email??"").trim().toLowerCase();if(!entry||!entry.startsWith("@")&&!entry.includes("@")||/\s/.test(entry))return io2.error("give an email address, or @domain for everyone at that d\
|
|
9145
|
+
omain"),2;let without=items=>items.filter(item=>item!==entry);return options2.accessAction==="remove"?!admins.includes(entry)&&!members2.includes(entry)?(io2.error(`${entry} is not on the list`),1):(await write({admins:without(admins),members:without(members2)}),io2.log(`${entry} can no longer sign in (existing sessions stay until they expire or are revoked with ${cliCommand("devices revoke ID")})`),0):(await write(options2.chatOnly?{admins:without(admins),members:[...without(members2),entry]}:{
|
|
9146
|
+
admins:[...without(admins),entry],members:without(members2)}),io2.log(`${entry} can sign in at /pair with an emailed code (${options2.chatOnly?"chat and approvals":"full access"})`),overridden&&io2.log("note: OMB_SIGNIN_EMAILS / OMB_SIGNIN_MEMBER_EMAILS are set in the environment and win over this list while the server runs"),0)}async function runLogin(options2,io2=defaultIo()){let account2=createTunnelAccount({dataDir:options2.dataDir,version:serverVersion2(),relayOnly:options2.relay===!0});if(fleetCredential()&&
|
|
9147
9147
|
io2.log(`note: ${FLEET_CREDENTIAL_ENV} is set, so serve --tunnel will use that credential rather than this account`),account2.credentials.status==="unavailable")return io2.error(`${account2.credentials.file} exists but could not be read; fix or remove it, then try again`),1;if(!account2.controlPlane)return io2.error("OMB_CONTROL_PLANE_URL is set but is not an https address"),1;let existing=describeTunnelAccount(account2.credentials.read());existing.address&&io2.log(`already signed in as ${existing.
|
|
9148
9148
|
email??"?"} (${existing.address}); signing in again refreshes it`);let email3=(options2.email??await io2.ask("Email for your Limix Bot account: ")).trim();if(!email3)return io2.error(`an email address is needed: ${cliCommand("login --email you@example.com")}`),1;try{await account2.service.requestCode(email3)}catch(error62){return io2.error(`could not send a sign-in code: ${message4(error62)}`),1}let code=(await io2.ask(`Enter the 8-digit code we emailed to ${email3}: `)).trim(),state;try{state=await account2.
|
|
9149
9149
|
service.verifyCode(email3,code)}catch(error62){return io2.error(`sign-in failed: ${message4(error62)}`),1}let signedIn=describeTunnelAccount(account2.credentials.read());return!signedIn.address&&!(options2.relay&&signedIn.installationId)?(io2.error(`signed in, but no public address was issued${state.message?`: ${state.message}`:""}`),1):(io2.log(`Signed in as ${signedIn.email??email3}.`),io2.log(signedIn.address?`This machine's public address: ${signedIn.address}`:"No public address reserved: ph\
|
|
@@ -170,7 +170,7 @@ export function createBotApiHost(deps) {
|
|
|
170
170
|
}
|
|
171
171
|
catch (error) {
|
|
172
172
|
markRunning(botId, threadId, false);
|
|
173
|
-
if (opened)
|
|
173
|
+
if (opened && !channel?.delivery)
|
|
174
174
|
deps.discard?.(botId, threadId);
|
|
175
175
|
const busy = z.object({ code: z.enum(["thread_busy", "thread_limit"]) }).safeParse(error).success;
|
|
176
176
|
fail(busy ? 409 : 502, busy ? BUSY : COULD_NOT_ANSWER, error instanceof Error ? error.message : String(error));
|
|
@@ -207,18 +207,21 @@ export function createBotApiHost(deps) {
|
|
|
207
207
|
* Bot API caller, confined. Waits for the answer up to `waitMs`. */
|
|
208
208
|
async function askFromChannel(botId, input) {
|
|
209
209
|
const store = deps.store;
|
|
210
|
+
const savedTask = input.threadId ? store.taskByThread(botId, input.threadId) : undefined;
|
|
211
|
+
const channelThread = savedTask && Boolean(savedTask.botApi) === !input.owner ? savedTask.threadId : undefined;
|
|
212
|
+
if (deps.channelModelChanging?.(botId, channelThread))
|
|
213
|
+
failBeforeAcceptance("capacity_busy");
|
|
210
214
|
if (!input.owner) {
|
|
211
|
-
if (!
|
|
212
|
-
fail(
|
|
215
|
+
if (savedTask && !savedTask.botApi)
|
|
216
|
+
fail(404, "no such thread");
|
|
217
|
+
if (!deps.canConfine(botId, channelThread))
|
|
218
|
+
throw Object.assign(new Error(CANNOT_CONFINE), { status: 403, code: "guest_engine" });
|
|
213
219
|
let attachments = [];
|
|
214
|
-
const answer = await runCall(botId, { message: input.text, ...(
|
|
220
|
+
const answer = await runCall(botId, { message: input.text, ...(channelThread ? { thread: channelThread } : {}), wait: Math.round((input.waitMs ?? 600_000) / 1000) }, () => { }, { attachment: input.attachment, delivery: input.delivery, collect(files) { attachments = files; } });
|
|
215
221
|
const body = answer.body;
|
|
216
222
|
return { threadId: body.thread, ...(attachments.length ? { attachments } : {}), reply: body.reply ?? "", ...(body.status ? { status: body.status } : {}) };
|
|
217
223
|
}
|
|
218
|
-
let threadId =
|
|
219
|
-
const known = threadId ? store.taskByThread(botId, threadId) : undefined;
|
|
220
|
-
if (!known || known.botApi)
|
|
221
|
-
threadId = undefined;
|
|
224
|
+
let threadId = channelThread;
|
|
222
225
|
if (threadId && deps.threadBusy(botId, threadId))
|
|
223
226
|
failBeforeAcceptance("thread_busy");
|
|
224
227
|
if (!deps.canStart(botId, threadId ?? ""))
|
|
@@ -9,6 +9,7 @@ import { createCipheriv, createDecipheriv, createHash, randomBytes, timingSafeEq
|
|
|
9
9
|
import { mkdirSync, readFileSync } from "node:fs";
|
|
10
10
|
import { dirname, join } from "node:path";
|
|
11
11
|
import { z } from "zod";
|
|
12
|
+
import { redactSecretsInText } from "../../shared/redact.js";
|
|
12
13
|
import { retryableBusySchema } from "../bot-api.js";
|
|
13
14
|
import { writeFileAtomic } from "../atomic.js";
|
|
14
15
|
import { PASS } from "../routes/table.js";
|
|
@@ -77,6 +78,19 @@ const text = (label) => ({
|
|
|
77
78
|
failed: "Bot chưa trả lời được lúc này. Thử lại sau.",
|
|
78
79
|
empty: "Bot đã làm xong nhưng không có câu trả lời bằng chữ.",
|
|
79
80
|
});
|
|
81
|
+
function channelAiFailure(error, owner) {
|
|
82
|
+
const issue = z.object({ code: z.string().optional(), detail: z.string().optional() }).safeParse(error);
|
|
83
|
+
if (!issue.success)
|
|
84
|
+
return;
|
|
85
|
+
if (issue.data.code === "guest_engine" || /too old to run this turn without a shell|kept its shell, so it can.t run this turn/i.test(issue.data.detail ?? ""))
|
|
86
|
+
return "Mô hình đang chọn chưa hỗ trợ trò chuyện với khách trên kênh này. Hãy báo chủ bot chọn mô hình hỗ trợ quyền khách trong Limix Bot.";
|
|
87
|
+
if (!owner || !issue.data.detail)
|
|
88
|
+
return;
|
|
89
|
+
if (/not (?:logged|signed) in|sign[ -]?in required|sign in again|authentication required|invalid api key|unauthorized|unauthenticated/i.test(issue.data.detail))
|
|
90
|
+
return "Tài khoản AI của mô hình đang chọn cần xác thực. Mở Cài đặt → AI trong Limix Bot để kết nối lại, rồi gửi một tin nhắn mới.";
|
|
91
|
+
if (/model (?:not found|is unavailable)|provider instance .*unavailable|model_not_found/i.test(issue.data.detail))
|
|
92
|
+
return "Mô hình đã chọn hiện không khả dụng. Hãy chọn một mô hình đang hoạt động trong cài đặt của bot rồi gửi một tin nhắn mới.";
|
|
93
|
+
}
|
|
80
94
|
const ZALO_RECEIPT = /^(?:\*\*)?(?:(?:mình|tôi|em)\s+)?đã nhận(?: được)? tin nhắn(?:\s*[::]?\s+(?:“([^”\r\n]*)”|"([^"\r\n]*)"|'([^'\r\n]*)'|‘([^’\r\n]*)’)|(?: của bạn)?(?=\s*[.!。]|\s*$))\s*[.!。]?(?:\*\*)?\s*/iu;
|
|
81
95
|
function zaloGroupReply(reply, message, hasMedia) {
|
|
82
96
|
const receipt = ZALO_RECEIPT.exec(reply);
|
|
@@ -393,8 +407,9 @@ export function createBotChannels(deps) {
|
|
|
393
407
|
catch (error) {
|
|
394
408
|
if (signal.aborted)
|
|
395
409
|
return;
|
|
396
|
-
|
|
397
|
-
|
|
410
|
+
const detail = z.object({ detail: z.string() }).safeParse(error);
|
|
411
|
+
log(`${kind}: ${redactSecretsInText(detail.success ? detail.data.detail : failure(error)).slice(0, 600)}`);
|
|
412
|
+
result = { reply: channelAiFailure(error, owner) ?? (error === mediaUnavailable ? say.mediaFailed : say.failed) };
|
|
398
413
|
}
|
|
399
414
|
finally {
|
|
400
415
|
clearInterval(typing);
|
|
@@ -187,7 +187,7 @@ export async function captureFrame(ports, target) {
|
|
|
187
187
|
const probe = await ports.probe(target);
|
|
188
188
|
if (!probe?.connected)
|
|
189
189
|
throw new Error("the browser has no open page to picture");
|
|
190
|
-
const file = join(tmpdir(), `
|
|
190
|
+
const file = join(tmpdir(), `limixbot-browser-${randomUUID()}.jpg`);
|
|
191
191
|
try {
|
|
192
192
|
closeSync(openSync(file, "wx", 0o600));
|
|
193
193
|
let answer;
|
|
@@ -74,7 +74,7 @@ export async function ensureCaddy(options) {
|
|
|
74
74
|
const digest = createHash("sha512").update(body).digest("hex");
|
|
75
75
|
if (digest !== asset.sha512)
|
|
76
76
|
throw new Error("the Caddy download failed its SHA-512 check; nothing was installed");
|
|
77
|
-
const scratch = mkdtempSync(join(tmpdir(), "
|
|
77
|
+
const scratch = mkdtempSync(join(tmpdir(), "limix-caddy-"));
|
|
78
78
|
try {
|
|
79
79
|
const archive = join(scratch, asset.name);
|
|
80
80
|
writeFileSync(archive, body, { mode: 0o600 });
|