@mossbear/protocol 0.1.0-alpha.88 → 0.1.0-alpha.89
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/dist/contextKinds.d.ts +5 -8
- package/dist/contextKinds.d.ts.map +1 -1
- package/dist/contextKinds.js +5 -8
- package/dist/contextKinds.js.map +1 -1
- package/dist/contextKinds.test.js +2 -10
- package/dist/contextKinds.test.js.map +1 -1
- package/dist/schemas.d.ts +749 -2751
- package/dist/schemas.d.ts.map +1 -1
- package/dist/schemas.js +38 -336
- package/dist/schemas.js.map +1 -1
- package/dist/schemas.test.js +35 -142
- package/dist/schemas.test.js.map +1 -1
- package/dist/types.d.ts +5 -10
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
package/dist/schemas.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
import * as v from 'valibot';
|
|
11
11
|
import { DISPLAY_NAME_REFUSED_CHARACTERS } from './bundleSlug.js';
|
|
12
12
|
import { isBundleSlug } from './bundleSlug.js';
|
|
13
|
-
import { CONTEXT_CONTENT_KINDS, CONTEXT_ITEM_TYPES, CONTEXT_ITEM_TYPE_FILTER_VALUES, contextItemTypeOf, INBOX_CONTENT_TYPES,
|
|
13
|
+
import { CONTEXT_CONTENT_KINDS, CONTEXT_ITEM_TYPES, CONTEXT_ITEM_TYPE_FILTER_VALUES, contextItemTypeOf, INBOX_CONTENT_TYPES, } from './contextKinds.js';
|
|
14
14
|
import { MAX_CONTEXT_CONTENT_BYTES, MAX_RAW_GUIDE_CONTENT_BYTES } from './limits.js';
|
|
15
15
|
// ---------------------------------------------------------------------------
|
|
16
16
|
// Core enum schemas
|
|
@@ -902,9 +902,15 @@ export const RevokeScopedTokenRequestSchema = v.object({
|
|
|
902
902
|
// one id, so no membership kind travels the wire. An older client may still send
|
|
903
903
|
// `itemType` on attach (or `?itemType=` on detach); this schema is not strict, so
|
|
904
904
|
// the field is dropped on parse rather than refused.
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
905
|
+
/**
|
|
906
|
+
* The member to attach, by its artifact id. `itemId` is the name a CLI from before
|
|
907
|
+
* release step 2 sends; both are read, and the parsed value is always `artifactId`.
|
|
908
|
+
* Drop `itemId` once no such CLI is left to send it.
|
|
909
|
+
*/
|
|
910
|
+
export const AttachBundleMemberRequestSchema = v.pipe(v.object({
|
|
911
|
+
artifactId: v.optional(v.pipe(v.string(), v.minLength(1))),
|
|
912
|
+
itemId: v.optional(v.pipe(v.string(), v.minLength(1))),
|
|
913
|
+
}), v.check((request) => request.artifactId !== undefined || request.itemId !== undefined, 'A member needs an artifactId.'), v.transform((request) => ({ artifactId: (request.artifactId ?? request.itemId) })));
|
|
908
914
|
export const AttachBundleMemberResponseSchema = v.object({
|
|
909
915
|
// False when the item was already a member — attach is idempotent, and the
|
|
910
916
|
// caller (multi-select menu applying a diff) treats both as success.
|
|
@@ -964,20 +970,6 @@ export const ContextItemTypeSchema = v.picklist(CONTEXT_ITEM_TYPES);
|
|
|
964
970
|
* the release that moved the CLI's own vocabulary onto `content`.
|
|
965
971
|
*/
|
|
966
972
|
export const ContextItemTypeFilterSchema = v.picklist(CONTEXT_ITEM_TYPE_FILTER_VALUES);
|
|
967
|
-
// The contentType a caller may *create* through the context layer. `guide` is
|
|
968
|
-
// deliberately absent, and stays absent after slice 2b-B made guides pushable:
|
|
969
|
-
// this schema is reached only by POST (create) and the MCP `create_artifact`
|
|
970
|
-
// tool — the PUT body carries no contentType at all
|
|
971
|
-
// (`UpdateContextItemRequestSchema` below). So admitting `guide` here could
|
|
972
|
-
// only legalize a *create*, which the endpoint cannot honor: POST always calls
|
|
973
|
-
// `insertBundleGuideFile`, which writes a standalone guide_files row with
|
|
974
|
-
// `guideId: null` and never the `guides` registration a guide needs, so the
|
|
975
|
-
// caller would get a 201 for something that is not a guide. Updating an
|
|
976
|
-
// existing guide needs nothing from this picklist — it is addressed by
|
|
977
|
-
// `itemId` alone (`guide-versioned-identity-plan.md` → Slice 2b-B, the third
|
|
978
|
-
// Codex constraint, resolved as "restrict to itemId-bearing updates").
|
|
979
|
-
// (the `pushable` column of `CONTEXT_CONTENT_KINDS`).
|
|
980
|
-
export const PushContentTypeSchema = v.picklist(PUSH_CONTENT_TYPES);
|
|
981
973
|
// Inbox capture is text or an image today (image upload lands in Phase 2b) —
|
|
982
974
|
// the `capturable` column of `CONTEXT_CONTENT_KINDS`.
|
|
983
975
|
export const InboxContentTypeSchema = v.picklist(INBOX_CONTENT_TYPES);
|
|
@@ -1393,6 +1385,14 @@ export const ContextItemsResponseSchema = v.object({
|
|
|
1393
1385
|
*/
|
|
1394
1386
|
untrusted: v.optional(v.nullable(GuideHistoryUntrustedSchema)),
|
|
1395
1387
|
});
|
|
1388
|
+
/**
|
|
1389
|
+
* The bundle pull under its artifact name: the same members and comments as
|
|
1390
|
+
* {@link ContextItemsResponseSchema}, under `artifacts`.
|
|
1391
|
+
*/
|
|
1392
|
+
export const BundleArtifactsResponseSchema = v.object({
|
|
1393
|
+
artifacts: v.array(ContextItemSchema),
|
|
1394
|
+
untrusted: v.optional(v.nullable(GuideHistoryUntrustedSchema)),
|
|
1395
|
+
});
|
|
1396
1396
|
/**
|
|
1397
1397
|
* How many bundles one comments read may name.
|
|
1398
1398
|
*
|
|
@@ -1519,7 +1519,6 @@ const AgentCommentTargetIdSchema = v.pipe(v.string(), v.minLength(1), v.maxLengt
|
|
|
1519
1519
|
export const AgentCommentRequestSchema = v.object({
|
|
1520
1520
|
target: v.variant('kind', [
|
|
1521
1521
|
v.object({ kind: v.literal('artifact'), id: AgentCommentTargetIdSchema }),
|
|
1522
|
-
v.object({ kind: v.literal('item'), id: AgentCommentTargetIdSchema }),
|
|
1523
1522
|
v.object({ kind: v.literal('session'), id: AgentCommentTargetIdSchema }),
|
|
1524
1523
|
v.object({ kind: v.literal('reply'), id: AgentCommentTargetIdSchema }),
|
|
1525
1524
|
]),
|
|
@@ -1550,8 +1549,7 @@ export const AgentCommentResponseSchema = v.object({
|
|
|
1550
1549
|
id: v.string(),
|
|
1551
1550
|
threadId: v.string(),
|
|
1552
1551
|
subject: v.object({
|
|
1553
|
-
|
|
1554
|
-
kind: v.picklist(['artifact', 'item', 'session']),
|
|
1552
|
+
kind: v.picklist(['artifact', 'session']),
|
|
1555
1553
|
id: v.string(),
|
|
1556
1554
|
}),
|
|
1557
1555
|
body: v.string(),
|
|
@@ -1712,251 +1710,6 @@ export const CommentEvidenceResponseSchema = v.object({
|
|
|
1712
1710
|
sessionCommentsWithheld: v.optional(v.pipe(v.number(), v.integer()), 0),
|
|
1713
1711
|
untrusted: GuideHistoryUntrustedSchema,
|
|
1714
1712
|
});
|
|
1715
|
-
/** Max number of context item ids a push may cite as its transform sources. */
|
|
1716
|
-
export const MAX_TRANSFORM_SOURCE_IDS = 100;
|
|
1717
|
-
/**
|
|
1718
|
-
* The ids of the caller-owned context items a pushed document was produced
|
|
1719
|
-
* from (inbox captures, bundle items — any item the caller owns). Shared
|
|
1720
|
-
* between the REST contract and the MCP tool's client-side arg validation so
|
|
1721
|
-
* the two can't drift.
|
|
1722
|
-
*/
|
|
1723
|
-
export const SourceItemIdsSchema = v.pipe(v.array(v.pipe(v.string(), v.minLength(1))), v.minLength(1), v.maxLength(MAX_TRANSFORM_SOURCE_IDS));
|
|
1724
|
-
// The update-side variant: same element and upper bound, but an empty array is
|
|
1725
|
-
// legal and means "clear the stored provenance". See
|
|
1726
|
-
// `UpdateContextItemRequestSchema.sourceItemIds` for why the create side keeps
|
|
1727
|
-
// the non-empty bound.
|
|
1728
|
-
export const UpdatableSourceItemIdsSchema = v.pipe(v.array(v.pipe(v.string(), v.minLength(1))), v.maxLength(MAX_TRANSFORM_SOURCE_IDS));
|
|
1729
|
-
// Push a canonical item into a bundle. `itemId` present → update in place (the
|
|
1730
|
-
// MCP push maps to PUT); absent → create (maps to POST). The dedicated update
|
|
1731
|
-
// schema below is what the PUT route validates.
|
|
1732
|
-
//
|
|
1733
|
-
// `sourceItemIds` (optional, on create and update alike) cites the context
|
|
1734
|
-
// items the pushed document was produced from. **The server accepts and ignores
|
|
1735
|
-
// it**: provenance is recorded per saved revision as `sources`
|
|
1736
|
-
// (`ArtifactSourceRefSchema`), and the head list is no longer written. The field
|
|
1737
|
-
// stays so a client that still sends it parses. Existing stored values are left
|
|
1738
|
-
// as they are.
|
|
1739
|
-
//
|
|
1740
|
-
// `path` (optional) is the document's **placement**: where it sits in the tree
|
|
1741
|
-
// of the repo that declared it, so the docs phase materializes it there instead
|
|
1742
|
-
// of dropping a second copy into the bundle directory. It is accepted on update
|
|
1743
|
-
// too (`UpdateContextItemRequestSchema.path`), which is what makes it a place
|
|
1744
|
-
// the user can rearrange rather than a record of where the file came from.
|
|
1745
|
-
//
|
|
1746
|
-
// Three things about it are load-bearing:
|
|
1747
|
-
//
|
|
1748
|
-
// - It is the **same schema** `ContextItemSchema.path` uses on the read side
|
|
1749
|
-
// (`:645`). A second rule here would let the server accept a row it then
|
|
1750
|
-
// could not serialize, and a strict read schema fails the *whole* response
|
|
1751
|
-
// server-side — so one bad row would take
|
|
1752
|
-
// every other item in the bundle with it.
|
|
1753
|
-
// - **Absent is legal and is the ordinary case**, not a migration artifact: a
|
|
1754
|
-
// document authored in the dashboard never had a repo path. Absent keeps
|
|
1755
|
-
// today's bundle-directory default, which the CLI already implements
|
|
1756
|
-
// (`packages/cli/src/artifacts/guide-projection.ts:356-358`).
|
|
1757
|
-
// - There is deliberately **no `root`**. The docs phase supplies only the
|
|
1758
|
-
// project root (`packages/cli/src/artifacts/sync-artifacts.ts:1613-1617`), so `global`
|
|
1759
|
-
// could never materialize, and with it refused a root field could only ever
|
|
1760
|
-
// carry the value an absent root already means.
|
|
1761
|
-
//
|
|
1762
|
-
// The route additionally refuses a path that is agent guidance — `AGENTS.md`,
|
|
1763
|
-
// anything under `.agents/` and friends — which the schema cannot express and
|
|
1764
|
-
// which is checked with `isAgentGuidancePath`. Without it an agent could push a
|
|
1765
|
-
// document that becomes a repo's guidance file on the next sync. The update
|
|
1766
|
-
// routes apply the same refusal, since a movable path is a second entrance.
|
|
1767
|
-
export const PushContextRequestSchema = v.object({
|
|
1768
|
-
name: ArtifactNameSchema,
|
|
1769
|
-
contentType: PushContentTypeSchema,
|
|
1770
|
-
content: ContextContentSchema,
|
|
1771
|
-
itemId: v.optional(v.string()),
|
|
1772
|
-
origin: v.optional(v.nullable(v.string())),
|
|
1773
|
-
sourceItemIds: v.optional(SourceItemIdsSchema),
|
|
1774
|
-
path: v.optional(v.nullable(SafeRelativePosixPathSchema)),
|
|
1775
|
-
/**
|
|
1776
|
-
* The committed `project.id` of the checkout this write comes from, when it
|
|
1777
|
-
* has one (`subscription-delivery-target-plan.md` → slice 3).
|
|
1778
|
-
*
|
|
1779
|
-
* It answers two questions, both about the writer's checkout:
|
|
1780
|
-
*
|
|
1781
|
-
* - **Is this write coming from the repo that owns these items?** Only a
|
|
1782
|
-
* bundle that claims a home asks. A request that declares nothing — every
|
|
1783
|
-
* dashboard edit — is not the home repo and is refused by name. Declaring an
|
|
1784
|
-
* id grants nothing on its own: an unclaimed bundle ignores it for this
|
|
1785
|
-
* purpose, and the caller must already be a member of the bundle's workspace
|
|
1786
|
-
* to reach this route at all.
|
|
1787
|
-
* - **Which repo is `path` placed in?** Stored beside `path` as the item's
|
|
1788
|
-
* home, so the one repo that declared the path can hold the document there
|
|
1789
|
-
* literally while every other subscriber mirrors it. Ignored without a
|
|
1790
|
-
* `path`: a home places nothing when there is no path to place.
|
|
1791
|
-
*
|
|
1792
|
-
* **The stored home is not echoed back as `ContextItemSchema.projectId`.**
|
|
1793
|
-
* That field tells a reader an item belongs to one repo and is not to be
|
|
1794
|
-
* materialized anywhere else; a document's home only says where it lands.
|
|
1795
|
-
*
|
|
1796
|
-
* Parsed as {@link DeclaredProjectIdSchema} — the CLI config reader's own
|
|
1797
|
-
* rule, trimmed and non-empty, and no stricter — so the stored home
|
|
1798
|
-
* round-trips against the value a checkout reads.
|
|
1799
|
-
*/
|
|
1800
|
-
projectId: v.optional(DeclaredProjectIdSchema),
|
|
1801
|
-
/**
|
|
1802
|
-
* Where the committed bytes in `content` came from, when this write is a
|
|
1803
|
-
* publication (`artifact-ownership-and-delivery-plan.md` → slice 3). Present
|
|
1804
|
-
* means git owns the resulting artifact: the commit is the authority and
|
|
1805
|
-
* Mossbear distributes the revision rather than keeping a second editable
|
|
1806
|
-
* copy.
|
|
1807
|
-
*
|
|
1808
|
-
* **Sending it is a claim about provenance, not an authorization.** The
|
|
1809
|
-
* server still answers who may write here from bundle membership and the
|
|
1810
|
-
* bundle's declared home, exactly as it does for `projectId` above; what this
|
|
1811
|
-
* adds is the revision the bytes were read from, so a subscriber can answer
|
|
1812
|
-
* "what did I get".
|
|
1813
|
-
*
|
|
1814
|
-
* **`path` is required alongside it and the route enforces that**, because
|
|
1815
|
-
* the database will: `guide_files_git_source_subset` admits only "repo id +
|
|
1816
|
-
* path + sha all present" or the whole group absent, so a publication that
|
|
1817
|
-
* named no path would fail at insert time with a constraint error instead of
|
|
1818
|
-
* a sentence. Refused in the route rather than restated as a wire rule, for
|
|
1819
|
-
* the reason `ContextItemSchema.gitSource` gives — a path this schema cannot
|
|
1820
|
-
* parse is one item's problem, not the response's.
|
|
1821
|
-
*/
|
|
1822
|
-
gitSource: v.optional(GitSourceSchema),
|
|
1823
|
-
});
|
|
1824
|
-
export const PushContextResponseSchema = v.object({
|
|
1825
|
-
item: ContextItemSchema,
|
|
1826
|
-
created: v.boolean(),
|
|
1827
|
-
});
|
|
1828
|
-
// Update a canonical item in place — the edit propagates to every bundle that
|
|
1829
|
-
// references it. Both fields are optional so a partial update parses; the route
|
|
1830
|
-
// rejects a body that changes nothing.
|
|
1831
|
-
export const UpdateContextItemRequestSchema = v.object({
|
|
1832
|
-
itemId: v.pipe(v.string(), v.minLength(1)),
|
|
1833
|
-
name: v.optional(ArtifactNameSchema),
|
|
1834
|
-
// Bounded by the **guide** cap, not the context cap, because an update can
|
|
1835
|
-
// target either kind and the two disagree: an imported guide body may be up
|
|
1836
|
-
// to `MAX_RAW_GUIDE_CONTENT_BYTES` (512 KiB) while a pushed/captured item
|
|
1837
|
-
// caps at `MAX_CONTEXT_CONTENT_BYTES` (256 KiB). Before slice 2b-B that gap
|
|
1838
|
-
// was unreachable — guides could not be pushed — and closing it by lowering
|
|
1839
|
-
// the import cap would reject guides that already import today, while raising
|
|
1840
|
-
// the context cap would double what the context layer accepts for everything.
|
|
1841
|
-
// So this is only the wire ceiling (the DoS bound); the *kind-specific* limit
|
|
1842
|
-
// is enforced in `updateBundleGuideFileContent`, which is the one place that
|
|
1843
|
-
// has already resolved which kind of row it is about to write. Enforcing it
|
|
1844
|
-
// in the route instead would be exactly the rule a future caller forgets
|
|
1845
|
-
// (Planning Principle 14).
|
|
1846
|
-
content: v.optional(UpdatableContentSchema),
|
|
1847
|
-
// Optimistic-concurrency precondition: the version the caller last read (from
|
|
1848
|
-
// `ContextItemSchema.version`). When present and it no longer matches the
|
|
1849
|
-
// current version, the update is rejected with 409 instead of silently
|
|
1850
|
-
// clobbering a concurrent write. Omit it to keep last-write-wins behavior.
|
|
1851
|
-
expectedVersion: v.optional(v.pipe(v.number(), v.integer(), v.minValue(1))),
|
|
1852
|
-
/**
|
|
1853
|
-
* The committed `project.id` of the checkout this write comes from — same
|
|
1854
|
-
* meaning and same two uses as on `PushContextRequestSchema`: a bundle that
|
|
1855
|
-
* claims a home accepts writes only from that repo, and a request declaring
|
|
1856
|
-
* nothing is not it; and when this update sets `path`, it is stored as the
|
|
1857
|
-
* repo that path is placed in. Parsed as on `PushContextRequestSchema`.
|
|
1858
|
-
*/
|
|
1859
|
-
projectId: v.optional(DeclaredProjectIdSchema),
|
|
1860
|
-
/**
|
|
1861
|
-
* Move the document: its new placement, or `null` to take the placement away
|
|
1862
|
-
* so it lands in the bundle folder again.
|
|
1863
|
-
*
|
|
1864
|
-
* **Three states, the same shape `sourceItemIds` takes.** Omitted leaves the
|
|
1865
|
-
* stored path and its home alone — every name or body edit. A path replaces
|
|
1866
|
-
* both: the path, and the home as `projectId` above declares it, since a path
|
|
1867
|
-
* is relative to the repo that declared it. `null` clears both.
|
|
1868
|
-
*
|
|
1869
|
-
* The same schema as the create side and the read side, for the reason
|
|
1870
|
-
* `PushContextRequestSchema` gives, and the same refusals in the routes —
|
|
1871
|
-
* agent guidance, Mossbear's state directory, git's.
|
|
1872
|
-
*
|
|
1873
|
-
* **Documents only.** A guide's path is its discovery path, which import
|
|
1874
|
-
* reconciles on; moving it here would fork it from the file it came from, so
|
|
1875
|
-
* the routes refuse it on a guide by name. A git-published artifact cannot
|
|
1876
|
-
* drop its path either, because the published-source group is only legal
|
|
1877
|
-
* beside one.
|
|
1878
|
-
*/
|
|
1879
|
-
path: v.optional(v.nullable(SafeRelativePosixPathSchema)),
|
|
1880
|
-
// Replaces the item's stored provenance. An update re-derives the document,
|
|
1881
|
-
// so the citation records where the item's *current* body came from; leaving
|
|
1882
|
-
// the previous ids in place would describe content that no longer exists.
|
|
1883
|
-
// This used to be rejected outright, because a transform was graded once at
|
|
1884
|
-
// creation — that reason was deleted with the grader
|
|
1885
|
-
// (`transform-grading-removal-plan.md`).
|
|
1886
|
-
//
|
|
1887
|
-
// Three states, which is why this is not `SourceItemIdsSchema`: **omitted**
|
|
1888
|
-
// leaves the stored ids alone (a name-only or provenance-preserving edit),
|
|
1889
|
-
// a **non-empty** list replaces them, and **`[]` clears them**. Without the
|
|
1890
|
-
// empty case an item rewritten from scratch could never shed provenance that
|
|
1891
|
-
// no longer describes it — the silently-wrong record this field's own
|
|
1892
|
-
// rationale argues against. `POST` keeps the non-empty bound: there is
|
|
1893
|
-
// nothing to clear on a create, so `[]` there would only be a second way to
|
|
1894
|
-
// say "no sources" alongside omitting the field.
|
|
1895
|
-
sourceItemIds: v.optional(UpdatableSourceItemIdsSchema),
|
|
1896
|
-
/**
|
|
1897
|
-
* The revision this update's bytes were read from — same meaning as on
|
|
1898
|
-
* `PushContextRequestSchema` above, and the field that makes a republication
|
|
1899
|
-
* advance an artifact's provenance rather than leave it pointing at the
|
|
1900
|
-
* commit it was first published from.
|
|
1901
|
-
*
|
|
1902
|
-
* **Omitted leaves the stored group alone; it never clears it.** An update
|
|
1903
|
-
* that says nothing about provenance is a name or body edit, not a claim that
|
|
1904
|
-
* the artifact stopped being git-owned — and an absent key that silently
|
|
1905
|
-
* un-owned a row would hand a subscriber write access by omission, which is
|
|
1906
|
-
* the failure the whole ownership model exists to prevent. Ownership is given
|
|
1907
|
-
* up by promotion, not by a missing field.
|
|
1908
|
-
*/
|
|
1909
|
-
gitSource: v.optional(GitSourceSchema),
|
|
1910
|
-
/**
|
|
1911
|
-
* Tombstone this artifact: the commit that published it has since deleted the
|
|
1912
|
-
* file, so the revision stops being delivered while the row and its version
|
|
1913
|
-
* history stay where they are.
|
|
1914
|
-
*
|
|
1915
|
-
* **A verb, not a column state**, the same shape the dashboard's own removal
|
|
1916
|
-
* takes (`~/zero/mutators.ts` → `guideFiles.update`'s `removed`). There is no
|
|
1917
|
-
* writable field here that a removal and an ordinary edit could disagree
|
|
1918
|
-
* about, and `literal(true)` is what keeps `removed: false` from reading as a
|
|
1919
|
-
* request to bring something back — un-removing is republishing, which is an
|
|
1920
|
-
* ordinary content write.
|
|
1921
|
-
*
|
|
1922
|
-
* **`gitSource` is required alongside it and the route enforces that.** A
|
|
1923
|
-
* tombstone's whole claim is *which revision removed the file*: without one
|
|
1924
|
-
* the row would say an artifact stopped being delivered and be unable to say
|
|
1925
|
-
* why, which is the silent withdrawal this field exists to replace. That also
|
|
1926
|
-
* keeps the only writer of a removal here the publication path — this is not
|
|
1927
|
-
* a general delete verb for the context layer.
|
|
1928
|
-
*
|
|
1929
|
-
* **Never sent with `content`.** A removal has no bytes; a body carrying both
|
|
1930
|
-
* is two answers to one question and the route refuses it rather than picking.
|
|
1931
|
-
*/
|
|
1932
|
-
removed: v.optional(v.literal(true)),
|
|
1933
|
-
});
|
|
1934
|
-
export const UpdateContextItemResponseSchema = v.object({
|
|
1935
|
-
item: ContextItemSchema,
|
|
1936
|
-
updated: v.boolean(),
|
|
1937
|
-
});
|
|
1938
|
-
// The same edit addressed by URL instead of by body field. The item-scoped
|
|
1939
|
-
// `PUT /api/v1/context/items/:itemId` takes the id from the path, so carrying it
|
|
1940
|
-
// in the body as well would let the two disagree and force the route to pick a
|
|
1941
|
-
// winner. Derived with `v.omit` rather than re-declared, so the updatable fields
|
|
1942
|
-
// and their bounds cannot drift between the two shapes.
|
|
1943
|
-
export const UpdateContextItemBodySchema = v.omit(UpdateContextItemRequestSchema, [
|
|
1944
|
-
'itemId',
|
|
1945
|
-
]);
|
|
1946
|
-
/** A single canonical item, for the item-scoped read route. */
|
|
1947
|
-
export const ContextItemResponseSchema = v.object({
|
|
1948
|
-
item: ContextItemSchema,
|
|
1949
|
-
});
|
|
1950
|
-
// `POST /api/v1/context/items/:itemId/archive`. A boolean, not a count: the
|
|
1951
|
-
// route addresses exactly one item and answers 404 when it does not resolve, so
|
|
1952
|
-
// there is no "succeeded on 0 of 1" state left for a number to express. That
|
|
1953
|
-
// ambiguity is the bug this route exists to remove — the batch inbox endpoint
|
|
1954
|
-
// answered `200 {archived: 0}` for an item it declined to touch
|
|
1955
|
-
// (`inbox-as-view-plan.md` → Evidence).
|
|
1956
|
-
export const ArchiveContextItemResponseSchema = v.object({
|
|
1957
|
-
archived: v.boolean(),
|
|
1958
|
-
item: ContextItemSchema,
|
|
1959
|
-
});
|
|
1960
1713
|
// A capture id the *client* minted, so a note has a name before it has a
|
|
1961
1714
|
// server — `offline-doc-editing-plan.md` → slice 4.
|
|
1962
1715
|
//
|
|
@@ -2075,18 +1828,13 @@ export const ArtifactVersionDetailSchema = v.object({
|
|
|
2075
1828
|
createdAt: v.string(),
|
|
2076
1829
|
});
|
|
2077
1830
|
/** The item routes' names for the version schemas, kept while those routes are served. */
|
|
2078
|
-
export const ContextItemVersionSchema = ArtifactVersionSchema;
|
|
2079
|
-
export const ContextItemVersionDetailSchema = ArtifactVersionDetailSchema;
|
|
2080
1831
|
// Newest-first page of a doc's version summaries. `nextCursor` is the version
|
|
2081
1832
|
// number to pass back as `?before=` for the following (older) page, or null
|
|
2082
1833
|
// once the oldest version has been returned.
|
|
2083
|
-
export const
|
|
2084
|
-
versions: v.array(
|
|
1834
|
+
export const BundleArtifactVersionsResponseSchema = v.object({
|
|
1835
|
+
versions: v.array(ArtifactVersionSchema),
|
|
2085
1836
|
nextCursor: v.nullable(v.number()),
|
|
2086
1837
|
});
|
|
2087
|
-
export const ContextItemVersionResponseSchema = v.object({
|
|
2088
|
-
version: ContextItemVersionDetailSchema,
|
|
2089
|
-
});
|
|
2090
1838
|
/** Default and max page size for the version-history list endpoint. */
|
|
2091
1839
|
export const DEFAULT_VERSIONS_LIMIT = 50;
|
|
2092
1840
|
export const MAX_VERSIONS_LIMIT = 200;
|
|
@@ -3006,21 +2754,19 @@ export const ExtractedFeedbackBatchSchema = v.object({
|
|
|
3006
2754
|
// ---------------------------------------------------------------------------
|
|
3007
2755
|
// Agent config schema
|
|
3008
2756
|
// ---------------------------------------------------------------------------
|
|
3009
|
-
// AgentConfig
|
|
2757
|
+
// AgentConfig was the input shape of `packages/projections`' renderers, which
|
|
2758
|
+
// were deleted with `projections-compat-renderers-dead`.
|
|
3010
2759
|
// EvalRequest/EvalResult/Finding and ProjectionRequest/ProjectionResult used
|
|
3011
2760
|
// to wrap it for the CLI's on-device grader and a projection wire envelope;
|
|
3012
2761
|
// both are gone, and had zero consumers outside this package's own tests.
|
|
3013
2762
|
//
|
|
3014
2763
|
// The CLI command that produced these — `mossbear guides project` — is gone
|
|
3015
|
-
// too (`guides-project-removal`). The schema stays because
|
|
3016
|
-
//
|
|
3017
|
-
//
|
|
3018
|
-
// renderers now have no non-test caller, and retiring them is its own row.
|
|
2764
|
+
// too (`guides-project-removal`). The schema stays only because it is a
|
|
2765
|
+
// published export: nothing in the repo reads it since the renderers were
|
|
2766
|
+
// removed, and dropping it is a semver judgment, not a cleanup.
|
|
3019
2767
|
//
|
|
3020
|
-
// `parseAgentConfig` below
|
|
3021
|
-
//
|
|
3022
|
-
// dropping a public wrapper is a semver judgment; it is filed with the eight
|
|
3023
|
-
// other unused `parse*` wrappers rather than deleted here.
|
|
2768
|
+
// `parseAgentConfig` below has no non-test caller for the same reason; it stays
|
|
2769
|
+
// until someone decides to drop a published wrapper.
|
|
3024
2770
|
export const AgentConfigSchema = v.object({
|
|
3025
2771
|
id: v.string(),
|
|
3026
2772
|
name: v.string(),
|
|
@@ -3805,27 +3551,16 @@ export const SearchFrontmatterSchema = v.pipe(v.record(v.pipe(v.string(), v.rege
|
|
|
3805
3551
|
export const SEARCH_COMMENT_AUTHOR_KINDS = ['person', 'agent', 'mossbear'];
|
|
3806
3552
|
export const SearchCommentAuthorKindSchema = v.picklist(SEARCH_COMMENT_AUTHOR_KINDS);
|
|
3807
3553
|
/**
|
|
3808
|
-
* What a comment is attached to. `
|
|
3809
|
-
* run the caller made. Session comments are the caller's own and never reach
|
|
3810
|
-
* workspace-mate.
|
|
3554
|
+
* What a comment is attached to. `artifact` is a guide or a document; `session`
|
|
3555
|
+
* is a run the caller made. Session comments are the caller's own and never reach
|
|
3556
|
+
* a workspace-mate.
|
|
3811
3557
|
*/
|
|
3812
|
-
export const SEARCH_COMMENT_SUBJECT_KINDS = ['item', 'session'];
|
|
3813
|
-
export const SearchCommentSubjectKindSchema = v.picklist(SEARCH_COMMENT_SUBJECT_KINDS);
|
|
3814
3558
|
/**
|
|
3815
3559
|
* The subject kinds a client names in a search: `artifact`, never its older
|
|
3816
3560
|
* name `item`.
|
|
3817
3561
|
*/
|
|
3818
3562
|
export const SEARCH_COMMENT_SUBJECT_KIND_NAMES = ['artifact', 'session'];
|
|
3819
|
-
|
|
3820
|
-
* The subject kinds a search request may name. `artifact` is the new name for
|
|
3821
|
-
* `item` and means the same subjects; both are accepted until every client sends
|
|
3822
|
-
* `artifact`, while hits and the advertised list above still say `item`.
|
|
3823
|
-
*/
|
|
3824
|
-
export const SEARCH_COMMENT_SUBJECT_KIND_FILTERS = [
|
|
3825
|
-
...SEARCH_COMMENT_SUBJECT_KINDS,
|
|
3826
|
-
'artifact',
|
|
3827
|
-
];
|
|
3828
|
-
export const SearchCommentSubjectKindFilterSchema = v.picklist(SEARCH_COMMENT_SUBJECT_KIND_FILTERS);
|
|
3563
|
+
export const SearchCommentSubjectKindFilterSchema = v.picklist(SEARCH_COMMENT_SUBJECT_KIND_NAMES);
|
|
3829
3564
|
/**
|
|
3830
3565
|
* What a user turn was, as the session classifier labels it. The same
|
|
3831
3566
|
* vocabulary the classifier writes; a `turns` search may keep only some.
|
|
@@ -4026,9 +3761,9 @@ const searchCommentHitFields = {
|
|
|
4026
3761
|
* A comment on a guide or document that matched. `body` and `itemName` and
|
|
4027
3762
|
* `workspaceName` are wrapped in `untrusted`'s markers.
|
|
4028
3763
|
*/
|
|
4029
|
-
export const
|
|
3764
|
+
export const SearchArtifactCommentHitSchema = v.object({
|
|
4030
3765
|
...searchCommentHitFields,
|
|
4031
|
-
subjectKind: v.literal('
|
|
3766
|
+
subjectKind: v.literal('artifact'),
|
|
4032
3767
|
itemId: NonEmptyStringSchema,
|
|
4033
3768
|
/**
|
|
4034
3769
|
* The guide the item belongs to, or null for a standalone document. A comment
|
|
@@ -4065,17 +3800,8 @@ export const SearchSessionCommentHitSchema = v.object({
|
|
|
4065
3800
|
sessionId: NonEmptyStringSchema,
|
|
4066
3801
|
matchedIn: v.literal('body'),
|
|
4067
3802
|
});
|
|
4068
|
-
/**
|
|
4069
|
-
* The same hit under the new name for its subject (one-artifact Stage 3): a
|
|
4070
|
-
* client reads either until every server sends `artifact`.
|
|
4071
|
-
*/
|
|
4072
|
-
export const SearchArtifactCommentHitSchema = v.object({
|
|
4073
|
-
...SearchItemCommentHitSchema.entries,
|
|
4074
|
-
subjectKind: v.literal('artifact'),
|
|
4075
|
-
});
|
|
4076
3803
|
export const SearchCommentHitSchema = v.variant('subjectKind', [
|
|
4077
3804
|
SearchArtifactCommentHitSchema,
|
|
4078
|
-
SearchItemCommentHitSchema,
|
|
4079
3805
|
SearchSessionCommentHitSchema,
|
|
4080
3806
|
]);
|
|
4081
3807
|
/**
|
|
@@ -4284,32 +4010,11 @@ export function parseUpdateBundleResponse(data) {
|
|
|
4284
4010
|
export function parseDeleteBundleResponse(data) {
|
|
4285
4011
|
return v.parse(DeleteBundleResponseSchema, data);
|
|
4286
4012
|
}
|
|
4287
|
-
export function parseContextItem(data) {
|
|
4288
|
-
return v.parse(ContextItemSchema, data);
|
|
4289
|
-
}
|
|
4290
4013
|
export function parseContextItemsResponse(data) {
|
|
4291
4014
|
return v.parse(ContextItemsResponseSchema, data);
|
|
4292
4015
|
}
|
|
4293
|
-
export function
|
|
4294
|
-
return v.parse(
|
|
4295
|
-
}
|
|
4296
|
-
export function parsePushContextResponse(data) {
|
|
4297
|
-
return v.parse(PushContextResponseSchema, data);
|
|
4298
|
-
}
|
|
4299
|
-
export function parseUpdateContextItemRequest(data) {
|
|
4300
|
-
return v.parse(UpdateContextItemRequestSchema, data);
|
|
4301
|
-
}
|
|
4302
|
-
export function parseUpdateContextItemResponse(data) {
|
|
4303
|
-
return v.parse(UpdateContextItemResponseSchema, data);
|
|
4304
|
-
}
|
|
4305
|
-
export function parseUpdateContextItemBody(data) {
|
|
4306
|
-
return v.parse(UpdateContextItemBodySchema, data);
|
|
4307
|
-
}
|
|
4308
|
-
export function parseContextItemResponse(data) {
|
|
4309
|
-
return v.parse(ContextItemResponseSchema, data);
|
|
4310
|
-
}
|
|
4311
|
-
export function parseArchiveContextItemResponse(data) {
|
|
4312
|
-
return v.parse(ArchiveContextItemResponseSchema, data);
|
|
4016
|
+
export function parseBundleArtifactsResponse(data) {
|
|
4017
|
+
return v.parse(BundleArtifactsResponseSchema, data);
|
|
4313
4018
|
}
|
|
4314
4019
|
export function parseInboxCaptureRequest(data) {
|
|
4315
4020
|
return v.parse(InboxCaptureRequestSchema, data);
|
|
@@ -4320,11 +4025,8 @@ export function parseInboxCaptureResponse(data) {
|
|
|
4320
4025
|
export function parseInboxListResponse(data) {
|
|
4321
4026
|
return v.parse(InboxListResponseSchema, data);
|
|
4322
4027
|
}
|
|
4323
|
-
export function
|
|
4324
|
-
return v.parse(
|
|
4325
|
-
}
|
|
4326
|
-
export function parseContextItemVersionResponse(data) {
|
|
4327
|
-
return v.parse(ContextItemVersionResponseSchema, data);
|
|
4028
|
+
export function parseBundleArtifactVersionsResponse(data) {
|
|
4029
|
+
return v.parse(BundleArtifactVersionsResponseSchema, data);
|
|
4328
4030
|
}
|
|
4329
4031
|
export function parseInboxArchiveRequest(data) {
|
|
4330
4032
|
return v.parse(InboxArchiveRequestSchema, data);
|