@cueloop/schema 0.1.0-alpha.61 → 0.1.0-alpha.63
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/package.json +1 -1
- package/src/feedback.test.ts +19 -0
- package/src/feedback.ts +3 -1
- package/src/types.test.ts +20 -1
- package/src/types.ts +12 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cueloop/schema",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.63",
|
|
4
4
|
"description": "The ReviewSession primitive: types, markdown block model, quote-primary anchors, feedback serialization",
|
|
5
5
|
"homepage": "https://github.com/mmurakaru/cueloop#readme",
|
|
6
6
|
"bugs": {
|
package/src/feedback.test.ts
CHANGED
|
@@ -65,6 +65,25 @@ describe("renderFeedback", () => {
|
|
|
65
65
|
expect(feedback).toContain("Apply this exact diff first");
|
|
66
66
|
});
|
|
67
67
|
|
|
68
|
+
test("a reply review with no artifact path references reply.md, never plan.md", () => {
|
|
69
|
+
// Act
|
|
70
|
+
const feedback = renderFeedback({
|
|
71
|
+
verdictKind: "request_changes",
|
|
72
|
+
summary: "",
|
|
73
|
+
artifactContent: "# Findings\n\nThe cache is fine.\n",
|
|
74
|
+
artifactType: "reply",
|
|
75
|
+
annotations: [
|
|
76
|
+
makeAnnotation({ anchor: { quote: "The cache is fine.", prefix: "", suffix: "" } }),
|
|
77
|
+
],
|
|
78
|
+
sessionId: "ses_reply",
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
// Assert
|
|
82
|
+
expect(feedback).toContain("Locate each one in reply.md");
|
|
83
|
+
expect(feedback).toContain("submit-revision ses_reply --content-file reply.md");
|
|
84
|
+
expect(feedback).not.toContain("plan.md");
|
|
85
|
+
});
|
|
86
|
+
|
|
68
87
|
test("a diff working copy is handed back as the curated patch, not a diff of diffs", () => {
|
|
69
88
|
// Arrange
|
|
70
89
|
const submittedPatch = `--- a/src/x.ts
|
package/src/feedback.ts
CHANGED
|
@@ -37,7 +37,9 @@ export interface FeedbackInput {
|
|
|
37
37
|
const quoteLines = (text: string) => "> " + text.replace(/\n/g, "\n> ");
|
|
38
38
|
|
|
39
39
|
export function renderFeedback(input: FeedbackInput): string {
|
|
40
|
-
|
|
40
|
+
// The document the agent revises: a reply's feedback references reply.md so
|
|
41
|
+
// the resubmit instruction never points a reply review at plan.md.
|
|
42
|
+
const path = input.artifactPath ?? (input.artifactType === "reply" ? "reply.md" : "plan.md");
|
|
41
43
|
// agent notes are the submitter's own context - never echoed back as
|
|
42
44
|
// feedback - and annotations a previous revision already addressed stay out
|
|
43
45
|
// of the next document, so the agent only ever sees the open items
|
package/src/types.test.ts
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
import { describe, expect, test } from "bun:test";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
ARTIFACT_TYPES,
|
|
4
|
+
isArtifactType,
|
|
5
|
+
isMarkdownArtifact,
|
|
6
|
+
newAnnotationId,
|
|
7
|
+
verdictAllows,
|
|
8
|
+
} from "./types";
|
|
9
|
+
|
|
10
|
+
describe("ARTIFACT_TYPES", () => {
|
|
11
|
+
test("names every primitive exactly once", () => {
|
|
12
|
+
expect([...ARTIFACT_TYPES].sort()).toEqual(["diff", "plan", "prototype", "reply"]);
|
|
13
|
+
expect(new Set(ARTIFACT_TYPES).size).toBe(ARTIFACT_TYPES.length);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
test("isArtifactType accepts every member and rejects strangers", () => {
|
|
17
|
+
for (const type of ARTIFACT_TYPES) expect(isArtifactType(type)).toBe(true);
|
|
18
|
+
expect(isArtifactType("blueprint")).toBe(false);
|
|
19
|
+
expect(isArtifactType("")).toBe(false);
|
|
20
|
+
});
|
|
21
|
+
});
|
|
3
22
|
|
|
4
23
|
describe("verdictAllows", () => {
|
|
5
24
|
test("only approve maps to allow", () => {
|
package/src/types.ts
CHANGED
|
@@ -17,8 +17,19 @@ export interface WorkspaceKey {
|
|
|
17
17
|
* markdown documents (see isMarkdownArtifact) - a plan is a proposal written
|
|
18
18
|
* forward, a reply is the agent's previous message pulled back for review.
|
|
19
19
|
* `diff` is a unified-diff patch; `prototype` is a rendered HTML page.
|
|
20
|
+
*
|
|
21
|
+
* One runtime union: every consumer that names the supported set - daemon
|
|
22
|
+
* wire validation, CLI flag parsing, adapter tool schemas - derives from this
|
|
23
|
+
* constant, so a new primitive extends them all without another hardcoded list.
|
|
20
24
|
*/
|
|
21
|
-
export
|
|
25
|
+
export const ARTIFACT_TYPES = ["plan", "diff", "prototype", "reply"] as const;
|
|
26
|
+
|
|
27
|
+
export type ArtifactType = (typeof ARTIFACT_TYPES)[number];
|
|
28
|
+
|
|
29
|
+
/** Trust-boundary guard: is this string one of the artifact primitives? */
|
|
30
|
+
export function isArtifactType(value: string): value is ArtifactType {
|
|
31
|
+
return (ARTIFACT_TYPES as readonly string[]).includes(value);
|
|
32
|
+
}
|
|
22
33
|
|
|
23
34
|
/**
|
|
24
35
|
* Markdown artifacts (plan, reply) are block-parsed and quote-anchored, so they
|