@agentvault/claude-bridge 0.7.7 → 0.7.8
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/index.js +148 -126
- package/dist/log.d.ts +22 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -53073,8 +53073,8 @@ var init_dhkem = __esm2({
|
|
|
53073
53073
|
async deserializePrivateKey(key) {
|
|
53074
53074
|
return await this._prim.deserializePrivateKey(toArrayBuffer(key));
|
|
53075
53075
|
}
|
|
53076
|
-
async importKey(
|
|
53077
|
-
return await this._prim.importKey(
|
|
53076
|
+
async importKey(format2, key, isPublic = true) {
|
|
53077
|
+
return await this._prim.importKey(format2, key, isPublic);
|
|
53078
53078
|
}
|
|
53079
53079
|
async generateKeyPair() {
|
|
53080
53080
|
return await this._prim.generateKeyPair();
|
|
@@ -53717,10 +53717,10 @@ var init_ec = __esm2({
|
|
|
53717
53717
|
throw new DeserializeError(e7);
|
|
53718
53718
|
}
|
|
53719
53719
|
}
|
|
53720
|
-
async importKey(
|
|
53720
|
+
async importKey(format2, key, isPublic) {
|
|
53721
53721
|
await this._setup();
|
|
53722
53722
|
try {
|
|
53723
|
-
if (
|
|
53723
|
+
if (format2 === "raw") {
|
|
53724
53724
|
return await this._importRawKey(key, isPublic);
|
|
53725
53725
|
}
|
|
53726
53726
|
if (key instanceof ArrayBuffer) {
|
|
@@ -55107,10 +55107,10 @@ var init_x25519 = __esm2({
|
|
|
55107
55107
|
throw new DeserializeError(e7);
|
|
55108
55108
|
}
|
|
55109
55109
|
}
|
|
55110
|
-
async importKey(
|
|
55110
|
+
async importKey(format2, key, isPublic) {
|
|
55111
55111
|
await this._setup();
|
|
55112
55112
|
try {
|
|
55113
|
-
if (
|
|
55113
|
+
if (format2 === "raw") {
|
|
55114
55114
|
return await this._importRawKey(key, isPublic);
|
|
55115
55115
|
}
|
|
55116
55116
|
if (key instanceof ArrayBuffer) {
|
|
@@ -60045,10 +60045,10 @@ function _splitEndoScalar(k2, basis, n22) {
|
|
|
60045
60045
|
}
|
|
60046
60046
|
return { k1neg, k1: k12, k2neg, k2: k22 };
|
|
60047
60047
|
}
|
|
60048
|
-
function validateSigFormat(
|
|
60049
|
-
if (!["compact", "recovered", "der"].includes(
|
|
60048
|
+
function validateSigFormat(format2) {
|
|
60049
|
+
if (!["compact", "recovered", "der"].includes(format2))
|
|
60050
60050
|
throw new Error('Signature format must be "compact", "recovered", or "der"');
|
|
60051
|
-
return
|
|
60051
|
+
return format2;
|
|
60052
60052
|
}
|
|
60053
60053
|
function validateSigOpts(opts, def) {
|
|
60054
60054
|
const optsn = {};
|
|
@@ -60736,11 +60736,11 @@ function ecdsa(Point, hash22, ecdsaOpts = {}) {
|
|
|
60736
60736
|
throw new Error(`invalid signature ${title}: out of range 1..Point.Fn.ORDER`);
|
|
60737
60737
|
return num;
|
|
60738
60738
|
}
|
|
60739
|
-
function validateSigLength(bytes,
|
|
60740
|
-
validateSigFormat(
|
|
60739
|
+
function validateSigLength(bytes, format2) {
|
|
60740
|
+
validateSigFormat(format2);
|
|
60741
60741
|
const size = lengths.signature;
|
|
60742
|
-
const sizer =
|
|
60743
|
-
return _abytes2(bytes, sizer, `${
|
|
60742
|
+
const sizer = format2 === "compact" ? size : format2 === "recovered" ? size + 1 : void 0;
|
|
60743
|
+
return _abytes2(bytes, sizer, `${format2} signature`);
|
|
60744
60744
|
}
|
|
60745
60745
|
class Signature {
|
|
60746
60746
|
constructor(r22, s22, recovery) {
|
|
@@ -60750,16 +60750,16 @@ function ecdsa(Point, hash22, ecdsaOpts = {}) {
|
|
|
60750
60750
|
this.recovery = recovery;
|
|
60751
60751
|
Object.freeze(this);
|
|
60752
60752
|
}
|
|
60753
|
-
static fromBytes(bytes,
|
|
60754
|
-
validateSigLength(bytes,
|
|
60753
|
+
static fromBytes(bytes, format2 = defaultSigOpts_format) {
|
|
60754
|
+
validateSigLength(bytes, format2);
|
|
60755
60755
|
let recid;
|
|
60756
|
-
if (
|
|
60756
|
+
if (format2 === "der") {
|
|
60757
60757
|
const { r: r32, s: s32 } = DER.toSig(_abytes2(bytes));
|
|
60758
60758
|
return new Signature(r32, s32);
|
|
60759
60759
|
}
|
|
60760
|
-
if (
|
|
60760
|
+
if (format2 === "recovered") {
|
|
60761
60761
|
recid = bytes[0];
|
|
60762
|
-
|
|
60762
|
+
format2 = "compact";
|
|
60763
60763
|
bytes = bytes.subarray(1);
|
|
60764
60764
|
}
|
|
60765
60765
|
const L22 = Fn3.BYTES;
|
|
@@ -60767,8 +60767,8 @@ function ecdsa(Point, hash22, ecdsaOpts = {}) {
|
|
|
60767
60767
|
const s22 = bytes.subarray(L22, L22 * 2);
|
|
60768
60768
|
return new Signature(Fn3.fromBytes(r22), Fn3.fromBytes(s22), recid);
|
|
60769
60769
|
}
|
|
60770
|
-
static fromHex(hex32,
|
|
60771
|
-
return this.fromBytes(hexToBytes4(hex32),
|
|
60770
|
+
static fromHex(hex32, format2) {
|
|
60771
|
+
return this.fromBytes(hexToBytes4(hex32), format2);
|
|
60772
60772
|
}
|
|
60773
60773
|
addRecoveryBit(recovery) {
|
|
60774
60774
|
return new Signature(this.r, this.s, recovery);
|
|
@@ -60800,21 +60800,21 @@ function ecdsa(Point, hash22, ecdsaOpts = {}) {
|
|
|
60800
60800
|
hasHighS() {
|
|
60801
60801
|
return isBiggerThanHalfOrder(this.s);
|
|
60802
60802
|
}
|
|
60803
|
-
toBytes(
|
|
60804
|
-
validateSigFormat(
|
|
60805
|
-
if (
|
|
60803
|
+
toBytes(format2 = defaultSigOpts_format) {
|
|
60804
|
+
validateSigFormat(format2);
|
|
60805
|
+
if (format2 === "der")
|
|
60806
60806
|
return hexToBytes4(DER.hexFromSig(this));
|
|
60807
60807
|
const r22 = Fn3.toBytes(this.r);
|
|
60808
60808
|
const s22 = Fn3.toBytes(this.s);
|
|
60809
|
-
if (
|
|
60809
|
+
if (format2 === "recovered") {
|
|
60810
60810
|
if (this.recovery == null)
|
|
60811
60811
|
throw new Error("recovery bit must be present");
|
|
60812
60812
|
return concatBytes2(Uint8Array.of(this.recovery), r22, s22);
|
|
60813
60813
|
}
|
|
60814
60814
|
return concatBytes2(r22, s22);
|
|
60815
60815
|
}
|
|
60816
|
-
toHex(
|
|
60817
|
-
return bytesToHex4(this.toBytes(
|
|
60816
|
+
toHex(format2) {
|
|
60817
|
+
return bytesToHex4(this.toBytes(format2));
|
|
60818
60818
|
}
|
|
60819
60819
|
// TODO: remove
|
|
60820
60820
|
assertValidity() {
|
|
@@ -60931,12 +60931,12 @@ function ecdsa(Point, hash22, ecdsaOpts = {}) {
|
|
|
60931
60931
|
return sig;
|
|
60932
60932
|
}
|
|
60933
60933
|
function verify(signature, message, publicKey, opts = {}) {
|
|
60934
|
-
const { lowS, prehash, format } = validateSigOpts(opts, defaultSigOpts);
|
|
60934
|
+
const { lowS, prehash, format: format2 } = validateSigOpts(opts, defaultSigOpts);
|
|
60935
60935
|
publicKey = ensureBytes("publicKey", publicKey);
|
|
60936
60936
|
message = validateMsgAndHash(ensureBytes("message", message), prehash);
|
|
60937
60937
|
if ("strict" in opts)
|
|
60938
60938
|
throw new Error("options.strict was renamed to lowS");
|
|
60939
|
-
const sig =
|
|
60939
|
+
const sig = format2 === void 0 ? tryParsingSig(signature) : Signature.fromBytes(ensureBytes("sig", signature), format2);
|
|
60940
60940
|
if (sig === false)
|
|
60941
60941
|
return false;
|
|
60942
60942
|
try {
|
|
@@ -80864,13 +80864,13 @@ function _stringbool(Classes, _params) {
|
|
|
80864
80864
|
return codec22;
|
|
80865
80865
|
}
|
|
80866
80866
|
// @__NO_SIDE_EFFECTS__
|
|
80867
|
-
function _stringFormat(Class22,
|
|
80867
|
+
function _stringFormat(Class22, format2, fnOrRegex, _params = {}) {
|
|
80868
80868
|
const params = normalizeParams(_params);
|
|
80869
80869
|
const def = {
|
|
80870
80870
|
...normalizeParams(_params),
|
|
80871
80871
|
check: "string_format",
|
|
80872
80872
|
type: "string",
|
|
80873
|
-
format,
|
|
80873
|
+
format: format2,
|
|
80874
80874
|
fn: typeof fnOrRegex === "function" ? fnOrRegex : (val) => fnOrRegex.test(val),
|
|
80875
80875
|
...params
|
|
80876
80876
|
};
|
|
@@ -81335,16 +81335,16 @@ var init_json_schema_processors = __esm2({
|
|
|
81335
81335
|
stringProcessor = (schema, ctx, _json, _params) => {
|
|
81336
81336
|
const json22 = _json;
|
|
81337
81337
|
json22.type = "string";
|
|
81338
|
-
const { minimum, maximum, format, patterns, contentEncoding } = schema._zod.bag;
|
|
81338
|
+
const { minimum, maximum, format: format2, patterns, contentEncoding } = schema._zod.bag;
|
|
81339
81339
|
if (typeof minimum === "number")
|
|
81340
81340
|
json22.minLength = minimum;
|
|
81341
81341
|
if (typeof maximum === "number")
|
|
81342
81342
|
json22.maxLength = maximum;
|
|
81343
|
-
if (
|
|
81344
|
-
json22.format = formatMap[
|
|
81343
|
+
if (format2) {
|
|
81344
|
+
json22.format = formatMap[format2] ?? format2;
|
|
81345
81345
|
if (json22.format === "")
|
|
81346
81346
|
delete json22.format;
|
|
81347
|
-
if (
|
|
81347
|
+
if (format2 === "time") {
|
|
81348
81348
|
delete json22.format;
|
|
81349
81349
|
}
|
|
81350
81350
|
}
|
|
@@ -81366,8 +81366,8 @@ var init_json_schema_processors = __esm2({
|
|
|
81366
81366
|
};
|
|
81367
81367
|
numberProcessor = (schema, ctx, _json, _params) => {
|
|
81368
81368
|
const json22 = _json;
|
|
81369
|
-
const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag;
|
|
81370
|
-
if (typeof
|
|
81369
|
+
const { minimum, maximum, format: format2, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag;
|
|
81370
|
+
if (typeof format2 === "string" && format2.includes("int"))
|
|
81371
81371
|
json22.type = "integer";
|
|
81372
81372
|
else
|
|
81373
81373
|
json22.type = "number";
|
|
@@ -82522,8 +82522,8 @@ function e1642(params) {
|
|
|
82522
82522
|
function jwt(params) {
|
|
82523
82523
|
return /* @__PURE__ */ _jwt(ZodJWT, params);
|
|
82524
82524
|
}
|
|
82525
|
-
function stringFormat(
|
|
82526
|
-
return /* @__PURE__ */ _stringFormat(ZodCustomStringFormat,
|
|
82525
|
+
function stringFormat(format2, fnOrRegex, _params = {}) {
|
|
82526
|
+
return /* @__PURE__ */ _stringFormat(ZodCustomStringFormat, format2, fnOrRegex, _params);
|
|
82527
82527
|
}
|
|
82528
82528
|
function hostname2(_params) {
|
|
82529
82529
|
return /* @__PURE__ */ _stringFormat(ZodCustomStringFormat, "hostname", regexes_exports.hostname, _params);
|
|
@@ -82533,11 +82533,11 @@ function hex2(_params) {
|
|
|
82533
82533
|
}
|
|
82534
82534
|
function hash(alg, params) {
|
|
82535
82535
|
const enc = params?.enc ?? "hex";
|
|
82536
|
-
const
|
|
82537
|
-
const regex = regexes_exports[
|
|
82536
|
+
const format2 = `${alg}_${enc}`;
|
|
82537
|
+
const regex = regexes_exports[format2];
|
|
82538
82538
|
if (!regex)
|
|
82539
|
-
throw new Error(`Unrecognized hash format: ${
|
|
82540
|
-
return /* @__PURE__ */ _stringFormat(ZodCustomStringFormat,
|
|
82539
|
+
throw new Error(`Unrecognized hash format: ${format2}`);
|
|
82540
|
+
return /* @__PURE__ */ _stringFormat(ZodCustomStringFormat, format2, regex, params);
|
|
82541
82541
|
}
|
|
82542
82542
|
function number2(params) {
|
|
82543
82543
|
return /* @__PURE__ */ _number(ZodNumber2, params);
|
|
@@ -92020,10 +92020,10 @@ var require_core = __commonJS({
|
|
|
92020
92020
|
return this;
|
|
92021
92021
|
}
|
|
92022
92022
|
// Add format
|
|
92023
|
-
addFormat(name,
|
|
92024
|
-
if (typeof
|
|
92025
|
-
|
|
92026
|
-
this.formats[name] =
|
|
92023
|
+
addFormat(name, format2) {
|
|
92024
|
+
if (typeof format2 == "string")
|
|
92025
|
+
format2 = new RegExp(format2);
|
|
92026
|
+
this.formats[name] = format2;
|
|
92027
92027
|
return this;
|
|
92028
92028
|
}
|
|
92029
92029
|
errorsText(errors = this.errors, { separator = ", ", dataVar = "data" } = {}) {
|
|
@@ -92141,9 +92141,9 @@ var require_core = __commonJS({
|
|
|
92141
92141
|
}
|
|
92142
92142
|
function addInitialFormats() {
|
|
92143
92143
|
for (const name in this.opts.formats) {
|
|
92144
|
-
const
|
|
92145
|
-
if (
|
|
92146
|
-
this.addFormat(name,
|
|
92144
|
+
const format2 = this.opts.formats[name];
|
|
92145
|
+
if (format2)
|
|
92146
|
+
this.addFormat(name, format2);
|
|
92147
92147
|
}
|
|
92148
92148
|
}
|
|
92149
92149
|
function addInitialKeywords(defs) {
|
|
@@ -93758,18 +93758,18 @@ var require_format = __commonJS({
|
|
|
93758
93758
|
});
|
|
93759
93759
|
const fDef = gen.const("fDef", (0, codegen_1._)`${fmts}[${schemaCode}]`);
|
|
93760
93760
|
const fType = gen.let("fType");
|
|
93761
|
-
const
|
|
93762
|
-
gen.if((0, codegen_1._)`typeof ${fDef} == "object" && !(${fDef} instanceof RegExp)`, () => gen.assign(fType, (0, codegen_1._)`${fDef}.type || "string"`).assign(
|
|
93761
|
+
const format2 = gen.let("format");
|
|
93762
|
+
gen.if((0, codegen_1._)`typeof ${fDef} == "object" && !(${fDef} instanceof RegExp)`, () => gen.assign(fType, (0, codegen_1._)`${fDef}.type || "string"`).assign(format2, (0, codegen_1._)`${fDef}.validate`), () => gen.assign(fType, (0, codegen_1._)`"string"`).assign(format2, fDef));
|
|
93763
93763
|
cxt.fail$data((0, codegen_1.or)(unknownFmt(), invalidFmt()));
|
|
93764
93764
|
function unknownFmt() {
|
|
93765
93765
|
if (opts.strictSchema === false)
|
|
93766
93766
|
return codegen_1.nil;
|
|
93767
|
-
return (0, codegen_1._)`${schemaCode} && !${
|
|
93767
|
+
return (0, codegen_1._)`${schemaCode} && !${format2}`;
|
|
93768
93768
|
}
|
|
93769
93769
|
function invalidFmt() {
|
|
93770
|
-
const callFormat = schemaEnv.$async ? (0, codegen_1._)`(${fDef}.async ? await ${
|
|
93771
|
-
const validData = (0, codegen_1._)`(typeof ${
|
|
93772
|
-
return (0, codegen_1._)`${
|
|
93770
|
+
const callFormat = schemaEnv.$async ? (0, codegen_1._)`(${fDef}.async ? await ${format2}(${data}) : ${format2}(${data}))` : (0, codegen_1._)`${format2}(${data})`;
|
|
93771
|
+
const validData = (0, codegen_1._)`(typeof ${format2} == "function" ? ${callFormat} : ${format2}.test(${data}))`;
|
|
93772
|
+
return (0, codegen_1._)`${format2} && ${format2} !== true && ${fType} === ${ruleType} && !${validData}`;
|
|
93773
93773
|
}
|
|
93774
93774
|
}
|
|
93775
93775
|
function validateFormat() {
|
|
@@ -93780,7 +93780,7 @@ var require_format = __commonJS({
|
|
|
93780
93780
|
}
|
|
93781
93781
|
if (formatDef === true)
|
|
93782
93782
|
return;
|
|
93783
|
-
const [fmtType,
|
|
93783
|
+
const [fmtType, format2, fmtRef] = getFormat(formatDef);
|
|
93784
93784
|
if (fmtType === ruleType)
|
|
93785
93785
|
cxt.pass(validCondition());
|
|
93786
93786
|
function unknownFormat() {
|
|
@@ -93807,7 +93807,7 @@ var require_format = __commonJS({
|
|
|
93807
93807
|
throw new Error("async format in sync schema");
|
|
93808
93808
|
return (0, codegen_1._)`await ${fmtRef}(${data})`;
|
|
93809
93809
|
}
|
|
93810
|
-
return typeof
|
|
93810
|
+
return typeof format2 == "function" ? (0, codegen_1._)`${fmtRef}(${data})` : (0, codegen_1._)`${fmtRef}.test(${data})`;
|
|
93811
93811
|
}
|
|
93812
93812
|
}
|
|
93813
93813
|
}
|
|
@@ -93820,8 +93820,8 @@ var require_format2 = __commonJS({
|
|
|
93820
93820
|
"use strict";
|
|
93821
93821
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
93822
93822
|
var format_1 = require_format();
|
|
93823
|
-
var
|
|
93824
|
-
exports.default =
|
|
93823
|
+
var format2 = [format_1.default];
|
|
93824
|
+
exports.default = format2;
|
|
93825
93825
|
}
|
|
93826
93826
|
});
|
|
93827
93827
|
var require_metadata = __commonJS({
|
|
@@ -94447,17 +94447,17 @@ var require_limit = __commonJS({
|
|
|
94447
94447
|
cxt.fail$data((0, codegen_1.or)((0, codegen_1._)`typeof ${fmt} != "object"`, (0, codegen_1._)`${fmt} instanceof RegExp`, (0, codegen_1._)`typeof ${fmt}.compare != "function"`, compareCode(fmt)));
|
|
94448
94448
|
}
|
|
94449
94449
|
function validateFormat() {
|
|
94450
|
-
const
|
|
94451
|
-
const fmtDef = self2.formats[
|
|
94450
|
+
const format2 = fCxt.schema;
|
|
94451
|
+
const fmtDef = self2.formats[format2];
|
|
94452
94452
|
if (!fmtDef || fmtDef === true)
|
|
94453
94453
|
return;
|
|
94454
94454
|
if (typeof fmtDef != "object" || fmtDef instanceof RegExp || typeof fmtDef.compare != "function") {
|
|
94455
|
-
throw new Error(`"${keyword}": format "${
|
|
94455
|
+
throw new Error(`"${keyword}": format "${format2}" does not define "compare" function`);
|
|
94456
94456
|
}
|
|
94457
94457
|
const fmt = gen.scopeValue("formats", {
|
|
94458
|
-
key:
|
|
94458
|
+
key: format2,
|
|
94459
94459
|
ref: fmtDef,
|
|
94460
|
-
code: opts.code.formats ? (0, codegen_1._)`${opts.code.formats}${(0, codegen_1.getProperty)(
|
|
94460
|
+
code: opts.code.formats ? (0, codegen_1._)`${opts.code.formats}${(0, codegen_1.getProperty)(format2)}` : void 0
|
|
94461
94461
|
});
|
|
94462
94462
|
cxt.fail$data(compareCode(fmt));
|
|
94463
94463
|
}
|
|
@@ -119180,6 +119180,16 @@ function readDeviceId(dataDir) {
|
|
|
119180
119180
|
);
|
|
119181
119181
|
}
|
|
119182
119182
|
|
|
119183
|
+
// src/log.ts
|
|
119184
|
+
import { format } from "node:util";
|
|
119185
|
+
function stamp(message) {
|
|
119186
|
+
const ts2 = (/* @__PURE__ */ new Date()).toISOString();
|
|
119187
|
+
return message.split("\n").map((line) => `${ts2} ${line}`).join("\n");
|
|
119188
|
+
}
|
|
119189
|
+
function logLine(...args) {
|
|
119190
|
+
console.error(stamp(format(...args)));
|
|
119191
|
+
}
|
|
119192
|
+
|
|
119183
119193
|
// src/worker-permission.ts
|
|
119184
119194
|
var PATH_FIELDS = ["file_path", "path", "notebook_path"];
|
|
119185
119195
|
function canonical(p2) {
|
|
@@ -119286,7 +119296,7 @@ function makeWorkerPreToolUseHook(opts) {
|
|
|
119286
119296
|
}
|
|
119287
119297
|
}
|
|
119288
119298
|
if (verdict.deny) {
|
|
119289
|
-
|
|
119299
|
+
logLine(`[worker-gate] DENY ${toolName} \u2014 ${verdict.reason}`);
|
|
119290
119300
|
return {
|
|
119291
119301
|
hookSpecificOutput: {
|
|
119292
119302
|
hookEventName: "PreToolUse",
|
|
@@ -119304,7 +119314,7 @@ function makeWorkerPermission(opts) {
|
|
|
119304
119314
|
return async (toolName, input) => {
|
|
119305
119315
|
const verdict = gateDecision(toolName, input, opts);
|
|
119306
119316
|
if (verdict.deny) {
|
|
119307
|
-
|
|
119317
|
+
logLine(`[worker-gate] DENY ${toolName} \u2014 ${verdict.reason}`);
|
|
119308
119318
|
return { behavior: "deny", message: verdict.reason };
|
|
119309
119319
|
}
|
|
119310
119320
|
return { behavior: "allow", updatedInput: input };
|
|
@@ -130202,13 +130212,13 @@ function _stringbool2(Classes, _params) {
|
|
|
130202
130212
|
return codec3;
|
|
130203
130213
|
}
|
|
130204
130214
|
// @__NO_SIDE_EFFECTS__
|
|
130205
|
-
function _stringFormat2(Class3,
|
|
130215
|
+
function _stringFormat2(Class3, format2, fnOrRegex, _params = {}) {
|
|
130206
130216
|
const params = normalizeParams2(_params);
|
|
130207
130217
|
const def = {
|
|
130208
130218
|
...normalizeParams2(_params),
|
|
130209
130219
|
check: "string_format",
|
|
130210
130220
|
type: "string",
|
|
130211
|
-
format,
|
|
130221
|
+
format: format2,
|
|
130212
130222
|
fn: typeof fnOrRegex === "function" ? fnOrRegex : (val) => fnOrRegex.test(val),
|
|
130213
130223
|
...params
|
|
130214
130224
|
};
|
|
@@ -130583,16 +130593,16 @@ var formatMap2 = {
|
|
|
130583
130593
|
var stringProcessor2 = (schema, ctx, _json, _params) => {
|
|
130584
130594
|
const json3 = _json;
|
|
130585
130595
|
json3.type = "string";
|
|
130586
|
-
const { minimum, maximum, format, patterns, contentEncoding } = schema._zod.bag;
|
|
130596
|
+
const { minimum, maximum, format: format2, patterns, contentEncoding } = schema._zod.bag;
|
|
130587
130597
|
if (typeof minimum === "number")
|
|
130588
130598
|
json3.minLength = minimum;
|
|
130589
130599
|
if (typeof maximum === "number")
|
|
130590
130600
|
json3.maxLength = maximum;
|
|
130591
|
-
if (
|
|
130592
|
-
json3.format = formatMap2[
|
|
130601
|
+
if (format2) {
|
|
130602
|
+
json3.format = formatMap2[format2] ?? format2;
|
|
130593
130603
|
if (json3.format === "")
|
|
130594
130604
|
delete json3.format;
|
|
130595
|
-
if (
|
|
130605
|
+
if (format2 === "time") {
|
|
130596
130606
|
delete json3.format;
|
|
130597
130607
|
}
|
|
130598
130608
|
}
|
|
@@ -130614,8 +130624,8 @@ var stringProcessor2 = (schema, ctx, _json, _params) => {
|
|
|
130614
130624
|
};
|
|
130615
130625
|
var numberProcessor2 = (schema, ctx, _json, _params) => {
|
|
130616
130626
|
const json3 = _json;
|
|
130617
|
-
const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag;
|
|
130618
|
-
if (typeof
|
|
130627
|
+
const { minimum, maximum, format: format2, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag;
|
|
130628
|
+
if (typeof format2 === "string" && format2.includes("int"))
|
|
130619
130629
|
json3.type = "integer";
|
|
130620
130630
|
else
|
|
130621
130631
|
json3.type = "number";
|
|
@@ -131804,8 +131814,8 @@ var ZodCustomStringFormat2 = /* @__PURE__ */ $constructor2("ZodCustomStringForma
|
|
|
131804
131814
|
$ZodCustomStringFormat2.init(inst, def);
|
|
131805
131815
|
ZodStringFormat2.init(inst, def);
|
|
131806
131816
|
});
|
|
131807
|
-
function stringFormat2(
|
|
131808
|
-
return _stringFormat2(ZodCustomStringFormat2,
|
|
131817
|
+
function stringFormat2(format2, fnOrRegex, _params = {}) {
|
|
131818
|
+
return _stringFormat2(ZodCustomStringFormat2, format2, fnOrRegex, _params);
|
|
131809
131819
|
}
|
|
131810
131820
|
function hostname5(_params) {
|
|
131811
131821
|
return _stringFormat2(ZodCustomStringFormat2, "hostname", regexes_exports2.hostname, _params);
|
|
@@ -131815,11 +131825,11 @@ function hex4(_params) {
|
|
|
131815
131825
|
}
|
|
131816
131826
|
function hash2(alg, params) {
|
|
131817
131827
|
const enc = params?.enc ?? "hex";
|
|
131818
|
-
const
|
|
131819
|
-
const regex = regexes_exports2[
|
|
131828
|
+
const format2 = `${alg}_${enc}`;
|
|
131829
|
+
const regex = regexes_exports2[format2];
|
|
131820
131830
|
if (!regex)
|
|
131821
|
-
throw new Error(`Unrecognized hash format: ${
|
|
131822
|
-
return _stringFormat2(ZodCustomStringFormat2,
|
|
131831
|
+
throw new Error(`Unrecognized hash format: ${format2}`);
|
|
131832
|
+
return _stringFormat2(ZodCustomStringFormat2, format2, regex, params);
|
|
131823
131833
|
}
|
|
131824
131834
|
var ZodNumber3 = /* @__PURE__ */ $constructor2("ZodNumber", (inst, def) => {
|
|
131825
131835
|
$ZodNumber2.init(inst, def);
|
|
@@ -132795,52 +132805,52 @@ function convertBaseSchema(schema, ctx) {
|
|
|
132795
132805
|
case "string": {
|
|
132796
132806
|
let stringSchema = z4.string();
|
|
132797
132807
|
if (schema.format) {
|
|
132798
|
-
const
|
|
132799
|
-
if (
|
|
132808
|
+
const format2 = schema.format;
|
|
132809
|
+
if (format2 === "email") {
|
|
132800
132810
|
stringSchema = stringSchema.check(z4.email());
|
|
132801
|
-
} else if (
|
|
132811
|
+
} else if (format2 === "uri" || format2 === "uri-reference") {
|
|
132802
132812
|
stringSchema = stringSchema.check(z4.url());
|
|
132803
|
-
} else if (
|
|
132813
|
+
} else if (format2 === "uuid" || format2 === "guid") {
|
|
132804
132814
|
stringSchema = stringSchema.check(z4.uuid());
|
|
132805
|
-
} else if (
|
|
132815
|
+
} else if (format2 === "date-time") {
|
|
132806
132816
|
stringSchema = stringSchema.check(z4.iso.datetime());
|
|
132807
|
-
} else if (
|
|
132817
|
+
} else if (format2 === "date") {
|
|
132808
132818
|
stringSchema = stringSchema.check(z4.iso.date());
|
|
132809
|
-
} else if (
|
|
132819
|
+
} else if (format2 === "time") {
|
|
132810
132820
|
stringSchema = stringSchema.check(z4.iso.time());
|
|
132811
|
-
} else if (
|
|
132821
|
+
} else if (format2 === "duration") {
|
|
132812
132822
|
stringSchema = stringSchema.check(z4.iso.duration());
|
|
132813
|
-
} else if (
|
|
132823
|
+
} else if (format2 === "ipv4") {
|
|
132814
132824
|
stringSchema = stringSchema.check(z4.ipv4());
|
|
132815
|
-
} else if (
|
|
132825
|
+
} else if (format2 === "ipv6") {
|
|
132816
132826
|
stringSchema = stringSchema.check(z4.ipv6());
|
|
132817
|
-
} else if (
|
|
132827
|
+
} else if (format2 === "mac") {
|
|
132818
132828
|
stringSchema = stringSchema.check(z4.mac());
|
|
132819
|
-
} else if (
|
|
132829
|
+
} else if (format2 === "cidr") {
|
|
132820
132830
|
stringSchema = stringSchema.check(z4.cidrv4());
|
|
132821
|
-
} else if (
|
|
132831
|
+
} else if (format2 === "cidr-v6") {
|
|
132822
132832
|
stringSchema = stringSchema.check(z4.cidrv6());
|
|
132823
|
-
} else if (
|
|
132833
|
+
} else if (format2 === "base64") {
|
|
132824
132834
|
stringSchema = stringSchema.check(z4.base64());
|
|
132825
|
-
} else if (
|
|
132835
|
+
} else if (format2 === "base64url") {
|
|
132826
132836
|
stringSchema = stringSchema.check(z4.base64url());
|
|
132827
|
-
} else if (
|
|
132837
|
+
} else if (format2 === "e164") {
|
|
132828
132838
|
stringSchema = stringSchema.check(z4.e164());
|
|
132829
|
-
} else if (
|
|
132839
|
+
} else if (format2 === "jwt") {
|
|
132830
132840
|
stringSchema = stringSchema.check(z4.jwt());
|
|
132831
|
-
} else if (
|
|
132841
|
+
} else if (format2 === "emoji") {
|
|
132832
132842
|
stringSchema = stringSchema.check(z4.emoji());
|
|
132833
|
-
} else if (
|
|
132843
|
+
} else if (format2 === "nanoid") {
|
|
132834
132844
|
stringSchema = stringSchema.check(z4.nanoid());
|
|
132835
|
-
} else if (
|
|
132845
|
+
} else if (format2 === "cuid") {
|
|
132836
132846
|
stringSchema = stringSchema.check(z4.cuid());
|
|
132837
|
-
} else if (
|
|
132847
|
+
} else if (format2 === "cuid2") {
|
|
132838
132848
|
stringSchema = stringSchema.check(z4.cuid2());
|
|
132839
|
-
} else if (
|
|
132849
|
+
} else if (format2 === "ulid") {
|
|
132840
132850
|
stringSchema = stringSchema.check(z4.ulid());
|
|
132841
|
-
} else if (
|
|
132851
|
+
} else if (format2 === "xid") {
|
|
132842
132852
|
stringSchema = stringSchema.check(z4.xid());
|
|
132843
|
-
} else if (
|
|
132853
|
+
} else if (format2 === "ksuid") {
|
|
132844
132854
|
stringSchema = stringSchema.check(z4.ksuid());
|
|
132845
132855
|
}
|
|
132846
132856
|
}
|
|
@@ -133319,7 +133329,7 @@ var PersistentClaudeSession = class {
|
|
|
133319
133329
|
});
|
|
133320
133330
|
}
|
|
133321
133331
|
};
|
|
133322
|
-
|
|
133332
|
+
logLine(
|
|
133323
133333
|
`[worker-gate] active \u2014 1:1 owner DM: FULL access, no allowlist, no workspace fence. Armed room: FULL access whenever "Remove all gates" is on (live, owner-controlled, off by default); otherwise allowlist, workspace=${this.opts.workspaceDir ?? "(none: file tools disabled)"}, bash=${this.opts.osIsolated ? "enabled (OS-isolated)" : "disabled"}`
|
|
133324
133334
|
);
|
|
133325
133335
|
return {
|
|
@@ -133360,7 +133370,19 @@ var PersistentClaudeSession = class {
|
|
|
133360
133370
|
this.roomServer = _s({
|
|
133361
133371
|
name: "room",
|
|
133362
133372
|
version: "0.2.0",
|
|
133363
|
-
tools: [makeRoomSayTool((text) => this.deliver(text))]
|
|
133373
|
+
tools: [makeRoomSayTool((text) => this.deliver(text))],
|
|
133374
|
+
// LOAD-BEARING for turn latency. The SDK defers MCP tools behind tool
|
|
133375
|
+
// search by default, so the WORKER (which gets the full built-in toolset
|
|
133376
|
+
// for owner DMs) could not see its own voice without first spending a
|
|
133377
|
+
// model round-trip on `ToolSearch {"query":"select:mcp__room__say"}` —
|
|
133378
|
+
// measured on 175 of 175 worker sessions, ~2-5s of a ~20s turn, for a tool
|
|
133379
|
+
// already in `allowedTools`. The listener escaped it only by accident, via
|
|
133380
|
+
// `tools: []`. Set on BOTH lanes so the listener stays correct if its
|
|
133381
|
+
// toolset ever widens.
|
|
133382
|
+
//
|
|
133383
|
+
// NOT a permission change: room_say is already allowed on every session.
|
|
133384
|
+
// This stops HIDING it, it does not grant it.
|
|
133385
|
+
alwaysLoad: true
|
|
133364
133386
|
});
|
|
133365
133387
|
const sdkOptions = this.buildSdkOptions();
|
|
133366
133388
|
const q10 = this.opts.queryImpl ? this.opts.queryImpl({
|
|
@@ -133386,7 +133408,7 @@ var PersistentClaudeSession = class {
|
|
|
133386
133408
|
if (reply) {
|
|
133387
133409
|
void reply(this.turnText);
|
|
133388
133410
|
} else {
|
|
133389
|
-
|
|
133411
|
+
logLine(
|
|
133390
133412
|
`[drop-probe] BLOCKED at result: composed ${this.turnText.length} chars, reply expected but activeReply unset \u2014 reply DROPPED`
|
|
133391
133413
|
);
|
|
133392
133414
|
}
|
|
@@ -133395,7 +133417,7 @@ var PersistentClaudeSession = class {
|
|
|
133395
133417
|
}
|
|
133396
133418
|
} finally {
|
|
133397
133419
|
if (this.currentReplyExpected && !this.saidThisTurn && !this.sawResultThisTurn && this.turnText.trim()) {
|
|
133398
|
-
|
|
133420
|
+
logLine(
|
|
133399
133421
|
`[drop-probe] STREAM ENDED before result: composed ${this.turnText.length} chars, reply expected, said=false \u2014 reply DROPPED (no result event)`
|
|
133400
133422
|
);
|
|
133401
133423
|
}
|
|
@@ -134087,22 +134109,22 @@ async function main() {
|
|
|
134087
134109
|
const cfg = loadConfig(process.env, process.argv.slice(2));
|
|
134088
134110
|
const firstArg = process.argv.slice(2)[0];
|
|
134089
134111
|
if (firstArg && !firstArg.startsWith("-") && firstArg === cfg.inviteToken) {
|
|
134090
|
-
|
|
134112
|
+
logLine(
|
|
134091
134113
|
"[bridge] warning: passing the invite token on the command line is visible to other local users via 'ps'. Prefer: AV_INVITE_TOKEN=\u2026 npx @agentvault/claude-bridge"
|
|
134092
134114
|
);
|
|
134093
134115
|
}
|
|
134094
|
-
|
|
134095
|
-
|
|
134096
|
-
|
|
134116
|
+
logLine(`[bridge] version: ${true ? "0.7.8" : "dev"}`);
|
|
134117
|
+
logLine(`[bridge] data dir: ${cfg.dataDir} (${cfg.dataDirSource})`);
|
|
134118
|
+
logLine(`[bridge] workspace: ${cfg.workspaceDir} \xB7 permissions: ${cfg.permissionMode} \xB7 enclave dir fenced`);
|
|
134097
134119
|
if (cfg.armRoom) {
|
|
134098
|
-
|
|
134120
|
+
logLine(
|
|
134099
134121
|
`[bridge] ARMED ROOM ${cfg.roomFilter} \u2014 worker tools are enabled on this room's turns. The enclave key dir stays fenced; the workspace dir is ADVISORY (the SDK does not confine file ops to it \u2014 they root in $HOME). Blast radius = whatever this host/environment exposes.`
|
|
134100
134122
|
);
|
|
134101
|
-
|
|
134123
|
+
logLine(
|
|
134102
134124
|
"[bridge] ARMED ROOM WARNING: this room contains agents you do not control. A room peer's message can drive your agent's tools. The directory is NOT a sandbox \u2014 run this bridge in an owner-provisioned confined environment (dedicated droplet / container / OS-user) with no connected accounts or ambient credentials. See the Slice 2 hardening guide."
|
|
134103
134125
|
);
|
|
134104
134126
|
} else {
|
|
134105
|
-
|
|
134127
|
+
logLine(
|
|
134106
134128
|
'[bridge] 1:1 owner DMs run with FULL tool access when "Allow tools" is on for this agent (dashboard switch, default off): any command, any file this user account can reach, network, skills and subagents \u2014 equivalent to a terminal on this machine, with no per-action prompt. Rooms are NOT affected: they stay say-only unless armed (AV_ARM_ROOM=1 with a pinned AV_ROOM_ID), and an armed room keeps the confined allowlist. Each tool-enabled turn runs in a fresh session seeded with only that one message, so room text cannot leak into a DM turn.'
|
|
134107
134129
|
);
|
|
134108
134130
|
}
|
|
@@ -134133,7 +134155,7 @@ async function main() {
|
|
|
134133
134155
|
// per-message binding is what prevents a private 1:1 reply from leaking into a
|
|
134134
134156
|
// room when room traffic arrives mid-compose.
|
|
134135
134157
|
// Assistant reasoning that wasn't sent — log a short trace only.
|
|
134136
|
-
onObserve: (text) =>
|
|
134158
|
+
onObserve: (text) => logLine(`[bridge] observed (${text.length} chars, not sent)`),
|
|
134137
134159
|
worker: false
|
|
134138
134160
|
});
|
|
134139
134161
|
const WORKER_MAX_TURNS = 20;
|
|
@@ -134142,7 +134164,7 @@ async function main() {
|
|
|
134142
134164
|
makeSession: (task) => new PersistentClaudeSession({
|
|
134143
134165
|
model: cfg.model,
|
|
134144
134166
|
systemPrompt: agentSystemPrompt,
|
|
134145
|
-
onObserve: (text) =>
|
|
134167
|
+
onObserve: (text) => logLine(`[worker] observed (${text.length} chars, not sent)`),
|
|
134146
134168
|
worker: true,
|
|
134147
134169
|
// Task 4: the hard backstop — no tool runs on any worker turn (owner DM or
|
|
134148
134170
|
// armed room) unless Work is on. Read live per tool decision.
|
|
@@ -134165,7 +134187,7 @@ async function main() {
|
|
|
134165
134187
|
deviceJwt
|
|
134166
134188
|
}),
|
|
134167
134189
|
timeoutMs: WORKER_TIMEOUT_MS,
|
|
134168
|
-
log: (m6) =>
|
|
134190
|
+
log: (m6) => logLine(m6),
|
|
134169
134191
|
// TRAP (2026-07-25). The 07-24 five-minute silence was diagnosable only by
|
|
134170
134192
|
// luck — the drop-trap happened to record a reply landing 300.016s after the
|
|
134171
134193
|
// ack, and 300s is WORKER_TIMEOUT_MS exactly. Nothing recorded WHY the worker
|
|
@@ -134173,7 +134195,7 @@ async function main() {
|
|
|
134173
134195
|
// Append-only JSONL beside the logs, plus one stamped console line so the
|
|
134174
134196
|
// incident is visible in bridge.error.log at the moment it happens.
|
|
134175
134197
|
onIncident: (rec) => {
|
|
134176
|
-
|
|
134198
|
+
logLine(
|
|
134177
134199
|
`[worker-trap] ${rec.at} ${rec.outcome} after ${rec.ranMs}ms (waited ${rec.waitedMs}ms behind ${rec.queueDepthAtEnqueue}, ${rec.queueDepthAtStart} still queued) replyExpected=${rec.replyExpected}` + (rec.session ? ` composed=${rec.session.composedChars} result=${rec.session.sawResult} said=${rec.session.said}` : "")
|
|
134178
134200
|
);
|
|
134179
134201
|
try {
|
|
@@ -134181,7 +134203,7 @@ async function main() {
|
|
|
134181
134203
|
mkdirSync6(dir, { recursive: true });
|
|
134182
134204
|
appendFileSync2(join11(dir, "worker-incidents.jsonl"), JSON.stringify(rec) + "\n");
|
|
134183
134205
|
} catch (err) {
|
|
134184
|
-
|
|
134206
|
+
logLine(`[worker-trap] could not persist incident: ${err.message}`);
|
|
134185
134207
|
}
|
|
134186
134208
|
}
|
|
134187
134209
|
});
|
|
@@ -134193,7 +134215,7 @@ async function main() {
|
|
|
134193
134215
|
{
|
|
134194
134216
|
roomFilter: cfg.roomFilter,
|
|
134195
134217
|
armRoom: cfg.armRoom,
|
|
134196
|
-
log: (m6) =>
|
|
134218
|
+
log: (m6) => logLine("[bridge] " + m6),
|
|
134197
134219
|
// Slice 2 Plan C (T11): live arm/disarm + local-approval poll + heartbeat.
|
|
134198
134220
|
workspaceDir: cfg.workspaceDir,
|
|
134199
134221
|
dataDir: cfg.dataDir,
|
|
@@ -134209,21 +134231,21 @@ async function main() {
|
|
|
134209
134231
|
}
|
|
134210
134232
|
);
|
|
134211
134233
|
attachLifecycle2(channel, {
|
|
134212
|
-
log: (m6) =>
|
|
134234
|
+
log: (m6) => logLine("[bridge] " + m6)
|
|
134213
134235
|
});
|
|
134214
|
-
channel.on("state", (s10) =>
|
|
134236
|
+
channel.on("state", (s10) => logLine(`[bridge] channel state: ${JSON.stringify(s10)}`));
|
|
134215
134237
|
channel.on(
|
|
134216
134238
|
"room_joined",
|
|
134217
|
-
(e7) =>
|
|
134239
|
+
(e7) => logLine(`[bridge] joined room ${e7.name} (${e7.roomId})`)
|
|
134218
134240
|
);
|
|
134219
134241
|
listener.start().catch((err) => {
|
|
134220
|
-
|
|
134242
|
+
logLine("[bridge] fatal:", err);
|
|
134221
134243
|
process.exit(1);
|
|
134222
134244
|
});
|
|
134223
134245
|
await channel.start();
|
|
134224
134246
|
}
|
|
134225
134247
|
main().catch((err) => {
|
|
134226
|
-
|
|
134248
|
+
logLine("[bridge] fatal:", err);
|
|
134227
134249
|
process.exit(1);
|
|
134228
134250
|
});
|
|
134229
134251
|
/*! Bundled license information:
|
package/dist/log.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prefix every line of `message` with an ISO-8601 UTC timestamp.
|
|
3
|
+
*
|
|
4
|
+
* Per-LINE, not per-call, on purpose: `logLine("[bridge] fatal:", err)` renders a
|
|
5
|
+
* multi-line stack trace, and a first-line-only stamp would leave every frame
|
|
6
|
+
* unanchored — the case where the clock matters most. The acceptance criterion
|
|
7
|
+
* on #790 is "every line in the file", so this reads it literally.
|
|
8
|
+
*/
|
|
9
|
+
export declare function stamp(message: string): string;
|
|
10
|
+
/**
|
|
11
|
+
* Write one stamped record to stderr.
|
|
12
|
+
*
|
|
13
|
+
* stderr (not stdout) because the launchd/systemd unit routes both, and the
|
|
14
|
+
* bridge's existing sinks were already `console.error` — keeping the stream the
|
|
15
|
+
* same means this change alters the CONTENT of the logs and nothing else.
|
|
16
|
+
*
|
|
17
|
+
* Multi-arg is supported via `util.format`, which is what `console.error` uses
|
|
18
|
+
* internally, so `logLine("[bridge] fatal:", err)` renders exactly as before —
|
|
19
|
+
* just anchored to a clock.
|
|
20
|
+
*/
|
|
21
|
+
export declare function logLine(...args: unknown[]): void;
|
|
22
|
+
//# sourceMappingURL=log.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentvault/claude-bridge",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.8",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"description": "AgentVault Claude Bridge
|
|
5
|
+
"description": "AgentVault Claude Bridge \u2014 daemon for bridging a Claude agent into secure E2E-encrypted AgentVault 1:1 direct messages and rooms.",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
8
|
"bin": {
|