pronto-imessage 0.1.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 ADDED
@@ -0,0 +1,50 @@
1
+ # pronto-imessage
2
+
3
+ `pronto-imessage` is Pronto's reusable, in-process interface to local Apple Messages on macOS. It owns the `imsg` JSON-RPC child process, capability qualification, provider-event normalization, watch notifications, exact-chat reply routing, and local delivery outcomes. It does not launch agents, interpret activation tags, or grant access to consumer resources.
4
+
5
+ ```ts
6
+ import { createProntoMessages } from "pronto-imessage";
7
+
8
+ const messages = createProntoMessages({
9
+ imsgPath: "/opt/homebrew/bin/imsg",
10
+ // Use an owner-private stable value of at least 32 bytes when queued work
11
+ // must retain an exact conversation reference across a process restart.
12
+ referenceKey: process.env.PRONTO_MESSAGES_REFERENCE_KEY,
13
+ statePath: "/private/application-state/provider-state.json",
14
+ });
15
+ await messages.qualify();
16
+
17
+ const subscription = await messages.subscribe({
18
+ onEvent: async (event) => {
19
+ if (event.message.fromMe) return;
20
+ const page = await messages.history({
21
+ conversation: event.conversation,
22
+ budget: {
23
+ maxMessages: 30,
24
+ maxRows: 30,
25
+ maxBytes: 2 * 1024 * 1024,
26
+ maxRpcCalls: 1,
27
+ },
28
+ mode: "recent",
29
+ includeReactions: true,
30
+ });
31
+ await messages.reply({
32
+ conversation: event.conversation,
33
+ text: `Reply to this exact conversation (${page.messages.length} context rows)`,
34
+ });
35
+ },
36
+ onRecovery: async (outcome) => {
37
+ if (outcome.status === "degraded") {
38
+ // Continue with live events and surface outcome.reason to the owner.
39
+ }
40
+ },
41
+ });
42
+ ```
43
+
44
+ The package binds durable checkpoints to a fingerprint of the current Messages database. It restarts and resubscribes after provider failure, performs catch-up within row-count, age, and wall-clock limits, and reports privacy-safe recovery diagnostics. A send that may have reached the provider is returned as `ambiguous` and is never automatically replayed.
45
+
46
+ Every observed conversation carries a module-issued, versioned, tamper-evident reference with an expiry. References are process-local by default. A consumer with durable queued work can provide a stable owner-private `referenceKey` of at least 32 bytes; that permits an unexpired observed reference to be revalidated after restart without granting access to a different chat. Rotating the key invalidates outstanding references. History requires that exact reference plus an explicit message, row, byte, and RPC-call budget. Pagination continuations remain bound to the same conversation capability and database generation. They cannot be used to search another conversation.
47
+
48
+ Attachment metadata never exposes the Messages source path. Available attachments carry an expiring sealed reference. `materializeAttachment` revalidates the conversation, database generation, provider metadata, containment under the Messages attachments root, regular-file identity, size, and MIME evidence before copying bytes into owner-private scratch. The returned scratch file has an explicit `dispose()` lifecycle.
49
+
50
+ The package root exposes normalized, versioned provider facts and delivery outcomes. Raw JSON-RPC methods, database paths, and payloads remain internal. The package is standard ESM and supports current Node.js and Bun consumers; the standalone `pronto` CLI is one ordinary workspace consumer.
@@ -0,0 +1,4 @@
1
+ import type { CreateProntoMessagesOptions, ProntoMessages } from "./types.js";
2
+ export type { ConversationFacts, ConversationReference, AttachmentReference, CreateProntoMessagesOptions, DeliveryOutcome, MessagesAttachment, MessagesEvent, MessagesHistoryBudget, MessagesHistoryPage, MessagesDiagnostics, MessagesQualification, MessagesRecoveryOutcome, MessagesRecoveryLimits, MessagesRecoveryReason, MessagesScopeLimits, MessagesSubscription, ProntoMessages, MaterializedAttachment, } from "./types.js";
3
+ export declare function createProntoMessages(input: CreateProntoMessagesOptions): ProntoMessages;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAEV,2BAA2B,EAS3B,cAAc,EACf,MAAM,YAAY,CAAC;AAEpB,YAAY,EACV,iBAAiB,EACjB,qBAAqB,EACrB,mBAAmB,EACnB,2BAA2B,EAC3B,eAAe,EACf,kBAAkB,EAClB,aAAa,EACb,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,uBAAuB,EACvB,sBAAsB,EACtB,sBAAsB,EACtB,mBAAmB,EACnB,oBAAoB,EACpB,cAAc,EACd,sBAAsB,GACvB,MAAM,YAAY,CAAC;AAywBpB,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,2BAA2B,GAAG,cAAc,CAEvF"}