workspai 0.46.0 → 0.47.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 +61 -12
- package/contracts/agent-customization-pack.v1.json +6 -1
- package/contracts/bootstrap-compliance.v1.json +14 -0
- package/contracts/cli-runtime-command-inventory.v1.snapshot.json +4 -0
- package/contracts/extension-cli-compatibility.v1.json +7 -1
- package/contracts/mirror-ops.v1.json +16 -0
- package/contracts/published-contract-catalog.v1.json +31 -0
- package/contracts/runtime-command-surface.v1.json +149 -1
- package/contracts/transparency-evidence.v1.json +13 -0
- package/contracts/workspace-contract.v1.json +78 -0
- package/contracts/workspace-intelligence/workspace-context.v1.json +20 -0
- package/contracts/workspace-intelligence/workspace-graph-token-efficiency.v1.json +72 -0
- package/contracts/workspace-intelligence/workspace-intelligence-run.v1.json +6 -1
- package/contracts/workspace-intelligence/workspace-knowledge-graph-change-overlay.v1.json +200 -0
- package/contracts/workspace-intelligence/workspace-knowledge-graph.v1.json +260 -0
- package/contracts/workspace-intelligence/workspace-knowledge-search.v1.json +60 -0
- package/contracts/workspace-intelligence-architecture.v1.json +6 -3
- package/contracts/workspace-intelligence-chain.v1.json +14 -3
- package/contracts/workspace-share-bundle.v1.json +16 -0
- package/dist/analyze-UVXPRGYZ.js +1 -0
- package/dist/artifact-remediation-plan-EPALZ2LC.js +3 -0
- package/dist/autopilot-release-5BQ6F5L2.js +1 -0
- package/dist/chunk-22NJ2ZMG.js +2 -0
- package/dist/{chunk-UQWOVV6V.js → chunk-2GHUZDYA.js} +1 -1
- package/dist/chunk-2TEDAKP6.js +2 -0
- package/dist/chunk-6SWRNA47.js +4 -0
- package/dist/chunk-76YOPAOT.js +1 -0
- package/dist/chunk-7VLCK5JW.js +1 -0
- package/dist/{chunk-J5PIZCAU.js → chunk-BSRVO52Y.js} +1 -1
- package/dist/chunk-COARSXRC.js +1 -0
- package/dist/chunk-CV5HKU4P.js +1 -0
- package/dist/chunk-CW7PGBIQ.js +13 -0
- package/dist/{chunk-WPEEC5BX.js → chunk-DV6GJD4K.js} +1 -1
- package/dist/chunk-FB7SCXAZ.js +1 -0
- package/dist/{chunk-4LGXSBCN.js → chunk-HSGFUKCN.js} +1 -1
- package/dist/{chunk-ZKAI3PJE.js → chunk-ITCAMC2E.js} +1 -1
- package/dist/chunk-KB44JP4M.js +2 -0
- package/dist/{chunk-QA5BGEQW.js → chunk-KZZ36CK5.js} +1 -1
- package/dist/chunk-LNRAB7UY.js +1 -0
- package/dist/{chunk-VFDM65IE.js → chunk-MEMHNE7Y.js} +22 -22
- package/dist/chunk-NOFM7MNA.js +2 -0
- package/dist/chunk-NRYS4CLR.js +2 -0
- package/dist/chunk-OA537ZQ5.js +1 -0
- package/dist/chunk-PBHP6JNY.js +8 -0
- package/dist/chunk-QDWYIRHR.js +8 -0
- package/dist/chunk-RWRLFSKW.js +2 -0
- package/dist/chunk-SK6XRKGG.js +1 -0
- package/dist/chunk-THIOE2PB.js +2 -0
- package/dist/chunk-TNQI5VCW.js +36 -0
- package/dist/chunk-TWNFECMN.js +2 -0
- package/dist/{chunk-6IIZJQLV.js → chunk-U5EZHZBX.js} +1 -1
- package/dist/{chunk-YUATNVOT.js → chunk-VBSQ7MF6.js} +19 -19
- package/dist/chunk-WDKNMTJQ.js +1 -0
- package/dist/chunk-YCL3I2JO.js +2 -0
- package/dist/chunk-ZDN7RHXJ.js +1 -0
- package/dist/chunk-ZM5NQ5Z2.js +1 -0
- package/dist/{create-WCV3L6XH.js → create-7JKJDAQV.js} +1 -1
- package/dist/{doctor-5BWM2EMJ.js → doctor-PGPNIS76.js} +1 -1
- package/dist/index.d.ts +33 -12
- package/dist/index.js +317 -317
- package/dist/pipeline-IB6ILJSV.js +5 -0
- package/dist/{workspace-7OXW5YTJ.js → workspace-H3QXBFGB.js} +1 -1
- package/dist/{workspace-agent-sync-O4IA6VOA.js → workspace-agent-sync-C7SG2Z5W.js} +1 -1
- package/dist/{workspace-archive-H74NBBNW.js → workspace-archive-P76EDIUG.js} +1 -1
- package/dist/{workspace-context-R7IPUBPG.js → workspace-context-BKQBKA4C.js} +1 -1
- package/dist/workspace-contract-RPQQBQXR.js +1 -0
- package/dist/workspace-dependency-graph-23BI2HG7.js +1 -0
- package/dist/workspace-explain-WVN7JH3U.js +1 -0
- package/dist/{workspace-explain-contract-SVFJAAEI.js → workspace-explain-contract-SEFTVF6J.js} +1 -1
- package/dist/{workspace-feedback-REOS36ZZ.js → workspace-feedback-WAID3IOE.js} +1 -1
- package/dist/{workspace-foundation-KXT4QI5O.js → workspace-foundation-5OOJEO2D.js} +1 -1
- package/dist/workspace-graph-token-efficiency-CFGFCJ5V.js +1 -0
- package/dist/{workspace-history-OGOVSKZG.js → workspace-history-C6OP3IAQ.js} +1 -1
- package/dist/workspace-intelligence-VKDL3H2J.js +1 -0
- package/dist/workspace-intelligence-runner-LVALAZY7.js +1 -0
- package/dist/workspace-knowledge-graph-FE2NTZKV.js +1 -0
- package/dist/workspace-knowledge-graph-change-overlay-XG6FC4IX.js +1 -0
- package/dist/workspace-knowledge-graph-query-VOSPPH4W.js +1 -0
- package/dist/workspace-mcp-serve-KT2I676Z.js +3 -0
- package/dist/workspace-model-S33CIB2R.js +1 -0
- package/dist/workspace-model-hash-MHXK5MEI.js +1 -0
- package/dist/{workspace-registry-summary-SZ46R5PD.js → workspace-registry-summary-A3YDL63D.js} +1 -1
- package/dist/workspace-run-M4LNJILC.js +1 -0
- package/dist/{workspace-verify-MFQ7IXGD.js → workspace-verify-ZGH3NXAH.js} +1 -1
- package/dist/workspace-watch-EVBJTMV7.js +1 -0
- package/docs/AI_DYNAMIC_INTEGRATION.md +73 -428
- package/docs/AI_EXAMPLES.md +37 -395
- package/docs/AI_FEATURES.md +76 -456
- package/docs/AI_QUICKSTART.md +49 -212
- package/docs/GLOSSARY.md +60 -0
- package/docs/OPEN_SOURCE_USER_SCENARIOS.md +68 -7
- package/docs/README.md +63 -41
- package/docs/commands-reference.md +51 -4
- package/docs/config-file-guide.md +6 -2
- package/docs/contracts/ARTIFACT_CATALOG.md +67 -37
- package/docs/contracts/README.md +44 -8
- package/docs/graph-benchmark-methodology.md +121 -0
- package/docs/workspace-knowledge-graph.md +295 -0
- package/docs/workspace-operations.md +49 -0
- package/package.json +2 -1
- package/dist/analyze-BEBEZSZK.js +0 -1
- package/dist/artifact-remediation-plan-FFQSESAM.js +0 -3
- package/dist/autopilot-release-WUR4CQIT.js +0 -1
- package/dist/chunk-2G7FASAO.js +0 -2
- package/dist/chunk-4EPHWD27.js +0 -8
- package/dist/chunk-CVHMUSRX.js +0 -1
- package/dist/chunk-DIPD72H4.js +0 -2
- package/dist/chunk-EFYHGCGX.js +0 -2
- package/dist/chunk-FWRXA435.js +0 -2
- package/dist/chunk-HDURFXW5.js +0 -2
- package/dist/chunk-HMUKBW2S.js +0 -4
- package/dist/chunk-K4WNYXKK.js +0 -33
- package/dist/chunk-LG6RFLPZ.js +0 -1
- package/dist/chunk-N7DV5L7C.js +0 -1
- package/dist/chunk-PRBVYW3T.js +0 -1
- package/dist/chunk-QZLIURER.js +0 -13
- package/dist/chunk-RIEF2DDX.js +0 -8
- package/dist/chunk-SXMTSV5M.js +0 -1
- package/dist/chunk-SXPY523X.js +0 -1
- package/dist/chunk-V3LRQZ36.js +0 -1
- package/dist/chunk-WYFPXTTS.js +0 -2
- package/dist/pipeline-ORIWVVYM.js +0 -5
- package/dist/workspace-contract-HKCMOMFE.js +0 -1
- package/dist/workspace-explain-GOPQYTPQ.js +0 -1
- package/dist/workspace-intelligence-7IESQSXY.js +0 -1
- package/dist/workspace-intelligence-runner-6GJ5M4HB.js +0 -1
- package/dist/workspace-mcp-serve-FRVWBO36.js +0 -3
- package/dist/workspace-model-PPYX7B4S.js +0 -1
- package/dist/workspace-run-V3KKHTVF.js +0 -1
- package/dist/workspace-watch-SOPZHRWA.js +0 -1
|
@@ -1,436 +1,81 @@
|
|
|
1
|
-
#
|
|
1
|
+
# AI Recommender Architecture
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
This document describes the optional module recommender implementation for
|
|
4
|
+
contributors. It does not define the canonical Workspace Intelligence chain.
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
## Runtime flow
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
AI system uses a **dynamic runtime catalog** and fetches module metadata from **RapidKit Python Core** instead of relying only on hardcoded entries.
|
|
11
|
-
|
|
12
|
-
### Before (Static):
|
|
13
|
-
|
|
14
|
-
```typescript
|
|
15
|
-
// ❌ Hardcoded fixed subset
|
|
16
|
-
export const MODULE_CATALOG = [
|
|
17
|
-
{ id: 'authentication-core', ... },
|
|
18
|
-
// ... 10 more
|
|
19
|
-
]
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
### After (Dynamic):
|
|
23
|
-
|
|
24
|
-
```typescript
|
|
25
|
-
// Fetches through the validated Core bridge
|
|
26
|
-
export async function getModuleCatalog() {
|
|
27
|
-
const result = await runCoreRapidkitCapture(
|
|
28
|
-
['modules', 'list', '--json-schema', '1'],
|
|
29
|
-
{ preferWorkspaceVenv: true }
|
|
30
|
-
);
|
|
31
|
-
return parseModules(result.stdout);
|
|
32
|
-
}
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
---
|
|
36
|
-
|
|
37
|
-
## 📊 Architecture
|
|
38
|
-
|
|
39
|
-
### Data Flow
|
|
40
|
-
|
|
41
|
-
```
|
|
42
|
-
User Query
|
|
8
|
+
```text
|
|
9
|
+
ai recommend
|
|
43
10
|
↓
|
|
44
|
-
|
|
11
|
+
load user configuration and provider mode
|
|
45
12
|
↓
|
|
46
|
-
|
|
13
|
+
load module catalog + compatible embeddings
|
|
47
14
|
↓
|
|
48
|
-
|
|
49
|
-
│ └─ Success: Return Python modules (runtime count)
|
|
50
|
-
│ └─ Fail: Return fallback catalog (baseline subset)
|
|
15
|
+
embed the query
|
|
51
16
|
↓
|
|
52
|
-
|
|
17
|
+
rank by cosine similarity
|
|
53
18
|
↓
|
|
54
|
-
|
|
55
|
-
↓
|
|
56
|
-
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
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
|
-
```typescript
|
|
118
|
-
Python Category → TypeScript Type
|
|
119
|
-
├─ "auth" → "auth"
|
|
120
|
-
├─ "authentication" → "auth"
|
|
121
|
-
├─ "database" → "database"
|
|
122
|
-
├─ "payment" → "payment"
|
|
123
|
-
├─ "billing" → "payment"
|
|
124
|
-
└─ etc.
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
---
|
|
128
|
-
|
|
129
|
-
### 3. Cache Strategy
|
|
130
|
-
|
|
131
|
-
**TTL: 5 minutes**
|
|
132
|
-
|
|
133
|
-
```
|
|
134
|
-
First call:
|
|
135
|
-
├─ Fetch from Python Core (duration depends on environment)
|
|
136
|
-
├─ Cache result
|
|
137
|
-
└─ Return
|
|
138
|
-
|
|
139
|
-
Subsequent calls (within 5 min):
|
|
140
|
-
├─ Return cached
|
|
141
|
-
└─ Avoid another Core bridge invocation
|
|
142
|
-
|
|
143
|
-
After 5 min:
|
|
144
|
-
├─ Re-fetch from Python
|
|
145
|
-
└─ Update cache
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
**Benefits:**
|
|
149
|
-
|
|
150
|
-
- Cached responses avoid repeated bridge calls
|
|
151
|
-
- Runtime catalog refreshes after five minutes
|
|
152
|
-
- Provider and Core latency remain environment-dependent
|
|
153
|
-
|
|
154
|
-
---
|
|
155
|
-
|
|
156
|
-
### 4. Fallback Mechanism
|
|
157
|
-
|
|
158
|
-
**Graceful degradation:**
|
|
159
|
-
|
|
160
|
-
```
|
|
161
|
-
Try Python Core:
|
|
162
|
-
├─ Success → Use runtime module catalog ✅
|
|
163
|
-
├─ Python not in PATH → Use fallback subset ⚠️
|
|
164
|
-
├─ Command timeout → Use fallback subset ⚠️
|
|
165
|
-
└─ Parse error → Use fallback subset ⚠️
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
**Fallback catalog:**
|
|
169
|
-
|
|
170
|
-
- Baseline core modules (hardcoded subset)
|
|
171
|
-
- Authentication, database, payment, etc.
|
|
172
|
-
- Enough for basic recommendations
|
|
173
|
-
|
|
174
|
-
---
|
|
175
|
-
|
|
176
|
-
### 5. Embedding Generation
|
|
177
|
-
|
|
178
|
-
**Now dynamic:**
|
|
179
|
-
|
|
180
|
-
```bash
|
|
181
|
-
# Old: Generated from fixed hardcoded subset
|
|
182
|
-
npx tsx src/ai/generate-embeddings.ts
|
|
183
|
-
|
|
184
|
-
# New: Fetches from Python Core first
|
|
185
|
-
# → Gets runtime module catalog
|
|
186
|
-
# → Generates embeddings for all discovered modules
|
|
187
|
-
# → Saves to data/modules-embeddings.json
|
|
188
|
-
```
|
|
189
|
-
|
|
190
|
-
**Output:**
|
|
191
|
-
|
|
192
|
-
```json
|
|
193
|
-
{
|
|
194
|
-
"model": "text-embedding-3-small",
|
|
195
|
-
"dimension": 1536,
|
|
196
|
-
"generated_at": "2026-01-01T...",
|
|
197
|
-
"modules": [
|
|
198
|
-
{
|
|
199
|
-
"id": "authentication-core",
|
|
200
|
-
"name": "Authentication Core",
|
|
201
|
-
"embedding": [0.123, -0.456, ...]
|
|
202
|
-
}
|
|
203
|
-
// ... runtime modules (from Python)
|
|
204
|
-
]
|
|
205
|
-
}
|
|
206
|
-
```
|
|
207
|
-
|
|
208
|
-
---
|
|
209
|
-
|
|
210
|
-
## 🚀 Usage Examples
|
|
211
|
-
|
|
212
|
-
### Example 1: With Python Core Available
|
|
213
|
-
|
|
214
|
-
```bash
|
|
215
|
-
$ workspai ai recommend "I need user authentication"
|
|
216
|
-
|
|
217
|
-
# Behind the scenes:
|
|
218
|
-
# 1. Calls the Core bridge: modules list --json-schema 1
|
|
219
|
-
# 2. Gets runtime module catalog from Python Core
|
|
220
|
-
# 3. Generates query embedding
|
|
221
|
-
# 4. Compares with catalog embeddings
|
|
222
|
-
# 5. Returns top 5 recommendations
|
|
223
|
-
|
|
224
|
-
📦 Recommended Modules:
|
|
225
|
-
1. authentication-core ⭐ (98% match)
|
|
226
|
-
2. users-core ⭐ (92% match)
|
|
227
|
-
3. session-management (88% match)
|
|
228
|
-
...
|
|
229
|
-
```
|
|
230
|
-
|
|
231
|
-
---
|
|
232
|
-
|
|
233
|
-
### Example 2: Without Python Core (Fallback)
|
|
234
|
-
|
|
235
|
-
```bash
|
|
236
|
-
$ workspai ai recommend "payment processing"
|
|
237
|
-
|
|
238
|
-
# Console output:
|
|
239
|
-
⚠️ RapidKit Python Core not found in PATH
|
|
240
|
-
Using fallback module catalog (baseline subset)
|
|
241
|
-
|
|
242
|
-
# Still works! Uses hardcoded fallback subset
|
|
243
|
-
📦 Recommended Modules:
|
|
244
|
-
1. stripe-payment ⭐ (95% match)
|
|
245
|
-
...
|
|
246
|
-
```
|
|
247
|
-
|
|
248
|
-
---
|
|
249
|
-
|
|
250
|
-
### Example 3: No Matching Modules
|
|
251
|
-
|
|
252
|
-
```bash
|
|
253
|
-
$ workspai ai recommend "blockchain integration"
|
|
254
|
-
|
|
255
|
-
# Output:
|
|
256
|
-
⚠️ No matching modules found in RapidKit Core registry.
|
|
257
|
-
|
|
258
|
-
💡 Options:
|
|
259
|
-
|
|
260
|
-
1. Create custom module:
|
|
261
|
-
rapidkit modules scaffold blockchain-integration --category integrations
|
|
262
|
-
|
|
263
|
-
2. Search with different keywords
|
|
264
|
-
Try more general terms (e.g., "storage" instead of "blockchain")
|
|
265
|
-
|
|
266
|
-
3. Request feature:
|
|
267
|
-
https://github.com/rapidkitlabs/workspai/issues
|
|
268
|
-
```
|
|
269
|
-
|
|
270
|
-
---
|
|
271
|
-
|
|
272
|
-
## 📋 Benefits
|
|
273
|
-
|
|
274
|
-
### ✅ Always Up-to-Date
|
|
275
|
-
|
|
276
|
-
```
|
|
277
|
-
When Python Core adds new modules:
|
|
278
|
-
├─ AI automatically picks them up
|
|
279
|
-
├─ No code changes needed in npm
|
|
280
|
-
├─ Just regenerate embeddings
|
|
281
|
-
└─ Users get latest recommendations
|
|
282
|
-
```
|
|
283
|
-
|
|
284
|
-
### ✅ Single Source of Truth
|
|
285
|
-
|
|
286
|
-
```
|
|
287
|
-
Module Registry:
|
|
288
|
-
├─ Python Core: runtime catalog (source of truth)
|
|
289
|
-
├─ npm AI: Reads from Python (always synced)
|
|
290
|
-
└─ No duplicate data
|
|
291
|
-
```
|
|
292
|
-
|
|
293
|
-
### ✅ Graceful Fallback
|
|
294
|
-
|
|
295
|
-
```
|
|
296
|
-
If Python unavailable:
|
|
297
|
-
├─ Still works (fallback subset)
|
|
298
|
-
├─ User informed (console warning)
|
|
299
|
-
├─ No crashes or errors
|
|
300
|
-
└─ Can upgrade to Python later
|
|
301
|
-
```
|
|
302
|
-
|
|
303
|
-
### Cache behavior
|
|
304
|
-
|
|
305
|
-
The in-process catalog cache refreshes every five minutes. No fixed response-time
|
|
306
|
-
or throughput guarantee is made; Core startup, provider latency, and catalog size
|
|
307
|
-
vary by environment.
|
|
308
|
-
|
|
309
|
-
---
|
|
310
|
-
|
|
311
|
-
## 🔧 Configuration
|
|
312
|
-
|
|
313
|
-
### Environment Variables
|
|
314
|
-
|
|
315
|
-
```bash
|
|
316
|
-
# Optional: Python command/interpreter override (if python3/python is not the right one)
|
|
317
|
-
export RAPIDKIT_PYTHON_CMD=/path/to/python
|
|
318
|
-
```
|
|
319
|
-
|
|
320
|
-
---
|
|
321
|
-
|
|
322
|
-
## 🧪 Testing
|
|
323
|
-
|
|
324
|
-
### Test 1: With Python Core
|
|
325
|
-
|
|
326
|
-
```bash
|
|
327
|
-
# Ensure Python Core in PATH
|
|
328
|
-
which rapidkit # Should return path
|
|
329
|
-
|
|
330
|
-
# Test recommendation
|
|
331
|
-
workspai ai recommend "authentication"
|
|
332
|
-
|
|
333
|
-
# Should show: using runtime catalog from Python Core
|
|
334
|
-
```
|
|
335
|
-
|
|
336
|
-
### Test 2: Without Python Core
|
|
337
|
-
|
|
338
|
-
```bash
|
|
339
|
-
# Temporarily hide Python
|
|
340
|
-
export PATH=/tmp:$PATH
|
|
341
|
-
|
|
342
|
-
# Test recommendation
|
|
343
|
-
workspai ai recommend "authentication"
|
|
344
|
-
|
|
345
|
-
# Should show: ⚠️ Using fallback catalog (baseline subset)
|
|
346
|
-
```
|
|
347
|
-
|
|
348
|
-
### Test 3: Cache Behavior
|
|
349
|
-
|
|
350
|
-
```bash
|
|
351
|
-
# First call (cold cache; duration is environment-dependent)
|
|
352
|
-
time workspai ai recommend "auth"
|
|
353
|
-
|
|
354
|
-
# Second call (warm catalog cache; still includes provider latency)
|
|
355
|
-
time workspai ai recommend "database"
|
|
356
|
-
|
|
357
|
-
# Wait 6 minutes, try again
|
|
358
|
-
sleep 360
|
|
359
|
-
time workspai ai recommend "payment"
|
|
360
|
-
```
|
|
361
|
-
|
|
362
|
-
---
|
|
363
|
-
|
|
364
|
-
## 📊 Comparison
|
|
365
|
-
|
|
366
|
-
| Feature | Before (Static) | After (Dynamic) |
|
|
367
|
-
| ------------------- | ------------------ | ------------------ |
|
|
368
|
-
| **Module Count** | Fixed subset | Runtime catalog |
|
|
369
|
-
| **Updates** | Manual code change | Automatic |
|
|
370
|
-
| **Sync** | Manual | Automatic |
|
|
371
|
-
| **Fallback** | ❌ None | ✅ Baseline subset |
|
|
372
|
-
| **Cache** | ❌ None | ✅ 5-minute TTL |
|
|
373
|
-
| **Python Required** | ❌ No | ⚠️ Recommended |
|
|
374
|
-
| **Performance** | Fast (hardcoded) | Fast (cached) |
|
|
375
|
-
|
|
376
|
-
---
|
|
377
|
-
|
|
378
|
-
## 🚀 Next Steps
|
|
379
|
-
|
|
380
|
-
### Current Stage: ✅ Dynamic Fetching
|
|
381
|
-
|
|
382
|
-
- ✅ Fetch from Python Core
|
|
383
|
-
- ✅ Cache with TTL
|
|
384
|
-
- ✅ Fallback to hardcoded
|
|
385
|
-
- ✅ Error handling
|
|
386
|
-
|
|
387
|
-
### Next Stage: Module Installation
|
|
388
|
-
|
|
389
|
-
```bash
|
|
390
|
-
workspai ai recommend "authentication"
|
|
391
|
-
# → Shows recommendations
|
|
392
|
-
# → [Install] button
|
|
393
|
-
# → Calls: rapidkit add module authentication-core
|
|
394
|
-
# → Python Core installs module
|
|
395
|
-
```
|
|
396
|
-
|
|
397
|
-
### Future Stage: Real-time Sync
|
|
398
|
-
|
|
399
|
-
```bash
|
|
400
|
-
# Watch Python modules directory
|
|
401
|
-
# Auto-regenerate embeddings when modules change
|
|
402
|
-
# Push updates to users
|
|
403
|
-
```
|
|
404
|
-
|
|
405
|
-
---
|
|
406
|
-
|
|
407
|
-
## 🎯 Summary
|
|
408
|
-
|
|
409
|
-
**What Changed:**
|
|
410
|
-
|
|
411
|
-
- ✅ AI now reads from Python Core dynamically
|
|
412
|
-
- ✅ Runtime catalog instead of a fixed hardcoded subset
|
|
413
|
-
- ✅ Always up-to-date
|
|
414
|
-
- ✅ Fallback if Python not available
|
|
415
|
-
- ✅ 5-minute cache for performance
|
|
416
|
-
|
|
417
|
-
**What Stayed Same:**
|
|
418
|
-
|
|
419
|
-
- ✅ Same API (getModuleCatalog)
|
|
420
|
-
- ✅ Same recommendation algorithm
|
|
421
|
-
- ✅ Same embedding model
|
|
422
|
-
- ✅ Same CLI commands
|
|
423
|
-
- ✅ Backward compatible
|
|
424
|
-
|
|
425
|
-
**Result:**
|
|
426
|
-
|
|
427
|
-
- 🎉 Runtime-driven catalog
|
|
428
|
-
- 🎉 Single source of truth
|
|
429
|
-
- 🎉 Production-ready
|
|
430
|
-
- 🎉 Zero breaking changes
|
|
431
|
-
|
|
432
|
-
---
|
|
433
|
-
|
|
434
|
-
**Built by the Workspai Team**
|
|
435
|
-
|
|
436
|
-
_Dynamic AI that grows with your framework._
|
|
19
|
+
return human or JSON recommendations
|
|
20
|
+
↓ optional, interactive
|
|
21
|
+
validate project `add` capability → Core bridge module install
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Source ownership
|
|
25
|
+
|
|
26
|
+
| Concern | Source area |
|
|
27
|
+
| -------------------------------- | ------------------------------------------- |
|
|
28
|
+
| Command and error behavior | `src/commands/ai.ts` |
|
|
29
|
+
| Provider/mock embedding client | `src/ai/openai-client.ts` |
|
|
30
|
+
| Module catalog and Core fallback | `src/ai/module-catalog.ts` |
|
|
31
|
+
| Ranking | `src/ai/recommender.ts` |
|
|
32
|
+
| Catalog generation/update | `src/ai/embeddings-manager.ts` |
|
|
33
|
+
| User configuration | `src/config/user-config.ts` |
|
|
34
|
+
| Core process boundary | `src/core-bridge/pythonRapidkitExec.ts` |
|
|
35
|
+
| Project command capability | `src/utils/project-command-capabilities.ts` |
|
|
36
|
+
|
|
37
|
+
## Catalog resolution
|
|
38
|
+
|
|
39
|
+
The recommender prefers compatible bundled catalog data. Development refreshes
|
|
40
|
+
can request module metadata through the validated Core bridge. If Core is not
|
|
41
|
+
available, a bounded fallback catalog permits basic discovery.
|
|
42
|
+
|
|
43
|
+
Catalog records must preserve their embedding model and dimension metadata.
|
|
44
|
+
Never combine vectors produced by incompatible models. Catalog caches are
|
|
45
|
+
in-process optimizations, not durable sources of truth.
|
|
46
|
+
|
|
47
|
+
## Failure behavior
|
|
48
|
+
|
|
49
|
+
- Missing provider key selects mock mode for `recommend`.
|
|
50
|
+
- Missing catalog in provider mode returns a structured remediation pointing to
|
|
51
|
+
`ai generate-embeddings`.
|
|
52
|
+
- Provider authentication, rate-limit, and network failures return non-zero.
|
|
53
|
+
- Invalid or unavailable project `add` capability blocks installation without
|
|
54
|
+
weakening the recommendation response.
|
|
55
|
+
- Human and JSON output must preserve the same underlying result semantics.
|
|
56
|
+
|
|
57
|
+
## Security boundaries
|
|
58
|
+
|
|
59
|
+
- Provider secrets come from user configuration or environment, never workspace
|
|
60
|
+
evidence.
|
|
61
|
+
- Logs and JSON responses must not emit provider keys.
|
|
62
|
+
- Core commands execute through the shared bridge rather than ad-hoc process
|
|
63
|
+
spawning.
|
|
64
|
+
- Module recommendation is advisory; installation remains capability-gated and
|
|
65
|
+
verification remains the responsibility of project/Workspace Intelligence
|
|
66
|
+
commands.
|
|
67
|
+
|
|
68
|
+
## Testing expectations
|
|
69
|
+
|
|
70
|
+
Changes to this area require coverage for:
|
|
71
|
+
|
|
72
|
+
- provider and mock modes;
|
|
73
|
+
- missing/invalid configuration;
|
|
74
|
+
- catalog present, missing, and incompatible cases;
|
|
75
|
+
- deterministic ranking fixtures;
|
|
76
|
+
- JSON error contracts and non-zero exits;
|
|
77
|
+
- supported and unsupported Core installation capabilities;
|
|
78
|
+
- secret redaction.
|
|
79
|
+
|
|
80
|
+
Use [AI_QUICKSTART.md](./AI_QUICKSTART.md) for user setup and
|
|
81
|
+
[AI_FEATURES.md](./AI_FEATURES.md) for the public behavioral contract.
|