@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
package/LICENSE
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to the Licensor for inclusion in the Work by the copyright
|
|
52
|
+
owner or by an individual or Legal Entity authorized to submit on behalf
|
|
53
|
+
of the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
Copyright 2025 EddaCraft
|
|
179
|
+
|
|
180
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
181
|
+
you may not use this file except in compliance with the License.
|
|
182
|
+
You may obtain a copy of the License at
|
|
183
|
+
|
|
184
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
185
|
+
|
|
186
|
+
Unless required by applicable law or agreed to in writing, software
|
|
187
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
188
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
189
|
+
See the License for the specific language governing permissions and
|
|
190
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
# @eddacraft/kindling-core
|
|
2
|
+
|
|
3
|
+
Core domain model and orchestration for Kindling - local memory engine for AI-assisted development.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@eddacraft/kindling-core)
|
|
6
|
+
[](../../LICENSE)
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm install @eddacraft/kindling-core
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Overview
|
|
15
|
+
|
|
16
|
+
`@eddacraft/kindling-core` provides the domain types, capsule lifecycle management, and retrieval orchestration for Kindling. It defines the core abstractions that other packages implement:
|
|
17
|
+
|
|
18
|
+
- **Observations** - Atomic records of captured events
|
|
19
|
+
- **Capsules** - Bounded units of meaning that group observations
|
|
20
|
+
- **Summaries** - High-level descriptions of capsule content
|
|
21
|
+
- **Pins** - User-marked important items
|
|
22
|
+
- **Retrieval** - Deterministic, scoped search across all entities
|
|
23
|
+
|
|
24
|
+
## Usage
|
|
25
|
+
|
|
26
|
+
```typescript
|
|
27
|
+
import {
|
|
28
|
+
// Types
|
|
29
|
+
Observation,
|
|
30
|
+
ObservationKind,
|
|
31
|
+
Capsule,
|
|
32
|
+
CapsuleType,
|
|
33
|
+
CapsuleStatus,
|
|
34
|
+
Summary,
|
|
35
|
+
Pin,
|
|
36
|
+
ScopeIds,
|
|
37
|
+
|
|
38
|
+
// Capsule lifecycle
|
|
39
|
+
CapsuleManager,
|
|
40
|
+
openCapsule,
|
|
41
|
+
closeCapsule,
|
|
42
|
+
|
|
43
|
+
// Retrieval
|
|
44
|
+
RetrieveOptions,
|
|
45
|
+
RetrieveResult,
|
|
46
|
+
RetrievalProvider,
|
|
47
|
+
|
|
48
|
+
// Utilities
|
|
49
|
+
ok,
|
|
50
|
+
err,
|
|
51
|
+
} from '@eddacraft/kindling-core';
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Core Types
|
|
55
|
+
|
|
56
|
+
### Observation
|
|
57
|
+
|
|
58
|
+
An atomic, immutable record of an event:
|
|
59
|
+
|
|
60
|
+
```typescript
|
|
61
|
+
interface Observation {
|
|
62
|
+
id: string;
|
|
63
|
+
kind: ObservationKind;
|
|
64
|
+
content: string;
|
|
65
|
+
provenance: Record<string, unknown>;
|
|
66
|
+
ts: number;
|
|
67
|
+
scopeIds: ScopeIds;
|
|
68
|
+
redacted: boolean;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
type ObservationKind =
|
|
72
|
+
| 'tool_call'
|
|
73
|
+
| 'command'
|
|
74
|
+
| 'file_diff'
|
|
75
|
+
| 'error'
|
|
76
|
+
| 'message'
|
|
77
|
+
| 'node_start'
|
|
78
|
+
| 'node_end'
|
|
79
|
+
| 'node_output'
|
|
80
|
+
| 'node_error';
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Capsule
|
|
84
|
+
|
|
85
|
+
A bounded unit that groups related observations:
|
|
86
|
+
|
|
87
|
+
```typescript
|
|
88
|
+
interface Capsule {
|
|
89
|
+
id: string;
|
|
90
|
+
type: CapsuleType;
|
|
91
|
+
intent: string;
|
|
92
|
+
status: CapsuleStatus;
|
|
93
|
+
openedAt: number;
|
|
94
|
+
closedAt?: number;
|
|
95
|
+
scopeIds: ScopeIds;
|
|
96
|
+
observationIds: string[];
|
|
97
|
+
summaryId?: string;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
type CapsuleType = 'session' | 'pocketflow_node';
|
|
101
|
+
type CapsuleStatus = 'open' | 'closed';
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### ScopeIds
|
|
105
|
+
|
|
106
|
+
Multi-dimensional isolation for queries:
|
|
107
|
+
|
|
108
|
+
```typescript
|
|
109
|
+
interface ScopeIds {
|
|
110
|
+
sessionId?: string;
|
|
111
|
+
repoId?: string;
|
|
112
|
+
agentId?: string;
|
|
113
|
+
userId?: string;
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Capsule Lifecycle
|
|
118
|
+
|
|
119
|
+
```typescript
|
|
120
|
+
import { CapsuleManager } from '@eddacraft/kindling-core';
|
|
121
|
+
import { SqliteKindlingStore } from '@eddacraft/kindling-store-sqlite';
|
|
122
|
+
|
|
123
|
+
const manager = new CapsuleManager(store);
|
|
124
|
+
|
|
125
|
+
// Open a capsule
|
|
126
|
+
const capsule = manager.open({
|
|
127
|
+
type: 'session',
|
|
128
|
+
intent: 'Fix authentication bug',
|
|
129
|
+
scopeIds: { sessionId: 's1', repoId: '/repo' },
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
// Attach observations
|
|
133
|
+
manager.attach(capsule.id, observation);
|
|
134
|
+
|
|
135
|
+
// Close with summary
|
|
136
|
+
manager.close(capsule.id, {
|
|
137
|
+
content: 'Fixed JWT validation',
|
|
138
|
+
confidence: 0.9,
|
|
139
|
+
});
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## Retrieval
|
|
143
|
+
|
|
144
|
+
```typescript
|
|
145
|
+
import { RetrieveOptions, RetrieveResult } from '@eddacraft/kindling-core';
|
|
146
|
+
|
|
147
|
+
const options: RetrieveOptions = {
|
|
148
|
+
query: 'authentication',
|
|
149
|
+
scopeIds: { repoId: '/repo' },
|
|
150
|
+
tokenBudget: 8000,
|
|
151
|
+
maxCandidates: 50,
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
// Results are tiered: pins -> summary -> candidates
|
|
155
|
+
const result: RetrieveResult = {
|
|
156
|
+
pins: [...], // Non-evictable, user-pinned
|
|
157
|
+
currentSummary: {...}, // Active capsule summary
|
|
158
|
+
candidates: [...], // FTS-ranked results
|
|
159
|
+
provenance: {...}, // Explains how results were generated
|
|
160
|
+
};
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
## Result Type
|
|
164
|
+
|
|
165
|
+
Kindling uses a Result type for validation:
|
|
166
|
+
|
|
167
|
+
```typescript
|
|
168
|
+
import { Result, ok, err } from '@eddacraft/kindling-core';
|
|
169
|
+
|
|
170
|
+
function validate(input: unknown): Result<Observation> {
|
|
171
|
+
if (!isValid(input)) {
|
|
172
|
+
return err({ field: 'content', message: 'Content is required' });
|
|
173
|
+
}
|
|
174
|
+
return ok(input as Observation);
|
|
175
|
+
}
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
## Related Packages
|
|
179
|
+
|
|
180
|
+
- [`@eddacraft/kindling-store-sqlite`](../kindling-store-sqlite) - SQLite persistence
|
|
181
|
+
- [`@eddacraft/kindling-provider-local`](../kindling-provider-local) - FTS retrieval
|
|
182
|
+
- [`@eddacraft/kindling-adapter-opencode`](../kindling-adapter-opencode) - OpenCode integration
|
|
183
|
+
- [`@eddacraft/kindling-adapter-pocketflow`](../kindling-adapter-pocketflow) - PocketFlow integration
|
|
184
|
+
|
|
185
|
+
## License
|
|
186
|
+
|
|
187
|
+
Apache-2.0
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Capsule lifecycle management
|
|
3
|
+
*
|
|
4
|
+
* Exports capsule manager, lifecycle functions, and related types.
|
|
5
|
+
*/
|
|
6
|
+
export type { OpenCapsuleOptions, CloseCapsuleSignals, CapsuleManager as ICapsuleManager, } from './types.js';
|
|
7
|
+
export type { CapsuleStore, } from './lifecycle.js';
|
|
8
|
+
export { openCapsule, closeCapsule, getCapsule, getOpenCapsule, } from './lifecycle.js';
|
|
9
|
+
export { CapsuleManager, } from './manager.js';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/capsule/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,YAAY,EACV,kBAAkB,EAClB,mBAAmB,EACnB,cAAc,IAAI,eAAe,GAClC,MAAM,YAAY,CAAC;AAEpB,YAAY,EACV,YAAY,GACb,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,WAAW,EACX,YAAY,EACZ,UAAU,EACV,cAAc,GACf,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,cAAc,GACf,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Capsule lifecycle management
|
|
3
|
+
*
|
|
4
|
+
* Exports capsule manager, lifecycle functions, and related types.
|
|
5
|
+
*/
|
|
6
|
+
// Lifecycle functions
|
|
7
|
+
export { openCapsule, closeCapsule, getCapsule, getOpenCapsule, } from './lifecycle.js';
|
|
8
|
+
// Manager
|
|
9
|
+
export { CapsuleManager, } from './manager.js';
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/capsule/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAaH,sBAAsB;AACtB,OAAO,EACL,WAAW,EACX,YAAY,EACZ,UAAU,EACV,cAAc,GACf,MAAM,gBAAgB,CAAC;AAExB,UAAU;AACV,OAAO,EACL,cAAc,GACf,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Capsule lifecycle functions
|
|
3
|
+
*
|
|
4
|
+
* Core logic for opening, closing, and managing capsules.
|
|
5
|
+
*/
|
|
6
|
+
import type { ID } from '../types/common.js';
|
|
7
|
+
import type { Capsule } from '../types/capsule.js';
|
|
8
|
+
import type { Summary } from '../types/summary.js';
|
|
9
|
+
import type { OpenCapsuleOptions, CloseCapsuleSignals } from './types.js';
|
|
10
|
+
/**
|
|
11
|
+
* Store interface for capsule lifecycle operations
|
|
12
|
+
*
|
|
13
|
+
* Minimal interface required by lifecycle functions
|
|
14
|
+
*/
|
|
15
|
+
export interface CapsuleStore {
|
|
16
|
+
createCapsule(capsule: Capsule): void;
|
|
17
|
+
closeCapsule(capsuleId: ID, closedAt: number): void;
|
|
18
|
+
getCapsuleById(capsuleId: ID): Capsule | undefined;
|
|
19
|
+
getOpenCapsuleForSession(sessionId: string): Capsule | undefined;
|
|
20
|
+
insertSummary(summary: Summary): void;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Open a new capsule
|
|
24
|
+
*
|
|
25
|
+
* Creates and persists a new capsule with status=open.
|
|
26
|
+
* For session-type capsules, validates that no other capsule is open for the same session.
|
|
27
|
+
*
|
|
28
|
+
* @param store - Store implementation
|
|
29
|
+
* @param options - Capsule creation options
|
|
30
|
+
* @returns The created capsule
|
|
31
|
+
* @throws Error if validation fails or duplicate open capsule exists
|
|
32
|
+
*/
|
|
33
|
+
export declare function openCapsule(store: CapsuleStore, options: OpenCapsuleOptions): Capsule;
|
|
34
|
+
/**
|
|
35
|
+
* Close an open capsule
|
|
36
|
+
*
|
|
37
|
+
* Updates capsule status to closed and sets closedAt timestamp.
|
|
38
|
+
* Optionally creates a summary if content is provided.
|
|
39
|
+
*
|
|
40
|
+
* @param store - Store implementation
|
|
41
|
+
* @param capsuleId - ID of capsule to close
|
|
42
|
+
* @param signals - Closure signals/metadata
|
|
43
|
+
* @returns The closed capsule
|
|
44
|
+
* @throws Error if capsule not found or already closed
|
|
45
|
+
*/
|
|
46
|
+
export declare function closeCapsule(store: CapsuleStore, capsuleId: ID, signals?: CloseCapsuleSignals): Capsule;
|
|
47
|
+
/**
|
|
48
|
+
* Get a capsule by ID
|
|
49
|
+
*
|
|
50
|
+
* @param store - Store implementation
|
|
51
|
+
* @param capsuleId - Capsule ID to lookup
|
|
52
|
+
* @returns Capsule or undefined if not found
|
|
53
|
+
*/
|
|
54
|
+
export declare function getCapsule(store: CapsuleStore, capsuleId: ID): Capsule | undefined;
|
|
55
|
+
/**
|
|
56
|
+
* Get the open capsule for a session (if any)
|
|
57
|
+
*
|
|
58
|
+
* @param store - Store implementation
|
|
59
|
+
* @param sessionId - Session ID to search for
|
|
60
|
+
* @returns Open capsule or undefined
|
|
61
|
+
*/
|
|
62
|
+
export declare function getOpenCapsule(store: CapsuleStore, sessionId: string): Capsule | undefined;
|
|
63
|
+
//# sourceMappingURL=lifecycle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lifecycle.d.ts","sourceRoot":"","sources":["../../src/capsule/lifecycle.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,KAAK,EAAE,OAAO,EAAiB,MAAM,qBAAqB,CAAC;AAClE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAI1E;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;IACtC,YAAY,CAAC,SAAS,EAAE,EAAE,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACpD,cAAc,CAAC,SAAS,EAAE,EAAE,GAAG,OAAO,GAAG,SAAS,CAAC;IACnD,wBAAwB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;IACjE,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;CACvC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,YAAY,EACnB,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAkCT;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,YAAY,EACnB,SAAS,EAAE,EAAE,EACb,OAAO,GAAE,mBAAwB,GAChC,OAAO,CAwCT;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CACxB,KAAK,EAAE,YAAY,EACnB,SAAS,EAAE,EAAE,GACZ,OAAO,GAAG,SAAS,CAErB;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,YAAY,EACnB,SAAS,EAAE,MAAM,GAChB,OAAO,GAAG,SAAS,CAErB"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Capsule lifecycle functions
|
|
3
|
+
*
|
|
4
|
+
* Core logic for opening, closing, and managing capsules.
|
|
5
|
+
*/
|
|
6
|
+
import { validateCapsule } from '../validation/capsule.js';
|
|
7
|
+
import { validateSummary } from '../validation/summary.js';
|
|
8
|
+
/**
|
|
9
|
+
* Open a new capsule
|
|
10
|
+
*
|
|
11
|
+
* Creates and persists a new capsule with status=open.
|
|
12
|
+
* For session-type capsules, validates that no other capsule is open for the same session.
|
|
13
|
+
*
|
|
14
|
+
* @param store - Store implementation
|
|
15
|
+
* @param options - Capsule creation options
|
|
16
|
+
* @returns The created capsule
|
|
17
|
+
* @throws Error if validation fails or duplicate open capsule exists
|
|
18
|
+
*/
|
|
19
|
+
export function openCapsule(store, options) {
|
|
20
|
+
const { type, intent, scopeIds, id } = options;
|
|
21
|
+
// Check for duplicate open capsule (session-scoped)
|
|
22
|
+
if (type === 'session' && scopeIds.sessionId) {
|
|
23
|
+
const existingCapsule = store.getOpenCapsuleForSession(scopeIds.sessionId);
|
|
24
|
+
if (existingCapsule) {
|
|
25
|
+
throw new Error(`Cannot open capsule: session ${scopeIds.sessionId} already has an open capsule (${existingCapsule.id})`);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
// Validate and create capsule
|
|
29
|
+
const capsuleResult = validateCapsule({
|
|
30
|
+
id,
|
|
31
|
+
type,
|
|
32
|
+
intent,
|
|
33
|
+
status: 'open',
|
|
34
|
+
scopeIds,
|
|
35
|
+
});
|
|
36
|
+
if (!capsuleResult.ok) {
|
|
37
|
+
throw new Error(`Capsule validation failed: ${capsuleResult.error.map(e => e.message).join(', ')}`);
|
|
38
|
+
}
|
|
39
|
+
const capsule = capsuleResult.value;
|
|
40
|
+
// Persist to store
|
|
41
|
+
store.createCapsule(capsule);
|
|
42
|
+
return capsule;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Close an open capsule
|
|
46
|
+
*
|
|
47
|
+
* Updates capsule status to closed and sets closedAt timestamp.
|
|
48
|
+
* Optionally creates a summary if content is provided.
|
|
49
|
+
*
|
|
50
|
+
* @param store - Store implementation
|
|
51
|
+
* @param capsuleId - ID of capsule to close
|
|
52
|
+
* @param signals - Closure signals/metadata
|
|
53
|
+
* @returns The closed capsule
|
|
54
|
+
* @throws Error if capsule not found or already closed
|
|
55
|
+
*/
|
|
56
|
+
export function closeCapsule(store, capsuleId, signals = {}) {
|
|
57
|
+
// Get existing capsule
|
|
58
|
+
const capsule = store.getCapsuleById(capsuleId);
|
|
59
|
+
if (!capsule) {
|
|
60
|
+
throw new Error(`Capsule ${capsuleId} not found`);
|
|
61
|
+
}
|
|
62
|
+
if (capsule.status === 'closed') {
|
|
63
|
+
throw new Error(`Capsule ${capsuleId} is already closed`);
|
|
64
|
+
}
|
|
65
|
+
// Close capsule
|
|
66
|
+
const closedAt = Date.now();
|
|
67
|
+
store.closeCapsule(capsuleId, closedAt);
|
|
68
|
+
// Create summary if content provided
|
|
69
|
+
if (signals.summaryContent) {
|
|
70
|
+
const summaryResult = validateSummary({
|
|
71
|
+
capsuleId,
|
|
72
|
+
content: signals.summaryContent,
|
|
73
|
+
confidence: signals.summaryConfidence ?? 0.8,
|
|
74
|
+
evidenceRefs: signals.evidenceRefs ?? [],
|
|
75
|
+
});
|
|
76
|
+
if (!summaryResult.ok) {
|
|
77
|
+
throw new Error(`Summary validation failed: ${summaryResult.error.map(e => e.message).join(', ')}`);
|
|
78
|
+
}
|
|
79
|
+
store.insertSummary(summaryResult.value);
|
|
80
|
+
}
|
|
81
|
+
// Return updated capsule
|
|
82
|
+
return {
|
|
83
|
+
...capsule,
|
|
84
|
+
status: 'closed',
|
|
85
|
+
closedAt,
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Get a capsule by ID
|
|
90
|
+
*
|
|
91
|
+
* @param store - Store implementation
|
|
92
|
+
* @param capsuleId - Capsule ID to lookup
|
|
93
|
+
* @returns Capsule or undefined if not found
|
|
94
|
+
*/
|
|
95
|
+
export function getCapsule(store, capsuleId) {
|
|
96
|
+
return store.getCapsuleById(capsuleId);
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Get the open capsule for a session (if any)
|
|
100
|
+
*
|
|
101
|
+
* @param store - Store implementation
|
|
102
|
+
* @param sessionId - Session ID to search for
|
|
103
|
+
* @returns Open capsule or undefined
|
|
104
|
+
*/
|
|
105
|
+
export function getOpenCapsule(store, sessionId) {
|
|
106
|
+
return store.getOpenCapsuleForSession(sessionId);
|
|
107
|
+
}
|
|
108
|
+
//# sourceMappingURL=lifecycle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lifecycle.js","sourceRoot":"","sources":["../../src/capsule/lifecycle.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Capsule manager implementation
|
|
3
|
+
*
|
|
4
|
+
* Manages capsule lifecycle with in-memory caching for fast lookup.
|
|
5
|
+
*/
|
|
6
|
+
import type { ID, ScopeIds } from '../types/common.js';
|
|
7
|
+
import type { Capsule } from '../types/capsule.js';
|
|
8
|
+
import type { CapsuleManager as ICapsuleManager, OpenCapsuleOptions, CloseCapsuleSignals } from './types.js';
|
|
9
|
+
import type { CapsuleStore } from './lifecycle.js';
|
|
10
|
+
/**
|
|
11
|
+
* Default capsule manager implementation
|
|
12
|
+
*
|
|
13
|
+
* Features:
|
|
14
|
+
* - In-memory cache for active capsules
|
|
15
|
+
* - Thread-safe operations (via synchronous store calls)
|
|
16
|
+
* - Automatic cache invalidation on close
|
|
17
|
+
*/
|
|
18
|
+
export declare class CapsuleManager implements ICapsuleManager {
|
|
19
|
+
private store;
|
|
20
|
+
private activeCache;
|
|
21
|
+
constructor(store: CapsuleStore);
|
|
22
|
+
/**
|
|
23
|
+
* Open a new capsule
|
|
24
|
+
*
|
|
25
|
+
* @param options - Capsule creation options
|
|
26
|
+
* @returns The created capsule
|
|
27
|
+
* @throws Error if validation fails or duplicate open capsule exists
|
|
28
|
+
*/
|
|
29
|
+
open(options: OpenCapsuleOptions): Capsule;
|
|
30
|
+
/**
|
|
31
|
+
* Close an open capsule
|
|
32
|
+
*
|
|
33
|
+
* @param capsuleId - ID of capsule to close
|
|
34
|
+
* @param signals - Closure signals/metadata
|
|
35
|
+
* @returns The closed capsule
|
|
36
|
+
* @throws Error if capsule not found or already closed
|
|
37
|
+
*/
|
|
38
|
+
close(capsuleId: ID, signals?: CloseCapsuleSignals): Capsule;
|
|
39
|
+
/**
|
|
40
|
+
* Get a capsule by ID
|
|
41
|
+
*
|
|
42
|
+
* Checks cache first, falls back to store.
|
|
43
|
+
*
|
|
44
|
+
* @param capsuleId - Capsule ID to lookup
|
|
45
|
+
* @returns Capsule or undefined if not found
|
|
46
|
+
*/
|
|
47
|
+
get(capsuleId: ID): Capsule | undefined;
|
|
48
|
+
/**
|
|
49
|
+
* Get the open capsule for a scope (if any)
|
|
50
|
+
*
|
|
51
|
+
* Currently only supports session-scoped lookup.
|
|
52
|
+
*
|
|
53
|
+
* @param scopeIds - Partial scope to match
|
|
54
|
+
* @returns Open capsule or undefined
|
|
55
|
+
*/
|
|
56
|
+
getOpen(scopeIds: Partial<ScopeIds>): Capsule | undefined;
|
|
57
|
+
/**
|
|
58
|
+
* Notify that an observation was attached to a capsule
|
|
59
|
+
*
|
|
60
|
+
* Updates the cached capsule's observationIds if the capsule is in the cache.
|
|
61
|
+
*
|
|
62
|
+
* @param capsuleId - Capsule that received the observation
|
|
63
|
+
* @param observationId - Observation that was attached
|
|
64
|
+
*/
|
|
65
|
+
notifyObservationAttached(capsuleId: ID, observationId: ID): void;
|
|
66
|
+
/**
|
|
67
|
+
* Clear the active capsule cache
|
|
68
|
+
*
|
|
69
|
+
* Useful for testing or manual cache invalidation.
|
|
70
|
+
*/
|
|
71
|
+
clearCache(): void;
|
|
72
|
+
/**
|
|
73
|
+
* Get count of cached active capsules
|
|
74
|
+
*
|
|
75
|
+
* Useful for debugging and monitoring.
|
|
76
|
+
*/
|
|
77
|
+
getCacheSize(): number;
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../src/capsule/manager.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,cAAc,IAAI,eAAe,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAC7G,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAGnD;;;;;;;GAOG;AACH,qBAAa,cAAe,YAAW,eAAe;IACpD,OAAO,CAAC,KAAK,CAAe;IAC5B,OAAO,CAAC,WAAW,CAAmB;gBAE1B,KAAK,EAAE,YAAY;IAK/B;;;;;;OAMG;IACH,IAAI,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO;IAS1C;;;;;;;OAOG;IACH,KAAK,CAAC,SAAS,EAAE,EAAE,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,OAAO;IAS5D;;;;;;;OAOG;IACH,GAAG,CAAC,SAAS,EAAE,EAAE,GAAG,OAAO,GAAG,SAAS;IAWvC;;;;;;;OAOG;IACH,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,QAAQ,CAAC,GAAG,OAAO,GAAG,SAAS;IASzD;;;;;;;OAOG;IACH,yBAAyB,CAAC,SAAS,EAAE,EAAE,EAAE,aAAa,EAAE,EAAE,GAAG,IAAI;IAQjE;;;;OAIG;IACH,UAAU,IAAI,IAAI;IAIlB;;;;OAIG;IACH,YAAY,IAAI,MAAM;CAGvB"}
|