ofw-mcp 2.21.0 → 2.22.0
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/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +48 -0
- package/dist/bundle.js +431 -265
- package/dist/tools/_confirm.js +17 -9
- package/dist/tools/expense-reimbursement.js +117 -0
- package/dist/tools/expenses.js +3 -0
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/server.json +3 -3
- package/skills/ofw/SKILL.md +22 -0
package/dist/bundle.js
CHANGED
|
@@ -7450,15 +7450,15 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
7450
7450
|
const syms = normalized.symbolKeys;
|
|
7451
7451
|
const doc = new Doc(["payload", "ctx"], { shape, inst, memo: memo3, syms });
|
|
7452
7452
|
const parseStr = (k) => `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
|
|
7453
|
-
const prefixStr = (
|
|
7454
|
-
let ${
|
|
7455
|
-
for (let i = 0; i < ${
|
|
7456
|
-
const iss = ${
|
|
7453
|
+
const prefixStr = (id2, k) => `
|
|
7454
|
+
let ${id2}_ab = false;
|
|
7455
|
+
for (let i = 0; i < ${id2}.issues.length; i++) {
|
|
7456
|
+
const iss = ${id2}.issues[i];
|
|
7457
7457
|
iss.path = iss.path ? [${k}, ...iss.path] : [${k}];
|
|
7458
7458
|
payload.issues.push(iss);
|
|
7459
|
-
if (iss.continue !== true) ${
|
|
7459
|
+
if (iss.continue !== true) ${id2}_ab = true;
|
|
7460
7460
|
}
|
|
7461
|
-
if (${
|
|
7461
|
+
if (${id2}_ab && ctx && ctx.abortEarly) {
|
|
7462
7462
|
payload.value = newResult;
|
|
7463
7463
|
return payload;
|
|
7464
7464
|
}`;
|
|
@@ -7472,34 +7472,34 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
7472
7472
|
for (const key of normalized.allKeys) {
|
|
7473
7473
|
if (key === "__proto__")
|
|
7474
7474
|
continue;
|
|
7475
|
-
const
|
|
7475
|
+
const id2 = ids[key];
|
|
7476
7476
|
const k = typeof key === "symbol" ? `syms[${syms.indexOf(key)}]` : esc(key);
|
|
7477
7477
|
const isPresent = `${k} in input`;
|
|
7478
7478
|
const schema = shape[key];
|
|
7479
7479
|
const optin = schema?._zod?.optin;
|
|
7480
7480
|
const isOptionalIn = optin !== void 0;
|
|
7481
7481
|
const isOptionalOut = schema?._zod?.optout === "optional";
|
|
7482
|
-
doc.write(`const ${
|
|
7482
|
+
doc.write(`const ${id2} = ${parseStr(k)};`);
|
|
7483
7483
|
if (isOptionalIn && isOptionalOut) {
|
|
7484
|
-
const assign = optin === "optional" ? `${
|
|
7484
|
+
const assign = optin === "optional" ? `${id2}_present` : `${id2}.value !== undefined || ${id2}_present`;
|
|
7485
7485
|
doc.write(`
|
|
7486
|
-
const ${
|
|
7487
|
-
if (!${
|
|
7488
|
-
if (${
|
|
7486
|
+
const ${id2}_present = ${isPresent};
|
|
7487
|
+
if (!${id2}.issues.length || ${id2}_present) {
|
|
7488
|
+
if (${id2}.issues.length) {${prefixStr(id2, k)}
|
|
7489
7489
|
}
|
|
7490
7490
|
|
|
7491
7491
|
if (${assign}) {
|
|
7492
|
-
newResult[${k}] = ${
|
|
7492
|
+
newResult[${k}] = ${id2}.value;
|
|
7493
7493
|
}
|
|
7494
7494
|
}
|
|
7495
7495
|
|
|
7496
7496
|
`);
|
|
7497
7497
|
} else if (!isOptionalIn) {
|
|
7498
7498
|
doc.write(`
|
|
7499
|
-
const ${
|
|
7500
|
-
if (${
|
|
7499
|
+
const ${id2}_present = ${isPresent};
|
|
7500
|
+
if (${id2}.issues.length) {${prefixStr(id2, k)}
|
|
7501
7501
|
}
|
|
7502
|
-
if (!${
|
|
7502
|
+
if (!${id2}_present && !${id2}.issues.length) {
|
|
7503
7503
|
payload.issues.push({
|
|
7504
7504
|
code: "invalid_type",
|
|
7505
7505
|
expected: "nonoptional",
|
|
@@ -7512,22 +7512,22 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
7512
7512
|
}
|
|
7513
7513
|
}
|
|
7514
7514
|
|
|
7515
|
-
if (${
|
|
7516
|
-
newResult[${k}] = ${
|
|
7515
|
+
if (${id2}_present) {
|
|
7516
|
+
newResult[${k}] = ${id2}.value;
|
|
7517
7517
|
}
|
|
7518
7518
|
|
|
7519
7519
|
`);
|
|
7520
7520
|
} else {
|
|
7521
7521
|
doc.write(`
|
|
7522
|
-
if (${
|
|
7522
|
+
if (${id2}.issues.length) {${prefixStr(id2, k)}
|
|
7523
7523
|
}
|
|
7524
7524
|
`);
|
|
7525
7525
|
if (optin === "defaulted") {
|
|
7526
|
-
doc.write(`newResult[${k}] = ${
|
|
7526
|
+
doc.write(`newResult[${k}] = ${id2}.value;`);
|
|
7527
7527
|
} else {
|
|
7528
7528
|
doc.write(`
|
|
7529
|
-
if (${
|
|
7530
|
-
newResult[${k}] = ${
|
|
7529
|
+
if (${id2}.value !== undefined || ${isPresent}) {
|
|
7530
|
+
newResult[${k}] = ${id2}.value;
|
|
7531
7531
|
}
|
|
7532
7532
|
`);
|
|
7533
7533
|
}
|
|
@@ -19555,26 +19555,26 @@ function extractDefs(ctx, schema) {
|
|
|
19555
19555
|
return;
|
|
19556
19556
|
const idToSchema = /* @__PURE__ */ new Map();
|
|
19557
19557
|
for (const entry of ctx.seen.entries()) {
|
|
19558
|
-
const
|
|
19559
|
-
if (
|
|
19560
|
-
const existing = idToSchema.get(
|
|
19558
|
+
const id2 = ctx.metadataRegistry.get(entry[0])?.id;
|
|
19559
|
+
if (id2) {
|
|
19560
|
+
const existing = idToSchema.get(id2);
|
|
19561
19561
|
if (existing && existing !== entry[0]) {
|
|
19562
|
-
throw new Error(`Duplicate schema id "${
|
|
19562
|
+
throw new Error(`Duplicate schema id "${id2}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);
|
|
19563
19563
|
}
|
|
19564
|
-
idToSchema.set(
|
|
19564
|
+
idToSchema.set(id2, entry[0]);
|
|
19565
19565
|
}
|
|
19566
19566
|
}
|
|
19567
19567
|
const makeURI = (entry) => {
|
|
19568
19568
|
const defsSegment = ctx.target === "draft-2020-12" ? "$defs" : "definitions";
|
|
19569
19569
|
if (ctx.external) {
|
|
19570
19570
|
const externalId = ctx.external.registry.get(entry[0])?.id;
|
|
19571
|
-
const uriGenerator = ctx.external.uri ?? ((
|
|
19571
|
+
const uriGenerator = ctx.external.uri ?? ((id3) => id3);
|
|
19572
19572
|
if (externalId) {
|
|
19573
19573
|
return { ref: uriGenerator(externalId) };
|
|
19574
19574
|
}
|
|
19575
|
-
const
|
|
19576
|
-
entry[1].defId =
|
|
19577
|
-
return { defId:
|
|
19575
|
+
const id2 = entry[1].defId ?? entry[1].schema.id ?? `schema${ctx.counter++}`;
|
|
19576
|
+
entry[1].defId = id2;
|
|
19577
|
+
return { defId: id2, ref: `${uriGenerator("__shared")}#/${defsSegment}/${encodeJSONPointerSegment(id2)}` };
|
|
19578
19578
|
}
|
|
19579
19579
|
const uriPrefix = `#`;
|
|
19580
19580
|
const defUriPrefix = `${uriPrefix}/${defsSegment}/`;
|
|
@@ -19622,8 +19622,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
19622
19622
|
continue;
|
|
19623
19623
|
}
|
|
19624
19624
|
}
|
|
19625
|
-
const
|
|
19626
|
-
if (
|
|
19625
|
+
const id2 = ctx.metadataRegistry.get(entry[0])?.id;
|
|
19626
|
+
if (id2) {
|
|
19627
19627
|
extractToDef(entry);
|
|
19628
19628
|
continue;
|
|
19629
19629
|
}
|
|
@@ -19856,10 +19856,10 @@ function finalize(ctx, schema) {
|
|
|
19856
19856
|
} else {
|
|
19857
19857
|
}
|
|
19858
19858
|
if (ctx.external?.uri) {
|
|
19859
|
-
const
|
|
19860
|
-
if (!
|
|
19859
|
+
const id2 = ctx.external.registry.get(schema)?.id;
|
|
19860
|
+
if (!id2)
|
|
19861
19861
|
throw new Error("Schema is missing an `id` property");
|
|
19862
|
-
result.$id = ctx.external.uri(
|
|
19862
|
+
result.$id = ctx.external.uri(id2);
|
|
19863
19863
|
}
|
|
19864
19864
|
assignProps(result, root.defId ? root.schema : root.def ?? root.schema);
|
|
19865
19865
|
const rootMetaId = ctx.metadataRegistry.get(schema)?.id;
|
|
@@ -20465,7 +20465,7 @@ function stringifyKeyNames(bySchema, json2, visited) {
|
|
|
20465
20465
|
const values = json2.enum ?? (json2.const !== void 0 ? [json2.const] : void 0);
|
|
20466
20466
|
if (!numericType && !values?.some((v) => typeof v === "number"))
|
|
20467
20467
|
return json2;
|
|
20468
|
-
const { minimum, maximum, exclusiveMinimum, exclusiveMaximum, multipleOf, format, id, ...rest } = json2;
|
|
20468
|
+
const { minimum, maximum, exclusiveMinimum, exclusiveMaximum, multipleOf, format, id: id2, ...rest } = json2;
|
|
20469
20469
|
if (rest.enum)
|
|
20470
20470
|
rest.enum = rest.enum.map((v) => typeof v === "number" ? String(v) : v);
|
|
20471
20471
|
else if (typeof rest.const === "number")
|
|
@@ -25610,8 +25610,8 @@ var REF_REWRITE_NAME_MAP_KEYS = /* @__PURE__ */ new Set([
|
|
|
25610
25610
|
"dependentSchemas",
|
|
25611
25611
|
"dependencies"
|
|
25612
25612
|
]);
|
|
25613
|
-
function establishesNewBase(
|
|
25614
|
-
return
|
|
25613
|
+
function establishesNewBase(id2) {
|
|
25614
|
+
return id2 !== void 0 && !(typeof id2 === "string" && id2.startsWith("#"));
|
|
25615
25615
|
}
|
|
25616
25616
|
function wrapOutputSchemaForLegacy(natural) {
|
|
25617
25617
|
const $schema = typeof natural["$schema"] === "string" ? natural["$schema"] : void 0;
|
|
@@ -31128,9 +31128,9 @@ var require_resolve = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
31128
31128
|
}
|
|
31129
31129
|
return count;
|
|
31130
31130
|
}
|
|
31131
|
-
function getFullPath(resolver,
|
|
31132
|
-
if (normalize !== false)
|
|
31133
|
-
return _getFullPath(resolver, resolver.parse(
|
|
31131
|
+
function getFullPath(resolver, id2 = "", normalize) {
|
|
31132
|
+
if (normalize !== false) id2 = normalizeId(id2);
|
|
31133
|
+
return _getFullPath(resolver, resolver.parse(id2));
|
|
31134
31134
|
}
|
|
31135
31135
|
exports.getFullPath = getFullPath;
|
|
31136
31136
|
function _getFullPath(resolver, p) {
|
|
@@ -31138,13 +31138,13 @@ var require_resolve = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
31138
31138
|
}
|
|
31139
31139
|
exports._getFullPath = _getFullPath;
|
|
31140
31140
|
const TRAILING_SLASH_HASH = /#\/?$/;
|
|
31141
|
-
function normalizeId(
|
|
31142
|
-
return
|
|
31141
|
+
function normalizeId(id2) {
|
|
31142
|
+
return id2 ? id2.replace(TRAILING_SLASH_HASH, "") : "";
|
|
31143
31143
|
}
|
|
31144
31144
|
exports.normalizeId = normalizeId;
|
|
31145
|
-
function resolveUrl(resolver, baseId,
|
|
31146
|
-
|
|
31147
|
-
return resolver.resolve(baseId,
|
|
31145
|
+
function resolveUrl(resolver, baseId, id2) {
|
|
31146
|
+
id2 = normalizeId(id2);
|
|
31147
|
+
return resolver.resolve(baseId, id2);
|
|
31148
31148
|
}
|
|
31149
31149
|
exports.resolveUrl = resolveUrl;
|
|
31150
31150
|
const ANCHOR = /^[a-z_][-a-z0-9._]*$/i;
|
|
@@ -31789,8 +31789,8 @@ var require_compile = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
31789
31789
|
const refPath = (0, resolve_1._getFullPath)(this.opts.uriResolver, p);
|
|
31790
31790
|
let baseId = (0, resolve_1.getFullPath)(this.opts.uriResolver, root.baseId, void 0);
|
|
31791
31791
|
if (Object.keys(root.schema).length > 0 && refPath === baseId) return getJsonPointer.call(this, p, root);
|
|
31792
|
-
const
|
|
31793
|
-
const schOrRef = this.refs[
|
|
31792
|
+
const id2 = (0, resolve_1.normalizeId)(refPath);
|
|
31793
|
+
const schOrRef = this.refs[id2] || this.schemas[id2];
|
|
31794
31794
|
if (typeof schOrRef == "string") {
|
|
31795
31795
|
const sch = resolveSchema.call(this, root, schOrRef);
|
|
31796
31796
|
if (typeof (sch === null || sch === void 0 ? void 0 : sch.schema) !== "object") return;
|
|
@@ -31798,7 +31798,7 @@ var require_compile = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
31798
31798
|
}
|
|
31799
31799
|
if (typeof (schOrRef === null || schOrRef === void 0 ? void 0 : schOrRef.schema) !== "object") return;
|
|
31800
31800
|
if (!schOrRef.validate) compileSchema.call(this, schOrRef);
|
|
31801
|
-
if (
|
|
31801
|
+
if (id2 === (0, resolve_1.normalizeId)(ref)) {
|
|
31802
31802
|
const { schema } = schOrRef;
|
|
31803
31803
|
const { schemaId } = this.opts;
|
|
31804
31804
|
const schId = schema[schemaId];
|
|
@@ -32666,13 +32666,13 @@ var require_core$3 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
32666
32666
|
for (const sch of schema) this.addSchema(sch, void 0, _meta, _validateSchema);
|
|
32667
32667
|
return this;
|
|
32668
32668
|
}
|
|
32669
|
-
let
|
|
32669
|
+
let id2;
|
|
32670
32670
|
if (typeof schema === "object") {
|
|
32671
32671
|
const { schemaId } = this.opts;
|
|
32672
|
-
|
|
32673
|
-
if (
|
|
32672
|
+
id2 = schema[schemaId];
|
|
32673
|
+
if (id2 !== void 0 && typeof id2 != "string") throw new Error(`schema ${schemaId} must be string`);
|
|
32674
32674
|
}
|
|
32675
|
-
key = (0, resolve_1.normalizeId)(key ||
|
|
32675
|
+
key = (0, resolve_1.normalizeId)(key || id2);
|
|
32676
32676
|
this._checkUnique(key);
|
|
32677
32677
|
this.schemas[key] = this._addSchema(schema, _meta, key, _validateSchema, true);
|
|
32678
32678
|
return this;
|
|
@@ -32737,11 +32737,11 @@ var require_core$3 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
32737
32737
|
case "object": {
|
|
32738
32738
|
const cacheKey = schemaKeyRef;
|
|
32739
32739
|
this._cache.delete(cacheKey);
|
|
32740
|
-
let
|
|
32741
|
-
if (
|
|
32742
|
-
|
|
32743
|
-
delete this.schemas[
|
|
32744
|
-
delete this.refs[
|
|
32740
|
+
let id2 = schemaKeyRef[this.opts.schemaId];
|
|
32741
|
+
if (id2) {
|
|
32742
|
+
id2 = (0, resolve_1.normalizeId)(id2);
|
|
32743
|
+
delete this.schemas[id2];
|
|
32744
|
+
delete this.refs[id2];
|
|
32745
32745
|
}
|
|
32746
32746
|
return this;
|
|
32747
32747
|
}
|
|
@@ -32833,14 +32833,14 @@ var require_core$3 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
32833
32833
|
}
|
|
32834
32834
|
}
|
|
32835
32835
|
_addSchema(schema, meta3, baseId, validateSchema = this.opts.validateSchema, addSchema = this.opts.addUsedSchema) {
|
|
32836
|
-
let
|
|
32836
|
+
let id2;
|
|
32837
32837
|
const { schemaId } = this.opts;
|
|
32838
|
-
if (typeof schema == "object")
|
|
32838
|
+
if (typeof schema == "object") id2 = schema[schemaId];
|
|
32839
32839
|
else if (this.opts.jtd) throw new Error("schema must be object");
|
|
32840
32840
|
else if (typeof schema != "boolean") throw new Error("schema must be object or boolean");
|
|
32841
32841
|
let sch = this._cache.get(schema);
|
|
32842
32842
|
if (sch !== void 0) return sch;
|
|
32843
|
-
baseId = (0, resolve_1.normalizeId)(
|
|
32843
|
+
baseId = (0, resolve_1.normalizeId)(id2 || baseId);
|
|
32844
32844
|
const localRefs = resolve_1.getSchemaRefs.call(this, schema, baseId);
|
|
32845
32845
|
sch = new compile_1.SchemaEnv({
|
|
32846
32846
|
schema,
|
|
@@ -32857,8 +32857,8 @@ var require_core$3 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
32857
32857
|
if (validateSchema) this.validateSchema(schema, true);
|
|
32858
32858
|
return sch;
|
|
32859
32859
|
}
|
|
32860
|
-
_checkUnique(
|
|
32861
|
-
if (this.schemas[
|
|
32860
|
+
_checkUnique(id2) {
|
|
32861
|
+
if (this.schemas[id2] || this.refs[id2]) throw new Error(`schema with key or id "${id2}" already exists`);
|
|
32862
32862
|
}
|
|
32863
32863
|
_compileSchemaEnv(sch) {
|
|
32864
32864
|
if (sch.meta) this._compileMetaSchema(sch);
|
|
@@ -36278,8 +36278,8 @@ var StdioListenRouter = class {
|
|
|
36278
36278
|
if (serverInfo !== void 0) this._serverInfo = serverInfo;
|
|
36279
36279
|
}
|
|
36280
36280
|
/** Whether `id` is an active listen subscription on this connection. */
|
|
36281
|
-
has(
|
|
36282
|
-
return this._subs.has(
|
|
36281
|
+
has(id2) {
|
|
36282
|
+
return this._subs.has(id2);
|
|
36283
36283
|
}
|
|
36284
36284
|
/**
|
|
36285
36285
|
* Serve one inbound `subscriptions/listen` request: registers the
|
|
@@ -36323,8 +36323,8 @@ var StdioListenRouter = class {
|
|
|
36323
36323
|
* `true` when a subscription was removed. After this call NOTHING further
|
|
36324
36324
|
* is delivered for that subscription id (the post-cancel hardening).
|
|
36325
36325
|
*/
|
|
36326
|
-
cancel(
|
|
36327
|
-
return this._subs.delete(
|
|
36326
|
+
cancel(id2) {
|
|
36327
|
+
return this._subs.delete(id2);
|
|
36328
36328
|
}
|
|
36329
36329
|
/**
|
|
36330
36330
|
* Route an outbound notification through the active subscriptions.
|
|
@@ -36356,13 +36356,13 @@ var StdioListenRouter = class {
|
|
|
36356
36356
|
*/
|
|
36357
36357
|
teardownAll() {
|
|
36358
36358
|
const out = [];
|
|
36359
|
-
for (const
|
|
36359
|
+
for (const id2 of this._subs.keys()) out.push({
|
|
36360
36360
|
jsonrpc: "2.0",
|
|
36361
|
-
id,
|
|
36361
|
+
id: id2,
|
|
36362
36362
|
result: {
|
|
36363
36363
|
resultType: "complete",
|
|
36364
36364
|
_meta: {
|
|
36365
|
-
[SUBSCRIPTION_ID_META_KEY]:
|
|
36365
|
+
[SUBSCRIPTION_ID_META_KEY]: id2,
|
|
36366
36366
|
...this._serverInfo !== void 0 && { [SERVER_INFO_META_KEY]: this._serverInfo }
|
|
36367
36367
|
}
|
|
36368
36368
|
}
|
|
@@ -37001,7 +37001,7 @@ var Server = class extends Protocol {
|
|
|
37001
37001
|
if (hasPreviousToolUse) {
|
|
37002
37002
|
const toolUseIds = new Set(previousContent.filter((c) => c.type === "tool_use").map((c) => c.id));
|
|
37003
37003
|
const toolResultIds = new Set(lastContent.filter((c) => c.type === "tool_result").map((c) => c.toolUseId));
|
|
37004
|
-
if (toolUseIds.size !== toolResultIds.size || ![...toolUseIds].every((
|
|
37004
|
+
if (toolUseIds.size !== toolResultIds.size || ![...toolUseIds].every((id2) => toolResultIds.has(id2))) throw new ProtocolError(ProtocolErrorCode.InvalidParams, "ids of tool_result blocks and tool_use blocks from previous message do not match");
|
|
37005
37005
|
}
|
|
37006
37006
|
}
|
|
37007
37007
|
const hasTools = Boolean(params.tools || params.toolChoice);
|
|
@@ -37910,8 +37910,8 @@ var StdioConnectionChannel = class {
|
|
|
37910
37910
|
}
|
|
37911
37911
|
async send(message, options) {
|
|
37912
37912
|
if (isJSONRPCResultResponse(message) || isJSONRPCErrorResponse(message)) {
|
|
37913
|
-
const { id } = message;
|
|
37914
|
-
if (
|
|
37913
|
+
const { id: id2 } = message;
|
|
37914
|
+
if (id2 !== void 0) this._settle(id2);
|
|
37915
37915
|
}
|
|
37916
37916
|
if (this._closed) return;
|
|
37917
37917
|
if (this._outboundIntercept?.(message) === "handled") return;
|
|
@@ -37964,8 +37964,8 @@ var StdioConnectionChannel = class {
|
|
|
37964
37964
|
this.onclose?.();
|
|
37965
37965
|
}
|
|
37966
37966
|
}
|
|
37967
|
-
_settle(
|
|
37968
|
-
this._pendingRequests.delete(
|
|
37967
|
+
_settle(id2) {
|
|
37968
|
+
this._pendingRequests.delete(id2);
|
|
37969
37969
|
if (this._pendingRequests.size === 0) this._releaseDrainWaiters();
|
|
37970
37970
|
}
|
|
37971
37971
|
_releaseDrainWaiters() {
|
|
@@ -38021,9 +38021,9 @@ function serveStdio(factory, options = {}) {
|
|
|
38021
38021
|
} catch {
|
|
38022
38022
|
}
|
|
38023
38023
|
};
|
|
38024
|
-
const writeErrorResponse = (
|
|
38024
|
+
const writeErrorResponse = (id2, code2, message, data) => wire.send({
|
|
38025
38025
|
jsonrpc: "2.0",
|
|
38026
|
-
id,
|
|
38026
|
+
id: id2,
|
|
38027
38027
|
error: {
|
|
38028
38028
|
code: code2,
|
|
38029
38029
|
message,
|
|
@@ -40725,12 +40725,12 @@ var PROTOCOL_VERSION = 4;
|
|
|
40725
40725
|
var HKDF_SESSION_INFO = "fetchproxy/4.0.0/session";
|
|
40726
40726
|
var enc = new TextEncoder();
|
|
40727
40727
|
function helloSignaturePayload(mcpId, sessionNonce, sessionPub, answersExtNonce) {
|
|
40728
|
-
const
|
|
40729
|
-
const out = new Uint8Array(
|
|
40730
|
-
out.set(
|
|
40731
|
-
out.set(sessionNonce,
|
|
40732
|
-
out.set(sessionPub,
|
|
40733
|
-
out.set(answersExtNonce,
|
|
40728
|
+
const id2 = enc.encode(mcpId);
|
|
40729
|
+
const out = new Uint8Array(id2.length + sessionNonce.length + sessionPub.length + answersExtNonce.length);
|
|
40730
|
+
out.set(id2, 0);
|
|
40731
|
+
out.set(sessionNonce, id2.length);
|
|
40732
|
+
out.set(sessionPub, id2.length + sessionNonce.length);
|
|
40733
|
+
out.set(answersExtNonce, id2.length + sessionNonce.length + sessionPub.length);
|
|
40734
40734
|
return out;
|
|
40735
40735
|
}
|
|
40736
40736
|
var ANSWERS_NO_EXT_SESSION = new Uint8Array(32);
|
|
@@ -40808,8 +40808,8 @@ function generateMcpId(serverName, version2) {
|
|
|
40808
40808
|
const rand = randomHex(8);
|
|
40809
40809
|
return `${serverName}:${version2}:${rand}`;
|
|
40810
40810
|
}
|
|
40811
|
-
function isValidMcpId(
|
|
40812
|
-
return typeof
|
|
40811
|
+
function isValidMcpId(id2) {
|
|
40812
|
+
return typeof id2 === "string" && ID_RE.test(id2);
|
|
40813
40813
|
}
|
|
40814
40814
|
function randomHex(bytes) {
|
|
40815
40815
|
const arr = new Uint8Array(bytes);
|
|
@@ -42805,13 +42805,13 @@ async function generateIdentity() {
|
|
|
42805
42805
|
createdAt: Date.now()
|
|
42806
42806
|
};
|
|
42807
42807
|
}
|
|
42808
|
-
function serializeIdentity(
|
|
42808
|
+
function serializeIdentity(id2) {
|
|
42809
42809
|
return JSON.stringify({
|
|
42810
|
-
x25519Priv: toB64(
|
|
42811
|
-
x25519Pub: toB64(
|
|
42812
|
-
ed25519Priv: toB64(
|
|
42813
|
-
ed25519Pub: toB64(
|
|
42814
|
-
createdAt:
|
|
42810
|
+
x25519Priv: toB64(id2.x25519Priv),
|
|
42811
|
+
x25519Pub: toB64(id2.x25519Pub),
|
|
42812
|
+
ed25519Priv: toB64(id2.ed25519Priv),
|
|
42813
|
+
ed25519Pub: toB64(id2.ed25519Pub),
|
|
42814
|
+
createdAt: id2.createdAt
|
|
42815
42815
|
}, null, 2);
|
|
42816
42816
|
}
|
|
42817
42817
|
function parseIdentity(text) {
|
|
@@ -42867,9 +42867,9 @@ async function loadOrCreateIdentity(serverName, dir = defaultIdentityDir()) {
|
|
|
42867
42867
|
let unreadable = null;
|
|
42868
42868
|
let recovered = false;
|
|
42869
42869
|
for (let attempt = 0; attempt < 5; attempt++) {
|
|
42870
|
-
const
|
|
42871
|
-
if (await publishIdentityIfAbsent(dir, serverName,
|
|
42872
|
-
return
|
|
42870
|
+
const id2 = await generateIdentity();
|
|
42871
|
+
if (await publishIdentityIfAbsent(dir, serverName, id2))
|
|
42872
|
+
return id2;
|
|
42873
42873
|
try {
|
|
42874
42874
|
return parseIdentity(await readFile(path, "utf8"));
|
|
42875
42875
|
} catch (e) {
|
|
@@ -42892,12 +42892,12 @@ async function loadOrCreateIdentity(serverName, dir = defaultIdentityDir()) {
|
|
|
42892
42892
|
throw new Error(`fetchproxy: could not create an identity for ${JSON.stringify(serverName)} in ${dir}`);
|
|
42893
42893
|
}
|
|
42894
42894
|
var NO_HARD_LINKS = /* @__PURE__ */ new Set(["EPERM", "ENOTSUP", "EOPNOTSUPP", "ENOSYS"]);
|
|
42895
|
-
async function publishIdentityIfAbsent(dir, serverName,
|
|
42895
|
+
async function publishIdentityIfAbsent(dir, serverName, id2) {
|
|
42896
42896
|
const path = identityFilePath(dir, serverName);
|
|
42897
42897
|
await sweepStagingFiles(dir, serverName, { olderThanMs: 6e4 });
|
|
42898
42898
|
const tmp = `${path}.${randomBytes5(STAGING_BYTES).toString("hex")}.tmp`;
|
|
42899
42899
|
try {
|
|
42900
|
-
await writeFile(tmp, serializeIdentity(
|
|
42900
|
+
await writeFile(tmp, serializeIdentity(id2), { mode: 384, flag: "wx" });
|
|
42901
42901
|
await chmod(tmp, 384);
|
|
42902
42902
|
try {
|
|
42903
42903
|
await link(tmp, path);
|
|
@@ -42906,7 +42906,7 @@ async function publishIdentityIfAbsent(dir, serverName, id) {
|
|
|
42906
42906
|
if (code2 === void 0 || !NO_HARD_LINKS.has(code2))
|
|
42907
42907
|
throw e;
|
|
42908
42908
|
try {
|
|
42909
|
-
await writeFile(path, serializeIdentity(
|
|
42909
|
+
await writeFile(path, serializeIdentity(id2), { mode: 384, flag: "wx" });
|
|
42910
42910
|
} catch (writeErr) {
|
|
42911
42911
|
if (writeErr.code !== "EEXIST") {
|
|
42912
42912
|
await rm(path, { force: true }).catch(() => void 0);
|
|
@@ -45140,17 +45140,17 @@ var FetchproxyServer = class {
|
|
|
45140
45140
|
}
|
|
45141
45141
|
} catch (err) {
|
|
45142
45142
|
if ("id" in inner && typeof inner.id === "number") {
|
|
45143
|
-
const { id } = inner;
|
|
45144
|
-
this.pending.delete(
|
|
45145
|
-
this.pendingReadCookies.delete(
|
|
45146
|
-
this.pendingStorage.delete(
|
|
45147
|
-
this.pendingWriteCookies.delete(
|
|
45148
|
-
this.pendingCapture.delete(
|
|
45149
|
-
this.pendingRedirect.delete(
|
|
45150
|
-
this.pendingDownload.delete(
|
|
45151
|
-
this.pendingIdb.delete(
|
|
45152
|
-
this.pendingDomList.delete(
|
|
45153
|
-
this.pendingGraphql.delete(
|
|
45143
|
+
const { id: id2 } = inner;
|
|
45144
|
+
this.pending.delete(id2);
|
|
45145
|
+
this.pendingReadCookies.delete(id2);
|
|
45146
|
+
this.pendingStorage.delete(id2);
|
|
45147
|
+
this.pendingWriteCookies.delete(id2);
|
|
45148
|
+
this.pendingCapture.delete(id2);
|
|
45149
|
+
this.pendingRedirect.delete(id2);
|
|
45150
|
+
this.pendingDownload.delete(id2);
|
|
45151
|
+
this.pendingIdb.delete(id2);
|
|
45152
|
+
this.pendingDomList.delete(id2);
|
|
45153
|
+
this.pendingGraphql.delete(id2);
|
|
45154
45154
|
}
|
|
45155
45155
|
throw err;
|
|
45156
45156
|
}
|
|
@@ -45161,10 +45161,10 @@ var FetchproxyServer = class {
|
|
|
45161
45161
|
* the throwing surface is the convenience methods.
|
|
45162
45162
|
*/
|
|
45163
45163
|
async _fetchOnceWithTimeout(init, fetchOpts = {}) {
|
|
45164
|
-
const
|
|
45165
|
-
const inner = { type: "request", id, op: "fetch", init };
|
|
45164
|
+
const id2 = this.nextRequestId++;
|
|
45165
|
+
const inner = { type: "request", id: id2, op: "fetch", init };
|
|
45166
45166
|
const pending = this.guardPending(new Promise((resolve7) => {
|
|
45167
|
-
this.pending.set(
|
|
45167
|
+
this.pending.set(id2, resolve7);
|
|
45168
45168
|
}));
|
|
45169
45169
|
try {
|
|
45170
45170
|
await this.sendInnerFrame(inner, {
|
|
@@ -45198,7 +45198,7 @@ var FetchproxyServer = class {
|
|
|
45198
45198
|
pending,
|
|
45199
45199
|
new Promise((resolve7) => {
|
|
45200
45200
|
timer = setTimeout(() => {
|
|
45201
|
-
this.pending.delete(
|
|
45201
|
+
this.pending.delete(id2);
|
|
45202
45202
|
const elapsedMs = Date.now() - start;
|
|
45203
45203
|
const base = `fetchproxy: ${init.url} did not respond within ${timeoutMs}ms`;
|
|
45204
45204
|
const error62 = isRetrySafeOnTimeout(init.method, fetchOpts.retryOnTimeout) ? base : withNotResentNote(base);
|
|
@@ -45262,7 +45262,7 @@ var FetchproxyServer = class {
|
|
|
45262
45262
|
});
|
|
45263
45263
|
return pending;
|
|
45264
45264
|
}
|
|
45265
|
-
async _withVerbTimeout(pending, pendingMap,
|
|
45265
|
+
async _withVerbTimeout(pending, pendingMap, id2, url2, requestedTimeoutMs, retrySafe = true) {
|
|
45266
45266
|
const transportMs = this.opts.fetchTimeoutMs;
|
|
45267
45267
|
if (transportMs === void 0 || transportMs <= 0)
|
|
45268
45268
|
return pending;
|
|
@@ -45275,7 +45275,7 @@ var FetchproxyServer = class {
|
|
|
45275
45275
|
pending,
|
|
45276
45276
|
new Promise((_resolve, reject) => {
|
|
45277
45277
|
timer = setTimeout(() => {
|
|
45278
|
-
pendingMap.delete(
|
|
45278
|
+
pendingMap.delete(id2);
|
|
45279
45279
|
reject(new FetchproxyTimeoutError({
|
|
45280
45280
|
url: url2,
|
|
45281
45281
|
timeoutMs,
|
|
@@ -45612,7 +45612,7 @@ var FetchproxyServer = class {
|
|
|
45612
45612
|
assertSubdomainLabel(opts.subdomain);
|
|
45613
45613
|
const baseDomain = this.resolveBaseDomain(opts.domain);
|
|
45614
45614
|
const host = opts.subdomain ? `${opts.subdomain}.${baseDomain}` : baseDomain;
|
|
45615
|
-
const
|
|
45615
|
+
const id2 = this.nextRequestId++;
|
|
45616
45616
|
let inner;
|
|
45617
45617
|
if (opts.keys !== void 0) {
|
|
45618
45618
|
this.assertScopeSubset(opts.keys, this.opts.cookieKeys, "cookieKeys");
|
|
@@ -45625,16 +45625,16 @@ var FetchproxyServer = class {
|
|
|
45625
45625
|
keys: [...opts.keys],
|
|
45626
45626
|
...cookiePath !== void 0 ? { path: cookiePath } : {}
|
|
45627
45627
|
};
|
|
45628
|
-
inner = { type: "request", id, op: "read_cookies", init: initV3 };
|
|
45628
|
+
inner = { type: "request", id: id2, op: "read_cookies", init: initV3 };
|
|
45629
45629
|
} else {
|
|
45630
45630
|
const tabUrl = `https://${host}/`;
|
|
45631
|
-
inner = { type: "request", id, op: "read_cookies", init: { tabUrl } };
|
|
45631
|
+
inner = { type: "request", id: id2, op: "read_cookies", init: { tabUrl } };
|
|
45632
45632
|
}
|
|
45633
45633
|
const pending = this.guardPending(new Promise((resolve7) => {
|
|
45634
|
-
this.pendingReadCookies.set(
|
|
45634
|
+
this.pendingReadCookies.set(id2, resolve7);
|
|
45635
45635
|
}));
|
|
45636
45636
|
await this.sendInnerFrame(inner);
|
|
45637
|
-
const result = await this._withVerbTimeout(pending, this.pendingReadCookies,
|
|
45637
|
+
const result = await this._withVerbTimeout(pending, this.pendingReadCookies, id2, `https://${host}`);
|
|
45638
45638
|
if (!result.ok) {
|
|
45639
45639
|
throw protocolErrorFrom(result.error);
|
|
45640
45640
|
}
|
|
@@ -45676,10 +45676,10 @@ var FetchproxyServer = class {
|
|
|
45676
45676
|
const host = opts.subdomain ? `${opts.subdomain}.${baseDomain}` : baseDomain;
|
|
45677
45677
|
this.assertScopeSubset(names, this.opts.cookieKeys, "cookieKeys");
|
|
45678
45678
|
const cookiePath = normalizeCookiePath(opts.path);
|
|
45679
|
-
const
|
|
45679
|
+
const id2 = this.nextRequestId++;
|
|
45680
45680
|
const inner = {
|
|
45681
45681
|
type: "request",
|
|
45682
|
-
id,
|
|
45682
|
+
id: id2,
|
|
45683
45683
|
op: "write_cookies",
|
|
45684
45684
|
init: {
|
|
45685
45685
|
// Bare origin, same invariant as the read path: a path must never be
|
|
@@ -45690,13 +45690,13 @@ var FetchproxyServer = class {
|
|
|
45690
45690
|
}
|
|
45691
45691
|
};
|
|
45692
45692
|
const pending = this.guardPending(new Promise((resolve7, reject) => {
|
|
45693
|
-
this.pendingWriteCookies.set(
|
|
45693
|
+
this.pendingWriteCookies.set(id2, { resolve: resolve7, reject });
|
|
45694
45694
|
}));
|
|
45695
45695
|
await this.sendInnerFrame(inner);
|
|
45696
45696
|
return this._withVerbTimeout(
|
|
45697
45697
|
pending,
|
|
45698
45698
|
this.pendingWriteCookies,
|
|
45699
|
-
|
|
45699
|
+
id2,
|
|
45700
45700
|
`https://${host}`,
|
|
45701
45701
|
void 0,
|
|
45702
45702
|
// A write: never re-sent after an ambiguous timeout.
|
|
@@ -45749,10 +45749,10 @@ var FetchproxyServer = class {
|
|
|
45749
45749
|
assertSubdomainLabel(opts.subdomain);
|
|
45750
45750
|
const baseDomain = this.resolveBaseDomain(opts.domain);
|
|
45751
45751
|
const host = opts.subdomain ? `${opts.subdomain}.${baseDomain}` : baseDomain;
|
|
45752
|
-
const
|
|
45752
|
+
const id2 = this.nextRequestId++;
|
|
45753
45753
|
const inner = {
|
|
45754
45754
|
type: "request",
|
|
45755
|
-
id,
|
|
45755
|
+
id: id2,
|
|
45756
45756
|
op,
|
|
45757
45757
|
init: {
|
|
45758
45758
|
origin: `https://${host}`,
|
|
@@ -45761,10 +45761,10 @@ var FetchproxyServer = class {
|
|
|
45761
45761
|
}
|
|
45762
45762
|
};
|
|
45763
45763
|
const pending = this.guardPending(new Promise((resolve7, reject) => {
|
|
45764
|
-
this.pendingStorage.set(
|
|
45764
|
+
this.pendingStorage.set(id2, { resolve: resolve7, reject });
|
|
45765
45765
|
}));
|
|
45766
45766
|
await this.sendInnerFrame(inner);
|
|
45767
|
-
return this._withVerbTimeout(pending, this.pendingStorage,
|
|
45767
|
+
return this._withVerbTimeout(pending, this.pendingStorage, id2, `https://${host}`);
|
|
45768
45768
|
}
|
|
45769
45769
|
/**
|
|
45770
45770
|
* 0.3.0+: snapshot the next outgoing request's named header. Single-
|
|
@@ -45807,10 +45807,10 @@ var FetchproxyServer = class {
|
|
|
45807
45807
|
return this.withLazyRevive("capture_request_header", `https://${resolved.host}${resolved.path ?? "/*"}`, () => this._captureRequestHeaderOnce(callOpts));
|
|
45808
45808
|
}
|
|
45809
45809
|
async _captureRequestHeaderOnce(opts) {
|
|
45810
|
-
const
|
|
45810
|
+
const id2 = this.nextRequestId++;
|
|
45811
45811
|
const inner = {
|
|
45812
45812
|
type: "request",
|
|
45813
|
-
id,
|
|
45813
|
+
id: id2,
|
|
45814
45814
|
op: "capture_request_header",
|
|
45815
45815
|
init: {
|
|
45816
45816
|
host: opts.host,
|
|
@@ -45820,13 +45820,13 @@ var FetchproxyServer = class {
|
|
|
45820
45820
|
}
|
|
45821
45821
|
};
|
|
45822
45822
|
const pending = this.guardPending(new Promise((resolve7, reject) => {
|
|
45823
|
-
this.pendingCapture.set(
|
|
45823
|
+
this.pendingCapture.set(id2, { resolve: resolve7, reject });
|
|
45824
45824
|
}));
|
|
45825
45825
|
await this.sendInnerFrame(inner);
|
|
45826
45826
|
return this._withVerbTimeout(
|
|
45827
45827
|
pending,
|
|
45828
45828
|
this.pendingCapture,
|
|
45829
|
-
|
|
45829
|
+
id2,
|
|
45830
45830
|
`https://${opts.host}${opts.path ?? "/*"}`,
|
|
45831
45831
|
// #237: this GOVERNS the deadline (window + reply grace, floored at the
|
|
45832
45832
|
// transport bound). Under #277 it did not, and was passed only so the
|
|
@@ -45856,10 +45856,10 @@ var FetchproxyServer = class {
|
|
|
45856
45856
|
return this.withLazyRevive("capture_redirect", `https://${opts.host}${opts.path ?? "/*"}`, () => this._captureRedirectOnce(opts));
|
|
45857
45857
|
}
|
|
45858
45858
|
async _captureRedirectOnce(opts) {
|
|
45859
|
-
const
|
|
45859
|
+
const id2 = this.nextRequestId++;
|
|
45860
45860
|
const inner = {
|
|
45861
45861
|
type: "request",
|
|
45862
|
-
id,
|
|
45862
|
+
id: id2,
|
|
45863
45863
|
op: "capture_redirect",
|
|
45864
45864
|
init: {
|
|
45865
45865
|
host: opts.host,
|
|
@@ -45868,13 +45868,13 @@ var FetchproxyServer = class {
|
|
|
45868
45868
|
}
|
|
45869
45869
|
};
|
|
45870
45870
|
const pending = this.guardPending(new Promise((resolve7, reject) => {
|
|
45871
|
-
this.pendingRedirect.set(
|
|
45871
|
+
this.pendingRedirect.set(id2, { resolve: resolve7, reject });
|
|
45872
45872
|
}));
|
|
45873
45873
|
await this.sendInnerFrame(inner);
|
|
45874
45874
|
return this._withVerbTimeout(
|
|
45875
45875
|
pending,
|
|
45876
45876
|
this.pendingRedirect,
|
|
45877
|
-
|
|
45877
|
+
id2,
|
|
45878
45878
|
`https://${opts.host}${opts.path ?? "/*"}`,
|
|
45879
45879
|
// #237: this GOVERNS the deadline (window + reply grace, floored at the
|
|
45880
45880
|
// transport bound). Under #277 it did not, and was passed only so the
|
|
@@ -45952,10 +45952,10 @@ var FetchproxyServer = class {
|
|
|
45952
45952
|
}
|
|
45953
45953
|
}
|
|
45954
45954
|
async _downloadOnce(opts) {
|
|
45955
|
-
const
|
|
45955
|
+
const id2 = this.nextRequestId++;
|
|
45956
45956
|
const inner = {
|
|
45957
45957
|
type: "request",
|
|
45958
|
-
id,
|
|
45958
|
+
id: id2,
|
|
45959
45959
|
op: "download",
|
|
45960
45960
|
init: {
|
|
45961
45961
|
url: opts.url,
|
|
@@ -45964,13 +45964,13 @@ var FetchproxyServer = class {
|
|
|
45964
45964
|
}
|
|
45965
45965
|
};
|
|
45966
45966
|
const pending = this.guardPending(new Promise((resolve7, reject) => {
|
|
45967
|
-
this.pendingDownload.set(
|
|
45967
|
+
this.pendingDownload.set(id2, { resolve: resolve7, reject });
|
|
45968
45968
|
}));
|
|
45969
45969
|
await this.sendInnerFrame(inner);
|
|
45970
45970
|
return this._withVerbTimeout(
|
|
45971
45971
|
pending,
|
|
45972
45972
|
this.pendingDownload,
|
|
45973
|
-
|
|
45973
|
+
id2,
|
|
45974
45974
|
opts.url,
|
|
45975
45975
|
// `download` takes a per-call timeoutMs like the two capture verbs, so
|
|
45976
45976
|
// it is governed by it like them (#237). It used to hit the identical
|
|
@@ -46012,10 +46012,10 @@ var FetchproxyServer = class {
|
|
|
46012
46012
|
throw new Error(`FetchproxyServer.readIndexedDb: (origin=${origin}, database=${JSON.stringify(opts.database)}, store=${JSON.stringify(opts.store)}) not declared in indexedDbScopes`);
|
|
46013
46013
|
}
|
|
46014
46014
|
this.assertScopeSubset(opts.keys, decl.keys, "indexedDbScopes.keys");
|
|
46015
|
-
const
|
|
46015
|
+
const id2 = this.nextRequestId++;
|
|
46016
46016
|
const inner = {
|
|
46017
46017
|
type: "request",
|
|
46018
|
-
id,
|
|
46018
|
+
id: id2,
|
|
46019
46019
|
op: "read_indexed_db",
|
|
46020
46020
|
init: {
|
|
46021
46021
|
origin,
|
|
@@ -46025,10 +46025,10 @@ var FetchproxyServer = class {
|
|
|
46025
46025
|
}
|
|
46026
46026
|
};
|
|
46027
46027
|
const pending = this.guardPending(new Promise((resolve7, reject) => {
|
|
46028
|
-
this.pendingIdb.set(
|
|
46028
|
+
this.pendingIdb.set(id2, { resolve: resolve7, reject });
|
|
46029
46029
|
}));
|
|
46030
46030
|
await this.sendInnerFrame(inner);
|
|
46031
|
-
return this._withVerbTimeout(pending, this.pendingIdb,
|
|
46031
|
+
return this._withVerbTimeout(pending, this.pendingIdb, id2, origin);
|
|
46032
46032
|
}
|
|
46033
46033
|
/**
|
|
46034
46034
|
* 1.4.0+: read declared DOM values from the user's signed-in tab.
|
|
@@ -46057,18 +46057,18 @@ var FetchproxyServer = class {
|
|
|
46057
46057
|
const baseDomain = this.resolveBaseDomain(opts.domain);
|
|
46058
46058
|
const host = opts.subdomain ? `${opts.subdomain}.${baseDomain}` : baseDomain;
|
|
46059
46059
|
const origin = `https://${host}`;
|
|
46060
|
-
const
|
|
46060
|
+
const id2 = this.nextRequestId++;
|
|
46061
46061
|
const inner = {
|
|
46062
46062
|
type: "request",
|
|
46063
|
-
id,
|
|
46063
|
+
id: id2,
|
|
46064
46064
|
op: "read_dom",
|
|
46065
46065
|
init: { origin, names: [...opts.names] }
|
|
46066
46066
|
};
|
|
46067
46067
|
const pending = this.guardPending(new Promise((resolve7, reject) => {
|
|
46068
|
-
this.pendingStorage.set(
|
|
46068
|
+
this.pendingStorage.set(id2, { resolve: resolve7, reject });
|
|
46069
46069
|
}));
|
|
46070
46070
|
await this.sendInnerFrame(inner);
|
|
46071
|
-
return this._withVerbTimeout(pending, this.pendingStorage,
|
|
46071
|
+
return this._withVerbTimeout(pending, this.pendingStorage, id2, origin);
|
|
46072
46072
|
}
|
|
46073
46073
|
/**
|
|
46074
46074
|
* 3.1.0+: read a declared REPEATED DOM structure from the user's
|
|
@@ -46103,18 +46103,18 @@ var FetchproxyServer = class {
|
|
|
46103
46103
|
const baseDomain = this.resolveBaseDomain(opts.domain);
|
|
46104
46104
|
const host = opts.subdomain ? `${opts.subdomain}.${baseDomain}` : baseDomain;
|
|
46105
46105
|
const origin = `https://${host}`;
|
|
46106
|
-
const
|
|
46106
|
+
const id2 = this.nextRequestId++;
|
|
46107
46107
|
const inner = {
|
|
46108
46108
|
type: "request",
|
|
46109
|
-
id,
|
|
46109
|
+
id: id2,
|
|
46110
46110
|
op: "read_dom_list",
|
|
46111
46111
|
init: { origin, name: opts.name }
|
|
46112
46112
|
};
|
|
46113
46113
|
const pending = this.guardPending(new Promise((resolve7, reject) => {
|
|
46114
|
-
this.pendingDomList.set(
|
|
46114
|
+
this.pendingDomList.set(id2, { resolve: resolve7, reject });
|
|
46115
46115
|
}));
|
|
46116
46116
|
await this.sendInnerFrame(inner);
|
|
46117
|
-
return this._withVerbTimeout(pending, this.pendingDomList,
|
|
46117
|
+
return this._withVerbTimeout(pending, this.pendingDomList, id2, origin);
|
|
46118
46118
|
}
|
|
46119
46119
|
/**
|
|
46120
46120
|
* 1.x+: run a declared GraphQL operation through the page's own Apollo
|
|
@@ -46145,10 +46145,10 @@ var FetchproxyServer = class {
|
|
|
46145
46145
|
}
|
|
46146
46146
|
await this.ensureConnected();
|
|
46147
46147
|
this.throwIfPendingPair();
|
|
46148
|
-
const
|
|
46148
|
+
const id2 = this.nextRequestId++;
|
|
46149
46149
|
const inner = {
|
|
46150
46150
|
type: "request",
|
|
46151
|
-
id,
|
|
46151
|
+
id: id2,
|
|
46152
46152
|
op: "graphql_query",
|
|
46153
46153
|
init: {
|
|
46154
46154
|
name: opts.name,
|
|
@@ -46157,11 +46157,11 @@ var FetchproxyServer = class {
|
|
|
46157
46157
|
}
|
|
46158
46158
|
};
|
|
46159
46159
|
const pending = this.guardPending(new Promise((resolve7, reject) => {
|
|
46160
|
-
this.pendingGraphql.set(
|
|
46160
|
+
this.pendingGraphql.set(id2, { resolve: resolve7, reject });
|
|
46161
46161
|
}));
|
|
46162
46162
|
const retrySafe = opts.retryOnTimeout === true;
|
|
46163
46163
|
await this.sendInnerFrame(inner, { resendable: retrySafe });
|
|
46164
|
-
return this._withVerbTimeout(pending, this.pendingGraphql,
|
|
46164
|
+
return this._withVerbTimeout(pending, this.pendingGraphql, id2, opts.name, void 0, retrySafe);
|
|
46165
46165
|
}
|
|
46166
46166
|
assertScopeSubset(requested, declared, label) {
|
|
46167
46167
|
const undeclared = undeclaredKeys(requested, declared);
|
|
@@ -46361,9 +46361,9 @@ var FetchproxyServer = class {
|
|
|
46361
46361
|
}
|
|
46362
46362
|
}
|
|
46363
46363
|
rejectAllPending(reason = "extension disconnected", keep = /* @__PURE__ */ new Set()) {
|
|
46364
|
-
for (const
|
|
46365
|
-
if (!keep.has(
|
|
46366
|
-
this.rejectPendingId(
|
|
46364
|
+
for (const id2 of this.allPendingIds()) {
|
|
46365
|
+
if (!keep.has(id2))
|
|
46366
|
+
this.rejectPendingId(id2, reason);
|
|
46367
46367
|
}
|
|
46368
46368
|
if (keep.size === 0)
|
|
46369
46369
|
this.resendable.clear();
|
|
@@ -46372,8 +46372,8 @@ var FetchproxyServer = class {
|
|
|
46372
46372
|
allPendingIds() {
|
|
46373
46373
|
const ids = [];
|
|
46374
46374
|
for (const map2 of this.pendingMaps())
|
|
46375
|
-
for (const
|
|
46376
|
-
ids.push(
|
|
46375
|
+
for (const id2 of map2.keys())
|
|
46376
|
+
ids.push(id2);
|
|
46377
46377
|
return ids;
|
|
46378
46378
|
}
|
|
46379
46379
|
pendingMaps() {
|
|
@@ -46390,16 +46390,16 @@ var FetchproxyServer = class {
|
|
|
46390
46390
|
this.pendingGraphql
|
|
46391
46391
|
];
|
|
46392
46392
|
}
|
|
46393
|
-
isPendingId(
|
|
46394
|
-
return this.pendingMaps().some((m) => m.has(
|
|
46393
|
+
isPendingId(id2) {
|
|
46394
|
+
return this.pendingMaps().some((m) => m.has(id2));
|
|
46395
46395
|
}
|
|
46396
46396
|
/** Fail the one awaiter registered under `id`, in its own map's shape. */
|
|
46397
|
-
rejectPendingId(
|
|
46397
|
+
rejectPendingId(id2, reason) {
|
|
46398
46398
|
const err = new FetchproxyProtocolError(reason);
|
|
46399
|
-
this.resendable.delete(
|
|
46400
|
-
const fetchCb = this.pending.get(
|
|
46399
|
+
this.resendable.delete(id2);
|
|
46400
|
+
const fetchCb = this.pending.get(id2);
|
|
46401
46401
|
if (fetchCb) {
|
|
46402
|
-
this.pending.delete(
|
|
46402
|
+
this.pending.delete(id2);
|
|
46403
46403
|
fetchCb({
|
|
46404
46404
|
ok: false,
|
|
46405
46405
|
error: err.message,
|
|
@@ -46408,9 +46408,9 @@ var FetchproxyServer = class {
|
|
|
46408
46408
|
});
|
|
46409
46409
|
return;
|
|
46410
46410
|
}
|
|
46411
|
-
const cookieCb = this.pendingReadCookies.get(
|
|
46411
|
+
const cookieCb = this.pendingReadCookies.get(id2);
|
|
46412
46412
|
if (cookieCb) {
|
|
46413
|
-
this.pendingReadCookies.delete(
|
|
46413
|
+
this.pendingReadCookies.delete(id2);
|
|
46414
46414
|
cookieCb({ ok: false, error: err.message });
|
|
46415
46415
|
return;
|
|
46416
46416
|
}
|
|
@@ -46424,9 +46424,9 @@ var FetchproxyServer = class {
|
|
|
46424
46424
|
this.pendingDownload,
|
|
46425
46425
|
this.pendingGraphql
|
|
46426
46426
|
]) {
|
|
46427
|
-
const entry = map2.get(
|
|
46427
|
+
const entry = map2.get(id2);
|
|
46428
46428
|
if (entry) {
|
|
46429
|
-
map2.delete(
|
|
46429
|
+
map2.delete(id2);
|
|
46430
46430
|
entry.reject(err);
|
|
46431
46431
|
return;
|
|
46432
46432
|
}
|
|
@@ -46435,9 +46435,9 @@ var FetchproxyServer = class {
|
|
|
46435
46435
|
noteResendable(inner) {
|
|
46436
46436
|
this.resendable.set(inner.id, inner);
|
|
46437
46437
|
if (this.resendable.size > 256) {
|
|
46438
|
-
for (const
|
|
46439
|
-
if (!this.isPendingId(
|
|
46440
|
-
this.resendable.delete(
|
|
46438
|
+
for (const id2 of [...this.resendable.keys()]) {
|
|
46439
|
+
if (!this.isPendingId(id2))
|
|
46440
|
+
this.resendable.delete(id2);
|
|
46441
46441
|
}
|
|
46442
46442
|
}
|
|
46443
46443
|
}
|
|
@@ -46452,29 +46452,29 @@ var FetchproxyServer = class {
|
|
|
46452
46452
|
*/
|
|
46453
46453
|
async recoverFromHostLoss() {
|
|
46454
46454
|
const toResend = /* @__PURE__ */ new Map();
|
|
46455
|
-
for (const [
|
|
46456
|
-
if (this.isPendingId(
|
|
46457
|
-
toResend.set(
|
|
46455
|
+
for (const [id2, inner] of this.resendable) {
|
|
46456
|
+
if (this.isPendingId(id2))
|
|
46457
|
+
toResend.set(id2, inner);
|
|
46458
46458
|
}
|
|
46459
46459
|
this.resendable.clear();
|
|
46460
46460
|
this.rejectAllPending("fetchproxy: the MCP process holding the bridge port exited while this request was in flight. It was not re-sent because it may already have run in the browser \u2014 check before retrying.", new Set(toResend.keys()));
|
|
46461
46461
|
if (toResend.size === 0)
|
|
46462
46462
|
return;
|
|
46463
|
-
const lost = (
|
|
46463
|
+
const lost = (id2, e) => this.rejectPendingId(id2, `fetchproxy: the bridge host exited and reconnecting failed: ${e instanceof Error ? e.message : String(e)}`);
|
|
46464
46464
|
try {
|
|
46465
46465
|
await this.ensureConnected();
|
|
46466
46466
|
} catch (e) {
|
|
46467
|
-
for (const
|
|
46468
|
-
lost(
|
|
46467
|
+
for (const id2 of toResend.keys())
|
|
46468
|
+
lost(id2, e);
|
|
46469
46469
|
return;
|
|
46470
46470
|
}
|
|
46471
|
-
for (const [
|
|
46472
|
-
if (!this.isPendingId(
|
|
46471
|
+
for (const [id2, inner] of toResend) {
|
|
46472
|
+
if (!this.isPendingId(id2))
|
|
46473
46473
|
continue;
|
|
46474
46474
|
try {
|
|
46475
46475
|
await this.resendInnerFrame(inner);
|
|
46476
46476
|
} catch (e) {
|
|
46477
|
-
lost(
|
|
46477
|
+
lost(id2, e);
|
|
46478
46478
|
}
|
|
46479
46479
|
}
|
|
46480
46480
|
}
|
|
@@ -47063,7 +47063,7 @@ function describeTokenlessLogin(record2) {
|
|
|
47063
47063
|
|
|
47064
47064
|
// src/version.ts
|
|
47065
47065
|
var SERVER_NAME = "ofw-mcp";
|
|
47066
|
-
var VERSION = "2.
|
|
47066
|
+
var VERSION = "2.22.0";
|
|
47067
47067
|
|
|
47068
47068
|
// src/auth.ts
|
|
47069
47069
|
function fetchproxyDisabled() {
|
|
@@ -47760,7 +47760,7 @@ function unconfirmedWriteResponse(e, opts) {
|
|
|
47760
47760
|
remedy: `Do NOT retry blindly \u2014 a second attempt can put a duplicate on the co-parent-visible record. First check with ${opts.checkWith}${fallback}, and retry only once you have confirmed it did not land.`
|
|
47761
47761
|
});
|
|
47762
47762
|
}
|
|
47763
|
-
async function postMessageAndRefetch(client2, payload,
|
|
47763
|
+
async function postMessageAndRefetch(client2, payload, detailSchema2, ctx) {
|
|
47764
47764
|
let posted;
|
|
47765
47765
|
try {
|
|
47766
47766
|
posted = await client2.request("POST", "/pub/v3/messages", payload);
|
|
@@ -47772,20 +47772,20 @@ async function postMessageAndRefetch(client2, payload, detailSchema, ctx) {
|
|
|
47772
47772
|
posted,
|
|
47773
47773
|
{ label: "ofw-mcp", context: `POST /pub/v3/messages (${ctx})`, mode: "strict" }
|
|
47774
47774
|
);
|
|
47775
|
-
const
|
|
47776
|
-
if (
|
|
47775
|
+
const id2 = typeof raw?.id === "number" ? raw.id : typeof raw?.entityId === "number" ? raw.entityId : null;
|
|
47776
|
+
if (id2 === null) return { id: null, detail: null, raw };
|
|
47777
47777
|
let fetched;
|
|
47778
47778
|
try {
|
|
47779
|
-
fetched = await client2.request("GET", `/pub/v3/messages/${
|
|
47779
|
+
fetched = await client2.request("GET", `/pub/v3/messages/${id2}`);
|
|
47780
47780
|
} catch (e) {
|
|
47781
|
-
throw new UnconfirmedWriteError(
|
|
47781
|
+
throw new UnconfirmedWriteError(id2, e);
|
|
47782
47782
|
}
|
|
47783
47783
|
const detail = parseLenient(
|
|
47784
|
-
|
|
47784
|
+
detailSchema2,
|
|
47785
47785
|
fetched,
|
|
47786
47786
|
{ label: "ofw-mcp", context: `GET /pub/v3/messages/{id} (${ctx})`, mode: "strict" }
|
|
47787
47787
|
);
|
|
47788
|
-
return { id, detail, raw };
|
|
47788
|
+
return { id: id2, detail, raw };
|
|
47789
47789
|
}
|
|
47790
47790
|
|
|
47791
47791
|
// src/tools/user.ts
|
|
@@ -48303,8 +48303,8 @@ async function syncDrafts(client2, draftsFolderId, store, budget) {
|
|
|
48303
48303
|
}
|
|
48304
48304
|
}
|
|
48305
48305
|
const seenIds = new Set(ids);
|
|
48306
|
-
for (const
|
|
48307
|
-
if (!seenIds.has(
|
|
48306
|
+
for (const id2 of await store.listDraftIds()) {
|
|
48307
|
+
if (!seenIds.has(id2)) await store.deleteDraft(id2);
|
|
48308
48308
|
}
|
|
48309
48309
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
48310
48310
|
await setDraftsCacheStatus(store, "fresh");
|
|
@@ -48649,14 +48649,14 @@ var ServerDraftSchema = external_exports.looseObject({
|
|
|
48649
48649
|
function isNotFound(e) {
|
|
48650
48650
|
return e instanceof Error && /OFW API error: 404\b/.test(e.message);
|
|
48651
48651
|
}
|
|
48652
|
-
async function fetchMessageSnapshot(client2,
|
|
48652
|
+
async function fetchMessageSnapshot(client2, id2) {
|
|
48653
48653
|
let raw;
|
|
48654
48654
|
try {
|
|
48655
|
-
raw = await client2.request("GET", `/pub/v3/messages/${
|
|
48655
|
+
raw = await client2.request("GET", `/pub/v3/messages/${id2}`);
|
|
48656
48656
|
} catch (e) {
|
|
48657
48657
|
if (isNotFound(e)) return null;
|
|
48658
48658
|
throw new DraftFreshnessError(
|
|
48659
|
-
`could not read the current state of draft ${
|
|
48659
|
+
`could not read the current state of draft ${id2} from OurFamilyWizard: ${e.message}`
|
|
48660
48660
|
);
|
|
48661
48661
|
}
|
|
48662
48662
|
if (raw === null || raw === void 0) return null;
|
|
@@ -48678,8 +48678,8 @@ async function fetchMessageSnapshot(client2, id) {
|
|
|
48678
48678
|
dateTime: detail.date?.dateTime ?? null
|
|
48679
48679
|
};
|
|
48680
48680
|
}
|
|
48681
|
-
async function fetchServerDraft(client2,
|
|
48682
|
-
return (await fetchMessageSnapshot(client2,
|
|
48681
|
+
async function fetchServerDraft(client2, id2) {
|
|
48682
|
+
return (await fetchMessageSnapshot(client2, id2))?.content ?? null;
|
|
48683
48683
|
}
|
|
48684
48684
|
var SUBSTANTIVE_FIELDS = ["subject", "body", "recipients"];
|
|
48685
48685
|
function substantiveChanges(changed) {
|
|
@@ -48846,11 +48846,11 @@ function stateNote(state, cachedAsDraft, folderName) {
|
|
|
48846
48846
|
async function probeIds(client2, store, ids, opts) {
|
|
48847
48847
|
const draftsById = new Map((await store.getDrafts(ids)).map((d) => [d.id, d]));
|
|
48848
48848
|
const messagesById = new Map((await store.getMessages(ids)).map((m) => [m.id, m]));
|
|
48849
|
-
const prepared = ids.map((
|
|
48850
|
-
const cachedDraft = draftsById.get(
|
|
48851
|
-
const cachedMessage = cachedDraft === null ? messagesById.get(
|
|
48849
|
+
const prepared = ids.map((id2) => {
|
|
48850
|
+
const cachedDraft = draftsById.get(id2) ?? null;
|
|
48851
|
+
const cachedMessage = cachedDraft === null ? messagesById.get(id2) ?? null : null;
|
|
48852
48852
|
return {
|
|
48853
|
-
id,
|
|
48853
|
+
id: id2,
|
|
48854
48854
|
cachedDraft,
|
|
48855
48855
|
cachedMessage,
|
|
48856
48856
|
skip: !opts.allowMarkRead && probeWouldStamp(cachedDraft, cachedMessage)
|
|
@@ -48879,15 +48879,15 @@ async function probeIds(client2, store, ids, opts) {
|
|
|
48879
48879
|
return { items, requests };
|
|
48880
48880
|
}
|
|
48881
48881
|
async function probeOne(client2, prepared, map2, draftKey) {
|
|
48882
|
-
const { id, cachedDraft } = prepared;
|
|
48882
|
+
const { id: id2, cachedDraft } = prepared;
|
|
48883
48883
|
let snapshot;
|
|
48884
48884
|
try {
|
|
48885
|
-
snapshot = await fetchMessageSnapshot(client2,
|
|
48885
|
+
snapshot = await fetchMessageSnapshot(client2, id2);
|
|
48886
48886
|
} catch (e) {
|
|
48887
48887
|
return {
|
|
48888
48888
|
requests: 1,
|
|
48889
48889
|
item: {
|
|
48890
|
-
id,
|
|
48890
|
+
id: id2,
|
|
48891
48891
|
error: "FRESHNESS_CHECK_FAILED",
|
|
48892
48892
|
message: e.message,
|
|
48893
48893
|
inSync: null,
|
|
@@ -48917,7 +48917,7 @@ async function probeOne(client2, prepared, map2, draftKey) {
|
|
|
48917
48917
|
return {
|
|
48918
48918
|
requests: 1,
|
|
48919
48919
|
item: {
|
|
48920
|
-
id,
|
|
48920
|
+
id: id2,
|
|
48921
48921
|
state,
|
|
48922
48922
|
folder: snapshot?.folderName ?? null,
|
|
48923
48923
|
sentAt: state === "sent" ? snapshot?.dateTime ?? null : null,
|
|
@@ -48943,6 +48943,13 @@ function newDraftKey() {
|
|
|
48943
48943
|
// src/tools/_confirm.ts
|
|
48944
48944
|
var CONFIRM_NOTE = "Asks the user to confirm first: a confirmation prompt where the client supports one; otherwise the first call performs NO write and returns a preview of exactly what would happen plus a confirmToken, and only a repeat call with that token proceeds (see MCP_CONFIRM_MODE).";
|
|
48945
48945
|
function confirmWrite2(ctx, opts) {
|
|
48946
|
+
const { confirmToken: _confirmToken, ...args } = opts.args;
|
|
48947
|
+
const subject = {
|
|
48948
|
+
target: opts.target,
|
|
48949
|
+
...opts.revision !== void 0 ? { revision: opts.revision } : {},
|
|
48950
|
+
payload: opts.payload,
|
|
48951
|
+
preview: opts.preview
|
|
48952
|
+
};
|
|
48946
48953
|
return requireConfirmationWithFallback(
|
|
48947
48954
|
ctx,
|
|
48948
48955
|
confirmationFromEnv({
|
|
@@ -48954,14 +48961,9 @@ function confirmWrite2(ctx, opts) {
|
|
|
48954
48961
|
// One OFW account per process (OFW_USERNAME / the captured session), so
|
|
48955
48962
|
// there is no principal to distinguish; mcp-utils 3 makes saying so explicit.
|
|
48956
48963
|
account: void 0,
|
|
48957
|
-
args: opts.args,
|
|
48964
|
+
args: { tool: opts.tool, action: opts.action, args, ...subject },
|
|
48958
48965
|
confirmToken: opts.confirmToken,
|
|
48959
|
-
subject: () =>
|
|
48960
|
-
target: opts.target,
|
|
48961
|
-
...opts.revision !== void 0 ? { revision: opts.revision } : {},
|
|
48962
|
-
payload: opts.payload,
|
|
48963
|
-
preview: opts.preview
|
|
48964
|
-
})
|
|
48966
|
+
subject: () => subject
|
|
48965
48967
|
})
|
|
48966
48968
|
);
|
|
48967
48969
|
}
|
|
@@ -49152,10 +49154,10 @@ async function readRels(zip, partPath) {
|
|
|
49152
49154
|
if (!xml) return [];
|
|
49153
49155
|
const rels = [];
|
|
49154
49156
|
for (const el of elements(xml, "Relationship")) {
|
|
49155
|
-
const
|
|
49157
|
+
const id2 = attr(el.attrs, "Id");
|
|
49156
49158
|
const target = attr(el.attrs, "Target");
|
|
49157
|
-
if (!
|
|
49158
|
-
rels.push({ id, target: resolvePartPath(dir, target), type: attr(el.attrs, "Type") ?? "" });
|
|
49159
|
+
if (!id2 || !target) continue;
|
|
49160
|
+
rels.push({ id: id2, target: resolvePartPath(dir, target), type: attr(el.attrs, "Type") ?? "" });
|
|
49159
49161
|
}
|
|
49160
49162
|
return rels;
|
|
49161
49163
|
}
|
|
@@ -49203,15 +49205,15 @@ async function readStyles(zip, dir) {
|
|
|
49203
49205
|
if (!xml) return { dateStyles: [] };
|
|
49204
49206
|
const custom2 = /* @__PURE__ */ new Map();
|
|
49205
49207
|
for (const el of elements(xml, "numFmt")) {
|
|
49206
|
-
const
|
|
49208
|
+
const id2 = Number(attr(el.attrs, "numFmtId"));
|
|
49207
49209
|
const code2 = attr(el.attrs, "formatCode");
|
|
49208
|
-
if (Number.isFinite(
|
|
49210
|
+
if (Number.isFinite(id2) && code2 !== null) custom2.set(id2, code2);
|
|
49209
49211
|
}
|
|
49210
49212
|
const dateStyles = [];
|
|
49211
49213
|
for (const block of elements(xml, "cellXfs")) {
|
|
49212
49214
|
for (const xf of elements(block.inner, "xf")) {
|
|
49213
|
-
const
|
|
49214
|
-
dateStyles.push(isDateFormat(
|
|
49215
|
+
const id2 = Number(attr(xf.attrs, "numFmtId") ?? "0");
|
|
49216
|
+
dateStyles.push(isDateFormat(id2, custom2.get(id2)));
|
|
49215
49217
|
}
|
|
49216
49218
|
}
|
|
49217
49219
|
return { dateStyles };
|
|
@@ -50360,7 +50362,7 @@ async function describeRecipients(cache, recipientIds, known) {
|
|
|
50360
50362
|
}
|
|
50361
50363
|
};
|
|
50362
50364
|
known.forEach(learn);
|
|
50363
|
-
if (recipientIds.some((
|
|
50365
|
+
if (recipientIds.some((id2) => !names.has(id2))) {
|
|
50364
50366
|
for (const row of await cache.listMessages({ page: 1, size: 200 })) learn(row.recipients);
|
|
50365
50367
|
}
|
|
50366
50368
|
return recipientIds.map((userId) => ({ userId, name: names.get(userId) ?? null }));
|
|
@@ -50505,10 +50507,10 @@ function registerMessageTools(server, client2, cacheProvider, attachmentIO) {
|
|
|
50505
50507
|
})
|
|
50506
50508
|
})
|
|
50507
50509
|
}, async (args) => {
|
|
50508
|
-
const
|
|
50510
|
+
const id2 = Number(args.messageId);
|
|
50509
50511
|
const view = resolveView(args.view, MESSAGE_VIEWS);
|
|
50510
50512
|
const cache = cacheProvider();
|
|
50511
|
-
const draftRow = await cache.getDraft(
|
|
50513
|
+
const draftRow = await cache.getDraft(id2);
|
|
50512
50514
|
if (draftRow !== null) {
|
|
50513
50515
|
const { freshness: freshness2, serverConfirmed, cacheStatus } = await draftsFreshness(cache);
|
|
50514
50516
|
return jsonResponse({
|
|
@@ -50553,17 +50555,17 @@ function registerMessageTools(server, client2, cacheProvider, attachmentIO) {
|
|
|
50553
50555
|
freshness: freshness2
|
|
50554
50556
|
});
|
|
50555
50557
|
}
|
|
50556
|
-
const cached2 = await cache.getMessage(
|
|
50558
|
+
const cached2 = await cache.getMessage(id2);
|
|
50557
50559
|
const blocked = readingBlockedToday();
|
|
50558
50560
|
if (blocked !== null) {
|
|
50559
50561
|
if (cached2 === null) {
|
|
50560
50562
|
return jsonErrorResponse({
|
|
50561
50563
|
...blocked,
|
|
50562
|
-
messageId:
|
|
50564
|
+
messageId: id2,
|
|
50563
50565
|
hint: "This id is not in the cache. Run ofw_sync_messages (it walks list pages, not bodies, and marks nothing read) to see its subject, sender and date."
|
|
50564
50566
|
});
|
|
50565
50567
|
}
|
|
50566
|
-
const attachments2 = await cache.listAttachmentsForMessage(
|
|
50568
|
+
const attachments2 = await cache.listAttachmentsForMessage(id2);
|
|
50567
50569
|
const freshness2 = await buildFreshness(cache, { source: "cache", folders: [cached2.folder] });
|
|
50568
50570
|
return jsonResponse({
|
|
50569
50571
|
readingBlocked: blocked,
|
|
@@ -50578,7 +50580,7 @@ function registerMessageTools(server, client2, cacheProvider, attachmentIO) {
|
|
|
50578
50580
|
try {
|
|
50579
50581
|
const detail2 = parseLenient(
|
|
50580
50582
|
MessageDetailSchema,
|
|
50581
|
-
await client2.request("GET", `/pub/v3/messages/${
|
|
50583
|
+
await client2.request("GET", `/pub/v3/messages/${id2}`),
|
|
50582
50584
|
{ label: "ofw-mcp", context: "GET /pub/v3/messages/{id} (view-status refresh)" }
|
|
50583
50585
|
);
|
|
50584
50586
|
const recipients = mapRecipients(detail2.recipients);
|
|
@@ -50591,17 +50593,17 @@ function registerMessageTools(server, client2, cacheProvider, attachmentIO) {
|
|
|
50591
50593
|
} catch {
|
|
50592
50594
|
}
|
|
50593
50595
|
}
|
|
50594
|
-
let attachments2 = await cache.listAttachmentsForMessage(
|
|
50596
|
+
let attachments2 = await cache.listAttachmentsForMessage(id2);
|
|
50595
50597
|
if (attachments2.length === 0 && listDataHintsAtFiles(row2.listData)) {
|
|
50596
50598
|
try {
|
|
50597
50599
|
const detail2 = parseLenient(
|
|
50598
50600
|
DetailFilesSchema,
|
|
50599
|
-
await client2.request("GET", `/pub/v3/messages/${
|
|
50601
|
+
await client2.request("GET", `/pub/v3/messages/${id2}`),
|
|
50600
50602
|
{ label: "ofw-mcp", context: "GET /pub/v3/messages/{id} (attachment backfill)" }
|
|
50601
50603
|
);
|
|
50602
50604
|
if (Array.isArray(detail2.files) && detail2.files.length > 0) {
|
|
50603
|
-
await fetchAttachmentMetaForMessage(client2,
|
|
50604
|
-
attachments2 = await cache.listAttachmentsForMessage(
|
|
50605
|
+
await fetchAttachmentMetaForMessage(client2, id2, detail2.files, cache);
|
|
50606
|
+
attachments2 = await cache.listAttachmentsForMessage(id2);
|
|
50605
50607
|
}
|
|
50606
50608
|
} catch {
|
|
50607
50609
|
}
|
|
@@ -50700,7 +50702,7 @@ function registerMessageTools(server, client2, cacheProvider, attachmentIO) {
|
|
|
50700
50702
|
(s) => s !== null && s !== void 0 && s.recipients.some((r) => r.userId !== 0)
|
|
50701
50703
|
);
|
|
50702
50704
|
if (source != null) {
|
|
50703
|
-
recipientIds = [...new Set(source.recipients.map((r) => r.userId).filter((
|
|
50705
|
+
recipientIds = [...new Set(source.recipients.map((r) => r.userId).filter((id2) => id2 !== 0))];
|
|
50704
50706
|
}
|
|
50705
50707
|
}
|
|
50706
50708
|
}
|
|
@@ -51178,7 +51180,7 @@ ${jsonText(
|
|
|
51178
51180
|
}
|
|
51179
51181
|
if (myFileIDs.length > 0 && Array.isArray(detail.files)) {
|
|
51180
51182
|
const storedFiles = new Set(detail.files);
|
|
51181
|
-
const missing = myFileIDs.filter((
|
|
51183
|
+
const missing = myFileIDs.filter((id2) => !storedFiles.has(id2));
|
|
51182
51184
|
if (missing.length > 0) {
|
|
51183
51185
|
warnings.push(
|
|
51184
51186
|
`Attachment fileId(s) ${missing.join(", ")} were requested in myFileIDs but are not attached to the saved draft. Re-upload or re-attach if needed.`
|
|
@@ -51601,7 +51603,7 @@ ${jsonText(
|
|
|
51601
51603
|
const requestedKeys = args.draftKeys ?? [];
|
|
51602
51604
|
const wantInventory = args.includeDraftInventory ?? (requestedIds.length === 0 && requestedKeys.length === 0);
|
|
51603
51605
|
const allTargets = [
|
|
51604
|
-
...requestedIds.map((
|
|
51606
|
+
...requestedIds.map((id2) => ({ kind: "id", id: id2 })),
|
|
51605
51607
|
...requestedKeys.map((draftKey) => ({ kind: "draftKey", draftKey }))
|
|
51606
51608
|
];
|
|
51607
51609
|
const targets = allTargets.slice(0, MAX_FRESHNESS_IDS);
|
|
@@ -51714,7 +51716,7 @@ function decorate(item) {
|
|
|
51714
51716
|
}
|
|
51715
51717
|
async function deleteOFWMessages(client2, ids) {
|
|
51716
51718
|
const form = new FormData();
|
|
51717
|
-
for (const
|
|
51719
|
+
for (const id2 of ids) form.append("messageIds", String(id2));
|
|
51718
51720
|
return client2.request("DELETE", "/pub/v1/messages", form);
|
|
51719
51721
|
}
|
|
51720
51722
|
|
|
@@ -51801,7 +51803,7 @@ function detailToWriteArgs(d) {
|
|
|
51801
51803
|
var SHARED = "shared with co-parent";
|
|
51802
51804
|
var PRIVATE = "private (only you)";
|
|
51803
51805
|
function describeEvent(a, names = /* @__PURE__ */ new Map()) {
|
|
51804
|
-
const who = (
|
|
51806
|
+
const who = (id2) => ({ userId: id2, name: names.get(id2) ?? null });
|
|
51805
51807
|
const out = {
|
|
51806
51808
|
title: a.title,
|
|
51807
51809
|
startDate: a.startDate,
|
|
@@ -51811,7 +51813,7 @@ function describeEvent(a, names = /* @__PURE__ */ new Map()) {
|
|
|
51811
51813
|
};
|
|
51812
51814
|
if (a.location) out.location = a.location;
|
|
51813
51815
|
if (a.notes) out.notes = a.notes;
|
|
51814
|
-
if (a.children !== void 0) out.children = a.children.map((
|
|
51816
|
+
if (a.children !== void 0) out.children = a.children.map((id2) => who(id2));
|
|
51815
51817
|
if (a.eventParentId !== void 0) out.eventParent = who(a.eventParentId);
|
|
51816
51818
|
if (a.dropOffParentId !== void 0) out.dropOffParent = who(a.dropOffParentId);
|
|
51817
51819
|
if (a.pickUpParentId !== void 0) out.pickUpParent = who(a.pickUpParentId);
|
|
@@ -51914,8 +51916,8 @@ function registerCalendarTools(server, client2) {
|
|
|
51914
51916
|
})
|
|
51915
51917
|
}, async (args, ctx) => {
|
|
51916
51918
|
const { eventId, confirmToken, ...changes } = args;
|
|
51917
|
-
const
|
|
51918
|
-
const rawDetail = await client2.request("GET", `/pub/v3/events/${
|
|
51919
|
+
const id2 = encodeURIComponent(eventId);
|
|
51920
|
+
const rawDetail = await client2.request("GET", `/pub/v3/events/${id2}`);
|
|
51919
51921
|
const current = parseLenient(eventDetailSchema, rawDetail, { label: "ofw-mcp", context: `GET /pub/v3/events/${eventId}`, mode: "strict" });
|
|
51920
51922
|
const defined = Object.fromEntries(Object.entries(changes).filter(([, v]) => v !== void 0));
|
|
51921
51923
|
const base = detailToWriteArgs(current);
|
|
@@ -51943,7 +51945,7 @@ function registerCalendarTools(server, client2) {
|
|
|
51943
51945
|
if (gate) return gate;
|
|
51944
51946
|
}
|
|
51945
51947
|
try {
|
|
51946
|
-
await requestWrite(client2, "PUT", `/pub/v3/events/${
|
|
51948
|
+
await requestWrite(client2, "PUT", `/pub/v3/events/${id2}`, payload);
|
|
51947
51949
|
} catch (e) {
|
|
51948
51950
|
if (!(e instanceof UnconfirmedWriteError)) throw e;
|
|
51949
51951
|
return unconfirmedWriteResponse(e, {
|
|
@@ -51953,7 +51955,7 @@ function registerCalendarTools(server, client2) {
|
|
|
51953
51955
|
});
|
|
51954
51956
|
}
|
|
51955
51957
|
try {
|
|
51956
|
-
const rawAfter = await client2.request("GET", `/pub/v3/events/${
|
|
51958
|
+
const rawAfter = await client2.request("GET", `/pub/v3/events/${id2}`);
|
|
51957
51959
|
const event = parseLenient(eventDetailSchema, rawAfter, { label: "ofw-mcp", context: `GET /pub/v3/events/${eventId} (post-update)`, mode: "strict" });
|
|
51958
51960
|
return jsonResponse({ note: "Event updated; returning re-fetched event state.", event });
|
|
51959
51961
|
} catch (e) {
|
|
@@ -51974,8 +51976,8 @@ function registerCalendarTools(server, client2) {
|
|
|
51974
51976
|
})
|
|
51975
51977
|
}, async (args, ctx) => {
|
|
51976
51978
|
const includeFuture = args.includeFuture ?? false;
|
|
51977
|
-
const
|
|
51978
|
-
const rawDetail = await client2.request("GET", `/pub/v3/events/${
|
|
51979
|
+
const id2 = encodeURIComponent(args.eventId);
|
|
51980
|
+
const rawDetail = await client2.request("GET", `/pub/v3/events/${id2}`);
|
|
51979
51981
|
const current = parseLenient(eventDetailSchema, rawDetail, { label: "ofw-mcp", context: `GET /pub/v3/events/${args.eventId}`, mode: "strict" });
|
|
51980
51982
|
if (current.publicFlag) {
|
|
51981
51983
|
const base = detailToWriteArgs(current);
|
|
@@ -52000,7 +52002,7 @@ function registerCalendarTools(server, client2) {
|
|
|
52000
52002
|
if (gate) return gate;
|
|
52001
52003
|
}
|
|
52002
52004
|
try {
|
|
52003
|
-
await requestWrite(client2, "DELETE", `/pub/v3/events/${
|
|
52005
|
+
await requestWrite(client2, "DELETE", `/pub/v3/events/${id2}?includeFuture=${includeFuture}`);
|
|
52004
52006
|
} catch (e) {
|
|
52005
52007
|
if (!(e instanceof UnconfirmedWriteError)) throw e;
|
|
52006
52008
|
return unconfirmedWriteResponse(e, {
|
|
@@ -52013,6 +52015,169 @@ function registerCalendarTools(server, client2) {
|
|
|
52013
52015
|
});
|
|
52014
52016
|
}
|
|
52015
52017
|
|
|
52018
|
+
// src/tools/expense-reimbursement.ts
|
|
52019
|
+
var money = external_exports.number().nonnegative().refine((v) => Number.isSafeInteger(Math.round(v * 100)) && v === Math.round(v * 100) / 100, "Must be an exact, safe cent amount");
|
|
52020
|
+
var id = external_exports.number().int().positive();
|
|
52021
|
+
var detailSchema = external_exports.looseObject({
|
|
52022
|
+
id,
|
|
52023
|
+
title: external_exports.string().min(1).refine((v) => v.trim().length > 0),
|
|
52024
|
+
author: external_exports.looseObject({ userId: id }),
|
|
52025
|
+
payer: external_exports.looseObject({ userId: id }),
|
|
52026
|
+
private: external_exports.boolean(),
|
|
52027
|
+
paymentType: external_exports.string(),
|
|
52028
|
+
amount: external_exports.looseObject({ total: money.refine((v) => v > 0), totalOwed: money, leftToPay: money }),
|
|
52029
|
+
status: external_exports.string().min(1),
|
|
52030
|
+
statusInfo: external_exports.looseObject({ baseStatus: external_exports.string(), subStatus: external_exports.literal("NONE") }),
|
|
52031
|
+
category: external_exports.looseObject({ id, split: external_exports.looseObject({ parentSplit: external_exports.string(), coparentSplit: external_exports.string() }) }),
|
|
52032
|
+
children: external_exports.array(external_exports.looseObject({ userId: id })).min(1)
|
|
52033
|
+
}).refine(
|
|
52034
|
+
(d) => d.amount.leftToPay <= d.amount.totalOwed && d.amount.totalOwed <= d.amount.total,
|
|
52035
|
+
"Inconsistent expense balances"
|
|
52036
|
+
);
|
|
52037
|
+
function immutableRevision(d) {
|
|
52038
|
+
const { status: _status, statusInfo: _info, paymentType: _type, amount, ...rest } = d;
|
|
52039
|
+
const {
|
|
52040
|
+
leftToPay: _balance,
|
|
52041
|
+
leftToPayFmt: _balanceFmt,
|
|
52042
|
+
description: _description,
|
|
52043
|
+
color: _color,
|
|
52044
|
+
...amountRest
|
|
52045
|
+
} = amount;
|
|
52046
|
+
return stateRevision({ ...rest, amount: amountRest });
|
|
52047
|
+
}
|
|
52048
|
+
function registerExpenseReimbursementTool(server, client2) {
|
|
52049
|
+
server.registerTool("ofw_mark_expense_reimbursed", {
|
|
52050
|
+
description: "Irreversibly mark the FULL remaining expense balance reimbursed externally. Records an already completed outside-OFW reimbursement only: does NOT send money or use bank/payment endpoints; no partial amounts. Requires expectedRemainingAmount (currency units, positive exact cents) matching the current leftToPay, NOT the full expense total. Reads the current expense, binds the entire detail to confirmation, rechecks immediately before writing, then verifies paid status and unchanged fields. Cannot be undone. On EXPENSE_REIMBURSEMENT_UNCONFIRMED, mayHaveLanded=true: inspect the OFW Expenses log before any retry; never replay blindly. " + CONFIRM_NOTE,
|
|
52051
|
+
annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: true },
|
|
52052
|
+
inputSchema: external_exports.object({
|
|
52053
|
+
expenseId: id.describe("Existing expense entity id"),
|
|
52054
|
+
expectedRemainingAmount: money.refine((v) => v > 0, "Must be positive").describe("Full remaining external reimbursement in currency units (e.g. 48.50); must match leftToPay, not the expense total"),
|
|
52055
|
+
confirmToken: confirmTokenParam
|
|
52056
|
+
})
|
|
52057
|
+
}, async (args, ctx) => {
|
|
52058
|
+
const path = `/pub/v2/expense/expenses/${args.expenseId}`;
|
|
52059
|
+
const read = async () => {
|
|
52060
|
+
const d = parseLenient(
|
|
52061
|
+
detailSchema,
|
|
52062
|
+
await client2.request("GET", path),
|
|
52063
|
+
{ label: "ofw-mcp", context: `GET ${path} (mark reimbursed)`, mode: "strict" }
|
|
52064
|
+
);
|
|
52065
|
+
if (d.id !== args.expenseId) throw new Error("Expense id does not match the requested expense");
|
|
52066
|
+
return d;
|
|
52067
|
+
};
|
|
52068
|
+
let current;
|
|
52069
|
+
try {
|
|
52070
|
+
current = await read();
|
|
52071
|
+
} catch {
|
|
52072
|
+
return jsonErrorResponse({
|
|
52073
|
+
result: "EXPENSE_REIMBURSEMENT_REFUSED",
|
|
52074
|
+
expenseId: args.expenseId,
|
|
52075
|
+
reason: "Could not safely read the expense identity, status, parties and balances. Nothing was sent."
|
|
52076
|
+
});
|
|
52077
|
+
}
|
|
52078
|
+
const base = current.statusInfo.baseStatus;
|
|
52079
|
+
if (base === "PAID" && current.amount.leftToPay === 0) {
|
|
52080
|
+
return jsonResponse({
|
|
52081
|
+
result: "ALREADY_PAID",
|
|
52082
|
+
expenseId: args.expenseId,
|
|
52083
|
+
changed: false,
|
|
52084
|
+
note: "OFW already reports paid with zero remaining balance. No write or money transfer was performed."
|
|
52085
|
+
});
|
|
52086
|
+
}
|
|
52087
|
+
if (!["OPEN", "APPROVED", "PARTIAL"].includes(base) || current.amount.leftToPay <= 0) {
|
|
52088
|
+
return jsonErrorResponse({
|
|
52089
|
+
result: "EXPENSE_REIMBURSEMENT_REFUSED",
|
|
52090
|
+
expenseId: args.expenseId,
|
|
52091
|
+
reason: "Only OPEN, APPROVED or PARTIAL expenses with subStatus NONE and positive remaining balance are supported. Nothing was sent."
|
|
52092
|
+
});
|
|
52093
|
+
}
|
|
52094
|
+
if (Math.round(current.amount.leftToPay * 100) !== Math.round(args.expectedRemainingAmount * 100)) {
|
|
52095
|
+
return jsonErrorResponse({
|
|
52096
|
+
result: "EXPENSE_REMAINING_AMOUNT_MISMATCH",
|
|
52097
|
+
expenseId: args.expenseId,
|
|
52098
|
+
expectedRemainingAmount: args.expectedRemainingAmount,
|
|
52099
|
+
remainingAmount: current.amount.leftToPay,
|
|
52100
|
+
total: current.amount.total,
|
|
52101
|
+
reason: "Approve the full remaining balance, not the original expense total or a partial payment. Nothing was sent."
|
|
52102
|
+
});
|
|
52103
|
+
}
|
|
52104
|
+
const payload = { status: "MARKED_REIMBURSED" };
|
|
52105
|
+
const revision = stateRevision(current);
|
|
52106
|
+
const gate = await confirmWrite2(ctx, {
|
|
52107
|
+
args,
|
|
52108
|
+
tool: "ofw_mark_expense_reimbursed",
|
|
52109
|
+
action: "ofw.expense.mark-reimbursed",
|
|
52110
|
+
target: `expense:${args.expenseId}`,
|
|
52111
|
+
revision,
|
|
52112
|
+
payload,
|
|
52113
|
+
confirmToken: args.confirmToken,
|
|
52114
|
+
message: `Mark "${current.title}" fully reimbursed externally (${current.amount.leftToPay}). This cannot be undone and does not transfer money.`,
|
|
52115
|
+
preview: {
|
|
52116
|
+
expenseId: args.expenseId,
|
|
52117
|
+
title: current.title,
|
|
52118
|
+
authorUserId: current.author.userId,
|
|
52119
|
+
payerUserId: current.payer.userId,
|
|
52120
|
+
category: current.category,
|
|
52121
|
+
children: current.children,
|
|
52122
|
+
private: current.private,
|
|
52123
|
+
total: current.amount.total,
|
|
52124
|
+
totalOwed: current.amount.totalOwed,
|
|
52125
|
+
remainingAmount: current.amount.leftToPay,
|
|
52126
|
+
status: current.status,
|
|
52127
|
+
statusInfo: current.statusInfo,
|
|
52128
|
+
paymentType: current.paymentType,
|
|
52129
|
+
warning: "Mark the FULL remaining balance reimbursed outside OFW. This cannot be undone. No money is transferred; no bank/payment action is performed."
|
|
52130
|
+
}
|
|
52131
|
+
});
|
|
52132
|
+
if (gate) return gate;
|
|
52133
|
+
try {
|
|
52134
|
+
if (stateRevision(await read()) !== revision) {
|
|
52135
|
+
return jsonErrorResponse({
|
|
52136
|
+
result: "EXPENSE_CHANGED",
|
|
52137
|
+
expenseId: args.expenseId,
|
|
52138
|
+
reason: "The expense changed after confirmation. Nothing was sent. Review it again before confirming."
|
|
52139
|
+
});
|
|
52140
|
+
}
|
|
52141
|
+
} catch {
|
|
52142
|
+
return jsonErrorResponse({
|
|
52143
|
+
result: "EXPENSE_REIMBURSEMENT_REFUSED",
|
|
52144
|
+
expenseId: args.expenseId,
|
|
52145
|
+
reason: "The immediate pre-write check failed. Nothing was sent."
|
|
52146
|
+
});
|
|
52147
|
+
}
|
|
52148
|
+
try {
|
|
52149
|
+
await requestWrite(client2, "PUT", `${path}/status`, payload);
|
|
52150
|
+
} catch (e) {
|
|
52151
|
+
if (!(e instanceof UnconfirmedWriteError)) throw e;
|
|
52152
|
+
return unconfirmedWriteResponse(e, {
|
|
52153
|
+
result: "EXPENSE_REIMBURSEMENT_UNCONFIRMED",
|
|
52154
|
+
what: `mark expense ${args.expenseId} reimbursed`,
|
|
52155
|
+
checkWith: "the Expenses log on ourfamilywizard.com"
|
|
52156
|
+
});
|
|
52157
|
+
}
|
|
52158
|
+
try {
|
|
52159
|
+
const after = await read();
|
|
52160
|
+
if (after.statusInfo.baseStatus !== "PAID" || after.amount.leftToPay !== 0 || after.paymentType !== "Marked reimbursed" || immutableRevision(after) !== immutableRevision(current)) {
|
|
52161
|
+
throw new Error("Paid status, external reimbursement marker, zero balance or unchanged expense fields could not be verified");
|
|
52162
|
+
}
|
|
52163
|
+
return jsonResponse({
|
|
52164
|
+
result: "EXPENSE_MARKED_REIMBURSED",
|
|
52165
|
+
expenseId: args.expenseId,
|
|
52166
|
+
verified: true,
|
|
52167
|
+
reimbursedAmount: current.amount.leftToPay,
|
|
52168
|
+
remainingAmount: 0,
|
|
52169
|
+
moneyTransferred: false
|
|
52170
|
+
});
|
|
52171
|
+
} catch (e) {
|
|
52172
|
+
return unconfirmedWriteResponse(new UnconfirmedWriteError(args.expenseId, e), {
|
|
52173
|
+
result: "EXPENSE_REIMBURSEMENT_UNCONFIRMED",
|
|
52174
|
+
what: `verify reimbursement of expense ${args.expenseId}`,
|
|
52175
|
+
checkWith: "the Expenses log on ourfamilywizard.com"
|
|
52176
|
+
});
|
|
52177
|
+
}
|
|
52178
|
+
});
|
|
52179
|
+
}
|
|
52180
|
+
|
|
52016
52181
|
// src/tools/expenses.ts
|
|
52017
52182
|
var UploadedExpenseFileSchema = external_exports.looseObject({
|
|
52018
52183
|
fileId: external_exports.number(),
|
|
@@ -52131,7 +52296,7 @@ var refId = (v, key) => positiveInt(v) ?? (isRecord2(v) ? positiveInt(v[key]) ??
|
|
|
52131
52296
|
var idList = (v, key) => {
|
|
52132
52297
|
if (!Array.isArray(v)) return void 0;
|
|
52133
52298
|
const ids = v.map((x) => refId(x, key));
|
|
52134
|
-
return ids.every((
|
|
52299
|
+
return ids.every((id2) => id2 !== void 0) ? ids : void 0;
|
|
52135
52300
|
};
|
|
52136
52301
|
function readExpenseState(raw) {
|
|
52137
52302
|
const d = isRecord2(raw) && isRecord2(raw.data) ? raw.data : raw;
|
|
@@ -52167,6 +52332,7 @@ function registerExpenseTools(server, client2, attachmentIO) {
|
|
|
52167
52332
|
const uploadOnly = getExpenseUploadOnly();
|
|
52168
52333
|
const checkIn = uploadOnly ? "the Expenses log on ourfamilywizard.com (ofw_list_expenses is not available in this deployment)" : "ofw_list_expenses";
|
|
52169
52334
|
const allowWrites = writeMode === "all";
|
|
52335
|
+
if (allowWrites && !uploadOnly) registerExpenseReimbursementTool(server, client2);
|
|
52170
52336
|
const allowReceiptUploads = allowWrites && attachmentIO !== void 0;
|
|
52171
52337
|
if (!uploadOnly) server.registerTool("ofw_get_expense_totals", {
|
|
52172
52338
|
description: "Get OurFamilyWizard expense summary totals (owed/paid)",
|
|
@@ -52760,8 +52926,8 @@ var OFWCacheCore = class {
|
|
|
52760
52926
|
for (const row of rows) this.upsertMessage(row);
|
|
52761
52927
|
});
|
|
52762
52928
|
}
|
|
52763
|
-
getMessage(
|
|
52764
|
-
const r = this.db.get("SELECT * FROM messages WHERE id = ?", [
|
|
52929
|
+
getMessage(id2) {
|
|
52930
|
+
const r = this.db.get("SELECT * FROM messages WHERE id = ?", [id2]);
|
|
52765
52931
|
return r ? rowFromDb(r) : null;
|
|
52766
52932
|
}
|
|
52767
52933
|
/**
|
|
@@ -52784,8 +52950,8 @@ var OFWCacheCore = class {
|
|
|
52784
52950
|
* `ofw_get_message` (which would have wrongly classified it as `inbox`)
|
|
52785
52951
|
* — the drafts table is the authoritative source for that id now.
|
|
52786
52952
|
*/
|
|
52787
|
-
deleteMessage(
|
|
52788
|
-
this.db.run("DELETE FROM messages WHERE id = ?", [
|
|
52953
|
+
deleteMessage(id2) {
|
|
52954
|
+
this.db.run("DELETE FROM messages WHERE id = ?", [id2]);
|
|
52789
52955
|
}
|
|
52790
52956
|
listMessages(opts) {
|
|
52791
52957
|
const { where, params } = buildMessageFilter(opts);
|
|
@@ -52833,8 +52999,8 @@ var OFWCacheCore = class {
|
|
|
52833
52999
|
for (const row of rows) this.upsertDraft(row);
|
|
52834
53000
|
});
|
|
52835
53001
|
}
|
|
52836
|
-
getDraft(
|
|
52837
|
-
const r = this.db.get("SELECT * FROM drafts WHERE id = ?", [
|
|
53002
|
+
getDraft(id2) {
|
|
53003
|
+
const r = this.db.get("SELECT * FROM drafts WHERE id = ?", [id2]);
|
|
52838
53004
|
return r ? draftFromDb(r) : null;
|
|
52839
53005
|
}
|
|
52840
53006
|
/**
|
|
@@ -52863,8 +53029,8 @@ var OFWCacheCore = class {
|
|
|
52863
53029
|
const r = this.db.get("SELECT COUNT(*) as n FROM drafts", []);
|
|
52864
53030
|
return r?.n ?? 0;
|
|
52865
53031
|
}
|
|
52866
|
-
deleteDraft(
|
|
52867
|
-
this.db.run("DELETE FROM drafts WHERE id = ?", [
|
|
53032
|
+
deleteDraft(id2) {
|
|
53033
|
+
this.db.run("DELETE FROM drafts WHERE id = ?", [id2]);
|
|
52868
53034
|
}
|
|
52869
53035
|
listDraftIds() {
|
|
52870
53036
|
const rows = this.db.all("SELECT id FROM drafts", []);
|
|
@@ -52890,8 +53056,8 @@ var OFWCacheCore = class {
|
|
|
52890
53056
|
]
|
|
52891
53057
|
);
|
|
52892
53058
|
}
|
|
52893
|
-
getDraftLineageById(
|
|
52894
|
-
const r = this.db.get("SELECT * FROM draft_lineage WHERE id = ?", [
|
|
53059
|
+
getDraftLineageById(id2) {
|
|
53060
|
+
const r = this.db.get("SELECT * FROM draft_lineage WHERE id = ?", [id2]);
|
|
52895
53061
|
return r ? lineageFromDb(r) : null;
|
|
52896
53062
|
}
|
|
52897
53063
|
/**
|
|
@@ -53026,14 +53192,14 @@ var LocalCacheStore = class {
|
|
|
53026
53192
|
async upsertMessages(rows) {
|
|
53027
53193
|
this.core.upsertMessages(rows);
|
|
53028
53194
|
}
|
|
53029
|
-
async getMessage(
|
|
53030
|
-
return this.core.getMessage(
|
|
53195
|
+
async getMessage(id2) {
|
|
53196
|
+
return this.core.getMessage(id2);
|
|
53031
53197
|
}
|
|
53032
53198
|
async getMessages(ids) {
|
|
53033
53199
|
return this.core.getMessages(ids);
|
|
53034
53200
|
}
|
|
53035
|
-
async deleteMessage(
|
|
53036
|
-
this.core.deleteMessage(
|
|
53201
|
+
async deleteMessage(id2) {
|
|
53202
|
+
this.core.deleteMessage(id2);
|
|
53037
53203
|
}
|
|
53038
53204
|
async listMessages(opts) {
|
|
53039
53205
|
return this.core.listMessages(opts);
|
|
@@ -53047,8 +53213,8 @@ var LocalCacheStore = class {
|
|
|
53047
53213
|
async upsertDrafts(rows) {
|
|
53048
53214
|
this.core.upsertDrafts(rows);
|
|
53049
53215
|
}
|
|
53050
|
-
async getDraft(
|
|
53051
|
-
return this.core.getDraft(
|
|
53216
|
+
async getDraft(id2) {
|
|
53217
|
+
return this.core.getDraft(id2);
|
|
53052
53218
|
}
|
|
53053
53219
|
async getDrafts(ids) {
|
|
53054
53220
|
return this.core.getDrafts(ids);
|
|
@@ -53059,8 +53225,8 @@ var LocalCacheStore = class {
|
|
|
53059
53225
|
async countDrafts() {
|
|
53060
53226
|
return this.core.countDrafts();
|
|
53061
53227
|
}
|
|
53062
|
-
async deleteDraft(
|
|
53063
|
-
this.core.deleteDraft(
|
|
53228
|
+
async deleteDraft(id2) {
|
|
53229
|
+
this.core.deleteDraft(id2);
|
|
53064
53230
|
}
|
|
53065
53231
|
async listDraftIds() {
|
|
53066
53232
|
return this.core.listDraftIds();
|
|
@@ -53068,8 +53234,8 @@ var LocalCacheStore = class {
|
|
|
53068
53234
|
async recordDraftLineage(row) {
|
|
53069
53235
|
this.core.recordDraftLineage(row);
|
|
53070
53236
|
}
|
|
53071
|
-
async getDraftLineageById(
|
|
53072
|
-
return this.core.getDraftLineageById(
|
|
53237
|
+
async getDraftLineageById(id2) {
|
|
53238
|
+
return this.core.getDraftLineageById(id2);
|
|
53073
53239
|
}
|
|
53074
53240
|
async getDraftLineageByIds(ids) {
|
|
53075
53241
|
return this.core.getDraftLineageByIds(ids);
|