@eddacraft/kindling-core 0.1.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/LICENSE +190 -0
- package/README.md +187 -0
- package/dist/capsule/index.d.ts +10 -0
- package/dist/capsule/index.d.ts.map +1 -0
- package/dist/capsule/index.js +10 -0
- package/dist/capsule/index.js.map +1 -0
- package/dist/capsule/lifecycle.d.ts +63 -0
- package/dist/capsule/lifecycle.d.ts.map +1 -0
- package/dist/capsule/lifecycle.js +108 -0
- package/dist/capsule/lifecycle.js.map +1 -0
- package/dist/capsule/manager.d.ts +79 -0
- package/dist/capsule/manager.d.ts.map +1 -0
- package/dist/capsule/manager.js +113 -0
- package/dist/capsule/manager.js.map +1 -0
- package/dist/capsule/types.d.ts +79 -0
- package/dist/capsule/types.d.ts.map +1 -0
- package/dist/capsule/types.js +5 -0
- package/dist/capsule/types.js.map +1 -0
- package/dist/export/bundle.d.ts +125 -0
- package/dist/export/bundle.d.ts.map +1 -0
- package/dist/export/bundle.js +136 -0
- package/dist/export/bundle.js.map +1 -0
- package/dist/export/index.d.ts +8 -0
- package/dist/export/index.d.ts.map +1 -0
- package/dist/export/index.js +8 -0
- package/dist/export/index.js.map +1 -0
- package/dist/export/restore.d.ts +111 -0
- package/dist/export/restore.d.ts.map +1 -0
- package/dist/export/restore.js +149 -0
- package/dist/export/restore.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/dist/retrieval/index.d.ts +8 -0
- package/dist/retrieval/index.d.ts.map +1 -0
- package/dist/retrieval/index.js +8 -0
- package/dist/retrieval/index.js.map +1 -0
- package/dist/retrieval/orchestrator.d.ts +50 -0
- package/dist/retrieval/orchestrator.d.ts.map +1 -0
- package/dist/retrieval/orchestrator.js +86 -0
- package/dist/retrieval/orchestrator.js.map +1 -0
- package/dist/retrieval/tiering.d.ts +76 -0
- package/dist/retrieval/tiering.d.ts.map +1 -0
- package/dist/retrieval/tiering.js +122 -0
- package/dist/retrieval/tiering.js.map +1 -0
- package/dist/service/index.d.ts +6 -0
- package/dist/service/index.d.ts.map +1 -0
- package/dist/service/index.js +5 -0
- package/dist/service/index.js.map +1 -0
- package/dist/service/kindling-service.d.ts +219 -0
- package/dist/service/kindling-service.d.ts.map +1 -0
- package/dist/service/kindling-service.js +260 -0
- package/dist/service/kindling-service.js.map +1 -0
- package/dist/types/capsule.d.ts +80 -0
- package/dist/types/capsule.d.ts.map +1 -0
- package/dist/types/capsule.js +33 -0
- package/dist/types/capsule.js.map +1 -0
- package/dist/types/common.d.ts +56 -0
- package/dist/types/common.d.ts.map +1 -0
- package/dist/types/common.js +16 -0
- package/dist/types/common.js.map +1 -0
- package/dist/types/index.d.ts +17 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +11 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/observation.d.ts +60 -0
- package/dist/types/observation.d.ts.map +1 -0
- package/dist/types/observation.js +27 -0
- package/dist/types/observation.js.map +1 -0
- package/dist/types/pin.d.ts +65 -0
- package/dist/types/pin.d.ts.map +1 -0
- package/dist/types/pin.js +26 -0
- package/dist/types/pin.js.map +1 -0
- package/dist/types/retrieval.d.ts +81 -0
- package/dist/types/retrieval.d.ts.map +1 -0
- package/dist/types/retrieval.js +5 -0
- package/dist/types/retrieval.js.map +1 -0
- package/dist/types/summary.d.ts +49 -0
- package/dist/types/summary.d.ts.map +1 -0
- package/dist/types/summary.js +13 -0
- package/dist/types/summary.js.map +1 -0
- package/dist/validation/capsule.d.ts +18 -0
- package/dist/validation/capsule.d.ts.map +1 -0
- package/dist/validation/capsule.js +143 -0
- package/dist/validation/capsule.js.map +1 -0
- package/dist/validation/index.d.ts +8 -0
- package/dist/validation/index.d.ts.map +1 -0
- package/dist/validation/index.js +8 -0
- package/dist/validation/index.js.map +1 -0
- package/dist/validation/observation.d.ts +18 -0
- package/dist/validation/observation.d.ts.map +1 -0
- package/dist/validation/observation.js +110 -0
- package/dist/validation/observation.js.map +1 -0
- package/dist/validation/pin.d.ts +16 -0
- package/dist/validation/pin.d.ts.map +1 -0
- package/dist/validation/pin.js +116 -0
- package/dist/validation/pin.js.map +1 -0
- package/dist/validation/summary.d.ts +16 -0
- package/dist/validation/summary.d.ts.map +1 -0
- package/dist/validation/summary.js +117 -0
- package/dist/validation/summary.js.map +1 -0
- package/package.json +55 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Common types used across Kindling packages
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Helper to create a success result
|
|
6
|
+
*/
|
|
7
|
+
export function ok(value) {
|
|
8
|
+
return { ok: true, value };
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Helper to create an error result
|
|
12
|
+
*/
|
|
13
|
+
export function err(error) {
|
|
14
|
+
return { ok: false, error };
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/types/common.ts"],"names":[],"mappings":"AAAA;;GAEG;AA+CH;;GAEG;AACH,MAAM,UAAU,EAAE,CAAI,KAAQ;IAC5B,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;AAC7B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,GAAG,CAAI,KAAQ;IAC7B,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;AAC9B,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Kindling Core Types
|
|
3
|
+
*
|
|
4
|
+
* Re-exports all domain types for convenient importing
|
|
5
|
+
*/
|
|
6
|
+
export type { ID, Timestamp, ScopeIds, Result, ValidationError, } from './common.js';
|
|
7
|
+
export { ok, err, } from './common.js';
|
|
8
|
+
export type { ObservationKind, Observation, ObservationInput, } from './observation.js';
|
|
9
|
+
export { OBSERVATION_KINDS, isObservationKind, } from './observation.js';
|
|
10
|
+
export type { CapsuleType, CapsuleStatus, Capsule, CapsuleInput, } from './capsule.js';
|
|
11
|
+
export { CAPSULE_TYPES, CAPSULE_STATUSES, isCapsuleType, isCapsuleStatus, } from './capsule.js';
|
|
12
|
+
export type { Summary, SummaryInput, } from './summary.js';
|
|
13
|
+
export { isValidConfidence, } from './summary.js';
|
|
14
|
+
export type { PinTargetType, Pin, PinInput, } from './pin.js';
|
|
15
|
+
export { PIN_TARGET_TYPES, isPinTargetType, isPinActive, } from './pin.js';
|
|
16
|
+
export type { RetrieveOptions, PinResult, CandidateResult, RetrieveProvenance, RetrieveResult, ProviderSearchOptions, ProviderSearchResult, RetrievalProvider, } from './retrieval.js';
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,YAAY,EACV,EAAE,EACF,SAAS,EACT,QAAQ,EACR,MAAM,EACN,eAAe,GAChB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,EAAE,EACF,GAAG,GACJ,MAAM,aAAa,CAAC;AAGrB,YAAY,EACV,eAAe,EACf,WAAW,EACX,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,kBAAkB,CAAC;AAG1B,YAAY,EACV,WAAW,EACX,aAAa,EACb,OAAO,EACP,YAAY,GACb,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,eAAe,GAChB,MAAM,cAAc,CAAC;AAGtB,YAAY,EACV,OAAO,EACP,YAAY,GACb,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,iBAAiB,GAClB,MAAM,cAAc,CAAC;AAGtB,YAAY,EACV,aAAa,EACb,GAAG,EACH,QAAQ,GACT,MAAM,UAAU,CAAC;AAElB,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,WAAW,GACZ,MAAM,UAAU,CAAC;AAGlB,YAAY,EACV,eAAe,EACf,SAAS,EACT,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,qBAAqB,EACrB,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Kindling Core Types
|
|
3
|
+
*
|
|
4
|
+
* Re-exports all domain types for convenient importing
|
|
5
|
+
*/
|
|
6
|
+
export { ok, err, } from './common.js';
|
|
7
|
+
export { OBSERVATION_KINDS, isObservationKind, } from './observation.js';
|
|
8
|
+
export { CAPSULE_TYPES, CAPSULE_STATUSES, isCapsuleType, isCapsuleStatus, } from './capsule.js';
|
|
9
|
+
export { isValidConfidence, } from './summary.js';
|
|
10
|
+
export { PIN_TARGET_TYPES, isPinTargetType, isPinActive, } from './pin.js';
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAWH,OAAO,EACL,EAAE,EACF,GAAG,GACJ,MAAM,aAAa,CAAC;AASrB,OAAO,EACL,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,kBAAkB,CAAC;AAU1B,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,eAAe,GAChB,MAAM,cAAc,CAAC;AAQtB,OAAO,EACL,iBAAiB,GAClB,MAAM,cAAc,CAAC;AAStB,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,WAAW,GACZ,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Observation types and definitions
|
|
3
|
+
*
|
|
4
|
+
* An Observation is an atomic, immutable record of an event that occurred
|
|
5
|
+
* during development (tool call, command, diff, error, message, etc.)
|
|
6
|
+
*/
|
|
7
|
+
import type { ID, Timestamp, ScopeIds } from './common.js';
|
|
8
|
+
/**
|
|
9
|
+
* Types of observations that can be captured
|
|
10
|
+
*/
|
|
11
|
+
export type ObservationKind = 'tool_call' | 'command' | 'file_diff' | 'error' | 'message' | 'node_start' | 'node_end' | 'node_output' | 'node_error';
|
|
12
|
+
/**
|
|
13
|
+
* Observation entity
|
|
14
|
+
*
|
|
15
|
+
* Immutable except for the `redacted` flag (via explicit redaction API)
|
|
16
|
+
*/
|
|
17
|
+
export interface Observation {
|
|
18
|
+
/** Unique identifier (UUIDv4) */
|
|
19
|
+
id: ID;
|
|
20
|
+
/** Type of observation */
|
|
21
|
+
kind: ObservationKind;
|
|
22
|
+
/** The actual content (text, JSON, etc.) */
|
|
23
|
+
content: string;
|
|
24
|
+
/**
|
|
25
|
+
* Source-specific metadata (e.g., toolName, exitCode, nodeId)
|
|
26
|
+
* Stored as JSON blob in persistence layer
|
|
27
|
+
*/
|
|
28
|
+
provenance: Record<string, unknown>;
|
|
29
|
+
/** Timestamp when observation was created (epoch milliseconds) */
|
|
30
|
+
ts: Timestamp;
|
|
31
|
+
/** Isolation dimensions for scoped queries */
|
|
32
|
+
scopeIds: ScopeIds;
|
|
33
|
+
/**
|
|
34
|
+
* Privacy flag
|
|
35
|
+
* If true, content is '[redacted]' and observation is excluded from FTS
|
|
36
|
+
*/
|
|
37
|
+
redacted: boolean;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Input for creating a new observation
|
|
41
|
+
* Makes id, ts, and redacted optional (will be auto-generated)
|
|
42
|
+
*/
|
|
43
|
+
export interface ObservationInput {
|
|
44
|
+
id?: ID;
|
|
45
|
+
kind: ObservationKind;
|
|
46
|
+
content: string;
|
|
47
|
+
provenance?: Record<string, unknown>;
|
|
48
|
+
ts?: Timestamp;
|
|
49
|
+
scopeIds: ScopeIds;
|
|
50
|
+
redacted?: boolean;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* All valid observation kinds
|
|
54
|
+
*/
|
|
55
|
+
export declare const OBSERVATION_KINDS: readonly ObservationKind[];
|
|
56
|
+
/**
|
|
57
|
+
* Type guard to check if a string is a valid ObservationKind
|
|
58
|
+
*/
|
|
59
|
+
export declare function isObservationKind(value: unknown): value is ObservationKind;
|
|
60
|
+
//# sourceMappingURL=observation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"observation.d.ts","sourceRoot":"","sources":["../../src/types/observation.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE3D;;GAEG;AACH,MAAM,MAAM,eAAe,GACvB,WAAW,GACX,SAAS,GACT,WAAW,GACX,OAAO,GACP,SAAS,GACT,YAAY,GACZ,UAAU,GACV,aAAa,GACb,YAAY,CAAC;AAEjB;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC1B,iCAAiC;IACjC,EAAE,EAAE,EAAE,CAAC;IAEP,0BAA0B;IAC1B,IAAI,EAAE,eAAe,CAAC;IAEtB,4CAA4C;IAC5C,OAAO,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAEpC,kEAAkE;IAClE,EAAE,EAAE,SAAS,CAAC;IAEd,8CAA8C;IAC9C,QAAQ,EAAE,QAAQ,CAAC;IAEnB;;;OAGG;IACH,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,EAAE,CAAC,EAAE,EAAE,CAAC;IACR,IAAI,EAAE,eAAe,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,EAAE,CAAC,EAAE,SAAS,CAAC;IACf,QAAQ,EAAE,QAAQ,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;GAEG;AACH,eAAO,MAAM,iBAAiB,EAAE,SAAS,eAAe,EAU9C,CAAC;AAEX;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,eAAe,CAE1E"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Observation types and definitions
|
|
3
|
+
*
|
|
4
|
+
* An Observation is an atomic, immutable record of an event that occurred
|
|
5
|
+
* during development (tool call, command, diff, error, message, etc.)
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* All valid observation kinds
|
|
9
|
+
*/
|
|
10
|
+
export const OBSERVATION_KINDS = [
|
|
11
|
+
'tool_call',
|
|
12
|
+
'command',
|
|
13
|
+
'file_diff',
|
|
14
|
+
'error',
|
|
15
|
+
'message',
|
|
16
|
+
'node_start',
|
|
17
|
+
'node_end',
|
|
18
|
+
'node_output',
|
|
19
|
+
'node_error',
|
|
20
|
+
];
|
|
21
|
+
/**
|
|
22
|
+
* Type guard to check if a string is a valid ObservationKind
|
|
23
|
+
*/
|
|
24
|
+
export function isObservationKind(value) {
|
|
25
|
+
return typeof value === 'string' && OBSERVATION_KINDS.includes(value);
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=observation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"observation.js","sourceRoot":"","sources":["../../src/types/observation.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAkEH;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAA+B;IAC3D,WAAW;IACX,SAAS;IACT,WAAW;IACX,OAAO;IACP,SAAS;IACT,YAAY;IACZ,UAAU;IACV,aAAa;IACb,YAAY;CACJ,CAAC;AAEX;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAc;IAC9C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,iBAAiB,CAAC,QAAQ,CAAC,KAAwB,CAAC,CAAC;AAC3F,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pin types and definitions
|
|
3
|
+
*
|
|
4
|
+
* A Pin marks an observation or summary as important
|
|
5
|
+
* (user-curated for retrieval prioritization)
|
|
6
|
+
*/
|
|
7
|
+
import type { ID, Timestamp, ScopeIds } from './common.js';
|
|
8
|
+
/**
|
|
9
|
+
* Type of entity that can be pinned
|
|
10
|
+
*/
|
|
11
|
+
export type PinTargetType = 'observation' | 'summary';
|
|
12
|
+
/**
|
|
13
|
+
* Pin entity
|
|
14
|
+
*
|
|
15
|
+
* Immutable - delete to remove
|
|
16
|
+
*/
|
|
17
|
+
export interface Pin {
|
|
18
|
+
/** Unique identifier (UUIDv4) */
|
|
19
|
+
id: ID;
|
|
20
|
+
/** Type of entity being pinned */
|
|
21
|
+
targetType: PinTargetType;
|
|
22
|
+
/** ID of the pinned entity (observation or summary) */
|
|
23
|
+
targetId: ID;
|
|
24
|
+
/**
|
|
25
|
+
* Optional user-provided explanation for why this is pinned
|
|
26
|
+
* e.g., "Critical context for auth flow"
|
|
27
|
+
*/
|
|
28
|
+
reason?: string;
|
|
29
|
+
/** Timestamp when pin was created (epoch milliseconds) */
|
|
30
|
+
createdAt: Timestamp;
|
|
31
|
+
/**
|
|
32
|
+
* Optional expiration timestamp (epoch milliseconds)
|
|
33
|
+
* If set, pin is only active while expiresAt > now
|
|
34
|
+
* Supports time-bound pins (e.g., session-only)
|
|
35
|
+
*/
|
|
36
|
+
expiresAt?: Timestamp;
|
|
37
|
+
/** Isolation dimensions for scoped queries */
|
|
38
|
+
scopeIds: ScopeIds;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Input for creating a new pin
|
|
42
|
+
* Makes id and createdAt optional (will be auto-generated)
|
|
43
|
+
*/
|
|
44
|
+
export interface PinInput {
|
|
45
|
+
id?: ID;
|
|
46
|
+
targetType: PinTargetType;
|
|
47
|
+
targetId: ID;
|
|
48
|
+
reason?: string;
|
|
49
|
+
createdAt?: Timestamp;
|
|
50
|
+
expiresAt?: Timestamp;
|
|
51
|
+
scopeIds: ScopeIds;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* All valid pin target types
|
|
55
|
+
*/
|
|
56
|
+
export declare const PIN_TARGET_TYPES: readonly PinTargetType[];
|
|
57
|
+
/**
|
|
58
|
+
* Type guard to check if a string is a valid PinTargetType
|
|
59
|
+
*/
|
|
60
|
+
export declare function isPinTargetType(value: unknown): value is PinTargetType;
|
|
61
|
+
/**
|
|
62
|
+
* Check if a pin is active (not expired) at a given timestamp
|
|
63
|
+
*/
|
|
64
|
+
export declare function isPinActive(pin: Pin, now: Timestamp): boolean;
|
|
65
|
+
//# sourceMappingURL=pin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pin.d.ts","sourceRoot":"","sources":["../../src/types/pin.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE3D;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,aAAa,GAAG,SAAS,CAAC;AAEtD;;;;GAIG;AACH,MAAM,WAAW,GAAG;IAClB,iCAAiC;IACjC,EAAE,EAAE,EAAE,CAAC;IAEP,kCAAkC;IAClC,UAAU,EAAE,aAAa,CAAC;IAE1B,uDAAuD;IACvD,QAAQ,EAAE,EAAE,CAAC;IAEb;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,0DAA0D;IAC1D,SAAS,EAAE,SAAS,CAAC;IAErB;;;;OAIG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IAEtB,8CAA8C;IAC9C,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAED;;;GAGG;AACH,MAAM,WAAW,QAAQ;IACvB,EAAE,CAAC,EAAE,EAAE,CAAC;IACR,UAAU,EAAE,aAAa,CAAC;IAC1B,QAAQ,EAAE,EAAE,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAED;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,SAAS,aAAa,EAG3C,CAAC;AAEX;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,aAAa,CAEtE;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,SAAS,GAAG,OAAO,CAE7D"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pin types and definitions
|
|
3
|
+
*
|
|
4
|
+
* A Pin marks an observation or summary as important
|
|
5
|
+
* (user-curated for retrieval prioritization)
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* All valid pin target types
|
|
9
|
+
*/
|
|
10
|
+
export const PIN_TARGET_TYPES = [
|
|
11
|
+
'observation',
|
|
12
|
+
'summary',
|
|
13
|
+
];
|
|
14
|
+
/**
|
|
15
|
+
* Type guard to check if a string is a valid PinTargetType
|
|
16
|
+
*/
|
|
17
|
+
export function isPinTargetType(value) {
|
|
18
|
+
return typeof value === 'string' && PIN_TARGET_TYPES.includes(value);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Check if a pin is active (not expired) at a given timestamp
|
|
22
|
+
*/
|
|
23
|
+
export function isPinActive(pin, now) {
|
|
24
|
+
return pin.expiresAt === undefined || pin.expiresAt > now;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=pin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pin.js","sourceRoot":"","sources":["../../src/types/pin.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AA0DH;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAA6B;IACxD,aAAa;IACb,SAAS;CACD,CAAC;AAEX;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,KAAc;IAC5C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,gBAAgB,CAAC,QAAQ,CAAC,KAAsB,CAAC,CAAC;AACxF,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,GAAQ,EAAE,GAAc;IAClD,OAAO,GAAG,CAAC,SAAS,KAAK,SAAS,IAAI,GAAG,CAAC,SAAS,GAAG,GAAG,CAAC;AAC5D,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Retrieval types and interfaces
|
|
3
|
+
*/
|
|
4
|
+
import type { ScopeIds, ID } from './common.js';
|
|
5
|
+
import type { Observation } from './observation.js';
|
|
6
|
+
import type { Summary } from './summary.js';
|
|
7
|
+
import type { Pin } from './pin.js';
|
|
8
|
+
/**
|
|
9
|
+
* Options for retrieval request
|
|
10
|
+
*/
|
|
11
|
+
export interface RetrieveOptions {
|
|
12
|
+
query: string;
|
|
13
|
+
scopeIds: ScopeIds;
|
|
14
|
+
/**
|
|
15
|
+
* @deprecated Use maxCandidates for bounded result sets. Token-budgeted assembly is a downstream system responsibility.
|
|
16
|
+
*/
|
|
17
|
+
tokenBudget?: number;
|
|
18
|
+
maxCandidates?: number;
|
|
19
|
+
includeRedacted?: boolean;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Pin with resolved target
|
|
23
|
+
*/
|
|
24
|
+
export interface PinResult {
|
|
25
|
+
pin: Pin;
|
|
26
|
+
target: Observation | Summary;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Candidate with score and match context
|
|
30
|
+
*/
|
|
31
|
+
export interface CandidateResult {
|
|
32
|
+
entity: Observation | Summary;
|
|
33
|
+
score: number;
|
|
34
|
+
matchContext?: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Provenance for retrieval result
|
|
38
|
+
*/
|
|
39
|
+
export interface RetrieveProvenance {
|
|
40
|
+
query: string;
|
|
41
|
+
scopeIds: ScopeIds;
|
|
42
|
+
totalCandidates: number;
|
|
43
|
+
returnedCandidates: number;
|
|
44
|
+
truncatedDueToTokenBudget: boolean;
|
|
45
|
+
providerUsed: string;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Complete retrieval result
|
|
49
|
+
*/
|
|
50
|
+
export interface RetrieveResult {
|
|
51
|
+
pins: PinResult[];
|
|
52
|
+
currentSummary?: Summary;
|
|
53
|
+
candidates: CandidateResult[];
|
|
54
|
+
provenance: RetrieveProvenance;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Provider search options
|
|
58
|
+
*/
|
|
59
|
+
export interface ProviderSearchOptions {
|
|
60
|
+
query: string;
|
|
61
|
+
scopeIds: ScopeIds;
|
|
62
|
+
maxResults?: number;
|
|
63
|
+
excludeIds?: ID[];
|
|
64
|
+
includeRedacted?: boolean;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Provider search result
|
|
68
|
+
*/
|
|
69
|
+
export interface ProviderSearchResult {
|
|
70
|
+
entity: Observation | Summary;
|
|
71
|
+
score: number;
|
|
72
|
+
matchContext?: string;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Retrieval provider interface
|
|
76
|
+
*/
|
|
77
|
+
export interface RetrievalProvider {
|
|
78
|
+
name: string;
|
|
79
|
+
search(options: ProviderSearchOptions): Promise<ProviderSearchResult[]>;
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=retrieval.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retrieval.d.ts","sourceRoot":"","sources":["../../src/types/retrieval.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK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,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,EAAE,EAAE,CAAC;IAClB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,oBAAoB,EAAE,CAAC,CAAC;CACzE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retrieval.js","sourceRoot":"","sources":["../../src/types/retrieval.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Summary types and definitions
|
|
3
|
+
*
|
|
4
|
+
* A Summary is a high-level description of a capsule's content
|
|
5
|
+
* (typically LLM-generated on capsule close)
|
|
6
|
+
*/
|
|
7
|
+
import type { ID, Timestamp } from './common.js';
|
|
8
|
+
/**
|
|
9
|
+
* Summary entity
|
|
10
|
+
*
|
|
11
|
+
* Fully immutable once created
|
|
12
|
+
*/
|
|
13
|
+
export interface Summary {
|
|
14
|
+
/** Unique identifier (UUIDv4) */
|
|
15
|
+
id: ID;
|
|
16
|
+
/** Reference to parent capsule (one-to-one relationship) */
|
|
17
|
+
capsuleId: ID;
|
|
18
|
+
/** Summary text (human-readable, typically LLM-generated) */
|
|
19
|
+
content: string;
|
|
20
|
+
/**
|
|
21
|
+
* Quality/confidence score (0.0 = low, 1.0 = high)
|
|
22
|
+
* Indicates reliability of the summary
|
|
23
|
+
*/
|
|
24
|
+
confidence: number;
|
|
25
|
+
/** Timestamp when summary was created (epoch milliseconds) */
|
|
26
|
+
createdAt: Timestamp;
|
|
27
|
+
/**
|
|
28
|
+
* Observation IDs that support this summary (provenance)
|
|
29
|
+
* Shows which observations informed the summary
|
|
30
|
+
*/
|
|
31
|
+
evidenceRefs: ID[];
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Input for creating a new summary
|
|
35
|
+
* Makes id and createdAt optional (will be auto-generated)
|
|
36
|
+
*/
|
|
37
|
+
export interface SummaryInput {
|
|
38
|
+
id?: ID;
|
|
39
|
+
capsuleId: ID;
|
|
40
|
+
content: string;
|
|
41
|
+
confidence: number;
|
|
42
|
+
createdAt?: Timestamp;
|
|
43
|
+
evidenceRefs: ID[];
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Validate that confidence score is in valid range [0.0, 1.0]
|
|
47
|
+
*/
|
|
48
|
+
export declare function isValidConfidence(value: number): boolean;
|
|
49
|
+
//# sourceMappingURL=summary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"summary.d.ts","sourceRoot":"","sources":["../../src/types/summary.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAEjD;;;;GAIG;AACH,MAAM,WAAW,OAAO;IACtB,iCAAiC;IACjC,EAAE,EAAE,EAAE,CAAC;IAEP,4DAA4D;IAC5D,SAAS,EAAE,EAAE,CAAC;IAEd,6DAA6D;IAC7D,OAAO,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB,8DAA8D;IAC9D,SAAS,EAAE,SAAS,CAAC;IAErB;;;OAGG;IACH,YAAY,EAAE,EAAE,EAAE,CAAC;CACpB;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,EAAE,CAAC,EAAE,EAAE,CAAC;IACR,SAAS,EAAE,EAAE,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,YAAY,EAAE,EAAE,EAAE,CAAC;CACpB;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAExD"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Summary types and definitions
|
|
3
|
+
*
|
|
4
|
+
* A Summary is a high-level description of a capsule's content
|
|
5
|
+
* (typically LLM-generated on capsule close)
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Validate that confidence score is in valid range [0.0, 1.0]
|
|
9
|
+
*/
|
|
10
|
+
export function isValidConfidence(value) {
|
|
11
|
+
return typeof value === 'number' && value >= 0.0 && value <= 1.0 && !isNaN(value);
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=summary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"summary.js","sourceRoot":"","sources":["../../src/types/summary.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAgDH;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAa;IAC7C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,IAAI,GAAG,IAAI,KAAK,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AACpF,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Capsule validation
|
|
3
|
+
*/
|
|
4
|
+
import type { Capsule, ValidationError, Result } from '../types/index.js';
|
|
5
|
+
/**
|
|
6
|
+
* Validate and normalize a capsule input
|
|
7
|
+
*
|
|
8
|
+
* Auto-generates:
|
|
9
|
+
* - id (if not provided)
|
|
10
|
+
* - openedAt (if not provided)
|
|
11
|
+
* - status (defaults to 'open')
|
|
12
|
+
* - observationIds (defaults to empty array)
|
|
13
|
+
*
|
|
14
|
+
* @param input - Capsule input to validate
|
|
15
|
+
* @returns Result containing validated Capsule or validation errors
|
|
16
|
+
*/
|
|
17
|
+
export declare function validateCapsule(input: unknown): Result<Capsule, ValidationError[]>;
|
|
18
|
+
//# sourceMappingURL=capsule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capsule.d.ts","sourceRoot":"","sources":["../../src/validation/capsule.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EACV,OAAO,EACP,eAAe,EACf,MAAM,EACP,MAAM,mBAAmB,CAAC;AAQ3B;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAAC,OAAO,EAAE,eAAe,EAAE,CAAC,CAkIlF"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Capsule validation
|
|
3
|
+
*/
|
|
4
|
+
import { randomUUID } from 'crypto';
|
|
5
|
+
import { ok, err, isCapsuleType, isCapsuleStatus, } from '../types/index.js';
|
|
6
|
+
/**
|
|
7
|
+
* Validate and normalize a capsule input
|
|
8
|
+
*
|
|
9
|
+
* Auto-generates:
|
|
10
|
+
* - id (if not provided)
|
|
11
|
+
* - openedAt (if not provided)
|
|
12
|
+
* - status (defaults to 'open')
|
|
13
|
+
* - observationIds (defaults to empty array)
|
|
14
|
+
*
|
|
15
|
+
* @param input - Capsule input to validate
|
|
16
|
+
* @returns Result containing validated Capsule or validation errors
|
|
17
|
+
*/
|
|
18
|
+
export function validateCapsule(input) {
|
|
19
|
+
const errors = [];
|
|
20
|
+
// Type check
|
|
21
|
+
if (typeof input !== 'object' || input === null) {
|
|
22
|
+
return err([{ field: 'input', message: 'Input must be an object' }]);
|
|
23
|
+
}
|
|
24
|
+
const data = input;
|
|
25
|
+
// Validate type (required)
|
|
26
|
+
if (!data.type) {
|
|
27
|
+
errors.push({ field: 'type', message: 'type is required' });
|
|
28
|
+
}
|
|
29
|
+
else if (!isCapsuleType(data.type)) {
|
|
30
|
+
errors.push({
|
|
31
|
+
field: 'type',
|
|
32
|
+
message: `Invalid capsule type: ${data.type}`,
|
|
33
|
+
value: data.type,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
// Validate intent (required, non-empty string)
|
|
37
|
+
if (!data.intent) {
|
|
38
|
+
errors.push({ field: 'intent', message: 'intent is required' });
|
|
39
|
+
}
|
|
40
|
+
else if (typeof data.intent !== 'string') {
|
|
41
|
+
errors.push({
|
|
42
|
+
field: 'intent',
|
|
43
|
+
message: 'intent must be a string',
|
|
44
|
+
value: typeof data.intent,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
else if (data.intent.trim().length === 0) {
|
|
48
|
+
errors.push({ field: 'intent', message: 'intent cannot be empty' });
|
|
49
|
+
}
|
|
50
|
+
// Validate scopeIds (required)
|
|
51
|
+
if (!data.scopeIds) {
|
|
52
|
+
errors.push({ field: 'scopeIds', message: 'scopeIds is required' });
|
|
53
|
+
}
|
|
54
|
+
else if (typeof data.scopeIds !== 'object' || data.scopeIds === null) {
|
|
55
|
+
errors.push({
|
|
56
|
+
field: 'scopeIds',
|
|
57
|
+
message: 'scopeIds must be an object',
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
// Validate status (optional)
|
|
61
|
+
if (data.status !== undefined && !isCapsuleStatus(data.status)) {
|
|
62
|
+
errors.push({
|
|
63
|
+
field: 'status',
|
|
64
|
+
message: `Invalid capsule status: ${data.status}`,
|
|
65
|
+
value: data.status,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
// Validate openedAt (optional, must be positive number)
|
|
69
|
+
if (data.openedAt !== undefined) {
|
|
70
|
+
if (typeof data.openedAt !== 'number') {
|
|
71
|
+
errors.push({
|
|
72
|
+
field: 'openedAt',
|
|
73
|
+
message: 'openedAt must be a number',
|
|
74
|
+
value: typeof data.openedAt,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
else if (data.openedAt < 0) {
|
|
78
|
+
errors.push({
|
|
79
|
+
field: 'openedAt',
|
|
80
|
+
message: 'openedAt must be non-negative',
|
|
81
|
+
value: data.openedAt,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
// Validate closedAt (optional, must be positive number)
|
|
86
|
+
if (data.closedAt !== undefined) {
|
|
87
|
+
if (typeof data.closedAt !== 'number') {
|
|
88
|
+
errors.push({
|
|
89
|
+
field: 'closedAt',
|
|
90
|
+
message: 'closedAt must be a number',
|
|
91
|
+
value: typeof data.closedAt,
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
else if (data.closedAt < 0) {
|
|
95
|
+
errors.push({
|
|
96
|
+
field: 'closedAt',
|
|
97
|
+
message: 'closedAt must be non-negative',
|
|
98
|
+
value: data.closedAt,
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
// Validate observationIds (optional, must be array of strings)
|
|
103
|
+
if (data.observationIds !== undefined) {
|
|
104
|
+
if (!Array.isArray(data.observationIds)) {
|
|
105
|
+
errors.push({
|
|
106
|
+
field: 'observationIds',
|
|
107
|
+
message: 'observationIds must be an array',
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
else if (!data.observationIds.every((id) => typeof id === 'string')) {
|
|
111
|
+
errors.push({
|
|
112
|
+
field: 'observationIds',
|
|
113
|
+
message: 'observationIds must contain only strings',
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
// Validate summaryId (optional, must be string)
|
|
118
|
+
if (data.summaryId !== undefined && typeof data.summaryId !== 'string') {
|
|
119
|
+
errors.push({
|
|
120
|
+
field: 'summaryId',
|
|
121
|
+
message: 'summaryId must be a string',
|
|
122
|
+
value: typeof data.summaryId,
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
// Return errors if any
|
|
126
|
+
if (errors.length > 0) {
|
|
127
|
+
return err(errors);
|
|
128
|
+
}
|
|
129
|
+
// Construct validated capsule with defaults
|
|
130
|
+
const capsule = {
|
|
131
|
+
id: data.id || randomUUID(),
|
|
132
|
+
type: data.type,
|
|
133
|
+
intent: data.intent,
|
|
134
|
+
status: data.status || 'open',
|
|
135
|
+
openedAt: data.openedAt || Date.now(),
|
|
136
|
+
closedAt: data.closedAt,
|
|
137
|
+
scopeIds: data.scopeIds,
|
|
138
|
+
observationIds: data.observationIds || [],
|
|
139
|
+
summaryId: data.summaryId,
|
|
140
|
+
};
|
|
141
|
+
return ok(capsule);
|
|
142
|
+
}
|
|
143
|
+
//# sourceMappingURL=capsule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capsule.js","sourceRoot":"","sources":["../../src/validation/capsule.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAMpC,OAAO,EACL,EAAE,EACF,GAAG,EACH,aAAa,EACb,eAAe,GAChB,MAAM,mBAAmB,CAAC;AAE3B;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,eAAe,CAAC,KAAc;IAC5C,MAAM,MAAM,GAAsB,EAAE,CAAC;IAErC,aAAa;IACb,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QAChD,OAAO,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,yBAAyB,EAAE,CAAC,CAAC,CAAC;IACvE,CAAC;IAED,MAAM,IAAI,GAAG,KAAgC,CAAC;IAE9C,2BAA2B;IAC3B,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;QACf,MAAM,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,kBAAkB,EAAE,CAAC,CAAC;IAC9D,CAAC;SAAM,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QACrC,MAAM,CAAC,IAAI,CAAC;YACV,KAAK,EAAE,MAAM;YACb,OAAO,EAAE,yBAAyB,IAAI,CAAC,IAAI,EAAE;YAC7C,KAAK,EAAE,IA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O,CAAC,CAAC;AACrB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validation functions for Kindling domain types
|
|
3
|
+
*/
|
|
4
|
+
export { validateObservation } from './observation.js';
|
|
5
|
+
export { validateCapsule } from './capsule.js';
|
|
6
|
+
export { validateSummary } from './summary.js';
|
|
7
|
+
export { validatePin } from './pin.js';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/validation/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validation functions for Kindling domain types
|
|
3
|
+
*/
|
|
4
|
+
export { validateObservation } from './observation.js';
|
|
5
|
+
export { validateCapsule } from './capsule.js';
|
|
6
|
+
export { validateSummary } from './summary.js';
|
|
7
|
+
export { validatePin } from './pin.js';
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/validation/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Observation validation
|
|
3
|
+
*/
|
|
4
|
+
import type { Observation, ValidationError, Result } from '../types/index.js';
|
|
5
|
+
/**
|
|
6
|
+
* Validate and normalize an observation input
|
|
7
|
+
*
|
|
8
|
+
* Auto-generates:
|
|
9
|
+
* - id (if not provided)
|
|
10
|
+
* - ts (if not provided)
|
|
11
|
+
* - redacted (defaults to false)
|
|
12
|
+
* - provenance (defaults to empty object)
|
|
13
|
+
*
|
|
14
|
+
* @param input - Observation input to validate
|
|
15
|
+
* @returns Result containing validated Observation or validation errors
|
|
16
|
+
*/
|
|
17
|
+
export declare function validateObservation(input: unknown): Result<Observation, ValidationError[]>;
|
|
18
|
+
//# sourceMappingURL=observation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"observation.d.ts","sourceRoot":"","sources":["../../src/validation/observation.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EACV,WAAW,EACX,eAAe,EACf,MAAM,EACP,MAAM,mBAAmB,CAAC;AAO3B;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAAC,WAAW,EAAE,eAAe,EAAE,CAAC,CAiG1F"}
|