@joe-broadhead/opencode-mem 0.12.1 → 0.12.3
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/CHANGELOG.md +45 -0
- package/package.json +1 -1
- package/src/collector-service.js +1 -1
- package/src/collector.js +75 -21
- package/src/plugins/locate.js +15 -4
- package/src/plugins/source-contract/index.js +2 -2
- package/src/plugins/source-contract/policy.js +3 -7
- package/src/plugins/source-contract/vendor/PROVENANCE.json +8 -8
- package/src/plugins/source-contract/vendor/RELEASE-SHA256SUMS +3 -3
- package/src/plugins/source-contract/vendor/RELEASE.json +9 -9
- package/src/plugins/source-contract/vendor/SHA256SUMS +28 -28
- package/src/plugins/source-contract/vendor/broker-client.js +14 -14
- package/src/plugins/source-contract/vendor/chunks/{chunk-Q3RQA5J2.js → chunk-77MJETEE.js} +9 -9
- package/src/plugins/source-contract/vendor/chunks/{chunk-6HDIB2SA.js → chunk-BOUWB5UP.js} +2 -2
- package/src/plugins/source-contract/vendor/chunks/{chunk-KYWBTAF4.js → chunk-EHIOPXPL.js} +9 -8
- package/src/plugins/source-contract/vendor/chunks/{chunk-RYNKNCPP.js → chunk-F4K2Y64D.js} +1 -1
- package/src/plugins/source-contract/vendor/chunks/{chunk-RRUAIQ4I.js → chunk-HVBOAYBO.js} +43 -9
- package/src/plugins/source-contract/vendor/chunks/{chunk-ELPJD3ND.js → chunk-IL565TRX.js} +1 -1
- package/src/plugins/source-contract/vendor/chunks/{chunk-W5SHR7DQ.js → chunk-JUWIMDGF.js} +2 -2
- package/src/{vendor/source-contract/chunks/chunk-I2RXJJJM.js → plugins/source-contract/vendor/chunks/chunk-NUEROZNU.js} +1 -1
- package/src/plugins/source-contract/vendor/chunks/{chunk-3M5PAKSS.js → chunk-OZMX7VR7.js} +22 -2
- package/src/plugins/source-contract/vendor/chunks/{chunk-HLVAKAYG.js → chunk-T4QM7B3S.js} +1 -1
- package/src/plugins/source-contract/vendor/chunks/{chunk-KWEWSZ4V.js → chunk-X6XP7YK2.js} +24 -4
- package/src/plugins/source-contract/vendor/chunks/{chunk-4ERCA4TK.js → chunk-XVA6H6OO.js} +2 -2
- package/src/plugins/source-contract/vendor/chunks/{chunk-ZUKF7P6U.js → chunk-YH323FAZ.js} +51 -10
- package/src/plugins/source-contract/vendor/cursor.js +3 -3
- package/src/plugins/source-contract/vendor/descriptor.js +11 -11
- package/src/plugins/source-contract/vendor/events.js +9 -5
- package/src/plugins/source-contract/vendor/index.js +3 -3
- package/src/plugins/source-contract/vendor/params.js +3 -3
- package/src/plugins/source-contract/vendor/permission.js +9 -3
- package/src/plugins/source-contract/vendor/pick.js +5 -5
- package/src/plugins/source-contract/vendor/read.js +14 -14
- package/src/plugins/source-contract/vendor/registry.js +4 -4
- package/src/plugins/source-contract/vendor/schema.js +8 -8
- package/src/plugins/source-contract/vendor/schemas/sources.json +158 -4
- package/src/plugins/source-contract/vendor/schemas.js +9 -9
- package/src/plugins/source-contract/vendor/tools-rpc.js +4 -4
- package/src/sources.js +44 -0
- package/src/tools/spaces.js +54 -18
- package/src/vendor/source-contract/README.md +6 -5
- package/src/vendor/source-contract/VENDOR.json +46 -46
- package/src/vendor/source-contract/chunks/{chunk-6HDIB2SA.js → chunk-BOUWB5UP.js} +2 -2
- package/src/vendor/source-contract/chunks/{chunk-W5SHR7DQ.js → chunk-JUWIMDGF.js} +2 -2
- package/src/{plugins/source-contract/vendor/chunks/chunk-I2RXJJJM.js → vendor/source-contract/chunks/chunk-NUEROZNU.js} +1 -1
- package/src/vendor/source-contract/chunks/{chunk-3M5PAKSS.js → chunk-OZMX7VR7.js} +22 -2
- package/src/vendor/source-contract/chunks/{chunk-HLVAKAYG.js → chunk-T4QM7B3S.js} +1 -1
- package/src/vendor/source-contract/chunks/{chunk-KWEWSZ4V.js → chunk-X6XP7YK2.js} +24 -4
- package/src/vendor/source-contract/chunks/{chunk-ZUKF7P6U.js → chunk-YH323FAZ.js} +51 -10
- package/src/vendor/source-contract/cursor.js +3 -3
- package/src/vendor/source-contract/events.js +9 -5
- package/src/vendor/source-contract/registry.js +4 -4
- package/src/vendor/source-contract/tools-rpc.js +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,51 @@
|
|
|
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.3] - 2026-11-17
|
|
7
|
+
|
|
8
|
+
### Fixed
|
|
9
|
+
|
|
10
|
+
- Memory reads the sources an installed plugin declares on plain OpenCode. OpenCode 2.2.6 reports a
|
|
11
|
+
git plugin with no commit, and the locator refused every such install, so no declaration was read
|
|
12
|
+
and every bind took the previous contract's path. Without a commit, the store's copies for the
|
|
13
|
+
target must agree on one declaration, or none is read.
|
|
14
|
+
- A bind request's name resolves to the source its plugin declares (`granola` is
|
|
15
|
+
`granola.meetings`), and the account is learned through the contract's `probe`. A namespace with
|
|
16
|
+
several sources, such as `gws`, names them instead of choosing one. The bind answer says which
|
|
17
|
+
source a name was asked as.
|
|
18
|
+
- A declared source's page always names its account, `"default"` included, so a resumed cursor is
|
|
19
|
+
accepted. Wispr Flow refused its second page without it.
|
|
20
|
+
|
|
21
|
+
### Deploy
|
|
22
|
+
|
|
23
|
+
No server change and no migration: the plugin alone changes.
|
|
24
|
+
|
|
25
|
+
## [0.12.2] - 2026-11-17
|
|
26
|
+
|
|
27
|
+
### Changed
|
|
28
|
+
|
|
29
|
+
- Memory reads the source contract's `v0.2.0` release, vendored in all three copies in place of
|
|
30
|
+
`v0.1.0`. Each vendored file is checked against the release's `SHA256SUMS`.
|
|
31
|
+
- The checks the contract tightened apply: a probe's `owner.id` must be scheme-qualified,
|
|
32
|
+
`ACCOUNT_UNKNOWN` is read as `ACCOUNT_MISMATCH` by the package itself, and a rules-only source is
|
|
33
|
+
checked like any other.
|
|
34
|
+
|
|
35
|
+
### Added
|
|
36
|
+
|
|
37
|
+
- A plugin may now send the keys `v0.2.0` adds: `removals[]` on a page, an owner with
|
|
38
|
+
`verified: false`, `accounts.server`, `permission.identityRules`, `permission.readsIdentity`, a
|
|
39
|
+
price's `conditions` and `min`, `noExpiry`, and an empty `permission.identity`.
|
|
40
|
+
- A page's `removals[]` retracts what Memory drew from each removed item, through the same
|
|
41
|
+
retraction as the label rule, which still holds for plugins that send nothing else. Only an event
|
|
42
|
+
Memory holds, for the page's own source and account, is retracted, and a repeated removal
|
|
43
|
+
retracts nothing twice. A removal is held to the contract's own `removalProblems`, so its id may
|
|
44
|
+
be as long as an event's: 512 characters.
|
|
45
|
+
|
|
46
|
+
### Deploy
|
|
47
|
+
|
|
48
|
+
The records service needs a deploy before a plugin sends `removals[]` to it: records only, with no
|
|
49
|
+
migration. Every other new key is read by the plugin alone, so it needs no deploy.
|
|
50
|
+
|
|
6
51
|
## [0.12.1] - 2026-11-17
|
|
7
52
|
|
|
8
53
|
### Fixed
|
package/package.json
CHANGED
package/src/collector-service.js
CHANGED
|
@@ -186,7 +186,7 @@ export function createCollectorService({ ctx, runtime, toolkit, clock = REAL_CLO
|
|
|
186
186
|
const account = binding.account || DEFAULT_ACCOUNT
|
|
187
187
|
const id = collectSessionId({ source: binding.source, account })
|
|
188
188
|
try {
|
|
189
|
-
await ensureSession({ id, title: `Memory collection: ${binding.source}`, permissions: collectSessionRules({ source: binding.source, account }), extra: { source: binding.source } })
|
|
189
|
+
await ensureSession({ id, title: `Memory collection: ${binding.read ?? binding.source}`, permissions: collectSessionRules({ source: binding.source, account, read: binding.read ?? null }), extra: { source: binding.source } })
|
|
190
190
|
} catch (error) {
|
|
191
191
|
throw new Error(`the collector's session for ${binding.source}:${account} could not be made (${oneLine(errorMessage(error), 200)}); nothing was read`)
|
|
192
192
|
}
|
package/src/collector.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { errorMessage, isPlainObject, oneLine } from "./util.js"
|
|
2
2
|
import { createHash } from "node:crypto"
|
|
3
3
|
import { isSourceName } from "./source-ids.js"
|
|
4
|
-
import { ACCOUNT_NAME, DEFAULT_EVERY_MINUTES, contractRefusal, rpcDefinition, sourceAllowRules, sourceEntry } from "./sources.js"
|
|
4
|
+
import { ACCOUNT_NAME, DEFAULT_EVERY_MINUTES, contractRefusal, resolveDeclaredSource, rpcDefinition, sourceAllowRules, sourceEntry } from "./sources.js"
|
|
5
5
|
import { acceptAnswer, probe, read } from "./plugins/source-contract/vendor/read.js"
|
|
6
6
|
import { isBrokerAnswer, sourceReader } from "./plugins/source-contract/vendor/broker-client.js"
|
|
7
7
|
import { probeResultProblems } from "./plugins/source-contract/vendor/events.js"
|
|
@@ -79,9 +79,16 @@ const freezeRules = (rules) => Object.freeze(rules.map((rule) => Object.freeze({
|
|
|
79
79
|
* of its EVENT_READS on the binding's own account, and for github the four
|
|
80
80
|
* `github_api` GETs its events_list makes. There is no session for every
|
|
81
81
|
* source at once (0.9.7).
|
|
82
|
+
*
|
|
83
|
+
* `read` is the declared source a request's name stands for (0.12.3): a request
|
|
84
|
+
* recorded under `granola` is probed through `granola.meetings`, and the session
|
|
85
|
+
* it runs in allows exactly what that declaration asserts — its probe action
|
|
86
|
+
* included (`sourceAllowRules`). Without it the binding's own name decides, as
|
|
87
|
+
* before.
|
|
82
88
|
*/
|
|
83
|
-
export function collectSessionRules({ source, account }) {
|
|
84
|
-
const
|
|
89
|
+
export function collectSessionRules({ source, account, read = null }) {
|
|
90
|
+
const named = read ? sourceEntry(read) : null
|
|
91
|
+
const entry = named?.contract === "sources" ? named : sourceEntry(source)
|
|
85
92
|
return freezeRules([...BASE_RULES, ...(entry ? sourceAllowRules(entry, account || DEFAULT_ACCOUNT) : [])])
|
|
86
93
|
}
|
|
87
94
|
|
|
@@ -163,9 +170,17 @@ export function collectableSources(sources, { only } = {}) {
|
|
|
163
170
|
* The account an events_list call names: a named binding's, and for a source
|
|
164
171
|
* whose reads are scoped by account (`namesAccount`, gws) "default" too, so
|
|
165
172
|
* the plugin reads exactly the account the session's rules allow.
|
|
173
|
+
*
|
|
174
|
+
* **A declared source always names it, "default" included** (0.12.3): the
|
|
175
|
+
* contract binds a cursor to the account it was issued for, and a resumed read
|
|
176
|
+
* that names none is refused (`INPUT_INVALID`) — live on 2026-11-17, wisprflow
|
|
177
|
+
* v0.0.4, binding `wisprflow:default`: the first page read, and the second
|
|
178
|
+
* stopped for the missing account. A plugin that declares no source keeps the
|
|
179
|
+
* previous contract's rule.
|
|
166
180
|
*/
|
|
167
|
-
function accountInput(entry, account) {
|
|
181
|
+
function accountInput(entry, account, declared = null) {
|
|
168
182
|
const named = account || DEFAULT_ACCOUNT
|
|
183
|
+
if (declared?.contract === "sources" || entry?.contract === "sources") return { account: named }
|
|
169
184
|
return named !== DEFAULT_ACCOUNT || entry?.namesAccount ? { account: named } : {}
|
|
170
185
|
}
|
|
171
186
|
|
|
@@ -174,6 +189,10 @@ function accountInput(entry, account) {
|
|
|
174
189
|
* scope the person confirmed**. A scoped source that is not told its scope reads
|
|
175
190
|
* its plugin's whole option, and its page is then refused as out of scope.
|
|
176
191
|
*
|
|
192
|
+
* The account is decided by the declared source a binding's name stands for,
|
|
193
|
+
* when its package declares one: a binding made before that keeps collecting,
|
|
194
|
+
* and its resumed page names the account its cursor was issued for.
|
|
195
|
+
*
|
|
177
196
|
* @param {{ source: string, account?: string }} binding
|
|
178
197
|
* @param {string | undefined} cursor
|
|
179
198
|
* @param {Record<string, string[]>} [scope] the consented scope (`events.cursor` returns it)
|
|
@@ -183,7 +202,7 @@ export function listInput(binding, cursor, scope) {
|
|
|
183
202
|
return {
|
|
184
203
|
...(cursor ? { cursor } : {}),
|
|
185
204
|
limit: PAGE_LIMIT,
|
|
186
|
-
...accountInput(entry, binding.account),
|
|
205
|
+
...accountInput(entry, binding.account, resolveDeclaredSource(binding.source).entry),
|
|
187
206
|
...(entry?.input ?? {}),
|
|
188
207
|
...(isPlainObject(scope) && Object.keys(scope).length ? { scope } : {}),
|
|
189
208
|
}
|
|
@@ -320,6 +339,10 @@ function readDeclaredAnswer(value, entry, account) {
|
|
|
320
339
|
more: page.more === true,
|
|
321
340
|
refused: Array.isArray(page.refused) ? page.refused : [],
|
|
322
341
|
failed: Array.isArray(page.failed) ? page.failed : [],
|
|
342
|
+
// The events the source says it removed (`removals[]`, contract v0.2.0 #36):
|
|
343
|
+
// `{ external_id, at, reason }`, already checked by the contract's own
|
|
344
|
+
// `removalProblems` inside `acceptAnswer`, and retracted by the store.
|
|
345
|
+
removals: Array.isArray(page.removals) ? page.removals : [],
|
|
323
346
|
// The page's own echo of what it read: kept, so the store can refuse a page
|
|
324
347
|
// that read wider than the person confirmed (plugin_scope).
|
|
325
348
|
scope: isPlainObject(page.scope) ? page.scope : null,
|
|
@@ -947,6 +970,8 @@ export function createCollector({ scheduler = null, lister = null, prober = null
|
|
|
947
970
|
...(move.advance && answer.cursor ? { cursor: answer.cursor } : {}),
|
|
948
971
|
...(answer.gap ? { gap: answer.gap } : {}),
|
|
949
972
|
...(answer.cost ? { cost: answer.cost } : {}),
|
|
973
|
+
// Nothing to read and something removed is the ordinary removal page.
|
|
974
|
+
...(Array.isArray(answer.removals) && answer.removals.length ? { removals: answer.removals } : {}),
|
|
950
975
|
})
|
|
951
976
|
result.pages += 1
|
|
952
977
|
result.accepted += Number(saved?.accepted) || 0
|
|
@@ -956,6 +981,10 @@ export function createCollector({ scheduler = null, lister = null, prober = null
|
|
|
956
981
|
// event is counted once (DESIGN-jelly-sources §2.3.1).
|
|
957
982
|
if (saved?.refused !== undefined) result.refused += Number(saved.refused) || 0
|
|
958
983
|
if (saved?.newest_refusal) noteRefusal(result, saved.newest_refusal)
|
|
984
|
+
// What the store took for this page: the removals the page named that
|
|
985
|
+
// it retracted or still owes, so the run's result counts them, and the
|
|
986
|
+
// store's own `removals_pending` says what still waits.
|
|
987
|
+
if (Array.isArray(saved?.removals) && saved.removals.length) result.removals = (Number(result.removals) || 0) + saved.removals.length
|
|
959
988
|
if (saved?.resync === false) {
|
|
960
989
|
result.error = "the source restarted its window twice today; the binding waits until tomorrow rather than read again blind"
|
|
961
990
|
result.action = "pause"
|
|
@@ -1005,7 +1034,7 @@ export function createCollector({ scheduler = null, lister = null, prober = null
|
|
|
1005
1034
|
// The store holds the pause; this run only says whether it took.
|
|
1006
1035
|
try {
|
|
1007
1036
|
// 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"
|
|
1037
|
+
const needsAccount = failure.code === "ACCOUNT_MISMATCH"
|
|
1009
1038
|
await pause(
|
|
1010
1039
|
binding,
|
|
1011
1040
|
changed
|
|
@@ -1038,11 +1067,21 @@ export function createCollector({ scheduler = null, lister = null, prober = null
|
|
|
1038
1067
|
}
|
|
1039
1068
|
|
|
1040
1069
|
/**
|
|
1041
|
-
* Answer the person's bind requests: for each requested source only,
|
|
1042
|
-
*
|
|
1043
|
-
*
|
|
1044
|
-
*
|
|
1045
|
-
*
|
|
1070
|
+
* Answer the person's bind requests: for each requested source only, learn
|
|
1071
|
+
* the signed-in account and report it, or the source's own reason it could
|
|
1072
|
+
* not, with `report`. Nothing is bound here: the person confirms the reported
|
|
1073
|
+
* account.
|
|
1074
|
+
*
|
|
1075
|
+
* **How the account is learned (0.12.3).** A name the installed plugin
|
|
1076
|
+
* declares a source for is learned through the contract's `probe` (D11), in
|
|
1077
|
+
* the binding's session, whatever name the request carries: 0.12.2 recorded
|
|
1078
|
+
* the nine registry names (`granola`, `github`, …) and then probed them
|
|
1079
|
+
* through the previous contract's owner-only `events_list`, which granola and
|
|
1080
|
+
* linear refuse without an account and github refuses as too large. The
|
|
1081
|
+
* owner-only `events_list` now serves only a plugin that declares nothing.
|
|
1082
|
+
* A request recorded under a name that has since been declared is reported
|
|
1083
|
+
* under its own name — the store keys it that way — with a note naming the
|
|
1084
|
+
* declared source that binds instead.
|
|
1046
1085
|
*
|
|
1047
1086
|
* @param {{ requests: unknown, only?: string, sessionID?: string, report: (input: object) => Promise<unknown>, probes?: object[] }} input
|
|
1048
1087
|
*/
|
|
@@ -1051,11 +1090,20 @@ export function createCollector({ scheduler = null, lister = null, prober = null
|
|
|
1051
1090
|
const probe = { ...asked, reported: false }
|
|
1052
1091
|
probes.push(probe)
|
|
1053
1092
|
const entry = sourceEntry(asked.source)
|
|
1093
|
+
// The declared source this name stands for, when the declaration names one:
|
|
1094
|
+
// one declared source is probed under its own id, and a name with several
|
|
1095
|
+
// is not guessed between them.
|
|
1096
|
+
const resolved = resolveDeclaredSource(asked.source)
|
|
1097
|
+
const reading = resolved.entry?.contract === "sources" ? resolved.entry : entry
|
|
1098
|
+
const renamed = reading.contract === "sources" && reading.source !== asked.source ? reading.source : null
|
|
1054
1099
|
// The binding's own session first: when it cannot be made, nothing is read and
|
|
1055
1100
|
// nothing is reported (it is not the source's failure, so no back-off either).
|
|
1056
1101
|
let session
|
|
1057
1102
|
try {
|
|
1058
|
-
|
|
1103
|
+
// The declared source a retired name stands for decides the session's rules too: the probe runs in
|
|
1104
|
+
// the binding's own session, and that session must allow the probe action the declaration asserts.
|
|
1105
|
+
const binding = renamed ? { ...asked, read: reading.source } : asked
|
|
1106
|
+
session = typeof sessionID === "function" ? await sessionID(binding) : sessionID
|
|
1059
1107
|
} catch (error) {
|
|
1060
1108
|
probe.error = oneLine(errorMessage(error), 300)
|
|
1061
1109
|
continue
|
|
@@ -1063,28 +1111,34 @@ export function createCollector({ scheduler = null, lister = null, prober = null
|
|
|
1063
1111
|
let body
|
|
1064
1112
|
try {
|
|
1065
1113
|
// A declared source has the contract's `probe` (D11); the owner-only
|
|
1066
|
-
// `events_list({ limit: 0 })` page is the previous contract's
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1114
|
+
// `events_list({ limit: 0 })` page is the previous contract's, and only
|
|
1115
|
+
// for a plugin that declares no source.
|
|
1116
|
+
const answer = reading.contract === "sources"
|
|
1117
|
+
? await (prober ? prober(reading.source, { account: asked.account }, session) : Promise.reject(new Error("this host gives plugins no tools RPC, so a source cannot be probed")))
|
|
1118
|
+
: await (lister ? lister(asked.source, probeInput(reading, asked.account), session) : Promise.reject(new Error("this host gives plugins no way to call another plugin's events_list")))
|
|
1119
|
+
// A name the declaration has replaced says which source binds instead:
|
|
1120
|
+
// the store refuses a retired name, so the person needs the one to use.
|
|
1121
|
+
const replaced = renamed ? `${asked.source} is the previous contract's name for ${renamed}, which this release binds instead: bind ${renamed} in Memory's console.` : null
|
|
1070
1122
|
if (answer?.owner?.id) {
|
|
1071
1123
|
const owner = { id: oneLine(answer.owner.id, 300), label: oneLine(answer.owner.label ?? answer.owner.email ?? answer.owner.id, 300) }
|
|
1124
|
+
const setup = answer.setup || reading.setupOptions || null
|
|
1072
1125
|
body = {
|
|
1073
1126
|
source: asked.source,
|
|
1074
1127
|
account: asked.account,
|
|
1075
1128
|
owner,
|
|
1076
1129
|
reported_account: answer.account,
|
|
1077
1130
|
// The installed declaration's digest, read from disk: a re-consent records the digest the installed
|
|
1078
|
-
// package has now, so jelly never refuses a read made under the old one.
|
|
1079
|
-
|
|
1131
|
+
// package has now, so jelly never refuses a read made under the old one. Only for the declared id
|
|
1132
|
+
// itself: a consent recorded under a retired name never reads that declaration.
|
|
1133
|
+
...(renamed === null && reading.descriptorHash ? { digest: reading.descriptorHash } : {}),
|
|
1080
1134
|
// The note is the source's or the plugin's own sentence: it is
|
|
1081
|
-
// reported to the store (`
|
|
1135
|
+
// reported to the store (`source_requests.note`) and shown from it,
|
|
1082
1136
|
// so it is redacted here, where it is written (review F1/F2).
|
|
1083
|
-
...(
|
|
1137
|
+
...(replaced || setup ? { note: oneLine(errorMessage([replaced, setup].filter(Boolean).join(" ")), 400) } : {}),
|
|
1084
1138
|
}
|
|
1085
1139
|
probe.owner = owner
|
|
1086
1140
|
} else {
|
|
1087
|
-
body = { source: asked.source, account: asked.account, note: oneLine(errorMessage(answer?.setup || `${
|
|
1141
|
+
body = { source: asked.source, account: asked.account, note: oneLine(errorMessage(answer?.setup || `${reading.package}'s ${reading.contract === "sources" ? "probe" : "events_list"} named no signed-in account; sign in to it in its own plugin.`), 400) }
|
|
1088
1142
|
}
|
|
1089
1143
|
} catch (error) {
|
|
1090
1144
|
body = { source: asked.source, account: asked.account, note: oneLine(errorMessage(error), 400) }
|
package/src/plugins/locate.js
CHANGED
|
@@ -216,7 +216,14 @@ export function parseRegistryTarget(target) {
|
|
|
216
216
|
}
|
|
217
217
|
|
|
218
218
|
function locateGit(target, version, root) {
|
|
219
|
-
|
|
219
|
+
// OpenCode 2.2.6 reports a package plugin's source as `{ type: "package",
|
|
220
|
+
// target }` and **no `version`** (`@opencode/core` `pluginSource`). Refusing
|
|
221
|
+
// then made every family plugin `unverified` and the scan `LAYOUT_CHANGED`,
|
|
222
|
+
// so no declaration was ever read on plain OpenCode (live, 2026-11-17).
|
|
223
|
+
// Without a commit the store's copies for this target are the candidates, and
|
|
224
|
+
// `choose` keeps the one declaration they agree on; with one, only the copy
|
|
225
|
+
// the host names is read.
|
|
226
|
+
const commit = typeof version === "string" && /^[0-9a-f]{7,64}$/.test(version) ? version : null
|
|
220
227
|
const suffix = `-${createHash("sha256").update(target).digest("hex").slice(0, 12)}`
|
|
221
228
|
let dirs
|
|
222
229
|
try {
|
|
@@ -245,12 +252,16 @@ function locateGit(target, version, root) {
|
|
|
245
252
|
const dependency = Object.entries(manifest.value.dependencies).find(([, spec]) => spec === target)?.[0]
|
|
246
253
|
if (!dependency) continue
|
|
247
254
|
const locked = lock.value.packages[`node_modules/${dependency}`]
|
|
248
|
-
if (typeof locked?.resolved !== "string"
|
|
255
|
+
if (typeof locked?.resolved !== "string") continue
|
|
256
|
+
if (commit !== null && !locked.resolved.endsWith(`#${commit}`)) continue
|
|
249
257
|
found.push({ ...packageIn(stamp, dependency, root), dependency })
|
|
250
258
|
}
|
|
251
259
|
}
|
|
252
|
-
//
|
|
253
|
-
//
|
|
260
|
+
// A stamp whose declaration differs from another stamp's is refused by
|
|
261
|
+
// `choose` ("differ"): the digest is what the person consents to, so the copy
|
|
262
|
+
// is never guessed between them. The store holds the target at another commit
|
|
263
|
+
// than the host names: the install is older or newer than `/api/plugin` says,
|
|
264
|
+
// and it is never read as that version's.
|
|
254
265
|
if (found.length === 0 && dirs.length > 0) return { ok: false, cause: "stale", reason: NOT_AT_COMMIT }
|
|
255
266
|
return choose(found, () => ({ kind: "git" }))
|
|
256
267
|
}
|
|
@@ -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.
|
|
8
|
-
* `
|
|
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" :
|
|
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.
|
|
5
|
-
"commit": "
|
|
6
|
-
"tag": "v0.
|
|
7
|
-
"tagObject": "
|
|
8
|
-
"release": "https://github.com/we-the-rebel-alliance/source-contract/releases/tag/v0.
|
|
9
|
-
"commitNote": "The release's tag: annotated tag v0.
|
|
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": "
|
|
15
|
-
"vendored": "2026-11-
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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.
|
|
3
|
-
"tagObject": "
|
|
4
|
-
"commit": "
|
|
5
|
-
"url": "https://github.com/we-the-rebel-alliance/source-contract/releases/tag/v0.
|
|
6
|
-
"published": "2026-11-
|
|
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": "
|
|
9
|
+
"sha256": "6d30b4c98a363dbb4cfd88be85779503075757226ac429a9c1565d81949e27a8"
|
|
10
10
|
},
|
|
11
11
|
"assets": {
|
|
12
|
-
"source-contract-0.
|
|
13
|
-
"source-contract-conformance-0.
|
|
14
|
-
"source-contract-schemas-0.
|
|
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
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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
|
-
|
|
41
|
-
|
|
40
|
+
b94a3e678154aafd9fa206d46fb1dfa93e6cdbd2f6eb27ef7391f99c95dce9d2 schemas/sources.json
|
|
41
|
+
2a27cbb7910bab01fe52f128141202a7ca26cc45fa2b6ae55dc28377e92e1fd1 tools-rpc.js
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
// @we-the-rebel-alliance/source-contract 0.
|
|
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-
|
|
8
|
-
import "./chunks/chunk-
|
|
9
|
-
import "./chunks/chunk-
|
|
10
|
-
import "./chunks/chunk-
|
|
11
|
-
import "./chunks/chunk-
|
|
12
|
-
import "./chunks/chunk-
|
|
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-
|
|
16
|
-
import "./chunks/chunk-
|
|
17
|
-
import "./chunks/chunk-
|
|
18
|
-
import "./chunks/chunk-
|
|
19
|
-
import "./chunks/chunk-
|
|
20
|
-
import "./chunks/chunk-
|
|
21
|
-
import "./chunks/chunk-
|
|
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
|
+
// @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-
|
|
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-
|
|
12
|
+
} from "./chunk-YH323FAZ.js";
|
|
13
13
|
import {
|
|
14
14
|
canonicalScope
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-NUEROZNU.js";
|
|
16
16
|
import {
|
|
17
17
|
resolveParams,
|
|
18
18
|
resolveSince
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-F4K2Y64D.js";
|
|
20
20
|
import {
|
|
21
21
|
detailRules,
|
|
22
22
|
grantCovers,
|
|
23
23
|
probeRules,
|
|
24
24
|
sessionRules
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-OZMX7VR7.js";
|
|
26
26
|
import {
|
|
27
27
|
pick,
|
|
28
28
|
pickProblemsForOutput
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-XVA6H6OO.js";
|
|
30
30
|
import {
|
|
31
31
|
checkOutput
|
|
32
|
-
} from "./chunk-
|
|
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
|
+
// @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-
|
|
16
|
+
} from "./chunk-JUWIMDGF.js";
|
|
17
17
|
|
|
18
18
|
// src/registry.ts
|
|
19
19
|
var text = (max) => string().max(max);
|