@joe-broadhead/opencode-mem 0.12.4 → 0.12.6
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 +81 -0
- package/README.md +1 -0
- package/package.json +147 -2
- package/src/actions.js +36 -1
- package/src/collector.js +176 -12
- package/src/plugins/source-contract/index.js +2 -2
- package/src/plugins/source-contract/vendor/PROVENANCE.json +9 -9
- 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 +36 -29
- package/src/plugins/source-contract/vendor/broker-client.js +14 -14
- package/src/plugins/source-contract/vendor/chunks/{chunk-JUWIMDGF.js → chunk-6ZSJSJMV.js} +2 -2
- package/src/plugins/source-contract/vendor/chunks/{chunk-77MJETEE.js → chunk-A2KM6BYK.js} +13 -13
- package/src/plugins/source-contract/vendor/chunks/{chunk-HVBOAYBO.js → chunk-BEU3WWNO.js} +59 -6
- package/src/plugins/source-contract/vendor/chunks/{chunk-T4QM7B3S.js → chunk-CUITXC5J.js} +1 -1
- package/src/{vendor/source-contract/chunks/chunk-OZMX7VR7.js → plugins/source-contract/vendor/chunks/chunk-EOS4LD6F.js} +1 -1
- package/src/plugins/source-contract/vendor/chunks/{chunk-F4K2Y64D.js → chunk-EUDLXWG4.js} +1 -1
- package/src/plugins/source-contract/vendor/chunks/{chunk-BOUWB5UP.js → chunk-GDBKZBG7.js} +2 -2
- package/src/plugins/source-contract/vendor/chunks/{chunk-EHIOPXPL.js → chunk-HR22TL23.js} +14 -14
- package/src/plugins/source-contract/vendor/chunks/{chunk-X6XP7YK2.js → chunk-IGPRJ63D.js} +2 -2
- package/src/plugins/source-contract/vendor/chunks/{chunk-XVA6H6OO.js → chunk-IIUWLSGP.js} +2 -2
- package/src/plugins/source-contract/vendor/chunks/chunk-ITQZIF2U.js +191 -0
- package/src/plugins/source-contract/vendor/chunks/{chunk-IL565TRX.js → chunk-KXQYSM2Z.js} +1 -1
- package/src/plugins/source-contract/vendor/chunks/{chunk-YH323FAZ.js → chunk-LJL3EALP.js} +238 -12
- package/src/plugins/source-contract/vendor/chunks/{chunk-NUEROZNU.js → chunk-NUBUQFLH.js} +1 -1
- 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 +22 -4
- package/src/plugins/source-contract/vendor/hints.js +33 -0
- 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 +3 -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 +14 -10
- package/src/plugins/source-contract/vendor/schemas/fact.commitment.json +57 -0
- package/src/plugins/source-contract/vendor/schemas/fact.meeting.attended.json +35 -0
- package/src/plugins/source-contract/vendor/schemas/fact.person.attribute.json +37 -0
- package/src/plugins/source-contract/vendor/schemas/hint.json +41 -0
- package/src/plugins/source-contract/vendor/schemas/routine.json +67 -0
- package/src/plugins/source-contract/vendor/schemas/sources.json +56 -0
- package/src/plugins/source-contract/vendor/schemas.js +16 -11
- package/src/plugins/source-contract/vendor/tools-rpc.js +4 -4
- package/src/records.js +5 -0
- package/src/vendor/source-contract/README.md +10 -8
- package/src/vendor/source-contract/VENDOR.json +48 -39
- package/src/vendor/source-contract/chunks/{chunk-JUWIMDGF.js → chunk-6ZSJSJMV.js} +2 -2
- package/src/vendor/source-contract/chunks/{chunk-T4QM7B3S.js → chunk-CUITXC5J.js} +1 -1
- package/src/{plugins/source-contract/vendor/chunks/chunk-OZMX7VR7.js → vendor/source-contract/chunks/chunk-EOS4LD6F.js} +1 -1
- package/src/vendor/source-contract/chunks/{chunk-BOUWB5UP.js → chunk-GDBKZBG7.js} +2 -2
- package/src/vendor/source-contract/chunks/{chunk-X6XP7YK2.js → chunk-IGPRJ63D.js} +2 -2
- package/src/vendor/source-contract/chunks/{chunk-YH323FAZ.js → chunk-LJL3EALP.js} +238 -12
- package/src/vendor/source-contract/chunks/{chunk-NUEROZNU.js → chunk-NUBUQFLH.js} +1 -1
- package/src/vendor/source-contract/cursor.js +3 -3
- package/src/vendor/source-contract/events.js +22 -4
- package/src/vendor/source-contract/registry.js +4 -4
- package/src/vendor/source-contract/tools-rpc.js +4 -4
- package/src/views/contracts.js +5 -1
- package/src/views/rpc.js +11 -0
- package/src/views/shape.js +11 -1
|
@@ -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.3.0",
|
|
3
|
+
"tagObject": "6e5136e274b7071d326d09d4ae5812b135228afb",
|
|
4
|
+
"commit": "2fd55cdc0c6c1067927fefc403a88bfd18c9a971",
|
|
5
|
+
"url": "https://github.com/we-the-rebel-alliance/source-contract/releases/tag/v0.3.0",
|
|
6
|
+
"published": "2026-11-18T00:59:15Z",
|
|
7
7
|
"sha256sums": {
|
|
8
8
|
"file": "RELEASE-SHA256SUMS",
|
|
9
|
-
"sha256": "
|
|
9
|
+
"sha256": "9deb3868d9d5c13f744f5fb87dead2d18ed987bad8d8548fe4d812bca4a4d235"
|
|
10
10
|
},
|
|
11
11
|
"assets": {
|
|
12
|
-
"source-contract-0.
|
|
13
|
-
"source-contract-conformance-0.
|
|
14
|
-
"source-contract-schemas-0.
|
|
12
|
+
"source-contract-0.3.0.tgz": "120cc9452302571d9674ecf108113a60390b96add0be7953bb5a1040c0a25a73",
|
|
13
|
+
"source-contract-conformance-0.3.0.mjs": "721279b2d6a1706a992b532285647db67e72f02cc4e9dde1dadf691e3d1b2863",
|
|
14
|
+
"source-contract-schemas-0.3.0.json": "fee84bb0cd88037272c2342cbcaf7b2d8b9052ba006592c1d3051408ec4fb172"
|
|
15
15
|
},
|
|
16
16
|
"pinnedAt": "test/fixtures/contract/"
|
|
17
17
|
}
|
|
@@ -1,30 +1,35 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
1
|
+
7338322bbbcf2a9aa4970be52b49d64f8d9b29a4817225de817415fc5df38ce7 broker-client.js
|
|
2
|
+
f4dce407e43e69044733d1c777f8f675da019b35b61829f5427a7399c378d473 chunks/chunk-6ZSJSJMV.js
|
|
3
|
+
3b48f3dce57ce54db9cfd760b92b1e6785297a9624792e66d3a99c404f8fdbc1 chunks/chunk-A2KM6BYK.js
|
|
4
|
+
1a84c77dea7873ca5454d1e141a7abf9fbc2088cdbd2521aab0985be37e15c4b chunks/chunk-BEU3WWNO.js
|
|
5
|
+
7356ce701b8031c195cd80c607e42132327c70f5ce77d8d90136fdbf229391be chunks/chunk-CUITXC5J.js
|
|
6
|
+
284e0921f6e59c8f25b5627587388628e0e58cf836ea58a067ba059b06c34cf3 chunks/chunk-EOS4LD6F.js
|
|
7
|
+
94a7d607142cc65a444f5136115cdb52c19a8f8e6a3148d2b0f67d5757a53b3e chunks/chunk-EUDLXWG4.js
|
|
8
|
+
95bda4fd3eabc20c99415c099d3bf8f217d6875491ca9b95fd7a350480114364 chunks/chunk-GDBKZBG7.js
|
|
9
|
+
686b9fb992371b09b2410c26e4ae1434cd5537093dff500f8408df0960a48393 chunks/chunk-HR22TL23.js
|
|
10
|
+
d3760e44d7b51aeabf6a79ea6b36b8193746c91e2bdcf4af5b847e05213c1cda chunks/chunk-IGPRJ63D.js
|
|
11
|
+
5a77c6f0147828e322361180282b16ffa5ec532460047f67462dff7b3614653b chunks/chunk-IIUWLSGP.js
|
|
12
|
+
66c80befaab4e4a60030aff86536c8714c3689007eae952d9fe64e4c0bfc755d chunks/chunk-ITQZIF2U.js
|
|
13
|
+
2db8791393a51144ad625a93c32ed7b513d62b32c1e8a5aa04ef5d9367128de5 chunks/chunk-KXQYSM2Z.js
|
|
14
|
+
6e9f5bcb4ed13a1bce165a37f766d0cc6ff60f8103bcbe357061977cfb2669d8 chunks/chunk-LJL3EALP.js
|
|
15
|
+
7af09eece1414e0b0f9bb201427d662b96f29b650bb6115998362135dce303b6 chunks/chunk-NUBUQFLH.js
|
|
16
|
+
79c27dccfa5792298d15e0c5772e02af88194f3696af5063aebf43b94e0b64f0 conformance.js
|
|
17
|
+
e79fac955db3d8441c1e74e8e2c8197c6cce6046974528805771c87d46192acc cursor.js
|
|
18
|
+
024e4036fbe3a2de25253a222565901429fc05acc62babd7624aabd8763dc471 descriptor.js
|
|
19
|
+
4371c957d5b8482410a1a4b3112eb6846de3fba672cc9862d129a77780cfd040 events.js
|
|
20
|
+
46cf305d3f0a6a56e6062d0f3af98acd84466ca04ed85ccbbc487962bd843e6b hints.js
|
|
21
|
+
66079527c7f5526d0b7629cce7882c1b07edcdfe0c3493a69f630c778f60c2d0 index.js
|
|
22
|
+
3bfa29b240986be60c838c21c5f0ea16183dd965ee772987d56d28f82e03cdbb params.js
|
|
23
|
+
c4102e605cadc767603a297f158375bbbe7d36c26fa5cedf367f8574be07d03f permission.js
|
|
24
|
+
2932b5e06b55546c53a49947cdaedcca35d4e9f67265e024feb0bd23e1cfcfb3 pick.js
|
|
25
|
+
2db6b59d39209acfe0cc1c6ebf7819d3c1e44fb0f57875769524550d7692978c read.js
|
|
26
|
+
6d2b55b4fceacefd17d3fbac4d59fb270802ab55d4f99ed503f4a738f1dbf189 registry.js
|
|
27
|
+
702e50402f5c1223ddc2106d414b5af3b3758b4eeefe81276b416e8da7acc06e schema.js
|
|
28
|
+
a88ec1bbf780363580e50c3ac034a7793888cdb93a7904c0e083eaa650bcc87e schemas.js
|
|
29
|
+
6b28eb55681a16ec008f80ec50d1406ef5841b81d06142265e0d34592227294a schemas/fact.commitment.json
|
|
30
|
+
57ae58c8631b9e430acd4ad93d2f605d6edb1111c50a0dd6ed9f28bae8187f44 schemas/fact.meeting.attended.json
|
|
31
|
+
d7c146d58ba5a4331c54211ecc007fa515a04208e1685b6b73a5a17c49c23a43 schemas/fact.person.attribute.json
|
|
32
|
+
b6a74c4c70be553c84be2028186336ed8e20264a350aad60995b3ee612cb0f06 schemas/hint.json
|
|
28
33
|
afdcaa972b3294394883025d8c531ff51d4117cb8f5d2240b5f55319cf646b10 schemas/output.agenda.json
|
|
29
34
|
2bb069201056c91056b3590417918970e3b79950df39f45f1537cc59eb3b9933 schemas/output.countdown.json
|
|
30
35
|
b162cf16515ffb3eb324c4cc62d9898e6c894ba882d91af60025b60cf33129f9 schemas/output.image.json
|
|
@@ -37,5 +42,7 @@ aa806aeb1f800c179648c7d3ad2d2ee67fa3c39977087d6f03c733ad28d14dcd schemas/output
|
|
|
37
42
|
30fbb81a6f8df5d0601e428f2503eb726eca603cc350805852dc7c909a9b59a1 schemas/output.record.json
|
|
38
43
|
3d9695004dbf803576efcca0ff5bcef94af2d9475131db2fc694f974bc217dae schemas/output.table.json
|
|
39
44
|
ffaaaa5107a2a6b7b36230e2e458383591b687af77c1be2e1876194bdeb40f90 schemas/output.thread.json
|
|
40
|
-
|
|
41
|
-
|
|
45
|
+
57e741ae3ff5b5685da7f267457d55459b66339e5aad6307eefc66e3c17921e0 schemas/routine.json
|
|
46
|
+
94960ad9f02464e80cbfb27cf85ad1383f27a33e1b7760319d0a925c0ca68101 schemas/sources.json
|
|
47
|
+
1a00d3f937d6c65cd6987bbd0f0da1591d6f423bd7751aedfdc8cdd152bfa04e THIRD-PARTY-NOTICES.md
|
|
48
|
+
c29b83c40ccb62a519250ac077e8469428402b8eeec0615b11bf6ef2bd9718d3 tools-rpc.js
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
// @we-the-rebel-alliance/source-contract 0.
|
|
1
|
+
// @we-the-rebel-alliance/source-contract 0.3.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-A2KM6BYK.js";
|
|
8
|
+
import "./chunks/chunk-IIUWLSGP.js";
|
|
9
|
+
import "./chunks/chunk-HR22TL23.js";
|
|
10
|
+
import "./chunks/chunk-GDBKZBG7.js";
|
|
11
|
+
import "./chunks/chunk-BEU3WWNO.js";
|
|
12
|
+
import "./chunks/chunk-IGPRJ63D.js";
|
|
13
|
+
import "./chunks/chunk-KXQYSM2Z.js";
|
|
14
|
+
import "./chunks/chunk-6ZSJSJMV.js";
|
|
15
|
+
import "./chunks/chunk-LJL3EALP.js";
|
|
13
16
|
import {
|
|
14
17
|
canonicalScope
|
|
15
|
-
} from "./chunks/chunk-
|
|
16
|
-
import "./chunks/chunk-
|
|
17
|
-
import "./chunks/chunk-
|
|
18
|
-
import "./chunks/chunk-
|
|
19
|
-
import "./chunks/chunk-BOUWB5UP.js";
|
|
20
|
-
import "./chunks/chunk-JUWIMDGF.js";
|
|
21
|
-
import "./chunks/chunk-T4QM7B3S.js";
|
|
18
|
+
} from "./chunks/chunk-NUBUQFLH.js";
|
|
19
|
+
import "./chunks/chunk-EUDLXWG4.js";
|
|
20
|
+
import "./chunks/chunk-EOS4LD6F.js";
|
|
21
|
+
import "./chunks/chunk-CUITXC5J.js";
|
|
22
22
|
|
|
23
23
|
// src/broker-client.ts
|
|
24
24
|
var BROKER_CODE_ALIASES = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
// @we-the-rebel-alliance/source-contract 0.
|
|
1
|
+
// @we-the-rebel-alliance/source-contract 0.3.0. Built by scripts/build.mjs; do not edit.
|
|
2
2
|
import {
|
|
3
3
|
__export
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-CUITXC5J.js";
|
|
5
5
|
|
|
6
6
|
// node_modules/zod/v4/classic/schemas.js
|
|
7
7
|
var schemas_exports2 = {};
|
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
// @we-the-rebel-alliance/source-contract 0.
|
|
1
|
+
// @we-the-rebel-alliance/source-contract 0.3.0. Built by scripts/build.mjs; do not edit.
|
|
2
|
+
import {
|
|
3
|
+
pick,
|
|
4
|
+
pickProblemsForOutput
|
|
5
|
+
} from "./chunk-IIUWLSGP.js";
|
|
2
6
|
import {
|
|
3
7
|
findSource,
|
|
4
8
|
maxBytesOf
|
|
5
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-HR22TL23.js";
|
|
10
|
+
import {
|
|
11
|
+
checkOutput
|
|
12
|
+
} from "./chunk-GDBKZBG7.js";
|
|
6
13
|
import {
|
|
7
14
|
ERROR_CODES,
|
|
8
15
|
PAGE,
|
|
9
16
|
canonicalCode,
|
|
10
17
|
probeResultProblems,
|
|
11
18
|
resultProblems
|
|
12
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-LJL3EALP.js";
|
|
13
20
|
import {
|
|
14
21
|
canonicalScope
|
|
15
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-NUBUQFLH.js";
|
|
16
23
|
import {
|
|
17
24
|
resolveParams,
|
|
18
25
|
resolveSince
|
|
19
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-EUDLXWG4.js";
|
|
20
27
|
import {
|
|
21
28
|
detailRules,
|
|
22
29
|
grantCovers,
|
|
23
30
|
probeRules,
|
|
24
31
|
sessionRules
|
|
25
|
-
} from "./chunk-
|
|
26
|
-
import {
|
|
27
|
-
pick,
|
|
28
|
-
pickProblemsForOutput
|
|
29
|
-
} from "./chunk-XVA6H6OO.js";
|
|
30
|
-
import {
|
|
31
|
-
checkOutput
|
|
32
|
-
} from "./chunk-BOUWB5UP.js";
|
|
32
|
+
} from "./chunk-EOS4LD6F.js";
|
|
33
33
|
|
|
34
34
|
// src/internal/failure.ts
|
|
35
35
|
var FAILURE_CODES = ERROR_CODES;
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
// @we-the-rebel-alliance/source-contract 0.
|
|
1
|
+
// @we-the-rebel-alliance/source-contract 0.3.0. Built by scripts/build.mjs; do not edit.
|
|
2
2
|
import {
|
|
3
3
|
isToolsRpcId
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import {
|
|
6
|
-
isEventKind
|
|
7
|
-
} from "./chunk-YH323FAZ.js";
|
|
4
|
+
} from "./chunk-IGPRJ63D.js";
|
|
8
5
|
import {
|
|
9
6
|
_enum,
|
|
10
7
|
array,
|
|
@@ -19,7 +16,14 @@ import {
|
|
|
19
16
|
string,
|
|
20
17
|
union,
|
|
21
18
|
validator
|
|
22
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-6ZSJSJMV.js";
|
|
20
|
+
import {
|
|
21
|
+
ATTENDANCE_RESPONSES,
|
|
22
|
+
COMMITMENT_STATES,
|
|
23
|
+
EVENT_LIMITS,
|
|
24
|
+
FACT_TYPES,
|
|
25
|
+
isEventKind
|
|
26
|
+
} from "./chunk-LJL3EALP.js";
|
|
23
27
|
|
|
24
28
|
// src/internal/schema/types.ts
|
|
25
29
|
var MAX_BYTES_DEFAULT = 65536;
|
|
@@ -35,6 +39,8 @@ var REGISTRY_NAME = /^[a-z][a-z0-9-]{0,31}$/;
|
|
|
35
39
|
var isOutputName = (name) => REGISTRY_NAME.test(name) || isEventKind(name);
|
|
36
40
|
var PRICE_PER = /^[a-z][a-z0-9-]{0,31}$/;
|
|
37
41
|
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])?)+$/;
|
|
42
|
+
var FILE_PATH = /^[a-z0-9][a-z0-9._-]*(?:\/[a-z0-9][a-z0-9._-]*)*\.md$/;
|
|
43
|
+
var filePath = string().max(200).regex(FILE_PATH, { error: "must be a relative path in the package ending in .md, such as hints/mail.md" });
|
|
38
44
|
var price = object({
|
|
39
45
|
per: string().max(32).regex(PRICE_PER, { error: "must be a lowercase word such as post, author or call" }),
|
|
40
46
|
usd: number().min(0),
|
|
@@ -148,6 +154,11 @@ var events = object({
|
|
|
148
154
|
kind: literal("events"),
|
|
149
155
|
reads: string().max(64).refine(isEventKind, { error: "must be a core kind such as message, or x-<namespace>/<name>" }).describe("The thing it reads: a core kind, or x-<namespace>/<name>, whose namespace is the source's."),
|
|
150
156
|
details: array(detail).optional(),
|
|
157
|
+
facts: array(_enum(FACT_TYPES, { error: "must be a core fact type (commitment, person.attribute, meeting.attended)" })).min(1, "must name at least one fact type").optional().describe(
|
|
158
|
+
"The fact types this source's events carry (#45 \xA73), each a core type. An event may carry a fact of a declared type and of no other; Memory stamps the installed package's version on each fact it files."
|
|
159
|
+
),
|
|
160
|
+
hints: array(filePath).min(1, "must name at least one hint file").optional().describe("The hint files the package ships for this source (#45 \xA74): how to read one kind of item, at most 1,500 characters each."),
|
|
161
|
+
routines: array(filePath).min(1, "must name at least one routine file").optional().describe("The routine files the package ships for this source (#45 \xA75). Memory's first engine runs only its own core routines, so a plugin ships one only later."),
|
|
151
162
|
permission: permissionEvents,
|
|
152
163
|
output: never({ error: "an events source has no output: output belongs to a snapshot" }).optional(),
|
|
153
164
|
maxAgeSec: never({ error: "an events source has no maxAgeSec: a snapshot may be reused, an events page is read once" }).optional(),
|
|
@@ -159,8 +170,11 @@ var snapshot = object({
|
|
|
159
170
|
output: string().max(64).refine(isOutputName, { error: "must be a registry name such as agenda, or x-<namespace>/<name>" }).describe("A registry name, or x-<namespace>/<name>; an x- output carries its schema inline."),
|
|
160
171
|
outputSchema: union([boolean(), looseObject({})]).optional().describe("An x- output's schema, inline: JSON Schema draft 2020-12. Required for x-, absent for a registry name."),
|
|
161
172
|
params: looseObject({}).optional().describe("The parameters a consumer may pass, resolved by the library at read time."),
|
|
173
|
+
hints: array(filePath).min(1, "must name at least one hint file").optional().describe("The hint files the package ships for this source (#45 \xA74): how to read one kind of item, at most 1,500 characters each."),
|
|
174
|
+
routines: array(filePath).min(1, "must name at least one routine file").optional().describe("The routine files the package ships for this source (#45 \xA75). Memory's first engine runs only its own core routines, so a plugin ships one only later."),
|
|
162
175
|
permission: permissionTool,
|
|
163
176
|
maxAgeSec: int().min(1).optional().describe("How long a result may be reused before it is read again."),
|
|
177
|
+
facts: never({ error: "a snapshot has no facts: a fact is derived from an event's provider fields" }).optional(),
|
|
164
178
|
reads: never({ error: "a snapshot has no reads: it is state, not a feed" }).optional(),
|
|
165
179
|
details: never({ error: "a snapshot has no details: it has no events to read one of" }).optional()
|
|
166
180
|
}).strict().describe("A snapshot source: the latest state, read on demand.").superRefine((value, ctx) => {
|
|
@@ -180,11 +194,50 @@ var sourcesSchema = object({
|
|
|
180
194
|
items: array(source).min(1).describe("The plugin's sources. A source id is unique across the declaration.")
|
|
181
195
|
}).strict();
|
|
182
196
|
|
|
197
|
+
// src/internal/schema/facts.ts
|
|
198
|
+
var actorId = string().min(1).max(EVENT_LIMITS.actorId).describe("An actor id on the same event.");
|
|
199
|
+
var httpsUrl = string().max(EVENT_LIMITS.url).refine((value) => /^https:\/\/\S+$/.test(value), { error: "must be an https URL" });
|
|
200
|
+
var commitment = object({
|
|
201
|
+
type: literal("commitment"),
|
|
202
|
+
key: string().min(1).max(EVENT_LIMITS.factKey).describe("A stable id of this commitment within the source and account."),
|
|
203
|
+
title: string().min(1).max(EVENT_LIMITS.factTitle),
|
|
204
|
+
owner: actorId,
|
|
205
|
+
counterparty: actorId.optional(),
|
|
206
|
+
due: string().regex(/^\d{4}-\d{2}-\d{2}$/, { error: "must be a date such as 2026-11-30" }).optional(),
|
|
207
|
+
state: _enum(COMMITMENT_STATES),
|
|
208
|
+
url: httpsUrl.optional()
|
|
209
|
+
}).strict();
|
|
210
|
+
var personAttribute = object({
|
|
211
|
+
type: literal("person.attribute"),
|
|
212
|
+
actor: actorId,
|
|
213
|
+
org: string().min(1).max(EVENT_LIMITS.factAttribute).optional(),
|
|
214
|
+
team: string().min(1).max(EVENT_LIMITS.factAttribute).optional(),
|
|
215
|
+
role: string().min(1).max(EVENT_LIMITS.factAttribute).optional()
|
|
216
|
+
}).strict().refine((value) => value.org !== void 0 || value.team !== void 0 || value.role !== void 0, {
|
|
217
|
+
error: "must name org, team or role: a person's attribute comes from structured profile or directory data"
|
|
218
|
+
}).describe("A person's attribute, from structured profile or directory data only: at least one of org, team or role.");
|
|
219
|
+
var meetingAttended = object({
|
|
220
|
+
type: literal("meeting.attended"),
|
|
221
|
+
actor: actorId,
|
|
222
|
+
response: _enum(ATTENDANCE_RESPONSES),
|
|
223
|
+
organizer: boolean()
|
|
224
|
+
}).strict();
|
|
225
|
+
var FACT_SCHEMAS = {
|
|
226
|
+
commitment: validator("fact.commitment", commitment),
|
|
227
|
+
"person.attribute": validator("fact.person.attribute", personAttribute),
|
|
228
|
+
"meeting.attended": validator("fact.meeting.attended", meetingAttended)
|
|
229
|
+
};
|
|
230
|
+
function factSchema(type) {
|
|
231
|
+
return Object.hasOwn(FACT_SCHEMAS, type) ? FACT_SCHEMAS[type] : void 0;
|
|
232
|
+
}
|
|
233
|
+
|
|
183
234
|
// src/schema.ts
|
|
184
235
|
var SOURCES_SCHEMA = validator("sources", sourcesSchema);
|
|
185
236
|
|
|
186
237
|
export {
|
|
187
238
|
MAX_BYTES_DEFAULT,
|
|
188
239
|
MAX_BYTES_LIMIT,
|
|
240
|
+
FACT_SCHEMAS,
|
|
241
|
+
factSchema,
|
|
189
242
|
SOURCES_SCHEMA
|
|
190
243
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @we-the-rebel-alliance/source-contract 0.
|
|
1
|
+
// @we-the-rebel-alliance/source-contract 0.3.0. Built by scripts/build.mjs; do not edit.
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __export = (target, all) => {
|
|
4
4
|
for (var name in all)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @we-the-rebel-alliance/source-contract 0.
|
|
1
|
+
// @we-the-rebel-alliance/source-contract 0.3.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-6ZSJSJMV.js";
|
|
17
17
|
|
|
18
18
|
// src/registry.ts
|
|
19
19
|
var text = (max) => string().max(max);
|
|
@@ -1,20 +1,15 @@
|
|
|
1
|
-
// @we-the-rebel-alliance/source-contract 0.
|
|
2
|
-
import {
|
|
3
|
-
SOURCES_SCHEMA
|
|
4
|
-
} from "./chunk-HVBOAYBO.js";
|
|
5
|
-
import {
|
|
6
|
-
SUPPORTED_CONTRACT_VERSIONS
|
|
7
|
-
} from "./chunk-IL565TRX.js";
|
|
8
|
-
import {
|
|
9
|
-
EVENT_KINDS,
|
|
10
|
-
MAX_BYTES,
|
|
11
|
-
isEventKind
|
|
12
|
-
} from "./chunk-YH323FAZ.js";
|
|
1
|
+
// @we-the-rebel-alliance/source-contract 0.3.0. Built by scripts/build.mjs; do not edit.
|
|
13
2
|
import {
|
|
14
3
|
OUTPUT_NAMES,
|
|
15
4
|
isExtensionOutput,
|
|
16
5
|
isOutputName
|
|
17
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-GDBKZBG7.js";
|
|
7
|
+
import {
|
|
8
|
+
SOURCES_SCHEMA
|
|
9
|
+
} from "./chunk-BEU3WWNO.js";
|
|
10
|
+
import {
|
|
11
|
+
SUPPORTED_CONTRACT_VERSIONS
|
|
12
|
+
} from "./chunk-KXQYSM2Z.js";
|
|
18
13
|
import {
|
|
19
14
|
_enum,
|
|
20
15
|
array,
|
|
@@ -26,7 +21,12 @@ import {
|
|
|
26
21
|
record,
|
|
27
22
|
string,
|
|
28
23
|
unknown
|
|
29
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-6ZSJSJMV.js";
|
|
25
|
+
import {
|
|
26
|
+
EVENT_KINDS,
|
|
27
|
+
MAX_BYTES,
|
|
28
|
+
isEventKind
|
|
29
|
+
} from "./chunk-LJL3EALP.js";
|
|
30
30
|
|
|
31
31
|
// src/descriptor.ts
|
|
32
32
|
import { createHash } from "node:crypto";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
// @we-the-rebel-alliance/source-contract 0.
|
|
1
|
+
// @we-the-rebel-alliance/source-contract 0.3.0. Built by scripts/build.mjs; do not edit.
|
|
2
2
|
import {
|
|
3
3
|
ACCOUNT_PATTERN,
|
|
4
4
|
evaluate
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-EOS4LD6F.js";
|
|
6
6
|
|
|
7
7
|
// src/tools-rpc.ts
|
|
8
8
|
import { randomUUID } from "node:crypto";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
// @we-the-rebel-alliance/source-contract 0.
|
|
1
|
+
// @we-the-rebel-alliance/source-contract 0.3.0. Built by scripts/build.mjs; do not edit.
|
|
2
2
|
import {
|
|
3
3
|
isExtensionOutput,
|
|
4
4
|
outputValidator
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-GDBKZBG7.js";
|
|
6
6
|
|
|
7
7
|
// src/pick.ts
|
|
8
8
|
var MAX_PICK_PATHS = 50;
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
// @we-the-rebel-alliance/source-contract 0.3.0. Built by scripts/build.mjs; do not edit.
|
|
2
|
+
import {
|
|
3
|
+
_enum,
|
|
4
|
+
array,
|
|
5
|
+
object,
|
|
6
|
+
string,
|
|
7
|
+
validator
|
|
8
|
+
} from "./chunk-6ZSJSJMV.js";
|
|
9
|
+
import {
|
|
10
|
+
isEventKind
|
|
11
|
+
} from "./chunk-LJL3EALP.js";
|
|
12
|
+
|
|
13
|
+
// src/hints.ts
|
|
14
|
+
var HINT_MAX = 1500;
|
|
15
|
+
var ROUTINE_BODY_MAX = 4e3;
|
|
16
|
+
var HINT_KEYS = ["source", "kinds", "produces"];
|
|
17
|
+
var ROUTINE_KEYS = ["id", "title", "reads", "produces"];
|
|
18
|
+
var FORBIDDEN_HINT_KEYS = ["apply", "stated_by", "space", "budget", "priority"];
|
|
19
|
+
var FORBIDDEN_ROUTINE_KEYS = ["tier", "schedule", "budget", "priority", "apply", "stated_by", "namespace"];
|
|
20
|
+
var PRODUCES_TYPES = ["commitment", "decision", "fact", "preference", "constraint", "person", "project"];
|
|
21
|
+
var PRODUCES_LIST = "commitment, decision, fact, preference, constraint, person or project";
|
|
22
|
+
var SOURCE_ID = /^[a-z][a-z0-9-]*(\.[a-z][a-z0-9-]*)+$/;
|
|
23
|
+
var ROUTINE_ID = /^[a-z][a-z0-9-]{0,63}$/;
|
|
24
|
+
var KEY = /^[a-z][a-z0-9_]*$/;
|
|
25
|
+
var producesType = _enum(PRODUCES_TYPES, { error: `must be a type Memory's core extractor finds (${PRODUCES_LIST})` });
|
|
26
|
+
var kind = string().max(64).refine(isEventKind, { error: "must be an event kind, such as meeting or x-<namespace>/<name>" });
|
|
27
|
+
var sourceId = string().max(64).regex(SOURCE_ID, { error: "must be a source id such as granola.meetings" });
|
|
28
|
+
var hintFrontmatter = object({
|
|
29
|
+
source: sourceId.describe("One of the plugin's own source ids."),
|
|
30
|
+
kinds: array(kind, { error: "must be a list such as [meeting]" }).min(1, "must name at least one kind"),
|
|
31
|
+
produces: array(producesType, { error: "must be a list such as [commitment]" }).min(1, "must name at least one type").optional()
|
|
32
|
+
}).strict();
|
|
33
|
+
var routineFrontmatter = object({
|
|
34
|
+
id: string().max(64).regex(ROUTINE_ID, { error: "must be a lowercase word such as meeting-actions" }),
|
|
35
|
+
title: string().min(1).max(200),
|
|
36
|
+
reads: object({
|
|
37
|
+
sources: array(sourceId, { error: "must be a list such as [granola.meetings]" }).min(1, "must name at least one source").describe("The plugin's own sources only."),
|
|
38
|
+
kinds: array(kind, { error: "must be a list such as [meeting]" }).min(1, "must name at least one kind")
|
|
39
|
+
}).strict(),
|
|
40
|
+
produces: array(producesType, { error: "must be a list such as [commitment]" }).min(1, "must name at least one type")
|
|
41
|
+
}).strict();
|
|
42
|
+
var HINT_SCHEMA = validator("hint", hintFrontmatter);
|
|
43
|
+
var ROUTINE_SCHEMA = validator("routine", routineFrontmatter);
|
|
44
|
+
function scalar(raw) {
|
|
45
|
+
const text = raw.trim();
|
|
46
|
+
if (text.startsWith('"') || text.startsWith("'")) {
|
|
47
|
+
const quote = text[0];
|
|
48
|
+
if (text.length < 2 || !text.endsWith(quote)) return { ok: false };
|
|
49
|
+
return { ok: true, value: text.slice(1, -1).replaceAll(`\\${quote}`, quote) };
|
|
50
|
+
}
|
|
51
|
+
if (text.startsWith("[") || text.startsWith("{")) return { ok: false };
|
|
52
|
+
return { ok: true, value: text };
|
|
53
|
+
}
|
|
54
|
+
function splitTop(text) {
|
|
55
|
+
const parts = [];
|
|
56
|
+
let depth = 0;
|
|
57
|
+
let quote = "";
|
|
58
|
+
let start = 0;
|
|
59
|
+
for (let index = 0; index < text.length; index++) {
|
|
60
|
+
const char = text[index];
|
|
61
|
+
if (quote !== "") {
|
|
62
|
+
if (char === quote) quote = "";
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
if (char === '"' || char === "'") quote = char;
|
|
66
|
+
else if (char === "[" || char === "{") depth++;
|
|
67
|
+
else if (char === "]" || char === "}") depth--;
|
|
68
|
+
else if (char === "," && depth === 0) {
|
|
69
|
+
parts.push(text.slice(start, index));
|
|
70
|
+
start = index + 1;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
parts.push(text.slice(start));
|
|
74
|
+
return parts.map((part) => part.trim()).filter((part) => part !== "");
|
|
75
|
+
}
|
|
76
|
+
function parseValue(raw) {
|
|
77
|
+
const text = raw.trim();
|
|
78
|
+
if (text.startsWith("[") && text.endsWith("]")) {
|
|
79
|
+
const inner = text.slice(1, -1);
|
|
80
|
+
const items = [];
|
|
81
|
+
for (const part of splitTop(inner)) {
|
|
82
|
+
const parsed = scalar(part);
|
|
83
|
+
if (!parsed.ok) return parsed;
|
|
84
|
+
items.push(parsed.value);
|
|
85
|
+
}
|
|
86
|
+
return { ok: true, value: items };
|
|
87
|
+
}
|
|
88
|
+
if (text.startsWith("{") && text.endsWith("}")) {
|
|
89
|
+
const inner = text.slice(1, -1);
|
|
90
|
+
const entries = {};
|
|
91
|
+
for (const part of splitTop(inner)) {
|
|
92
|
+
const colon = part.indexOf(":");
|
|
93
|
+
if (colon <= 0) return { ok: false };
|
|
94
|
+
const key = part.slice(0, colon).trim();
|
|
95
|
+
if (!KEY.test(key)) return { ok: false };
|
|
96
|
+
const parsed = parseValue(part.slice(colon + 1));
|
|
97
|
+
if (!parsed.ok) return parsed;
|
|
98
|
+
entries[key] = parsed.value;
|
|
99
|
+
}
|
|
100
|
+
return { ok: true, value: entries };
|
|
101
|
+
}
|
|
102
|
+
return scalar(text);
|
|
103
|
+
}
|
|
104
|
+
function parseFrontmatter(text, what = "file") {
|
|
105
|
+
const lines = text.replace(/\r\n/g, "\n").split("\n");
|
|
106
|
+
if (lines[0] !== "---") return { ok: false, problems: [`the ${what} must begin with its frontmatter: --- on a line of its own`] };
|
|
107
|
+
const close = lines.findIndex((line, index) => index > 0 && line === "---");
|
|
108
|
+
if (close === -1) return { ok: false, problems: [`the ${what} has no closing --- line for its frontmatter`] };
|
|
109
|
+
const frontmatter = {};
|
|
110
|
+
const problems = [];
|
|
111
|
+
for (const [index, line] of lines.slice(1, close).entries()) {
|
|
112
|
+
const at = index + 2;
|
|
113
|
+
if (line.trim() === "") continue;
|
|
114
|
+
if (/^[\s]/.test(line)) {
|
|
115
|
+
problems.push(`the ${what}'s frontmatter line ${at} is indented: the frontmatter is one key a line`);
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
const colon = line.indexOf(":");
|
|
119
|
+
const key = colon === -1 ? "" : line.slice(0, colon).trim();
|
|
120
|
+
if (colon <= 0 || !KEY.test(key)) {
|
|
121
|
+
problems.push(`the ${what}'s frontmatter line ${at} is not a key and its value`);
|
|
122
|
+
continue;
|
|
123
|
+
}
|
|
124
|
+
if (Object.hasOwn(frontmatter, key)) {
|
|
125
|
+
problems.push(`the ${what}'s frontmatter line ${at} repeats the key "${key}"`);
|
|
126
|
+
continue;
|
|
127
|
+
}
|
|
128
|
+
const parsed = parseValue(line.slice(colon + 1));
|
|
129
|
+
if (!parsed.ok) {
|
|
130
|
+
problems.push(`the ${what}'s frontmatter line ${at} holds a value this contract does not read`);
|
|
131
|
+
continue;
|
|
132
|
+
}
|
|
133
|
+
frontmatter[key] = parsed.value;
|
|
134
|
+
}
|
|
135
|
+
if (problems.length > 0) return { ok: false, problems };
|
|
136
|
+
return { ok: true, value: { frontmatter, body: lines.slice(close + 1).join("\n").trim() } };
|
|
137
|
+
}
|
|
138
|
+
function keyProblems(frontmatter, known, forbidden, what, why) {
|
|
139
|
+
const problems = [];
|
|
140
|
+
for (const key of Object.keys(frontmatter)) {
|
|
141
|
+
if (known.includes(key)) continue;
|
|
142
|
+
if (forbidden.includes(key)) problems.push(`the ${what} sets "${key}", which a ${what} may not set: ${why}`);
|
|
143
|
+
else problems.push(`the ${what} has the key "${key}", which a ${what} does not have (${known.join(", ")})`);
|
|
144
|
+
}
|
|
145
|
+
return problems;
|
|
146
|
+
}
|
|
147
|
+
var HINT_WHY = "a hint is data, and Memory decides how its text is used";
|
|
148
|
+
var ROUTINE_WHY = "the namespace, the tier, the schedule, the budget, the priority and the apply mode are Memory's";
|
|
149
|
+
function hintProblems(text, options) {
|
|
150
|
+
if (typeof text !== "string") return ["the hint is not text"];
|
|
151
|
+
const problems = [];
|
|
152
|
+
if (text.length > HINT_MAX) problems.push(`the hint is ${text.length} characters, over the ${HINT_MAX} a hint may take`);
|
|
153
|
+
const parsed = parseFrontmatter(text, "hint");
|
|
154
|
+
if (!parsed.ok) return [...problems, ...parsed.problems];
|
|
155
|
+
const keys = keyProblems(parsed.value.frontmatter, HINT_KEYS, FORBIDDEN_HINT_KEYS, "hint", HINT_WHY);
|
|
156
|
+
if (keys.length > 0) return [...problems, ...keys];
|
|
157
|
+
const checked = HINT_SCHEMA.check(parsed.value.frontmatter);
|
|
158
|
+
if (!checked.ok) return [...problems, ...checked.problems];
|
|
159
|
+
if (!options.sources.includes(checked.value.source)) problems.push(`the hint names the source "${checked.value.source}", which is not one of the plugin's own`);
|
|
160
|
+
return problems;
|
|
161
|
+
}
|
|
162
|
+
function routineProblems(text, options) {
|
|
163
|
+
if (typeof text !== "string") return ["the routine is not text"];
|
|
164
|
+
const problems = [];
|
|
165
|
+
const parsed = parseFrontmatter(text, "routine");
|
|
166
|
+
if (!parsed.ok) return parsed.problems;
|
|
167
|
+
if (parsed.value.body.length > ROUTINE_BODY_MAX) problems.push(`the routine's body is ${parsed.value.body.length} characters, over the ${ROUTINE_BODY_MAX} its instructions may take`);
|
|
168
|
+
const keys = keyProblems(parsed.value.frontmatter, ROUTINE_KEYS, FORBIDDEN_ROUTINE_KEYS, "routine", ROUTINE_WHY);
|
|
169
|
+
if (keys.length > 0) return [...problems, ...keys];
|
|
170
|
+
const checked = ROUTINE_SCHEMA.check(parsed.value.frontmatter);
|
|
171
|
+
if (!checked.ok) return [...problems, ...checked.problems];
|
|
172
|
+
for (const source of checked.value.reads.sources) {
|
|
173
|
+
if (!options.sources.includes(source)) problems.push(`the routine reads the source "${source}", which is not one of the plugin's own`);
|
|
174
|
+
}
|
|
175
|
+
return problems;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export {
|
|
179
|
+
HINT_MAX,
|
|
180
|
+
ROUTINE_BODY_MAX,
|
|
181
|
+
HINT_KEYS,
|
|
182
|
+
ROUTINE_KEYS,
|
|
183
|
+
FORBIDDEN_HINT_KEYS,
|
|
184
|
+
FORBIDDEN_ROUTINE_KEYS,
|
|
185
|
+
PRODUCES_TYPES,
|
|
186
|
+
HINT_SCHEMA,
|
|
187
|
+
ROUTINE_SCHEMA,
|
|
188
|
+
parseFrontmatter,
|
|
189
|
+
hintProblems,
|
|
190
|
+
routineProblems
|
|
191
|
+
};
|