approval-box 0.1.30 → 0.1.31
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.
|
@@ -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-ACEZENFU.mjs";
|
|
6
6
|
|
|
7
7
|
// src/hooks/receive.ts
|
|
8
8
|
await runChannelReceiveMain(PROFILE);
|
|
@@ -22268,8 +22268,10 @@ export {
|
|
|
22268
22268
|
PROFILE,
|
|
22269
22269
|
claudeHookRoot,
|
|
22270
22270
|
cursorHookRoot,
|
|
22271
|
+
channelRoot,
|
|
22271
22272
|
CodexDeliveryError,
|
|
22272
22273
|
withoutBom,
|
|
22274
|
+
processIsRunning,
|
|
22273
22275
|
setupNodeExecutable,
|
|
22274
22276
|
liveNodeExecutable,
|
|
22275
22277
|
safeParse,
|
package/dist/cli.mjs
CHANGED
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
channelDeliveryState,
|
|
17
17
|
channelMarker,
|
|
18
18
|
channelReceiveProcess,
|
|
19
|
+
channelRoot,
|
|
19
20
|
claudeHookRoot,
|
|
20
21
|
claudeParentFromRequest,
|
|
21
22
|
claudeParentHooksRegistered,
|
|
@@ -41,6 +42,7 @@ import {
|
|
|
41
42
|
openChannel,
|
|
42
43
|
optional,
|
|
43
44
|
preprocess,
|
|
45
|
+
processIsRunning,
|
|
44
46
|
readChannel,
|
|
45
47
|
record,
|
|
46
48
|
removeClaudeParentHooks,
|
|
@@ -57,7 +59,7 @@ import {
|
|
|
57
59
|
waitProcessCommandLine,
|
|
58
60
|
withCodexReceiver,
|
|
59
61
|
withdrawFromChannel
|
|
60
|
-
} from "./chunks/chunk-
|
|
62
|
+
} from "./chunks/chunk-ACEZENFU.mjs";
|
|
61
63
|
|
|
62
64
|
// ../../node_modules/qrcode/lib/can-promise.js
|
|
63
65
|
var require_can_promise = __commonJS({
|
|
@@ -12096,6 +12098,7 @@ function runtimeEntry(kind) {
|
|
|
12096
12098
|
var lockFile = () => join5(stateRoot(), "daemon.json");
|
|
12097
12099
|
var journalFile = () => join5(stateRoot(), "deliveries.json");
|
|
12098
12100
|
var IDLE_EXIT_MS = 30 * 6e4;
|
|
12101
|
+
var ORPHAN_GRACE_MS = 5 * 6e4;
|
|
12099
12102
|
function alive(pid) {
|
|
12100
12103
|
try {
|
|
12101
12104
|
process.kill(pid, 0);
|
|
@@ -12128,6 +12131,31 @@ function shouldReplaceDaemon(runningEntry, myEntry) {
|
|
|
12128
12131
|
function daemonNode(executable = process.execPath, exists = existsSync3) {
|
|
12129
12132
|
return liveNodeExecutable(executable, exists);
|
|
12130
12133
|
}
|
|
12134
|
+
function receiverOf(channelId, profile = PROFILE, running = processIsRunning) {
|
|
12135
|
+
let claude;
|
|
12136
|
+
try {
|
|
12137
|
+
if (channelClosed(profile, channelId)) return "closed";
|
|
12138
|
+
claude = readChannel(profile, channelId).claude;
|
|
12139
|
+
} catch {
|
|
12140
|
+
return "present";
|
|
12141
|
+
}
|
|
12142
|
+
if (!claude || running(claude.parent_pid, claude.parent_started_identity)) return "present";
|
|
12143
|
+
try {
|
|
12144
|
+
const waiter = JSON.parse(readFileSync3(join5(channelRoot(profile), "claude-sessions", claude.session_id, "waiter.json"), "utf8"));
|
|
12145
|
+
if (typeof waiter.pid === "number" && typeof waiter.started_identity === "string" && running(waiter.pid, waiter.started_identity)) return "present";
|
|
12146
|
+
} catch {
|
|
12147
|
+
}
|
|
12148
|
+
return "gone";
|
|
12149
|
+
}
|
|
12150
|
+
function abandoned(entry, receiver, now = Date.now()) {
|
|
12151
|
+
if (receiver === "present") {
|
|
12152
|
+
delete entry.orphaned_at;
|
|
12153
|
+
return false;
|
|
12154
|
+
}
|
|
12155
|
+
if (receiver === "closed") return true;
|
|
12156
|
+
entry.orphaned_at ??= new Date(now).toISOString();
|
|
12157
|
+
return now - Date.parse(entry.orphaned_at) >= ORPHAN_GRACE_MS;
|
|
12158
|
+
}
|
|
12131
12159
|
function ensureDaemon() {
|
|
12132
12160
|
try {
|
|
12133
12161
|
if (!readConfig()?.token) return;
|
|
@@ -12223,8 +12251,14 @@ async function runDaemon() {
|
|
|
12223
12251
|
if (current === "emitted") Object.assign(entry, { state: "report", result: "delivered" });
|
|
12224
12252
|
else if (current === "unknown") Object.assign(entry, { state: "report", result: "unknown", detail: "\u53D7\u3051\u53E3\u306E\u51FA\u529B\u3092\u78BA\u304B\u3081\u3089\u308C\u307E\u305B\u3093\u3067\u3057\u305F" });
|
|
12225
12253
|
else if (current === null || current === "withdrawn") Object.assign(entry, { state: "report", result: "failed", detail: "\u914D\u9001\u306E\u8A18\u9332\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093" });
|
|
12226
|
-
else if (current === "queued"
|
|
12227
|
-
|
|
12254
|
+
else if (current === "queued") {
|
|
12255
|
+
const before = entry.orphaned_at;
|
|
12256
|
+
const giveUp = abandoned(entry, receiverOf(entry.channel_id));
|
|
12257
|
+
if (entry.orphaned_at !== before) save();
|
|
12258
|
+
if (!giveUp) continue;
|
|
12259
|
+
if (!withdrawFromChannel(PROFILE, entry.channel_id, entry.delivery_id)) continue;
|
|
12260
|
+
Object.assign(entry, { state: "report", result: "failed", detail: "\u7533\u8ACB\u3092\u51FA\u3057\u305FAI\u306E\u4F1A\u8A71\u304C\u7D42\u308F\u3063\u3066\u3044\u307E\u3059" });
|
|
12261
|
+
} else continue;
|
|
12228
12262
|
save();
|
|
12229
12263
|
log(`\u914D\u9001 ${id} \u2192 ${entry.result}`);
|
|
12230
12264
|
await report(id);
|
|
@@ -16028,7 +16062,7 @@ function claudeChannelIsCurrent(profile, channelId, parent) {
|
|
|
16028
16062
|
}
|
|
16029
16063
|
|
|
16030
16064
|
// src/version.ts
|
|
16031
|
-
var VERSION = true ? "0.1.
|
|
16065
|
+
var VERSION = true ? "0.1.31" : "0.0.0-dev";
|
|
16032
16066
|
function osName() {
|
|
16033
16067
|
return process.platform === "darwin" ? "macos" : process.platform === "win32" ? "windows" : process.platform;
|
|
16034
16068
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "approval-box",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.31",
|
|
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",
|