@ashx-j/lunr 0.2.24 → 0.2.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -1
- package/dist/builtin-extensions/index.d.ts.map +1 -1
- package/dist/builtin-extensions/index.js +1 -0
- package/dist/builtin-extensions/index.js.map +1 -1
- package/dist/builtin-extensions/lunr-computer-use.d.ts +3 -0
- package/dist/builtin-extensions/lunr-computer-use.d.ts.map +1 -0
- package/dist/builtin-extensions/lunr-computer-use.js +179 -0
- package/dist/builtin-extensions/lunr-computer-use.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/extension/schemas.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/schemas.js +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/schemas.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.d.ts +4 -4
- package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.js +8 -5
- package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-runner.d.ts +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-runner.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-runner.js +11 -2
- package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-runner.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-execution.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-execution.js +3 -3
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-execution.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/execution.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/execution.js +15 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/execution.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/chain-outputs.d.ts +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/chain-outputs.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/chain-outputs.js +5 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/chain-outputs.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/child-tools.d.ts +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/child-tools.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/child-tools.js +2 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/child-tools.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/tui/communication.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/tui/communication.js +1 -1
- package/dist/builtin-extensions/pi-subagents/src/tui/communication.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/tui/render.d.ts +1 -0
- package/dist/builtin-extensions/pi-subagents/src/tui/render.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/tui/render.js +5 -3
- package/dist/builtin-extensions/pi-subagents/src/tui/render.js.map +1 -1
- package/dist/core/computer-use/adapter.d.ts +28 -0
- package/dist/core/computer-use/adapter.d.ts.map +1 -0
- package/dist/core/computer-use/adapter.js +133 -0
- package/dist/core/computer-use/adapter.js.map +1 -0
- package/dist/core/computer-use/image.d.ts +27 -0
- package/dist/core/computer-use/image.d.ts.map +1 -0
- package/dist/core/computer-use/image.js +72 -0
- package/dist/core/computer-use/image.js.map +1 -0
- package/dist/core/computer-use/lease.d.ts +18 -0
- package/dist/core/computer-use/lease.d.ts.map +1 -0
- package/dist/core/computer-use/lease.js +129 -0
- package/dist/core/computer-use/lease.js.map +1 -0
- package/dist/core/computer-use/macos-runtime.d.ts +14 -0
- package/dist/core/computer-use/macos-runtime.d.ts.map +1 -0
- package/dist/core/computer-use/macos-runtime.js +148 -0
- package/dist/core/computer-use/macos-runtime.js.map +1 -0
- package/dist/core/computer-use/policy.d.ts +19 -0
- package/dist/core/computer-use/policy.d.ts.map +1 -0
- package/dist/core/computer-use/policy.js +67 -0
- package/dist/core/computer-use/policy.js.map +1 -0
- package/dist/core/computer-use/release.generated.d.ts +31 -0
- package/dist/core/computer-use/release.generated.d.ts.map +1 -0
- package/dist/core/computer-use/release.generated.js +36 -0
- package/dist/core/computer-use/release.generated.js.map +1 -0
- package/dist/core/computer-use/runtime.d.ts +13 -0
- package/dist/core/computer-use/runtime.d.ts.map +1 -0
- package/dist/core/computer-use/runtime.js +158 -0
- package/dist/core/computer-use/runtime.js.map +1 -0
- package/dist/core/computer-use/schemas.d.ts +100 -0
- package/dist/core/computer-use/schemas.d.ts.map +1 -0
- package/dist/core/computer-use/schemas.js +79 -0
- package/dist/core/computer-use/schemas.js.map +1 -0
- package/dist/core/computer-use/windows-desktop.d.ts +3 -0
- package/dist/core/computer-use/windows-desktop.d.ts.map +1 -0
- package/dist/core/computer-use/windows-desktop.js +48 -0
- package/dist/core/computer-use/windows-desktop.js.map +1 -0
- package/dist/core/computer-use/workflow.d.ts +38 -0
- package/dist/core/computer-use/workflow.d.ts.map +1 -0
- package/dist/core/computer-use/workflow.js +560 -0
- package/dist/core/computer-use/workflow.js.map +1 -0
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +4 -0
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/permissions.d.ts +1 -1
- package/dist/core/permissions.d.ts.map +1 -1
- package/dist/core/permissions.js +14 -3
- package/dist/core/permissions.js.map +1 -1
- package/dist/core/plan-mode.d.ts.map +1 -1
- package/dist/core/plan-mode.js +9 -0
- package/dist/core/plan-mode.js.map +1 -1
- package/dist/core/settings-manager.d.ts +6 -0
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +19 -0
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/subagent-event-transport.d.ts +3 -0
- package/dist/core/subagent-event-transport.d.ts.map +1 -0
- package/dist/core/subagent-event-transport.js +61 -0
- package/dist/core/subagent-event-transport.js.map +1 -0
- package/dist/gateway/adapters/discord.d.ts.map +1 -1
- package/dist/gateway/adapters/discord.js +4 -9
- package/dist/gateway/adapters/discord.js.map +1 -1
- package/dist/gateway/adapters/telegram.d.ts.map +1 -1
- package/dist/gateway/adapters/telegram.js +7 -0
- package/dist/gateway/adapters/telegram.js.map +1 -1
- package/dist/gateway/agent-bridge.d.ts +4 -1
- package/dist/gateway/agent-bridge.d.ts.map +1 -1
- package/dist/gateway/agent-bridge.js +57 -17
- package/dist/gateway/agent-bridge.js.map +1 -1
- package/dist/gateway/approval.d.ts.map +1 -1
- package/dist/gateway/approval.js +3 -3
- package/dist/gateway/approval.js.map +1 -1
- package/dist/gateway/authz.d.ts +4 -4
- package/dist/gateway/authz.d.ts.map +1 -1
- package/dist/gateway/authz.js +8 -12
- package/dist/gateway/authz.js.map +1 -1
- package/dist/gateway/buttons.d.ts.map +1 -1
- package/dist/gateway/buttons.js +29 -19
- package/dist/gateway/buttons.js.map +1 -1
- package/dist/gateway/commands.d.ts +2 -0
- package/dist/gateway/commands.d.ts.map +1 -1
- package/dist/gateway/commands.js +35 -18
- package/dist/gateway/commands.js.map +1 -1
- package/dist/gateway/config.d.ts +1 -0
- package/dist/gateway/config.d.ts.map +1 -1
- package/dist/gateway/config.js +2 -0
- package/dist/gateway/config.js.map +1 -1
- package/dist/gateway/cron.d.ts +1 -1
- package/dist/gateway/cron.d.ts.map +1 -1
- package/dist/gateway/cron.js +22 -8
- package/dist/gateway/cron.js.map +1 -1
- package/dist/gateway/index.d.ts.map +1 -1
- package/dist/gateway/index.js +26 -26
- package/dist/gateway/index.js.map +1 -1
- package/dist/gateway/mobile-commands.d.ts.map +1 -1
- package/dist/gateway/mobile-commands.js +11 -11
- package/dist/gateway/mobile-commands.js.map +1 -1
- package/dist/gateway/presenter.d.ts +12 -1
- package/dist/gateway/presenter.d.ts.map +1 -1
- package/dist/gateway/presenter.js +148 -50
- package/dist/gateway/presenter.js.map +1 -1
- package/dist/gateway/router.d.ts +5 -5
- package/dist/gateway/router.d.ts.map +1 -1
- package/dist/gateway/router.js +95 -43
- package/dist/gateway/router.js.map +1 -1
- package/dist/gateway/service.d.ts.map +1 -1
- package/dist/gateway/service.js +13 -4
- package/dist/gateway/service.js.map +1 -1
- package/dist/gateway/setup.d.ts +5 -0
- package/dist/gateway/setup.d.ts.map +1 -1
- package/dist/gateway/setup.js +101 -43
- package/dist/gateway/setup.js.map +1 -1
- package/dist/gateway/stream.d.ts +6 -5
- package/dist/gateway/stream.d.ts.map +1 -1
- package/dist/gateway/stream.js +24 -11
- package/dist/gateway/stream.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +4 -0
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +20 -0
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +8 -0
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/print-mode.d.ts.map +1 -1
- package/dist/modes/print-mode.js +9 -1
- package/dist/modes/print-mode.js.map +1 -1
- package/dist/node-runtime/adapter-VFG7WNPX.js +17 -0
- package/dist/node-runtime/{agent-session-services-IEF7LQWD.js → agent-session-services-5YXS2PLF.js} +13 -10
- package/dist/node-runtime/{builtin-extensions-EBAWTH4M.js → builtin-extensions-I2HIFEMY.js} +3 -2
- package/dist/node-runtime/{chunk-K5AGHH57.js → chunk-2CFDTH5B.js} +7 -3
- package/dist/node-runtime/{chunk-VWCE2HSZ.js → chunk-2HMIRK7W.js} +4 -4
- package/dist/node-runtime/chunk-2IDTZAG5.js +1415 -0
- package/dist/node-runtime/{chunk-IGV54Q5V.js → chunk-3MISGG4S.js} +137 -76
- package/dist/node-runtime/chunk-4SBQAI4T.js +2185 -0
- package/dist/node-runtime/{chunk-WHLRAGUQ.js → chunk-5B5QN3ZQ.js} +16 -16
- package/dist/node-runtime/chunk-5B6VKFEV.js +180 -0
- package/dist/node-runtime/{chunk-AD6VXAO7.js → chunk-5Q4A37RB.js} +15 -104
- package/dist/node-runtime/{chunk-4TLO4PO2.js → chunk-7IQGBKBJ.js} +7 -1401
- package/dist/node-runtime/{chunk-R3K2F5GI.js → chunk-B4HP6ZWM.js} +2 -0
- package/dist/node-runtime/{chunk-OCVIXVTZ.js → chunk-D5UCKPBQ.js} +12 -1
- package/dist/node-runtime/chunk-DVQSHCVP.js +97 -0
- package/dist/node-runtime/{chunk-HFVZUPFJ.js → chunk-E75WFZ33.js} +2 -2
- package/dist/node-runtime/chunk-FY4A63RK.js +73 -0
- package/dist/node-runtime/{chunk-RORY2HMJ.js → chunk-I74LN5JG.js} +16 -1
- package/dist/node-runtime/chunk-IKU6Y7DL.js +287 -0
- package/dist/node-runtime/{chunk-QM43FEAE.js → chunk-L24TPBS4.js} +6 -5
- package/dist/node-runtime/{chunk-DE2JB6J5.js → chunk-LJTIVM7I.js} +7 -7
- package/dist/node-runtime/{chunk-DSIKTUPW.js → chunk-LWJXTA6Z.js} +274 -2433
- package/dist/node-runtime/{chunk-YVI6L6LU.js → chunk-P7XBVXGT.js} +36 -21
- package/dist/node-runtime/{chunk-OVX6X377.js → chunk-PTFBPO3C.js} +1 -1
- package/dist/node-runtime/{chunk-F4FLTQKV.js → chunk-RAK2QA2B.js} +186 -1529
- package/dist/node-runtime/{chunk-L3LX4SNR.js → chunk-RCR3XAQY.js} +36 -8
- package/dist/node-runtime/chunk-RGQAEOM5.js +81 -0
- package/dist/node-runtime/{chunk-UWPJL22I.js → chunk-SLVOAQOY.js} +15 -4
- package/dist/node-runtime/chunk-SN2KSMPQ.js +1364 -0
- package/dist/node-runtime/{chunk-FU6OODRZ.js → chunk-SPVDBUOS.js} +1 -1
- package/dist/node-runtime/{chunk-5Q3EHOHI.js → chunk-T4DA4XE7.js} +19 -17
- package/dist/node-runtime/chunk-U5F4IC7R.js +53 -0
- package/dist/node-runtime/{chunk-UP2XBVH5.js → chunk-UOEDI7RP.js} +1 -1
- package/dist/node-runtime/{chunk-Y73WPE6S.js → chunk-UVWCDQYF.js} +79 -44
- package/dist/node-runtime/{chunk-ZXSGTGJ6.js → chunk-WIF24I7G.js} +21 -5
- package/dist/node-runtime/{chunk-OF7PWMG4.js → chunk-X3PGBLQ7.js} +3 -87
- package/dist/node-runtime/chunk-XHIRAZ26.js +108 -0
- package/dist/node-runtime/{chunk-YDO2F2IA.js → chunk-YWOJIGFY.js} +1 -1
- package/dist/node-runtime/{command-7BG7VVTS.js → command-FSBU2EVZ.js} +5 -5
- package/dist/node-runtime/{commands-NZLSOHPE.js → commands-EMBQQVVT.js} +4 -2
- package/dist/node-runtime/{commands-QFDKNQTL.js → commands-NAAL7KNT.js} +7 -6
- package/dist/node-runtime/{config-RORQUQFG.js → config-D4QUPAHX.js} +1 -1
- package/dist/node-runtime/{direct-tool-executor-77GW4F5P.js → direct-tool-executor-4D7UXYU4.js} +7 -4
- package/dist/node-runtime/{gateway-TWR3N65G.js → gateway-DQM333YV.js} +140 -85
- package/dist/node-runtime/index.js +28 -21
- package/dist/node-runtime/{init-HS6NQXSK.js → init-P5AUV77I.js} +4 -2
- package/dist/node-runtime/{install-cli-VAP6KBFN.js → install-cli-NN4YAU44.js} +3 -3
- package/dist/node-runtime/{interactive-mode-6J5VZ2TT.js → interactive-mode-YOHZVMKX.js} +14 -11
- package/dist/node-runtime/{lunr-browser-J5ZZYVGM.js → lunr-browser-IR7TL3J7.js} +3 -3
- package/dist/node-runtime/lunr-computer-use-Y23CCDIJ.js +158 -0
- package/dist/node-runtime/{lunr-cron-CXOL37AL.js → lunr-cron-USHC4LXH.js} +9 -7
- package/dist/node-runtime/main.js +19 -15
- package/dist/node-runtime/{mcp-auth-flow-QIXHW6QN.js → mcp-auth-flow-QVLFVLEO.js} +2 -1
- package/dist/node-runtime/{mobile-commands-VTBM5DSZ.js → mobile-commands-O5LCHL32.js} +6 -5
- package/dist/node-runtime/{package-manager-cli-ZLW5DZXF.js → package-manager-cli-Q7BL6KZO.js} +12 -8
- package/dist/node-runtime/{pi-mcp-adapter-5UKBZP44.js → pi-mcp-adapter-3PHF4KZ4.js} +5 -5
- package/dist/node-runtime/{pi-subagents-XPCLLKIM.js → pi-subagents-7IBSSGEW.js} +27 -21
- package/dist/node-runtime/{print-mode-XSFM26EL.js → print-mode-XQ76CYMT.js} +2 -1
- package/dist/node-runtime/{proxy-modes-LGEUYD7R.js → proxy-modes-5FAPSZEZ.js} +7 -4
- package/dist/node-runtime/rpc-entry.js +19 -15
- package/dist/node-runtime/runtime-EFPPD2UW.js +21 -0
- package/dist/node-runtime/{runtime-bridges-QYXUX2TG.js → runtime-bridges-7WVCLI76.js} +6 -5
- package/dist/node-runtime/{service-ISSP6VHE.js → service-MDQIPQ26.js} +1 -1
- package/dist/node-runtime/{settings-manager-WCQDUVQB.js → settings-manager-DJDM5AHM.js} +5 -4
- package/dist/node-runtime/setup-PFBWRNUI.js +215 -0
- package/dist/node-runtime/{subagent-executor-OTNISDQU.js → subagent-executor-LPZ4BHWE.js} +32 -14
- package/dist/node-runtime/{update-cli-VBR2777K.js → update-cli-HNMOTNGX.js} +5 -4
- package/dist/node-runtime/workflow-OHPBEFO4.js +637 -0
- package/dist/utils/image-resize-core.d.ts +2 -0
- package/dist/utils/image-resize-core.d.ts.map +1 -1
- package/dist/utils/image-resize-core.js +10 -0
- package/dist/utils/image-resize-core.js.map +1 -1
- package/docs/computer-use.md +362 -0
- package/docs/features.md +9 -7
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/gondolin/package-lock.json +2 -2
- package/examples/extensions/gondolin/package.json +1 -1
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/install-lock/package-lock.json +3841 -0
- package/install-lock/package.json +18 -0
- package/native/computer-use/LICENSE.md +21 -0
- package/npm-shrinkwrap.json +3822 -0
- package/package.json +15 -9
- package/dist/node-runtime/setup-YRBKH2LD.js +0 -155
|
@@ -3,52 +3,59 @@ import {
|
|
|
3
3
|
AgentBridge,
|
|
4
4
|
QUEUED,
|
|
5
5
|
startGatewayCron
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-UVWCDQYF.js";
|
|
7
7
|
import {
|
|
8
8
|
CHAT_COMMANDS,
|
|
9
9
|
botCommandSpecs,
|
|
10
10
|
runChatCommand,
|
|
11
11
|
sendCommandReply
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import
|
|
12
|
+
} from "./chunk-P7XBVXGT.js";
|
|
13
|
+
import {
|
|
14
|
+
resolveWithinRoots
|
|
15
|
+
} from "./chunk-5B5QN3ZQ.js";
|
|
14
16
|
import {
|
|
15
17
|
acceptGatewayInput,
|
|
16
18
|
addAllowedUser,
|
|
17
19
|
bindConversation,
|
|
18
20
|
conversationBinding,
|
|
21
|
+
gatewayEpoch,
|
|
22
|
+
getSession,
|
|
19
23
|
handleApprovalCallback,
|
|
20
24
|
handleCallback,
|
|
21
25
|
invalidateGatewayDialogs,
|
|
22
26
|
isAuthorized,
|
|
23
|
-
isGatewayOwner,
|
|
24
27
|
listSessions,
|
|
28
|
+
queueGatewayText,
|
|
25
29
|
registerGatewayApprovalHandler,
|
|
26
|
-
|
|
30
|
+
rememberGatewayRole,
|
|
31
|
+
requireAuthorized,
|
|
27
32
|
runWithApprovalContext,
|
|
28
33
|
splitMessage,
|
|
29
34
|
startButtonSweeper,
|
|
30
35
|
startGatewayPresenter,
|
|
31
36
|
stopButtonSweeper,
|
|
32
37
|
stopGatewayPresenter
|
|
33
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-3MISGG4S.js";
|
|
34
39
|
import {
|
|
35
40
|
createPairingStore
|
|
36
41
|
} from "./chunk-RMQZU2YU.js";
|
|
37
42
|
import {
|
|
38
43
|
claimGateway
|
|
39
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-SLVOAQOY.js";
|
|
40
45
|
import "./chunk-CJECDQKP.js";
|
|
41
46
|
import "./chunk-CDVHZOOK.js";
|
|
42
|
-
import "./chunk-
|
|
47
|
+
import "./chunk-XHIRAZ26.js";
|
|
48
|
+
import "./chunk-5Q4A37RB.js";
|
|
43
49
|
import {
|
|
44
50
|
isFeatureEnabled
|
|
45
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-2HMIRK7W.js";
|
|
46
52
|
import "./chunk-GYIXXQAO.js";
|
|
47
53
|
import "./chunk-GJ2RDBRL.js";
|
|
48
54
|
import "./chunk-CGBXPL3E.js";
|
|
49
55
|
import "./chunk-BBUVIEZB.js";
|
|
50
|
-
import "./chunk-
|
|
56
|
+
import "./chunk-WIF24I7G.js";
|
|
51
57
|
import "./chunk-M3LZLQW2.js";
|
|
58
|
+
import "./chunk-FY4A63RK.js";
|
|
52
59
|
import "./chunk-KKUTQQV7.js";
|
|
53
60
|
import "./chunk-CSFI6YXL.js";
|
|
54
61
|
import "./chunk-I54LGHWM.js";
|
|
@@ -61,8 +68,9 @@ import {
|
|
|
61
68
|
gatewayConfigPath,
|
|
62
69
|
loadGatewayConfig,
|
|
63
70
|
platformConfigFor,
|
|
64
|
-
resolvePlatformToken
|
|
65
|
-
|
|
71
|
+
resolvePlatformToken,
|
|
72
|
+
saveGatewayConfig
|
|
73
|
+
} from "./chunk-B4HP6ZWM.js";
|
|
66
74
|
import "./chunk-E24EO34J.js";
|
|
67
75
|
import "./chunk-RDDAZOMU.js";
|
|
68
76
|
import "./chunk-FQMM2EZ2.js";
|
|
@@ -357,7 +365,7 @@ var DiscordAdapter = class {
|
|
|
357
365
|
userName: interaction.user.username
|
|
358
366
|
}, cfg = loadGatewayConfig(), authorized = isAuthorized(source, cfg, createPairingStore());
|
|
359
367
|
if (interaction.isAutocomplete()) {
|
|
360
|
-
if (!authorized
|
|
368
|
+
if (!authorized)
|
|
361
369
|
return await interaction.respond([]), !0;
|
|
362
370
|
let query = String(interaction.options.getFocused()).toLowerCase(), values = [];
|
|
363
371
|
if (interaction.commandName === "mode" && (values = ["yolo", "auto", "read-only"]), this.commandSuggestions && ["thinking", "model"].includes(interaction.commandName) && (values = [...await this.commandSuggestions(source, interaction.commandName)]), interaction.commandName === "project" && (values = cfg.projectRoots ?? []), interaction.commandName === "sessions") {
|
|
@@ -474,16 +482,12 @@ ${event.text}`,
|
|
|
474
482
|
return null;
|
|
475
483
|
try {
|
|
476
484
|
let channel = await this.client.channels.fetch(id);
|
|
477
|
-
if (this.channelCache.set(id, channel), this.channelCache.size > CHANNEL_CACHE_CAP) {
|
|
485
|
+
if (channel && this.channelCache.set(id, channel), this.channelCache.size > CHANNEL_CACHE_CAP) {
|
|
478
486
|
let oldest = this.channelCache.keys().next().value;
|
|
479
487
|
oldest !== void 0 && this.channelCache.delete(oldest);
|
|
480
488
|
}
|
|
481
489
|
return channel;
|
|
482
490
|
} catch {
|
|
483
|
-
if (this.channelCache.set(id, null), this.channelCache.size > CHANNEL_CACHE_CAP) {
|
|
484
|
-
let oldest = this.channelCache.keys().next().value;
|
|
485
|
-
oldest !== void 0 && this.channelCache.delete(oldest);
|
|
486
|
-
}
|
|
487
491
|
return null;
|
|
488
492
|
}
|
|
489
493
|
}
|
|
@@ -933,6 +937,10 @@ ${event.text}`,
|
|
|
933
937
|
let result = await this.callApi("sendMessage", body);
|
|
934
938
|
return { success: !0, messageId: String(result.message_id) };
|
|
935
939
|
} catch (err) {
|
|
940
|
+
if (err instanceof TelegramApiError && err.status === 400 && body.reply_parameters !== void 0 && /message to be replied not found/i.test(err.message)) {
|
|
941
|
+
let { reply_parameters: _dropped, ...plain } = body;
|
|
942
|
+
return this.callSend(plain);
|
|
943
|
+
}
|
|
936
944
|
if (err instanceof TelegramApiError && err.status === 400 && body.parse_mode !== void 0 && MARKDOWN_PARSE_ERROR_RE.test(err.message)) {
|
|
937
945
|
let { parse_mode: _dropped, ...plain } = body;
|
|
938
946
|
return this.callSend(plain);
|
|
@@ -1047,6 +1055,7 @@ var StreamConsumer = class {
|
|
|
1047
1055
|
options;
|
|
1048
1056
|
buffer = "";
|
|
1049
1057
|
flushedLen = 0;
|
|
1058
|
+
lastPreview = "";
|
|
1050
1059
|
messageId = null;
|
|
1051
1060
|
lastFlushAt = 0;
|
|
1052
1061
|
chain = Promise.resolve();
|
|
@@ -1059,9 +1068,9 @@ var StreamConsumer = class {
|
|
|
1059
1068
|
push(delta) {
|
|
1060
1069
|
this.buffer += delta, this.buffer.length - this.flushedLen >= this.options.threshold && this.now() - this.lastFlushAt >= this.options.intervalMs && this.schedule();
|
|
1061
1070
|
}
|
|
1062
|
-
/**
|
|
1071
|
+
/** Wait for pending previews; final delivery belongs to the router. */
|
|
1063
1072
|
async finalize() {
|
|
1064
|
-
return
|
|
1073
|
+
return await this.chain, this.buffer;
|
|
1065
1074
|
}
|
|
1066
1075
|
/** The platform message id of the preview, when one was successfully sent. */
|
|
1067
1076
|
get sentMessageId() {
|
|
@@ -1071,12 +1080,19 @@ var StreamConsumer = class {
|
|
|
1071
1080
|
get truncated() {
|
|
1072
1081
|
return this.buffer.length > this.maxPreview;
|
|
1073
1082
|
}
|
|
1074
|
-
/**
|
|
1083
|
+
/** Preview visible text without a trailing silence-marker fragment. */
|
|
1075
1084
|
preview() {
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1085
|
+
let lines = this.buffer.split(`
|
|
1086
|
+
`), last = lines.at(-1)?.trim() ?? "";
|
|
1087
|
+
(SILENCE_MARKERS.has(last) || last && [...SILENCE_MARKERS].some((marker) => marker.startsWith(last))) && lines.pop(), lines.length && isMarkerLine(lines[0]) && lines.shift();
|
|
1088
|
+
let visible = lines.join(`
|
|
1089
|
+
`).trim();
|
|
1090
|
+
if (!visible)
|
|
1091
|
+
return "";
|
|
1092
|
+
if (visible.length <= this.maxPreview)
|
|
1093
|
+
return visible;
|
|
1094
|
+
let cut = this.maxPreview - 3, code = visible.charCodeAt(cut - 1);
|
|
1095
|
+
return code >= 55296 && code <= 56319 && (cut -= 1), `${visible.slice(0, cut)}\u2026`;
|
|
1080
1096
|
}
|
|
1081
1097
|
schedule(force = !1) {
|
|
1082
1098
|
this.chain = this.chain.then(() => this.flush(force)).catch(() => {
|
|
@@ -1086,12 +1102,15 @@ var StreamConsumer = class {
|
|
|
1086
1102
|
if (!(this.buffer.length > this.flushedLen) || !force && this.messageId !== null && this.now() - this.lastFlushAt < this.options.intervalMs)
|
|
1087
1103
|
return;
|
|
1088
1104
|
let text = this.preview();
|
|
1105
|
+
if (!text || text === this.lastPreview)
|
|
1106
|
+
return;
|
|
1107
|
+
let length = this.buffer.length;
|
|
1089
1108
|
if (this.messageId === null) {
|
|
1090
1109
|
if (this.messageId = await this.options.sendInitial(text), this.messageId === null)
|
|
1091
1110
|
return;
|
|
1092
1111
|
} else
|
|
1093
1112
|
await this.options.edit(this.messageId, text);
|
|
1094
|
-
this.flushedLen = this.
|
|
1113
|
+
this.flushedLen = length, this.lastPreview = text, this.lastFlushAt = this.now();
|
|
1095
1114
|
}
|
|
1096
1115
|
};
|
|
1097
1116
|
|
|
@@ -1118,10 +1137,12 @@ function createRouter(deps) {
|
|
|
1118
1137
|
}
|
|
1119
1138
|
return initialCfg;
|
|
1120
1139
|
}
|
|
1121
|
-
async function sendError(adapter, event, message) {
|
|
1122
|
-
await
|
|
1140
|
+
async function sendError(adapter, event, key, cfg, message, epoch) {
|
|
1141
|
+
await queueGatewayText(key, event.source, adapter, `\u26A0 ${oneLine(message)}`, {
|
|
1142
|
+
kind: "notice",
|
|
1123
1143
|
replyTo: event.messageId,
|
|
1124
|
-
|
|
1144
|
+
cfg,
|
|
1145
|
+
epoch
|
|
1125
1146
|
});
|
|
1126
1147
|
}
|
|
1127
1148
|
function isGroupGated(event, cfg) {
|
|
@@ -1141,7 +1162,21 @@ function createRouter(deps) {
|
|
|
1141
1162
|
if (source.chatType !== "dm" || cfg.unauthorizedDmBehavior !== "pair")
|
|
1142
1163
|
return !0;
|
|
1143
1164
|
let code = pairing.issueCode(source.platform, source.userId);
|
|
1144
|
-
return code === null || await adapter.send(source.chatId, `Your lunR pairing code: ${formatPairingCode(code)}
|
|
1165
|
+
return code === null || await adapter.send(source.chatId, `Your lunR pairing code: ${formatPairingCode(code)}. On the computer running lunr, approve access with: lunr gateway pair approve ${source.platform} ${formatPairingCode(code)}. Approval grants full gateway access, including local projects and saved sessions.`, { replyTo: event.messageId, threadId: source.threadId }), !0;
|
|
1166
|
+
}
|
|
1167
|
+
function workspaceReadiness(event, key, cfg) {
|
|
1168
|
+
if (getSession(key) || conversationBinding(key)?.cwd)
|
|
1169
|
+
return;
|
|
1170
|
+
let root = cfg.defaultProject;
|
|
1171
|
+
if (!root)
|
|
1172
|
+
return "No default project selected. Use /project to choose an approved folder.";
|
|
1173
|
+
try {
|
|
1174
|
+
let cwd = resolveWithinRoots(root, cfg.projectRoots ?? []);
|
|
1175
|
+
bindConversation(key, event.source, { cwd, owner: event.source.userId });
|
|
1176
|
+
return;
|
|
1177
|
+
} catch {
|
|
1178
|
+
return "Default project is no longer an approved folder. Use /project to choose an approved folder.";
|
|
1179
|
+
}
|
|
1145
1180
|
}
|
|
1146
1181
|
async function handleSlash(adapter, event, key) {
|
|
1147
1182
|
let text = event.text.trim();
|
|
@@ -1149,7 +1184,7 @@ function createRouter(deps) {
|
|
|
1149
1184
|
return !1;
|
|
1150
1185
|
let firstToken = text.split(/\s+/, 1)[0].toLowerCase(), commandWord = firstToken.split("@")[0].slice(1), args = text.slice(firstToken.length).trim();
|
|
1151
1186
|
if (deps.remoteControls) {
|
|
1152
|
-
let { handleMobileCommand, cancelMobileTransfer } = await import("./mobile-commands-
|
|
1187
|
+
let { handleMobileCommand, cancelMobileTransfer } = await import("./mobile-commands-O5LCHL32.js");
|
|
1153
1188
|
if (["stop", "stopall", "new", "cancel"].includes(commandWord) && cancelMobileTransfer(key), commandWord === "cancel")
|
|
1154
1189
|
return invalidateGatewayDialogs(key), await adapter.send(event.source.chatId, "Cancelled the pending selection or transfer.", {
|
|
1155
1190
|
threadId: event.source.threadId
|
|
@@ -1159,6 +1194,23 @@ function createRouter(deps) {
|
|
|
1159
1194
|
if (!event.text.startsWith("/"))
|
|
1160
1195
|
return !1;
|
|
1161
1196
|
}
|
|
1197
|
+
if (commandWord === "start") {
|
|
1198
|
+
let issue = deps.remoteControls ? workspaceReadiness(event, key, freshCfg()) : void 0;
|
|
1199
|
+
if (issue)
|
|
1200
|
+
return await sendCommandReply(adapter, event, issue), !0;
|
|
1201
|
+
try {
|
|
1202
|
+
let session = await bridge.getSession(key, !0), models = await session?.modelRuntime.getAvailable();
|
|
1203
|
+
models?.length ? !session?.model || !models.some((model) => model.id === session.model?.id && model.provider === session.model.provider) ? await sendCommandReply(adapter, event, "No available model selected. Use /model here to choose one.") : await sendCommandReply(adapter, event, "Ready. Send a message to begin, or use /model to choose a model.") : await sendCommandReply(adapter, event, "No authenticated model available. Use /login on your computer, then try /start again.");
|
|
1204
|
+
} catch {
|
|
1205
|
+
await sendCommandReply(adapter, event, "Session setup failed. Run lunr gateway doctor on your computer, then try /start again.");
|
|
1206
|
+
}
|
|
1207
|
+
return !0;
|
|
1208
|
+
}
|
|
1209
|
+
if (deps.remoteControls && commandWord === "model") {
|
|
1210
|
+
let issue = workspaceReadiness(event, key, freshCfg());
|
|
1211
|
+
if (issue)
|
|
1212
|
+
return await sendCommandReply(adapter, event, issue), !0;
|
|
1213
|
+
}
|
|
1162
1214
|
let cmd = CHAT_COMMANDS.find((c) => c.name === commandWord || c.aliases?.includes(commandWord));
|
|
1163
1215
|
if (!cmd)
|
|
1164
1216
|
return event.source.chatType !== "dm";
|
|
@@ -1167,36 +1219,37 @@ function createRouter(deps) {
|
|
|
1167
1219
|
key,
|
|
1168
1220
|
adapter,
|
|
1169
1221
|
bridge,
|
|
1222
|
+
cfg: freshCfg(),
|
|
1170
1223
|
args,
|
|
1171
1224
|
reply: (message) => sendCommandReply(adapter, event, message)
|
|
1172
1225
|
};
|
|
1173
1226
|
return runWithApprovalContext({ key, adapter, source: event.source }, () => runChatCommand(cmd, ctx));
|
|
1174
1227
|
}
|
|
1175
|
-
async function deliver(adapter, event, text, opts) {
|
|
1228
|
+
async function deliver(adapter, event, text, key, cfg, opts) {
|
|
1176
1229
|
let filtered = applySilenceFilter(text);
|
|
1177
|
-
if (filtered
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1230
|
+
if (filtered !== null) {
|
|
1231
|
+
if (opts.editMessageId) {
|
|
1232
|
+
let chunks = splitMessage(filtered, adapter.maxMessageLength);
|
|
1233
|
+
if ((await adapter.editMessage(event.source.chatId, opts.editMessageId, opts.previewTruncated ? chunks[0] : filtered).catch(() => ({ success: !1 }))).success) {
|
|
1234
|
+
if (!opts.previewTruncated)
|
|
1235
|
+
return;
|
|
1236
|
+
await queueGatewayText(key, event.source, adapter, chunks.slice(1).join(""), {
|
|
1237
|
+
kind: "result",
|
|
1238
|
+
cfg,
|
|
1239
|
+
chunks: chunks.slice(1)
|
|
1240
|
+
});
|
|
1241
|
+
return;
|
|
1242
|
+
}
|
|
1184
1243
|
}
|
|
1185
|
-
await
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
replyTo: opts.reply && index === 0 ? event.messageId : void 0,
|
|
1190
|
-
threadId: event.source.threadId
|
|
1244
|
+
await queueGatewayText(key, event.source, adapter, filtered, {
|
|
1245
|
+
kind: "result",
|
|
1246
|
+
replyTo: opts.reply ? event.messageId : void 0,
|
|
1247
|
+
cfg
|
|
1191
1248
|
});
|
|
1192
|
-
if (!result.success) {
|
|
1193
|
-
console.error(`[gateway] send failed on ${adapter.platform}: ${result.error ?? "unknown error"}`);
|
|
1194
|
-
return;
|
|
1195
|
-
}
|
|
1196
1249
|
}
|
|
1197
1250
|
}
|
|
1198
1251
|
async function runTurn(adapter, event, key, cfg) {
|
|
1199
|
-
let streaming = cfg.streaming.enabled && typeof adapter.editMessage == "function", consumer;
|
|
1252
|
+
let epoch = gatewayEpoch(key), streaming = cfg.streaming.enabled && typeof adapter.editMessage == "function", consumer;
|
|
1200
1253
|
streaming && (consumer = new StreamConsumer({
|
|
1201
1254
|
sendInitial: async (text) => {
|
|
1202
1255
|
let result2 = await adapter.send(event.source.chatId, text, {
|
|
@@ -1206,7 +1259,9 @@ function createRouter(deps) {
|
|
|
1206
1259
|
return result2.success ? result2.messageId ?? null : null;
|
|
1207
1260
|
},
|
|
1208
1261
|
edit: async (messageId, text) => {
|
|
1209
|
-
await adapter.editMessage(event.source.chatId, messageId, text);
|
|
1262
|
+
let result2 = await adapter.editMessage(event.source.chatId, messageId, text);
|
|
1263
|
+
if (!result2.success)
|
|
1264
|
+
throw new Error(result2.error ?? "Preview edit failed");
|
|
1210
1265
|
},
|
|
1211
1266
|
intervalMs: cfg.streaming.editIntervalMs,
|
|
1212
1267
|
threshold: cfg.streaming.bufferThreshold,
|
|
@@ -1215,13 +1270,13 @@ function createRouter(deps) {
|
|
|
1215
1270
|
let callbacks = {
|
|
1216
1271
|
onDelta: consumer ? (delta) => consumer.push(delta) : void 0,
|
|
1217
1272
|
onFollowUpResult: (text) => {
|
|
1218
|
-
deliver(adapter, event, text, { reply: !1 });
|
|
1273
|
+
deliver(adapter, event, text, key, cfg, { reply: !1 }).catch((error) => console.error("[gateway] follow-up delivery failed:", error));
|
|
1219
1274
|
},
|
|
1220
1275
|
onError: (message) => {
|
|
1221
|
-
sendError(adapter, event, message);
|
|
1276
|
+
sendError(adapter, event, key, cfg, message, epoch).catch((error) => console.error("[gateway] error delivery failed:", error));
|
|
1222
1277
|
}
|
|
1223
1278
|
}, result = await runWithApprovalContext({ key, adapter, source: event.source }, () => bridge.runTurn(key, event, callbacks));
|
|
1224
|
-
result !== QUEUED && (consumer && await consumer.finalize(), await deliver(adapter, event, result, {
|
|
1279
|
+
result !== QUEUED && (consumer && await consumer.finalize(), await deliver(adapter, event, result, key, cfg, {
|
|
1225
1280
|
reply: !consumer,
|
|
1226
1281
|
editMessageId: consumer?.sentMessageId ?? void 0,
|
|
1227
1282
|
previewTruncated: consumer?.truncated ?? !1
|
|
@@ -1232,24 +1287,28 @@ function createRouter(deps) {
|
|
|
1232
1287
|
let adapter = adapters.get(event.source.platform);
|
|
1233
1288
|
if (!adapter)
|
|
1234
1289
|
return;
|
|
1235
|
-
let cfg = freshCfg();
|
|
1290
|
+
let cfg = freshCfg(), key = buildSessionKey(event.source, { groupSessionsPerUser: cfg.groupSessionsPerUser }), epoch = gatewayEpoch(key);
|
|
1236
1291
|
try {
|
|
1237
|
-
if (isGroupGated(event, cfg) || await isDenied(adapter, event, cfg))
|
|
1292
|
+
if (isGroupGated(event, cfg) || (rememberGatewayRole(key, event.source), await isDenied(adapter, event, cfg)))
|
|
1238
1293
|
return;
|
|
1239
|
-
let key = buildSessionKey(event.source, { groupSessionsPerUser: cfg.groupSessionsPerUser });
|
|
1240
1294
|
if (deps.remoteControls) {
|
|
1241
1295
|
let binding = conversationBinding(key);
|
|
1242
|
-
if (binding?.owner && (
|
|
1243
|
-
throw new Error("This session belongs to a different
|
|
1296
|
+
if (binding?.owner && (requireAuthorized(event.source, cfg), binding.owner !== event.source.userId))
|
|
1297
|
+
throw new Error("This session belongs to a different user.");
|
|
1244
1298
|
if (bindConversation(key, event.source), acceptGatewayInput(key, event))
|
|
1245
1299
|
return;
|
|
1246
1300
|
}
|
|
1247
1301
|
if (await handleSlash(adapter, event, key))
|
|
1248
1302
|
return;
|
|
1303
|
+
let issue = deps.remoteControls ? workspaceReadiness(event, key, cfg) : void 0;
|
|
1304
|
+
if (issue) {
|
|
1305
|
+
await sendCommandReply(adapter, event, issue);
|
|
1306
|
+
return;
|
|
1307
|
+
}
|
|
1249
1308
|
await adapter.sendTyping(event.source.chatId, event.source.threadId).catch(() => {
|
|
1250
1309
|
}), await runTurn(adapter, event, key, cfg);
|
|
1251
1310
|
} catch (err) {
|
|
1252
|
-
await sendError(adapter, event, err instanceof Error ? err.message : String(err)).catch(() => {
|
|
1311
|
+
await sendError(adapter, event, key, cfg, err instanceof Error ? err.message : String(err), epoch).catch(() => {
|
|
1253
1312
|
});
|
|
1254
1313
|
}
|
|
1255
1314
|
}
|
|
@@ -1261,16 +1320,8 @@ var ADAPTER_FACTORIES = {
|
|
|
1261
1320
|
telegram: (cfg) => new TelegramAdapter(cfg),
|
|
1262
1321
|
discord: (cfg) => new DiscordAdapter(cfg)
|
|
1263
1322
|
}, KNOWN_PLATFORMS = ["telegram", "discord"], SETUP_INSTRUCTIONS = {
|
|
1264
|
-
telegram: [
|
|
1265
|
-
|
|
1266
|
-
" <agentDir>/gateway.json (telegram.token) or export LUNR_TELEGRAM_BOT_TOKEN,",
|
|
1267
|
-
" then set telegram.enabled = true."
|
|
1268
|
-
],
|
|
1269
|
-
discord: [
|
|
1270
|
-
"Discord: discord.com/developers \u2192 New Application \u2192 Bot \u2192 copy the token into",
|
|
1271
|
-
" <agentDir>/gateway.json (discord.token) or export LUNR_DISCORD_BOT_TOKEN,",
|
|
1272
|
-
" enable the MESSAGE CONTENT intent, then set discord.enabled = true."
|
|
1273
|
-
]
|
|
1323
|
+
telegram: ["Telegram: run lunr gateway setup locally to configure the bot token and approved user ID."],
|
|
1324
|
+
discord: ["Discord: run lunr gateway setup locally to configure the bot token and approved user ID."]
|
|
1274
1325
|
};
|
|
1275
1326
|
function printSetupInstructions(enabledButUnrunnable) {
|
|
1276
1327
|
console.log("lunR gateway: no runnable platforms configured.");
|
|
@@ -1280,18 +1331,24 @@ function printSetupInstructions(enabledButUnrunnable) {
|
|
|
1280
1331
|
for (let line of SETUP_INSTRUCTIONS[platform])
|
|
1281
1332
|
console.log(line);
|
|
1282
1333
|
}
|
|
1283
|
-
async function runPairApprove(platform, code) {
|
|
1334
|
+
async function runPairApprove(platform, code, owner = !1) {
|
|
1284
1335
|
if (!code)
|
|
1285
|
-
return console.error("Usage: lunr gateway pair approve <platform> <code>"), 1;
|
|
1336
|
+
return console.error("Usage: lunr gateway pair approve <platform> <code> [--owner]"), 1;
|
|
1286
1337
|
let userId = createPairingStore().approve(platform, code);
|
|
1287
1338
|
if (userId === null)
|
|
1288
1339
|
return console.error(`Pairing failed: no valid pending code "${code}" for ${platform} (wrong, expired, or locked out).`), 1;
|
|
1289
1340
|
try {
|
|
1290
|
-
|
|
1341
|
+
if (owner) {
|
|
1342
|
+
let cfg = loadGatewayConfig();
|
|
1343
|
+
if (platform !== "telegram" && platform !== "discord")
|
|
1344
|
+
throw new Error("Unknown platform.");
|
|
1345
|
+
cfg.owners ??= { telegram: [], discord: [] }, cfg.owners[platform] = [.../* @__PURE__ */ new Set([...cfg.owners[platform], userId])], cfg[platform].allowedUsers = [.../* @__PURE__ */ new Set([...cfg[platform].allowedUsers, userId])], saveGatewayConfig(cfg);
|
|
1346
|
+
} else
|
|
1347
|
+
addAllowedUser(platform, userId);
|
|
1291
1348
|
} catch (err) {
|
|
1292
1349
|
return console.error(`Paired ${platform} user ${userId}, but could not persist allowedUsers: ${err}`), 1;
|
|
1293
1350
|
}
|
|
1294
|
-
return console.log(`Approved ${platform} user ${userId}
|
|
1351
|
+
return console.log(`Approved ${platform} user ${userId}. Gateway access includes local projects and saved sessions.`), 0;
|
|
1295
1352
|
}
|
|
1296
1353
|
function runPairList() {
|
|
1297
1354
|
let pairing = createPairingStore(), pending = pairing.listPending(), approved = pairing.listApproved();
|
|
@@ -1359,19 +1416,17 @@ async function runDaemon() {
|
|
|
1359
1416
|
await bridge.shutdown(), await Promise.all([...adapters.values()].map((adapter) => adapter.disconnect().catch(() => {
|
|
1360
1417
|
}))), stopGatewayPresenter(), owner.release(), process.removeListener("SIGINT", shutdown), process.removeListener("SIGTERM", shutdown), finish();
|
|
1361
1418
|
})().catch((error) => {
|
|
1362
|
-
console.error("Gateway shutdown failed:", error instanceof Error ? error.message : String(error)), stopping = !1, owner.update(platformStatus, "ready"), startButtonSweeper(), cron = startGatewayCron({ adapters, cfg });
|
|
1419
|
+
console.error("Gateway shutdown failed:", error instanceof Error ? error.message : String(error)), stopping = !1, owner.update(platformStatus, Object.values(platformStatus).includes("connected") ? "ready" : "starting"), startButtonSweeper(), cron = startGatewayCron({ adapters, cfg });
|
|
1363
1420
|
for (let [platform, adapter] of adapters)
|
|
1364
1421
|
platformStatus[platform] !== "connected" && connect(platform, adapter);
|
|
1365
1422
|
});
|
|
1366
1423
|
}
|
|
1367
1424
|
}, owner = claimGateway(shutdown);
|
|
1368
|
-
process.on("SIGINT", shutdown), process.on("SIGTERM", shutdown), startGatewayPresenter(adapters);
|
|
1369
|
-
let connected = [];
|
|
1370
|
-
startButtonSweeper();
|
|
1425
|
+
process.on("SIGINT", shutdown), process.on("SIGTERM", shutdown), startGatewayPresenter(adapters), startButtonSweeper();
|
|
1371
1426
|
let connect = async (platform, adapter) => {
|
|
1372
1427
|
if (!stopping) {
|
|
1373
1428
|
try {
|
|
1374
|
-
if (platformStatus[platform] = "connecting", owner.update(platformStatus, "starting"), !await adapter.connect())
|
|
1429
|
+
if (platformStatus[platform] = "connecting", owner.update(platformStatus, Object.values(platformStatus).includes("connected") ? "ready" : "starting"), !await adapter.connect())
|
|
1375
1430
|
throw new Error("Connection failed");
|
|
1376
1431
|
adapter.onMessage((event) => {
|
|
1377
1432
|
router.handleEvent(event);
|
|
@@ -1387,9 +1442,9 @@ async function runDaemon() {
|
|
|
1387
1442
|
await adapter.disconnect();
|
|
1388
1443
|
return;
|
|
1389
1444
|
}
|
|
1390
|
-
|
|
1445
|
+
platformStatus[platform] = "connected", console.log(`lunR gateway: ${platform} connected`);
|
|
1391
1446
|
} catch {
|
|
1392
|
-
if (platformStatus[platform] = "disconnected, retrying", await adapter.disconnect().catch(() => {
|
|
1447
|
+
if (platformStatus[platform] = "disconnected, retrying (check gateway logs)", await adapter.disconnect().catch(() => {
|
|
1393
1448
|
}), !stopping) {
|
|
1394
1449
|
let retry = setTimeout(() => {
|
|
1395
1450
|
retries.delete(retry), connect(platform, adapter);
|
|
@@ -1397,18 +1452,18 @@ async function runDaemon() {
|
|
|
1397
1452
|
retries.add(retry);
|
|
1398
1453
|
}
|
|
1399
1454
|
}
|
|
1400
|
-
stopping || owner.update(platformStatus);
|
|
1455
|
+
stopping || owner.update(platformStatus, Object.values(platformStatus).includes("connected") ? "ready" : "starting");
|
|
1401
1456
|
}
|
|
1402
1457
|
};
|
|
1403
1458
|
for (let [platform, adapter] of adapters)
|
|
1404
1459
|
connect(platform, adapter);
|
|
1405
|
-
return cron = startGatewayCron({ adapters, cfg }), console.log(`lunR gateway: cron scheduler started (${cron.intervalMs / 1e3}s interval)`), owner.update(platformStatus), await stopped, 0;
|
|
1460
|
+
return cron = startGatewayCron({ adapters, cfg }), console.log(`lunR gateway: cron scheduler started (${cron.intervalMs / 1e3}s interval)`), owner.update(platformStatus, "starting"), await stopped, 0;
|
|
1406
1461
|
}
|
|
1407
1462
|
async function runGateway(args) {
|
|
1408
1463
|
let [sub, ...rest] = args;
|
|
1409
1464
|
if (sub === "pair") {
|
|
1410
|
-
let [action, platform, code] = rest;
|
|
1411
|
-
return action === "approve" && platform ? runPairApprove(platform, code) : action === "list" ? runPairList() : (console.error("Usage: lunr gateway pair approve <platform> <code> | lunr gateway pair list"), 1);
|
|
1465
|
+
let [action, platform, code, flag] = rest;
|
|
1466
|
+
return action === "approve" && platform && (flag === void 0 || flag === "--owner") ? runPairApprove(platform, code, flag === "--owner") : action === "list" ? runPairList() : (console.error("Usage: lunr gateway pair approve <platform> <code> [--owner] | lunr gateway pair list"), 1);
|
|
1412
1467
|
}
|
|
1413
1468
|
return sub === "status" ? runStatus() : sub === void 0 ? runDaemon() : (console.error(`Unknown gateway sub-command "${sub}". Expected: pair approve | pair list | status`), 1);
|
|
1414
1469
|
}
|
|
@@ -19,7 +19,8 @@ import {
|
|
|
19
19
|
TreeSelectorComponent,
|
|
20
20
|
UserMessageComponent,
|
|
21
21
|
UserMessageSelectorComponent
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-RCR3XAQY.js";
|
|
23
|
+
import "./chunk-KWA4OC2J.js";
|
|
23
24
|
import {
|
|
24
25
|
attachJsonlLineReader,
|
|
25
26
|
runRpcMode,
|
|
@@ -27,8 +28,8 @@ import {
|
|
|
27
28
|
} from "./chunk-IF24A3FH.js";
|
|
28
29
|
import {
|
|
29
30
|
runPrintMode
|
|
30
|
-
} from "./chunk-
|
|
31
|
-
import "./chunk-
|
|
31
|
+
} from "./chunk-D5UCKPBQ.js";
|
|
32
|
+
import "./chunk-U5F4IC7R.js";
|
|
32
33
|
import "./chunk-US544NN6.js";
|
|
33
34
|
import "./chunk-CDVHZOOK.js";
|
|
34
35
|
import {
|
|
@@ -39,13 +40,14 @@ import "./chunk-RWTKOC3B.js";
|
|
|
39
40
|
import "./chunk-7N3YHTYF.js";
|
|
40
41
|
import {
|
|
41
42
|
main
|
|
42
|
-
} from "./chunk-
|
|
43
|
-
import "./chunk-
|
|
44
|
-
import "./chunk-
|
|
43
|
+
} from "./chunk-T4DA4XE7.js";
|
|
44
|
+
import "./chunk-DVQSHCVP.js";
|
|
45
|
+
import "./chunk-L24TPBS4.js";
|
|
46
|
+
import "./chunk-X3PGBLQ7.js";
|
|
45
47
|
import "./chunk-YPHAIRZT.js";
|
|
46
48
|
import "./chunk-PL6JKXWI.js";
|
|
47
49
|
import "./chunk-5ZH3ZFIZ.js";
|
|
48
|
-
import "./chunk-
|
|
50
|
+
import "./chunk-PTFBPO3C.js";
|
|
49
51
|
import {
|
|
50
52
|
AgentSession,
|
|
51
53
|
AgentSessionRuntime,
|
|
@@ -57,10 +59,8 @@ import {
|
|
|
57
59
|
parseSkillBlock,
|
|
58
60
|
wrapRegisteredTool,
|
|
59
61
|
wrapRegisteredTools
|
|
60
|
-
} from "./chunk-
|
|
61
|
-
import "./chunk-CCCN2UCX.js";
|
|
62
|
+
} from "./chunk-LJTIVM7I.js";
|
|
62
63
|
import {
|
|
63
|
-
DefaultPackageManager,
|
|
64
64
|
DefaultResourceLoader,
|
|
65
65
|
createEventBus,
|
|
66
66
|
createExtensionRuntime,
|
|
@@ -70,9 +70,13 @@ import {
|
|
|
70
70
|
loadProjectContextFiles,
|
|
71
71
|
loadSkills,
|
|
72
72
|
loadSkillsFromDir
|
|
73
|
-
} from "./chunk-
|
|
74
|
-
import "./chunk-
|
|
73
|
+
} from "./chunk-SN2KSMPQ.js";
|
|
74
|
+
import "./chunk-CCCN2UCX.js";
|
|
75
|
+
import {
|
|
76
|
+
DefaultPackageManager
|
|
77
|
+
} from "./chunk-RAK2QA2B.js";
|
|
75
78
|
import "./chunk-DVGWF6A2.js";
|
|
79
|
+
import "./chunk-OBMWP3I5.js";
|
|
76
80
|
import {
|
|
77
81
|
parseFrontmatter,
|
|
78
82
|
stripFrontmatter
|
|
@@ -100,7 +104,7 @@ import {
|
|
|
100
104
|
renderDiff,
|
|
101
105
|
truncateToVisualLines,
|
|
102
106
|
withFileMutationQueue
|
|
103
|
-
} from "./chunk-
|
|
107
|
+
} from "./chunk-YWOJIGFY.js";
|
|
104
108
|
import {
|
|
105
109
|
DEFAULT_MAX_BYTES,
|
|
106
110
|
DEFAULT_MAX_LINES,
|
|
@@ -111,21 +115,23 @@ import {
|
|
|
111
115
|
} from "./chunk-53YJI7JU.js";
|
|
112
116
|
import "./chunk-5ZQXRPMC.js";
|
|
113
117
|
import {
|
|
114
|
-
convertToPng
|
|
118
|
+
convertToPng
|
|
119
|
+
} from "./chunk-XHIRAZ26.js";
|
|
120
|
+
import {
|
|
115
121
|
formatDimensionNote,
|
|
116
122
|
resizeImage
|
|
117
|
-
} from "./chunk-
|
|
123
|
+
} from "./chunk-5Q4A37RB.js";
|
|
118
124
|
import {
|
|
119
125
|
AuthStorage,
|
|
120
126
|
ModelRuntime,
|
|
121
127
|
readStoredCredential
|
|
122
128
|
} from "./chunk-KJ6DWS3K.js";
|
|
123
|
-
import "./chunk-
|
|
129
|
+
import "./chunk-SPVDBUOS.js";
|
|
124
130
|
import {
|
|
125
131
|
SettingsManager
|
|
126
|
-
} from "./chunk-
|
|
127
|
-
import "./chunk-
|
|
128
|
-
import "./chunk-
|
|
132
|
+
} from "./chunk-I74LN5JG.js";
|
|
133
|
+
import "./chunk-UOEDI7RP.js";
|
|
134
|
+
import "./chunk-2HMIRK7W.js";
|
|
129
135
|
import {
|
|
130
136
|
ProjectTrustStore,
|
|
131
137
|
hasTrustRequiringProjectResources
|
|
@@ -153,8 +159,9 @@ import {
|
|
|
153
159
|
} from "./chunk-GJ2RDBRL.js";
|
|
154
160
|
import "./chunk-CGBXPL3E.js";
|
|
155
161
|
import "./chunk-BBUVIEZB.js";
|
|
156
|
-
import "./chunk-
|
|
162
|
+
import "./chunk-WIF24I7G.js";
|
|
157
163
|
import "./chunk-M3LZLQW2.js";
|
|
164
|
+
import "./chunk-FY4A63RK.js";
|
|
158
165
|
import "./chunk-KKUTQQV7.js";
|
|
159
166
|
import {
|
|
160
167
|
getShellConfig
|
|
@@ -213,7 +220,7 @@ import {
|
|
|
213
220
|
isToolCallEventType,
|
|
214
221
|
isWriteToolResult
|
|
215
222
|
} from "./chunk-OR4L3IB2.js";
|
|
216
|
-
import "./chunk-
|
|
223
|
+
import "./chunk-B4HP6ZWM.js";
|
|
217
224
|
import {
|
|
218
225
|
parseArgs
|
|
219
226
|
} from "./chunk-E24EO34J.js";
|
|
@@ -8,8 +8,10 @@ import {
|
|
|
8
8
|
updateMetadataCache,
|
|
9
9
|
updateServerMetadata,
|
|
10
10
|
updateStatusBar
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import "./chunk-
|
|
11
|
+
} from "./chunk-4SBQAI4T.js";
|
|
12
|
+
import "./chunk-LWJXTA6Z.js";
|
|
13
|
+
import "./chunk-7IQGBKBJ.js";
|
|
14
|
+
import "./chunk-2IDTZAG5.js";
|
|
13
15
|
import "./chunk-LWYIVUGV.js";
|
|
14
16
|
import "./chunk-4HXHDDCF.js";
|
|
15
17
|
import "./chunk-ARC4KOTI.js";
|
|
@@ -12,10 +12,10 @@ import {
|
|
|
12
12
|
loadInstallFeatures,
|
|
13
13
|
parseFeatureFlags,
|
|
14
14
|
saveInstallFeatures
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-2HMIRK7W.js";
|
|
16
16
|
import {
|
|
17
17
|
loadGatewayConfig
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-B4HP6ZWM.js";
|
|
19
19
|
import {
|
|
20
20
|
APP_NAME,
|
|
21
21
|
NPM_CLI_PACKAGE,
|
|
@@ -132,7 +132,7 @@ async function runSetup(argv) {
|
|
|
132
132
|
for (let id of applied.disabledIds)
|
|
133
133
|
await FEATURE_HANDLERS[id].disable({ purgeSecrets: !1 });
|
|
134
134
|
} else
|
|
135
|
-
return await (await import("./setup-
|
|
135
|
+
return await (await import("./setup-PFBWRNUI.js")).setupGateway(), 0;
|
|
136
136
|
let { installBrowser } = await import("./setup-JBKOLJ6F.js");
|
|
137
137
|
return await installBrowser(!1), saveInstallFeatures(next), appendInstallLog(`setup installerVersion=${VERSION}`), console.log(`Writing ${getAgentDir()}/install-features.json`), console.log(`
|
|
138
138
|
Next:`), console.log(` 1. Restart this shell (or add ${resolveInstallPrefix()}/bin to PATH)`), console.log(` 2. Run: ${APP_NAME}`), console.log(" 3. In the TUI: /login"), 0;
|