crewly 1.8.4 → 1.8.5
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/config/roles/_common/wiki-instructions.md +33 -0
- package/config/roles/orchestrator/prompt.md +35 -0
- package/config/roles/team-leader/prompt.md +38 -0
- package/config/skills/agent/core/wiki-query/SKILL.md +66 -0
- package/config/skills/agent/core/wiki-query/execute.sh +107 -0
- package/config/skills/orchestrator/wiki-bookkeep/SKILL.md +71 -0
- package/config/skills/orchestrator/wiki-bookkeep/execute.sh +72 -0
- package/config/skills/orchestrator/wiki-ingest/SKILL.md +63 -0
- package/config/skills/orchestrator/wiki-ingest/execute.sh +113 -0
- package/config/skills/orchestrator/wiki-process-queue/SKILL.md +71 -0
- package/config/skills/orchestrator/wiki-process-queue/execute.sh +93 -0
- package/config/skills/orchestrator/wiki-queue-add/SKILL.md +89 -0
- package/config/skills/orchestrator/wiki-queue-add/execute.sh +115 -0
- package/dist/backend/backend/src/controllers/wiki/wiki.controller.d.ts +134 -0
- package/dist/backend/backend/src/controllers/wiki/wiki.controller.d.ts.map +1 -0
- package/dist/backend/backend/src/controllers/wiki/wiki.controller.js +718 -0
- package/dist/backend/backend/src/controllers/wiki/wiki.controller.js.map +1 -0
- package/dist/backend/backend/src/controllers/wiki/wiki.routes.d.ts +23 -0
- package/dist/backend/backend/src/controllers/wiki/wiki.routes.d.ts.map +1 -0
- package/dist/backend/backend/src/controllers/wiki/wiki.routes.js +43 -0
- package/dist/backend/backend/src/controllers/wiki/wiki.routes.js.map +1 -0
- package/dist/backend/backend/src/index.d.ts.map +1 -1
- package/dist/backend/backend/src/index.js +39 -0
- package/dist/backend/backend/src/index.js.map +1 -1
- package/dist/backend/backend/src/routes/api.routes.d.ts.map +1 -1
- package/dist/backend/backend/src/routes/api.routes.js +4 -0
- package/dist/backend/backend/src/routes/api.routes.js.map +1 -1
- package/dist/backend/backend/src/services/session/pty/pty-session.d.ts +28 -0
- package/dist/backend/backend/src/services/session/pty/pty-session.d.ts.map +1 -1
- package/dist/backend/backend/src/services/session/pty/pty-session.js +162 -4
- package/dist/backend/backend/src/services/session/pty/pty-session.js.map +1 -1
- package/dist/backend/backend/src/services/wiki/referenced-by.resolver.d.ts +69 -0
- package/dist/backend/backend/src/services/wiki/referenced-by.resolver.d.ts.map +1 -0
- package/dist/backend/backend/src/services/wiki/referenced-by.resolver.js +174 -0
- package/dist/backend/backend/src/services/wiki/referenced-by.resolver.js.map +1 -0
- package/dist/backend/backend/src/services/wiki/schema-loader.service.d.ts +57 -0
- package/dist/backend/backend/src/services/wiki/schema-loader.service.d.ts.map +1 -0
- package/dist/backend/backend/src/services/wiki/schema-loader.service.js +183 -0
- package/dist/backend/backend/src/services/wiki/schema-loader.service.js.map +1 -0
- package/dist/backend/backend/src/services/wiki/wiki-bookkeep-trigger.service.d.ts +86 -0
- package/dist/backend/backend/src/services/wiki/wiki-bookkeep-trigger.service.d.ts.map +1 -0
- package/dist/backend/backend/src/services/wiki/wiki-bookkeep-trigger.service.js +187 -0
- package/dist/backend/backend/src/services/wiki/wiki-bookkeep-trigger.service.js.map +1 -0
- package/dist/backend/backend/src/services/wiki/wiki-bookkeep.service.d.ts +116 -0
- package/dist/backend/backend/src/services/wiki/wiki-bookkeep.service.d.ts.map +1 -0
- package/dist/backend/backend/src/services/wiki/wiki-bookkeep.service.js +299 -0
- package/dist/backend/backend/src/services/wiki/wiki-bookkeep.service.js.map +1 -0
- package/dist/backend/backend/src/services/wiki/wiki-chat-subscriber.service.d.ts +74 -0
- package/dist/backend/backend/src/services/wiki/wiki-chat-subscriber.service.d.ts.map +1 -0
- package/dist/backend/backend/src/services/wiki/wiki-chat-subscriber.service.js +154 -0
- package/dist/backend/backend/src/services/wiki/wiki-chat-subscriber.service.js.map +1 -0
- package/dist/backend/backend/src/services/wiki/wiki-ingest.service.d.ts +100 -0
- package/dist/backend/backend/src/services/wiki/wiki-ingest.service.d.ts.map +1 -0
- package/dist/backend/backend/src/services/wiki/wiki-ingest.service.js +212 -0
- package/dist/backend/backend/src/services/wiki/wiki-ingest.service.js.map +1 -0
- package/dist/backend/backend/src/services/wiki/wiki-process.service.d.ts +84 -0
- package/dist/backend/backend/src/services/wiki/wiki-process.service.d.ts.map +1 -0
- package/dist/backend/backend/src/services/wiki/wiki-process.service.js +138 -0
- package/dist/backend/backend/src/services/wiki/wiki-process.service.js.map +1 -0
- package/dist/backend/backend/src/services/wiki/wiki-query.service.d.ts +115 -0
- package/dist/backend/backend/src/services/wiki/wiki-query.service.d.ts.map +1 -0
- package/dist/backend/backend/src/services/wiki/wiki-query.service.js +291 -0
- package/dist/backend/backend/src/services/wiki/wiki-query.service.js.map +1 -0
- package/dist/backend/backend/src/services/wiki/wiki-queue.service.d.ts +115 -0
- package/dist/backend/backend/src/services/wiki/wiki-queue.service.d.ts.map +1 -0
- package/dist/backend/backend/src/services/wiki/wiki-queue.service.js +261 -0
- package/dist/backend/backend/src/services/wiki/wiki-queue.service.js.map +1 -0
- package/dist/backend/backend/src/services/wiki/wiki.types.d.ts +84 -0
- package/dist/backend/backend/src/services/wiki/wiki.types.d.ts.map +1 -0
- package/dist/backend/backend/src/services/wiki/wiki.types.js +10 -0
- package/dist/backend/backend/src/services/wiki/wiki.types.js.map +1 -0
- package/frontend/dist/assets/{index-b279da34.js → index-cc115bb4.js} +246 -246
- package/frontend/dist/assets/{index-c07e04c0.css → index-db3f5041.css} +1 -1
- package/frontend/dist/index.html +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WikiQueueService — file-backed queue of "wiki-worthy" content
|
|
3
|
+
* that agents enqueue from inside their conversations.
|
|
4
|
+
*
|
|
5
|
+
* Design (Steve, 2026-05-22 redesign — replacing the keyword heuristic):
|
|
6
|
+
*
|
|
7
|
+
* 1. The orchestrator-system-prompt rule teaches agents to call the
|
|
8
|
+
* `wiki-queue-add` skill when a turn produces content with lasting
|
|
9
|
+
* value (decision, person fact, customer info, pattern, learning).
|
|
10
|
+
* Agents — not regex — decide.
|
|
11
|
+
*
|
|
12
|
+
* 2. Items sit in the queue with `status: pending` until an agent
|
|
13
|
+
* claims one via `wiki-process-queue` and chooses (a) where in the
|
|
14
|
+
* vault to put it OR (b) skip it because it's not actually worth
|
|
15
|
+
* saving. The agent's LLM is the classifier; we never pre-pick a
|
|
16
|
+
* taxonomy beyond the frozen folders.
|
|
17
|
+
*
|
|
18
|
+
* 3. Bookkeeping cron / threshold reads the same queue + vault stats
|
|
19
|
+
* so it can decide when to ask an agent for a consolidation pass.
|
|
20
|
+
*
|
|
21
|
+
* Storage: `~/.crewly/wiki-queue/<id>.json`. Single flat directory;
|
|
22
|
+
* cross-vault filtering happens at list time via the `vaultPath` field
|
|
23
|
+
* inside each record.
|
|
24
|
+
*
|
|
25
|
+
* @module services/wiki/wiki-queue.service
|
|
26
|
+
*/
|
|
27
|
+
import * as path from 'path';
|
|
28
|
+
import * as os from 'os';
|
|
29
|
+
import * as fs from 'fs/promises';
|
|
30
|
+
import { existsSync } from 'fs';
|
|
31
|
+
import { randomUUID } from 'crypto';
|
|
32
|
+
import { LoggerService } from '../core/logger.service.js';
|
|
33
|
+
const MAX_CONTENT_BYTES = 64 * 1024;
|
|
34
|
+
const MAX_REASON_BYTES = 2 * 1024;
|
|
35
|
+
/**
|
|
36
|
+
* File-backed queue. Stateless other than the on-disk JSONs and an
|
|
37
|
+
* in-memory cache of the root directory. Singleton because all writes
|
|
38
|
+
* go to the same on-disk pool.
|
|
39
|
+
*/
|
|
40
|
+
export class WikiQueueService {
|
|
41
|
+
static instance = null;
|
|
42
|
+
logger;
|
|
43
|
+
rootDir;
|
|
44
|
+
initPromise = null;
|
|
45
|
+
constructor(rootDir) {
|
|
46
|
+
this.logger = LoggerService.getInstance().createComponentLogger('WikiQueue');
|
|
47
|
+
this.rootDir = rootDir ?? path.join(os.homedir(), '.crewly', 'wiki-queue');
|
|
48
|
+
}
|
|
49
|
+
static getInstance() {
|
|
50
|
+
if (!this.instance)
|
|
51
|
+
this.instance = new WikiQueueService();
|
|
52
|
+
return this.instance;
|
|
53
|
+
}
|
|
54
|
+
/** Test-only reset. */
|
|
55
|
+
static _resetForTesting() {
|
|
56
|
+
this.instance = null;
|
|
57
|
+
}
|
|
58
|
+
/** Expose for tests. */
|
|
59
|
+
getRootDir() {
|
|
60
|
+
return this.rootDir;
|
|
61
|
+
}
|
|
62
|
+
// ---------------------------------------------------------------------------
|
|
63
|
+
// CRUD
|
|
64
|
+
// ---------------------------------------------------------------------------
|
|
65
|
+
/** Enqueue a new candidate. Returns the persisted item. */
|
|
66
|
+
async add(input) {
|
|
67
|
+
this.validateAddInput(input);
|
|
68
|
+
await this.ensureRoot();
|
|
69
|
+
const item = {
|
|
70
|
+
id: randomUUID(),
|
|
71
|
+
vaultPath: input.vaultPath,
|
|
72
|
+
queuedAt: new Date().toISOString(),
|
|
73
|
+
queuedBy: input.queuedBy,
|
|
74
|
+
sourceType: input.sourceType,
|
|
75
|
+
sourceRef: input.sourceRef,
|
|
76
|
+
content: input.content,
|
|
77
|
+
reason: input.reason,
|
|
78
|
+
status: 'pending',
|
|
79
|
+
};
|
|
80
|
+
await this.writeItem(item);
|
|
81
|
+
this.logger.info('WikiQueue add', {
|
|
82
|
+
id: item.id,
|
|
83
|
+
vaultPath: item.vaultPath,
|
|
84
|
+
sourceType: item.sourceType,
|
|
85
|
+
queuedBy: item.queuedBy,
|
|
86
|
+
bytes: Buffer.byteLength(item.content, 'utf8'),
|
|
87
|
+
});
|
|
88
|
+
return item;
|
|
89
|
+
}
|
|
90
|
+
/** List items, newest-first, optionally filtered. */
|
|
91
|
+
async list(filter = {}) {
|
|
92
|
+
await this.ensureRoot();
|
|
93
|
+
const limit = filter.limit ?? 50;
|
|
94
|
+
const entries = await fs.readdir(this.rootDir, { withFileTypes: true });
|
|
95
|
+
const items = [];
|
|
96
|
+
for (const entry of entries) {
|
|
97
|
+
if (!entry.isFile() || !entry.name.endsWith('.json'))
|
|
98
|
+
continue;
|
|
99
|
+
const item = await this.readItemFile(path.join(this.rootDir, entry.name));
|
|
100
|
+
if (!item)
|
|
101
|
+
continue;
|
|
102
|
+
if (filter.vaultPath && item.vaultPath !== filter.vaultPath)
|
|
103
|
+
continue;
|
|
104
|
+
if (filter.status && item.status !== filter.status)
|
|
105
|
+
continue;
|
|
106
|
+
if (filter.queuedBy && item.queuedBy !== filter.queuedBy)
|
|
107
|
+
continue;
|
|
108
|
+
items.push(item);
|
|
109
|
+
}
|
|
110
|
+
items.sort((a, b) => (a.queuedAt < b.queuedAt ? 1 : -1));
|
|
111
|
+
return items.slice(0, limit);
|
|
112
|
+
}
|
|
113
|
+
/** Fetch one by id. Returns null when missing. */
|
|
114
|
+
async get(id) {
|
|
115
|
+
await this.ensureRoot();
|
|
116
|
+
const file = path.join(this.rootDir, `${id}.json`);
|
|
117
|
+
return this.readItemFile(file);
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Claim an item — only allowed when `status: pending`. Stamps the
|
|
121
|
+
* claimant + timestamp atomically.
|
|
122
|
+
*/
|
|
123
|
+
async claim(id, claimedBy) {
|
|
124
|
+
const item = await this.requireItem(id);
|
|
125
|
+
if (item.status !== 'pending') {
|
|
126
|
+
throw new Error(`WikiQueue.claim(${id}): item is ${item.status}; only pending items can be claimed`);
|
|
127
|
+
}
|
|
128
|
+
const updated = {
|
|
129
|
+
...item,
|
|
130
|
+
status: 'claimed',
|
|
131
|
+
claimedBy,
|
|
132
|
+
claimedAt: new Date().toISOString(),
|
|
133
|
+
};
|
|
134
|
+
await this.writeItem(updated);
|
|
135
|
+
this.logger.info('WikiQueue claim', { id, claimedBy });
|
|
136
|
+
return updated;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Mark processed. Requires the item to be `claimed` AND requires a
|
|
140
|
+
* `result` with at least one of `pagesWritten` / `targetPath` / `summary`.
|
|
141
|
+
*/
|
|
142
|
+
async markProcessed(id, result) {
|
|
143
|
+
const item = await this.requireItem(id);
|
|
144
|
+
if (item.status !== 'claimed') {
|
|
145
|
+
throw new Error(`WikiQueue.markProcessed(${id}): item is ${item.status}; must be claimed first`);
|
|
146
|
+
}
|
|
147
|
+
const updated = {
|
|
148
|
+
...item,
|
|
149
|
+
status: 'processed',
|
|
150
|
+
processedAt: new Date().toISOString(),
|
|
151
|
+
result,
|
|
152
|
+
};
|
|
153
|
+
await this.writeItem(updated);
|
|
154
|
+
this.logger.info('WikiQueue processed', {
|
|
155
|
+
id,
|
|
156
|
+
pages: result.pagesWritten?.length ?? 0,
|
|
157
|
+
target: result.targetPath,
|
|
158
|
+
});
|
|
159
|
+
return updated;
|
|
160
|
+
}
|
|
161
|
+
/** Mark skipped — agent decided this isn't wiki-worthy after all. */
|
|
162
|
+
async markSkipped(id, skipReason) {
|
|
163
|
+
if (!skipReason || skipReason.trim().length === 0) {
|
|
164
|
+
throw new Error('WikiQueue.markSkipped requires a non-empty skipReason');
|
|
165
|
+
}
|
|
166
|
+
const item = await this.requireItem(id);
|
|
167
|
+
if (item.status !== 'claimed') {
|
|
168
|
+
throw new Error(`WikiQueue.markSkipped(${id}): item is ${item.status}; must be claimed first`);
|
|
169
|
+
}
|
|
170
|
+
const updated = {
|
|
171
|
+
...item,
|
|
172
|
+
status: 'skipped',
|
|
173
|
+
processedAt: new Date().toISOString(),
|
|
174
|
+
result: { ingested: false, skipReason },
|
|
175
|
+
};
|
|
176
|
+
await this.writeItem(updated);
|
|
177
|
+
this.logger.info('WikiQueue skipped', { id, reason: skipReason });
|
|
178
|
+
return updated;
|
|
179
|
+
}
|
|
180
|
+
/** Status counts, optionally scoped to a vault. */
|
|
181
|
+
async getStats(vaultPath) {
|
|
182
|
+
const items = await this.list({ vaultPath, limit: Number.MAX_SAFE_INTEGER });
|
|
183
|
+
const counts = {
|
|
184
|
+
pending: 0,
|
|
185
|
+
claimed: 0,
|
|
186
|
+
processed: 0,
|
|
187
|
+
skipped: 0,
|
|
188
|
+
total: items.length,
|
|
189
|
+
};
|
|
190
|
+
for (const it of items) {
|
|
191
|
+
counts[it.status]++;
|
|
192
|
+
}
|
|
193
|
+
return counts;
|
|
194
|
+
}
|
|
195
|
+
// ---------------------------------------------------------------------------
|
|
196
|
+
// Internals
|
|
197
|
+
// ---------------------------------------------------------------------------
|
|
198
|
+
validateAddInput(input) {
|
|
199
|
+
if (!input.vaultPath || !path.isAbsolute(input.vaultPath)) {
|
|
200
|
+
throw new Error('WikiQueue.add: vaultPath must be absolute');
|
|
201
|
+
}
|
|
202
|
+
if (!input.queuedBy)
|
|
203
|
+
throw new Error('WikiQueue.add: queuedBy is required');
|
|
204
|
+
if (!input.sourceType)
|
|
205
|
+
throw new Error('WikiQueue.add: sourceType is required');
|
|
206
|
+
if (!input.sourceRef)
|
|
207
|
+
throw new Error('WikiQueue.add: sourceRef is required');
|
|
208
|
+
const content = input.content ?? '';
|
|
209
|
+
if (content.trim().length === 0) {
|
|
210
|
+
throw new Error('WikiQueue.add: content is empty');
|
|
211
|
+
}
|
|
212
|
+
if (Buffer.byteLength(content, 'utf8') > MAX_CONTENT_BYTES) {
|
|
213
|
+
throw new Error(`WikiQueue.add: content exceeds ${MAX_CONTENT_BYTES} bytes`);
|
|
214
|
+
}
|
|
215
|
+
const reason = input.reason ?? '';
|
|
216
|
+
if (reason.trim().length === 0) {
|
|
217
|
+
throw new Error('WikiQueue.add: reason is required — agents MUST justify why this is wiki-worthy');
|
|
218
|
+
}
|
|
219
|
+
if (Buffer.byteLength(reason, 'utf8') > MAX_REASON_BYTES) {
|
|
220
|
+
throw new Error(`WikiQueue.add: reason exceeds ${MAX_REASON_BYTES} bytes`);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
async ensureRoot() {
|
|
224
|
+
if (this.initPromise) {
|
|
225
|
+
await this.initPromise;
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
this.initPromise = (async () => {
|
|
229
|
+
if (!existsSync(this.rootDir)) {
|
|
230
|
+
await fs.mkdir(this.rootDir, { recursive: true });
|
|
231
|
+
}
|
|
232
|
+
})();
|
|
233
|
+
await this.initPromise;
|
|
234
|
+
}
|
|
235
|
+
async writeItem(item) {
|
|
236
|
+
const file = path.join(this.rootDir, `${item.id}.json`);
|
|
237
|
+
const tmp = `${file}.tmp`;
|
|
238
|
+
await fs.writeFile(tmp, JSON.stringify(item, null, 2), 'utf8');
|
|
239
|
+
await fs.rename(tmp, file); // atomic on the same filesystem
|
|
240
|
+
}
|
|
241
|
+
async readItemFile(file) {
|
|
242
|
+
try {
|
|
243
|
+
const raw = await fs.readFile(file, 'utf8');
|
|
244
|
+
const parsed = JSON.parse(raw);
|
|
245
|
+
// Soft validation — discard rows that don't match the shape we own.
|
|
246
|
+
if (!parsed.id || !parsed.status || !parsed.queuedAt)
|
|
247
|
+
return null;
|
|
248
|
+
return parsed;
|
|
249
|
+
}
|
|
250
|
+
catch {
|
|
251
|
+
return null;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
async requireItem(id) {
|
|
255
|
+
const item = await this.get(id);
|
|
256
|
+
if (!item)
|
|
257
|
+
throw new Error(`WikiQueue: item not found: ${id}`);
|
|
258
|
+
return item;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
//# sourceMappingURL=wiki-queue.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wiki-queue.service.js","sourceRoot":"","sources":["../../../../../../backend/src/services/wiki/wiki-queue.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,aAAa,EAAmB,MAAM,2BAA2B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,EAAE,CAAC,CAAC;QAChC,IAAI,CAAC,IAAI;YAAE,MAAM,IAAI,KAAK,CAAC,8BAA8B,EAAE,EAAE,CAAC,CAAC;QAC/D,OAAO,IAAI,CAAC;IACd,CAAC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LLM-Wiki shared types.
|
|
3
|
+
*
|
|
4
|
+
* Mirrors the SCHEMA.md YAML shape defined in
|
|
5
|
+
* .crewly/specs/2026-05-22-atlas-crewly-llm-wiki-v2-three-scope.md §2.
|
|
6
|
+
*
|
|
7
|
+
* @module services/wiki/wiki.types
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* The three vault scopes per v2.1 §1.
|
|
11
|
+
*
|
|
12
|
+
* - `team`: ~/.crewly/teams/<team-id>/wiki/ (cross-project team norms)
|
|
13
|
+
* - `project`: <project-root>/.crewly/wiki/ (project-scoped knowledge)
|
|
14
|
+
* - `global`: ~/.crewly/global-wiki/ (ORC cross-project synthesis)
|
|
15
|
+
*/
|
|
16
|
+
export type VaultScope = 'team' | 'project' | 'global';
|
|
17
|
+
/**
|
|
18
|
+
* A symbolic `referenced_by:` entry in SCHEMA.md.
|
|
19
|
+
*
|
|
20
|
+
* Format: `<kind>:<name>` (e.g. `skill:get-sops`, `service:sop.service`).
|
|
21
|
+
* Resolves to an absolute filesystem path via
|
|
22
|
+
* {@link ReferencedByResolver.resolve} so SCHEMA.md stays portable across
|
|
23
|
+
* machines, users, and runtime targets.
|
|
24
|
+
*/
|
|
25
|
+
export type ReferencedBySymbol = `skill:${string}` | `service:${string}`;
|
|
26
|
+
/**
|
|
27
|
+
* A folder entry inside a vault's `hardcoded:` block.
|
|
28
|
+
*
|
|
29
|
+
* Hardcoded folders are referenced by string literal from OSS code. They
|
|
30
|
+
* MUST NOT be moved, renamed, or restructured by `wiki-lint`.
|
|
31
|
+
*/
|
|
32
|
+
export interface HardcodedFolder {
|
|
33
|
+
/** Folder name relative to vault root, e.g. `sop/`, `memory/`. */
|
|
34
|
+
path: string;
|
|
35
|
+
/** Always true for entries in `hardcoded:`. */
|
|
36
|
+
frozen: true;
|
|
37
|
+
/** Human description; appears in lint reports. */
|
|
38
|
+
description: string;
|
|
39
|
+
/** Symbolic refs to code that hard-codes this path. Use `skill:` / `service:`. */
|
|
40
|
+
referenced_by: ReferencedBySymbol[];
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* The single `llm-curated:` folder entry — LLM owns sub-structure entirely.
|
|
44
|
+
*/
|
|
45
|
+
export interface LlmCuratedFolder {
|
|
46
|
+
/** Always `llm-curated/`. */
|
|
47
|
+
path: string;
|
|
48
|
+
/** Always false; lint MAY restructure. */
|
|
49
|
+
frozen: false;
|
|
50
|
+
/** Initial subdirs to seed; LLM may add more if `llm_can_create_subdirs`. */
|
|
51
|
+
seed_subdirs: string[];
|
|
52
|
+
llm_can_create_subdirs: boolean;
|
|
53
|
+
lint_may_restructure: boolean;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* `write_policy:` block — who may write canonical pages vs. propose-only.
|
|
57
|
+
*/
|
|
58
|
+
export interface WritePolicy {
|
|
59
|
+
/** Roles allowed to write canonical pages via `wiki-ingest`. */
|
|
60
|
+
canonical: string[];
|
|
61
|
+
/** Roles whose ingest writes are PR-style; TL/ORC must accept. */
|
|
62
|
+
proposed_only: string[];
|
|
63
|
+
/** Roles allowed to modify SCHEMA.md itself. */
|
|
64
|
+
schema_writer: string[];
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Parsed SCHEMA.md content for one vault.
|
|
68
|
+
*/
|
|
69
|
+
export interface VaultSchema {
|
|
70
|
+
vault_scope: VaultScope;
|
|
71
|
+
vault_id: string;
|
|
72
|
+
hardcoded: HardcodedFolder[];
|
|
73
|
+
llm_curated: LlmCuratedFolder[];
|
|
74
|
+
write_policy: WritePolicy;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Result of resolving a symbolic `referenced_by:` entry.
|
|
78
|
+
*/
|
|
79
|
+
export interface ResolvedReference {
|
|
80
|
+
symbol: ReferencedBySymbol;
|
|
81
|
+
absolutePath: string;
|
|
82
|
+
exists: boolean;
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=wiki.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wiki.types.d.ts","sourceRoot":"","sources":["../../../../../../backend/src/services/wiki/wiki.types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;;;GAMG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,SAAS,GAAG,QAAQ,CAAC;AAEvD;;;;;;;GAOG;AACH,MAAM,MAAM,kBAAkB,GAAG,SAAS,MAAM,EAAE,GAAG,WAAW,MAAM,EAAE,CAAC;AAEzE;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC9B,kEAAkE;IAClE,IAAI,EAAE,MAAM,CAAC;IACb,+CAA+C;IAC/C,MAAM,EAAE,IAAI,CAAC;IACb,kDAAkD;IAClD,WAAW,EAAE,MAAM,CAAC;IACpB,kFAAkF;IAClF,aAAa,EAAE,kBAAkB,EAAE,CAAC;CACrC;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,6BAA6B;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,0CAA0C;IAC1C,MAAM,EAAE,KAAK,CAAC;IACd,6EAA6E;IAC7E,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,sBAAsB,EAAE,OAAO,CAAC;IAChC,oBAAoB,EAAE,OAAO,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,gEAAgE;IAChE,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,kEAAkE;IAClE,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,gDAAgD;IAChD,aAAa,EAAE,MAAM,EAAE,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,WAAW,EAAE,UAAU,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,eAAe,EAAE,CAAC;IAC7B,WAAW,EAAE,gBAAgB,EAAE,CAAC;IAChC,YAAY,EAAE,WAAW,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,kBAAkB,CAAC;IAC3B,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,OAAO,CAAC;CACjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wiki.types.js","sourceRoot":"","sources":["../../../../../../backend/src/services/wiki/wiki.types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG"}
|