@jamesaphoenix/tx-types 0.4.4 → 0.5.0
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/dist/anchor.d.ts +150 -0
- package/dist/anchor.d.ts.map +1 -0
- package/dist/anchor.js +100 -0
- package/dist/anchor.js.map +1 -0
- package/dist/attempt.d.ts +0 -15
- package/dist/attempt.d.ts.map +1 -1
- package/dist/attempt.js +0 -29
- package/dist/attempt.js.map +1 -1
- package/dist/candidate.d.ts +175 -0
- package/dist/candidate.d.ts.map +1 -0
- package/dist/candidate.js +139 -0
- package/dist/candidate.js.map +1 -0
- package/dist/cycle.d.ts +1 -6
- package/dist/cycle.d.ts.map +1 -1
- package/dist/cycle.js.map +1 -1
- package/dist/doc.d.ts.map +1 -1
- package/dist/doc.js.map +1 -1
- package/dist/edge.d.ts +87 -0
- package/dist/edge.d.ts.map +1 -0
- package/dist/edge.js +82 -0
- package/dist/edge.js.map +1 -0
- package/dist/index.d.ts +10 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -5
- package/dist/index.js.map +1 -1
- package/dist/learning.d.ts +74 -1
- package/dist/learning.d.ts.map +1 -1
- package/dist/learning.js +40 -1
- package/dist/learning.js.map +1 -1
- package/dist/message.d.ts +83 -0
- package/dist/message.d.ts.map +1 -0
- package/dist/message.js +82 -0
- package/dist/message.js.map +1 -0
- package/dist/response.d.ts +68 -0
- package/dist/response.d.ts.map +1 -1
- package/dist/response.js +65 -0
- package/dist/response.js.map +1 -1
- package/dist/run.d.ts +0 -30
- package/dist/run.d.ts.map +1 -1
- package/dist/run.js +0 -55
- package/dist/run.js.map +1 -1
- package/dist/symbol.d.ts +71 -0
- package/dist/symbol.d.ts.map +1 -0
- package/dist/symbol.js +83 -0
- package/dist/symbol.js.map +1 -0
- package/package.json +7 -21
package/dist/anchor.d.ts
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Anchor types for tx
|
|
3
|
+
*
|
|
4
|
+
* Type definitions for file/code associations (anchors) that link learnings
|
|
5
|
+
* to specific file locations, symbols, or code regions.
|
|
6
|
+
* Core type definitions using Effect Schema (Doctrine Rule 10).
|
|
7
|
+
* Schema definitions provide both compile-time types and runtime validation.
|
|
8
|
+
*/
|
|
9
|
+
import { Schema } from "effect";
|
|
10
|
+
/**
|
|
11
|
+
* Anchor type - how the learning is associated with code.
|
|
12
|
+
* - glob: Pattern match (e.g., "src/repo/*.ts")
|
|
13
|
+
* - hash: Content hash of specific lines
|
|
14
|
+
* - symbol: Named code element (function, class, etc.)
|
|
15
|
+
* - line_range: Specific line numbers
|
|
16
|
+
*/
|
|
17
|
+
export declare const ANCHOR_TYPES: readonly ["glob", "hash", "symbol", "line_range"];
|
|
18
|
+
/**
|
|
19
|
+
* Anchor status - validity of the file/code association.
|
|
20
|
+
* - valid: Anchor still points to correct code
|
|
21
|
+
* - drifted: Code has changed but anchor still exists
|
|
22
|
+
* - invalid: Anchor no longer valid (file deleted, symbol removed)
|
|
23
|
+
*/
|
|
24
|
+
export declare const ANCHOR_STATUSES: readonly ["valid", "drifted", "invalid"];
|
|
25
|
+
/**
|
|
26
|
+
* Detection source for invalidation.
|
|
27
|
+
*/
|
|
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>;
|
|
52
|
+
/** Original content preview for self-healing Jaccard similarity comparison */
|
|
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>>;
|
|
70
|
+
/** Original content preview for self-healing comparison (max ~500 chars) */
|
|
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>>;
|
|
82
|
+
/** Updated content preview for self-healing comparison */
|
|
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;
|
|
102
|
+
/**
|
|
103
|
+
* Anchor with freshness information for lazy verification.
|
|
104
|
+
* Returned by getWithVerification - includes whether anchor was fresh or verified.
|
|
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). */
|
|
121
|
+
export interface AnchorRow {
|
|
122
|
+
id: number;
|
|
123
|
+
learning_id: number;
|
|
124
|
+
anchor_type: string;
|
|
125
|
+
anchor_value: string;
|
|
126
|
+
file_path: string;
|
|
127
|
+
symbol_fqname: string | null;
|
|
128
|
+
line_start: number | null;
|
|
129
|
+
line_end: number | null;
|
|
130
|
+
content_hash: string | null;
|
|
131
|
+
content_preview: string | null;
|
|
132
|
+
status: string;
|
|
133
|
+
pinned: number;
|
|
134
|
+
verified_at: string | null;
|
|
135
|
+
created_at: string;
|
|
136
|
+
}
|
|
137
|
+
/** Database row type for invalidation log (snake_case from SQLite). */
|
|
138
|
+
export interface InvalidationLogRow {
|
|
139
|
+
id: number;
|
|
140
|
+
anchor_id: number;
|
|
141
|
+
old_status: string;
|
|
142
|
+
new_status: string;
|
|
143
|
+
reason: string;
|
|
144
|
+
detected_by: string;
|
|
145
|
+
old_content_hash: string | null;
|
|
146
|
+
new_content_hash: string | null;
|
|
147
|
+
similarity_score: number | null;
|
|
148
|
+
invalidated_at: string;
|
|
149
|
+
}
|
|
150
|
+
//# sourceMappingURL=anchor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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,M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E,MAAM,GAAG,IAAI,CAAC;IAC7B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,GAAG,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
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Anchor types for tx
|
|
3
|
+
*
|
|
4
|
+
* Type definitions for file/code associations (anchors) that link learnings
|
|
5
|
+
* to specific file locations, symbols, or code regions.
|
|
6
|
+
* Core type definitions using Effect Schema (Doctrine Rule 10).
|
|
7
|
+
* Schema definitions provide both compile-time types and runtime validation.
|
|
8
|
+
*/
|
|
9
|
+
import { Schema } from "effect";
|
|
10
|
+
// =============================================================================
|
|
11
|
+
// CONSTANTS
|
|
12
|
+
// =============================================================================
|
|
13
|
+
/**
|
|
14
|
+
* Anchor type - how the learning is associated with code.
|
|
15
|
+
* - glob: Pattern match (e.g., "src/repo/*.ts")
|
|
16
|
+
* - hash: Content hash of specific lines
|
|
17
|
+
* - symbol: Named code element (function, class, etc.)
|
|
18
|
+
* - line_range: Specific line numbers
|
|
19
|
+
*/
|
|
20
|
+
export const ANCHOR_TYPES = ["glob", "hash", "symbol", "line_range"];
|
|
21
|
+
/**
|
|
22
|
+
* Anchor status - validity of the file/code association.
|
|
23
|
+
* - valid: Anchor still points to correct code
|
|
24
|
+
* - drifted: Code has changed but anchor still exists
|
|
25
|
+
* - invalid: Anchor no longer valid (file deleted, symbol removed)
|
|
26
|
+
*/
|
|
27
|
+
export const ANCHOR_STATUSES = ["valid", "drifted", "invalid"];
|
|
28
|
+
/**
|
|
29
|
+
* Detection source for invalidation.
|
|
30
|
+
*/
|
|
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
|
+
});
|
|
100
|
+
//# sourceMappingURL=anchor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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;A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C5C,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
|
@@ -34,21 +34,6 @@ export declare const CreateAttemptInputSchema: Schema.Struct<{
|
|
|
34
34
|
reason: Schema.optional<Schema.NullOr<typeof Schema.String>>;
|
|
35
35
|
}>;
|
|
36
36
|
export type CreateAttemptInput = typeof CreateAttemptInputSchema.Type;
|
|
37
|
-
/**
|
|
38
|
-
* Check if a string is a valid attempt outcome.
|
|
39
|
-
*/
|
|
40
|
-
export declare const isValidAttemptOutcome: (outcome: string) => outcome is AttemptOutcome;
|
|
41
|
-
/**
|
|
42
|
-
* Error thrown when an attempt outcome is invalid.
|
|
43
|
-
*/
|
|
44
|
-
export declare class InvalidAttemptOutcomeError extends Error {
|
|
45
|
-
readonly outcome: string;
|
|
46
|
-
constructor(outcome: string);
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Validate and return an AttemptOutcome, or throw if invalid.
|
|
50
|
-
*/
|
|
51
|
-
export declare const assertAttemptOutcome: (outcome: string) => AttemptOutcome;
|
|
52
37
|
/** Database row type for attempts (snake_case from SQLite). */
|
|
53
38
|
export interface AttemptRow {
|
|
54
39
|
id: number;
|
package/dist/attempt.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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,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AAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;CACpB"}
|
package/dist/attempt.js
CHANGED
|
@@ -37,33 +37,4 @@ export const CreateAttemptInputSchema = Schema.Struct({
|
|
|
37
37
|
outcome: AttemptOutcomeSchema,
|
|
38
38
|
reason: Schema.optional(Schema.NullOr(Schema.String)),
|
|
39
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
|
-
};
|
|
69
40
|
//# 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;;;;;;GAMG;AAEH,OAAO,EAAE,MAAM,EAAE,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|
4
|
+
* Learning candidates are potential learnings extracted from Claude Code
|
|
5
|
+
* transcripts that await promotion to the learnings table.
|
|
6
|
+
* Core type definitions using Effect Schema (Doctrine Rule 10).
|
|
7
|
+
*
|
|
8
|
+
* @see PRD-015 for the JSONL daemon and knowledge promotion pipeline
|
|
9
|
+
*/
|
|
10
|
+
import { Schema } from "effect";
|
|
11
|
+
/**
|
|
12
|
+
* All valid confidence levels.
|
|
13
|
+
*/
|
|
14
|
+
export declare const CANDIDATE_CONFIDENCES: readonly ["high", "medium", "low"];
|
|
15
|
+
/**
|
|
16
|
+
* All valid candidate categories.
|
|
17
|
+
*/
|
|
18
|
+
export declare const CANDIDATE_CATEGORIES: readonly ["architecture", "testing", "performance", "security", "debugging", "tooling", "patterns", "other"];
|
|
19
|
+
/**
|
|
20
|
+
* All valid candidate statuses.
|
|
21
|
+
*/
|
|
22
|
+
export declare const CANDIDATE_STATUSES: readonly ["pending", "promoted", "rejected", "merged"];
|
|
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<{
|
|
36
|
+
/** The transcript text content to analyze */
|
|
37
|
+
content: typeof Schema.String;
|
|
38
|
+
/** Source file path (e.g., ~/.claude/projects/foo/session.jsonl) */
|
|
39
|
+
sourceFile: typeof Schema.String;
|
|
40
|
+
/** Optional run ID for provenance tracking */
|
|
41
|
+
sourceRunId: Schema.optional<Schema.NullOr<typeof Schema.String>>;
|
|
42
|
+
/** Optional task ID for provenance tracking */
|
|
43
|
+
sourceTaskId: Schema.optional<Schema.NullOr<typeof Schema.String>>;
|
|
44
|
+
/** Byte offset in source file (for incremental processing) */
|
|
45
|
+
byteOffset: Schema.optional<Schema.filter<typeof Schema.Number>>;
|
|
46
|
+
/** Line number range in source file */
|
|
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<{
|
|
55
|
+
/** The learning text (1-3 sentences, actionable) */
|
|
56
|
+
content: typeof Schema.String;
|
|
57
|
+
/** Confidence level assigned by the LLM */
|
|
58
|
+
confidence: Schema.Literal<["high", "medium", "low"]>;
|
|
59
|
+
/** Category of the learning */
|
|
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<{
|
|
65
|
+
/** Unique database ID */
|
|
66
|
+
id: Schema.filter<typeof Schema.Number>;
|
|
67
|
+
/** The learning text (1-3 sentences, actionable) */
|
|
68
|
+
content: typeof Schema.String;
|
|
69
|
+
/** Confidence level assigned by the LLM */
|
|
70
|
+
confidence: Schema.Literal<["high", "medium", "low"]>;
|
|
71
|
+
/** Category of the learning */
|
|
72
|
+
category: Schema.NullOr<Schema.Literal<["architecture", "testing", "performance", "security", "debugging", "tooling", "patterns", "other"]>>;
|
|
73
|
+
/** Source JSONL file path */
|
|
74
|
+
sourceFile: typeof Schema.String;
|
|
75
|
+
/** Source run ID for provenance */
|
|
76
|
+
sourceRunId: Schema.NullOr<typeof Schema.String>;
|
|
77
|
+
/** Source task ID for provenance */
|
|
78
|
+
sourceTaskId: Schema.NullOr<typeof Schema.String>;
|
|
79
|
+
/** When the candidate was extracted */
|
|
80
|
+
extractedAt: typeof Schema.DateFromSelf;
|
|
81
|
+
/** Current status in promotion pipeline */
|
|
82
|
+
status: Schema.Literal<["pending", "promoted", "rejected", "merged"]>;
|
|
83
|
+
/** When the candidate was reviewed */
|
|
84
|
+
reviewedAt: Schema.NullOr<typeof Schema.DateFromSelf>;
|
|
85
|
+
/** Who reviewed ('auto' or user identifier) */
|
|
86
|
+
reviewedBy: Schema.NullOr<typeof Schema.String>;
|
|
87
|
+
/** ID of promoted learning (if promoted or merged) */
|
|
88
|
+
promotedLearningId: Schema.NullOr<Schema.filter<typeof Schema.Number>>;
|
|
89
|
+
/** Reason for rejection (if rejected) */
|
|
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. */
|
|
160
|
+
export interface CandidateRow {
|
|
161
|
+
readonly id: number;
|
|
162
|
+
readonly content: string;
|
|
163
|
+
readonly confidence: string;
|
|
164
|
+
readonly category: string | null;
|
|
165
|
+
readonly source_file: string;
|
|
166
|
+
readonly source_run_id: string | null;
|
|
167
|
+
readonly source_task_id: string | null;
|
|
168
|
+
readonly extracted_at: string;
|
|
169
|
+
readonly status: string;
|
|
170
|
+
readonly reviewed_at: string | null;
|
|
171
|
+
readonly reviewed_by: string | null;
|
|
172
|
+
readonly promoted_learning_id: number | null;
|
|
173
|
+
readonly rejection_reason: string | null;
|
|
174
|
+
}
|
|
175
|
+
//# sourceMappingURL=candidate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"candidate.d.ts","sourceRoot":"","sources":["../src/candidate.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAM/B;;GAEG;AACH,eAAO,MAAM,qBAAqB,oCAAqC,CAAA;AAEvE;;GAEG;AACH,eAAO,MAAM,oBAAoB,8GASvB,CAAA;AAEV;;GAEG;AACH,eAAO,MAAM,kBAAkB,wDAAyD,CAAA;AAMxF,0DAA0D;AAC1D,eAAO,MAAM,yBAAyB,2CAA2C,CAAA;AACjF,MAAM,MAAM,mBAAmB,GAAG,OAAO,yBAAyB,CAAC,IAAI,CAAA;AAEvE,0CAA0C;AAC1C,eAAO,MAAM,uBAAuB,qHAA0C,CAAA;AAC9E,MAAM,MAAM,iBAAiB,GAAG,OAAO,uBAAuB,CAAC,IAAI,CAAA;AAEnE,gEAAgE;AAChE,eAAO,MAAM,qBAAqB,+DAAwC,CAAA;AAC1E,MAAM,MAAM,eAAe,GAAG,OAAO,qBAAqB,CAAC,IAAI,CAAA;AAE/D,yDAAyD;AACzD,MAAM,MAAM,WAAW,GAAG,MAAM,CAAA;AAEhC,4EA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