@joe-broadhead/opencode-mem 0.12.0 → 0.12.2

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 (51) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/docs/agent-protocol.md +1 -1
  3. package/package.json +1 -1
  4. package/src/collector.js +11 -1
  5. package/src/plugins/source-contract/index.js +2 -2
  6. package/src/plugins/source-contract/policy.js +3 -7
  7. package/src/plugins/source-contract/vendor/PROVENANCE.json +8 -8
  8. package/src/plugins/source-contract/vendor/RELEASE-SHA256SUMS +3 -3
  9. package/src/plugins/source-contract/vendor/RELEASE.json +9 -9
  10. package/src/plugins/source-contract/vendor/SHA256SUMS +28 -28
  11. package/src/plugins/source-contract/vendor/broker-client.js +14 -14
  12. package/src/plugins/source-contract/vendor/chunks/{chunk-Q3RQA5J2.js → chunk-77MJETEE.js} +9 -9
  13. package/src/plugins/source-contract/vendor/chunks/{chunk-6HDIB2SA.js → chunk-BOUWB5UP.js} +2 -2
  14. package/src/plugins/source-contract/vendor/chunks/{chunk-KYWBTAF4.js → chunk-EHIOPXPL.js} +9 -8
  15. package/src/plugins/source-contract/vendor/chunks/{chunk-RYNKNCPP.js → chunk-F4K2Y64D.js} +1 -1
  16. package/src/plugins/source-contract/vendor/chunks/{chunk-RRUAIQ4I.js → chunk-HVBOAYBO.js} +43 -9
  17. package/src/plugins/source-contract/vendor/chunks/{chunk-ELPJD3ND.js → chunk-IL565TRX.js} +1 -1
  18. package/src/plugins/source-contract/vendor/chunks/{chunk-W5SHR7DQ.js → chunk-JUWIMDGF.js} +2 -2
  19. package/src/{vendor/source-contract/chunks/chunk-I2RXJJJM.js → plugins/source-contract/vendor/chunks/chunk-NUEROZNU.js} +1 -1
  20. package/src/plugins/source-contract/vendor/chunks/{chunk-3M5PAKSS.js → chunk-OZMX7VR7.js} +22 -2
  21. package/src/plugins/source-contract/vendor/chunks/{chunk-HLVAKAYG.js → chunk-T4QM7B3S.js} +1 -1
  22. package/src/plugins/source-contract/vendor/chunks/{chunk-KWEWSZ4V.js → chunk-X6XP7YK2.js} +24 -4
  23. package/src/plugins/source-contract/vendor/chunks/{chunk-4ERCA4TK.js → chunk-XVA6H6OO.js} +2 -2
  24. package/src/plugins/source-contract/vendor/chunks/{chunk-ZUKF7P6U.js → chunk-YH323FAZ.js} +51 -10
  25. package/src/plugins/source-contract/vendor/cursor.js +3 -3
  26. package/src/plugins/source-contract/vendor/descriptor.js +11 -11
  27. package/src/plugins/source-contract/vendor/events.js +9 -5
  28. package/src/plugins/source-contract/vendor/index.js +3 -3
  29. package/src/plugins/source-contract/vendor/params.js +3 -3
  30. package/src/plugins/source-contract/vendor/permission.js +9 -3
  31. package/src/plugins/source-contract/vendor/pick.js +5 -5
  32. package/src/plugins/source-contract/vendor/read.js +14 -14
  33. package/src/plugins/source-contract/vendor/registry.js +4 -4
  34. package/src/plugins/source-contract/vendor/schema.js +8 -8
  35. package/src/plugins/source-contract/vendor/schemas/sources.json +158 -4
  36. package/src/plugins/source-contract/vendor/schemas.js +9 -9
  37. package/src/plugins/source-contract/vendor/tools-rpc.js +4 -4
  38. package/src/tools/share.js +1 -1
  39. package/src/vendor/source-contract/README.md +6 -5
  40. package/src/vendor/source-contract/VENDOR.json +46 -46
  41. package/src/vendor/source-contract/chunks/{chunk-6HDIB2SA.js → chunk-BOUWB5UP.js} +2 -2
  42. package/src/vendor/source-contract/chunks/{chunk-W5SHR7DQ.js → chunk-JUWIMDGF.js} +2 -2
  43. package/src/{plugins/source-contract/vendor/chunks/chunk-I2RXJJJM.js → vendor/source-contract/chunks/chunk-NUEROZNU.js} +1 -1
  44. package/src/vendor/source-contract/chunks/{chunk-3M5PAKSS.js → chunk-OZMX7VR7.js} +22 -2
  45. package/src/vendor/source-contract/chunks/{chunk-HLVAKAYG.js → chunk-T4QM7B3S.js} +1 -1
  46. package/src/vendor/source-contract/chunks/{chunk-KWEWSZ4V.js → chunk-X6XP7YK2.js} +24 -4
  47. package/src/vendor/source-contract/chunks/{chunk-ZUKF7P6U.js → chunk-YH323FAZ.js} +51 -10
  48. package/src/vendor/source-contract/cursor.js +3 -3
  49. package/src/vendor/source-contract/events.js +9 -5
  50. package/src/vendor/source-contract/registry.js +4 -4
  51. package/src/vendor/source-contract/tools-rpc.js +4 -4
package/CHANGELOG.md CHANGED
@@ -3,6 +3,50 @@
3
3
  The format follows Keep a Changelog 1.1.0: one `## [x.y.z] - date` section per
4
4
  release.
5
5
 
6
+ ## [0.12.2] - 2026-11-17
7
+
8
+ ### Changed
9
+
10
+ - Memory reads the source contract's `v0.2.0` release, vendored in all three copies in place of
11
+ `v0.1.0`. Each vendored file is checked against the release's `SHA256SUMS`.
12
+ - The checks the contract tightened apply: a probe's `owner.id` must be scheme-qualified,
13
+ `ACCOUNT_UNKNOWN` is read as `ACCOUNT_MISMATCH` by the package itself, and a rules-only source is
14
+ checked like any other.
15
+
16
+ ### Added
17
+
18
+ - A plugin may now send the keys `v0.2.0` adds: `removals[]` on a page, an owner with
19
+ `verified: false`, `accounts.server`, `permission.identityRules`, `permission.readsIdentity`, a
20
+ price's `conditions` and `min`, `noExpiry`, and an empty `permission.identity`.
21
+ - A page's `removals[]` retracts what Memory drew from each removed item, through the same
22
+ retraction as the label rule, which still holds for plugins that send nothing else. Only an event
23
+ Memory holds, for the page's own source and account, is retracted, and a repeated removal
24
+ retracts nothing twice. A removal is held to the contract's own `removalProblems`, so its id may
25
+ be as long as an event's: 512 characters.
26
+
27
+ ### Deploy
28
+
29
+ The records service needs a deploy before a plugin sends `removals[]` to it: records only, with no
30
+ migration. Every other new key is read by the plugin alone, so it needs no deploy.
31
+
32
+ ## [0.12.1] - 2026-11-17
33
+
34
+ ### Fixed
35
+
36
+ - `mem_share`'s opening now names `revoke` and says it takes the `grant_id` that `list` returns, so
37
+ taking access back no longer reads the page first. The catalogue's first 117 characters said
38
+ "grant ... copy" and left revoke to the rest of the description: `tool-share-revoke` failed 0/3
39
+ on its call budget in 0.12.0, every attempt after a page list or a page read, and 2/3 passed in
40
+ 0.11.3. Rule 10 keeps its meaning, and the description is 4 characters shorter.
41
+ - The removal worker's slice and tick bounds are read on a clock the store accepts, so
42
+ `RM-drain-slices-bounded` and `RM-slice-yields-under-budget` measure the bound in readings, not
43
+ the runner's wall time. Both failed once on a slow CI runner during 0.12.0's release.
44
+
45
+ ### Deploy
46
+
47
+ No server behaviour change and no migration. The records store takes an injected scheduling clock
48
+ for its tests, and production uses the real one, so there is nothing to deploy.
49
+
6
50
  ## [0.12.0] - 2026-11-16
7
51
 
8
52
  Includes 0.11.4.
@@ -32,7 +32,7 @@ inside `execute`, same arguments.
32
32
  | `mem_page` | `action` | read-only: `list`, `read`, `links`, `history`, `export`; writes: `write`, `append`, `replace`, `move`, `delete` | `path`, `prefix`, `type`, `title`, `content`, `section`, `to`, `depth`, `confirm`, `space` | Pages: one per person, project, team, topic, runbook or decision, linked with [[path]]; documents are mem_wiki. |
33
33
  | `mem_commitments` | `action` | read-only: `list`; writes: `add`, `update`, `delete` | `id`, `what`, `owner`, `due`, `trigger`, `state` (`open`, `done`, `cancelled`, `all`), `project`, `link`, `due_before` | Commitments: things someone will do, with a due date or a trigger. |
34
34
  | `mem_wiki` | `action` | read-only: `list`, `search`, `read`, `status`; writes: `create`, `write`, `append`, `delete` | `query`, `knowledge_id`, `wiki_id`, `name`, `filename`, `content`, `ingest`, `ref`, `confirm`, `path`, `visibility` (`auto`, `private`, `team`), `type` (`wiki`, `code-graph`, `all`), `space` | Documents: uploads, repositories and their pages. |
35
- | `mem_share` | `action` | read-only: `list`; writes: `grant`, `revoke`, `transfer`, `copy`, `move` | `path`, `ids`, `to`, `role` (`viewer`, `editor`), `expires`, `space`, `rationale`, `keep`, `grant_id` | Who may see what, only when the person asks: grant pages or folders, or copy memories to a shared space. |
35
+ | `mem_share` | `action` | read-only: `list`; writes: `grant`, `revoke`, `transfer`, `copy`, `move` | `path`, `ids`, `to`, `role` (`viewer`, `editor`), `expires`, `space`, `rationale`, `keep`, `grant_id` | Grant or revoke a page or folder in a space, only when the person asks: revoke takes grant_id from list. |
36
36
  | `mem_spaces` | `action` | read-only: `current`, `list`, `members`, `access`, `health`, `profile`; writes: `sources`, `jobs`, `review`, `create`, `rename`, `archive`, `leave`, `handover` | `space`, `name`, `user`, `restore`, `bind`, `unbind`, `confirm`, `job`, `decide`, `limit` | Spaces and what flows in. |
37
37
  | `mem_collect` | none | none | `source`, `wait` | Collect new events from the person's bound sources (mail, chat, meetings) into Memory now. |
38
38
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@joe-broadhead/opencode-mem",
3
- "version": "0.12.0",
3
+ "version": "0.12.2",
4
4
  "type": "module",
5
5
  "description": "Durable private and shared-space memory for OpenCode agents",
6
6
  "license": "MIT",
package/src/collector.js CHANGED
@@ -320,6 +320,10 @@ function readDeclaredAnswer(value, entry, account) {
320
320
  more: page.more === true,
321
321
  refused: Array.isArray(page.refused) ? page.refused : [],
322
322
  failed: Array.isArray(page.failed) ? page.failed : [],
323
+ // The events the source says it removed (`removals[]`, contract v0.2.0 #36):
324
+ // `{ external_id, at, reason }`, already checked by the contract's own
325
+ // `removalProblems` inside `acceptAnswer`, and retracted by the store.
326
+ removals: Array.isArray(page.removals) ? page.removals : [],
323
327
  // The page's own echo of what it read: kept, so the store can refuse a page
324
328
  // that read wider than the person confirmed (plugin_scope).
325
329
  scope: isPlainObject(page.scope) ? page.scope : null,
@@ -947,6 +951,8 @@ export function createCollector({ scheduler = null, lister = null, prober = null
947
951
  ...(move.advance && answer.cursor ? { cursor: answer.cursor } : {}),
948
952
  ...(answer.gap ? { gap: answer.gap } : {}),
949
953
  ...(answer.cost ? { cost: answer.cost } : {}),
954
+ // Nothing to read and something removed is the ordinary removal page.
955
+ ...(Array.isArray(answer.removals) && answer.removals.length ? { removals: answer.removals } : {}),
950
956
  })
951
957
  result.pages += 1
952
958
  result.accepted += Number(saved?.accepted) || 0
@@ -956,6 +962,10 @@ export function createCollector({ scheduler = null, lister = null, prober = null
956
962
  // event is counted once (DESIGN-jelly-sources §2.3.1).
957
963
  if (saved?.refused !== undefined) result.refused += Number(saved.refused) || 0
958
964
  if (saved?.newest_refusal) noteRefusal(result, saved.newest_refusal)
965
+ // What the store took for this page: the removals the page named that
966
+ // it retracted or still owes, so the run's result counts them, and the
967
+ // store's own `removals_pending` says what still waits.
968
+ if (Array.isArray(saved?.removals) && saved.removals.length) result.removals = (Number(result.removals) || 0) + saved.removals.length
959
969
  if (saved?.resync === false) {
960
970
  result.error = "the source restarted its window twice today; the binding waits until tomorrow rather than read again blind"
961
971
  result.action = "pause"
@@ -1005,7 +1015,7 @@ export function createCollector({ scheduler = null, lister = null, prober = null
1005
1015
  // The store holds the pause; this run only says whether it took.
1006
1016
  try {
1007
1017
  // An account that is not the bound one says so in the store: the person confirms the right account.
1008
- const needsAccount = failure.code === "ACCOUNT_MISMATCH" || failure.code === "ACCOUNT_UNKNOWN"
1018
+ const needsAccount = failure.code === "ACCOUNT_MISMATCH"
1009
1019
  await pause(
1010
1020
  binding,
1011
1021
  changed
@@ -4,8 +4,8 @@
4
4
  * DESIGN-MEMORY-JOBS §8.3).
5
5
  *
6
6
  * The contract's package is `we-the-rebel-alliance/source-contract`. **It is
7
- * vendored, not depended on** (`vendor/`, the locked v0.1.0 release at
8
- * `381e6c91`, with `PROVENANCE.json` and `SHA256SUMS`), so an install of Memory
7
+ * vendored, not depended on** (`vendor/`, the locked v0.2.0 release at
8
+ * `88bdc1e3`, with `PROVENANCE.json` and `SHA256SUMS`), so an install of Memory
9
9
  * runs no build and there is no runtime dependency. Everything the contract
10
10
  * defines comes from it:
11
11
  *
@@ -55,9 +55,9 @@ export function failureAction(code) {
55
55
  return { action: "hold", reset: "none", resync: false, reason: "the person's budget is spent; retry on the cadence, never at once" }
56
56
  case "RATE_LIMITED":
57
57
  return { action: "hold", reset: "none", resync: false, reason: "the provider rate-limited the read; retry after the delay it gave" }
58
+ // `ACCOUNT_UNKNOWN`, jelly's own word for it, is the package's alias of this
59
+ // code (source-contract#29), so `canonicalCode` has already mapped it here.
58
60
  case "ACCOUNT_MISMATCH":
59
- // jelly's own word for an account that is not the agent's (source-contract#29: an alias, once it merges).
60
- case "ACCOUNT_UNKNOWN":
61
61
  return { action: "pause", reset: "none", resync: false, reason: "the account changed; the person confirms it again" }
62
62
  case "PERMISSION_DENIED":
63
63
  return { action: "pause", reset: "none", resync: false, reason: "a grant the source needs was not confirmed" }
@@ -89,14 +89,10 @@ export function isErrorState(code) {
89
89
  * @param {unknown} error
90
90
  * @returns {{ code: string, message: string, next: string | null }}
91
91
  */
92
- /** jelly's own word for an account that is not the agent's: the package aliases it once #29 merges, and an
93
- * older table does not know it, so Memory reads it as the mismatch it means. */
94
- export const CODE_ALIASES = Object.freeze({ ACCOUNT_UNKNOWN: "ACCOUNT_MISMATCH" })
95
-
96
92
  export function failureFromError(error) {
97
93
  const read = parseSourceError(error)
98
94
  const canonical = canonicalCode(read?.code ?? "") ?? (read?.code || undefined)
99
- const code = canonical === undefined ? "UNAVAILABLE" : CODE_ALIASES[canonical] ?? canonical
95
+ const code = canonical === undefined ? "UNAVAILABLE" : canonical
100
96
  const message = typeof error?.message === "string" && error.message ? error.message : `${code}: the read failed.`
101
97
  return { code, message, next: read?.next ?? null }
102
98
  }
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "package": "@we-the-rebel-alliance/source-contract",
3
3
  "repo": "https://github.com/we-the-rebel-alliance/source-contract",
4
- "version": "0.1.0",
5
- "commit": "8ace21db949557740c6dd8fd837c6efc50c367b7",
6
- "tag": "v0.1.0",
7
- "tagObject": "1bf9466b3d3745900bad4abb1c83f922956887de",
8
- "release": "https://github.com/we-the-rebel-alliance/source-contract/releases/tag/v0.1.0",
9
- "commitNote": "The release's tag: annotated tag v0.1.0 (1bf9466b) on 8ace21db, which is 381e6c91 plus the probe rule of #8 item 1 (#26). Copied from the release tarball's dist/ after verifying the tarball, the conformance kit and the schemas against the release's SHA256SUMS.",
4
+ "version": "0.2.0",
5
+ "commit": "88bdc1e32af83098e06e6fb234ae267d91a4320e",
6
+ "tag": "v0.2.0",
7
+ "tagObject": "6c2eaac8d3cc83886b4916e96f79fe1fd7d6199a",
8
+ "release": "https://github.com/we-the-rebel-alliance/source-contract/releases/tag/v0.2.0",
9
+ "commitNote": "The release's tag: annotated tag v0.2.0 (6c2eaac8) on 88bdc1e, which is v0.1.0 (8ace21db) plus #29-#41. Copied from the release tarball's dist/ after verifying the tarball, the conformance kit and the schemas against the release's SHA256SUMS.",
10
10
  "path": "dist/",
11
11
  "files": 41,
12
12
  "sha256sums": "SHA256SUMS",
13
13
  "releaseSha256sums": "RELEASE-SHA256SUMS",
14
- "manifestSha256": "cd613a1994b45cc1faf459f3c9a4862d3adb6afcfd8c7e149266eb79a60ffbf6",
15
- "vendored": "2026-11-14",
14
+ "manifestSha256": "bad4db73bc6452eb8a50e0d47c3c5d1be4e67099535837cd814cc73d8402219e",
15
+ "vendored": "2026-11-17",
16
16
  "note": "Memory bundles it, so an install runs no build and there is no runtime dependency. dist/*.d.ts are not vendored: Memory reads JavaScript. test/source-contract.test.js checks every file against SHA256SUMS and this manifest hash; test/contract-release.test.js checks them against the release tarball pinned in test/fixtures/contract/."
17
17
  }
@@ -1,3 +1,3 @@
1
- 7ce8140e9c413f1d8bc1956bcac68b733908dd6c02a1f11e6f69e76c8fc3e91d source-contract-0.1.0.tgz
2
- 5761082a10c8f96be0a6e159dcf80cfd7785889befcc4d887d7c2a632e02a113 source-contract-conformance-0.1.0.mjs
3
- e59dc291e40c382880bc4e33c0171a755cd11041b5232b5e1177b8335734a395 source-contract-schemas-0.1.0.json
1
+ d4ca51d3fe8faf1cfa1c105bb31794207b15f0323acb58f6beafdeea52abdbe8 source-contract-0.2.0.tgz
2
+ 2a47f3cfdf49ce648d5af59ba8ef572885897112c8fa2bc586aff4caedc0360f source-contract-conformance-0.2.0.mjs
3
+ 8be41f62e41b0d25a40f558bf275867f45eb1c5d5ed8cc2a6b949b75f7b062bd source-contract-schemas-0.2.0.json
@@ -1,17 +1,17 @@
1
1
  {
2
- "tag": "v0.1.0",
3
- "tagObject": "1bf9466b3d3745900bad4abb1c83f922956887de",
4
- "commit": "8ace21db949557740c6dd8fd837c6efc50c367b7",
5
- "url": "https://github.com/we-the-rebel-alliance/source-contract/releases/tag/v0.1.0",
6
- "published": "2026-11-14T21:53:00Z",
2
+ "tag": "v0.2.0",
3
+ "tagObject": "6c2eaac8d3cc83886b4916e96f79fe1fd7d6199a",
4
+ "commit": "88bdc1e32af83098e06e6fb234ae267d91a4320e",
5
+ "url": "https://github.com/we-the-rebel-alliance/source-contract/releases/tag/v0.2.0",
6
+ "published": "2026-11-17T12:25:18Z",
7
7
  "sha256sums": {
8
8
  "file": "RELEASE-SHA256SUMS",
9
- "sha256": "5a3fe019effbc64be422ddeb0f18c870658fd7a9c20dec059c83d803abbf8124"
9
+ "sha256": "6d30b4c98a363dbb4cfd88be85779503075757226ac429a9c1565d81949e27a8"
10
10
  },
11
11
  "assets": {
12
- "source-contract-0.1.0.tgz": "7ce8140e9c413f1d8bc1956bcac68b733908dd6c02a1f11e6f69e76c8fc3e91d",
13
- "source-contract-conformance-0.1.0.mjs": "5761082a10c8f96be0a6e159dcf80cfd7785889befcc4d887d7c2a632e02a113",
14
- "source-contract-schemas-0.1.0.json": "e59dc291e40c382880bc4e33c0171a755cd11041b5232b5e1177b8335734a395"
12
+ "source-contract-0.2.0.tgz": "d4ca51d3fe8faf1cfa1c105bb31794207b15f0323acb58f6beafdeea52abdbe8",
13
+ "source-contract-conformance-0.2.0.mjs": "2a47f3cfdf49ce648d5af59ba8ef572885897112c8fa2bc586aff4caedc0360f",
14
+ "source-contract-schemas-0.2.0.json": "8be41f62e41b0d25a40f558bf275867f45eb1c5d5ed8cc2a6b949b75f7b062bd"
15
15
  },
16
16
  "pinnedAt": "test/fixtures/contract/"
17
17
  }
@@ -1,30 +1,30 @@
1
1
  1a00d3f937d6c65cd6987bbd0f0da1591d6f423bd7751aedfdc8cdd152bfa04e THIRD-PARTY-NOTICES.md
2
- 0b79307d2d1f33db24d3dd53184a3166627b51dffbdbb81f7cb4cf7a5ecafadd broker-client.js
3
- d5a610aab777cff819b2d4fb4ebc9b4903f14345a1ebe5f52842f41119290f13 chunks/chunk-3M5PAKSS.js
4
- b91fefade14e3988d5817431a0a72476f5f03c8ce40e5c0448034e0572f8975b chunks/chunk-4ERCA4TK.js
5
- a4f9d76b5e98c2994cdd9e2dc9d6ad4f796977fa7a7720519f498cb8996ed047 chunks/chunk-6HDIB2SA.js
6
- d8e1a5c27078e5ce1cfe2ef7e3f6381fffe242e625fa6370251b6fbfc03105ff chunks/chunk-ELPJD3ND.js
7
- d0c7a4785744974cc4cf01af0f21495fc13b5ecea729aa8d162f800f16a56d6f chunks/chunk-HLVAKAYG.js
8
- 6f9f2b56ea30e3aa7629f823cc19b9438b5178f7448e2c292d2b07d28b0bc8e8 chunks/chunk-I2RXJJJM.js
9
- 9789db2ecce07e4ef24e46afe7f0b6669b45e7fe544c9aa302048dcfb20f6c34 chunks/chunk-KWEWSZ4V.js
10
- b2efb36e7e70f930f23d2375f79a825a14ba682b86986ad038588747797743c7 chunks/chunk-KYWBTAF4.js
11
- a4887f98e83f3ecea7ddfd1da9a5518f4c44ac0032f91aa1bdaf057a5bdfa630 chunks/chunk-Q3RQA5J2.js
12
- 1e431825a38c3b8ec14d94b312f9b255b019c151277fc5ae304deafbf43a0729 chunks/chunk-RRUAIQ4I.js
13
- c384c7af7ae1fc1d58999221adc1a4830001fb467b86cdb7678016eea174daaa chunks/chunk-RYNKNCPP.js
14
- 2b17357118874b1052601e8062dc2aa24c182d5a55c2642400cba7572577d151 chunks/chunk-W5SHR7DQ.js
15
- 6971bb13eb9a9ea9a3708d7e99b76292d4f82170c58cdafbd2443e1d47a34153 chunks/chunk-ZUKF7P6U.js
16
- d939fa44dbe5536e0e6bfaf1560b9b1abd2380cb0849fa9361a1b224da986ca3 conformance.js
17
- 28482ff668ec5680fe7c3e38ae7ee87c36da99ee447dbb851d055cdc49b0bea1 cursor.js
18
- 684cf95c0ddfb7d1b4e13c10fe5307a96971771e8e2ca71ab9a992d5deb6ebd2 descriptor.js
19
- ce67038a5d442dd57d554a59eda98adcf726e3d7f5210c544c4e4f78200dd852 events.js
20
- 52208818a550d9317dc263906f9a001bf0b4b56fb3d19319c43fe8fe68a7cc28 index.js
21
- e5168b149699c793eccf1ad4c0f8a07df777aec675f093754ec3194d62c44ca7 params.js
22
- 2ca7ea60b48cab16d5e14fc3f447469ad736f506a9c9a29f22ccef83e292da12 permission.js
23
- 572ab1bd6534215d59f99b774ff1d2dfff399dc94439e45b7ed048ab9ea6bdf1 pick.js
24
- 5890bea19273e20a2c4726f855c66c2470e68c0deb732309b7122b81f02d6081 read.js
25
- 52ac92e7c0bb4c651e42d9a7ae6e7ae029a2c8677dfa240426271bbe4721164f registry.js
26
- 826b66a5c8e44c029795b2db9aaf8bc63092be99b75a6a866705312ed238b11b schema.js
27
- 98fb19d5d3974668d31e949bdbb238b682326b22b8bca6a2b4c5c1105ca3c53f schemas.js
2
+ 32b2940e7c9bbe6b9cbdd777f5eb0dfd8ae6177ec3c76360992a39d0161460ff broker-client.js
3
+ 92f2543c72ad90e59357ffd904c6ab92eba6e062b7acb7dbb54c3ed08bb92620 chunks/chunk-77MJETEE.js
4
+ c1576a886f7d67c8bb5afeb40f9282893e276012861a21f5952fc6a2b17051a4 chunks/chunk-BOUWB5UP.js
5
+ cf4c37cdf92c51a182e5c91f540fcd41dc798a8e90c6c4a9911a0dac4ac54a6c chunks/chunk-EHIOPXPL.js
6
+ 3f460580a07cf2011b3971d00af8306598cd73b59d43844b7610b38917c93bb5 chunks/chunk-F4K2Y64D.js
7
+ 8d4d5b011223794170623f008e3d62a1e397af5bf74ee5ced268399d776177da chunks/chunk-HVBOAYBO.js
8
+ ce20e775c75c7f13ff4c0608510819a57e134b885f33934933fd4a29b79df1e0 chunks/chunk-IL565TRX.js
9
+ 58a2f8598a2120c567ae89f9c2302083164d5271d5de2dcbf9949fb53eecc471 chunks/chunk-JUWIMDGF.js
10
+ a9b21faf6e418d1f484749908123fab5db2843f4eac68978edd01f28e651330e chunks/chunk-NUEROZNU.js
11
+ 02119d5b15c6dc03306a1f5fcfd0ede841a252a94137a47ad18c438d7fe46782 chunks/chunk-OZMX7VR7.js
12
+ 847c456d855db47ca014344b0a7d38af2050675d3bd3e22cdfa02254985417d2 chunks/chunk-T4QM7B3S.js
13
+ 1edd6b1242779f4d604ed9010dfc35a05fd112eab1186b218e06c2d45096ede7 chunks/chunk-X6XP7YK2.js
14
+ a73cbef67fd6b6d9b40e77d88038ca74e1398990614732d0b3b714a76fc94071 chunks/chunk-XVA6H6OO.js
15
+ 7fc90ad68ef25be1633cc86a0f59f08cab04f27fed562eac43ac5532772acc5d chunks/chunk-YH323FAZ.js
16
+ f64e742976a4c3a9442305eb735532716c86bb049de0a7ef90dcf53518c5c88d conformance.js
17
+ fd1cfd69b0d5765ccdcd0b451d51f7a422c5c87f89465f73da24e938339665e1 cursor.js
18
+ 1c182a6594c02af158b2104c967e76eb09acb3342157326ac71204ffa6fe2e77 descriptor.js
19
+ 40829989df80afa24b5c4313b66dc9dfd22dcd6296ae23da3b7d747329d4f65a events.js
20
+ 7b690aa81cb7967ace45c9fb6fe319540387b06ad7366e69170955abb24f1ecc index.js
21
+ 624ff0a0afbb2359491f5e808365232a0c49852acb3f95de64cbf0f126f54aa4 params.js
22
+ 0d1cedeec5d097753dcb50a40de7e0e0fccd102f96a3688785dfa2550cccd778 permission.js
23
+ 66fb3d6b18732cca8ce5d8470b3b2dc9310cc5a29c98f7d76c5c8bbdccadad27 pick.js
24
+ f5f4cb67818fa346f45199356a0ab7ff6e1eb2c859a7cdfc0a65141b41a072f8 read.js
25
+ 89b6e892ed4f36774e5e455220305d29f9a0bcd8ca3ad38fab0855d1458f4b91 registry.js
26
+ 4ad50a25cd4cb4561d983b94d169e4a453d76be35b013d73b79f48e9a1e26b4c schema.js
27
+ 49c63338b4bcd3de82f1702d4a79c16f9ecd57bdee8d72cd7650b4dee7836c62 schemas.js
28
28
  afdcaa972b3294394883025d8c531ff51d4117cb8f5d2240b5f55319cf646b10 schemas/output.agenda.json
29
29
  2bb069201056c91056b3590417918970e3b79950df39f45f1537cc59eb3b9933 schemas/output.countdown.json
30
30
  b162cf16515ffb3eb324c4cc62d9898e6c894ba882d91af60025b60cf33129f9 schemas/output.image.json
@@ -37,5 +37,5 @@ aa806aeb1f800c179648c7d3ad2d2ee67fa3c39977087d6f03c733ad28d14dcd schemas/output
37
37
  30fbb81a6f8df5d0601e428f2503eb726eca603cc350805852dc7c909a9b59a1 schemas/output.record.json
38
38
  3d9695004dbf803576efcca0ff5bcef94af2d9475131db2fc694f974bc217dae schemas/output.table.json
39
39
  ffaaaa5107a2a6b7b36230e2e458383591b687af77c1be2e1876194bdeb40f90 schemas/output.thread.json
40
- 160d6c9fff25809ae4eaa4d3d2275b7048b57e5606bf277e6924d6064dd1ca95 schemas/sources.json
41
- bdac6baf1f7fa35fa800aa59269aaee22e770a76247b81f324b2d263a75447a1 tools-rpc.js
40
+ b94a3e678154aafd9fa206d46fb1dfa93e6cdbd2f6eb27ef7391f99c95dce9d2 schemas/sources.json
41
+ 2a27cbb7910bab01fe52f128141202a7ca26cc45fa2b6ae55dc28377e92e1fd1 tools-rpc.js
@@ -1,24 +1,24 @@
1
- // @we-the-rebel-alliance/source-contract 0.1.0. Built by scripts/build.mjs; do not edit.
1
+ // @we-the-rebel-alliance/source-contract 0.2.0. Built by scripts/build.mjs; do not edit.
2
2
  import {
3
3
  acceptAnswer,
4
4
  checkReadRequest,
5
5
  failureFromError,
6
6
  read
7
- } from "./chunks/chunk-Q3RQA5J2.js";
8
- import "./chunks/chunk-KYWBTAF4.js";
9
- import "./chunks/chunk-RRUAIQ4I.js";
10
- import "./chunks/chunk-KWEWSZ4V.js";
11
- import "./chunks/chunk-ELPJD3ND.js";
12
- import "./chunks/chunk-ZUKF7P6U.js";
7
+ } from "./chunks/chunk-77MJETEE.js";
8
+ import "./chunks/chunk-EHIOPXPL.js";
9
+ import "./chunks/chunk-HVBOAYBO.js";
10
+ import "./chunks/chunk-X6XP7YK2.js";
11
+ import "./chunks/chunk-IL565TRX.js";
12
+ import "./chunks/chunk-YH323FAZ.js";
13
13
  import {
14
14
  canonicalScope
15
- } from "./chunks/chunk-I2RXJJJM.js";
16
- import "./chunks/chunk-RYNKNCPP.js";
17
- import "./chunks/chunk-3M5PAKSS.js";
18
- import "./chunks/chunk-4ERCA4TK.js";
19
- import "./chunks/chunk-6HDIB2SA.js";
20
- import "./chunks/chunk-W5SHR7DQ.js";
21
- import "./chunks/chunk-HLVAKAYG.js";
15
+ } from "./chunks/chunk-NUEROZNU.js";
16
+ import "./chunks/chunk-F4K2Y64D.js";
17
+ import "./chunks/chunk-OZMX7VR7.js";
18
+ import "./chunks/chunk-XVA6H6OO.js";
19
+ import "./chunks/chunk-BOUWB5UP.js";
20
+ import "./chunks/chunk-JUWIMDGF.js";
21
+ import "./chunks/chunk-T4QM7B3S.js";
22
22
 
23
23
  // src/broker-client.ts
24
24
  var BROKER_CODE_ALIASES = {
@@ -1,35 +1,35 @@
1
- // @we-the-rebel-alliance/source-contract 0.1.0. Built by scripts/build.mjs; do not edit.
1
+ // @we-the-rebel-alliance/source-contract 0.2.0. Built by scripts/build.mjs; do not edit.
2
2
  import {
3
3
  findSource,
4
4
  maxBytesOf
5
- } from "./chunk-KYWBTAF4.js";
5
+ } from "./chunk-EHIOPXPL.js";
6
6
  import {
7
7
  ERROR_CODES,
8
8
  PAGE,
9
9
  canonicalCode,
10
10
  probeResultProblems,
11
11
  resultProblems
12
- } from "./chunk-ZUKF7P6U.js";
12
+ } from "./chunk-YH323FAZ.js";
13
13
  import {
14
14
  canonicalScope
15
- } from "./chunk-I2RXJJJM.js";
15
+ } from "./chunk-NUEROZNU.js";
16
16
  import {
17
17
  resolveParams,
18
18
  resolveSince
19
- } from "./chunk-RYNKNCPP.js";
19
+ } from "./chunk-F4K2Y64D.js";
20
20
  import {
21
21
  detailRules,
22
22
  grantCovers,
23
23
  probeRules,
24
24
  sessionRules
25
- } from "./chunk-3M5PAKSS.js";
25
+ } from "./chunk-OZMX7VR7.js";
26
26
  import {
27
27
  pick,
28
28
  pickProblemsForOutput
29
- } from "./chunk-4ERCA4TK.js";
29
+ } from "./chunk-XVA6H6OO.js";
30
30
  import {
31
31
  checkOutput
32
- } from "./chunk-6HDIB2SA.js";
32
+ } from "./chunk-BOUWB5UP.js";
33
33
 
34
34
  // src/internal/failure.ts
35
35
  var FAILURE_CODES = ERROR_CODES;
@@ -213,7 +213,7 @@ async function readDetail(host, request) {
213
213
  async function probe(host, request) {
214
214
  const source = findSource(request.installed.sources, request.source);
215
215
  if (!source) return { ok: false, failure: failure("UNAVAILABLE", `${request.installed.package} declares no source ${request.source}`, "Check the source id.") };
216
- const declared = source.permission.identity;
216
+ const declared = source.permission.identity ?? (source.permission.identityRules !== void 0 ? [] : void 0);
217
217
  const identity = declared ?? request.identityOperations;
218
218
  if (identity === void 0) {
219
219
  return { ok: false, failure: failure("PERMISSION_DENIED", `${source.id} declares no identity operations, and none were given`, "Declare permission.identity in the source, or pass the identity operations.") };
@@ -1,4 +1,4 @@
1
- // @we-the-rebel-alliance/source-contract 0.1.0. Built by scripts/build.mjs; do not edit.
1
+ // @we-the-rebel-alliance/source-contract 0.2.0. Built by scripts/build.mjs; do not edit.
2
2
  import {
3
3
  _enum,
4
4
  _null,
@@ -13,7 +13,7 @@ import {
13
13
  string,
14
14
  union,
15
15
  validator
16
- } from "./chunk-W5SHR7DQ.js";
16
+ } from "./chunk-JUWIMDGF.js";
17
17
 
18
18
  // src/registry.ts
19
19
  var text = (max) => string().max(max);
@@ -1,20 +1,20 @@
1
- // @we-the-rebel-alliance/source-contract 0.1.0. Built by scripts/build.mjs; do not edit.
1
+ // @we-the-rebel-alliance/source-contract 0.2.0. Built by scripts/build.mjs; do not edit.
2
2
  import {
3
3
  SOURCES_SCHEMA
4
- } from "./chunk-RRUAIQ4I.js";
4
+ } from "./chunk-HVBOAYBO.js";
5
5
  import {
6
6
  SUPPORTED_CONTRACT_VERSIONS
7
- } from "./chunk-ELPJD3ND.js";
7
+ } from "./chunk-IL565TRX.js";
8
8
  import {
9
9
  EVENT_KINDS,
10
10
  MAX_BYTES,
11
11
  isEventKind
12
- } from "./chunk-ZUKF7P6U.js";
12
+ } from "./chunk-YH323FAZ.js";
13
13
  import {
14
14
  OUTPUT_NAMES,
15
15
  isExtensionOutput,
16
16
  isOutputName
17
- } from "./chunk-6HDIB2SA.js";
17
+ } from "./chunk-BOUWB5UP.js";
18
18
  import {
19
19
  _enum,
20
20
  array,
@@ -26,7 +26,7 @@ import {
26
26
  record,
27
27
  string,
28
28
  unknown
29
- } from "./chunk-W5SHR7DQ.js";
29
+ } from "./chunk-JUWIMDGF.js";
30
30
 
31
31
  // src/descriptor.ts
32
32
  import { createHash } from "node:crypto";
@@ -52,7 +52,7 @@ var item = looseObject({
52
52
  reads: string().refine(isEventKind, `must be an event kind: ${EVENT_KINDS.join(", ")}, or x-<plugin>/<kind>`).optional(),
53
53
  output: string().optional(),
54
54
  params: record(string(), looseObject({ relative: boolean().optional(), me: boolean().optional() })).optional(),
55
- accounts: looseObject({ named: boolean().optional() }).optional(),
55
+ accounts: looseObject({ named: boolean().optional(), server: string().max(64).optional() }).optional(),
56
56
  scope: looseObject({ keys: array(string().regex(/^[a-z][a-zA-Z0-9_-]{0,39}$/)).min(1), describe: string().max(200).optional() }).optional(),
57
57
  details: array(
58
58
  looseObject({
@@ -67,7 +67,8 @@ var item = looseObject({
67
67
  operations: array(operation).min(1, "must name at least one operation: grants and off switches key on them").optional(),
68
68
  // A provider whose resources are method-and-path (GitHub's `github_api` on `GET /user`) states its grants
69
69
  // verbatim; `operationRule` derives from `operations` for every other provider (#4, from the github plugin).
70
- rules: array(object({ action, resource: string().min(1).max(200) })).min(1).optional()
70
+ rules: array(object({ action, resource: string().min(1).max(200) })).min(1).optional(),
71
+ identityRules: array(object({ action, resource: string().min(1).max(200) })).optional()
71
72
  }),
72
73
  private: boolean().optional(),
73
74
  cost: looseObject({ class: _enum(["free", "metered", "billed"]), units: array(price).optional(), probe: price.optional() }),
@@ -1,4 +1,4 @@
1
- // @we-the-rebel-alliance/source-contract 0.1.0. Built by scripts/build.mjs; do not edit.
1
+ // @we-the-rebel-alliance/source-contract 0.2.0. Built by scripts/build.mjs; do not edit.
2
2
 
3
3
  // src/params.ts
4
4
  var MAX_RELATIVE_DAYS = 366;
@@ -1,10 +1,10 @@
1
- // @we-the-rebel-alliance/source-contract 0.1.0. Built by scripts/build.mjs; do not edit.
1
+ // @we-the-rebel-alliance/source-contract 0.2.0. Built by scripts/build.mjs; do not edit.
2
2
  import {
3
3
  isToolsRpcId
4
- } from "./chunk-KWEWSZ4V.js";
4
+ } from "./chunk-X6XP7YK2.js";
5
5
  import {
6
6
  isEventKind
7
- } from "./chunk-ZUKF7P6U.js";
7
+ } from "./chunk-YH323FAZ.js";
8
8
  import {
9
9
  _enum,
10
10
  array,
@@ -19,7 +19,7 @@ import {
19
19
  string,
20
20
  union,
21
21
  validator
22
- } from "./chunk-W5SHR7DQ.js";
22
+ } from "./chunk-JUWIMDGF.js";
23
23
 
24
24
  // src/internal/schema/types.ts
25
25
  var MAX_BYTES_DEFAULT = 65536;
@@ -37,8 +37,14 @@ var PRICE_PER = /^[a-z][a-z0-9-]{0,31}$/;
37
37
  var HOST = /^(?:\*\.)?[A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?(?:\.[A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?)+$/;
38
38
  var price = object({
39
39
  per: string().max(32).regex(PRICE_PER, { error: "must be a lowercase word such as post, author or call" }),
40
- usd: number().min(0)
41
- }).strict().describe("One price unit, in US dollars, from the plugin's own price table.");
40
+ usd: number().min(0),
41
+ conditions: string().min(1).max(200).optional().describe("The short sentence shown at consent when this price applies, such as X app owners only."),
42
+ min: number().min(0).optional().describe("The lowest rate that may apply, in US dollars: at most usd.")
43
+ }).strict().describe("One price unit, in US dollars, from the plugin's own price table.").superRefine((value, ctx) => {
44
+ if (value.min !== void 0 && value.min > value.usd) {
45
+ ctx.addIssue({ code: "custom", path: ["min"], message: "must not exceed usd, the price the source declares" });
46
+ }
47
+ });
42
48
  var units = array(price).min(1);
43
49
  var freeCost = object({
44
50
  class: literal("free"),
@@ -48,7 +54,13 @@ var freeCost = object({
48
54
  var meteredCost = object({ class: literal("metered"), units, probe: price.optional() }).strict();
49
55
  var billedCost = object({ class: literal("billed"), units, probe: price }).strict();
50
56
  var cost = discriminatedUnion("class", [freeCost, meteredCost, billedCost], { error: "must be free, metered or billed" }).describe("What one read costs, including a probe call, which reads no content.");
51
- var accounts = object({ named: boolean().describe("True when the source reads more than one account, so a read names one.") }).strict().describe("Which signed-in accounts a source reads.");
57
+ var ACCOUNT_SERVER = /^[a-z][a-z0-9_-]*\{account\}[a-z0-9_-]*$/;
58
+ var accounts = object({
59
+ named: boolean().describe("True when the source reads more than one account, so a read names one."),
60
+ server: string().max(64).regex(ACCOUNT_SERVER, { error: "must be lowercase words holding {account} once, such as plaud-{account}" }).optional().describe(
61
+ "For a plugin with one MCP server per account (#30, item 9): the server a named account's MCP tools live on, with {account} for the account, such as plaud-{account}. A bare operation is then <server>_<operation> for an account other than default; the default account keeps the namespace."
62
+ )
63
+ }).strict().describe("Which signed-in accounts a source reads.");
52
64
  var scope = object({
53
65
  keys: array(string().max(32).regex(SCOPE_KEY, { error: "must be a lowercase scope key such as channels" })).describe("The scope keys a person confirms: labels, channels, repositories. Empty when there is nothing to choose."),
54
66
  describe: string().max(200).describe("The sentence shown at consent, such as Which labels."),
@@ -65,16 +77,38 @@ var detail = object({
65
77
  from: array(_enum(["external_id", "kind", "occurred_at", "url", "thread", "actors", "labels", "hash"])).min(1).describe("The event fields the detail's input comes from. Identifiers only: an event's title and text are never an input.")
66
78
  }).strict().describe("One read of an event's detail: the tool, and the event fields its input comes from.");
67
79
  var permissionBase = {
68
- identity: array(string().max(200).regex(OPERATION, { error: "must be a provider operation or an MCP tool name" })).min(1).optional().describe("The identity operations probe asserts for this source (#4, #8); each is among permission.operations, and no content read asserts it."),
80
+ identity: array(string().max(200).regex(OPERATION, { error: "must be a provider operation or an MCP tool name" })).optional().describe(
81
+ "The identity operations probe asserts for this source (#4, #8); each is among permission.operations, and no content read asserts it. Empty when the probe asserts only sources.probe.action; absent when the source does not declare it, so a consumer uses its fallback."
82
+ ),
83
+ /**
84
+ * True when the source's content reads legitimately assert an identity operation, such as reading mentions needing
85
+ * the signed-in user's id. Each identity operation is still declared in `permission.identity` and among
86
+ * `permission.operations`. Absent means content reads never assert one.
87
+ */
88
+ readsIdentity: boolean().optional().describe("True when the source's content reads assert an identity operation (#30, item 4); every identity operation is still declared."),
69
89
  operations: array(string().max(200).regex(OPERATION, { error: "must be a provider operation or an MCP tool name" })).min(1).optional().describe("Every operation the source's reads assert, and nothing else. Absent when `rules` states them."),
70
90
  rules: array(
71
91
  object({
72
92
  action: string().max(80).regex(ACTION, { error: "must be a permission action such as github_api" }),
73
93
  resource: string().max(200).describe("The resource the action is asserted on, such as GET /user.")
74
94
  }).strict()
75
- ).min(1).optional().describe("The grants verbatim, for a provider whose resources are not <account>:<operation> (GitHub's github_api on GET /user).")
95
+ ).min(1).optional().describe("The grants verbatim, for a provider whose resources are not <account>:<operation> (GitHub's github_api on GET /user)."),
96
+ identityRules: array(
97
+ object({
98
+ action: string().max(80).regex(ACTION, { error: "must be a permission action such as github_api" }),
99
+ resource: string().max(200).describe("The resource the action is asserted on, such as GET /user.")
100
+ }).strict()
101
+ ).optional().describe(
102
+ "For a rules source: the grants probe asserts for this source, verbatim, each among permission.rules (#30, item 10). Empty when the probe asserts only sources.probe.action; absent when undeclared. A rules source's equivalent of identity."
103
+ )
76
104
  };
77
105
  var permissionEither = (value, ctx) => {
106
+ if (value.identityRules !== void 0 && value.rules === void 0) {
107
+ ctx.addIssue({ code: "custom", path: ["identityRules"], message: "identityRules is for a source that states its rules verbatim; a source with operations declares identity" });
108
+ }
109
+ if (value.identity !== void 0 && value.rules !== void 0) {
110
+ ctx.addIssue({ code: "custom", path: ["identity"], message: "a source that states its rules verbatim declares its probe's grants as identityRules, not identity" });
111
+ }
78
112
  if (value.operations === void 0 && value.rules === void 0) {
79
113
  ctx.addIssue({ code: "custom", message: "a permission states its operations, or its rules verbatim" });
80
114
  }
@@ -1,4 +1,4 @@
1
- // @we-the-rebel-alliance/source-contract 0.1.0. Built by scripts/build.mjs; do not edit.
1
+ // @we-the-rebel-alliance/source-contract 0.2.0. Built by scripts/build.mjs; do not edit.
2
2
 
3
3
  // src/index.ts
4
4
  var CONTRACT_VERSION = 1;
@@ -1,7 +1,7 @@
1
- // @we-the-rebel-alliance/source-contract 0.1.0. Built by scripts/build.mjs; do not edit.
1
+ // @we-the-rebel-alliance/source-contract 0.2.0. Built by scripts/build.mjs; do not edit.
2
2
  import {
3
3
  __export
4
- } from "./chunk-HLVAKAYG.js";
4
+ } from "./chunk-T4QM7B3S.js";
5
5
 
6
6
  // node_modules/zod/v4/classic/schemas.js
7
7
  var schemas_exports2 = {};
@@ -1,4 +1,4 @@
1
- // @we-the-rebel-alliance/source-contract 0.1.0. Built by scripts/build.mjs; do not edit.
1
+ // @we-the-rebel-alliance/source-contract 0.2.0. Built by scripts/build.mjs; do not edit.
2
2
 
3
3
  // src/cursor.ts
4
4
  import { createHash } from "node:crypto";