@mossbear/protocol 0.1.0-alpha.88 → 0.1.0-alpha.90

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/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, PUSH_CONTENT_TYPES, } from './contextKinds.js';
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
@@ -109,14 +109,24 @@ const BoundedRawContentSchema = v.pipe(v.string(), v.check((value) => new TextEn
109
109
  //
110
110
  // Exported so the member-files read path (server response filtering, CLI
111
111
  // defense-in-depth before writing to disk) enforces the identical rule.
112
- export const SafeRelativePosixPathSchema = v.pipe(v.string(), v.minLength(1), v.maxLength(512), v.check((path) => !path.includes('\\'), 'path must use forward slashes'), v.check((path) => !path.startsWith('/') && !/^[a-zA-Z]:/.test(path), 'path must be relative'), v.check(
112
+ //
113
+ // The check messages each name the one edit that fixes the path, so they are
114
+ // written for the reader and exported for a server boundary to pass through.
115
+ export const PATH_ISSUE_MESSAGES = {
116
+ backslash: 'path must use forward slashes',
117
+ absolute: 'path must be relative',
118
+ control: 'path must not contain control characters',
119
+ segments: 'path must not contain empty, "." or ".." segments',
120
+ skillMd: 'path must not shadow the skill’s own SKILL.md',
121
+ };
122
+ export const SafeRelativePosixPathSchema = v.pipe(v.string(), v.minLength(1), v.maxLength(512), v.check((path) => !path.includes('\\'), PATH_ISSUE_MESSAGES.backslash), v.check((path) => !path.startsWith('/') && !/^[a-zA-Z]:/.test(path), PATH_ISSUE_MESSAGES.absolute), v.check(
113
123
  // eslint-disable-next-line no-control-regex
114
- (path) => !/[\u0000-\u001f\u007f]/.test(path), 'path must not contain control characters'), v.check((path) => path
124
+ (path) => !/[\u0000-\u001f\u007f]/.test(path), PATH_ISSUE_MESSAGES.control), v.check((path) => path
115
125
  .split('/')
116
- .every((segment) => segment !== '' && segment !== '.' && segment !== '..'), 'path must not contain empty, "." or ".." segments'));
126
+ .every((segment) => segment !== '' && segment !== '.' && segment !== '..'), PATH_ISSUE_MESSAGES.segments));
117
127
  // Member paths are relative to the skill directory, and additionally may never
118
128
  // name the skill's own SKILL.md (the payload itself).
119
- export const SkillMemberPathSchema = v.pipe(SafeRelativePosixPathSchema, v.check((path) => path.toLowerCase() !== 'skill.md', 'path must not shadow the skill’s own SKILL.md'));
129
+ export const SkillMemberPathSchema = v.pipe(SafeRelativePosixPathSchema, v.check((path) => path.toLowerCase() !== 'skill.md', PATH_ISSUE_MESSAGES.skillMd));
120
130
  // A sibling file of a skill's SKILL.md (scripts/, references/, assets/,
121
131
  // supporting docs), imported alongside it as a guide_file row.
122
132
  export const RawSkillMemberFileSchema = v.object({
@@ -902,9 +912,15 @@ export const RevokeScopedTokenRequestSchema = v.object({
902
912
  // one id, so no membership kind travels the wire. An older client may still send
903
913
  // `itemType` on attach (or `?itemType=` on detach); this schema is not strict, so
904
914
  // the field is dropped on parse rather than refused.
905
- export const AttachBundleMemberRequestSchema = v.object({
906
- itemId: v.pipe(v.string(), v.minLength(1)),
907
- });
915
+ /**
916
+ * The member to attach, by its artifact id. `itemId` is the name a CLI from before
917
+ * release step 2 sends; both are read, and the parsed value is always `artifactId`.
918
+ * Drop `itemId` once no such CLI is left to send it.
919
+ */
920
+ export const AttachBundleMemberRequestSchema = v.pipe(v.object({
921
+ artifactId: v.optional(v.pipe(v.string(), v.minLength(1))),
922
+ itemId: v.optional(v.pipe(v.string(), v.minLength(1))),
923
+ }), v.check((request) => request.artifactId !== undefined || request.itemId !== undefined, 'A member needs an artifactId.'), v.transform((request) => ({ artifactId: (request.artifactId ?? request.itemId) })));
908
924
  export const AttachBundleMemberResponseSchema = v.object({
909
925
  // False when the item was already a member — attach is idempotent, and the
910
926
  // caller (multi-select menu applying a diff) treats both as success.
@@ -964,20 +980,6 @@ export const ContextItemTypeSchema = v.picklist(CONTEXT_ITEM_TYPES);
964
980
  * the release that moved the CLI's own vocabulary onto `content`.
965
981
  */
966
982
  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
983
  // Inbox capture is text or an image today (image upload lands in Phase 2b) —
982
984
  // the `capturable` column of `CONTEXT_CONTENT_KINDS`.
983
985
  export const InboxContentTypeSchema = v.picklist(INBOX_CONTENT_TYPES);
@@ -1393,6 +1395,14 @@ export const ContextItemsResponseSchema = v.object({
1393
1395
  */
1394
1396
  untrusted: v.optional(v.nullable(GuideHistoryUntrustedSchema)),
1395
1397
  });
1398
+ /**
1399
+ * The bundle pull under its artifact name: the same members and comments as
1400
+ * {@link ContextItemsResponseSchema}, under `artifacts`.
1401
+ */
1402
+ export const BundleArtifactsResponseSchema = v.object({
1403
+ artifacts: v.array(ContextItemSchema),
1404
+ untrusted: v.optional(v.nullable(GuideHistoryUntrustedSchema)),
1405
+ });
1396
1406
  /**
1397
1407
  * How many bundles one comments read may name.
1398
1408
  *
@@ -1519,7 +1529,6 @@ const AgentCommentTargetIdSchema = v.pipe(v.string(), v.minLength(1), v.maxLengt
1519
1529
  export const AgentCommentRequestSchema = v.object({
1520
1530
  target: v.variant('kind', [
1521
1531
  v.object({ kind: v.literal('artifact'), id: AgentCommentTargetIdSchema }),
1522
- v.object({ kind: v.literal('item'), id: AgentCommentTargetIdSchema }),
1523
1532
  v.object({ kind: v.literal('session'), id: AgentCommentTargetIdSchema }),
1524
1533
  v.object({ kind: v.literal('reply'), id: AgentCommentTargetIdSchema }),
1525
1534
  ]),
@@ -1550,8 +1559,7 @@ export const AgentCommentResponseSchema = v.object({
1550
1559
  id: v.string(),
1551
1560
  threadId: v.string(),
1552
1561
  subject: v.object({
1553
- // `artifact` is the new name for `item`; a client reads either.
1554
- kind: v.picklist(['artifact', 'item', 'session']),
1562
+ kind: v.picklist(['artifact', 'session']),
1555
1563
  id: v.string(),
1556
1564
  }),
1557
1565
  body: v.string(),
@@ -1712,251 +1720,6 @@ export const CommentEvidenceResponseSchema = v.object({
1712
1720
  sessionCommentsWithheld: v.optional(v.pipe(v.number(), v.integer()), 0),
1713
1721
  untrusted: GuideHistoryUntrustedSchema,
1714
1722
  });
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
1723
  // A capture id the *client* minted, so a note has a name before it has a
1961
1724
  // server — `offline-doc-editing-plan.md` → slice 4.
1962
1725
  //
@@ -2075,18 +1838,13 @@ export const ArtifactVersionDetailSchema = v.object({
2075
1838
  createdAt: v.string(),
2076
1839
  });
2077
1840
  /** 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
1841
  // Newest-first page of a doc's version summaries. `nextCursor` is the version
2081
1842
  // number to pass back as `?before=` for the following (older) page, or null
2082
1843
  // once the oldest version has been returned.
2083
- export const ContextItemVersionsResponseSchema = v.object({
2084
- versions: v.array(ContextItemVersionSchema),
1844
+ export const BundleArtifactVersionsResponseSchema = v.object({
1845
+ versions: v.array(ArtifactVersionSchema),
2085
1846
  nextCursor: v.nullable(v.number()),
2086
1847
  });
2087
- export const ContextItemVersionResponseSchema = v.object({
2088
- version: ContextItemVersionDetailSchema,
2089
- });
2090
1848
  /** Default and max page size for the version-history list endpoint. */
2091
1849
  export const DEFAULT_VERSIONS_LIMIT = 50;
2092
1850
  export const MAX_VERSIONS_LIMIT = 200;
@@ -3006,21 +2764,19 @@ export const ExtractedFeedbackBatchSchema = v.object({
3006
2764
  // ---------------------------------------------------------------------------
3007
2765
  // Agent config schema
3008
2766
  // ---------------------------------------------------------------------------
3009
- // AgentConfig is the input shape `packages/projections`' renderers take.
2767
+ // AgentConfig was the input shape of `packages/projections`' renderers, which
2768
+ // were deleted with `projections-compat-renderers-dead`.
3010
2769
  // EvalRequest/EvalResult/Finding and ProjectionRequest/ProjectionResult used
3011
2770
  // to wrap it for the CLI's on-device grader and a projection wire envelope;
3012
2771
  // both are gone, and had zero consumers outside this package's own tests.
3013
2772
  //
3014
2773
  // The CLI command that produced these — `mossbear guides project` — is gone
3015
- // too (`guides-project-removal`). The schema stays because the renderers it
3016
- // fed still type against it (`packages/projections/src/agents-dir.ts:14`,
3017
- // `claude-md.ts:21`, `claude-rules.ts:21`, `cursor-rules.ts:21`); those
3018
- // renderers now have no non-test caller, and retiring them is its own row.
2774
+ // too (`guides-project-removal`). The schema stays only because it is a
2775
+ // published export: nothing in the repo reads it since the renderers were
2776
+ // removed, and dropping it is a semver judgment, not a cleanup.
3019
2777
  //
3020
- // `parseAgentConfig` below lost its only non-test caller to that same deletion.
3021
- // It is dead code today, kept for now because this package is published and
3022
- // dropping a public wrapper is a semver judgment; it is filed with the eight
3023
- // other unused `parse*` wrappers rather than deleted here.
2778
+ // `parseAgentConfig` below has no non-test caller for the same reason; it stays
2779
+ // until someone decides to drop a published wrapper.
3024
2780
  export const AgentConfigSchema = v.object({
3025
2781
  id: v.string(),
3026
2782
  name: v.string(),
@@ -3805,27 +3561,16 @@ export const SearchFrontmatterSchema = v.pipe(v.record(v.pipe(v.string(), v.rege
3805
3561
  export const SEARCH_COMMENT_AUTHOR_KINDS = ['person', 'agent', 'mossbear'];
3806
3562
  export const SearchCommentAuthorKindSchema = v.picklist(SEARCH_COMMENT_AUTHOR_KINDS);
3807
3563
  /**
3808
- * What a comment is attached to. `item` is a guide or a document; `session` is a
3809
- * run the caller made. Session comments are the caller's own and never reach a
3810
- * workspace-mate.
3564
+ * What a comment is attached to. `artifact` is a guide or a document; `session`
3565
+ * is a run the caller made. Session comments are the caller's own and never reach
3566
+ * a workspace-mate.
3811
3567
  */
3812
- export const SEARCH_COMMENT_SUBJECT_KINDS = ['item', 'session'];
3813
- export const SearchCommentSubjectKindSchema = v.picklist(SEARCH_COMMENT_SUBJECT_KINDS);
3814
3568
  /**
3815
3569
  * The subject kinds a client names in a search: `artifact`, never its older
3816
3570
  * name `item`.
3817
3571
  */
3818
3572
  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);
3573
+ export const SearchCommentSubjectKindFilterSchema = v.picklist(SEARCH_COMMENT_SUBJECT_KIND_NAMES);
3829
3574
  /**
3830
3575
  * What a user turn was, as the session classifier labels it. The same
3831
3576
  * vocabulary the classifier writes; a `turns` search may keep only some.
@@ -4026,9 +3771,9 @@ const searchCommentHitFields = {
4026
3771
  * A comment on a guide or document that matched. `body` and `itemName` and
4027
3772
  * `workspaceName` are wrapped in `untrusted`'s markers.
4028
3773
  */
4029
- export const SearchItemCommentHitSchema = v.object({
3774
+ export const SearchArtifactCommentHitSchema = v.object({
4030
3775
  ...searchCommentHitFields,
4031
- subjectKind: v.literal('item'),
3776
+ subjectKind: v.literal('artifact'),
4032
3777
  itemId: NonEmptyStringSchema,
4033
3778
  /**
4034
3779
  * The guide the item belongs to, or null for a standalone document. A comment
@@ -4065,17 +3810,8 @@ export const SearchSessionCommentHitSchema = v.object({
4065
3810
  sessionId: NonEmptyStringSchema,
4066
3811
  matchedIn: v.literal('body'),
4067
3812
  });
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
3813
  export const SearchCommentHitSchema = v.variant('subjectKind', [
4077
3814
  SearchArtifactCommentHitSchema,
4078
- SearchItemCommentHitSchema,
4079
3815
  SearchSessionCommentHitSchema,
4080
3816
  ]);
4081
3817
  /**
@@ -4284,32 +4020,11 @@ export function parseUpdateBundleResponse(data) {
4284
4020
  export function parseDeleteBundleResponse(data) {
4285
4021
  return v.parse(DeleteBundleResponseSchema, data);
4286
4022
  }
4287
- export function parseContextItem(data) {
4288
- return v.parse(ContextItemSchema, data);
4289
- }
4290
4023
  export function parseContextItemsResponse(data) {
4291
4024
  return v.parse(ContextItemsResponseSchema, data);
4292
4025
  }
4293
- export function parsePushContextRequest(data) {
4294
- return v.parse(PushContextRequestSchema, data);
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);
4026
+ export function parseBundleArtifactsResponse(data) {
4027
+ return v.parse(BundleArtifactsResponseSchema, data);
4313
4028
  }
4314
4029
  export function parseInboxCaptureRequest(data) {
4315
4030
  return v.parse(InboxCaptureRequestSchema, data);
@@ -4320,11 +4035,8 @@ export function parseInboxCaptureResponse(data) {
4320
4035
  export function parseInboxListResponse(data) {
4321
4036
  return v.parse(InboxListResponseSchema, data);
4322
4037
  }
4323
- export function parseContextItemVersionsResponse(data) {
4324
- return v.parse(ContextItemVersionsResponseSchema, data);
4325
- }
4326
- export function parseContextItemVersionResponse(data) {
4327
- return v.parse(ContextItemVersionResponseSchema, data);
4038
+ export function parseBundleArtifactVersionsResponse(data) {
4039
+ return v.parse(BundleArtifactVersionsResponseSchema, data);
4328
4040
  }
4329
4041
  export function parseInboxArchiveRequest(data) {
4330
4042
  return v.parse(InboxArchiveRequestSchema, data);