@joe-broadhead/opencode-mem 0.9.12 → 0.11.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.
- package/CHANGELOG.md +1934 -2
- package/README.md +29 -17
- package/SECURITY.md +3 -1
- package/docs/agent-instructions.md +17 -0
- package/docs/agent-protocol.md +8 -8
- package/docs/permissions.md +22 -4
- package/package.json +7923 -217
- package/shared/page-paths.js +44 -0
- package/skills/mem.pages/SKILL.md +8 -1
- package/skills/mem.usage/SKILL.md +15 -15
- package/src/action-grant-keys.js +159 -0
- package/src/action-grant.js +439 -0
- package/src/actions.js +1690 -0
- package/src/backend/records.js +25 -2
- package/src/backend/v3.js +76 -22
- package/src/call-shapes.js +17 -16
- package/src/collector-lock.js +533 -62
- package/src/collector-service.js +153 -26
- package/src/collector.js +627 -33
- package/src/config.js +79 -6
- package/src/connect.js +106 -8
- package/src/credentials.js +123 -25
- package/src/events.js +174 -3
- package/src/forget-turn.js +141 -0
- package/src/host-refusal.js +78 -0
- package/src/index.js +209 -22
- package/src/jobs/host.js +557 -0
- package/src/ops/codes.js +110 -0
- package/src/ops/copy-lineage.js +42 -0
- package/src/ops/index.js +28 -0
- package/src/ops/space-ops.js +1936 -0
- package/src/outlinks.js +103 -0
- package/src/p2-reservation.js +151 -0
- package/src/permissions.js +30 -0
- package/src/plugins/descriptor.js +62 -0
- package/src/plugins/discovery.js +318 -0
- package/src/plugins/grants.js +178 -0
- package/src/plugins/locate.js +319 -0
- package/src/plugins/manifest.js +1162 -0
- package/src/plugins/source-contract/index.js +34 -0
- package/src/plugins/source-contract/policy.js +102 -0
- package/src/plugins/source-contract/vendor/PROVENANCE.json +17 -0
- package/src/plugins/source-contract/vendor/RELEASE-SHA256SUMS +3 -0
- package/src/plugins/source-contract/vendor/RELEASE.json +17 -0
- package/src/plugins/source-contract/vendor/SHA256SUMS +41 -0
- package/src/plugins/source-contract/vendor/THIRD-PARTY-NOTICES.md +35 -0
- package/src/plugins/source-contract/vendor/broker-client.js +93 -0
- package/src/plugins/source-contract/vendor/chunks/chunk-3M5PAKSS.js +84 -0
- package/src/plugins/source-contract/vendor/chunks/chunk-4ERCA4TK.js +185 -0
- package/src/plugins/source-contract/vendor/chunks/chunk-6HDIB2SA.js +183 -0
- package/src/plugins/source-contract/vendor/chunks/chunk-ELPJD3ND.js +10 -0
- package/src/plugins/source-contract/vendor/chunks/chunk-HLVAKAYG.js +10 -0
- package/src/plugins/source-contract/vendor/chunks/chunk-I2RXJJJM.js +81 -0
- package/src/plugins/source-contract/vendor/chunks/chunk-KWEWSZ4V.js +505 -0
- package/src/plugins/source-contract/vendor/chunks/chunk-KYWBTAF4.js +182 -0
- package/src/plugins/source-contract/vendor/chunks/chunk-Q3RQA5J2.js +249 -0
- package/src/plugins/source-contract/vendor/chunks/chunk-RRUAIQ4I.js +156 -0
- package/src/plugins/source-contract/vendor/chunks/chunk-RYNKNCPP.js +165 -0
- package/src/plugins/source-contract/vendor/chunks/chunk-W5SHR7DQ.js +9477 -0
- package/src/plugins/source-contract/vendor/chunks/chunk-ZUKF7P6U.js +653 -0
- package/src/plugins/source-contract/vendor/cursor.js +26 -0
- package/src/plugins/source-contract/vendor/descriptor.js +34 -0
- package/src/plugins/source-contract/vendor/events.js +257 -0
- package/src/plugins/source-contract/vendor/index.js +10 -0
- package/src/plugins/source-contract/vendor/params.js +22 -0
- package/src/plugins/source-contract/vendor/permission.js +28 -0
- package/src/plugins/source-contract/vendor/pick.js +22 -0
- package/src/plugins/source-contract/vendor/read.js +29 -0
- package/src/plugins/source-contract/vendor/registry.js +23 -0
- package/src/plugins/source-contract/vendor/schema.js +17 -0
- package/src/plugins/source-contract/vendor/schemas/output.agenda.json +96 -0
- package/src/plugins/source-contract/vendor/schemas/output.countdown.json +28 -0
- package/src/plugins/source-contract/vendor/schemas/output.image.json +28 -0
- package/src/plugins/source-contract/vendor/schemas/output.inbox.json +84 -0
- package/src/plugins/source-contract/vendor/schemas/output.links.json +46 -0
- package/src/plugins/source-contract/vendor/schemas/output.list.json +57 -0
- package/src/plugins/source-contract/vendor/schemas/output.metric.json +61 -0
- package/src/plugins/source-contract/vendor/schemas/output.note.json +14 -0
- package/src/plugins/source-contract/vendor/schemas/output.progress.json +50 -0
- package/src/plugins/source-contract/vendor/schemas/output.record.json +38 -0
- package/src/plugins/source-contract/vendor/schemas/output.table.json +61 -0
- package/src/plugins/source-contract/vendor/schemas/output.thread.json +62 -0
- package/src/plugins/source-contract/vendor/schemas/sources.json +819 -0
- package/src/plugins/source-contract/vendor/schemas.js +19 -0
- package/src/plugins/source-contract/vendor/tools-rpc.js +42 -0
- package/src/plugins/verify.js +56 -0
- package/src/protocol.js +21 -5
- package/src/recall.js +104 -5
- package/src/records.js +61 -2
- package/src/requests.js +216 -0
- package/src/runtime.js +89 -7
- package/src/setup-time.js +68 -0
- package/src/skills.js +230 -8
- package/src/source-ids.js +25 -0
- package/src/sources/declaration.js +365 -0
- package/src/sources/reads.js +772 -0
- package/src/sources/rpc.js +151 -0
- package/src/sources.js +409 -90
- package/src/spaces.js +283 -11
- package/src/spool.js +61 -4
- package/src/stated.js +10 -5
- package/src/storable.js +139 -0
- package/src/tools/commitments.js +47 -5
- package/src/tools/held-write.js +36 -13
- package/src/tools/index.js +27 -0
- package/src/tools/ingest.js +27 -2
- package/src/tools/memory.js +52 -14
- package/src/tools/page.js +95 -9
- package/src/tools/recall.js +208 -4
- package/src/tools/records-kit.js +2 -1
- package/src/tools/share.js +42 -3
- package/src/tools/shared.js +44 -4
- package/src/tools/space-lifecycle.js +278 -0
- package/src/tools/spaces.js +373 -29
- package/src/tools/status.js +9 -2
- package/src/tools/wiki.js +34 -4
- package/src/util.js +110 -6
- package/src/vendor/source-contract/README.md +24 -0
- package/src/vendor/source-contract/THIRD-PARTY-NOTICES.md +35 -0
- package/src/vendor/source-contract/VENDOR.json +81 -0
- package/src/vendor/source-contract/chunks/chunk-3M5PAKSS.js +84 -0
- package/src/vendor/source-contract/chunks/chunk-6HDIB2SA.js +183 -0
- package/src/vendor/source-contract/chunks/chunk-HLVAKAYG.js +10 -0
- package/src/vendor/source-contract/chunks/chunk-I2RXJJJM.js +81 -0
- package/src/vendor/source-contract/chunks/chunk-KWEWSZ4V.js +505 -0
- package/src/vendor/source-contract/chunks/chunk-W5SHR7DQ.js +9477 -0
- package/src/vendor/source-contract/chunks/chunk-ZUKF7P6U.js +653 -0
- package/src/vendor/source-contract/cursor.js +26 -0
- package/src/vendor/source-contract/events.js +257 -0
- package/src/vendor/source-contract/registry.js +23 -0
- package/src/vendor/source-contract/tools-rpc.js +42 -0
- package/src/views/access-reads.js +256 -0
- package/src/views/communities.js +77 -0
- package/src/views/contracts.js +1183 -36
- package/src/views/inbox-bytes.js +103 -0
- package/src/views/overdue.js +1 -1
- package/src/views/profile.js +31 -0
- package/src/views/receipt.js +81 -0
- package/src/views/records-reads.js +869 -37
- package/src/views/rpc.js +159 -11
- package/src/views/shape.js +8 -5
- package/views/memory.html +16 -3
- package/views/pages.html +2 -2
- package/views/remembered.html +130 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// @we-the-rebel-alliance/source-contract 0.1.0. Built by scripts/build.mjs; do not edit.
|
|
2
|
+
import {
|
|
3
|
+
CURSOR_V1,
|
|
4
|
+
CURSOR_V2,
|
|
5
|
+
MAX_CURSOR_LENGTH,
|
|
6
|
+
RESERVED_STATE_KEYS,
|
|
7
|
+
bindingHash,
|
|
8
|
+
canonicalScope,
|
|
9
|
+
decodeBoundCursor,
|
|
10
|
+
decodeCursor,
|
|
11
|
+
encodeBoundCursor,
|
|
12
|
+
encodeCursor
|
|
13
|
+
} from "./chunks/chunk-I2RXJJJM.js";
|
|
14
|
+
import "./chunks/chunk-HLVAKAYG.js";
|
|
15
|
+
export {
|
|
16
|
+
CURSOR_V1,
|
|
17
|
+
CURSOR_V2,
|
|
18
|
+
MAX_CURSOR_LENGTH,
|
|
19
|
+
RESERVED_STATE_KEYS,
|
|
20
|
+
bindingHash,
|
|
21
|
+
canonicalScope,
|
|
22
|
+
decodeBoundCursor,
|
|
23
|
+
decodeCursor,
|
|
24
|
+
encodeBoundCursor,
|
|
25
|
+
encodeCursor
|
|
26
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// @we-the-rebel-alliance/source-contract 0.1.0. Built by scripts/build.mjs; do not edit.
|
|
2
|
+
import {
|
|
3
|
+
DEFAULT_MAX_BYTES,
|
|
4
|
+
DETAIL_FIELDS,
|
|
5
|
+
MAX_BYTES_LIMIT,
|
|
6
|
+
canonicalJson,
|
|
7
|
+
checkSources,
|
|
8
|
+
descriptorHash,
|
|
9
|
+
findInstalledPackage,
|
|
10
|
+
findSource,
|
|
11
|
+
maxBytesOf,
|
|
12
|
+
readInstalledDescriptor
|
|
13
|
+
} from "./chunks/chunk-KYWBTAF4.js";
|
|
14
|
+
import "./chunks/chunk-RRUAIQ4I.js";
|
|
15
|
+
import "./chunks/chunk-KWEWSZ4V.js";
|
|
16
|
+
import "./chunks/chunk-ELPJD3ND.js";
|
|
17
|
+
import "./chunks/chunk-ZUKF7P6U.js";
|
|
18
|
+
import "./chunks/chunk-I2RXJJJM.js";
|
|
19
|
+
import "./chunks/chunk-3M5PAKSS.js";
|
|
20
|
+
import "./chunks/chunk-6HDIB2SA.js";
|
|
21
|
+
import "./chunks/chunk-W5SHR7DQ.js";
|
|
22
|
+
import "./chunks/chunk-HLVAKAYG.js";
|
|
23
|
+
export {
|
|
24
|
+
DEFAULT_MAX_BYTES,
|
|
25
|
+
DETAIL_FIELDS,
|
|
26
|
+
MAX_BYTES_LIMIT,
|
|
27
|
+
canonicalJson,
|
|
28
|
+
checkSources,
|
|
29
|
+
descriptorHash,
|
|
30
|
+
findInstalledPackage,
|
|
31
|
+
findSource,
|
|
32
|
+
maxBytesOf,
|
|
33
|
+
readInstalledDescriptor
|
|
34
|
+
};
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
// @we-the-rebel-alliance/source-contract 0.1.0. Built by scripts/build.mjs; do not edit.
|
|
2
|
+
import {
|
|
3
|
+
CONTRACT1_CODES,
|
|
4
|
+
ERROR_ALIASES,
|
|
5
|
+
ERROR_CODES,
|
|
6
|
+
EVENTS_LIST,
|
|
7
|
+
EVENT_KINDS,
|
|
8
|
+
EVENT_LIMITS,
|
|
9
|
+
EXTENSION_KIND,
|
|
10
|
+
EXTENSION_NAME,
|
|
11
|
+
EXTENSION_SEGMENT_MAX,
|
|
12
|
+
FIRST_RUN_HOURS,
|
|
13
|
+
GAP_REASONS,
|
|
14
|
+
MAX_BYTES,
|
|
15
|
+
MAX_PAGE_BYTES,
|
|
16
|
+
PAGE,
|
|
17
|
+
PROBE,
|
|
18
|
+
PROBE_LIMITS,
|
|
19
|
+
PROPOSED_CODES,
|
|
20
|
+
REFUSAL_REASONS,
|
|
21
|
+
SCOPE_KEY_PATTERN,
|
|
22
|
+
SINCE_PATTERN,
|
|
23
|
+
SOURCE_PATTERN,
|
|
24
|
+
SourceError,
|
|
25
|
+
TRUST,
|
|
26
|
+
canonicalCode,
|
|
27
|
+
cut,
|
|
28
|
+
eventHash,
|
|
29
|
+
eventProblems,
|
|
30
|
+
eventsListResult,
|
|
31
|
+
extensionNamespace,
|
|
32
|
+
fitPage,
|
|
33
|
+
isEventKind,
|
|
34
|
+
isEventKindIn,
|
|
35
|
+
isExtensionName,
|
|
36
|
+
makeEvent,
|
|
37
|
+
oldestFirst,
|
|
38
|
+
parseEventsListInput,
|
|
39
|
+
parseProbeInput,
|
|
40
|
+
parseSourceError,
|
|
41
|
+
probeResult,
|
|
42
|
+
probeResultProblems,
|
|
43
|
+
resultProblems,
|
|
44
|
+
scopeProblems,
|
|
45
|
+
screenEvents,
|
|
46
|
+
secretKinds,
|
|
47
|
+
sinceTime,
|
|
48
|
+
sourceNamespace,
|
|
49
|
+
startTime
|
|
50
|
+
} from "./chunks/chunk-ZUKF7P6U.js";
|
|
51
|
+
import {
|
|
52
|
+
decodeBoundCursor,
|
|
53
|
+
decodeCursor,
|
|
54
|
+
encodeBoundCursor,
|
|
55
|
+
encodeCursor
|
|
56
|
+
} from "./chunks/chunk-I2RXJJJM.js";
|
|
57
|
+
import "./chunks/chunk-HLVAKAYG.js";
|
|
58
|
+
|
|
59
|
+
// src/internal/events-conformance.ts
|
|
60
|
+
var describeError = (error) => error instanceof Error ? error.message.split("\n", 1)[0] : String(error);
|
|
61
|
+
async function eventsListConformance(list, fixtures) {
|
|
62
|
+
const problems = [];
|
|
63
|
+
const hooks = fixtures.hooks ?? {};
|
|
64
|
+
const maxBytes = fixtures.maxBytes ?? MAX_PAGE_BYTES;
|
|
65
|
+
const call = async (input, what) => {
|
|
66
|
+
try {
|
|
67
|
+
const result = await list(input);
|
|
68
|
+
hooks.onCall?.({ what, input, result });
|
|
69
|
+
return { result };
|
|
70
|
+
} catch (error) {
|
|
71
|
+
hooks.onCall?.({ what, input, error });
|
|
72
|
+
return { error };
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
const scope = {
|
|
76
|
+
...fixtures.account === void 0 ? {} : { account: fixtures.account },
|
|
77
|
+
...fixtures.sourceInput ? { source: fixtures.source } : {},
|
|
78
|
+
...fixtures.scope === void 0 ? {} : { scope: fixtures.scope }
|
|
79
|
+
};
|
|
80
|
+
const base = { ...fixtures.since === void 0 ? {} : { since: fixtures.since }, ...scope };
|
|
81
|
+
const after = (cursor) => ({ cursor, ...scope });
|
|
82
|
+
const pageSize = fixtures.pageSize ?? 2;
|
|
83
|
+
const since = fixtures.since === void 0 ? void 0 : sinceTime(fixtures.since);
|
|
84
|
+
const owners = /* @__PURE__ */ new Set();
|
|
85
|
+
const accounts = /* @__PURE__ */ new Set();
|
|
86
|
+
const hashes = /* @__PURE__ */ new Map();
|
|
87
|
+
const check = (listed, what, limit) => {
|
|
88
|
+
if (listed.error !== void 0) {
|
|
89
|
+
problems.push(`${what} failed: ${describeError(listed.error)}`);
|
|
90
|
+
return void 0;
|
|
91
|
+
}
|
|
92
|
+
const found = resultProblems(listed.result, limit, maxBytes);
|
|
93
|
+
problems.push(...found.map((problem) => `${what}: ${problem}`));
|
|
94
|
+
if (found.length > 0) return void 0;
|
|
95
|
+
const result = listed.result;
|
|
96
|
+
if (result.source !== fixtures.source) problems.push(`${what}: the result names the source ${result.source}, not ${fixtures.source}`);
|
|
97
|
+
if (fixtures.account !== void 0 && result.account !== fixtures.account) problems.push(`${what}: the result names the account ${result.account}, not ${fixtures.account}`);
|
|
98
|
+
accounts.add(result.account);
|
|
99
|
+
owners.add(JSON.stringify(result.owner));
|
|
100
|
+
if (fixtures.owner && JSON.stringify(result.owner) !== JSON.stringify({ id: fixtures.owner.id, label: fixtures.owner.label })) problems.push(`${what}: the owner is not the fixture's owner`);
|
|
101
|
+
if (fixtures.scopeEcho && fixtures.scope !== void 0) {
|
|
102
|
+
if (result.scope === void 0) problems.push(`${what}: the result does not echo the scope`);
|
|
103
|
+
else if (JSON.stringify(result.scope) !== JSON.stringify(sortedScope(fixtures.scope))) problems.push(`${what}: the result's scope is not the call's scope`);
|
|
104
|
+
}
|
|
105
|
+
for (const event of result.events) {
|
|
106
|
+
if (event.source !== fixtures.source) problems.push(`${what}: an event names the source ${event.source}, not ${fixtures.source}`);
|
|
107
|
+
if (fixtures.account !== void 0 && event.account !== fixtures.account) problems.push(`${what}: an event names the account ${event.account}, not ${fixtures.account}`);
|
|
108
|
+
if (since !== void 0 && Date.parse(event.occurred_at) < since) problems.push(`${what}: the event ${event.external_id} is from before since`);
|
|
109
|
+
if (fixtures.namespace !== void 0 && !isEventKindIn(event.kind, fixtures.namespace)) problems.push(`${what}: the event ${event.external_id} is a ${event.kind}, outside the namespace ${fixtures.namespace}`);
|
|
110
|
+
if (fixtures.kinds !== void 0 && !fixtures.kinds.includes(event.kind)) problems.push(`${what}: the event ${event.external_id} is a ${event.kind}, which the source does not declare`);
|
|
111
|
+
const secrets = secretKinds([event.title, event.text].filter(Boolean).join("\n"));
|
|
112
|
+
if (secrets.length > 0) problems.push(`${what}: the event ${event.external_id} holds a secret (${secrets.join(", ")}); it belongs in refused[]`);
|
|
113
|
+
const known = hashes.get(event.external_id);
|
|
114
|
+
if (known !== void 0 && known !== event.hash) problems.push(`${what}: the event ${event.external_id} has another hash than before`);
|
|
115
|
+
hashes.set(event.external_id, event.hash);
|
|
116
|
+
}
|
|
117
|
+
return result;
|
|
118
|
+
};
|
|
119
|
+
const ids = (result) => result?.events.map((event) => event.external_id) ?? [];
|
|
120
|
+
const whole = check(await call({ ...base, limit: PAGE.max }, "one call with the largest limit"), "one call with the largest limit", PAGE.max);
|
|
121
|
+
if (whole) {
|
|
122
|
+
if (JSON.stringify(ids(whole)) !== JSON.stringify(fixtures.expected)) problems.push(`one call with the largest limit lists [${ids(whole).join(", ")}], not [${fixtures.expected.join(", ")}]`);
|
|
123
|
+
if (fixtures.expected.length <= PAGE.max && whole.more) problems.push("one call with the largest limit lists everything but says more");
|
|
124
|
+
if (fixtures.refused !== void 0) {
|
|
125
|
+
const refusedIds = (whole.refused ?? []).map((entry) => entry.external_id);
|
|
126
|
+
if (JSON.stringify(refusedIds) !== JSON.stringify(fixtures.refused)) problems.push(`one call with the largest limit refuses [${refusedIds.join(", ")}], not [${fixtures.refused.join(", ")}]`);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
const pages = [];
|
|
130
|
+
let page = check(await call({ ...base, limit: pageSize }, "the first page"), "the first page", pageSize);
|
|
131
|
+
const most = fixtures.expected.length + (fixtures.refused?.length ?? 0) + 10;
|
|
132
|
+
while (page) {
|
|
133
|
+
pages.push(page);
|
|
134
|
+
if (!page.more) break;
|
|
135
|
+
if (pages.length > most) {
|
|
136
|
+
problems.push(`the paged walk did not end after ${most} pages`);
|
|
137
|
+
break;
|
|
138
|
+
}
|
|
139
|
+
const what = `page ${pages.length + 1}`;
|
|
140
|
+
page = check(await call({ ...after(page.cursor), limit: pageSize }, what), what, pageSize);
|
|
141
|
+
}
|
|
142
|
+
const walked = pages.flatMap(ids);
|
|
143
|
+
if (JSON.stringify(walked) !== JSON.stringify(fixtures.expected)) problems.push(`the pages of ${pageSize} list [${walked.join(", ")}], not [${fixtures.expected.join(", ")}]`);
|
|
144
|
+
if (pages.length >= 2) {
|
|
145
|
+
const again = check(await call({ ...after(pages[0].cursor), limit: pageSize }, "the first cursor again"), "the first cursor again", pageSize);
|
|
146
|
+
if (again && JSON.stringify(again.events) !== JSON.stringify(pages[1].events)) problems.push("the first cursor, used again, does not list the second page again");
|
|
147
|
+
}
|
|
148
|
+
const last = pages.at(-1);
|
|
149
|
+
if (last && !last.more) {
|
|
150
|
+
const end = check(await call({ ...after(last.cursor), limit: pageSize }, "the last cursor"), "the last cursor", pageSize);
|
|
151
|
+
if (end && (end.events.length > 0 || end.more)) problems.push("the last cursor lists events again, or says more");
|
|
152
|
+
}
|
|
153
|
+
const empty = check(await call({ ...scope, since: "2999-01-01T00:00:00Z", limit: pageSize }, "an empty first page"), "an empty first page", pageSize);
|
|
154
|
+
if (empty && (empty.events.length > 0 || empty.more)) problems.push("a first page from a since in the future lists events, or says more");
|
|
155
|
+
if (owners.size > 1) problems.push("the owner changes between calls");
|
|
156
|
+
if (accounts.size > 1) problems.push("the account changes between calls");
|
|
157
|
+
const refused = async (input, what, codes) => {
|
|
158
|
+
const listed = await call(input, what);
|
|
159
|
+
if (listed.error === void 0) {
|
|
160
|
+
problems.push(`${what} was not refused`);
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
if (fixtures.codes) {
|
|
164
|
+
const parsed = parseSourceError(listed.error);
|
|
165
|
+
if (!parsed?.canonical || !codes.includes(parsed.canonical)) problems.push(`${what} was refused without the code ${codes.join(" or ")}${parsed ? ` (it says ${parsed.code})` : ""}`);
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
const INPUT = ["INPUT_INVALID"];
|
|
169
|
+
const CURSOR = ["CURSOR_INVALID"];
|
|
170
|
+
await refused({ ...base, limit: PAGE.max + 1 }, `a limit of ${PAGE.max + 1}`, INPUT);
|
|
171
|
+
await refused({ ...base, limit: 0 }, "a limit of 0", INPUT);
|
|
172
|
+
await refused({ ...after("not-a-cursor"), limit: pageSize }, "a malformed cursor", CURSOR);
|
|
173
|
+
await refused({ ...after(encodeCursor(`${fixtures.source}-other`, {})), limit: pageSize }, "another source's cursor", CURSOR);
|
|
174
|
+
await refused({ ...base, source: `${fixtures.source}-other`, limit: pageSize }, "a source the plugin does not have", ["SOURCE_UNKNOWN", "INPUT_INVALID"]);
|
|
175
|
+
const first = pages[0];
|
|
176
|
+
if (fixtures.binding !== void 0 && first) {
|
|
177
|
+
const binding = { plugin: fixtures.binding.plugin, source: fixtures.source, account: first.account, ...fixtures.scope === void 0 ? {} : { scope: fixtures.scope } };
|
|
178
|
+
const decoded = decodeBoundCursor(binding, first.cursor);
|
|
179
|
+
if (!decoded.ok) problems.push("the first page's cursor is not the library's cursor bound to this plugin, source, account and scope");
|
|
180
|
+
else {
|
|
181
|
+
const others = [
|
|
182
|
+
["another plugin's", { ...binding, plugin: `${binding.plugin}-other` }],
|
|
183
|
+
["another account's", { ...binding, account: `${binding.account}-other` }],
|
|
184
|
+
["another scope's", { ...binding, scope: { ...binding.scope ?? {}, conformance: ["other"] } }]
|
|
185
|
+
];
|
|
186
|
+
for (const [whose, other] of others) await refused({ ...after(encodeBoundCursor(other, decoded.state)), limit: pageSize }, `${whose} bound cursor`, CURSOR);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
if (hooks.after) problems.push(...await hooks.after({ ...whole ? { whole } : {}, pages }));
|
|
190
|
+
return problems;
|
|
191
|
+
}
|
|
192
|
+
function sortedScope(scope) {
|
|
193
|
+
const out = {};
|
|
194
|
+
for (const key of Object.keys(scope).sort()) {
|
|
195
|
+
const value = scope[key];
|
|
196
|
+
out[key] = Array.isArray(value) ? [...new Set(value)].sort() : value;
|
|
197
|
+
}
|
|
198
|
+
return out;
|
|
199
|
+
}
|
|
200
|
+
async function assertEventsListConformance(list, fixtures) {
|
|
201
|
+
const problems = await eventsListConformance(list, fixtures);
|
|
202
|
+
if (problems.length > 0) throw new Error(`events_list breaks the contract:
|
|
203
|
+
- ${problems.join("\n- ")}`);
|
|
204
|
+
}
|
|
205
|
+
export {
|
|
206
|
+
CONTRACT1_CODES,
|
|
207
|
+
ERROR_ALIASES,
|
|
208
|
+
ERROR_CODES,
|
|
209
|
+
EVENTS_LIST,
|
|
210
|
+
EVENT_KINDS,
|
|
211
|
+
EVENT_LIMITS,
|
|
212
|
+
EXTENSION_KIND,
|
|
213
|
+
EXTENSION_NAME,
|
|
214
|
+
EXTENSION_SEGMENT_MAX,
|
|
215
|
+
FIRST_RUN_HOURS,
|
|
216
|
+
GAP_REASONS,
|
|
217
|
+
MAX_BYTES,
|
|
218
|
+
MAX_PAGE_BYTES,
|
|
219
|
+
PAGE,
|
|
220
|
+
PROBE,
|
|
221
|
+
PROBE_LIMITS,
|
|
222
|
+
PROPOSED_CODES,
|
|
223
|
+
REFUSAL_REASONS,
|
|
224
|
+
SCOPE_KEY_PATTERN,
|
|
225
|
+
SINCE_PATTERN,
|
|
226
|
+
SOURCE_PATTERN,
|
|
227
|
+
SourceError,
|
|
228
|
+
TRUST,
|
|
229
|
+
assertEventsListConformance,
|
|
230
|
+
canonicalCode,
|
|
231
|
+
cut,
|
|
232
|
+
decodeCursor,
|
|
233
|
+
encodeCursor,
|
|
234
|
+
eventHash,
|
|
235
|
+
eventProblems,
|
|
236
|
+
eventsListConformance,
|
|
237
|
+
eventsListResult,
|
|
238
|
+
extensionNamespace,
|
|
239
|
+
fitPage,
|
|
240
|
+
isEventKind,
|
|
241
|
+
isEventKindIn,
|
|
242
|
+
isExtensionName,
|
|
243
|
+
makeEvent,
|
|
244
|
+
oldestFirst,
|
|
245
|
+
parseEventsListInput,
|
|
246
|
+
parseProbeInput,
|
|
247
|
+
parseSourceError,
|
|
248
|
+
probeResult,
|
|
249
|
+
probeResultProblems,
|
|
250
|
+
resultProblems,
|
|
251
|
+
scopeProblems,
|
|
252
|
+
screenEvents,
|
|
253
|
+
secretKinds,
|
|
254
|
+
sinceTime,
|
|
255
|
+
sourceNamespace,
|
|
256
|
+
startTime
|
|
257
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// @we-the-rebel-alliance/source-contract 0.1.0. Built by scripts/build.mjs; do not edit.
|
|
2
|
+
import {
|
|
3
|
+
CONTRACT_VERSION,
|
|
4
|
+
SUPPORTED_CONTRACT_VERSIONS
|
|
5
|
+
} from "./chunks/chunk-ELPJD3ND.js";
|
|
6
|
+
import "./chunks/chunk-HLVAKAYG.js";
|
|
7
|
+
export {
|
|
8
|
+
CONTRACT_VERSION,
|
|
9
|
+
SUPPORTED_CONTRACT_VERSIONS
|
|
10
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// @we-the-rebel-alliance/source-contract 0.1.0. Built by scripts/build.mjs; do not edit.
|
|
2
|
+
import {
|
|
3
|
+
MAX_RELATIVE_DAYS,
|
|
4
|
+
ME,
|
|
5
|
+
WINDOWS,
|
|
6
|
+
isTimeZone,
|
|
7
|
+
resolveParams,
|
|
8
|
+
resolveRelativeTime,
|
|
9
|
+
resolveSince,
|
|
10
|
+
resolveWindow
|
|
11
|
+
} from "./chunks/chunk-RYNKNCPP.js";
|
|
12
|
+
import "./chunks/chunk-HLVAKAYG.js";
|
|
13
|
+
export {
|
|
14
|
+
MAX_RELATIVE_DAYS,
|
|
15
|
+
ME,
|
|
16
|
+
WINDOWS,
|
|
17
|
+
isTimeZone,
|
|
18
|
+
resolveParams,
|
|
19
|
+
resolveRelativeTime,
|
|
20
|
+
resolveSince,
|
|
21
|
+
resolveWindow
|
|
22
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// @we-the-rebel-alliance/source-contract 0.1.0. Built by scripts/build.mjs; do not edit.
|
|
2
|
+
import {
|
|
3
|
+
ACCOUNT_PATTERN,
|
|
4
|
+
DENY_ALL,
|
|
5
|
+
accountProblem,
|
|
6
|
+
detailRules,
|
|
7
|
+
evaluate,
|
|
8
|
+
grantCovers,
|
|
9
|
+
methodAction,
|
|
10
|
+
namespaceOf,
|
|
11
|
+
operationRule,
|
|
12
|
+
probeRules,
|
|
13
|
+
sessionRules
|
|
14
|
+
} from "./chunks/chunk-3M5PAKSS.js";
|
|
15
|
+
import "./chunks/chunk-HLVAKAYG.js";
|
|
16
|
+
export {
|
|
17
|
+
ACCOUNT_PATTERN,
|
|
18
|
+
DENY_ALL,
|
|
19
|
+
accountProblem,
|
|
20
|
+
detailRules,
|
|
21
|
+
evaluate,
|
|
22
|
+
grantCovers,
|
|
23
|
+
methodAction,
|
|
24
|
+
namespaceOf,
|
|
25
|
+
operationRule,
|
|
26
|
+
probeRules,
|
|
27
|
+
sessionRules
|
|
28
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// @we-the-rebel-alliance/source-contract 0.1.0. Built by scripts/build.mjs; do not edit.
|
|
2
|
+
import {
|
|
3
|
+
MAX_PICK_PATHS,
|
|
4
|
+
MAX_PICK_PATH_LENGTH,
|
|
5
|
+
PICK_PATH,
|
|
6
|
+
missingPaths,
|
|
7
|
+
pick,
|
|
8
|
+
pickProblems,
|
|
9
|
+
pickProblemsForOutput
|
|
10
|
+
} from "./chunks/chunk-4ERCA4TK.js";
|
|
11
|
+
import "./chunks/chunk-6HDIB2SA.js";
|
|
12
|
+
import "./chunks/chunk-W5SHR7DQ.js";
|
|
13
|
+
import "./chunks/chunk-HLVAKAYG.js";
|
|
14
|
+
export {
|
|
15
|
+
MAX_PICK_PATHS,
|
|
16
|
+
MAX_PICK_PATH_LENGTH,
|
|
17
|
+
PICK_PATH,
|
|
18
|
+
missingPaths,
|
|
19
|
+
pick,
|
|
20
|
+
pickProblems,
|
|
21
|
+
pickProblemsForOutput
|
|
22
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// @we-the-rebel-alliance/source-contract 0.1.0. Built by scripts/build.mjs; do not edit.
|
|
2
|
+
import {
|
|
3
|
+
acceptAnswer,
|
|
4
|
+
checkReadRequest,
|
|
5
|
+
detailFields,
|
|
6
|
+
probe,
|
|
7
|
+
read,
|
|
8
|
+
readDetail
|
|
9
|
+
} from "./chunks/chunk-Q3RQA5J2.js";
|
|
10
|
+
import "./chunks/chunk-KYWBTAF4.js";
|
|
11
|
+
import "./chunks/chunk-RRUAIQ4I.js";
|
|
12
|
+
import "./chunks/chunk-KWEWSZ4V.js";
|
|
13
|
+
import "./chunks/chunk-ELPJD3ND.js";
|
|
14
|
+
import "./chunks/chunk-ZUKF7P6U.js";
|
|
15
|
+
import "./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";
|
|
22
|
+
export {
|
|
23
|
+
acceptAnswer,
|
|
24
|
+
checkReadRequest,
|
|
25
|
+
detailFields,
|
|
26
|
+
probe,
|
|
27
|
+
read,
|
|
28
|
+
readDetail
|
|
29
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// @we-the-rebel-alliance/source-contract 0.1.0. Built by scripts/build.mjs; do not edit.
|
|
2
|
+
import {
|
|
3
|
+
EXTENSION_OUTPUT,
|
|
4
|
+
IMAGE_DATA_URI_MAX,
|
|
5
|
+
OUTPUTS,
|
|
6
|
+
OUTPUT_NAMES,
|
|
7
|
+
checkOutput,
|
|
8
|
+
isExtensionOutput,
|
|
9
|
+
isOutputName,
|
|
10
|
+
outputValidator
|
|
11
|
+
} from "./chunks/chunk-6HDIB2SA.js";
|
|
12
|
+
import "./chunks/chunk-W5SHR7DQ.js";
|
|
13
|
+
import "./chunks/chunk-HLVAKAYG.js";
|
|
14
|
+
export {
|
|
15
|
+
EXTENSION_OUTPUT,
|
|
16
|
+
IMAGE_DATA_URI_MAX,
|
|
17
|
+
OUTPUTS,
|
|
18
|
+
OUTPUT_NAMES,
|
|
19
|
+
checkOutput,
|
|
20
|
+
isExtensionOutput,
|
|
21
|
+
isOutputName,
|
|
22
|
+
outputValidator
|
|
23
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// @we-the-rebel-alliance/source-contract 0.1.0. Built by scripts/build.mjs; do not edit.
|
|
2
|
+
import {
|
|
3
|
+
MAX_BYTES_DEFAULT,
|
|
4
|
+
MAX_BYTES_LIMIT,
|
|
5
|
+
SOURCES_SCHEMA
|
|
6
|
+
} from "./chunks/chunk-RRUAIQ4I.js";
|
|
7
|
+
import "./chunks/chunk-KWEWSZ4V.js";
|
|
8
|
+
import "./chunks/chunk-ZUKF7P6U.js";
|
|
9
|
+
import "./chunks/chunk-I2RXJJJM.js";
|
|
10
|
+
import "./chunks/chunk-3M5PAKSS.js";
|
|
11
|
+
import "./chunks/chunk-W5SHR7DQ.js";
|
|
12
|
+
import "./chunks/chunk-HLVAKAYG.js";
|
|
13
|
+
export {
|
|
14
|
+
MAX_BYTES_DEFAULT,
|
|
15
|
+
MAX_BYTES_LIMIT,
|
|
16
|
+
SOURCES_SCHEMA
|
|
17
|
+
};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"properties": {
|
|
5
|
+
"items": {
|
|
6
|
+
"maxItems": 50,
|
|
7
|
+
"type": "array",
|
|
8
|
+
"items": {
|
|
9
|
+
"type": "object",
|
|
10
|
+
"properties": {
|
|
11
|
+
"id": {
|
|
12
|
+
"type": "string",
|
|
13
|
+
"minLength": 1,
|
|
14
|
+
"maxLength": 128
|
|
15
|
+
},
|
|
16
|
+
"url": {
|
|
17
|
+
"type": "string",
|
|
18
|
+
"maxLength": 2048
|
|
19
|
+
},
|
|
20
|
+
"ask": {
|
|
21
|
+
"type": "string",
|
|
22
|
+
"maxLength": 200
|
|
23
|
+
},
|
|
24
|
+
"title": {
|
|
25
|
+
"type": "string",
|
|
26
|
+
"maxLength": 120
|
|
27
|
+
},
|
|
28
|
+
"start": {
|
|
29
|
+
"anyOf": [
|
|
30
|
+
{
|
|
31
|
+
"type": "string",
|
|
32
|
+
"format": "date-time",
|
|
33
|
+
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"type": "string",
|
|
37
|
+
"pattern": "^\\d{4}-\\d{2}-\\d{2}$"
|
|
38
|
+
}
|
|
39
|
+
]
|
|
40
|
+
},
|
|
41
|
+
"end": {
|
|
42
|
+
"anyOf": [
|
|
43
|
+
{
|
|
44
|
+
"type": "string",
|
|
45
|
+
"format": "date-time",
|
|
46
|
+
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"type": "string",
|
|
50
|
+
"pattern": "^\\d{4}-\\d{2}-\\d{2}$"
|
|
51
|
+
}
|
|
52
|
+
]
|
|
53
|
+
},
|
|
54
|
+
"allDay": {
|
|
55
|
+
"type": "boolean"
|
|
56
|
+
},
|
|
57
|
+
"location": {
|
|
58
|
+
"type": "string",
|
|
59
|
+
"maxLength": 120
|
|
60
|
+
},
|
|
61
|
+
"calendar": {
|
|
62
|
+
"type": "string",
|
|
63
|
+
"maxLength": 60
|
|
64
|
+
},
|
|
65
|
+
"joinUrl": {
|
|
66
|
+
"type": "string",
|
|
67
|
+
"maxLength": 2048
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
"required": [
|
|
71
|
+
"id",
|
|
72
|
+
"title",
|
|
73
|
+
"start"
|
|
74
|
+
],
|
|
75
|
+
"additionalProperties": false
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
"rangeEnd": {
|
|
79
|
+
"anyOf": [
|
|
80
|
+
{
|
|
81
|
+
"type": "string",
|
|
82
|
+
"format": "date-time",
|
|
83
|
+
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"type": "string",
|
|
87
|
+
"pattern": "^\\d{4}-\\d{2}-\\d{2}$"
|
|
88
|
+
}
|
|
89
|
+
]
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
"required": [
|
|
93
|
+
"items"
|
|
94
|
+
],
|
|
95
|
+
"additionalProperties": false
|
|
96
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"properties": {
|
|
5
|
+
"label": {
|
|
6
|
+
"type": "string",
|
|
7
|
+
"maxLength": 60
|
|
8
|
+
},
|
|
9
|
+
"target": {
|
|
10
|
+
"type": "string",
|
|
11
|
+
"format": "date-time",
|
|
12
|
+
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
|
|
13
|
+
},
|
|
14
|
+
"style": {
|
|
15
|
+
"type": "string",
|
|
16
|
+
"enum": [
|
|
17
|
+
"relative",
|
|
18
|
+
"timer"
|
|
19
|
+
]
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"required": [
|
|
23
|
+
"label",
|
|
24
|
+
"target",
|
|
25
|
+
"style"
|
|
26
|
+
],
|
|
27
|
+
"additionalProperties": false
|
|
28
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"properties": {
|
|
5
|
+
"url": {
|
|
6
|
+
"type": "string",
|
|
7
|
+
"maxLength": 2048
|
|
8
|
+
},
|
|
9
|
+
"dataUri": {
|
|
10
|
+
"type": "string",
|
|
11
|
+
"maxLength": 1044480,
|
|
12
|
+
"pattern": "^data:image\\/(png|jpeg|webp);base64,[A-Za-z0-9+/]+={0,2}$"
|
|
13
|
+
},
|
|
14
|
+
"alt": {
|
|
15
|
+
"type": "string",
|
|
16
|
+
"minLength": 1,
|
|
17
|
+
"maxLength": 200
|
|
18
|
+
},
|
|
19
|
+
"caption": {
|
|
20
|
+
"type": "string",
|
|
21
|
+
"maxLength": 120
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"required": [
|
|
25
|
+
"alt"
|
|
26
|
+
],
|
|
27
|
+
"additionalProperties": false
|
|
28
|
+
}
|