@schnick371/devsteps-shared 0.8.5 → 1.0.0-next.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.
Files changed (148) hide show
  1. package/README.md +8 -3
  2. package/dist/constants/index.d.ts +26 -0
  3. package/dist/constants/index.d.ts.map +1 -1
  4. package/dist/constants/index.js +26 -0
  5. package/dist/constants/index.js.map +1 -1
  6. package/dist/core/add.d.ts +7 -0
  7. package/dist/core/add.d.ts.map +1 -1
  8. package/dist/core/add.js +9 -2
  9. package/dist/core/add.js.map +1 -1
  10. package/dist/core/archive.d.ts +7 -0
  11. package/dist/core/archive.d.ts.map +1 -1
  12. package/dist/core/archive.js +30 -20
  13. package/dist/core/archive.js.map +1 -1
  14. package/dist/core/auto-migrate-detect.d.ts +61 -0
  15. package/dist/core/auto-migrate-detect.d.ts.map +1 -0
  16. package/dist/core/auto-migrate-detect.js +68 -0
  17. package/dist/core/auto-migrate-detect.js.map +1 -0
  18. package/dist/core/auto-migrate-impl.d.ts +32 -0
  19. package/dist/core/auto-migrate-impl.d.ts.map +1 -0
  20. package/dist/core/auto-migrate-impl.js +120 -0
  21. package/dist/core/auto-migrate-impl.js.map +1 -0
  22. package/dist/core/auto-migrate.d.ts +16 -131
  23. package/dist/core/auto-migrate.d.ts.map +1 -1
  24. package/dist/core/auto-migrate.js +25 -318
  25. package/dist/core/auto-migrate.js.map +1 -1
  26. package/dist/core/auto-migrate.test.js +11 -7
  27. package/dist/core/auto-migrate.test.js.map +1 -1
  28. package/dist/core/bulk-update.d.ts +7 -0
  29. package/dist/core/bulk-update.d.ts.map +1 -1
  30. package/dist/core/bulk-update.js +8 -1
  31. package/dist/core/bulk-update.js.map +1 -1
  32. package/dist/core/config.d.ts +7 -0
  33. package/dist/core/config.d.ts.map +1 -1
  34. package/dist/core/config.js +7 -0
  35. package/dist/core/config.js.map +1 -1
  36. package/dist/core/context.d.ts +9 -0
  37. package/dist/core/context.d.ts.map +1 -1
  38. package/dist/core/context.js +9 -0
  39. package/dist/core/context.js.map +1 -1
  40. package/dist/core/get.d.ts +7 -0
  41. package/dist/core/get.d.ts.map +1 -1
  42. package/dist/core/get.js +8 -1
  43. package/dist/core/get.js.map +1 -1
  44. package/dist/core/index-rebuild.d.ts +3 -0
  45. package/dist/core/index-rebuild.d.ts.map +1 -1
  46. package/dist/core/index-rebuild.js +11 -8
  47. package/dist/core/index-rebuild.js.map +1 -1
  48. package/dist/core/index-rebuild.test.js +6 -15
  49. package/dist/core/index-rebuild.test.js.map +1 -1
  50. package/dist/core/index-refs-core.d.ts +114 -0
  51. package/dist/core/index-refs-core.d.ts.map +1 -0
  52. package/dist/core/index-refs-core.js +306 -0
  53. package/dist/core/index-refs-core.js.map +1 -0
  54. package/dist/core/index-refs.d.ts +9 -124
  55. package/dist/core/index-refs.d.ts.map +1 -1
  56. package/dist/core/index-refs.js +19 -345
  57. package/dist/core/index-refs.js.map +1 -1
  58. package/dist/core/index-refs.test.js +3 -3
  59. package/dist/core/index-refs.test.js.map +1 -1
  60. package/dist/core/index.d.ts +19 -10
  61. package/dist/core/index.d.ts.map +1 -1
  62. package/dist/core/index.js +19 -10
  63. package/dist/core/index.js.map +1 -1
  64. package/dist/core/link.d.ts +33 -0
  65. package/dist/core/link.d.ts.map +1 -0
  66. package/dist/core/link.js +102 -0
  67. package/dist/core/link.js.map +1 -0
  68. package/dist/core/list.d.ts +8 -0
  69. package/dist/core/list.d.ts.map +1 -1
  70. package/dist/core/list.js +82 -5
  71. package/dist/core/list.js.map +1 -1
  72. package/dist/core/unlink.d.ts +26 -0
  73. package/dist/core/unlink.d.ts.map +1 -0
  74. package/dist/core/unlink.js +78 -0
  75. package/dist/core/unlink.js.map +1 -0
  76. package/dist/core/update.d.ts +7 -0
  77. package/dist/core/update.d.ts.map +1 -1
  78. package/dist/core/update.js +16 -8
  79. package/dist/core/update.js.map +1 -1
  80. package/dist/core/validation.d.ts +26 -1
  81. package/dist/core/validation.d.ts.map +1 -1
  82. package/dist/core/validation.js +65 -4
  83. package/dist/core/validation.js.map +1 -1
  84. package/dist/index.d.ts +11 -4
  85. package/dist/index.d.ts.map +1 -1
  86. package/dist/index.js +11 -4
  87. package/dist/index.js.map +1 -1
  88. package/dist/schemas/analysis.d.ts +206 -0
  89. package/dist/schemas/analysis.d.ts.map +1 -0
  90. package/dist/schemas/analysis.js +138 -0
  91. package/dist/schemas/analysis.js.map +1 -0
  92. package/dist/schemas/cbp-loops.d.ts +154 -0
  93. package/dist/schemas/cbp-loops.d.ts.map +1 -0
  94. package/dist/schemas/cbp-loops.js +160 -0
  95. package/dist/schemas/cbp-loops.js.map +1 -0
  96. package/dist/schemas/cbp-loops.test.d.ts +10 -0
  97. package/dist/schemas/cbp-loops.test.d.ts.map +1 -0
  98. package/dist/schemas/cbp-loops.test.js +268 -0
  99. package/dist/schemas/cbp-loops.test.js.map +1 -0
  100. package/dist/schemas/cbp-mandate.d.ts +107 -0
  101. package/dist/schemas/cbp-mandate.d.ts.map +1 -0
  102. package/dist/schemas/cbp-mandate.js +107 -0
  103. package/dist/schemas/cbp-mandate.js.map +1 -0
  104. package/dist/schemas/cbp-mandate.test.d.ts +10 -0
  105. package/dist/schemas/cbp-mandate.test.d.ts.map +1 -0
  106. package/dist/schemas/cbp-mandate.test.js +188 -0
  107. package/dist/schemas/cbp-mandate.test.js.map +1 -0
  108. package/dist/schemas/index-refs.schema.d.ts +4 -1
  109. package/dist/schemas/index-refs.schema.d.ts.map +1 -1
  110. package/dist/schemas/index-refs.schema.js +24 -3
  111. package/dist/schemas/index-refs.schema.js.map +1 -1
  112. package/dist/schemas/index.d.ts +17 -7
  113. package/dist/schemas/index.d.ts.map +1 -1
  114. package/dist/schemas/index.js +14 -1
  115. package/dist/schemas/index.js.map +1 -1
  116. package/dist/schemas/project.d.ts +7 -0
  117. package/dist/schemas/project.d.ts.map +1 -1
  118. package/dist/schemas/project.js +7 -0
  119. package/dist/schemas/project.js.map +1 -1
  120. package/dist/schemas/relationships.d.ts +3 -0
  121. package/dist/schemas/relationships.d.ts.map +1 -1
  122. package/dist/schemas/relationships.js +3 -0
  123. package/dist/schemas/relationships.js.map +1 -1
  124. package/dist/types/commands.d.ts +7 -0
  125. package/dist/types/commands.d.ts.map +1 -1
  126. package/dist/types/commands.js +7 -0
  127. package/dist/types/commands.js.map +1 -1
  128. package/dist/types/index-refs.types.d.ts +3 -0
  129. package/dist/types/index-refs.types.d.ts.map +1 -1
  130. package/dist/types/index-refs.types.js +3 -0
  131. package/dist/types/index-refs.types.js.map +1 -1
  132. package/dist/types/index.d.ts +9 -1
  133. package/dist/types/index.d.ts.map +1 -1
  134. package/dist/types/index.js +7 -0
  135. package/dist/types/index.js.map +1 -1
  136. package/dist/utils/cache.d.ts +7 -0
  137. package/dist/utils/cache.d.ts.map +1 -1
  138. package/dist/utils/cache.js +7 -0
  139. package/dist/utils/cache.js.map +1 -1
  140. package/dist/utils/index.d.ts +9 -1
  141. package/dist/utils/index.d.ts.map +1 -1
  142. package/dist/utils/index.js +26 -3
  143. package/dist/utils/index.js.map +1 -1
  144. package/dist/utils/init-helpers.d.ts +30 -0
  145. package/dist/utils/init-helpers.d.ts.map +1 -0
  146. package/dist/utils/init-helpers.js +134 -0
  147. package/dist/utils/init-helpers.js.map +1 -0
  148. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"analysis.js","sourceRoot":"","sources":["../../src/schemas/analysis.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;GAQG;AAEH,gFAAgF;AAEhF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,IAAI,CAAC;IACnC,QAAQ;IACR,aAAa;IACb,SAAS;IACT,WAAW;IACX,aAAa;IACb,UAAU,EAAE,gCAAgC;IAC5C,KAAK,EAAE,gCAAgC;IACvC,MAAM,EAAE,4BAA4B;CACrC,CAAC,CAAC;AAGH,gFAAgF;A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B,aAAa,EAAE,CAAC,CAAC,KAAK,CAAC,wBAAwB,CAAC;IAChD,kBAAkB,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;IACnD,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC9B,cAAc,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC;CAChD,CAAC,CAAC"}
@@ -0,0 +1,154 @@
1
+ /**
2
+ * Copyright © 2025 Thomas Hertel (the@devsteps.dev)
3
+ * Licensed under the Apache License, Version 2.0
4
+ *
5
+ * Context Budget Protocol (CBP) — Loop Control Schemas
6
+ * Zod schemas for rejection feedback, iteration signals, and escalation.
7
+ *
8
+ * @see EPIC-028 CBP Tier-2 Mandate Tools
9
+ */
10
+ import { z } from 'zod';
11
+ /**
12
+ * Context Budget Protocol (CBP) — Loop Control Schemas
13
+ *
14
+ * These schemas enable bounded loops across all tiers without infinite recursion.
15
+ * Every loop MUST have a hard termination bound enforced in the handler.
16
+ *
17
+ * Loop types:
18
+ * - TDD inner loop: test → impl → test (max 3 iterations, Tier-3)
19
+ * - Review-Fix loop: review → rejection → impl → review (max 3 iterations, Tier-2↔Tier-3)
20
+ * - Clarification loop: research → ambiguity → re-research (max 2 iterations, Tier-2)
21
+ * - Adaptive replanning: every 5 items or on risk drift (max once per 5 items, Tier-1)
22
+ *
23
+ * @see EPIC-028 N-Tier Agent Hierarchy
24
+ * @see STORY-108 MandateResult CBP Extension
25
+ * @see SPIKE-015 Tier-4 + Loop Pattern Formalization
26
+ */
27
+ export declare const LoopType: z.ZodEnum<{
28
+ tdd: "tdd";
29
+ "review-fix": "review-fix";
30
+ clarification: "clarification";
31
+ replanning: "replanning";
32
+ }>;
33
+ export type LoopType = z.infer<typeof LoopType>;
34
+ export declare const LoopStatus: z.ZodEnum<{
35
+ continuing: "continuing";
36
+ resolved: "resolved";
37
+ exhausted: "exhausted";
38
+ escalated: "escalated";
39
+ }>;
40
+ export type LoopStatus = z.infer<typeof LoopStatus>;
41
+ /**
42
+ * Written by deep-analyst-quality (Tier-2) when a Tier-3 implementation
43
+ * fails the quality gate. Tier-1 reads this and re-dispatches the Tier-3
44
+ * impl agent with the rejection context attached.
45
+ *
46
+ * Storage: .devsteps/cbp/[sprint_id]/[item_id].rejection-[iteration].json
47
+ * Iteration files are append-only (never overwrite) for audit trail.
48
+ */
49
+ export declare const RejectionIssueSchema: z.ZodObject<{
50
+ file: z.ZodString;
51
+ line: z.ZodOptional<z.ZodNumber>;
52
+ issue: z.ZodString;
53
+ suggestion: z.ZodString;
54
+ }, z.core.$strip>;
55
+ export type RejectionIssue = z.infer<typeof RejectionIssueSchema>;
56
+ export declare const RejectionType: z.ZodEnum<{
57
+ "quality-insufficient": "quality-insufficient";
58
+ "wrong-approach": "wrong-approach";
59
+ "missing-requirement": "missing-requirement";
60
+ "test-failure": "test-failure";
61
+ "type-error": "type-error";
62
+ }>;
63
+ export type RejectionType = z.infer<typeof RejectionType>;
64
+ export declare const RejectionFeedbackSchema: z.ZodObject<{
65
+ target_subagent: z.ZodString;
66
+ iteration: z.ZodNumber;
67
+ rejection_type: z.ZodEnum<{
68
+ "quality-insufficient": "quality-insufficient";
69
+ "wrong-approach": "wrong-approach";
70
+ "missing-requirement": "missing-requirement";
71
+ "test-failure": "test-failure";
72
+ "type-error": "type-error";
73
+ }>;
74
+ violated_criteria: z.ZodArray<z.ZodString>;
75
+ specific_issues: z.ZodArray<z.ZodObject<{
76
+ file: z.ZodString;
77
+ line: z.ZodOptional<z.ZodNumber>;
78
+ issue: z.ZodString;
79
+ suggestion: z.ZodString;
80
+ }, z.core.$strip>>;
81
+ max_iterations_remaining: z.ZodNumber;
82
+ escalate_if_remaining: z.ZodDefault<z.ZodNumber>;
83
+ sprint_id: z.ZodString;
84
+ item_id: z.ZodString;
85
+ created_at: z.ZodString;
86
+ schema_version: z.ZodDefault<z.ZodLiteral<"1.0">>;
87
+ }, z.core.$strip>;
88
+ export type RejectionFeedback = z.infer<typeof RejectionFeedbackSchema>;
89
+ /**
90
+ * Written by any agent in a loop to signal the current loop state to Tier-1.
91
+ * Tier-1 checks this file before each iteration to detect stuck/resolved loops.
92
+ *
93
+ * Storage: .devsteps/cbp/[sprint_id]/[item_id].loop-signal.json
94
+ * OVERWRITES previous signal — represents CURRENT state (not history).
95
+ * Use iteration field to reconstruct history if needed.
96
+ */
97
+ export declare const IterationSignalSchema: z.ZodObject<{
98
+ loop_type: z.ZodEnum<{
99
+ tdd: "tdd";
100
+ "review-fix": "review-fix";
101
+ clarification: "clarification";
102
+ replanning: "replanning";
103
+ }>;
104
+ status: z.ZodEnum<{
105
+ continuing: "continuing";
106
+ resolved: "resolved";
107
+ exhausted: "exhausted";
108
+ escalated: "escalated";
109
+ }>;
110
+ iteration: z.ZodNumber;
111
+ max_iterations: z.ZodNumber;
112
+ sprint_id: z.ZodString;
113
+ item_id: z.ZodString;
114
+ notes: z.ZodOptional<z.ZodString>;
115
+ signaled_at: z.ZodString;
116
+ schema_version: z.ZodDefault<z.ZodLiteral<"1.0">>;
117
+ }, z.core.$strip>;
118
+ export type IterationSignal = z.infer<typeof IterationSignalSchema>;
119
+ /**
120
+ * Written by any agent (any tier) when it cannot proceed without external input.
121
+ * Tier-1 checks for pending escalations before each phase.
122
+ * Escalations PAUSE execution — never silently continue.
123
+ *
124
+ * Storage: .devsteps/cbp/[sprint_id]/escalations/[escalation_id].json
125
+ * Files are NOT overwritten — each escalation gets a unique ID.
126
+ */
127
+ export declare const EscalationType: z.ZodEnum<{
128
+ "human-required": "human-required";
129
+ "contradicting-requirements": "contradicting-requirements";
130
+ "budget-exhausted": "budget-exhausted";
131
+ "architectural-decision": "architectural-decision";
132
+ "scope-ambiguous": "scope-ambiguous";
133
+ }>;
134
+ export type EscalationType = z.infer<typeof EscalationType>;
135
+ export declare const EscalationSignalSchema: z.ZodObject<{
136
+ escalation_id: z.ZodString;
137
+ source_agent: z.ZodString;
138
+ escalation_type: z.ZodEnum<{
139
+ "human-required": "human-required";
140
+ "contradicting-requirements": "contradicting-requirements";
141
+ "budget-exhausted": "budget-exhausted";
142
+ "architectural-decision": "architectural-decision";
143
+ "scope-ambiguous": "scope-ambiguous";
144
+ }>;
145
+ context: z.ZodString;
146
+ decision_needed: z.ZodString;
147
+ blocking_items: z.ZodArray<z.ZodString>;
148
+ suggested_resolution: z.ZodOptional<z.ZodString>;
149
+ sprint_id: z.ZodString;
150
+ escalated_at: z.ZodString;
151
+ schema_version: z.ZodDefault<z.ZodLiteral<"1.0">>;
152
+ }, z.core.$strip>;
153
+ export type EscalationSignal = z.infer<typeof EscalationSignalSchema>;
154
+ //# sourceMappingURL=cbp-loops.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cbp-loops.d.ts","sourceRoot":"","sources":["../../src/schemas/cbp-loops.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;;;;;;;;GAeG;AAIH,eAAO,MAAM,QAAQ;;;;;EAKnB,CAAC;AACH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAC;AAEhD,eAAO,MAAM,UAAU;;;;;EAKrB,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAIpD;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB;;;;;iBAS/B,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,eAAO,MAAM,aAAa;;;;;;EAMxB,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAE1D,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;iBAuBlC,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAIxE;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;iBAmBhC,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAIpE;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc;;;;;;EAMzB,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAE5D,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;iBAwBjC,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
@@ -0,0 +1,160 @@
1
+ /**
2
+ * Copyright © 2025 Thomas Hertel (the@devsteps.dev)
3
+ * Licensed under the Apache License, Version 2.0
4
+ *
5
+ * Context Budget Protocol (CBP) — Loop Control Schemas
6
+ * Zod schemas for rejection feedback, iteration signals, and escalation.
7
+ *
8
+ * @see EPIC-028 CBP Tier-2 Mandate Tools
9
+ */
10
+ import { z } from 'zod';
11
+ /**
12
+ * Context Budget Protocol (CBP) — Loop Control Schemas
13
+ *
14
+ * These schemas enable bounded loops across all tiers without infinite recursion.
15
+ * Every loop MUST have a hard termination bound enforced in the handler.
16
+ *
17
+ * Loop types:
18
+ * - TDD inner loop: test → impl → test (max 3 iterations, Tier-3)
19
+ * - Review-Fix loop: review → rejection → impl → review (max 3 iterations, Tier-2↔Tier-3)
20
+ * - Clarification loop: research → ambiguity → re-research (max 2 iterations, Tier-2)
21
+ * - Adaptive replanning: every 5 items or on risk drift (max once per 5 items, Tier-1)
22
+ *
23
+ * @see EPIC-028 N-Tier Agent Hierarchy
24
+ * @see STORY-108 MandateResult CBP Extension
25
+ * @see SPIKE-015 Tier-4 + Loop Pattern Formalization
26
+ */
27
+ // ─── Loop Types ───────────────────────────────────────────────────────────────
28
+ export const LoopType = z.enum([
29
+ 'tdd', // Red-Green-Refactor inner loop
30
+ 'review-fix', // Reviewer rejects → impl agent fixes → reviewer re-checks
31
+ 'clarification', // Analyst encounters ambiguity → requests clarification
32
+ 'replanning', // Sprint executor replans after accumulated drift
33
+ ]);
34
+ export const LoopStatus = z.enum([
35
+ 'continuing', // Loop will execute another iteration
36
+ 'resolved', // Loop terminated with success
37
+ 'exhausted', // Max iterations reached without resolution
38
+ 'escalated', // Loop escalated to human or higher tier
39
+ ]);
40
+ // ─── RejectionFeedbackSchema ──────────────────────────────────────────────────
41
+ /**
42
+ * Written by deep-analyst-quality (Tier-2) when a Tier-3 implementation
43
+ * fails the quality gate. Tier-1 reads this and re-dispatches the Tier-3
44
+ * impl agent with the rejection context attached.
45
+ *
46
+ * Storage: .devsteps/cbp/[sprint_id]/[item_id].rejection-[iteration].json
47
+ * Iteration files are append-only (never overwrite) for audit trail.
48
+ */
49
+ export const RejectionIssueSchema = z.object({
50
+ /** Relative file path where the issue was found */
51
+ file: z.string(),
52
+ /** Line number (optional — for precise targeting) */
53
+ line: z.number().int().positive().optional(),
54
+ /** Human-readable description of the issue */
55
+ issue: z.string().max(300),
56
+ /** Concrete suggestion for the impl agent to fix */
57
+ suggestion: z.string().max(300),
58
+ });
59
+ export const RejectionType = z.enum([
60
+ 'quality-insufficient', // Score too low, general quality issues
61
+ 'wrong-approach', // Architectural or pattern decision is wrong
62
+ 'missing-requirement', // One or more acceptance criteria not met
63
+ 'test-failure', // Tests fail (TypeScript errors, assertion failures)
64
+ 'type-error', // TypeScript strict mode violations
65
+ ]);
66
+ export const RejectionFeedbackSchema = z.object({
67
+ /** Which Tier-3 agent produced the rejected output */
68
+ target_subagent: z.string(),
69
+ /** Current loop iteration (1-based) */
70
+ iteration: z.number().int().min(1).max(5),
71
+ /** Classification of the rejection reason */
72
+ rejection_type: RejectionType,
73
+ /** Which acceptance criteria from the story/task were violated */
74
+ violated_criteria: z.array(z.string()).min(1),
75
+ /** Specific, actionable issues for the impl agent */
76
+ specific_issues: z.array(RejectionIssueSchema).min(1).max(20),
77
+ /** How many more iterations remain (countdown) */
78
+ max_iterations_remaining: z.number().int().min(0).max(4),
79
+ /** If remaining iterations ≤ this value, escalate instead of retrying */
80
+ escalate_if_remaining: z.number().int().min(0).max(3).default(0),
81
+ /** Sprint ID for file path construction */
82
+ sprint_id: z.string(),
83
+ /** Which DevSteps item this rejection applies to */
84
+ item_id: z.string(),
85
+ /** ISO 8601 timestamp */
86
+ created_at: z.string().datetime(),
87
+ /** Schema version */
88
+ schema_version: z.literal('1.0').default('1.0'),
89
+ });
90
+ // ─── IterationSignalSchema ────────────────────────────────────────────────────
91
+ /**
92
+ * Written by any agent in a loop to signal the current loop state to Tier-1.
93
+ * Tier-1 checks this file before each iteration to detect stuck/resolved loops.
94
+ *
95
+ * Storage: .devsteps/cbp/[sprint_id]/[item_id].loop-signal.json
96
+ * OVERWRITES previous signal — represents CURRENT state (not history).
97
+ * Use iteration field to reconstruct history if needed.
98
+ */
99
+ export const IterationSignalSchema = z.object({
100
+ /** Which loop type is signaling */
101
+ loop_type: LoopType,
102
+ /** Current loop state */
103
+ status: LoopStatus,
104
+ /** Current iteration number (1-based) */
105
+ iteration: z.number().int().min(1),
106
+ /** Hard maximum — never execute iteration > max_iterations */
107
+ max_iterations: z.number().int().min(1).max(5),
108
+ /** Sprint ID for file path construction */
109
+ sprint_id: z.string(),
110
+ /** Which DevSteps item this loop is for */
111
+ item_id: z.string(),
112
+ /** Optional context for debugging or escalation messages */
113
+ notes: z.string().max(500).optional(),
114
+ /** ISO 8601 timestamp of this signal */
115
+ signaled_at: z.string().datetime(),
116
+ /** Schema version */
117
+ schema_version: z.literal('1.0').default('1.0'),
118
+ });
119
+ // ─── EscalationSignalSchema ───────────────────────────────────────────────────
120
+ /**
121
+ * Written by any agent (any tier) when it cannot proceed without external input.
122
+ * Tier-1 checks for pending escalations before each phase.
123
+ * Escalations PAUSE execution — never silently continue.
124
+ *
125
+ * Storage: .devsteps/cbp/[sprint_id]/escalations/[escalation_id].json
126
+ * Files are NOT overwritten — each escalation gets a unique ID.
127
+ */
128
+ export const EscalationType = z.enum([
129
+ 'human-required', // Cannot continue without user decision
130
+ 'contradicting-requirements', // Two requirements conflict (needs user priority)
131
+ 'budget-exhausted', // Token or time budget depleted
132
+ 'architectural-decision', // Requires architecture choice beyond agent scope
133
+ 'scope-ambiguous', // Acceptance criteria are genuinely unclear
134
+ ]);
135
+ export const EscalationSignalSchema = z.object({
136
+ /** Unique ID for this escalation — used as filename */
137
+ escalation_id: z.string().uuid(),
138
+ /** Which agent triggered the escalation */
139
+ source_agent: z.string(),
140
+ /** Classification of what decision is needed */
141
+ escalation_type: EscalationType,
142
+ /**
143
+ * What led to this escalation — max ~400 tokens.
144
+ * Must be self-contained (no file path references — Tier-1 reads this inline).
145
+ */
146
+ context: z.string().max(3000),
147
+ /** Specific yes/no or choice question for the human or Tier-1 */
148
+ decision_needed: z.string().max(500),
149
+ /** DevSteps item IDs blocked by this escalation */
150
+ blocking_items: z.array(z.string()).min(1),
151
+ /** What the agent suggests (included but not authoritative) */
152
+ suggested_resolution: z.string().max(500).optional(),
153
+ /** Sprint ID for file path construction */
154
+ sprint_id: z.string(),
155
+ /** ISO 8601 timestamp */
156
+ escalated_at: z.string().datetime(),
157
+ /** Schema version */
158
+ schema_version: z.literal('1.0').default('1.0'),
159
+ });
160
+ //# sourceMappingURL=cbp-loops.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cbp-loops.js","sourceRoot":"","sources":["../../src/schemas/cbp-loops.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;;;;;;;;GAeG;AAEH,iFAAiF;AAEjF,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAC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AE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1C,+DAA+D;IAC/D,oBAAoB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE;IACpD,2CAA2C;IAC3C,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,yBAAyB;IACzB,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACnC,qBAAqB;IACrB,cAAc,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC;CAChD,CAAC,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Unit Tests for CBP Loop Control Schemas
3
+ *
4
+ * Tests: RejectionFeedbackSchema, IterationSignalSchema, EscalationSignalSchema
5
+ *
6
+ * @see STORY-108 MandateResult CBP Extension
7
+ * @see TASK-234 Loop schemas: RejectionFeedback + IterationSignal + EscalationSignal
8
+ */
9
+ export {};
10
+ //# sourceMappingURL=cbp-loops.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cbp-loops.test.d.ts","sourceRoot":"","sources":["../../src/schemas/cbp-loops.test.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG"}
@@ -0,0 +1,268 @@
1
+ /**
2
+ * Unit Tests for CBP Loop Control Schemas
3
+ *
4
+ * Tests: RejectionFeedbackSchema, IterationSignalSchema, EscalationSignalSchema
5
+ *
6
+ * @see STORY-108 MandateResult CBP Extension
7
+ * @see TASK-234 Loop schemas: RejectionFeedback + IterationSignal + EscalationSignal
8
+ */
9
+ import { describe, expect, it } from 'vitest';
10
+ import { EscalationSignalSchema, EscalationType, IterationSignalSchema, LoopStatus, LoopType, RejectionFeedbackSchema, RejectionType, } from './cbp-loops.js';
11
+ // ─── Helpers ─────────────────────────────────────────────────────────────────
12
+ function validRejection() {
13
+ return {
14
+ target_subagent: 'devsteps-impl-subagent',
15
+ iteration: 1,
16
+ rejection_type: 'test-failure',
17
+ violated_criteria: ['Tests must pass for all affected modules'],
18
+ specific_issues: [
19
+ {
20
+ file: 'packages/shared/src/schemas/cbp-mandate.ts',
21
+ line: 45,
22
+ issue: 'Missing export of MandateType enum',
23
+ suggestion: 'Add: export type MandateType = z.infer<typeof MandateType>',
24
+ },
25
+ ],
26
+ max_iterations_remaining: 2,
27
+ sprint_id: 'sprint-2026-02-22',
28
+ item_id: 'TASK-233',
29
+ created_at: '2026-02-22T11:00:00.000Z',
30
+ };
31
+ }
32
+ function validSignal(overrides = {}) {
33
+ return {
34
+ loop_type: 'review-fix',
35
+ status: 'continuing',
36
+ iteration: 1,
37
+ max_iterations: 3,
38
+ sprint_id: 'sprint-2026-02-22',
39
+ item_id: 'TASK-233',
40
+ signaled_at: '2026-02-22T11:05:00.000Z',
41
+ ...overrides,
42
+ };
43
+ }
44
+ function validEscalation() {
45
+ return {
46
+ escalation_id: 'b2c3d4e5-f6a7-8901-bcde-f12345678901',
47
+ source_agent: 'devsteps-t2-archaeology',
48
+ escalation_type: 'architectural-decision',
49
+ context: 'The affected_paths for TASK-233 overlap with the CBP v1 schemas. Modifying analysis.ts would break existing T3 agents that depend on it. Two options: (A) extend in-place, (B) create cbp-mandate.ts separately.',
50
+ decision_needed: 'Should MandateSchema be added to analysis.ts or a new cbp-mandate.ts file?',
51
+ blocking_items: ['TASK-233', 'TASK-235'],
52
+ sprint_id: 'sprint-2026-02-22',
53
+ escalated_at: '2026-02-22T11:10:00.000Z',
54
+ };
55
+ }
56
+ // ─── Enum tests ───────────────────────────────────────────────────────────────
57
+ describe('LoopType', () => {
58
+ it('accepts all valid loop types', () => {
59
+ for (const t of ['tdd', 'review-fix', 'clarification', 'replanning']) {
60
+ expect(() => LoopType.parse(t)).not.toThrow();
61
+ }
62
+ });
63
+ it('rejects unknown loop types', () => {
64
+ expect(() => LoopType.parse('escalation')).toThrow();
65
+ expect(() => LoopType.parse('')).toThrow();
66
+ });
67
+ });
68
+ describe('LoopStatus', () => {
69
+ it('accepts all valid statuses', () => {
70
+ for (const s of ['continuing', 'resolved', 'exhausted', 'escalated']) {
71
+ expect(() => LoopStatus.parse(s)).not.toThrow();
72
+ }
73
+ });
74
+ });
75
+ describe('RejectionType', () => {
76
+ it('accepts all valid rejection types', () => {
77
+ const types = [
78
+ 'quality-insufficient',
79
+ 'wrong-approach',
80
+ 'missing-requirement',
81
+ 'test-failure',
82
+ 'type-error',
83
+ ];
84
+ for (const t of types) {
85
+ expect(() => RejectionType.parse(t)).not.toThrow();
86
+ }
87
+ });
88
+ });
89
+ describe('EscalationType', () => {
90
+ it('accepts all valid escalation types', () => {
91
+ const types = [
92
+ 'human-required',
93
+ 'contradicting-requirements',
94
+ 'budget-exhausted',
95
+ 'architectural-decision',
96
+ 'scope-ambiguous',
97
+ ];
98
+ for (const t of types) {
99
+ expect(() => EscalationType.parse(t)).not.toThrow();
100
+ }
101
+ });
102
+ });
103
+ // ─── RejectionFeedbackSchema ──────────────────────────────────────────────────
104
+ describe('RejectionFeedbackSchema', () => {
105
+ it('parses a valid RejectionFeedback', () => {
106
+ const result = RejectionFeedbackSchema.safeParse(validRejection());
107
+ expect(result.success).toBe(true);
108
+ if (result.success) {
109
+ expect(result.data.iteration).toBe(1);
110
+ expect(result.data.schema_version).toBe('1.0');
111
+ expect(result.data.escalate_if_remaining).toBe(0); // default
112
+ }
113
+ });
114
+ it('defaults escalate_if_remaining to 0', () => {
115
+ const result = RejectionFeedbackSchema.parse(validRejection());
116
+ expect(result.escalate_if_remaining).toBe(0);
117
+ });
118
+ it('rejects iteration exceeding 5', () => {
119
+ const result = RejectionFeedbackSchema.safeParse({ ...validRejection(), iteration: 6 });
120
+ expect(result.success).toBe(false);
121
+ });
122
+ it('rejects iteration below 1', () => {
123
+ const result = RejectionFeedbackSchema.safeParse({ ...validRejection(), iteration: 0 });
124
+ expect(result.success).toBe(false);
125
+ });
126
+ it('rejects empty violated_criteria', () => {
127
+ const result = RejectionFeedbackSchema.safeParse({
128
+ ...validRejection(),
129
+ violated_criteria: [],
130
+ });
131
+ expect(result.success).toBe(false);
132
+ });
133
+ it('rejects empty specific_issues', () => {
134
+ const result = RejectionFeedbackSchema.safeParse({ ...validRejection(), specific_issues: [] });
135
+ expect(result.success).toBe(false);
136
+ });
137
+ it('rejects issue text exceeding 300 characters', () => {
138
+ const longIssue = {
139
+ file: 'src/foo.ts',
140
+ issue: 'x'.repeat(301),
141
+ suggestion: 'Fix it',
142
+ };
143
+ const result = RejectionFeedbackSchema.safeParse({
144
+ ...validRejection(),
145
+ specific_issues: [longIssue],
146
+ });
147
+ expect(result.success).toBe(false);
148
+ });
149
+ it('accepts more than 20 specific_issues — schema allows max 20', () => {
150
+ const issues = Array.from({ length: 21 }, (_, i) => ({
151
+ file: `src/file${i}.ts`,
152
+ issue: 'Issue description',
153
+ suggestion: 'Fix suggestion',
154
+ }));
155
+ const result = RejectionFeedbackSchema.safeParse({
156
+ ...validRejection(),
157
+ specific_issues: issues,
158
+ });
159
+ expect(result.success).toBe(false); // Exceeds max 20
160
+ });
161
+ it('accepts issue without line number (optional)', () => {
162
+ const noLine = [{ file: 'src/foo.ts', issue: 'Missing export', suggestion: 'Add export' }];
163
+ const result = RejectionFeedbackSchema.safeParse({
164
+ ...validRejection(),
165
+ specific_issues: noLine,
166
+ });
167
+ expect(result.success).toBe(true);
168
+ });
169
+ });
170
+ // ─── IterationSignalSchema ────────────────────────────────────────────────────
171
+ describe('IterationSignalSchema', () => {
172
+ it('parses a valid IterationSignal', () => {
173
+ const result = IterationSignalSchema.safeParse(validSignal());
174
+ expect(result.success).toBe(true);
175
+ if (result.success) {
176
+ expect(result.data.loop_type).toBe('review-fix');
177
+ expect(result.data.schema_version).toBe('1.0');
178
+ }
179
+ });
180
+ it('rejects max_iterations exceeding 5', () => {
181
+ const result = IterationSignalSchema.safeParse(validSignal({ max_iterations: 6 }));
182
+ expect(result.success).toBe(false);
183
+ });
184
+ it('rejects max_iterations below 1', () => {
185
+ const result = IterationSignalSchema.safeParse(validSignal({ max_iterations: 0 }));
186
+ expect(result.success).toBe(false);
187
+ });
188
+ it('rejects iteration below 1', () => {
189
+ const result = IterationSignalSchema.safeParse(validSignal({ iteration: 0 }));
190
+ expect(result.success).toBe(false);
191
+ });
192
+ it('accepts all valid status combinations', () => {
193
+ for (const status of ['continuing', 'resolved', 'exhausted', 'escalated']) {
194
+ expect(IterationSignalSchema.safeParse(validSignal({ status })).success).toBe(true);
195
+ }
196
+ });
197
+ it('accepts optional notes field', () => {
198
+ const result = IterationSignalSchema.safeParse(validSignal({ notes: 'TypeScript errors remain in 2 files' }));
199
+ expect(result.success).toBe(true);
200
+ });
201
+ it('rejects notes exceeding 500 characters', () => {
202
+ const result = IterationSignalSchema.safeParse(validSignal({ notes: 'x'.repeat(501) }));
203
+ expect(result.success).toBe(false);
204
+ });
205
+ });
206
+ // ─── EscalationSignalSchema ───────────────────────────────────────────────────
207
+ describe('EscalationSignalSchema', () => {
208
+ it('parses a valid EscalationSignal', () => {
209
+ const result = EscalationSignalSchema.safeParse(validEscalation());
210
+ expect(result.success).toBe(true);
211
+ if (result.success) {
212
+ expect(result.data.escalation_id).toBe('b2c3d4e5-f6a7-8901-bcde-f12345678901');
213
+ expect(result.data.schema_version).toBe('1.0');
214
+ }
215
+ });
216
+ it('rejects invalid UUID for escalation_id', () => {
217
+ const result = EscalationSignalSchema.safeParse({
218
+ ...validEscalation(),
219
+ escalation_id: 'not-uuid',
220
+ });
221
+ expect(result.success).toBe(false);
222
+ });
223
+ it('rejects empty blocking_items', () => {
224
+ const result = EscalationSignalSchema.safeParse({ ...validEscalation(), blocking_items: [] });
225
+ expect(result.success).toBe(false);
226
+ });
227
+ it('rejects context exceeding 3000 characters', () => {
228
+ const result = EscalationSignalSchema.safeParse({
229
+ ...validEscalation(),
230
+ context: 'x'.repeat(3001),
231
+ });
232
+ expect(result.success).toBe(false);
233
+ });
234
+ it('rejects decision_needed exceeding 500 characters', () => {
235
+ const result = EscalationSignalSchema.safeParse({
236
+ ...validEscalation(),
237
+ decision_needed: 'x'.repeat(501),
238
+ });
239
+ expect(result.success).toBe(false);
240
+ });
241
+ it('accepts optional suggested_resolution', () => {
242
+ const result = EscalationSignalSchema.safeParse({
243
+ ...validEscalation(),
244
+ suggested_resolution: 'Use option B: create cbp-mandate.ts as a separate file.',
245
+ });
246
+ expect(result.success).toBe(true);
247
+ });
248
+ it('rejects suggested_resolution exceeding 500 characters', () => {
249
+ const result = EscalationSignalSchema.safeParse({
250
+ ...validEscalation(),
251
+ suggested_resolution: 'x'.repeat(501),
252
+ });
253
+ expect(result.success).toBe(false);
254
+ });
255
+ it('accepts all valid escalation types', () => {
256
+ const types = [
257
+ 'human-required',
258
+ 'contradicting-requirements',
259
+ 'budget-exhausted',
260
+ 'architectural-decision',
261
+ 'scope-ambiguous',
262
+ ];
263
+ for (const escalation_type of types) {
264
+ expect(EscalationSignalSchema.safeParse({ ...validEscalation(), escalation_type }).success).toBe(true);
265
+ }
266
+ });
267
+ });
268
+ //# sourceMappingURL=cbp-loops.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cbp-loops.test.js","sourceRoot":"","sources":["../../src/schemas/cbp-loops.test.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EACL,sBAAsB,EACtB,cAAc,EACd,qBAAqB,EACrB,UAAU,EACV,QAAQ,EACR,uBAAuB,EACvB,aAAa,GACd,MAAM,gBAAgB,CAAC;AAExB,gFAAgF;AAEhF,SAAS,cAAc;IACrB,OAAO;QACL,eAAe,EAAE,wBAAwB;QACzC,SAAS,EAAE,CAAC;QACZ,cAAc,EAAE,cAAc;QAC9B,iBAAiB,EAAE,CAAC,0CAA0C,CAAC;QAC/D,eAAe,EAAE;YACf;gBACE,IAAI,EAAE,4CAA4C;g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