@jamesaphoenix/tx-types 0.4.2 → 0.4.3

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 (62) hide show
  1. package/README.md +480 -0
  2. package/dist/anchor.d.ts +93 -96
  3. package/dist/anchor.d.ts.map +1 -1
  4. package/dist/anchor.js +74 -1
  5. package/dist/anchor.js.map +1 -1
  6. package/dist/attempt.d.ts +36 -28
  7. package/dist/attempt.d.ts.map +1 -1
  8. package/dist/attempt.js +59 -1
  9. package/dist/attempt.js.map +1 -1
  10. package/dist/candidate.d.ts +117 -145
  11. package/dist/candidate.d.ts.map +1 -1
  12. package/dist/candidate.js +109 -0
  13. package/dist/candidate.js.map +1 -1
  14. package/dist/cycle.d.ts +130 -0
  15. package/dist/cycle.d.ts.map +1 -0
  16. package/dist/cycle.js +89 -0
  17. package/dist/cycle.js.map +1 -0
  18. package/dist/deduplication.d.ts +76 -92
  19. package/dist/deduplication.d.ts.map +1 -1
  20. package/dist/deduplication.js +63 -2
  21. package/dist/deduplication.js.map +1 -1
  22. package/dist/doc.d.ts +269 -0
  23. package/dist/doc.d.ts.map +1 -0
  24. package/dist/doc.js +232 -0
  25. package/dist/doc.js.map +1 -0
  26. package/dist/edge.d.ts +53 -56
  27. package/dist/edge.d.ts.map +1 -1
  28. package/dist/edge.js +51 -1
  29. package/dist/edge.js.map +1 -1
  30. package/dist/file-learning.d.ts +23 -28
  31. package/dist/file-learning.d.ts.map +1 -1
  32. package/dist/file-learning.js +22 -2
  33. package/dist/file-learning.js.map +1 -1
  34. package/dist/index.d.ts +14 -14
  35. package/dist/index.d.ts.map +1 -1
  36. package/dist/index.js +38 -21
  37. package/dist/index.js.map +1 -1
  38. package/dist/learning.d.ts +167 -172
  39. package/dist/learning.d.ts.map +1 -1
  40. package/dist/learning.js +109 -1
  41. package/dist/learning.js.map +1 -1
  42. package/dist/response.d.ts +636 -0
  43. package/dist/response.d.ts.map +1 -0
  44. package/dist/response.js +354 -0
  45. package/dist/response.js.map +1 -0
  46. package/dist/run.d.ts +73 -40
  47. package/dist/run.d.ts.map +1 -1
  48. package/dist/run.js +108 -1
  49. package/dist/run.js.map +1 -1
  50. package/dist/symbol.d.ts +42 -43
  51. package/dist/symbol.d.ts.map +1 -1
  52. package/dist/symbol.js +55 -1
  53. package/dist/symbol.js.map +1 -1
  54. package/dist/task.d.ts +114 -78
  55. package/dist/task.d.ts.map +1 -1
  56. package/dist/task.js +149 -2
  57. package/dist/task.js.map +1 -1
  58. package/dist/tracked-project.d.ts +24 -34
  59. package/dist/tracked-project.d.ts.map +1 -1
  60. package/dist/tracked-project.js +34 -0
  61. package/dist/tracked-project.js.map +1 -1
  62. package/package.json +7 -3
@@ -3,188 +3,160 @@
3
3
  *
4
4
  * Learning candidates are potential learnings extracted from Claude Code
5
5
  * transcripts that await promotion to the learnings table.
6
+ * Core type definitions using Effect Schema (Doctrine Rule 10).
6
7
  *
7
8
  * @see PRD-015 for the JSONL daemon and knowledge promotion pipeline
8
9
  */
9
- /**
10
- * Confidence level for extracted learning candidates.
11
- *
12
- * - high: Tested in session with clear outcome - auto-promotable
13
- * - medium: Reasonable but unverified - needs review
14
- * - low: Speculative or edge case - needs review
15
- */
16
- export type CandidateConfidence = "high" | "medium" | "low";
10
+ import { Schema } from "effect";
17
11
  /**
18
12
  * All valid confidence levels.
19
13
  */
20
14
  export declare const CANDIDATE_CONFIDENCES: readonly ["high", "medium", "low"];
21
- /**
22
- * Category of the extracted learning.
23
- * Helps organize and filter learnings by domain.
24
- */
25
- export type CandidateCategory = "architecture" | "testing" | "performance" | "security" | "debugging" | "tooling" | "patterns" | "other";
26
15
  /**
27
16
  * All valid candidate categories.
28
17
  */
29
18
  export declare const CANDIDATE_CATEGORIES: readonly ["architecture", "testing", "performance", "security", "debugging", "tooling", "patterns", "other"];
30
- /**
31
- * Status of a learning candidate in the promotion pipeline.
32
- *
33
- * - pending: Awaiting review or auto-promotion
34
- * - promoted: Successfully promoted to learnings table
35
- * - rejected: Manually rejected by reviewer
36
- * - merged: Merged with existing similar learning
37
- */
38
- export type CandidateStatus = "pending" | "promoted" | "rejected" | "merged";
39
19
  /**
40
20
  * All valid candidate statuses.
41
21
  */
42
22
  export declare const CANDIDATE_STATUSES: readonly ["pending", "promoted", "rejected", "merged"];
43
- /**
44
- * A chunk of transcript content to be analyzed for learning extraction.
45
- * Used as input to the CandidateExtractor.
46
- */
47
- export interface TranscriptChunk {
23
+ /** Confidence level for extracted learning candidates. */
24
+ export declare const CandidateConfidenceSchema: Schema.Literal<["high", "medium", "low"]>;
25
+ export type CandidateConfidence = typeof CandidateConfidenceSchema.Type;
26
+ /** Category of the extracted learning. */
27
+ export declare const CandidateCategorySchema: Schema.Literal<["architecture", "testing", "performance", "security", "debugging", "tooling", "patterns", "other"]>;
28
+ export type CandidateCategory = typeof CandidateCategorySchema.Type;
29
+ /** Status of a learning candidate in the promotion pipeline. */
30
+ export declare const CandidateStatusSchema: Schema.Literal<["pending", "promoted", "rejected", "merged"]>;
31
+ export type CandidateStatus = typeof CandidateStatusSchema.Type;
32
+ /** Unique identifier for a stored learning candidate. */
33
+ export type CandidateId = number;
34
+ /** A chunk of transcript content to be analyzed for learning extraction. */
35
+ export declare const TranscriptChunkSchema: Schema.Struct<{
48
36
  /** The transcript text content to analyze */
49
- readonly content: string;
37
+ content: typeof Schema.String;
50
38
  /** Source file path (e.g., ~/.claude/projects/foo/session.jsonl) */
51
- readonly sourceFile: string;
39
+ sourceFile: typeof Schema.String;
52
40
  /** Optional run ID for provenance tracking */
53
- readonly sourceRunId?: string | null;
41
+ sourceRunId: Schema.optional<Schema.NullOr<typeof Schema.String>>;
54
42
  /** Optional task ID for provenance tracking */
55
- readonly sourceTaskId?: string | null;
43
+ sourceTaskId: Schema.optional<Schema.NullOr<typeof Schema.String>>;
56
44
  /** Byte offset in source file (for incremental processing) */
57
- readonly byteOffset?: number;
45
+ byteOffset: Schema.optional<Schema.filter<typeof Schema.Number>>;
58
46
  /** Line number range in source file */
59
- readonly lineRange?: {
60
- start: number;
61
- end: number;
62
- };
63
- }
64
- /**
65
- * A learning candidate extracted from a transcript by the LLM.
66
- * This is the raw extraction output before database storage.
67
- */
68
- export interface ExtractedCandidate {
47
+ lineRange: Schema.optional<Schema.Struct<{
48
+ start: Schema.filter<typeof Schema.Number>;
49
+ end: Schema.filter<typeof Schema.Number>;
50
+ }>>;
51
+ }>;
52
+ export type TranscriptChunk = typeof TranscriptChunkSchema.Type;
53
+ /** A learning candidate extracted from a transcript by the LLM. */
54
+ export declare const ExtractedCandidateSchema: Schema.Struct<{
69
55
  /** The learning text (1-3 sentences, actionable) */
70
- readonly content: string;
56
+ content: typeof Schema.String;
71
57
  /** Confidence level assigned by the LLM */
72
- readonly confidence: CandidateConfidence;
58
+ confidence: Schema.Literal<["high", "medium", "low"]>;
73
59
  /** Category of the learning */
74
- readonly category: CandidateCategory;
75
- }
76
- /**
77
- * Unique identifier for a stored learning candidate.
78
- */
79
- export type CandidateId = number;
80
- /**
81
- * A learning candidate stored in the database.
82
- * Extends ExtractedCandidate with storage metadata.
83
- */
84
- export interface LearningCandidate {
60
+ category: Schema.Literal<["architecture", "testing", "performance", "security", "debugging", "tooling", "patterns", "other"]>;
61
+ }>;
62
+ export type ExtractedCandidate = typeof ExtractedCandidateSchema.Type;
63
+ /** A learning candidate stored in the database. */
64
+ export declare const LearningCandidateSchema: Schema.Struct<{
85
65
  /** Unique database ID */
86
- readonly id: CandidateId;
66
+ id: Schema.filter<typeof Schema.Number>;
87
67
  /** The learning text (1-3 sentences, actionable) */
88
- readonly content: string;
68
+ content: typeof Schema.String;
89
69
  /** Confidence level assigned by the LLM */
90
- readonly confidence: CandidateConfidence;
70
+ confidence: Schema.Literal<["high", "medium", "low"]>;
91
71
  /** Category of the learning */
92
- readonly category: CandidateCategory | null;
72
+ category: Schema.NullOr<Schema.Literal<["architecture", "testing", "performance", "security", "debugging", "tooling", "patterns", "other"]>>;
93
73
  /** Source JSONL file path */
94
- readonly sourceFile: string;
74
+ sourceFile: typeof Schema.String;
95
75
  /** Source run ID for provenance */
96
- readonly sourceRunId: string | null;
76
+ sourceRunId: Schema.NullOr<typeof Schema.String>;
97
77
  /** Source task ID for provenance */
98
- readonly sourceTaskId: string | null;
78
+ sourceTaskId: Schema.NullOr<typeof Schema.String>;
99
79
  /** When the candidate was extracted */
100
- readonly extractedAt: Date;
80
+ extractedAt: typeof Schema.DateFromSelf;
101
81
  /** Current status in promotion pipeline */
102
- readonly status: CandidateStatus;
82
+ status: Schema.Literal<["pending", "promoted", "rejected", "merged"]>;
103
83
  /** When the candidate was reviewed */
104
- readonly reviewedAt: Date | null;
84
+ reviewedAt: Schema.NullOr<typeof Schema.DateFromSelf>;
105
85
  /** Who reviewed ('auto' or user identifier) */
106
- readonly reviewedBy: string | null;
86
+ reviewedBy: Schema.NullOr<typeof Schema.String>;
107
87
  /** ID of promoted learning (if promoted or merged) */
108
- readonly promotedLearningId: number | null;
88
+ promotedLearningId: Schema.NullOr<Schema.filter<typeof Schema.Number>>;
109
89
  /** Reason for rejection (if rejected) */
110
- readonly rejectionReason: string | null;
111
- }
112
- /**
113
- * Input for creating a new learning candidate.
114
- */
115
- export interface CreateCandidateInput {
116
- /** The learning text */
117
- readonly content: string;
118
- /** Confidence level */
119
- readonly confidence: CandidateConfidence;
120
- /** Category of the learning */
121
- readonly category?: CandidateCategory | null;
122
- /** Source file path */
123
- readonly sourceFile: string;
124
- /** Source run ID */
125
- readonly sourceRunId?: string | null;
126
- /** Source task ID */
127
- readonly sourceTaskId?: string | null;
128
- }
129
- /**
130
- * Input for updating a learning candidate.
131
- */
132
- export interface UpdateCandidateInput {
133
- /** New status */
134
- readonly status?: CandidateStatus;
135
- /** Review timestamp */
136
- readonly reviewedAt?: Date;
137
- /** Reviewer identifier */
138
- readonly reviewedBy?: string;
139
- /** Promoted learning ID */
140
- readonly promotedLearningId?: number;
141
- /** Rejection reason */
142
- readonly rejectionReason?: string;
143
- }
144
- /**
145
- * Filter options for querying learning candidates.
146
- */
147
- export interface CandidateFilter {
148
- /** Filter by status */
149
- readonly status?: CandidateStatus | CandidateStatus[];
150
- /** Filter by confidence */
151
- readonly confidence?: CandidateConfidence | CandidateConfidence[];
152
- /** Filter by category */
153
- readonly category?: CandidateCategory | CandidateCategory[];
154
- /** Filter by source file */
155
- readonly sourceFile?: string;
156
- /** Filter by source run ID */
157
- readonly sourceRunId?: string;
158
- /** Filter by source task ID */
159
- readonly sourceTaskId?: string;
160
- /** Maximum results */
161
- readonly limit?: number;
162
- /** Offset for pagination */
163
- readonly offset?: number;
164
- }
165
- /**
166
- * Result of candidate extraction from a transcript chunk.
167
- */
168
- export interface ExtractionResult {
169
- /** Extracted candidates */
170
- readonly candidates: readonly ExtractedCandidate[];
171
- /** Source chunk that was processed */
172
- readonly sourceChunk: TranscriptChunk;
173
- /** Whether extraction was performed (false if using noop) */
174
- readonly wasExtracted: boolean;
175
- /** Processing metadata */
176
- readonly metadata?: {
177
- /** Model used for extraction */
178
- readonly model?: string;
179
- /** Tokens used (input + output) */
180
- readonly tokensUsed?: number;
181
- /** Processing duration in milliseconds */
182
- readonly durationMs?: number;
183
- };
184
- }
185
- /**
186
- * Database row representation for learning_candidates table.
187
- */
90
+ rejectionReason: Schema.NullOr<typeof Schema.String>;
91
+ }>;
92
+ export type LearningCandidate = typeof LearningCandidateSchema.Type;
93
+ /** Input for creating a new learning candidate. */
94
+ export declare const CreateCandidateInputSchema: Schema.Struct<{
95
+ content: typeof Schema.String;
96
+ confidence: Schema.Literal<["high", "medium", "low"]>;
97
+ category: Schema.optional<Schema.NullOr<Schema.Literal<["architecture", "testing", "performance", "security", "debugging", "tooling", "patterns", "other"]>>>;
98
+ sourceFile: typeof Schema.String;
99
+ sourceRunId: Schema.optional<Schema.NullOr<typeof Schema.String>>;
100
+ sourceTaskId: Schema.optional<Schema.NullOr<typeof Schema.String>>;
101
+ }>;
102
+ export type CreateCandidateInput = typeof CreateCandidateInputSchema.Type;
103
+ /** Input for updating a learning candidate. */
104
+ export declare const UpdateCandidateInputSchema: Schema.Struct<{
105
+ status: Schema.optional<Schema.Literal<["pending", "promoted", "rejected", "merged"]>>;
106
+ reviewedAt: Schema.optional<typeof Schema.DateFromSelf>;
107
+ reviewedBy: Schema.optional<typeof Schema.String>;
108
+ promotedLearningId: Schema.optional<Schema.filter<typeof Schema.Number>>;
109
+ rejectionReason: Schema.optional<typeof Schema.String>;
110
+ }>;
111
+ export type UpdateCandidateInput = typeof UpdateCandidateInputSchema.Type;
112
+ /** Filter options for querying learning candidates. */
113
+ export declare const CandidateFilterSchema: Schema.Struct<{
114
+ status: Schema.optional<Schema.Union<[Schema.Literal<["pending", "promoted", "rejected", "merged"]>, Schema.Array$<Schema.Literal<["pending", "promoted", "rejected", "merged"]>>]>>;
115
+ confidence: Schema.optional<Schema.Union<[Schema.Literal<["high", "medium", "low"]>, Schema.Array$<Schema.Literal<["high", "medium", "low"]>>]>>;
116
+ category: Schema.optional<Schema.Union<[Schema.Literal<["architecture", "testing", "performance", "security", "debugging", "tooling", "patterns", "other"]>, Schema.Array$<Schema.Literal<["architecture", "testing", "performance", "security", "debugging", "tooling", "patterns", "other"]>>]>>;
117
+ sourceFile: Schema.optional<typeof Schema.String>;
118
+ sourceRunId: Schema.optional<typeof Schema.String>;
119
+ sourceTaskId: Schema.optional<typeof Schema.String>;
120
+ limit: Schema.optional<Schema.filter<typeof Schema.Number>>;
121
+ offset: Schema.optional<Schema.filter<typeof Schema.Number>>;
122
+ }>;
123
+ export type CandidateFilter = typeof CandidateFilterSchema.Type;
124
+ /** Result of candidate extraction from a transcript chunk. */
125
+ export declare const ExtractionResultSchema: Schema.Struct<{
126
+ candidates: Schema.Array$<Schema.Struct<{
127
+ /** The learning text (1-3 sentences, actionable) */
128
+ content: typeof Schema.String;
129
+ /** Confidence level assigned by the LLM */
130
+ confidence: Schema.Literal<["high", "medium", "low"]>;
131
+ /** Category of the learning */
132
+ category: Schema.Literal<["architecture", "testing", "performance", "security", "debugging", "tooling", "patterns", "other"]>;
133
+ }>>;
134
+ sourceChunk: Schema.Struct<{
135
+ /** The transcript text content to analyze */
136
+ content: typeof Schema.String;
137
+ /** Source file path (e.g., ~/.claude/projects/foo/session.jsonl) */
138
+ sourceFile: typeof Schema.String;
139
+ /** Optional run ID for provenance tracking */
140
+ sourceRunId: Schema.optional<Schema.NullOr<typeof Schema.String>>;
141
+ /** Optional task ID for provenance tracking */
142
+ sourceTaskId: Schema.optional<Schema.NullOr<typeof Schema.String>>;
143
+ /** Byte offset in source file (for incremental processing) */
144
+ byteOffset: Schema.optional<Schema.filter<typeof Schema.Number>>;
145
+ /** Line number range in source file */
146
+ lineRange: Schema.optional<Schema.Struct<{
147
+ start: Schema.filter<typeof Schema.Number>;
148
+ end: Schema.filter<typeof Schema.Number>;
149
+ }>>;
150
+ }>;
151
+ wasExtracted: typeof Schema.Boolean;
152
+ metadata: Schema.optional<Schema.Struct<{
153
+ model: Schema.optional<typeof Schema.String>;
154
+ tokensUsed: Schema.optional<Schema.filter<typeof Schema.Number>>;
155
+ durationMs: Schema.optional<typeof Schema.Number>;
156
+ }>>;
157
+ }>;
158
+ export type ExtractionResult = typeof ExtractionResultSchema.Type;
159
+ /** Database row representation for learning_candidates table. */
188
160
  export interface CandidateRow {
189
161
  readonly id: number;
190
162
  readonly content: string;
@@ -1 +1 @@
1
- {"version":3,"file":"candidate.d.ts","sourceRoot":"","sources":["../src/candidate.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;;;GAMG;AACH,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAA;AAE3D;;GAEG;AACH,eAAO,MAAM,qBAAqB,oCAAqC,CAAA;AAEvE;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GACzB,cAAc,GACd,SAAS,GACT,aAAa,GACb,UAAU,GACV,WAAW,GACX,SAAS,GACT,UAAU,GACV,OAAO,CAAA;AAEX;;GAEG;AACH,eAAO,MAAM,oBA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ates are potential learnings extracted from Claude Code
5
5
  * transcripts that await promotion to the learnings table.
6
+ * Core type definitions using Effect Schema (Doctrine Rule 10).
6
7
  *
7
8
  * @see PRD-015 for the JSONL daemon and knowledge promotion pipeline
8
9
  */
10
+ import { Schema } from "effect";
11
+ // =============================================================================
12
+ // CONSTANTS
13
+ // =============================================================================
9
14
  /**
10
15
  * All valid confidence levels.
11
16
  */
@@ -27,4 +32,108 @@ export const CANDIDATE_CATEGORIES = [
27
32
  * All valid candidate statuses.
28
33
  */
29
34
  export const CANDIDATE_STATUSES = ["pending", "promoted", "rejected", "merged"];
35
+ // =============================================================================
36
+ // SCHEMAS & TYPES
37
+ // =============================================================================
38
+ /** Confidence level for extracted learning candidates. */
39
+ export const CandidateConfidenceSchema = Schema.Literal(...CANDIDATE_CONFIDENCES);
40
+ /** Category of the extracted learning. */
41
+ export const CandidateCategorySchema = Schema.Literal(...CANDIDATE_CATEGORIES);
42
+ /** Status of a learning candidate in the promotion pipeline. */
43
+ export const CandidateStatusSchema = Schema.Literal(...CANDIDATE_STATUSES);
44
+ /** A chunk of transcript content to be analyzed for learning extraction. */
45
+ export const TranscriptChunkSchema = Schema.Struct({
46
+ /** The transcript text content to analyze */
47
+ content: Schema.String,
48
+ /** Source file path (e.g., ~/.claude/projects/foo/session.jsonl) */
49
+ sourceFile: Schema.String,
50
+ /** Optional run ID for provenance tracking */
51
+ sourceRunId: Schema.optional(Schema.NullOr(Schema.String)),
52
+ /** Optional task ID for provenance tracking */
53
+ sourceTaskId: Schema.optional(Schema.NullOr(Schema.String)),
54
+ /** Byte offset in source file (for incremental processing) */
55
+ byteOffset: Schema.optional(Schema.Number.pipe(Schema.int())),
56
+ /** Line number range in source file */
57
+ lineRange: Schema.optional(Schema.Struct({
58
+ start: Schema.Number.pipe(Schema.int()),
59
+ end: Schema.Number.pipe(Schema.int()),
60
+ })),
61
+ });
62
+ /** A learning candidate extracted from a transcript by the LLM. */
63
+ export const ExtractedCandidateSchema = Schema.Struct({
64
+ /** The learning text (1-3 sentences, actionable) */
65
+ content: Schema.String,
66
+ /** Confidence level assigned by the LLM */
67
+ confidence: CandidateConfidenceSchema,
68
+ /** Category of the learning */
69
+ category: CandidateCategorySchema,
70
+ });
71
+ /** A learning candidate stored in the database. */
72
+ export const LearningCandidateSchema = Schema.Struct({
73
+ /** Unique database ID */
74
+ id: Schema.Number.pipe(Schema.int()),
75
+ /** The learning text (1-3 sentences, actionable) */
76
+ content: Schema.String,
77
+ /** Confidence level assigned by the LLM */
78
+ confidence: CandidateConfidenceSchema,
79
+ /** Category of the learning */
80
+ category: Schema.NullOr(CandidateCategorySchema),
81
+ /** Source JSONL file path */
82
+ sourceFile: Schema.String,
83
+ /** Source run ID for provenance */
84
+ sourceRunId: Schema.NullOr(Schema.String),
85
+ /** Source task ID for provenance */
86
+ sourceTaskId: Schema.NullOr(Schema.String),
87
+ /** When the candidate was extracted */
88
+ extractedAt: Schema.DateFromSelf,
89
+ /** Current status in promotion pipeline */
90
+ status: CandidateStatusSchema,
91
+ /** When the candidate was reviewed */
92
+ reviewedAt: Schema.NullOr(Schema.DateFromSelf),
93
+ /** Who reviewed ('auto' or user identifier) */
94
+ reviewedBy: Schema.NullOr(Schema.String),
95
+ /** ID of promoted learning (if promoted or merged) */
96
+ promotedLearningId: Schema.NullOr(Schema.Number.pipe(Schema.int())),
97
+ /** Reason for rejection (if rejected) */
98
+ rejectionReason: Schema.NullOr(Schema.String),
99
+ });
100
+ /** Input for creating a new learning candidate. */
101
+ export const CreateCandidateInputSchema = Schema.Struct({
102
+ content: Schema.String,
103
+ confidence: CandidateConfidenceSchema,
104
+ category: Schema.optional(Schema.NullOr(CandidateCategorySchema)),
105
+ sourceFile: Schema.String,
106
+ sourceRunId: Schema.optional(Schema.NullOr(Schema.String)),
107
+ sourceTaskId: Schema.optional(Schema.NullOr(Schema.String)),
108
+ });
109
+ /** Input for updating a learning candidate. */
110
+ export const UpdateCandidateInputSchema = Schema.Struct({
111
+ status: Schema.optional(CandidateStatusSchema),
112
+ reviewedAt: Schema.optional(Schema.DateFromSelf),
113
+ reviewedBy: Schema.optional(Schema.String),
114
+ promotedLearningId: Schema.optional(Schema.Number.pipe(Schema.int())),
115
+ rejectionReason: Schema.optional(Schema.String),
116
+ });
117
+ /** Filter options for querying learning candidates. */
118
+ export const CandidateFilterSchema = Schema.Struct({
119
+ status: Schema.optional(Schema.Union(CandidateStatusSchema, Schema.Array(CandidateStatusSchema))),
120
+ confidence: Schema.optional(Schema.Union(CandidateConfidenceSchema, Schema.Array(CandidateConfidenceSchema))),
121
+ category: Schema.optional(Schema.Union(CandidateCategorySchema, Schema.Array(CandidateCategorySchema))),
122
+ sourceFile: Schema.optional(Schema.String),
123
+ sourceRunId: Schema.optional(Schema.String),
124
+ sourceTaskId: Schema.optional(Schema.String),
125
+ limit: Schema.optional(Schema.Number.pipe(Schema.int())),
126
+ offset: Schema.optional(Schema.Number.pipe(Schema.int())),
127
+ });
128
+ /** Result of candidate extraction from a transcript chunk. */
129
+ export const ExtractionResultSchema = Schema.Struct({
130
+ candidates: Schema.Array(ExtractedCandidateSchema),
131
+ sourceChunk: TranscriptChunkSchema,
132
+ wasExtracted: Schema.Boolean,
133
+ metadata: Schema.optional(Schema.Struct({
134
+ model: Schema.optional(Schema.String),
135
+ tokensUsed: Schema.optional(Schema.Number.pipe(Schema.int())),
136
+ durationMs: Schema.optional(Schema.Number),
137
+ })),
138
+ });
30
139
  //# sourceMappingURL=candidate.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"candidate.js","sourceRoot":"","sources":["../src/candidate.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAWH;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,CAAU,CAAA;AAgBvE;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,cAAc;IACd,SAAS;IACT,aAAa;IACb,UAAU;IACV,WAAW;IACX,SAAS;IACT,UAA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QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC;CAC1D,CAAC,CAAA;AAGF,8DAA8D;AAC9D,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAC,MAAM,CAAC;IAClD,UAAU,EAAE,MAAM,CAAC,KAAK,CAAC,wBAAwB,CAAC;IAClD,WAAW,EAAE,qBAAqB;IAClC,YAAY,EAAE,MAAM,CAAC,OAAO;IAC5B,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;QACtC,KAAK,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;QACrC,UAAU,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC;QAC7D,UAAU,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;KAC3C,CAAC,CAAC;CACJ,CAAC,CAAA"}
@@ -0,0 +1,130 @@
1
+ /**
2
+ * Cycle types for tx
3
+ *
4
+ * Type definitions for the cycle-based issue discovery system.
5
+ * Core type definitions using Effect Schema (Doctrine Rule 10).
6
+ *
7
+ * Cycles dispatch sub-agent swarms to scan for codebase issues,
8
+ * deduplicate findings against known issues, and optionally fix them.
9
+ */
10
+ import { Schema } from "effect";
11
+ export declare const FINDING_SEVERITIES: readonly ["high", "medium", "low"];
12
+ export declare const LOSS_WEIGHTS: {
13
+ readonly high: 3;
14
+ readonly medium: 2;
15
+ readonly low: 1;
16
+ };
17
+ /** Severity level for a finding. */
18
+ export declare const FindingSeveritySchema: Schema.Literal<["high", "medium", "low"]>;
19
+ export type FindingSeverity = typeof FindingSeveritySchema.Type;
20
+ /** A single issue found by a scan agent. */
21
+ export declare const FindingSchema: Schema.Struct<{
22
+ title: typeof Schema.String;
23
+ description: typeof Schema.String;
24
+ severity: Schema.Literal<["high", "medium", "low"]>;
25
+ issueType: typeof Schema.String;
26
+ file: typeof Schema.String;
27
+ line: typeof Schema.Number;
28
+ }>;
29
+ export type Finding = typeof FindingSchema.Type;
30
+ /** A duplicate finding mapped to an existing issue. */
31
+ export declare const DuplicateSchema: Schema.Struct<{
32
+ findingIdx: typeof Schema.Number;
33
+ existingIssueId: typeof Schema.String;
34
+ reason: typeof Schema.String;
35
+ }>;
36
+ export type Duplicate = typeof DuplicateSchema.Type;
37
+ /** Result of deduplication: new issues and identified duplicates. */
38
+ export declare const DedupResultSchema: Schema.Struct<{
39
+ newIssues: Schema.Array$<Schema.Struct<{
40
+ title: typeof Schema.String;
41
+ description: typeof Schema.String;
42
+ severity: Schema.Literal<["high", "medium", "low"]>;
43
+ issueType: typeof Schema.String;
44
+ file: typeof Schema.String;
45
+ line: typeof Schema.Number;
46
+ }>>;
47
+ duplicates: Schema.Array$<Schema.Struct<{
48
+ findingIdx: typeof Schema.Number;
49
+ existingIssueId: typeof Schema.String;
50
+ reason: typeof Schema.String;
51
+ }>>;
52
+ }>;
53
+ export type DedupResult = typeof DedupResultSchema.Type;
54
+ /** Configuration for a cycle scan run. */
55
+ export declare const CycleConfigSchema: Schema.Struct<{
56
+ taskPrompt: typeof Schema.String;
57
+ scanPrompt: typeof Schema.String;
58
+ name: Schema.optional<typeof Schema.String>;
59
+ description: Schema.optional<typeof Schema.String>;
60
+ cycles: Schema.optional<Schema.filter<Schema.filter<typeof Schema.Number>>>;
61
+ maxRounds: Schema.optional<Schema.filter<Schema.filter<typeof Schema.Number>>>;
62
+ agents: Schema.optional<Schema.filter<Schema.filter<typeof Schema.Number>>>;
63
+ model: Schema.optional<typeof Schema.String>;
64
+ fix: Schema.optional<typeof Schema.Boolean>;
65
+ scanOnly: Schema.optional<typeof Schema.Boolean>;
66
+ dryRun: Schema.optional<typeof Schema.Boolean>;
67
+ score: Schema.optional<Schema.filter<typeof Schema.Number>>;
68
+ }>;
69
+ export type CycleConfig = typeof CycleConfigSchema.Type;
70
+ /** Metrics for a single round within a cycle. */
71
+ export declare const RoundMetricsSchema: Schema.Struct<{
72
+ cycle: Schema.filter<typeof Schema.Number>;
73
+ round: Schema.filter<typeof Schema.Number>;
74
+ loss: typeof Schema.Number;
75
+ newIssues: Schema.filter<typeof Schema.Number>;
76
+ existingIssues: Schema.filter<typeof Schema.Number>;
77
+ duplicates: Schema.filter<typeof Schema.Number>;
78
+ high: Schema.filter<typeof Schema.Number>;
79
+ medium: Schema.filter<typeof Schema.Number>;
80
+ low: Schema.filter<typeof Schema.Number>;
81
+ }>;
82
+ export type RoundMetrics = typeof RoundMetricsSchema.Type;
83
+ /** Result of a completed cycle. */
84
+ export declare const CycleResultSchema: Schema.Struct<{
85
+ cycleRunId: typeof Schema.String;
86
+ cycle: Schema.filter<typeof Schema.Number>;
87
+ name: typeof Schema.String;
88
+ description: typeof Schema.String;
89
+ rounds: Schema.filter<typeof Schema.Number>;
90
+ totalNewIssues: Schema.filter<typeof Schema.Number>;
91
+ existingIssues: Schema.filter<typeof Schema.Number>;
92
+ finalLoss: typeof Schema.Number;
93
+ converged: typeof Schema.Boolean;
94
+ }>;
95
+ export type CycleResult = typeof CycleResultSchema.Type;
96
+ /** Progress events emitted during cycle scan — keeps service UI-agnostic. */
97
+ export type CycleProgressEvent = {
98
+ type: "cycle_start";
99
+ cycle: number;
100
+ totalCycles: number;
101
+ name: string;
102
+ } | {
103
+ type: "scan_complete";
104
+ cycle: number;
105
+ round: number;
106
+ findings: number;
107
+ durationMs: number;
108
+ } | {
109
+ type: "dedup_complete";
110
+ cycle: number;
111
+ round: number;
112
+ newIssues: number;
113
+ duplicates: number;
114
+ } | {
115
+ type: "round_loss";
116
+ cycle: number;
117
+ round: number;
118
+ loss: number;
119
+ high: number;
120
+ medium: number;
121
+ low: number;
122
+ } | {
123
+ type: "converged";
124
+ cycle: number;
125
+ round: number;
126
+ } | {
127
+ type: "cycle_complete";
128
+ result: CycleResult;
129
+ };
130
+ //# sourceMappingURL=cyc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