@pushary/agent-hooks 0.89.11 → 0.89.13
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 +55 -0
- package/README.md +4 -2
- package/dist/bin/pushary-bell-hook.js +5 -5
- package/dist/bin/pushary-bell.js +11 -11
- package/dist/bin/pushary-claude.js +225 -48
- package/dist/bin/pushary-clean.js +49 -29
- package/dist/bin/pushary-codex-bridge.js +17 -16
- package/dist/bin/pushary-codex-hook.js +11 -10
- package/dist/bin/pushary-codex.js +7 -7
- package/dist/bin/pushary-connect.js +12 -12
- package/dist/bin/pushary-daemon-supervisor.d.ts +1 -0
- package/dist/bin/pushary-daemon-supervisor.js +27 -0
- package/dist/bin/pushary-daemon.js +22 -22
- package/dist/bin/pushary-disconnect.js +9 -9
- package/dist/bin/pushary-doctor.js +59 -49
- package/dist/bin/pushary-elicitation-hook.js +4 -4
- package/dist/bin/pushary-gemini-bridge.js +16 -15
- package/dist/bin/pushary-gemini-hook.js +10 -9
- package/dist/bin/pushary-hook.js +13 -13
- package/dist/bin/pushary-login.js +11 -11
- package/dist/bin/pushary-logout.js +11 -11
- package/dist/bin/pushary-mode.js +5 -5
- package/dist/bin/pushary-notification-hook.js +7 -7
- package/dist/bin/pushary-opencode-hook.js +10 -9
- package/dist/bin/pushary-permission-denied-hook.js +11 -11
- package/dist/bin/pushary-permission-hook.js +11 -11
- package/dist/bin/pushary-post-hook.js +7 -7
- package/dist/bin/pushary-prompt-hook.js +7 -7
- package/dist/bin/pushary-session-end-hook.js +7 -7
- package/dist/bin/pushary-session-start-hook.js +7 -7
- package/dist/bin/pushary-setup.js +87 -59
- package/dist/bin/pushary-stats.js +4 -4
- package/dist/bin/pushary-status.js +14 -14
- package/dist/bin/pushary-stop-hook.js +7 -7
- package/dist/bin/pushary-stopfailure-hook.js +7 -7
- package/dist/bin/pushary-suggestions.js +2 -2
- package/dist/bin/pushary-transcripts.d.ts +1 -0
- package/dist/bin/pushary-transcripts.js +79 -0
- package/dist/bin/pushary-upgrade.js +21 -21
- package/dist/bin/pushary-wait.js +5 -5
- package/dist/bin/pushary.js +3 -2
- package/dist/{chunk-6XUABEX2.js → chunk-3OXHYPZG.js} +1 -1
- package/dist/{chunk-QA72MKIT.js → chunk-3YGGEDJK.js} +5 -5
- package/dist/{chunk-IUN6VOKV.js → chunk-4IPSMEGT.js} +68 -46
- package/dist/{chunk-XX2V4QS5.js → chunk-4LL6LG5X.js} +2 -2
- package/dist/{chunk-J4K75V4D.js → chunk-5MNTWAAJ.js} +10 -9
- package/dist/{chunk-KVE5RCQL.js → chunk-5YEF55AX.js} +1 -1
- package/dist/{chunk-3SQYKLBW.js → chunk-7JZCADBR.js} +46 -18
- package/dist/{chunk-IUWRVTQK.js → chunk-ANMHIZZY.js} +1 -1
- package/dist/{chunk-6EKQZA6R.js → chunk-B2HND22S.js} +1 -1
- package/dist/{chunk-TRVIRETT.js → chunk-C56VHSXU.js} +1 -1
- package/dist/{chunk-TEZ2FZD6.js → chunk-CBGGUEKE.js} +2 -2
- package/dist/{chunk-3HFK3UXM.js → chunk-FOGW6O2Y.js} +1 -1
- package/dist/{chunk-3XTFX4CL.js → chunk-GMJDQDXU.js} +17 -2
- package/dist/{chunk-DKWM5T3P.js → chunk-JTBDBKHU.js} +2 -2
- package/dist/{chunk-Q223OM5J.js → chunk-JVLB5CAJ.js} +4 -4
- package/dist/{chunk-2LPEZYMC.js → chunk-KNLKHJZR.js} +1 -1
- package/dist/{chunk-X4ZUUFKV.js → chunk-L4ZCFMWW.js} +63 -1
- package/dist/chunk-M3UABYRT.js +20 -0
- package/dist/{chunk-PZRWFWSR.js → chunk-MNTZKFZI.js} +7 -7
- package/dist/{chunk-FZ73G2RO.js → chunk-MSTHT2M7.js} +25 -6
- package/dist/{chunk-TG3T3M4K.js → chunk-N4QJ3CLX.js} +6 -2
- package/dist/{chunk-3CUDMTL4.js → chunk-NBDU3R3G.js} +10 -3
- package/dist/{chunk-FXIL7RCL.js → chunk-OX35BSPV.js} +4 -4
- package/dist/{chunk-UDBJHQMG.js → chunk-QFJZHVVL.js} +1 -1
- package/dist/chunk-QZCFVWA7.js +58 -0
- package/dist/{chunk-TY5HVMXT.js → chunk-RAEPAUNJ.js} +1 -1
- package/dist/{chunk-NCVIWGVA.js → chunk-S4BLNILH.js} +1 -1
- package/dist/{chunk-MZGWKIUZ.js → chunk-VASZ6TWW.js} +7 -3
- package/dist/{chunk-SYUIXXQW.js → chunk-VF3RTVWY.js} +1 -1
- package/dist/{chunk-LURY4WNF.js → chunk-WHDSJ6PD.js} +1 -1
- package/dist/chunk-YKLCWWEI.js +76 -0
- package/dist/{chunk-253WC6O5.js → chunk-YXT55PYF.js} +1 -1
- package/dist/{chunk-BLODMQKJ.js → chunk-ZO43JTT3.js} +1 -1
- package/dist/{chunk-OLAGKKSR.js → chunk-ZP3SNUP7.js} +16 -6
- package/dist/{chunk-34GN3IPX.js → chunk-ZWEKONU6.js} +1 -1
- package/dist/src/index.d.ts +3 -1
- package/dist/src/index.js +15 -11
- package/package.json +4 -2
- /package/dist/{chunk-X6RXX2NF.js → chunk-QINYXLA5.js} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
clearPin,
|
|
4
|
+
fingerprint,
|
|
5
|
+
loadPin
|
|
6
|
+
} from "../chunk-YKLCWWEI.js";
|
|
7
|
+
import {
|
|
8
|
+
transcriptsEnabled
|
|
9
|
+
} from "../chunk-M3UABYRT.js";
|
|
10
|
+
import {
|
|
11
|
+
exitOnHelpFlag
|
|
12
|
+
} from "../chunk-WHDSJ6PD.js";
|
|
13
|
+
import "../chunk-GMJDQDXU.js";
|
|
14
|
+
import "../chunk-DINDL2CF.js";
|
|
15
|
+
import "../chunk-NBDU3R3G.js";
|
|
16
|
+
import "../chunk-BC3VCZ3E.js";
|
|
17
|
+
import "../chunk-KZERVKTD.js";
|
|
18
|
+
import "../chunk-ANMHIZZY.js";
|
|
19
|
+
import "../chunk-4LL6LG5X.js";
|
|
20
|
+
import "../chunk-2UMNXADU.js";
|
|
21
|
+
import "../chunk-QINYXLA5.js";
|
|
22
|
+
|
|
23
|
+
// bin/pushary-transcripts.ts
|
|
24
|
+
exitOnHelpFlag("transcripts");
|
|
25
|
+
var dim = (text) => `\x1B[2m${text}\x1B[0m`;
|
|
26
|
+
var bold = (text) => `\x1B[1m${text}\x1B[0m`;
|
|
27
|
+
var showStatus = () => {
|
|
28
|
+
const pin = loadPin();
|
|
29
|
+
console.log();
|
|
30
|
+
console.log(` ${bold("Transcript sync")} ${transcriptsEnabled() ? "on" : dim("off")}`);
|
|
31
|
+
console.log();
|
|
32
|
+
if (!pin) {
|
|
33
|
+
console.log(` No keys pinned yet. The first sync on this machine records the keys it`);
|
|
34
|
+
console.log(` seals to, and every later change has to be accepted here.`);
|
|
35
|
+
console.log();
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
console.log(` ${bold("Phone key")} ${fingerprint(pin.phonePublicKey)}`);
|
|
39
|
+
console.log(` ${dim("Compare this with the fingerprint in the app under Settings.")}`);
|
|
40
|
+
console.log();
|
|
41
|
+
if (pin.providerKeyId && pin.providerPublicKey) {
|
|
42
|
+
console.log(` ${bold("Recovery key")} ${pin.providerKeyId.slice(0, 16)}`);
|
|
43
|
+
console.log(` ${dim("Pushary can recover a session sealed to this key under a documented")}`);
|
|
44
|
+
console.log(` ${dim("legal obligation. Sessions sealed before it existed cannot be recovered.")}`);
|
|
45
|
+
} else {
|
|
46
|
+
console.log(` ${bold("Recovery key")} ${dim("none")}`);
|
|
47
|
+
console.log(` ${dim("Only your phone can read these transcripts. Nobody at Pushary can.")}`);
|
|
48
|
+
}
|
|
49
|
+
console.log();
|
|
50
|
+
};
|
|
51
|
+
var rotate = () => {
|
|
52
|
+
const had = loadPin();
|
|
53
|
+
clearPin();
|
|
54
|
+
console.log();
|
|
55
|
+
if (!had) {
|
|
56
|
+
console.log(` Nothing was pinned. The next sync records whatever the server offers.`);
|
|
57
|
+
} else {
|
|
58
|
+
console.log(` Dropped the pinned keys. The next sync records what the server offers now`);
|
|
59
|
+
console.log(` and resumes uploading.`);
|
|
60
|
+
console.log();
|
|
61
|
+
console.log(` ${dim("If you did not reinstall the app or rotate a key, stop and check with")}`);
|
|
62
|
+
console.log(` ${dim("Pushary before running an agent on this machine.")}`);
|
|
63
|
+
}
|
|
64
|
+
console.log();
|
|
65
|
+
};
|
|
66
|
+
var args = process.argv.slice(2);
|
|
67
|
+
var wantsRotate = args.includes("--rotate");
|
|
68
|
+
var verb = args.find((arg) => !arg.startsWith("-"));
|
|
69
|
+
if (verb === "trust" && wantsRotate) {
|
|
70
|
+
rotate();
|
|
71
|
+
} else if (verb === "trust") {
|
|
72
|
+
console.error(`Run \`pushary transcripts trust --rotate\` to accept the keys the server is offering now.`);
|
|
73
|
+
process.exit(1);
|
|
74
|
+
} else if (verb === void 0 || verb === "status") {
|
|
75
|
+
showStatus();
|
|
76
|
+
} else {
|
|
77
|
+
console.error(`Unknown: ${verb}. Try \`pushary transcripts status\` or \`pushary transcripts trust --rotate\`.`);
|
|
78
|
+
process.exit(1);
|
|
79
|
+
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
reapplyAllAgents
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-FZ73G2RO.js";
|
|
4
|
+
} from "../chunk-MNTZKFZI.js";
|
|
5
|
+
import "../chunk-5YEF55AX.js";
|
|
7
6
|
import {
|
|
8
7
|
waitForMachineReadiness
|
|
9
|
-
} from "../chunk-
|
|
10
|
-
import "../chunk-
|
|
11
|
-
import "../chunk-
|
|
12
|
-
import "../chunk-
|
|
8
|
+
} from "../chunk-RAEPAUNJ.js";
|
|
9
|
+
import "../chunk-MSTHT2M7.js";
|
|
10
|
+
import "../chunk-JVLB5CAJ.js";
|
|
11
|
+
import "../chunk-B2HND22S.js";
|
|
12
|
+
import "../chunk-VF3RTVWY.js";
|
|
13
13
|
import {
|
|
14
14
|
daemonHasRemoteProof,
|
|
15
15
|
daemonServiceManagerAvailable,
|
|
@@ -20,12 +20,12 @@ import {
|
|
|
20
20
|
replaceDaemonService,
|
|
21
21
|
stopDaemonService,
|
|
22
22
|
waitForDaemonRemoteProof
|
|
23
|
-
} from "../chunk-
|
|
23
|
+
} from "../chunk-7JZCADBR.js";
|
|
24
24
|
import {
|
|
25
25
|
detectProviderLiveCapabilities,
|
|
26
26
|
hasSpawnProvider,
|
|
27
27
|
resolveControlPolicy
|
|
28
|
-
} from "../chunk-
|
|
28
|
+
} from "../chunk-3OXHYPZG.js";
|
|
29
29
|
import {
|
|
30
30
|
needsShell
|
|
31
31
|
} from "../chunk-XHKBHWLX.js";
|
|
@@ -33,33 +33,33 @@ import {
|
|
|
33
33
|
execNpm,
|
|
34
34
|
npmErrorMessage,
|
|
35
35
|
resolveGlobalBinary
|
|
36
|
-
} from "../chunk-
|
|
37
|
-
import "../chunk-
|
|
36
|
+
} from "../chunk-L4ZCFMWW.js";
|
|
37
|
+
import "../chunk-JTBDBKHU.js";
|
|
38
38
|
import {
|
|
39
39
|
claudeJson,
|
|
40
40
|
codexConfigToml,
|
|
41
41
|
cursorPluginDir,
|
|
42
42
|
geminiSettings,
|
|
43
43
|
vscodePluginDir
|
|
44
|
-
} from "../chunk-
|
|
45
|
-
import {
|
|
46
|
-
readControlMode
|
|
47
|
-
} from "../chunk-3CUDMTL4.js";
|
|
44
|
+
} from "../chunk-3YGGEDJK.js";
|
|
48
45
|
import {
|
|
49
46
|
exitOnHelpFlag
|
|
50
|
-
} from "../chunk-
|
|
51
|
-
import "../chunk-
|
|
52
|
-
import "../chunk-BC3VCZ3E.js";
|
|
47
|
+
} from "../chunk-WHDSJ6PD.js";
|
|
48
|
+
import "../chunk-GMJDQDXU.js";
|
|
53
49
|
import {
|
|
54
50
|
isNewerVersion
|
|
55
51
|
} from "../chunk-DINDL2CF.js";
|
|
56
|
-
import
|
|
52
|
+
import {
|
|
53
|
+
readControlMode
|
|
54
|
+
} from "../chunk-NBDU3R3G.js";
|
|
55
|
+
import "../chunk-BC3VCZ3E.js";
|
|
57
56
|
import "../chunk-KZERVKTD.js";
|
|
58
|
-
import "../chunk-
|
|
57
|
+
import "../chunk-ANMHIZZY.js";
|
|
58
|
+
import "../chunk-4LL6LG5X.js";
|
|
59
59
|
import {
|
|
60
60
|
getApiKey
|
|
61
61
|
} from "../chunk-2UMNXADU.js";
|
|
62
|
-
import "../chunk-
|
|
62
|
+
import "../chunk-QINYXLA5.js";
|
|
63
63
|
|
|
64
64
|
// bin/pushary-upgrade.ts
|
|
65
65
|
import { existsSync } from "fs";
|
package/dist/bin/pushary-wait.js
CHANGED
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
} from "../chunk-IIENZE2J.js";
|
|
5
5
|
import {
|
|
6
6
|
exitOnFailedResponse
|
|
7
|
-
} from "../chunk-
|
|
8
|
-
import "../chunk-
|
|
7
|
+
} from "../chunk-YXT55PYF.js";
|
|
8
|
+
import "../chunk-ZO43JTT3.js";
|
|
9
9
|
import {
|
|
10
10
|
createIo
|
|
11
11
|
} from "../chunk-5RUIFDTP.js";
|
|
@@ -14,8 +14,8 @@ import {
|
|
|
14
14
|
} from "../chunk-GMXKITVA.js";
|
|
15
15
|
import {
|
|
16
16
|
exitOnHelpFlag
|
|
17
|
-
} from "../chunk-
|
|
18
|
-
import "../chunk-
|
|
17
|
+
} from "../chunk-WHDSJ6PD.js";
|
|
18
|
+
import "../chunk-GMJDQDXU.js";
|
|
19
19
|
import "../chunk-DINDL2CF.js";
|
|
20
20
|
import "../chunk-SAF6HGAA.js";
|
|
21
21
|
import {
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
getApiKey,
|
|
29
29
|
getBaseUrl
|
|
30
30
|
} from "../chunk-2UMNXADU.js";
|
|
31
|
-
import "../chunk-
|
|
31
|
+
import "../chunk-QINYXLA5.js";
|
|
32
32
|
|
|
33
33
|
// bin/pushary-wait.ts
|
|
34
34
|
exitOnHelpFlag("wait");
|
package/dist/bin/pushary.js
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
COMMANDS,
|
|
4
4
|
isCommandName,
|
|
5
5
|
renderHelp
|
|
6
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-GMJDQDXU.js";
|
|
7
7
|
import {
|
|
8
8
|
getPackageVersion
|
|
9
9
|
} from "../chunk-DINDL2CF.js";
|
|
@@ -33,7 +33,8 @@ var LOADERS = {
|
|
|
33
33
|
stats: () => import("./pushary-stats.js"),
|
|
34
34
|
suggestions: () => import("./pushary-suggestions.js"),
|
|
35
35
|
upgrade: () => import("./pushary-upgrade.js"),
|
|
36
|
-
hook: () => import("./pushary-hook.js")
|
|
36
|
+
hook: () => import("./pushary-hook.js"),
|
|
37
|
+
transcripts: () => import("./pushary-transcripts.js")
|
|
37
38
|
};
|
|
38
39
|
installProxyDispatcher();
|
|
39
40
|
var argv = process.argv.slice(2);
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
HOOK_BUDGETS,
|
|
3
3
|
HOOK_LOCATOR_BINARY
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-QINYXLA5.js";
|
|
5
|
+
|
|
6
|
+
// src/removal-scope.ts
|
|
7
|
+
var namesAppLocator = (command) => command.includes(HOOK_LOCATOR_BINARY);
|
|
8
|
+
var isProtectedByScope = (command, scope) => scope?.keepAppWiring === true && namesAppLocator(command);
|
|
5
9
|
|
|
6
10
|
// src/codex-config.ts
|
|
7
11
|
import { createHash } from "crypto";
|
|
8
12
|
import { homedir } from "os";
|
|
9
13
|
import { join } from "path";
|
|
10
14
|
|
|
11
|
-
// src/removal-scope.ts
|
|
12
|
-
var namesAppLocator = (command) => command.includes(HOOK_LOCATOR_BINARY);
|
|
13
|
-
var isProtectedByScope = (command, scope) => scope?.keepAppWiring === true && namesAppLocator(command);
|
|
14
|
-
|
|
15
15
|
// src/canonical-json.ts
|
|
16
16
|
var canonicalJson = (value) => {
|
|
17
17
|
if (value === null || typeof value !== "object") return JSON.stringify(value);
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getBaseUrl
|
|
3
|
-
} from "./chunk-2UMNXADU.js";
|
|
4
1
|
import {
|
|
5
2
|
redactSecrets
|
|
6
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-QINYXLA5.js";
|
|
7
4
|
|
|
8
5
|
// src/crypto.ts
|
|
9
6
|
import nacl from "tweetnacl";
|
|
@@ -36,7 +33,67 @@ var encryptRecord = (plaintext, sessionKey) => {
|
|
|
36
33
|
};
|
|
37
34
|
|
|
38
35
|
// src/transcript-capture.ts
|
|
39
|
-
import {
|
|
36
|
+
import { createHmac } from "crypto";
|
|
37
|
+
|
|
38
|
+
// src/transcript-budget.ts
|
|
39
|
+
var CIPHERTEXT_BUDGET_CHARS = 64 * 1024;
|
|
40
|
+
var SECRETBOX_OVERHEAD_BYTES = 24 + 16;
|
|
41
|
+
var MAX_PLAINTEXT_BYTES = Math.floor(CIPHERTEXT_BUDGET_CHARS / 4) * 3 - SECRETBOX_OVERHEAD_BYTES;
|
|
42
|
+
var MIN_KEEP_CHARS = 200;
|
|
43
|
+
var note = (dropped) => `
|
|
44
|
+
[Pushary truncated ${dropped} bytes to fit the transcript size limit]`;
|
|
45
|
+
var stringSlots = (value, out = []) => {
|
|
46
|
+
if (Array.isArray(value)) {
|
|
47
|
+
value.forEach((inner, index) => {
|
|
48
|
+
if (typeof inner === "string") {
|
|
49
|
+
out.push({ get: () => value[index], set: (v) => {
|
|
50
|
+
value[index] = v;
|
|
51
|
+
} });
|
|
52
|
+
} else {
|
|
53
|
+
stringSlots(inner, out);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
} else if (value && typeof value === "object") {
|
|
57
|
+
const object = value;
|
|
58
|
+
for (const key of Object.keys(object)) {
|
|
59
|
+
const inner = object[key];
|
|
60
|
+
if (typeof inner === "string") {
|
|
61
|
+
out.push({ get: () => object[key], set: (v) => {
|
|
62
|
+
object[key] = v;
|
|
63
|
+
} });
|
|
64
|
+
} else {
|
|
65
|
+
stringSlots(inner, out);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return out;
|
|
70
|
+
};
|
|
71
|
+
var jsonBytes = (value) => Buffer.byteLength(JSON.stringify(value), "utf-8");
|
|
72
|
+
var fitWithinPlaintextBudget = (record, budget = MAX_PLAINTEXT_BYTES) => {
|
|
73
|
+
if (jsonBytes(record) <= budget) return false;
|
|
74
|
+
const slots = stringSlots(record).map((slot) => ({
|
|
75
|
+
slot,
|
|
76
|
+
originalBytes: Buffer.byteLength(slot.get(), "utf-8")
|
|
77
|
+
}));
|
|
78
|
+
if (slots.length === 0) return false;
|
|
79
|
+
let truncated = false;
|
|
80
|
+
for (let pass = 0; pass < 64 && jsonBytes(record) > budget; pass += 1) {
|
|
81
|
+
let worst = slots[0];
|
|
82
|
+
for (const candidate of slots) {
|
|
83
|
+
if (candidate.slot.get().length > worst.slot.get().length) worst = candidate;
|
|
84
|
+
}
|
|
85
|
+
const current = worst.slot.get();
|
|
86
|
+
const keep = Math.max(MIN_KEEP_CHARS, Math.floor(current.length / 2));
|
|
87
|
+
const kept = current.slice(0, keep);
|
|
88
|
+
const replacement = kept + note(worst.originalBytes - Buffer.byteLength(kept, "utf-8"));
|
|
89
|
+
if (replacement.length >= current.length) break;
|
|
90
|
+
worst.slot.set(replacement);
|
|
91
|
+
truncated = true;
|
|
92
|
+
}
|
|
93
|
+
return truncated;
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
// src/transcript-capture.ts
|
|
40
97
|
var INTERNAL_TYPES = /* @__PURE__ */ new Set([
|
|
41
98
|
"file-history-snapshot",
|
|
42
99
|
"change",
|
|
@@ -55,7 +112,7 @@ var redactDeep = (value) => {
|
|
|
55
112
|
}
|
|
56
113
|
return value;
|
|
57
114
|
};
|
|
58
|
-
var localIdFor = (parsed, rawLine) => typeof parsed.uuid === "string" && parsed.uuid.length > 0 ? parsed.uuid :
|
|
115
|
+
var localIdFor = (parsed, rawLine, sessionKey) => typeof parsed.uuid === "string" && parsed.uuid.length > 0 ? parsed.uuid : createHmac("sha256", sessionKey).update(rawLine).digest("hex").slice(0, 32);
|
|
59
116
|
var buildTranscriptRecords = (lines, sessionKey, seen = /* @__PURE__ */ new Set()) => {
|
|
60
117
|
const records = [];
|
|
61
118
|
const nextSeen = new Set(seen);
|
|
@@ -70,55 +127,20 @@ var buildTranscriptRecords = (lines, sessionKey, seen = /* @__PURE__ */ new Set(
|
|
|
70
127
|
}
|
|
71
128
|
const type = typeof parsed.type === "string" ? parsed.type : "";
|
|
72
129
|
if (INTERNAL_TYPES.has(type)) continue;
|
|
73
|
-
const localId = localIdFor(parsed, trimmed);
|
|
130
|
+
const localId = localIdFor(parsed, trimmed, sessionKey);
|
|
74
131
|
if (nextSeen.has(localId)) continue;
|
|
75
132
|
nextSeen.add(localId);
|
|
76
|
-
const
|
|
133
|
+
const redacted = redactDeep(parsed);
|
|
134
|
+
fitWithinPlaintextBudget(redacted);
|
|
135
|
+
const content = encryptRecord(JSON.stringify(redacted), sessionKey);
|
|
77
136
|
records.push({ localId, content });
|
|
78
137
|
}
|
|
79
138
|
return { records, seen: nextSeen };
|
|
80
139
|
};
|
|
81
140
|
|
|
82
|
-
// src/transcript-api.ts
|
|
83
|
-
var fetchAccountPublicKey = async (apiKey, baseUrl = getBaseUrl()) => {
|
|
84
|
-
try {
|
|
85
|
-
const res = await fetch(`${baseUrl}/api/agent/encryption-account`, {
|
|
86
|
-
headers: { Authorization: `Bearer ${apiKey}` },
|
|
87
|
-
signal: AbortSignal.timeout(5e3)
|
|
88
|
-
});
|
|
89
|
-
if (!res.ok) return null;
|
|
90
|
-
const data = await res.json();
|
|
91
|
-
return typeof data.publicKey === "string" && data.publicKey.length > 0 ? data.publicKey : null;
|
|
92
|
-
} catch {
|
|
93
|
-
return null;
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
var uploadTranscriptRecords = async (apiKey, params, baseUrl = getBaseUrl()) => {
|
|
97
|
-
try {
|
|
98
|
-
const res = await fetch(`${baseUrl}/api/agent/transcript`, {
|
|
99
|
-
method: "POST",
|
|
100
|
-
headers: { Authorization: `Bearer ${apiKey}`, "Content-Type": "application/json" },
|
|
101
|
-
body: JSON.stringify(params),
|
|
102
|
-
signal: AbortSignal.timeout(15e3)
|
|
103
|
-
});
|
|
104
|
-
const body = await res.json().catch(() => null);
|
|
105
|
-
const keyRegistered = body?.keyRegistered === true;
|
|
106
|
-
const keyConflict = body?.keyConflict === true;
|
|
107
|
-
return {
|
|
108
|
-
ok: res.ok && !keyConflict && (params.dataEncryptionKey === void 0 || keyRegistered),
|
|
109
|
-
keyRegistered,
|
|
110
|
-
keyConflict
|
|
111
|
-
};
|
|
112
|
-
} catch {
|
|
113
|
-
return { ok: false, keyRegistered: false, keyConflict: false };
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
|
-
|
|
117
141
|
export {
|
|
118
142
|
decodePublicKey,
|
|
119
143
|
generateSessionKey,
|
|
120
144
|
wrapSessionKey,
|
|
121
|
-
buildTranscriptRecords
|
|
122
|
-
fetchAccountPublicKey,
|
|
123
|
-
uploadTranscriptRecords
|
|
145
|
+
buildTranscriptRecords
|
|
124
146
|
};
|
|
@@ -23,12 +23,12 @@ var backupFile = (filePath) => {
|
|
|
23
23
|
copyFileSync(filePath, target);
|
|
24
24
|
return target;
|
|
25
25
|
};
|
|
26
|
-
var writeFileAtomic = (filePath, contents, mode) => {
|
|
26
|
+
var writeFileAtomic = (filePath, contents, mode, encoding = "utf-8") => {
|
|
27
27
|
const dir = dirname(filePath);
|
|
28
28
|
if (!existsSync(dir)) mkdirSync(dir, { recursive: true });
|
|
29
29
|
const temp = join(dir, `.${process.pid}-${stamp()}.pushary-tmp`);
|
|
30
30
|
try {
|
|
31
|
-
writeFileSync(temp, contents, mode === void 0 ?
|
|
31
|
+
writeFileSync(temp, contents, mode === void 0 ? encoding : { encoding, mode });
|
|
32
32
|
const handle = openSync(temp, "r+");
|
|
33
33
|
try {
|
|
34
34
|
fsyncSync(handle);
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
PRETOOLUSE_HANDLED_TOOLS,
|
|
3
3
|
PRETOOLUSE_PHONE_ANSWERED_TOOLS
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-B2HND22S.js";
|
|
5
5
|
import {
|
|
6
6
|
defersToNativeMode
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-S4BLNILH.js";
|
|
8
8
|
import {
|
|
9
9
|
isGatingMoment,
|
|
10
10
|
recordKeylessMoment
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-FOGW6O2Y.js";
|
|
12
12
|
import {
|
|
13
13
|
denyReasonFrom,
|
|
14
14
|
isDeferAnswer
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
readLastUserPrompt,
|
|
21
21
|
repoKeyFor,
|
|
22
22
|
throttlePass
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-OX35BSPV.js";
|
|
24
24
|
import {
|
|
25
25
|
DEFAULT_SESSION,
|
|
26
26
|
askUser,
|
|
@@ -30,16 +30,17 @@ import {
|
|
|
30
30
|
sendNotification
|
|
31
31
|
} from "./chunk-JHJHCMAF.js";
|
|
32
32
|
import {
|
|
33
|
+
UNNAMED_ACTION,
|
|
33
34
|
deriveAction,
|
|
34
35
|
deriveActionBody,
|
|
35
36
|
deriveBlocker,
|
|
36
37
|
deriveToolTarget,
|
|
37
38
|
describeToolCall,
|
|
38
39
|
scopePathFor
|
|
39
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-N4QJ3CLX.js";
|
|
40
41
|
import {
|
|
41
42
|
getMachineId
|
|
42
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-JTBDBKHU.js";
|
|
43
44
|
import {
|
|
44
45
|
getApiKey,
|
|
45
46
|
getBaseUrl
|
|
@@ -54,7 +55,7 @@ import {
|
|
|
54
55
|
parseAgentQuestionAnswers,
|
|
55
56
|
parseAgentQuestions,
|
|
56
57
|
resolveGate
|
|
57
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-QINYXLA5.js";
|
|
58
59
|
|
|
59
60
|
// src/decision-episode.ts
|
|
60
61
|
var EPISODE_PATH = "/api/agent/decision-episode";
|
|
@@ -100,7 +101,7 @@ var handlePushOnly = async (apiKey, description, projectName, timeoutSeconds, ti
|
|
|
100
101
|
let result;
|
|
101
102
|
try {
|
|
102
103
|
result = await askUser(apiKey, {
|
|
103
|
-
question: `Allow ${description}?`,
|
|
104
|
+
question: `Allow ${description || UNNAMED_ACTION}?`,
|
|
104
105
|
type: "confirm",
|
|
105
106
|
context: `Agent wants to run this in ${projectName}`,
|
|
106
107
|
agentName: `Claude Code - ${projectName}`,
|
|
@@ -168,7 +169,7 @@ var handlePushFirst = async (apiKey, description, projectName, pushFirstSeconds,
|
|
|
168
169
|
let result;
|
|
169
170
|
try {
|
|
170
171
|
result = await askUser(apiKey, {
|
|
171
|
-
question: `Allow ${description}?`,
|
|
172
|
+
question: `Allow ${description || UNNAMED_ACTION}?`,
|
|
172
173
|
type: "confirm",
|
|
173
174
|
context: `Agent wants to run this in ${projectName}`,
|
|
174
175
|
agentName: `Claude Code - ${projectName}`,
|