@ashx-j/lunr 0.2.25 → 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 +16 -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 +2 -2
- package/dist/gateway/adapters/discord.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/commands.d.ts.map +1 -1
- package/dist/gateway/commands.js +2 -6
- package/dist/gateway/commands.js.map +1 -1
- package/dist/gateway/cron.d.ts.map +1 -1
- package/dist/gateway/cron.js +20 -6
- package/dist/gateway/cron.js.map +1 -1
- package/dist/gateway/index.d.ts.map +1 -1
- package/dist/gateway/index.js +3 -3
- package/dist/gateway/index.js.map +1 -1
- package/dist/gateway/mobile-commands.d.ts.map +1 -1
- package/dist/gateway/mobile-commands.js +8 -8
- package/dist/gateway/mobile-commands.js.map +1 -1
- package/dist/gateway/presenter.d.ts.map +1 -1
- package/dist/gateway/presenter.js +3 -3
- package/dist/gateway/presenter.js.map +1 -1
- package/dist/gateway/router.d.ts.map +1 -1
- package/dist/gateway/router.js +5 -7
- package/dist/gateway/router.js.map +1 -1
- package/dist/gateway/setup.d.ts.map +1 -1
- package/dist/gateway/setup.js +6 -4
- package/dist/gateway/setup.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-YXXFCP5J.js → agent-session-services-5YXS2PLF.js} +10 -8
- package/dist/node-runtime/{builtin-extensions-ZLAX7TUH.js → builtin-extensions-I2HIFEMY.js} +3 -2
- package/dist/node-runtime/{chunk-3XPLBUEM.js → chunk-2CFDTH5B.js} +7 -3
- package/dist/node-runtime/chunk-2IDTZAG5.js +1415 -0
- package/dist/node-runtime/{chunk-QTU6AKNJ.js → chunk-3MISGG4S.js} +11 -15
- package/dist/node-runtime/chunk-4SBQAI4T.js +2185 -0
- package/dist/node-runtime/{chunk-TORR5XBV.js → chunk-5B5QN3ZQ.js} +12 -12
- 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-OCVIXVTZ.js → chunk-D5UCKPBQ.js} +12 -1
- package/dist/node-runtime/{chunk-7S3T6YEA.js → chunk-DVQSHCVP.js} +1 -1
- 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-6XL67VVY.js → chunk-I74LN5JG.js} +15 -0
- package/dist/node-runtime/chunk-IKU6Y7DL.js +287 -0
- package/dist/node-runtime/{chunk-WF7PGWRZ.js → chunk-L24TPBS4.js} +5 -4
- package/dist/node-runtime/{chunk-VQFSUJJG.js → chunk-LJTIVM7I.js} +7 -7
- package/dist/node-runtime/{chunk-DSIKTUPW.js → chunk-LWJXTA6Z.js} +274 -2433
- package/dist/node-runtime/{chunk-E4D3IGP2.js → chunk-P7XBVXGT.js} +6 -7
- package/dist/node-runtime/{chunk-OVX6X377.js → chunk-PTFBPO3C.js} +1 -1
- package/dist/node-runtime/{chunk-RC7DMV45.js → chunk-RCR3XAQY.js} +34 -6
- package/dist/node-runtime/chunk-RGQAEOM5.js +81 -0
- package/dist/node-runtime/{chunk-YCUZEGJG.js → chunk-SN2KSMPQ.js} +6 -3
- package/dist/node-runtime/{chunk-NRKGMJYU.js → chunk-SPVDBUOS.js} +1 -1
- package/dist/node-runtime/{chunk-IJIFHRTB.js → chunk-T4DA4XE7.js} +19 -19
- package/dist/node-runtime/chunk-U5F4IC7R.js +53 -0
- package/dist/node-runtime/{chunk-KWIYUUZK.js → chunk-UVWCDQYF.js} +27 -18
- package/dist/node-runtime/{chunk-ZXSGTGJ6.js → chunk-WIF24I7G.js} +21 -5
- package/dist/node-runtime/{chunk-2HHLJWGD.js → chunk-X3PGBLQ7.js} +2 -2
- 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-6WDOYKS6.js → command-FSBU2EVZ.js} +3 -3
- package/dist/node-runtime/{commands-NZLSOHPE.js → commands-EMBQQVVT.js} +4 -2
- package/dist/node-runtime/{commands-QC6VUZJQ.js → commands-NAAL7KNT.js} +5 -4
- package/dist/node-runtime/{direct-tool-executor-77GW4F5P.js → direct-tool-executor-4D7UXYU4.js} +7 -4
- package/dist/node-runtime/{gateway-INAYBF4Q.js → gateway-DQM333YV.js} +18 -19
- package/dist/node-runtime/index.js +23 -19
- package/dist/node-runtime/{init-HS6NQXSK.js → init-P5AUV77I.js} +4 -2
- package/dist/node-runtime/{install-cli-KL4UDDAD.js → install-cli-NN4YAU44.js} +1 -1
- package/dist/node-runtime/{interactive-mode-Z5M7WYYZ.js → interactive-mode-YOHZVMKX.js} +11 -9
- package/dist/node-runtime/lunr-computer-use-Y23CCDIJ.js +158 -0
- package/dist/node-runtime/{lunr-cron-LWIZJM2N.js → lunr-cron-USHC4LXH.js} +6 -4
- package/dist/node-runtime/main.js +16 -14
- package/dist/node-runtime/{mcp-auth-flow-QIXHW6QN.js → mcp-auth-flow-QVLFVLEO.js} +2 -1
- package/dist/node-runtime/{mobile-commands-J7OJEKFO.js → mobile-commands-O5LCHL32.js} +4 -3
- package/dist/node-runtime/{package-manager-cli-VYZM5WHN.js → package-manager-cli-Q7BL6KZO.js} +7 -6
- package/dist/node-runtime/{pi-mcp-adapter-5UKBZP44.js → pi-mcp-adapter-3PHF4KZ4.js} +5 -5
- package/dist/node-runtime/{pi-subagents-DNY7EAIG.js → pi-subagents-7IBSSGEW.js} +24 -18
- 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 +16 -14
- package/dist/node-runtime/runtime-EFPPD2UW.js +21 -0
- package/dist/node-runtime/{runtime-bridges-VRDDR73P.js → runtime-bridges-7WVCLI76.js} +3 -2
- package/dist/node-runtime/{settings-manager-J4SPQPDJ.js → settings-manager-DJDM5AHM.js} +2 -1
- package/dist/node-runtime/{setup-CQ2NLVK5.js → setup-PFBWRNUI.js} +10 -9
- package/dist/node-runtime/{subagent-executor-KZZQGAKV.js → subagent-executor-LPZ4BHWE.js} +29 -11
- package/dist/node-runtime/{update-cli-GTFJC7XK.js → update-cli-HNMOTNGX.js} +2 -1
- 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 +8 -6
- 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/{chunk-LQP3RB67.js → chunk-RAK2QA2B.js} +3 -3
|
@@ -5,9 +5,9 @@ import {
|
|
|
5
5
|
createPicker,
|
|
6
6
|
gatewayInput,
|
|
7
7
|
gatewaySelect,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
} from "./chunk-
|
|
8
|
+
isAuthorized,
|
|
9
|
+
requireAuthorized
|
|
10
|
+
} from "./chunk-3MISGG4S.js";
|
|
11
11
|
import {
|
|
12
12
|
getSubagentCancellation
|
|
13
13
|
} from "./chunk-BBUVIEZB.js";
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
PERMISSION_MODES,
|
|
16
16
|
getPermissionMode,
|
|
17
17
|
setPermissionMode
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-WIF24I7G.js";
|
|
19
19
|
import {
|
|
20
20
|
SessionManager
|
|
21
21
|
} from "./chunk-2KIPT4HJ.js";
|
|
@@ -109,9 +109,9 @@ async function browseProject(ctx, initialPath) {
|
|
|
109
109
|
sessionKey: key,
|
|
110
110
|
invokerId: event.source.userId,
|
|
111
111
|
...initial,
|
|
112
|
-
validate: () =>
|
|
112
|
+
validate: () => isAuthorized(event.source, loadGatewayConfig()),
|
|
113
113
|
resolve: async (item) => {
|
|
114
|
-
if (
|
|
114
|
+
if (requireAuthorized(event.source), item.value === "use" && current) {
|
|
115
115
|
let cwd = resolveWithinRoots(current, loadGatewayConfig().projectRoots ?? []);
|
|
116
116
|
if (bridge.getStatus(key).busy)
|
|
117
117
|
throw new Error("Stop the current turn or wait before switching projects.");
|
|
@@ -146,7 +146,7 @@ async function continueSession(ctx, file) {
|
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
148
|
async function performContinue(ctx, file, signal) {
|
|
149
|
-
|
|
149
|
+
requireAuthorized(ctx.event.source);
|
|
150
150
|
let { requestSessionTransfer, SessionTransferError } = await import("./session-handoff-GWARVEWT.js"), { key, bridge } = ctx;
|
|
151
151
|
if (bridge.peekSession?.(key)?.sessionManager?.getSessionFile() === file) {
|
|
152
152
|
await ctx.adapter.send(ctx.event.source.chatId, "This session is already open here.");
|
|
@@ -168,7 +168,7 @@ How should lunR continue?`, ["Wait until idle", "Stop and continue", "Cancel"],
|
|
|
168
168
|
else {
|
|
169
169
|
let deadline = Date.now() + 12e4;
|
|
170
170
|
for (; ; ) {
|
|
171
|
-
signal.throwIfAborted(),
|
|
171
|
+
signal.throwIfAborted(), requireAuthorized(ctx.event.source);
|
|
172
172
|
try {
|
|
173
173
|
await requestSessionTransfer(file, { timeoutMs: 3e3, signal });
|
|
174
174
|
break;
|
|
@@ -180,7 +180,7 @@ How should lunR continue?`, ["Wait until idle", "Stop and continue", "Cancel"],
|
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
|
-
signal.throwIfAborted(),
|
|
183
|
+
signal.throwIfAborted(), requireAuthorized(ctx.event.source), await bridge.switchSession(key, file);
|
|
184
184
|
let session = await bridge.getSession(key), cwd = session?.sessionManager?.getCwd();
|
|
185
185
|
bindConversation(key, ctx.event.source, { cwd, owner: ctx.event.source.userId });
|
|
186
186
|
let id = session?.sessionManager?.getSessionId();
|
|
@@ -241,14 +241,14 @@ async function sessionPicker(ctx, items) {
|
|
|
241
241
|
invokerId: ctx.event.source.userId,
|
|
242
242
|
title: "Choose a session. Use /sessions <search> to filter.",
|
|
243
243
|
items,
|
|
244
|
-
validate: () =>
|
|
244
|
+
validate: () => isAuthorized(ctx.event.source, loadGatewayConfig()),
|
|
245
245
|
resolve: async (item) => (await continueSession(ctx, item.value), { done: !0, text: "Session selection finished." })
|
|
246
246
|
}, { threadId: ctx.event.source.threadId });
|
|
247
247
|
}
|
|
248
248
|
async function handleMobileCommand(ctx, command, args) {
|
|
249
249
|
if (!MOBILE_COMMANDS.some((c) => c.name === command) && command !== "resume")
|
|
250
250
|
return !1;
|
|
251
|
-
if (
|
|
251
|
+
if (requireAuthorized(ctx.event.source, ctx.cfg), bindConversation(ctx.key, ctx.event.source, { owner: ctx.event.source.userId }), command === "project")
|
|
252
252
|
return await browseProject(ctx, args.trim() || void 0), !0;
|
|
253
253
|
if (command === "sessions" || command === "resume" || command === "continue")
|
|
254
254
|
return await browseSessions(ctx, args, command === "continue"), !0;
|
|
@@ -325,7 +325,7 @@ async function handleMobileCommand(ctx, command, args) {
|
|
|
325
325
|
if (command === "settings") {
|
|
326
326
|
let choice = await gatewaySelect(ctx.key, "Session settings", ["Model", "Thinking", "Permissions"]);
|
|
327
327
|
if (choice === "Model" || choice === "Thinking") {
|
|
328
|
-
let { CHAT_COMMANDS, runChatCommand } = await import("./commands-
|
|
328
|
+
let { CHAT_COMMANDS, runChatCommand } = await import("./commands-NAAL7KNT.js"), cmd = CHAT_COMMANDS.find((c) => c.name === choice.toLowerCase());
|
|
329
329
|
return cmd && await runChatCommand(cmd, {
|
|
330
330
|
...ctx,
|
|
331
331
|
args: "",
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { createRequire as __lunrRequire } from "node:module"; const require = __lunrRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
require_proper_lockfile
|
|
4
|
+
} from "./chunk-URD2SLIT.js";
|
|
5
|
+
import {
|
|
6
|
+
getPackageDir
|
|
7
|
+
} from "./chunk-FQMM2EZ2.js";
|
|
8
|
+
import {
|
|
9
|
+
__toESM
|
|
10
|
+
} from "./chunk-BRJX2PRC.js";
|
|
11
|
+
|
|
12
|
+
// packages/coding-agent/dist/core/computer-use/runtime.js
|
|
13
|
+
var import_proper_lockfile = __toESM(require_proper_lockfile(), 1);
|
|
14
|
+
import { execFile } from "node:child_process";
|
|
15
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
16
|
+
import { createReadStream } from "node:fs";
|
|
17
|
+
import { lstat, mkdir, readdir, readFile, readlink, realpath, rename, rm } from "node:fs/promises";
|
|
18
|
+
import { createRequire } from "node:module";
|
|
19
|
+
import { userInfo } from "node:os";
|
|
20
|
+
import { dirname, isAbsolute, join, relative, resolve } from "node:path";
|
|
21
|
+
import { promisify } from "node:util";
|
|
22
|
+
|
|
23
|
+
// packages/coding-agent/dist/core/computer-use/release.generated.js
|
|
24
|
+
var computerRelease = {
|
|
25
|
+
version: "0.28.1",
|
|
26
|
+
tag: "cua-driver-rs-v0.28.1",
|
|
27
|
+
sourceCommit: "d8028a7943087ee258dc1b4d19dc12a7cd27669c",
|
|
28
|
+
repository: "https://github.com/trycua/cua",
|
|
29
|
+
prerelease: !0,
|
|
30
|
+
approval: "production-approved",
|
|
31
|
+
artifacts: [
|
|
32
|
+
{
|
|
33
|
+
platform: "win32",
|
|
34
|
+
arch: "x64",
|
|
35
|
+
packageName: "@ashx-j/lunr-computer-win32-x64",
|
|
36
|
+
name: "cua-driver-rs-0.28.1-windows-x86_64-binary.zip",
|
|
37
|
+
bytes: 28930759,
|
|
38
|
+
sha256: "ab90418a54f84102f549cde4537daef3a0e20ba8254b7e24524a50fc5f4174d3"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
platform: "win32",
|
|
42
|
+
arch: "arm64",
|
|
43
|
+
packageName: "@ashx-j/lunr-computer-win32-arm64",
|
|
44
|
+
name: "cua-driver-rs-0.28.1-windows-arm64-binary.zip",
|
|
45
|
+
bytes: 27246194,
|
|
46
|
+
sha256: "d260e6110e029680d543d317f3c3c09569475f8d65855fcedda202e2ee989bf0"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
platform: "darwin",
|
|
50
|
+
arch: "arm64",
|
|
51
|
+
packageName: "@ashx-j/lunr-computer-darwin-arm64",
|
|
52
|
+
name: "cua-driver-rs-0.28.1-darwin-arm64.tar.gz",
|
|
53
|
+
bytes: 70074352,
|
|
54
|
+
sha256: "b3cb3781feb9855dfcdd616bc5c9c8e627453e3e16a073c1446326691a549b24"
|
|
55
|
+
}
|
|
56
|
+
]
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
// packages/coding-agent/dist/core/computer-use/runtime.js
|
|
60
|
+
var exec = promisify(execFile), CUA_VERSION = computerRelease.version;
|
|
61
|
+
async function resolveRuntimeArchive(packageDirectory = getPackageDir(), platform = process.platform, arch = process.arch) {
|
|
62
|
+
let payload = computerRelease.artifacts.find((item) => item.platform === platform && item.arch === arch);
|
|
63
|
+
if (!payload)
|
|
64
|
+
throw new Error("Computer use is unsupported on this platform or architecture.");
|
|
65
|
+
let archive = join(packageDirectory, "native", "computer-use", payload.name);
|
|
66
|
+
try {
|
|
67
|
+
await lstat(archive);
|
|
68
|
+
} catch (error) {
|
|
69
|
+
if (!(error instanceof Error && "code" in error && error.code === "ENOENT"))
|
|
70
|
+
throw error;
|
|
71
|
+
let manifestPath;
|
|
72
|
+
try {
|
|
73
|
+
manifestPath = createRequire(join(packageDirectory, "package.json")).resolve(`${payload.packageName}/package.json`);
|
|
74
|
+
} catch {
|
|
75
|
+
throw new Error("Computer-use payload is missing. Reinstall lunR with optional dependencies enabled. No runtime was downloaded.");
|
|
76
|
+
}
|
|
77
|
+
let manifest = JSON.parse(await readFile(manifestPath, "utf8")), cli = JSON.parse(await readFile(join(packageDirectory, "package.json"), "utf8"));
|
|
78
|
+
if (manifest.name !== payload.packageName || manifest.version !== cli.version)
|
|
79
|
+
throw new Error("Computer-use payload package version does not match lunR. Reinstall lunR with optional dependencies enabled.");
|
|
80
|
+
archive = join(dirname(manifestPath), payload.name);
|
|
81
|
+
}
|
|
82
|
+
let info = await lstat(archive);
|
|
83
|
+
if (!info.isFile() || info.isSymbolicLink() || info.size !== payload.bytes)
|
|
84
|
+
throw new Error("Bundled computer-use archive is not a regular file of the pinned size.");
|
|
85
|
+
return { archive, sha256: payload.sha256 };
|
|
86
|
+
}
|
|
87
|
+
function runtimeEnvironment(inherited = process.env) {
|
|
88
|
+
return {
|
|
89
|
+
...Object.fromEntries(Object.entries(inherited).filter((entry) => entry[1] !== void 0 && !entry[0].toUpperCase().startsWith("CUA_"))),
|
|
90
|
+
CUA_DRIVER_RS_TELEMETRY_ENABLED: "false",
|
|
91
|
+
CUA_DRIVER_RS_UPDATE_CHECK: "false",
|
|
92
|
+
CUA_DRIVER_PERMISSION_MODE: "standard",
|
|
93
|
+
CUA_DRIVER_DISABLE_UNRESTRICTED: "true"
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
async function digest(path, signal) {
|
|
97
|
+
let hash = createHash("sha256");
|
|
98
|
+
for await (let chunk of createReadStream(path, { signal }))
|
|
99
|
+
hash.update(chunk);
|
|
100
|
+
return hash.digest("hex");
|
|
101
|
+
}
|
|
102
|
+
async function assertOwnedPath(path) {
|
|
103
|
+
let current = resolve(path);
|
|
104
|
+
for (; ; ) {
|
|
105
|
+
try {
|
|
106
|
+
if ((await lstat(current)).isSymbolicLink() || resolve(await realpath(current)).toLowerCase() !== current.toLowerCase())
|
|
107
|
+
throw new Error(`Computer runtime path redirects elsewhere: ${current}`);
|
|
108
|
+
} catch (error) {
|
|
109
|
+
if (!(error instanceof Error && "code" in error && error.code === "ENOENT"))
|
|
110
|
+
throw error;
|
|
111
|
+
}
|
|
112
|
+
let parent = dirname(current);
|
|
113
|
+
if (parent === current)
|
|
114
|
+
return;
|
|
115
|
+
current = parent;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
async function runtimeInventory(root, signal) {
|
|
119
|
+
let inventory = {};
|
|
120
|
+
async function walk(path) {
|
|
121
|
+
for (let item of await readdir(path, { withFileTypes: !0 })) {
|
|
122
|
+
let entry = join(path, item.name), key = relative(root, entry);
|
|
123
|
+
if (item.isSymbolicLink()) {
|
|
124
|
+
let target = await readlink(entry), resolved = relative(root, resolve(dirname(entry), target));
|
|
125
|
+
if (isAbsolute(target) || resolved === ".." || resolved.startsWith(`..${process.platform === "win32" ? "\\" : "/"}`) || isAbsolute(resolved))
|
|
126
|
+
throw new Error("Runtime symlink escapes its bundle.");
|
|
127
|
+
inventory[key] = `link:${target}`;
|
|
128
|
+
} else if (item.isDirectory())
|
|
129
|
+
await assertOwnedPath(entry), inventory[key] = "directory", await walk(entry);
|
|
130
|
+
else if (item.isFile())
|
|
131
|
+
await assertOwnedPath(entry), inventory[key] = await digest(entry, signal);
|
|
132
|
+
else
|
|
133
|
+
throw new Error("Unexpected runtime filesystem entry.");
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
return await walk(root), Object.fromEntries(Object.entries(inventory).sort(([a], [b]) => a.localeCompare(b)));
|
|
137
|
+
}
|
|
138
|
+
async function installRuntime(signal) {
|
|
139
|
+
signal?.throwIfAborted();
|
|
140
|
+
let platform = `${process.platform}-${process.arch}`, { archive, sha256 } = await resolveRuntimeArchive();
|
|
141
|
+
if (process.platform === "win32" && process.env.SESSIONNAME === "Services")
|
|
142
|
+
throw new Error("Computer use requires a logged-in interactive desktop.");
|
|
143
|
+
if (await digest(archive, signal) !== sha256)
|
|
144
|
+
throw new Error("Bundled computer-use archive failed SHA-256 verification.");
|
|
145
|
+
let root = join(userInfo().homedir, ".lunr", "desktop");
|
|
146
|
+
await assertOwnedPath(root), await mkdir(root, { recursive: !0, mode: 448 });
|
|
147
|
+
let release = await import_proper_lockfile.default.lock(root, { retries: 0, stale: 12e4 }), temporary = join(root, `extract-${randomUUID()}`), destination = join(root, `runtime-${platform}`);
|
|
148
|
+
try {
|
|
149
|
+
await assertOwnedPath(destination), await mkdir(temporary, { mode: 448 }), await exec(process.platform === "win32" ? join(process.env.SystemRoot ?? "C:\\Windows", "System32", "tar.exe") : "/usr/bin/tar", ["-xf", archive, "-C", temporary], {
|
|
150
|
+
timeout: 3e4,
|
|
151
|
+
windowsHide: !0,
|
|
152
|
+
signal
|
|
153
|
+
});
|
|
154
|
+
let extracted = process.platform === "darwin" ? join(temporary, `cua-driver-rs-${CUA_VERSION}-darwin-arm64`) : temporary, expected = await runtimeInventory(extracted, signal);
|
|
155
|
+
try {
|
|
156
|
+
if (await lstat(destination), JSON.stringify(await runtimeInventory(destination, signal)) !== JSON.stringify(expected))
|
|
157
|
+
throw new Error("Cached computer runtime differs from the verified archive. Remove the inactive lunR runtime directory before reinstalling; it was not executed or overwritten.");
|
|
158
|
+
} catch (error) {
|
|
159
|
+
if (!(error instanceof Error && "code" in error && error.code === "ENOENT"))
|
|
160
|
+
throw error;
|
|
161
|
+
await rename(extracted, destination);
|
|
162
|
+
}
|
|
163
|
+
if (signal?.throwIfAborted(), process.platform === "darwin") {
|
|
164
|
+
let app = join(destination, "CuaDriver.app");
|
|
165
|
+
return await exec("/usr/bin/codesign", ["--verify", "--deep", "--strict", app], { timeout: 15e3, signal }), { app, command: join(app, "Contents", "MacOS", "cua-driver") };
|
|
166
|
+
}
|
|
167
|
+
return { command: join(destination, "cua-driver.exe") };
|
|
168
|
+
} finally {
|
|
169
|
+
await rm(temporary, { recursive: !0, force: !0 }), await release();
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
export {
|
|
174
|
+
CUA_VERSION,
|
|
175
|
+
resolveRuntimeArchive,
|
|
176
|
+
runtimeEnvironment,
|
|
177
|
+
assertOwnedPath,
|
|
178
|
+
runtimeInventory,
|
|
179
|
+
installRuntime
|
|
180
|
+
};
|
|
@@ -3,6 +3,12 @@ import {
|
|
|
3
3
|
loadPhoton
|
|
4
4
|
} from "./chunk-RQ2Q5IYR.js";
|
|
5
5
|
|
|
6
|
+
// packages/coding-agent/dist/utils/image-resize.js
|
|
7
|
+
import { Worker } from "node:worker_threads";
|
|
8
|
+
|
|
9
|
+
// packages/coding-agent/dist/utils/image-resize-core.js
|
|
10
|
+
import { createHash } from "node:crypto";
|
|
11
|
+
|
|
6
12
|
// packages/coding-agent/dist/utils/exif-orientation.js
|
|
7
13
|
function readOrientationFromTiff(bytes, tiffStart) {
|
|
8
14
|
if (tiffStart + 8 > bytes.length)
|
|
@@ -99,42 +105,13 @@ function applyExifOrientation(photon, image, originalBytes) {
|
|
|
99
105
|
}
|
|
100
106
|
}
|
|
101
107
|
|
|
102
|
-
// packages/coding-agent/dist/utils/image-convert.js
|
|
103
|
-
async function convertImageBytesToPng(bytes) {
|
|
104
|
-
let photon = await loadPhoton();
|
|
105
|
-
if (!photon)
|
|
106
|
-
return null;
|
|
107
|
-
try {
|
|
108
|
-
let rawImage = photon.PhotonImage.new_from_byteslice(bytes), image = applyExifOrientation(photon, rawImage, bytes);
|
|
109
|
-
image !== rawImage && rawImage.free();
|
|
110
|
-
try {
|
|
111
|
-
return new Uint8Array(image.get_bytes());
|
|
112
|
-
} finally {
|
|
113
|
-
image.free();
|
|
114
|
-
}
|
|
115
|
-
} catch {
|
|
116
|
-
return null;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
async function convertToPng(base64Data, mimeType) {
|
|
120
|
-
if (mimeType === "image/png")
|
|
121
|
-
return { data: base64Data, mimeType };
|
|
122
|
-
let bytes = new Uint8Array(Buffer.from(base64Data, "base64")), pngBytes = await convertImageBytesToPng(bytes);
|
|
123
|
-
return pngBytes ? {
|
|
124
|
-
data: Buffer.from(pngBytes).toString("base64"),
|
|
125
|
-
mimeType: "image/png"
|
|
126
|
-
} : null;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
// packages/coding-agent/dist/utils/image-resize.js
|
|
130
|
-
import { Worker } from "node:worker_threads";
|
|
131
|
-
|
|
132
108
|
// packages/coding-agent/dist/utils/image-resize-core.js
|
|
133
109
|
var DEFAULT_MAX_BYTES = 4.5 * 1024 * 1024, DEFAULT_OPTIONS = {
|
|
134
110
|
maxWidth: 2e3,
|
|
135
111
|
maxHeight: 2e3,
|
|
136
112
|
maxBytes: DEFAULT_MAX_BYTES,
|
|
137
|
-
jpegQuality: 80
|
|
113
|
+
jpegQuality: 80,
|
|
114
|
+
includePixelFingerprint: !1
|
|
138
115
|
};
|
|
139
116
|
function encodeCandidate(buffer, mimeType) {
|
|
140
117
|
let data = Buffer.from(buffer).toString("base64");
|
|
@@ -162,7 +139,7 @@ async function resizeImageInProcess(inputBytes, mimeType, options) {
|
|
|
162
139
|
}
|
|
163
140
|
}, rawImage = photon.PhotonImage.new_from_byteslice(inputBytes);
|
|
164
141
|
image = applyExifOrientation(photon, rawImage, inputBytes), image !== rawImage && rawImage.free();
|
|
165
|
-
let originalWidth = image.get_width(), originalHeight = image.get_height(), format = mimeType.split("/")[1] ?? "png";
|
|
142
|
+
let originalWidth = image.get_width(), originalHeight = image.get_height(), format = mimeType.split("/")[1] ?? "png", fingerprint = opts.includePixelFingerprint ? createHash("sha256").update(`${originalWidth}x${originalHeight}:`).update(image.get_raw_pixels()).digest("hex") : void 0;
|
|
166
143
|
if (originalWidth <= opts.maxWidth && originalHeight <= opts.maxHeight && inputBase64Size < opts.maxBytes)
|
|
167
144
|
return {
|
|
168
145
|
data: Buffer.from(inputBytes).toString("base64"),
|
|
@@ -171,7 +148,8 @@ async function resizeImageInProcess(inputBytes, mimeType, options) {
|
|
|
171
148
|
originalHeight,
|
|
172
149
|
width: originalWidth,
|
|
173
150
|
height: originalHeight,
|
|
174
|
-
wasResized: !1
|
|
151
|
+
wasResized: !1,
|
|
152
|
+
...fingerprint ? { fingerprint } : {}
|
|
175
153
|
};
|
|
176
154
|
let targetWidth = originalWidth, targetHeight = originalHeight;
|
|
177
155
|
targetWidth > opts.maxWidth && (targetHeight = Math.round(targetHeight * opts.maxWidth / targetWidth), targetWidth = opts.maxWidth), targetHeight > opts.maxHeight && (targetWidth = Math.round(targetWidth * opts.maxHeight / targetHeight), targetHeight = opts.maxHeight);
|
|
@@ -187,7 +165,8 @@ async function resizeImageInProcess(inputBytes, mimeType, options) {
|
|
|
187
165
|
originalHeight,
|
|
188
166
|
width: currentWidth,
|
|
189
167
|
height: currentHeight,
|
|
190
|
-
wasResized: !0
|
|
168
|
+
wasResized: !0,
|
|
169
|
+
...fingerprint ? { fingerprint } : {}
|
|
191
170
|
};
|
|
192
171
|
if (currentWidth === 1 && currentHeight === 1)
|
|
193
172
|
break;
|
|
@@ -267,76 +246,8 @@ function formatDimensionNote(result) {
|
|
|
267
246
|
return `[Image: original ${result.originalWidth}x${result.originalHeight}, displayed at ${result.width}x${result.height}. Multiply coordinates by ${scale.toFixed(2)} to map to original image.]`;
|
|
268
247
|
}
|
|
269
248
|
|
|
270
|
-
// packages/coding-agent/dist/utils/image-process.js
|
|
271
|
-
function baseMimeType(mimeType) {
|
|
272
|
-
return mimeType.split(";")[0]?.trim().toLowerCase() ?? mimeType.toLowerCase();
|
|
273
|
-
}
|
|
274
|
-
function normalizeSupportedImageMimeType(mimeType) {
|
|
275
|
-
switch (baseMimeType(mimeType)) {
|
|
276
|
-
case "image/png":
|
|
277
|
-
return "image/png";
|
|
278
|
-
case "image/jpeg":
|
|
279
|
-
case "image/jpg":
|
|
280
|
-
return "image/jpeg";
|
|
281
|
-
case "image/gif":
|
|
282
|
-
return "image/gif";
|
|
283
|
-
case "image/webp":
|
|
284
|
-
return "image/webp";
|
|
285
|
-
default:
|
|
286
|
-
return null;
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
async function normalizeImage(bytes, mimeType) {
|
|
290
|
-
let normalizedMimeType = normalizeSupportedImageMimeType(mimeType);
|
|
291
|
-
if (normalizedMimeType)
|
|
292
|
-
return { bytes, mimeType: normalizedMimeType };
|
|
293
|
-
let pngBytes = await convertImageBytesToPng(bytes);
|
|
294
|
-
return pngBytes ? {
|
|
295
|
-
bytes: pngBytes,
|
|
296
|
-
mimeType: "image/png",
|
|
297
|
-
convertedFrom: baseMimeType(mimeType)
|
|
298
|
-
} : null;
|
|
299
|
-
}
|
|
300
|
-
function conversionHint(from, to) {
|
|
301
|
-
if (!(!from || from === to))
|
|
302
|
-
return `[Image converted from ${from} to ${to}.]`;
|
|
303
|
-
}
|
|
304
|
-
async function processImage(bytes, mimeType, options) {
|
|
305
|
-
let autoResizeImages = options?.autoResizeImages ?? !0, normalized = await normalizeImage(bytes, mimeType);
|
|
306
|
-
if (!normalized)
|
|
307
|
-
return {
|
|
308
|
-
ok: !1,
|
|
309
|
-
message: "[Image omitted: could not be converted to a supported inline image format.]"
|
|
310
|
-
};
|
|
311
|
-
if (autoResizeImages) {
|
|
312
|
-
let resized = await resizeImage(normalized.bytes, normalized.mimeType, options?.resizeOptions);
|
|
313
|
-
if (!resized)
|
|
314
|
-
return {
|
|
315
|
-
ok: !1,
|
|
316
|
-
message: "[Image omitted: could not be resized below the inline image size limit.]"
|
|
317
|
-
};
|
|
318
|
-
let hints2 = [], convertedHint2 = conversionHint(normalized.convertedFrom, resized.mimeType);
|
|
319
|
-
convertedHint2 && hints2.push(convertedHint2);
|
|
320
|
-
let dimensionNote = formatDimensionNote(resized);
|
|
321
|
-
return dimensionNote && hints2.push(dimensionNote), {
|
|
322
|
-
ok: !0,
|
|
323
|
-
data: resized.data,
|
|
324
|
-
mimeType: resized.mimeType,
|
|
325
|
-
hints: hints2
|
|
326
|
-
};
|
|
327
|
-
}
|
|
328
|
-
let hints = [], convertedHint = conversionHint(normalized.convertedFrom, normalized.mimeType);
|
|
329
|
-
return convertedHint && hints.push(convertedHint), {
|
|
330
|
-
ok: !0,
|
|
331
|
-
data: Buffer.from(normalized.bytes).toString("base64"),
|
|
332
|
-
mimeType: normalized.mimeType,
|
|
333
|
-
hints
|
|
334
|
-
};
|
|
335
|
-
}
|
|
336
|
-
|
|
337
249
|
export {
|
|
338
|
-
|
|
250
|
+
applyExifOrientation,
|
|
339
251
|
resizeImage,
|
|
340
|
-
formatDimensionNote
|
|
341
|
-
processImage
|
|
252
|
+
formatDimensionNote
|
|
342
253
|
};
|