@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.
- package/README.md +480 -0
- package/dist/anchor.d.ts +93 -96
- package/dist/anchor.d.ts.map +1 -1
- package/dist/anchor.js +74 -1
- package/dist/anchor.js.map +1 -1
- package/dist/attempt.d.ts +36 -28
- package/dist/attempt.d.ts.map +1 -1
- package/dist/attempt.js +59 -1
- package/dist/attempt.js.map +1 -1
- package/dist/candidate.d.ts +117 -145
- package/dist/candidate.d.ts.map +1 -1
- package/dist/candidate.js +109 -0
- package/dist/candidate.js.map +1 -1
- package/dist/cycle.d.ts +130 -0
- package/dist/cycle.d.ts.map +1 -0
- package/dist/cycle.js +89 -0
- package/dist/cycle.js.map +1 -0
- package/dist/deduplication.d.ts +76 -92
- package/dist/deduplication.d.ts.map +1 -1
- package/dist/deduplication.js +63 -2
- package/dist/deduplication.js.map +1 -1
- package/dist/doc.d.ts +269 -0
- package/dist/doc.d.ts.map +1 -0
- package/dist/doc.js +232 -0
- package/dist/doc.js.map +1 -0
- package/dist/edge.d.ts +53 -56
- package/dist/edge.d.ts.map +1 -1
- package/dist/edge.js +51 -1
- package/dist/edge.js.map +1 -1
- package/dist/file-learning.d.ts +23 -28
- package/dist/file-learning.d.ts.map +1 -1
- package/dist/file-learning.js +22 -2
- package/dist/file-learning.js.map +1 -1
- package/dist/index.d.ts +14 -14
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +38 -21
- package/dist/index.js.map +1 -1
- package/dist/learning.d.ts +167 -172
- package/dist/learning.d.ts.map +1 -1
- package/dist/learning.js +109 -1
- package/dist/learning.js.map +1 -1
- package/dist/response.d.ts +636 -0
- package/dist/response.d.ts.map +1 -0
- package/dist/response.js +354 -0
- package/dist/response.js.map +1 -0
- package/dist/run.d.ts +73 -40
- package/dist/run.d.ts.map +1 -1
- package/dist/run.js +108 -1
- package/dist/run.js.map +1 -1
- package/dist/symbol.d.ts +42 -43
- package/dist/symbol.d.ts.map +1 -1
- package/dist/symbol.js +55 -1
- package/dist/symbol.js.map +1 -1
- package/dist/task.d.ts +114 -78
- package/dist/task.d.ts.map +1 -1
- package/dist/task.js +149 -2
- package/dist/task.js.map +1 -1
- package/dist/tracked-project.d.ts +24 -34
- package/dist/tracked-project.d.ts.map +1 -1
- package/dist/tracked-project.js +34 -0
- package/dist/tracked-project.js.map +1 -1
- package/package.json +7 -3
package/dist/anchor.d.ts
CHANGED
|
@@ -3,14 +3,10 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Type definitions for file/code associations (anchors) that link learnings
|
|
5
5
|
* to specific file locations, symbols, or code regions.
|
|
6
|
-
*
|
|
6
|
+
* Core type definitions using Effect Schema (Doctrine Rule 10).
|
|
7
|
+
* Schema definitions provide both compile-time types and runtime validation.
|
|
7
8
|
*/
|
|
8
|
-
|
|
9
|
-
* Branded type for anchor IDs.
|
|
10
|
-
*/
|
|
11
|
-
export type AnchorId = number & {
|
|
12
|
-
readonly _brand: unique symbol;
|
|
13
|
-
};
|
|
9
|
+
import { Schema } from "effect";
|
|
14
10
|
/**
|
|
15
11
|
* Anchor type - how the learning is associated with code.
|
|
16
12
|
* - glob: Pattern match (e.g., "src/repo/*.ts")
|
|
@@ -19,7 +15,6 @@ export type AnchorId = number & {
|
|
|
19
15
|
* - line_range: Specific line numbers
|
|
20
16
|
*/
|
|
21
17
|
export declare const ANCHOR_TYPES: readonly ["glob", "hash", "symbol", "line_range"];
|
|
22
|
-
export type AnchorType = (typeof ANCHOR_TYPES)[number];
|
|
23
18
|
/**
|
|
24
19
|
* Anchor status - validity of the file/code association.
|
|
25
20
|
* - valid: Anchor still points to correct code
|
|
@@ -27,60 +22,102 @@ export type AnchorType = (typeof ANCHOR_TYPES)[number];
|
|
|
27
22
|
* - invalid: Anchor no longer valid (file deleted, symbol removed)
|
|
28
23
|
*/
|
|
29
24
|
export declare const ANCHOR_STATUSES: readonly ["valid", "drifted", "invalid"];
|
|
30
|
-
export type AnchorStatus = (typeof ANCHOR_STATUSES)[number];
|
|
31
25
|
/**
|
|
32
|
-
*
|
|
26
|
+
* Detection source for invalidation.
|
|
33
27
|
*/
|
|
34
|
-
export
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
28
|
+
export declare const INVALIDATION_SOURCES: readonly ["periodic", "lazy", "manual", "agent", "git_hook"];
|
|
29
|
+
/** Anchor ID - branded integer. */
|
|
30
|
+
export declare const AnchorIdSchema: Schema.brand<Schema.filter<typeof Schema.Number>, "AnchorId">;
|
|
31
|
+
export type AnchorId = typeof AnchorIdSchema.Type;
|
|
32
|
+
/** Anchor type schema. */
|
|
33
|
+
export declare const AnchorTypeSchema: Schema.Literal<["glob", "hash", "symbol", "line_range"]>;
|
|
34
|
+
export type AnchorType = typeof AnchorTypeSchema.Type;
|
|
35
|
+
/** Anchor status schema. */
|
|
36
|
+
export declare const AnchorStatusSchema: Schema.Literal<["valid", "drifted", "invalid"]>;
|
|
37
|
+
export type AnchorStatus = typeof AnchorStatusSchema.Type;
|
|
38
|
+
/** Invalidation source schema. */
|
|
39
|
+
export declare const InvalidationSourceSchema: Schema.Literal<["periodic", "lazy", "manual", "agent", "git_hook"]>;
|
|
40
|
+
export type InvalidationSource = typeof InvalidationSourceSchema.Type;
|
|
41
|
+
/** Anchor entity - links a learning to a file/code location. */
|
|
42
|
+
export declare const AnchorSchema: Schema.Struct<{
|
|
43
|
+
id: Schema.brand<Schema.filter<typeof Schema.Number>, "AnchorId">;
|
|
44
|
+
learningId: Schema.filter<typeof Schema.Number>;
|
|
45
|
+
anchorType: Schema.Literal<["glob", "hash", "symbol", "line_range"]>;
|
|
46
|
+
anchorValue: typeof Schema.String;
|
|
47
|
+
filePath: typeof Schema.String;
|
|
48
|
+
symbolFqname: Schema.NullOr<typeof Schema.String>;
|
|
49
|
+
lineStart: Schema.NullOr<Schema.filter<typeof Schema.Number>>;
|
|
50
|
+
lineEnd: Schema.NullOr<Schema.filter<typeof Schema.Number>>;
|
|
51
|
+
contentHash: Schema.NullOr<typeof Schema.String>;
|
|
44
52
|
/** Original content preview for self-healing Jaccard similarity comparison */
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
readonly contentHash?: string | null;
|
|
53
|
+
contentPreview: Schema.NullOr<typeof Schema.String>;
|
|
54
|
+
status: Schema.Literal<["valid", "drifted", "invalid"]>;
|
|
55
|
+
pinned: typeof Schema.Boolean;
|
|
56
|
+
verifiedAt: Schema.NullOr<typeof Schema.DateFromSelf>;
|
|
57
|
+
createdAt: typeof Schema.DateFromSelf;
|
|
58
|
+
}>;
|
|
59
|
+
export type Anchor = typeof AnchorSchema.Type;
|
|
60
|
+
/** Input for creating a new anchor. */
|
|
61
|
+
export declare const CreateAnchorInputSchema: Schema.Struct<{
|
|
62
|
+
learningId: Schema.filter<typeof Schema.Number>;
|
|
63
|
+
anchorType: Schema.Literal<["glob", "hash", "symbol", "line_range"]>;
|
|
64
|
+
anchorValue: typeof Schema.String;
|
|
65
|
+
filePath: typeof Schema.String;
|
|
66
|
+
symbolFqname: Schema.optional<Schema.NullOr<typeof Schema.String>>;
|
|
67
|
+
lineStart: Schema.optional<Schema.NullOr<Schema.filter<typeof Schema.Number>>>;
|
|
68
|
+
lineEnd: Schema.optional<Schema.NullOr<Schema.filter<typeof Schema.Number>>>;
|
|
69
|
+
contentHash: Schema.optional<Schema.NullOr<typeof Schema.String>>;
|
|
63
70
|
/** Original content preview for self-healing comparison (max ~500 chars) */
|
|
64
|
-
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
readonly contentHash?: string | null;
|
|
71
|
+
contentPreview: Schema.optional<Schema.NullOr<typeof Schema.String>>;
|
|
72
|
+
}>;
|
|
73
|
+
export type CreateAnchorInput = typeof CreateAnchorInputSchema.Type;
|
|
74
|
+
/** Input for updating an anchor. */
|
|
75
|
+
export declare const UpdateAnchorInputSchema: Schema.Struct<{
|
|
76
|
+
anchorValue: Schema.optional<typeof Schema.String>;
|
|
77
|
+
filePath: Schema.optional<typeof Schema.String>;
|
|
78
|
+
symbolFqname: Schema.optional<Schema.NullOr<typeof Schema.String>>;
|
|
79
|
+
lineStart: Schema.optional<Schema.NullOr<Schema.filter<typeof Schema.Number>>>;
|
|
80
|
+
lineEnd: Schema.optional<Schema.NullOr<Schema.filter<typeof Schema.Number>>>;
|
|
81
|
+
contentHash: Schema.optional<Schema.NullOr<typeof Schema.String>>;
|
|
76
82
|
/** Updated content preview for self-healing comparison */
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
83
|
+
contentPreview: Schema.optional<Schema.NullOr<typeof Schema.String>>;
|
|
84
|
+
status: Schema.optional<Schema.Literal<["valid", "drifted", "invalid"]>>;
|
|
85
|
+
verifiedAt: Schema.optional<Schema.NullOr<typeof Schema.DateFromSelf>>;
|
|
86
|
+
}>;
|
|
87
|
+
export type UpdateAnchorInput = typeof UpdateAnchorInputSchema.Type;
|
|
88
|
+
/** Invalidation log entry - tracks anchor status changes. */
|
|
89
|
+
export declare const InvalidationLogSchema: Schema.Struct<{
|
|
90
|
+
id: Schema.filter<typeof Schema.Number>;
|
|
91
|
+
anchorId: Schema.filter<typeof Schema.Number>;
|
|
92
|
+
oldStatus: Schema.Literal<["valid", "drifted", "invalid"]>;
|
|
93
|
+
newStatus: Schema.Literal<["valid", "drifted", "invalid"]>;
|
|
94
|
+
reason: typeof Schema.String;
|
|
95
|
+
detectedBy: Schema.Literal<["periodic", "lazy", "manual", "agent", "git_hook"]>;
|
|
96
|
+
oldContentHash: Schema.NullOr<typeof Schema.String>;
|
|
97
|
+
newContentHash: Schema.NullOr<typeof Schema.String>;
|
|
98
|
+
similarityScore: Schema.NullOr<typeof Schema.Number>;
|
|
99
|
+
invalidatedAt: typeof Schema.DateFromSelf;
|
|
100
|
+
}>;
|
|
101
|
+
export type InvalidationLog = typeof InvalidationLogSchema.Type;
|
|
81
102
|
/**
|
|
82
|
-
*
|
|
103
|
+
* Anchor with freshness information for lazy verification.
|
|
104
|
+
* Returned by getWithVerification - includes whether anchor was fresh or verified.
|
|
83
105
|
*/
|
|
106
|
+
export interface AnchorWithFreshness {
|
|
107
|
+
readonly anchor: Anchor;
|
|
108
|
+
/** True if anchor was still within TTL, false if verification was needed */
|
|
109
|
+
readonly isFresh: boolean;
|
|
110
|
+
/** True if verification was performed (because anchor was stale) */
|
|
111
|
+
readonly wasVerified: boolean;
|
|
112
|
+
/** Verification result if verification was performed */
|
|
113
|
+
readonly verificationResult?: {
|
|
114
|
+
readonly previousStatus: AnchorStatus;
|
|
115
|
+
readonly newStatus: AnchorStatus;
|
|
116
|
+
readonly action: "unchanged" | "self_healed" | "drifted" | "invalidated";
|
|
117
|
+
readonly reason?: string;
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
/** Database row type for anchors (snake_case from SQLite). */
|
|
84
121
|
export interface AnchorRow {
|
|
85
122
|
id: number;
|
|
86
123
|
learning_id: number;
|
|
@@ -97,29 +134,7 @@ export interface AnchorRow {
|
|
|
97
134
|
verified_at: string | null;
|
|
98
135
|
created_at: string;
|
|
99
136
|
}
|
|
100
|
-
/**
|
|
101
|
-
* Detection source for invalidation.
|
|
102
|
-
*/
|
|
103
|
-
export declare const INVALIDATION_SOURCES: readonly ["periodic", "lazy", "manual", "agent", "git_hook"];
|
|
104
|
-
export type InvalidationSource = (typeof INVALIDATION_SOURCES)[number];
|
|
105
|
-
/**
|
|
106
|
-
* Invalidation log entry - tracks anchor status changes.
|
|
107
|
-
*/
|
|
108
|
-
export interface InvalidationLog {
|
|
109
|
-
readonly id: number;
|
|
110
|
-
readonly anchorId: number;
|
|
111
|
-
readonly oldStatus: AnchorStatus;
|
|
112
|
-
readonly newStatus: AnchorStatus;
|
|
113
|
-
readonly reason: string;
|
|
114
|
-
readonly detectedBy: InvalidationSource;
|
|
115
|
-
readonly oldContentHash: string | null;
|
|
116
|
-
readonly newContentHash: string | null;
|
|
117
|
-
readonly similarityScore: number | null;
|
|
118
|
-
readonly invalidatedAt: Date;
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* Database row type for invalidation log (snake_case from SQLite).
|
|
122
|
-
*/
|
|
137
|
+
/** Database row type for invalidation log (snake_case from SQLite). */
|
|
123
138
|
export interface InvalidationLogRow {
|
|
124
139
|
id: number;
|
|
125
140
|
anchor_id: number;
|
|
@@ -132,22 +147,4 @@ export interface InvalidationLogRow {
|
|
|
132
147
|
similarity_score: number | null;
|
|
133
148
|
invalidated_at: string;
|
|
134
149
|
}
|
|
135
|
-
/**
|
|
136
|
-
* Anchor with freshness information for lazy verification.
|
|
137
|
-
* Returned by getWithVerification - includes whether anchor was fresh or verified.
|
|
138
|
-
*/
|
|
139
|
-
export interface AnchorWithFreshness {
|
|
140
|
-
readonly anchor: Anchor;
|
|
141
|
-
/** True if anchor was still within TTL, false if verification was needed */
|
|
142
|
-
readonly isFresh: boolean;
|
|
143
|
-
/** True if verification was performed (because anchor was stale) */
|
|
144
|
-
readonly wasVerified: boolean;
|
|
145
|
-
/** Verification result if verification was performed */
|
|
146
|
-
readonly verificationResult?: {
|
|
147
|
-
readonly previousStatus: AnchorStatus;
|
|
148
|
-
readonly newStatus: AnchorStatus;
|
|
149
|
-
readonly action: "unchanged" | "self_healed" | "drifted" | "invalidated";
|
|
150
|
-
readonly reason?: string;
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
150
|
//# sourceMappingURL=anchor.d.ts.map
|
package/dist/anchor.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"anchor.d.ts","sourceRoot":"","sources":["../src/anchor.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"anchor.d.ts","sourceRoot":"","sources":["../src/anchor.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAM/B;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,mDAAoD,CAAC;AAE9E;;;;;GAKG;AACH,eAAO,MAAM,eAAe,0CAA2C,CAAC;AAExE;;GAEG;AACH,eAAO,MAAM,oBAAoB,8DAA+D,CAAC;AAMjG,mCAAmC;AACnC,eAAO,MAAM,cAAc,+DAG1B,CAAA;AACD,MAAM,MAAM,QAAQ,GAAG,OAAO,cAAc,CAAC,IAAI,CAAA;AAEjD,0BAA0B;AAC1B,eAAO,MAAM,gBAAgB,0DAAkC,CAAA;AAC/D,MAAM,MAAM,UAAU,GAAG,OAAO,gBAAgB,CAAC,IAAI,CAAA;AAErD,4BAA4B;AAC5B,eAAO,MAAM,kBAAkB,iDAAqC,CAAA;AACpE,MAAM,MAAM,YAAY,GAAG,OAAO,kBAAkB,CAAC,IAAI,CAAA;AAEzD,kCAAkC;AAClC,eAAO,MAAM,wBAAwB,qEAA0C,CAAA;AAC/E,MAAM,MAAM,kBAAkB,GAAG,OAAO,wBAAwB,CAAC,IAAI,CAAA;AAErE,gEAAgE;AAChE,eAAO,MAAM,YAAY;;;;;;;;;;IAUvB,8EAA8E;;;;;;EAM9E,CAAA;AACF,MAAM,MAAM,MAAM,GAAG,OAAO,YAAY,CAAC,IAAI,CAAA;AAE7C,uCAAuC;AACvC,eAAO,MAAM,uBAAuB;;;;;;;;;IASlC,4EAA4E;;EAE5E,CAAA;AACF,MAAM,MAAM,iBAAiB,GAAG,OAAO,uBAAuB,CAAC,IAAI,CAAA;AAEnE,oCAAoC;AACpC,eAAO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G,IAAI,CAAC;IAC3B,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,uEAAuE;AACvE,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,cAAc,EAAE,MAAM,CAAC;CACxB"}
|
package/dist/anchor.js
CHANGED
|
@@ -3,8 +3,13 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Type definitions for file/code associations (anchors) that link learnings
|
|
5
5
|
* to specific file locations, symbols, or code regions.
|
|
6
|
-
*
|
|
6
|
+
* Core type definitions using Effect Schema (Doctrine Rule 10).
|
|
7
|
+
* Schema definitions provide both compile-time types and runtime validation.
|
|
7
8
|
*/
|
|
9
|
+
import { Schema } from "effect";
|
|
10
|
+
// =============================================================================
|
|
11
|
+
// CONSTANTS
|
|
12
|
+
// =============================================================================
|
|
8
13
|
/**
|
|
9
14
|
* Anchor type - how the learning is associated with code.
|
|
10
15
|
* - glob: Pattern match (e.g., "src/repo/*.ts")
|
|
@@ -24,4 +29,72 @@ export const ANCHOR_STATUSES = ["valid", "drifted", "invalid"];
|
|
|
24
29
|
* Detection source for invalidation.
|
|
25
30
|
*/
|
|
26
31
|
export const INVALIDATION_SOURCES = ["periodic", "lazy", "manual", "agent", "git_hook"];
|
|
32
|
+
// =============================================================================
|
|
33
|
+
// SCHEMAS & TYPES
|
|
34
|
+
// =============================================================================
|
|
35
|
+
/** Anchor ID - branded integer. */
|
|
36
|
+
export const AnchorIdSchema = Schema.Number.pipe(Schema.int(), Schema.brand("AnchorId"));
|
|
37
|
+
/** Anchor type schema. */
|
|
38
|
+
export const AnchorTypeSchema = Schema.Literal(...ANCHOR_TYPES);
|
|
39
|
+
/** Anchor status schema. */
|
|
40
|
+
export const AnchorStatusSchema = Schema.Literal(...ANCHOR_STATUSES);
|
|
41
|
+
/** Invalidation source schema. */
|
|
42
|
+
export const InvalidationSourceSchema = Schema.Literal(...INVALIDATION_SOURCES);
|
|
43
|
+
/** Anchor entity - links a learning to a file/code location. */
|
|
44
|
+
export const AnchorSchema = Schema.Struct({
|
|
45
|
+
id: AnchorIdSchema,
|
|
46
|
+
learningId: Schema.Number.pipe(Schema.int()),
|
|
47
|
+
anchorType: AnchorTypeSchema,
|
|
48
|
+
anchorValue: Schema.String,
|
|
49
|
+
filePath: Schema.String,
|
|
50
|
+
symbolFqname: Schema.NullOr(Schema.String),
|
|
51
|
+
lineStart: Schema.NullOr(Schema.Number.pipe(Schema.int())),
|
|
52
|
+
lineEnd: Schema.NullOr(Schema.Number.pipe(Schema.int())),
|
|
53
|
+
contentHash: Schema.NullOr(Schema.String),
|
|
54
|
+
/** Original content preview for self-healing Jaccard similarity comparison */
|
|
55
|
+
contentPreview: Schema.NullOr(Schema.String),
|
|
56
|
+
status: AnchorStatusSchema,
|
|
57
|
+
pinned: Schema.Boolean,
|
|
58
|
+
verifiedAt: Schema.NullOr(Schema.DateFromSelf),
|
|
59
|
+
createdAt: Schema.DateFromSelf,
|
|
60
|
+
});
|
|
61
|
+
/** Input for creating a new anchor. */
|
|
62
|
+
export const CreateAnchorInputSchema = Schema.Struct({
|
|
63
|
+
learningId: Schema.Number.pipe(Schema.int()),
|
|
64
|
+
anchorType: AnchorTypeSchema,
|
|
65
|
+
anchorValue: Schema.String,
|
|
66
|
+
filePath: Schema.String,
|
|
67
|
+
symbolFqname: Schema.optional(Schema.NullOr(Schema.String)),
|
|
68
|
+
lineStart: Schema.optional(Schema.NullOr(Schema.Number.pipe(Schema.int()))),
|
|
69
|
+
lineEnd: Schema.optional(Schema.NullOr(Schema.Number.pipe(Schema.int()))),
|
|
70
|
+
contentHash: Schema.optional(Schema.NullOr(Schema.String)),
|
|
71
|
+
/** Original content preview for self-healing comparison (max ~500 chars) */
|
|
72
|
+
contentPreview: Schema.optional(Schema.NullOr(Schema.String)),
|
|
73
|
+
});
|
|
74
|
+
/** Input for updating an anchor. */
|
|
75
|
+
export const UpdateAnchorInputSchema = Schema.Struct({
|
|
76
|
+
anchorValue: Schema.optional(Schema.String),
|
|
77
|
+
filePath: Schema.optional(Schema.String),
|
|
78
|
+
symbolFqname: Schema.optional(Schema.NullOr(Schema.String)),
|
|
79
|
+
lineStart: Schema.optional(Schema.NullOr(Schema.Number.pipe(Schema.int()))),
|
|
80
|
+
lineEnd: Schema.optional(Schema.NullOr(Schema.Number.pipe(Schema.int()))),
|
|
81
|
+
contentHash: Schema.optional(Schema.NullOr(Schema.String)),
|
|
82
|
+
/** Updated content preview for self-healing comparison */
|
|
83
|
+
contentPreview: Schema.optional(Schema.NullOr(Schema.String)),
|
|
84
|
+
status: Schema.optional(AnchorStatusSchema),
|
|
85
|
+
verifiedAt: Schema.optional(Schema.NullOr(Schema.DateFromSelf)),
|
|
86
|
+
});
|
|
87
|
+
/** Invalidation log entry - tracks anchor status changes. */
|
|
88
|
+
export const InvalidationLogSchema = Schema.Struct({
|
|
89
|
+
id: Schema.Number.pipe(Schema.int()),
|
|
90
|
+
anchorId: Schema.Number.pipe(Schema.int()),
|
|
91
|
+
oldStatus: AnchorStatusSchema,
|
|
92
|
+
newStatus: AnchorStatusSchema,
|
|
93
|
+
reason: Schema.String,
|
|
94
|
+
detectedBy: InvalidationSourceSchema,
|
|
95
|
+
oldContentHash: Schema.NullOr(Schema.String),
|
|
96
|
+
newContentHash: Schema.NullOr(Schema.String),
|
|
97
|
+
similarityScore: Schema.NullOr(Schema.Number),
|
|
98
|
+
invalidatedAt: Schema.DateFromSelf,
|
|
99
|
+
});
|
|
27
100
|
//# sourceMappingURL=anchor.js.map
|
package/dist/anchor.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"anchor.js","sourceRoot":"","sources":["../src/anchor.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"anchor.js","sourceRoot":"","sources":["../src/anchor.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE/B,gFAAgF;AAChF,YAAY;AACZ,gFAAgF;AAEhF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,CAAU,CAAC;AAE9E;;;;;GAKG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,OAAO,EAAE,SAAS,EAAE,SAAS,CAAU,CAAC;AAExE;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,CAAU,CAAC;AAEjG,gFAAgF;AAChF,kBAAkB;AAClB,gFAAgF;AAEhF,mCAAmC;AACnC,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAC9C,MAAM,CAAC,GAAG,EAAE,EACZ,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,CACzB,CAAA;AAGD,0BAA0B;AAC1B,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,YAAY,CAAC,CAAA;AAG/D,4BAA4B;AAC5B,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,eAAe,CAAC,CAAA;AAGpE,kCAAkC;AAClC,MAAM,CAAC,MAAM,wBAAwB,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,oBAAoB,CAAC,CAAA;AAG/E,gEAAgE;AAChE,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC;IACxC,EAAE,EAA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,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC7D,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAAC;IAC3C,UAAU,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;CAChE,CAAC,CAAA;AAGF,6DAA6D;AAC7D,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CAAC,MAAM,CAAC;IACjD,EAAE,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC;IACpC,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC;IAC1C,SAAS,EAAE,kBAAkB;IAC7B,SAAS,EAAE,kBAAkB;IAC7B,MAAM,EAAE,MAAM,CAAC,MAAM;IACrB,UAAU,EAAE,wBAAwB;IACpC,cAAc,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;IAC5C,cAAc,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;IAC5C,eAAe,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;IAC7C,aAAa,EAAE,MAAM,CAAC,YAAY;CACnC,CAAC,CAAA"}
|
package/dist/attempt.d.ts
CHANGED
|
@@ -2,46 +2,54 @@
|
|
|
2
2
|
* Attempt types for tx
|
|
3
3
|
*
|
|
4
4
|
* Type definitions for tracking task approach outcomes.
|
|
5
|
-
*
|
|
5
|
+
* Core type definitions using Effect Schema (Doctrine Rule 10).
|
|
6
|
+
* Schema definitions provide both compile-time types and runtime validation.
|
|
6
7
|
*/
|
|
7
|
-
import
|
|
8
|
+
import { Schema } from "effect";
|
|
8
9
|
/**
|
|
9
10
|
* Valid attempt outcomes.
|
|
10
11
|
*/
|
|
11
12
|
export declare const ATTEMPT_OUTCOMES: readonly ["failed", "succeeded"];
|
|
13
|
+
/** Attempt outcome - whether the approach failed or succeeded. */
|
|
14
|
+
export declare const AttemptOutcomeSchema: Schema.Literal<["failed", "succeeded"]>;
|
|
15
|
+
export type AttemptOutcome = typeof AttemptOutcomeSchema.Type;
|
|
16
|
+
/** Attempt ID - branded integer. */
|
|
17
|
+
export declare const AttemptIdSchema: Schema.brand<Schema.filter<typeof Schema.Number>, "AttemptId">;
|
|
18
|
+
export type AttemptId = typeof AttemptIdSchema.Type;
|
|
19
|
+
/** Attempt entity - records a specific approach tried for a task. */
|
|
20
|
+
export declare const AttemptSchema: Schema.Struct<{
|
|
21
|
+
id: Schema.brand<Schema.filter<typeof Schema.Number>, "AttemptId">;
|
|
22
|
+
taskId: Schema.brand<Schema.filter<typeof Schema.String>, "TaskId">;
|
|
23
|
+
approach: typeof Schema.String;
|
|
24
|
+
outcome: Schema.Literal<["failed", "succeeded"]>;
|
|
25
|
+
reason: Schema.NullOr<typeof Schema.String>;
|
|
26
|
+
createdAt: typeof Schema.DateFromSelf;
|
|
27
|
+
}>;
|
|
28
|
+
export type Attempt = typeof AttemptSchema.Type;
|
|
29
|
+
/** Input for creating a new attempt. */
|
|
30
|
+
export declare const CreateAttemptInputSchema: Schema.Struct<{
|
|
31
|
+
taskId: typeof Schema.String;
|
|
32
|
+
approach: typeof Schema.String;
|
|
33
|
+
outcome: Schema.Literal<["failed", "succeeded"]>;
|
|
34
|
+
reason: Schema.optional<Schema.NullOr<typeof Schema.String>>;
|
|
35
|
+
}>;
|
|
36
|
+
export type CreateAttemptInput = typeof CreateAttemptInputSchema.Type;
|
|
12
37
|
/**
|
|
13
|
-
*
|
|
38
|
+
* Check if a string is a valid attempt outcome.
|
|
14
39
|
*/
|
|
15
|
-
export
|
|
40
|
+
export declare const isValidAttemptOutcome: (outcome: string) => outcome is AttemptOutcome;
|
|
16
41
|
/**
|
|
17
|
-
*
|
|
42
|
+
* Error thrown when an attempt outcome is invalid.
|
|
18
43
|
*/
|
|
19
|
-
export
|
|
20
|
-
readonly
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Attempt entity - records a specific approach tried for a task.
|
|
24
|
-
*/
|
|
25
|
-
export interface Attempt {
|
|
26
|
-
readonly id: AttemptId;
|
|
27
|
-
readonly taskId: TaskId;
|
|
28
|
-
readonly approach: string;
|
|
29
|
-
readonly outcome: AttemptOutcome;
|
|
30
|
-
readonly reason: string | null;
|
|
31
|
-
readonly createdAt: Date;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Input for creating a new attempt.
|
|
35
|
-
*/
|
|
36
|
-
export interface CreateAttemptInput {
|
|
37
|
-
readonly taskId: string;
|
|
38
|
-
readonly approach: string;
|
|
39
|
-
readonly outcome: AttemptOutcome;
|
|
40
|
-
readonly reason?: string | null;
|
|
44
|
+
export declare class InvalidAttemptOutcomeError extends Error {
|
|
45
|
+
readonly outcome: string;
|
|
46
|
+
constructor(outcome: string);
|
|
41
47
|
}
|
|
42
48
|
/**
|
|
43
|
-
*
|
|
49
|
+
* Validate and return an AttemptOutcome, or throw if invalid.
|
|
44
50
|
*/
|
|
51
|
+
export declare const assertAttemptOutcome: (outcome: string) => AttemptOutcome;
|
|
52
|
+
/** Database row type for attempts (snake_case from SQLite). */
|
|
45
53
|
export interface AttemptRow {
|
|
46
54
|
id: number;
|
|
47
55
|
task_id: string;
|
package/dist/attempt.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attempt.d.ts","sourceRoot":"","sources":["../src/attempt.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"attempt.d.ts","sourceRoot":"","sources":["../src/attempt.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAO/B;;GAEG;AACH,eAAO,MAAM,gBAAgB,kCAAmC,CAAC;AAMjE,kEAAkE;AAClE,eAAO,MAAM,oBAAoB,yCAAsC,CAAA;AACvE,MAAM,MAAM,cAAc,GAAG,OAAO,oBAAoB,CAAC,IAAI,CAAA;AAE7D,oCAAoC;AACpC,eAAO,MAAM,eAAe,gEAG3B,CAAA;AACD,MAAM,MAAM,SAAS,GAAG,OAAO,eAAe,CAAC,IAAI,CAAA;AAEnD,qEAAqE;AACrE,eAAO,MAAM,aAAa;;;;;;;EAOxB,CAAA;AACF,MAAM,MAAM,OAAO,GAAG,OAAO,aAAa,CAAC,IAAI,CAAA;AAE/C,wCAAwC;AACxC,eAAO,MAAM,wBAAwB;;;;;EAKnC,CAAA;AACF,MAAM,MAAM,kBAAkB,GAAG,OAAO,wBAAwB,CAAC,IAAI,CAAA;AAMrE;;GAEG;AACH,eAAO,MAAM,qBAAqB,GAAI,SAAS,MAAM,KAAG,OAAO,IAAI,cAElE,CAAC;AAEF;;GAEG;AACH,qBAAa,0BAA2B,SAAQ,KAAK;aACvB,OAAO,EAAE,MAAM;gBAAf,OAAO,EAAE,MAAM;CAI5C;AAED;;GAEG;AACH,eAAO,MAAM,oBAAoB,GAAI,SAAS,MAAM,KAAG,cAKtD,CAAC;AAMF,+DAA+D;AAC/D,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;CACpB"}
|
package/dist/attempt.js
CHANGED
|
@@ -2,10 +2,68 @@
|
|
|
2
2
|
* Attempt types for tx
|
|
3
3
|
*
|
|
4
4
|
* Type definitions for tracking task approach outcomes.
|
|
5
|
-
*
|
|
5
|
+
* Core type definitions using Effect Schema (Doctrine Rule 10).
|
|
6
|
+
* Schema definitions provide both compile-time types and runtime validation.
|
|
6
7
|
*/
|
|
8
|
+
import { Schema } from "effect";
|
|
9
|
+
import { TaskIdSchema } from "./task.js";
|
|
10
|
+
// =============================================================================
|
|
11
|
+
// CONSTANTS
|
|
12
|
+
// =============================================================================
|
|
7
13
|
/**
|
|
8
14
|
* Valid attempt outcomes.
|
|
9
15
|
*/
|
|
10
16
|
export const ATTEMPT_OUTCOMES = ["failed", "succeeded"];
|
|
17
|
+
// =============================================================================
|
|
18
|
+
// SCHEMAS & TYPES
|
|
19
|
+
// =============================================================================
|
|
20
|
+
/** Attempt outcome - whether the approach failed or succeeded. */
|
|
21
|
+
export const AttemptOutcomeSchema = Schema.Literal(...ATTEMPT_OUTCOMES);
|
|
22
|
+
/** Attempt ID - branded integer. */
|
|
23
|
+
export const AttemptIdSchema = Schema.Number.pipe(Schema.int(), Schema.brand("AttemptId"));
|
|
24
|
+
/** Attempt entity - records a specific approach tried for a task. */
|
|
25
|
+
export const AttemptSchema = Schema.Struct({
|
|
26
|
+
id: AttemptIdSchema,
|
|
27
|
+
taskId: TaskIdSchema,
|
|
28
|
+
approach: Schema.String,
|
|
29
|
+
outcome: AttemptOutcomeSchema,
|
|
30
|
+
reason: Schema.NullOr(Schema.String),
|
|
31
|
+
createdAt: Schema.DateFromSelf,
|
|
32
|
+
});
|
|
33
|
+
/** Input for creating a new attempt. */
|
|
34
|
+
export const CreateAttemptInputSchema = Schema.Struct({
|
|
35
|
+
taskId: Schema.String,
|
|
36
|
+
approach: Schema.String,
|
|
37
|
+
outcome: AttemptOutcomeSchema,
|
|
38
|
+
reason: Schema.optional(Schema.NullOr(Schema.String)),
|
|
39
|
+
});
|
|
40
|
+
// =============================================================================
|
|
41
|
+
// RUNTIME VALIDATORS
|
|
42
|
+
// =============================================================================
|
|
43
|
+
/**
|
|
44
|
+
* Check if a string is a valid attempt outcome.
|
|
45
|
+
*/
|
|
46
|
+
export const isValidAttemptOutcome = (outcome) => {
|
|
47
|
+
return ATTEMPT_OUTCOMES.includes(outcome);
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Error thrown when an attempt outcome is invalid.
|
|
51
|
+
*/
|
|
52
|
+
export class InvalidAttemptOutcomeError extends Error {
|
|
53
|
+
outcome;
|
|
54
|
+
constructor(outcome) {
|
|
55
|
+
super(`Invalid attempt outcome: "${outcome}". Valid outcomes: ${ATTEMPT_OUTCOMES.join(", ")}`);
|
|
56
|
+
this.outcome = outcome;
|
|
57
|
+
this.name = "InvalidAttemptOutcomeError";
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Validate and return an AttemptOutcome, or throw if invalid.
|
|
62
|
+
*/
|
|
63
|
+
export const assertAttemptOutcome = (outcome) => {
|
|
64
|
+
if (!isValidAttemptOutcome(outcome)) {
|
|
65
|
+
throw new InvalidAttemptOutcomeError(outcome);
|
|
66
|
+
}
|
|
67
|
+
return outcome;
|
|
68
|
+
};
|
|
11
69
|
//# sourceMappingURL=attempt.js.map
|
package/dist/attempt.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attempt.js","sourceRoot":"","sources":["../src/attempt.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"attempt.js","sourceRoot":"","sources":["../src/attempt.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAExC,gFAAgF;AAChF,YAAY;AACZ,gFAAgF;AAEhF;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,QAAQ,EAAE,WAAW,CAAU,CAAC;AAEjE,gFAAgF;AAChF,kBAAkB;AAClB,gFAAgF;AAEhF,kEAAkE;AAClE,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,gBAAgB,CAAC,CAAA;AAGvE,oCAAoC;AACpC,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAC/C,MAAM,CAAC,GAAG,EA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