approval-box 0.1.24 → 0.1.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/dist/THIRD_PARTY_NOTICES.md +1 -1
- package/dist/approval-box-claude-hook.mjs +1 -1
- package/dist/approval-box-cursor-hook.mjs +1 -1
- package/dist/approval-box-receive.mjs +1 -1
- package/dist/chunks/{chunk-HBSDWG62.mjs → chunk-XTKJLDHY.mjs} +45 -34
- package/dist/cli.mjs +21 -6
- package/package.json +2 -2
|
@@ -2,7 +2,7 @@ import { createRequire as __kbCreateRequire } from 'node:module'; const require
|
|
|
2
2
|
import {
|
|
3
3
|
PROFILE,
|
|
4
4
|
runChannelReceiveMain
|
|
5
|
-
} from "./chunks/chunk-
|
|
5
|
+
} from "./chunks/chunk-XTKJLDHY.mjs";
|
|
6
6
|
|
|
7
7
|
// src/hooks/receive.ts
|
|
8
8
|
await runChannelReceiveMain(PROFILE);
|
|
@@ -19783,6 +19783,31 @@ var SetupError = class extends Error {
|
|
|
19783
19783
|
}
|
|
19784
19784
|
};
|
|
19785
19785
|
|
|
19786
|
+
// ../../node_modules/aiterm-steer-delivery/dist/setup-node.js
|
|
19787
|
+
import { accessSync, constants, existsSync } from "node:fs";
|
|
19788
|
+
var BREW_NODE = /^(.*)\/Cellar\/(node(?:@\d+)?)\/[^/]+\/bin\/node$/;
|
|
19789
|
+
function setupNodeExecutable(executable = process.execPath) {
|
|
19790
|
+
const brew = BREW_NODE.exec(executable);
|
|
19791
|
+
if (!brew)
|
|
19792
|
+
return executable;
|
|
19793
|
+
const node2 = `${brew[1]}/opt/${brew[2]}/bin/node`;
|
|
19794
|
+
try {
|
|
19795
|
+
accessSync(node2, constants.X_OK);
|
|
19796
|
+
} catch {
|
|
19797
|
+
throw new SetupError("node_runtime_unavailable", "Homebrew\u306ENode\u8D77\u52D5\u5148\u3092\u5B9F\u884C\u3067\u304D\u307E\u305B\u3093\u3002Node\u306E\u5C0E\u5165\u72B6\u614B\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044");
|
|
19798
|
+
}
|
|
19799
|
+
return node2;
|
|
19800
|
+
}
|
|
19801
|
+
function liveNodeExecutable(executable = process.execPath, exists = existsSync) {
|
|
19802
|
+
const brew = BREW_NODE.exec(executable);
|
|
19803
|
+
if (brew) {
|
|
19804
|
+
const opt = `${brew[1]}/opt/${brew[2]}/bin/node`;
|
|
19805
|
+
if (exists(opt))
|
|
19806
|
+
return opt;
|
|
19807
|
+
}
|
|
19808
|
+
return exists(executable) ? executable : "node";
|
|
19809
|
+
}
|
|
19810
|
+
|
|
19786
19811
|
// ../../node_modules/aiterm-steer-delivery/dist/files.js
|
|
19787
19812
|
import * as fs from "node:fs";
|
|
19788
19813
|
import * as path2 from "node:path";
|
|
@@ -20025,7 +20050,7 @@ function resolveCodexExecutable() {
|
|
|
20025
20050
|
}
|
|
20026
20051
|
return null;
|
|
20027
20052
|
}
|
|
20028
|
-
function codexSpawnEnv(env = process.env, node2 =
|
|
20053
|
+
function codexSpawnEnv(env = process.env, node2 = liveNodeExecutable(), platform = process.platform) {
|
|
20029
20054
|
const windows = platform === "win32";
|
|
20030
20055
|
const key = Object.keys(env).find((name) => windows ? name.toLowerCase() === "path" : name === "PATH") ?? "PATH";
|
|
20031
20056
|
const delimiter2 = windows ? ";" : ":";
|
|
@@ -20486,7 +20511,7 @@ function startCodexWakeWatch(profile, parent, deliveryId, options = {}) {
|
|
|
20486
20511
|
delivery_id: deliveryId,
|
|
20487
20512
|
...options.delay_ms === void 0 ? {} : { delay_ms: options.delay_ms }
|
|
20488
20513
|
});
|
|
20489
|
-
const child = spawn(
|
|
20514
|
+
const child = spawn(liveNodeExecutable(), [entry], { detached: true, stdio: "ignore", windowsHide: true, env: { ...env, [CODEX_WAKE_PAYLOAD_ENV]: payload } });
|
|
20490
20515
|
child.on("error", () => {
|
|
20491
20516
|
});
|
|
20492
20517
|
child.unref();
|
|
@@ -20816,7 +20841,7 @@ import { homedir as homedir3 } from "node:os";
|
|
|
20816
20841
|
import * as path8 from "node:path";
|
|
20817
20842
|
|
|
20818
20843
|
// ../../node_modules/aiterm-steer-delivery/dist/hook-setup.js
|
|
20819
|
-
import { copyFileSync, existsSync as
|
|
20844
|
+
import { copyFileSync, existsSync as existsSync7, lstatSync, mkdirSync as mkdirSync4, readFileSync as readFileSync5, realpathSync as realpathSync3, renameSync as renameSync2, unlinkSync as unlinkSync2, writeFileSync as writeFileSync3 } from "node:fs";
|
|
20820
20845
|
import { dirname as dirname3 } from "node:path";
|
|
20821
20846
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
20822
20847
|
import { isDeepStrictEqual } from "node:util";
|
|
@@ -20853,9 +20878,9 @@ function claudeParentHookEntries(profile, hook, platform = process.platform) {
|
|
|
20853
20878
|
}
|
|
20854
20879
|
var OPTIONAL_CLAUDE_EVENTS = /* @__PURE__ */ new Set(["SessionStart"]);
|
|
20855
20880
|
function mergeClaudeParentHooks(profile, file2, hook) {
|
|
20856
|
-
const target2 =
|
|
20881
|
+
const target2 = existsSync7(file2) ? realpathSync3(file2) : file2;
|
|
20857
20882
|
let current = {};
|
|
20858
|
-
if (
|
|
20883
|
+
if (existsSync7(target2)) {
|
|
20859
20884
|
try {
|
|
20860
20885
|
current = JSON.parse(readFileSync5(target2, "utf8"));
|
|
20861
20886
|
} catch {
|
|
@@ -20890,11 +20915,11 @@ function mergeClaudeParentHooks(profile, file2, hook) {
|
|
|
20890
20915
|
try {
|
|
20891
20916
|
writeFileSync3(temporary, `${JSON.stringify(next, null, 2)}
|
|
20892
20917
|
`, { mode: 384, flag: "wx" });
|
|
20893
|
-
if (
|
|
20918
|
+
if (existsSync7(target2))
|
|
20894
20919
|
copyFileSync(target2, `${target2}${profile.backup_suffix}`);
|
|
20895
20920
|
renameSync2(temporary, target2);
|
|
20896
20921
|
} finally {
|
|
20897
|
-
if (
|
|
20922
|
+
if (existsSync7(temporary))
|
|
20898
20923
|
unlinkSync2(temporary);
|
|
20899
20924
|
}
|
|
20900
20925
|
if (!isDeepStrictEqual(JSON.parse(readFileSync5(target2, "utf8")), next)) {
|
|
@@ -20919,7 +20944,7 @@ function claudeParentHooksRegistered(profile, document) {
|
|
|
20919
20944
|
return Object.keys(claudeParentHookEntries(profile, { command: "", script: profile.hooks.claude })).filter((event) => !OPTIONAL_CLAUDE_EVENTS.has(event)).every((event) => ownedClaudeParentHooks(profile, document, event).length > 0);
|
|
20920
20945
|
}
|
|
20921
20946
|
function removeClaudeParentHooks(profile, file2) {
|
|
20922
|
-
if (!
|
|
20947
|
+
if (!existsSync7(file2))
|
|
20923
20948
|
return "unchanged";
|
|
20924
20949
|
const target2 = realpathSync3(file2);
|
|
20925
20950
|
const current = JSON.parse(readFileSync5(target2, "utf8"));
|
|
@@ -20950,7 +20975,7 @@ function removeClaudeParentHooks(profile, file2) {
|
|
|
20950
20975
|
copyFileSync(target2, `${target2}${profile.backup_suffix}`);
|
|
20951
20976
|
renameSync2(temporary, target2);
|
|
20952
20977
|
} finally {
|
|
20953
|
-
if (
|
|
20978
|
+
if (existsSync7(temporary))
|
|
20954
20979
|
unlinkSync2(temporary);
|
|
20955
20980
|
}
|
|
20956
20981
|
if (!isDeepStrictEqual(JSON.parse(readFileSync5(target2, "utf8")), next))
|
|
@@ -20969,9 +20994,9 @@ function ownsCursorParentHook(profile, hook) {
|
|
|
20969
20994
|
return record2(hook) && typeof hook.command === "string" && commandNamesFile(hook.command, profile.hooks.cursor);
|
|
20970
20995
|
}
|
|
20971
20996
|
function mergeCursorParentHooks(profile, file2, hook) {
|
|
20972
|
-
const target2 =
|
|
20997
|
+
const target2 = existsSync7(file2) ? realpathSync3(file2) : file2;
|
|
20973
20998
|
let current = { version: 1, hooks: {} };
|
|
20974
|
-
if (
|
|
20999
|
+
if (existsSync7(target2)) {
|
|
20975
21000
|
try {
|
|
20976
21001
|
current = JSON.parse(readFileSync5(target2, "utf8"));
|
|
20977
21002
|
} catch {
|
|
@@ -21010,11 +21035,11 @@ function mergeCursorParentHooks(profile, file2, hook) {
|
|
|
21010
21035
|
try {
|
|
21011
21036
|
writeFileSync3(temporary, `${JSON.stringify(next, null, 2)}
|
|
21012
21037
|
`, { mode: 384, flag: "wx" });
|
|
21013
|
-
if (
|
|
21038
|
+
if (existsSync7(target2))
|
|
21014
21039
|
copyFileSync(target2, `${target2}${profile.backup_suffix}`);
|
|
21015
21040
|
renameSync2(temporary, target2);
|
|
21016
21041
|
} finally {
|
|
21017
|
-
if (
|
|
21042
|
+
if (existsSync7(temporary))
|
|
21018
21043
|
unlinkSync2(temporary);
|
|
21019
21044
|
}
|
|
21020
21045
|
if (!isDeepStrictEqual(JSON.parse(readFileSync5(target2, "utf8")), next)) {
|
|
@@ -21023,7 +21048,7 @@ function mergeCursorParentHooks(profile, file2, hook) {
|
|
|
21023
21048
|
return "configured";
|
|
21024
21049
|
}
|
|
21025
21050
|
function removeCursorParentHooks(profile, file2) {
|
|
21026
|
-
if (!
|
|
21051
|
+
if (!existsSync7(file2))
|
|
21027
21052
|
return "unchanged";
|
|
21028
21053
|
const target2 = realpathSync3(file2);
|
|
21029
21054
|
const current = JSON.parse(readFileSync5(target2, "utf8"));
|
|
@@ -21054,7 +21079,7 @@ function removeCursorParentHooks(profile, file2) {
|
|
|
21054
21079
|
copyFileSync(target2, `${target2}${profile.backup_suffix}`);
|
|
21055
21080
|
renameSync2(temporary, target2);
|
|
21056
21081
|
} finally {
|
|
21057
|
-
if (
|
|
21082
|
+
if (existsSync7(temporary))
|
|
21058
21083
|
unlinkSync2(temporary);
|
|
21059
21084
|
}
|
|
21060
21085
|
if (!isDeepStrictEqual(JSON.parse(readFileSync5(target2, "utf8")), next)) {
|
|
@@ -21673,7 +21698,7 @@ async function handleCursorChannelHook(profile, event, emit) {
|
|
|
21673
21698
|
await emitClaimed(claimed, "cursor_hook", (texts) => emit(texts.join("\n\n")));
|
|
21674
21699
|
return true;
|
|
21675
21700
|
}
|
|
21676
|
-
function channelReceiveProcess(script, channelId, executable =
|
|
21701
|
+
function channelReceiveProcess(script, channelId, executable = liveNodeExecutable()) {
|
|
21677
21702
|
const args = [script, "--channel", uuid3.parse(channelId)];
|
|
21678
21703
|
return { executable, args, windows_start_process_argument_list: process.platform === "win32" ? windowsStartProcessArgumentList(args) : null };
|
|
21679
21704
|
}
|
|
@@ -21776,21 +21801,6 @@ async function runChannelReceiveMain(profile, argv = process.argv.slice(2), scri
|
|
|
21776
21801
|
}
|
|
21777
21802
|
}
|
|
21778
21803
|
|
|
21779
|
-
// ../../node_modules/aiterm-steer-delivery/dist/setup-node.js
|
|
21780
|
-
import { accessSync as accessSync3, constants as constants3 } from "node:fs";
|
|
21781
|
-
function setupNodeExecutable(executable = process.execPath) {
|
|
21782
|
-
const brew = /^(.*)\/Cellar\/(node(?:@\d+)?)\/[^/]+\/bin\/node$/.exec(executable);
|
|
21783
|
-
if (!brew)
|
|
21784
|
-
return executable;
|
|
21785
|
-
const node2 = `${brew[1]}/opt/${brew[2]}/bin/node`;
|
|
21786
|
-
try {
|
|
21787
|
-
accessSync3(node2, constants3.X_OK);
|
|
21788
|
-
} catch {
|
|
21789
|
-
throw new SetupError("node_runtime_unavailable", "Homebrew\u306ENode\u8D77\u52D5\u5148\u3092\u5B9F\u884C\u3067\u304D\u307E\u305B\u3093\u3002Node\u306E\u5C0E\u5165\u72B6\u614B\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044");
|
|
21790
|
-
}
|
|
21791
|
-
return node2;
|
|
21792
|
-
}
|
|
21793
|
-
|
|
21794
21804
|
// ../../node_modules/aiterm-steer-delivery/dist/aiterm-provider.js
|
|
21795
21805
|
import { spawn as spawn3 } from "node:child_process";
|
|
21796
21806
|
import * as fs8 from "node:fs";
|
|
@@ -21815,7 +21825,7 @@ function findAitermDeliveryProvider(options = {}) {
|
|
|
21815
21825
|
const env = options.env ?? process.env;
|
|
21816
21826
|
const explicit = options.cli ?? env.AITERM_PARENT_DELIVERY_CLI;
|
|
21817
21827
|
if (explicit) {
|
|
21818
|
-
return path10.isAbsolute(explicit) && isFile(explicit) ? { node: options.node ??
|
|
21828
|
+
return path10.isAbsolute(explicit) && isFile(explicit) ? { node: options.node ?? liveNodeExecutable(), cli: explicit, version: null, source: "explicit" } : null;
|
|
21819
21829
|
}
|
|
21820
21830
|
const home2 = options.home ?? env.HOME ?? os2.homedir();
|
|
21821
21831
|
try {
|
|
@@ -21829,14 +21839,14 @@ function findAitermDeliveryProvider(options = {}) {
|
|
|
21829
21839
|
if (process.platform === "win32") {
|
|
21830
21840
|
const cli = path10.join(directory2, "node_modules", "aiterm-mcp", "dist", "parent-delivery-cli.js");
|
|
21831
21841
|
if (isFile(path10.join(directory2, "aiterm-parent-delivery.cmd")) && isFile(cli))
|
|
21832
|
-
return { node: options.node ??
|
|
21842
|
+
return { node: options.node ?? liveNodeExecutable(), cli, version: null, source: "path" };
|
|
21833
21843
|
continue;
|
|
21834
21844
|
}
|
|
21835
21845
|
const shim = path10.join(directory2, "aiterm-parent-delivery");
|
|
21836
21846
|
if (!isFile(shim))
|
|
21837
21847
|
continue;
|
|
21838
21848
|
try {
|
|
21839
|
-
return { node: options.node ??
|
|
21849
|
+
return { node: options.node ?? liveNodeExecutable(), cli: fs8.realpathSync(shim), version: null, source: "path" };
|
|
21840
21850
|
} catch {
|
|
21841
21851
|
}
|
|
21842
21852
|
}
|
|
@@ -22212,6 +22222,7 @@ export {
|
|
|
22212
22222
|
CodexDeliveryError,
|
|
22213
22223
|
withoutBom,
|
|
22214
22224
|
setupNodeExecutable,
|
|
22225
|
+
liveNodeExecutable,
|
|
22215
22226
|
safeParse,
|
|
22216
22227
|
string2 as string,
|
|
22217
22228
|
number2 as number,
|
package/dist/cli.mjs
CHANGED
|
@@ -32,6 +32,7 @@ import {
|
|
|
32
32
|
isCursorMcpClient,
|
|
33
33
|
iso_exports,
|
|
34
34
|
literal,
|
|
35
|
+
liveNodeExecutable,
|
|
35
36
|
looseObject,
|
|
36
37
|
mergeClaudeParentHooks,
|
|
37
38
|
mergeCursorParentHooks,
|
|
@@ -56,7 +57,7 @@ import {
|
|
|
56
57
|
waitProcessCommandLine,
|
|
57
58
|
withCodexReceiver,
|
|
58
59
|
withdrawFromChannel
|
|
59
|
-
} from "./chunks/chunk-
|
|
60
|
+
} from "./chunks/chunk-XTKJLDHY.mjs";
|
|
60
61
|
|
|
61
62
|
// ../../node_modules/qrcode/lib/can-promise.js
|
|
62
63
|
var require_can_promise = __commonJS({
|
|
@@ -11883,7 +11884,7 @@ function writeConfig(config) {
|
|
|
11883
11884
|
|
|
11884
11885
|
// src/daemon-launch.ts
|
|
11885
11886
|
import { spawn, spawnSync } from "node:child_process";
|
|
11886
|
-
import { closeSync, openSync } from "node:fs";
|
|
11887
|
+
import { appendFileSync, closeSync, openSync } from "node:fs";
|
|
11887
11888
|
import { join as join2, resolve } from "node:path";
|
|
11888
11889
|
function windowsDaemonLaunchScript(executable, entry, cwd, environment) {
|
|
11889
11890
|
const env = Object.fromEntries(["APPROVAL_BOX_HOME", "HOME", "USERPROFILE", "APPDATA", "LOCALAPPDATA", "PATH", "CODEX_HOME", "GROK_HOME", "CODEX_BIN"].flatMap((key) => environment[key] === void 0 ? [] : [[key, environment[key]]]));
|
|
@@ -11900,9 +11901,20 @@ function launchDaemon(executable, entry, cwd) {
|
|
|
11900
11901
|
if (result.error || result.status !== 0 || !/^\s*\d+\s*$/.test(result.stdout ?? "")) throw new Error(`Windows\u306E\u5E38\u99D0\u8D77\u52D5\u306B\u5931\u6557\u3057\u307E\u3057\u305F\uFF08${result.error?.message ?? `exit ${result.status}`}\uFF09`);
|
|
11901
11902
|
return;
|
|
11902
11903
|
}
|
|
11903
|
-
const
|
|
11904
|
+
const file = join2(cwd, "daemon.log");
|
|
11905
|
+
const log = openSync(file, "a", 384);
|
|
11904
11906
|
try {
|
|
11905
|
-
spawn(executable, [entry, "daemon"], { cwd, detached: true, stdio: ["ignore", "ignore", log], windowsHide: true })
|
|
11907
|
+
const child = spawn(executable, [entry, "daemon"], { cwd, detached: true, stdio: ["ignore", "ignore", log], windowsHide: true });
|
|
11908
|
+
child.on("error", (error) => {
|
|
11909
|
+
const line = `approval-box: \u914D\u9001\u30C7\u30FC\u30E2\u30F3\u3092\u8D77\u52D5\u3067\u304D\u307E\u305B\u3093\uFF08DAEMON_LAUNCH_FAILED\uFF09: ${executable}: ${error.message}
|
|
11910
|
+
`;
|
|
11911
|
+
try {
|
|
11912
|
+
appendFileSync(file, `${(/* @__PURE__ */ new Date()).toISOString()} ${line}`, { mode: 384 });
|
|
11913
|
+
} catch {
|
|
11914
|
+
}
|
|
11915
|
+
process.stderr.write(line);
|
|
11916
|
+
});
|
|
11917
|
+
child.unref();
|
|
11906
11918
|
} finally {
|
|
11907
11919
|
closeSync(log);
|
|
11908
11920
|
}
|
|
@@ -12030,6 +12042,9 @@ function shouldReplaceDaemon(runningEntry, myEntry) {
|
|
|
12030
12042
|
for (let i = 0; i < 3; i++) if (running[i] !== mine[i]) return running[i] < mine[i];
|
|
12031
12043
|
return true;
|
|
12032
12044
|
}
|
|
12045
|
+
function daemonNode(executable = process.execPath, exists = existsSync3) {
|
|
12046
|
+
return liveNodeExecutable(executable, exists);
|
|
12047
|
+
}
|
|
12033
12048
|
function ensureDaemon() {
|
|
12034
12049
|
try {
|
|
12035
12050
|
if (!readConfig()?.token) return;
|
|
@@ -12042,7 +12057,7 @@ function ensureDaemon() {
|
|
|
12042
12057
|
}
|
|
12043
12058
|
}
|
|
12044
12059
|
mkdirSync3(stateRoot(), { recursive: true, mode: 448 });
|
|
12045
|
-
launchDaemon(
|
|
12060
|
+
launchDaemon(daemonNode(), runtimeEntry("cli"), stateRoot());
|
|
12046
12061
|
} catch (error) {
|
|
12047
12062
|
process.stderr.write(`approval-box: \u914D\u9001\u30C7\u30FC\u30E2\u30F3\u3092\u8D77\u52D5\u3067\u304D\u307E\u305B\u3093: ${error.message}
|
|
12048
12063
|
`);
|
|
@@ -15907,7 +15922,7 @@ function claudeChannelIsCurrent(profile, channelId, parent) {
|
|
|
15907
15922
|
}
|
|
15908
15923
|
|
|
15909
15924
|
// src/version.ts
|
|
15910
|
-
var VERSION = true ? "0.1.
|
|
15925
|
+
var VERSION = true ? "0.1.25" : "0.0.0-dev";
|
|
15911
15926
|
function osName() {
|
|
15912
15927
|
return process.platform === "darwin" ? "macos" : process.platform === "win32" ? "windows" : process.platform;
|
|
15913
15928
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "approval-box",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.25",
|
|
4
4
|
"description": "Approval Box connector: lets Claude Code, Codex, Cursor and Grok ask you for a decision, and steers your answer back into the same session.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://approval-box.kitepon.dev",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"@modelcontextprotocol/sdk": "^1.31.0",
|
|
33
33
|
"@types/node": "^25.9.1",
|
|
34
34
|
"@types/qrcode": "^1.5.5",
|
|
35
|
-
"aiterm-steer-delivery": "0.4.
|
|
35
|
+
"aiterm-steer-delivery": "0.4.6",
|
|
36
36
|
"esbuild": "^0.28.2",
|
|
37
37
|
"qrcode": "^1.5.4",
|
|
38
38
|
"typescript": "^6.0.3",
|