@kb-labs/mind-contracts 2.93.0 → 2.96.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/README.md +16 -167
- package/dist/index.d.ts +1920 -68
- package/dist/index.js +421 -352
- package/dist/index.js.map +1 -1
- package/package.json +7 -18
- package/dist/contract-D29vlhme.d.ts +0 -96
- package/dist/contract.d.ts +0 -1
- package/dist/contract.js +0 -57
- package/dist/contract.js.map +0 -1
- package/dist/schema.d.ts +0 -1820
- package/dist/schema.js +0 -286
- package/dist/schema.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,174 +1,23 @@
|
|
|
1
1
|
# @kb-labs/mind-contracts
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Wire contracts for the KB Labs **Mind** (RAG) plugin — the thin boundary shared
|
|
4
|
+
between the CLI, REST, and any other consumer.
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
Contains only Zod schemas, CLI flag definitions, route constants, and per-index
|
|
7
|
+
config resolution. Imports nothing but `@kb-labs/sdk` and `zod` — no platform
|
|
8
|
+
internals, no runtime logic.
|
|
6
9
|
|
|
7
|
-
|
|
10
|
+
## Exports
|
|
8
11
|
|
|
9
|
-
|
|
12
|
+
- **Schemas** — `index`, `search`, `query`/agent, `explore`, `sync`, `status`
|
|
13
|
+
request/response shapes (`*RequestSchema` / `*ResponseSchema`).
|
|
14
|
+
- **Flags** — `indexFlags`, `searchFlags`, `askFlags`, `exploreFlags`,
|
|
15
|
+
`syncPathsFlags`, `reindexFlags`, `statusFlags`.
|
|
16
|
+
- **Config** — `MindConfigSchema`, `effectiveIndexConfig(config, indexId)`
|
|
17
|
+
(global config + named-index overrides).
|
|
18
|
+
- **Routes** — `MIND_BASE_PATH`, `MIND_ROUTES`, `MIND_FULL_ROUTES`.
|
|
10
19
|
|
|
11
|
-
|
|
12
|
-
- **Schema Validation**: Zod schemas for validation
|
|
13
|
-
- **Type Safety**: TypeScript types derived from schemas
|
|
14
|
-
- **Versioning**: SemVer-based contract versioning
|
|
20
|
+
## Layer
|
|
15
21
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
- **Version**: 0.1.0
|
|
19
|
-
- **Stage**: Stable
|
|
20
|
-
- **Status**: Production Ready ✅
|
|
21
|
-
|
|
22
|
-
## Architecture
|
|
23
|
-
|
|
24
|
-
### High-Level Overview
|
|
25
|
-
|
|
26
|
-
```
|
|
27
|
-
Mind Contracts
|
|
28
|
-
│
|
|
29
|
-
├──► Contract Manifest
|
|
30
|
-
├──► Zod Schemas
|
|
31
|
-
├──► TypeScript Types
|
|
32
|
-
└──► Helper Parsers
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
### Key Components
|
|
36
|
-
|
|
37
|
-
1. **Contract Manifest** (`contract.ts`): Plugin contracts manifest
|
|
38
|
-
2. **Schemas** (`schema/`): Zod validation schemas
|
|
39
|
-
3. **Types** (`types.ts`): TypeScript type definitions
|
|
40
|
-
4. **Parsers** (`schema.ts`): Helper parsers
|
|
41
|
-
|
|
42
|
-
## ✨ Features
|
|
43
|
-
|
|
44
|
-
- **Contract Manifest**: Typed declaration of Mind artifacts, commands, workflows, and REST routes
|
|
45
|
-
- **Zod Schemas**: Validation schemas for CLI flag definitions, query DTOs, REST responses, Studio widgets
|
|
46
|
-
- **TypeScript Types**: Type definitions for command inputs/outputs
|
|
47
|
-
- **Helper Parsers**: `parsePluginContracts` for runtime validation
|
|
48
|
-
|
|
49
|
-
## 📦 API Reference
|
|
50
|
-
|
|
51
|
-
### Main Exports
|
|
52
|
-
|
|
53
|
-
#### Contract Manifest
|
|
54
|
-
|
|
55
|
-
- `pluginContractsManifest`: Typed declaration of Mind artifacts, commands, workflows, and REST routes
|
|
56
|
-
- `contractsVersion`: SemVer version for contract coordination
|
|
57
|
-
- `contractsSchemaId`: Schema ID for contract validation
|
|
58
|
-
|
|
59
|
-
#### Schemas
|
|
60
|
-
|
|
61
|
-
- `parsePluginContracts`: Parse plugin contracts
|
|
62
|
-
- `pluginContractsSchema`: Plugin contracts schema
|
|
63
|
-
|
|
64
|
-
#### Types
|
|
65
|
-
|
|
66
|
-
- `PluginContracts`: Plugin contracts type
|
|
67
|
-
- `ArtifactDecl`: Artifact declaration type
|
|
68
|
-
- `CommandDecl`: Command declaration type
|
|
69
|
-
|
|
70
|
-
## 🔧 Configuration
|
|
71
|
-
|
|
72
|
-
### Configuration Options
|
|
73
|
-
|
|
74
|
-
No configuration needed - pure contract definitions.
|
|
75
|
-
|
|
76
|
-
## 🔗 Dependencies
|
|
77
|
-
|
|
78
|
-
### Runtime Dependencies
|
|
79
|
-
|
|
80
|
-
- `zod` (`^3.23.8`): Schema validation
|
|
81
|
-
|
|
82
|
-
### Development Dependencies
|
|
83
|
-
|
|
84
|
-
- `@kb-labs/devkit` (`link:../../../kb-labs-devkit`): DevKit presets
|
|
85
|
-
- `@types/node` (`^24.7.0`): Node.js types
|
|
86
|
-
- `semver` (`^7.6.3`): SemVer parsing
|
|
87
|
-
- `tsup` (`^8.5.0`): TypeScript bundler
|
|
88
|
-
- `typescript` (`^5.6.3`): TypeScript compiler
|
|
89
|
-
- `vitest` (`^3.2.4`): Test runner
|
|
90
|
-
|
|
91
|
-
## 🧪 Testing
|
|
92
|
-
|
|
93
|
-
### Test Structure
|
|
94
|
-
|
|
95
|
-
```
|
|
96
|
-
tests/
|
|
97
|
-
└── contracts.manifest.test.ts
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
### Test Coverage
|
|
101
|
-
|
|
102
|
-
- **Current Coverage**: ~70%
|
|
103
|
-
- **Target Coverage**: 90%
|
|
104
|
-
|
|
105
|
-
## 📈 Performance
|
|
106
|
-
|
|
107
|
-
### Performance Characteristics
|
|
108
|
-
|
|
109
|
-
- **Time Complexity**: O(1) for type operations, O(n) for schema validation
|
|
110
|
-
- **Space Complexity**: O(1)
|
|
111
|
-
- **Bottlenecks**: Schema validation for large payloads
|
|
112
|
-
|
|
113
|
-
## 🔒 Security
|
|
114
|
-
|
|
115
|
-
### Security Considerations
|
|
116
|
-
|
|
117
|
-
- **Schema Validation**: Input validation via Zod schemas
|
|
118
|
-
- **Type Safety**: TypeScript type safety
|
|
119
|
-
|
|
120
|
-
### Known Vulnerabilities
|
|
121
|
-
|
|
122
|
-
- None
|
|
123
|
-
|
|
124
|
-
## 🐛 Known Issues & Limitations
|
|
125
|
-
|
|
126
|
-
### Known Issues
|
|
127
|
-
|
|
128
|
-
- None currently
|
|
129
|
-
|
|
130
|
-
### Limitations
|
|
131
|
-
|
|
132
|
-
- **Schema Validation**: Basic validation only
|
|
133
|
-
|
|
134
|
-
### Future Improvements
|
|
135
|
-
|
|
136
|
-
- **Enhanced Validation**: More validation rules
|
|
137
|
-
|
|
138
|
-
## 🔄 Migration & Breaking Changes
|
|
139
|
-
|
|
140
|
-
### Versioning Rules
|
|
141
|
-
|
|
142
|
-
- **MAJOR** — breaking changes (removed fields, renamed IDs, incompatible schema updates)
|
|
143
|
-
- **MINOR** — backwards-compatible additions (new flags, artifacts, optional fields)
|
|
144
|
-
- **PATCH** — metadata/documentation tweaks that do not alter payload structure
|
|
145
|
-
|
|
146
|
-
### Breaking Changes in Future Versions
|
|
147
|
-
|
|
148
|
-
- None planned
|
|
149
|
-
|
|
150
|
-
## 📚 Examples
|
|
151
|
-
|
|
152
|
-
### Example 1: Use Contract Manifest
|
|
153
|
-
|
|
154
|
-
```typescript
|
|
155
|
-
import { pluginContractsManifest } from '@kb-labs/mind-contracts';
|
|
156
|
-
|
|
157
|
-
const queryArtifactId = pluginContractsManifest.artifacts['mind.query.json'].id;
|
|
158
|
-
```
|
|
159
|
-
|
|
160
|
-
### Example 2: Parse Plugin Contracts
|
|
161
|
-
|
|
162
|
-
```typescript
|
|
163
|
-
import { parsePluginContracts } from '@kb-labs/mind-contracts';
|
|
164
|
-
|
|
165
|
-
const contracts = parsePluginContracts(rawManifest);
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
## 🤝 Contributing
|
|
169
|
-
|
|
170
|
-
See [CONTRIBUTING.md](../../CONTRIBUTING.md) for development guidelines.
|
|
171
|
-
|
|
172
|
-
## 📄 License
|
|
173
|
-
|
|
174
|
-
MIT © KB Labs
|
|
22
|
+
Layer 1 (contracts). Depended on by `@kb-labs/mind-core` and
|
|
23
|
+
`@kb-labs/mind-entry`; depends on nothing internal.
|