@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
package/dist/cycle.js ADDED
@@ -0,0 +1,89 @@
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
+ // =============================================================================
12
+ // CONSTANTS
13
+ // =============================================================================
14
+ export const FINDING_SEVERITIES = ["high", "medium", "low"];
15
+ export const LOSS_WEIGHTS = { high: 3, medium: 2, low: 1 };
16
+ // =============================================================================
17
+ // SCHEMAS & TYPES — Finding
18
+ // =============================================================================
19
+ /** Severity level for a finding. */
20
+ export const FindingSeveritySchema = Schema.Literal(...FINDING_SEVERITIES);
21
+ /** A single issue found by a scan agent. */
22
+ export const FindingSchema = Schema.Struct({
23
+ title: Schema.String,
24
+ description: Schema.String,
25
+ severity: FindingSeveritySchema,
26
+ issueType: Schema.String,
27
+ file: Schema.String,
28
+ line: Schema.Number,
29
+ });
30
+ // =============================================================================
31
+ // SCHEMAS & TYPES — Dedup
32
+ // =============================================================================
33
+ /** A duplicate finding mapped to an existing issue. */
34
+ export const DuplicateSchema = Schema.Struct({
35
+ findingIdx: Schema.Number,
36
+ existingIssueId: Schema.String,
37
+ reason: Schema.String,
38
+ });
39
+ /** Result of deduplication: new issues and identified duplicates. */
40
+ export const DedupResultSchema = Schema.Struct({
41
+ newIssues: Schema.Array(FindingSchema),
42
+ duplicates: Schema.Array(DuplicateSchema),
43
+ });
44
+ // =============================================================================
45
+ // SCHEMAS & TYPES — Cycle Config
46
+ // =============================================================================
47
+ /** Configuration for a cycle scan run. */
48
+ export const CycleConfigSchema = Schema.Struct({
49
+ taskPrompt: Schema.String,
50
+ scanPrompt: Schema.String,
51
+ name: Schema.optional(Schema.String),
52
+ description: Schema.optional(Schema.String),
53
+ cycles: Schema.optional(Schema.Number.pipe(Schema.int(), Schema.positive())),
54
+ maxRounds: Schema.optional(Schema.Number.pipe(Schema.int(), Schema.positive())),
55
+ agents: Schema.optional(Schema.Number.pipe(Schema.int(), Schema.positive())),
56
+ model: Schema.optional(Schema.String),
57
+ fix: Schema.optional(Schema.Boolean),
58
+ scanOnly: Schema.optional(Schema.Boolean),
59
+ dryRun: Schema.optional(Schema.Boolean),
60
+ score: Schema.optional(Schema.Number.pipe(Schema.int())),
61
+ });
62
+ // =============================================================================
63
+ // SCHEMAS & TYPES — Metrics
64
+ // =============================================================================
65
+ /** Metrics for a single round within a cycle. */
66
+ export const RoundMetricsSchema = Schema.Struct({
67
+ cycle: Schema.Number.pipe(Schema.int()),
68
+ round: Schema.Number.pipe(Schema.int()),
69
+ loss: Schema.Number,
70
+ newIssues: Schema.Number.pipe(Schema.int()),
71
+ existingIssues: Schema.Number.pipe(Schema.int()),
72
+ duplicates: Schema.Number.pipe(Schema.int()),
73
+ high: Schema.Number.pipe(Schema.int()),
74
+ medium: Schema.Number.pipe(Schema.int()),
75
+ low: Schema.Number.pipe(Schema.int()),
76
+ });
77
+ /** Result of a completed cycle. */
78
+ export const CycleResultSchema = Schema.Struct({
79
+ cycleRunId: Schema.String,
80
+ cycle: Schema.Number.pipe(Schema.int()),
81
+ name: Schema.String,
82
+ description: Schema.String,
83
+ rounds: Schema.Number.pipe(Schema.int()),
84
+ totalNewIssues: Schema.Number.pipe(Schema.int()),
85
+ existingIssues: Schema.Number.pipe(Schema.int()),
86
+ finalLoss: Schema.Number,
87
+ converged: Schema.Boolean,
88
+ });
89
+ //# sourceMappingURL=cycle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cycle.js","sourceRoot":"","sources":["../src/cycle.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE/B,gFAAgF;AAChF,YAAY;AACZ,gFAAgF;AAEhF,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,CAAU,CAAA;AAEpE,MAAM,CAAC,MAAM,YAAY,GAAG,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAW,CAAA;AAEnE,gFAAgF;AAChF,4BAA4B;AAC5B,gFAAgF;AAEhF,oCAAoC;AACpC,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,kBAAkB,CAAC,CAAA;AAG1E,4CAA4C;AAC5C,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC;IACzC,KAAK,EAAE,MAAM,CAAC,MAAM;IACpB,WAAW,EAAE,MAAM,CAAC,MAAM;IAC1B,QAAQ,EAAE,qBAAqB;IAC/B,SAAS,EAAE,MAAM,CAAC,MAAM;IACxB,IAAI,EAAE,MAAM,CAAC,MAAM;IACnB,IAAI,EAAE,MAAM,CAAC,MAAM;CACpB,CAAC,CAAA;AAGF,gFAAgF;AAChF,0BAA0B;AAC1B,gFAAgF;AAEhF,uDAAuD;AACvD,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC;IAC3C,UAAU,EAAE,MAAM,CAAC,MAAM;IACzB,eAAe,EAAE,MAAM,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IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC;IACvC,IAAI,EAAE,MAAM,CAAC,MAAM;IACnB,WAAW,EAAE,MAAM,CAAC,MAAM;IAC1B,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC;IACxC,cAAc,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC;IAChD,cAAc,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC;IAChD,SAAS,EAAE,MAAM,CAAC,MAAM;IACxB,SAAS,EAAE,MAAM,CAAC,OAAO;CAC1B,CAAC,CAAA"}
@@ -3,34 +3,83 @@
3
3
  *
4
4
  * Type definitions for JSONL line deduplication and file progress tracking.
5
5
  * Used by the telemetry daemon to avoid re-processing already-seen content.
6
- * Zero runtime dependencies - pure TypeScript types only.
7
- */
8
- /**
9
- * Processed hash ID (auto-incremented integer).
6
+ * Core type definitions using Effect Schema (Doctrine Rule 10).
7
+ * Schema definitions provide both compile-time types and runtime validation.
10
8
  */
9
+ import { Schema } from "effect";
10
+ /** Processed hash ID (auto-incremented integer). */
11
11
  export type ProcessedHashId = number;
12
- /**
13
- * A processed JSONL line hash record.
14
- * Tracks unique content by SHA256 hash for deduplication.
15
- */
16
- export interface ProcessedHash {
17
- readonly id: ProcessedHashId;
18
- readonly contentHash: string;
19
- readonly sourceFile: string;
20
- readonly sourceLine: number;
21
- readonly processedAt: Date;
22
- }
23
- /**
24
- * Input for recording a processed hash.
25
- */
26
- export interface CreateProcessedHashInput {
27
- readonly contentHash: string;
28
- readonly sourceFile: string;
29
- readonly sourceLine: number;
30
- }
31
- /**
32
- * Database row type for processed_hashes (snake_case from SQLite).
33
- */
12
+ /** A processed JSONL line hash record. */
13
+ export declare const ProcessedHashSchema: Schema.Struct<{
14
+ id: Schema.filter<typeof Schema.Number>;
15
+ contentHash: typeof Schema.String;
16
+ sourceFile: typeof Schema.String;
17
+ sourceLine: Schema.filter<typeof Schema.Number>;
18
+ processedAt: typeof Schema.DateFromSelf;
19
+ }>;
20
+ export type ProcessedHash = typeof ProcessedHashSchema.Type;
21
+ /** Input for recording a processed hash. */
22
+ export declare const CreateProcessedHashInputSchema: Schema.Struct<{
23
+ contentHash: typeof Schema.String;
24
+ sourceFile: typeof Schema.String;
25
+ sourceLine: Schema.filter<typeof Schema.Number>;
26
+ }>;
27
+ export type CreateProcessedHashInput = typeof CreateProcessedHashInputSchema.Type;
28
+ /** File progress ID (auto-incremented integer). */
29
+ export type FileProgressId = number;
30
+ /** File processing progress record. */
31
+ export declare const FileProgressSchema: Schema.Struct<{
32
+ id: Schema.filter<typeof Schema.Number>;
33
+ filePath: typeof Schema.String;
34
+ lastLineProcessed: Schema.filter<typeof Schema.Number>;
35
+ lastByteOffset: Schema.filter<typeof Schema.Number>;
36
+ fileSize: Schema.NullOr<Schema.filter<typeof Schema.Number>>;
37
+ fileChecksum: Schema.NullOr<typeof Schema.String>;
38
+ lastProcessedAt: typeof Schema.DateFromSelf;
39
+ }>;
40
+ export type FileProgress = typeof FileProgressSchema.Type;
41
+ /** Input for creating/updating file progress. */
42
+ export declare const UpsertFileProgressInputSchema: Schema.Struct<{
43
+ filePath: typeof Schema.String;
44
+ lastLineProcessed: Schema.filter<typeof Schema.Number>;
45
+ lastByteOffset: Schema.filter<typeof Schema.Number>;
46
+ fileSize: Schema.optional<Schema.filter<typeof Schema.Number>>;
47
+ fileChecksum: Schema.optional<typeof Schema.String>;
48
+ }>;
49
+ export type UpsertFileProgressInput = typeof UpsertFileProgressInputSchema.Type;
50
+ /** Result of checking if a hash exists. */
51
+ export declare const HashCheckResultSchema: Schema.Struct<{
52
+ exists: typeof Schema.Boolean;
53
+ hash: typeof Schema.String;
54
+ }>;
55
+ export type HashCheckResult = typeof HashCheckResultSchema.Type;
56
+ /** Result of processing a JSONL line. */
57
+ export declare const LineProcessResultSchema: Schema.Struct<{
58
+ hash: typeof Schema.String;
59
+ isNew: typeof Schema.Boolean;
60
+ lineNumber: Schema.filter<typeof Schema.Number>;
61
+ content: typeof Schema.String;
62
+ }>;
63
+ export type LineProcessResult = typeof LineProcessResultSchema.Type;
64
+ /** Result of processing a file. */
65
+ export declare const FileProcessResultSchema: Schema.Struct<{
66
+ filePath: typeof Schema.String;
67
+ totalLines: Schema.filter<typeof Schema.Number>;
68
+ newLines: Schema.filter<typeof Schema.Number>;
69
+ skippedLines: Schema.filter<typeof Schema.Number>;
70
+ startLine: Schema.filter<typeof Schema.Number>;
71
+ endLine: Schema.filter<typeof Schema.Number>;
72
+ duration: typeof Schema.Number;
73
+ }>;
74
+ export type FileProcessResult = typeof FileProcessResultSchema.Type;
75
+ /** Options for deduplication processing. */
76
+ export declare const DeduplicationOptionsSchema: Schema.Struct<{
77
+ batchSize: Schema.optional<Schema.filter<typeof Schema.Number>>;
78
+ startLine: Schema.optional<Schema.filter<typeof Schema.Number>>;
79
+ maxLines: Schema.optional<Schema.filter<typeof Schema.Number>>;
80
+ }>;
81
+ export type DeduplicationOptions = typeof DeduplicationOptionsSchema.Type;
82
+ /** Database row type for processed_hashes (snake_case from SQLite). */
34
83
  export interface ProcessedHashRow {
35
84
  id: number;
36
85
  content_hash: string;
@@ -38,36 +87,7 @@ export interface ProcessedHashRow {
38
87
  source_line: number;
39
88
  processed_at: string;
40
89
  }
41
- /**
42
- * File progress ID (auto-incremented integer).
43
- */
44
- export type FileProgressId = number;
45
- /**
46
- * File processing progress record.
47
- * Tracks how far we've processed a JSONL file for incremental processing.
48
- */
49
- export interface FileProgress {
50
- readonly id: FileProgressId;
51
- readonly filePath: string;
52
- readonly lastLineProcessed: number;
53
- readonly lastByteOffset: number;
54
- readonly fileSize: number | null;
55
- readonly fileChecksum: string | null;
56
- readonly lastProcessedAt: Date;
57
- }
58
- /**
59
- * Input for creating/updating file progress.
60
- */
61
- export interface UpsertFileProgressInput {
62
- readonly filePath: string;
63
- readonly lastLineProcessed: number;
64
- readonly lastByteOffset: number;
65
- readonly fileSize?: number;
66
- readonly fileChecksum?: string;
67
- }
68
- /**
69
- * Database row type for file_progress (snake_case from SQLite).
70
- */
90
+ /** Database row type for file_progress (snake_case from SQLite). */
71
91
  export interface FileProgressRow {
72
92
  id: number;
73
93
  file_path: string;
@@ -77,40 +97,4 @@ export interface FileProgressRow {
77
97
  file_checksum: string | null;
78
98
  last_processed_at: string;
79
99
  }
80
- /**
81
- * Result of checking if a hash exists.
82
- */
83
- export interface HashCheckResult {
84
- readonly exists: boolean;
85
- readonly hash: string;
86
- }
87
- /**
88
- * Result of processing a JSONL line.
89
- */
90
- export interface LineProcessResult {
91
- readonly hash: string;
92
- readonly isNew: boolean;
93
- readonly lineNumber: number;
94
- readonly content: string;
95
- }
96
- /**
97
- * Result of processing a file.
98
- */
99
- export interface FileProcessResult {
100
- readonly filePath: string;
101
- readonly totalLines: number;
102
- readonly newLines: number;
103
- readonly skippedLines: number;
104
- readonly startLine: number;
105
- readonly endLine: number;
106
- readonly duration: number;
107
- }
108
- /**
109
- * Options for deduplication processing.
110
- */
111
- export interface DeduplicationOptions {
112
- readonly batchSize?: number;
113
- readonly startLine?: number;
114
- readonly maxLines?: number;
115
- }
116
100
  //# sourceMappingURL=deduplication.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"deduplication.d.ts","sourceRoot":"","sources":["../src/deduplication.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC;AAErC;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,EAAE,EAAE,eAAe,CAAC;IAC7B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,WAAW,EAAE,IAAI,CAAC;CAC5B;AAED;;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,MAAM,CAAC;CACtB;AAED,oEAAoE;AACpE,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,gBAAgB,EAAE,MAAM,CAAC;IACzB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,iBAAiB,EAAE,MAAM,CAAC;CAC3B"}
@@ -3,7 +3,68 @@
3
3
  *
4
4
  * Type definitions for JSONL line deduplication and file progress tracking.
5
5
  * Used by the telemetry daemon to avoid re-processing already-seen content.
6
- * Zero runtime dependencies - pure TypeScript types only.
6
+ * Core type definitions using Effect Schema (Doctrine Rule 10).
7
+ * Schema definitions provide both compile-time types and runtime validation.
7
8
  */
8
- export {};
9
+ import { Schema } from "effect";
10
+ /** A processed JSONL line hash record. */
11
+ export const ProcessedHashSchema = Schema.Struct({
12
+ id: Schema.Number.pipe(Schema.int()),
13
+ contentHash: Schema.String,
14
+ sourceFile: Schema.String,
15
+ sourceLine: Schema.Number.pipe(Schema.int()),
16
+ processedAt: Schema.DateFromSelf,
17
+ });
18
+ /** Input for recording a processed hash. */
19
+ export const CreateProcessedHashInputSchema = Schema.Struct({
20
+ contentHash: Schema.String,
21
+ sourceFile: Schema.String,
22
+ sourceLine: Schema.Number.pipe(Schema.int()),
23
+ });
24
+ /** File processing progress record. */
25
+ export const FileProgressSchema = Schema.Struct({
26
+ id: Schema.Number.pipe(Schema.int()),
27
+ filePath: Schema.String,
28
+ lastLineProcessed: Schema.Number.pipe(Schema.int()),
29
+ lastByteOffset: Schema.Number.pipe(Schema.int()),
30
+ fileSize: Schema.NullOr(Schema.Number.pipe(Schema.int())),
31
+ fileChecksum: Schema.NullOr(Schema.String),
32
+ lastProcessedAt: Schema.DateFromSelf,
33
+ });
34
+ /** Input for creating/updating file progress. */
35
+ export const UpsertFileProgressInputSchema = Schema.Struct({
36
+ filePath: Schema.String,
37
+ lastLineProcessed: Schema.Number.pipe(Schema.int()),
38
+ lastByteOffset: Schema.Number.pipe(Schema.int()),
39
+ fileSize: Schema.optional(Schema.Number.pipe(Schema.int())),
40
+ fileChecksum: Schema.optional(Schema.String),
41
+ });
42
+ /** Result of checking if a hash exists. */
43
+ export const HashCheckResultSchema = Schema.Struct({
44
+ exists: Schema.Boolean,
45
+ hash: Schema.String,
46
+ });
47
+ /** Result of processing a JSONL line. */
48
+ export const LineProcessResultSchema = Schema.Struct({
49
+ hash: Schema.String,
50
+ isNew: Schema.Boolean,
51
+ lineNumber: Schema.Number.pipe(Schema.int()),
52
+ content: Schema.String,
53
+ });
54
+ /** Result of processing a file. */
55
+ export const FileProcessResultSchema = Schema.Struct({
56
+ filePath: Schema.String,
57
+ totalLines: Schema.Number.pipe(Schema.int()),
58
+ newLines: Schema.Number.pipe(Schema.int()),
59
+ skippedLines: Schema.Number.pipe(Schema.int()),
60
+ startLine: Schema.Number.pipe(Schema.int()),
61
+ endLine: Schema.Number.pipe(Schema.int()),
62
+ duration: Schema.Number,
63
+ });
64
+ /** Options for deduplication processing. */
65
+ export const DeduplicationOptionsSchema = Schema.Struct({
66
+ batchSize: Schema.optional(Schema.Number.pipe(Schema.int())),
67
+ startLine: Schema.optional(Schema.Number.pipe(Schema.int())),
68
+ maxLines: Schema.optional(Schema.Number.pipe(Schema.int())),
69
+ });
9
70
  //# sourceMappingURL=deduplication.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"deduplication.js","sourceRoot":"","sources":["../src/deduplication.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
1
+ {"version":3,"file":"deduplication.js","sourceRoot":"","sources":["../src/deduplication.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAS/B,0CAA0C;AAC1C,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC,MAAM,CAAC;IAC/C,EAA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AAC;IAC9C,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC;IAC3C,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC;IACzC,QAAQ,EAAE,MAAM,CAAC,MAAM;CACxB,CAAC,CAAA;AAGF,4CAA4C;AAC5C,MAAM,CAAC,MAAM,0BAA0B,GAAG,MAAM,CAAC,MAAM,CAAC;IACtD,SAAS,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC;IAC5D,SAAS,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC;IAC5D,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC;CAC5D,CAAC,CAAA"}
package/dist/doc.d.ts ADDED
@@ -0,0 +1,269 @@
1
+ /**
2
+ * Doc types for tx
3
+ *
4
+ * Type definitions for the docs-as-primitives system.
5
+ * See DD-023 for specification.
6
+ * Core type definitions using Effect Schema (Doctrine Rule 10).
7
+ *
8
+ * Docs are structured YAML (source of truth) with rendered MD views.
9
+ * YAML content lives on disk (.tx/docs/); DB stores metadata + links only.
10
+ */
11
+ import { Schema } from "effect";
12
+ export declare const DOC_KINDS: readonly ["overview", "prd", "design"];
13
+ export declare const DOC_STATUSES: readonly ["changing", "locked"];
14
+ export declare const DOC_LINK_TYPES: readonly ["overview_to_prd", "overview_to_design", "prd_to_design", "design_patch"];
15
+ export declare const TASK_DOC_LINK_TYPES: readonly ["implements", "references"];
16
+ export declare const INVARIANT_ENFORCEMENT_TYPES: readonly ["integration_test", "linter", "llm_as_judge"];
17
+ export declare const INVARIANT_STATUSES: readonly ["active", "deprecated"];
18
+ /** Doc kind — overview (one per project), prd, or design. */
19
+ export declare const DocKindSchema: Schema.Literal<["overview", "prd", "design"]>;
20
+ export type DocKind = typeof DocKindSchema.Type;
21
+ /** Doc status — changing (editable) or locked (immutable). */
22
+ export declare const DocStatusSchema: Schema.Literal<["changing", "locked"]>;
23
+ export type DocStatus = typeof DocStatusSchema.Type;
24
+ /** Doc link type — directed edge between docs in the DAG. */
25
+ export declare const DocLinkTypeSchema: Schema.Literal<["overview_to_prd", "overview_to_design", "prd_to_design", "design_patch"]>;
26
+ export type DocLinkType = typeof DocLinkTypeSchema.Type;
27
+ /** Task-doc link type — how a task relates to a doc. */
28
+ export declare const TaskDocLinkTypeSchema: Schema.Literal<["implements", "references"]>;
29
+ export type TaskDocLinkType = typeof TaskDocLinkTypeSchema.Type;
30
+ /** Doc ID — branded integer. */
31
+ export declare const DocIdSchema: Schema.brand<Schema.filter<typeof Schema.Number>, "DocId">;
32
+ export type DocId = typeof DocIdSchema.Type;
33
+ /** Core doc entity (DB metadata — YAML content lives on disk only). */
34
+ export declare const DocSchema: Schema.Struct<{
35
+ id: Schema.brand<Schema.filter<typeof Schema.Number>, "DocId">;
36
+ hash: typeof Schema.String;
37
+ kind: Schema.Literal<["overview", "prd", "design"]>;
38
+ name: typeof Schema.String;
39
+ title: typeof Schema.String;
40
+ version: Schema.filter<typeof Schema.Number>;
41
+ status: Schema.Literal<["changing", "locked"]>;
42
+ filePath: typeof Schema.String;
43
+ parentDocId: Schema.NullOr<Schema.brand<Schema.filter<typeof Schema.Number>, "DocId">>;
44
+ createdAt: typeof Schema.DateFromSelf;
45
+ lockedAt: Schema.NullOr<typeof Schema.DateFromSelf>;
46
+ metadata: Schema.Record$<typeof Schema.String, typeof Schema.Unknown>;
47
+ }>;
48
+ export type Doc = typeof DocSchema.Type;
49
+ /** Doc with resolved links (for API responses). */
50
+ export declare const DocWithLinksSchema: Schema.Struct<{
51
+ linksTo: Schema.Array$<Schema.Struct<{
52
+ docId: Schema.brand<Schema.filter<typeof Schema.Number>, "DocId">;
53
+ docName: typeof Schema.String;
54
+ linkType: Schema.Literal<["overview_to_prd", "overview_to_design", "prd_to_design", "design_patch"]>;
55
+ }>>;
56
+ linksFrom: Schema.Array$<Schema.Struct<{
57
+ docId: Schema.brand<Schema.filter<typeof Schema.Number>, "DocId">;
58
+ docName: typeof Schema.String;
59
+ linkType: Schema.Literal<["overview_to_prd", "overview_to_design", "prd_to_design", "design_patch"]>;
60
+ }>>;
61
+ taskIds: Schema.Array$<typeof Schema.String>;
62
+ invariantCount: Schema.filter<typeof Schema.Number>;
63
+ id: Schema.brand<Schema.filter<typeof Schema.Number>, "DocId">;
64
+ hash: typeof Schema.String;
65
+ kind: Schema.Literal<["overview", "prd", "design"]>;
66
+ name: typeof Schema.String;
67
+ title: typeof Schema.String;
68
+ version: Schema.filter<typeof Schema.Number>;
69
+ status: Schema.Literal<["changing", "locked"]>;
70
+ filePath: typeof Schema.String;
71
+ parentDocId: Schema.NullOr<Schema.brand<Schema.filter<typeof Schema.Number>, "DocId">>;
72
+ createdAt: typeof Schema.DateFromSelf;
73
+ lockedAt: Schema.NullOr<typeof Schema.DateFromSelf>;
74
+ metadata: Schema.Record$<typeof Schema.String, typeof Schema.Unknown>;
75
+ }>;
76
+ export type DocWithLinks = typeof DocWithLinksSchema.Type;
77
+ /** Doc link entity. */
78
+ export declare const DocLinkSchema: Schema.Struct<{
79
+ id: Schema.filter<typeof Schema.Number>;
80
+ fromDocId: Schema.brand<Schema.filter<typeof Schema.Number>, "DocId">;
81
+ toDocId: Schema.brand<Schema.filter<typeof Schema.Number>, "DocId">;
82
+ linkType: Schema.Literal<["overview_to_prd", "overview_to_design", "prd_to_design", "design_patch"]>;
83
+ createdAt: typeof Schema.DateFromSelf;
84
+ }>;
85
+ export type DocLink = typeof DocLinkSchema.Type;
86
+ /** Task-doc link entity. */
87
+ export declare const TaskDocLinkSchema: Schema.Struct<{
88
+ id: Schema.filter<typeof Schema.Number>;
89
+ taskId: typeof Schema.String;
90
+ docId: Schema.brand<Schema.filter<typeof Schema.Number>, "DocId">;
91
+ linkType: Schema.Literal<["implements", "references"]>;
92
+ createdAt: typeof Schema.DateFromSelf;
93
+ }>;
94
+ export type TaskDocLink = typeof TaskDocLinkSchema.Type;
95
+ /** Input for creating a new doc. */
96
+ export declare const CreateDocInputSchema: Schema.Struct<{
97
+ kind: Schema.Literal<["overview", "prd", "design"]>;
98
+ name: typeof Schema.String;
99
+ title: typeof Schema.String;
100
+ yamlContent: typeof Schema.String;
101
+ metadata: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.Unknown>>;
102
+ }>;
103
+ export type CreateDocInput = typeof CreateDocInputSchema.Type;
104
+ /** Invariant enforcement type — how the invariant is verified. */
105
+ export declare const InvariantEnforcementSchema: Schema.Literal<["integration_test", "linter", "llm_as_judge"]>;
106
+ export type InvariantEnforcement = typeof InvariantEnforcementSchema.Type;
107
+ /** Invariant status. */
108
+ export declare const InvariantStatusSchema: Schema.Literal<["active", "deprecated"]>;
109
+ export type InvariantStatus = typeof InvariantStatusSchema.Type;
110
+ /** Invariant ID — branded string matching INV-[A-Z0-9-]+. */
111
+ export declare const InvariantIdSchema: Schema.brand<Schema.filter<typeof Schema.String>, "InvariantId">;
112
+ export type InvariantId = typeof InvariantIdSchema.Type;
113
+ /** Invariant entity — a machine-checkable system rule. */
114
+ export declare const InvariantSchema: Schema.Struct<{
115
+ id: Schema.brand<Schema.filter<typeof Schema.String>, "InvariantId">;
116
+ rule: typeof Schema.String;
117
+ enforcement: Schema.Literal<["integration_test", "linter", "llm_as_judge"]>;
118
+ docId: Schema.brand<Schema.filter<typeof Schema.Number>, "DocId">;
119
+ subsystem: Schema.NullOr<typeof Schema.String>;
120
+ testRef: Schema.NullOr<typeof Schema.String>;
121
+ lintRule: Schema.NullOr<typeof Schema.String>;
122
+ promptRef: Schema.NullOr<typeof Schema.String>;
123
+ status: Schema.Literal<["active", "deprecated"]>;
124
+ createdAt: typeof Schema.DateFromSelf;
125
+ metadata: Schema.Record$<typeof Schema.String, typeof Schema.Unknown>;
126
+ }>;
127
+ export type Invariant = typeof InvariantSchema.Type;
128
+ /** Invariant check result — audit trail entry. */
129
+ export declare const InvariantCheckSchema: Schema.Struct<{
130
+ id: Schema.filter<typeof Schema.Number>;
131
+ invariantId: Schema.brand<Schema.filter<typeof Schema.String>, "InvariantId">;
132
+ passed: typeof Schema.Boolean;
133
+ details: Schema.NullOr<typeof Schema.String>;
134
+ checkedAt: typeof Schema.DateFromSelf;
135
+ durationMs: Schema.NullOr<Schema.filter<typeof Schema.Number>>;
136
+ }>;
137
+ export type InvariantCheck = typeof InvariantCheckSchema.Type;
138
+ /** Input for upserting an invariant (from YAML sync). */
139
+ export declare const UpsertInvariantInputSchema: Schema.Struct<{
140
+ id: typeof Schema.String;
141
+ rule: typeof Schema.String;
142
+ enforcement: Schema.Literal<["integration_test", "linter", "llm_as_judge"]>;
143
+ docId: Schema.brand<Schema.filter<typeof Schema.Number>, "DocId">;
144
+ subsystem: Schema.optional<Schema.NullOr<typeof Schema.String>>;
145
+ testRef: Schema.optional<Schema.NullOr<typeof Schema.String>>;
146
+ lintRule: Schema.optional<Schema.NullOr<typeof Schema.String>>;
147
+ promptRef: Schema.optional<Schema.NullOr<typeof Schema.String>>;
148
+ }>;
149
+ export type UpsertInvariantInput = typeof UpsertInvariantInputSchema.Type;
150
+ /** Input for recording an invariant check. */
151
+ export declare const RecordInvariantCheckInputSchema: Schema.Struct<{
152
+ invariantId: typeof Schema.String;
153
+ passed: typeof Schema.Boolean;
154
+ details: Schema.optional<Schema.NullOr<typeof Schema.String>>;
155
+ durationMs: Schema.optional<Schema.NullOr<Schema.filter<typeof Schema.Number>>>;
156
+ }>;
157
+ export type RecordInvariantCheckInput = typeof RecordInvariantCheckInputSchema.Type;
158
+ /**
159
+ * Check if a string is a valid doc kind.
160
+ */
161
+ export declare const isValidDocKind: (kind: string) => kind is DocKind;
162
+ export declare class InvalidDocKindError extends Error {
163
+ readonly kind: string;
164
+ constructor(kind: string);
165
+ }
166
+ export declare const assertDocKind: (kind: string) => DocKind;
167
+ /**
168
+ * Check if a string is a valid doc status.
169
+ */
170
+ export declare const isValidDocStatus: (status: string) => status is DocStatus;
171
+ export declare class InvalidDocStatusError extends Error {
172
+ readonly status: string;
173
+ constructor(status: string);
174
+ }
175
+ export declare const assertDocStatus: (status: string) => DocStatus;
176
+ /**
177
+ * Check if a string is a valid doc link type.
178
+ */
179
+ export declare const isValidDocLinkType: (linkType: string) => linkType is DocLinkType;
180
+ export declare class InvalidDocLinkTypeError extends Error {
181
+ readonly linkType: string;
182
+ constructor(linkType: string);
183
+ }
184
+ export declare const assertDocLinkType: (linkType: string) => DocLinkType;
185
+ /** Node in the doc graph. */
186
+ export declare const DocGraphNodeSchema: Schema.Struct<{
187
+ id: typeof Schema.String;
188
+ label: typeof Schema.String;
189
+ kind: Schema.Literal<["overview", "prd", "design", "task"]>;
190
+ status: Schema.optional<typeof Schema.String>;
191
+ }>;
192
+ export type DocGraphNode = typeof DocGraphNodeSchema.Type;
193
+ /** Edge in the doc graph. */
194
+ export declare const DocGraphEdgeSchema: Schema.Struct<{
195
+ source: typeof Schema.String;
196
+ target: typeof Schema.String;
197
+ type: typeof Schema.String;
198
+ }>;
199
+ export type DocGraphEdge = typeof DocGraphEdgeSchema.Type;
200
+ /** Full doc graph (nodes + edges). */
201
+ export declare const DocGraphSchema: Schema.Struct<{
202
+ nodes: Schema.Array$<Schema.Struct<{
203
+ id: typeof Schema.String;
204
+ label: typeof Schema.String;
205
+ kind: Schema.Literal<["overview", "prd", "design", "task"]>;
206
+ status: Schema.optional<typeof Schema.String>;
207
+ }>>;
208
+ edges: Schema.Array$<Schema.Struct<{
209
+ source: typeof Schema.String;
210
+ target: typeof Schema.String;
211
+ type: typeof Schema.String;
212
+ }>>;
213
+ }>;
214
+ export type DocGraph = typeof DocGraphSchema.Type;
215
+ /** Database row type for docs (snake_case from SQLite). */
216
+ export interface DocRow {
217
+ id: number;
218
+ hash: string;
219
+ kind: string;
220
+ name: string;
221
+ title: string;
222
+ version: number;
223
+ status: string;
224
+ file_path: string;
225
+ parent_doc_id: number | null;
226
+ created_at: string;
227
+ locked_at: string | null;
228
+ metadata: string | null;
229
+ }
230
+ /** Database row type for doc links. */
231
+ export interface DocLinkRow {
232
+ id: number;
233
+ from_doc_id: number;
234
+ to_doc_id: number;
235
+ link_type: string;
236
+ created_at: string;
237
+ }
238
+ /** Database row type for task-doc links. */
239
+ export interface TaskDocLinkRow {
240
+ id: number;
241
+ task_id: string;
242
+ doc_id: number;
243
+ link_type: string;
244
+ created_at: string;
245
+ }
246
+ /** Database row type for invariants. */
247
+ export interface InvariantRow {
248
+ id: string;
249
+ rule: string;
250
+ enforcement: string;
251
+ doc_id: number;
252
+ subsystem: string | null;
253
+ test_ref: string | null;
254
+ lint_rule: string | null;
255
+ prompt_ref: string | null;
256
+ status: string;
257
+ created_at: string;
258
+ metadata: string | null;
259
+ }
260
+ /** Database row type for invariant checks. */
261
+ export interface InvariantCheckRow {
262
+ id: number;
263
+ invariant_id: string;
264
+ passed: number;
265
+ details: string | null;
266
+ checked_at: string;
267
+ duration_ms: number | null;
268
+ }
269
+ //# sourceMappingURL=doc.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"doc.d.ts","sourceRoot":"","sources":["../src/doc.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAM/B,eAAO,MAAM,SAAS,wCAAyC,CAAA;AAE/D,eAAO,MAAM,YAAY,iCAAkC,CAAA;AAE3D,eAAO,MAAM,cAAc,qFAKjB,CAAA;AAEV,eAAO,MAAM,mBAAmB,uCAAwC,CAAA;AAExE,eAAO,MAAM,2BAA2B,yDAI9B,CAAA;AAEV,eAAO,MAAM,kBAAkB,mCAAoC,CAAA;AAMnE,6DAA6D;AAC7D,eAAO,MAAM,aAAa,+CAA+B,CAAA;AAC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