@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/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAGH,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,UAAU,EACV,kBAAkB,EAClB,cAAc,EACd,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EACrB,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,sBAAsB,EACtB,KAAK,UAAU,EACf,KAAK,MAAM,EACX,KAAK,IAAI,EACT,KAAK,YAAY,EACjB,KAAK,QAAQ,EACb,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,UAAU,EACf,KAAK,UAAU,EACf,KAAK,OAAO,EACZ,KAAK,aAAa,GACnB,MAAM,WAAW,CAAC;AAGnB,OAAO,EACL,qBAAqB,EACrB,wBAAwB,EACxB,gBAAgB,EAChB,cAAc,EACd,uBAAuB,EACvB,yBAAyB,EACzB,yBAAyB,EACzB,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,0BAA0B,EAC1B,4BAA4B,EAC5B,sBAAsB,EACtB,KAAK,kBAAkB,E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
|
|
1
1
|
/**
|
|
2
2
|
* @tx/types - Shared TypeScript types for tx
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* Effect Schema definitions providing both compile-time types and runtime validation.
|
|
5
5
|
* Works with any runtime (Node, Bun, Deno).
|
|
6
6
|
*
|
|
7
7
|
* @example
|
|
8
8
|
* ```typescript
|
|
9
9
|
* import { Task, TaskWithDeps, TaskId, TaskStatus } from "@jamesaphoenix/tx-types";
|
|
10
|
+
* import { TaskSchema, TaskWithDepsSchema } from "@jamesaphoenix/tx-types";
|
|
10
11
|
* import { Learning, LearningWithScore } from "@jamesaphoenix/tx-types";
|
|
11
12
|
* import { Attempt, Run } from "@jamesaphoenix/tx-types";
|
|
12
13
|
*
|
|
13
14
|
* // Or import from specific modules:
|
|
14
|
-
* import type
|
|
15
|
-
* import type
|
|
15
|
+
* import { TaskSchema, type Task, type TaskWithDeps } from "@tx/types/task";
|
|
16
|
+
* import { LearningSchema, type Learning } from "@tx/types/learning";
|
|
16
17
|
* ```
|
|
17
18
|
*/
|
|
18
|
-
// Task types
|
|
19
|
-
export { TASK_STATUSES, VALID_TRANSITIONS, } from "./task.js";
|
|
20
|
-
// Learning types
|
|
21
|
-
export { LEARNING_SOURCE_TYPES, } from "./learning.js";
|
|
22
|
-
//
|
|
23
|
-
export {
|
|
24
|
-
//
|
|
25
|
-
export {
|
|
26
|
-
//
|
|
27
|
-
export {
|
|
28
|
-
//
|
|
29
|
-
export {
|
|
30
|
-
//
|
|
31
|
-
export {
|
|
32
|
-
//
|
|
33
|
-
export {
|
|
34
|
-
//
|
|
35
|
-
export {
|
|
19
|
+
// Task types & schemas
|
|
20
|
+
export { TASK_STATUSES, VALID_TRANSITIONS, TASK_ID_PATTERN, TaskStatusSchema, TaskIdSchema, TaskSchema, TaskWithDepsSchema, TaskTreeSchema, TaskDependencySchema, CreateTaskInputSchema, UpdateTaskInputSchema, TaskCursorSchema, TaskFilterSchema, isValidTaskId, assertTaskId, InvalidTaskIdError, isValidTaskStatus, assertTaskStatus, InvalidTaskStatusError, } from "./task.js";
|
|
21
|
+
// Learning types & schemas
|
|
22
|
+
export { LEARNING_SOURCE_TYPES, LearningSourceTypeSchema, LearningIdSchema, LearningSchema, LearningWithScoreSchema, CreateLearningInputSchema, UpdateLearningInputSchema, LearningQuerySchema, ContextOptionsSchema, ContextResultSchema, LearningSearchResultSchema, DiversificationOptionsSchema, RetrievalOptionsSchema, } from "./learning.js";
|
|
23
|
+
// File learning types & schemas
|
|
24
|
+
export { FileLearningIdSchema, FileLearningSchema, CreateFileLearningInputSchema, } from "./file-learning.js";
|
|
25
|
+
// Attempt types & schemas
|
|
26
|
+
export { ATTEMPT_OUTCOMES, AttemptOutcomeSchema, AttemptIdSchema, AttemptSchema, CreateAttemptInputSchema, isValidAttemptOutcome, assertAttemptOutcome, InvalidAttemptOutcomeError, } from "./attempt.js";
|
|
27
|
+
// Run types & schemas
|
|
28
|
+
export { RUN_STATUSES, RunStatusSchema, RunIdSchema, RunSchema, CreateRunInputSchema, UpdateRunInputSchema, isValidRunStatus, assertRunStatus, InvalidRunStatusError, isValidRunId, assertRunId, InvalidRunIdError, } from "./run.js";
|
|
29
|
+
// Deduplication types & schemas
|
|
30
|
+
export { ProcessedHashSchema, CreateProcessedHashInputSchema, FileProgressSchema, UpsertFileProgressInputSchema, HashCheckResultSchema, LineProcessResultSchema, FileProcessResultSchema, DeduplicationOptionsSchema, } from "./deduplication.js";
|
|
31
|
+
// Tracked project types & schemas (daemon monitoring)
|
|
32
|
+
export { SOURCE_TYPES, SourceTypeSchema, TrackedProjectSchema, CreateTrackedProjectInputSchema, } from "./tracked-project.js";
|
|
33
|
+
// Doc types & schemas
|
|
34
|
+
export { DOC_KINDS, DOC_STATUSES, DOC_LINK_TYPES, TASK_DOC_LINK_TYPES, INVARIANT_ENFORCEMENT_TYPES, INVARIANT_STATUSES, DocKindSchema, DocStatusSchema, DocLinkTypeSchema, TaskDocLinkTypeSchema, DocIdSchema, isValidDocKind, assertDocKind, InvalidDocKindError, isValidDocStatus, assertDocStatus, InvalidDocStatusError, isValidDocLinkType, assertDocLinkType, InvalidDocLinkTypeError, DocSchema, DocWithLinksSchema, DocLinkSchema, TaskDocLinkSchema, CreateDocInputSchema, InvariantEnforcementSchema, InvariantStatusSchema, InvariantIdSchema, InvariantSchema, InvariantCheckSchema, UpsertInvariantInputSchema, RecordInvariantCheckInputSchema, DocGraphNodeSchema, DocGraphEdgeSchema, DocGraphSchema, } from "./doc.js";
|
|
35
|
+
// Cycle types & schemas (cycle-based issue discovery)
|
|
36
|
+
export { FINDING_SEVERITIES, LOSS_WEIGHTS, FindingSeveritySchema, FindingSchema, DuplicateSchema, DedupResultSchema, CycleConfigSchema, RoundMetricsSchema, CycleResultSchema, } from "./cycle.js";
|
|
37
|
+
// Response types & schemas (shared schemas for CLI, MCP, API, SDK)
|
|
38
|
+
export {
|
|
39
|
+
// Serialized entity schemas
|
|
40
|
+
TaskWithDepsSerializedSchema, LearningSerializedSchema, LearningWithScoreSerializedSchema, FileLearningsSerializedSchema, RunSerializedSchema, AttemptSerializedSchema,
|
|
41
|
+
// Serialization functions
|
|
42
|
+
serializeTask, serializeLearning, serializeLearningWithScore, serializeFileLearning, serializeRun, serializeAttempt,
|
|
43
|
+
// Response envelope schemas
|
|
44
|
+
ErrorResponseSchema,
|
|
45
|
+
// Task response schemas & types
|
|
46
|
+
TaskReadyResponseSchema, TaskListResponseSchema, TaskDetailResponseSchema, TaskCompletionResponseSchema, TaskTreeResponseSchema,
|
|
47
|
+
// Learning response schemas & types
|
|
48
|
+
LearningSearchResponseSchema, ContextResponseSchema, FileLearningListResponseSchema,
|
|
49
|
+
// Run response schemas & types
|
|
50
|
+
RunListResponseSchema, RunDetailResponseSchema,
|
|
51
|
+
// Sync response schemas & types
|
|
52
|
+
SyncExportResponseSchema, SyncImportResponseSchema, } from "./response.js";
|
|
36
53
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,uBAAuB;AACvB,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,UAAU,EACV,kBAAkB,EAClB,cAAc,EACd,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EACrB,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,sBAAsB,GAavB,MAAM,WAAW,CAAC;AAEnB,2BAA2B;AAC3B,OAAO,EACL,qBAAqB,EACrB,wBAAwB,EACxB,gBAAgB,EAChB,cAAc,EACd,uBAAuB,EACvB,yBAAyB,EACzB,yBAAyB,EACzB,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,0BAA0B,EAC1B,4BAA4B,EAC5B,sBAAsB,GAevB,MAAM,eAAe,CAAC;AAEvB,gCAAgC;AAChC,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAClB,6BAA6B,GAK9B,MAAM,oBAAoB,CAAC;AAE5B,0BAA0B;AAC1B,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,eAAe,EACf,aAAa,EACb,wBAAwB,EACxB,qBAAqB,EACrB,oBAAoB,EACpB,0BAA0B,GAM3B,MAAM,cAAc,CAAC;AAEtB,sBAAsB;AACtB,OAAO,EACL,YAAY,EACZ,eAAe,EACf,WAAW,EACX,SAAS,EACT,oBAAoB,EACpB,oBAAoB,EACpB,gBAAgB,EAChB,eAAe,EACf,qBAAqB,EACrB,YAAY,EACZ,WAAW,EACX,iBAAiB,GAOlB,MAAM,UAAU,CAAC;AAElB,gCAAgC;AAChC,OAAO,EACL,mBAAmB,EACnB,8BAA8B,EAC9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B,4BAA4B,EAC5B,sBAAsB;AAMtB,oCAAoC;AACpC,4BAA4B,EAC5B,qBAAqB,EACrB,8BAA8B;AAI9B,+BAA+B;AAC/B,qBAAqB,EACrB,uBAAuB;AAGvB,gCAAgC;AAChC,wBAAwB,EACxB,wBAAwB,GAGzB,MAAM,eAAe,CAAC"}
|
package/dist/learning.d.ts
CHANGED
|
@@ -3,154 +3,182 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Type definitions for the contextual learnings system.
|
|
5
5
|
* See PRD-010 and DD-010 for specification.
|
|
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
|
-
import
|
|
9
|
+
import { Schema } from "effect";
|
|
9
10
|
/**
|
|
10
11
|
* Valid learning source types.
|
|
11
12
|
*/
|
|
12
13
|
export declare const LEARNING_SOURCE_TYPES: readonly ["compaction", "run", "manual", "claude_md"];
|
|
13
|
-
/**
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
*/
|
|
20
|
-
export
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
* Learning with relevance scoring from search results.
|
|
41
|
-
*/
|
|
42
|
-
export interface LearningWithScore extends Learning {
|
|
43
|
-
readonly relevanceScore: number;
|
|
44
|
-
readonly bm25Score: number;
|
|
45
|
-
readonly vectorScore: number;
|
|
46
|
-
readonly recencyScore: number;
|
|
14
|
+
/** Learning source type - where the learning came from. */
|
|
15
|
+
export declare const LearningSourceTypeSchema: Schema.Literal<["compaction", "run", "manual", "claude_md"]>;
|
|
16
|
+
export type LearningSourceType = typeof LearningSourceTypeSchema.Type;
|
|
17
|
+
/** Learning ID - branded integer. */
|
|
18
|
+
export declare const LearningIdSchema: Schema.brand<Schema.filter<typeof Schema.Number>, "LearningId">;
|
|
19
|
+
export type LearningId = typeof LearningIdSchema.Type;
|
|
20
|
+
/** Core learning entity. */
|
|
21
|
+
export declare const LearningSchema: Schema.Struct<{
|
|
22
|
+
id: Schema.brand<Schema.filter<typeof Schema.Number>, "LearningId">;
|
|
23
|
+
content: typeof Schema.String;
|
|
24
|
+
sourceType: Schema.Literal<["compaction", "run", "manual", "claude_md"]>;
|
|
25
|
+
sourceRef: Schema.NullOr<typeof Schema.String>;
|
|
26
|
+
createdAt: typeof Schema.DateFromSelf;
|
|
27
|
+
keywords: Schema.Array$<typeof Schema.String>;
|
|
28
|
+
category: Schema.NullOr<typeof Schema.String>;
|
|
29
|
+
usageCount: Schema.filter<typeof Schema.Number>;
|
|
30
|
+
lastUsedAt: Schema.NullOr<typeof Schema.DateFromSelf>;
|
|
31
|
+
outcomeScore: Schema.NullOr<typeof Schema.Number>;
|
|
32
|
+
embedding: Schema.NullOr<Schema.instanceOf<Float32Array<ArrayBuffer>>>;
|
|
33
|
+
}>;
|
|
34
|
+
export type Learning = typeof LearningSchema.Type;
|
|
35
|
+
/** Learning with relevance scoring from search results. */
|
|
36
|
+
export declare const LearningWithScoreSchema: Schema.Struct<{
|
|
37
|
+
relevanceScore: typeof Schema.Number;
|
|
38
|
+
bm25Score: typeof Schema.Number;
|
|
39
|
+
vectorScore: typeof Schema.Number;
|
|
40
|
+
recencyScore: typeof Schema.Number;
|
|
47
41
|
/** RRF (Reciprocal Rank Fusion) score from combining BM25 and vector rankings */
|
|
48
|
-
|
|
42
|
+
rrfScore: typeof Schema.Number;
|
|
49
43
|
/** Rank in BM25 results (1-indexed, 0 if not in BM25 results) */
|
|
50
|
-
|
|
44
|
+
bm25Rank: Schema.filter<typeof Schema.Number>;
|
|
51
45
|
/** Rank in vector similarity results (1-indexed, 0 if not in vector results) */
|
|
52
|
-
|
|
46
|
+
vectorRank: Schema.filter<typeof Schema.Number>;
|
|
53
47
|
/** LLM reranker score (0-1, optional - only present when reranking is applied) */
|
|
54
|
-
|
|
55
|
-
/** Number of hops from seed (0 = direct match from RRF, 1+ = expanded via graph) */
|
|
56
|
-
readonly expansionHops?: number;
|
|
57
|
-
/** Path of learning IDs from seed to this learning (only for expanded results) */
|
|
58
|
-
readonly expansionPath?: readonly LearningId[];
|
|
59
|
-
/** Edge type that led to this learning (null for direct matches) */
|
|
60
|
-
readonly sourceEdge?: EdgeType | null;
|
|
48
|
+
rerankerScore: Schema.optional<typeof Schema.Number>;
|
|
61
49
|
/** Feedback score from historical usage (0-1, 0.5 = neutral, optional) */
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
*/
|
|
77
|
-
export
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
50
|
+
feedbackScore: Schema.optional<typeof Schema.Number>;
|
|
51
|
+
id: Schema.brand<Schema.filter<typeof Schema.Number>, "LearningId">;
|
|
52
|
+
content: typeof Schema.String;
|
|
53
|
+
sourceType: Schema.Literal<["compaction", "run", "manual", "claude_md"]>;
|
|
54
|
+
sourceRef: Schema.NullOr<typeof Schema.String>;
|
|
55
|
+
createdAt: typeof Schema.DateFromSelf;
|
|
56
|
+
keywords: Schema.Array$<typeof Schema.String>;
|
|
57
|
+
category: Schema.NullOr<typeof Schema.String>;
|
|
58
|
+
usageCount: Schema.filter<typeof Schema.Number>;
|
|
59
|
+
lastUsedAt: Schema.NullOr<typeof Schema.DateFromSelf>;
|
|
60
|
+
outcomeScore: Schema.NullOr<typeof Schema.Number>;
|
|
61
|
+
embedding: Schema.NullOr<Schema.instanceOf<Float32Array<ArrayBuffer>>>;
|
|
62
|
+
}>;
|
|
63
|
+
export type LearningWithScore = typeof LearningWithScoreSchema.Type;
|
|
64
|
+
/** Input for creating a new learning. */
|
|
65
|
+
export declare const CreateLearningInputSchema: Schema.Struct<{
|
|
66
|
+
content: typeof Schema.String;
|
|
67
|
+
sourceType: Schema.optional<Schema.Literal<["compaction", "run", "manual", "claude_md"]>>;
|
|
68
|
+
sourceRef: Schema.optional<Schema.NullOr<typeof Schema.String>>;
|
|
69
|
+
keywords: Schema.optional<Schema.Array$<typeof Schema.String>>;
|
|
70
|
+
category: Schema.optional<Schema.NullOr<typeof Schema.String>>;
|
|
71
|
+
}>;
|
|
72
|
+
export type CreateLearningInput = typeof CreateLearningInputSchema.Type;
|
|
73
|
+
/** Input for updating an existing learning. */
|
|
74
|
+
export declare const UpdateLearningInputSchema: Schema.Struct<{
|
|
75
|
+
usageCount: Schema.optional<Schema.filter<typeof Schema.Number>>;
|
|
76
|
+
lastUsedAt: Schema.optional<typeof Schema.DateFromSelf>;
|
|
77
|
+
outcomeScore: Schema.optional<typeof Schema.Number>;
|
|
78
|
+
embedding: Schema.optional<Schema.instanceOf<Float32Array<ArrayBuffer>>>;
|
|
79
|
+
}>;
|
|
80
|
+
export type UpdateLearningInput = typeof UpdateLearningInputSchema.Type;
|
|
81
|
+
/** Query options for learning searches. */
|
|
82
|
+
export declare const LearningQuerySchema: Schema.Struct<{
|
|
83
|
+
query: typeof Schema.String;
|
|
84
|
+
limit: Schema.optional<Schema.filter<typeof Schema.Number>>;
|
|
85
|
+
minScore: Schema.optional<typeof Schema.Number>;
|
|
86
|
+
category: Schema.optional<typeof Schema.String>;
|
|
87
|
+
sourceType: Schema.optional<Schema.Literal<["compaction", "run", "manual", "claude_md"]>>;
|
|
88
|
+
}>;
|
|
89
|
+
export type LearningQuery = typeof LearningQuerySchema.Type;
|
|
90
|
+
/** Options for context retrieval. */
|
|
91
|
+
export declare const ContextOptionsSchema: Schema.Struct<{
|
|
92
|
+
/** Maximum number of learnings to return (default: 10, capped at 50). Misnamed — this is a result count, not a token budget. */
|
|
93
|
+
maxTokens: Schema.optional<Schema.filter<typeof Schema.Number>>;
|
|
94
|
+
}>;
|
|
95
|
+
export type ContextOptions = typeof ContextOptionsSchema.Type;
|
|
96
|
+
/** Result of context retrieval for a task. */
|
|
97
|
+
export declare const ContextResultSchema: Schema.Struct<{
|
|
98
|
+
taskId: typeof Schema.String;
|
|
99
|
+
taskTitle: typeof Schema.String;
|
|
100
|
+
learnings: Schema.Array$<Schema.Struct<{
|
|
101
|
+
relevanceScore: typeof Schema.Number;
|
|
102
|
+
bm25Score: typeof Schema.Number;
|
|
103
|
+
vectorScore: typeof Schema.Number;
|
|
104
|
+
recencyScore: typeof Schema.Number;
|
|
105
|
+
/** RRF (Reciprocal Rank Fusion) score from combining BM25 and vector rankings */
|
|
106
|
+
rrfScore: typeof Schema.Number;
|
|
107
|
+
/** Rank in BM25 results (1-indexed, 0 if not in BM25 results) */
|
|
108
|
+
bm25Rank: Schema.filter<typeof Schema.Number>;
|
|
109
|
+
/** Rank in vector similarity results (1-indexed, 0 if not in vector results) */
|
|
110
|
+
vectorRank: Schema.filter<typeof Schema.Number>;
|
|
111
|
+
/** LLM reranker score (0-1, optional - only present when reranking is applied) */
|
|
112
|
+
rerankerScore: Schema.optional<typeof Schema.Number>;
|
|
113
|
+
/** Feedback score from historical usage (0-1, 0.5 = neutral, optional) */
|
|
114
|
+
feedbackScore: Schema.optional<typeof Schema.Number>;
|
|
115
|
+
id: Schema.brand<Schema.filter<typeof Schema.Number>, "LearningId">;
|
|
116
|
+
content: typeof Schema.String;
|
|
117
|
+
sourceType: Schema.Literal<["compaction", "run", "manual", "claude_md"]>;
|
|
118
|
+
sourceRef: Schema.NullOr<typeof Schema.String>;
|
|
119
|
+
createdAt: typeof Schema.DateFromSelf;
|
|
120
|
+
keywords: Schema.Array$<typeof Schema.String>;
|
|
121
|
+
category: Schema.NullOr<typeof Schema.String>;
|
|
122
|
+
usageCount: Schema.filter<typeof Schema.Number>;
|
|
123
|
+
lastUsedAt: Schema.NullOr<typeof Schema.DateFromSelf>;
|
|
124
|
+
outcomeScore: Schema.NullOr<typeof Schema.Number>;
|
|
125
|
+
embedding: Schema.NullOr<Schema.instanceOf<Float32Array<ArrayBuffer>>>;
|
|
126
|
+
}>>;
|
|
127
|
+
searchQuery: typeof Schema.String;
|
|
128
|
+
searchDuration: typeof Schema.Number;
|
|
129
|
+
}>;
|
|
130
|
+
export type ContextResult = typeof ContextResultSchema.Type;
|
|
131
|
+
/** Result of a learning search operation. */
|
|
132
|
+
export declare const LearningSearchResultSchema: Schema.Struct<{
|
|
133
|
+
learnings: Schema.Array$<Schema.Struct<{
|
|
134
|
+
id: Schema.brand<Schema.filter<typeof Schema.Number>, "LearningId">;
|
|
135
|
+
content: typeof Schema.String;
|
|
136
|
+
sourceType: Schema.Literal<["compaction", "run", "manual", "claude_md"]>;
|
|
137
|
+
sourceRef: Schema.NullOr<typeof Schema.String>;
|
|
138
|
+
createdAt: typeof Schema.DateFromSelf;
|
|
139
|
+
keywords: Schema.Array$<typeof Schema.String>;
|
|
140
|
+
category: Schema.NullOr<typeof Schema.String>;
|
|
141
|
+
usageCount: Schema.filter<typeof Schema.Number>;
|
|
142
|
+
lastUsedAt: Schema.NullOr<typeof Schema.DateFromSelf>;
|
|
143
|
+
outcomeScore: Schema.NullOr<typeof Schema.Number>;
|
|
144
|
+
embedding: Schema.NullOr<Schema.instanceOf<Float32Array<ArrayBuffer>>>;
|
|
145
|
+
}>>;
|
|
146
|
+
query: typeof Schema.String;
|
|
147
|
+
searchDuration: typeof Schema.Number;
|
|
148
|
+
}>;
|
|
149
|
+
export type LearningSearchResult = typeof LearningSearchResultSchema.Type;
|
|
150
|
+
/** Options for MMR (Maximal Marginal Relevance) diversification. See PRD-017. */
|
|
151
|
+
export declare const DiversificationOptionsSchema: Schema.Struct<{
|
|
152
|
+
/** Enable MMR diversification (default: false) */
|
|
153
|
+
enabled: Schema.optional<typeof Schema.Boolean>;
|
|
154
|
+
/** Trade-off between relevance (1.0) and diversity (0.0) (default: 0.7) */
|
|
155
|
+
lambda: Schema.optional<typeof Schema.Number>;
|
|
156
|
+
/** Maximum results per category for top 5 results (default: 2) */
|
|
157
|
+
maxPerCategory: Schema.optional<Schema.filter<typeof Schema.Number>>;
|
|
158
|
+
}>;
|
|
159
|
+
export type DiversificationOptions = typeof DiversificationOptionsSchema.Type;
|
|
160
|
+
/** Options for retrieval operations. Used by RetrieverService.search(). */
|
|
161
|
+
export declare const RetrievalOptionsSchema: Schema.Struct<{
|
|
162
|
+
/** Maximum number of results to return (default: 10) */
|
|
163
|
+
limit: Schema.optional<Schema.filter<typeof Schema.Number>>;
|
|
164
|
+
/** Minimum relevance score threshold (default: 0.1) */
|
|
165
|
+
minScore: Schema.optional<typeof Schema.Number>;
|
|
166
|
+
/** Optional category filter */
|
|
167
|
+
category: Schema.optional<typeof Schema.String>;
|
|
168
|
+
/** Optional source type filter */
|
|
169
|
+
sourceType: Schema.optional<Schema.Literal<["compaction", "run", "manual", "claude_md"]>>;
|
|
170
|
+
/** MMR diversification options for result variety */
|
|
171
|
+
diversification: Schema.optional<Schema.Struct<{
|
|
172
|
+
/** Enable MMR diversification (default: false) */
|
|
173
|
+
enabled: Schema.optional<typeof Schema.Boolean>;
|
|
174
|
+
/** Trade-off between relevance (1.0) and diversity (0.0) (default: 0.7) */
|
|
175
|
+
lambda: Schema.optional<typeof Schema.Number>;
|
|
176
|
+
/** Maximum results per category for top 5 results (default: 2) */
|
|
177
|
+
maxPerCategory: Schema.optional<Schema.filter<typeof Schema.Number>>;
|
|
178
|
+
}>>;
|
|
179
|
+
}>;
|
|
180
|
+
export type RetrievalOptions = typeof RetrievalOptionsSchema.Type;
|
|
181
|
+
/** Database row type for learnings (snake_case from SQLite). */
|
|
154
182
|
export interface LearningRow {
|
|
155
183
|
id: number;
|
|
156
184
|
content: string;
|
|
@@ -164,40 +192,7 @@ export interface LearningRow {
|
|
|
164
192
|
outcome_score: number | null;
|
|
165
193
|
embedding: Buffer | null;
|
|
166
194
|
}
|
|
167
|
-
/**
|
|
168
|
-
* Options for MMR (Maximal Marginal Relevance) diversification.
|
|
169
|
-
* Balances relevance with diversity to avoid redundant results.
|
|
170
|
-
* See PRD-017 for specification.
|
|
171
|
-
*/
|
|
172
|
-
export interface DiversificationOptions {
|
|
173
|
-
/** Enable MMR diversification (default: false) */
|
|
174
|
-
readonly enabled?: boolean;
|
|
175
|
-
/** Trade-off between relevance (1.0) and diversity (0.0) (default: 0.7) */
|
|
176
|
-
readonly lambda?: number;
|
|
177
|
-
/** Maximum results per category for top 5 results (default: 2) */
|
|
178
|
-
readonly maxPerCategory?: number;
|
|
179
|
-
}
|
|
180
|
-
/**
|
|
181
|
-
* Options for retrieval operations.
|
|
182
|
-
* Used by RetrieverService.search() and custom retrievers.
|
|
183
|
-
*/
|
|
184
|
-
export interface RetrievalOptions {
|
|
185
|
-
/** Maximum number of results to return (default: 10) */
|
|
186
|
-
readonly limit?: number;
|
|
187
|
-
/** Minimum relevance score threshold (default: 0.1) */
|
|
188
|
-
readonly minScore?: number;
|
|
189
|
-
/** Optional category filter */
|
|
190
|
-
readonly category?: string;
|
|
191
|
-
/** Optional source type filter */
|
|
192
|
-
readonly sourceType?: LearningSourceType;
|
|
193
|
-
/** Graph expansion options for traversing related learnings */
|
|
194
|
-
readonly graphExpansion?: GraphExpansionQueryOptions;
|
|
195
|
-
/** MMR diversification options for result variety */
|
|
196
|
-
readonly diversification?: DiversificationOptions;
|
|
197
|
-
}
|
|
198
|
-
/**
|
|
199
|
-
* Learning row with BM25 score from FTS5 query.
|
|
200
|
-
*/
|
|
195
|
+
/** Learning row with BM25 score from FTS5 query. */
|
|
201
196
|
export interface LearningRowWithBM25 extends LearningRow {
|
|
202
197
|
bm25_score: number;
|
|
203
198
|
}
|
package/dist/learning.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"learning.d.ts","sourceRoot":"","sources":["../src/learning.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"learning.d.ts","sourceRoot":"","sources":["../src/learning.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAM/B;;GAEG;AACH,eAAO,MAAM,qBAAqB,uDAKxB,CAAC;AAMX,2DAA2D;AAC3D,eAAO,MAAM,wBAAwB,8DAA2C,CAAA;AAChF,MAAM,MAAM,kBAAkB,GAAG,OAAO,wBAAwB,CAAC,IAA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|
+
* 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
|
* Valid learning source types.
|
|
10
15
|
*/
|
|
@@ -14,4 +19,107 @@ export const LEARNING_SOURCE_TYPES = [
|
|
|
14
19
|
"manual",
|
|
15
20
|
"claude_md",
|
|
16
21
|
];
|
|
22
|
+
// =============================================================================
|
|
23
|
+
// SCHEMAS & TYPES
|
|
24
|
+
// =============================================================================
|
|
25
|
+
/** Learning source type - where the learning came from. */
|
|
26
|
+
export const LearningSourceTypeSchema = Schema.Literal(...LEARNING_SOURCE_TYPES);
|
|
27
|
+
/** Learning ID - branded integer. */
|
|
28
|
+
export const LearningIdSchema = Schema.Number.pipe(Schema.int(), Schema.brand("LearningId"));
|
|
29
|
+
/** Core learning entity. */
|
|
30
|
+
export const LearningSchema = Schema.Struct({
|
|
31
|
+
id: LearningIdSchema,
|
|
32
|
+
content: Schema.String,
|
|
33
|
+
sourceType: LearningSourceTypeSchema,
|
|
34
|
+
sourceRef: Schema.NullOr(Schema.String),
|
|
35
|
+
createdAt: Schema.DateFromSelf,
|
|
36
|
+
keywords: Schema.Array(Schema.String),
|
|
37
|
+
category: Schema.NullOr(Schema.String),
|
|
38
|
+
usageCount: Schema.Number.pipe(Schema.int()),
|
|
39
|
+
lastUsedAt: Schema.NullOr(Schema.DateFromSelf),
|
|
40
|
+
outcomeScore: Schema.NullOr(Schema.Number),
|
|
41
|
+
embedding: Schema.NullOr(Schema.instanceOf(Float32Array)),
|
|
42
|
+
});
|
|
43
|
+
/** Learning with relevance scoring from search results. */
|
|
44
|
+
export const LearningWithScoreSchema = Schema.Struct({
|
|
45
|
+
...LearningSchema.fields,
|
|
46
|
+
relevanceScore: Schema.Number,
|
|
47
|
+
bm25Score: Schema.Number,
|
|
48
|
+
vectorScore: Schema.Number,
|
|
49
|
+
recencyScore: Schema.Number,
|
|
50
|
+
/** RRF (Reciprocal Rank Fusion) score from combining BM25 and vector rankings */
|
|
51
|
+
rrfScore: Schema.Number,
|
|
52
|
+
/** Rank in BM25 results (1-indexed, 0 if not in BM25 results) */
|
|
53
|
+
bm25Rank: Schema.Number.pipe(Schema.int()),
|
|
54
|
+
/** Rank in vector similarity results (1-indexed, 0 if not in vector results) */
|
|
55
|
+
vectorRank: Schema.Number.pipe(Schema.int()),
|
|
56
|
+
/** LLM reranker score (0-1, optional - only present when reranking is applied) */
|
|
57
|
+
rerankerScore: Schema.optional(Schema.Number),
|
|
58
|
+
/** Feedback score from historical usage (0-1, 0.5 = neutral, optional) */
|
|
59
|
+
feedbackScore: Schema.optional(Schema.Number),
|
|
60
|
+
});
|
|
61
|
+
/** Input for creating a new learning. */
|
|
62
|
+
export const CreateLearningInputSchema = Schema.Struct({
|
|
63
|
+
content: Schema.String,
|
|
64
|
+
sourceType: Schema.optional(LearningSourceTypeSchema),
|
|
65
|
+
sourceRef: Schema.optional(Schema.NullOr(Schema.String)),
|
|
66
|
+
keywords: Schema.optional(Schema.Array(Schema.String)),
|
|
67
|
+
category: Schema.optional(Schema.NullOr(Schema.String)),
|
|
68
|
+
});
|
|
69
|
+
/** Input for updating an existing learning. */
|
|
70
|
+
export const UpdateLearningInputSchema = Schema.Struct({
|
|
71
|
+
usageCount: Schema.optional(Schema.Number.pipe(Schema.int())),
|
|
72
|
+
lastUsedAt: Schema.optional(Schema.DateFromSelf),
|
|
73
|
+
outcomeScore: Schema.optional(Schema.Number),
|
|
74
|
+
embedding: Schema.optional(Schema.instanceOf(Float32Array)),
|
|
75
|
+
});
|
|
76
|
+
/** Query options for learning searches. */
|
|
77
|
+
export const LearningQuerySchema = Schema.Struct({
|
|
78
|
+
query: Schema.String,
|
|
79
|
+
limit: Schema.optional(Schema.Number.pipe(Schema.int())),
|
|
80
|
+
minScore: Schema.optional(Schema.Number),
|
|
81
|
+
category: Schema.optional(Schema.String),
|
|
82
|
+
sourceType: Schema.optional(LearningSourceTypeSchema),
|
|
83
|
+
});
|
|
84
|
+
/** Options for context retrieval. */
|
|
85
|
+
export const ContextOptionsSchema = Schema.Struct({
|
|
86
|
+
/** Maximum number of learnings to return (default: 10, capped at 50). Misnamed — this is a result count, not a token budget. */
|
|
87
|
+
maxTokens: Schema.optional(Schema.Number.pipe(Schema.int())),
|
|
88
|
+
});
|
|
89
|
+
/** Result of context retrieval for a task. */
|
|
90
|
+
export const ContextResultSchema = Schema.Struct({
|
|
91
|
+
taskId: Schema.String,
|
|
92
|
+
taskTitle: Schema.String,
|
|
93
|
+
learnings: Schema.Array(LearningWithScoreSchema),
|
|
94
|
+
searchQuery: Schema.String,
|
|
95
|
+
searchDuration: Schema.Number,
|
|
96
|
+
});
|
|
97
|
+
/** Result of a learning search operation. */
|
|
98
|
+
export const LearningSearchResultSchema = Schema.Struct({
|
|
99
|
+
learnings: Schema.Array(LearningSchema),
|
|
100
|
+
query: Schema.String,
|
|
101
|
+
searchDuration: Schema.Number,
|
|
102
|
+
});
|
|
103
|
+
/** Options for MMR (Maximal Marginal Relevance) diversification. See PRD-017. */
|
|
104
|
+
export const DiversificationOptionsSchema = Schema.Struct({
|
|
105
|
+
/** Enable MMR diversification (default: false) */
|
|
106
|
+
enabled: Schema.optional(Schema.Boolean),
|
|
107
|
+
/** Trade-off between relevance (1.0) and diversity (0.0) (default: 0.7) */
|
|
108
|
+
lambda: Schema.optional(Schema.Number),
|
|
109
|
+
/** Maximum results per category for top 5 results (default: 2) */
|
|
110
|
+
maxPerCategory: Schema.optional(Schema.Number.pipe(Schema.int())),
|
|
111
|
+
});
|
|
112
|
+
/** Options for retrieval operations. Used by RetrieverService.search(). */
|
|
113
|
+
export const RetrievalOptionsSchema = Schema.Struct({
|
|
114
|
+
/** Maximum number of results to return (default: 10) */
|
|
115
|
+
limit: Schema.optional(Schema.Number.pipe(Schema.int())),
|
|
116
|
+
/** Minimum relevance score threshold (default: 0.1) */
|
|
117
|
+
minScore: Schema.optional(Schema.Number),
|
|
118
|
+
/** Optional category filter */
|
|
119
|
+
category: Schema.optional(Schema.String),
|
|
120
|
+
/** Optional source type filter */
|
|
121
|
+
sourceType: Schema.optional(LearningSourceTypeSchema),
|
|
122
|
+
/** MMR diversification options for result variety */
|
|
123
|
+
diversification: Schema.optional(DiversificationOptionsSchema),
|
|
124
|
+
});
|
|
17
125
|
//# sourceMappingURL=learning.js.map
|