@rubytech/create-maxy-code 0.1.457 → 0.1.459

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.
Files changed (138) hide show
  1. package/package.json +1 -1
  2. package/payload/platform/lib/mcp-lifeline/dist/index.d.ts.map +1 -1
  3. package/payload/platform/lib/mcp-lifeline/dist/index.js +22 -1
  4. package/payload/platform/lib/mcp-lifeline/dist/index.js.map +1 -1
  5. package/payload/platform/lib/mcp-lifeline/src/__tests__/lifeline.test.ts +26 -0
  6. package/payload/platform/lib/mcp-lifeline/src/index.ts +24 -1
  7. package/payload/platform/lib/storage-broker/dist/__tests__/cf-exec.test.js +322 -2
  8. package/payload/platform/lib/storage-broker/dist/__tests__/cf-exec.test.js.map +1 -1
  9. package/payload/platform/lib/storage-broker/dist/__tests__/object-limits.test.d.ts +2 -0
  10. package/payload/platform/lib/storage-broker/dist/__tests__/object-limits.test.d.ts.map +1 -0
  11. package/payload/platform/lib/storage-broker/dist/__tests__/object-limits.test.js +59 -0
  12. package/payload/platform/lib/storage-broker/dist/__tests__/object-limits.test.js.map +1 -0
  13. package/payload/platform/lib/storage-broker/dist/cf-exec.d.ts +12 -1
  14. package/payload/platform/lib/storage-broker/dist/cf-exec.d.ts.map +1 -1
  15. package/payload/platform/lib/storage-broker/dist/cf-exec.js +156 -26
  16. package/payload/platform/lib/storage-broker/dist/cf-exec.js.map +1 -1
  17. package/payload/platform/lib/storage-broker/dist/house-credential.d.ts.map +1 -1
  18. package/payload/platform/lib/storage-broker/dist/house-credential.js +8 -2
  19. package/payload/platform/lib/storage-broker/dist/house-credential.js.map +1 -1
  20. package/payload/platform/lib/storage-broker/dist/index.d.ts +1 -0
  21. package/payload/platform/lib/storage-broker/dist/index.d.ts.map +1 -1
  22. package/payload/platform/lib/storage-broker/dist/index.js +1 -0
  23. package/payload/platform/lib/storage-broker/dist/index.js.map +1 -1
  24. package/payload/platform/lib/storage-broker/dist/object-limits.d.ts +53 -0
  25. package/payload/platform/lib/storage-broker/dist/object-limits.d.ts.map +1 -0
  26. package/payload/platform/lib/storage-broker/dist/object-limits.js +72 -0
  27. package/payload/platform/lib/storage-broker/dist/object-limits.js.map +1 -0
  28. package/payload/platform/lib/storage-broker/src/__tests__/cf-exec.test.ts +362 -3
  29. package/payload/platform/lib/storage-broker/src/__tests__/object-limits.test.ts +76 -0
  30. package/payload/platform/lib/storage-broker/src/cf-exec.ts +230 -44
  31. package/payload/platform/lib/storage-broker/src/house-credential.ts +8 -2
  32. package/payload/platform/lib/storage-broker/src/index.ts +1 -0
  33. package/payload/platform/lib/storage-broker/src/object-limits.ts +75 -0
  34. package/payload/platform/plugins/admin/skills/platform-architecture/SKILL.md +5 -5
  35. package/payload/platform/plugins/cloudflare/bin/__tests__/cf-token.test.sh +145 -4
  36. package/payload/platform/plugins/cloudflare/bin/cf-token.sh +61 -3
  37. package/payload/platform/plugins/cloudflare/references/api.md +1 -1
  38. package/payload/platform/plugins/cloudflare/skills/cloudflare/SKILL.md +1 -1
  39. package/payload/platform/plugins/docs/references/outlook-guide.md +4 -4
  40. package/payload/platform/plugins/outlook/.claude-plugin/plugin.json +1 -1
  41. package/payload/platform/plugins/outlook/PLUGIN.md +2 -2
  42. package/payload/platform/plugins/outlook/mcp/dist/__tests__/attach.test.d.ts +2 -0
  43. package/payload/platform/plugins/outlook/mcp/dist/__tests__/attach.test.d.ts.map +1 -0
  44. package/payload/platform/plugins/outlook/mcp/dist/__tests__/attach.test.js +138 -0
  45. package/payload/platform/plugins/outlook/mcp/dist/__tests__/attach.test.js.map +1 -0
  46. package/payload/platform/plugins/outlook/mcp/dist/__tests__/draft-attachments.test.d.ts +2 -0
  47. package/payload/platform/plugins/outlook/mcp/dist/__tests__/draft-attachments.test.d.ts.map +1 -0
  48. package/payload/platform/plugins/outlook/mcp/dist/__tests__/draft-attachments.test.js +121 -0
  49. package/payload/platform/plugins/outlook/mcp/dist/__tests__/draft-attachments.test.js.map +1 -0
  50. package/payload/platform/plugins/outlook/mcp/dist/__tests__/draft-edit-attachments.test.d.ts +2 -0
  51. package/payload/platform/plugins/outlook/mcp/dist/__tests__/draft-edit-attachments.test.d.ts.map +1 -0
  52. package/payload/platform/plugins/outlook/mcp/dist/__tests__/draft-edit-attachments.test.js +102 -0
  53. package/payload/platform/plugins/outlook/mcp/dist/__tests__/draft-edit-attachments.test.js.map +1 -0
  54. package/payload/platform/plugins/outlook/mcp/dist/__tests__/draft-edit.test.js +16 -3
  55. package/payload/platform/plugins/outlook/mcp/dist/__tests__/draft-edit.test.js.map +1 -1
  56. package/payload/platform/plugins/outlook/mcp/dist/__tests__/graph-client.test.js +108 -1
  57. package/payload/platform/plugins/outlook/mcp/dist/__tests__/graph-client.test.js.map +1 -1
  58. package/payload/platform/plugins/outlook/mcp/dist/__tests__/mail-send-attachments.test.d.ts +2 -0
  59. package/payload/platform/plugins/outlook/mcp/dist/__tests__/mail-send-attachments.test.d.ts.map +1 -0
  60. package/payload/platform/plugins/outlook/mcp/dist/__tests__/mail-send-attachments.test.js +209 -0
  61. package/payload/platform/plugins/outlook/mcp/dist/__tests__/mail-send-attachments.test.js.map +1 -0
  62. package/payload/platform/plugins/outlook/mcp/dist/index.js +10 -7
  63. package/payload/platform/plugins/outlook/mcp/dist/index.js.map +1 -1
  64. package/payload/platform/plugins/outlook/mcp/dist/lib/attach.d.ts +37 -0
  65. package/payload/platform/plugins/outlook/mcp/dist/lib/attach.d.ts.map +1 -0
  66. package/payload/platform/plugins/outlook/mcp/dist/lib/attach.js +79 -0
  67. package/payload/platform/plugins/outlook/mcp/dist/lib/attach.js.map +1 -0
  68. package/payload/platform/plugins/outlook/mcp/dist/lib/graph-client.d.ts +42 -15
  69. package/payload/platform/plugins/outlook/mcp/dist/lib/graph-client.d.ts.map +1 -1
  70. package/payload/platform/plugins/outlook/mcp/dist/lib/graph-client.js +32 -1
  71. package/payload/platform/plugins/outlook/mcp/dist/lib/graph-client.js.map +1 -1
  72. package/payload/platform/plugins/outlook/mcp/dist/lib/message.d.ts +8 -0
  73. package/payload/platform/plugins/outlook/mcp/dist/lib/message.d.ts.map +1 -1
  74. package/payload/platform/plugins/outlook/mcp/dist/lib/message.js +4 -0
  75. package/payload/platform/plugins/outlook/mcp/dist/lib/message.js.map +1 -1
  76. package/payload/platform/plugins/outlook/mcp/dist/lib/outbound-attachments.d.ts +31 -8
  77. package/payload/platform/plugins/outlook/mcp/dist/lib/outbound-attachments.d.ts.map +1 -1
  78. package/payload/platform/plugins/outlook/mcp/dist/lib/outbound-attachments.js +40 -13
  79. package/payload/platform/plugins/outlook/mcp/dist/lib/outbound-attachments.js.map +1 -1
  80. package/payload/platform/plugins/outlook/mcp/dist/lib/upload-session.d.ts +9 -5
  81. package/payload/platform/plugins/outlook/mcp/dist/lib/upload-session.d.ts.map +1 -1
  82. package/payload/platform/plugins/outlook/mcp/dist/lib/upload-session.js +12 -8
  83. package/payload/platform/plugins/outlook/mcp/dist/lib/upload-session.js.map +1 -1
  84. package/payload/platform/plugins/outlook/mcp/dist/tools/calendar-event.d.ts.map +1 -1
  85. package/payload/platform/plugins/outlook/mcp/dist/tools/calendar-event.js +3 -5
  86. package/payload/platform/plugins/outlook/mcp/dist/tools/calendar-event.js.map +1 -1
  87. package/payload/platform/plugins/outlook/mcp/dist/tools/draft-edit.d.ts +36 -4
  88. package/payload/platform/plugins/outlook/mcp/dist/tools/draft-edit.d.ts.map +1 -1
  89. package/payload/platform/plugins/outlook/mcp/dist/tools/draft-edit.js +56 -9
  90. package/payload/platform/plugins/outlook/mcp/dist/tools/draft-edit.js.map +1 -1
  91. package/payload/platform/plugins/outlook/mcp/dist/tools/draft.d.ts +13 -2
  92. package/payload/platform/plugins/outlook/mcp/dist/tools/draft.d.ts.map +1 -1
  93. package/payload/platform/plugins/outlook/mcp/dist/tools/draft.js +18 -4
  94. package/payload/platform/plugins/outlook/mcp/dist/tools/draft.js.map +1 -1
  95. package/payload/platform/plugins/outlook/mcp/dist/tools/mail-attachment.d.ts.map +1 -1
  96. package/payload/platform/plugins/outlook/mcp/dist/tools/mail-attachment.js +3 -4
  97. package/payload/platform/plugins/outlook/mcp/dist/tools/mail-attachment.js.map +1 -1
  98. package/payload/platform/plugins/outlook/mcp/dist/tools/mail-fetch-body.d.ts.map +1 -1
  99. package/payload/platform/plugins/outlook/mcp/dist/tools/mail-fetch-body.js +2 -4
  100. package/payload/platform/plugins/outlook/mcp/dist/tools/mail-fetch-body.js.map +1 -1
  101. package/payload/platform/plugins/outlook/mcp/dist/tools/mail-reply.d.ts.map +1 -1
  102. package/payload/platform/plugins/outlook/mcp/dist/tools/mail-reply.js +3 -20
  103. package/payload/platform/plugins/outlook/mcp/dist/tools/mail-reply.js.map +1 -1
  104. package/payload/platform/plugins/outlook/mcp/dist/tools/mail-send.d.ts +27 -3
  105. package/payload/platform/plugins/outlook/mcp/dist/tools/mail-send.d.ts.map +1 -1
  106. package/payload/platform/plugins/outlook/mcp/dist/tools/mail-send.js +53 -8
  107. package/payload/platform/plugins/outlook/mcp/dist/tools/mail-send.js.map +1 -1
  108. package/payload/platform/plugins/outlook/references/graph-surfaces.md +41 -6
  109. package/payload/platform/plugins/outlook/skills/outlook/SKILL.md +22 -5
  110. package/payload/platform/plugins/storage-broker/PLUGIN.md +41 -2
  111. package/payload/platform/plugins/storage-broker/mcp/dist/__tests__/confine-path.test.d.ts +2 -0
  112. package/payload/platform/plugins/storage-broker/mcp/dist/__tests__/confine-path.test.d.ts.map +1 -0
  113. package/payload/platform/plugins/storage-broker/mcp/dist/__tests__/confine-path.test.js +85 -0
  114. package/payload/platform/plugins/storage-broker/mcp/dist/__tests__/confine-path.test.js.map +1 -0
  115. package/payload/platform/plugins/storage-broker/mcp/dist/__tests__/put-source.test.d.ts +2 -0
  116. package/payload/platform/plugins/storage-broker/mcp/dist/__tests__/put-source.test.d.ts.map +1 -0
  117. package/payload/platform/plugins/storage-broker/mcp/dist/__tests__/put-source.test.js +77 -0
  118. package/payload/platform/plugins/storage-broker/mcp/dist/__tests__/put-source.test.js.map +1 -0
  119. package/payload/platform/plugins/storage-broker/mcp/dist/confine-path.d.ts +12 -0
  120. package/payload/platform/plugins/storage-broker/mcp/dist/confine-path.d.ts.map +1 -0
  121. package/payload/platform/plugins/storage-broker/mcp/dist/confine-path.js +107 -0
  122. package/payload/platform/plugins/storage-broker/mcp/dist/confine-path.js.map +1 -0
  123. package/payload/platform/plugins/storage-broker/mcp/dist/index.js +86 -0
  124. package/payload/platform/plugins/storage-broker/mcp/dist/index.js.map +1 -1
  125. package/payload/platform/plugins/storage-broker/mcp/dist/put-source.d.ts +11 -0
  126. package/payload/platform/plugins/storage-broker/mcp/dist/put-source.d.ts.map +1 -0
  127. package/payload/platform/plugins/storage-broker/mcp/dist/put-source.js +35 -0
  128. package/payload/platform/plugins/storage-broker/mcp/dist/put-source.js.map +1 -0
  129. package/payload/platform/scripts/logs-read-jsonl.test.sh +118 -0
  130. package/payload/platform/scripts/logs-read.sh +63 -9
  131. package/payload/platform/services/claude-session-manager/dist/canonical-tool-names.generated.d.ts.map +1 -1
  132. package/payload/platform/services/claude-session-manager/dist/canonical-tool-names.generated.js +4 -0
  133. package/payload/platform/services/claude-session-manager/dist/canonical-tool-names.generated.js.map +1 -1
  134. package/payload/server/{chunk-F4D35LKL.js → chunk-POBXIHOF.js} +34 -0
  135. package/payload/server/{chunk-SDYRKIYY.js → chunk-Q6W4U6HL.js} +153 -27
  136. package/payload/server/maxy-edge.js +1 -1
  137. package/payload/server/server.js +206 -6
  138. package/payload/server/{src-554BYJMN.js → src-3I2RYZFB.js} +9 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"confine-path.js","sourceRoot":"","sources":["../src/confine-path.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC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B,CAAC,KAAK,IAAI,YAAY,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAC1F,CAAC;YACJ,CAAC;YACD,QAAQ,GAAG,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;QAC9C,CAAC;IACH,CAAC;IAED,IAAI,QAAQ,KAAK,IAAI,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,GAAG,GAAG,CAAC,EAAE,CAAC;QAC1D,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,uDAAuD,CAAC,CAAC;IAC/E,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -6,10 +6,14 @@
6
6
  */
7
7
  import { initStderrTee } from "../../../../lib/mcp-stderr-tee/dist/index.js";
8
8
  initStderrTee("storage-broker");
9
+ import { writeFileSync } from "node:fs";
9
10
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
10
11
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
11
12
  import { z } from "zod";
12
13
  import { callApi as rawCallApi } from "./call-api.js";
14
+ import { confineToAccountDir } from "./confine-path.js";
15
+ import { readPutSource } from "./put-source.js";
16
+ import { R2_OBJECT_MAX_BYTES } from "../../../../lib/storage-broker/dist/object-limits.js";
13
17
  import { callerScopeHeaders } from "./caller-scope-headers.js";
14
18
  import { requirePortEnv } from "../../../../lib/require-port-env/dist/index.js";
15
19
  import { lifelineTool } from "../../../../lib/mcp-lifeline/dist/index.js";
@@ -87,6 +91,88 @@ lifelineTool(server, "storage-r2-bucket-create", "Create a Cloudflare R2 bucket
87
91
  return textResult(`R2 create failed: ${err}`, true);
88
92
  return textResult(`Created R2 bucket ${name}.`);
89
93
  });
94
+ // ─── R2 objects (Task 1691) ───────────────────────────────────────────────
95
+ //
96
+ // get/put move bytes through a file rather than the tool result: these objects
97
+ // are photos and scans, and base64 in a tool result would push megabytes into
98
+ // the agent's context window. The file I/O lives here, in this account-scoped
99
+ // process, and never in the house-level route that holds the credential — see
100
+ // confine-path.ts for why that split is the part that matters.
101
+ // ─── storage-r2-object-list ───────────────────────────────────────────────
102
+ lifelineTool(server, "storage-r2-object-list", "List the objects in an R2 bucket your account owns.", {
103
+ bucket: z.string().describe("Bucket name"),
104
+ prefix: z.string().optional().describe("Only list keys starting with this prefix"),
105
+ }, async ({ bucket, prefix }) => {
106
+ const result = await callApi("storage-r2-object-list", "/api/storage/r2/object/list", "POST", { bucket, prefix });
107
+ const err = errorOf(result);
108
+ if (err)
109
+ return textResult(`R2 object list failed: ${err}`, true);
110
+ const objects = result.objects ?? [];
111
+ return textResult(objects.length ? objects.map((o) => `${o.key}\t${o.size}`).join("\n") : "No objects.");
112
+ });
113
+ // ─── storage-r2-object-get ────────────────────────────────────────────────
114
+ lifelineTool(server, "storage-r2-object-get", `Download an object from an R2 bucket your account owns to a file in your account directory. Objects larger than ${R2_OBJECT_MAX_BYTES / 1024 / 1024} MiB are rejected.`, {
115
+ bucket: z.string().describe("Bucket name"),
116
+ key: z.string().describe("Object key"),
117
+ destPath: z.string().describe("Destination file path, inside your account directory"),
118
+ }, async ({ bucket, key, destPath }) => {
119
+ // Confine before the fetch: a rejected destination should cost no download.
120
+ let dest;
121
+ try {
122
+ dest = confineToAccountDir(destPath, false);
123
+ }
124
+ catch (e) {
125
+ return textResult(`R2 object get failed: ${e instanceof Error ? e.message : String(e)}`, true);
126
+ }
127
+ const result = await callApi("storage-r2-object-get", "/api/storage/r2/object/get", "POST", { bucket, key });
128
+ const err = errorOf(result);
129
+ if (err)
130
+ return textResult(`R2 object get failed: ${err}`, true);
131
+ const b64 = result.contentBase64;
132
+ if (typeof b64 !== "string")
133
+ return textResult("R2 object get failed: no content in response", true);
134
+ const bytes = Buffer.from(b64, "base64");
135
+ try {
136
+ writeFileSync(dest, bytes);
137
+ }
138
+ catch (e) {
139
+ return textResult(`R2 object get failed: ${e instanceof Error ? e.message : String(e)}`, true);
140
+ }
141
+ return textResult(`Wrote ${bytes.length} bytes to ${dest}`);
142
+ });
143
+ // ─── storage-r2-object-put ────────────────────────────────────────────────
144
+ lifelineTool(server, "storage-r2-object-put", `Upload a file from your account directory to an R2 bucket your account owns. Files larger than ${R2_OBJECT_MAX_BYTES / 1024 / 1024} MiB are rejected.`, {
145
+ bucket: z.string().describe("Bucket name"),
146
+ key: z.string().describe("Object key"),
147
+ srcPath: z.string().describe("Source file path, inside your account directory"),
148
+ }, async ({ bucket, key, srcPath }) => {
149
+ let bytes;
150
+ try {
151
+ // Confined and size-checked before the read: an over-cap file costs no
152
+ // buffer here and never reaches the house process.
153
+ ({ bytes } = readPutSource(srcPath));
154
+ }
155
+ catch (e) {
156
+ return textResult(`R2 object put failed: ${e instanceof Error ? e.message : String(e)}`, true);
157
+ }
158
+ const result = await callApi("storage-r2-object-put", "/api/storage/r2/object/put", "POST", {
159
+ bucket,
160
+ key,
161
+ contentBase64: bytes.toString("base64"),
162
+ });
163
+ const err = errorOf(result);
164
+ if (err)
165
+ return textResult(`R2 object put failed: ${err}`, true);
166
+ return textResult(`Uploaded ${bytes.length} bytes to ${bucket}/${key}.`);
167
+ });
168
+ // ─── storage-r2-object-delete ─────────────────────────────────────────────
169
+ lifelineTool(server, "storage-r2-object-delete", "Delete an object from an R2 bucket your account owns.", { bucket: z.string().describe("Bucket name"), key: z.string().describe("Object key") }, async ({ bucket, key }) => {
170
+ const result = await callApi("storage-r2-object-delete", "/api/storage/r2/object/delete", "POST", { bucket, key });
171
+ const err = errorOf(result);
172
+ if (err)
173
+ return textResult(`R2 object delete failed: ${err}`, true);
174
+ return textResult(`Deleted ${bucket}/${key}.`);
175
+ });
90
176
  async function main() {
91
177
  const transport = new StdioServerTransport();
92
178
  await server.connect(transport);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,a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AAO,UAAU,CAAC,4BAA4B,GAAG,EAAE,EAAE,IAAI,CAAC,CAAC;IACpE,OAAO,UAAU,CAAC,WAAW,MAAM,IAAI,GAAG,GAAG,CAAC,CAAC;AACjD,CAAC,CACF,CAAC;AAEF,KAAK,UAAU,IAAI;IACjB,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAClC,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IACnB,OAAO,CAAC,KAAK,CAAC,+BAA+B,GAAG,EAAE,CAAC,CAAC;IACpD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Returns the confined absolute path and the file's bytes.
3
+ *
4
+ * Throws naming the offending file and the limit when the file is over the cap,
5
+ * and naming the path when it is outside the account directory or unreadable.
6
+ */
7
+ export declare function readPutSource(srcPath: string): {
8
+ path: string;
9
+ bytes: Buffer;
10
+ };
11
+ //# sourceMappingURL=put-source.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"put-source.d.ts","sourceRoot":"","sources":["../src/put-source.ts"],"names":[],"mappings":"AAuBA;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAQ9E"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Resolve a put's source file: confine it to the caller's account directory,
3
+ * size it, reject it if it is over the cap, and only then read it.
4
+ *
5
+ * The order is the point (Task 1695). An over-cap file must cost no buffer, in
6
+ * this process or the house one, so the size is checked before the read rather
7
+ * than after — the same pre-read statSync rule the email plugin's
8
+ * resolveOutboundAttachments already proves for the same class of payload.
9
+ * Checking after the read would bound the upload while leaving the local OOM
10
+ * exactly where it was.
11
+ *
12
+ * This lives in its own module rather than inline in the put tool because the
13
+ * ordering is the behaviour worth testing, and index.ts constructs an MCP server
14
+ * on import.
15
+ */
16
+ import { readFileSync, statSync } from "node:fs";
17
+ import { basename } from "node:path";
18
+ import { confineToAccountDir } from "./confine-path.js";
19
+ import { R2_OBJECT_MAX_BYTES, tooLargeMessage, } from "../../../../lib/storage-broker/dist/object-limits.js";
20
+ /**
21
+ * Returns the confined absolute path and the file's bytes.
22
+ *
23
+ * Throws naming the offending file and the limit when the file is over the cap,
24
+ * and naming the path when it is outside the account directory or unreadable.
25
+ */
26
+ export function readPutSource(srcPath) {
27
+ const path = confineToAccountDir(srcPath, true);
28
+ // confineToAccountDir has already proven this is a regular file.
29
+ const { size } = statSync(path);
30
+ if (size > R2_OBJECT_MAX_BYTES) {
31
+ throw new Error(tooLargeMessage(basename(path), size));
32
+ }
33
+ return { path, bytes: readFileSync(path) };
34
+ }
35
+ //# sourceMappingURL=put-source.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"put-source.js","sourceRoot":"","sources":["../src/put-source.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EACL,mBAAmB,EACnB,eAAe,GAChB,MAAM,sDAAsD,CAAC;AAE9D;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,OAAe;IAC3C,MAAM,IAAI,GAAG,mBAAmB,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAChD,iEAAiE;IACjE,MAAM,EAAE,IAAI,EAAE,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;IAChC,IAAI,IAAI,GAAG,mBAAmB,EAAE,CAAC;QAC/B,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;IACzD,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC;AAC7C,CAAC"}
@@ -87,6 +87,52 @@ write_parent_with_error() {
87
87
  } > "$f"
88
88
  }
89
89
 
90
+ # Write a parent JSONL carrying BOTH harness rejections and the classes that
91
+ # must NOT be treated as rejections. A rejection is a call the CLI refused to
92
+ # dispatch, so the tool never ran; everything else here either ran and failed or
93
+ # is a different fault. Both InputValidationError sub-classes are covered:
94
+ # unparseable JSON (carries __unparsedToolInput) and schema-valid JSON that
95
+ # failed validation (no such marker, and the majority class in practice).
96
+ write_parent_with_rejections() {
97
+ local cfg="$1" uuid="$2"
98
+ local f="$cfg/projects/-fake-cwd/${uuid}.jsonl"
99
+ {
100
+ printf '%s\n' '{"type":"user","timestamp":"2026-07-16T15:59:00.000Z","uuid":"r0","message":{"role":"user","content":"send it"}}'
101
+ # 2 x rejection sub-class A (unparseable JSON) on ONE tool -> census x2
102
+ printf '%s\n' '{"type":"assistant","timestamp":"2026-07-16T15:59:01.000Z","uuid":"r1","message":{"role":"assistant","content":[{"type":"tool_use","id":"toolu_R1","name":"outlook-mail-send","input":{"__unparsedToolInput":"{\"to\": bare@x.co}"}}]}}'
103
+ printf '%s\n' '{"type":"user","timestamp":"2026-07-16T15:59:02.000Z","uuid":"r2","message":{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_R1","is_error":true,"content":"<tool_use_error>InputValidationError: outlook-mail-send was called with input that could not be parsed as JSON.\nYou sent (first 200 of 670 bytes): {\"to\": bare@x.co} REJECT_A_ONE</tool_use_error>"}]}}'
104
+ printf '%s\n' '{"type":"assistant","timestamp":"2026-07-16T15:59:03.000Z","uuid":"r3","message":{"role":"assistant","content":[{"type":"tool_use","id":"toolu_R2","name":"outlook-mail-send","input":{"__unparsedToolInput":"{\"to\": bare@x.co}"}}]}}'
105
+ printf '%s\n' '{"type":"user","timestamp":"2026-07-16T15:59:04.000Z","uuid":"r4","message":{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_R2","is_error":true,"content":"<tool_use_error>InputValidationError: outlook-mail-send was called with input that could not be parsed as JSON.\nYou sent (first 200 of 670 bytes): {\"to\": bare@x.co} REJECT_A_TWO</tool_use_error>"}]}}'
106
+ # rejection sub-class B: JSON parsed fine, schema validation failed
107
+ printf '%s\n' '{"type":"assistant","timestamp":"2026-07-16T15:59:05.000Z","uuid":"r5","message":{"role":"assistant","content":[{"type":"tool_use","id":"toolu_R3","name":"Read","input":{"offset":"x"}}]}}'
108
+ printf '%s\n' '{"type":"user","timestamp":"2026-07-16T15:59:06.000Z","uuid":"r6","message":{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_R3","is_error":true,"content":"<tool_use_error>InputValidationError: Read failed due to the following issue: The parameter `offset` type is expected as `number` REJECT_B_ONE</tool_use_error>"}]}}'
109
+ # NOT a rejection: unknown tool (different fault, has its own PostToolUse hook)
110
+ printf '%s\n' '{"type":"assistant","timestamp":"2026-07-16T15:59:07.000Z","uuid":"r7","message":{"role":"assistant","content":[{"type":"tool_use","id":"toolu_N1","name":"work-create","input":{}}]}}'
111
+ printf '%s\n' '{"type":"user","timestamp":"2026-07-16T15:59:08.000Z","uuid":"r8","message":{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_N1","is_error":true,"content":"<tool_use_error>Error: No such tool available: work-create NOTREJ_NOTOOL</tool_use_error>"}]}}'
112
+ # NOT a rejection: MCP server-side validation (the call DID reach the server)
113
+ printf '%s\n' '{"type":"assistant","timestamp":"2026-07-16T15:59:09.000Z","uuid":"r9","message":{"role":"assistant","content":[{"type":"tool_use","id":"toolu_N2","name":"outlook-mail-fetch-body","input":{}}]}}'
114
+ printf '%s\n' '{"type":"user","timestamp":"2026-07-16T15:59:10.000Z","uuid":"rA","message":{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_N2","is_error":true,"content":"MCP error -32602: Input validation error: id: Required NOTREJ_32602"}]}}'
115
+ # NOT a rejection: built-in tool that RAN and failed its precondition
116
+ printf '%s\n' '{"type":"assistant","timestamp":"2026-07-16T15:59:11.000Z","uuid":"rB","message":{"role":"assistant","content":[{"type":"tool_use","id":"toolu_N3","name":"Edit","input":{}}]}}'
117
+ printf '%s\n' '{"type":"user","timestamp":"2026-07-16T15:59:12.000Z","uuid":"rC","message":{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_N3","is_error":true,"content":"<tool_use_error>File has not been read yet. Read it first before writing to it. NOTREJ_UNREAD</tool_use_error>"}]}}'
118
+ } > "$f"
119
+ }
120
+
121
+ # Write a subagent transcript whose ONLY error is a harness rejection. Used to
122
+ # prove --scan-subagent-errors does not report a rejection-only subagent as an
123
+ # error-carrying one: the subagent did not fail, a call was never dispatched.
124
+ write_subagent_rejection_only() {
125
+ local cfg="$1" parent_uuid="$2" agent="$3" atype="$4"
126
+ local d="$cfg/projects/-fake-cwd/${parent_uuid}/subagents"
127
+ mkdir -p "$d"
128
+ {
129
+ printf '%s\n' '{"type":"user","timestamp":"2026-07-16T16:00:00.000Z","uuid":"j1","message":{"role":"user","content":"read it"}}'
130
+ printf '%s\n' '{"type":"assistant","timestamp":"2026-07-16T16:00:01.000Z","uuid":"j2","message":{"role":"assistant","content":[{"type":"tool_use","id":"toolu_SR","name":"Read","input":{"__unparsedToolInput":"{\"file_path\": /x}"}}]}}'
131
+ printf '%s\n' '{"type":"user","timestamp":"2026-07-16T16:00:02.000Z","uuid":"j3","message":{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_SR","is_error":true,"content":"<tool_use_error>InputValidationError: Read was called with input that could not be parsed as JSON.\nYou sent (first 200 of 30 bytes): {\"file_path\": /x} SUBREJ_ONLY</tool_use_error>"}]}}'
132
+ } > "$d/${agent}.jsonl"
133
+ printf '{"agentType":"%s","description":"read a file"}\n' "$atype" > "$d/${agent}.meta.json"
134
+ }
135
+
90
136
  # Write a CLEAN subagent transcript (no errors) + its meta.
91
137
  write_subagent_clean() {
92
138
  local cfg="$1" parent_uuid="$2" agent="$3" atype="$4"
@@ -248,6 +294,75 @@ case_parent_error_not_subagent() {
248
294
  return 0
249
295
  }
250
296
 
297
+ # --- Case J: harness rejection is distinguished from a tool that RAN and failed ---
298
+ # The 1692 defect: a call the CLI refused to dispatch rendered identically to a
299
+ # tool that ran and returned a failure, so a rejection loop read as "the tool is
300
+ # broken" while the tool was healthy. Only InputValidationError may be relabelled.
301
+ case_rejection_classified_and_counted() {
302
+ local root="/tmp/maxy-1692-J-$$"; local out
303
+ out=$(setup_tree "$root"); local script="${out% *}"; local cfg="${out#* }"
304
+ write_parent_with_rejections "$cfg" "$UUID_A"
305
+ write_pidfile "$cfg" 4255 "$UUID_A" "$BRIDGE"
306
+
307
+ invoke "$script" "$cfg" "session_${BRIDGE}"
308
+ cleanup_tree "$root"
309
+
310
+ [[ $RC -eq 0 ]] || { echo " expected exit 0, got $RC; err=$ERR"; return 1; }
311
+
312
+ # Both InputValidationError sub-classes are rejections (neither dispatched).
313
+ [[ "$OUT" == *"REJECTED"*"REJECT_A_ONE"* ]] || { echo " sub-class A (unparseable) not flagged REJECTED"; return 1; }
314
+ [[ "$OUT" == *"REJECTED"*"REJECT_B_ONE"* ]] || { echo " sub-class B (schema-invalid) not flagged REJECTED"; return 1; }
315
+
316
+ # The exclusions MUST keep the plain tool-error rendering. Widening the
317
+ # predicate to the bare <tool_use_error> wrapper is the regression this pins.
318
+ local l
319
+ for l in NOTREJ_NOTOOL NOTREJ_32602 NOTREJ_UNREAD; do
320
+ grep -q "tool error.*$l" <<<"$OUT" || { echo " $l lost its '‼ tool error' rendering"; return 1; }
321
+ grep -q "REJECTED.*$l" <<<"$OUT" && { echo " $l wrongly flagged REJECTED"; return 1; }
322
+ done
323
+
324
+ # Repetition is the diagnostic fact: 2 identical calls on one tool, counted.
325
+ [[ "$OUT" == *"rejections: 3"* ]] || { echo " census missing or miscounted (want 3)"; return 1; }
326
+ [[ "$OUT" == *"outlook-mail-send x2"* ]] || { echo " census does not count the repeat per tool"; return 1; }
327
+ return 0
328
+ }
329
+
330
+ # --- Case K: a clean session emits NO census line (non-regression) ---
331
+ case_no_rejections_no_census() {
332
+ local root="/tmp/maxy-1692-K-$$"; local out
333
+ out=$(setup_tree "$root"); local script="${out% *}"; local cfg="${out#* }"
334
+ write_parent_with_error "$cfg" "$UUID_A"
335
+ write_pidfile "$cfg" 4256 "$UUID_A" "$BRIDGE"
336
+
337
+ invoke "$script" "$cfg" "session_${BRIDGE}"
338
+ cleanup_tree "$root"
339
+
340
+ [[ $RC -eq 0 ]] || { echo " expected exit 0, got $RC"; return 1; }
341
+ [[ "$OUT" != *"rejections:"* ]] || { echo " census line emitted for a session with no rejections"; return 1; }
342
+ [[ "$OUT" != *"REJECTED"* ]] || { echo " genuine tool error wrongly flagged REJECTED"; return 1; }
343
+ return 0
344
+ }
345
+
346
+ # --- Case L: --scan-subagent-errors does not report a rejection-only subagent ---
347
+ # A rejection is not a subagent failure: the subagent did not fail, a call was
348
+ # never dispatched. Counting it re-creates the 1692 conflation one mode over.
349
+ case_scan_ignores_rejection_only_subagent() {
350
+ local root="/tmp/maxy-1692-L-$$"; local out
351
+ out=$(setup_tree "$root"); local script="${out% *}"; local cfg="${out#* }"
352
+ write_parent "$cfg" "$UUID_A"
353
+ write_subagent_rejection_only "$cfg" "$UUID_A" "agent-aREJ00001" "content-producer"
354
+ write_subagent_failed "$cfg" "$UUID_A" "agent-aFAIL0001" "pdf-renderer"
355
+
356
+ invoke "$script" "$cfg" --scan-subagent-errors
357
+ cleanup_tree "$root"
358
+
359
+ [[ $RC -eq 0 ]] || { echo " expected exit 0, got $RC; err=$ERR"; return 1; }
360
+ [[ "$OUT" == *"aFAIL0001"* ]] || { echo " genuinely failed subagent missing from scan"; return 1; }
361
+ [[ "$OUT" != *"SUBREJ_ONLY"* ]] || { echo " rejection-only subagent reported as error-carrying"; return 1; }
362
+ [[ "$OUT" != *"aREJ00001"* ]] || { echo " rejection-only subagent listed by scan"; return 1; }
363
+ return 0
364
+ }
365
+
251
366
  # --- Case I: content-grep resolves a unique body match (last-resort tier) ---
252
367
  case_content_grep_single() {
253
368
  local root="/tmp/maxy-585-I-$$"; local out
@@ -299,6 +414,9 @@ run_case "parent's own tool error not mislabelled SUBAGENT ERROR" case_pare
299
414
  run_case "content-grep resolves a unique body match" case_content_grep_single
300
415
  run_case "content-grep refuses an ambiguous (multi) body match" case_content_grep_ambiguous_refuses
301
416
  run_case "unresolvable key → exit 1" case_unresolvable_miss
417
+ run_case "harness rejection classified + counted, exclusions intact" case_rejection_classified_and_counted
418
+ run_case "no rejections → no census line" case_no_rejections_no_census
419
+ run_case "scan ignores a rejection-only subagent" case_scan_ignores_rejection_only_subagent
302
420
 
303
421
  echo ""
304
422
  echo "================================================"
@@ -627,7 +627,7 @@ tail_mode() {
627
627
  # non-interactive SSH PATH. argv[1] selects the mode (timeline|scan); the
628
628
  # program is fed via -c so logs-read.sh stays a single self-contained file.
629
629
  JSONL_PY=$(cat <<'PY'
630
- import sys, os, re, json, glob
630
+ import sys, os, re, json, glob, collections
631
631
 
632
632
  MODE = sys.argv[1] if len(sys.argv) > 1 else ''
633
633
 
@@ -776,7 +776,40 @@ def subagent_dir(projects_root, uuid):
776
776
  # failure (the task's target, flagged 'SUBAGENT ERROR' and counted) from the
777
777
  # parent session's own tool error (shown plainly, never counted as a subagent
778
778
  # error). Returns the count of SUBAGENT errors found (0 for the parent).
779
- def collect_events(path, source, events, is_sub):
779
+ # A harness rejection is a call that NEVER REACHED its tool: the CLI refused the
780
+ # model's arguments, so no MCP dispatch happened and no plugin line exists
781
+ # anywhere (not in server.log, not in mcp-<server>-<sessionId>.log, not in
782
+ # mcp-lifeline). Rendering it as a plain tool error reads as "the tool is broken"
783
+ # when the tool was never called -- the confusion that produced a false
784
+ # customer-facing fault report (task 1692).
785
+ #
786
+ # InputValidationError has two sub-classes and BOTH are rejections, because
787
+ # neither dispatches. The label says 'never dispatched', not 'malformed', because
788
+ # only the first is malformed:
789
+ # A. "...could not be parsed as JSON" -- args unparseable; the tool_use block
790
+ # carries __unparsedToolInput. 52 of 170 measured 2026-07-16.
791
+ # B. "...failed due to the following issue(s)" -- the JSON parsed fine and
792
+ # violated the schema (wrong type, missing required). No __unparsedToolInput.
793
+ # 118 of 170, so the majority; calling it 'malformed' would be wrong.
794
+ #
795
+ # This is the ONLY class relabelled. Deliberately NOT covered, all of which keep
796
+ # rendering as '‼ tool error':
797
+ # 'Error: No such tool available:' / 'Unknown skill:' -- different fault, and
798
+ # the missing-tool case already has a PostToolUse hook (mcp-tool-missing.sh)
799
+ # 'MCP error -32602' -- reached the server; its SDK rejected it
800
+ # every unwrapped is_error payload -- the tool ran and returned a failure
801
+ #
802
+ # The <tool_use_error> wrapper alone is NOT a rejection discriminator: measured
803
+ # 2026-07-16 across 733 SiteDesk transcripts it wraps mostly built-in tools that
804
+ # RAN and failed ('File has not been read yet' x60, 'File has been modified
805
+ # since read' x16). Match the error class, not the wrapper.
806
+ def is_rejection(text):
807
+ if not isinstance(text, str):
808
+ return False
809
+ return text.lstrip().startswith('<tool_use_error>InputValidationError:')
810
+
811
+
812
+ def collect_events(path, source, events, is_sub, rejects=None):
780
813
  rows = load_jsonl(path)
781
814
  id2tool = {}
782
815
  for r in rows:
@@ -812,10 +845,18 @@ def collect_events(path, source, events, is_sub):
812
845
  for b in content:
813
846
  if isinstance(b, dict) and b.get('type') == 'tool_result' and b.get('is_error'):
814
847
  tool = id2tool.get(b.get('tool_use_id'))
815
- flag = '‼ SUBAGENT ERROR' if is_sub else '‼ tool error'
816
- events.append((ts, source, 'error', '%s tool=%s error="%s"' % (flag, tool or '?', clip(result_text(b, r), 200))))
817
- if is_sub:
818
- n_err += 1
848
+ body = result_text(b, r)
849
+ if is_rejection(body):
850
+ # Not a tool failure: the call never ran. Never
851
+ # counted as a subagent error for the same reason.
852
+ flag = '‼ REJECTED (never dispatched)'
853
+ if rejects is not None:
854
+ rejects[tool or '?'] += 1
855
+ else:
856
+ flag = '‼ SUBAGENT ERROR' if is_sub else '‼ tool error'
857
+ if is_sub:
858
+ n_err += 1
859
+ events.append((ts, source, 'error', '%s tool=%s error="%s"' % (flag, tool or '?', clip(body, 200))))
819
860
  elif isinstance(content, str) and content.strip():
820
861
  events.append((ts, source, 'text', 'user: ' + clip(content, 160)))
821
862
  return n_err
@@ -826,18 +867,25 @@ def timeline(projects_root, sessions_dir, key):
826
867
  sys.stderr.write('-- trailer: key=%s resolved=no reason=%s\n' % (key, via))
827
868
  return 1
828
869
  events = []
870
+ rejects = collections.Counter()
829
871
  if parent_path and os.path.exists(parent_path):
830
- collect_events(parent_path, 'parent', events, False)
872
+ collect_events(parent_path, 'parent', events, False, rejects)
831
873
  sdir = subagent_dir(projects_root, uuid)
832
874
  sub_count = err_count = 0
833
875
  if sdir:
834
876
  for af in sorted(glob.glob(os.path.join(sdir, 'agent-*.jsonl'))):
835
877
  sub_count += 1
836
- err_count += collect_events(af, agent_type(af) or os.path.basename(af)[:-6], events, True)
878
+ err_count += collect_events(af, agent_type(af) or os.path.basename(af)[:-6], events, True, rejects)
837
879
  events.sort(key=lambda e: e[0])
838
880
  print('# session %s (resolved via %s)' % (uuid, via))
839
881
  print('# parent: %s' % (parent_path or '(no parent transcript on disk)'))
840
882
  print('# subagents: %d subagent-errors: %d' % (sub_count, err_count))
883
+ # Repetition is the diagnostic fact: one fat-fingered call is a typo, N
884
+ # identical ones against a single tool is a wedged loop. Counting it here
885
+ # makes that one greppable line instead of N unrelated ones.
886
+ if rejects:
887
+ top = ' '.join('%s x%d' % (t, n) for t, n in rejects.most_common())
888
+ print('# rejections: %d (%s)' % (sum(rejects.values()), top))
841
889
  print('')
842
890
  for ts, source, _kind, text in events:
843
891
  print('%s [%s] %s' % (ts or ('-' * 24), source, text))
@@ -871,7 +919,13 @@ def scan(projects_root, limit):
871
919
  if isinstance(content, list):
872
920
  for b in content:
873
921
  if isinstance(b, dict) and b.get('type') == 'tool_result' and b.get('is_error'):
874
- errs.append((id2tool.get(b.get('tool_use_id')), result_text(b, r)))
922
+ body = result_text(b, r)
923
+ # A rejection is not a subagent failure: the subagent did
924
+ # not fail, a call was never dispatched. Counting it here
925
+ # would re-create the conflation the timeline just fixed.
926
+ if is_rejection(body):
927
+ continue
928
+ errs.append((id2tool.get(b.get('tool_use_id')), body))
875
929
  if errs:
876
930
  parent_uuid = os.path.basename(os.path.dirname(os.path.dirname(af)))
877
931
  findings.append((af, agent_type(af), parent_uuid, errs))
@@ -1 +1 @@
1
- {"version":3,"file":"canonical-tool-names.generated.d.ts","sourceRoot":"","sources":["../src/canonical-tool-names.generated.ts"],"names":[],"mappings":"AAQA,+EAA+E;AAC/E,eAAO,MAAM,gBAAgB,EAAE,SAAS,MAAM,EAuB7C,CAAA;AAED,gEAAgE;AAChE,eAAO,MAAM,yBAAyB,EAAE,SAAS,MAAM,EAgStD,CAAA"}
1
+ {"version":3,"file":"canonical-tool-names.generated.d.ts","sourceRoot":"","sources":["../src/canonical-tool-names.generated.ts"],"names":[],"mappings":"AAQA,+EAA+E;AAC/E,eAAO,MAAM,gBAAgB,EAAE,SAAS,MAAM,EAuB7C,CAAA;AAED,gEAAgE;AAChE,eAAO,MAAM,yBAAyB,EAAE,SAAS,MAAM,EAoStD,CAAA"}
@@ -276,6 +276,10 @@ export const CANONICAL_MAXY_TOOL_NAMES = [
276
276
  "mcp__plugin_storage-broker_storage-broker__storage-d1-query",
277
277
  "mcp__plugin_storage-broker_storage-broker__storage-r2-bucket-create",
278
278
  "mcp__plugin_storage-broker_storage-broker__storage-r2-bucket-list",
279
+ "mcp__plugin_storage-broker_storage-broker__storage-r2-object-delete",
280
+ "mcp__plugin_storage-broker_storage-broker__storage-r2-object-get",
281
+ "mcp__plugin_storage-broker_storage-broker__storage-r2-object-list",
282
+ "mcp__plugin_storage-broker_storage-broker__storage-r2-object-put",
279
283
  "mcp__plugin_telegram_telegram__message",
280
284
  "mcp__plugin_telegram_telegram__message-history",
281
285
  "mcp__plugin_telegram_telegram__telegram-webhook-register",
@@ -1 +1 @@
1
- {"version":3,"file":"canonical-tool-names.generated.js","sourceRoot":"","sources":["../src/canonical-tool-names.generated.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,kEAAkE;AAClE,yDAAyD;AACzD,kFAAkF;AAClF,EAAE;AACF,yEAAyE;AACzE,6DAA6D;AAE7D,+EAA+E;AAC/E,MAAM,CAAC,MAAM,gBAAgB,GAAsB;IACjD,OAAO;IACP,KAAK;IACL,SAAS;IACT,WAAW;IACX,UAAU;IACV,OAAO;IACP,YAAY;IACZ,OAAO;IACP,cAAc;IACd,UAAU;IACV,QAAQ;IACR,SAAS;IACT,YAAY;IACZ,WAAW;IACX,YAAY;IACZ,gBAAgB;IAChB,UAAU;IACV,SAAS;IACT,cAAc;IACd,UAAU;IACV,MAAM;IACN,WAAW;CACZ,CAAA;AAED,gEAAgE;AAChE,MAAM,CAAC,MAAM,yBAAyB,GAAsB;IAC1D,yCAAyC;IACzC,yCAAyC;IACzC,kDAAkD;IAClD,sDAAsD;IACtD,yCAAyC;IACzC,yCAAyC;IACzC,uCAAuC;IACvC,wCAAwC;IACxC,iDAAiD;IACjD,yCAAyC;IACzC,iDAAiD;IACjD,yCAAyC;IACzC,sCAAsC;IACtC,yCAAyC;IACzC,wCAAwC;IACxC,oCAAoC;IACpC,yCAAyC;IACzC,qCAAqC;IACrC,uCAAuC;IACvC,2CAA2C;IAC3C,4CAA4C;IAC5C,qCAAqC;IACrC,yCAAyC;IACzC,4CAA4C;IAC5C,oCAAoC;IACpC,sCAAsC;IACtC,0CAA0C;IAC1C,uCAAuC;IACvC,sCAAsC;IACtC,sDAAsD;IACtD,mDAAmD;IACnD,6CAA6C;IAC7C,wCAAwC;IACxC,yCAAyC;IACzC,qCAAqC;IACrC,uCAAuC;IACvC,sCAAsC;IACtC,wCAAwC;IACxC,+BAA+B;IAC/B,qCAAqC;IACrC,sCAAsC;IACtC,yCAAyC;IACzC,4CAA4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AgD;IAChD,mDAAmD;IACnD,mDAAmD;IACnD,6DAA6D;IAC7D,2DAA2D;IAC3D,2DAA2D;IAC3D,+DAA+D;IAC/D,+DAA+D;IAC/D,+DAA+D;IAC/D,0DAA0D;IAC1D,6DAA6D;IAC7D,6DAA6D;IAC7D,8DAA8D;IAC9D,8DAA8D;IAC9D,8DAA8D;IAC9D,qDAAqD;IACrD,sDAAsD;IACtD,2DAA2D;IAC3D,iDAAiD;IACjD,sDAAsD;IACtD,uDAAuD;IACvD,yDAAyD;IACzD,oDAAoD;IACpD,iEAAiE;IACjE,mDAAmD;IACnD,wDAAwD;IACxD,iDAAiD;IACjD,wDAAwD;IACxD,kDAAkD;IAClD,oDAAoD;IACpD,iDAAiD;IACjD,8DAA8D;IAC9D,4DAA4D;IAC5D,6DAA6D;IAC7D,qEAAqE;IACrE,mEAAmE;IACnE,wCAAwC;IACxC,gDAAgD;IAChD,0DAA0D;IAC1D,sCAAsC;IACtC,6DAA6D;IAC7D,kEAAkE;IAClE,8DAA8D;IAC9D,oEAAoE;IACpE,0DAA0D;IAC1D,kDAAkD;IAClD,gDAAgD;IAChD,kEAAkE;IAClE,uDAAuD;IACvD,oDAAoD;IACpD,oDAAoD;IACpD,qDAAqD;IACrD,oDAAoD;IACpD,kDAAkD;IAClD,oDAAoD;IACpD,gDAAgD;IAChD,yCAAyC;IACzC,uCAAuC;IACvC,oCAAoC;IACpC,qCAAqC;IACrC,uCAAuC;IACvC,qCAAqC;IACrC,yCAAyC;IACzC,qCAAqC;IACrC,sCAAsC;IACtC,oCAAoC;IACpC,iCAAiC;IACjC,kCAAkC;IAClC,mCAAmC;IACnC,oCAAoC;IACpC,oCAAoC;IACpC,kDAAkD;IAClD,kDAAkD;IAClD,mDAAmD;IACnD,+CAA+C;IAC/C,gDAAgD;IAChD,gDAAgD;IAChD,kDAAkD;IAClD,oDAAoD;CACrD,CAAA"}
1
+ {"version":3,"file":"canonical-tool-names.generated.js","sourceRoot":"","sources":["../src/canonical-tool-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/D,+DAA+D;IAC/D,0DAA0D;IAC1D,6DAA6D;IAC7D,6DAA6D;IAC7D,8DAA8D;IAC9D,8DAA8D;IAC9D,8DAA8D;IAC9D,qDAAqD;IACrD,sDAAsD;IACtD,2DAA2D;IAC3D,iDAAiD;IACjD,sDAAsD;IACtD,uDAAuD;IACvD,yDAAyD;IACzD,oDAAoD;IACpD,iEAAiE;IACjE,mDAAmD;IACnD,wDAAwD;IACxD,iDAAiD;IACjD,wDAAwD;IACxD,kDAAkD;IAClD,oDAAoD;IACpD,iDAAiD;IACjD,8DAA8D;IAC9D,4DAA4D;IAC5D,6DAA6D;IAC7D,qEAAqE;IACrE,mEAAmE;IACnE,qEAAqE;IACrE,kEAAkE;IAClE,mEAAmE;IACnE,kEAAkE;IAClE,wCAAwC;IACxC,gDAAgD;IAChD,0DAA0D;IAC1D,sCAAsC;IACtC,6DAA6D;IAC7D,kEAAkE;IAClE,8DAA8D;IAC9D,oEAAoE;IACpE,0DAA0D;IAC1D,kDAAkD;IAClD,gDAAgD;IAChD,kEAAkE;IAClE,uDAAuD;IACvD,oDAAoD;IACpD,oDAAoD;IACpD,qDAAqD;IACrD,oDAAoD;IACpD,kDAAkD;IAClD,oDAAoD;IACpD,gDAAgD;IAChD,yCAAyC;IACzC,uCAAuC;IACvC,oCAAoC;IACpC,qCAAqC;IACrC,uCAAuC;IACvC,qCAAqC;IACrC,yCAAyC;IACzC,qCAAqC;IACrC,sCAAsC;IACtC,oCAAoC;IACpC,iCAAiC;IACjC,kCAAkC;IAClC,mCAAmC;IACnC,oCAAoC;IACpC,oCAAoC;IACpC,kDAAkD;IAClD,kDAAkD;IAClD,mDAAmD;IACnD,+CAA+C;IAC/C,gDAAgD;IAChD,gDAAgD;IAChD,kDAAkD;IAClD,oDAAoD;CACrD,CAAA"}
@@ -44,6 +44,39 @@ var compose = (middleware, onError, onNotFound) => {
44
44
  };
45
45
  };
46
46
 
47
+ // node_modules/hono/dist/http-exception.js
48
+ var HTTPException = class extends Error {
49
+ res;
50
+ status;
51
+ /**
52
+ * Creates an instance of `HTTPException`.
53
+ * @param status - HTTP status code for the exception. Defaults to 500.
54
+ * @param options - Additional options for the exception.
55
+ */
56
+ constructor(status = 500, options) {
57
+ super(options?.message, { cause: options?.cause });
58
+ this.res = options?.res;
59
+ this.status = status;
60
+ }
61
+ /**
62
+ * Returns the response object associated with the exception.
63
+ * If a response object is not provided, a new response is created with the error message and status code.
64
+ * @returns The response object.
65
+ */
66
+ getResponse() {
67
+ if (this.res) {
68
+ const newResponse = new Response(this.res.body, {
69
+ status: this.status,
70
+ headers: this.res.headers
71
+ });
72
+ return newResponse;
73
+ }
74
+ return new Response(this.message, {
75
+ status: this.status
76
+ });
77
+ }
78
+ };
79
+
47
80
  // node_modules/hono/dist/request/constants.js
48
81
  var GET_MATCH_RESULT = /* @__PURE__ */ Symbol();
49
82
 
@@ -5886,6 +5919,7 @@ var clientIpMiddleware = async (c, next) => {
5886
5919
  };
5887
5920
 
5888
5921
  export {
5922
+ HTTPException,
5889
5923
  HtmlEscapedCallbackPhase,
5890
5924
  resolveCallback,
5891
5925
  Hono2 as Hono,