@ashx-j/lunr-dev 0.2.16-dev.9.1 → 0.2.19-dev.10.1
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 +32 -1
- package/README.md +7 -1
- package/dist/builtin-extensions/ashxj-thinking.d.ts +1 -0
- package/dist/builtin-extensions/ashxj-thinking.d.ts.map +1 -1
- package/dist/builtin-extensions/ashxj-thinking.js +44 -19
- package/dist/builtin-extensions/ashxj-thinking.js.map +1 -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 +157 -0
- package/dist/builtin-extensions/lunr-computer-use.js.map +1 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/index.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-lsp-extension/src/index.js +10 -3
- package/dist/builtin-extensions/pi-lsp-extension/src/index.js.map +1 -1
- package/dist/builtin-extensions/pi-lsp-extension/src/runtime.d.ts +5 -1
- package/dist/builtin-extensions/pi-lsp-extension/src/runtime.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-lsp-extension/src/runtime.js +26 -4
- package/dist/builtin-extensions/pi-lsp-extension/src/runtime.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 +37 -27
- package/dist/builtin-extensions/pi-mcp-adapter/index.js.map +1 -1
- package/dist/builtin-extensions/pi-mcp-adapter/server-manager.d.ts +6 -1
- package/dist/builtin-extensions/pi-mcp-adapter/server-manager.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-mcp-adapter/server-manager.js +33 -8
- package/dist/builtin-extensions/pi-mcp-adapter/server-manager.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/index.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/index.js +52 -23
- package/dist/builtin-extensions/pi-subagents/src/extension/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 +6 -2
- package/dist/builtin-extensions/pi-subagents/src/extension/schemas.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.d.ts +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.js +5 -2
- package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/request-params.d.ts +10 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/request-params.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/request-params.js +38 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/request-params.js.map +1 -0
- 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 +3 -16
- 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 +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/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 +70 -30
- package/dist/builtin-extensions/pi-subagents/src/tui/render.js.map +1 -1
- package/dist/builtin-extensions/pi-web-access/index.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-web-access/index.js +103 -102
- package/dist/builtin-extensions/pi-web-access/index.js.map +1 -1
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +1 -1
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/computer-use/adapter.d.ts +23 -0
- package/dist/core/computer-use/adapter.d.ts.map +1 -0
- package/dist/core/computer-use/adapter.js +116 -0
- package/dist/core/computer-use/adapter.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 +66 -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 +88 -0
- package/dist/core/computer-use/schemas.d.ts.map +1 -0
- package/dist/core/computer-use/schemas.js +80 -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 +24 -0
- package/dist/core/computer-use/workflow.d.ts.map +1 -0
- package/dist/core/computer-use/workflow.js +330 -0
- package/dist/core/computer-use/workflow.js.map +1 -0
- package/dist/core/keybindings.d.ts +2 -2
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +2 -2
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/model-runtime.d.ts +0 -3
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +1 -10
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +1 -1
- package/dist/core/package-manager.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 +23 -7
- 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/rollback.d.ts.map +1 -1
- package/dist/core/rollback.js +13 -90
- package/dist/core/rollback.js.map +1 -1
- package/dist/core/session-manager.d.ts +0 -1
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +21 -79
- package/dist/core/session-manager.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/dev-cli.js +0 -0
- package/dist/gateway/agent-bridge.d.ts +6 -1
- package/dist/gateway/agent-bridge.d.ts.map +1 -1
- package/dist/gateway/agent-bridge.js +23 -6
- package/dist/gateway/agent-bridge.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 +23 -7
- package/dist/gateway/cron.js.map +1 -1
- package/dist/modes/interactive/components/footer.d.ts +4 -2
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +23 -32
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/processes-selector.d.ts +2 -3
- package/dist/modes/interactive/components/processes-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/processes-selector.js +5 -10
- package/dist/modes/interactive/components/processes-selector.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 +18 -8
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/thinking-level-slash.d.ts +4 -0
- package/dist/modes/interactive/thinking-level-slash.d.ts.map +1 -0
- package/dist/modes/interactive/thinking-level-slash.js +23 -0
- package/dist/modes/interactive/thinking-level-slash.js.map +1 -0
- package/dist/node-runtime/adapter-AZMY335J.js +279 -0
- package/dist/node-runtime/{agent-session-services-IFJMSX7Z.js → agent-session-services-RSGP5GDN.js} +15 -12
- package/dist/node-runtime/{builtin-extensions-LYZ3BFWQ.js → builtin-extensions-7STLFW3A.js} +4 -3
- package/dist/node-runtime/chunk-2IDTZAG5.js +1415 -0
- package/dist/node-runtime/{chunk-7NBZ5P7I.js → chunk-4SJWFTUP.js} +1 -1
- package/dist/node-runtime/{chunk-AJX357CL.js → chunk-5NWQCSKR.js} +20 -1013
- package/dist/node-runtime/chunk-5OLJGVCB.js +68 -0
- package/dist/node-runtime/chunk-5Q45AVQG.js +108 -0
- package/dist/node-runtime/{chunk-TQNSPERU.js → chunk-5SQDLSZJ.js} +1 -1
- package/dist/node-runtime/{chunk-F4VQFJI2.js → chunk-6SPPH4FY.js} +4 -4
- package/dist/node-runtime/{chunk-PBC2Y6GS.js → chunk-6UB6NKA3.js} +29 -72
- package/dist/node-runtime/{chunk-A2KQXUJD.js → chunk-7AFOFSDY.js} +1 -1
- package/dist/node-runtime/chunk-BKAZ6BKX.js +2185 -0
- package/dist/node-runtime/{chunk-AHSTJBIB.js → chunk-EH2LJQPM.js} +4 -4
- package/dist/node-runtime/{chunk-N77MY65L.js → chunk-FLYMHKCS.js} +25 -25
- package/dist/node-runtime/{chunk-5P7PZMRU.js → chunk-HRS4HMDX.js} +1 -1
- package/dist/node-runtime/{chunk-IPA627GP.js → chunk-ISQDQIZN.js} +4 -4
- package/dist/node-runtime/{chunk-WJVFOIB5.js → chunk-J7QGQD45.js} +1 -1
- package/dist/node-runtime/{chunk-WOVTOV5P.js → chunk-JT6YCS5B.js} +29 -34
- package/dist/node-runtime/chunk-JZHEUQRL.js +180 -0
- package/dist/node-runtime/{chunk-ZKMFUD3Q.js → chunk-K72NVGUB.js} +3 -3
- package/dist/node-runtime/{chunk-ECD5L7YI.js → chunk-LCACDWHJ.js} +389 -15
- package/dist/node-runtime/{chunk-2QKLKMKC.js → chunk-LTXUQJI4.js} +1 -1
- package/dist/node-runtime/{chunk-MKKH27PH.js → chunk-LWJXTA6Z.js} +274 -2416
- package/dist/node-runtime/{chunk-EDBJNRSM.js → chunk-MGSB2C3M.js} +1 -1
- package/dist/node-runtime/{chunk-CDFZEWPU.js → chunk-MUMMMTW4.js} +6 -2
- package/dist/node-runtime/{chunk-YF63P5ZT.js → chunk-OTT6JMPU.js} +10 -67
- package/dist/node-runtime/{chunk-PGAJ5MO5.js → chunk-T5GM5BFH.js} +1 -1
- package/dist/node-runtime/{chunk-PCGNAY2O.js → chunk-TAP7QTUT.js} +38 -16
- package/dist/node-runtime/{chunk-4TLO4PO2.js → chunk-U6C7VTR5.js} +7 -1401
- package/dist/node-runtime/chunk-URD2SLIT.js +1019 -0
- package/dist/node-runtime/{chunk-QH42CDX3.js → chunk-W7S2REEG.js} +111 -84
- package/dist/node-runtime/{chunk-LZAW4ZX3.js → chunk-ZRDIMBEQ.js} +27 -9
- package/dist/node-runtime/{chunk-AD6VXAO7.js → chunk-ZSEZY3II.js} +5 -100
- package/dist/node-runtime/cli-runtime.js +1 -1
- package/dist/node-runtime/{command-L3LAHDIH.js → command-6UXQ6XZN.js} +1 -1
- package/dist/node-runtime/{commands-RL5YBW5I.js → commands-LGR5VT5X.js} +6 -4
- package/dist/node-runtime/{direct-tool-executor-JVDXTO7A.js → direct-tool-executor-TDJS7TBD.js} +9 -6
- package/dist/node-runtime/{export-html-KR26FOUZ.js → export-html-E4DT6ZJQ.js} +1 -1
- package/dist/node-runtime/{extract-XLQSJN4V.js → extract-IUCVZCWC.js} +2 -2
- package/dist/node-runtime/{gateway-X2TI5X7F.js → gateway-3OLC4GQN.js} +22 -367
- package/dist/node-runtime/{gemini-search-U7SUMPQA.js → gemini-search-NCIDF7NE.js} +1 -1
- package/dist/node-runtime/{gemini-url-context-PXWCBQHK.js → gemini-url-context-OKIN7AIP.js} +2 -2
- package/dist/node-runtime/image-resize-6ZPBFMWW.js +11 -0
- package/dist/node-runtime/index.js +53 -49
- package/dist/node-runtime/{init-NJV2T55N.js → init-EKE277AG.js} +6 -4
- package/dist/node-runtime/{interactive-mode-KOM35YF2.js → interactive-mode-S5M26CQ7.js} +20 -17
- package/dist/node-runtime/{interactive-view-U6OILKF3.js → interactive-view-N6F4KUIT.js} +3 -5
- package/dist/node-runtime/lunr-computer-use-4X3KUNF4.js +206 -0
- package/dist/node-runtime/{lunr-cron-YJ5UHYRD.js → lunr-cron-KKBOGAEF.js} +7 -1
- package/dist/node-runtime/main.js +24 -21
- package/dist/node-runtime/{mcp-auth-flow-QIXHW6QN.js → mcp-auth-flow-YL6RWPYG.js} +2 -1
- package/dist/node-runtime/{package-manager-cli-TZZHJCVI.js → package-manager-cli-C4EJOO5Q.js} +8 -6
- package/dist/node-runtime/{pi-mcp-adapter-QFB37AVN.js → pi-mcp-adapter-DPTJGAAL.js} +33 -27
- package/dist/node-runtime/{pi-subagents-7XJ4H53P.js → pi-subagents-VKCLYIBY.js} +103 -76
- package/dist/node-runtime/{pi-web-access-DPGAVKOA.js → pi-web-access-BV6DSZOP.js} +72 -69
- package/dist/node-runtime/{proxy-modes-HEEFK4KC.js → proxy-modes-R64LU6WZ.js} +12 -9
- package/dist/node-runtime/rpc-entry.js +24 -21
- package/dist/node-runtime/runtime-3SB5ATHQ.js +21 -0
- package/dist/node-runtime/{runtime-bridges-PPHNBFWL.js → runtime-bridges-UJ5WJJLN.js} +3 -3
- package/dist/node-runtime/{session-manager-MQNBYACL.js → session-manager-QEMZBMTM.js} +3 -5
- package/dist/node-runtime/{session-selector-5AZLJS6U.js → session-selector-URVJLOTK.js} +2 -2
- package/dist/node-runtime/{settings-manager-5LF2VQWC.js → settings-manager-K6IPIQTI.js} +3 -1
- package/dist/node-runtime/{src-Y7JSCK64.js → src-GPFAU3N6.js} +30 -10
- package/dist/node-runtime/{subagent-executor-5RNDEPIJ.js → subagent-executor-EFLTO32A.js} +39 -21
- package/dist/node-runtime/{update-cli-A253SZ7P.js → update-cli-I6OVDRPL.js} +3 -1
- package/dist/node-runtime/{video-extract-OYT5WKS5.js → video-extract-ETA5RA7U.js} +2 -2
- package/dist/node-runtime/workflow-SA34S4VX.js +325 -0
- package/dist/node-runtime/{youtube-extract-TQYKGFGS.js → youtube-extract-SRVGNN26.js} +2 -2
- package/dist/rpc.d.ts +3 -0
- package/dist/rpc.d.ts.map +1 -0
- package/dist/rpc.js +18 -0
- package/dist/rpc.js.map +1 -0
- package/dist/startup/interactive-view.d.ts.map +1 -1
- package/dist/startup/interactive-view.js +1 -2
- package/dist/startup/interactive-view.js.map +1 -1
- package/docs/computer-use.md +277 -0
- package/docs/development.md +0 -32
- package/docs/features.md +2 -2
- package/docs/interactive-startup.md +10 -3
- package/docs/keybindings.md +2 -2
- package/docs/terminal-setup.md +1 -1
- package/docs/usage.md +1 -1
- 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/hidden-thinking-label.ts +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 +3827 -0
- package/install-lock/package.json +18 -0
- package/native/computer-use/LICENSE.md +21 -0
- package/npm-shrinkwrap.json +3808 -0
- package/package.json +16 -10
- package/dist/startup/interactive-shell.d.ts +0 -55
- package/dist/startup/interactive-shell.d.ts.map +0 -1
- package/dist/startup/interactive-shell.js +0 -264
- package/dist/startup/interactive-shell.js.map +0 -1
- package/dist/node-runtime/{chunk-YSKSB3BJ.js → chunk-CH6OL6P2.js} +2 -2
- package/dist/node-runtime/{chunk-VSELYKWU.js → chunk-EHMBW7FA.js} +3 -3
package/dist/node-runtime/{direct-tool-executor-JVDXTO7A.js → direct-tool-executor-TDJS7TBD.js}
RENAMED
|
@@ -6,25 +6,28 @@ import {
|
|
|
6
6
|
resolveMcpOutputGuardOptions,
|
|
7
7
|
resolveMcpResultContent,
|
|
8
8
|
transformMcpContent
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-6SPPH4FY.js";
|
|
10
10
|
import {
|
|
11
11
|
formatSchema,
|
|
12
12
|
getFailureAgeSeconds,
|
|
13
13
|
lazyConnect
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-BKAZ6BKX.js";
|
|
15
15
|
import {
|
|
16
16
|
abortable,
|
|
17
17
|
formatAuthRequiredMessage,
|
|
18
18
|
throwIfAborted
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-EHMBW7FA.js";
|
|
20
|
+
import "./chunk-ARC4KOTI.js";
|
|
21
|
+
import "./chunk-LWJXTA6Z.js";
|
|
20
22
|
import {
|
|
21
|
-
UrlElicitationRequiredError,
|
|
22
23
|
authenticate,
|
|
23
24
|
supportsOAuth
|
|
24
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-U6C7VTR5.js";
|
|
25
26
|
import "./chunk-4HXHDDCF.js";
|
|
27
|
+
import {
|
|
28
|
+
UrlElicitationRequiredError
|
|
29
|
+
} from "./chunk-2IDTZAG5.js";
|
|
26
30
|
import "./chunk-BI3DHYCN.js";
|
|
27
|
-
import "./chunk-ARC4KOTI.js";
|
|
28
31
|
import "./chunk-Q4Q6D4IY.js";
|
|
29
32
|
import "./chunk-BRJX2PRC.js";
|
|
30
33
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire as __lunrRequire } from "node:module"; const require = __lunrRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
SessionManager
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-6UB6NKA3.js";
|
|
5
5
|
import "./chunk-FVDOXRUD.js";
|
|
6
6
|
import {
|
|
7
7
|
getResolvedThemeColors,
|
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
extractHeadingTitle,
|
|
5
5
|
fetchAllContent,
|
|
6
6
|
loadSsrfAllowRanges
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-J7QGQD45.js";
|
|
8
|
+
import "./chunk-4SJWFTUP.js";
|
|
9
9
|
import "./chunk-DAPBPCBP.js";
|
|
10
10
|
import "./chunk-VRB2IYGG.js";
|
|
11
11
|
import "./chunk-BRJX2PRC.js";
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { createRequire as __lunrRequire } from "node:module"; const require = __lunrRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
|
-
|
|
3
|
+
AgentBridge,
|
|
4
|
+
QUEUED,
|
|
5
|
+
listSessions,
|
|
4
6
|
splitMessage,
|
|
5
7
|
startGatewayCron
|
|
6
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-LCACDWHJ.js";
|
|
7
9
|
import {
|
|
8
10
|
gatewayConfigPath,
|
|
9
11
|
isFeatureEnabled,
|
|
@@ -15,25 +17,23 @@ import {
|
|
|
15
17
|
import "./chunk-CJECDQKP.js";
|
|
16
18
|
import {
|
|
17
19
|
computeContextBreakdown
|
|
18
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-7AFOFSDY.js";
|
|
19
21
|
import {
|
|
20
22
|
findExactModelReferenceMatch
|
|
21
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-5SQDLSZJ.js";
|
|
22
24
|
import "./chunk-CGBXPL3E.js";
|
|
23
|
-
import
|
|
24
|
-
processImage
|
|
25
|
-
} from "./chunk-AD6VXAO7.js";
|
|
25
|
+
import "./chunk-5Q45AVQG.js";
|
|
26
26
|
import {
|
|
27
27
|
NO_HANDLER_REASON,
|
|
28
|
-
createPermissionContext,
|
|
29
|
-
deletePermissionContext,
|
|
30
28
|
registerApprovalHandler
|
|
31
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-ZRDIMBEQ.js";
|
|
32
30
|
import "./chunk-M3LZLQW2.js";
|
|
31
|
+
import "./chunk-5OLJGVCB.js";
|
|
33
32
|
import {
|
|
34
33
|
SessionManager
|
|
35
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-6UB6NKA3.js";
|
|
36
35
|
import "./chunk-FVDOXRUD.js";
|
|
36
|
+
import "./chunk-ZSEZY3II.js";
|
|
37
37
|
import "./chunk-RQ2Q5IYR.js";
|
|
38
38
|
import "./chunk-DDGMHUOW.js";
|
|
39
39
|
import {
|
|
@@ -885,351 +885,6 @@ function typingKey2(chatId, threadId) {
|
|
|
885
885
|
return `${chatId}:${threadId ?? ""}`;
|
|
886
886
|
}
|
|
887
887
|
|
|
888
|
-
// packages/coding-agent/dist/gateway/agent-bridge.js
|
|
889
|
-
import { existsSync as existsSync2 } from "node:fs";
|
|
890
|
-
|
|
891
|
-
// packages/coding-agent/dist/gateway/store.js
|
|
892
|
-
import { existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
|
|
893
|
-
import { dirname, join } from "node:path";
|
|
894
|
-
var storePathOverride;
|
|
895
|
-
function storePath() {
|
|
896
|
-
return storePathOverride ?? join(getAgentDir(), "gateway-sessions.json");
|
|
897
|
-
}
|
|
898
|
-
function readStore() {
|
|
899
|
-
let path = storePath();
|
|
900
|
-
if (!existsSync(path))
|
|
901
|
-
return {};
|
|
902
|
-
try {
|
|
903
|
-
let parsed = JSON.parse(readFileSync(path, "utf-8"));
|
|
904
|
-
if (parsed == null || typeof parsed != "object" || Array.isArray(parsed))
|
|
905
|
-
return {};
|
|
906
|
-
let out = {};
|
|
907
|
-
for (let [key, value] of Object.entries(parsed)) {
|
|
908
|
-
if (value == null || typeof value != "object")
|
|
909
|
-
continue;
|
|
910
|
-
let v = value;
|
|
911
|
-
typeof v.sessionId != "string" || typeof v.sessionFile != "string" || (out[key] = {
|
|
912
|
-
sessionId: v.sessionId,
|
|
913
|
-
sessionFile: v.sessionFile,
|
|
914
|
-
createdAt: typeof v.createdAt == "string" ? v.createdAt : (/* @__PURE__ */ new Date(0)).toISOString(),
|
|
915
|
-
lastActiveAt: typeof v.lastActiveAt == "string" ? v.lastActiveAt : (/* @__PURE__ */ new Date(0)).toISOString()
|
|
916
|
-
});
|
|
917
|
-
}
|
|
918
|
-
return out;
|
|
919
|
-
} catch {
|
|
920
|
-
return {};
|
|
921
|
-
}
|
|
922
|
-
}
|
|
923
|
-
function writeStore(data) {
|
|
924
|
-
let path = storePath(), dir = dirname(path);
|
|
925
|
-
existsSync(dir) || mkdirSync(dir, { recursive: !0 });
|
|
926
|
-
let tmp = `${path}.tmp-${process.pid}`;
|
|
927
|
-
writeFileSync(tmp, `${JSON.stringify(data, null, 2)}
|
|
928
|
-
`, "utf-8"), renameSync(tmp, path);
|
|
929
|
-
}
|
|
930
|
-
function getSession(key) {
|
|
931
|
-
return readStore()[key];
|
|
932
|
-
}
|
|
933
|
-
function putSession(key, entry) {
|
|
934
|
-
let data = readStore(), existing = data[key], stored = {
|
|
935
|
-
sessionId: entry.sessionId,
|
|
936
|
-
sessionFile: entry.sessionFile,
|
|
937
|
-
createdAt: existing?.createdAt ?? (/* @__PURE__ */ new Date()).toISOString(),
|
|
938
|
-
lastActiveAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
939
|
-
};
|
|
940
|
-
return data[key] = stored, writeStore(data), stored;
|
|
941
|
-
}
|
|
942
|
-
function touchSession(key) {
|
|
943
|
-
let data = readStore(), existing = data[key];
|
|
944
|
-
existing && (existing.lastActiveAt = (/* @__PURE__ */ new Date()).toISOString(), writeStore(data));
|
|
945
|
-
}
|
|
946
|
-
function removeSession(key) {
|
|
947
|
-
let data = readStore();
|
|
948
|
-
return key in data ? (delete data[key], writeStore(data), !0) : !1;
|
|
949
|
-
}
|
|
950
|
-
function listSessions() {
|
|
951
|
-
return readStore();
|
|
952
|
-
}
|
|
953
|
-
|
|
954
|
-
// packages/coding-agent/dist/gateway/agent-bridge.js
|
|
955
|
-
function isUserMessageEntry(entry) {
|
|
956
|
-
return entry.type === "message";
|
|
957
|
-
}
|
|
958
|
-
var QUEUED = "__lunr_gateway_queued__", CACHE_CAP = 20, QUEUE_CAP = 5, runDepth = 0;
|
|
959
|
-
async function defaultSessionFactory(key, reopen) {
|
|
960
|
-
let [{ loadAllBuiltinExtensions }, { getAgentDir: getAgentDir2 }, { registerCustomizeBridge }, { registerMemoryCapBridge }, { registerModelTierBridge }, { createAgentSessionFromServices, createAgentSessionServices }, { SessionManager: SessionManager2 }, { SettingsManager }, { bindRuntimeBridges }] = await Promise.all([
|
|
961
|
-
import("./builtin-extensions-LYZ3BFWQ.js"),
|
|
962
|
-
import("./config-FMEOZSWE.js"),
|
|
963
|
-
import("./customize-XEXL2DGQ.js"),
|
|
964
|
-
import("./memory-cap-3S4XRLNP.js"),
|
|
965
|
-
import("./model-tiers-NJLHUEGK.js"),
|
|
966
|
-
import("./agent-session-services-IFJMSX7Z.js"),
|
|
967
|
-
import("./session-manager-MQNBYACL.js"),
|
|
968
|
-
import("./settings-manager-5LF2VQWC.js"),
|
|
969
|
-
import("./runtime-bridges-PPHNBFWL.js")
|
|
970
|
-
]), cwd = process.cwd(), agentDir = getAgentDir2(), settingsManager = SettingsManager.create(cwd, agentDir, { projectTrusted: !1 });
|
|
971
|
-
registerModelTierBridge(settingsManager), registerMemoryCapBridge(settingsManager), registerCustomizeBridge(settingsManager);
|
|
972
|
-
let sessionManager;
|
|
973
|
-
reopen && existsSync2(reopen.sessionFile) ? sessionManager = SessionManager2.open(reopen.sessionFile) : (reopen && console.warn(`[gateway] stored session file missing for ${key}; starting a fresh session`), sessionManager = SessionManager2.create(cwd));
|
|
974
|
-
let services = await createAgentSessionServices({
|
|
975
|
-
cwd,
|
|
976
|
-
agentDir,
|
|
977
|
-
settingsManager,
|
|
978
|
-
resourceLoaderOptions: { extensionFactories: await loadAllBuiltinExtensions() }
|
|
979
|
-
}), { session } = await createAgentSessionFromServices({ services, sessionManager });
|
|
980
|
-
return bindRuntimeBridges({ session, services }), await session.bindExtensions({
|
|
981
|
-
mode: "print",
|
|
982
|
-
onError: (err) => console.error(`[gateway] extension error (${err.extensionPath}): ${err.error}`)
|
|
983
|
-
}), session;
|
|
984
|
-
}
|
|
985
|
-
function extractFinalText(session) {
|
|
986
|
-
let messages = session.state.messages, last = messages[messages.length - 1];
|
|
987
|
-
if (last?.role !== "assistant")
|
|
988
|
-
return "";
|
|
989
|
-
let assistant = last;
|
|
990
|
-
if (assistant.stopReason === "error" || assistant.stopReason === "aborted")
|
|
991
|
-
throw new Error(assistant.errorMessage || `Request ${assistant.stopReason}`);
|
|
992
|
-
let text = "";
|
|
993
|
-
for (let content of assistant.content)
|
|
994
|
-
content.type === "text" && (text += content.text);
|
|
995
|
-
return text;
|
|
996
|
-
}
|
|
997
|
-
var AgentBridge = class {
|
|
998
|
-
cap;
|
|
999
|
-
sessionFactory;
|
|
1000
|
-
cache = /* @__PURE__ */ new Map();
|
|
1001
|
-
redoStack = /* @__PURE__ */ new Map();
|
|
1002
|
-
creating = /* @__PURE__ */ new Map();
|
|
1003
|
-
constructor(options = {}) {
|
|
1004
|
-
this.cap = options.cacheCap ?? CACHE_CAP, this.sessionFactory = options.sessionFactory ?? defaultSessionFactory;
|
|
1005
|
-
}
|
|
1006
|
-
/**
|
|
1007
|
-
* Run one conversational turn. Resolves with the final assistant text, or
|
|
1008
|
-
* the QUEUED sentinel when the session was busy (router must not reply).
|
|
1009
|
-
*/
|
|
1010
|
-
async runTurn(key, event, callbacks = {}) {
|
|
1011
|
-
let entry = await this.getOrCreate(key);
|
|
1012
|
-
if (entry.busy)
|
|
1013
|
-
return entry.queue.length >= QUEUE_CAP && (entry.queue.shift(), entry.dropped++), entry.queue.push(event), QUEUED;
|
|
1014
|
-
entry.busy = !0;
|
|
1015
|
-
let result;
|
|
1016
|
-
try {
|
|
1017
|
-
result = await this.runPrompt(entry, event.text, callbacks, event.source, event.attachments);
|
|
1018
|
-
} catch (err) {
|
|
1019
|
-
throw entry.busy = !1, err;
|
|
1020
|
-
}
|
|
1021
|
-
return touchSession(key), this.drainQueue(entry, callbacks).finally(() => {
|
|
1022
|
-
entry.busy = !1;
|
|
1023
|
-
}), result;
|
|
1024
|
-
}
|
|
1025
|
-
async abort(key) {
|
|
1026
|
-
await this.cache.get(key)?.session.abort();
|
|
1027
|
-
}
|
|
1028
|
-
/** Return the live session for a key, or null when none exists yet. */
|
|
1029
|
-
async getSession(key) {
|
|
1030
|
-
let cached = this.cache.get(key);
|
|
1031
|
-
return cached ? cached.session : getSession(key) ? (await this.getOrCreate(key)).session : null;
|
|
1032
|
-
}
|
|
1033
|
-
/** Switch the chat to a different persisted session file. */
|
|
1034
|
-
async switchSession(key, sessionFile) {
|
|
1035
|
-
let entry = this.cache.get(key);
|
|
1036
|
-
if (entry?.busy)
|
|
1037
|
-
throw new Error("Session is busy \u2014 /stop first or wait");
|
|
1038
|
-
if (entry) {
|
|
1039
|
-
let oldSessionId = entry.session.sessionManager?.getSessionId();
|
|
1040
|
-
entry.unsubscribe?.(), this.cache.delete(key), entry.session.dispose?.(), oldSessionId && deletePermissionContext(oldSessionId);
|
|
1041
|
-
}
|
|
1042
|
-
removeSession(key), this.redoStack.delete(key);
|
|
1043
|
-
let session = await this.sessionFactory(key, { sessionFile }), newFile = session.sessionManager?.getSessionFile(), newSessionId = session.sessionManager?.getSessionId();
|
|
1044
|
-
newFile && putSession(key, { sessionId: newSessionId ?? key, sessionFile: newFile }), newSessionId && createPermissionContext(newSessionId);
|
|
1045
|
-
let newEntry = { session, busy: !1, queue: [], dropped: 0 };
|
|
1046
|
-
this.cache.set(key, newEntry), this._enforceCacheCap(key), newEntry.unsubscribe = this._subscribeToSession(key, newEntry);
|
|
1047
|
-
}
|
|
1048
|
-
/** Undo the last user turn and push the previous leaf onto the redo stack. */
|
|
1049
|
-
async undo(key) {
|
|
1050
|
-
let session = await this.getSession(key);
|
|
1051
|
-
if (!session)
|
|
1052
|
-
throw new Error("No session");
|
|
1053
|
-
if (session.isStreaming)
|
|
1054
|
-
throw new Error("Wait for the current response to finish");
|
|
1055
|
-
let branch = session.sessionManager?.getBranch() ?? [], lastUserIndex = -1;
|
|
1056
|
-
for (let i = branch.length - 1; i >= 0; i--) {
|
|
1057
|
-
let entry = branch[i];
|
|
1058
|
-
if (isUserMessageEntry(entry) && entry.message.role === "user") {
|
|
1059
|
-
lastUserIndex = i;
|
|
1060
|
-
break;
|
|
1061
|
-
}
|
|
1062
|
-
}
|
|
1063
|
-
if (lastUserIndex === -1)
|
|
1064
|
-
throw new Error("Nothing to undo");
|
|
1065
|
-
let lastUser = branch[lastUserIndex];
|
|
1066
|
-
if (!isUserMessageEntry(lastUser))
|
|
1067
|
-
throw new Error("Nothing to undo");
|
|
1068
|
-
let leafId = session.sessionManager?.getLeafId() ?? null, targetId;
|
|
1069
|
-
if (lastUser.id === leafId) {
|
|
1070
|
-
if (!lastUser.parentId)
|
|
1071
|
-
throw new Error("Nothing to undo");
|
|
1072
|
-
targetId = lastUser.parentId;
|
|
1073
|
-
} else
|
|
1074
|
-
targetId = lastUser.id;
|
|
1075
|
-
if ((await session.navigateTree(targetId, {})).cancelled)
|
|
1076
|
-
throw new Error("Navigation cancelled");
|
|
1077
|
-
if (leafId) {
|
|
1078
|
-
let stack = this.redoStack.get(key) ?? [];
|
|
1079
|
-
stack.push(leafId), this.redoStack.set(key, stack);
|
|
1080
|
-
}
|
|
1081
|
-
return { userText: extractUserText(lastUser.message) };
|
|
1082
|
-
}
|
|
1083
|
-
/** Redo to the leaf saved by the most recent undo. */
|
|
1084
|
-
async redo(key) {
|
|
1085
|
-
let session = await this.getSession(key);
|
|
1086
|
-
if (!session)
|
|
1087
|
-
throw new Error("No session");
|
|
1088
|
-
if (session.isStreaming)
|
|
1089
|
-
throw new Error("Wait for the current response to finish");
|
|
1090
|
-
let stack = this.redoStack.get(key) ?? [], targetId = stack.pop();
|
|
1091
|
-
if (!targetId)
|
|
1092
|
-
throw new Error("Nothing to redo");
|
|
1093
|
-
if (this.redoStack.set(key, stack), (await session.navigateTree(targetId, {})).cancelled)
|
|
1094
|
-
throw stack.push(targetId), this.redoStack.set(key, stack), new Error("Navigation cancelled");
|
|
1095
|
-
}
|
|
1096
|
-
/** Test/debug hook: how many redo targets are saved for a key. */
|
|
1097
|
-
getRedoStackLength(key) {
|
|
1098
|
-
return this.redoStack.get(key)?.length ?? 0;
|
|
1099
|
-
}
|
|
1100
|
-
/** Drop the cached session (disposing it) and forget the store entry (/new, /reset). */
|
|
1101
|
-
async reset(key) {
|
|
1102
|
-
let entry = this.cache.get(key);
|
|
1103
|
-
if (entry) {
|
|
1104
|
-
entry.queue.length = 0, entry.dropped = 0;
|
|
1105
|
-
try {
|
|
1106
|
-
await entry.session.abort();
|
|
1107
|
-
} catch {
|
|
1108
|
-
}
|
|
1109
|
-
entry.unsubscribe?.(), this.cache.delete(key), entry.session.dispose?.();
|
|
1110
|
-
}
|
|
1111
|
-
removeSession(key), this.redoStack.delete(key);
|
|
1112
|
-
}
|
|
1113
|
-
getStatus(key) {
|
|
1114
|
-
let entry = this.cache.get(key);
|
|
1115
|
-
return {
|
|
1116
|
-
busy: entry?.busy ?? !1,
|
|
1117
|
-
queueDepth: entry?.queue.length ?? 0,
|
|
1118
|
-
createdAt: getSession(key)?.createdAt
|
|
1119
|
-
};
|
|
1120
|
-
}
|
|
1121
|
-
/** One prompt → final text. Increments runDepth; streams deltas when asked. */
|
|
1122
|
-
async runPrompt(entry, text, callbacks, source, attachments) {
|
|
1123
|
-
let { session } = entry, unsubscribe;
|
|
1124
|
-
if (callbacks.onDelta) {
|
|
1125
|
-
let onDelta = callbacks.onDelta, streamedLen = 0;
|
|
1126
|
-
unsubscribe = session.subscribe((event) => {
|
|
1127
|
-
if (event.type !== "message_update")
|
|
1128
|
-
return;
|
|
1129
|
-
let assistantEvent = event.assistantMessageEvent;
|
|
1130
|
-
if (assistantEvent.type !== "text_delta")
|
|
1131
|
-
return;
|
|
1132
|
-
let full = "";
|
|
1133
|
-
for (let content of assistantEvent.partial.content)
|
|
1134
|
-
content.type === "text" && (full += content.text);
|
|
1135
|
-
full.length < streamedLen && (streamedLen = 0), full.length > streamedLen && (onDelta(full.slice(streamedLen)), streamedLen = full.length);
|
|
1136
|
-
});
|
|
1137
|
-
}
|
|
1138
|
-
runDepth++;
|
|
1139
|
-
try {
|
|
1140
|
-
let images = [], notes = [];
|
|
1141
|
-
for (let attachment of attachments ?? []) {
|
|
1142
|
-
let bytes = Buffer.from(attachment.data, "base64"), processed = await processImage(new Uint8Array(bytes), attachment.mimeType);
|
|
1143
|
-
if (processed.ok) {
|
|
1144
|
-
images.push({ type: "image", data: processed.data, mimeType: processed.mimeType });
|
|
1145
|
-
for (let hint of processed.hints)
|
|
1146
|
-
notes.push(hint);
|
|
1147
|
-
} else
|
|
1148
|
-
notes.push(processed.message);
|
|
1149
|
-
}
|
|
1150
|
-
let promptText = notes.length > 0 ? `${text}
|
|
1151
|
-
|
|
1152
|
-
${notes.join(" ")}` : text;
|
|
1153
|
-
await runWithOrigin({
|
|
1154
|
-
platform: source.platform,
|
|
1155
|
-
chatId: source.chatId,
|
|
1156
|
-
threadId: source.threadId,
|
|
1157
|
-
chatType: source.chatType
|
|
1158
|
-
}, () => session.prompt(promptText, { source: "extension", ...images.length ? { images } : {} }));
|
|
1159
|
-
} finally {
|
|
1160
|
-
runDepth--, unsubscribe?.();
|
|
1161
|
-
}
|
|
1162
|
-
return extractFinalText(session);
|
|
1163
|
-
}
|
|
1164
|
-
/** Drain the queue FIFO: all queued messages become one concatenated turn. */
|
|
1165
|
-
async drainQueue(entry, callbacks) {
|
|
1166
|
-
for (; entry.queue.length > 0; ) {
|
|
1167
|
-
let items = entry.queue.splice(0), parts = items.map((item) => item.text), attachments = items.flatMap((item) => item.attachments ?? []);
|
|
1168
|
-
entry.dropped > 0 && (parts.unshift(`[gateway: ${entry.dropped} earlier message(s) were dropped \u2014 the queue was full]`), entry.dropped = 0);
|
|
1169
|
-
try {
|
|
1170
|
-
let text = await this.runPrompt(entry, parts.join(`
|
|
1171
|
-
|
|
1172
|
-
`), {}, items[items.length - 1].source, attachments);
|
|
1173
|
-
callbacks.onFollowUpResult?.(text);
|
|
1174
|
-
} catch (err) {
|
|
1175
|
-
callbacks.onError?.(err instanceof Error ? err.message : String(err));
|
|
1176
|
-
return;
|
|
1177
|
-
}
|
|
1178
|
-
}
|
|
1179
|
-
}
|
|
1180
|
-
async getOrCreate(key) {
|
|
1181
|
-
let cached = this.cache.get(key);
|
|
1182
|
-
if (cached)
|
|
1183
|
-
return this.cache.delete(key), this.cache.set(key, cached), cached;
|
|
1184
|
-
let pending2 = this.creating.get(key);
|
|
1185
|
-
if (!pending2) {
|
|
1186
|
-
pending2 = this.createEntry(key), this.creating.set(key, pending2);
|
|
1187
|
-
try {
|
|
1188
|
-
await pending2;
|
|
1189
|
-
} finally {
|
|
1190
|
-
this.creating.delete(key);
|
|
1191
|
-
}
|
|
1192
|
-
}
|
|
1193
|
-
return pending2;
|
|
1194
|
-
}
|
|
1195
|
-
async createEntry(key) {
|
|
1196
|
-
let stored = getSession(key), session = await this.sessionFactory(key, stored ? { sessionFile: stored.sessionFile } : void 0), sessionFile = session.sessionManager?.getSessionFile(), sessionId = session.sessionManager?.getSessionId();
|
|
1197
|
-
sessionFile && putSession(key, { sessionId: sessionId ?? key, sessionFile }), sessionId && createPermissionContext(sessionId);
|
|
1198
|
-
let entry = { session, busy: !1, queue: [], dropped: 0, unsubscribe: void 0 };
|
|
1199
|
-
return this.cache.set(key, entry), this._enforceCacheCap(key), entry.unsubscribe = this._subscribeToSession(key, entry), entry;
|
|
1200
|
-
}
|
|
1201
|
-
_enforceCacheCap(protectedKey) {
|
|
1202
|
-
for (; this.cache.size > this.cap; ) {
|
|
1203
|
-
let oldestKey, oldest;
|
|
1204
|
-
for (let [key, entry] of this.cache)
|
|
1205
|
-
if (key !== protectedKey && !entry.busy) {
|
|
1206
|
-
oldestKey = key, oldest = entry;
|
|
1207
|
-
break;
|
|
1208
|
-
}
|
|
1209
|
-
if (!oldest || !oldestKey) {
|
|
1210
|
-
this.cap = this.cache.size;
|
|
1211
|
-
break;
|
|
1212
|
-
}
|
|
1213
|
-
oldest.unsubscribe?.(), this.cache.delete(oldestKey), oldest.session.dispose?.();
|
|
1214
|
-
let evictedSessionId = oldest.session.sessionManager?.getSessionId();
|
|
1215
|
-
evictedSessionId && deletePermissionContext(evictedSessionId);
|
|
1216
|
-
}
|
|
1217
|
-
}
|
|
1218
|
-
_subscribeToSession(key, entry) {
|
|
1219
|
-
return entry.session.subscribe((event) => this._handleSessionEvent(key, event));
|
|
1220
|
-
}
|
|
1221
|
-
_handleSessionEvent(key, event) {
|
|
1222
|
-
event.type === "message_start" && event.message?.role === "user" && this.redoStack.delete(key);
|
|
1223
|
-
}
|
|
1224
|
-
};
|
|
1225
|
-
function extractUserText(message) {
|
|
1226
|
-
let text = "";
|
|
1227
|
-
if ("content" in message && Array.isArray(message.content))
|
|
1228
|
-
for (let block of message.content)
|
|
1229
|
-
block && typeof block == "object" && "type" in block && block.type === "text" && "text" in block && typeof block.text == "string" && (text += block.text);
|
|
1230
|
-
return text;
|
|
1231
|
-
}
|
|
1232
|
-
|
|
1233
888
|
// packages/coding-agent/dist/gateway/approval.js
|
|
1234
889
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
1235
890
|
import { randomBytes } from "node:crypto";
|
|
@@ -2022,8 +1677,8 @@ async function sendCommandReply(adapter, event, text) {
|
|
|
2022
1677
|
|
|
2023
1678
|
// packages/coding-agent/dist/gateway/pairing.js
|
|
2024
1679
|
import { randomInt } from "node:crypto";
|
|
2025
|
-
import { chmodSync, existsSync
|
|
2026
|
-
import { join
|
|
1680
|
+
import { chmodSync, existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
|
|
1681
|
+
import { join } from "node:path";
|
|
2027
1682
|
var CODE_ALPHABET3 = "ABCDEFGHJKMNPQRSTUVWXYZ23456789", CODE_LENGTH2 = 8, DEFAULT_TTL_MS = 3600 * 1e3, DEFAULT_RATE_LIMIT_MS = 600 * 1e3, DEFAULT_MAX_PENDING = 3, DEFAULT_MAX_FAILS = 5, DEFAULT_LOCKOUT_MS = 3600 * 1e3;
|
|
2028
1683
|
function normalizeCode(code) {
|
|
2029
1684
|
return code.replace(/-/g, "").trim().toUpperCase();
|
|
@@ -2035,16 +1690,16 @@ function generateCode() {
|
|
|
2035
1690
|
return code;
|
|
2036
1691
|
}
|
|
2037
1692
|
function createPairingStore(options = {}) {
|
|
2038
|
-
let dir = options.dir ??
|
|
1693
|
+
let dir = options.dir ?? join(getAgentDir(), "pairing"), ttlMs = options.ttlMs ?? DEFAULT_TTL_MS, rateLimitMs = options.rateLimitMs ?? DEFAULT_RATE_LIMIT_MS, maxPending = options.maxPending ?? DEFAULT_MAX_PENDING, maxFails = options.maxFails ?? DEFAULT_MAX_FAILS, lockoutMs = options.lockoutMs ?? DEFAULT_LOCKOUT_MS, now = options.now ?? (() => Date.now());
|
|
2039
1694
|
function storeFile() {
|
|
2040
|
-
return
|
|
1695
|
+
return join(dir, "store.json");
|
|
2041
1696
|
}
|
|
2042
1697
|
function read() {
|
|
2043
1698
|
let path = storeFile();
|
|
2044
|
-
if (!
|
|
1699
|
+
if (!existsSync(path))
|
|
2045
1700
|
return { pending: [], approved: [] };
|
|
2046
1701
|
try {
|
|
2047
|
-
let parsed = JSON.parse(
|
|
1702
|
+
let parsed = JSON.parse(readFileSync(path, "utf-8"));
|
|
2048
1703
|
if (parsed == null || typeof parsed != "object" || Array.isArray(parsed))
|
|
2049
1704
|
return { pending: [], approved: [] };
|
|
2050
1705
|
let p = parsed, pending2 = Array.isArray(p.pending) ? p.pending : [], approved = Array.isArray(p.approved) ? p.approved : [];
|
|
@@ -2059,10 +1714,10 @@ function createPairingStore(options = {}) {
|
|
|
2059
1714
|
}
|
|
2060
1715
|
}
|
|
2061
1716
|
function write(data) {
|
|
2062
|
-
|
|
1717
|
+
existsSync(dir) || mkdirSync(dir, { recursive: !0 });
|
|
2063
1718
|
let path = storeFile(), tmp = `${path}.tmp-${process.pid}`;
|
|
2064
|
-
|
|
2065
|
-
`, "utf-8"),
|
|
1719
|
+
writeFileSync(tmp, `${JSON.stringify(data, null, 2)}
|
|
1720
|
+
`, "utf-8"), renameSync(tmp, path);
|
|
2066
1721
|
try {
|
|
2067
1722
|
chmodSync(path, 384);
|
|
2068
1723
|
} catch {
|
|
@@ -2130,7 +1785,7 @@ function createPairingStore(options = {}) {
|
|
|
2130
1785
|
}
|
|
2131
1786
|
|
|
2132
1787
|
// packages/coding-agent/dist/gateway/router.js
|
|
2133
|
-
import { existsSync as
|
|
1788
|
+
import { existsSync as existsSync2 } from "node:fs";
|
|
2134
1789
|
|
|
2135
1790
|
// packages/coding-agent/dist/gateway/session-keys.js
|
|
2136
1791
|
var SESSION_KEY_PREFIX = "agent:main";
|
|
@@ -2227,7 +1882,7 @@ function createRouter(deps) {
|
|
|
2227
1882
|
if (!reloadConfig)
|
|
2228
1883
|
return initialCfg;
|
|
2229
1884
|
try {
|
|
2230
|
-
if (
|
|
1885
|
+
if (existsSync2(gatewayConfigPath()))
|
|
2231
1886
|
return loadGatewayConfig();
|
|
2232
1887
|
} catch {
|
|
2233
1888
|
}
|
|
@@ -14,8 +14,8 @@ import {
|
|
|
14
14
|
} from "./chunk-3WFAEVKS.js";
|
|
15
15
|
import {
|
|
16
16
|
extractHeadingTitle
|
|
17
|
-
} from "./chunk-
|
|
18
|
-
import "./chunk-
|
|
17
|
+
} from "./chunk-J7QGQD45.js";
|
|
18
|
+
import "./chunk-4SJWFTUP.js";
|
|
19
19
|
import {
|
|
20
20
|
activityMonitor
|
|
21
21
|
} from "./chunk-DAPBPCBP.js";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createRequire as __lunrRequire } from "node:module"; const require = __lunrRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
formatDimensionNote,
|
|
4
|
+
resizeImage
|
|
5
|
+
} from "./chunk-ZSEZY3II.js";
|
|
6
|
+
import "./chunk-RQ2Q5IYR.js";
|
|
7
|
+
import "./chunk-BRJX2PRC.js";
|
|
8
|
+
export {
|
|
9
|
+
formatDimensionNote,
|
|
10
|
+
resizeImage
|
|
11
|
+
};
|