@pushary/agent-hooks 1.9.148 → 1.9.149
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 +4 -0
- package/data/openclaw-plugin/package.json +8 -2
- package/dist/bin/pushary-bell-hook.js +4 -5
- package/dist/bin/pushary-claude.js +4 -5
- package/dist/bin/pushary-codex-bridge.js +5 -5
- package/dist/bin/pushary-codex-hook.js +4 -5
- package/dist/bin/pushary-codex-session.js +1 -1
- package/dist/bin/pushary-daemon.js +3 -4
- package/dist/bin/pushary-elicitation-hook.js +4 -5
- package/dist/bin/pushary-gemini-bridge.js +4 -4
- package/dist/bin/pushary-gemini-hook.js +4 -5
- package/dist/bin/pushary-hook.js +5 -6
- package/dist/bin/pushary-notification-hook.js +4 -5
- package/dist/bin/pushary-opencode-hook.js +4 -5
- package/dist/bin/pushary-permission-denied-hook.js +5 -6
- package/dist/bin/pushary-permission-hook.js +5 -6
- package/dist/bin/pushary-post-hook.js +4 -5
- package/dist/bin/pushary-prompt-hook.js +4 -5
- package/dist/bin/pushary-session-end-hook.js +4 -5
- package/dist/bin/pushary-session-start-hook.js +4 -5
- package/dist/bin/pushary-setup.js +2 -3
- package/dist/bin/pushary-stop-hook.js +4 -5
- package/dist/bin/pushary-stopfailure-hook.js +4 -5
- package/dist/bin/pushary-transcript-register.js +4 -5
- package/dist/bin/pushary-transcripts.js +13 -14
- package/dist/{chunk-B6RTPP3X.js → chunk-26TXJ35O.js} +1 -1
- package/dist/{chunk-YOP7LFHW.js → chunk-2CVRVHUQ.js} +2 -2
- package/dist/{chunk-XMSDA5WA.js → chunk-352FIVVH.js} +41 -1
- package/dist/{chunk-BPKB7BI4.js → chunk-35IODIBL.js} +17 -2
- package/dist/{chunk-5ZIYTFPW.js → chunk-5HAA7C4X.js} +59 -177
- package/dist/{chunk-UFGFO7QB.js → chunk-F6ESGEWU.js} +1 -1
- package/dist/{chunk-UL2NNDKD.js → chunk-MUTMXSQZ.js} +128 -2
- package/dist/{chunk-S4HS6VTI.js → chunk-OJUW7QW2.js} +2 -4
- package/dist/{chunk-VPMSV35B.js → chunk-ZIPPDZ5B.js} +1 -1
- package/dist/{codex-session-launch-4YJR4ZGN.js → codex-session-launch-73EQE6IL.js} +5 -5
- package/dist/src/index.js +5 -6
- package/package.json +1 -1
- package/dist/chunk-VAE5JBR5.js +0 -46
|
@@ -1,18 +1,134 @@
|
|
|
1
1
|
import {
|
|
2
|
-
external_exports
|
|
3
|
-
|
|
2
|
+
external_exports,
|
|
3
|
+
readOwnerOnlyJson
|
|
4
|
+
} from "./chunk-352FIVVH.js";
|
|
4
5
|
import {
|
|
5
6
|
fetchAsCredential
|
|
6
7
|
} from "./chunk-4L2IYNLC.js";
|
|
7
8
|
import {
|
|
8
9
|
getBaseUrl
|
|
9
10
|
} from "./chunk-VPADWVYD.js";
|
|
11
|
+
import {
|
|
12
|
+
writeJsonAtomicDurable
|
|
13
|
+
} from "./chunk-TODDEIYG.js";
|
|
10
14
|
import {
|
|
11
15
|
compressTranscriptRecord,
|
|
12
16
|
redactSecretsFromContent,
|
|
13
17
|
transcriptRecordPlaintext
|
|
14
18
|
} from "./chunk-O5ARO3JM.js";
|
|
15
19
|
|
|
20
|
+
// src/transcript-recipient-pin.ts
|
|
21
|
+
import { createHash } from "crypto";
|
|
22
|
+
import { mkdirSync, rmSync } from "fs";
|
|
23
|
+
import { homedir } from "os";
|
|
24
|
+
import { dirname, join } from "path";
|
|
25
|
+
var recipientPinFile = () => process.env.PUSHARY_RECIPIENT_PIN_FILE?.trim() || join(homedir(), ".pushary", "recipients.json");
|
|
26
|
+
var asPin = (offer) => ({
|
|
27
|
+
phonePublicKey: offer.phonePublicKey,
|
|
28
|
+
providerKeyId: offer.provider?.keyId ?? null,
|
|
29
|
+
providerPublicKey: offer.provider?.publicKey ?? null
|
|
30
|
+
});
|
|
31
|
+
var pinnedRecipientsSchema = external_exports.object({
|
|
32
|
+
phonePublicKey: external_exports.string().min(1).max(256),
|
|
33
|
+
providerKeyId: external_exports.string().min(1).max(256).nullable().default(null),
|
|
34
|
+
providerPublicKey: external_exports.string().min(1).max(256).nullable().default(null)
|
|
35
|
+
});
|
|
36
|
+
var loadPin = (path = recipientPinFile()) => {
|
|
37
|
+
try {
|
|
38
|
+
return pinnedRecipientsSchema.parse(readOwnerOnlyJson(path, 16384));
|
|
39
|
+
} catch (error) {
|
|
40
|
+
if (error instanceof Error && "code" in error && error.code === "ENOENT") return null;
|
|
41
|
+
throw new Error("Existing history trust could not be read. Nothing was replaced.");
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
var savePin = (pin, path = recipientPinFile()) => {
|
|
45
|
+
try {
|
|
46
|
+
mkdirSync(dirname(path), { recursive: true, mode: 448 });
|
|
47
|
+
writeJsonAtomicDurable(path, pin, 384);
|
|
48
|
+
return true;
|
|
49
|
+
} catch {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
var clearPin = () => {
|
|
54
|
+
try {
|
|
55
|
+
rmSync(recipientPinFile(), { force: true });
|
|
56
|
+
} catch {
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
var verifyRecipients = (offer, pinned) => {
|
|
60
|
+
if (!pinned) return { kind: "first-use", pin: asPin(offer) };
|
|
61
|
+
const next = asPin(offer);
|
|
62
|
+
const changed = [];
|
|
63
|
+
if (next.phonePublicKey !== pinned.phonePublicKey) changed.push("the phone key this machine seals to");
|
|
64
|
+
if (next.providerKeyId !== pinned.providerKeyId) changed.push("the compliance recovery key id");
|
|
65
|
+
if (next.providerPublicKey !== pinned.providerPublicKey) changed.push("the compliance recovery key");
|
|
66
|
+
return changed.length === 0 ? { kind: "match" } : { kind: "changed", changed };
|
|
67
|
+
};
|
|
68
|
+
var fingerprint = (publicKey) => createHash("sha256").update(publicKey).digest("hex");
|
|
69
|
+
var changedRecipientsMessage = (verdict, offer) => [
|
|
70
|
+
"[pushary] Transcript sync stopped: the keys this machine seals transcripts to have changed.",
|
|
71
|
+
...verdict.changed.map((what) => `[pushary] changed: ${what}`),
|
|
72
|
+
`[pushary] now offered: phone ${fingerprint(offer.phonePublicKey)}${offer.provider ? `, recovery ${offer.provider.keyId.slice(0, 8)}` : ", no recovery key"}`,
|
|
73
|
+
"[pushary] If you reinstalled the app or rotated a key, this is expected. Compare the",
|
|
74
|
+
"[pushary] fingerprint above with the one in the app under Settings, then run:",
|
|
75
|
+
"[pushary] pushary transcripts trust --fingerprint <fingerprint-from-phone-settings>",
|
|
76
|
+
"[pushary] Until then nothing is uploaded, so no turn is sealed to a key you have not seen."
|
|
77
|
+
].join("\n");
|
|
78
|
+
|
|
79
|
+
// src/transcript-phone-trust.ts
|
|
80
|
+
import { createHash as createHash2 } from "crypto";
|
|
81
|
+
import { mkdirSync as mkdirSync2 } from "fs";
|
|
82
|
+
import { dirname as dirname2, join as join2 } from "path";
|
|
83
|
+
var approvedPhoneSchema = external_exports.object({ version: external_exports.literal(1), sourcePinHash: external_exports.string().regex(/^[a-f0-9]{64}$/), phonePublicKey: external_exports.string().min(1).max(256) });
|
|
84
|
+
var pinHash = (pin) => createHash2("sha256").update(JSON.stringify(pin)).digest("hex");
|
|
85
|
+
var approvalFile = (path, pin, publicKey) => join2(`${path}.trusted-phones`, `${pinHash(pin)}-${fingerprint(publicKey)}.json`);
|
|
86
|
+
var sameRecoveryRecipient = (offer, pin) => (offer.provider?.keyId ?? null) === pin.providerKeyId && (offer.provider?.publicKey ?? null) === pin.providerPublicKey;
|
|
87
|
+
var canonicalPublicKey = (key) => {
|
|
88
|
+
const bytes = Buffer.from(key, "base64");
|
|
89
|
+
return bytes.length === 32 && bytes.toString("base64") === key;
|
|
90
|
+
};
|
|
91
|
+
var phoneWasApproved = (offer, pin, path) => {
|
|
92
|
+
try {
|
|
93
|
+
const approval = approvedPhoneSchema.parse(readOwnerOnlyJson(approvalFile(path, pin, offer.phonePublicKey), 16384));
|
|
94
|
+
if (approval.sourcePinHash !== pinHash(pin) || approval.phonePublicKey !== offer.phonePublicKey) throw new Error("Mismatched approval");
|
|
95
|
+
return true;
|
|
96
|
+
} catch (error) {
|
|
97
|
+
if (error instanceof Error && "code" in error && error.code === "ENOENT") return false;
|
|
98
|
+
throw new Error("Saved phone verification could not be read. Nothing was replaced.");
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
var verifyTrustedRecipients = (offer, path = recipientPinFile()) => {
|
|
102
|
+
const pin = loadPin(path);
|
|
103
|
+
const verdict = verifyRecipients(offer, pin);
|
|
104
|
+
if (verdict.kind !== "changed" || !pin || !sameRecoveryRecipient(offer, pin)) return verdict;
|
|
105
|
+
return phoneWasApproved(offer, pin, path) ? { kind: "match" } : verdict;
|
|
106
|
+
};
|
|
107
|
+
var verifyAnchoredRecipients = (offer, path = recipientPinFile(), anchorPath) => {
|
|
108
|
+
const verdict = verifyTrustedRecipients(offer, path);
|
|
109
|
+
if (verdict.kind !== "first-use" || anchorPath === void 0 || loadPin(anchorPath) === null) return verdict;
|
|
110
|
+
const anchored = verifyTrustedRecipients(offer, anchorPath);
|
|
111
|
+
return anchored.kind === "match" ? verdict : anchored;
|
|
112
|
+
};
|
|
113
|
+
var assertVerifiedPhone = (offer, pin, expectedFingerprint) => {
|
|
114
|
+
if (!canonicalPublicKey(offer.phonePublicKey) || fingerprint(offer.phonePublicKey) !== expectedFingerprint.trim().toLowerCase()) {
|
|
115
|
+
throw new Error("The fingerprint does not match this phone. Nothing was changed.");
|
|
116
|
+
}
|
|
117
|
+
if (!pin) throw new Error("No existing history trust was found. Nothing was changed.");
|
|
118
|
+
if (!sameRecoveryRecipient(offer, pin)) throw new Error("The recovery recipient also changed. Phone verification cannot approve that change.");
|
|
119
|
+
};
|
|
120
|
+
var trustPhoneRecipient = (request) => {
|
|
121
|
+
const { offer, pinFile } = request;
|
|
122
|
+
const pin = loadPin(pinFile);
|
|
123
|
+
assertVerifiedPhone(offer, pin, request.expectedFingerprint);
|
|
124
|
+
if (!pin) throw new Error("No existing history trust was found.");
|
|
125
|
+
if (verifyTrustedRecipients(offer, pinFile).kind === "match") return "already_trusted";
|
|
126
|
+
const path = approvalFile(pinFile, pin, offer.phonePublicKey);
|
|
127
|
+
mkdirSync2(dirname2(path), { recursive: true, mode: 448 });
|
|
128
|
+
writeJsonAtomicDurable(path, { version: 1, sourcePinHash: pinHash(pin), phonePublicKey: offer.phonePublicKey }, 384);
|
|
129
|
+
return "trusted";
|
|
130
|
+
};
|
|
131
|
+
|
|
16
132
|
// src/transcript-api.ts
|
|
17
133
|
var providerRecipientSchema = external_exports.object({
|
|
18
134
|
required: external_exports.boolean(),
|
|
@@ -274,6 +390,16 @@ var buildTranscriptRecords = (lines, sessionKey, seen = /* @__PURE__ */ new Set(
|
|
|
274
390
|
};
|
|
275
391
|
|
|
276
392
|
export {
|
|
393
|
+
recipientPinFile,
|
|
394
|
+
loadPin,
|
|
395
|
+
savePin,
|
|
396
|
+
clearPin,
|
|
397
|
+
fingerprint,
|
|
398
|
+
changedRecipientsMessage,
|
|
399
|
+
verifyTrustedRecipients,
|
|
400
|
+
verifyAnchoredRecipients,
|
|
401
|
+
assertVerifiedPhone,
|
|
402
|
+
trustPhoneRecipient,
|
|
277
403
|
decodePublicKey,
|
|
278
404
|
generateSessionKey,
|
|
279
405
|
wrapSessionKey,
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
|
+
external_exports,
|
|
2
3
|
readOwnerOnlyJson,
|
|
3
4
|
transcriptReadPositionSchema
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import {
|
|
6
|
-
external_exports
|
|
7
|
-
} from "./chunk-XMSDA5WA.js";
|
|
5
|
+
} from "./chunk-352FIVVH.js";
|
|
8
6
|
|
|
9
7
|
// src/native-transcript-account.ts
|
|
10
8
|
import { createHash } from "crypto";
|
|
@@ -11,15 +11,15 @@ import {
|
|
|
11
11
|
isCodexQuestionLeftWithTheLocalClient,
|
|
12
12
|
planCodexElicitation,
|
|
13
13
|
reportOwnedQuestion
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import "./chunk-
|
|
14
|
+
} from "./chunk-2CVRVHUQ.js";
|
|
15
|
+
import "./chunk-35IODIBL.js";
|
|
16
16
|
import "./chunk-ZX2O66NS.js";
|
|
17
17
|
import "./chunk-NRPQUU3D.js";
|
|
18
|
-
import "./chunk-
|
|
18
|
+
import "./chunk-F6ESGEWU.js";
|
|
19
19
|
import "./chunk-3WD3BEPB.js";
|
|
20
20
|
import "./chunk-CYTPQDQY.js";
|
|
21
|
-
import "./chunk-
|
|
22
|
-
import "./chunk-
|
|
21
|
+
import "./chunk-MUTMXSQZ.js";
|
|
22
|
+
import "./chunk-352FIVVH.js";
|
|
23
23
|
import "./chunk-FQLS37AX.js";
|
|
24
24
|
import {
|
|
25
25
|
writeDegraded
|
package/dist/src/index.js
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
handlePreToolUse
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-26TXJ35O.js";
|
|
4
4
|
import "../chunk-QSZYHL7Z.js";
|
|
5
5
|
import "../chunk-CMTDMZPV.js";
|
|
6
6
|
import "../chunk-UJUGFLVF.js";
|
|
7
7
|
import "../chunk-X4OEGFOG.js";
|
|
8
8
|
import "../chunk-Q7GZKNMH.js";
|
|
9
|
-
import "../chunk-
|
|
9
|
+
import "../chunk-ZIPPDZ5B.js";
|
|
10
10
|
import "../chunk-D3QT4S7U.js";
|
|
11
11
|
import "../chunk-NLED3JGR.js";
|
|
12
|
-
import "../chunk-
|
|
13
|
-
import "../chunk-VAE5JBR5.js";
|
|
12
|
+
import "../chunk-5HAA7C4X.js";
|
|
14
13
|
import "../chunk-G66WIAST.js";
|
|
15
14
|
import "../chunk-PVBDITRS.js";
|
|
16
15
|
import "../chunk-XZGQZDFP.js";
|
|
@@ -30,8 +29,8 @@ import "../chunk-R2JRRCZK.js";
|
|
|
30
29
|
import "../chunk-YPY4YCIZ.js";
|
|
31
30
|
import {
|
|
32
31
|
fetchAccountPublicKey
|
|
33
|
-
} from "../chunk-
|
|
34
|
-
import "../chunk-
|
|
32
|
+
} from "../chunk-MUTMXSQZ.js";
|
|
33
|
+
import "../chunk-352FIVVH.js";
|
|
35
34
|
import "../chunk-T3CMGGNW.js";
|
|
36
35
|
import "../chunk-FQLS37AX.js";
|
|
37
36
|
import {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pushary/agent-hooks",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.149",
|
|
4
4
|
"description": "Human-in-the-loop (HITL) for AI agents: ask a person for approvals or answers by push notification. One command connects Claude Code, Codex, Cursor, Gemini CLI and more.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pushary",
|
package/dist/chunk-VAE5JBR5.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
external_exports
|
|
3
|
-
} from "./chunk-XMSDA5WA.js";
|
|
4
|
-
import {
|
|
5
|
-
writeJsonAtomic
|
|
6
|
-
} from "./chunk-TODDEIYG.js";
|
|
7
|
-
|
|
8
|
-
// src/transcript-read-positions.ts
|
|
9
|
-
import { lstatSync, readFileSync } from "fs";
|
|
10
|
-
var OWNER_ONLY_FILE_MODE = 384;
|
|
11
|
-
var MAXIMUM_READ_POSITIONS_BYTES = 4 * 1024 * 1024;
|
|
12
|
-
var transcriptReadPositionSchema = external_exports.object({
|
|
13
|
-
identity: external_exports.string().nullable(),
|
|
14
|
-
offset: external_exports.number().int().nonnegative(),
|
|
15
|
-
startedBeforeEpoch: external_exports.boolean()
|
|
16
|
-
});
|
|
17
|
-
var savedReadPositionsSchema = external_exports.object({ positions: external_exports.record(external_exports.string(), transcriptReadPositionSchema) });
|
|
18
|
-
var ownedOnlyByThisUser = (info) => !process.getuid || info.uid === process.getuid() && (info.mode & 511) === OWNER_ONLY_FILE_MODE;
|
|
19
|
-
var readOwnerOnlyJson = (path, maximumBytes) => {
|
|
20
|
-
const info = lstatSync(path);
|
|
21
|
-
if (!info.isFile() || info.nlink !== 1 || !ownedOnlyByThisUser(info) || info.size > maximumBytes) return null;
|
|
22
|
-
return JSON.parse(readFileSync(path, "utf8"));
|
|
23
|
-
};
|
|
24
|
-
var savedTranscriptReadPositions = (file) => ({
|
|
25
|
-
load: () => {
|
|
26
|
-
try {
|
|
27
|
-
return new Map(Object.entries(savedReadPositionsSchema.parse(readOwnerOnlyJson(file, MAXIMUM_READ_POSITIONS_BYTES)).positions));
|
|
28
|
-
} catch {
|
|
29
|
-
return /* @__PURE__ */ new Map();
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
save: (positions) => {
|
|
33
|
-
try {
|
|
34
|
-
writeJsonAtomic(file, { positions: Object.fromEntries(positions) }, OWNER_ONLY_FILE_MODE);
|
|
35
|
-
} catch {
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
export {
|
|
42
|
-
transcriptReadPositionSchema,
|
|
43
|
-
ownedOnlyByThisUser,
|
|
44
|
-
readOwnerOnlyJson,
|
|
45
|
-
savedTranscriptReadPositions
|
|
46
|
-
};
|