@mgcrea/mcp-apple-messages 1.24.0 → 1.25.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/README.md CHANGED
@@ -64,6 +64,10 @@ will be wrong several times on any real inbox.
64
64
  If the Contacts permission has not been granted, resolution is skipped and handles come back raw.
65
65
  That is a capability downgrade reported through `diagnostics`, never a throw.
66
66
 
67
+ The lookup runs with the Contacts package's defaults. The `APPLE_CONTACTS_*` settings configure the
68
+ Contacts server, not this one: setting them here changes nothing, and
69
+ `APPLE_MESSAGES_RESOLVE_CONTACTS` is the only switch Messages reads for it.
70
+
67
71
  ## Tools
68
72
 
69
73
  Read: `diagnostics`, `list_chats`, `list_messages`, `search_messages`, `get_message`,
package/dist/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { A as MESSAGES_SURFACE, V as BUILD_INFO, a as loadConfig, r as createServer } from "./server-zO2kScTE.js";
2
+ import { A as MESSAGES_SURFACE, V as BUILD_INFO, a as loadConfig, r as createServer } from "./server-OgcrDAq5.js";
3
3
  import { runStdioServer } from "@mgcrea/mcp-apple-core";
4
4
  //#region src/cli.ts
5
5
  const LOG_PREFIX = "apple-messages-mcp";
@@ -16,7 +16,7 @@ runStdioServer({
16
16
  const status = client.status();
17
17
  return {
18
18
  server,
19
- banner: `read-only, store=${status.store.opened ? "open" : "UNREADABLE"}, messages=${status.counts?.messages ?? 0}, chats=${status.counts?.chats ?? 0}, names=${status.contacts.available ? "contacts" : "raw handles"}, index=${config.indexMode}`
19
+ banner: `writes=${config.allowWrites ? "ENABLED" : "disabled"}, store=${status.store.opened ? "open" : "UNREADABLE"}, messages=${status.counts?.messages ?? 0}, chats=${status.counts?.chats ?? 0}, names=${status.contacts.available ? "contacts" : "raw handles"}, index=${config.indexMode}`
20
20
  };
21
21
  }
22
22
  }).catch((err) => {
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","names":[],"sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { runStdioServer } from \"@mgcrea/mcp-apple-core\";\n\nimport { BUILD_INFO } from \"./build-info.js\";\nimport { MESSAGES_SURFACE } from \"./client/errors.js\";\nimport { loadConfig } from \"./config.js\";\nimport { createServer } from \"./server.js\";\n\nconst LOG_PREFIX = \"apple-messages-mcp\";\n\nrunStdioServer({\n build: BUILD_INFO,\n surface: MESSAGES_SURFACE,\n logPrefix: LOG_PREFIX,\n start: async (logger) => {\n const config = loadConfig();\n const { server, client } = createServer({ config, logger });\n const status = client.status();\n return {\n server,\n // No writes= line: this surface has no mutating tool, and printing a flag\n // that gates nothing would imply one exists.\n banner:\n `read-only, ` +\n `store=${status.store.opened ? \"open\" : \"UNREADABLE\"}, ` +\n `messages=${status.counts?.messages ?? 0}, ` +\n `chats=${status.counts?.chats ?? 0}, ` +\n `names=${status.contacts.available ? \"contacts\" : \"raw handles\"}, ` +\n `index=${config.indexMode}`,\n };\n },\n}).catch((err: unknown) => {\n console.error(`[${LOG_PREFIX}] fatal:`, err);\n process.exit(1);\n});\n"],"mappings":";;;;AAQA,MAAM,aAAa;AAEnB,eAAe;CACb,OAAO;CACP,SAAS;CACT,WAAW;CACX,OAAO,OAAO,WAAW;EACvB,MAAM,SAAS,WAAW;EAC1B,MAAM,EAAE,QAAQ,WAAW,aAAa;GAAE;GAAQ;EAAO,CAAC;EAC1D,MAAM,SAAS,OAAO,OAAO;EAC7B,OAAO;GACL;GAGA,QACE,oBACS,OAAO,MAAM,SAAS,SAAS,aAAa,aACzC,OAAO,QAAQ,YAAY,EAAE,UAChC,OAAO,QAAQ,SAAS,EAAE,UAC1B,OAAO,SAAS,YAAY,aAAa,cAAc,UACvD,OAAO;EACpB;CACF;AACF,CAAC,CAAC,CAAC,OAAO,QAAiB;CACzB,QAAQ,MAAM,IAAI,WAAW,WAAW,GAAG;CAC3C,QAAQ,KAAK,CAAC;AAChB,CAAC"}
1
+ {"version":3,"file":"cli.js","names":[],"sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { runStdioServer } from \"@mgcrea/mcp-apple-core\";\n\nimport { BUILD_INFO } from \"./build-info.js\";\nimport { MESSAGES_SURFACE } from \"./client/errors.js\";\nimport { loadConfig } from \"./config.js\";\nimport { createServer } from \"./server.js\";\n\nconst LOG_PREFIX = \"apple-messages-mcp\";\n\nrunStdioServer({\n build: BUILD_INFO,\n surface: MESSAGES_SURFACE,\n logPrefix: LOG_PREFIX,\n start: async (logger) => {\n const config = loadConfig();\n const { server, client } = createServer({ config, logger });\n const status = client.status();\n return {\n server,\n banner:\n `writes=${config.allowWrites ? \"ENABLED\" : \"disabled\"}, ` +\n `store=${status.store.opened ? \"open\" : \"UNREADABLE\"}, ` +\n `messages=${status.counts?.messages ?? 0}, ` +\n `chats=${status.counts?.chats ?? 0}, ` +\n `names=${status.contacts.available ? \"contacts\" : \"raw handles\"}, ` +\n `index=${config.indexMode}`,\n };\n },\n}).catch((err: unknown) => {\n console.error(`[${LOG_PREFIX}] fatal:`, err);\n process.exit(1);\n});\n"],"mappings":";;;;AAQA,MAAM,aAAa;AAEnB,eAAe;CACb,OAAO;CACP,SAAS;CACT,WAAW;CACX,OAAO,OAAO,WAAW;EACvB,MAAM,SAAS,WAAW;EAC1B,MAAM,EAAE,QAAQ,WAAW,aAAa;GAAE;GAAQ;EAAO,CAAC;EAC1D,MAAM,SAAS,OAAO,OAAO;EAC7B,OAAO;GACL;GACA,QACE,UAAU,OAAO,cAAc,YAAY,WAAW,UAC7C,OAAO,MAAM,SAAS,SAAS,aAAa,aACzC,OAAO,QAAQ,YAAY,EAAE,UAChC,OAAO,QAAQ,SAAS,EAAE,UAC1B,OAAO,SAAS,YAAY,aAAa,cAAc,UACvD,OAAO;EACpB;CACF;AACF,CAAC,CAAC,CAAC,OAAO,QAAiB;CACzB,QAAQ,MAAM,IAAI,WAAW,WAAW,GAAG;CAC3C,QAAQ,KAAK,CAAC;AAChB,CAAC"}
package/dist/index.d.ts CHANGED
@@ -26,7 +26,6 @@ declare const ConfigSchema: z.ZodObject<{
26
26
  allowWrites: z.ZodDefault<z.ZodBoolean>;
27
27
  exposePrompts: z.ZodDefault<z.ZodBoolean>;
28
28
  lazyTools: z.ZodDefault<z.ZodBoolean>;
29
- debug: z.ZodDefault<z.ZodBoolean>;
30
29
  osascriptPath: z.ZodDefault<z.ZodString>;
31
30
  osascriptTimeoutMs: z.ZodDefault<z.ZodNumber>;
32
31
  maxResults: z.ZodDefault<z.ZodNumber>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/build-info.ts","../src/config.ts","../src/client/locate.ts","../src/client/store.ts","../src/client/messages.ts","../src/client/dates.ts","../src/client/errors.ts","../src/client/ref.ts","../src/client/typedstream.ts","../src/client/jxa/core.ts","../src/client/jxa/write.ts","../src/server.ts","../src/tools/index.ts"],"mappings":";;;;;;cAkBa,YAAY;;;;;;;;;;;;;;;;;;cCSnB,cAAY,EAAA;;;;;;;;;;;;;;;;;;;;;GA4EP,EAAA,KAAA;KAEC,SAAS,EAAE,aAAa;cAEvB,aAAU,MAAS,OAAO,eAA2B;;;;;;;;;;;;;cC3FrD;;cAGA;KAaD,eAAe;EACzB;EACA;;EAEA;EACA;;cAGW,mBAAgB;cAQhB,cAAW;EACd;EAAgC;MACvC;;;cCiBU,gBAAa;KAMd;EACV;EACA,gBAAgB;EAChB,aAAa;EACb,eAAe;EACf,mBAAmB;EACnB;EACA;EACA;EACA;;KAGU;EACV;EACA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA;EACA;;EAEA;EACA;;EAEA;;EAEA;;KAGU;EACV;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA;EACA;;KAGU;EACV;EACA;EACA;EACA;;;;;;;;;EASA;EACA;;;;;;;;;;;;cAaW;KAED,0BAA0B;KAE1B;EACV;;;;;;;;;;EAUA;;EAEA;EACA;EACA;EACA;EAC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B,QAAY,kCAAgC;;;;;;;;cA6BhE,UAAO,QAAY,YAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cC9P7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cC1DA;;;cClBA;cACA;KAED;EACV,QAAQ;EACR,SAAS;;EAET,YAAY;;EAEZ;;EAEA,WAAW,6BAA6B;;KAG9B;EACV,QAAQ;EACR,QAAQ;;;;;;;cAQG,eAAY,MAAU,wBAAsB;;;KC7B7C;;;;;;;;;;;;;;;EAeV;;;;;EAKA;;;;;;;;EAQA;;;;;;;;;;;;;;;;;;;;;;;;cAyBW,gBAAa,QAChB,WAAS,QACT,qBAAmB,KACtB"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/build-info.ts","../src/config.ts","../src/client/locate.ts","../src/client/store.ts","../src/client/messages.ts","../src/client/dates.ts","../src/client/errors.ts","../src/client/ref.ts","../src/client/typedstream.ts","../src/client/jxa/core.ts","../src/client/jxa/write.ts","../src/server.ts","../src/tools/index.ts"],"mappings":";;;;;;cAkBa,YAAY;;;;;;;;;;;;;;;;;;cCSnB,cAAY,EAAA;;;;;;;;;;;;;;;;;;;;GA4EP,EAAA,KAAA;KAEC,SAAS,EAAE,aAAa;cAEvB,aAAU,MAAS,OAAO,eAA2B;;;;;;;;;;;;;cC3FrD;;cAGA;KAaD,eAAe;EACzB;EACA;;EAEA;EACA;;cAGW,mBAAgB;cAQhB,cAAW;EACd;EAAgC;MACvC;;;cCiBU,gBAAa;KAMd;EACV;EACA,gBAAgB;EAChB,aAAa;EACb,eAAe;EACf,mBAAmB;EACnB;EACA;EACA;EACA;;KAGU;EACV;EACA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA;EACA;;EAEA;EACA;;EAEA;;EAEA;;KAGU;EACV;EACA;EACA;;E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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KC6Od;EAEN;EACA;EACA;;EAEA;EACA;;EAEA;EAAW;EAAkB;EAAoB;EAA2B;;cAErE,uBAAoB,QAAY,kCAAgC;;;;;;;;cA6BhE,UAAO,QAAY,YAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cC9P7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cC1DA;;;cClBA;cACA;KAED;EACV,QAAQ;EACR,SAAS;;EAET,YAAY;;EAEZ;;EAEA,WAAW,6BAA6B;;KAG9B;EACV,QAAQ;EACR,QAAQ;;;;;;;cAQG,eAAY,MAAU,wBAAsB;;;KC7B7C;;;;;;;;;;;;;;;EAeV;;;;;EAKA;;;;;;;;EAQA;;;;;;;;;;;;;;;;;;;;;;;;cAyBW,gBAAa,QAChB,WAAS,QACT,qBAAmB,KACtB"}
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import { A as MESSAGES_SURFACE, B as toAppleSeconds, C as locateStore, D as ChatNotFoundError, E as AppleMessagesError, F as SendTargetNotFoundError, I as CORE_DATA_EPOCH_OFFSET, L as appleSecondsSql, M as MessagesUnavailableError, N as SchemaDriftError, O as IndexUnavailableError, P as SendFailedError, R as fromAppleSeconds, S as defaultStorePath, T as PRELUDE, V as BUILD_INFO, _ as decodeMessageRef, a as loadConfig, b as ATTACHMENTS_RELATIVE, c as introspect, d as decodeAttributedBody, f as outline, g as decodeChatRef, h as MESSAGE_REF_VERSION, i as registerTools, j as MessageNotFoundError, k as MESSAGES_BUNDLE_ID, l as openStore, m as InvalidMessageRefError, n as SERVER_VERSION, o as AppleMessagesClient, p as CHAT_REF_VERSION, r as createServer, s as MessagesStore, t as SERVER_NAME, u as reactionLabel, v as encodeChatRef, w as SEND_MESSAGE, x as STORE_RELATIVE, y as encodeMessageRef, z as renderInstant } from "./server-zO2kScTE.js";
1
+ import { A as MESSAGES_SURFACE, B as toAppleSeconds, C as locateStore, D as ChatNotFoundError, E as AppleMessagesError, F as SendTargetNotFoundError, I as CORE_DATA_EPOCH_OFFSET, L as appleSecondsSql, M as MessagesUnavailableError, N as SchemaDriftError, O as IndexUnavailableError, P as SendFailedError, R as fromAppleSeconds, S as defaultStorePath, T as PRELUDE, V as BUILD_INFO, _ as decodeMessageRef, a as loadConfig, b as ATTACHMENTS_RELATIVE, c as introspect, d as decodeAttributedBody, f as outline, g as decodeChatRef, h as MESSAGE_REF_VERSION, i as registerTools, j as MessageNotFoundError, k as MESSAGES_BUNDLE_ID, l as openStore, m as InvalidMessageRefError, n as SERVER_VERSION, o as AppleMessagesClient, p as CHAT_REF_VERSION, r as createServer, s as MessagesStore, t as SERVER_NAME, u as reactionLabel, v as encodeChatRef, w as SEND_MESSAGE, x as STORE_RELATIVE, y as encodeMessageRef, z as renderInstant } from "./server-OgcrDAq5.js";
2
2
  export { ATTACHMENTS_RELATIVE, AppleMessagesClient, AppleMessagesError, BUILD_INFO, CHAT_REF_VERSION, CORE_DATA_EPOCH_OFFSET, ChatNotFoundError, IndexUnavailableError, InvalidMessageRefError, MESSAGES_BUNDLE_ID, MESSAGES_SURFACE, MESSAGE_REF_VERSION, MessageNotFoundError, MessagesStore, MessagesUnavailableError, PRELUDE, SEND_MESSAGE, SERVER_NAME, SERVER_VERSION, STORE_RELATIVE, SchemaDriftError, SendFailedError, SendTargetNotFoundError, appleSecondsSql, createServer, decodeAttributedBody, decodeChatRef, decodeMessageRef, defaultStorePath, encodeChatRef, encodeMessageRef, fromAppleSeconds, introspect, loadConfig, locateStore, openStore, outline, reactionLabel, registerTools, renderInstant, toAppleSeconds };
@@ -1,5 +1,5 @@
1
- import { AppleAutomationError, AppleAutomationError as AppleMessagesError, BaseConfigSchema, CORE_DATA_EPOCH_OFFSET, IndexUnavailableError, IndexUnavailableError as IndexUnavailableError$1, PreconditionError, SchemaDriftError, SchemaDriftError as SchemaDriftError$1, columnsOf, confirmArg, createOsascriptRunner, describeAggregation, describeStore, escapeLike, extractCode, fail, fingerprintSchema, groupByArg, limitArg, ok, openReadOnly, parseBool, parseBound, parseConfig, parseIntOpt, promptArg, readPackageIdentity, registerSurfaceResources, registerWorkflowPrompt, requiredPromptArg, resolveLimit, trimmed, withBusyRetry, withLazyTools, wrap, wrapResult } from "@mgcrea/mcp-apple-core";
2
- import { existsSync, mkdirSync, readFileSync, statSync, writeFileSync } from "node:fs";
1
+ import { AppleAutomationError, AppleAutomationError as AppleMessagesError, BaseConfigSchema, CORE_DATA_EPOCH_OFFSET, IndexUnavailableError, IndexUnavailableError as IndexUnavailableError$1, PreconditionError, SchemaDriftError, SchemaDriftError as SchemaDriftError$1, buildBaseDiagnostics, columnsOf, confirmArg, createOsascriptRunner, describeAggregation, describeStore, escapeLike, extractCode, fail, fingerprintSchema, groupByArg, limitArg, ok, openReadOnly, parseBool, parseBound, parseConfig, parseIntOpt, promptArg, readPackageIdentity, registerSurfaceResources, registerWorkflowPrompt, requiredPromptArg, resolveLimit, trimmed, withBusyRetry, withLazyTools, wrap, wrapResult, writeConfinedFile } from "@mgcrea/mcp-apple-core";
2
+ import { existsSync, readFileSync, statSync } from "node:fs";
3
3
  import { homedir } from "node:os";
4
4
  import { basename, isAbsolute, join, resolve, sep } from "node:path";
5
5
  import { AppleContactsClient, emailKey, handleKind, loadConfig, suffixKey } from "@mgcrea/mcp-apple-contacts";
@@ -13,8 +13,8 @@ const pkg = readPackageIdentity(new URL("../package.json", import.meta.url), {
13
13
  const BUILD_INFO = {
14
14
  name: pkg.name,
15
15
  version: pkg.version,
16
- gitCommit: "2398a54",
17
- gitCommitDate: "2026-09-26T21:25:01+02:00"
16
+ gitCommit: "782cb1c",
17
+ gitCommitDate: "2026-10-03T15:37:05+02:00"
18
18
  };
19
19
  //#endregion
20
20
  //#region src/client/dates.ts
@@ -1100,12 +1100,13 @@ var MessagesStore = class {
1100
1100
  WHERE (m."text" IS NULL OR m."text" = '')
1101
1101
  AND m."attributedBody" IS NOT NULL ${reactionFilter}
1102
1102
  ${floor === null ? "" : `AND ${appleSecondsSql("m.\"date\"")} >= ?`}
1103
- ORDER BY m."date" DESC`).all(...floor === null ? [] : [floor]);
1103
+ ORDER BY m."date" DESC`).iterate(...floor === null ? [] : [floor]);
1104
1104
  const lowered = query.toLowerCase();
1105
1105
  const decoded = [];
1106
1106
  for (const raw of blobOnly) {
1107
1107
  const row = this.#toRow(raw);
1108
1108
  if (row.text && row.text.toLowerCase().includes(lowered)) decoded.push(row);
1109
+ if (decoded.length >= cap) break;
1109
1110
  }
1110
1111
  if (decoded.length === 0) return column.slice(0, cap);
1111
1112
  return [...column, ...decoded].toSorted((a, b) => (b.sentAt ?? -Infinity) - (a.sentAt ?? -Infinity)).slice(0, cap);
@@ -1752,19 +1753,15 @@ var AppleMessagesClient = class {
1752
1753
  */
1753
1754
  async saveAttachment(attachmentId, opts = {}) {
1754
1755
  const { source, meta } = this.#resolveStoreAttachment(attachmentId);
1755
- const dest = resolve(this.#config.attachmentDir);
1756
- const dir = opts.directory ? resolve(dest, opts.directory) : dest;
1757
- if (dir !== dest && !dir.startsWith(dest + sep)) throw new PreconditionError(`Refusing to write outside ${dest}. Set APPLE_MESSAGES_ATTACHMENT_DIR to change the destination.`);
1758
- const name = basename(meta.transferName ?? basename(source));
1759
- const target = resolve(join(dir, name));
1760
- if (target !== join(dir, name) || !target.startsWith(dir + sep)) throw new PreconditionError(`Refusing to write outside ${dir}.`);
1761
- if (existsSync(target) && !opts.overwrite) throw new PreconditionError(`${target} already exists; refusing to overwrite it.`);
1762
- const bytes = readFileSync(source);
1763
- mkdirSync(dir, { recursive: true });
1764
- writeFileSync(target, bytes, { mode: 384 });
1765
1756
  return {
1766
- path: target,
1767
- bytes: bytes.length,
1757
+ ...writeConfinedFile({
1758
+ root: this.#config.attachmentDir,
1759
+ directory: opts.directory,
1760
+ name: meta.transferName ?? basename(source),
1761
+ bytes: () => readFileSync(source),
1762
+ overwrite: opts.overwrite ?? false,
1763
+ settingName: "APPLE_MESSAGES_ATTACHMENT_DIR"
1764
+ }),
1768
1765
  source,
1769
1766
  mimeType: meta.mimeType
1770
1767
  };
@@ -2140,7 +2137,6 @@ const loadConfig$1 = (env = process.env) => parseConfig(ConfigSchema, {
2140
2137
  allowWrites: parseBool(env.APPLE_MESSAGES_ALLOW_WRITES),
2141
2138
  exposePrompts: parseBool(env.APPLE_MESSAGES_EXPOSE_PROMPTS),
2142
2139
  lazyTools: parseBool(env.APPLE_MESSAGES_LAZY_TOOLS),
2143
- debug: parseBool(env.APPLE_MESSAGES_DEBUG),
2144
2140
  storePath: trimmed(env.APPLE_MESSAGES_STORE),
2145
2141
  indexMode: trimmed(env.APPLE_MESSAGES_INDEX_MODE),
2146
2142
  resolveContacts: parseBool(env.APPLE_MESSAGES_RESOLVE_CONTACTS),
@@ -2337,11 +2333,11 @@ const buildDiagnostics = async (client) => {
2337
2333
  const status = client.status();
2338
2334
  const writes = client.config.allowWrites;
2339
2335
  return {
2340
- server: {
2341
- name: BUILD_INFO.name,
2342
- version: BUILD_INFO.version
2343
- },
2344
- settings: { exposePrompts: client.config.exposePrompts },
2336
+ ...buildBaseDiagnostics({
2337
+ build: BUILD_INFO,
2338
+ config: client.config,
2339
+ allowWrites: writes
2340
+ }),
2345
2341
  lane: {
2346
2342
  reads: "file lane (read-only SQLite)",
2347
2343
  writes: writes ? "apple_messages_send_message, over Apple Events. The only mutating command the Messages dictionary offers." : "off — APPLE_MESSAGES_ALLOW_WRITES is not set, so the send tool is not registered and this server sends no Apple Event at all.",
@@ -2744,4 +2740,4 @@ const createServer = (opts) => {
2744
2740
  //#endregion
2745
2741
  export { MESSAGES_SURFACE as A, toAppleSeconds as B, locateStore as C, ChatNotFoundError as D, AppleMessagesError as E, SendTargetNotFoundError as F, CORE_DATA_EPOCH_OFFSET as I, appleSecondsSql as L, MessagesUnavailableError as M, SchemaDriftError$1 as N, IndexUnavailableError$1 as O, SendFailedError as P, fromAppleSeconds as R, defaultStorePath as S, PRELUDE as T, BUILD_INFO as V, decodeMessageRef as _, loadConfig$1 as a, ATTACHMENTS_RELATIVE as b, introspect as c, decodeAttributedBody as d, outline as f, decodeChatRef as g, MESSAGE_REF_VERSION as h, registerTools as i, MessageNotFoundError as j, MESSAGES_BUNDLE_ID as k, openStore as l, InvalidMessageRefError as m, SERVER_VERSION as n, AppleMessagesClient as o, CHAT_REF_VERSION as p, createServer as r, MessagesStore as s, SERVER_NAME as t, reactionLabel as u, encodeChatRef as v, SEND_MESSAGE as w, STORE_RELATIVE as x, encodeMessageRef as y, renderInstant as z };
2746
2742
 
2747
- //# sourceMappingURL=server-zO2kScTE.js.map
2743
+ //# sourceMappingURL=server-OgcrDAq5.js.map