@ashx-j/lunr 0.2.23 → 0.2.25
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 +22 -1
- package/README.md +10 -10
- package/dist/builtin-extensions/ashxj-tui.d.ts.map +1 -1
- package/dist/builtin-extensions/ashxj-tui.js +2 -2
- package/dist/builtin-extensions/ashxj-tui.js.map +1 -1
- package/dist/builtin-extensions/lunr-plan-tools.d.ts +7 -7
- package/dist/builtin-extensions/lunr-plan-tools.d.ts.map +1 -1
- package/dist/builtin-extensions/lunr-plan-tools.js +12 -12
- package/dist/builtin-extensions/lunr-plan-tools.js.map +1 -1
- package/dist/builtin-extensions/pi-intercom/index.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-intercom/index.js +2 -0
- package/dist/builtin-extensions/pi-intercom/index.js.map +1 -1
- package/dist/builtin-extensions/pi-mcp-adapter/direct-tools.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-mcp-adapter/direct-tools.js +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/direct-tools.js.map +1 -1
- package/dist/builtin-extensions/pi-mcp-adapter/index.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-mcp-adapter/index.js +1 -1
- package/dist/builtin-extensions/pi-mcp-adapter/index.js.map +1 -1
- 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 +6 -4
- package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/intercom/intercom-bridge.d.ts +2 -0
- package/dist/builtin-extensions/pi-subagents/src/intercom/intercom-bridge.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/intercom/intercom-bridge.js +6 -3
- package/dist/builtin-extensions/pi-subagents/src/intercom/intercom-bridge.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/intercom/native-supervisor-channel.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/intercom/native-supervisor-channel.js +7 -2
- package/dist/builtin-extensions/pi-subagents/src/intercom/native-supervisor-channel.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-execution.d.ts +2 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-execution.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-execution.js +4 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-execution.js.map +1 -1
- 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 +1 -1
- 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 +1 -0
- 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 +5 -1
- 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 +3 -2
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/execution.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.js +19 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.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 +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/child-tools.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/pi-args.d.ts +2 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/pi-args.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/pi-args.js +17 -15
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/pi-args.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-prompt-runtime.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-prompt-runtime.js +3 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-prompt-runtime.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/shared/child-spec.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/shared/child-spec.js +2 -2
- package/dist/builtin-extensions/pi-subagents/src/shared/child-spec.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/shared/types.d.ts +1 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/types.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/shared/types.js.map +1 -1
- package/dist/core/agent-session.d.ts +1 -1
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +5 -4
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/browser/schema.d.ts +1 -1
- package/dist/core/browser/schema.d.ts.map +1 -1
- package/dist/core/browser/schema.js +1 -1
- package/dist/core/browser/schema.js.map +1 -1
- package/dist/core/catalog-cache-scope.d.ts.map +1 -1
- package/dist/core/catalog-cache-scope.js +3 -1
- package/dist/core/catalog-cache-scope.js.map +1 -1
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +3 -2
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/permissions.d.ts +16 -23
- package/dist/core/permissions.d.ts.map +1 -1
- package/dist/core/permissions.js +66 -141
- package/dist/core/permissions.js.map +1 -1
- package/dist/core/plan-mode.d.ts +10 -12
- package/dist/core/plan-mode.d.ts.map +1 -1
- package/dist/core/plan-mode.js +16 -18
- package/dist/core/plan-mode.js.map +1 -1
- package/dist/core/runtime-bridges.d.ts.map +1 -1
- package/dist/core/runtime-bridges.js +2 -0
- package/dist/core/runtime-bridges.js.map +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +13 -6
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +9 -2
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/settings-manager.d.ts +9 -1
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +40 -1
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +4 -4
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/subagent-permission-inherit.d.ts +6 -10
- package/dist/core/subagent-permission-inherit.d.ts.map +1 -1
- package/dist/core/subagent-permission-inherit.js +14 -14
- package/dist/core/subagent-permission-inherit.js.map +1 -1
- package/dist/core/system-prompt.d.ts +2 -0
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +9 -4
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/gateway/adapters/discord.d.ts.map +1 -1
- package/dist/gateway/adapters/discord.js +3 -8
- 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 +2 -6
- package/dist/gateway/approval.d.ts.map +1 -1
- package/dist/gateway/approval.js +3 -7
- package/dist/gateway/approval.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 +39 -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 +2 -2
- 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 +15 -14
- 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 +146 -48
- 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 +96 -42
- 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 +98 -42
- 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/main.d.ts.map +1 -1
- package/dist/main.js +1 -2
- package/dist/main.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 +23 -3
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/thinking-tail.d.ts.map +1 -1
- package/dist/modes/interactive/components/thinking-tail.js +2 -2
- package/dist/modes/interactive/components/thinking-tail.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts +1 -0
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +12 -2
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +1 -2
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +76 -90
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/node-runtime/{agent-session-services-GZVSOGYR.js → agent-session-services-YXXFCP5J.js} +12 -12
- package/dist/node-runtime/{builtin-extensions-QVCXNQT4.js → builtin-extensions-ZLAX7TUH.js} +3 -3
- package/dist/node-runtime/{chunk-W64JC4E7.js → chunk-2HHLJWGD.js} +3 -87
- package/dist/node-runtime/{chunk-VWCE2HSZ.js → chunk-2HMIRK7W.js} +4 -4
- package/dist/node-runtime/{chunk-XLTL257W.js → chunk-2KIPT4HJ.js} +5 -1
- package/dist/node-runtime/{chunk-RIR5EDDJ.js → chunk-3XPLBUEM.js} +17 -12
- package/dist/node-runtime/{chunk-QAZOULTU.js → chunk-6XL67VVY.js} +40 -6
- package/dist/node-runtime/chunk-7S3T6YEA.js +97 -0
- package/dist/node-runtime/{chunk-R3K2F5GI.js → chunk-B4HP6ZWM.js} +2 -0
- package/dist/node-runtime/{chunk-TQGPP4SC.js → chunk-CDVHZOOK.js} +1 -1
- package/dist/node-runtime/{chunk-YJMMG7C6.js → chunk-DSIKTUPW.js} +1 -1
- package/dist/node-runtime/{chunk-LFZDVKSP.js → chunk-E4D3IGP2.js} +41 -25
- package/dist/node-runtime/{chunk-OFKSVRV7.js → chunk-GYIXXQAO.js} +1 -1
- package/dist/node-runtime/{chunk-BX2RB477.js → chunk-HFVZUPFJ.js} +1 -1
- package/dist/node-runtime/{chunk-AZJHNQKQ.js → chunk-I54LGHWM.js} +1 -1
- package/dist/node-runtime/{chunk-YHQ3NBB3.js → chunk-IJIFHRTB.js} +20 -18
- package/dist/node-runtime/{chunk-GS66LV4M.js → chunk-KJ6DWS3K.js} +4 -4
- package/dist/node-runtime/{chunk-HPUP7E4T.js → chunk-KWIYUUZK.js} +68 -42
- package/dist/node-runtime/{chunk-TVJUOJZJ.js → chunk-LQP3RB67.js} +184 -1527
- package/dist/node-runtime/{chunk-VSELYKWU.js → chunk-LWYIVUGV.js} +2 -1
- package/dist/node-runtime/{chunk-JHYKXIMM.js → chunk-MPKSOJBT.js} +1 -1
- package/dist/node-runtime/{chunk-GMHJCCEN.js → chunk-NRKGMJYU.js} +4 -1
- package/dist/node-runtime/{chunk-CSUZVNYE.js → chunk-OVX6X377.js} +10 -6
- package/dist/node-runtime/{chunk-DD5YWFSJ.js → chunk-QTU6AKNJ.js} +130 -65
- package/dist/node-runtime/{chunk-LLUIPGDR.js → chunk-RC7DMV45.js} +110 -77
- package/dist/node-runtime/{chunk-UWPJL22I.js → chunk-SLVOAQOY.js} +15 -4
- package/dist/node-runtime/{chunk-EKVFP6YF.js → chunk-TORR5XBV.js} +17 -16
- package/dist/node-runtime/{chunk-UP2XBVH5.js → chunk-UOEDI7RP.js} +1 -1
- package/dist/node-runtime/{chunk-DQMGU675.js → chunk-VQFSUJJG.js} +20 -17
- package/dist/node-runtime/{chunk-X3URCYCU.js → chunk-WF7PGWRZ.js} +14 -14
- package/dist/node-runtime/chunk-YCUZEGJG.js +1361 -0
- package/dist/node-runtime/{chunk-5D7LC2ZQ.js → chunk-ZXSGTGJ6.js} +54 -85
- package/dist/node-runtime/cli-runtime.js +1 -1
- package/dist/node-runtime/{command-PDVTBRWA.js → command-6WDOYKS6.js} +5 -5
- package/dist/node-runtime/{commands-KAMO2T6P.js → commands-NZLSOHPE.js} +2 -2
- package/dist/node-runtime/{commands-XDCFGIGW.js → commands-QC6VUZJQ.js} +9 -9
- package/dist/node-runtime/{config-RORQUQFG.js → config-D4QUPAHX.js} +1 -1
- package/dist/node-runtime/{direct-tool-executor-YAVOLDFY.js → direct-tool-executor-77GW4F5P.js} +3 -3
- package/dist/node-runtime/{export-html-KSOIMVPI.js → export-html-VM4J2MNR.js} +1 -1
- package/dist/node-runtime/{gateway-AYWM5DIO.js → gateway-INAYBF4Q.js} +141 -85
- package/dist/node-runtime/index.js +23 -21
- package/dist/node-runtime/{init-X2LIUB2H.js → init-HS6NQXSK.js} +2 -2
- package/dist/node-runtime/{install-cli-3BO4MMQ6.js → install-cli-KL4UDDAD.js} +3 -3
- package/dist/node-runtime/{interactive-mode-4MFRKAHG.js → interactive-mode-Z5M7WYYZ.js} +14 -14
- package/dist/node-runtime/{interactive-view-TUZHCQM3.js → interactive-view-NGFAMHPW.js} +2 -2
- package/dist/node-runtime/{lunr-browser-RYFIIVJN.js → lunr-browser-IR7TL3J7.js} +4 -4
- package/dist/node-runtime/{lunr-cron-YWXEPZMQ.js → lunr-cron-LWIZJM2N.js} +8 -8
- package/dist/node-runtime/main.js +19 -18
- package/dist/node-runtime/{mobile-commands-LVHDAUDP.js → mobile-commands-J7OJEKFO.js} +6 -6
- package/dist/node-runtime/{model-runtime-PLQKAG4B.js → model-runtime-OO5HFLWE.js} +1 -1
- package/dist/node-runtime/{package-manager-cli-6GT3Z3CK.js → package-manager-cli-VYZM5WHN.js} +10 -8
- package/dist/node-runtime/{pi-intercom-HBPK5HSJ.js → pi-intercom-QM53RLTS.js} +2 -0
- package/dist/node-runtime/{pi-mcp-adapter-E6WULBKF.js → pi-mcp-adapter-5UKBZP44.js} +7 -6
- package/dist/node-runtime/{pi-subagents-CDWK2AKY.js → pi-subagents-DNY7EAIG.js} +23 -13
- package/dist/node-runtime/{proxy-modes-OSQCWRBI.js → proxy-modes-LGEUYD7R.js} +3 -3
- package/dist/node-runtime/rpc-entry.js +19 -18
- package/dist/node-runtime/{runtime-bridges-3XUQ46XW.js → runtime-bridges-VRDDR73P.js} +8 -1
- package/dist/node-runtime/{service-ISSP6VHE.js → service-MDQIPQ26.js} +1 -1
- package/dist/node-runtime/{session-handoff-HC7R5E24.js → session-handoff-GWARVEWT.js} +2 -2
- package/dist/node-runtime/{session-manager-CFN4UFM2.js → session-manager-JB5J6XBN.js} +1 -1
- package/dist/node-runtime/{settings-manager-6VEMXRDL.js → settings-manager-J4SPQPDJ.js} +10 -7
- package/dist/node-runtime/setup-CQ2NLVK5.js +214 -0
- package/dist/node-runtime/{subagent-executor-M5VWB3D3.js → subagent-executor-KZZQGAKV.js} +40 -7
- package/dist/node-runtime/{update-cli-UVKJWRRJ.js → update-cli-GTFJC7XK.js} +4 -5
- package/dist/startup/interactive-view.d.ts.map +1 -1
- package/dist/startup/interactive-view.js +5 -1
- package/dist/startup/interactive-view.js.map +1 -1
- package/docs/browser.md +1 -1
- package/docs/features.md +19 -18
- package/docs/index.md +1 -1
- package/docs/keybindings.md +1 -1
- package/docs/providers.md +6 -2
- package/docs/quickstart.md +2 -2
- package/docs/settings.md +1 -1
- package/docs/usage.md +4 -4
- 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/plan-mode/README.md +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/package.json +4 -4
- package/dist/node-runtime/chunk-LISUTZS3.js +0 -19
- package/dist/node-runtime/setup-5SR2J35A.js +0 -155
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
import { createRequire as __lunrRequire } from "node:module"; const require = __lunrRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
readSecret
|
|
4
|
-
} from "./chunk-H4K3JDRB.js";
|
|
5
|
-
import {
|
|
6
|
-
createPairingStore
|
|
7
|
-
} from "./chunk-RMQZU2YU.js";
|
|
8
|
-
import {
|
|
9
|
-
configureStartup,
|
|
10
|
-
loadServiceSettings,
|
|
11
|
-
startGatewayService
|
|
12
|
-
} from "./chunk-UWPJL22I.js";
|
|
13
|
-
import {
|
|
14
|
-
loadInstallFeatures,
|
|
15
|
-
saveInstallFeatures
|
|
16
|
-
} from "./chunk-VWCE2HSZ.js";
|
|
17
|
-
import {
|
|
18
|
-
loadGatewayConfig,
|
|
19
|
-
saveGatewayConfig
|
|
20
|
-
} from "./chunk-R3K2F5GI.js";
|
|
21
|
-
import "./chunk-FQMM2EZ2.js";
|
|
22
|
-
import "./chunk-Q4Q6D4IY.js";
|
|
23
|
-
import "./chunk-BRJX2PRC.js";
|
|
24
|
-
|
|
25
|
-
// packages/coding-agent/dist/gateway/setup.js
|
|
26
|
-
import { existsSync, realpathSync, statSync } from "node:fs";
|
|
27
|
-
import { resolve } from "node:path";
|
|
28
|
-
import { createInterface } from "node:readline/promises";
|
|
29
|
-
async function validateBotToken(platform, token) {
|
|
30
|
-
let url = platform === "telegram" ? `https://api.telegram.org/bot${token}/getMe` : "https://discord.com/api/v10/users/@me", response;
|
|
31
|
-
try {
|
|
32
|
-
response = await fetch(url, {
|
|
33
|
-
headers: platform === "discord" ? { Authorization: `Bot ${token}` } : {},
|
|
34
|
-
signal: AbortSignal.timeout(15e3)
|
|
35
|
-
});
|
|
36
|
-
} catch {
|
|
37
|
-
throw new Error(`${platform}: could not reach the bot API. Check your connection and try again.`);
|
|
38
|
-
}
|
|
39
|
-
if (!response.ok)
|
|
40
|
-
throw new Error(`${platform}: token check failed with HTTP ${response.status}. Check the token and bot permissions.`);
|
|
41
|
-
let value = await response.json();
|
|
42
|
-
if (!value || typeof value != "object")
|
|
43
|
-
throw new Error(`${platform}: unexpected bot API response.`);
|
|
44
|
-
let user = platform === "telegram" && "result" in value ? value.result : value;
|
|
45
|
-
if (!user || typeof user != "object" || !("id" in user))
|
|
46
|
-
throw new Error(`${platform}: bot identity was missing.`);
|
|
47
|
-
return "username" in user && typeof user.username == "string" ? user.username : String(user.id);
|
|
48
|
-
}
|
|
49
|
-
async function setupGateway() {
|
|
50
|
-
if (!process.stdin.isTTY || !process.stdout.isTTY)
|
|
51
|
-
throw new Error("Run lunr gateway setup in a terminal. Bot tokens are entered privately, not as command arguments.");
|
|
52
|
-
let rl = createInterface({ input: process.stdin, output: process.stdout }), ask = async (question, fallback = "") => (await rl.question(`${question}${fallback ? ` [${fallback}]` : ""}: `)).trim() || fallback, cfg = loadGatewayConfig();
|
|
53
|
-
try {
|
|
54
|
-
console.log(`Set up lunR on your phone
|
|
55
|
-
Your computer must stay awake and connected to the internet. Press Ctrl+C to cancel.
|
|
56
|
-
`);
|
|
57
|
-
let choice = (await ask("Connect telegram, discord, or both", cfg.discord.enabled ? cfg.telegram.enabled ? "both" : "discord" : "telegram")).toLowerCase();
|
|
58
|
-
if (!["telegram", "discord", "both"].includes(choice))
|
|
59
|
-
throw new Error("Choose telegram, discord, or both.");
|
|
60
|
-
for (let platform of ["telegram", "discord"]) {
|
|
61
|
-
if (choice !== platform && choice !== "both")
|
|
62
|
-
continue;
|
|
63
|
-
console.log(platform === "telegram" ? `
|
|
64
|
-
Telegram
|
|
65
|
-
1. Open https://t.me/BotFather and send /newbot.
|
|
66
|
-
2. Follow its prompts and copy the bot token.
|
|
67
|
-
3. Open your new bot and send /whoami. After startup it will show your user ID and pairing code.
|
|
68
|
-
Guide: https://core.telegram.org/bots/tutorial` : `
|
|
69
|
-
Discord
|
|
70
|
-
1. Open https://discord.com/developers/applications and create an application.
|
|
71
|
-
2. Open Bot, create or reset its token, and enable Message Content Intent for ordinary chat.
|
|
72
|
-
3. Under Installation, add bot and applications.commands scopes. Grant View Channels, Send Messages, Read Message History, Attach Files, and thread permissions if needed.
|
|
73
|
-
4. Use the install link to add your bot. In Discord, enable Developer Mode and copy your user ID.
|
|
74
|
-
Guide: https://docs.discord.com/developers/quick-start/getting-started`);
|
|
75
|
-
let token = cfg[platform].token;
|
|
76
|
-
if (!token || await ask("Replace the saved token? yes/no", "no") === "yes") {
|
|
77
|
-
rl.close();
|
|
78
|
-
try {
|
|
79
|
-
token = (await readSecret(`${platform} bot token`))?.trim();
|
|
80
|
-
} finally {
|
|
81
|
-
rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
if (!token)
|
|
85
|
-
throw new Error("No token entered. Existing configuration was not changed.");
|
|
86
|
-
console.log(`Connected bot: ${await validateBotToken(platform, token)}`), cfg[platform].token = token, cfg[platform].enabled = !0, cfg.owners ??= { telegram: [], discord: [] };
|
|
87
|
-
let owner = await ask(`Your ${platform} user ID, or leave empty to pair after startup`, cfg.owners[platform][0] ?? "");
|
|
88
|
-
if (owner && !/^\d+$/.test(owner))
|
|
89
|
-
throw new Error("User IDs contain digits only.");
|
|
90
|
-
owner && (cfg.owners[platform] = [.../* @__PURE__ */ new Set([...cfg.owners[platform], owner])], cfg[platform].allowedUsers = [.../* @__PURE__ */ new Set([...cfg[platform].allowedUsers, owner])]);
|
|
91
|
-
}
|
|
92
|
-
let root = await ask("Project folder you want to browse from your phone", cfg.projectRoots?.[0] ?? process.cwd()), path = resolve(root);
|
|
93
|
-
if (!existsSync(path) || !statSync(path).isDirectory())
|
|
94
|
-
throw new Error("That project folder does not exist.");
|
|
95
|
-
cfg.projectRoots = [.../* @__PURE__ */ new Set([...cfg.projectRoots ?? [], realpathSync(path)])];
|
|
96
|
-
let startup = await ask("Automatic startup: off, login, or boot", "off");
|
|
97
|
-
if (!["off", "login", "boot"].includes(startup))
|
|
98
|
-
throw new Error("Choose off, login, or boot.");
|
|
99
|
-
startup === "boot" && console.log("Boot startup may require administrator permission or OS-managed account credentials. lunR does not save your account password.");
|
|
100
|
-
let [{ ModelRuntime }, { SettingsManager }] = await Promise.all([
|
|
101
|
-
import("./model-runtime-PLQKAG4B.js"),
|
|
102
|
-
import("./settings-manager-6VEMXRDL.js")
|
|
103
|
-
]), models = await (await ModelRuntime.create({ allowModelNetwork: !1 })).getAvailable();
|
|
104
|
-
if (!models.length)
|
|
105
|
-
throw new Error("No saved model credentials found. Open lunr locally and use /login, then rerun gateway setup. Nothing saved.");
|
|
106
|
-
let settings = SettingsManager.create(process.cwd()), providers = [...new Set(models.map((model2) => model2.provider))];
|
|
107
|
-
console.log(`Saved providers: ${providers.join(", ")}`);
|
|
108
|
-
let provider = await ask("Model provider", settings.getDefaultProvider() ?? providers[0]), choices = models.filter((model2) => model2.provider === provider);
|
|
109
|
-
if (!choices.length)
|
|
110
|
-
throw new Error("Choose one of the saved providers. Nothing saved.");
|
|
111
|
-
console.log(choices.map((model2, index) => `${index + 1}. ${model2.id}`).join(`
|
|
112
|
-
`));
|
|
113
|
-
let selected = await ask("Model number or ID", choices.find((model2) => model2.id === settings.getDefaultModel())?.id ?? choices[0].id), model = choices.find((model2) => model2.id === selected) ?? choices[Number(selected) - 1];
|
|
114
|
-
if (!model)
|
|
115
|
-
throw new Error("Choose a model from the list. Nothing saved.");
|
|
116
|
-
if (await ask("Save these settings? yes/no", "yes") !== "yes") {
|
|
117
|
-
console.log("Cancelled. Nothing saved.");
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
saveGatewayConfig(cfg), settings.setDefaultModelAndProvider(model.provider, model.id);
|
|
121
|
-
let features = loadInstallFeatures();
|
|
122
|
-
features.features["chat-platforms"] = {
|
|
123
|
-
enabled: !0,
|
|
124
|
-
options: {
|
|
125
|
-
...features.features["chat-platforms"]?.options,
|
|
126
|
-
autostart: loadServiceSettings().startup !== "off"
|
|
127
|
-
}
|
|
128
|
-
}, saveInstallFeatures(features);
|
|
129
|
-
try {
|
|
130
|
-
await configureStartup(startup);
|
|
131
|
-
} finally {
|
|
132
|
-
features.features["chat-platforms"].options.autostart = loadServiceSettings().startup !== "off", saveInstallFeatures(features);
|
|
133
|
-
}
|
|
134
|
-
await ask("Start the gateway now? yes/no", "yes") === "yes" && console.log(await startGatewayService()), console.log(`
|
|
135
|
-
Send /whoami to your bot. To approve your own pairing code with access to projects and TUI sessions, run:
|
|
136
|
-
lunr gateway pair approve <telegram|discord> <code> --owner
|
|
137
|
-
Then use /project, /sessions, or /continue on your phone.`);
|
|
138
|
-
} finally {
|
|
139
|
-
rl.close();
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
function approveGatewayOwner(platform, code) {
|
|
143
|
-
if (platform !== "telegram" && platform !== "discord")
|
|
144
|
-
throw new Error("Choose telegram or discord.");
|
|
145
|
-
let user = createPairingStore().approve(platform, code);
|
|
146
|
-
if (!user)
|
|
147
|
-
throw new Error("Pairing code is invalid or expired.");
|
|
148
|
-
let cfg = loadGatewayConfig();
|
|
149
|
-
return cfg.owners ??= { telegram: [], discord: [] }, cfg.owners[platform] = [.../* @__PURE__ */ new Set([...cfg.owners[platform], user])], cfg[platform].allowedUsers = [.../* @__PURE__ */ new Set([...cfg[platform].allowedUsers, user])], saveGatewayConfig(cfg), `Approved ${platform} owner ${user}. Owner access includes local projects and TUI session history.`;
|
|
150
|
-
}
|
|
151
|
-
export {
|
|
152
|
-
approveGatewayOwner,
|
|
153
|
-
setupGateway,
|
|
154
|
-
validateBotToken
|
|
155
|
-
};
|