@superbee/core 0.4.10 → 0.4.11-pre.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/README.md +3 -422
- package/dist/body-pages.js +2 -2
- package/dist/body-pages.js.map +1 -1
- package/dist/builtin-recipes/content.js +7 -7
- package/dist/builtin-recipes/content.js.map +1 -1
- package/dist/bundle-health/report.js +2 -2
- package/dist/bundle-health/report.js.map +1 -1
- package/dist/content-type.d.ts +1 -2
- package/dist/content-type.d.ts.map +1 -1
- package/dist/content-type.js +1 -2
- package/dist/content-type.js.map +1 -1
- package/dist/document-field-actions.js +1 -1
- package/dist/document-field-actions.js.map +1 -1
- package/dist/document-mutation.d.ts.map +1 -1
- package/dist/document-mutation.js +3 -4
- package/dist/document-mutation.js.map +1 -1
- package/dist/file-journaled-backend.d.ts.map +1 -1
- package/dist/file-journaled-backend.js +2 -3
- package/dist/file-journaled-backend.js.map +1 -1
- package/dist/hosted-transport/answer-rows.js +3 -3
- package/dist/hosted-transport/answer-rows.js.map +1 -1
- package/dist/hosted-transport/attribution.d.ts +3 -3
- package/dist/hosted-transport/attribution.d.ts.map +1 -1
- package/dist/hosted-transport/attribution.js +3 -3
- package/dist/hosted-transport/attribution.js.map +1 -1
- package/dist/hosted-transport/index.d.ts +1 -1
- package/dist/hosted-transport/index.js +1 -1
- package/dist/hosted-transport/port-run.d.ts +2 -2
- package/dist/hosted-transport/port-run.js +2 -2
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/indexeddb-backend.d.ts.map +1 -1
- package/dist/indexeddb-backend.js +2 -3
- package/dist/indexeddb-backend.js.map +1 -1
- package/dist/kinds.d.ts +4 -4
- package/dist/kinds.js +4 -4
- package/dist/kinds.js.map +1 -1
- package/dist/okf-authoring.d.ts.map +1 -1
- package/dist/okf-authoring.js +5 -2
- package/dist/okf-authoring.js.map +1 -1
- package/dist/portable-export.js +1 -1
- package/dist/portable-export.js.map +1 -1
- package/dist/portable-frontmatter.d.ts +3 -3
- package/dist/portable-frontmatter.d.ts.map +1 -1
- package/dist/portable-frontmatter.js +20 -5
- package/dist/portable-frontmatter.js.map +1 -1
- package/dist/recipe-lifecycle/evolution.d.ts.map +1 -1
- package/dist/recipe-lifecycle/evolution.js +22 -14
- package/dist/recipe-lifecycle/evolution.js.map +1 -1
- package/dist/recipe-lifecycle/install.d.ts.map +1 -1
- package/dist/recipe-lifecycle/install.js +21 -1
- package/dist/recipe-lifecycle/install.js.map +1 -1
- package/dist/recipe-lifecycle/legacy-aliases.js +1 -1
- package/dist/recipe-lifecycle/legacy-aliases.js.map +1 -1
- package/dist/recipe-sources.d.ts.map +1 -1
- package/dist/recipe-sources.js +3 -2
- package/dist/recipe-sources.js.map +1 -1
- package/dist/record-overlay/apply.d.ts.map +1 -1
- package/dist/record-overlay/apply.js +6 -3
- package/dist/record-overlay/apply.js.map +1 -1
- package/dist/remote.d.ts +1 -1
- package/dist/remote.d.ts.map +1 -1
- package/dist/remote.js +1 -1
- package/dist/remote.js.map +1 -1
- package/dist/validation.d.ts +1 -1
- package/dist/validation.js +1 -1
- package/package.json +1 -9
- package/dist/hosted-client/binding.d.ts +0 -7
- package/dist/hosted-client/binding.d.ts.map +0 -1
- package/dist/hosted-client/binding.js +0 -10
- package/dist/hosted-client/binding.js.map +0 -1
- package/dist/hosted-client/blob-delivery.d.ts +0 -68
- package/dist/hosted-client/blob-delivery.d.ts.map +0 -1
- package/dist/hosted-client/blob-delivery.js +0 -170
- package/dist/hosted-client/blob-delivery.js.map +0 -1
- package/dist/hosted-client/blob-write.d.ts +0 -387
- package/dist/hosted-client/blob-write.d.ts.map +0 -1
- package/dist/hosted-client/blob-write.js +0 -770
- package/dist/hosted-client/blob-write.js.map +0 -1
- package/dist/hosted-client/bundle-listing.d.ts +0 -46
- package/dist/hosted-client/bundle-listing.d.ts.map +0 -1
- package/dist/hosted-client/bundle-listing.js +0 -36
- package/dist/hosted-client/bundle-listing.js.map +0 -1
- package/dist/hosted-client/client.d.ts +0 -249
- package/dist/hosted-client/client.d.ts.map +0 -1
- package/dist/hosted-client/client.js +0 -381
- package/dist/hosted-client/client.js.map +0 -1
- package/dist/hosted-client/directory.d.ts +0 -46
- package/dist/hosted-client/directory.d.ts.map +0 -1
- package/dist/hosted-client/directory.js +0 -74
- package/dist/hosted-client/directory.js.map +0 -1
- package/dist/hosted-client/errors.d.ts +0 -26
- package/dist/hosted-client/errors.d.ts.map +0 -1
- package/dist/hosted-client/errors.js +0 -35
- package/dist/hosted-client/errors.js.map +0 -1
- package/dist/hosted-client/inbox.d.ts +0 -320
- package/dist/hosted-client/inbox.d.ts.map +0 -1
- package/dist/hosted-client/inbox.js +0 -379
- package/dist/hosted-client/inbox.js.map +0 -1
- package/dist/hosted-client/index.d.ts +0 -31
- package/dist/hosted-client/index.d.ts.map +0 -1
- package/dist/hosted-client/index.js +0 -33
- package/dist/hosted-client/index.js.map +0 -1
- package/dist/hosted-client/journal.d.ts +0 -103
- package/dist/hosted-client/journal.d.ts.map +0 -1
- package/dist/hosted-client/journal.js +0 -464
- package/dist/hosted-client/journal.js.map +0 -1
- package/dist/hosted-client/node.d.ts +0 -74
- package/dist/hosted-client/node.d.ts.map +0 -1
- package/dist/hosted-client/node.js +0 -219
- package/dist/hosted-client/node.js.map +0 -1
- package/dist/hosted-client/reference.d.ts +0 -12
- package/dist/hosted-client/reference.d.ts.map +0 -1
- package/dist/hosted-client/reference.js +0 -29
- package/dist/hosted-client/reference.js.map +0 -1
- package/dist/hosted-client/view-content.d.ts +0 -184
- package/dist/hosted-client/view-content.d.ts.map +0 -1
- package/dist/hosted-client/view-content.js +0 -268
- package/dist/hosted-client/view-content.js.map +0 -1
- package/dist/hosted-client/write.d.ts +0 -219
- package/dist/hosted-client/write.d.ts.map +0 -1
- package/dist/hosted-client/write.js +0 -419
- package/dist/hosted-client/write.js.map +0 -1
package/README.md
CHANGED
|
@@ -748,428 +748,9 @@ other Core consumers.
|
|
|
748
748
|
|
|
749
749
|
## Hosted client
|
|
750
750
|
|
|
751
|
-
|
|
752
|
-
(
|
|
753
|
-
|
|
754
|
-
the bundle list (`bundles`, with `readBundleListing`), documents (`reader`), document history
|
|
755
|
-
(`history`) and operations run by id (`listOperations`, `runOperation`). `within(slug)` returns
|
|
756
|
-
the same client naming every bundle-scoped request's bundle as `<slug>/<bundle-id>`.
|
|
757
|
-
Document reads and history run `documents.read.v1` and `documents.history.v1` by id on `run`; a
|
|
758
|
-
host from before that is read on its own `read` and `history` routes instead, decided once per
|
|
759
|
-
operation for each client.
|
|
760
|
-
|
|
761
|
-
```ts
|
|
762
|
-
import { bearerCredentials, createHostedClient } from "@superbee/core/hosted-client";
|
|
763
|
-
|
|
764
|
-
const client = createHostedClient({
|
|
765
|
-
target: { origin: "https://mcp.getsuperbee.com", syncPrefix: "/sync/v1" },
|
|
766
|
-
credentials: bearerCredentials(() => getToken()),
|
|
767
|
-
});
|
|
768
|
-
const identity = await client.whoami();
|
|
769
|
-
```
|
|
770
|
-
|
|
771
|
-
The target is the origin and the sync prefix, `/sync/v1`. `syncRoutePrefix({ origin, audience })` derives the prefix from a protected-resource
|
|
772
|
-
audience and returns null when the audience has none. `credentials` is the transport carrier's
|
|
773
|
-
own credential provider: an async function returning the headers for one request. It is called
|
|
774
|
-
before every request, so it may renew a short-lived token. `bearerCredentials` builds one from a
|
|
775
|
-
token getter. The client never logs credentials, and its errors carry the route and code, never a
|
|
776
|
-
token.
|
|
777
|
-
|
|
778
|
-
Failures are typed and carry no wording for any particular surface:
|
|
779
|
-
|
|
780
|
-
- `HostedCarrierError`: transport. `denied` means no credential (nothing was sent) or the request
|
|
781
|
-
was refused before sending; `unavailable` means the answer is unknown. `isAnswerTooLarge`
|
|
782
|
-
distinguishes an answer larger than its bound.
|
|
783
|
-
- `MalformedAnswer` (`code` `MALFORMED_ANSWER`, `route`): the host answered something the
|
|
784
|
-
contract does not admit. Retrying gets the same answer.
|
|
785
|
-
- `RemoteError` (`code`, `status`): the host refused the request, with its own code.
|
|
786
|
-
- `HostedRouteNotServed` (`code` `ROUTE_NOT_SERVED`, status 404, `route`): a `RemoteError` for a
|
|
787
|
-
host from before the route.
|
|
788
|
-
|
|
789
|
-
Operation and history refusals the host states in a `200` (and `bundle_not_found`,
|
|
790
|
-
`unknown_operation` and `invalid_input`) come back as `{ ok: false, refusal }`, not as errors.
|
|
791
|
-
|
|
792
|
-
### Writing a document
|
|
793
|
-
|
|
794
|
-
`write` sends one whole serialized document (frontmatter and body, as a file holds it) to a hosted
|
|
795
|
-
bundle: a create of an absent id, or a replace at exactly the version the caller read.
|
|
796
|
-
|
|
797
|
-
```ts
|
|
798
|
-
const created = await client.write("notes", { id: "notes/today", document: text, expectAbsent: true });
|
|
799
|
-
const replaced = await client.write("notes", { id: "notes/today", document: edited, expectedVersion: version });
|
|
800
|
-
```
|
|
801
|
-
|
|
802
|
-
It returns one of:
|
|
803
|
-
|
|
804
|
-
- `{ status: "committed", version }`: the host stored it; `version` is the new head.
|
|
805
|
-
- `{ status: "conflict", reason: "version_conflict", currentVersion }`: the document is not at the
|
|
806
|
-
expected version (for a create: it exists). `currentVersion` is the version the host serves, or
|
|
807
|
-
null when it serves none. Nothing was written.
|
|
808
|
-
- `{ status: "conflict", reason: "concurrent_change" }`: another write to the bundle overlapped
|
|
809
|
-
this one past the host's own retries. Nothing was written.
|
|
810
|
-
- `{ status: "refused", code, message }`: the host refused this write (`validation_failed`,
|
|
811
|
-
`invalid_input`, `AUTH_REQUIRED`, `PERMISSION_DENIED`, a sync quota's `REQUEST_CAPACITY_*`, or
|
|
812
|
-
`read_only` when the bundle serves no writes). Nothing was written.
|
|
813
|
-
- `{ status: "unknown", requestId }`: the host may or may not hold the write.
|
|
814
|
-
|
|
815
|
-
Every result names its `requestId`. A conflict is final for that identity: the client never
|
|
816
|
-
resends it, under that identity or a new one. Read the document and decide; another attempt is a
|
|
817
|
-
new `write`.
|
|
818
|
-
|
|
819
|
-
A write needs the bundle's capabilities (whether it serves writes, its OKF edition, the write
|
|
820
|
-
bound and the retention window). The client reads them once per bundle and workspace and holds the
|
|
821
|
-
answer for `capabilitiesTtlMs` (default 60,000 ms), shared by the client and its `within` clients
|
|
822
|
-
and never by `reader()`. So a write costs one round trip while its bundle's capabilities are fresh,
|
|
823
|
-
and two when they are read first; concurrent writes to one bundle share one read. A write refused
|
|
824
|
-
`read_only`, `invalid_input`, `validation_failed` or `PERMISSION_DENIED` (which is how a
|
|
825
|
-
`bundle_not_found` write answer arrives), or whose result is `unknown`, drops the held answer, and
|
|
826
|
-
a capabilities read that fails is never held, so the next write reads them again. Set
|
|
827
|
-
`capabilitiesTtlMs: 0` to read them before every write. The retention window that decides a
|
|
828
|
-
resend after an `absent` lookup (below) is never taken from a held answer: it is read again then.
|
|
829
|
-
|
|
830
|
-
Each write has one request identity and carries the client's binding, a digest of a random id the
|
|
831
|
-
client mints once (its `within` clients share it). When an answer is lost (a transport failure or
|
|
832
|
-
a deadline after sending), the client looks the identity up on the host and reports what the host
|
|
833
|
-
recorded. The host's outcome route tells a request it never received ("absent") from one still in
|
|
834
|
-
progress ("pending"), and the shared transport keeps the two apart. On either answer `write`
|
|
835
|
-
sends the same identity once more, which the host applies at most once; after "pending", an
|
|
836
|
-
earlier delivery is known to be held. Absence counts as
|
|
837
|
-
evidence only within the retention window the host serves in its capabilities
|
|
838
|
-
(`operationsRetentionMs`, less an hour's margin); past it, the result stays `unknown` and nothing
|
|
839
|
-
is resent. The client measures an intent's age by its own clock against the host's window, so that
|
|
840
|
-
margin holds only while the client's clock is within an hour of the host's. A resend refused before
|
|
841
|
-
it reaches the host's execution (no credential, access withdrawn, a spent quota) leaves the result
|
|
842
|
-
`unknown` too, since the first delivery may still commit; after a "pending" lookup, so does any
|
|
843
|
-
refusal before execution, a gateway's `400` included. The result's `refusal` (`{ code, message }`)
|
|
844
|
-
names that refusal, so an app can say why the write is waiting (for example, access withdrawn)
|
|
845
|
-
while it stays held; only the call that met the refusal reports it. Absence alone never settles
|
|
846
|
-
such a write: a delayed first delivery is authorized when it arrives, so it can still commit once
|
|
847
|
-
access returns. When the lookups themselves fail, or the caller's `signal` aborts after sending, the
|
|
848
|
-
result is `unknown`.
|
|
849
|
-
|
|
850
|
-
An `unknown` write can be resolved later in two ways:
|
|
851
|
-
|
|
852
|
-
- `lookupWrite(requestId)` makes one outcome lookup and never sends the write. When the host holds
|
|
853
|
-
no outcome yet (absent or pending), the answer stays `unknown`.
|
|
854
|
-
- `settleWrite(requestId)` looks the identity up and, when the host never recorded it within its
|
|
855
|
-
retention window or holds it pending, sends the same identity once more, as `write` would have.
|
|
856
|
-
|
|
857
|
-
Both answer `{ status: "unrecorded", requestId }` when the intent store holds no write under that
|
|
858
|
-
identity: it was never recorded there, or it already settled and left the store. Both return
|
|
859
|
-
`unknown` when the bundle's capabilities cannot be read, because the write may already have left.
|
|
860
|
-
`settleWrite` only looks up, sending nothing, when the host serves the bundle no writes. A
|
|
861
|
-
`signal` already aborted when `write`, `lookupWrite` or `settleWrite` is called is thrown as its
|
|
862
|
-
reason before any request; an abort during delivery leaves the write `unknown` and held.
|
|
863
|
-
`write` instead throws that failure, because it has sent nothing yet.
|
|
864
|
-
|
|
865
|
-
Until it settles, a write is held in an intent store: its operation, bundle (and workspace),
|
|
866
|
-
document id, document and digest, expected version, request identity and binding, which is
|
|
867
|
-
everything needed to rebuild the lookup exactly. The default store is in memory and lives as long
|
|
868
|
-
as the client. Pass `intentStore` (`put`, `get`, `delete`, and optionally `list`) to keep intents
|
|
869
|
-
durable across restarts (`openHostedClientJournal`, below, is one for Node); lookups use the
|
|
870
|
-
binding recorded with each intent. A service that
|
|
871
|
-
restarts with a durable store calls `heldWrites()` to find the writes that never settled
|
|
872
|
-
(including any recorded but never sent), then settles each with `settleWrite`. `heldWrites()`
|
|
873
|
-
throws `HostedIntentsNotListable` when the store has no `list`. A settled write leaves the store.
|
|
874
|
-
|
|
875
|
-
`write(..., { requestId })` with the identity of a held write resumes that write and applies
|
|
876
|
-
nothing new. A different write under a held identity, including the same write named in another
|
|
877
|
-
workspace, is refused before sending. The host refuses an identity it recorded for another
|
|
878
|
-
document (`invalid_input`). Calls on one client that name the same identity run one after another.
|
|
879
|
-
|
|
880
|
-
`write` throws only before anything is sent: a malformed input (`TypeError`), the typed error of
|
|
881
|
-
its capabilities read, or a failure of the intent store to record the write. Document deletion is
|
|
882
|
-
not part of `write`.
|
|
883
|
-
|
|
884
|
-
### Writing a blob
|
|
885
|
-
|
|
886
|
-
`writeBlob` and `deleteBlob` write one ordinary file (a blob: an image, a diagram, any bytes) to a
|
|
887
|
-
hosted bundle. A create names an absent key; a replace and a delete name the head they expect,
|
|
888
|
-
its version **and** content type (a `BlobPin`), so a type-only change is a replace too.
|
|
889
|
-
|
|
890
|
-
```ts
|
|
891
|
-
const svg = new TextEncoder().encode("<svg xmlns='http://www.w3.org/2000/svg'/>");
|
|
892
|
-
const created = await client.writeBlob("notes", { key: "diagrams/flow.svg", bytes: svg, contentType: "image/svg+xml", expectAbsent: true });
|
|
893
|
-
if (created.status !== "committed") throw new Error(created.status);
|
|
894
|
-
let pin = created.head!; // { key, version, contentType }
|
|
895
|
-
|
|
896
|
-
const replaced = await client.writeBlob("notes", { key: pin.key, bytes: edited, contentType: "image/svg+xml", expected: pin });
|
|
897
|
-
if (replaced.status === "committed") pin = replaced.head!;
|
|
898
|
-
|
|
899
|
-
const read = await client.readBlob("notes", pin.key, { pin }); // bytes verified, or null if no longer at the pin
|
|
900
|
-
const deleted = await client.deleteBlob("notes", { key: pin.key, expected: pin });
|
|
901
|
-
```
|
|
902
|
-
|
|
903
|
-
Each call returns one of:
|
|
904
|
-
|
|
905
|
-
- `{ status: "committed", head, changed? }`: applied. `head` is the new head (null after a
|
|
906
|
-
delete); `changed` is false for a replace the head already matched.
|
|
907
|
-
- `{ status: "conflict", reason: "version_conflict", actual }`: the head is not at the expected pin
|
|
908
|
-
(for a create: the key exists). `actual` is the head now, or null when there is none (a delete of
|
|
909
|
-
an absent key). Final for that identity.
|
|
910
|
-
- `{ status: "conflict", reason: "concurrent_change", message }`: another write overlapped this one
|
|
911
|
-
past the host's own retries. Nothing was applied.
|
|
912
|
-
- `{ status: "refused", code, message }`: the host's own refusal, or one the client names. The
|
|
913
|
-
host's codes are those it records under the identity (`backend_unavailable`, ...) and those it
|
|
914
|
-
answers without writing and never records (`insufficient_scope` for a grant without blob writes,
|
|
915
|
-
`bundle_not_found`, `request_capacity` in a `200` or a `429`, and `path_collision` for a create
|
|
916
|
-
whose key, or one of its folders, differs from an existing document or blob path only by letter
|
|
917
|
-
case or Unicode form under `foldPath`, the per-folder rule portable export applies; a create
|
|
918
|
-
only, and it never resends: rename the key). A refusal of the second kind
|
|
919
|
-
proves only that this attempt did not run, so it is final only when every earlier attempt of the
|
|
920
|
-
write is proven not applied, which is always so for a write the client sends; a write whose
|
|
921
|
-
earlier attempt was unclear is never sent again, only looked up, and stays `unknown`.
|
|
922
|
-
`insufficient_scope`, `bundle_not_found` and `invalid_input` also drop the held capabilities
|
|
923
|
-
answer, so the next write reads them again. The client's own codes are `invalid_input` (an
|
|
924
|
-
unsafe key, a key under one of Superbee's own record folders or a reserved file, an invalid content type, a body over the host's `blobWriteBytes` or 16 MiB, or a held
|
|
925
|
-
identity reused for another write), `scope_mismatch` (a held write, or a reused `requestId`, recorded
|
|
926
|
-
for another origin or sync prefix) or `unsettled_write` (an earlier write of the same key in the bundle is still
|
|
927
|
-
unsettled: settle or forget it first). Nothing was sent for a client-named refusal.
|
|
928
|
-
- `{ status: "held", deletions, baseline }`: the host holds this mass delete (`428
|
|
929
|
-
deletions_held`). Nothing was applied. A person confirms the count, and
|
|
930
|
-
`settleBlobWrite(requestId, { acceptDeletes })` with at least `deletions` sends it again; without
|
|
931
|
-
`acceptDeletes` it stays held and nothing is sent, and with fewer it throws
|
|
932
|
-
`HostedBlobDeletionsNotAccepted`, sending nothing. `deleteBlob(..., { acceptDeletes })` sends the
|
|
933
|
-
confirmation with the first attempt.
|
|
934
|
-
- `{ status: "unknown" }`: the host may or may not hold the write.
|
|
935
|
-
|
|
936
|
-
Every result names its `requestId`, `key` and `operation`.
|
|
937
|
-
|
|
938
|
-
**The capability gate.** A blob write needs the bundle's `blobWrites: "allowed"` and its
|
|
939
|
-
`blobWriteBytes` bound, from the same held capabilities answer `write` uses. When the host serves
|
|
940
|
-
the bundle no blob writes (an older host's answer reads as refused), `writeBlob` and `deleteBlob`
|
|
941
|
-
throw `HostedBlobWritesNotServed`, a `HostedRouteNotServed` (`isRouteNotServed` is true), before
|
|
942
|
-
anything is journaled or sent. This differs from `write()`, which answers a bundle without writes
|
|
943
|
-
with the result `refused: read_only`: the blob routes are a newer capability a caller probes for, as
|
|
944
|
-
it probes for any route a host may lack. The checks a send would otherwise fail (the capability, the
|
|
945
|
-
byte bound, the key and the content type) all run against that one answer before the write is
|
|
946
|
-
journaled, and the delivery is handed the same answer, so the two cannot disagree.
|
|
947
|
-
|
|
948
|
-
**Exactly once, never resent after it may have left.** Each blob write is journaled under one
|
|
949
|
-
request identity (with the client's binding, the bundle and workspace and the bytes), durably
|
|
950
|
-
claimed, then sent once. After an unclear answer the client looks the identity up on the host
|
|
951
|
-
(`/outcome`, under the binding recorded with the write) and reports what the host recorded. Unlike a
|
|
952
|
-
document write, an `absent` lookup is never permission to send again: once an attempt may have left,
|
|
953
|
-
a blob write is only ever looked up. A send proven never to have left (the credential provider
|
|
954
|
-
failed or was denied, the signal was already aborted, the identity was malformed, a local check
|
|
955
|
-
failed) is rolled back instead: `writeBlob` throws `HostedBlobWriteNotSent` with its `requestId` and
|
|
956
|
-
`reason`, and the write stays held and resendable (`held: true`), so `settleBlobWrite` or the same
|
|
957
|
-
`writeBlob` call (same `requestId`, same input) sends it. A transport failure after the request was
|
|
958
|
-
handed to the carrier is `unknown`.
|
|
959
|
-
|
|
960
|
-
**Recovery.** `heldBlobWrites()` lists every unsettled blob write (`requestId`, `bundleId`,
|
|
961
|
-
`workspace`, `key`, `operation`, `state`, `attempts`, `resendable`, `hold`, `createdAt`) and sweeps any
|
|
962
|
-
settled one a crash left behind.
|
|
963
|
-
|
|
964
|
-
- `lookupBlobWrite(requestId)` makes one outcome lookup and never sends. A write never sent (or
|
|
965
|
-
proven not applied) answers `{ status: "pending" }` without a request, and a held delete `held`.
|
|
966
|
-
- `settleBlobWrite(requestId, { acceptDeletes? })` submits the write when its state is pending or
|
|
967
|
-
unknown and every attempt is proven not applied (`attempts === notAppliedThrough`); otherwise it
|
|
968
|
-
only looks it up, and an absent lookup is `unknown`.
|
|
969
|
-
- `forgetBlobWrite(requestId)` drops an `unknown` write once one fresh lookup answers `absent`,
|
|
970
|
-
returning `{ status: "forgotten" }`. **The earlier delivery may still commit**; the host's
|
|
971
|
-
compare-and-swap is what keeps a later write from losing that update. Any other record is
|
|
972
|
-
`{ status: "kept", reason: "not_unknown" }` (settle an `in_flight` one first), a lookup that fails,
|
|
973
|
-
is refused or is malformed is `kept` with `lookup_unavailable`, and a lookup that finds the outcome
|
|
974
|
-
settles the write instead. A forgotten identity is no longer held, so `writeBlob` with that same
|
|
975
|
-
`requestId` journals and uploads it again under that identity. That is safe: the host answers a
|
|
976
|
-
delivery it recorded under the identity with the recorded result, and one it did not record is
|
|
977
|
-
checked against the expected pin like any write.
|
|
978
|
-
|
|
979
|
-
All three answer `{ status: "unrecorded", requestId }` when the journal holds no blob write under the
|
|
980
|
-
identity. A reused `requestId` with the same input resumes (settles) the held write; with different
|
|
981
|
-
input it is `refused: invalid_input` and nothing is admitted. Calls are serialized per request
|
|
982
|
-
identity and per key (the journal's guard covers a key across bundles), so concurrent calls of one
|
|
983
|
-
client never trip each other.
|
|
984
|
-
|
|
985
|
-
```ts
|
|
986
|
-
// A service restarting after a crash: settle what it held, forgetting only proven-absent unknowns.
|
|
987
|
-
for (const held of await client.heldBlobWrites()) {
|
|
988
|
-
const settled = await client.settleBlobWrite(held.requestId);
|
|
989
|
-
if (settled.status === "unknown") console.warn(`blob write ${held.requestId} is still unknown`); // forgetBlobWrite once you choose to move on
|
|
990
|
-
}
|
|
991
|
-
```
|
|
992
|
-
|
|
993
|
-
**Reads.** `readBlob(bundleId, key, { pin })` requires the pin: it reads exactly that version and
|
|
994
|
-
content type, verifies length, digest and type, and answers null when the key is no longer at the pin
|
|
995
|
-
(the host's `409`). `blobHead(bundleId, key)` is the explicit lookup of one head (or null), and
|
|
996
|
-
`blobHeads(bundleId)` the whole listing; both read the full verified listing (up to 10,000 heads in
|
|
997
|
-
4 MiB pages), since the host has no single-key head route yet.
|
|
998
|
-
|
|
999
|
-
**Keys.** `isOrdinaryBlobKey` is the one key policy every blob writer uses, this client and the
|
|
1000
|
-
CLI's checkout sync alike: a safe key that is not a reserved file (`index.md`, `log.md`) and does not
|
|
1001
|
-
sit under one of Superbee's own folders (`OWNED_BLOB_ROOTS`, derived from the bundle sections below:
|
|
1002
|
-
`views/`, `pages/`, their registries, `conventions/`, `recipes/`, `references/`, `connectors/`,
|
|
1003
|
-
`sites/`, `promotions/` and `_superbee/`, compared case-insensitively). Any other key is refused
|
|
1004
|
-
`invalid_input` before any request.
|
|
1005
|
-
|
|
1006
|
-
**Aborts.** A `signal` aborted before the write is admitted throws its reason and journals nothing;
|
|
1007
|
-
that includes an abort while the capabilities are still being read, so a hung credential provider
|
|
1008
|
-
never holds the call (or its key) past the caller's abort. Once admitted, a write is held until it
|
|
1009
|
-
settles, and an abort before its send leaves it resendable (`HostedBlobWriteNotSent`).
|
|
1010
|
-
|
|
1011
|
-
**Journal.** The default blob journal is in memory (`createMemoryBlobJournal`), owned by the client.
|
|
1012
|
-
Give a blob journal to one client (its `within` clients share it). Two clients over one journal
|
|
1013
|
-
coordinate only through its per-key guard: concurrent writes of different identities still settle,
|
|
1014
|
-
but two calls on the same request identity from both clients can fail with a raw journal conflict.
|
|
1015
|
-
Pass `blobJournal` to keep blob writes across restarts: in Node, `openHostedClientJournal(...).blobs`
|
|
1016
|
-
(below). `driveJournaledBlob(journal, context, requestId, mode)` is the owner of the journaled
|
|
1017
|
-
sequence (admit, claim, deliver, persist, retire) for a caller with its own journal and premises; its
|
|
1018
|
-
`premises.snapshot(key, step)` returns each transaction's guard plus the caller's own metadata
|
|
1019
|
-
changes, checked atomically with it.
|
|
1020
|
-
|
|
1021
|
-
**Limitations.**
|
|
1022
|
-
|
|
1023
|
-
- Lookups currently need `blobWrites`: a grant downgraded to read-only cannot settle its earlier
|
|
1024
|
-
blob writes until the host authorizes the outcome route on its own (a hosted follow-up).
|
|
1025
|
-
- A lookup across principals is unverified: a new token of the same principal finds its outcomes
|
|
1026
|
-
(the binding travels in the journal), but what another principal's lookup gets is not yet proven.
|
|
1027
|
-
- Every journal record of a write carries its bytes, and each transaction validates the record.
|
|
1028
|
-
Validation is cached per payload, so a write costs about 0.17 s per MiB in Node (3 MiB about
|
|
1029
|
-
0.5 s, 16 MiB about 2.6 s, measured with the in-memory journal); without the cache it was about
|
|
1030
|
-
1.7 s per MiB (16 MiB about 28 s). The first validation of a payload still runs on the caller's
|
|
1031
|
-
thread in one slice, about 1.2 s for 16 MiB.
|
|
1032
|
-
|
|
1033
|
-
### Inbox
|
|
1034
|
-
|
|
1035
|
-
`createHostedInbox(client, { tenantId })` is a person's hosted inbox in one workspace, over the
|
|
1036
|
-
same client (its credential, deadline and abort; a `within` client serves too). It reaches the
|
|
1037
|
-
attention routes, `POST <prefix>/attention/<operationId>`, and names the workspace in the
|
|
1038
|
-
`Superbee-Workspace` header on every request, since a sync sign-in spans all of the person's
|
|
1039
|
-
workspaces. Notifications are a hosted capability: a host without these routes answers
|
|
1040
|
-
`HostedRouteNotServed`, and nothing here emulates a local inbox.
|
|
1041
|
-
|
|
1042
|
-
```ts
|
|
1043
|
-
import { createHostedInbox } from "@superbee/core/hosted-client";
|
|
1044
|
-
|
|
1045
|
-
const identity = await client.whoami();
|
|
1046
|
-
const inbox = createHostedInbox(client, { tenantId: identity.tenantIds[0]!, via: "my-agent" });
|
|
1047
|
-
const receipt = await inbox.request({ recipient: { kind: "principal", principalId: identity.principalId }, kind: "needs_input", note: "Ready for you" });
|
|
1048
|
-
const page = await inbox.list({ threadId: receipt.threadId, afterSeq: 0 });
|
|
1049
|
-
```
|
|
1050
|
-
|
|
1051
|
-
The methods are `list`, `threads`, `summary`, `get` (does not mark read), `open` (marks read),
|
|
1052
|
-
`ack` (at the revision read), `request` (send) and `cancel` (withdraw your own send), with the
|
|
1053
|
-
open contract's shapes (`InboxEntry`, `InboxThread`, `AttentionReceipt` and the inputs). A
|
|
1054
|
-
recipient is a principal id; to notify yourself, use `whoami().principalId`. A document target
|
|
1055
|
-
names `whoami().targetAuthorityKey` as its `authorityKey` and the document's current version; a
|
|
1056
|
-
host that reports no key (the field is absent, as on every `/sync/v1` host today) cannot take one yet.
|
|
1057
|
-
|
|
1058
|
-
`request` mints one UUIDv7 ticket per send (or takes the one you pass). When an answer is lost or
|
|
1059
|
-
the host marks its refusal retryable, it sends the same body under the same ticket again
|
|
1060
|
-
(`sendAttempts`, default 3), which the host answers as a replay of the first send, never as a second
|
|
1061
|
-
item. A send still unclear after that throws `HostedAttentionOutcomeUnknown` with its `ticket`:
|
|
1062
|
-
`request({ ...input, ticket })` within 24 hours settles it. Refusals are
|
|
1063
|
-
`HostedAttentionRefusal` (a `RemoteError`) with the catalog's `code` (`attention_disabled`,
|
|
1064
|
-
`not_found`, `target_unavailable`, `target_unsupported`, `quota_exceeded`, `request_conflict`,
|
|
1065
|
-
`version_conflict`, `ticket_expired` with `serverTime`, `workspace_not_available` and the rest),
|
|
1066
|
-
`retryable`, and a message in this client's words: the host's message and hint are never repeated.
|
|
1067
|
-
|
|
1068
|
-
### Durable intent store (Node only)
|
|
1069
|
-
|
|
1070
|
-
`openHostedClientJournal` from `@superbee/core/hosted-client/node` is a durable `intentStore`, and its
|
|
1071
|
-
`blobs` a durable `blobJournal`, so a short-lived process that exits with a write `unknown` can recover
|
|
1072
|
-
it after a restart.
|
|
1073
|
-
|
|
1074
|
-
```ts
|
|
1075
|
-
import { createHostedClient } from "@superbee/core/hosted-client";
|
|
1076
|
-
import { openHostedClientJournal } from "@superbee/core/hosted-client/node";
|
|
1077
|
-
|
|
1078
|
-
const journal = await openHostedClientJournal({ directory: path.join(stateDir, "superbee-writes") });
|
|
1079
|
-
const client = createHostedClient({ target, credentials, intentStore: journal, blobJournal: journal.blobs });
|
|
1080
|
-
for (const held of await client.heldWrites()) await client.settleWrite(held.requestId);
|
|
1081
|
-
for (const held of await client.heldBlobWrites()) await client.settleBlobWrite(held.requestId);
|
|
1082
|
-
// ... writes ...
|
|
1083
|
-
await journal.close();
|
|
1084
|
-
```
|
|
1085
|
-
|
|
1086
|
-
The journal is a `FileJournaledBackend` directory: an fsynced, checksummed log with snapshot
|
|
1087
|
-
compaction. Its on-disk format is a supported compatibility promise: a format bump ships a reader
|
|
1088
|
-
for every earlier layout, and an older reader refuses a newer store with `FileJournalFormatError`
|
|
1089
|
-
rather than misreading it. The current format is 3 (see `JOURNALED-BACKENDS.md`). Each unsettled write is one metadata row, `hosted-client.write.<requestId>`,
|
|
1090
|
-
holding the whole document and the binding it was sent under, so a new process with a new token
|
|
1091
|
-
looks it up exactly as the first would have. A settled write is removed. Each unsettled blob write is
|
|
1092
|
-
one row of the backend's own blob intent family, with its bytes, under the same transition rules as
|
|
1093
|
-
the in-memory journal; a settled one is retired, and since every record of a blob write carries its
|
|
1094
|
-
bytes, retiring or forgetting one compacts the store once its log or snapshot is past 1 MiB. Metadata
|
|
1095
|
-
a blob write carries may not name the journal's own rows (`hosted-client.*`) or a checkout's
|
|
1096
|
-
blob-sync state.
|
|
1097
|
-
|
|
1098
|
-
- **Ownership.** Open takes an exclusive same-user lock on the directory until `close()`. Another
|
|
1099
|
-
process waits `lock.waitMs` (default 5,000 ms) and then gets `FilesystemMutationLockError`. A
|
|
1100
|
-
lock left by a process that died on this host is reclaimed.
|
|
1101
|
-
- **Local file system only.** The lock lives in a per-user runtime directory on this host, so it
|
|
1102
|
-
cannot exclude a process on another host. Keep the journal on a local disk, never on NFS, SMB
|
|
1103
|
-
or another shared mount. Open does not detect a network mount; this is the operator's rule.
|
|
1104
|
-
- **Privacy.** The journal holds whole documents. A directory open creates is mode 0700, and its
|
|
1105
|
-
files 0600. On POSIX, an existing directory that is a symbolic link, is owned by another user,
|
|
1106
|
-
or grants its group or others any permission, is refused as `HostedClientJournalError`
|
|
1107
|
-
`JOURNAL_DIRECTORY_NOT_PRIVATE`. The check runs again once the lock is held, and a directory
|
|
1108
|
-
replaced in between is refused too. The directory is the journal's alone: an existing one may
|
|
1109
|
-
hold only `store.log`, `store.snapshot` and `store.snapshot.tmp`, and any other entry (an
|
|
1110
|
-
operating system's `.DS_Store` included) is refused as `JOURNAL_NOT_HOSTED_CLIENT`, as is a
|
|
1111
|
-
`store.log` that is not a journal's log, and a store file that is a symbolic link, a
|
|
1112
|
-
directory, has more than one link, or (on POSIX) belongs to another user. The listing and the
|
|
1113
|
-
files are checked again under the lock. Another process of the same user changing the
|
|
1114
|
-
directory while it opens is out of scope: in that window the open can truncate a torn or
|
|
1115
|
-
foreign log tail.
|
|
1116
|
-
- **Marker.** A new journal records `hosted-client.journal = { schemaVersion: 1 }` in its first
|
|
1117
|
-
transaction. Open refuses, as `JOURNAL_NOT_HOSTED_CLIENT`, a store with rows but no marker or one
|
|
1118
|
-
holding documents, blob files or a checkout's blob-sync state, so it is never pointed at a CLI
|
|
1119
|
-
checkout store. A marked journal holding blob write intents is its own and reopens. A marker of another schema is `JOURNAL_SCHEMA_UNSUPPORTED`. Open decides on a read-only
|
|
1120
|
-
pass first, so a refused directory's files are left byte for byte. A crash before the marker
|
|
1121
|
-
lands leaves an empty store, which the next open marks.
|
|
1122
|
-
- **Size.** Once the store is adopted, the log is compacted into the snapshot whenever it grows past the greater of 1 MiB
|
|
1123
|
-
(`HOSTED_CLIENT_JOURNAL_COMPACT_FLOOR_BYTES`) and twice the last snapshot, so steady writing keeps
|
|
1124
|
-
it near 1 MiB. The snapshot, which holds every write still unsettled, and any one transaction are
|
|
1125
|
-
bounded at 256 MiB. A write that would pass that bound is refused before anything is recorded,
|
|
1126
|
-
and its `write` throws. Unsettled writes count toward the bound until `settleWrite` resolves them.
|
|
1127
|
-
- **Ordering.** Unlike the in-memory store, each call takes effect when its asynchronous steps
|
|
1128
|
-
complete, so unawaited overlapping calls on one request identity can land out of call order.
|
|
1129
|
-
Await each call before the next, as the client does.
|
|
1130
|
-
- **Damage.** `FileJournalCorruptError` (a damaged record before the log's end or a damaged
|
|
1131
|
-
snapshot) and `FileJournalFormatError` (a newer format) refuse the open and change no file. A torn
|
|
1132
|
-
final record, which was never acknowledged, is truncated. Nothing is repaired automatically:
|
|
1133
|
-
moving the directory aside starts an empty journal and loses the writes it held, which can then
|
|
1134
|
-
be settled only by reading the documents on the host.
|
|
1135
|
-
|
|
1136
|
-
### Export download (Node only)
|
|
1137
|
-
|
|
1138
|
-
`@superbee/core/hosted-client/node` downloads and verifies a hosted bundle's portable export. It
|
|
1139
|
-
is a supported public API under the same versioning. It is Node-only because verification
|
|
1140
|
-
(`@superbee/core/portable-export`) needs Node; `@superbee/core/hosted-client` never imports it,
|
|
1141
|
-
so the client itself stays browser-safe.
|
|
1142
|
-
|
|
1143
|
-
```ts
|
|
1144
|
-
import { bearerCredentials, createHostedClient } from "@superbee/core/hosted-client";
|
|
1145
|
-
import { downloadExport, EXPORT_WINDOW_MS } from "@superbee/core/hosted-client/node";
|
|
1146
|
-
import { materializeExport } from "@superbee/core/portable-export";
|
|
1147
|
-
|
|
1148
|
-
const client = createHostedClient({ target, credentials: bearerCredentials(getToken), deadlineMs: EXPORT_WINDOW_MS });
|
|
1149
|
-
const verified = await downloadExport(client, "team.notes", { signal });
|
|
1150
|
-
const folder = await materializeExport(verified, parentDirectory);
|
|
1151
|
-
```
|
|
1152
|
-
|
|
1153
|
-
`downloadExport(client, bundleId, { signal })` returns a `VerifiedExport`: every document,
|
|
1154
|
-
reserved file and blob at the bundle's latest confirmed revision, read whole and checked against
|
|
1155
|
-
the host's digest manifests. It writes nothing. A stopped, tampered or oversized export never
|
|
1156
|
-
becomes a result; placing the files is the caller's (`materializeExport`, or its own staging). It
|
|
1157
|
-
reads a paged export one page at a time and joins the pages. On a host from before paging it reads
|
|
1158
|
-
the whole archive. A bundle that changes between pages is read again from its first page, up to
|
|
1159
|
-
three attempts, and a busy or stopped page is asked for once more. Create the client with
|
|
1160
|
-
`deadlineMs: EXPORT_WINDOW_MS` (60 s), the host's export window; the default 15 s can cut a large
|
|
1161
|
-
bundle. A `within(slug)` client names the bundle in that workspace.
|
|
1162
|
-
|
|
1163
|
-
Failures are typed:
|
|
1164
|
-
|
|
1165
|
-
- `HostedCarrierError`, `HostedRouteNotServed` (a host without the export route) and
|
|
1166
|
-
`RemoteError` (the host's refusal: `bundle_not_found`, `result_too_large`, `validation_failed`,
|
|
1167
|
-
an unauthenticated bearer and so on), as for the rest of the client.
|
|
1168
|
-
- `ExportArchiveError` (`problem`): the verifier refused the archive. `incomplete` means the host
|
|
1169
|
-
stopped it, and the same request may succeed.
|
|
1170
|
-
- `HostedExportError` (`problem`): `stopped` (the answer's body failed part way), `too_large`
|
|
1171
|
-
(past `MAX_EXPORT_BYTES`) or `source_changed` (the bundle kept changing between pages).
|
|
1172
|
-
- The signal's reason, once `signal` or the client's own signal aborts.
|
|
751
|
+
The Node headless client lives at `@superbee/cli/hosted-client`. See the
|
|
752
|
+
[Hosted client guide](../cli/README.md#hosted-client) for package requirements and examples.
|
|
753
|
+
Core provides the runtime-neutral `@superbee/core/hosted-transport` and Hosted document backend.
|
|
1173
754
|
|
|
1174
755
|
## Release compatibility
|
|
1175
756
|
|
package/dist/body-pages.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Pages of a document body for agents (`doc read --offset/--max-bytes`), the same contract the
|
|
2
|
-
// hosted MCP gateway's `read_document` answers
|
|
3
|
-
//
|
|
2
|
+
// hosted MCP gateway's `read_document` answers:
|
|
3
|
+
// offsets in UTF-16 code units, a page bound in UTF-8 bytes, never a split
|
|
4
4
|
// character, and a page that ends just after a line where one is near its cut.
|
|
5
5
|
/** A page's body bound when the caller names none, in UTF-8 bytes. */
|
|
6
6
|
export const PAGE_DEFAULT_BYTES = 32_768;
|
package/dist/body-pages.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"body-pages.js","sourceRoot":"","sources":["../src/body-pages.ts"],"names":[],"mappings":"AAAA,+FAA+F;AAC/F
|
|
1
|
+
{"version":3,"file":"body-pages.js","sourceRoot":"","sources":["../src/body-pages.ts"],"names":[],"mappings":"AAAA,+FAA+F;AAC/F,gDAAgD;AAChD,2EAA2E;AAC3E,+EAA+E;AAE/E,sEAAsE;AACtE,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC;AACzC,uEAAuE;AACvE,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,CAAC;AACpC,MAAM,CAAC,MAAM,cAAc,GAAG,OAAO,CAAC;AACtC,+FAA+F;AAC/F,MAAM,WAAW,GAAG,KAAK,CAAC;AAc1B,SAAS,OAAO,CAAC,IAAY,EAAE,MAAc,EAAE,QAAgB;IAC7D,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAI,GAAG,GAAG,MAAM,CAAC;IACjB,OAAO,GAAG,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;QACzB,MAAM,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAE,CAAC;QACpC,MAAM,KAAK,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC1E,IAAI,KAAK,GAAG,KAAK,GAAG,QAAQ;YAAE,MAAM;QACpC,KAAK,IAAI,KAAK,CAAC;QACf,GAAG,IAAI,IAAI,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,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EAAE,QAAQ,CAAC,CAAC;IAC5C,OAAO;QACL,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,GAAG,CAAC;QAC7B,KAAK,EAAE;YACL,MAAM;YACN,GAAG;YACH,WAAW,EAAE,IAAI,CAAC,MAAM;YACxB,WAAW,EAAE,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM;YAClD,QAAQ,EAAE,MAAM,KAAK,CAAC,IAAI,GAAG,KAAK,IAAI,CAAC,MAAM;YAC7C,GAAG,CAAC,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACnD;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -32,7 +32,7 @@ export const CONTEXT_NOTE_KIND = {
|
|
|
32
32
|
sections: ["Summary"],
|
|
33
33
|
freshnessHorizon: "24h",
|
|
34
34
|
// Context Notes are transient cross-session scratch — collapse them by default in browse listings
|
|
35
|
-
// so they never swamp durable knowledge
|
|
35
|
+
// so they never swamp durable knowledge. Per-bundle
|
|
36
36
|
// overridable by dropping the key; every other kind stays expanded.
|
|
37
37
|
browseCollapsed: true,
|
|
38
38
|
};
|
|
@@ -130,12 +130,12 @@ export const TASK_KIND = {
|
|
|
130
130
|
governs: TASK_TYPE,
|
|
131
131
|
description: "A concrete unit of work that can be claimed, prioritized, assigned, and completed.",
|
|
132
132
|
path: "tasks/",
|
|
133
|
-
// The typed-edge vocabulary
|
|
133
|
+
// The typed-edge vocabulary: a task's dependency edge is a
|
|
134
134
|
// link whose display text is exactly "depends on", targeting another Task. Declared here so
|
|
135
135
|
// `kinds` teaches the vocabulary to any agent that orients — discovery shipped; validation
|
|
136
136
|
// is a future consumer.
|
|
137
137
|
links: { "depends on": TASK_TYPE },
|
|
138
|
-
// The claim coordinates
|
|
138
|
+
// The claim coordinates: declaring them is what
|
|
139
139
|
// lets sync's converge report a lost claim as ownership and withdraw the re-apply route,
|
|
140
140
|
// instead of presenting the race as an ordinary content conflict. Logical names; the
|
|
141
141
|
// edition's coordinate policy resolves them onto storage keys.
|
|
@@ -145,7 +145,7 @@ export const TASK_KIND = {
|
|
|
145
145
|
optional: ["priority", "assignee", "description"],
|
|
146
146
|
values: { [PROGRESS_STATUS_FIELD]: ["todo", "in_progress", "blocked", "done", "canceled"] },
|
|
147
147
|
valueDescriptions: {},
|
|
148
|
-
// The terminal declaration
|
|
148
|
+
// The terminal declaration: done/canceled are the
|
|
149
149
|
// states past which a Task is no longer open — machinery (list --open, the status sweep's
|
|
150
150
|
// exclusion + sort) ships together with the declaration for every new bundle.
|
|
151
151
|
terminal: { [PROGRESS_STATUS_FIELD]: ["done", "canceled"] },
|
|
@@ -205,8 +205,8 @@ export const ROADMAP_KIND = {
|
|
|
205
205
|
// "contains", targeting a Roadmap Item — declared so `kinds` teaches it and `link add`'s graph
|
|
206
206
|
// lint validates it.
|
|
207
207
|
links: { contains: ROADMAP_ITEM_TYPE },
|
|
208
|
-
// No status field on the spine, so nothing to declare terminal (
|
|
209
|
-
//
|
|
208
|
+
// No status field on the spine, so nothing to declare terminal (a
|
|
209
|
+
// maintainer decision).
|
|
210
210
|
fields: { required: ["title"], optional: [], values: {}, valueDescriptions: {}, terminal: {}, descriptions: {} },
|
|
211
211
|
};
|
|
212
212
|
/** The `conventions/roadmap.md` prose body. */
|
|
@@ -235,7 +235,7 @@ export const ROADMAP_ITEM_KIND = {
|
|
|
235
235
|
optional: ["description", "sequence"],
|
|
236
236
|
values: { [PROGRESS_STATUS_FIELD]: ["queued", "active", "done"] },
|
|
237
237
|
valueDescriptions: {},
|
|
238
|
-
//
|
|
238
|
+
// Maintainer decision: a done Roadmap Item
|
|
239
239
|
// hides from `list --open`, consistent with Task's done/canceled.
|
|
240
240
|
terminal: { [PROGRESS_STATUS_FIELD]: ["done"] },
|
|
241
241
|
descriptions: {},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content.js","sourceRoot":"","sources":["../../src/builtin-recipes/content.ts"],"names":[],"mappings":"AAAA,0FAA0F;AAC1F,OAAO,EAAE,qBAAqB,EAAuB,MAAM,aAAa,CAAC;AACzE,OAAO,EAAE,4BAA4B,EAAE,MAAM,eAAe,CAAC;AAE7D,gGAAgG;AAChG,MAAM,iBAAiB,GAAG,cAAc,CAAC;AAEzC;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAmB;IAC/C,EAAE,EAAE,0BAA0B;IAC9B,KAAK,EAAE,iBAAiB;IACxB,OAAO,EAAE,iBAAiB;IAC1B,IAAI,EAAE,gBAAgB;IACtB,MAAM,EAAE;QACN,QAAQ,EAAE,CAAC,OAAO,EAAE,WAAW,CAAC;QAChC,QAAQ,EAAE,CAAC,aAAa,EAAE,MAAM,CAAC;QACjC,MAAM,EAAE,EAAE;QACV,iBAAiB,EAAE,EAAE;QACrB,QAAQ,EAAE,EAAE;QACZ,YAAY,EAAE,EAAE;KACjB;IACD,QAAQ,EAAE,CAAC,SAAS,CAAC;IACrB,gBAAgB,EAAE,KAAK;IACvB,kGAAkG;IAClG,
|
|
1
|
+
{"version":3,"file":"content.js","sourceRoot":"","sources":["../../src/builtin-recipes/content.ts"],"names":[],"mappings":"AAAA,0FAA0F;AAC1F,OAAO,EAAE,qBAAqB,EAAuB,MAAM,aAAa,CAAC;AACzE,OAAO,EAAE,4BAA4B,EAAE,MAAM,eAAe,CAAC;AAE7D,gGAAgG;AAChG,MAAM,iBAAiB,GAAG,cAAc,CAAC;AAEzC;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAmB;IAC/C,EAAE,EAAE,0BAA0B;IAC9B,KAAK,EAAE,iBAAiB;IACxB,OAAO,EAAE,iBAAiB;IAC1B,IAAI,EAAE,gBAAgB;IACtB,MAAM,EAAE;QACN,QAAQ,EAAE,CAAC,OAAO,EAAE,WAAW,CAAC;QAChC,QAAQ,EAAE,CAA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xB,gCAAgC;IAChC,6GAA6G;IAC7G,SAAS;IACT,8FAA8F;IAC9F,gGAAgG;IAChG,cAAc,CAAC"}
|
|
@@ -291,8 +291,8 @@ export async function bundleHealth(bundle, options = {}) {
|
|
|
291
291
|
if (invalidLegacy) {
|
|
292
292
|
invalidLegacyTimestamps.push({ id: doc.id, type: docType(doc), field: invalidLegacy.field, value: diagnosticValue(invalidLegacy.value) });
|
|
293
293
|
}
|
|
294
|
-
if (okfVersion === "0.2") {
|
|
295
|
-
for (const { field, value } of invalidOkfTimestamps(doc.frontmatter)) {
|
|
294
|
+
if (okfVersion === "0.2" || okfVersion === "0.3") {
|
|
295
|
+
for (const { field, value } of invalidOkfTimestamps(doc.frontmatter, okfVersion)) {
|
|
296
296
|
invalidTimestamps.push({ id: doc.id, type: docType(doc), field, value: diagnosticValue(value) });
|
|
297
297
|
}
|
|
298
298
|
}
|