@mossbear/protocol 0.1.0-alpha.114 → 0.1.0-alpha.115

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.
Files changed (39) hide show
  1. package/dist/comments.d.ts +1405 -0
  2. package/dist/comments.d.ts.map +1 -0
  3. package/dist/comments.js +683 -0
  4. package/dist/comments.js.map +1 -0
  5. package/dist/comments.test.d.ts +2 -0
  6. package/dist/comments.test.d.ts.map +1 -0
  7. package/dist/comments.test.js +64 -0
  8. package/dist/comments.test.js.map +1 -0
  9. package/dist/pairing.d.ts +1 -1
  10. package/dist/schemas.d.ts +160 -4720
  11. package/dist/schemas.d.ts.map +1 -1
  12. package/dist/schemas.js +7 -1417
  13. package/dist/schemas.js.map +1 -1
  14. package/dist/search.d.ts +1222 -0
  15. package/dist/search.d.ts.map +1 -0
  16. package/dist/search.js +474 -0
  17. package/dist/search.js.map +1 -0
  18. package/dist/search.test.d.ts +2 -0
  19. package/dist/search.test.d.ts.map +1 -0
  20. package/dist/search.test.js +64 -0
  21. package/dist/search.test.js.map +1 -0
  22. package/dist/sessionContracts.test.d.ts +2 -0
  23. package/dist/sessionContracts.test.d.ts.map +1 -0
  24. package/dist/sessionContracts.test.js +75 -0
  25. package/dist/sessionContracts.test.js.map +1 -0
  26. package/dist/sessionDigest.d.ts +149 -0
  27. package/dist/sessionDigest.d.ts.map +1 -0
  28. package/dist/sessionDigest.js +57 -0
  29. package/dist/sessionDigest.js.map +1 -0
  30. package/dist/sessionGrade.d.ts +184 -0
  31. package/dist/sessionGrade.d.ts.map +1 -0
  32. package/dist/sessionGrade.js +130 -0
  33. package/dist/sessionGrade.js.map +1 -0
  34. package/dist/usageOnly.d.ts +5 -5
  35. package/dist/wirePrimitives.d.ts +86 -0
  36. package/dist/wirePrimitives.d.ts.map +1 -0
  37. package/dist/wirePrimitives.js +89 -0
  38. package/dist/wirePrimitives.js.map +1 -0
  39. package/package.json +1 -1
@@ -61,7 +61,7 @@ export declare const UsageOnlySessionSchema: v.SchemaWithPipe<readonly [v.Strict
61
61
  }[], "Duplicate usage occurrence">]>;
62
62
  }, undefined>, v.CheckAction<{
63
63
  sessionKey: string;
64
- harness: "claude_code" | "codex" | "opencode" | "antigravity";
64
+ harness: "claude_code" | "codex" | "antigravity" | "opencode";
65
65
  snapshotSequence: number;
66
66
  startedAt: number;
67
67
  endedAt?: number | undefined;
@@ -121,7 +121,7 @@ export declare const UsageOnlySyncRequestSchema: v.StrictObjectSchema<{
121
121
  }[], "Duplicate usage occurrence">]>;
122
122
  }, undefined>, v.CheckAction<{
123
123
  sessionKey: string;
124
- harness: "claude_code" | "codex" | "opencode" | "antigravity";
124
+ harness: "claude_code" | "codex" | "antigravity" | "opencode";
125
125
  snapshotSequence: number;
126
126
  startedAt: number;
127
127
  endedAt?: number | undefined;
@@ -135,7 +135,7 @@ export declare const UsageOnlySyncRequestSchema: v.StrictObjectSchema<{
135
135
  }[];
136
136
  }, "Session end precedes start">]>, undefined>, v.MinLengthAction<{
137
137
  sessionKey: string;
138
- harness: "claude_code" | "codex" | "opencode" | "antigravity";
138
+ harness: "claude_code" | "codex" | "antigravity" | "opencode";
139
139
  snapshotSequence: number;
140
140
  startedAt: number;
141
141
  endedAt?: number | undefined;
@@ -149,7 +149,7 @@ export declare const UsageOnlySyncRequestSchema: v.StrictObjectSchema<{
149
149
  }[];
150
150
  }[], 1, undefined>, v.MaxLengthAction<{
151
151
  sessionKey: string;
152
- harness: "claude_code" | "codex" | "opencode" | "antigravity";
152
+ harness: "claude_code" | "codex" | "antigravity" | "opencode";
153
153
  snapshotSequence: number;
154
154
  startedAt: number;
155
155
  endedAt?: number | undefined;
@@ -163,7 +163,7 @@ export declare const UsageOnlySyncRequestSchema: v.StrictObjectSchema<{
163
163
  }[];
164
164
  }[], 100, undefined>, v.CheckAction<{
165
165
  sessionKey: string;
166
- harness: "claude_code" | "codex" | "opencode" | "antigravity";
166
+ harness: "claude_code" | "codex" | "antigravity" | "opencode";
167
167
  snapshotSequence: number;
168
168
  startedAt: number;
169
169
  endedAt?: number | undefined;
@@ -0,0 +1,86 @@
1
+ /** Shared wire primitives. Domain modules must not depend on the aggregate schemas. */
2
+ import * as v from 'valibot';
3
+ export declare const NonEmptyStringSchema: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
4
+ /**
5
+ * The markers every untrusted block in a response is wrapped in, plus a
6
+ * statement of what they mean.
7
+ *
8
+ * Generated per response from the content itself, so no marker-like text
9
+ * inside a block can end it early — a property `deriveDelimiterToken` checks
10
+ * rather than assumes.
11
+ *
12
+ * Named for the guide-history response it was written for and shared by every
13
+ * payload that places somebody else's words in front of an agent: a grade's
14
+ * reasoning, and now an item's comments. One marker scheme, not one per payload —
15
+ * a second scheme is a second thing a reader has to be taught to respect.
16
+ */
17
+ export declare const GuideHistoryUntrustedSchema: v.ObjectSchema<{
18
+ readonly token: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
19
+ readonly startMarker: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
20
+ readonly endMarker: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
21
+ readonly note: v.StringSchema<undefined>;
22
+ }, undefined>;
23
+ export type GuideHistoryUntrusted = v.InferOutput<typeof GuideHistoryUntrustedSchema>;
24
+ /**
25
+ * Who wrote a comment. An agent writes under its person's account, so the
26
+ * author's name alone cannot tell a person's answer from an agent's message.
27
+ */
28
+ export declare const CommentAuthorKindSchema: v.PicklistSchema<["person", "agent", "mossbear"], undefined>;
29
+ export type CommentAuthorKind = v.InferOutput<typeof CommentAuthorKindSchema>;
30
+ /**
31
+ * The run-level verdict vocabulary — `aligned | misaligned | not_applicable`.
32
+ * `not_applicable` is a guide that was in the agent's context and that the
33
+ * session never engaged. It is not `unguided`, which is an action-level word,
34
+ * and neither is ever restated in terms of the other.
35
+ */
36
+ export declare const SESSION_GUIDE_VERDICTS: readonly ["aligned", "misaligned", "not_applicable"];
37
+ export declare const SessionGuideVerdictValueSchema: v.PicklistSchema<readonly ["aligned", "misaligned", "not_applicable"], undefined>;
38
+ export type SessionGuideVerdictValue = v.InferOutput<typeof SessionGuideVerdictValueSchema>;
39
+ /**
40
+ * Which agent harness produced a run — the CLI's harness registry, on the wire.
41
+ *
42
+ * **Deliberately not {@link PlatformKindSchema}, and not a widening of it.**
43
+ * That picklist answers a different question — which transcript format a
44
+ * *suggestion* was extracted from — over a set that includes harnesses
45
+ * `mossbear init` cannot wire (`cursor`, `copilot`) and excludes one it can
46
+ * (`antigravity`). Two questions, two sets; collapsing them would need both a
47
+ * new member and an overloaded meaning.
48
+ *
49
+ * Declared here rather than in the CLI so there is exactly one list: the CLI's
50
+ * `HarnessId` is `v.InferOutput` of this, imported as a type, so a manifest for
51
+ * a harness this schema does not name fails typecheck instead of failing at the
52
+ * sync boundary. The import is type-only on purpose — `mossbear-hook` runs once
53
+ * per agent tool call, and nothing here may enter its runtime import graph.
54
+ *
55
+ * Rides `metadata.harness` on each action (see {@link ActionMetadataSchema});
56
+ * the server reduces a session's actions to one value and writes `runs.harness`.
57
+ */
58
+ export declare const HarnessIdSchema: v.PicklistSchema<["claude_code", "codex", "antigravity", "opencode"], undefined>;
59
+ export type HarnessId = v.InferOutput<typeof HarnessIdSchema>;
60
+ /** Longest accepted repository name. An `owner/repo` path is far shorter; this bounds a folder name. */
61
+ export declare const MAX_REPOSITORY_NAME_LENGTH = 200;
62
+ /**
63
+ * The name of the repository a session ran in, as a person would recognise it:
64
+ * the `owner/repo` path of the checkout's git remote, or the checkout's folder
65
+ * name when it has no remote the CLI can read a path from.
66
+ *
67
+ * A display name, not an identity. Two forks share a name, and a folder name
68
+ * says nothing beyond itself; `projectId` and `repoId` stay the keys a reader
69
+ * joins on. The CLI keeps only the path of a remote: never its scheme,
70
+ * credentials, host, port or query, so a URL carrying a token does not leave
71
+ * the machine.
72
+ *
73
+ * Rides `metadata.repository` on each action (see {@link ActionMetadataSchema}).
74
+ * The server reduces a session's stamps to one value; absent is "unnamed",
75
+ * which is every session a CLI predating the field recorded.
76
+ */
77
+ export declare const RepositoryNameSchema: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 200, undefined>, v.CheckAction<string, "repository must be trimmed and hold no control characters">]>;
78
+ /**
79
+ * A repo's declared portable identity. See `RulesImportRequestSchema.projectId`
80
+ * for why this is looser than {@link RepoIdSchema} — a declared id is
81
+ * human-authored and predates any prefix rule.
82
+ */
83
+ export declare const ProjectIdSchema: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 128, undefined>, v.RegexAction<string, "projectId must contain only letters, digits, underscore, dot or hyphen">]>;
84
+ /** Most artifacts one batch feedback read may name. */
85
+ export declare const MAX_ARTIFACT_FEEDBACK_BATCH = 25;
86
+ //# sourceMappingURL=wirePrimitives.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wirePrimitives.d.ts","sourceRoot":"","sources":["../src/wirePrimitives.ts"],"names":[],"mappings":"AAAA,uFAAuF;AAEvF,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B,eAAO,MAAM,oBAAoB,iGAAqC,CAAA;AAEtE;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,2BAA2B;;;;;aAKtC,CAAA;AAEF,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,2BAA2B,CAAC,CAAA;AAErF;;;GAGG;AACH,eAAO,MAAM,uBAAuB,8DAA8C,CAAA;AAElF,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,uBAAuB,CAAC,CAAA;AAE7E;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,sDAAuD,CAAA;AAE1F,eAAO,MAAM,8BAA8B,mFAAqC,CAAA;AAEhF,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,WAAW,CAClD,OAAO,8BAA8B,CACtC,CAAA;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,eAAe,kFAK1B,CAAA;AAEF,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,eAAe,CAAC,CAAA;AAE7D,wGAAwG;AACxG,eAAO,MAAM,0BAA0B,MAAM,CAAA;AAE7C;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,oBAAoB,gOAQhC,CAAA;AAKD;;;;GAIG;AACH,eAAO,MAAM,eAAe,2PAS3B,CAAA;AAED,uDAAuD;AACvD,eAAO,MAAM,2BAA2B,KAAK,CAAA"}
@@ -0,0 +1,89 @@
1
+ /** Shared wire primitives. Domain modules must not depend on the aggregate schemas. */
2
+ import * as v from 'valibot';
3
+ export const NonEmptyStringSchema = v.pipe(v.string(), v.minLength(1));
4
+ /**
5
+ * The markers every untrusted block in a response is wrapped in, plus a
6
+ * statement of what they mean.
7
+ *
8
+ * Generated per response from the content itself, so no marker-like text
9
+ * inside a block can end it early — a property `deriveDelimiterToken` checks
10
+ * rather than assumes.
11
+ *
12
+ * Named for the guide-history response it was written for and shared by every
13
+ * payload that places somebody else's words in front of an agent: a grade's
14
+ * reasoning, and now an item's comments. One marker scheme, not one per payload —
15
+ * a second scheme is a second thing a reader has to be taught to respect.
16
+ */
17
+ export const GuideHistoryUntrustedSchema = v.object({
18
+ token: NonEmptyStringSchema,
19
+ startMarker: NonEmptyStringSchema,
20
+ endMarker: NonEmptyStringSchema,
21
+ note: v.string(),
22
+ });
23
+ /**
24
+ * Who wrote a comment. An agent writes under its person's account, so the
25
+ * author's name alone cannot tell a person's answer from an agent's message.
26
+ */
27
+ export const CommentAuthorKindSchema = v.picklist(['person', 'agent', 'mossbear']);
28
+ /**
29
+ * The run-level verdict vocabulary — `aligned | misaligned | not_applicable`.
30
+ * `not_applicable` is a guide that was in the agent's context and that the
31
+ * session never engaged. It is not `unguided`, which is an action-level word,
32
+ * and neither is ever restated in terms of the other.
33
+ */
34
+ export const SESSION_GUIDE_VERDICTS = ['aligned', 'misaligned', 'not_applicable'];
35
+ export const SessionGuideVerdictValueSchema = v.picklist(SESSION_GUIDE_VERDICTS);
36
+ /**
37
+ * Which agent harness produced a run — the CLI's harness registry, on the wire.
38
+ *
39
+ * **Deliberately not {@link PlatformKindSchema}, and not a widening of it.**
40
+ * That picklist answers a different question — which transcript format a
41
+ * *suggestion* was extracted from — over a set that includes harnesses
42
+ * `mossbear init` cannot wire (`cursor`, `copilot`) and excludes one it can
43
+ * (`antigravity`). Two questions, two sets; collapsing them would need both a
44
+ * new member and an overloaded meaning.
45
+ *
46
+ * Declared here rather than in the CLI so there is exactly one list: the CLI's
47
+ * `HarnessId` is `v.InferOutput` of this, imported as a type, so a manifest for
48
+ * a harness this schema does not name fails typecheck instead of failing at the
49
+ * sync boundary. The import is type-only on purpose — `mossbear-hook` runs once
50
+ * per agent tool call, and nothing here may enter its runtime import graph.
51
+ *
52
+ * Rides `metadata.harness` on each action (see {@link ActionMetadataSchema});
53
+ * the server reduces a session's actions to one value and writes `runs.harness`.
54
+ */
55
+ export const HarnessIdSchema = v.picklist([
56
+ 'claude_code',
57
+ 'codex',
58
+ 'antigravity',
59
+ 'opencode',
60
+ ]);
61
+ /** Longest accepted repository name. An `owner/repo` path is far shorter; this bounds a folder name. */
62
+ export const MAX_REPOSITORY_NAME_LENGTH = 200;
63
+ /**
64
+ * The name of the repository a session ran in, as a person would recognise it:
65
+ * the `owner/repo` path of the checkout's git remote, or the checkout's folder
66
+ * name when it has no remote the CLI can read a path from.
67
+ *
68
+ * A display name, not an identity. Two forks share a name, and a folder name
69
+ * says nothing beyond itself; `projectId` and `repoId` stay the keys a reader
70
+ * joins on. The CLI keeps only the path of a remote: never its scheme,
71
+ * credentials, host, port or query, so a URL carrying a token does not leave
72
+ * the machine.
73
+ *
74
+ * Rides `metadata.repository` on each action (see {@link ActionMetadataSchema}).
75
+ * The server reduces a session's stamps to one value; absent is "unnamed",
76
+ * which is every session a CLI predating the field recorded.
77
+ */
78
+ export const RepositoryNameSchema = v.pipe(v.string(), v.minLength(1), v.maxLength(MAX_REPOSITORY_NAME_LENGTH), v.check((value) => value.trim() === value && !/\p{Cc}/u.test(value), 'repository must be trimmed and hold no control characters'));
79
+ /** Longest accepted `projectId`. Generated ids are far shorter; this bounds a hand-declared one. */
80
+ const MAX_PROJECT_ID_LENGTH = 128;
81
+ /**
82
+ * A repo's declared portable identity. See `RulesImportRequestSchema.projectId`
83
+ * for why this is looser than {@link RepoIdSchema} — a declared id is
84
+ * human-authored and predates any prefix rule.
85
+ */
86
+ export const ProjectIdSchema = v.pipe(v.string(), v.trim(), v.minLength(1), v.maxLength(MAX_PROJECT_ID_LENGTH), v.regex(/^[A-Za-z0-9_.-]+$/, 'projectId must contain only letters, digits, underscore, dot or hyphen'));
87
+ /** Most artifacts one batch feedback read may name. */
88
+ export const MAX_ARTIFACT_FEEDBACK_BATCH = 25;
89
+ //# sourceMappingURL=wirePrimitives.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wirePrimitives.js","sourceRoot":"","sources":["../src/wirePrimitives.ts"],"names":[],"mappings":"AAAA,uFAAuF;AAEvF,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAA;AAEtE;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC,MAAM,CAAC;IAClD,KAAK,EAAE,oBAAoB;IAC3B,WAAW,EAAE,oBAAoB;IACjC,SAAS,EAAE,oBAAoB;IAC/B,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;CACjB,CAAC,CAAA;AAIF;;;GAGG;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,CAAA;AAED,uDAAuD;AACvD,MAAM,CAAC,MAAM,2BAA2B,GAAG,EAAE,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mossbear/protocol",
3
- "version": "0.1.0-alpha.114",
3
+ "version": "0.1.0-alpha.115",
4
4
  "private": false,
5
5
  "description": "Shared types and wire schemas for Mossbear — the contract between the mossbear CLI and the dashboard.",
6
6
  "license": "MIT",