@proofmeta/resolver-free 0.2.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.
Files changed (3) hide show
  1. package/README.md +43 -0
  2. package/index.mjs +53 -0
  3. package/package.json +36 -0
package/README.md ADDED
@@ -0,0 +1,43 @@
1
+ # @proofmeta/resolver-free
2
+
3
+ Reference "free" resolver for the [ProofMeta Protocol](https://github.com/bettabeta/proofmeta). No-op: confirms instantly, carries no external dependencies. Use it for Tier-1 flows, demos, and integration tests where no real payment or delivery is needed.
4
+
5
+ ## Install
6
+
7
+ ```
8
+ npm install @proofmeta/resolver-free
9
+ ```
10
+
11
+ ## Use
12
+
13
+ ```js
14
+ import { createFreeResolver } from "@proofmeta/resolver-free";
15
+
16
+ const free = createFreeResolver({ id: "none" });
17
+
18
+ // 1. Advertise it in your Manifest
19
+ manifest.resolvers = [free.descriptor];
20
+ // → { role: "payment", id: "none" }
21
+
22
+ // 2. Invoke it when handling an OPEN license request
23
+ const result = await free.process({ request, licenseType });
24
+ // → { ok: true, receipt: { resolver: "free:none", confirmed_at: "..." } }
25
+ ```
26
+
27
+ ## Resolver interface
28
+
29
+ The programming interface below is **not** part of the ProofMeta protocol on the wire — it's the shape the reference Provider (`examples/provider/server.mjs`) expects from a resolver module. Other Providers are free to invent their own calling convention; what matters on the wire is the `{ role, id }` entry in the Manifest and the resulting `status.update` envelopes.
30
+
31
+ ```ts
32
+ {
33
+ descriptor: { role: "payment" | "delivery" | "anchor" | string, id: string },
34
+ process(ctx: { request, licenseType }): Promise<
35
+ { ok: true, receipt?: Record<string, unknown> } |
36
+ { ok: false, reason: string }
37
+ >
38
+ }
39
+ ```
40
+
41
+ ## License
42
+
43
+ Apache-2.0. See [LICENSE](https://github.com/bettabeta/proofmeta/blob/main/LICENSE).
package/index.mjs ADDED
@@ -0,0 +1,53 @@
1
+ // Copyright 2026 Daud Zulfacar, Pandr UG (haftungsbeschränkt)
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ /**
5
+ * @proofmeta/resolver-free — no-op payment resolver.
6
+ *
7
+ * Declares itself as { role: "payment", id: "none" } (or a custom id the
8
+ * Provider chooses). Its `process` hook returns immediately with ok:true,
9
+ * carrying no external side effects. Used for Tier-1 flows and integration
10
+ * tests per Success Criterion #3.
11
+ *
12
+ * The programming interface below is NOT part of the protocol — it's the
13
+ * shape the reference Provider example expects a resolver module to expose.
14
+ * Other Providers are free to invent their own calling convention.
15
+ */
16
+
17
+ /**
18
+ * @typedef {Object} ResolverDescriptor
19
+ * @property {"payment"|"delivery"|"anchor"|string} role
20
+ * @property {string} id
21
+ *
22
+ * @typedef {Object} ProcessResultOK
23
+ * @property {true} ok
24
+ * @property {Record<string, unknown>} [receipt]
25
+ *
26
+ * @typedef {Object} ProcessResultErr
27
+ * @property {false} ok
28
+ * @property {string} reason
29
+ *
30
+ * @typedef {ProcessResultOK|ProcessResultErr} ProcessResult
31
+ *
32
+ * @typedef {Object} ProcessContext
33
+ * @property {Object} request The verified OPEN license.request payload
34
+ * @property {Object} licenseType The Manifest license_types[] entry for this request
35
+ */
36
+
37
+ /**
38
+ * Create a free resolver instance.
39
+ *
40
+ * @param {Object} [opts]
41
+ * @param {string} [opts.id="none"] — id as it will appear in Manifest.resolvers[].id
42
+ * @returns {{ descriptor: ResolverDescriptor, process: (ctx: ProcessContext) => Promise<ProcessResult> }}
43
+ */
44
+ export function createFreeResolver(opts = {}) {
45
+ const id = opts.id ?? "none";
46
+ return {
47
+ descriptor: { role: "payment", id },
48
+ async process(_ctx) {
49
+ // No payment, no external call, no anchor. The license is free.
50
+ return { ok: true, receipt: { resolver: `free:${id}`, confirmed_at: new Date().toISOString() } };
51
+ },
52
+ };
53
+ }
package/package.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "@proofmeta/resolver-free",
3
+ "version": "0.2.0",
4
+ "description": "ProofMeta reference resolver: no-op 'free' payment resolver. Instantly confirms; carries no external dependencies. Used for Tier-1 flows and integration tests.",
5
+ "license": "Apache-2.0",
6
+ "type": "module",
7
+ "main": "./index.mjs",
8
+ "exports": {
9
+ ".": "./index.mjs"
10
+ },
11
+ "files": [
12
+ "index.mjs",
13
+ "README.md"
14
+ ],
15
+ "keywords": [
16
+ "proofmeta",
17
+ "resolver",
18
+ "free",
19
+ "licensing",
20
+ "agents",
21
+ "ai",
22
+ "protocol"
23
+ ],
24
+ "repository": {
25
+ "type": "git",
26
+ "url": "git+https://github.com/bettabeta/proofmeta.git",
27
+ "directory": "packages/resolvers/free"
28
+ },
29
+ "homepage": "https://github.com/bettabeta/proofmeta#readme",
30
+ "bugs": {
31
+ "url": "https://github.com/bettabeta/proofmeta/issues"
32
+ },
33
+ "publishConfig": {
34
+ "access": "public"
35
+ }
36
+ }