limixbot 0.3.76 → 0.3.78
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{ActivityPanel-D51A8W6A.js → ActivityPanel-BnOiDJ5j.js} +1 -1
- package/dist/assets/{App-DWJunNzC.js → App-Ccaik4nh.js} +107 -107
- package/dist/assets/{AppEventEditor-DSvbGdZZ.js → AppEventEditor-t6Av7NOE.js} +1 -1
- package/dist/assets/BotSettingsDialog-Jml7My-b.js +16 -0
- package/dist/assets/{BrowserPanel-DBYD2a8i.js → BrowserPanel-CUHJnE82.js} +1 -1
- package/dist/assets/{BrowserProfilesManager-DOqRoXSu.js → BrowserProfilesManager-CvbIsDm9.js} +1 -1
- package/dist/assets/{CloudAddDialog-DutvKPqy.js → CloudAddDialog-DpFQ_7c-.js} +1 -1
- package/dist/assets/{ComputerFilesPane-CnUIrfLS.js → ComputerFilesPane-BsensCvt.js} +1 -1
- package/dist/assets/{ComputerPanel-CFf7J7n8.js → ComputerPanel-B0ENHo46.js} +2 -2
- package/dist/assets/{DataPanel-DA0lRMkO.js → DataPanel-DV9mwPul.js} +1 -1
- package/dist/assets/{DesktopViewer-CTFtTJfc.js → DesktopViewer-DBMUDqPa.js} +1 -1
- package/dist/assets/{FilesView-vNL3-JAH.js → FilesView-DSu7yrZA.js} +1 -1
- package/dist/assets/{GrokMoveDialog-C_uh53eb.js → GrokMoveDialog-CMj6Emru.js} +1 -1
- package/dist/assets/{InspectorPanel-oXXogL4o.js → InspectorPanel-B3w6Y4qG.js} +1 -1
- package/dist/assets/{KeyboardShortcutsModal-BkX9TS9G.js → KeyboardShortcutsModal-CfT-uwtU.js} +1 -1
- package/dist/assets/{LiveDesktop-BQHz5zXv.js → LiveDesktop-4eCmERzA.js} +1 -1
- package/dist/assets/{LocalVmWorkspace-DvSPojv9.js → LocalVmWorkspace-BXoiFCe0.js} +1 -1
- package/dist/assets/{MacLocalControl-uRhkVesD.js → MacLocalControl-BTRCF43R.js} +1 -1
- package/dist/assets/{MarkdownFilePreview-Je1rsP_8.js → MarkdownFilePreview-tqpO-D4N.js} +1 -1
- package/dist/assets/{MenuMotion-CFF-RIXJ.js → MenuMotion-CcuJn489.js} +1 -1
- package/dist/assets/{NewBotDialog-CrNc5bA_.js → NewBotDialog-BqKNU097.js} +1 -1
- package/dist/assets/{PhoneAppDialog-3on7O9lw.js → PhoneAppDialog-PS1bI6g8.js} +1 -1
- package/dist/assets/{PlacesRail-ELI3T2sc.js → PlacesRail-CRmtzh8u.js} +1 -1
- package/dist/assets/{PluginsPanel-DXIK_N_c.js → PluginsPanel-D4i3zwIA.js} +1 -1
- package/dist/assets/{ProIntroduction-Bj1j3IMF.js → ProIntroduction-C85_XeHC.js} +1 -1
- package/dist/assets/{RemoteAgentSettingsPanel-B9FbziLP.js → RemoteAgentSettingsPanel-SPgwuyfq.js} +1 -1
- package/dist/assets/{RoomPanel-CV6m2Qbs.js → RoomPanel-CbThf0I_.js} +1 -1
- package/dist/assets/{RoutinesPage-DqBcn9fe.js → RoutinesPage-C6ZnktBj.js} +1 -1
- package/dist/assets/{SettingsModal-Bkz83DkE.js → SettingsModal-KBR5RjPM.js} +4 -4
- package/dist/assets/{ShareTeamDialog-BaW1bVZ2.js → ShareTeamDialog-eZaDlKv5.js} +1 -1
- package/dist/assets/{SignedInSites-C0ltccGF.js → SignedInSites-DVavgFc_.js} +1 -1
- package/dist/assets/{TeamLibraryPanel-Dv2YvAM3.js → TeamLibraryPanel-B0T8855p.js} +1 -1
- package/dist/assets/{TeamMapPage-ChUId2CS.js → TeamMapPage-BKdlnyWn.js} +1 -1
- package/dist/assets/{TriggersPage-BZ0zXv9m.js → TriggersPage-XQBMC0K2.js} +1 -1
- package/dist/assets/{VisibilitySection-B06HHo8h.js → VisibilitySection-B8j0l2xI.js} +1 -1
- package/dist/assets/{WebhookTrigger-C_l4rsXp.js → WebhookTrigger-CKy1qshB.js} +1 -1
- package/dist/assets/{WorksOnGrid-CccIOj5Z.js → WorksOnGrid-UmXQc8fl.js} +1 -1
- package/dist/assets/{abnfDiagram-YUKMZFIV-DResobc1.js → abnfDiagram-YUKMZFIV-65Eq1Je6.js} +1 -1
- package/dist/assets/{activity-BeWN6iFt.js → activity-ZDWVxHRW.js} +1 -1
- package/dist/assets/{architectureDiagram-47P4ROYG-EW6tDndT.js → architectureDiagram-47P4ROYG-DrG8Yma0.js} +1 -1
- package/dist/assets/{blockDiagram-E7TT5TSB-BWNZq_iK.js → blockDiagram-E7TT5TSB-D54NTWSM.js} +1 -1
- package/dist/assets/{c4Diagram-CRA5TL53-a8kJFvOi.js → c4Diagram-CRA5TL53-3og_-YU_.js} +1 -1
- package/dist/assets/{calendar-days-CKIODWyG.js → calendar-days-BMi-5cJi.js} +1 -1
- package/dist/assets/channel-BhUqydpo.js +1 -0
- package/dist/assets/{chunk-2Q5K7J3B-BAlLffB5.js → chunk-2Q5K7J3B-r3qgqOqv.js} +1 -1
- package/dist/assets/{chunk-5VM5RSS4-u-n_0A16.js → chunk-5VM5RSS4-DR43CCkD.js} +1 -1
- package/dist/assets/{chunk-7TKQ45FW-Dje2HIYG.js → chunk-7TKQ45FW-Cjbd6ZLp.js} +1 -1
- package/dist/assets/{chunk-AW2ZBBNX-CTv2QYrQ.js → chunk-AW2ZBBNX-CmpcWqjE.js} +1 -1
- package/dist/assets/{chunk-FVRAUYC3-CeRufprs.js → chunk-FVRAUYC3--y-kcX08.js} +2 -2
- package/dist/assets/{chunk-HTAEGDNF-BQOR0Oky.js → chunk-HTAEGDNF-dBj3y-VC.js} +1 -1
- package/dist/assets/{chunk-JWPE2WC7-BWUhUjQD.js → chunk-JWPE2WC7-B3uOSoFW.js} +1 -1
- package/dist/assets/{chunk-KQW6MTUR-M_Rw-e6l.js → chunk-KQW6MTUR-DfT1IF3I.js} +1 -1
- package/dist/assets/{chunk-XXDRQBXY-BF4xTAtp.js → chunk-XXDRQBXY-CygLCvpM.js} +1 -1
- package/dist/assets/{classDiagram-v2-K4WV4PDN-CcN7EMBJ.js → classDiagram-v2-K4WV4PDN-DGTDBVvN.js} +1 -1
- package/dist/assets/coins-2Ipg9jSL.js +1 -0
- package/dist/assets/{core-BBw5zec6.js → core-pfNd0qD5.js} +1 -1
- package/dist/assets/{cose-bilkent-JH36ORCC-B7mx7aiX.js → cose-bilkent-JH36ORCC-Bb0KgTtB.js} +1 -1
- package/dist/assets/{cynefin-EF2NZ3EQ-X7ROQUp4.js → cynefin-EF2NZ3EQ-qGBA_DIq.js} +1 -1
- package/dist/assets/{cynefinDiagram-3GCD6N5R-DH51LPlw.js → cynefinDiagram-3GCD6N5R-hF9YSVOq.js} +1 -1
- package/dist/assets/{dagre-W4DXFKR2-BwLI0VKF.js → dagre-W4DXFKR2-3q_zIjPm.js} +1 -1
- package/dist/assets/{diagram-2UJZ2QOL-Bdzh5mWt.js → diagram-2UJZ2QOL-BOTHlOcq.js} +1 -1
- package/dist/assets/{diagram-OVF4WLC6-CO17M3Es.js → diagram-OVF4WLC6-Dnya3JUJ.js} +1 -1
- package/dist/assets/{diagram-PFPMY2P6-uH_rjKFV.js → diagram-PFPMY2P6-Bm2_1jj-.js} +1 -1
- package/dist/assets/{diagram-UMYRVEAY-9OZc7lRb.js → diagram-UMYRVEAY-CQrHk9Kj.js} +1 -1
- package/dist/assets/{diagram-YEKJPTXX-D1g5sKaj.js → diagram-YEKJPTXX-DLdp-cKw.js} +1 -1
- package/dist/assets/{diagram-ZIFT7M5P-Bf2C6qIK.js → diagram-ZIFT7M5P-C542U79M.js} +1 -1
- package/dist/assets/{ebnfDiagram-VR2GEFS7-KnLpOP-d.js → ebnfDiagram-VR2GEFS7-DsKKpNma.js} +1 -1
- package/dist/assets/{elk-IJKZMXRS-DgCQzgmR.js → elk-IJKZMXRS-DZL2zCKo.js} +1 -1
- package/dist/assets/{erDiagram-O2IAPWRE-BmD4mb98.js → erDiagram-O2IAPWRE-D4IGRyB_.js} +1 -1
- package/dist/assets/{file-up-DVBjkxkY.js → file-up-CZXyq-v_.js} +1 -1
- package/dist/assets/{flowDiagram-OXPTDLAJ-nDMx-HYJ.js → flowDiagram-OXPTDLAJ-xHZwGby9.js} +1 -1
- package/dist/assets/{ganttDiagram-R7TSEDQI-Dnb4ykwm.js → ganttDiagram-R7TSEDQI-eCuinfuc.js} +1 -1
- package/dist/assets/{gitGraphDiagram-XJZIOB7I-D1Bi-WVr.js → gitGraphDiagram-XJZIOB7I-Cyhck_tc.js} +1 -1
- package/dist/assets/{import-name--XXEptcs.js → import-name-CI8ywg9z.js} +1 -1
- package/dist/assets/{index-B71mb9w2.js → index-Bfq2K69f.js} +3 -3
- package/dist/assets/{index-B6yxcS2o.js → index-CH3K8lgA.js} +1 -1
- package/dist/assets/{infoDiagram-5W2HQ5XZ-7Dj4vVEF.js → infoDiagram-5W2HQ5XZ-Cz9xYKn8.js} +1 -1
- package/dist/assets/{ishikawaDiagram-K3B6WC7H-CVYf9Cex.js → ishikawaDiagram-K3B6WC7H-Cms6sZIz.js} +1 -1
- package/dist/assets/{journeyDiagram-COXZFDF6-Cq8Mrdls.js → journeyDiagram-COXZFDF6-C918DJxn.js} +1 -1
- package/dist/assets/{kanban-definition-P3RFRI5V-CKbNaTXV.js → kanban-definition-P3RFRI5V-Dh4rnCl5.js} +1 -1
- package/dist/assets/{mcp-servers-QoKOOaH_.js → mcp-servers-CJbfxQZh.js} +1 -1
- package/dist/assets/{mermaid.core-Cfx1Ri6O.js → mermaid.core-nsP0cVsp.js} +4 -4
- package/dist/assets/{mindmap-definition-LZFPQGKD-DU5lKgNA.js → mindmap-definition-LZFPQGKD-CFrq5gkA.js} +1 -1
- package/dist/assets/{minimize-GgnXEvJ1.js → minimize-OWlsq-0s.js} +1 -1
- package/dist/assets/{monitor-DWT5skqg.js → monitor-76fhlY80.js} +1 -1
- package/dist/assets/{new-bot-D2Lics-a.js → new-bot-Dc7eL-b9.js} +1 -1
- package/dist/assets/{org-library-BCFhCpmM.js → org-library-CYLIr0IG.js} +1 -1
- package/dist/assets/{package-format-DV1UWT2N.js → package-format-CVYBpd3z.js} +1 -1
- package/dist/assets/{pegDiagram-BGZESJAR-BZOUlSxL.js → pegDiagram-BGZESJAR-CpRYFAU1.js} +1 -1
- package/dist/assets/{pieDiagram-CAPJLFHJ-CGiStUXf.js → pieDiagram-CAPJLFHJ-BaqH4FaB.js} +1 -1
- package/dist/assets/{quadrantDiagram-GDMTTRAM-B1Wmdtv4.js → quadrantDiagram-GDMTTRAM-CGj6xfEM.js} +1 -1
- package/dist/assets/{rail-CpX_7HEm.js → rail-Dil29FKU.js} +1 -1
- package/dist/assets/{railroadDiagram-SM67HX2B-Wg4VNMHy.js → railroadDiagram-SM67HX2B-T8YW5IRA.js} +1 -1
- package/dist/assets/{remote-desktop-panel-e0kd0Yg3.js → remote-desktop-panel-CPxDvrzD.js} +1 -1
- package/dist/assets/{requirementDiagram-X7JNWC4A-C0Mg7lFb.js → requirementDiagram-X7JNWC4A-vX99IzDT.js} +1 -1
- package/dist/assets/{sankeyDiagram-UM26HJRW-B6uYMcAk.js → sankeyDiagram-UM26HJRW-BfgAMAiw.js} +1 -1
- package/dist/assets/{sequenceDiagram-ZO4K6R2Y-Cug8I0Vk.js → sequenceDiagram-ZO4K6R2Y-BxqhI_5G.js} +1 -1
- package/dist/assets/{sizeCapture-INFHLROL-DhhG2JX9.js → sizeCapture-INFHLROL-DivsEQN9.js} +1 -1
- package/dist/assets/{stateDiagram-v2-TBUQTH76-jGiuUtK8.js → stateDiagram-v2-TBUQTH76-gvw7v1YG.js} +1 -1
- package/dist/assets/{styles-BLTbBw4n.js → styles-1Sa7mQdy.js} +2 -2
- package/dist/assets/{swimlanes-N4OXWK64-BLynKh6J.js → swimlanes-N4OXWK64-BHxjZqDS.js} +1 -1
- package/dist/assets/swimlanesDiagram-K3J5GTZL-CynVazVQ.js +8 -0
- package/dist/assets/{team-share-CaqqOl-B.js → team-share-DzmYPtMt.js} +1 -1
- package/dist/assets/{timeline-definition-YOQAKGHF-CVo7GXYB.js → timeline-definition-YOQAKGHF-CkrkdnYL.js} +1 -1
- package/dist/assets/{usecaseDiagram-VIAY4XPW-C1fDwoE_.js → usecaseDiagram-VIAY4XPW-D4LWhANl.js} +1 -1
- package/dist/assets/{vennDiagram-BLWOH2XV-DJama013.js → vennDiagram-BLWOH2XV-CX4YR6o_.js} +1 -1
- package/dist/assets/{vi-DmPGsLok.js → vi-CcmBtVzr.js} +1 -1
- package/dist/assets/{wardleyDiagram-YMQ3BMBF-CgCuKC8t.js → wardleyDiagram-YMQ3BMBF-BXx0E2ta.js} +1 -1
- package/dist/assets/{xychartDiagram-TAQBALBS-CFlp3Uf_.js → xychartDiagram-TAQBALBS-DxVI0fYE.js} +1 -1
- package/dist/index.html +2 -2
- package/dist/rail.html +4 -4
- package/dist-server/container-mcp.js +1 -1
- package/dist-server/drivers/agents-proxy.js +136 -312
- package/dist-server/index.js +5366 -5363
- package/dist-server/openmausbot.js +5 -5
- package/dist-server/package.json +1 -1
- package/dist-server/pair-cli.js +5 -5
- package/dist-server/server/bot-api-host.js +72 -36
- package/dist-server/server/bot-visibility.js +2 -8
- package/dist-server/server/host/visibility-host.js +1 -4
- package/dist-server/server/index.js +12 -24
- package/dist-server/server/limix-telegram.js +329 -0
- package/dist-server/server/routes/bot-messages.js +0 -3
- package/dist-server/server/safety-floor-gate.js +2 -6
- package/dist-server/shared/bot-api.js +0 -1
- package/dist-server/vps-container-mcp.js +9 -9
- package/dist-server/workspace-backup.worker.js +1 -1
- package/package.json +1 -1
- package/dist/assets/BotSettingsDialog-YdaTa4r7.js +0 -16
- package/dist/assets/LimixChannelReview-CBljZ-UR.js +0 -1
- package/dist/assets/channel-CMcNEoPI.js +0 -1
- package/dist/assets/swimlanesDiagram-K3J5GTZL-BnYnsuXV.js +0 -8
- package/dist-server/server/limix-app-catalog.js +0 -7
- package/dist-server/server/limix-channel-identity.js +0 -42
- package/dist-server/server/limix-channel-media.js +0 -72
- package/dist-server/server/limix-channel-review-path.js +0 -6
- package/dist-server/server/limix-channel-review.js +0 -53
- package/dist-server/server/limix-owner-lane.js +0 -51
|
@@ -18,17 +18,17 @@ prefix.toLowerCase(),40);let head=name.split(/[\s_./:-]+/).find(Boolean)??name,w
|
|
|
18
18
|
(counts.get(word)??0)+1);return{counts,length:words.length}}function fields(tool){let text2=[tool.title,tool.description].filter(part=>typeof part=="string").join(" ");return{name:counted(tool.name),text:counted(text2),schema:counted(schemaText(tool.inputSchema))}}function lists(name,description){return name.counts.has("list")||typeof description=="string"&&terms(description.slice(0,40))[0]==="list"}var rarity=(total,holding)=>Math.log(1+(total-holding+.5)/(holding+.5)),saturated=tf=>tf*(K1+1)/(tf+
|
|
19
19
|
K1);function byName(a,b2){return a.name<b2.name?-1:a.name>b2.name?1:0}var bm25Ranker=(query,tools,limit)=>{let wanted=[...new Set(terms(query))],exact=query.trim().toLowerCase(),listing=!wanted.includes("list")&&query.toLowerCase().split(/[^\p{L}\p{N}]+/u).some(word=>LIST_INTENT.has(word)),docs=tools.map(tool=>{let parts=fields(tool);return{tool,fields:parts,area:counted(toolArea(tool.name)),lists:lists(parts.name,tool.description)}}),average=Object.fromEntries(FIELDS.map(field=>[field,docs.reduce(
|
|
20
20
|
(sum,doc)=>sum+doc.fields[field].length,0)/Math.max(1,docs.length)||1])),averageArea=docs.reduce((sum,doc)=>sum+doc.area.length,0)/Math.max(1,docs.length)||1,df=new Map,areaDf=new Map;for(let doc of docs)for(let term of wanted)FIELDS.some(field=>doc.fields[field].counts.has(term))&&df.set(term,(df.get(term)??0)+1),doc.area.counts.has(term)&&areaDf.set(term,(areaDf.get(term)??0)+1);let listRarity=rarity(docs.length,docs.filter(doc=>doc.lists).length),scored=[];for(let doc of docs){let score=doc.tool.
|
|
21
|
-
name.toLowerCase()===exact?1e3:0;for(let term of wanted){let tf=0;for(let field of FIELDS){let{counts,length:length2}=doc.fields[field],
|
|
21
|
+
name.toLowerCase()===exact?1e3:0;for(let term of wanted){let tf=0;for(let field of FIELDS){let{counts,length:length2}=doc.fields[field],count=counts.get(term);count&&(tf+=FIELD_WEIGHTS[field]*count/(1-B+B*length2/average[field]))}tf&&(score+=rarity(docs.length,df.get(term)??0)*saturated(tf));let inArea=doc.area.counts.get(term);inArea&&(score+=rarity(docs.length,areaDf.get(term)??0)*saturated(AREA_WEIGHT*inArea/(1-B+B*doc.area.length/averageArea)))}score>0&&listing&&doc.lists&&(score+=LIST_WEIGHT*
|
|
22
22
|
listRarity),score>0&&scored.push({tool:doc.tool,score})}return scored.sort((a,b2)=>b2.score-a.score||byName(a.tool,b2.tool)),scored.slice(0,limit).map(entry=>entry.tool)};var HOW_TO_SEARCH=`Find tool names with ${SEARCH_TOOL}({ "query": "what you want to do" }), then run one with ${CALL_TOOL}({ "name": "...", "arguments": {...} }).`;var encoder=new TextEncoder;var ANNOTATIONS=new Set(["examples","example","default","$comment"]),ANNOTATIONS_AND_WORDS=new Set([...ANNOTATIONS,"description","title"]);var TOOL_BRIDGE_ENV="OMB_AGENTS_TOOL_BRIDGE",FIND_TOOL="find_tool",USE_TOOL="use_tool",BRIDGE_HOT_TOOL_NAMES=new Set(["create_options_card","tool_result_read","list_room_targets","coordinate_bots","list_bots","list_rooms","select_computer","attach_file","post_to_room","request_credential","request_sign_in","fill_login","message_person","send_voice_note","memory_update"]),FIND_MATCHES_MAX=3,FIND_CHARS_MAX=2e4,QUERY_CHARS=1e3,BRIDGE_NAMES_MAX_CHARS=1200,MORE_NAMES_CHARS=24;function record2(value){
|
|
23
23
|
return value!==null&&typeof value=="object"&&!Array.isArray(value)}var SERVER_PREFIXES=["","mcp__agents__","agents__","agents_"];function calledByItsOwnName(name){return SERVER_PREFIXES.some(prefix=>isOutboundTool(`${prefix}${name}`))}function namesList(names,maxChars){if(!names.length)return"none.";let text2="",shown=0;for(let name of names){let part=`${shown?", ":""}${name}`,last=shown===names.length-1;if(text2.length+part.length+(last?1:MORE_NAMES_CHARS)>maxChars)break;text2+=part,shown+=1}return shown<names.length?`${text2}${shown?", ":""}\u2026 and ${names.length-shown} more.`:`${text2}.`}var FIND_USAGE=`${FIND_TOOL} needs { "query": "what you want to do, in a few words" }, for example "schedule a routine", or a tool's e\
|
|
24
24
|
xact name.`,USE_USAGE=`${USE_TOOL} needs { "name": "the tool's exact name", "arguments": { ... } }, with arguments a JSON object as the tool's input schema describes it. Find the name and the schema with ${FIND_TOOL}.`,HOW_TO_RUN=`Run one with ${USE_TOOL}({ "name": "...", "arguments": { ... } }), with arguments that fit its inputSchema. Follow its description as you would for a tool in your list.`;function createToolBridge(tools){let profile=new Set(tools.map(tool=>tool.name)),hot=tools.filter(tool=>BRIDGE_HOT_TOOL_NAMES.
|
|
25
|
-
has(tool.name)||calledByItsOwnName(tool.name)),hotNames=new Set(hot.map(tool=>tool.name)),hidden=tools.filter(tool=>!hotNames.has(tool.name)),
|
|
25
|
+
has(tool.name)||calledByItsOwnName(tool.name)),hotNames=new Set(hot.map(tool=>tool.name)),hidden=tools.filter(tool=>!hotNames.has(tool.name)),listed=[...hot,{name:FIND_TOOL,description:`Find an Limix Bot tool that is not in your tool list. Say what you want to do in a few words, or give the tool's name. Each match comes back with its description and exact input schema; run one with ${USE_TOOL}. Tools reached this way: ${namesList(hidden.map(tool=>tool.name),BRIDGE_NAMES_MAX_CHARS)}`,inputSchema:{
|
|
26
26
|
type:"object",additionalProperties:!1,properties:{query:{type:"string",description:"What you want to do, in a few words, or a tool's exact name."}},required:["query"]},annotations:READ_ONLY_ANNOTATIONS},{name:USE_TOOL,description:`Run one Limix Bot tool that ${FIND_TOOL} gave you, by its exact name, with its input as arguments. It runs exactly as if you had called it directly: the same permissions, limits and refusals apply, and its result comes back unchanged. Read the tool's description and in\
|
|
27
|
-
put schema from ${FIND_TOOL} before the first call.`,inputSchema:{type:"object",additionalProperties:!1,properties:{name:{type:"string",description:`The tool's exact name, as ${FIND_TOOL} gave it.`},arguments:{type:"object",additionalProperties:!0,description:`The tool's input, as the input schema ${FIND_TOOL} returned describes it. Leave out for a tool that takes none.`}},required:["name"]}}],listedNames=new Set(
|
|
27
|
+
put schema from ${FIND_TOOL} before the first call.`,inputSchema:{type:"object",additionalProperties:!1,properties:{name:{type:"string",description:`The tool's exact name, as ${FIND_TOOL} gave it.`},arguments:{type:"object",additionalProperties:!0,description:`The tool's input, as the input schema ${FIND_TOOL} returned describes it. Leave out for a tool that takes none.`}},required:["name"]}}],listedNames=new Set(listed.map(tool=>tool.name));async function find(args){let query=record2(args)&&typeof args.
|
|
28
28
|
query=="string"?args.query.trim():"";if(!query||query.length>QUERY_CHARS)return{text:FIND_USAGE,isError:!0};let named=Object.hasOwn(AGENTS_TOOL_ALIASES,query)?AGENTS_TOOL_ALIASES[query].tools[0]:query;if(listedNames.has(named))return{text:`${named} is in your tool list: call it directly.`};let ranked=await bm25Ranker(named,hidden,FIND_MATCHES_MAX),matches=[],chars=0;for(let candidate of ranked.slice(0,FIND_MATCHES_MAX)){let tool=hidden.find(entry=>entry.name===candidate.name);if(!tool)continue;let match={
|
|
29
29
|
name:tool.name,description:tool.description,inputSchema:tool.inputSchema},size=JSON.stringify(match).length;if(matches.length&&chars+size>FIND_CHARS_MAX)break;matches.push(match),chars+=size}return{text:JSON.stringify(matches.length?{matches,next:HOW_TO_RUN}:{matches,next:`Nothing matched. Try other words, or one of these names: ${namesList(hidden.map(tool=>tool.name),BRIDGE_NAMES_MAX_CHARS)} A tool in your tool list is called directly.`})}}function use(args){let name=record2(args)&&typeof args.
|
|
30
|
-
name=="string"?args.name:"",input2=record2(args)?args.arguments:void 0;return!name.trim()||input2!=null&&!record2(input2)?{answer:{text:USE_USAGE,isError:!0}}:profile.has(name)&&calledByItsOwnName(name)?{answer:{text:`${name} is in your tool list: call it directly, not through ${USE_TOOL}. Nothing was run.`,isError:!0}}:{name,arguments:input2??{}}}async function route(name,args){if(name===FIND_TOOL)return{answer:await find(args)};if(name===USE_TOOL)return use(args)}return{listed
|
|
31
|
-
|
|
30
|
+
name=="string"?args.name:"",input2=record2(args)?args.arguments:void 0;return!name.trim()||input2!=null&&!record2(input2)?{answer:{text:USE_USAGE,isError:!0}}:profile.has(name)&&calledByItsOwnName(name)?{answer:{text:`${name} is in your tool list: call it directly, not through ${USE_TOOL}. Nothing was run.`,isError:!0}}:{name,arguments:input2??{}}}async function route(name,args){if(name===FIND_TOOL)return{answer:await find(args)};if(name===USE_TOOL)return use(args)}return{listed,hidden,find,use,
|
|
31
|
+
route}}var MODELGO_URL="https://modelgo.ai/?utm_source=openmausbot&utm_medium=sponsorship&utm_content=app&campaign_id=openmausbot&ad_group_id=app";var CREDENTIAL_TARGETS={xaiApiKey:{label:"xAI API key",description:"Used by the built-in Grok provider.",placeholder:"xai-\u2026",helpUrl:"https://console.x.ai/"},boxToken:{label:"Boat API key",description:"Gives bots an isolated cloud computer when Boat is selected.",placeholder:"Paste your Boat API key",helpUrl:"https://docs.boat.dev/api-keys"},opencodeGoApiKey:{label:"OpenCode API key",description:"Used for OpenCode Zen and Go.",placeholder:"Paste your OpenCode API key",helpUrl:"https://openc\
|
|
32
32
|
ode.ai/docs/providers/"},ttsKey:{label:"ElevenLabs API key",description:"Enables text-to-speech voices in calls.",placeholder:"Paste your ElevenLabs API key",helpUrl:"https://elevenlabs.io/app/settings/api-keys"},geminiTtsKey:{label:"Gemini speech API key",description:"Generates spoken replies, voice notes and call speech with Gemini.",placeholder:"Paste your Google AI Studio API key",helpUrl:"https://aistudio.google.com/api-keys"},fishAudioKey:{label:"Fish Audio API key",description:"Enables Fi\
|
|
33
33
|
sh Audio voices in calls.",placeholder:"Paste your Fish Audio API key",helpUrl:"https://fish.audio/app/api-keys/"},openaiImageApiKey:{label:"OpenAI API key",description:"Used to generate images in chats and bot avatars when OpenAI is the image provider.",placeholder:"sk-\u2026",helpUrl:"https://platform.openai.com/api-keys"},onePasswordToken:{label:"1Password service account token",description:"Lets bots sign in with the website logins in the 1Password vault this token can read, the way Settings\
|
|
34
34
|
\u2192 Logins does.",placeholder:"ops_\u2026",helpUrl:"https://developer.1password.com/docs/service-accounts/get-started/"},composioApiKey:{label:"Composio API key",description:"Connects apps such as Gmail, Slack and GitHub through your own Composio project.",placeholder:"ak_\u2026",helpUrl:"https://dashboard.composio.dev/~/project/settings/api-keys"},openaiApiKey:{label:"OpenAI API key",description:"Runs OpenAI models with your own key.",placeholder:"sk-\u2026",helpUrl:"https://platform.openai\
|
|
@@ -212,7 +212,7 @@ tool.inputSchema,tool.description)}))}var FULL_INPUT_SCHEMAS=new Map([...TOOL_DE
|
|
|
212
212
|
profile.cloudHome&&profile.team!==!0||!COMPUTER_ASK_TOOL_NAMES.has(tool.name)),RESEARCH_READY_TOOLS=(profile.voiceNotes?SHAREABLE_TOOLS:SHAREABLE_TOOLS.filter(tool=>!VOICE_TOOL_NAMES.has(tool.name))).filter(tool=>!RESEARCH_TOOL_NAMES.has(tool.name)||profile.xResearch===!0&&(profile.research===!0||X_TOOL_NAMES.has(tool.name)));return[...profile.chief?RESEARCH_READY_TOOLS:RESEARCH_READY_TOOLS.filter(tool=>!CHIEF_ONLY_TOOL_NAMES.has(tool.name)).map(tool=>{if(!CHIEF_TARGET_TOOL_NAMES.has(tool.name))
|
|
213
213
|
return tool;let properties=Object.fromEntries(Object.entries(tool.inputSchema.properties).filter(([key])=>key!=="for_bot_id"));return{...tool,description:tool.description.replace(CHIEF_PROFILE_TARGET,""),inputSchema:{...tool.inputSchema,properties}}}),...profile.mausbot===!0?MAUSBOT_TOOL_DEFINITIONS:[]]}var DEFER_TOOLS_ENV="OMB_AGENTS_DEFER_TOOLS",CLAUDE_ALWAYS_LOADED_TOOL_NAMES=new Set(["tool_result_read","list_bots","attach_file","memory_update","message_person","send_voice_note","create_options_card"]),ALWAYS_LOAD_META="anthropic/alwaysLoad";function withDeferMarks(tools){return tools.map(tool=>CLAUDE_ALWAYS_LOADED_TOOL_NAMES.has(tool.name)?tool:{...tool,_meta:{...tool._meta,[ALWAYS_LOAD_META]:!1}})}var COMMON=new Set(["about","after","also","and","any","are","can","does","each","for","from","has","have","how","into","its","not","one","skill","that","the","their","them","then","this","use","used","user","using","was","what","when","which","who","will","with","you","your"]);function fitWords(text2){return(text2.toLowerCase().match(/[\p{L}\p{N}]+/gu)??[]).flatMap(word=>word.length<3||COMMON.has(word)?[]:[(word.length>3&&word.endsWith("s")&&!word.endsWith("ss")?word.slice(0,-1):word).slice(0,6)])}
|
|
214
214
|
function rankSkills(skills,about){let wanted=new Set(fitWords(about));if(!wanted.size||!skills.length)return[];let docs=skills.map(skill=>{let weights=new Map;for(let word of fitWords(skill.description))weights.set(word,1);for(let word of fitWords(skill.name.replace(/-/g," ")))weights.set(word,2);return weights}),usedBy=new Map;for(let doc of docs)for(let word of doc.keys())usedBy.set(word,(usedBy.get(word)??0)+1);let averageSize=docs.reduce((sum,doc)=>sum+doc.size,0)/docs.length||1;return skills.
|
|
215
|
-
map((skill,i)=>{let doc=docs[i],score=0;for(let[word,weight2]of doc)wanted.has(word)&&(score+=weight2*Math.log(1+skills.length/usedBy.get(word)));return{skill,score:score/(.5+.5*doc.size/averageSize)}}).filter(hit=>hit.score>0).sort((a,b2)=>b2.score-a.score||a.skill.name.localeCompare(b2.skill.name)).map(hit=>hit.skill)}function isSkillSwitchAction(action2){return action2==="enable"||action2==="disable"||action2==="delete"}function skillSwitchVerb(action2){return action2==="enable"?"turn on":action2==="disable"?"turn off":"delete"}
|
|
215
|
+
map((skill,i)=>{let doc=docs[i],score=0;for(let[word,weight2]of doc)wanted.has(word)&&(score+=weight2*Math.log(1+skills.length/usedBy.get(word)));return{skill,score:score/(.5+.5*doc.size/averageSize)}}).filter(hit=>hit.score>0).sort((a,b2)=>b2.score-a.score||a.skill.name.localeCompare(b2.skill.name)).map(hit=>hit.skill)}function isSkillSwitchAction(action2){return action2==="enable"||action2==="disable"||action2==="delete"}function skillSwitchVerb(action2){return action2==="enable"?"turn on":action2==="disable"?"turn off":"delete"}var external_exports={};__export(external_exports,{$brand:()=>$brand,$input:()=>$input,$output:()=>$output,INVALID:()=>INVALID,NEVER:()=>NEVER,TimePrecision:()=>TimePrecision,ZodAny:()=>ZodAny,ZodArray:()=>ZodArray,ZodBase64:()=>ZodBase64,ZodBase64URL:()=>ZodBase64URL,ZodBigInt:()=>ZodBigInt,ZodBigIntFormat:()=>ZodBigIntFormat,ZodBoolean:()=>ZodBoolean,ZodCIDRv4:()=>ZodCIDRv4,ZodCIDRv6:()=>ZodCIDRv6,ZodCUID:()=>ZodCUID,ZodCUID2:()=>ZodCUID2,ZodCatch:()=>ZodCatch,ZodCodec:()=>ZodCodec,ZodCompileAsyncError:()=>ZodCompileAsyncError,
|
|
216
216
|
ZodCompileUnsupportedError:()=>ZodCompileUnsupportedError,ZodCreditCard:()=>ZodCreditCard,ZodCustom:()=>ZodCustom,ZodCustomStringFormat:()=>ZodCustomStringFormat,ZodDate:()=>ZodDate,ZodDefault:()=>ZodDefault,ZodDiscriminatedUnion:()=>ZodDiscriminatedUnion,ZodE164:()=>ZodE164,ZodEmail:()=>ZodEmail,ZodEmoji:()=>ZodEmoji,ZodEnum:()=>ZodEnum,ZodError:()=>ZodError,ZodExactOptional:()=>ZodExactOptional,ZodFile:()=>ZodFile,ZodFirstPartyTypeKind:()=>ZodFirstPartyTypeKind,ZodFunction:()=>ZodFunction,ZodGUID:()=>ZodGUID,
|
|
217
217
|
ZodIBAN:()=>ZodIBAN,ZodIPv4:()=>ZodIPv4,ZodIPv6:()=>ZodIPv6,ZodISODate:()=>ZodISODate,ZodISODateTime:()=>ZodISODateTime,ZodISODuration:()=>ZodISODuration,ZodISOTime:()=>ZodISOTime,ZodInstanceOf:()=>ZodInstanceOf,ZodIntersection:()=>ZodIntersection,ZodIssueCode:()=>ZodIssueCode,ZodJWT:()=>ZodJWT,ZodKSUID:()=>ZodKSUID,ZodLazy:()=>ZodLazy,ZodLiteral:()=>ZodLiteral,ZodMAC:()=>ZodMAC,ZodMap:()=>ZodMap,ZodNaN:()=>ZodNaN,ZodNanoID:()=>ZodNanoID,ZodNever:()=>ZodNever,ZodNonOptional:()=>ZodNonOptional,ZodNull:()=>ZodNull,
|
|
218
218
|
ZodNullable:()=>ZodNullable,ZodNumber:()=>ZodNumber,ZodNumberFormat:()=>ZodNumberFormat,ZodObject:()=>ZodObject,ZodOptional:()=>ZodOptional,ZodPipe:()=>ZodPipe,ZodPrefault:()=>ZodPrefault,ZodPreprocess:()=>ZodPreprocess,ZodPromise:()=>ZodPromise,ZodReadonly:()=>ZodReadonly,ZodRealError:()=>ZodRealError,ZodRecord:()=>ZodRecord,ZodSet:()=>ZodSet,ZodString:()=>ZodString,ZodStringFormat:()=>ZodStringFormat,ZodSuccess:()=>ZodSuccess,ZodSymbol:()=>ZodSymbol,ZodTemplateLiteral:()=>ZodTemplateLiteral,ZodTransform:()=>ZodTransform,
|
|
@@ -268,7 +268,7 @@ schema)),(value,key)=>selected&&!selected.has(key)?value:new Class2({type:"nonop
|
|
|
268
268
|
return issues.map(iss=>{var _a3;return(_a3=iss).path??(_a3.path=[]),iss.path.unshift(path),iss})}function unwrapMessage(message){return typeof message=="string"?message:message?.message}function sizeCaps(defChecks){let caps=[];for(let ch of defChecks??[]){let d=ch._zod.def;if(!/_(length|size)$|_equals$/.test(d.check))break;let max=d.maximum??d.length??d.size;max>=0&&caps.push([max,ch])}return caps}function attachSchema(issues,start,inst){var _a3;for(let i=start;i<issues.length;i++)(_a3=issues[i]).
|
|
269
269
|
schema??(_a3.schema=inst)}function finalizeIssue(iss,ctx,config2){var _a3;let traits=iss.inst?._zod?.traits;traits?.has("$ZodType")&&(traits.has("$ZodCheck")?(_a3=iss).schema??(_a3.schema=iss.inst):iss.schema=iss.inst);let schemaError=iss.schema!==iss.inst?iss.schema?._zod.def?.error:void 0,message=iss.message?iss.message:unwrapMessage(iss.inst?._zod.def?.error?.(iss))??unwrapMessage(schemaError?.(iss))??unwrapMessage(ctx?.error?.(iss))??unwrapMessage(config2.customError?.(iss))??unwrapMessage(config2.
|
|
270
270
|
localeError?.(iss))??"Invalid input",full={};for(let k2 of Object.keys(iss))k2==="inst"||k2==="schema"||k2==="continue"||k2==="input"||k2==="__proto__"||(full[k2]=iss[k2]);return full.path??(full.path=[]),full.message=message,ctx?.reportInput&&(full.input=iss.input),full}function getSizableOrigin(input2){return input2 instanceof Set?"set":input2 instanceof Map?"map":input2 instanceof File?"file":"unknown"}var highSurrogate=/[\uD800-\uDBFF]/;function codePointLength(str){let units=str.length;if(!highSurrogate.
|
|
271
|
-
test(str))return units;let
|
|
271
|
+
test(str))return units;let count=units;for(let i=0;i<units-1;i++)(str.charCodeAt(i)&64512)===55296&&(str.charCodeAt(i+1)&64512)===56320&&(count--,i++);return count}function getLengthableOrigin(input2){return Array.isArray(input2)?"array":typeof input2=="string"?"string":"unknown"}function parsedType(data){let t=typeof data;switch(t){case"number":return Number.isNaN(data)?"nan":"number";case"object":{if(data===null)return"null";if(Array.isArray(data))return"array";let obj=data;if(obj&&Object.getPrototypeOf(
|
|
272
272
|
obj)!==Object.prototype&&"constructor"in obj&&obj.constructor)return obj.constructor.name}}return t}function issue(...args){let[iss,input2,inst]=args;return typeof iss=="string"?{message:iss,code:"custom",input:input2,inst}:{...iss}}function cleanEnum(obj){return Object.entries(obj).filter(([k2,_2])=>Number.isNaN(Number.parseInt(k2,10))).map(el=>el[1])}function base64ToUint8Array(base643){let binaryString=atob(base643),bytes=new Uint8Array(binaryString.length);for(let i=0;i<binaryString.length;i++)
|
|
273
273
|
bytes[i]=binaryString.charCodeAt(i);return bytes}function uint8ArrayToBase64(bytes){let binaryString="";for(let i=0;i<bytes.length;i++)binaryString+=String.fromCharCode(bytes[i]);return btoa(binaryString)}function base64urlToUint8Array(base64url3){let base643=base64url3.replace(/-/g,"+").replace(/_/g,"/"),padding2="=".repeat((4-base643.length%4)%4);return base64ToUint8Array(base643+padding2)}function uint8ArrayToBase64url(bytes){return uint8ArrayToBase64(bytes).replace(/\+/g,"-").replace(/\//g,"\
|
|
274
274
|
_").replace(/=/g,"")}function hexToUint8Array(hex3){let cleanHex=hex3.replace(/^0x/,"");if(cleanHex.length%2!==0)throw new Error("Invalid hex string length");let bytes=new Uint8Array(cleanHex.length/2);for(let i=0;i<cleanHex.length;i+=2)bytes[i/2]=Number.parseInt(cleanHex.slice(i,i+2),16);return bytes}function uint8ArrayToHex(bytes){return Array.from(bytes).map(b2=>b2.toString(16).padStart(2,"0")).join("")}var Class=class{constructor(..._args){}};function members(proto,table){for(let key in table){
|
|
@@ -517,7 +517,7 @@ switch(issue2.code){case"invalid_type":{let expected=TypeDictionary[issue2.expec
|
|
|
517
517
|
\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${stringifyPrimitive(issue2.values[0])}`:`Yanl\u0131\u015F se\xE7im: a\u015Fa\u011F\u0131dak\u0131lardan biri olmal\u0131d\u0131r: ${joinValues(issue2.values,"|")}`;case"too_big":{let adj=issue2.inclusive?"<=":"<",sizing=getSizing(issue2.origin);return sizing?`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${issue2.origin??"d\u0259y\u0259r"} ${adj}${issue2.maximum.toString()} ${sizing.unit??"element"}`:`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${issue2.origin??
|
|
518
518
|
"d\u0259y\u0259r"} ${adj}${issue2.maximum.toString()}`}case"too_small":{let adj=issue2.inclusive?">=":">",sizing=getSizing(issue2.origin);return sizing?`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${issue2.origin} ${adj}${issue2.minimum.toString()} ${sizing.unit}`:`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${issue2.origin} ${adj}${issue2.minimum.toString()}`}case"invalid_format":{let _issue=issue2;return _issue.format==="starts_with"?`Yanl\u0131\u015F m\u0259tn: "${_issue.prefix}" il\u0259 ba\u015Flamal\u0131d\u0131r`:
|
|
519
519
|
_issue.format==="ends_with"?`Yanl\u0131\u015F m\u0259tn: "${_issue.suffix}" il\u0259 bitm\u0259lidir`:_issue.format==="includes"?`Yanl\u0131\u015F m\u0259tn: "${_issue.includes}" daxil olmal\u0131d\u0131r`:_issue.format==="regex"?`Yanl\u0131\u015F m\u0259tn: ${_issue.pattern} \u015Fablonuna uy\u011Fun olmal\u0131d\u0131r`:`Yanl\u0131\u015F ${FormatDictionary[_issue.format]??issue2.format}`}case"not_multiple_of":return`Yanl\u0131\u015F \u0259d\u0259d: ${issue2.divisor} il\u0259 b\xF6l\xFCn\u0259 bil\u0259n olmal\u0131d\u0131r`;case"\
|
|
520
|
-
unrecognized_keys":return`Tan\u0131nmayan a\xE7ar${issue2.keys.length>1?"lar":""}: ${joinValues(issue2.keys,", ")}`;case"invalid_key":return`${issue2.origin} daxilind\u0259 yanl\u0131\u015F a\xE7ar`;case"invalid_union":return"Yanl\u0131\u015F d\u0259y\u0259r";case"invalid_element":return`${issue2.origin} daxilind\u0259 yanl\u0131\u015F d\u0259y\u0259r`;default:return"Yanl\u0131\u015F d\u0259y\u0259r"}}};function az_default(){return{localeError:error2()}}function getBelarusianPlural(
|
|
520
|
+
unrecognized_keys":return`Tan\u0131nmayan a\xE7ar${issue2.keys.length>1?"lar":""}: ${joinValues(issue2.keys,", ")}`;case"invalid_key":return`${issue2.origin} daxilind\u0259 yanl\u0131\u015F a\xE7ar`;case"invalid_union":return"Yanl\u0131\u015F d\u0259y\u0259r";case"invalid_element":return`${issue2.origin} daxilind\u0259 yanl\u0131\u015F d\u0259y\u0259r`;default:return"Yanl\u0131\u015F d\u0259y\u0259r"}}};function az_default(){return{localeError:error2()}}function getBelarusianPlural(count,one,few,many){let absCount=Math.abs(count),lastDigit=absCount%10,lastTwoDigits=absCount%100;return lastTwoDigits>=11&&lastTwoDigits<=19?many:lastDigit===1?one:lastDigit>=2&&lastDigit<=4?few:many}var error3=()=>{let Sizable={string:{unit:{one:"\u0441\u0456\u043C\u0432\u0430\u043B",few:"\u0441\u0456\u043C\u0432\u0430\u043B\u044B",many:"\u0441\u0456\u043C\u0432\u0430\u043B\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},array:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",
|
|
521
521
|
few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},set:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},map:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},
|
|
522
522
|
verb:"\u043C\u0435\u0446\u044C"},file:{unit:{one:"\u0431\u0430\u0439\u0442",few:"\u0431\u0430\u0439\u0442\u044B",many:"\u0431\u0430\u0439\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"}};function getSizing(origin){return Sizable[origin]??null}let FormatDictionary={regex:"\u0443\u0432\u043E\u0434",email:"email \u0430\u0434\u0440\u0430\u0441",url:"URL",emoji:"\u044D\u043C\u043E\u0434\u0437\u0456",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",
|
|
523
523
|
ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0430 \u0456 \u0447\u0430\u0441",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0447\u0430\u0441",duration:"ISO \u043F\u0440\u0430\u0446\u044F\u0433\u043B\u0430\u0441\u0446\u044C",ipv4:"IPv4 \u0430\u0434\u0440\u0430\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0430\u0441",mac:"MAC \u0430\u0434\u0440\u0430\u0441",cidrv4:"IPv4 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D",
|
|
@@ -709,8 +709,8 @@ code){case"invalid_type":{let expected=TypeDictionary[issue2.expected]??issue2.e
|
|
|
709
709
|
a v\xE1rt \xE9rt\xE9k ${stringifyPrimitive(issue2.values[0])}`:`\xC9rv\xE9nytelen opci\xF3: valamelyik \xE9rt\xE9k v\xE1rt ${joinValues(issue2.values,"|")}`;case"too_big":{let adj=issue2.inclusive?"<=":"<",sizing=getSizing(issue2.origin);return sizing?`T\xFAl nagy: ${issue2.origin??"\xE9rt\xE9k"} m\xE9rete t\xFAl nagy ${adj}${issue2.maximum.toString()} ${sizing.unit??"elem"}`:`T\xFAl nagy: a bemeneti \xE9rt\xE9k ${issue2.origin??"\xE9rt\xE9k"} t\xFAl nagy: ${adj}${issue2.maximum.toString()}`}case"\
|
|
710
710
|
too_small":{let adj=issue2.inclusive?">=":">",sizing=getSizing(issue2.origin);return sizing?`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${issue2.origin} m\xE9rete t\xFAl kicsi ${adj}${issue2.minimum.toString()} ${sizing.unit}`:`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${issue2.origin} t\xFAl kicsi ${adj}${issue2.minimum.toString()}`}case"invalid_format":{let _issue=issue2;return _issue.format==="starts_with"?`\xC9rv\xE9nytelen string: "${_issue.prefix}" \xE9rt\xE9kkel kell kezd\u0151dnie`:_issue.format===
|
|
711
711
|
"ends_with"?`\xC9rv\xE9nytelen string: "${_issue.suffix}" \xE9rt\xE9kkel kell v\xE9gz\u0151dnie`:_issue.format==="includes"?`\xC9rv\xE9nytelen string: "${_issue.includes}" \xE9rt\xE9ket kell tartalmaznia`:_issue.format==="regex"?`\xC9rv\xE9nytelen string: ${_issue.pattern} mint\xE1nak kell megfelelnie`:`\xC9rv\xE9nytelen ${FormatDictionary[_issue.format]??issue2.format}`}case"not_multiple_of":return`\xC9rv\xE9nytelen sz\xE1m: ${issue2.divisor} t\xF6bbsz\xF6r\xF6s\xE9nek kell lennie`;case"unrecog\
|
|
712
|
-
nized_keys":return`Ismeretlen kulcs${issue2.keys.length>1?"s":""}: ${joinValues(issue2.keys,", ")}`;case"invalid_key":return`\xC9rv\xE9nytelen kulcs ${issue2.origin}`;case"invalid_union":return"\xC9rv\xE9nytelen bemenet";case"invalid_element":return`\xC9rv\xE9nytelen \xE9rt\xE9k: ${issue2.origin}`;default:return"\xC9rv\xE9nytelen bemenet"}}};function hu_default(){return{localeError:error23()}}function getArmenianPlural(
|
|
713
|
-
|
|
712
|
+
nized_keys":return`Ismeretlen kulcs${issue2.keys.length>1?"s":""}: ${joinValues(issue2.keys,", ")}`;case"invalid_key":return`\xC9rv\xE9nytelen kulcs ${issue2.origin}`;case"invalid_union":return"\xC9rv\xE9nytelen bemenet";case"invalid_element":return`\xC9rv\xE9nytelen \xE9rt\xE9k: ${issue2.origin}`;default:return"\xC9rv\xE9nytelen bemenet"}}};function hu_default(){return{localeError:error23()}}function getArmenianPlural(count,one,many){return Math.abs(count)===1?one:many}function withDefiniteArticle(word){if(!word)return"";let vowels=["\u0561","\u0565","\u0568","\u056B","\u0578","\u0578\u0582","\u0585"],lastChar=word[word.length-1];return word+(vowels.includes(lastChar)?"\u0576":"\u0568")}var error24=()=>{let Sizable={string:{unit:{one:"\u0576\u0577\u0561\u0576",many:"\u0576\u0577\u0561\u0576\u0576\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"},file:{unit:{one:"\u0562\u0561\u0575\u0569",
|
|
713
|
+
many:"\u0562\u0561\u0575\u0569\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"},array:{unit:{one:"\u057F\u0561\u0580\u0580",many:"\u057F\u0561\u0580\u0580\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"},set:{unit:{one:"\u057F\u0561\u0580\u0580",many:"\u057F\u0561\u0580\u0580\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"},map:{unit:{one:"\u057F\u0561\u0580\u0580",many:"\u057F\u0561\u0580\u0580\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"}};
|
|
714
714
|
function getSizing(origin){return Sizable[origin]??null}let FormatDictionary={regex:"\u0574\u0578\u0582\u057F\u0584",email:"\u0567\u056C. \u0570\u0561\u057D\u0581\u0565",url:"URL",emoji:"\u0567\u0574\u0578\u057B\u056B",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0561\u0574\u057D\u0561\u0569\u056B\u057E \u0587 \u056A\u0561\u0574",date:"ISO \u0561\u0574\u057D\u0561\u0569\u056B\u057E",time:"ISO\
|
|
715
715
|
\u056A\u0561\u0574",duration:"ISO \u057F\u0587\u0578\u0572\u0578\u0582\u0569\u0575\u0578\u0582\u0576",ipv4:"IPv4 \u0570\u0561\u057D\u0581\u0565",ipv6:"IPv6 \u0570\u0561\u057D\u0581\u0565",mac:"MAC \u0570\u0561\u057D\u0581\u0565",cidrv4:"IPv4 \u0574\u056B\u057B\u0561\u056F\u0561\u0575\u0584",cidrv6:"IPv6 \u0574\u056B\u057B\u0561\u056F\u0561\u0575\u0584",base64:"base64 \u0571\u0587\u0561\u0579\u0561\u0583\u0578\u057E \u057F\u0578\u0572",base64url:"base64url \u0571\u0587\u0561\u0579\u0561\u0583\u0578\u057E \u057F\u0578\u0572",
|
|
716
716
|
json_string:"JSON \u057F\u0578\u0572",e164:"E.164 \u0570\u0561\u0574\u0561\u0580",credit_card:"\u056F\u0580\u0565\u0564\u056B\u057F \u0584\u0561\u0580\u057F\u056B \u0570\u0561\u0574\u0561\u0580",currency_code:"\u0561\u0580\u056A\u0578\u0582\u0575\u0569\u056B \u056F\u0578\u0564",iban:"IBAN",jwt:"JWT",template_literal:"\u0574\u0578\u0582\u057F\u0584"},TypeDictionary={nan:"NaN",number:"\u0569\u056B\u057E",array:"\u0566\u0561\u0576\u0563\u057E\u0561\u056E"};return issue2=>{switch(issue2.code){case"i\
|
|
@@ -896,7 +896,7 @@ intrare"},TypeDictionary={nan:"NaN",string:"\u0219ir",number:"num\u0103r",boolea
|
|
|
896
896
|
teptat ${expected}, primit ${received}`}case"invalid_value":return issue2.values.length===1?`Intrare invalid\u0103: a\u0219teptat ${stringifyPrimitive(issue2.values[0])}`:`Op\u021Biune invalid\u0103: a\u0219teptat una dintre ${joinValues(issue2.values,"|")}`;case"too_big":{let adj=issue2.inclusive?"<=":"<",sizing=getSizing(issue2.origin);return sizing?`Prea mare: a\u0219teptat ca ${issue2.origin??"valoarea"} ${sizing.verb} ${adj}${issue2.maximum.toString()} ${sizing.unit??"elemente"}`:`Prea mare\
|
|
897
897
|
: a\u0219teptat ca ${issue2.origin??"valoarea"} s\u0103 fie ${adj}${issue2.maximum.toString()}`}case"too_small":{let adj=issue2.inclusive?">=":">",sizing=getSizing(issue2.origin);return sizing?`Prea mic: a\u0219teptat ca ${issue2.origin} ${sizing.verb} ${adj}${issue2.minimum.toString()} ${sizing.unit}`:`Prea mic: a\u0219teptat ca ${issue2.origin} s\u0103 fie ${adj}${issue2.minimum.toString()}`}case"invalid_format":{let _issue=issue2;return _issue.format==="starts_with"?`\u0218ir invalid: trebuie s\u0103 \xEE\
|
|
898
898
|
nceap\u0103 cu "${_issue.prefix}"`:_issue.format==="ends_with"?`\u0218ir invalid: trebuie s\u0103 se termine cu "${_issue.suffix}"`:_issue.format==="includes"?`\u0218ir invalid: trebuie s\u0103 includ\u0103 "${_issue.includes}"`:_issue.format==="regex"?`\u0218ir invalid: trebuie s\u0103 se potriveasc\u0103 cu modelul ${_issue.pattern}`:`Format invalid: ${FormatDictionary[_issue.format]??issue2.format}`}case"not_multiple_of":return`Num\u0103r invalid: trebuie s\u0103 fie multiplu de ${issue2.divisor}`;case"\
|
|
899
|
-
unrecognized_keys":return`Chei nerecunoscute: ${joinValues(issue2.keys,", ")}`;case"invalid_key":return`Cheie invalid\u0103 \xEEn ${issue2.origin}`;case"invalid_union":return"Intrare invalid\u0103";case"invalid_element":return`Valoare invalid\u0103 \xEEn ${issue2.origin}`;default:return"Intrare invalid\u0103"}}};function ro_default(){return{localeError:error45()}}function getRussianPlural(
|
|
899
|
+
unrecognized_keys":return`Chei nerecunoscute: ${joinValues(issue2.keys,", ")}`;case"invalid_key":return`Cheie invalid\u0103 \xEEn ${issue2.origin}`;case"invalid_union":return"Intrare invalid\u0103";case"invalid_element":return`Valoare invalid\u0103 \xEEn ${issue2.origin}`;default:return"Intrare invalid\u0103"}}};function ro_default(){return{localeError:error45()}}function getRussianPlural(count,one,few,many){let absCount=Math.abs(count),lastDigit=absCount%10,lastTwoDigits=absCount%100;return lastTwoDigits>=11&&lastTwoDigits<=19?many:lastDigit===1?one:lastDigit>=2&&lastDigit<=4?few:many}var error46=()=>{let Sizable={string:{unit:{one:"\u0441\u0438\u043C\u0432\u043E\u043B",few:"\u0441\u0438\u043C\u0432\u043E\u043B\u0430",many:"\u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"},file:{unit:{one:"\u0431\u0430\u0439\u0442",
|
|
900
900
|
few:"\u0431\u0430\u0439\u0442\u0430",many:"\u0431\u0430\u0439\u0442"},verb:"\u0438\u043C\u0435\u0442\u044C"},array:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"},set:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},
|
|
901
901
|
verb:"\u0438\u043C\u0435\u0442\u044C"},map:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"}};function getSizing(origin){return Sizable[origin]??null}let FormatDictionary={regex:"\u0432\u0432\u043E\u0434",email:"email \u0430\u0434\u0440\u0435\u0441",url:"URL",emoji:"\u044D\u043C\u043E\u0434\u0437\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"\
|
|
902
902
|
UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043C\u044F",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0432\u0440\u0435\u043C\u044F",duration:"ISO \u0434\u043B\u0438\u0442\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u044C",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441",mac:"MAC \u0430\u0434\u0440\u0435\u0441",cidrv4:"IPv4 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",
|
|
@@ -1346,121 +1346,75 @@ s2:clone(s2,{...def,keyType:newKey,valueType:newVal})}case"set":{let newVal=run(
|
|
|
1346
1346
|
s2:clone(s2,{...def,left:newLeft,right:newRight})}case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":{let newInner=run(def.innerType);return newInner===def.innerType?s2:clone(s2,{...def,innerType:newInner})}case"pipe":{let newIn=run(def.in),newOut=run(def.out);return newIn===def.in&&newOut===def.out?s2:clone(s2,{...def,in:newIn,out:newOut})}case"function":{let newInput=run(def.input),newOutput=run(def.output);return newInput===
|
|
1347
1347
|
def.input&&newOutput===def.output?s2:clone(s2,{...def,input:newInput,output:newOutput})}case"lazy":{let original=def.getter,{_cachedInner,...rest}=def;return clone(s2,{...rest,getter:()=>run(original())})}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":return s2;default:return s2}}return run(
|
|
1348
1348
|
schema)}function deepPartial(schema){return visit(schema,{object:s2=>s2.partial(),union:s2=>{let def=s2._zod.def;return def.discriminator===void 0?s2:union(def.options)}})}function withChecks(side,checks){if(!checks?.length)return side;let def=side._zod.def;return clone(side,mergeDefs(def,{checks:[...def.checks??[],...checks]}),{parent:!0})}function outSide(def){return withChecks(def.out,def.checks)}function inSide(def){return def.in._zod.traits.has("$ZodTransform")?outSide(def):def.in}function input(schema){return visit(schema,{pipe:s2=>inSide(s2._zod.def),default:(s2,rewritten)=>rewritten?optional(s2._zod.def.innerType):s2,catch:(s2,rewritten)=>rewritten?s2._zod.
|
|
1349
|
-
def.innerType:s2})}function output(schema){return visit(schema,{pipe:s2=>outSide(s2._zod.def),prefault:(s2,rewritten)=>rewritten?s2._zod.def.innerType:s2})}var coerce_exports={};__export(coerce_exports,{bigint:()=>bigint3,boolean:()=>boolean3,date:()=>date4,number:()=>number3,string:()=>string3});function string3(params){return _coercedString(ZodString,params)}function number3(params){return _coercedNumber(ZodNumber,params)}function boolean3(params){return _coercedBoolean(ZodBoolean,params)}function bigint3(params){return _coercedBigint(ZodBigInt,params)}function date4(params){return _coercedDate(ZodDate,params)}var
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
"
|
|
1389
|
-
|
|
1390
|
-
{
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
return
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
(
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
id ${pid}) for memory`),this.closeBrowsers(working)),!this.engines.size&&this.timer&&(clearInterval(this.timer),this.timer=null),this.wake()}kernelKilled(kills){let killed=kills!==null&&this.oomKills!==null&&kills>this.oomKills?kills-this.oomKills:0;return this.oomKills=kills??this.oomKills,killed&&this.ledger.note(this.now(),"killed",killed),killed>0}noteStops(threadIds,count2){for(let threadId of threadIds)this.stops.has(threadId)||this.ledger.note(this.now(),"stopped"),this.stops.set(threadId,
|
|
1419
|
-
{count:count2(threadId),browser:this.browsers?.running(threadId)===!0})}order(){let at=this.now();if(this.ordered?.at===at&&this.ordered.generation===this.generation)return this.ordered.list;let first=[],rest=[];for(let waiter of this.queue)(this.personsOwn(waiter.threadId)||at-waiter.since>=BOT_TURN_GIVES_WAY_MS?first:rest).push(waiter);return this.ordered={at,generation:this.generation,list:[...first,...rest]},this.ordered.list}wake(){this.generation++;for(let waiter of this.queue)waiter.wake()}arm(){
|
|
1420
|
-
this.timer||!this.enabled||(this.timer=setInterval(()=>this.tick(),this.tickMs),this.timer.unref?.())}},engineMemory=new EngineMemory({enabled:(process.env.OMB_CLOUD_ROLE==="home"||process.env.OMB_CLOUD_ROLE==="team")&&process.platform==="linux"});var MAX_CONCURRENT_BOT_THREADS=16;var BYTES_PER_DEFAULT_THREAD=2*1024**3;var PAIRING_INPUT_PROBLEM_TEXT={"serverError.pair.emailCode":"That's a sign-in code from an email. Pairing needs a 12-character code like 7KQ2-M9XD-H4TP.","serverError.pair.oldCode":"That's a code from an older Limix Bot. Make a new one on the other computer: Phone & devices \u2192 Pair a device.","serverError.pair.scriptKey":"That's a script key. Pairing needs a pairing code.","serverError.pair.notACode":"That isn't a pairing code. Pairing needs a 12-character code like 7KQ2-M9XD-H4TP."};var USER_ERROR={"serverError.pair.codeWrong":"pairing code is wrong or has expired; create a new one on the server","serverError.pair.tooMany":"Too many wrong codes. Try again at {time}.",...PAIRING_INPUT_PROBLEM_TEXT,"serverError.pair.linkExpired":"this sign-in link has expired or was already used","serverError.email.invalid":"enter a valid email address","serverError.email.codeFormat":"enter the 8-digit code from the email","serverError.email.tooMany":"too many attempts; wait a minute and requ\
|
|
1421
|
-
est a new code","serverError.email.codeWrong":"that code is wrong or has expired; request a new one","serverError.email.notAllowed":"this email is not on this server's sign-in list; ask the server's owner to add it","serverError.email.unavailable":"the sign-in service could not be reached ({detail}); try again in a moment","serverError.email.notSetUp":"email sign-in is not set up on this server; use a pairing code","serverError.signIn.tooMany":"too many failed sign-in attempts from your address;\
|
|
1422
|
-
try again in {seconds}s","serverError.cloud.personal":"My Cloud is personal: only your own devices can connect.","serverError.model.botBusy":"the bot is working \u2014 stop it before changing models","serverError.model.accountUpdating":"this provider account is being updated \u2014 try again shortly","serverError.chat.busyEdit":"the thread is working \u2014 stop it before editing","serverError.chat.busyVersion":"the thread is working \u2014 stop it before switching versions","serverError.chat.b\
|
|
1423
|
-
usyFresh":"the thread is working \u2014 stop it before starting fresh","serverError.chat.questionGone":"this question is no longer available","serverError.chat.askerGone":"the bot that asked this question is no longer available","serverError.chat.routineElsewhere":"this bot is running a routine in another conversation","serverError.chat.busyInRoom":"this bot is working in channel {room}","serverError.chat.answerSent":"That answer is already on its way.","serverError.chat.savingCredential":"this \
|
|
1424
|
-
task is securely saving a credential \u2014 try again when it finishes","serverError.team.personalMove":"Moving a computer's bots, chats and logins goes to My Cloud only. Nothing personal comes into {team}.","serverError.team.memberLogin":"On {team} only an admin can save a login, and it is then used by every bot in {team}.","serverError.team.signInFirst":"Sign in to {team} in the app first.","serverError.team.ownAppsNeedKey":"Your own apps can't be connected on {team} yet. Ask an admin to add t\
|
|
1425
|
-
he team's Composio key.","serverError.chat.ownerOrAdmin":"Only the owner or an admin can do that.","serverError.routine.checks":"Choose checks from calendar, mail and runs","serverError.routine.checksRepeat":"Checks need a bot routine that repeats","serverError.routine.access":"Choose read-and-draft access or none","serverError.routine.deliver":"Only a bot routine can deliver to the brief","serverError.team.noSuchPhone":"no such phone","serverError.team.sessionEnded":"Your session ended. Sign in\
|
|
1426
|
-
again before creating a pairing code.","serverError.page.roomOrClosed":"Pages from a room or a closed conversation can't be published here.","serverError.page.notHere":"That page is not in this conversation.","serverError.page.fromMcp":"That app came from an MCP server; only a page a bot made can be published.","serverError.page.versionGone":"That version of the page is no longer kept.","serverError.page.notStored":"This app's page is not stored on this computer.","serverError.page.downloadHasF\
|
|
1427
|
-
iles":"This page has files beside it, so it can't be saved as one file. Share it for a link instead.","serverError.department.notFound":"No such department","serverError.department.missing":"no such department","serverError.department.nameLength":"Department name must be 1 to 60 characters","serverError.department.nameRule":"Department name must be 1 to 60 characters without control characters","serverError.department.unassignComputer":"Unassign this department's computer before deleting the dep\
|
|
1428
|
-
artment","serverError.department.oneChief":"A department can have only one Chief of Staff. Choose one Chief or use a department without one.","serverError.department.memoryChanged":"This department memory changed. Reload it before saving or approving.","serverError.department.shareTooLarge":"This department is too large to share (4 MB). Leave out pictures, starter notes or some skills and try again.","serverError.department.shareSkillClash":'Two bots in this department have different skills name\
|
|
1429
|
-
d "{skill}". Leave that skill out and try again.',"serverError.department.shareNoBots":"Add a bot to this department before sharing it.","serverError.department.shareSkillLimit":"A department can share at most {count} skills. Choose fewer skills and try again.","serverError.department.shareBotSkillLimit":"{name} has more than {count} skills. Choose fewer skills and try again.","serverError.department.createFirst":"Create the named department before making a Chief responsible for it","serverError\
|
|
1430
|
-
.department.chiefOnlyExtra":"Only a Chief may manage existing additional departments","serverError.department.confirmExtra":"Confirm additional department access (acknowledgePeerScope)","serverError.department.stopBots":"Stop running bots before granting access to another department, or use the desktop app or a paired Full-access session.","serverError.share.version":"Use a version like 1.2.3.","serverError.preset.empty":"Your New bot defaults are empty. Give them a name, instructions, skills or\
|
|
1431
|
-
starter notes first.","serverError.preset.tooLarge":"This preset is too large to share (4 MB). Leave out starter notes or some skills and try again.","serverError.decider.accountRequired":"Add your Cloudflare account ID with the token.","serverError.decider.keyRequired":"Save a Cloudflare Workers AI, Jev or OpenRouter key before turning on fast decisions.","serverError.decider.jevRejected":"Jev rejected this key. Check it at typesafe.ai and paste it again.","serverError.decider.workersRejected":"\
|
|
1432
|
-
Cloudflare rejected this token. Check that it has Workers AI permission and belongs to this account ID.","serverError.decider.routerRejected":"OpenRouter rejected this key. Check it at openrouter.ai/keys and paste it again.","serverError.decider.accountId":"A Cloudflare account ID is 32 letters and digits.","serverError.decider.accountFormat":"decider.workersAiAccountId a Cloudflare account ID is 32 letters and digits","serverError.voice.utteranceTooLong":"voice utterances are limited to 500 cha\
|
|
1433
|
-
racters","serverError.goal.alreadyRunning":"A goal is already running in this chat. Stop it before starting another.","serverError.chat.missingConversation":"no such conversation","serverError.department.chiefResponsibility":"Only a Chief of Staff can be made responsible for additional departments","serverError.department.confirmResponsibility":"Confirm which additional departments this Chief is responsible for (acknowledgePeerScope)","serverError.owner.teamOnly":"Only a team's bots report to so\
|
|
1434
|
-
meone.","serverError.owner.choose":"Choose someone in {team}.","serverError.owner.chiefConflict":"{name} already has a Chief of Staff. Take the crown off one of them first.","serverError.owner.unassignedChiefConflict":"That person already has a Chief of Staff. Take the crown off one of them first.","serverError.owner.departmentAdmin":"Only {team}'s admins can set who a department's bots report to.","serverError.owner.unavailable":"One or more bots are unavailable.","serverError.bot.missing":"no \
|
|
1435
|
-
such bot","serverError.owner.personal":"{bot} is {name}'s own Limix Bot: it always reports to them.","serverError.owner.change":"Only {team}'s admins, or the person {bot} reports to, can change who it reports to.","serverError.helper.ownerOnly":"Only the owner can answer this.","serverError.helper.missing":"There is no such suggestion.","serverError.notification.missing":"no such notification","serverError.phone.list":"Only the owner or an admin can list phones.","serverError.phone.remove":"Only\
|
|
1436
|
-
the owner or an admin can remove phones.","serverError.model.defaultAdmin":"forbidden: this session may change this thread's model, not the bot's default (needs the admin scope)","serverError.department.readFailed":"Saved departments and shared instructions could not be read; the existing file was left unchanged","serverError.department.duplicate":"A department with that name already exists","serverError.department.renameBusy":"Stop this department's active work before renaming it","serverError\
|
|
1437
|
-
.department.emptyFirst":"Move all bots (including archived bots) and group chats out of this department first","serverError.department.deleteBusy":"Stop this department's active work before deleting it","serverError.department.generalChief":"General already has a Chief of Staff. Move or change this department's Chief before deleting it","serverError.backup.recursiveLink":"Cannot back up a symbolic link to the folder that contains it: {path}","serverError.setup.noTools":"This bot's AI can't set i\
|
|
1438
|
-
t up by itself. Tell the bot what you'd like it to do instead.","serverError.setup.missingConversation":"There is no such conversation.","serverError.setup.stopOwner":"Only the person who pressed Set me up, or an owner or admin, can stop it.","serverError.setup.hasInstructions":"This bot already has instructions. To change its job, type /setup and what you'd like it to do.","serverError.setup.started":"This chat has already started. Type /setup and what you'd like this bot to do.","serverError.s\
|
|
1439
|
-
etup.someoneElse":"Someone else is setting this bot up.","serverError.approval.allThreads":"Finish this bot's approval change first. Every thread's provider must support this approval level.","serverError.approval.pending":"Finish this bot's pending approval change first","serverError.approval.provider":"Use the bot's provider on this thread before applying its approval level","serverError.engineCheck.timeout":"{name} didn't answer within {seconds} seconds.","serverError.request.bodyTimeout":"Th\
|
|
1440
|
-
e request took too long. Check the connection and try again.","serverError.browser.restartingUnresponsive":"The browser stopped responding, so it is being restarted. The live view reconnects by itself.","serverError.computer.desktopOnly":"Only the Limix Bot app on this computer can let a bot use it. Open the app here, or let the bot work in its own browser or on a cloud desktop instead.","serverError.computer.permissionsThenRestart":"Limix Bot can't use this computer yet \u2014 make sure Limix Bot ha\
|
|
1441
|
-
s the permissions it asks for, then restart it","serverError.computer.notReadyDetail":"Limix Bot can't use this computer yet \u2014 {reason}","serverError.computer.notReadyMacPermission":"Limix Bot can't use this computer yet \u2014 {reason}. Relaunch Limix Bot after granting the missing macOS permission.","serverError.install.invalidDetails":"{name}'s install details are invalid. Nothing was downloaded.","serverError.install.versionGone":"This version of {name} is no longer available to downloa\
|
|
1442
|
-
d. Update Limix Bot, then try again.","serverError.install.downloadLimited":"The download site is limiting downloads right now. Try again in a few minutes.","serverError.install.siteNotAnswering":"{name}'s download site isn't answering right now. Try again later.","serverError.install.downloadFailed":"{name} couldn't be downloaded. Check the internet connection and try again.","serverError.install.downloadTooLarge":"The {name} download was larger than expected, so it was stopped. Nothing was ins\
|
|
1443
|
-
talled.","serverError.install.unofficialDownload":"The {name} download did not come from its official site, so it was stopped. Nothing was installed.","serverError.install.redirects":"The {name} download kept redirecting, so it was stopped. Nothing was installed.","serverError.install.safetyCheck":"The {name} download failed its safety check, so nothing was installed. Try again later.","serverError.install.downloadTimeout":"The {name} download took too long and was stopped. Check the internet co\
|
|
1444
|
-
nnection and try again.","serverError.install.unsafeArchive":"The archive contains an unexpected or unsafe file. Nothing was installed.","serverError.install.unsafeFile":"The {name} download holds an unexpected or unsafe file, so nothing was installed.","serverError.install.notPlainFolder":"Limix Bot's folder for {name} is not a plain folder ({path}), so nothing was changed. Move it away, then try again.","serverError.install.unexpectedFolder":"Limix Bot's folder for {name} holds something it di\
|
|
1445
|
-
d not put there ({path}), so nothing was changed. Move it away, then try again.","serverError.install.diskSpace":"There is not enough free disk space to install {name}. Free up about {megabytes} MB, then try again.","serverError.install.openElsewhere":"{name} is open in another window. Close it, then try again.","serverError.install.cannotWrite":"Limix Bot can't write to its folder for {name}. Check the folder's permissions, then try again.","serverError.install.failed":"{name} couldn't be insta\
|
|
1446
|
-
lled. Try again.","serverError.install.noDownload":"{name} has no download for this computer.","serverError.install.existingDoesNotStart":"{name} is installed, but it doesn't start on this computer ({failure}). Nothing was changed.","serverError.install.programMissing":"The {name} download did not contain the program it should, so nothing was installed.","serverError.install.notSigned":"The downloaded {name} is not signed by its maker, so nothing was installed.","serverError.install.downloadDoes\
|
|
1447
|
-
NotStart":"{name} was downloaded, but it doesn't start on this computer ({failure}). Nothing was installed.","serverError.secret.missing":"no such credential request","serverError.secret.settingsCard":"this card saves a key in Settings","serverError.secret.savingFromPhone":"this secret is currently being saved from a phone","serverError.secret.declined":"this request was declined","serverError.secret.replaced":"this request was replaced by a newer one","serverError.secret.taskStopped":"this requ\
|
|
1448
|
-
est stopped with its task","serverError.secret.alreadySaved":"this secret was already saved","serverError.secret.valueSize":"Enter the secret: up to {bytes} bytes.","serverError.secret.notKeptSafely":"The secret could not be kept safely. Nothing was saved.","serverError.secret.unavailableLower":"this credential request is no longer available","serverError.signIn.requestMissing":"no such sign-in request","serverError.signIn.requestReplaced":"this sign-in request was superseded by a newer one","se\
|
|
1449
|
-
rverError.signIn.answeredInChat":"this sign-in request was already answered in the chat","serverError.signIn.alreadyDone":"this sign-in request was already marked done","serverError.signIn.alreadyCancelled":"this sign-in request was already cancelled","serverError.inbox.answerNotPassed":"That answer can't be passed back.","serverError.room.nameOneLine":"room name must fit on one line","serverError.computer.systemUnsupported":"bots can't use this computer on this system \u2014 choose another place for\
|
|
1450
|
-
this bot to work","serverError.computer.aiUnsupported":"this bot's AI can't use this computer \u2014 pick another AI for this bot, or choose another place for it to work","serverError.wait.alreadyEnded":"This wait has already ended.","serverError.botDefaults.nameLength":"name must be at most 100 characters","serverError.botDefaults.sectionLength":"section must be at most 60 characters","serverError.botDefaults.invalid":"These bot settings are not valid.","serverError.postiz.addressHttps":"Enter\
|
|
1451
|
-
your Postiz server's address, starting with https://.","serverError.postiz.addressNoCredentials":"Leave any user name or password out of the Postiz address.","serverError.postiz.addressNoQuery":"Enter the Postiz address without anything after ? or #.","serverError.postiz.addressLocalHttp":"Use an https:// address. Plain http:// works only for a Postiz server on this computer.","serverError.postiz.addressUseHttps":"Use your Postiz server's https:// address.","serverError.postiz.addressContainsKe\
|
|
1452
|
-
y":"That address has a key in it. Enter the server address alone, and paste the key in its own box.","serverError.postiz.mcpUpdating":"MCP servers are being updated. Try again in a moment.","serverError.setup.mausbotMissing":"no such Limix Bot","serverError.setup.mausbotOwnerOnly":"only Limix Bot's own person can do this","serverError.setup.noIntroToFollowUp":"this conversation has no intro to follow up","serverError.inbox.missing":"There is no inbox here.","serverError.inbox.lineMissing":"That \
|
|
1453
|
-
line is not in your inbox.","serverError.inbox.answerRequired":"This waits on your answer: answer it, or close it, where it asks.","serverError.instance.settingsInvalid":"Supply a valid CLI path, account name, configuration directory, boolean tools setting or a reply wait of 1 to 60 minutes.","serverError.instance.replyWaitUnsupported":"The reply wait is available for OpenAI-compatible servers only.","serverError.instance.modelsUnsupported":"Model IDs can be changed for added OpenAI-compatible s\
|
|
1454
|
-
ervers only.","serverError.instance.defaultModelRemoved":"{model} is the default model. Choose another default model before removing it from this server.","serverError.mcp.personalHeadersShared":"Personal MCP header values cannot be saved in shared configuration. Save your key in your personal connection.","serverError.mcp.testSignInFirst":"Sign in to the team to test your own connection.","serverError.postiz.adminOnly":"Only the owner or an admin can manage the Postiz connection.","serverError.\
|
|
1455
|
-
postiz.keyAlone":"Paste the Postiz API key alone.","serverError.postiz.addressAsText":"Send the Postiz address as text.","serverError.secret.localService":"A local service cannot enter a secret. Enter it in Limix Bot.","serverError.secret.cloudOwnerOnly":"Only the owner of this Cloud can enter this secret.","serverError.secret.conversationOwnerOnly":"Only the person this conversation belongs to can enter this secret.","serverError.secret.credentialSavingFromPhone":"this credential is currently b\
|
|
1456
|
-
eing saved from a phone","serverError.secret.credentialDismissed":"this credential request was dismissed","serverError.secret.credentialSuperseded":"this credential request was superseded by a newer one","serverError.secret.notSavedYet":"{label} was not saved yet","serverError.secret.notReadyToResume":"this credential request is not ready to resume","serverError.secret.noLongerConfigured":"{label} is no longer configured","serverError.department.moveChiefConflict":"A department can have only one\
|
|
1457
|
-
Chief of Staff. Change the Chief before moving this bot.","serverError.department.membershipChanged":"Department membership changed. Reopen the dialog and try again.","serverError.mcp.addressAsText":"Send the MCP server address as text.","serverError.mcp.addressChanged":"The MCP server address changed. Reload the server and try again.","serverError.attachment.alreadyInMessage":"This file is already in a message, so it stays.","serverError.engine.signedOut":"{name} is signed out.","serverError.b\
|
|
1458
|
-
ot.viewOnly":"You can view {bot}, not chat with it.","serverError.secret.mailboxAlreadyConnected":"this mailbox was already connected","serverError.secret.emailAndPassword":"Enter your email address and its password.","serverError.secret.emailUnavailable":"Email can't be connected here.","serverError.mailbox.adminOnly":"Only the owner or an admin can manage the mailboxes.","serverError.mailbox.addressAndPassword":"Enter your email address and password.","serverError.mailbox.outgoingFields":"Chec\
|
|
1459
|
-
k the outgoing server: a name like mail.example.com, a port from 1 to 65535, and SSL/TLS or STARTTLS.","serverError.voice.fishKeyRequired":"Add a Fish Audio key in Settings \u2192 API keys to talk to your bots here.","serverError.voice.fishTranscribeConnection":"Couldn't reach Fish Audio to hear you \u2014 check your connection.","serverError.file.tooLarge":"This file is {size}, over the {limit} limit for opening files from chat. The file itself is still saved as {name}."};var BOT_PROFILE_LIMITS={name:100,title:200,description:4e3,voice:200,soul:24e3};function fitsOnOneLine(value){for(let i=0;i<value.length;i+=1){let code=value.charCodeAt(i);if(code<32||code>=127&&code<=159||code===8232||code===8233)return!1}return!0}var REPLY_STYLES=["default","conversational"];var MASCOT_BODY_IDS=["cursor","blob","circle","squircle","capsule","drop","shield","hexagon","diamond","star"],mascotBodySchema=external_exports.enum(MASCOT_BODY_IDS);var HALLOWEEN_BODY_IDS=["pumpkin","ghost","witch","bat","cat","skull","monster","mummy","vampire","spider"],DIWALI_BODY_IDS=["rocket","anaar","chakri","sparkler","bomb","laddu","chakli","jalebi","katli","karanji"],CARVED_BODY_IDS=[...HALLOWEEN_BODY_IDS,...DIWALI_BODY_IDS];var BOT_BODY_IDS=[...MASCOT_BODY_IDS,...CARVED_BODY_IDS],botBodySchema=external_exports.enum(BOT_BODY_IDS);var festival=(bodies,costumes)=>({bodies,costumes}),FESTIVALS={halloween:festival(HALLOWEEN_BODY_IDS,{orange:"pumpkin",purple:"ghost",teal:"witch",red:"bat",blue:"cat",cyan:"skull",green:"monster",yellow:"mummy",coral:"vampire",pink:"spider"}),diwali:festival(DIWALI_BODY_IDS,{orange:"laddu",purple:"chakri",teal:"karanji",red:"rocket",blue:"bomb",cyan:"chakli",green:"anaar",yellow:"katli",coral:"jalebi",pink:"sparkler"})},FESTIVAL_IDS=Object.keys(FESTIVALS);var profilePatchSchema=external_exports.object({name:external_exports.string({error:"name must be a string"}).max(BOT_PROFILE_LIMITS.name,{error:"name must be at most 100 characters"}).refine(value=>!!value.trim(),{error:"name must not be empty"}).refine(fitsOnOneLine,{error:"name must fit on one line"}).optional(),title:external_exports.string({error:"title must be a string"}).max(BOT_PROFILE_LIMITS.title,{error:"title must be at most 200 characters"}).refine(fitsOnOneLine,{error:"title must fi\
|
|
1460
|
-
t on one line"}).optional(),description:external_exports.string({error:"description must be a string"}).max(BOT_PROFILE_LIMITS.description,{error:"description must be at most 4000 characters"}).optional(),soul:external_exports.string({error:"soul must be a string"}).refine(value=>Buffer.byteLength(value,"utf8")<=BOT_PROFILE_LIMITS.soul,{error:"standing instructions must be at most 24000 bytes"}).optional(),notifications:external_exports.boolean({error:"notifications must be true or false"}).optional(),
|
|
1461
|
-
avatarUrl:external_exports.union([botAvatarUrlSchema,external_exports.literal(""),external_exports.null()],{error:"avatarUrl must be a stored PNG, JPEG, GIF, or WebP attachment"}).optional(),avatarCrop:botAvatarCropSchema.optional(),avatarZoom:external_exports.number({error:"avatarZoom must be a number from 1 to 3"}).finite().min(AVATAR_ZOOM_MIN).max(AVATAR_ZOOM_MAX).optional(),avatarFocusX:external_exports.number({error:"avatarFocusX must be a number from 0 to 1"}).finite().min(0).max(1).optional(),
|
|
1462
|
-
avatarFocusY:external_exports.number({error:"avatarFocusY must be a number from 0 to 1"}).finite().min(0).max(1).optional(),mascotBody:botBodySchema.optional(),mascotFaceColor:mascotFaceColorSchema.nullable().optional(),voice:external_exports.string({error:"voice must be a string"}).max(BOT_PROFILE_LIMITS.voice,{error:"voice must be at most 200 characters"}).optional(),speakReplies:external_exports.boolean({error:"speakReplies must be true or false"}).optional(),replyStyle:external_exports.enum(
|
|
1463
|
-
REPLY_STYLES,{error:"replyStyle must be default or conversational"}).optional()});var EFFORT_LEVELS=["none","low","medium","high","xhigh","max"];var MAUS_COLOR_NAMES=["green","blue","red","orange","purple","cyan","pink","yellow","teal","coral","silver","chrome"];function T(s2){return Date.UTC(s2.y,s2.m-1,s2.d,s2.h,s2.i,s2.s)}function D(s2,e){return s2.y===e.y&&s2.m===e.m&&s2.d===e.d&&s2.h===e.h&&s2.i===e.i&&s2.s===e.s}function A(s2,e){let t=new Date(Date.parse(s2));if(isNaN(t))throw new Error("Invalid ISO8601 passed to timezone parser.");let r=s2.substring(9);return r.includes("Z")||r.includes("+")||r.includes("-")?b(t.getUTCFullYear(),t.getUTCMonth()+1,t.getUTCDate(),t.getUTCHours(),t.getUTCMinutes(),t.getUTCSeconds(),"Etc/UTC"):b(t.getFullYear(),t.getMonth()+
|
|
1349
|
+
def.innerType:s2})}function output(schema){return visit(schema,{pipe:s2=>outSide(s2._zod.def),prefault:(s2,rewritten)=>rewritten?s2._zod.def.innerType:s2})}var coerce_exports={};__export(coerce_exports,{bigint:()=>bigint3,boolean:()=>boolean3,date:()=>date4,number:()=>number3,string:()=>string3});function string3(params){return _coercedString(ZodString,params)}function number3(params){return _coercedNumber(ZodNumber,params)}function boolean3(params){return _coercedBoolean(ZodBoolean,params)}function bigint3(params){return _coercedBigint(ZodBigInt,params)}function date4(params){return _coercedDate(ZodDate,params)}var MAX_VISIBILITY_PEOPLE=500;var peopleSchema=external_exports.object({people:external_exports.array(external_exports.string().max(320)).max(MAX_VISIBILITY_PEOPLE)}).strict();var accessSchema=external_exports.object({everyone:external_exports.enum(["none","view","chat","edit"]),people:external_exports.record(external_exports.string().max(320),external_exports.enum(["view","chat","edit"]))}).strict();var ROSTER_NAME_MAX=80;var oneLine=value=>{let flattened="";for(let i=0;i<value.length;i+=1){let code=value.charCodeAt(i),breaksOut=code<32||code>=127&&code<=159||code===8232||code===8233;flattened+=breaksOut?" ":value[i]}return flattened.replace(/\s+/g," ").trim()},clip=(value,max)=>{let flat=oneLine(value);return flat.length>max?`${flat.slice(0,max-1)}\u2026`:flat};function peerName(value){return clip(value.replace(/[[\]]/g," "),ROSTER_NAME_MAX)}var APP_LIMITS={htmlBytes:262144,title:80,fallback:1500,fallbackExcerpt:600,heightMin:80,heightMax:720,messageText:4e3,contextText:4e3,doneText:300,mcpHtmlBytes:2097152,rpcArgumentsBytes:65536,rpcResourceBytes:8388608,messagesPerHour:20,rpcPerMinute:60};function isRecord2(value){return!!value&&typeof value=="object"&&!Array.isArray(value)}function utf8Bytes(text2){let bytes=0;for(let index=0;index<text2.length;index+=1){let code=text2.charCodeAt(index);if(code<128)bytes+=1;else if(code<2048)bytes+=2;else if(code>=55296&&code<=56319&&index+1<text2.length){let next=text2.charCodeAt(index+1);next>=56320&&next<=57343?(bytes+=4,index+=1):bytes+=3}else bytes+=3}return bytes}function oneLine2(text2){return text2.replace(/\s+/g," ").trim()}function wrapHtmlFragment(html){
|
|
1350
|
+
return/<(?:html|body)[\s>/]/i.test(html)||/<(?:html|body)$/i.test(html)?html:`<!DOCTYPE html><html><head><meta charset="utf-8"></head><body>${html}</body></html>`}function checkHtml(value){if(typeof value!="string")return{ok:!1,error:"html: must be a string holding one HTML document."};let html=value.trim();if(!html)return{ok:!1,error:"html: is empty; send one HTML document with inline style and script."};let bytes=utf8Bytes(html);return bytes>APP_LIMITS.htmlBytes?{ok:!1,error:`html: is ${bytes}\
|
|
1351
|
+
bytes, over the ${APP_LIMITS.htmlBytes}-byte limit; load libraries from a CDN and embed less data.`}:{ok:!0,value:wrapHtmlFragment(html)}}function checkJsx(value){if(typeof value!="string")return{ok:!1,error:"jsx: must be a string holding one React component file."};let jsx=value.trim();if(!jsx)return{ok:!1,error:"jsx: is empty; send one React component file with a default export."};let bytes=utf8Bytes(jsx);return bytes>APP_LIMITS.htmlBytes?{ok:!1,error:`jsx: is ${bytes} bytes, over the ${APP_LIMITS.
|
|
1352
|
+
htmlBytes}-byte limit; embed less data.`}:/\bexport\s+default\b/.test(jsx)?{ok:!0,value:jsx}:{ok:!1,error:"jsx: needs `export default` of the page's component."}}function checkPage(input2){let given2=value=>value!=null;if([input2.html,input2.jsx,input2.path].filter(given2).length>1)return{ok:!1,error:"Send one of html, jsx or path."};if(given2(input2.path)){let path=typeof input2.path=="string"?input2.path.trim():"";return!path||path.length>4096?{ok:!1,error:"path: the folder with index.html, or\
|
|
1353
|
+
the .html file, in your working folder."}:{ok:!0,value:{path}}}if(given2(input2.jsx)){let jsx=checkJsx(input2.jsx);return jsx.ok?{ok:!0,value:{jsx:jsx.value}}:jsx}let html=checkHtml(input2.html);return html.ok?{ok:!0,value:{html:html.value}}:html}function checkTitle(value){if(typeof value!="string")return{ok:!1,error:"title: must be a string of 1 to 80 characters."};let title=oneLine2(value);return!title||title.length>APP_LIMITS.title?{ok:!1,error:"title: must be 1 to 80 characters on one line."}:
|
|
1354
|
+
{ok:!0,value:title}}function checkFrameless(value){return value==null?{ok:!0,value:void 0}:typeof value!="boolean"?{ok:!1,error:"frameless: must be true or false."}:{ok:!0,value}}function checkLive(value,path){return value==null?{ok:!0,value:void 0}:typeof value!="boolean"?{ok:!1,error:"live: must be true or false."}:value&&path===void 0?{ok:!1,error:"live: only a page from a folder (path) can be live."}:{ok:!0,value}}function parseShowHtmlInput(input2){if(!isRecord2(input2))return{ok:!1,error:"\
|
|
1355
|
+
show_html needs {html, jsx or path, title, height?, fallback_text?}."};let page=checkPage(input2);if(!page.ok)return page;let title=checkTitle(input2.title);if(!title.ok)return title;let out={...page.value,title:title.value},frameless=checkFrameless(input2.frameless);if(!frameless.ok)return frameless;frameless.value&&(out.frameless=!0);let live=checkLive(input2.live,out.path);if(!live.ok)return live;if(live.value&&(out.live=!0),input2.height!==void 0&&input2.height!==null){if(typeof input2.height!=
|
|
1356
|
+
"number"||!Number.isFinite(input2.height))return{ok:!1,error:"height: must be a number of pixels, 80 to 720."};out.height=Math.round(Math.min(APP_LIMITS.heightMax,Math.max(APP_LIMITS.heightMin,input2.height)))}if(input2.fallback_text!==void 0&&input2.fallback_text!==null){if(typeof input2.fallback_text!="string")return{ok:!1,error:"fallback_text: must be a string."};let fallback=input2.fallback_text.trim();if(fallback.length>APP_LIMITS.fallback)return{ok:!1,error:`fallback_text: must be at most ${APP_LIMITS.
|
|
1357
|
+
fallback} characters.`};fallback&&(out.fallbackText=fallback)}return{ok:!0,value:out}}function parseUpdateHtmlInput(input2){if(!isRecord2(input2))return{ok:!1,error:"Replacing a page needs {app_id, html, jsx or path, title?}."};if(typeof input2.app_id!="string"||!/^[\w-]{1,128}$/.test(input2.app_id.trim()))return{ok:!1,error:"app_id: is required, the id show_html returned."};let page=checkPage(input2);if(!page.ok)return page;let out={appId:input2.app_id.trim(),...page.value},frameless=checkFrameless(
|
|
1358
|
+
input2.frameless);if(!frameless.ok)return frameless;frameless.value!==void 0&&(out.frameless=frameless.value);let live=checkLive(input2.live,out.path);if(!live.ok)return live;if(live.value!==void 0&&(out.live=live.value),input2.title!==void 0&&input2.title!==null){let title=checkTitle(input2.title);if(!title.ok)return title;out.title=title.value}return{ok:!0,value:out}}var FIELDS2=["value","label","title","caption"],KEY=/^(?:brief|chat\.notice|server\.meetings)\.[\w.]{1,80}$/,STYLES=new Set(["clock","bareClock","longDate","shortDate"]),MAX_PARAMS=8,MAX_DEPTH=3,MAX_STRING=400,isRecord3=value=>value!==null&&typeof value=="object"&&!Array.isArray(value);function readParam(raw,depth){if(typeof raw=="string")return raw.slice(0,MAX_STRING);if(typeof raw=="number")return Number.isFinite(raw)?raw:void 0;if(isRecord3(raw))return typeof raw.at=="number"&&Number.isFinite(
|
|
1359
|
+
raw.at)&&STYLES.has(raw.style)?{at:raw.at,style:raw.style,...typeof raw.zone=="string"&&raw.zone.length<=64?{zone:raw.zone}:{}}:readText(raw,depth+1)}function readText(raw,depth){if(!isRecord3(raw)||typeof raw.key!="string"||!KEY.test(raw.key)||depth>MAX_DEPTH)return;if(raw.params===void 0)return{key:raw.key};if(!isRecord3(raw.params))return;let entries=Object.entries(raw.params).slice(0,MAX_PARAMS).map(([name,value])=>[name,readParam(value,depth)]);if(!entries.some(([name,value])=>value===void 0||
|
|
1360
|
+
!/^\w{1,32}$/.test(name)))return{key:raw.key,params:Object.fromEntries(entries)}}function readWidgetText(raw){if(!isRecord3(raw))return;let fields2={};for(let field of FIELDS2){let text2=readText(raw[field],0);text2&&(fields2[field]=text2)}return Object.keys(fields2).length?fields2:void 0}function buttonStyle(raw){return raw.color==="danger"||raw.style==="danger"?"danger":raw.variant==="ghost"||raw.style==="quiet"?"quiet":raw.style==="secondary"||raw.variant==="outline"||raw.variant==="soft"||raw.color==="secondary"?"secondary":raw.style==="primary"||raw.color==="primary"||raw.variant==="solid"||raw.submit===!0?"primary":"secondary"}var WIDGET_LIMITS={bytes:32e3,nodes:250,depth:10,listItems:40,options:40,fields:20,tableRows:60,tableCols:8,chartRows:100,chartSeries:4,images:6,text:2e3,markdown:6e3,title:120,caption:240,label:80,actionPayloadBytes:2e3,fieldValue:2e3,fallback:1500},WIDGET_ICON_NAMES=["info","agent","analytics","atom","batch","bolt","book-open","book-closed","book-clock","bug","calendar","chart","check","check-circle","check-circle-filled","chevron-left","chevron-right","circle-question","compass","confetti","c\
|
|
1361
|
+
ube","desktop","document","dot","dots-horizontal","dots-vertical","empty-circle","external-link","globe","keys","lab","images","lifesaver","lightbulb","mail","map-pin","maps","mobile","name","notebook","notebook-pencil","page-blank","phone","play","plus","profile","profile-card","reload","star","star-filled","search","sparkle","sparkle-double","square-code","square-image","square-text","suitcase","settings-slider","user","wreath","write","write-alt","write-alt2","pull-request","upload","download",
|
|
1362
|
+
"clock","lock","link","file","folder","bell","warning","close","arrow-right"],THREAD_ID=/^[\w-]{1,128}$/;function threadActionTarget(action2){if(action2.type!=="open_thread"||!isRecord4(action2.payload))return;let{botId,groupId,threadId}=action2.payload;if(!(typeof threadId!="string"||!THREAD_ID.test(threadId))){if(typeof botId=="string"&&THREAD_ID.test(botId)&&groupId===void 0)return{botId,threadId};if(typeof groupId=="string"&&THREAD_ID.test(groupId)&&botId===void 0)return{groupId,threadId}}}var PHONE_PAIRING_ACTION="open_phone_pairing",CLIENT_ACTION=action2=>action2.type==="open_url"||action2.type==="open_thread"||action2.type===PHONE_PAIRING_ACTION,ROOT_TYPES=new Set(["Card","ListView"]),FIELD_TYPES=new Set(["Select","DatePicker","TimePicker","DayPicker","Checkbox","RadioGroup","Input","Textarea"]),TYPE_ALIASES={TableRow:"Table.Row",TableCell:"Table.Cell"},ACTION_TYPE=/^[A-Za-z0-9_.:-]{1,64}$/,FIELD_NAME=/^[A-Za-z0-9_.-]{1,64}$/,ISO_DATE=/^\d{4}-\d{2}-\d{2}$/,TIME_OF_DAY=/^([01]\d|2[0-3]):[0-5]\d$/,
|
|
1363
|
+
WIDGET_WEEKDAYS=["mon","tue","wed","thu","fri","sat","sun"],WidgetInputError=class extends Error{};function fail(path,message){throw new WidgetInputError(`${path}: ${message}`)}function isRecord4(value){return!!value&&typeof value=="object"&&!Array.isArray(value)}var clamp=(value,low,high)=>Math.min(high,Math.max(low,value));function text(max,mode="optional"){return(raw,path)=>{if(raw==null)return mode==="optional"?void 0:fail(path,"is required");if(typeof raw!="string"&&typeof raw!="number")return fail(
|
|
1364
|
+
path,"must be a string");let value=String(raw).trim();if(value.length>max)return fail(path,`must be at most ${max} characters`);if(!value&&mode==="nonEmpty")return fail(path,"must not be blank");if(!(!value&&mode==="optional"))return value}}function line2(max,mode="optional"){let read=text(max,mode);return(raw,path)=>read(typeof raw=="string"?raw.replace(/\s+/g," "):raw,path)}function oneOf(...values){return raw=>typeof raw=="string"&&values.includes(raw)?raw:void 0}function mapped(map2){return raw=>typeof raw==
|
|
1365
|
+
"string"&&Object.hasOwn(map2,raw)?map2[raw]:void 0}var on=raw=>raw===!0?!0:void 0,off=raw=>raw===!1?!1:void 0;function pxOf(raw){let match=typeof raw=="string"?/^(\d+(?:\.\d+)?)px$/.exec(raw.trim()):null;return match?Number(match[1]):void 0}function spacing(max=64){return raw=>{let px=typeof raw=="number"&&Number.isFinite(raw)?raw*4:pxOf(raw);return px===void 0?void 0:clamp(Math.round(px),0,max)}}function length(max=2e3){return raw=>{if(raw==="100%"||raw==="full")return"full";let px=typeof raw==
|
|
1366
|
+
"number"&&Number.isFinite(raw)?raw:pxOf(raw);return px===void 0||px<1?void 0:clamp(Math.round(px),1,max)}}function integer2(min,max){return raw=>{let value=typeof raw=="string"&&raw.trim()?Number(raw):raw;return typeof value=="number"&&Number.isFinite(value)?clamp(Math.round(value),min,max):void 0}}function decimal(min,max){return raw=>{let value=typeof raw=="string"&&raw.trim()?Number(raw):raw;return typeof value=="number"&&Number.isFinite(value)?clamp(value,min,max):void 0}}var padding=raw=>{let side=spacing();
|
|
1367
|
+
if(!isRecord4(raw)){let all=side(raw,"");return typeof all=="number"?[all,all,all,all]:void 0}let pick2=(...keys)=>{for(let key of keys){let value=side(raw[key],"");if(typeof value=="number")return value}return 0},sides=[pick2("top","y"),pick2("right","x"),pick2("bottom","y"),pick2("left","x")];return sides.some(Boolean)?sides:void 0},RADII={none:0,"2xs":2,xs:4,sm:6,md:8,lg:12,xl:16,"2xl":20,"3xl":24,"4xl":28,full:999,"100%":999},radius=raw=>typeof raw=="number"&&Number.isFinite(raw)?clamp(Math.
|
|
1368
|
+
round(raw),0,999):typeof raw=="string"&&Object.hasOwn(RADII,raw)?RADII[raw]:void 0,aspectRatio=raw=>{let parts=typeof raw=="string"?/^(\d+(?:\.\d+)?)\s*\/\s*(\d+(?:\.\d+)?)$/.exec(raw.trim()):null,value=parts?Number(parts[1])/Number(parts[2]):typeof raw=="string"?Number(raw):raw;return typeof value=="number"&&Number.isFinite(value)&&value>0?clamp(value,.1,10):void 0},background=mapped({surface:"surface",secondary:"secondary",tertiary:"tertiary",elevated:"elevated","surface-secondary":"secondary",
|
|
1369
|
+
"surface-tertiary":"tertiary","surface-elevated":"elevated","surface-elevated-secondary":"elevated"}),inkColor=mapped({prose:"primary",primary:"primary",emphasis:"primary",secondary:"secondary",tertiary:"tertiary",success:"success",warning:"warning",danger:"danger"}),border=raw=>{let size=isRecord4(raw)?raw.size:raw;return typeof size=="number"&&Number.isFinite(size)&&size>0?clamp(Math.round(size),1,2):void 0},weight=oneOf("normal","medium","semibold","bold"),textAlign=oneOf("start","center","en\
|
|
1370
|
+
d");function icon(fallback){return raw=>typeof raw=="string"&&WIDGET_ICON_NAMES.includes(raw)?raw:raw==null?void 0:fallback}var flexShare=(raw,path)=>{let share=decimal(0,12)(raw,path),rounded=typeof share=="number"?Math.round(share*100)/100:0;return rounded>0?rounded:void 0},DATE_YEARS={min:1900,max:2200},isoDate=raw=>{if(typeof raw!="string"||!ISO_DATE.test(raw)||Number.isNaN(Date.parse(`${raw}T00:00:00Z`)))return;let year=Number(raw.slice(0,4));return year>=DATE_YEARS.min&&year<=DATE_YEARS.max?
|
|
1371
|
+
raw:void 0},timeOfDay=raw=>{let match=typeof raw=="string"?/^(\d{1,2}):(\d{2})(?::\d{2})?$/.exec(raw.trim()):null,value=match?`${match[1].padStart(2,"0")}:${match[2]}`:void 0;return value&&TIME_OF_DAY.test(value)?value:void 0};function weekdays(raw){let items=Array.isArray(raw)?raw:typeof raw=="string"?raw.split(","):[],picked=new Set(items.filter(item=>typeof item=="string").map(item=>item.trim().toLowerCase().slice(0,3))),days=WIDGET_WEEKDAYS.filter(day=>picked.has(day));return days.length?days.
|
|
1372
|
+
join(","):void 0}var weekdaysReader=raw=>weekdays(raw),progressValue=raw=>{let percent=typeof raw=="string"?/^\s*(\d+(?:\.\d+)?)\s*%\s*$/.exec(raw):null,value=percent?Number(percent[1])/100:typeof raw=="string"&&raw.trim()?Number(raw):raw;if(!(typeof value!="number"||!Number.isFinite(value)||value<0))return clamp(value>1&&value<=100?value/100:value,0,1)},action=(raw,path)=>{if(raw==null)return;if(!isRecord4(raw)||typeof raw.type!="string"||!ACTION_TYPE.test(raw.type))return fail(path,'must be {t\
|
|
1373
|
+
ype, payload?} with a type of letters, digits and "_.:-"');let out={type:raw.type};if(raw.payload!==void 0){let json2=JSON.stringify(raw.payload);if(json2===void 0)return fail(`${path}.payload`,"must be JSON");if(json2.length>WIDGET_LIMITS.actionPayloadBytes)return fail(`${path}.payload`,`must be at most ${WIDGET_LIMITS.actionPayloadBytes} characters of JSON`);out.payload=JSON.parse(json2)}return out.type==="open_url"&&!isWebUrl(isRecord4(out.payload)?out.payload.url:void 0,["http:","https:"])?fail(
|
|
1374
|
+
`${path}.payload.url`,"open_url needs an http or https url"):out.type==="open_thread"&&!threadActionTarget(out)?fail(`${path}.payload`,"open_thread needs {botId, threadId} or {groupId, threadId}"):out},WEB_URL_MAX=2e3;function isWebUrl(value,protocols){if(typeof value!="string"||value.length>WEB_URL_MAX)return!1;try{return protocols.includes(new URL(value).protocol)}catch{return!1}}var buttonSpec=(raw,path)=>raw==null?void 0:isRecord4(raw)?{label:line2(WIDGET_LIMITS.label,"nonEmpty")(raw.label,`${path}\
|
|
1375
|
+
.label`),action:action(raw.action,`${path}.action`)??fail(`${path}.action`,"is required")}:fail(path,"must be {label, action}"),status=(raw,path)=>{if(raw==null)return;let record6=isRecord4(raw)?raw:{text:raw},label=line2(WIDGET_LIMITS.caption,"nonEmpty")(record6.text,`${path}.text`),name=icon()(record6.icon,`${path}.icon`);return name?{text:label,icon:name}:{text:label}},options=(raw,path)=>{if(!Array.isArray(raw)||raw.length<1||raw.length>WIDGET_LIMITS.options)return fail(path,`needs 1 to ${WIDGET_LIMITS.
|
|
1376
|
+
options} items`);let seen=new Set;return raw.map((item,index)=>{let at=`${path}[${index}]`,record6=isRecord4(item)?item:{value:item},value=line2(200,"nonEmpty")(typeof record6.value=="boolean"?String(record6.value):record6.value,`${at}.value`);return seen.has(value)?fail(at,`repeats the value ${JSON.stringify(value)}`):(seen.add(value),{label:line2(WIDGET_LIMITS.label)(record6.label,`${at}.label`)??value,value})})},UNSAFE_KEYS=new Set(["__proto__","constructor","prototype"]),fieldName=(raw,path)=>typeof raw==
|
|
1377
|
+
"string"&&FIELD_NAME.test(raw)&&!raw.split(".").some(part=>UNSAFE_KEYS.has(part))?raw:fail(path,'is required: letters, digits and "_.-", at most 64'),optionalFieldName=(raw,path)=>raw==null?void 0:fieldName(raw,path),inputType=(raw,path)=>raw==="password"?fail(path,"password fields are not allowed in a widget; use request_credential for secrets"):oneOf("text","number","email","tel","url")(raw,path),imageSrc=(raw,path)=>isWebUrl(raw,["https:"])?raw:fail(path,"must be an https url"),CHART_MAX=1e12,
|
|
1378
|
+
chartData=(raw,path)=>!Array.isArray(raw)||raw.length<1||raw.length>WIDGET_LIMITS.chartRows?fail(path,`needs 1 to ${WIDGET_LIMITS.chartRows} rows`):raw.map((row,index)=>{if(!isRecord4(row))return fail(`${path}[${index}]`,"must be an object");let out={};for(let[key,value]of Object.entries(row).slice(0,12))UNSAFE_KEYS.has(key)||(typeof value=="number"?Number.isFinite(value):typeof value=="string"||value===null)&&(out[key.slice(0,64)]=typeof value=="string"?value.slice(0,120):typeof value=="number"?
|
|
1379
|
+
clamp(value,-CHART_MAX,CHART_MAX):null);return out}),chartSeries=(raw,path)=>!Array.isArray(raw)||raw.length<1||raw.length>WIDGET_LIMITS.chartSeries?fail(path,`needs 1 to ${WIDGET_LIMITS.chartSeries} series`):raw.map((item,index)=>{let at=`${path}[${index}]`;if(!isRecord4(item))return fail(at,"must be {type, dataKey}");let series={type:oneOf("bar","line","area")(item.type,at)??"bar",dataKey:text(64,"nonEmpty")(item.dataKey,`${at}.dataKey`)},label=line2(WIDGET_LIMITS.label)(item.label,`${at}.labe\
|
|
1380
|
+
l`);typeof label=="string"&&(series.label=label);let stack=text(32)(item.stack,`${at}.stack`);return typeof stack=="string"&&(series.stack=stack),series}),chartAxis=(raw,path)=>({dataKey:text(64,"nonEmpty")(isRecord4(raw)?raw.dataKey:raw,`${path}.dataKey`)}),LAYOUT={gap:spacing(),padding,align:oneOf("start","center","end","baseline","stretch"),justify:oneOf("start","center","end","between","around","evenly","stretch"),wrap:raw=>raw===!0||raw==="wrap"?!0:void 0,flex:flexShare,width:length(),height:length(),
|
|
1381
|
+
minWidth:length(),maxWidth:length(),minHeight:length(),maxHeight:length(),aspectRatio,background,border,radius},TEXT_STYLE={weight,color:inkColor,textAlign,truncate:on,maxLines:integer2(1,20),width:length()},ROOT={title:line2(WIDGET_LIMITS.title),caption:line2(WIDGET_LIMITS.caption),meta:line2(WIDGET_LIMITS.label),status,confirm:buttonSpec,cancel:buttonSpec},FIELD={name:fieldName,label:line2(WIDGET_LIMITS.title),disabled:on,required:on},PLACEHOLDER=line2(WIDGET_LIMITS.title),SPECS={Card:{props:{
|
|
1382
|
+
...ROOT,size:oneOf("sm","md","lg","full"),padding},children:"any"},ListView:{props:{...ROOT,limit:integer2(1,WIDGET_LIMITS.listItems),name:optionalFieldName,defaultValue:line2(200)},children:"items"},ListViewItem:{props:{gap:spacing(),align:LAYOUT.align,onClickAction:action,value:line2(200)},children:"any"},Box:{props:{...LAYOUT,direction:oneOf("row","col")},children:"any"},Row:{props:LAYOUT,children:"any"},Col:{props:LAYOUT,children:"any"},Form:{props:{...LAYOUT,direction:oneOf("row","col"),onSubmitAction:action},
|
|
1383
|
+
children:"any"},Spacer:{props:{minSize:length(400)}},Divider:{props:{spacing:spacing(),flush:on}},Table:{props:{},children:"rows"},"Table.Row":{props:{header:on},children:"cells"},"Table.Cell":{props:{align:textAlign,vAlign:textAlign,colSpan:integer2(1,WIDGET_LIMITS.tableCols),rowSpan:integer2(1,20),width:length(),colSize:oneOf("xs","sm","md","lg","xl"),padding},children:"any"},Text:{props:{value:text(WIDGET_LIMITS.text,"required"),size:oneOf("xs","sm","md","lg","xl"),...TEXT_STYLE,italic:on,lineThrough:on,
|
|
1384
|
+
minLines:integer2(1,20)}},Title:{props:{value:text(WIDGET_LIMITS.text,"required"),size:oneOf("sm","md","lg","xl","2xl","3xl","4xl","5xl"),...TEXT_STYLE}},Caption:{props:{value:text(WIDGET_LIMITS.text,"required"),size:oneOf("sm","md","lg"),...TEXT_STYLE}},Label:{props:{value:line2(WIDGET_LIMITS.title,"nonEmpty"),fieldName:text(64),size:oneOf("xs","sm","md","lg","xl"),weight,color:inkColor,textAlign,width:length()}},Markdown:{props:{value:text(WIDGET_LIMITS.markdown,"required")}},Image:{props:{src:imageSrc,
|
|
1385
|
+
alt:line2(WIDGET_LIMITS.caption),fit:oneOf("none","fill","cover","contain","scale-down"),position:oneOf("center","top","bottom","left","right","top left","top right","bottom left","bottom right"),frame:on,flush:on,width:length(),height:length(),minWidth:length(),maxWidth:length(),minHeight:length(),maxHeight:length(),aspectRatio,radius}},Icon:{props:{name:icon("dot"),color:inkColor,size:oneOf("xs","sm","md","lg","xl","2xl","3xl")}},Chart:{props:{data:chartData,series:chartSeries,xAxis:chartAxis,
|
|
1386
|
+
showYAxis:on,showLegend:off,showGrid:off,height:length(400),aspectRatio,flex:flexShare,width:length()}},Badge:{props:{label:line2(WIDGET_LIMITS.label,"nonEmpty"),color:oneOf("secondary","success","danger","warning","info","discovery"),variant:oneOf("soft","solid","outline","dot"),size:oneOf("sm","md","lg"),pill:off}},Progress:{props:{value:progressValue,label:line2(WIDGET_LIMITS.caption)}},Button:{props:{label:line2(WIDGET_LIMITS.label),iconStart:icon(),iconEnd:icon(),block:on,disabled:on,submit:on,
|
|
1387
|
+
onClickAction:action}},Select:{props:{...FIELD,options,placeholder:PLACEHOLDER,defaultValue:text(200),clearable:on,block:on}},DatePicker:{props:{...FIELD,placeholder:PLACEHOLDER,defaultValue:isoDate,min:isoDate,max:isoDate,clearable:on,block:on}},TimePicker:{props:{...FIELD,placeholder:PLACEHOLDER,defaultValue:timeOfDay,min:timeOfDay,max:timeOfDay,step:integer2(1,60),clearable:on,block:on}},DayPicker:{props:{...FIELD,defaultValue:weekdaysReader}},Checkbox:{props:{...FIELD,defaultChecked:on}},RadioGroup:{
|
|
1388
|
+
props:{...FIELD,options,defaultValue:text(200),direction:oneOf("row","col"),ariaLabel:line2(WIDGET_LIMITS.title)}},Input:{props:{...FIELD,inputType,placeholder:PLACEHOLDER,defaultValue:text(WIDGET_LIMITS.fieldValue),pattern:text(200)}},Textarea:{props:{...FIELD,placeholder:PLACEHOLDER,defaultValue:text(WIDGET_LIMITS.fieldValue),rows:integer2(1,12),maxRows:integer2(1,20),autoResize:on}},Transition:{props:{},children:"one"}},WIDGET_NODE_TYPES=Object.keys(SPECS);function typeOf(raw){return typeof raw.
|
|
1389
|
+
type=="string"?TYPE_ALIASES[raw.type]??raw.type:""}function normalize(input2,path,depth,slot,context){if(!isRecord4(input2))return fail(path,"must be an object with a type");let raw=input2,type=typeOf(raw);if(!Object.hasOwn(SPECS,type))return fail(path,`unknown type ${JSON.stringify(raw.type)}; use one of ${WIDGET_NODE_TYPES.join(", ")}`);if(slot==="items"&&type!=="ListViewItem"&&([raw,type]=[{type:"ListViewItem",children:[raw]},"ListViewItem"]),slot==="cells"&&type!=="Table.Cell"&&([raw,type]=[
|
|
1390
|
+
{type:"Table.Cell",children:[raw]},"Table.Cell"]),slot==="rows"&&type!=="Table.Row")return fail(path,"a Table takes Table.Row children");if(slot!=="root"&&ROOT_TYPES.has(type))return fail(path,`${type} is a root and cannot be nested`);if(slot==="any"&&(type==="Table.Row"||type==="Table.Cell"))return fail(path,`${type} belongs inside a Table`);if(depth>WIDGET_LIMITS.depth)return fail(path,`is nested deeper than ${WIDGET_LIMITS.depth} levels`);if(context.nodes+=1,context.nodes>WIDGET_LIMITS.nodes)
|
|
1391
|
+
return fail(path,`the widget has more than ${WIDGET_LIMITS.nodes} nodes`);let spec=SPECS[type],node2={type,id:`n${context.nodes}`},source={...raw};for(let[shorthand,a,b2]of[["size","width","height"],["minSize","minWidth","minHeight"],["maxSize","maxWidth","maxHeight"]]){let both=source[shorthand];type==="Card"||type==="Spacer"||!(typeof both=="number"||both==="100%"||pxOf(both)!==void 0)||(source[a]??=both,source[b2]??=both)}for(let[key,read]of Object.entries(spec.props)){let value=read(source[key],
|
|
1392
|
+
`${path}.${key}`);value!==void 0&&(node2[key]=value)}if(type==="Button"&&(node2.style=buttonStyle(raw)),raw.i18n!==void 0&&(node2.i18n=readWidgetText(raw.i18n)),type==="Icon"&&(node2.name??="dot"),type==="Progress"){let max=typeof raw.max=="number"&&Number.isFinite(raw.max)&&raw.max>0?raw.max:void 0,given2=typeof raw.value=="number"&&Number.isFinite(raw.value)?raw.value:void 0;if(max!==void 0&&given2!==void 0&&(node2.value=clamp(given2/max,0,1)),node2.value===void 0)return fail(`${path}.value`,"\
|
|
1393
|
+
is required: a number from 0 to 1")}if(type==="Image"&&++context.images>WIDGET_LIMITS.images)return fail(path,`the widget has more than ${WIDGET_LIMITS.images} images`);if(FIELD_TYPES.has(type)){let name=node2.name;if(context.fields.has(name))return fail(`${path}.name`,`repeats the field name ${JSON.stringify(name)}`);if(context.fields.add(name),context.fields.size>WIDGET_LIMITS.fields)return fail(path,`the widget has more than ${WIDGET_LIMITS.fields} fields`);if(type==="TimePicker"||type==="Dat\
|
|
1394
|
+
ePicker"){typeof node2.min=="string"&&typeof node2.max=="string"&&node2.min>node2.max&&delete node2.max;let picked=node2.defaultValue;typeof picked=="string"&&(typeof node2.min=="string"&&picked<node2.min||typeof node2.max=="string"&&picked>node2.max)&&delete node2.defaultValue}let chosen=node2.defaultValue;(type==="Select"||type==="RadioGroup")&&chosen!==void 0&&!node2.options.some(option=>option.value===chosen)&&delete node2.defaultValue,(type==="Select"||type==="RadioGroup")&&(node2.allowOther=
|
|
1395
|
+
raw.allowOther!==!1)}if(spec.children){let list=raw.children===void 0||raw.children===null?[]:Array.isArray(raw.children)?raw.children:[raw.children],kept=spec.children==="one"?list.slice(0,1):list;if(type==="ListView"&&kept.length>WIDGET_LIMITS.listItems)return fail(`${path}.children`,`a list takes at most ${WIDGET_LIMITS.listItems} items`);if(type==="Table"&&kept.length>WIDGET_LIMITS.tableRows)return fail(`${path}.children`,`a table takes at most ${WIDGET_LIMITS.tableRows} rows`);if(type==="Ta\
|
|
1396
|
+
ble.Row"&&kept.length>WIDGET_LIMITS.tableCols)return fail(`${path}.children`,`a row takes at most ${WIDGET_LIMITS.tableCols} cells`);let childSlot=spec.children==="one"?"any":spec.children;node2.children=kept.map((child,index)=>normalize(child,`${path}.children[${index}]`,depth+1,childSlot,context))}if(type==="ListView")if(typeof node2.name=="string")selectable(node2,raw,path,context);else{delete node2.defaultValue;for(let row of node2.children??[])delete row.value}return type==="ListViewItem"&&
|
|
1397
|
+
slot!=="items"&&delete node2.value,node2}function selectable(list,raw,path,context){let name=list.name;context.fields.has(name)&&fail(`${path}.name`,`repeats the field name ${JSON.stringify(name)}`),context.fields.add(name),context.fields.size>WIDGET_LIMITS.fields&&fail(path,`the widget has more than ${WIDGET_LIMITS.fields} fields`),isRecord4(list.confirm)||fail(`${path}.confirm`,"a list with a name lets the person choose a row; it needs confirm: {label, action} to send the choice");let rows=list.
|
|
1398
|
+
children??[];rows.length<2&&fail(`${path}.children`,"a list with a name needs at least two rows to choose from");let seen=new Set;rows.forEach((row,index)=>{let at=`${path}.children[${index}]`;row.onClickAction!==void 0&&fail(`${at}.onClickAction`,"the rows of a list with a name are selected, not pressed; remove onClickAction from the rows, or remove name from the list");let value=widgetString(row,"value")??(firstText(row)||String(index+1));seen.has(value)&&fail(`${at}.value`,`repeats the value ${JSON.
|
|
1399
|
+
stringify(value)}; give each row its own value`),seen.add(value),row.value=value}),raw.required!==!1&&(list.required=!0),list.allowOther=raw.allowOther!==!1,typeof list.defaultValue=="string"&&!seen.has(list.defaultValue)&&delete list.defaultValue}function parseWidgetInput(value){let raw=value;if(typeof raw=="string")try{raw=JSON.parse(raw)}catch{return{ok:!1,error:"widget: must be a JSON object, not text."}}if(!isRecord4(raw))return{ok:!1,error:"widget: must be an object with a type."};let bytes;try{bytes=JSON.stringify(raw).length}catch{return{ok:!1,error:"widget: must be plain JSON."}}if(bytes>WIDGET_LIMITS.bytes)return{ok:!1,error:`widget: is ${bytes} characters of JSON; keep it under ${WIDGET_LIMITS.bytes}.`};try{let rooted=ROOT_TYPES.
|
|
1400
|
+
has(typeOf(raw))?raw:{type:"Card",children:[raw]},root=normalize(rooted,"widget",1,"root",{nodes:0,images:0,fields:new Set}),seen=new Map;for(let entry of collectActions(root,!0)){if(!entry.label)return{ok:!1,error:`widget: the ${entry.kind} at ${entry.ref} has an action but no label; give it a label (a list item takes its first Text or Title).`};if(!entry.client){if(seen.has(entry.label))return{ok:!1,error:`widget: two actions are both labelled ${JSON.stringify(entry.label)}; give each a distin\
|
|
1401
|
+
ct label.`};seen.set(entry.label,entry.ref)}}return{ok:!0,value:root}}catch(error62){if(error62 instanceof WidgetInputError)return{ok:!1,error:`${error62.message}.`};throw error62}}var widgetString=(node2,key)=>typeof node2[key]=="string"?node2[key]:void 0;function buttonSpecOf(root,key){let spec=root[key];return isRecord4(spec)&&typeof spec.label=="string"&&isRecord4(spec.action)?spec:void 0}function walk(node2,visit2,ancestors=[]){visit2(node2,ancestors);let next=[...ancestors,node2];for(let child of Array.isArray(node2.children)?node2.children:[])isRecord4(child)&&walk(child,visit2,next)}function lastOf(items,match){for(let index=items.length-1;index>=0;index-=1)if(match(items[index]))return items[index]}function firstText(node2){let found="";return walk(
|
|
1402
|
+
node2,inner=>{found||inner.type!=="Title"&&inner.type!=="Text"||typeof inner.value!="string"||typeof inner.width=="number"||(found=inner.value.replace(/\s+/g," ").trim().slice(0,WIDGET_LIMITS.label))}),found}function collectActions(root,strict){let found=[];walk(root,(node2,ancestors)=>{if(node2.type==="Button"){if(node2.disabled===!0)return;let form=lastOf(ancestors,ancestor=>ancestor.type==="Form"),own2=isRecord4(node2.onClickAction)?node2.onClickAction:void 0,submitted=node2.submit===!0&&isRecord4(
|
|
1403
|
+
form?.onSubmitAction)?form.onSubmitAction:void 0,picked=own2??submitted;if(!picked){if(strict&&node2.submit===!0)throw new WidgetInputError(`widget: the submit Button at ${node2.id} needs a Form with onSubmitAction around it`);return}let row=lastOf(ancestors,ancestor=>ancestor.type==="ListViewItem"||ancestor.type==="Table.Row"||ancestor.type==="Row");found.push({ref:node2.id,label:widgetString(node2,"label")??"",action:picked,kind:"button",...node2.submit===!0?{tone:"submit"}:{},...row?{row:firstText(
|
|
1404
|
+
row)}:{}})}else node2.type==="ListViewItem"&&isRecord4(node2.onClickAction)&&found.push({ref:node2.id,label:firstText(node2),action:node2.onClickAction,kind:"item"})});for(let key of["confirm","cancel"]){let spec=buttonSpecOf(root,key);spec&&found.push({ref:key,label:spec.label,action:spec.action,tone:key,kind:key})}let counts=new Map;for(let entry of found)counts.set(entry.label,(counts.get(entry.label)??0)+1);return found.map(({row,...entry})=>({...entry,...CLIENT_ACTION(entry.action)?{client:!0}:
|
|
1405
|
+
{},label:row&&entry.label&&(counts.get(entry.label)??0)>1?`${entry.label}: ${row}`.slice(0,WIDGET_LIMITS.label*2):entry.label}))}function widgetActions(root){return collectActions(root,!1)}function widgetScope(root,ref){let scope=root;return walk(root,(node2,ancestors)=>{node2.id===ref&&(scope=lastOf(ancestors,ancestor=>ancestor.type==="Form")??root)}),scope}function widgetFields(scope,root=scope){let labels=new Map;walk(root,node2=>{node2.type==="Label"&&typeof node2.fieldName=="string"&&typeof node2.value=="string"&&labels.set(node2.fieldName,node2.value)});let fields2=[];return walk(scope,node2=>{if(typeof node2.name!="string"||!(FIELD_TYPES.has(node2.type)||node2.type==="ListV\
|
|
1406
|
+
iew"))return;let own2=node2.type==="ListView"?widgetString(node2,"title"):widgetString(node2,"label");fields2.push({name:node2.name,type:node2.type,node:node2,label:labels.get(node2.name)??own2??node2.name})}),fields2}function widgetAdvice(root){let notes=[],rows=Array.isArray(root.children)?root.children.length:0;root.type==="ListView"&&rows>=2&&buttonSpecOf(root,"confirm")&&widgetFields(root).length===0&&!widgetActions(root).some(entry=>entry.kind==="item"||entry.kind==="button")&¬es.push("No row of this list can be chosen: the person can only confirm or cancel it as a whole. If they are meant to pick one row, show it again with its widget_id and give the ListView a name (and each row a value), so the ro\
|
|
1407
|
+
ws become selectable and confirm sends the pick.");let fields2=widgetFields(root),sending=widgetActions(root).filter(entry=>!entry.client&&entry.tone!=="cancel");if(fields2.length>0&&!sending.length)notes.push("Nothing in this widget sends what the person fills in. Show it again with its widget_id and confirm: {label, action} (and cancel if they may decline) so they can send it.");else if(fields2.length>0){let sent=new Set(sending.flatMap(entry=>widgetFields(widgetScope(root,entry.ref),root).map(
|
|
1408
|
+
field=>field.name))),unsent=fields2.filter(field=>!sent.has(field.name)).map(field=>JSON.stringify(field.label));unsent.length&¬es.push(`${unsent.join(", ")} sits outside the Form whose button is the only way to send, so it is never sent. Show it again with its widget_id, with it inside that Form or with confirm on the Card.`)}let typed=fields2.filter(field=>field.type==="Input"),phrase=field=>`${field.name} ${field.label} ${widgetString(field.node,"placeholder")??""}`.replace(/\b(each|every|this|next|first|last|any|some|one|other|same|spare|free|full|part|lead|over|down)[\s-]+times?\b/gi,
|
|
1409
|
+
" ").replace(/\btimes\b/gi," "),asks=pattern=>typed.filter(field=>pattern.test(phrase(field))).map(field=>field.label),pickers=[[/\b(time|o'?clock|hh:mm)\b|\b\d{1,2}(:\d{2})?\s?[ap]m\b|\b\d{1,2}:\d{2}\b/i,"TimePicker"],[/\b(days|weekdays?|weekly|repeats?|repeating|(which|what) days?|days? of the week)\b/i,"DayPicker"],[/\b(dates?|deadline|due)\b/i,"DatePicker"]],seen=new Set;for(let[pattern,picker]of pickers){let labels=asks(pattern).filter(label=>!seen.has(label));labels.forEach(label=>seen.add(
|
|
1410
|
+
label)),labels.length&¬es.push(`${labels.map(label=>JSON.stringify(label)).join(", ")} asks the person to type what a ${picker} lets them pick. Show it again with its widget_id and a ${picker} in its place.`)}return notes.length?notes.join(" "):void 0}var CARD_TOOL_NAMES=new Set(["create_options_card","show_widget","show_html"]),CARD_ROUTE="/api/internal/options-card",MASKED=" Something in it read as a secret and was masked before it was stored. Never put secrets in a page or a widget.";async function callAppTool(name,args,context){let updating=name==="update_html",parsed=updating?parseUpdateHtmlInput(args):parseShowHtmlInput(args);if(!parsed.ok)return{text:parsed.error,isError:!0};let page=parsed.value.jsx!==void 0?{jsx:args.jsx}:parsed.value.
|
|
1411
|
+
path!==void 0?{path:args.path}:{html:args.html},frameless=parsed.value.frameless!==void 0?{frameless:parsed.value.frameless}:{},live=parsed.value.live!==void 0?{live:parsed.value.live}:{},body=updating?{tool:name,app_id:args.app_id,...page,...typeof args.title=="string"?{title:args.title}:{},...frameless,...live}:{tool:name,...page,title:args.title,...typeof args.height=="number"?{height:args.height}:{},...typeof args.fallback_text=="string"?{fallback_text:args.fallback_text}:{},...frameless,...live},
|
|
1412
|
+
answer=await context.client.apiResponse(CARD_ROUTE,{method:"POST",body:JSON.stringify(body)});if(!answer.ok)return{text:String(answer.body.error??(updating?"Could not update that page.":"Could not show that page.")),isError:!0};let messageId=String(answer.body.messageId??""),masked=answer.body.masked===!0?MASKED:"",leftOut2=typeof answer.body.leftOut=="string"&&answer.body.leftOut?` ${answer.body.leftOut}`:"";return{text:(updating?`Updated app ${messageId}.`:`Shown as app ${messageId}. To change\
|
|
1413
|
+
it, call show_html again with app_id "${messageId}".`)+leftOut2+masked}}async function callCardTool(name,args,context){let{api,apiResponse}=context.client;if(name==="create_options_card"){if(context.botId!==WATCHER_OPTIONS_CARD_BOT_ID)return{text:"create_options_card is not enabled for this bot.",isError:!0};let parsed2=parseOptionsCardInput(args);if(!parsed2.ok)return{text:parsed2.error,isError:!0};let result=await api(CARD_ROUTE,{method:"POST",body:JSON.stringify(parsed2.value)});return{text:`\
|
|
1414
|
+
Rendered the native options card in this Watcher thread (message ${String(result.messageId??"created")}). Wait for the person's click or custom response; the card itself authorizes no external action.`}}if(name==="show_html")return callAppTool(agentsCallMember(name,args)==="update_html"?"update_html":"show_html",args,context);let parsed=parseWidgetInput(args.widget);if(!parsed.ok)return{text:parsed.error,isError:!0};let updating=agentsCallMember(name,args)==="update_widget";if(updating&&(typeof args.
|
|
1415
|
+
widget_id!="string"||!args.widget_id.trim()))return{text:"widget_id: is required, the id show_widget returned.",isError:!0};let{ok,body}=await apiResponse(CARD_ROUTE,{method:"POST",body:JSON.stringify(updating?{tool:"update_widget",widget_id:args.widget_id,widget:args.widget}:{tool:"show_widget",widget:args.widget,...typeof args.fallback_text=="string"?{fallback_text:args.fallback_text}:{}})});if(!ok)return{text:String(body.error??(updating?"Could not update that widget.":"Could not show that wi\
|
|
1416
|
+
dget.")),isError:!0};let messageId=String(body.messageId??""),masked=body.masked===!0?" Something in it read as a secret and was masked before it was stored. Never put secrets in a widget, and name a payload field key, token or password only when it holds one.":"",advice=widgetAdvice(parsed.value);return{text:(updating?`Updated widget ${messageId}.`:`Shown as widget ${messageId}. Its answer arrives as the person's next message, even while you are still working; if they type something else instea\
|
|
1417
|
+
d, that is their answer. Do what does not depend on it, then end your turn without asking again in text. To change it later, call show_widget again with widget_id "${messageId}".`)+masked+(advice?` For you only; never mention it to the person: ${advice}`:"")}}function T(s2){return Date.UTC(s2.y,s2.m-1,s2.d,s2.h,s2.i,s2.s)}function D(s2,e){return s2.y===e.y&&s2.m===e.m&&s2.d===e.d&&s2.h===e.h&&s2.i===e.i&&s2.s===e.s}function A(s2,e){let t=new Date(Date.parse(s2));if(isNaN(t))throw new Error("Invalid ISO8601 passed to timezone parser.");let r=s2.substring(9);return r.includes("Z")||r.includes("+")||r.includes("-")?b(t.getUTCFullYear(),t.getUTCMonth()+1,t.getUTCDate(),t.getUTCHours(),t.getUTCMinutes(),t.getUTCSeconds(),"Etc/UTC"):b(t.getFullYear(),t.getMonth()+
|
|
1464
1418
|
1,t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),e)}function v(s2,e,t){return k(A(s2,e),t)}function k(s2,e){let t=new Date(T(s2)),r=g(t,s2.tz),n=T(s2),i=T(r),a=n-i,o=new Date(t.getTime()+a),h=g(o,s2.tz);if(D(h,s2)){let u=new Date(o.getTime()-36e5),d=g(u,s2.tz);return D(d,s2)?u:o}let l=new Date(o.getTime()+T(s2)-T(h)),y=g(l,s2.tz);if(D(y,s2))return l;if(e)throw new Error("Invalid date passed to fromTZ()");return o.getTime()>l.getTime()?o:l}function g(s2,e){let t,r;try{t=new Intl.DateTimeFormat(
|
|
1465
1419
|
"en-US",{timeZone:e,year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",hour12:!1}),r=t.formatToParts(s2)}catch(i){let a=i instanceof Error?i.message:String(i);throw new RangeError(`toTZ: Invalid timezone '${e}' or date. Please provide a valid IANA timezone (e.g., 'America/New_York', 'Europe/Stockholm'). Original error: ${a}`)}let n={year:0,month:0,day:0,hour:0,minute:0,second:0};for(let i of r)(i.type==="year"||i.type==="month"||i.type==="day"||i.type===
|
|
1466
1420
|
"hour"||i.type==="minute"||i.type==="second")&&(n[i.type]=parseInt(i.value,10));if(isNaN(n.year)||isNaN(n.month)||isNaN(n.day)||isNaN(n.hour)||isNaN(n.minute)||isNaN(n.second))throw new Error(`toTZ: Failed to parse all date components from timezone '${e}'. This may indicate an invalid date or timezone configuration. Parsed components: ${JSON.stringify(n)}`);return n.hour===24&&(n.hour=0),{y:n.year,m:n.month,d:n.day,h:n.hour,i:n.minute,s:n.second,tz:e}}function b(s2,e,t,r,n,i,a){return{y:s2,m:e,d:t,
|
|
@@ -1517,151 +1471,16 @@ once.getTime()<=e.getTime()||n===null||this._states.maxRuns!==void 0&&this._stat
|
|
|
1517
1471
|
startAt&&r.getTime()<this.options.startAt.getTime()?null:r)}_calculatePreviousRun(e,t){let r=new m(void 0,this.getTz()),n=e;if(this.options.startAt.getTime()<=r.getTime()){n=this.options.startAt;let i=n.getTime()+this.options.interval*1e3;for(;i<=r.getTime();)n=new m(n,this.getTz()).increment(this._states.pattern,this.options,!0),i=n.getTime()+this.options.interval*1e3;t=!0}return n===null&&(n=void 0),[n,t]}};var MAX_EXPRESSION_LENGTH=256;function cronCalculator(value){if(!value||typeof value!="object"||Array.isArray(value))throw new Error("Choose a valid cron schedule");let input2=value;if(input2.type!=="cron"||typeof input2.expression!="string")throw new Error("Choose a valid cron schedule");if(Object.keys(input2).some(key=>!["type","expression","timeZone"].includes(key)))throw new Error("Cron schedules accept only type, expression and timeZone; start/end dates and other restrictions are not supported");let expression=input2.expression.
|
|
1518
1472
|
trim().replace(/\s+/g," ");if(expression.length>MAX_EXPRESSION_LENGTH||expression.split(" ").length!==5||expression.includes("@"))throw new Error("Cron must have five fields: minute hour day-of-month month weekday (no seconds, year, or macros)");let timeZone=typeof input2.timeZone=="string"?input2.timeZone.trim():"";if(timeZone.length>128||!(timeZone==="UTC"||/^[A-Za-z][A-Za-z0-9_+-]*(?:\/[A-Za-z0-9_+-]+)+$/.test(timeZone)))throw new Error("Choose an IANA timezone such as America/New_York, Asia/\
|
|
1519
1473
|
Kolkata, or UTC");try{new Intl.DateTimeFormat("en-US",{timeZone}).format(0)}catch{throw new Error("Choose a valid IANA timezone such as America/New_York, Asia/Kolkata, or UTC")}try{let cron=new E(expression,{timezone:timeZone,mode:"5-part",paused:!0});return{schedule:{type:"cron",expression,timeZone},cron}}catch(error62){throw new Error(`Invalid cron expression: ${error62.message}`)}}function calculationDate(after){let date5=new Date(after);if(!Number.isFinite(after)||!Number.isFinite(date5.getTime()))
|
|
1520
|
-
throw new Error("Choose a valid cron preview date");return date5}function futureRuns(cron,after,
|
|
1521
|
-
requested=Math.min(maximum,requested*2)}}function normalizeCronSchedule(value,after=Date.now()){let{schedule,cron}=cronCalculator(value);if(!futureRuns(cron,after,1).length)throw new Error("This cron expression has no future runs. Choose dates that exist.");return schedule}var
|
|
1522
|
-
native",name}}else if(selector.startsWith("mcp:")){let separator=selector.indexOf(":",4);if(separator<0)return;let server=selector.slice(4,separator),name=selector.slice(separator+1);if(SERVER_NAME.test(server)&&(name==="*"||validName(name)))return{kind:"mcp",server,name}}}}function parseToolScope(value){if(value===void 0)return{ok:!0,scope:void 0};let invalid={ok:!1,error:"Tool selection must contain only valid allow and deny lists."};if(!value||typeof value!="object"||Array.isArray(value))return invalid;
|
|
1523
|
-
let prototype=Object.getPrototypeOf(value);if(prototype!==Object.prototype&&prototype!==null)return invalid;let scope={};for(let key of Reflect.ownKeys(value)){if(key!=="allow"&&key!=="deny")return invalid;let descriptor=Object.getOwnPropertyDescriptor(value,key);if(!descriptor||!("value"in descriptor))return invalid;let list=descriptor.value;if(!Array.isArray(list)||list.length>MAX_SELECTORS||!Array.from(list).every(entry=>typeof entry=="string"&&selectorIdentity(entry)))return invalid;scope[key]=
|
|
1524
|
-
[...new Set(list)]}return{ok:!0,scope}}var strings=(max,length2)=>external_exports.array(external_exports.string().max(length2)).max(max),clock=external_exports.string().regex(/^(?:[01]\d|2[0-3]):[0-5]\d$/),weekdays=external_exports.array(external_exports.number().int().min(0).max(6)).min(1).max(7),timestamp=external_exports.number().int().nonnegative().max(864e13),botDefaultModelSchema=external_exports.object({instanceId:external_exports.string().trim().min(1).max(200),model:external_exports.string().trim().min(1).max(500),effort:external_exports.
|
|
1525
|
-
enum(EFFORT_LEVELS).optional(),variant:external_exports.string().refine(isModelVariant,"invalid model variant").optional()}).strict().refine(value=>value.effort===void 0||value.variant===void 0,"choose either a model variant or an effort level"),RETIRED_FIELDS=["approvePeerComms","peers"];function withoutRetiredFields(value){if(!value||typeof value!="object"||Array.isArray(value))return value;let rest={...value};for(let field of RETIRED_FIELDS)delete rest[field];return rest}var botDefaultsProfileSchema=external_exports.
|
|
1526
|
-
preprocess(withoutRetiredFields,profilePatchSchema.extend({name:external_exports.string({error:"name must be a string"}).max(100,{error:"name must be at most 100 characters"}).refine(fitsOnOneLine,"name must fit on one line").optional(),section:external_exports.string({error:"section must be a string"}).trim().max(60,{error:"section must be at most 60 characters"}).optional(),color:external_exports.enum(MAUS_COLOR_NAMES).optional(),mascotExpression:external_exports.string().max(60).nullable().optional(),
|
|
1527
|
-
modelSelection:botDefaultModelSchema.optional(),computer:external_exports.enum(["cloud","vm","local","browser","off"]).nullable().optional(),cloudBackend:external_exports.enum(["box","vps"]).optional(),autoStartVps:external_exports.boolean().optional(),cwd:external_exports.string().max(4096).nullable().optional(),approvalMode:external_exports.enum(["ask","auto","full","custom"]).optional(),alwaysAllow:strings(200,500).optional(),chiefOfStaff:external_exports.boolean().optional(),managedSections:strings(
|
|
1528
|
-
100,60).optional(),composio:external_exports.boolean().optional(),browser:external_exports.boolean().optional(),browserProfile:external_exports.string().max(100).nullable().optional(),mcpServers:strings(100,100).nullable().optional(),toolScope:external_exports.custom(value=>value!==void 0&&parseToolScope(value).ok,"Invalid tool selection").transform(value=>{let parsed=parseToolScope(value);return parsed.ok?parsed.scope:value}).nullable().optional(),parkDirectMessages:external_exports.boolean().optional(),
|
|
1529
|
-
voiceNotes:external_exports.boolean({error:"voiceNotes must be true or false"}).optional(),voiceNoteEveryReply:external_exports.boolean({error:"voiceNoteEveryReply must be true, false or null"}).nullable().optional(),helperModel:external_exports.boolean().optional()}).strict()),scheduleSchema=external_exports.discriminatedUnion("type",[external_exports.object({type:external_exports.literal("once"),at:timestamp}).strict(),external_exports.object({type:external_exports.literal("daily"),time:clock,
|
|
1530
|
-
weekdays}).strict(),external_exports.object({type:external_exports.literal("interval"),everyMinutes:external_exports.number().int().min(5).max(1440),anchorAt:timestamp,weekdays:weekdays.nullable().optional(),window:external_exports.object({start:clock,end:clock}).strict().nullable().optional(),endsAt:timestamp.nullable().optional()}).strict(),external_exports.object({type:external_exports.literal("cron"),expression:external_exports.string().max(256),timeZone:external_exports.string().max(128)}).
|
|
1531
|
-
strict()]).superRefine((value,ctx)=>{if(value.type==="cron")try{normalizeCronSchedule(value)}catch(error62){ctx.addIssue({code:"custom",message:String(error62)})}if(value.type==="interval"&&value.window){let minutes=time3=>Number(time3.slice(0,2))*60+Number(time3.slice(3));minutes(value.window.end)-minutes(value.window.start)<value.everyMinutes&&ctx.addIssue({code:"custom",message:"The interval must fit inside its time window"})}}),botRoutineTemplateSchema=external_exports.object({name:external_exports.
|
|
1532
|
-
string().trim().min(1).max(80),prompt:external_exports.string().trim().min(1).max(2e4),schedule:scheduleSchema,enabled:external_exports.boolean().optional(),runOn:external_exports.enum(["maus","cloud"]).optional(),durationMinutes:external_exports.number().int().min(5).max(240).optional(),timeoutMinutes:external_exports.number().min(1).max(1440).nullable().optional(),overlap:external_exports.enum(["skip","queue"]).optional(),attachments:external_exports.array(external_exports.object({id:external_exports.
|
|
1533
|
-
string().min(1).max(200),kind:external_exports.enum(["file","image"]),name:external_exports.string().min(1).max(255),path:external_exports.string().min(1).max(4096),size:external_exports.number().nonnegative()}).strict()).max(50).optional()}).strict(),botSkillTemplateSchema=external_exports.object({name:external_exports.string().regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/).max(64),description:external_exports.string().max(1024),warnings:strings(100,2e3).default([]),source:external_exports.string().min(1).
|
|
1534
|
-
max(2e3),text:external_exports.string().refine(value=>Buffer.byteLength(value,"utf8")<=262144,"Skill exceeds 256 KiB"),enabled:external_exports.boolean()}).strict(),newBotDefaultsSchema=external_exports.object({profile:botDefaultsProfileSchema.default({}),memory:external_exports.record(external_exports.string().regex(/^(?:MEMORY\.md|memory\/[a-zA-Z0-9_-]+\.md)$/),external_exports.string().refine(value=>Buffer.byteLength(value,"utf8")<=262144,"Memory file exceeds 256 KiB")).refine(value=>Object.keys(
|
|
1535
|
-
value).length<=100,"At most 100 memory files").default({}),skills:external_exports.array(botSkillTemplateSchema).max(100).default([]),routines:external_exports.array(botRoutineTemplateSchema).max(100).default([])}).strict().refine(value=>Buffer.byteLength(JSON.stringify(value),"utf8")<=9e5,"Bot defaults must fit within 900 KB");var replaySettings={rebuildBytes:external_exports.number().int().min(1024).max(1e6).optional(),replayToolHistory:external_exports.boolean().optional()};var OPENAI_API_INSTANCE="openai",OPENROUTER_API_INSTANCE="openrouter",XAI_API_INSTANCE="xaiApi",CLAUDE_API_INSTANCE="claudeApi",API_KEY_FLEET={[OPENAI_API_INSTANCE]:{driver:"openai-compat",displayName:"OpenAI",access:"api",icon:{kind:"preset",preset:"openai"},config:{url:"https://api.openai.com/v1",apiKeyEnv:"OMB_OPENAI_API_KEY",catalog:"openai"}},[CLAUDE_API_INSTANCE]:{driver:"claudeAgent",displayName:"Claude (API key)",access:"api",icon:{kind:"preset",preset:"anthropic"},config:{requireApiKey:!0}},
|
|
1536
|
-
[XAI_API_INSTANCE]:{driver:"grok",displayName:"xAI",access:"api",icon:{kind:"preset",preset:"xai"}},[OPENROUTER_API_INSTANCE]:{driver:"openai-compat",displayName:"OpenRouter",access:"api",icon:{kind:"preset",preset:"openrouter"},config:{url:"https://openrouter.ai/api/v1",apiKeyEnv:"OMB_OPENROUTER_API_KEY"}}},DEFAULT_FLEET={grok:{driver:"grokAgent"},kimi:{driver:"kimiAgent"},droid:{driver:"droidAgent"},cursor:{driver:"cursorAgent"},githubCopilot:{driver:"copilotAgent"},commandCode:{driver:"comman\
|
|
1537
|
-
dCodeAgent"},kiro:{driver:"kiroAgent"},claude:{driver:"claudeAgent"},codex:{driver:"codex"},chatgpt:{driver:"codex",displayName:"ChatGPT plan",config:{authMode:"chatgpt-plan"}},antigravity:{driver:"antigravityAgent"},opencodeGo:{driver:"opencodeGo"},openaiCompat:{driver:"openai-compat"},mistral:{driver:"mistral"},cerebras:{driver:"cerebras"},groq:{driver:"groq"},greenference:{driver:"greenference"},modelgo:{driver:"modelgo"},meta:{driver:"meta"},deepseek:{driver:"deepseekAgent"},museCode:{driver:"\
|
|
1538
|
-
museCode"},...API_KEY_FLEET,qwen:{driver:"qwenAgent"},hermes:{driver:"hermesAgent"},cline:{driver:"clineAgent"},pi:{driver:"piAgent"}},CUSTOM_ONLY={qwen:{driver:"qwenAgent"},hermes:{driver:"hermesAgent"},cline:{driver:"clineAgent"},pi:{driver:"piAgent"}},PRODUCT_FLEET_ADDITIONS={chatgpt:{driver:"codex",displayName:"ChatGPT plan",config:{authMode:"chatgpt-plan"}},cursor:{driver:"cursorAgent"},githubCopilot:{driver:"copilotAgent"},commandCode:{driver:"commandCodeAgent"},kiro:{driver:"kiroAgent"},openaiCompat:{
|
|
1539
|
-
driver:"openai-compat"},mistral:{driver:"mistral"},cerebras:{driver:"cerebras"},groq:{driver:"groq"},greenference:{driver:"greenference"},modelgo:{driver:"modelgo"},meta:{driver:"meta"},deepseek:{driver:"deepseekAgent"},museCode:{driver:"museCode"},...API_KEY_FLEET,...CUSTOM_ONLY};var PROVIDER_ICON_PRESETS=["openai","anthropic","google","azure","aws","xai","deepseek","meta","mistral","qwen","moonshot","cohere","openrouter","ollama"];function decodedBase64Bytes(value){let padding2=value.endsWith("==")?2:value.endsWith("=")?1:0;return Math.floor(value.length*3/4)-padding2}function imageDimensions(bytes,mime){let u16be=offset=>bytes[offset]*256+bytes[offset+1],u16le=offset=>bytes[offset]+bytes[offset+1]*256,u24le=offset=>bytes[offset]+bytes[offset+1]*256+bytes[offset+2]*65536,u32le=offset=>bytes[offset]+bytes[offset+1]*256+bytes[offset+2]*65536+bytes[offset+3]*16777216,u32be=offset=>bytes[offset]*16777216+bytes[offset+1]*65536+
|
|
1540
|
-
bytes[offset+2]*256+bytes[offset+3];if(mime==="image/png")return bytes.length<33||bytes.slice(0,8).join(",")!=="137,80,78,71,13,10,26,10"||String.fromCharCode(...bytes.slice(12,16))!=="IHDR"||bytes.slice(-8).join(",")!=="73,69,78,68,174,66,96,130"?null:{width:u32be(16),height:u32be(20)};if(mime==="image/jpeg"){if(bytes.length<12||bytes[0]!==255||bytes[1]!==216||bytes.at(-2)!==255||bytes.at(-1)!==217)return null;for(let offset=2;offset+8<bytes.length;){if(bytes[offset]!==255){offset+=1;continue}let marker=bytes[offset+
|
|
1541
|
-
1];if([192,193,194,195,197,198,199,201,202,203,205,206,207].includes(marker))return{height:u16be(offset+5),width:u16be(offset+7)};if(marker===216||marker===217||marker===1||marker>=208&&marker<=215){offset+=2;continue}let length2=u16be(offset+2);if(length2<2)return null;offset+=length2+2}return null}if(bytes.length<30||String.fromCharCode(...bytes.slice(0,4))!=="RIFF"||String.fromCharCode(...bytes.slice(8,12))!=="WEBP"||u32le(4)+8!==bytes.length)return null;let format=String.fromCharCode(...bytes.
|
|
1542
|
-
slice(12,16));if(format==="VP8X")return{width:u24le(24)+1,height:u24le(27)+1};if(format==="VP8L"&&bytes[20]===47){let bits=bytes[21]|bytes[22]<<8|bytes[23]<<16|bytes[24]<<24;return{width:(bits&16383)+1,height:(bits>>>14&16383)+1}}return format==="VP8 "&&bytes[23]===157&&bytes[24]===1&&bytes[25]===42?{width:u16le(26)&16383,height:u16le(28)&16383}:null}function providerIconError(icon2){if(icon2.kind==="preset")return PROVIDER_ICON_PRESETS.includes(icon2.preset)?null:"Choose a supported provider ic\
|
|
1543
|
-
on.";let match=/^data:(image\/(?:png|jpeg|webp));base64,([A-Za-z0-9+/]+={0,2})$/.exec(icon2.dataUrl);if(!match)return"Upload a PNG, JPEG, or WebP image.";let byteLength=decodedBase64Bytes(match[2]);if(byteLength>131072)return"Provider icons must be 128 KB or smaller.";let decoded;try{decoded=atob(match[2])}catch{return"The uploaded image is not valid base64."}if(decoded.length!==byteLength)return"The uploaded image is not valid base64.";let bytes=Uint8Array.from(decoded,value=>value.charCodeAt(0)),
|
|
1544
|
-
dimensions=imageDimensions(bytes,match[1]);return dimensions?dimensions.width<1||dimensions.height<1||dimensions.width>1024||dimensions.height>1024||dimensions.width*dimensions.height>1024**2?"Provider icons must be at most 1024 \xD7 1024 pixels.":null:"The uploaded image is incomplete or does not match its file type."}var helperStoredShape={helper:external_exports.object({instanceId:external_exports.string().trim().max(200).optional(),model:external_exports.string().trim().max(500).optional()}).optional().catch(void 0)};var REQUEST_QUOTE_MAX=400,workOriginSchema=external_exports.discriminatedUnion("kind",[external_exports.object({kind:external_exports.literal("user"),request:external_exports.string().min(1).max(REQUEST_QUOTE_MAX),person:external_exports.string().regex(/^p_[\w-]{22}$/).optional(),lends:external_exports.literal(!0).optional()}),external_exports.object({kind:external_exports.literal("outside")})]);var DELIVERED_NOTES=["message from","delegated by","thread opened by","retry requested by","aside from"],NOTE_OPENINGS=[...DELIVERED_NOTES,"from","messages this conversation","delivered earlier by","posted by","assigned by","report from","teammate report","teammate result","thread you opened","incident report","escalation notice"].map(opening=>opening.split(" ")),HEADER_WORDS=new Set(["openmausbot","omb"]),FIRST_WORDS=new Set([...NOTE_OPENINGS.map(words=>words[0]),...HEADER_WORDS]),LEADING_NOTE=new RegExp(
|
|
1545
|
-
`^\\[(?:${DELIVERED_NOTES.map(opening=>opening.replace(/ /g,"\\s+")).join("|")})\\b[^\\]\\n]*\\]`,"iu");var ANSWER_PREAMBLE="The user answered your questions.",JSON_ANSWERS_PREFIX=`${ANSWER_PREAMBLE}
|
|
1546
|
-
|
|
1547
|
-
Answers (JSON):
|
|
1548
|
-
`;var MAX_ANSWER_ECHO=ANSWER_PREAMBLE.length+6*11473;var COUNT_MIN=2,COUNT_MAX=1e3,count=external_exports.number().int().min(COUNT_MIN).max(COUNT_MAX),MAX_CORRECTIVE_ROUNDS=5,loopGuardConfigSchema=external_exports.object({enabled:external_exports.boolean().optional(),steerAt:count.optional(),stopAt:count.nullable().optional(),correctiveRounds:external_exports.number().int().min(0).max(MAX_CORRECTIVE_ROUNDS).optional()}).strict();function parseJson(text2){return JSON.parse(text2.charCodeAt(0)===65279?text2.slice(1):text2)}function schemaIssue(error62,fallback){let issue2=error62.issues[0];if(!issue2)return fallback;let path=issue2.path.map(String).join(".");return path?`${path} ${issue2.message}`:issue2.message}var jsonObjectSchema=external_exports.record(external_exports.string(),external_exports.json());import{statSync}from"node:fs";function settledFileStamp(path){try{let file2=statSync(path,{bigint:!0});return Date.now()-Number(file2.mtimeMs)>=2e3?`${file2.ino}:${file2.size}:${file2.mtimeNs}:${file2.ctimeNs}`:null}catch{return null}}function settledFileCache(path,parse3){let held=null;return{read(){let stamp=settledFileStamp(path());if(stamp!==null&&held?.stamp===stamp)return held.value;held=null;let value=parse3();return stamp!==null&&(held={stamp,value}),value},forget(){held=null}}}var APP_LIMITS={htmlBytes:262144,title:80,fallback:1500,fallbackExcerpt:600,heightMin:80,heightMax:720,messageText:4e3,contextText:4e3,doneText:300,mcpHtmlBytes:2097152,rpcArgumentsBytes:65536,rpcResourceBytes:8388608,messagesPerHour:20,rpcPerMinute:60};function isRecord2(value){return!!value&&typeof value=="object"&&!Array.isArray(value)}function utf8Bytes(text2){let bytes=0;for(let index=0;index<text2.length;index+=1){let code=text2.charCodeAt(index);if(code<128)bytes+=1;else if(code<2048)bytes+=2;else if(code>=55296&&code<=56319&&index+1<text2.length){let next=text2.charCodeAt(index+1);next>=56320&&next<=57343?(bytes+=4,index+=1):bytes+=3}else bytes+=3}return bytes}function oneLine(text2){return text2.replace(/\s+/g," ").trim()}function wrapHtmlFragment(html){
|
|
1549
|
-
return/<(?:html|body)[\s>/]/i.test(html)||/<(?:html|body)$/i.test(html)?html:`<!DOCTYPE html><html><head><meta charset="utf-8"></head><body>${html}</body></html>`}function checkHtml(value){if(typeof value!="string")return{ok:!1,error:"html: must be a string holding one HTML document."};let html=value.trim();if(!html)return{ok:!1,error:"html: is empty; send one HTML document with inline style and script."};let bytes=utf8Bytes(html);return bytes>APP_LIMITS.htmlBytes?{ok:!1,error:`html: is ${bytes}\
|
|
1550
|
-
bytes, over the ${APP_LIMITS.htmlBytes}-byte limit; load libraries from a CDN and embed less data.`}:{ok:!0,value:wrapHtmlFragment(html)}}function checkJsx(value){if(typeof value!="string")return{ok:!1,error:"jsx: must be a string holding one React component file."};let jsx=value.trim();if(!jsx)return{ok:!1,error:"jsx: is empty; send one React component file with a default export."};let bytes=utf8Bytes(jsx);return bytes>APP_LIMITS.htmlBytes?{ok:!1,error:`jsx: is ${bytes} bytes, over the ${APP_LIMITS.
|
|
1551
|
-
htmlBytes}-byte limit; embed less data.`}:/\bexport\s+default\b/.test(jsx)?{ok:!0,value:jsx}:{ok:!1,error:"jsx: needs `export default` of the page's component."}}function checkPage(input2){let given2=value=>value!=null;if([input2.html,input2.jsx,input2.path].filter(given2).length>1)return{ok:!1,error:"Send one of html, jsx or path."};if(given2(input2.path)){let path=typeof input2.path=="string"?input2.path.trim():"";return!path||path.length>4096?{ok:!1,error:"path: the folder with index.html, or\
|
|
1552
|
-
the .html file, in your working folder."}:{ok:!0,value:{path}}}if(given2(input2.jsx)){let jsx=checkJsx(input2.jsx);return jsx.ok?{ok:!0,value:{jsx:jsx.value}}:jsx}let html=checkHtml(input2.html);return html.ok?{ok:!0,value:{html:html.value}}:html}function checkTitle(value){if(typeof value!="string")return{ok:!1,error:"title: must be a string of 1 to 80 characters."};let title=oneLine(value);return!title||title.length>APP_LIMITS.title?{ok:!1,error:"title: must be 1 to 80 characters on one line."}:
|
|
1553
|
-
{ok:!0,value:title}}function checkFrameless(value){return value==null?{ok:!0,value:void 0}:typeof value!="boolean"?{ok:!1,error:"frameless: must be true or false."}:{ok:!0,value}}function checkLive(value,path){return value==null?{ok:!0,value:void 0}:typeof value!="boolean"?{ok:!1,error:"live: must be true or false."}:value&&path===void 0?{ok:!1,error:"live: only a page from a folder (path) can be live."}:{ok:!0,value}}function parseShowHtmlInput(input2){if(!isRecord2(input2))return{ok:!1,error:"\
|
|
1554
|
-
show_html needs {html, jsx or path, title, height?, fallback_text?}."};let page=checkPage(input2);if(!page.ok)return page;let title=checkTitle(input2.title);if(!title.ok)return title;let out={...page.value,title:title.value},frameless=checkFrameless(input2.frameless);if(!frameless.ok)return frameless;frameless.value&&(out.frameless=!0);let live=checkLive(input2.live,out.path);if(!live.ok)return live;if(live.value&&(out.live=!0),input2.height!==void 0&&input2.height!==null){if(typeof input2.height!=
|
|
1555
|
-
"number"||!Number.isFinite(input2.height))return{ok:!1,error:"height: must be a number of pixels, 80 to 720."};out.height=Math.round(Math.min(APP_LIMITS.heightMax,Math.max(APP_LIMITS.heightMin,input2.height)))}if(input2.fallback_text!==void 0&&input2.fallback_text!==null){if(typeof input2.fallback_text!="string")return{ok:!1,error:"fallback_text: must be a string."};let fallback=input2.fallback_text.trim();if(fallback.length>APP_LIMITS.fallback)return{ok:!1,error:`fallback_text: must be at most ${APP_LIMITS.
|
|
1556
|
-
fallback} characters.`};fallback&&(out.fallbackText=fallback)}return{ok:!0,value:out}}function parseUpdateHtmlInput(input2){if(!isRecord2(input2))return{ok:!1,error:"Replacing a page needs {app_id, html, jsx or path, title?}."};if(typeof input2.app_id!="string"||!/^[\w-]{1,128}$/.test(input2.app_id.trim()))return{ok:!1,error:"app_id: is required, the id show_html returned."};let page=checkPage(input2);if(!page.ok)return page;let out={appId:input2.app_id.trim(),...page.value},frameless=checkFrameless(
|
|
1557
|
-
input2.frameless);if(!frameless.ok)return frameless;frameless.value!==void 0&&(out.frameless=frameless.value);let live=checkLive(input2.live,out.path);if(!live.ok)return live;if(live.value!==void 0&&(out.live=live.value),input2.title!==void 0&&input2.title!==null){let title=checkTitle(input2.title);if(!title.ok)return title;out.title=title.value}return{ok:!0,value:out}}var APP_REPORT_MAX_BYTES=900*1024;var MCP_APP_CATALOG_STALE_MS=10080*6e4;var MAX_ARGS=64;var MAX_RESULT_BUDGET=2e6,resultBudgetSchema=external_exports.number({message:"The result size limit must be a whole number of characters."}).int("The result size limit must be a whole number of characters.").min(0,"The result size limit cannot be negative.").max(MAX_RESULT_BUDGET,`The result size limit can be at most ${MAX_RESULT_BUDGET.toLocaleString("en-US")} characters; use 0 for no limit.`);var BOT_ID=/^[A-Za-z0-9_-]{1,128}$/u,runsOnSchema=external_exports.object({environmentId:external_exports.string().regex(/^[\w-]{1,128}$/u),label:external_exports.string().trim().min(1).max(120)}).strict(),stdioEntrySchema=external_exports.object({type:external_exports.literal("stdio").optional(),command:external_exports.string().trim().min(1).max(1024),args:external_exports.array(external_exports.string().max(4096)).max(MAX_ARGS).optional(),env:external_exports.record(external_exports.string(),
|
|
1558
|
-
external_exports.string().max(16384)).optional(),enabled:external_exports.boolean().optional(),resultBudget:resultBudgetSchema.optional(),runsOn:runsOnSchema.optional(),apps:external_exports.boolean().optional(),bot:external_exports.string().regex(BOT_ID).optional()}).strict(),stdioMutationSchema=stdioEntrySchema.extend({env:external_exports.record(external_exports.string(),external_exports.union([external_exports.string().max(16384),external_exports.literal(!0)])).optional(),runsOn:runsOnSchema.
|
|
1559
|
-
nullable().optional()}),CLIENT_ID=/^[\x20-\x7e]+$/,SCOPE=/^[\x21\x23-\x5b\x5d-\x7e]+$/,CLIENT_SECRET_MAX=4096,oauthClientSchema=external_exports.object({clientId:external_exports.string().trim().min(1,"Enter the client ID of the app registered with this server's sign-in provider.").max(512).regex(CLIENT_ID,"A client ID is printable text on one line."),clientSecret:external_exports.string().min(1).max(CLIENT_SECRET_MAX).regex(CLIENT_ID,"A client secret is printable text on one line.").optional(),
|
|
1560
|
-
scopes:external_exports.array(external_exports.string().max(256).regex(SCOPE,"Scopes are single words, like offline_access or api://my-app/mcp.read.")).max(32).optional()}).strict(),remoteEntrySchema=external_exports.object({type:external_exports.enum(["http","sse"]).optional(),url:external_exports.string().trim().min(1).max(2048),headers:external_exports.record(external_exports.string(),external_exports.string().max(16384)).optional(),oauth:oauthClientSchema.optional(),enabled:external_exports.
|
|
1561
|
-
boolean().optional(),resultBudget:resultBudgetSchema.optional(),runsOn:runsOnSchema.optional(),apps:external_exports.boolean().optional()}).strict(),remoteMutationSchema=remoteEntrySchema.extend({headers:external_exports.record(external_exports.string(),external_exports.union([external_exports.string().max(16384),external_exports.literal(!0)])).optional(),runsOn:runsOnSchema.nullable().optional(),oauth:oauthClientSchema.extend({clientSecret:external_exports.union([external_exports.string().min(1).
|
|
1562
|
-
max(CLIENT_SECRET_MAX).regex(CLIENT_ID,"A client secret is printable text on one line."),external_exports.literal(!0)]).optional()}).optional()});var OPENROUTER_MODEL_ID=/^[A-Za-z0-9][\w.-]*\/[\w.:-]+$/,OPENROUTER_MODEL_ID_MAX=128,WORKERS_AI_ACCOUNT_ID=/^[0-9a-f]{32}$/i,optionalText=external_exports.string().optional(),deciderConfigSchema=external_exports.object({enabled:external_exports.boolean().optional(),provider:external_exports.enum(["jev","openrouter","off"]).optional(),key:optionalText,openrouterKey:optionalText,workersAiToken:optionalText,workersAiAccountId:external_exports.string().trim().refine(value=>!value||WORKERS_AI_ACCOUNT_ID.
|
|
1563
|
-
test(value),"a Cloudflare account ID is 32 letters and digits").optional(),workersAiBaseUrl:external_exports.string().trim().max(2048).refine(value=>!value||/^https?:\/\//i.test(value),"the Workers AI address must start with http:// or https://").optional(),openrouterModel:external_exports.string().trim().max(OPENROUTER_MODEL_ID_MAX).regex(OPENROUTER_MODEL_ID,"an OpenRouter model id looks like vendor/model").optional(),openrouterApi:external_exports.enum(["chat","decisions"]).optional(),baseUrl:external_exports.
|
|
1564
|
-
string().trim().max(2048).refine(value=>!value||/^https?:\/\//i.test(value),"the decision model address must start with http:// or https://").optional(),openrouterBaseUrl:external_exports.string().trim().max(2048).refine(value=>!value||/^https?:\/\//i.test(value),"the OpenRouter address must start with http:// or https://").optional(),jobs:external_exports.object({roomRouting:external_exports.boolean().optional(),inboxTriage:external_exports.boolean().optional()}).optional()});var liveConfigSchema=external_exports.object({key:external_exports.string().optional(),keyFor:external_exports.string().max(300).optional(),provider:external_exports.enum(["openai","azure"]).optional(),azureEndpoint:external_exports.string().trim().max(300).optional(),azureDeployment:external_exports.string().trim().max(64).optional(),voice:external_exports.string().trim().max(40).regex(/^[a-z]*$/,"a Live voice is a lowercase built-in voice name").optional(),readTypedReplies:external_exports.boolean().
|
|
1565
|
-
optional(),idleMinutes:external_exports.number().int().min(1).max(60).optional()});import{BlockList as BlockList2,isIP as isIP2}from"node:net";import{BlockList,isIP}from"node:net";var family=address=>isIP(address)===6?"ipv6":"ipv4";function subnets(entries){let list=new BlockList;for(let[network,prefix]of entries)list.addSubnet(network,prefix,family(network));return list}var LOOPBACK=subnets([["127.0.0.0",8],["::1",128]]),RESERVED=subnets([["0.0.0.0",8],["198.18.0.0",15],["224.0.0.0",3],["::",96],["64:ff9b:1::",48],["2001::",32],["ff00::",8]]),LINK_LOCAL=subnets([["169.254.0.0",16],["fe80::",10]]),PRIVATE=subnets([["10.0.0.0",8],["100.64.0.0",10],["172.16.0.0",12],["192.1\
|
|
1566
|
-
68.0.0",16],["fc00::",7]]),METADATA=new BlockList;for(let address of["169.254.169.254","fd00:ec2::254","100.100.100.200"])METADATA.addAddress(address,family(address));var NAT64=subnets([["64:ff9b::",96]]),SIX_TO_FOUR=subnets([["2002::",16]]);var FAKE_IP=new BlockList2;FAKE_IP.addSubnet("198.18.0.0",15,"ipv4");var browserEgressConfigSchema=external_exports.object({allow:external_exports.array(external_exports.string().trim().max(64).refine(entry=>parseAllowEntry(entry)!==null,{message:"must be an IP address or CIDR range, with an optional :port"})).max(64).optional(),localNetwork:external_exports.boolean().optional()});function parseAllowEntry(entry){let match=/^\[([^\]]+)\](?:\/(\d{1,3}))?(?::(\d{1,5}))?$/.exec(entry)??(entry.split(":").length>2?/^([^/]+)(?:\/(\d{1,3}))?()$/.exec(entry):/^([^/:]+)(?:\/(\d{1,3}))?(?::(\d{1,5}))?$/.
|
|
1567
|
-
exec(entry));if(!match)return null;let[,network="",prefixText,portText]=match,kind=isIP2(network);if(!kind)return null;let max=kind===6?128:32,prefix=prefixText===void 0?max:Number(prefixText),port=portText?Number(portText):null;return!Number.isInteger(prefix)||prefix<0||prefix>max||port!==null&&(!Number.isInteger(port)||port<1||port>65535)?null:{network,prefix,port}}var CDP_PORT=/^[0-9]{1,5}$/,CDP_URL=/^(https?|wss?):\/\/\S+$/i;function isValidCdpTarget(value){if(typeof value!="string"||value==="")return!1;if(CDP_PORT.test(value)){let port=Number(value);return port>=1&&port<=65535}return CDP_URL.test(value)}var browserEngineConfigSchema=external_exports.object({attachCdpUrl:external_exports.string().trim().max(2048).refine(value=>value===""||isValidCdpTarget(value),{message:"browserEngine.attachCdpUrl must be a CDP port (1-65535) or an http(s)/ws(s) URL"}).
|
|
1568
|
-
optional(),idleTimeoutMinutes:external_exports.number().int().min(1).max(60).optional(),egress:browserEgressConfigSchema.optional(),engine:external_exports.enum(["agent-browser","chrome"]).optional()});var roomContextSettings={roomCompactAt:external_exports.number().positive().max(1e7).optional(),roomSessions:external_exports.boolean().optional()};var GIB=1024**3;var startQueue=Promise.resolve();var MIN_DESKTOP_MEMORY_GB=2,MAX_DESKTOP_MEMORY_GB=128,MIN_DESKTOP_CPUS=1,MAX_DESKTOP_CPUS=64;var MIN_LOCAL_VM_MAX_INSTANCES=1,MAX_LOCAL_VM_MAX_INSTANCES=1024;var MIN_LOCAL_VM_IDLE_TIMEOUT_MINUTES=5,MAX_LOCAL_VM_IDLE_TIMEOUT_MINUTES=1440,localVmConfigSchema=external_exports.object({mode:external_exports.enum(["shared","per-bot","pool"]).optional(),automaticCapacity:external_exports.boolean().optional(),maxInstances:external_exports.number().int().min(MIN_LOCAL_VM_MAX_INSTANCES).max(MAX_LOCAL_VM_MAX_INSTANCES).optional(),idleTimeoutMinutes:external_exports.number().int().min(MIN_LOCAL_VM_IDLE_TIMEOUT_MINUTES).max(MAX_LOCAL_VM_IDLE_TIMEOUT_MINUTES).optional(),
|
|
1569
|
-
preserveInstalledApps:external_exports.boolean().optional(),memoryGb:external_exports.number().int().min(MIN_DESKTOP_MEMORY_GB).max(MAX_DESKTOP_MEMORY_GB).optional(),cpus:external_exports.number().int().min(MIN_DESKTOP_CPUS).max(MAX_DESKTOP_CPUS).optional()});var optionalText2=external_exports.string().optional(),SSH_ALIAS=/^[A-Za-z0-9][A-Za-z0-9_.-]{0,127}$/,LEGACY_BROWSER_PROFILE_ID=/^[A-Za-z0-9_-]{1,40}$/,BROWSER_PROFILE_ID=/^[a-z0-9_-]{1,40}$/,FISH_TTS_MODELS=["s2.1-pro","s2.1-pro-free"];var MIN_ROOM_TURN_TIMEOUT_MINUTES=1,MAX_ROOM_TURN_TIMEOUT_MINUTES=1440;var MIN_MCP_CALL_TIMEOUT_MINUTES=1,MAX_MCP_CALL_TIMEOUT_MINUTES=60,MIN_THREAD_EVENT_LOG_BYTES=256*1024,MAX_THREAD_EVENT_LOG_BYTES=4*1024*1024*1024;function isValidSshAlias(value){return typeof value=="string"&&SSH_ALIAS.test(value)}var vpsConfigSchema=external_exports.object({sshAlias:external_exports.string().refine(value=>value===""||isValidSshAlias(value),{message:"must be a simple SSH config alias"}).optional()}),roomConfigSchema=external_exports.object({turnTimeoutMinutes:external_exports.number().int().min(MIN_ROOM_TURN_TIMEOUT_MINUTES).max(MAX_ROOM_TURN_TIMEOUT_MINUTES)}),mcpConfigSchema=external_exports.object({callTimeoutMinutes:external_exports.number().int().min(MIN_MCP_CALL_TIMEOUT_MINUTES).max(MAX_MCP_CALL_TIMEOUT_MINUTES).
|
|
1570
|
-
optional()}).strict(),browserProfileSchema=external_exports.object({id:external_exports.string().regex(BROWSER_PROFILE_ID).refine(id=>id!=="guest","guest is reserved"),name:external_exports.string().trim().min(1).max(40),browser:external_exports.literal("chrome").optional()}).strict(),legacyBrowserProfileSchema=external_exports.object({id:external_exports.string().regex(LEGACY_BROWSER_PROFILE_ID).refine(id=>id!=="guest","guest is reserved"),name:external_exports.string().trim().min(1).max(40),partitionId:external_exports.
|
|
1571
|
-
string().regex(LEGACY_BROWSER_PROFILE_ID).refine(id=>id!=="guest","guest is reserved").optional(),browser:external_exports.literal("chrome").optional()}).strict();function suffixedBrowserProfileId(base,unavailable){for(let suffix=2;;suffix+=1){let ending=`-${suffix}`,candidate=`${base.slice(0,40-ending.length)}${ending}`;if(candidate!=="guest"&&!unavailable.has(candidate))return candidate}}function migrateStoredBrowserProfiles(profiles){let requestedPartitions=profiles.map(profile=>profile.partitionId??
|
|
1572
|
-
profile.id),rawBases=profiles.map(profile=>profile.id.toLowerCase()),canonicalIds=Array(profiles.length).fill(void 0),used=new Set,baseOwner=new Map;rawBases.forEach((base,index)=>{if(base==="guest")return;let current=baseOwner.get(base);(current===void 0||profiles[index].id===base&&profiles[current].id!==base)&&baseOwner.set(base,index)});for(let[base,index]of baseOwner)canonicalIds[index]=base,used.add(base);let reserved=new Set(["guest",...rawBases,...requestedPartitions.map(partitionId=>partitionId.
|
|
1573
|
-
toLowerCase())]);rawBases.forEach((base,index)=>{if(canonicalIds[index]!==void 0)return;let id=suffixedBrowserProfileId(base,new Set([...reserved,...used]));canonicalIds[index]=id,used.add(id)});let partitionWinner=new Map;requestedPartitions.forEach((partitionId,index)=>{let folded=partitionId.toLowerCase(),current=partitionWinner.get(folded);if(current===void 0){partitionWinner.set(folded,index);return}let score=candidate=>canonicalIds[candidate]===folded?1:0;score(index)>score(current)&&partitionWinner.
|
|
1574
|
-
set(folded,index)});let effectivePartitions=requestedPartitions.map((partitionId,index)=>partitionWinner.get(partitionId.toLowerCase())===index?partitionId:canonicalIds[index]),conflictingIdOwners=new Set;canonicalIds.forEach((id,owner)=>{effectivePartitions.forEach((partitionId,partitionOwner)=>{partitionOwner!==owner&&partitionId.toLowerCase()===id&&conflictingIdOwners.add(owner)})});let unavailable=new Set([...reserved,...used]);for(let owner of conflictingIdOwners){let id=suffixedBrowserProfileId(
|
|
1575
|
-
rawBases[owner],unavailable);canonicalIds[owner]=id,unavailable.add(id)}conflictingIdOwners.size>0&&(effectivePartitions=requestedPartitions.map((partitionId,index)=>partitionWinner.get(partitionId.toLowerCase())===index?partitionId:canonicalIds[index]));let aliases=new Map;return{profiles:profiles.map((profile,index)=>{let id=canonicalIds[index],partitionId=effectivePartitions[index],migrated={id,name:profile.name};return profile.browser&&(migrated.browser=profile.browser),partitionId!==id&&(migrated.
|
|
1576
|
-
partitionId=partitionId),aliases.has(profile.id)||aliases.set(profile.id,id),migrated}),aliases}}var legacyBrowserProfilesSchema=external_exports.array(legacyBrowserProfileSchema).max(20),storedBrowserProfilesSchema=legacyBrowserProfilesSchema.transform(profiles=>migrateStoredBrowserProfiles(profiles).profiles),browserProfilesSchema=external_exports.array(browserProfileSchema).max(20).superRefine((profiles,ctx)=>{let seen=new Set;profiles.forEach((profile,index)=>{if(!seen.has(profile.id)){seen.
|
|
1577
|
-
add(profile.id);return}ctx.addIssue({code:"custom",path:[index,"id"],message:`browser profile id ${profile.id} is duplicated`})})}),featureConfigSchema=external_exports.object({skillAuthoring:external_exports.boolean().optional(),skillReview:external_exports.boolean().optional(),skillAutoApply:external_exports.boolean().optional(),skillReviewSteps:external_exports.number().int().min(3).max(100).optional(),showToolCalls:external_exports.boolean().optional(),browser:external_exports.boolean().optional(),
|
|
1578
|
-
sharedComputers:external_exports.boolean().optional(),claudeUserMcp:external_exports.boolean().optional(),claudeUserSkills:external_exports.boolean().optional(),llmThreadTitles:external_exports.boolean().optional(),smartSetupChoices:external_exports.boolean().optional(),autoRecall:external_exports.boolean().optional(),skillsLibrary:external_exports.boolean().optional(),shareLearnedSkills:external_exports.enum(["off","ask","auto"]).optional(),roomMemoryCapture:external_exports.boolean().optional(),
|
|
1579
|
-
parallelRoomJobs:external_exports.boolean().optional(),acpPlanLines:external_exports.boolean().optional()}).extend({agentsToolBridge:external_exports.boolean().optional(),savedSteps:external_exports.boolean().optional()}),onboardingConfigSchema=external_exports.object({completedAt:external_exports.string().trim().max(40).optional(),version:external_exports.number().int().min(0).max(1e3).optional(),reelSeen:external_exports.boolean().optional(),hintsSeen:external_exports.array(external_exports.string().
|
|
1580
|
-
trim().min(1).max(60)).max(100).optional(),firstTurnAt:external_exports.string().trim().max(40).optional()}).strict(),instanceConfigSchema=external_exports.object({driver:external_exports.string().min(1),displayName:optionalText2,accentColor:optionalText2,icon:external_exports.discriminatedUnion("kind",[external_exports.object({kind:external_exports.literal("preset"),preset:external_exports.enum(PROVIDER_ICON_PRESETS)}).strict(),external_exports.object({kind:external_exports.literal("custom"),dataUrl:external_exports.
|
|
1581
|
-
string()}).strict().refine(icon2=>providerIconError(icon2)===null,{message:"Invalid provider icon"})]).optional(),environment:external_exports.record(external_exports.string(),external_exports.string()).optional(),enabled:external_exports.boolean().optional(),hidden:external_exports.boolean().optional(),access:external_exports.enum(["subscription","custom","api"]).optional(),config:external_exports.json().optional()}),instanceConfigMapSchema=external_exports.record(external_exports.string(),instanceConfigSchema),
|
|
1582
|
-
defaultModelSelectionSchema=external_exports.object({instanceId:external_exports.string().trim().min(1).max(200),model:external_exports.string().trim().min(1).max(500),effort:external_exports.enum(EFFORT_LEVELS).optional(),variant:external_exports.string().refine(isModelVariant,"invalid model variant").optional()}).refine(selection=>selection.variant===void 0||selection.effort===void 0,"choose either a model variant or an effort level"),automaticRecoverySchema=external_exports.object({enabled:external_exports.
|
|
1583
|
-
boolean(),backup:defaultModelSelectionSchema.optional()}).strict().refine(recovery=>!recovery.enabled||recovery.backup!==void 0,{message:"Choose a backup model before enabling automatic recovery",path:["backup"]}),cacheKeepWarmSchema=external_exports.object({enabled:external_exports.boolean(),windowMinutes:external_exports.number().int().min(15).max(1440).optional()}).strict(),threadsConfigSchema=external_exports.object({maxConcurrentPerBot:external_exports.number().int().min(1).max(MAX_CONCURRENT_BOT_THREADS),
|
|
1584
|
-
eventLogMaxBytes:external_exports.number().int().min(MIN_THREAD_EVENT_LOG_BYTES).max(MAX_THREAD_EVENT_LOG_BYTES).optional(),eventLogRetentionDays:external_exports.number().int().min(1).max(3650).optional()}).strict(),newBotsConfigSchema=external_exports.object({effort:external_exports.enum(EFFORT_LEVELS).optional()}).strict(),newBotsPatchSchema=external_exports.object({effort:newBotsConfigSchema.shape.effort.nullable()}).strict(),threadsPatchSchema=threadsConfigSchema.extend({maxConcurrentPerBot:threadsConfigSchema.
|
|
1585
|
-
shape.maxConcurrentPerBot.optional(),eventLogMaxBytes:threadsConfigSchema.shape.eventLogMaxBytes.nullable(),eventLogRetentionDays:threadsConfigSchema.shape.eventLogRetentionDays.nullable()}),appConfigSchema=external_exports.object({customDomain:external_exports.string().optional(),signIn:external_exports.object({admins:external_exports.array(external_exports.string().max(320)).max(500).optional(),members:external_exports.array(external_exports.string().max(320)).max(5e3).optional()}).optional(),
|
|
1586
|
-
defaultModelSelection:defaultModelSelectionSchema.optional(),automaticRecovery:automaticRecoverySchema.optional(),cacheKeepWarm:cacheKeepWarmSchema.optional(),newBotDefaults:newBotDefaultsSchema.optional(),newBots:newBotsConfigSchema.optional(),cliStartup:external_exports.object({access:external_exports.enum(["local","tunnel","tailscale","public-url"]),publicUrl:external_exports.string().url().optional(),phone:external_exports.enum(["ios","android"]).optional()}).optional(),mistral:external_exports.
|
|
1587
|
-
object({key:optionalText2}).optional(),cerebras:external_exports.object({key:optionalText2}).optional(),treg:external_exports.object({key:optionalText2}).optional(),postiz:external_exports.object({key:optionalText2,url:optionalText2}).optional(),groq:external_exports.object({key:optionalText2,url:optionalText2}).optional(),greenference:external_exports.object({key:optionalText2}).optional(),modelgo:external_exports.object({key:optionalText2}).optional(),meta:external_exports.object({key:optionalText2,
|
|
1588
|
-
url:optionalText2}).optional(),deepseek:external_exports.object({key:optionalText2}).optional(),xai:external_exports.object({key:optionalText2,url:optionalText2}).optional(),anthropic:external_exports.object({key:optionalText2,url:optionalText2,everyClaudeBot:external_exports.boolean().optional()}).optional(),openai:external_exports.object({key:optionalText2}).optional(),openrouter:external_exports.object({key:optionalText2}).optional(),budgets:external_exports.object({monthlyUsd:external_exports.
|
|
1589
|
-
number().min(0).max(1e6).optional(),warnAtPercent:external_exports.number().int().min(1).max(100).optional()}).optional(),billing:external_exports.object({currency:external_exports.string().regex(/^[A-Z]{3}$/).optional(),prices:external_exports.record(external_exports.string().min(1).max(160),external_exports.object({inputPerMillion:external_exports.number().min(0).max(1e6),outputPerMillion:external_exports.number().min(0).max(1e6),cachedInputPerMillion:external_exports.number().min(0).max(1e6).
|
|
1590
|
-
optional()})).optional()}).optional(),openaiCompat:external_exports.object({key:optionalText2,url:optionalText2,model:optionalText2,provider:optionalText2}).optional(),composio:external_exports.object({apiKey:optionalText2,userId:optionalText2,sessionId:optionalText2}).optional(),box:external_exports.object({token:optionalText2}).optional(),vps:vpsConfigSchema.optional(),opencodeGo:external_exports.object({apiKey:optionalText2,providerKeys:external_exports.record(external_exports.string(),external_exports.
|
|
1591
|
-
string()).optional()}).optional(),tts:external_exports.object({key:optionalText2,fishKey:optionalText2,geminiKey:optionalText2,voice:optionalText2,provider:external_exports.enum(["elevenlabs","fish","system","chatterbox","xai","gemini","openai"]).optional(),baseUrl:external_exports.string().trim().max(2048).refine(value=>!value||/^https?:\/\//i.test(value),"the Chatterbox server address must start with http:// or https://").optional(),model:optionalText2,fishModel:external_exports.enum(FISH_TTS_MODELS).
|
|
1592
|
-
optional(),everyReply:external_exports.boolean().optional()}).optional(),decider:deciderConfigSchema.optional(),live:liveConfigSchema.optional(),imageGen:imageGenConfigSchema.optional(),everyBotRules:external_exports.string().max(24e3).optional(),profile:external_exports.object({name:optionalText2,email:optionalText2,aboutMe:external_exports.string().max(24e3).optional(),avatarUrl:external_exports.union([external_exports.literal(""),botAvatarUrlSchema]).optional()}).optional(),language:optionalText2,
|
|
1593
|
-
computerName:external_exports.string().trim().max(63).optional(),rooms:roomConfigSchema.optional(),mcp:mcpConfigSchema.optional(),context:external_exports.object({compactAt:external_exports.number().positive().max(1e7).optional(),autoCompact:external_exports.boolean().optional()}).extend(roomContextSettings).extend(replaySettings).optional(),memory:external_exports.object({captureQuietMs:external_exports.number().int().min(1e3).max(1440*6e4).optional(),tidyHour:external_exports.number().int().min(
|
|
1594
|
-
0).max(23).optional()}).strict().optional(),threads:threadsConfigSchema.optional(),burst:external_exports.object({maxParallel:external_exports.number().int().min(1).max(100).optional()}).strict().optional(),decisions:external_exports.object({retentionDays:external_exports.number().int().min(1).max(3650).optional()}).strict().optional(),loopGuard:loopGuardConfigSchema.optional(),safetyFloor:external_exports.object({enabled:external_exports.boolean().optional()}).strict().optional(),localVm:localVmConfigSchema.
|
|
1595
|
-
optional(),features:featureConfigSchema.optional(),onboarding:onboardingConfigSchema.optional(),browserEngine:browserEngineConfigSchema.optional(),browserProfiles:browserProfilesSchema.optional(),instances:instanceConfigMapSchema.optional(),mcpServers:external_exports.record(external_exports.string(),external_exports.unknown()).optional()}),storedAppConfigSchema=appConfigSchema.extend(helperStoredShape).extend({browserProfiles:storedBrowserProfilesSchema.optional(),opencodeGo:external_exports.object(
|
|
1596
|
-
{apiKey:optionalText2,providerKeys:external_exports.record(external_exports.string(),external_exports.unknown()).catch({}).transform(keys=>Object.fromEntries(Object.entries(keys).filter(entry=>typeof entry[1]=="string"))).optional()}).optional()}),appConfigPatchSchema=appConfigSchema.omit({instances:!0,mcpServers:!0,cliStartup:!0,customDomain:!0}).extend({threads:threadsPatchSchema.optional(),newBots:newBotsPatchSchema.optional(),imageGen:imageGenPatchSchema.optional()}),CONFIG_PATCH_FIELDS=appConfigPatchSchema.
|
|
1597
|
-
shape,jsonObjectSchema2=external_exports.record(external_exports.string(),external_exports.json());function parseStoredConfig(value){let parsed=storedAppConfigSchema.safeParse(value);if(!parsed.success)throw new Error(schemaIssue(parsed.error,"Invalid stored configuration"));return parsed.data.localVm&&parsed.data.localVm.automaticCapacity===void 0&&(parsed.data.localVm.automaticCapacity=!0),parsed.data}var DEFAULT_CAPTURE_QUIET_MS=2*6e4;var DATA_DIR=process.env.OMB_DATA_DIR||join2(dataHome(),".limixbot"),LEGACY_DATA_DIR=join2(dataHome(),".opengrokbot"),EVENTS_DIR=join2(DATA_DIR,"events"),NATIVE_DIR=join2(DATA_DIR,"native");var storedConfig=settledFileCache(()=>join2(DATA_DIR,"config.json"),()=>parseStoredConfig(parseJson(readFileSync2(join2(DATA_DIR,"config.json"),"utf8"))));var TOKEN=process.env.LIMIX_OWNER_LANE_TOKEN?.trim()||"";delete process.env.LIMIX_OWNER_LANE_TOKEN;var MAX_VISIBILITY_PEOPLE=500;var peopleSchema=external_exports.object({people:external_exports.array(external_exports.string().max(320)).max(MAX_VISIBILITY_PEOPLE)}).strict();var accessSchema=external_exports.object({everyone:external_exports.enum(["none","view","chat","edit"]),people:external_exports.record(external_exports.string().max(320),external_exports.enum(["view","chat","edit"]))}).strict();var ROSTER_NAME_MAX=80;var oneLine2=value=>{let flattened="";for(let i=0;i<value.length;i+=1){let code=value.charCodeAt(i),breaksOut=code<32||code>=127&&code<=159||code===8232||code===8233;flattened+=breaksOut?" ":value[i]}return flattened.replace(/\s+/g," ").trim()},clip=(value,max)=>{let flat=oneLine2(value);return flat.length>max?`${flat.slice(0,max-1)}\u2026`:flat};function peerName(value){return clip(value.replace(/[[\]]/g," "),ROSTER_NAME_MAX)}var FIELDS2=["value","label","title","caption"],KEY=/^(?:brief|chat\.notice|server\.meetings)\.[\w.]{1,80}$/,STYLES=new Set(["clock","bareClock","longDate","shortDate"]),MAX_PARAMS=8,MAX_DEPTH=3,MAX_STRING=400,isRecord3=value=>value!==null&&typeof value=="object"&&!Array.isArray(value);function readParam(raw,depth){if(typeof raw=="string")return raw.slice(0,MAX_STRING);if(typeof raw=="number")return Number.isFinite(raw)?raw:void 0;if(isRecord3(raw))return typeof raw.at=="number"&&Number.isFinite(
|
|
1598
|
-
raw.at)&&STYLES.has(raw.style)?{at:raw.at,style:raw.style,...typeof raw.zone=="string"&&raw.zone.length<=64?{zone:raw.zone}:{}}:readText(raw,depth+1)}function readText(raw,depth){if(!isRecord3(raw)||typeof raw.key!="string"||!KEY.test(raw.key)||depth>MAX_DEPTH)return;if(raw.params===void 0)return{key:raw.key};if(!isRecord3(raw.params))return;let entries=Object.entries(raw.params).slice(0,MAX_PARAMS).map(([name,value])=>[name,readParam(value,depth)]);if(!entries.some(([name,value])=>value===void 0||
|
|
1599
|
-
!/^\w{1,32}$/.test(name)))return{key:raw.key,params:Object.fromEntries(entries)}}function readWidgetText(raw){if(!isRecord3(raw))return;let fields2={};for(let field of FIELDS2){let text2=readText(raw[field],0);text2&&(fields2[field]=text2)}return Object.keys(fields2).length?fields2:void 0}function buttonStyle(raw){return raw.color==="danger"||raw.style==="danger"?"danger":raw.variant==="ghost"||raw.style==="quiet"?"quiet":raw.style==="secondary"||raw.variant==="outline"||raw.variant==="soft"||raw.color==="secondary"?"secondary":raw.style==="primary"||raw.color==="primary"||raw.variant==="solid"||raw.submit===!0?"primary":"secondary"}var WIDGET_LIMITS={bytes:32e3,nodes:250,depth:10,listItems:40,options:40,fields:20,tableRows:60,tableCols:8,chartRows:100,chartSeries:4,images:6,text:2e3,markdown:6e3,title:120,caption:240,label:80,actionPayloadBytes:2e3,fieldValue:2e3,fallback:1500},WIDGET_ICON_NAMES=["info","agent","analytics","atom","batch","bolt","book-open","book-closed","book-clock","bug","calendar","chart","check","check-circle","check-circle-filled","chevron-left","chevron-right","circle-question","compass","confetti","c\
|
|
1600
|
-
ube","desktop","document","dot","dots-horizontal","dots-vertical","empty-circle","external-link","globe","keys","lab","images","lifesaver","lightbulb","mail","map-pin","maps","mobile","name","notebook","notebook-pencil","page-blank","phone","play","plus","profile","profile-card","reload","star","star-filled","search","sparkle","sparkle-double","square-code","square-image","square-text","suitcase","settings-slider","user","wreath","write","write-alt","write-alt2","pull-request","upload","download",
|
|
1601
|
-
"clock","lock","link","file","folder","bell","warning","close","arrow-right"],THREAD_ID=/^[\w-]{1,128}$/;function threadActionTarget(action2){if(action2.type!=="open_thread"||!isRecord4(action2.payload))return;let{botId,groupId,threadId}=action2.payload;if(!(typeof threadId!="string"||!THREAD_ID.test(threadId))){if(typeof botId=="string"&&THREAD_ID.test(botId)&&groupId===void 0)return{botId,threadId};if(typeof groupId=="string"&&THREAD_ID.test(groupId)&&botId===void 0)return{groupId,threadId}}}var PHONE_PAIRING_ACTION="open_phone_pairing",CLIENT_ACTION=action2=>action2.type==="open_url"||action2.type==="open_thread"||action2.type===PHONE_PAIRING_ACTION,ROOT_TYPES=new Set(["Card","ListView"]),FIELD_TYPES=new Set(["Select","DatePicker","TimePicker","DayPicker","Checkbox","RadioGroup","Input","Textarea"]),TYPE_ALIASES={TableRow:"Table.Row",TableCell:"Table.Cell"},ACTION_TYPE=/^[A-Za-z0-9_.:-]{1,64}$/,FIELD_NAME=/^[A-Za-z0-9_.-]{1,64}$/,ISO_DATE=/^\d{4}-\d{2}-\d{2}$/,TIME_OF_DAY=/^([01]\d|2[0-3]):[0-5]\d$/,
|
|
1602
|
-
WIDGET_WEEKDAYS=["mon","tue","wed","thu","fri","sat","sun"],WidgetInputError=class extends Error{};function fail(path,message){throw new WidgetInputError(`${path}: ${message}`)}function isRecord4(value){return!!value&&typeof value=="object"&&!Array.isArray(value)}var clamp=(value,low,high)=>Math.min(high,Math.max(low,value));function text(max,mode="optional"){return(raw,path)=>{if(raw==null)return mode==="optional"?void 0:fail(path,"is required");if(typeof raw!="string"&&typeof raw!="number")return fail(
|
|
1603
|
-
path,"must be a string");let value=String(raw).trim();if(value.length>max)return fail(path,`must be at most ${max} characters`);if(!value&&mode==="nonEmpty")return fail(path,"must not be blank");if(!(!value&&mode==="optional"))return value}}function line2(max,mode="optional"){let read=text(max,mode);return(raw,path)=>read(typeof raw=="string"?raw.replace(/\s+/g," "):raw,path)}function oneOf(...values){return raw=>typeof raw=="string"&&values.includes(raw)?raw:void 0}function mapped(map2){return raw=>typeof raw==
|
|
1604
|
-
"string"&&Object.hasOwn(map2,raw)?map2[raw]:void 0}var on=raw=>raw===!0?!0:void 0,off=raw=>raw===!1?!1:void 0;function pxOf(raw){let match=typeof raw=="string"?/^(\d+(?:\.\d+)?)px$/.exec(raw.trim()):null;return match?Number(match[1]):void 0}function spacing(max=64){return raw=>{let px=typeof raw=="number"&&Number.isFinite(raw)?raw*4:pxOf(raw);return px===void 0?void 0:clamp(Math.round(px),0,max)}}function length(max=2e3){return raw=>{if(raw==="100%"||raw==="full")return"full";let px=typeof raw==
|
|
1605
|
-
"number"&&Number.isFinite(raw)?raw:pxOf(raw);return px===void 0||px<1?void 0:clamp(Math.round(px),1,max)}}function integer2(min,max){return raw=>{let value=typeof raw=="string"&&raw.trim()?Number(raw):raw;return typeof value=="number"&&Number.isFinite(value)?clamp(Math.round(value),min,max):void 0}}function decimal(min,max){return raw=>{let value=typeof raw=="string"&&raw.trim()?Number(raw):raw;return typeof value=="number"&&Number.isFinite(value)?clamp(value,min,max):void 0}}var padding=raw=>{let side=spacing();
|
|
1606
|
-
if(!isRecord4(raw)){let all=side(raw,"");return typeof all=="number"?[all,all,all,all]:void 0}let pick2=(...keys)=>{for(let key of keys){let value=side(raw[key],"");if(typeof value=="number")return value}return 0},sides=[pick2("top","y"),pick2("right","x"),pick2("bottom","y"),pick2("left","x")];return sides.some(Boolean)?sides:void 0},RADII={none:0,"2xs":2,xs:4,sm:6,md:8,lg:12,xl:16,"2xl":20,"3xl":24,"4xl":28,full:999,"100%":999},radius=raw=>typeof raw=="number"&&Number.isFinite(raw)?clamp(Math.
|
|
1607
|
-
round(raw),0,999):typeof raw=="string"&&Object.hasOwn(RADII,raw)?RADII[raw]:void 0,aspectRatio=raw=>{let parts=typeof raw=="string"?/^(\d+(?:\.\d+)?)\s*\/\s*(\d+(?:\.\d+)?)$/.exec(raw.trim()):null,value=parts?Number(parts[1])/Number(parts[2]):typeof raw=="string"?Number(raw):raw;return typeof value=="number"&&Number.isFinite(value)&&value>0?clamp(value,.1,10):void 0},background=mapped({surface:"surface",secondary:"secondary",tertiary:"tertiary",elevated:"elevated","surface-secondary":"secondary",
|
|
1608
|
-
"surface-tertiary":"tertiary","surface-elevated":"elevated","surface-elevated-secondary":"elevated"}),inkColor=mapped({prose:"primary",primary:"primary",emphasis:"primary",secondary:"secondary",tertiary:"tertiary",success:"success",warning:"warning",danger:"danger"}),border=raw=>{let size=isRecord4(raw)?raw.size:raw;return typeof size=="number"&&Number.isFinite(size)&&size>0?clamp(Math.round(size),1,2):void 0},weight=oneOf("normal","medium","semibold","bold"),textAlign=oneOf("start","center","en\
|
|
1609
|
-
d");function icon(fallback){return raw=>typeof raw=="string"&&WIDGET_ICON_NAMES.includes(raw)?raw:raw==null?void 0:fallback}var flexShare=(raw,path)=>{let share=decimal(0,12)(raw,path),rounded=typeof share=="number"?Math.round(share*100)/100:0;return rounded>0?rounded:void 0},DATE_YEARS={min:1900,max:2200},isoDate=raw=>{if(typeof raw!="string"||!ISO_DATE.test(raw)||Number.isNaN(Date.parse(`${raw}T00:00:00Z`)))return;let year=Number(raw.slice(0,4));return year>=DATE_YEARS.min&&year<=DATE_YEARS.max?
|
|
1610
|
-
raw:void 0},timeOfDay=raw=>{let match=typeof raw=="string"?/^(\d{1,2}):(\d{2})(?::\d{2})?$/.exec(raw.trim()):null,value=match?`${match[1].padStart(2,"0")}:${match[2]}`:void 0;return value&&TIME_OF_DAY.test(value)?value:void 0};function weekdays2(raw){let items=Array.isArray(raw)?raw:typeof raw=="string"?raw.split(","):[],picked=new Set(items.filter(item=>typeof item=="string").map(item=>item.trim().toLowerCase().slice(0,3))),days=WIDGET_WEEKDAYS.filter(day=>picked.has(day));return days.length?days.
|
|
1611
|
-
join(","):void 0}var weekdaysReader=raw=>weekdays2(raw),progressValue=raw=>{let percent=typeof raw=="string"?/^\s*(\d+(?:\.\d+)?)\s*%\s*$/.exec(raw):null,value=percent?Number(percent[1])/100:typeof raw=="string"&&raw.trim()?Number(raw):raw;if(!(typeof value!="number"||!Number.isFinite(value)||value<0))return clamp(value>1&&value<=100?value/100:value,0,1)},action=(raw,path)=>{if(raw==null)return;if(!isRecord4(raw)||typeof raw.type!="string"||!ACTION_TYPE.test(raw.type))return fail(path,'must be {\
|
|
1612
|
-
type, payload?} with a type of letters, digits and "_.:-"');let out={type:raw.type};if(raw.payload!==void 0){let json2=JSON.stringify(raw.payload);if(json2===void 0)return fail(`${path}.payload`,"must be JSON");if(json2.length>WIDGET_LIMITS.actionPayloadBytes)return fail(`${path}.payload`,`must be at most ${WIDGET_LIMITS.actionPayloadBytes} characters of JSON`);out.payload=JSON.parse(json2)}return out.type==="open_url"&&!isWebUrl(isRecord4(out.payload)?out.payload.url:void 0,["http:","https:"])?
|
|
1613
|
-
fail(`${path}.payload.url`,"open_url needs an http or https url"):out.type==="open_thread"&&!threadActionTarget(out)?fail(`${path}.payload`,"open_thread needs {botId, threadId} or {groupId, threadId}"):out},WEB_URL_MAX=2e3;function isWebUrl(value,protocols){if(typeof value!="string"||value.length>WEB_URL_MAX)return!1;try{return protocols.includes(new URL(value).protocol)}catch{return!1}}var buttonSpec=(raw,path)=>raw==null?void 0:isRecord4(raw)?{label:line2(WIDGET_LIMITS.label,"nonEmpty")(raw.label,
|
|
1614
|
-
`${path}.label`),action:action(raw.action,`${path}.action`)??fail(`${path}.action`,"is required")}:fail(path,"must be {label, action}"),status=(raw,path)=>{if(raw==null)return;let record6=isRecord4(raw)?raw:{text:raw},label=line2(WIDGET_LIMITS.caption,"nonEmpty")(record6.text,`${path}.text`),name=icon()(record6.icon,`${path}.icon`);return name?{text:label,icon:name}:{text:label}},options=(raw,path)=>{if(!Array.isArray(raw)||raw.length<1||raw.length>WIDGET_LIMITS.options)return fail(path,`needs 1\
|
|
1615
|
-
to ${WIDGET_LIMITS.options} items`);let seen=new Set;return raw.map((item,index)=>{let at=`${path}[${index}]`,record6=isRecord4(item)?item:{value:item},value=line2(200,"nonEmpty")(typeof record6.value=="boolean"?String(record6.value):record6.value,`${at}.value`);return seen.has(value)?fail(at,`repeats the value ${JSON.stringify(value)}`):(seen.add(value),{label:line2(WIDGET_LIMITS.label)(record6.label,`${at}.label`)??value,value})})},UNSAFE_KEYS=new Set(["__proto__","constructor","prototype"]),
|
|
1616
|
-
fieldName=(raw,path)=>typeof raw=="string"&&FIELD_NAME.test(raw)&&!raw.split(".").some(part=>UNSAFE_KEYS.has(part))?raw:fail(path,'is required: letters, digits and "_.-", at most 64'),optionalFieldName=(raw,path)=>raw==null?void 0:fieldName(raw,path),inputType=(raw,path)=>raw==="password"?fail(path,"password fields are not allowed in a widget; use request_credential for secrets"):oneOf("text","number","email","tel","url")(raw,path),imageSrc=(raw,path)=>isWebUrl(raw,["https:"])?raw:fail(path,"mus\
|
|
1617
|
-
t be an https url"),CHART_MAX=1e12,chartData=(raw,path)=>!Array.isArray(raw)||raw.length<1||raw.length>WIDGET_LIMITS.chartRows?fail(path,`needs 1 to ${WIDGET_LIMITS.chartRows} rows`):raw.map((row,index)=>{if(!isRecord4(row))return fail(`${path}[${index}]`,"must be an object");let out={};for(let[key,value]of Object.entries(row).slice(0,12))UNSAFE_KEYS.has(key)||(typeof value=="number"?Number.isFinite(value):typeof value=="string"||value===null)&&(out[key.slice(0,64)]=typeof value=="string"?value.
|
|
1618
|
-
slice(0,120):typeof value=="number"?clamp(value,-CHART_MAX,CHART_MAX):null);return out}),chartSeries=(raw,path)=>!Array.isArray(raw)||raw.length<1||raw.length>WIDGET_LIMITS.chartSeries?fail(path,`needs 1 to ${WIDGET_LIMITS.chartSeries} series`):raw.map((item,index)=>{let at=`${path}[${index}]`;if(!isRecord4(item))return fail(at,"must be {type, dataKey}");let series={type:oneOf("bar","line","area")(item.type,at)??"bar",dataKey:text(64,"nonEmpty")(item.dataKey,`${at}.dataKey`)},label=line2(WIDGET_LIMITS.
|
|
1619
|
-
label)(item.label,`${at}.label`);typeof label=="string"&&(series.label=label);let stack=text(32)(item.stack,`${at}.stack`);return typeof stack=="string"&&(series.stack=stack),series}),chartAxis=(raw,path)=>({dataKey:text(64,"nonEmpty")(isRecord4(raw)?raw.dataKey:raw,`${path}.dataKey`)}),LAYOUT={gap:spacing(),padding,align:oneOf("start","center","end","baseline","stretch"),justify:oneOf("start","center","end","between","around","evenly","stretch"),wrap:raw=>raw===!0||raw==="wrap"?!0:void 0,flex:flexShare,
|
|
1620
|
-
width:length(),height:length(),minWidth:length(),maxWidth:length(),minHeight:length(),maxHeight:length(),aspectRatio,background,border,radius},TEXT_STYLE={weight,color:inkColor,textAlign,truncate:on,maxLines:integer2(1,20),width:length()},ROOT={title:line2(WIDGET_LIMITS.title),caption:line2(WIDGET_LIMITS.caption),meta:line2(WIDGET_LIMITS.label),status,confirm:buttonSpec,cancel:buttonSpec},FIELD={name:fieldName,label:line2(WIDGET_LIMITS.title),disabled:on,required:on},PLACEHOLDER=line2(WIDGET_LIMITS.
|
|
1621
|
-
title),SPECS={Card:{props:{...ROOT,size:oneOf("sm","md","lg","full"),padding},children:"any"},ListView:{props:{...ROOT,limit:integer2(1,WIDGET_LIMITS.listItems),name:optionalFieldName,defaultValue:line2(200)},children:"items"},ListViewItem:{props:{gap:spacing(),align:LAYOUT.align,onClickAction:action,value:line2(200)},children:"any"},Box:{props:{...LAYOUT,direction:oneOf("row","col")},children:"any"},Row:{props:LAYOUT,children:"any"},Col:{props:LAYOUT,children:"any"},Form:{props:{...LAYOUT,direction:oneOf(
|
|
1622
|
-
"row","col"),onSubmitAction:action},children:"any"},Spacer:{props:{minSize:length(400)}},Divider:{props:{spacing:spacing(),flush:on}},Table:{props:{},children:"rows"},"Table.Row":{props:{header:on},children:"cells"},"Table.Cell":{props:{align:textAlign,vAlign:textAlign,colSpan:integer2(1,WIDGET_LIMITS.tableCols),rowSpan:integer2(1,20),width:length(),colSize:oneOf("xs","sm","md","lg","xl"),padding},children:"any"},Text:{props:{value:text(WIDGET_LIMITS.text,"required"),size:oneOf("xs","sm","md","l\
|
|
1623
|
-
g","xl"),...TEXT_STYLE,italic:on,lineThrough:on,minLines:integer2(1,20)}},Title:{props:{value:text(WIDGET_LIMITS.text,"required"),size:oneOf("sm","md","lg","xl","2xl","3xl","4xl","5xl"),...TEXT_STYLE}},Caption:{props:{value:text(WIDGET_LIMITS.text,"required"),size:oneOf("sm","md","lg"),...TEXT_STYLE}},Label:{props:{value:line2(WIDGET_LIMITS.title,"nonEmpty"),fieldName:text(64),size:oneOf("xs","sm","md","lg","xl"),weight,color:inkColor,textAlign,width:length()}},Markdown:{props:{value:text(WIDGET_LIMITS.
|
|
1624
|
-
markdown,"required")}},Image:{props:{src:imageSrc,alt:line2(WIDGET_LIMITS.caption),fit:oneOf("none","fill","cover","contain","scale-down"),position:oneOf("center","top","bottom","left","right","top left","top right","bottom left","bottom right"),frame:on,flush:on,width:length(),height:length(),minWidth:length(),maxWidth:length(),minHeight:length(),maxHeight:length(),aspectRatio,radius}},Icon:{props:{name:icon("dot"),color:inkColor,size:oneOf("xs","sm","md","lg","xl","2xl","3xl")}},Chart:{props:{
|
|
1625
|
-
data:chartData,series:chartSeries,xAxis:chartAxis,showYAxis:on,showLegend:off,showGrid:off,height:length(400),aspectRatio,flex:flexShare,width:length()}},Badge:{props:{label:line2(WIDGET_LIMITS.label,"nonEmpty"),color:oneOf("secondary","success","danger","warning","info","discovery"),variant:oneOf("soft","solid","outline","dot"),size:oneOf("sm","md","lg"),pill:off}},Progress:{props:{value:progressValue,label:line2(WIDGET_LIMITS.caption)}},Button:{props:{label:line2(WIDGET_LIMITS.label),iconStart:icon(),
|
|
1626
|
-
iconEnd:icon(),block:on,disabled:on,submit:on,onClickAction:action}},Select:{props:{...FIELD,options,placeholder:PLACEHOLDER,defaultValue:text(200),clearable:on,block:on}},DatePicker:{props:{...FIELD,placeholder:PLACEHOLDER,defaultValue:isoDate,min:isoDate,max:isoDate,clearable:on,block:on}},TimePicker:{props:{...FIELD,placeholder:PLACEHOLDER,defaultValue:timeOfDay,min:timeOfDay,max:timeOfDay,step:integer2(1,60),clearable:on,block:on}},DayPicker:{props:{...FIELD,defaultValue:weekdaysReader}},Checkbox:{
|
|
1627
|
-
props:{...FIELD,defaultChecked:on}},RadioGroup:{props:{...FIELD,options,defaultValue:text(200),direction:oneOf("row","col"),ariaLabel:line2(WIDGET_LIMITS.title)}},Input:{props:{...FIELD,inputType,placeholder:PLACEHOLDER,defaultValue:text(WIDGET_LIMITS.fieldValue),pattern:text(200)}},Textarea:{props:{...FIELD,placeholder:PLACEHOLDER,defaultValue:text(WIDGET_LIMITS.fieldValue),rows:integer2(1,12),maxRows:integer2(1,20),autoResize:on}},Transition:{props:{},children:"one"}},WIDGET_NODE_TYPES=Object.
|
|
1628
|
-
keys(SPECS);function typeOf(raw){return typeof raw.type=="string"?TYPE_ALIASES[raw.type]??raw.type:""}function normalize(input2,path,depth,slot,context){if(!isRecord4(input2))return fail(path,"must be an object with a type");let raw=input2,type=typeOf(raw);if(!Object.hasOwn(SPECS,type))return fail(path,`unknown type ${JSON.stringify(raw.type)}; use one of ${WIDGET_NODE_TYPES.join(", ")}`);if(slot==="items"&&type!=="ListViewItem"&&([raw,type]=[{type:"ListViewItem",children:[raw]},"ListViewItem"]),
|
|
1629
|
-
slot==="cells"&&type!=="Table.Cell"&&([raw,type]=[{type:"Table.Cell",children:[raw]},"Table.Cell"]),slot==="rows"&&type!=="Table.Row")return fail(path,"a Table takes Table.Row children");if(slot!=="root"&&ROOT_TYPES.has(type))return fail(path,`${type} is a root and cannot be nested`);if(slot==="any"&&(type==="Table.Row"||type==="Table.Cell"))return fail(path,`${type} belongs inside a Table`);if(depth>WIDGET_LIMITS.depth)return fail(path,`is nested deeper than ${WIDGET_LIMITS.depth} levels`);if(context.
|
|
1630
|
-
nodes+=1,context.nodes>WIDGET_LIMITS.nodes)return fail(path,`the widget has more than ${WIDGET_LIMITS.nodes} nodes`);let spec=SPECS[type],node2={type,id:`n${context.nodes}`},source={...raw};for(let[shorthand,a,b2]of[["size","width","height"],["minSize","minWidth","minHeight"],["maxSize","maxWidth","maxHeight"]]){let both=source[shorthand];type==="Card"||type==="Spacer"||!(typeof both=="number"||both==="100%"||pxOf(both)!==void 0)||(source[a]??=both,source[b2]??=both)}for(let[key,read]of Object.entries(
|
|
1631
|
-
spec.props)){let value=read(source[key],`${path}.${key}`);value!==void 0&&(node2[key]=value)}if(type==="Button"&&(node2.style=buttonStyle(raw)),raw.i18n!==void 0&&(node2.i18n=readWidgetText(raw.i18n)),type==="Icon"&&(node2.name??="dot"),type==="Progress"){let max=typeof raw.max=="number"&&Number.isFinite(raw.max)&&raw.max>0?raw.max:void 0,given2=typeof raw.value=="number"&&Number.isFinite(raw.value)?raw.value:void 0;if(max!==void 0&&given2!==void 0&&(node2.value=clamp(given2/max,0,1)),node2.value===
|
|
1632
|
-
void 0)return fail(`${path}.value`,"is required: a number from 0 to 1")}if(type==="Image"&&++context.images>WIDGET_LIMITS.images)return fail(path,`the widget has more than ${WIDGET_LIMITS.images} images`);if(FIELD_TYPES.has(type)){let name=node2.name;if(context.fields.has(name))return fail(`${path}.name`,`repeats the field name ${JSON.stringify(name)}`);if(context.fields.add(name),context.fields.size>WIDGET_LIMITS.fields)return fail(path,`the widget has more than ${WIDGET_LIMITS.fields} fields`);
|
|
1633
|
-
if(type==="TimePicker"||type==="DatePicker"){typeof node2.min=="string"&&typeof node2.max=="string"&&node2.min>node2.max&&delete node2.max;let picked=node2.defaultValue;typeof picked=="string"&&(typeof node2.min=="string"&&picked<node2.min||typeof node2.max=="string"&&picked>node2.max)&&delete node2.defaultValue}let chosen=node2.defaultValue;(type==="Select"||type==="RadioGroup")&&chosen!==void 0&&!node2.options.some(option=>option.value===chosen)&&delete node2.defaultValue,(type==="Select"||type===
|
|
1634
|
-
"RadioGroup")&&(node2.allowOther=raw.allowOther!==!1)}if(spec.children){let list=raw.children===void 0||raw.children===null?[]:Array.isArray(raw.children)?raw.children:[raw.children],kept=spec.children==="one"?list.slice(0,1):list;if(type==="ListView"&&kept.length>WIDGET_LIMITS.listItems)return fail(`${path}.children`,`a list takes at most ${WIDGET_LIMITS.listItems} items`);if(type==="Table"&&kept.length>WIDGET_LIMITS.tableRows)return fail(`${path}.children`,`a table takes at most ${WIDGET_LIMITS.
|
|
1635
|
-
tableRows} rows`);if(type==="Table.Row"&&kept.length>WIDGET_LIMITS.tableCols)return fail(`${path}.children`,`a row takes at most ${WIDGET_LIMITS.tableCols} cells`);let childSlot=spec.children==="one"?"any":spec.children;node2.children=kept.map((child,index)=>normalize(child,`${path}.children[${index}]`,depth+1,childSlot,context))}if(type==="ListView")if(typeof node2.name=="string")selectable(node2,raw,path,context);else{delete node2.defaultValue;for(let row of node2.children??[])delete row.value}
|
|
1636
|
-
return type==="ListViewItem"&&slot!=="items"&&delete node2.value,node2}function selectable(list,raw,path,context){let name=list.name;context.fields.has(name)&&fail(`${path}.name`,`repeats the field name ${JSON.stringify(name)}`),context.fields.add(name),context.fields.size>WIDGET_LIMITS.fields&&fail(path,`the widget has more than ${WIDGET_LIMITS.fields} fields`),isRecord4(list.confirm)||fail(`${path}.confirm`,"a list with a name lets the person choose a row; it needs confirm: {label, action} to \
|
|
1637
|
-
send the choice");let rows=list.children??[];rows.length<2&&fail(`${path}.children`,"a list with a name needs at least two rows to choose from");let seen=new Set;rows.forEach((row,index)=>{let at=`${path}.children[${index}]`;row.onClickAction!==void 0&&fail(`${at}.onClickAction`,"the rows of a list with a name are selected, not pressed; remove onClickAction from the rows, or remove name from the list");let value=widgetString(row,"value")??(firstText(row)||String(index+1));seen.has(value)&&fail(`${at}\
|
|
1638
|
-
.value`,`repeats the value ${JSON.stringify(value)}; give each row its own value`),seen.add(value),row.value=value}),raw.required!==!1&&(list.required=!0),list.allowOther=raw.allowOther!==!1,typeof list.defaultValue=="string"&&!seen.has(list.defaultValue)&&delete list.defaultValue}function parseWidgetInput(value){let raw=value;if(typeof raw=="string")try{raw=JSON.parse(raw)}catch{return{ok:!1,error:"widget: must be a JSON object, not text."}}if(!isRecord4(raw))return{ok:!1,error:"widget: must be an object with a type."};let bytes;try{bytes=JSON.stringify(raw).length}catch{return{ok:!1,error:"widget: must be plain JSON."}}if(bytes>WIDGET_LIMITS.bytes)return{ok:!1,error:`widget: is ${bytes} characters of JSON; keep it under ${WIDGET_LIMITS.bytes}.`};try{let rooted=ROOT_TYPES.
|
|
1639
|
-
has(typeOf(raw))?raw:{type:"Card",children:[raw]},root=normalize(rooted,"widget",1,"root",{nodes:0,images:0,fields:new Set}),seen=new Map;for(let entry of collectActions(root,!0)){if(!entry.label)return{ok:!1,error:`widget: the ${entry.kind} at ${entry.ref} has an action but no label; give it a label (a list item takes its first Text or Title).`};if(!entry.client){if(seen.has(entry.label))return{ok:!1,error:`widget: two actions are both labelled ${JSON.stringify(entry.label)}; give each a distin\
|
|
1640
|
-
ct label.`};seen.set(entry.label,entry.ref)}}return{ok:!0,value:root}}catch(error62){if(error62 instanceof WidgetInputError)return{ok:!1,error:`${error62.message}.`};throw error62}}var widgetString=(node2,key)=>typeof node2[key]=="string"?node2[key]:void 0;function buttonSpecOf(root,key){let spec=root[key];return isRecord4(spec)&&typeof spec.label=="string"&&isRecord4(spec.action)?spec:void 0}function walk(node2,visit2,ancestors=[]){visit2(node2,ancestors);let next=[...ancestors,node2];for(let child of Array.isArray(node2.children)?node2.children:[])isRecord4(child)&&walk(child,visit2,next)}function lastOf(items,match){for(let index=items.length-1;index>=0;index-=1)if(match(items[index]))return items[index]}function firstText(node2){let found="";return walk(
|
|
1641
|
-
node2,inner=>{found||inner.type!=="Title"&&inner.type!=="Text"||typeof inner.value!="string"||typeof inner.width=="number"||(found=inner.value.replace(/\s+/g," ").trim().slice(0,WIDGET_LIMITS.label))}),found}function collectActions(root,strict){let found=[];walk(root,(node2,ancestors)=>{if(node2.type==="Button"){if(node2.disabled===!0)return;let form=lastOf(ancestors,ancestor=>ancestor.type==="Form"),own2=isRecord4(node2.onClickAction)?node2.onClickAction:void 0,submitted=node2.submit===!0&&isRecord4(
|
|
1642
|
-
form?.onSubmitAction)?form.onSubmitAction:void 0,picked=own2??submitted;if(!picked){if(strict&&node2.submit===!0)throw new WidgetInputError(`widget: the submit Button at ${node2.id} needs a Form with onSubmitAction around it`);return}let row=lastOf(ancestors,ancestor=>ancestor.type==="ListViewItem"||ancestor.type==="Table.Row"||ancestor.type==="Row");found.push({ref:node2.id,label:widgetString(node2,"label")??"",action:picked,kind:"button",...node2.submit===!0?{tone:"submit"}:{},...row?{row:firstText(
|
|
1643
|
-
row)}:{}})}else node2.type==="ListViewItem"&&isRecord4(node2.onClickAction)&&found.push({ref:node2.id,label:firstText(node2),action:node2.onClickAction,kind:"item"})});for(let key of["confirm","cancel"]){let spec=buttonSpecOf(root,key);spec&&found.push({ref:key,label:spec.label,action:spec.action,tone:key,kind:key})}let counts=new Map;for(let entry of found)counts.set(entry.label,(counts.get(entry.label)??0)+1);return found.map(({row,...entry})=>({...entry,...CLIENT_ACTION(entry.action)?{client:!0}:
|
|
1644
|
-
{},label:row&&entry.label&&(counts.get(entry.label)??0)>1?`${entry.label}: ${row}`.slice(0,WIDGET_LIMITS.label*2):entry.label}))}function widgetActions(root){return collectActions(root,!1)}function widgetScope(root,ref){let scope=root;return walk(root,(node2,ancestors)=>{node2.id===ref&&(scope=lastOf(ancestors,ancestor=>ancestor.type==="Form")??root)}),scope}function widgetFields(scope,root=scope){let labels=new Map;walk(root,node2=>{node2.type==="Label"&&typeof node2.fieldName=="string"&&typeof node2.value=="string"&&labels.set(node2.fieldName,node2.value)});let fields2=[];return walk(scope,node2=>{if(typeof node2.name!="string"||!(FIELD_TYPES.has(node2.type)||node2.type==="ListV\
|
|
1645
|
-
iew"))return;let own2=node2.type==="ListView"?widgetString(node2,"title"):widgetString(node2,"label");fields2.push({name:node2.name,type:node2.type,node:node2,label:labels.get(node2.name)??own2??node2.name})}),fields2}function widgetAdvice(root){let notes=[],rows=Array.isArray(root.children)?root.children.length:0;root.type==="ListView"&&rows>=2&&buttonSpecOf(root,"confirm")&&widgetFields(root).length===0&&!widgetActions(root).some(entry=>entry.kind==="item"||entry.kind==="button")&¬es.push("No row of this list can be chosen: the person can only confirm or cancel it as a whole. If they are meant to pick one row, show it again with its widget_id and give the ListView a name (and each row a value), so the ro\
|
|
1646
|
-
ws become selectable and confirm sends the pick.");let fields2=widgetFields(root),sending=widgetActions(root).filter(entry=>!entry.client&&entry.tone!=="cancel");if(fields2.length>0&&!sending.length)notes.push("Nothing in this widget sends what the person fills in. Show it again with its widget_id and confirm: {label, action} (and cancel if they may decline) so they can send it.");else if(fields2.length>0){let sent=new Set(sending.flatMap(entry=>widgetFields(widgetScope(root,entry.ref),root).map(
|
|
1647
|
-
field=>field.name))),unsent=fields2.filter(field=>!sent.has(field.name)).map(field=>JSON.stringify(field.label));unsent.length&¬es.push(`${unsent.join(", ")} sits outside the Form whose button is the only way to send, so it is never sent. Show it again with its widget_id, with it inside that Form or with confirm on the Card.`)}let typed=fields2.filter(field=>field.type==="Input"),phrase=field=>`${field.name} ${field.label} ${widgetString(field.node,"placeholder")??""}`.replace(/\b(each|every|this|next|first|last|any|some|one|other|same|spare|free|full|part|lead|over|down)[\s-]+times?\b/gi,
|
|
1648
|
-
" ").replace(/\btimes\b/gi," "),asks=pattern=>typed.filter(field=>pattern.test(phrase(field))).map(field=>field.label),pickers=[[/\b(time|o'?clock|hh:mm)\b|\b\d{1,2}(:\d{2})?\s?[ap]m\b|\b\d{1,2}:\d{2}\b/i,"TimePicker"],[/\b(days|weekdays?|weekly|repeats?|repeating|(which|what) days?|days? of the week)\b/i,"DayPicker"],[/\b(dates?|deadline|due)\b/i,"DatePicker"]],seen=new Set;for(let[pattern,picker]of pickers){let labels=asks(pattern).filter(label=>!seen.has(label));labels.forEach(label=>seen.add(
|
|
1649
|
-
label)),labels.length&¬es.push(`${labels.map(label=>JSON.stringify(label)).join(", ")} asks the person to type what a ${picker} lets them pick. Show it again with its widget_id and a ${picker} in its place.`)}return notes.length?notes.join(" "):void 0}var CARD_TOOL_NAMES=new Set(["create_options_card","show_widget","show_html"]),CARD_ROUTE="/api/internal/options-card",MASKED=" Something in it read as a secret and was masked before it was stored. Never put secrets in a page or a widget.";async function callAppTool(name,args,context){let updating=name==="update_html",parsed=updating?parseUpdateHtmlInput(args):parseShowHtmlInput(args);if(!parsed.ok)return{text:parsed.error,isError:!0};let page=parsed.value.jsx!==void 0?{jsx:args.jsx}:parsed.value.
|
|
1650
|
-
path!==void 0?{path:args.path}:{html:args.html},frameless=parsed.value.frameless!==void 0?{frameless:parsed.value.frameless}:{},live=parsed.value.live!==void 0?{live:parsed.value.live}:{},body=updating?{tool:name,app_id:args.app_id,...page,...typeof args.title=="string"?{title:args.title}:{},...frameless,...live}:{tool:name,...page,title:args.title,...typeof args.height=="number"?{height:args.height}:{},...typeof args.fallback_text=="string"?{fallback_text:args.fallback_text}:{},...frameless,...live},
|
|
1651
|
-
answer=await context.client.apiResponse(CARD_ROUTE,{method:"POST",body:JSON.stringify(body)});if(!answer.ok)return{text:String(answer.body.error??(updating?"Could not update that page.":"Could not show that page.")),isError:!0};let messageId=String(answer.body.messageId??""),masked=answer.body.masked===!0?MASKED:"",leftOut2=typeof answer.body.leftOut=="string"&&answer.body.leftOut?` ${answer.body.leftOut}`:"";return{text:(updating?`Updated app ${messageId}.`:`Shown as app ${messageId}. To change\
|
|
1652
|
-
it, call show_html again with app_id "${messageId}".`)+leftOut2+masked}}async function callCardTool(name,args,context){let{api,apiResponse}=context.client;if(name==="create_options_card"){if(context.botId!==WATCHER_OPTIONS_CARD_BOT_ID)return{text:"create_options_card is not enabled for this bot.",isError:!0};let parsed2=parseOptionsCardInput(args);if(!parsed2.ok)return{text:parsed2.error,isError:!0};let result=await api(CARD_ROUTE,{method:"POST",body:JSON.stringify(parsed2.value)});return{text:`\
|
|
1653
|
-
Rendered the native options card in this Watcher thread (message ${String(result.messageId??"created")}). Wait for the person's click or custom response; the card itself authorizes no external action.`}}if(name==="show_html")return callAppTool(agentsCallMember(name,args)==="update_html"?"update_html":"show_html",args,context);let parsed=parseWidgetInput(args.widget);if(!parsed.ok)return{text:parsed.error,isError:!0};let updating=agentsCallMember(name,args)==="update_widget";if(updating&&(typeof args.
|
|
1654
|
-
widget_id!="string"||!args.widget_id.trim()))return{text:"widget_id: is required, the id show_widget returned.",isError:!0};let{ok,body}=await apiResponse(CARD_ROUTE,{method:"POST",body:JSON.stringify(updating?{tool:"update_widget",widget_id:args.widget_id,widget:args.widget}:{tool:"show_widget",widget:args.widget,...typeof args.fallback_text=="string"?{fallback_text:args.fallback_text}:{}})});if(!ok)return{text:String(body.error??(updating?"Could not update that widget.":"Could not show that wi\
|
|
1655
|
-
dget.")),isError:!0};let messageId=String(body.messageId??""),masked=body.masked===!0?" Something in it read as a secret and was masked before it was stored. Never put secrets in a widget, and name a payload field key, token or password only when it holds one.":"",advice=widgetAdvice(parsed.value);return{text:(updating?`Updated widget ${messageId}.`:`Shown as widget ${messageId}. Its answer arrives as the person's next message, even while you are still working; if they type something else instea\
|
|
1656
|
-
d, that is their answer. Do what does not depend on it, then end your turn without asking again in text. To change it later, call show_widget again with widget_id "${messageId}".`)+masked+(advice?` For you only; never mention it to the person: ${advice}`:"")}}var SAID={"Europe/London":"UK time","Europe/Belfast":"UK time","America/Phoenix":"Arizona time","Asia/Dubai":"UAE time"},UNIVERSAL=/^(?:Etc\/)?(?:UTC|UCT|GMT|Universal|Zulu|Greenwich)(?:[+-]0)?$/i,ABBREVIATION=/^(?:[A-Z]{1,5}|GMT.*|UTC.*)$/;function zoneName(zone,locale,style){try{let name=new Intl.DateTimeFormat(locale,{timeZone:zone,timeZoneName:style}).formatToParts(new Date).find(part=>part.type==="timeZoneName")?.value;return name&&!ABBREVIATION.test(name)?name:null}catch{return null}}function plainTimeZone(zone,locale="\
|
|
1474
|
+
throw new Error("Choose a valid cron preview date");return date5}function futureRuns(cron,after,count){let from=calculationDate(after),maximum=count+1440,requested=count;for(;;){let candidates=cron.nextRuns(requested,from),runs=[];for(let date5 of candidates){let at=date5.getTime();if(!Number.isFinite(at))throw new Error("The cron schedule produced an invalid date");if(at>(runs.at(-1)??after)&&runs.push(at),runs.length===count)return runs}if(candidates.length<requested||requested===maximum)return runs;
|
|
1475
|
+
requested=Math.min(maximum,requested*2)}}function normalizeCronSchedule(value,after=Date.now()){let{schedule,cron}=cronCalculator(value);if(!futureRuns(cron,after,1).length)throw new Error("This cron expression has no future runs. Choose dates that exist.");return schedule}var SAID={"Europe/London":"UK time","Europe/Belfast":"UK time","America/Phoenix":"Arizona time","Asia/Dubai":"UAE time"},UNIVERSAL=/^(?:Etc\/)?(?:UTC|UCT|GMT|Universal|Zulu|Greenwich)(?:[+-]0)?$/i,ABBREVIATION=/^(?:[A-Z]{1,5}|GMT.*|UTC.*)$/;function zoneName(zone,locale,style){try{let name=new Intl.DateTimeFormat(locale,{timeZone:zone,timeZoneName:style}).formatToParts(new Date).find(part=>part.type==="timeZoneName")?.value;return name&&!ABBREVIATION.test(name)?name:null}catch{return null}}function plainTimeZone(zone,locale="\
|
|
1657
1476
|
en"){let english=locale.toLowerCase().startsWith("en");if(UNIVERSAL.test(zone.trim()))return"UTC";if(english&&SAID[zone])return SAID[zone];let name=zoneName(zone,locale,"shortGeneric")??zoneName(zone,locale,"longGeneric");if(name)return english?name.replace(/ Time$/," time"):name;let city=zone.split("/").at(-1)?.replaceAll("_"," ").trim();return city?`${city} time`:zone}function dayKey(at,zone){return new Intl.DateTimeFormat("en-CA",{timeZone:zone,year:"numeric",month:"2-digit",day:"2-digit"}).format(at)}function plainWhen(at,zone,now=Date.now()){try{let time3=new Intl.DateTimeFormat("en-US",{timeZone:zone,hour:"numeric",minute:"2-digit"}).format(at).replace(/\s/g," "),date5=new Intl.DateTimeFormat("en-US",{timeZone:zone,weekday:"long",month:"long",day:"numeric"}).format(at),day=dayKey(at,zone),today=dayKey(now,zone);return day===today?`today at ${time3}`:day===
|
|
1658
1477
|
new Date(Date.parse(`${today}T12:00:00Z`)+864e5).toISOString().slice(0,10)?`tomorrow (${date5}) at ${time3}`:`${date5} at ${time3}`}catch{return new Date(at).toISOString()}}var TRIGGER_TOOL_NAMES=new Set(["trigger_info","trigger","delete_trigger"]),LIST_ROUTE="/api/internal/triggers",EVENTS_ROUTE="/api/internal/trigger-events",APP_ONLY=["app","event","account"],REQUEST_ROUTE="/api/internal/trigger-requests",SCHEDULE_ONLY=["schedule","timeout_minutes","timeoutMinutes","clear_timeout","continuity","overlap","run_on_startup","runOnStartup"];function jsonRecord(value){return value!==null&&typeof value=="object"&&!Array.isArray(value)}var SHORT_WEEKDAYS={mon:"monday",tue:"\
|
|
1659
1478
|
tuesday",tues:"tuesday",wed:"wednesday",thu:"thursday",thur:"thursday",thurs:"thursday",fri:"friday",sat:"saturday",sun:"sunday"},SUPPORTED_SCHEDULES='Supported schedules: {"type":"once","at":"2026-09-01T09:00:00+05:30"} (future RFC3339 with explicit offset), {"type":"weekly","time":"09:00","weekdays":["monday","friday"]}, {"type":"daily","time":"09:00"}, {"type":"interval","every_minutes":15,"weekdays":["monday","friday"],"window_start":"09:00","window_end":"17:00"}, or {"type":"cron","expressi\
|
|
1660
1479
|
on":"0 9 1 * *","timeZone":"Asia/Kolkata"} (monthly at 09:00 on day 1; five fields and an explicit IANA timezone).';function normalizeScheduleInput(args){let raw=args.schedule;if(typeof raw=="string")try{raw=JSON.parse(raw)}catch{return{error:`The schedule must be a JSON object, not text. ${SUPPORTED_SCHEDULES}`}}if(!jsonRecord(raw))return{error:`The schedule must be a JSON object. ${SUPPORTED_SCHEDULES}`};let type=typeof raw.type=="string"?raw.type.trim().toLowerCase():"",fields2=type==="once"?
|
|
1661
1480
|
["type","at"]:type==="weekly"||type==="daily"?["type","time","weekdays"]:type==="interval"?["type","every_minutes","everyMinutes","starts_at","anchorAt","weekdays","every_day","window_start","window_end","window","all_day","ends_at","endsAt","never_ends"]:type==="cron"?["type","expression","timeZone"]:type==="limit_reset"?["type","engine","repeat"]:null,unsupported=fields2&&Object.keys(raw).find(key=>raw[key]!=null&&!fields2.includes(key));if(unsupported)return{error:`Unsupported ${type} schedul\
|
|
1662
1481
|
e field "${unsupported}". Weekly and daily times use the computer's timezone from trigger_info. ${SUPPORTED_SCHEDULES}`};if(type==="cron")try{return{schedule:{...normalizeCronSchedule({type,expression:raw.expression,timeZone:raw.timeZone})}}}catch(error62){return{error:`${error62 instanceof Error?error62.message:"Invalid cron schedule"}. ${SUPPORTED_SCHEDULES}`}}if(type==="limit_reset")return limitResetSchedule(raw.engine,raw.repeat);if(type==="once")return typeof raw.at!="string"||!raw.at.trim()?
|
|
1663
|
-
{error:'A once schedule needs "at": a future RFC3339 date-time with an explicit offset, for example 2026-09-01T09:00:00+05:30.'}:{schedule:{type:"once",at:raw.at.trim()}};if(type==="weekly"||type==="daily"){let time3=typeof raw.time=="string"?raw.time.trim():"";if(!time3)return{error:`A ${type} schedule needs "time" in 24-hour HH:MM, for example 09:00.`};let
|
|
1664
|
-
weekdays)||raw.weekdays.length===0)return{error:'A weekly schedule needs "weekdays", for example ["monday","friday"] \u2014 or use {"type":"daily"} to run every day.'};
|
|
1482
|
+
{error:'A once schedule needs "at": a future RFC3339 date-time with an explicit offset, for example 2026-09-01T09:00:00+05:30.'}:{schedule:{type:"once",at:raw.at.trim()}};if(type==="weekly"||type==="daily"){let time3=typeof raw.time=="string"?raw.time.trim():"";if(!time3)return{error:`A ${type} schedule needs "time" in 24-hour HH:MM, for example 09:00.`};let weekdays2;if(type==="daily")weekdays2=Array.isArray(raw.weekdays)&&raw.weekdays.length?raw.weekdays:[...WEEKDAYS];else{if(!Array.isArray(raw.
|
|
1483
|
+
weekdays)||raw.weekdays.length===0)return{error:'A weekly schedule needs "weekdays", for example ["monday","friday"] \u2014 or use {"type":"daily"} to run every day.'};weekdays2=raw.weekdays}let normalized=[];for(let day of weekdays2){let lower=String(day).trim().toLowerCase(),full=WEEKDAYS.includes(lower)?lower:Object.hasOwn(SHORT_WEEKDAYS,lower)?SHORT_WEEKDAYS[lower]:void 0;if(!full)return{error:`Unsupported weekday "${String(day)}". Use full names: ${WEEKDAYS.join(", ")}.`};normalized.includes(
|
|
1665
1484
|
full)||normalized.push(full)}return{schedule:{type:"weekly",time:time3,weekdays:normalized}}}if(type==="interval"){for(let flag of["every_day","all_day","never_ends"])if(raw[flag]!=null&&typeof raw[flag]!="boolean")return{error:`"${flag}" must be true or false.`};if(raw.window!=null&&(!jsonRecord(raw.window)||Object.keys(raw.window).some(key=>key!=="start"&&key!=="end")||typeof raw.window.start!="string"||typeof raw.window.end!="string"))return{error:'"window" must contain "start" and "end" in H\
|
|
1666
1485
|
H:MM, for example {"start":"09:00","end":"17:00"}.'};let rawMinutes=raw.every_minutes??raw.everyMinutes,everyMinutes=Number(rawMinutes);if(!Number.isInteger(everyMinutes)||everyMinutes<5||everyMinutes>1440)return{error:'An interval schedule needs "every_minutes": a whole number from 5 to 1440.'};let rawStart=raw.starts_at??raw.anchorAt;if(rawStart!==void 0&&(typeof rawStart!="string"||!rawStart.trim()))return{error:'"starts_at" must be an RFC3339 date-time with an explicit timezone offset.'};if(raw.
|
|
1667
1486
|
every_day===!0&&Array.isArray(raw.weekdays)&&raw.weekdays.length>0)return{error:'Choose interval "weekdays" or "every_day", not both.'};let intervalWeekdays;if(raw.every_day===!0)intervalWeekdays=null;else if(raw.weekdays!==void 0){if(!Array.isArray(raw.weekdays)||raw.weekdays.length===0)return{error:'Interval "weekdays" must contain at least one full weekday name.'};intervalWeekdays=[];for(let day of raw.weekdays){let lower=String(day).trim().toLowerCase(),full=WEEKDAYS.includes(lower)?lower:Object.
|
|
@@ -1702,8 +1521,8 @@ e: call delete_trigger with the trigger_id.",isError:!0};let action2=name==="del
|
|
|
1702
1521
|
return{text:`${createOnly} applies only to action=create.`,isError:!0};let{fields:fields2,error:error62}=triggerFields(Object.fromEntries(Object.entries(args).filter(([key])=>!CALL_KEYS.has(key))));if(error62)return{text:error62,isError:!0};let body={action:action2,triggerId,...forBotId?{forBotId}:{}};if(action2==="update"){if(!Object.keys(fields2).length)return{text:"The update action needs at least one supported field to change.",isError:!0};body.changes=fields2}else if(Object.keys(fields2).length)
|
|
1703
1522
|
return{text:name==="delete_trigger"?"delete_trigger takes only trigger_id and for_bot_id.":`The ${action2} action changes no fields; send them with action=update.`,isError:!0};let done=action2==="run_now"?`Started trigger ${triggerId} once now`:`Applied ${action2} to trigger ${triggerId}`;return request(body,context,done)}async function listTriggers(args,forBotId,context){let query=new URLSearchParams({fromBotId:context.botId,fromThreadId:context.threadId});if(typeof args.trigger_id=="string"&&args.
|
|
1704
1523
|
trigger_id.trim()&&query.set("triggerId",args.trigger_id.trim()),args.include_address===!0){if(!query.has("triggerId"))return{text:"include_address needs trigger_id: the webhook automation whose address you want, from trigger_info.",isError:!0};query.set("includeAddress","1")}forBotId&&query.set("forBotId",forBotId);let r=await context.client.api(`${LIST_ROUTE}?${query.toString()}`),now=typeof r.now=="string"?r.now:new Date().toISOString(),timeZone=typeof r.timeZone=="string"&&r.timeZone?r.timeZone:
|
|
1705
|
-
"local computer timezone",
|
|
1706
|
-
${JSON.stringify(r.trigger,null,2)}`};let triggers=Array.isArray(r.triggers)?r.triggers:[];return triggers.length?{text:`This bot's triggers (${
|
|
1524
|
+
"local computer timezone",clock=`current time: ${now}; timezone: ${timeZone}`;if(typeof r.error=="string")return{text:`${r.error} (${clock})`,isError:!0};if(r.trigger)return{text:`Trigger (${clock}):
|
|
1525
|
+
${JSON.stringify(r.trigger,null,2)}`};let triggers=Array.isArray(r.triggers)?r.triggers:[];return triggers.length?{text:`This bot's triggers (${clock}):
|
|
1707
1526
|
${JSON.stringify(triggers,null,2)}`}:{text:`This bot has no triggers. Current time: ${now}. Timezone: ${timeZone}.`}}async function listEvents(args,context){let query=new URLSearchParams({fromBotId:context.botId,fromThreadId:context.threadId});typeof args.app=="string"&&args.app.trim()&&query.set("app",args.app.trim().toLowerCase()),typeof args.search=="string"&&args.search.trim()&&query.set("search",args.search.trim().slice(0,100));let r=await context.client.api(`${EVENTS_ROUTE}?${query.toString()}`);
|
|
1708
1527
|
if(typeof r.error=="string")return{text:r.error,isError:!0};if(typeof r.unavailable=="string")return{text:r.unavailable};let apps=Array.isArray(r.apps)?r.apps:[],notConnected=Array.isArray(r.notConnected)?r.notConnected:[],connect=notConnected.length?`
|
|
1709
1528
|
|
|
@@ -1726,7 +1545,12 @@ ${teamHits.map(hit=>{let source=hit.source,origin=source&&typeof source=="object
|
|
|
1726
1545
|
${memoryHits.map(hit=>`- [memory file ${String(hit.file)}] ${String(hit.snippet)}`).join(`
|
|
1727
1546
|
`)}
|
|
1728
1547
|
|
|
1729
|
-
`:"";return team+privateNotes}var
|
|
1548
|
+
`:"";return team+privateNotes}var REDACTION_MARKER=/^«redacted \d+ chars»$/,mask=value=>REDACTION_MARKER.test(value)?value:`\xABredacted ${value.length} chars\xBB`,KEY_PREFIXES=[/\bom[dg]_[A-Za-z0-9_-]{43}(?![A-Za-z0-9_-])/g,/\bsk-(?:ant-|proj-|live-|test-)?[A-Za-z0-9_-]{16,}/g,/\b(?:sk|rk)_(?:live|test)_[A-Za-z0-9]{16,}/g,/\bxai-[A-Za-z0-9_-]{20,}/g,/\bgsk_[A-Za-z0-9]{40,}/g,/\bcsk-[A-Za-z0-9]{32,}/g,/\bLLM\|\d{6,}\|[A-Za-z0-9_-]{16,}/g,/\bhf_[A-Za-z0-9]{30,}/g,/\bpypi-AgE[A-Za-z0-9_-]{82,}/g,/\b(?:ghp|gho|ghu|ghs|ghr)_[A-Za-z0-9]{20,}/g,
|
|
1549
|
+
/\bgithub_pat_[A-Za-z0-9_]{20,}/g,/\bgl(?:pat|dt|rtr?)-[A-Za-z0-9_-]{20,}(?:\.[A-Za-z0-9_-]+)*/g,/\bxox[abposr]-[A-Za-z0-9-]{20,}/g,/\bxapp-\d-[A-Za-z0-9-]{20,}/g,/\b(?:AKIA|ASIA)[0-9A-Z]{16}\b/g,/\bAIza[0-9A-Za-z_-]{30,}/g,/\bnpm_[A-Za-z0-9]{20,}/g,/\bwhsec_[A-Za-z0-9_-]{20,}/g,/\bSG\.[A-Za-z0-9_-]{22}\.[A-Za-z0-9_-]{43}(?![A-Za-z0-9_-])/g,/\bbak_[A-Za-z0-9_-]{20,}/g,/\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g],KEY_PREFIX_TESTS=KEY_PREFIXES.map(re=>new RegExp(re.source));var BEARER=/(\bBearer\s+)([A-Za-z0-9._~+/=-]{12,})/g,BASIC_AUTH=/(\bAuthorization["']?\s*[:=]\s*["']?Basic\s+)([A-Za-z0-9+/]{4,}={0,2})(?![A-Za-z0-9._~+/=-])/gi,PEM_BLOCK=/(-----BEGIN [A-Z ]*PRIVATE KEY-----)([\s\S]*?)(-----END [A-Z ]*PRIVATE KEY-----)/g,KEY_VALUE=/\b((?:[A-Za-z0-9_-]*_)?(?:api[_-]?key|apikey|secret|token|password|passwd|authorization|auth[_-]?token|access[_-]?key|private[_-]?key)s?)(["']?\s*[=:]\s*)(["']?)([A-Za-z0-9._~+/=-]{8,})\3/gi,KEY_SUFFIX_ASSIGNMENT=/\b([A-Za-z][A-Za-z0-9_-]*[_-]key)s?(=)(["']?)([A-Za-z0-9._~+/=-]+)\3/gi,
|
|
1550
|
+
SECRET_FLAG=/(--(?:token|password|passwd|api-key|apikey|secret|access-key|auth-token)(?:=|\s+))(["']?)(?!-)([A-Za-z0-9._~+/=-]+)\2/gi,URL_USERINFO=/(\b[a-z][a-z0-9+.-]*:\/\/[^\s/:@'"]+:)([^\s/@'"«»]+)(@)/gi;var heldSecretScrubbers=new Set;function scrubHeldSecrets(text2){if(!text2||heldSecretScrubbers.size===0)return text2;let out=text2;for(let scrub of heldSecretScrubbers)out=scrub(out);return out}function redactSecretsInText(text2){if(!text2)return text2;let held=scrubHeldSecrets(text2);if(held.length<8)return held;let out=held;out=out.replace(PEM_BLOCK,(_m,open2,body,close)=>`${open2}
|
|
1551
|
+
${mask(body.trim())}
|
|
1552
|
+
${close}`);for(let re of KEY_PREFIXES)out=out.replace(re,m2=>mask(m2));return out=out.replace(BEARER,(_m,lead,tok)=>`${lead}${mask(tok)}`),out=out.replace(BASIC_AUTH,(_m,lead,creds)=>`${lead}${mask(creds)}`),out=out.replace(KEY_VALUE,(_m,key,sep,quote,value)=>`${key}${sep}${quote}${mask(value)}${quote}`),out=out.replace(KEY_SUFFIX_ASSIGNMENT,(_m,key,sep,quote,value)=>`${key}${sep}${quote}${mask(value)}${quote}`),out=out.replace(SECRET_FLAG,(_m,flag,quote,value)=>`${flag}${quote}${mask(value)}${quote}`),
|
|
1553
|
+
out=out.replace(URL_USERINFO,(_m,lead,secret,at)=>`${lead}${mask(secret)}${at}`),out}var TOOL_RESULT_PREVIEW_CHARS=16e3,TOOL_RESULT_MAX_CHARS=128*1024,TOOL_RESULT_TTL_MS=60*6e4;var MAX_BYTES=16*1024*1024,MAX_OWNER_BYTES=2*1024*1024;function toolResultPrefix(text2,chars){let prefix=text2.slice(0,chars),last=prefix.charCodeAt(prefix.length-1);return last>=55296&&last<=56319?prefix.slice(0,-1):prefix}async function boundedAgentResult(text2,save){if(text2.length<=24e3)return text2;let redacted=redactSecretsInText(text2),prefix=toolResultPrefix(redacted,TOOL_RESULT_PREVIEW_CHARS),retained=toolResultPrefix(redacted,TOOL_RESULT_MAX_CHARS),truncated=retained.length<redacted.length;try{let saved=await save(retained,truncated);if(!saved||typeof saved.id!="string"||!/^r-[0-9a-f-]{36}$/.test(saved.id))throw new Error("Invalid saved result");return`${prefix}
|
|
1730
1554
|
|
|
1731
1555
|
[Large tool result: showing the first ${prefix.length} characters. ${truncated||saved.truncated?"Only a bounded portion was retained; the remaining tail was omitted.":"The remaining redacted result is temporarily saved."} If a missing detail is needed, call tool_result_read with id "${saved.id}" and offset ${prefix.length}. Saved results expire after one hour, on app restart, or under cache pressure. Do not repeat an action just to retrieve its output.]`}catch{return`${prefix}
|
|
1732
1556
|
|
|
@@ -1765,8 +1589,8 @@ ${r.summary.trim()}`:"";return{text:`A confirmation card is now visible to the u
|
|
|
1765
1589
|
|
|
1766
1590
|
This change has not been applied yet. End this turn and wait for the user to confirm or deny the card; do not claim the ${noun} was created or changed before confirmation.`}}function recallSpeaker(hit){return typeof hit.peer=="string"&&hit.peer?`@${hit.peer} (another bot \u2014 not your user)`:typeof hit.from=="string"&&hit.from?hit.from:hit.role==="user"?"user":"you"}function recallWhen(at,dateOnly){if(typeof at!="number"||!Number.isFinite(at))return"";let said=new Date(at);if(!Number.isFinite(
|
|
1767
1591
|
said.getTime()))return"";let pad=value=>String(value).padStart(2,"0"),day=`${said.getFullYear()}-${pad(said.getMonth()+1)}-${pad(said.getDate())}`;return dateOnly?day:`${day} ${pad(said.getHours())}:${pad(said.getMinutes())}`}async function callTool(called,input2,context){let{name,arguments:given2}=resolveAgentsCall(called,input2),args=dropBlankArguments(name,given2),refused=outOfBounds(name,fullInputSchema(name),args);if(refused)return{text:refused,isError:!0};let member=agentsCallMember(name,args),
|
|
1768
|
-
{botId:
|
|
1769
|
-
|
|
1592
|
+
{botId:BOT_ID,threadId:THREAD_ID2}=context,{api,apiResponse}=context.client;if(name==="vm_exec"){let{ok,body}=await apiResponse("/api/internal/vm-exec",{method:"POST",body:JSON.stringify({command:args.command,...typeof args.timeout_seconds=="number"?{timeout_seconds:args.timeout_seconds}:{}})});if(!ok)return{text:String(body.error??"Could not run that command."),isError:!0};let exitCode=Number(body.exitCode??0),stdout=String(body.stdout??""),stderr=String(body.stderr??""),lines=[body.timedOut?"T\
|
|
1593
|
+
he command was stopped: it ran past its time limit.":`exit code ${exitCode}`];return stdout&&lines.push("--- stdout ---",stdout.replace(/\s+$/,"")),stderr&&lines.push("--- stderr ---",stderr.replace(/\s+$/,"")),!stdout&&!stderr&&!body.timedOut&&lines.push("(no output)"),{text:lines.join(`
|
|
1770
1594
|
`),...exitCode!==0||body.timedOut?{isError:!0}:{}}}if(name==="attach_file"){let{ok,body}=await apiResponse("/api/internal/attach-file",{method:"POST",body:JSON.stringify({path:args.path,...typeof args.name=="string"?{name:args.name}:{}})});return ok?{text:`Attached ${String(body.name??"the file")} (${Number(body.bytes??0)} bytes). It now appears in the chat with a preview.`}:{text:String(body.error??"Could not attach that file."),isError:!0}}if(CARD_TOOL_NAMES.has(name))return callCardTool(name,
|
|
1771
1595
|
args,context);if(RESEARCH_TOOL_NAMES.has(name))return callResearchTool(name,args,context);if(HELPER_TOOL_NAMES.has(name))return callHelperTool(name,args,context);if(IMAGE_TOOL_NAMES.has(name))return callImageTool(name,args,context);if(MEETING_TOOL_NAMES.has(name))return callMeetingTool(name,args,context);if(MAUSBOT_TOOL_NAMES.has(name))return callMausBotTool(name,args,context);if(PAGE_TOOL_NAMES.has(name))return callPageTool(name,args,context);if(PERSON_TOOL_NAMES.has(name))return callPersonTool(
|
|
1772
1596
|
name,args,context);if(DEVS_TOOL_NAMES.has(name))return callDevsTool(name,args,context);if(TRIGGER_TOOL_NAMES.has(name))return callTriggerTool(name,args,context);if(WAIT_TOOL_NAMES.has(name))return callWaitTool(name,args,context);if(name===USAGE_LIMITS_TOOL)return callUsageLimitsTool(context);if(COMPUTER_ASK_TOOL_NAMES.has(name))return callComputerAskTool(args,context);if(SHARED_COMPUTER_TOOL_NAMES.has(name)&&!context.sharedComputers)return{text:"Computer sharing is turned off in this workspace. \
|
|
@@ -1784,11 +1608,11 @@ d from a coordinate_bots receipt or list_threads) and an optional "wait_ms" (0-2
|
|
|
1784
1608
|
let outstanding=Array.isArray(r.outstanding)?r.outstanding.filter(jsonRecord3):[];return outstanding.length?{text:`Outstanding assignments of this conversation (${outstanding.length}):
|
|
1785
1609
|
${outstanding.map(a=>`- ${assignmentLine(a)}`).join(`
|
|
1786
1610
|
`)}
|
|
1787
|
-
Each resumes you when it settles; do not wait on them in this turn.`}:{text:"Nothing outstanding: no assignment of this conversation is still open."}}if(name==="list_bots"){let bots=(await api(`/api/internal/agents?self=${encodeURIComponent(
|
|
1611
|
+
Each resumes you when it settles; do not wait on them in this turn.`}:{text:"Nothing outstanding: no assignment of this conversation is still open."}}if(name==="list_bots"){let bots=(await api(`/api/internal/agents?self=${encodeURIComponent(BOT_ID)}`)).bots??[];return bots.length?{text:`Bots you can reach (every department; you can contact any of them):
|
|
1788
1612
|
${bots.map(b2=>{let role=b2.title?` \u2014 ${b2.title}`:"",about=b2.description?` (${String(b2.description).slice(0,120)})`:"",state=typeof b2.statusText=="string"?b2.status==="available"?"":b2.statusText:b2.busy?"busy":"",team=typeof b2.section=="string"?`, department: ${peerName(b2.section)||"General"}`:"";return`- ${b2.name}${role}${about} [id: ${b2.id}, model: ${b2.model}${team}${state?`, ${state}`:""}]`}).join(`
|
|
1789
1613
|
`)}
|
|
1790
1614
|
|
|
1791
|
-
Use coordinate_bots for concrete work or, with consult: true, for advice, then end your turn. Busy teammates queue and results resume you automatically.`}:{text:"No other bots you can reach yet."}}if(name==="list_rooms"){let query=new URLSearchParams({fromBotId:
|
|
1615
|
+
Use coordinate_bots for concrete work or, with consult: true, for advice, then end your turn. Busy teammates queue and results resume you automatically.`}:{text:"No other bots you can reach yet."}}if(name==="list_rooms"){let query=new URLSearchParams({fromBotId:BOT_ID,fromThreadId:THREAD_ID2}),r=await api(`/api/internal/rooms?${query.toString()}`),rooms=Array.isArray(r.rooms)?r.rooms.filter(jsonRecord3):[],unpostable=Array.isArray(r.unpostable)?r.unpostable.filter(jsonRecord3):[],blocked=unpostable.
|
|
1792
1616
|
length?`
|
|
1793
1617
|
|
|
1794
1618
|
Rooms you are in but cannot post into (no id \u2014 there is nothing to retry; give the user the reason instead):
|
|
@@ -1798,55 +1622,55 @@ ${rooms.map(room=>{let members2=Array.isArray(room.members)?room.members.map(Str
|
|
|
1798
1622
|
`)}
|
|
1799
1623
|
|
|
1800
1624
|
Use post_to_room with one of these ids. A post adds one message to the room; it does not start anyone's turn, so nobody replies to it automatically.${blocked}`}:{text:`You are not in any room you can post into. Tell the user what you wanted to share and let them decide where it goes.${blocked}`}}if(name==="post_to_room"){let groupId=String(args.group_id??"").trim(),message=String(args.message??"").trim(),attachVoiceNote=args.attach_voice_note===!0;if(!groupId||!message)return{text:"post_to_room \
|
|
1801
|
-
needs group_id (from list_rooms) and message.",isError:!0};let r=await api("/api/internal/post-to-room",{method:"POST",body:JSON.stringify({fromBotId:
|
|
1802
|
-
|
|
1803
|
-
{fromBotId:
|
|
1625
|
+
needs group_id (from list_rooms) and message.",isError:!0};let r=await api("/api/internal/post-to-room",{method:"POST",body:JSON.stringify({fromBotId:BOT_ID,fromThreadId:THREAD_ID2,groupId,message,attachVoiceNote,...args.mention_ids!==void 0?{mentionIds:args.mention_ids}:{}})});return r.error?{text:String(r.error),isError:!0}:{text:`Posted in ${r.roomName??"the room"}${r.attachedVoiceNote?" with the voice note attached":""}. Nobody's turn was started, so expect no reply \u2014 tell the user it is pos\
|
|
1626
|
+
ted.`}}if(name==="select_computer"){if(args.surface!==void 0&&(typeof args.surface!="string"||!["auto","cloud","vm","local","browser"].includes(args.surface)))return{text:"Choose auto, cloud, vm, local or browser; omit surface to inspect connected choices.",isError:!0};let result=await api("/api/internal/computer/select",args.surface===void 0?void 0:{method:"POST",body:JSON.stringify({surface:args.surface})});return{text:JSON.stringify(result)}}if(name==="list_threads"){let query=new URLSearchParams(
|
|
1627
|
+
{fromBotId:BOT_ID,fromThreadId:THREAD_ID2}),r=await api(`/api/internal/threads?${query.toString()}`);if(r.error)return{text:`Couldn't list threads: ${String(r.error)}`,isError:!0};let threads=Array.isArray(r.threads)?r.threads.filter(jsonRecord3):[];if(!threads.length)return{text:"No threads yet: you have none of your own beyond this one, and you have not opened any on a teammate."};let stateWord={running:"running","waiting-on-you":"waiting on the person",queued:"queued",idle:"idle"};return{text:`\
|
|
1804
1628
|
Threads, newest first:
|
|
1805
1629
|
${threads.map(thread=>{let where=thread.own===!0?"yours":`on @${String(thread.botName)}${typeof thread.openedBy=="string"&&thread.openedBy?`, opened by @${thread.openedBy}`:""}`,state=stateWord[String(thread.state)]??String(thread.state),unread=thread.unread===!0?", unread for the person":"",handoff2=typeof thread.delegationId=="string"&&thread.delegationId?` [delegation id: ${thread.delegationId}]`:"",waiting=typeof thread.waiting=="string"&&thread.waiting?`: ${thread.waiting}`:"";return`- #${String(
|
|
1806
1630
|
thread.title)} (${where}, ${state}${waiting}${unread}) [thread id: ${String(thread.threadId)}]${handoff2}`}).join(`
|
|
1807
|
-
`)}`}}if(name==="close_thread"){let threadId=String(args.thread_id??"").trim();if(!threadId)return{text:"close_thread needs the thread_id from list_threads or start_thread.",isError:!0};let r=await api(`/api/internal/threads/${encodeURIComponent(threadId)}/close`,{method:"POST",body:JSON.stringify({fromBotId:
|
|
1808
|
-
""}. It stays in the person's sidebar, idle, with a note that you closed it.`}}if(name==="start_thread"){let title=String(args.title??"").trim(),message=String(args.message??"").trim();if(!title||!message)return{text:"start_thread needs title (one short line) and message (the complete first message).",isError:!0};let toBotId=typeof args.bot_id=="string"?args.bot_id.trim():"",folder=typeof args.folder=="string"?args.folder.trim():"",body={fromBotId:
|
|
1631
|
+
`)}`}}if(name==="close_thread"){let threadId=String(args.thread_id??"").trim();if(!threadId)return{text:"close_thread needs the thread_id from list_threads or start_thread.",isError:!0};let r=await api(`/api/internal/threads/${encodeURIComponent(threadId)}/close`,{method:"POST",body:JSON.stringify({fromBotId:BOT_ID,fromThreadId:THREAD_ID2})});return r.error?{text:`Couldn't close that thread: ${String(r.error)}`,isError:!0}:{text:`Closed #${String(r.title)}${r.botName?` on @${String(r.botName)}`:
|
|
1632
|
+
""}. It stays in the person's sidebar, idle, with a note that you closed it.`}}if(name==="start_thread"){let title=String(args.title??"").trim(),message=String(args.message??"").trim();if(!title||!message)return{text:"start_thread needs title (one short line) and message (the complete first message).",isError:!0};let toBotId=typeof args.bot_id=="string"?args.bot_id.trim():"",folder=typeof args.folder=="string"?args.folder.trim():"",body={fromBotId:BOT_ID,fromThreadId:THREAD_ID2,title,message};if(toBotId&&
|
|
1809
1633
|
(body.toBotId=toBotId),folder&&(body.folder=folder),args.model_selection!==void 0){let fields2=jsonRecord3(args.model_selection)?args.model_selection:null;if(!fields2||typeof fields2.instanceId!="string"||!fields2.instanceId.trim()||typeof fields2.model!="string"||!fields2.model.trim()||fields2.effort!==void 0&&(typeof fields2.effort!="string"||!fields2.effort.trim()))return{text:"start_thread model_selection needs instanceId and model, as list_models gives them, and effort only from that engine\
|
|
1810
1634
|
's efforts.",isError:!0};body.modelSelection={instanceId:fields2.instanceId.trim(),model:fields2.model.trim(),...typeof fields2.effort=="string"?{effort:fields2.effort.trim()}:{}}}args.report_back===!0&&(body.reportBack=!0);let r=await api("/api/internal/threads",{method:"POST",body:JSON.stringify(body)});if(r.error&&r.state!=="failed")return{text:`Couldn't open that thread: ${String(r.error)}`,isError:!0};if(r.reportBack===!0)return{text:`Opened thread #${String(r.title??title)} on yourself [th\
|
|
1811
|
-
read id: ${String(r.threadId??"")}]. It starts when this turn ends, and its result comes back to this conversation and resumes you automatically (assignment id: ${String(r.requestId??"unknown")}). Mention it to the person as #${String(r.title??title)} and finish your turn; do not check or wait for it in this turn. To steer it or send it a follow-up, while it runs or after, use coordinate_bots with bot_ids ["${
|
|
1635
|
+
read id: ${String(r.threadId??"")}]. It starts when this turn ends, and its result comes back to this conversation and resumes you automatically (assignment id: ${String(r.requestId??"unknown")}). Mention it to the person as #${String(r.title??title)} and finish your turn; do not check or wait for it in this turn. To steer it or send it a follow-up, while it runs or after, use coordinate_bots with bot_ids ["${BOT_ID}"] and thread "${String(r.threadId??"")}".`};let receipt=r.self!==!0&&Array.isArray(
|
|
1812
1636
|
r.receipts)&&jsonRecord3(r.receipts[0])?r.receipts[0]:void 0,threadTitle=String(r.title??receipt?.title??title),threadId=String(r.threadId??receipt?.threadId??""),where=r.self===!0?"on yourself":`on @${String(r.botName??receipt?.botName??"that bot")}`,opened=`Opened thread #${threadTitle} ${where} [thread id: ${threadId}].`;if(r.self===!0){if(r.state==="running")return{text:`${opened} It is running now, in parallel with this conversation, and its result stays in that thread \u2014 it will not be deli\
|
|
1813
1637
|
vered here. Mention it to the person as #${threadTitle}; use list_threads in a later turn to see how it is going.`};if(r.state==="queued"){let position=Number(r.position)||1,limit=Number(r.limit)||0;return{text:`${opened} You are at your limit of ${limit} threads running at once, so it is ${ordinal(position)} in line and starts as soon as one of them finishes \u2014 nothing more to do. Mention it to the person as #${threadTitle}.`}}return{text:`${opened} It could not start: ${String(r.error??"un\
|
|
1814
1638
|
known reason")}. The thread exists but nothing is running in it; tell the person.`,isError:!0}}let assignmentId=handoffIds(r)[0]??"",approval=r.approvalRequired===!0?" The person must approve this handoff first; their card appears after your turn ends.":"",timing=r.state==="queued"?` @${String(r.botName??"that bot")} can run ${Number(r.limit)||0} threads at once and they are all spoken for, so it waits ${ordinal(Number(r.position)||1)} in line for a free slot after this turn ends.`:" It starts w\
|
|
1815
1639
|
hen this turn ends, like any handoff.";return{text:`${opened}${timing}${approval} Its result will be delivered to this conversation automatically (assignment id: ${assignmentId||"unknown"}). Acknowledge it, mention it to the person as #${threadTitle}, and finish your turn; do not check or wait for it in this turn.`}}if(name==="burst")return callBurstTool(args,api);if(name==="list_models"){let search=typeof args.search=="string"?args.search.trim():"",r=await api(`/api/internal/models${search?`?se\
|
|
1816
1640
|
arch=${encodeURIComponent(search)}`:""}`);return r.error?{text:`Couldn't list models: ${String(r.error)}`,isError:!0}:{text:JSON.stringify(r)}}if(name==="list_team_setup")return{text:JSON.stringify(await api("/api/internal/team-setup-catalog"))};if(name==="diagnose_limix")return{text:JSON.stringify(await api("/api/internal/limix-diagnosis"))};if(name==="list_team_library")return{text:JSON.stringify(await api("/api/internal/team-library"))};if(name==="propose_team_setup"||name==="propose_bot_dele\
|
|
1817
|
-
tion"){let deleting=name==="propose_bot_deletion",result=await api(deleting?"/api/internal/bot-deletion-requests":"/api/internal/team-setup-requests",{method:"POST",body:JSON.stringify({fromBotId:
|
|
1818
|
-
|
|
1641
|
+
tion"){let deleting=name==="propose_bot_deletion",result=await api(deleting?"/api/internal/bot-deletion-requests":"/api/internal/team-setup-requests",{method:"POST",body:JSON.stringify({fromBotId:BOT_ID,fromThreadId:THREAD_ID2,...deleting?{targetBotId:args.bot_id,reason:args.reason}:{plan:args}})}),completed=completedProposalResult(result,deleting?"the requested bot deletion":"the requested team setup");return completed||{text:`One review card is visible: ${String(result.title)}. Nothing has bee\
|
|
1642
|
+
n applied. End this turn; the decision and structured result resume you automatically once. Do not ask again, poll, or repeat this proposal.`}}if(name==="create_bot"){let botName=String(args.name??"").trim(),role=String(args.role??"").trim(),instructions=String(args.instructions??"").trim();if(!botName||!role||!instructions)return{text:"create_bot needs name, role, and instructions.",isError:!0};let r=await api("/api/internal/create-bot",{method:"POST",body:JSON.stringify({fromBotId:BOT_ID,fromThreadId:THREAD_ID2,
|
|
1819
1643
|
name:botName,role,instructions,...args.modelSelection!==void 0?{modelSelection:args.modelSelection}:{},...typeof args.cwd=="string"?{cwd:args.cwd.trim()}:{}})});return r.state==="pending"?{text:`One review card is visible: ${String(r.title)}. @${botName} has not been created yet. End this turn; the decision and structured result resume you automatically once. Do not ask again, poll, or repeat this request.`}:r.id?{text:`Created @${r.name??botName} in ${r.section??"General"} [id: ${r.id}].${r.modelSelection?
|
|
1820
1644
|
` Model: ${JSON.stringify(r.modelSelection)}.`:""} Assign work with coordinate_bots.`}:completedProposalResult(r,`creating @${botName}`)??{text:`@${botName} was not created.`,isError:!0}}if(member==="create_room"){if(args.section!==void 0)return{text:"A room you create stays in your own department; ask the user to move it.",isError:!0};let roomName=String(args.name??"").trim(),memberIds=Array.isArray(args.member_bot_ids)?args.member_bot_ids.map(id=>String(id).trim()).filter(Boolean):[],bulletin=typeof args.
|
|
1821
|
-
bulletin=="string"?args.bulletin.trim():void 0;if(!roomName)return{text:"manage_room action=create needs a room name.",isError:!0};if(!memberIds.length)return{text:"manage_room action=create needs at least one bot ID in member_bot_ids.",isError:!0};let r=await api("/api/internal/create-room",{method:"POST",body:JSON.stringify({fromBotId:
|
|
1645
|
+
bulletin=="string"?args.bulletin.trim():void 0;if(!roomName)return{text:"manage_room action=create needs a room name.",isError:!0};if(!memberIds.length)return{text:"manage_room action=create needs at least one bot ID in member_bot_ids.",isError:!0};let r=await api("/api/internal/create-room",{method:"POST",body:JSON.stringify({fromBotId:BOT_ID,fromThreadId:THREAD_ID2,name:roomName,memberIds,bulletin})});return r.error?{text:`Couldn't create room: ${r.error}`,isError:!0}:{text:`Created room \u201C${r.
|
|
1822
1646
|
name??roomName}\u201D in section \u201C${r.section??"General"}\u201D [id: ${r.id}] with ${r.memberCount??memberIds.length} members.`}}if(member==="manage_room"){if(args.section!==void 0||args.action==="set_section")return{text:"Moving rooms between sections is user-only.",isError:!0};let roomId=String(args.room_id??"").trim(),action2=String(args.action??"").trim();if(!roomId||!action2)return{text:"manage_room needs action and, for any action but create, the room_id from list_rooms.",isError:!0};
|
|
1823
|
-
let memberIds=Array.isArray(args.member_bot_ids)?args.member_bot_ids.map(id=>String(id).trim()).filter(Boolean):void 0,roomName=typeof args.name=="string"?args.name.trim():void 0,bulletin=typeof args.bulletin=="string"?args.bulletin.trim():void 0,r=await api("/api/internal/manage-room",{method:"POST",body:JSON.stringify({fromBotId:
|
|
1647
|
+
let memberIds=Array.isArray(args.member_bot_ids)?args.member_bot_ids.map(id=>String(id).trim()).filter(Boolean):void 0,roomName=typeof args.name=="string"?args.name.trim():void 0,bulletin=typeof args.bulletin=="string"?args.bulletin.trim():void 0,r=await api("/api/internal/manage-room",{method:"POST",body:JSON.stringify({fromBotId:BOT_ID,fromThreadId:THREAD_ID2,roomId,action:action2,memberIds,name:roomName,bulletin})});return r.error?{text:`Couldn't manage room: ${r.error}`,isError:!0}:{text:typeof r.
|
|
1824
1648
|
message=="string"?r.message:`Updated room ${roomId}.`}}if(name==="request_credential"){let credentialId=args.credential_id;if(credentialId===void 0||credentialId==="")return requestCustomSecret(args,context);if(credentialId===EMAIL_CREDENTIAL)return requestEmailCard(args,context);if(!isCredentialTargetId(credentialId))return{text:"request_credential needs a supported credential_id.",isError:!0};let reason=typeof args.reason=="string"?args.reason.trim().slice(0,240):"",r=await api("/api/internal/\
|
|
1825
|
-
request-credential",{method:"POST",body:JSON.stringify({fromBotId:
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1649
|
+
request-credential",{method:"POST",body:JSON.stringify({fromBotId:BOT_ID,fromThreadId:THREAD_ID2,credentialId,...reason?{reason}:{}})});return r.alreadyConfigured?{text:`${r.label??CREDENTIAL_TARGETS[credentialId].label} is already configured. Continue the task.`}:credentialId==="onePasswordToken"?{text:`A secure ${r.label??CREDENTIAL_TARGETS[credentialId].label} request is ready: the person pastes it into its card in Limix Bot, on their computer or in My Cloud, and Limix Bot checks it with 1Pas\
|
|
1650
|
+
sword before keeping it. End this turn; Limix Bot will resume the task after they save or decline. Never ask them to paste the token into chat, and never pass it to a command line.`}:{text:`A secure ${r.label??CREDENTIAL_TARGETS[credentialId].label} request is now in this conversation, and the person was notified. The desktop app and a freshly QR-paired mobile app show its secure entry card; older mobile pairings explain how to pair again or finish on the computer. End this turn; Limix Bot will \
|
|
1651
|
+
resume the task after the user saves or declines. Never ask them to paste the key into chat.`}}if(name==="request_sign_in"){let site=typeof args.site=="string"?args.site.trim():"";if(!site)return{text:"request_sign_in needs site: the page's address or its domain, such as example.com.",isError:!0};let reason=typeof args.reason=="string"?args.reason.trim().slice(0,240):"",r=await api("/api/internal/request-sign-in",{method:"POST",body:JSON.stringify({fromBotId:BOT_ID,fromThreadId:THREAD_ID2,site,...reason?
|
|
1652
|
+
{reason}:{}})});return{text:`The person was asked to sign in to ${r.site??site} on ${SIGN_IN_PLACES[String(r.place)]??"the place you work"}. Your turn ends now: say in one short line that you are waiting for them, then stop. Limix Bot resumes you when they finish or decline. Never ask for the password or a code in chat.`}}if(name==="fill_login"){let username=typeof args.username=="string"?args.username.trim().slice(0,512):"",email3=typeof args.email=="string"?args.email.trim().slice(0,320):"",r=await api(
|
|
1653
|
+
"/api/internal/fill-login",{method:"POST",body:JSON.stringify({fromBotId:BOT_ID,fromThreadId:THREAD_ID2,...username?{username}:{},...email3?{email:email3}:{},...args.submit===!1?{submit:!1}:{}})});return{text:typeof r.text=="string"&&r.text?r.text:"fill_login did not answer. Call request_sign_in instead.",...r.ok===!0?{}:{isError:!0}}}if(name==="send_voice_note"){if(typeof args.text!="string"||!args.text.trim())return{text:"send_voice_note needs text: the short speakable note, at most 1000 chara\
|
|
1654
|
+
cters.",isError:!0};let text2=args.text.trim();if(text2.length>1e3)return{text:`send_voice_note is limited to 1000 characters; this one is ${text2.length}. Shorten the note.`,isError:!0};try{let r=await api("/api/internal/voice-note",{method:"POST",body:JSON.stringify({fromBotId:BOT_ID,fromThreadId:THREAD_ID2,text:text2})});return r.attached!==!0||typeof r.file!="string"||!r.file?{text:"Voice note not sent: Limix Bot did not confirm the audio was saved. Tell the person the note did not go throug\
|
|
1655
|
+
h; do not say it is attached.",isError:!0}:{text:"Voice note recorded. It will be attached to this turn's reply when the turn ends; the note text is also the visible caption."}}catch(error62){return{text:`Voice note not sent: ${error62 instanceof Error?error62.message:String(error62)}`,isError:!0}}}if(name==="propose_profile"){if(args.notifications!==void 0&&typeof args.notifications!="boolean"||args.speakReplies!==void 0&&typeof args.speakReplies!="boolean")return{text:"propose_profile notifica\
|
|
1656
|
+
tions and speakReplies must be true or false.",isError:!0};let changes={};if(typeof args.name=="string"&&(changes.name=args.name.trim()),typeof args.title=="string"&&(changes.title=args.title.trim()),typeof args.description=="string"&&(changes.description=args.description.trim()),typeof args.soul=="string"&&(changes.soul=args.soul),typeof args.cwd=="string"&&(changes.cwd=args.cwd.trim()),typeof args.notifications=="boolean"&&(changes.notifications=args.notifications),typeof args.speakReplies=="b\
|
|
1657
|
+
oolean"&&(changes.speakReplies=args.speakReplies),!Object.keys(changes).length)return{text:"propose_profile needs at least one of name, title, description, soul, cwd, notifications, or speakReplies.",isError:!0};let forBotId=String(args.for_bot_id??"").trim(),r=await api("/api/internal/profile-requests",{method:"POST",body:JSON.stringify({fromBotId:BOT_ID,fromThreadId:THREAD_ID2,changes,reason:args.reason,forBotId:forBotId||void 0})});return confirmationResult(r,"the profile change","profile")}if(name===
|
|
1658
|
+
"propose_model"){let raw=args.model_selection,fields2=typeof raw=="object"&&raw!==null&&!Array.isArray(raw)?raw:null;if(!fields2||typeof fields2.instanceId!="string"||!fields2.instanceId.trim()||typeof fields2.model!="string"||!fields2.model.trim())return{text:"propose_model needs model_selection with instanceId and model.",isError:!0};if(fields2.effort!==void 0&&(typeof fields2.effort!="string"||!fields2.effort.trim())||fields2.variant!==void 0&&(typeof fields2.variant!="string"||!fields2.variant.
|
|
1659
|
+
trim()))return{text:"propose_model effort and variant must be non-empty strings when supplied.",isError:!0};let selection={instanceId:fields2.instanceId.trim(),model:fields2.model.trim()};typeof fields2.effort=="string"&&fields2.effort.trim()&&(selection.effort=fields2.effort.trim()),typeof fields2.variant=="string"&&fields2.variant.trim()&&(selection.variant=fields2.variant.trim());let forBotId=String(args.for_bot_id??"").trim(),r=await api("/api/internal/model-requests",{method:"POST",body:JSON.
|
|
1660
|
+
stringify({fromBotId:BOT_ID,fromThreadId:THREAD_ID2,modelSelection:selection,reason:args.reason,forBotId:forBotId||void 0})});return confirmationResult(r,"the default model change","model")}if(member==="memory_update"){let passageOnly=args.action==="remove"||args.action==="forget";if(!["append","replace","remove","supersede","forget","prefer"].includes(String(args.action))||!passageOnly&&(typeof args.text!="string"||!args.text.trim())||args.action!=="append"&&args.action!=="prefer"&&(typeof args.
|
|
1661
|
+
old_text!="string"||!args.old_text.trim()))return{text:"Use memory_update action=append with text, replace or supersede with text and old_text, remove with old_text, forget with old_text naming what to forget, or prefer with text: one standing preference of the person.",isError:!0};let{body:r}=await apiResponse("/api/internal/memory",{method:"POST",body:JSON.stringify({fromBotId:BOT_ID,fromThreadId:THREAD_ID2,action:args.action,text:args.text,oldText:args.old_text,...typeof args.until=="string"&&
|
|
1662
|
+
args.until.trim()?{until:args.until.trim()}:{}})});if(r.error||r.ok!==!0)return{text:String(r.error??"Memory update was not confirmed."),isError:!0};if(args.action==="forget")return{text:forgetText(String(args.old_text),r)};if(args.action==="prefer")return{text:preferText(r)};let entry=typeof r.entry=="string"&&r.entry?` Entry: ${r.entry}`:"",moved=Array.isArray(r.moved)?r.moved.filter(line3=>typeof line3=="string"):[],full=r.truncated?`
|
|
1839
1663
|
Saved, but the lines that never move out of MEMORY.md (hand-written ones, health and safety facts) fill what loads each session, so the newest entries do not load. Tell the person their saved notes are full, and that they can remove ones they no longer need under What it remembers in your panel.`:"",shown=moved.slice(0,MOVED_ENTRIES_SHOWN).map(text2=>text2.split(`
|
|
1840
1664
|
`)[0]),more=moved.length>shown.length?`
|
|
1841
1665
|
\u2026and ${moved.length-shown.length} more`:"",movedNote=moved.length?`
|
|
1842
1666
|
To stay within what loads each session, moved ${moved.length===1?"1 older entry":`${moved.length} older entries`} to your archive (session_search finds them):
|
|
1843
1667
|
${shown.join(`
|
|
1844
|
-
`)}${more}`:"";return{text:`Memory updated.${entry}${full}${movedNote}`}}if(name==="retry_thread"){let botId=String(args.bot_id??"").trim(),threadId=String(args.thread_id??"").trim(),note=typeof args.note=="string"?args.note.trim():"";if(!botId||!threadId)return{text:"retry_thread needs bot_id and thread_id \u2014 both are in the incident report.",isError:!0};let r=await api("/api/internal/retry-thread",{method:"POST",body:JSON.stringify({fromBotId:
|
|
1668
|
+
`)}${more}`:"";return{text:`Memory updated.${entry}${full}${movedNote}`}}if(name==="retry_thread"){let botId=String(args.bot_id??"").trim(),threadId=String(args.thread_id??"").trim(),note=typeof args.note=="string"?args.note.trim():"";if(!botId||!threadId)return{text:"retry_thread needs bot_id and thread_id \u2014 both are in the incident report.",isError:!0};let r=await api("/api/internal/retry-thread",{method:"POST",body:JSON.stringify({fromBotId:BOT_ID,fromThreadId:THREAD_ID2,toBotId:botId,toThreadId:threadId,
|
|
1845
1669
|
...note?{note}:{}})});return r.error?{text:`Couldn't retry that thread: ${String(r.error)}`,isError:!0}:{text:typeof r.message=="string"?r.message:"The thread is running again. Its result stays in that thread; you are not woken for it \u2014 check it later with session_search or list_threads if you need to."}}if(member==="memory_log"){if(typeof args.text!="string"||!args.text.trim())return{text:"memory_log needs text: one line about what happened.",isError:!0};let r=await api("/api/internal/memo\
|
|
1846
|
-
ry/log",{method:"POST",body:JSON.stringify({fromBotId:
|
|
1847
|
-
let r=await api("/api/internal/team-memory",{method:"POST",body:JSON.stringify({fromBotId:
|
|
1848
|
-
until=="string"?args.until.trim():"";if(!q&&!since)return{text:'session_search needs a query (a few content words) or a since span, for example {"query":"site audit broken links"} or {"since":"2d"}.',isError:!0};let query=new URLSearchParams({fromBotId:
|
|
1849
|
-
|
|
1670
|
+
ry/log",{method:"POST",body:JSON.stringify({fromBotId:BOT_ID,fromThreadId:THREAD_ID2,text:args.text})});return r.error||r.ok!==!0?{text:String(r.error??"The log line was not confirmed."),isError:!0}:{text:`Logged to ${String(r.file)}: ${String(r.line)}`}}if(name==="propose_team_memory"){let kind=String(args.kind??"").trim(),entryName=String(args.name??"").trim(),detail=String(args.detail??"").trim();if(!kind||!entryName||!detail)return{text:"propose_team_memory needs kind, name, and detail.",isError:!0};
|
|
1671
|
+
let r=await api("/api/internal/team-memory",{method:"POST",body:JSON.stringify({fromBotId:BOT_ID,fromThreadId:THREAD_ID2,kind,key:typeof args.key=="string"?args.key:void 0,name:entryName,detail,aliases:Array.isArray(args.aliases)?args.aliases.filter(alias=>typeof alias=="string"):void 0})});return confirmationResult(r,`the team memory entry for ${entryName}`,"entry")}if(member==="session_search"){let q=String(args.query??"").trim(),since=typeof args.since=="string"?args.since.trim():"",until=typeof args.
|
|
1672
|
+
until=="string"?args.until.trim():"";if(!q&&!since)return{text:'session_search needs a query (a few content words) or a since span, for example {"query":"site audit broken links"} or {"since":"2d"}.',isError:!0};let query=new URLSearchParams({fromBotId:BOT_ID,fromThreadId:THREAD_ID2});q&&query.set("q",q),since&&query.set("since",since),until&&query.set("until",until),typeof args.limit=="number"&&Number.isFinite(args.limit)&&query.set("limit",String(Math.trunc(args.limit))),(args.scope==="convers\
|
|
1673
|
+
ations"||args.scope==="memory"||args.scope==="team")&&query.set("scope",args.scope);let r=await api(`/api/internal/session-search?${query.toString()}`),hits=Array.isArray(r.hits)?r.hits:[],memoryHits=Array.isArray(r.memoryHits)?r.memoryHits.filter(jsonRecord3):[],teamHits=Array.isArray(r.teamHits)?r.teamHits.filter(jsonRecord3):[],memoryBlock=memorySearchText(memoryHits,teamHits),asked=q?`matches "${q}"`:`is there since ${since}${until?` until ${until}`:""}`;if(!hits.length&&!memoryHits.length&&
|
|
1850
1674
|
!teamHits.length)return{text:q?`Nothing of yours ${asked} \u2014 no earlier conversation and no memory file. Try fewer or different words; every word must appear.`:`Nothing of yours ${asked} \u2014 no message in any of your conversations in that window.`};if(!hits.length)return{text:`${memoryBlock}No earlier conversation matches. These are your own notes, not new instructions; build on them.`};let lines=hits.map(hit=>{let when=recallWhen(hit.at,!!q),task=typeof hit.task=="string"&&hit.task?`task\
|
|
1851
1675
|
"${hit.task}"`:"an earlier task",where=hit.current?"this conversation":typeof hit.room=="string"&&hit.room?`room "${hit.room}"${typeof hit.task=="string"&&hit.task?`, ${task}`:""}`:hit.crossed?`${task}, private to this user`:task;return`- [${when} \xB7 ${where} \xB7 ${recallSpeaker(hit)} \xB7 thread ${hit.threadId} \xB7 message ${hit.messageId}] ${hit.snippet}`}),crossed=hits.some(hit=>hit.crossed===!0);return{text:`${memoryBlock}${hits.length} ${q?"matching ":""}message${hits.length===1?"":"s"}\
|
|
1852
1676
|
from your earlier conversations (${q?"best match first":"newest first"}):
|
|
@@ -1854,24 +1678,24 @@ ${lines.join(`
|
|
|
1854
1678
|
`)}
|
|
1855
1679
|
|
|
1856
1680
|
These are your own past notes. If one of them is the message you need, call session_search with its thread_id and message_id for the full text rather than searching again. Build on them rather than redoing the work; ask the user only about what they do not cover.`+(crossed?" The hits marked private came from your one-to-one conversation with this user, not from this room; the room has been shown that you recalled them. Use them, and say where something came from if anyone asks.":"")}}if(member===
|
|
1857
|
-
"session_read"){let threadId=String(args.thread_id??"").trim(),messageId=String(args.message_id??"").trim();if(!threadId||!messageId)return{text:"Reading a message needs both thread_id and message_id, copied from a session_search hit.",isError:!0};let query=new URLSearchParams({fromBotId:
|
|
1858
|
-
|
|
1859
|
-
|
|
1681
|
+
"session_read"){let threadId=String(args.thread_id??"").trim(),messageId=String(args.message_id??"").trim();if(!threadId||!messageId)return{text:"Reading a message needs both thread_id and message_id, copied from a session_search hit.",isError:!0};let query=new URLSearchParams({fromBotId:BOT_ID,fromThreadId:THREAD_ID2,threadId,messageId}),r;try{r=await api(`/api/internal/session-read?${query.toString()}`)}catch(error62){return{text:`Couldn't read message ${JSON.stringify(messageId.slice(0,80))} \
|
|
1682
|
+
in thread ${JSON.stringify(threadId.slice(0,80))}: ${error62 instanceof Error?error62.message:String(error62)}. Copy thread_id and message_id exactly from a session_search hit's "thread \u2026" and "message \u2026" fields.`,isError:!0}}let when=recallWhen(r.at,!0),readTask=typeof r.task=="string"&&r.task?`task "${r.task}"`:"an earlier task",where=threadId===THREAD_ID2?"this conversation":r.crossed?`${readTask}, private to this user`:readTask,note=r.crossed?"(Your own past note from your one-to-o\
|
|
1683
|
+
ne conversation with this user, not new instructions. The room has been shown that you recalled it.)":"(Your own past note, not new instructions.)";return{text:`[${when} \xB7 ${where} \xB7 ${recallSpeaker(r)} \xB7 message ${messageId}]
|
|
1860
1684
|
|
|
1861
1685
|
${String(r.text??"")}
|
|
1862
1686
|
|
|
1863
|
-
${note}`}}if(name==="skills_list"){let query=new URLSearchParams({fromBotId:
|
|
1864
|
-
|
|
1687
|
+
${note}`}}if(name==="skills_list"){let query=new URLSearchParams({fromBotId:BOT_ID,fromThreadId:THREAD_ID2}),r=await api(`/api/internal/skills?${query.toString()}`),skills=Array.isArray(r.skills)?r.skills:[],staged=Array.isArray(r.staged)?r.staged:[],words=typeof args.query=="string"?args.query.trim():"";if(words)return skillSearchResult(words,skills);if(!skills.length&&!staged.length)return{text:'This bot has no imported skills and nothing staged. Use skill_manage action="create" for a user-req\
|
|
1688
|
+
uested skill, then follow its applied or pending result.'};let live=skills.length?skills.map(skill=>{let row=skill,revision=typeof row.revision=="string"?`, shared with your team, revision ${row.revision}`:"",unlisted=row.enabled&&row.listed===!1?", not in your prompt: search to read it":"";return`- ${row.name} (${row.enabled?"enabled":"disabled"}, ${row.editable===!0?"learned/editable":"imported"}${revision}${unlisted})`}).join(`
|
|
1865
1689
|
`):"(none)",pending=staged.length?staged.map(entry=>{let row=entry;return`- ${row.action} ${row.name}`}).join(`
|
|
1866
1690
|
`):"(none)";return{text:`Imported skills:
|
|
1867
1691
|
${live}
|
|
1868
1692
|
|
|
1869
1693
|
Staged (waiting for the user's decision):
|
|
1870
|
-
${pending}`}}if(name==="skill_manage"){if(isSkillSwitchAction(args.action)){let skillName2=typeof args.skill_name=="string"?args.skill_name.trim():"",verb=skillSwitchVerb(args.action);if(!skillName2)return{text:`skill_manage needs skill_name to ${verb} a skill. Copy the exact name from skills_list.`,isError:!0};let r2=await api("/api/internal/skills/stage",{method:"POST",body:JSON.stringify({fromBotId:
|
|
1694
|
+
${pending}`}}if(name==="skill_manage"){if(isSkillSwitchAction(args.action)){let skillName2=typeof args.skill_name=="string"?args.skill_name.trim():"",verb=skillSwitchVerb(args.action);if(!skillName2)return{text:`skill_manage needs skill_name to ${verb} a skill. Copy the exact name from skills_list.`,isError:!0};let r2=await api("/api/internal/skills/stage",{method:"POST",body:JSON.stringify({fromBotId:BOT_ID,fromThreadId:THREAD_ID2,action:args.action,skill_name:skillName2})}),completed2=completedProposalResult(
|
|
1871
1695
|
r2,`a request to ${verb} skill \u201C${skillName2}\u201D`);return completed2||{text:`A confirmation card is now visible to the user to ${verb} skill \u201C${skillName2}\u201D. Nothing changes until they approve it. End this turn and wait for the decision.`}}if(args.action!=="create"&&args.action!=="update")return{text:'skill_manage action must be "create", "update", "enable", "disable" or "delete".',isError:!0};let skillMd=typeof args.skill_md=="string"?args.skill_md:"";if(!skillMd.trim())return{
|
|
1872
1696
|
text:"skill_manage needs skill_md: the full SKILL.md including YAML frontmatter.",isError:!0};let source=typeof args.source=="string"?args.source.trim():"";if(!source)return{text:'skill_manage needs source: the URL, folder, or "conversation" used to author the skill.',isError:!0};let skillName=typeof args.skill_name=="string"?args.skill_name.trim():"";if(args.action==="update"&&!skillName)return{text:"skill_manage needs skill_name for an update. Copy the exact name from skills_list.",isError:!0};
|
|
1873
|
-
let r=await api("/api/internal/skills/stage",{method:"POST",body:JSON.stringify({fromBotId:
|
|
1874
|
-
|
|
1697
|
+
let r=await api("/api/internal/skills/stage",{method:"POST",body:JSON.stringify({fromBotId:BOT_ID,fromThreadId:THREAD_ID2,action:args.action,skill_name:skillName||void 0,skill_md:skillMd,...Array.isArray(args.references)?{references:args.references}:{},gist:typeof args.gist=="string"?args.gist:void 0,base_revision:typeof args.base_revision=="string"?args.base_revision:void 0,source})}),nameLabel=typeof r.name=="string"?r.name:"the skill",warningText=Array.isArray(r.warnings)&&r.warnings.length?`\
|
|
1698
|
+
|
|
1875
1699
|
|
|
1876
1700
|
Scan warnings:
|
|
1877
1701
|
- ${r.warnings.join(`
|
|
@@ -1888,9 +1712,9 @@ raw);if(url2.protocol!=="http:"&&url2.protocol!=="https:")return;let path=url2.p
|
|
|
1888
1712
|
input2);if(!fields2)return;let text2=key=>typeof fields2[key]=="string"?fields2[key]:void 0;for(let key of QUERY_KEYS)if(text2(key))return clip2(text2(key),DETAIL_MAX);for(let key of PAGE_KEYS){let page=text2(key)&&pageOf(text2(key));if(page)return clip2(page,DETAIL_MAX)}for(let key of FILE_KEYS){let path=text2(key);if(path)return clip2(path.split(/[\\/]/).filter(Boolean).slice(-2).join("/"),DETAIL_MAX)}if(text2("command"))return clip2(text2("command"),DETAIL_MAX);let bare=name.replace(TOOL_NAMESPACE,
|
|
1889
1713
|
"");for(let key of ACTION_KEYS)if(text2(key))return clip2(text2(key).replace(/[_-]+/g," "),DETAIL_MAX);if(typeof fields2.name=="string"&&/^(?:use_tool|call_tool)$/.test(bare))return clip2(fields2.name,DETAIL_MAX);if(Array.isArray(fields2.coordinate)&&fields2.coordinate.length===2)return clip2(`at ${fields2.coordinate.join(", ")}`,DETAIL_MAX)}function errorLine(output2){if(typeof output2!="string")return;let first=output2.split(`
|
|
1890
1714
|
`).find(line3=>line3.trim());return first?clip2(first,ERROR_MAX):void 0}var RECEIPT_TIMEOUT_MS=2e3;async function sendToolReceipt(context,name,args,startedAt,outcome){let detail=toolDetail(name,args),error62=outcome.ok?void 0:errorLine(outcome.error),body=JSON.stringify({name,startedAt,endedAt:Date.now(),ok:outcome.ok,...detail?{detail}:{},...error62?{error:error62}:{}});try{await context.client.apiResponse("/api/internal/tool-timing",{method:"POST",body,signal:AbortSignal.timeout(RECEIPT_TIMEOUT_MS)})}catch{}}var TOOL_LIMIT_ENV="OMB_TOOL_LIMIT";function parseToolLimit(value){return typeof value=="string"&&/^\d{1,5}$/.test(value)?Number(value):void 0}function toolLimitFromEnv(env=process.env){return parseToolLimit(env[TOOL_LIMIT_ENV])}function capToolList(tools,limit){return limit===void 0||tools.length<=limit?[...tools]:tools.slice(0,limit)}function capToolListResult(result,limit,log){if(limit===void 0||!result||typeof result!="object"||Array.isArray(result))return result;let{tools,nextCursor:_next,...rest}=result;return Array.isArray(
|
|
1891
|
-
tools)?(tools.length>limit&&log?.(`listed ${limit} of ${tools.length} tools to fit the model's tool limit`),{...rest,tools:capToolList(tools,limit)}):result}function agentsToolList(env){let available=availableTools(catalogProfileFromEnv(env)),bridge=env[TOOL_BRIDGE_ENV]==="1"?createToolBridge(available):void 0;return{available,bridge,listed:bridge?bridge.listed:env[DEFER_TOOLS_ENV]==="1"?withDeferMarks(available):available}}function agentsMcp(env){let{available,bridge,listed
|
|
1892
|
-
|
|
1893
|
-
|
|
1715
|
+
tools)?(tools.length>limit&&log?.(`listed ${limit} of ${tools.length} tools to fit the model's tool limit`),{...rest,tools:capToolList(tools,limit)}):result}function agentsToolList(env){let available=availableTools(catalogProfileFromEnv(env)),bridge=env[TOOL_BRIDGE_ENV]==="1"?createToolBridge(available):void 0;return{available,bridge,listed:bridge?bridge.listed:env[DEFER_TOOLS_ENV]==="1"?withDeferMarks(available):available}}function agentsMcp(env){let{available,bridge,listed}=agentsToolList(env),limit=toolLimitFromEnv(env),context=toolCallContextFromEnv(env),ok=(id,result)=>({jsonrpc:"2.0",id,result}),rpcErr=(id,code,message)=>({jsonrpc:"2.0",id,error:{
|
|
1716
|
+
code,message}}),textResult=(id,text2,isError=!1)=>ok(id,{content:[{type:"text",text:text2}],isError});return async msg=>{let id=msg.id,method=msg.method;if(!method)return;let params=msg.params??{};switch(method){case"initialize":return ok(id,{protocolVersion:params.protocolVersion??"2024-11-05",capabilities:{tools:{}},serverInfo:{name:"openmausbot-agents",version:"0.1.0"}});case"notifications/initialized":case"notifications/cancelled":return;case"ping":return ok(id,{});case"tools/list":return ok(
|
|
1717
|
+
id,capToolListResult({tools:listed},limit,line3=>console.warn(`[agents] ${line3}`)));case"tools/call":{let called={name:params.name,arguments:params.arguments??{}},bridged=bridge?await bridge.route(called.name,called.arguments):void 0;if(bridged&&"answer"in bridged)return textResult(id,bridged.answer.text,bridged.answer.isError);let{name,arguments:args}=bridged??called,runs=resolveAgentsCall(name,args).name;if(!available.some(t=>t.name===runs)){let unknown2=`Unknown tool: ${name}`;return bridged?
|
|
1894
1718
|
textResult(id,unknown2,!0):rpcErr(id,-32602,unknown2)}let startedAt=Date.now();try{let{text:text2,isError,passthrough}=await callTool(name,args,context);return await sendToolReceipt(context,name,args,startedAt,{ok:!isError,error:text2}),passthrough?ok(id,passthrough):textResult(id,name==="tool_result_read"?text2:await capResult(text2,context),isError)}catch(e){return await sendToolReceipt(context,name,args,startedAt,{ok:!1,error:e.message}),textResult(id,await capResult(e.message,context),!0)}}default:
|
|
1895
1719
|
return id!==void 0?rpcErr(id,-32601,`Method not found: ${method}`):void 0}}}var handle=agentsMcp(process.env),send2=msg=>process.stdout.write(JSON.stringify(msg)+`
|
|
1896
1720
|
`),rl=readline.createInterface({input:process.stdin,terminal:!1});rl.on("line",line3=>{let t=line3.trim();if(!t)return;let msg;try{msg=JSON.parse(t)}catch{return}handle(msg).then(reply=>{reply&&send2(reply)},e=>{msg.id!==void 0&&send2({jsonrpc:"2.0",id:msg.id,error:{code:-32603,message:e.message}})})});rl.on("close",()=>process.exit(0));
|