octopi-agent 0.58.0 → 0.65.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 CHANGED
@@ -67,14 +67,14 @@ Infrastructure primitives (EventBus, StateMachine) and **Kernel ports** (ModelPr
67
67
  | **Session** | `session/` | How does continuity hold? (aggregate, Discourse, tasks, history) |
68
68
  | **Agent** | `agent/` | Who is it / how is it configured? (template, persona, builder) |
69
69
  | **Memory** | `memory/` | What has it learned? (Memory / Cognition / Wisdom substrate) |
70
- | **Knowledge** | `knowledge/` | What does the world write down? (exogenous corpus, sources, retrieval) |
70
+ | **Knowledge** | `knowledge/` | What does the world write down? (exogenous sources, Knowledge Service, retrieval) |
71
71
  | **Activation** | `activation/` | How do stimuli become Runs? |
72
72
  | **Run** | `run/` | How does this episode stay safe? (RunScope, reliability, guard, budget) |
73
73
  | **Context** | `context/` | What does the model see? (eight-layer assembly, tokens, window) |
74
74
  | **Extension** | `extension/` | How are capabilities extended? (Plugin/Tool/Skill/MCP, sandbox) |
75
75
  | **Collaboration** | `collaboration/` | How do multi-Agents / subsystems coordinate? |
76
76
 
77
- Cross-cutting / foundation (not counted): `observability/`, `context/capabilities/`, `shared/`.
77
+ Cross-cutting / foundation (not counted): `observability/`, `context/capabilities/` (summary/compact), `capabilities/document/` (Document extract Port), `shared/`.
78
78
  Sole count authority: [docs/domains.yaml](./docs/domains.yaml) · narrative: [docs/domains.md](./docs/domains.md).
79
79
 
80
80
  ### Layer 3: Integration — External Adapters
@@ -414,6 +414,16 @@ export async function serveStartCommand(args) {
414
414
  console.log(` Config: ${configPath ?? join(getOctopiHome(), 'octopi.json')}`);
415
415
  console.log(` Port: ${port}`);
416
416
  console.log(` Log: ${logPath}`);
417
+ // Knowledge Service 启动状态(manageLocal / 远程 / disabled)
418
+ const knLines = readLogTail(logPath, 30).filter((l) => l.includes('[Knowledge]'));
419
+ if (knLines.length > 0) {
420
+ for (const line of knLines.slice(-3)) {
421
+ console.log(` ${line.trim()}`);
422
+ }
423
+ }
424
+ else {
425
+ console.log(' Knowledge: (no [Knowledge] line yet — see gateway.log)');
426
+ }
417
427
  // Web UI 为可选:失败不拖垮 Gateway(跨平台/无 web 依赖时仍可 serve)
418
428
  await webuiStartCommand(configPath, { soft: true });
419
429
  console.log(`\nUse 'octopi serve stop' to stop, 'octopi serve status' to check.`);
@@ -767,6 +777,15 @@ async function startGatewayBlocking(configPath, args) {
767
777
  apiKey: httpConfig?.apiKey,
768
778
  corsOrigins: httpConfig?.corsOrigins,
769
779
  onRequest: (req, res) => webApiRouter.handle(req, res),
780
+ healthExtras: () => {
781
+ try {
782
+ const kn = gateway.knowledgeRuntime;
783
+ return { knowledge: kn?.state ?? 'disabled' };
784
+ }
785
+ catch {
786
+ return { knowledge: 'unknown' };
787
+ }
788
+ },
770
789
  }));
771
790
  }
772
791
  const shutdown = async () => {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * doctor 数据层:agent.db 迁移检查 + session.store 废弃检测
2
+ * doctor 数据层:agent.db 迁移检查 + session.store 废弃检测 + knowledge.db schema 升级
3
3
  *
4
4
  * 本地确定性;node:sqlite / agent.db 不可用时只报告,不拖垮 doctor。
5
5
  *
@@ -45,6 +45,42 @@ export declare function checkDeprecatedSessionStore(raw: Record<string, unknown>
45
45
  * @returns findings
46
46
  */
47
47
  export declare function detectDataLayer(targets: AgentDataTarget[]): DataFixResult['findings'];
48
+ /** 异步检测 knowledge 源注册健康(doctor detect 合并) */
49
+ export declare function detectKnowledgeSourcesAsync(): Promise<DataFixResult['findings']>;
50
+ /** knowledge.db 路径(OCTOPI_HOME/knowledge/) */
51
+ export declare function knowledgeDbPath(): string;
52
+ /**
53
+ * 检测 knowledge.db 是否仍是旧 schema(source_id/path 文件表,无 identity_key)
54
+ */
55
+ export declare function detectKnowledgeDb(): DataFixResult['findings'];
56
+ /**
57
+ * 打开 knowledge.db 触发 v2 schema 迁移(幂等;Index 可重建)
58
+ */
59
+ export declare function migrateKnowledgeDatabase(): Promise<string>;
60
+ export interface KnowledgeSourceInfo {
61
+ id: string;
62
+ displayName: string;
63
+ location: string;
64
+ status: string;
65
+ scopeLevel: string;
66
+ scopeKey: string;
67
+ kind: string;
68
+ }
69
+ /**
70
+ * 列出 knowledge.db 中的源注册(不含索引投影)。
71
+ * 源是用户数据,**不**在 migrate 时自动删除。
72
+ */
73
+ export declare function listKnowledgeSources(): Promise<KnowledgeSourceInfo[]>;
74
+ /**
75
+ * 检测源注册状态:location 是否还在、是否需 reindex。
76
+ * **不**自动删源;仅报告,删除走 --allow-delete-legacy-dirs 或管理面。
77
+ */
78
+ export declare function detectKnowledgeSourceHealth(): Promise<DataFixResult['findings']>;
79
+ /**
80
+ * 显式删除知识源注册(用户确认后)。
81
+ * 仅删 registration + 本源 memberships;不删共享 File 的 chunks(零认领才 purge)。
82
+ */
83
+ export declare function removeKnowledgeSource(sourceId: string): Promise<string>;
48
84
  /**
49
85
  * 打开 agent.db 触发既有 schema migrate(幂等)
50
86
  *
@@ -1,11 +1,11 @@
1
1
  /**
2
- * doctor 数据层:agent.db 迁移检查 + session.store 废弃检测
2
+ * doctor 数据层:agent.db 迁移检查 + session.store 废弃检测 + knowledge.db schema 升级
3
3
  *
4
4
  * 本地确定性;node:sqlite / agent.db 不可用时只报告,不拖垮 doctor。
5
5
  *
6
6
  * @module
7
7
  */
8
- import { existsSync, mkdirSync, readdirSync } from 'node:fs';
8
+ import { existsSync, mkdirSync, readdirSync, statSync, copyFileSync } from 'node:fs';
9
9
  import { join, resolve } from 'node:path';
10
10
  import { getOctopiHome } from '@octopi-agent/engine/paths.js';
11
11
  /**
@@ -116,8 +116,209 @@ export function detectDataLayer(targets) {
116
116
  });
117
117
  }
118
118
  }
119
+ findings.push(...detectKnowledgeDb());
120
+ return findings;
121
+ }
122
+ /** 异步检测 knowledge 源注册健康(doctor detect 合并) */
123
+ export async function detectKnowledgeSourcesAsync() {
124
+ return detectKnowledgeSourceHealth();
125
+ }
126
+ /** knowledge.db 路径(OCTOPI_HOME/knowledge/) */
127
+ export function knowledgeDbPath() {
128
+ return join(getOctopiHome(), 'knowledge', 'knowledge.db');
129
+ }
130
+ /**
131
+ * 检测 knowledge.db 是否仍是旧 schema(source_id/path 文件表,无 identity_key)
132
+ */
133
+ export function detectKnowledgeDb() {
134
+ const findings = [];
135
+ const dbPath = knowledgeDbPath();
136
+ if (!existsSync(dbPath)) {
137
+ findings.push({
138
+ id: 'KN001',
139
+ domain: 'data',
140
+ severity: 'info',
141
+ message: 'knowledge.db not present yet (Knowledge Service will create on first start)',
142
+ hint: 'managed by Knowledge Service (manageLocal) or remote baseUrl',
143
+ fixable: false,
144
+ });
145
+ return findings;
146
+ }
147
+ try {
148
+ // 轻量探测:不 import sqlite 也能报文件在;schema 细节留给 --fix
149
+ findings.push({
150
+ id: 'KN002',
151
+ domain: 'data',
152
+ severity: 'info',
153
+ message: `knowledge.db present (${formatBytes(statSync(dbPath).size)}); schema check on --fix data`,
154
+ hint: 'v2 File identity schema: knowledge_files.identity_key + knowledge_memberships',
155
+ fixable: true,
156
+ group: 'data',
157
+ });
158
+ }
159
+ catch {
160
+ findings.push({
161
+ id: 'KN003',
162
+ domain: 'data',
163
+ severity: 'warn',
164
+ message: 'knowledge.db unreadable',
165
+ hint: 'check permissions on OCTOPI_HOME/knowledge/',
166
+ fixable: false,
167
+ });
168
+ }
169
+ return findings;
170
+ }
171
+ function formatBytes(n) {
172
+ if (n < 1024)
173
+ return `${n}B`;
174
+ if (n < 1024 * 1024)
175
+ return `${(n / 1024).toFixed(1)}KB`;
176
+ return `${(n / (1024 * 1024)).toFixed(1)}MB`;
177
+ }
178
+ /**
179
+ * 打开 knowledge.db 触发 v2 schema 迁移(幂等;Index 可重建)
180
+ */
181
+ export async function migrateKnowledgeDatabase() {
182
+ const dbPath = knowledgeDbPath();
183
+ const dir = join(getOctopiHome(), 'knowledge');
184
+ mkdirSync(dir, { recursive: true });
185
+ const created = !existsSync(dbPath);
186
+ if (!created) {
187
+ // 迁移前备份(同目录 .bak)
188
+ const bak = `${dbPath}.pre-v2.bak`;
189
+ if (!existsSync(bak)) {
190
+ copyFileSync(dbPath, bak);
191
+ }
192
+ }
193
+ const { KnowledgeDatabase } = await import('@octopi-agent/engine/harness/knowledge/db.js');
194
+ const db = await KnowledgeDatabase.create({ dbPath });
195
+ try {
196
+ const stats = db.stats();
197
+ return created
198
+ ? `knowledge: created knowledge.db (File identity schema)`
199
+ : `knowledge: schema migrate ok (sources=${stats.sources ?? 0}, files=${stats.files ?? 0}; index rebuild via reindex)`;
200
+ }
201
+ finally {
202
+ db.close();
203
+ }
204
+ }
205
+ /**
206
+ * 列出 knowledge.db 中的源注册(不含索引投影)。
207
+ * 源是用户数据,**不**在 migrate 时自动删除。
208
+ */
209
+ export async function listKnowledgeSources() {
210
+ const dbPath = knowledgeDbPath();
211
+ if (!existsSync(dbPath))
212
+ return [];
213
+ const { KnowledgeDatabase } = await import('@octopi-agent/engine/harness/knowledge/db.js');
214
+ const db = await KnowledgeDatabase.create({ dbPath });
215
+ try {
216
+ const rows = db.raw
217
+ .prepare(`SELECT id, display_name, location, status, scope_level, scope_key, kind
218
+ FROM knowledge_sources ORDER BY created_at`)
219
+ .all();
220
+ return rows.map((r) => ({
221
+ id: r.id,
222
+ displayName: r.display_name,
223
+ location: r.location,
224
+ status: r.status,
225
+ scopeLevel: r.scope_level,
226
+ scopeKey: r.scope_key,
227
+ kind: r.kind,
228
+ }));
229
+ }
230
+ finally {
231
+ db.close();
232
+ }
233
+ }
234
+ /**
235
+ * 检测源注册状态:location 是否还在、是否需 reindex。
236
+ * **不**自动删源;仅报告,删除走 --allow-delete-legacy-dirs 或管理面。
237
+ */
238
+ export async function detectKnowledgeSourceHealth() {
239
+ const findings = [];
240
+ let sources = [];
241
+ try {
242
+ sources = await listKnowledgeSources();
243
+ }
244
+ catch (err) {
245
+ findings.push({
246
+ id: 'KN004',
247
+ domain: 'data',
248
+ severity: 'warn',
249
+ message: `knowledge: cannot list sources: ${err instanceof Error ? err.message : String(err)}`,
250
+ hint: 'open knowledge.db failed — run doctor --fix data first',
251
+ fixable: false,
252
+ });
253
+ return findings;
254
+ }
255
+ if (sources.length === 0) {
256
+ findings.push({
257
+ id: 'KN005',
258
+ domain: 'data',
259
+ severity: 'info',
260
+ message: 'knowledge: no sources registered',
261
+ hint: 'register sources via Web UI or API',
262
+ fixable: false,
263
+ });
264
+ return findings;
265
+ }
266
+ const missing = [];
267
+ for (const s of sources) {
268
+ if (s.scopeLevel === 'session')
269
+ continue;
270
+ if (s.kind === 'url' || s.kind === 'connector')
271
+ continue;
272
+ if (s.location && !existsSync(s.location)) {
273
+ missing.push(s);
274
+ }
275
+ }
276
+ findings.push({
277
+ id: 'KN006',
278
+ domain: 'data',
279
+ severity: 'info',
280
+ message: `knowledge: ${sources.length} source(s) registered (index rebuild via reindex)`,
281
+ hint: sources.map((s) => `${s.displayName || s.id} [${s.status}]`).slice(0, 8).join('; '),
282
+ fixable: false,
283
+ });
284
+ for (const s of missing) {
285
+ findings.push({
286
+ id: 'KN007',
287
+ domain: 'data',
288
+ severity: 'warn',
289
+ message: `knowledge source "${s.displayName || s.id}": location missing (${s.location})`,
290
+ hint: 'path no longer exists — remove the source via Web UI if obsolete; doctor will not auto-delete source registrations',
291
+ fixable: false,
292
+ });
293
+ }
119
294
  return findings;
120
295
  }
296
+ /**
297
+ * 显式删除知识源注册(用户确认后)。
298
+ * 仅删 registration + 本源 memberships;不删共享 File 的 chunks(零认领才 purge)。
299
+ */
300
+ export async function removeKnowledgeSource(sourceId) {
301
+ const dbPath = knowledgeDbPath();
302
+ const { KnowledgeDatabase } = await import('@octopi-agent/engine/harness/knowledge/db.js');
303
+ const db = await KnowledgeDatabase.create({ dbPath });
304
+ try {
305
+ const src = db.raw
306
+ .prepare('SELECT display_name FROM knowledge_sources WHERE id = ?')
307
+ .get(sourceId);
308
+ if (!src)
309
+ return `knowledge source ${sourceId}: not found`;
310
+ db.raw.prepare('DELETE FROM knowledge_sources WHERE id = ?').run(sourceId);
311
+ db.raw.prepare('DELETE FROM knowledge_project_agents WHERE 1=0').run(); // no-op placeholder
312
+ db.raw
313
+ .prepare('DELETE FROM knowledge_memberships WHERE source_id = ?')
314
+ .run(sourceId);
315
+ // 零认领 File 的 purge 交给服务启动 reconcile;此处只解绑
316
+ return `knowledge source "${src.display_name || sourceId}": removed (run reindex/reconcile to purge orphan index)`;
317
+ }
318
+ finally {
319
+ db.close();
320
+ }
321
+ }
121
322
  /**
122
323
  * 打开 agent.db 触发既有 schema migrate(幂等)
123
324
  *
@@ -156,6 +357,10 @@ export async function applyDataLayerFixes(targets, options = {}) {
156
357
  ? `[dry-run] would open+migrate ${dbPath}`
157
358
  : `[dry-run] would create ${dbPath}`);
158
359
  }
360
+ const kdb = knowledgeDbPath();
361
+ notes.push(existsSync(kdb)
362
+ ? `[dry-run] would backup+migrate ${kdb} to File identity schema`
363
+ : `[dry-run] would create ${kdb}`);
159
364
  findings.push({
160
365
  id: 'FIX002',
161
366
  domain: 'data',
@@ -191,6 +396,30 @@ export async function applyDataLayerFixes(targets, options = {}) {
191
396
  });
192
397
  }
193
398
  }
399
+ // knowledge.db:File identity schema(v2)
400
+ try {
401
+ notes.push(await migrateKnowledgeDatabase());
402
+ findings.push({
403
+ id: 'KN002',
404
+ domain: 'data',
405
+ severity: 'ok',
406
+ message: notes[notes.length - 1],
407
+ hint: 'index rebuild via source reindex (Index non-authoritative)',
408
+ fixable: false,
409
+ });
410
+ }
411
+ catch (err) {
412
+ const msg = err instanceof Error ? err.message : String(err);
413
+ notes.push(`knowledge.db migrate failed: ${msg}`);
414
+ findings.push({
415
+ id: 'KN003',
416
+ domain: 'data',
417
+ severity: 'error',
418
+ message: `knowledge: schema migrate failed: ${msg}`,
419
+ hint: 'requires Node.js >= 24 node:sqlite; pre-v2 backup written as knowledge.db.pre-v2.bak',
420
+ fixable: false,
421
+ });
422
+ }
194
423
  const failed = findings.filter((f) => f.id === 'DB003').length;
195
424
  findings.push({
196
425
  id: 'FIX002',
@@ -4,7 +4,7 @@
4
4
  * @module
5
5
  */
6
6
  import type { CliArgs } from '../args.js';
7
- import { applyDataLayerFixes, checkDeprecatedSessionStore, detectDataLayer, resolveAgentDataTargets } from './data.js';
7
+ import { applyDataLayerFixes, checkDeprecatedSessionStore, detectDataLayer, resolveAgentDataTargets, detectKnowledgeDb, detectKnowledgeSourcesAsync, migrateKnowledgeDatabase, knowledgeDbPath, listKnowledgeSources, removeKnowledgeSource } from './data.js';
8
8
  import { latestConfigBackup, listConfigBackups, restoreConfigFromBackup } from './restore.js';
9
9
  export type DoctorSeverity = 'error' | 'warn' | 'info' | 'ok';
10
10
  export type FixGroup = 'config' | 'layout' | 'data';
@@ -128,4 +128,4 @@ export declare function doctorCommand(args: CliArgs, options?: DoctorOptions): P
128
128
  /** 供测试:列出 agent 目录 */
129
129
  export declare function listAgentDirs(home: string): string[];
130
130
  export { listConfigBackups, latestConfigBackup, restoreConfigFromBackup };
131
- export { detectDataLayer, applyDataLayerFixes, resolveAgentDataTargets, checkDeprecatedSessionStore, };
131
+ export { detectDataLayer, applyDataLayerFixes, resolveAgentDataTargets, checkDeprecatedSessionStore, detectKnowledgeDb, detectKnowledgeSourcesAsync, migrateKnowledgeDatabase, knowledgeDbPath, listKnowledgeSources, removeKnowledgeSource, };
@@ -9,7 +9,7 @@ import { dirname, join, resolve } from 'node:path';
9
9
  import { getOctopiHome } from '@octopi-agent/engine/paths.js';
10
10
  import { validateConfig } from '../../config-schema.js';
11
11
  import { applyConfigMigrations, detectConfigMigrations, expandEnvPlaceholders, parseConfigJson, } from '../../config-migrations.js';
12
- import { applyDataLayerFixes, checkDeprecatedSessionStore, detectDataLayer, resolveAgentDataTargets, } from './data.js';
12
+ import { applyDataLayerFixes, checkDeprecatedSessionStore, detectDataLayer, resolveAgentDataTargets, detectKnowledgeDb, detectKnowledgeSourcesAsync, migrateKnowledgeDatabase, knowledgeDbPath, listKnowledgeSources, removeKnowledgeSource, } from './data.js';
13
13
  import { latestConfigBackup, listConfigBackups, restoreConfigFromBackup, } from './restore.js';
14
14
  import { redactConfig, looksLikeSecret, redactSecretString } from './redact.js';
15
15
  // ── 路径解析 ──
@@ -248,7 +248,7 @@ function domainAllowed(id, domain, only) {
248
248
  return true;
249
249
  return only.includes(domain) || only.includes(id);
250
250
  }
251
- function diagnoseConfigLayoutData(home, configPath, allowDeleteLegacyDirs, explicitConfig) {
251
+ async function diagnoseConfigLayoutData(home, configPath, allowDeleteLegacyDirs, explicitConfig) {
252
252
  const findings = [];
253
253
  let rawUnexpanded = null;
254
254
  let parseRecovered = false;
@@ -309,6 +309,8 @@ function diagnoseConfigLayoutData(home, configPath, allowDeleteLegacyDirs, expli
309
309
  findings.push(...checkLayout(home, configPath, rawUnexpanded, allowDeleteLegacyDirs, explicitConfig));
310
310
  const targets = resolveAgentDataTargets(home, rawUnexpanded);
311
311
  findings.push(...detectDataLayer(targets));
312
+ // knowledge 源注册健康(不自动删源)
313
+ findings.push(...(await detectKnowledgeSourcesAsync()));
312
314
  if (configPath) {
313
315
  findings.push(...checkDeprecatedSessionStore(rawUnexpanded, targets, dirname(resolve(configPath))));
314
316
  }
@@ -360,7 +362,7 @@ export async function runDoctor(args, options = {}) {
360
362
  const paths = resolveDoctorPaths(args);
361
363
  const explicitConfig = Boolean(args.config);
362
364
  const fixFindings = [];
363
- let diagnosis = diagnoseConfigLayoutData(paths.home, paths.configPath, Boolean(options.allowDeleteLegacyDirs), explicitConfig);
365
+ let diagnosis = await diagnoseConfigLayoutData(paths.home, paths.configPath, Boolean(options.allowDeleteLegacyDirs), explicitConfig);
364
366
  const backups = paths.configPath && existsSync(paths.configPath) ? listConfigBackups(paths.configPath) : [];
365
367
  if (options.fix && !options.dryRun) {
366
368
  const candidates = groupFixableFindings(diagnosis.findings);
@@ -458,7 +460,7 @@ export async function runDoctor(args, options = {}) {
458
460
  const dataResult = await applyDataLayerFixes(diagnosis.targets, { dryRun: false });
459
461
  fixFindings.push(...dataResult.findings);
460
462
  }
461
- diagnosis = diagnoseConfigLayoutData(paths.home, paths.configPath, Boolean(options.allowDeleteLegacyDirs), explicitConfig);
463
+ diagnosis = await diagnoseConfigLayoutData(paths.home, paths.configPath, Boolean(options.allowDeleteLegacyDirs), explicitConfig);
462
464
  }
463
465
  else if (options.fix && options.dryRun) {
464
466
  const candidates = groupFixableFindings(diagnosis.findings);
@@ -708,4 +710,4 @@ export function listAgentDirs(home) {
708
710
  .sort();
709
711
  }
710
712
  export { listConfigBackups, latestConfigBackup, restoreConfigFromBackup };
711
- export { detectDataLayer, applyDataLayerFixes, resolveAgentDataTargets, checkDeprecatedSessionStore, };
713
+ export { detectDataLayer, applyDataLayerFixes, resolveAgentDataTargets, checkDeprecatedSessionStore, detectKnowledgeDb, detectKnowledgeSourcesAsync, migrateKnowledgeDatabase, knowledgeDbPath, listKnowledgeSources, removeKnowledgeSource, };
@@ -346,7 +346,7 @@ export declare const OctopiConfigSchema: z.ZodObject<{
346
346
  cacheDir: z.ZodOptional<z.ZodNullable<z.ZodString>>;
347
347
  cacheMaxBytes: z.ZodOptional<z.ZodNumber>;
348
348
  timeoutMs: z.ZodOptional<z.ZodNumber>;
349
- allowTextScrape: z.ZodOptional<z.ZodBoolean>;
349
+ maxInputBytes: z.ZodOptional<z.ZodNumber>;
350
350
  }, z.core.$strip>>;
351
351
  markitdown: z.ZodOptional<z.ZodObject<{
352
352
  enabled: z.ZodOptional<z.ZodBoolean>;
@@ -363,6 +363,15 @@ export declare const OctopiConfigSchema: z.ZodObject<{
363
363
  }, z.core.$strip>>;
364
364
  }, z.core.$strip>>;
365
365
  knowledge: z.ZodOptional<z.ZodObject<{
366
+ service: z.ZodOptional<z.ZodObject<{
367
+ baseUrl: z.ZodOptional<z.ZodString>;
368
+ token: z.ZodOptional<z.ZodString>;
369
+ manageLocal: z.ZodOptional<z.ZodBoolean>;
370
+ port: z.ZodOptional<z.ZodNumber>;
371
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
372
+ connectTimeoutMs: z.ZodOptional<z.ZodNumber>;
373
+ }, z.core.$strip>>;
374
+ required: z.ZodOptional<z.ZodBoolean>;
366
375
  recall: z.ZodOptional<z.ZodEnum<{
367
376
  off: "off";
368
377
  hint: "hint";
@@ -398,6 +407,11 @@ export declare const OctopiConfigSchema: z.ZodObject<{
398
407
  index: z.ZodOptional<z.ZodObject<{
399
408
  embedding: z.ZodOptional<z.ZodBoolean>;
400
409
  hybridKeyword: z.ZodOptional<z.ZodBoolean>;
410
+ embedSecretPolicy: z.ZodOptional<z.ZodEnum<{
411
+ allow: "allow";
412
+ redact: "redact";
413
+ skip: "skip";
414
+ }>>;
401
415
  phaseA: z.ZodOptional<z.ZodObject<{
402
416
  concurrency: z.ZodOptional<z.ZodNumber>;
403
417
  debounceMs: z.ZodOptional<z.ZodNumber>;
@@ -410,6 +424,29 @@ export declare const OctopiConfigSchema: z.ZodObject<{
410
424
  queue: z.ZodOptional<z.ZodObject<{
411
425
  maxDepth: z.ZodOptional<z.ZodNumber>;
412
426
  }, z.core.$strip>>;
427
+ files: z.ZodOptional<z.ZodObject<{
428
+ oversize: z.ZodOptional<z.ZodEnum<{
429
+ skip: "skip";
430
+ partial: "partial";
431
+ }>>;
432
+ maxFileBytes: z.ZodOptional<z.ZodNumber>;
433
+ hardMaxFileBytes: z.ZodOptional<z.ZodNumber>;
434
+ maxBytes: z.ZodOptional<z.ZodObject<{
435
+ text: z.ZodOptional<z.ZodNumber>;
436
+ pdf: z.ZodOptional<z.ZodNumber>;
437
+ officeDoc: z.ZodOptional<z.ZodNumber>;
438
+ sheet: z.ZodOptional<z.ZodNumber>;
439
+ }, z.core.$strip>>;
440
+ partial: z.ZodOptional<z.ZodObject<{
441
+ maxSheets: z.ZodOptional<z.ZodNumber>;
442
+ maxRowsPerSheet: z.ZodOptional<z.ZodNumber>;
443
+ maxPdfPages: z.ZodOptional<z.ZodNumber>;
444
+ maxTextChars: z.ZodOptional<z.ZodNumber>;
445
+ }, z.core.$strip>>;
446
+ parseTimeoutMs: z.ZodOptional<z.ZodNumber>;
447
+ parseTimeoutPerMBMs: z.ZodOptional<z.ZodNumber>;
448
+ maxParseTimeoutMs: z.ZodOptional<z.ZodNumber>;
449
+ }, z.core.$strip>>;
413
450
  }, z.core.$strip>>;
414
451
  load: z.ZodOptional<z.ZodObject<{
415
452
  parseConcurrency: z.ZodOptional<z.ZodNumber>;
@@ -1062,7 +1099,7 @@ export declare const HarnessConfigSchema: z.ZodObject<{
1062
1099
  cacheDir: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1063
1100
  cacheMaxBytes: z.ZodOptional<z.ZodNumber>;
1064
1101
  timeoutMs: z.ZodOptional<z.ZodNumber>;
1065
- allowTextScrape: z.ZodOptional<z.ZodBoolean>;
1102
+ maxInputBytes: z.ZodOptional<z.ZodNumber>;
1066
1103
  }, z.core.$strip>>;
1067
1104
  markitdown: z.ZodOptional<z.ZodObject<{
1068
1105
  enabled: z.ZodOptional<z.ZodBoolean>;
@@ -1079,6 +1116,15 @@ export declare const HarnessConfigSchema: z.ZodObject<{
1079
1116
  }, z.core.$strip>>;
1080
1117
  }, z.core.$strip>>;
1081
1118
  knowledge: z.ZodOptional<z.ZodObject<{
1119
+ service: z.ZodOptional<z.ZodObject<{
1120
+ baseUrl: z.ZodOptional<z.ZodString>;
1121
+ token: z.ZodOptional<z.ZodString>;
1122
+ manageLocal: z.ZodOptional<z.ZodBoolean>;
1123
+ port: z.ZodOptional<z.ZodNumber>;
1124
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
1125
+ connectTimeoutMs: z.ZodOptional<z.ZodNumber>;
1126
+ }, z.core.$strip>>;
1127
+ required: z.ZodOptional<z.ZodBoolean>;
1082
1128
  recall: z.ZodOptional<z.ZodEnum<{
1083
1129
  off: "off";
1084
1130
  hint: "hint";
@@ -1114,6 +1160,11 @@ export declare const HarnessConfigSchema: z.ZodObject<{
1114
1160
  index: z.ZodOptional<z.ZodObject<{
1115
1161
  embedding: z.ZodOptional<z.ZodBoolean>;
1116
1162
  hybridKeyword: z.ZodOptional<z.ZodBoolean>;
1163
+ embedSecretPolicy: z.ZodOptional<z.ZodEnum<{
1164
+ allow: "allow";
1165
+ redact: "redact";
1166
+ skip: "skip";
1167
+ }>>;
1117
1168
  phaseA: z.ZodOptional<z.ZodObject<{
1118
1169
  concurrency: z.ZodOptional<z.ZodNumber>;
1119
1170
  debounceMs: z.ZodOptional<z.ZodNumber>;
@@ -1126,6 +1177,29 @@ export declare const HarnessConfigSchema: z.ZodObject<{
1126
1177
  queue: z.ZodOptional<z.ZodObject<{
1127
1178
  maxDepth: z.ZodOptional<z.ZodNumber>;
1128
1179
  }, z.core.$strip>>;
1180
+ files: z.ZodOptional<z.ZodObject<{
1181
+ oversize: z.ZodOptional<z.ZodEnum<{
1182
+ skip: "skip";
1183
+ partial: "partial";
1184
+ }>>;
1185
+ maxFileBytes: z.ZodOptional<z.ZodNumber>;
1186
+ hardMaxFileBytes: z.ZodOptional<z.ZodNumber>;
1187
+ maxBytes: z.ZodOptional<z.ZodObject<{
1188
+ text: z.ZodOptional<z.ZodNumber>;
1189
+ pdf: z.ZodOptional<z.ZodNumber>;
1190
+ officeDoc: z.ZodOptional<z.ZodNumber>;
1191
+ sheet: z.ZodOptional<z.ZodNumber>;
1192
+ }, z.core.$strip>>;
1193
+ partial: z.ZodOptional<z.ZodObject<{
1194
+ maxSheets: z.ZodOptional<z.ZodNumber>;
1195
+ maxRowsPerSheet: z.ZodOptional<z.ZodNumber>;
1196
+ maxPdfPages: z.ZodOptional<z.ZodNumber>;
1197
+ maxTextChars: z.ZodOptional<z.ZodNumber>;
1198
+ }, z.core.$strip>>;
1199
+ parseTimeoutMs: z.ZodOptional<z.ZodNumber>;
1200
+ parseTimeoutPerMBMs: z.ZodOptional<z.ZodNumber>;
1201
+ maxParseTimeoutMs: z.ZodOptional<z.ZodNumber>;
1202
+ }, z.core.$strip>>;
1129
1203
  }, z.core.$strip>>;
1130
1204
  load: z.ZodOptional<z.ZodObject<{
1131
1205
  parseConcurrency: z.ZodOptional<z.ZodNumber>;
@@ -143,6 +143,11 @@
143
143
 
144
144
  "knowledge": {
145
145
  "recall": "hybrid",
146
+ "required": false,
147
+ "service": {
148
+ "manageLocal": true,
149
+ "port": 18280
150
+ },
146
151
  "autoInject": {
147
152
  "minScore": 0.78,
148
153
  "maxChunks": 4,
@@ -159,6 +164,29 @@
159
164
  "includePriorUserTurns": 1,
160
165
  "skipIfUserTokensBelow": 8
161
166
  },
167
+ "index": {
168
+ "embedSecretPolicy": "redact",
169
+ "files": {
170
+ "oversize": "partial",
171
+ "maxFileBytes": 50000000,
172
+ "hardMaxFileBytes": 268435456,
173
+ "maxBytes": {
174
+ "text": 20000000,
175
+ "pdf": 50000000,
176
+ "officeDoc": 200000000,
177
+ "sheet": 50000000
178
+ },
179
+ "partial": {
180
+ "maxSheets": 20,
181
+ "maxRowsPerSheet": 5000,
182
+ "maxPdfPages": 200,
183
+ "maxTextChars": 2000000
184
+ },
185
+ "parseTimeoutMs": 45000,
186
+ "parseTimeoutPerMBMs": 5000,
187
+ "maxParseTimeoutMs": 300000
188
+ }
189
+ },
162
190
  "promotion": {
163
191
  "metrics": { "minSessions": 3, "minHits": 10 }
164
192
  },
@@ -1084,8 +1084,10 @@
1084
1084
  "exclusiveMinimum": 0,
1085
1085
  "maximum": 9007199254740991
1086
1086
  },
1087
- "allowTextScrape": {
1088
- "type": "boolean"
1087
+ "maxInputBytes": {
1088
+ "type": "integer",
1089
+ "exclusiveMinimum": 0,
1090
+ "maximum": 9007199254740991
1089
1091
  }
1090
1092
  }
1091
1093
  },
@@ -1157,6 +1159,38 @@
1157
1159
  "knowledge": {
1158
1160
  "type": "object",
1159
1161
  "properties": {
1162
+ "service": {
1163
+ "type": "object",
1164
+ "properties": {
1165
+ "baseUrl": {
1166
+ "type": "string"
1167
+ },
1168
+ "token": {
1169
+ "type": "string"
1170
+ },
1171
+ "manageLocal": {
1172
+ "type": "boolean"
1173
+ },
1174
+ "port": {
1175
+ "type": "integer",
1176
+ "exclusiveMinimum": 0,
1177
+ "maximum": 65535
1178
+ },
1179
+ "timeoutMs": {
1180
+ "type": "integer",
1181
+ "exclusiveMinimum": 0,
1182
+ "maximum": 9007199254740991
1183
+ },
1184
+ "connectTimeoutMs": {
1185
+ "type": "integer",
1186
+ "exclusiveMinimum": 0,
1187
+ "maximum": 9007199254740991
1188
+ }
1189
+ }
1190
+ },
1191
+ "required": {
1192
+ "type": "boolean"
1193
+ },
1160
1194
  "recall": {
1161
1195
  "type": "string",
1162
1196
  "enum": [
@@ -1264,6 +1298,14 @@
1264
1298
  "hybridKeyword": {
1265
1299
  "type": "boolean"
1266
1300
  },
1301
+ "embedSecretPolicy": {
1302
+ "type": "string",
1303
+ "enum": [
1304
+ "allow",
1305
+ "redact",
1306
+ "skip"
1307
+ ]
1308
+ },
1267
1309
  "phaseA": {
1268
1310
  "type": "object",
1269
1311
  "properties": {
@@ -1307,6 +1349,93 @@
1307
1349
  "maximum": 9007199254740991
1308
1350
  }
1309
1351
  }
1352
+ },
1353
+ "files": {
1354
+ "type": "object",
1355
+ "properties": {
1356
+ "oversize": {
1357
+ "type": "string",
1358
+ "enum": [
1359
+ "partial",
1360
+ "skip"
1361
+ ]
1362
+ },
1363
+ "maxFileBytes": {
1364
+ "type": "integer",
1365
+ "exclusiveMinimum": 0,
1366
+ "maximum": 9007199254740991
1367
+ },
1368
+ "hardMaxFileBytes": {
1369
+ "type": "integer",
1370
+ "exclusiveMinimum": 0,
1371
+ "maximum": 9007199254740991
1372
+ },
1373
+ "maxBytes": {
1374
+ "type": "object",
1375
+ "properties": {
1376
+ "text": {
1377
+ "type": "integer",
1378
+ "exclusiveMinimum": 0,
1379
+ "maximum": 9007199254740991
1380
+ },
1381
+ "pdf": {
1382
+ "type": "integer",
1383
+ "exclusiveMinimum": 0,
1384
+ "maximum": 9007199254740991
1385
+ },
1386
+ "officeDoc": {
1387
+ "type": "integer",
1388
+ "exclusiveMinimum": 0,
1389
+ "maximum": 9007199254740991
1390
+ },
1391
+ "sheet": {
1392
+ "type": "integer",
1393
+ "exclusiveMinimum": 0,
1394
+ "maximum": 9007199254740991
1395
+ }
1396
+ }
1397
+ },
1398
+ "partial": {
1399
+ "type": "object",
1400
+ "properties": {
1401
+ "maxSheets": {
1402
+ "type": "integer",
1403
+ "exclusiveMinimum": 0,
1404
+ "maximum": 9007199254740991
1405
+ },
1406
+ "maxRowsPerSheet": {
1407
+ "type": "integer",
1408
+ "exclusiveMinimum": 0,
1409
+ "maximum": 9007199254740991
1410
+ },
1411
+ "maxPdfPages": {
1412
+ "type": "integer",
1413
+ "exclusiveMinimum": 0,
1414
+ "maximum": 9007199254740991
1415
+ },
1416
+ "maxTextChars": {
1417
+ "type": "integer",
1418
+ "exclusiveMinimum": 0,
1419
+ "maximum": 9007199254740991
1420
+ }
1421
+ }
1422
+ },
1423
+ "parseTimeoutMs": {
1424
+ "type": "integer",
1425
+ "exclusiveMinimum": 0,
1426
+ "maximum": 9007199254740991
1427
+ },
1428
+ "parseTimeoutPerMBMs": {
1429
+ "type": "integer",
1430
+ "minimum": 0,
1431
+ "maximum": 9007199254740991
1432
+ },
1433
+ "maxParseTimeoutMs": {
1434
+ "type": "integer",
1435
+ "exclusiveMinimum": 0,
1436
+ "maximum": 9007199254740991
1437
+ }
1438
+ }
1310
1439
  }
1311
1440
  }
1312
1441
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "octopi-agent",
3
- "version": "0.58.0",
3
+ "version": "0.65.0",
4
4
  "description": "Octopi suite — CLI (bin: octopi), config IO, and dependency umbrella for core/engine/gateway/webui",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -20,7 +20,7 @@
20
20
  },
21
21
  "scripts": {
22
22
  "clean": "node scripts/clean-dist.mjs",
23
- "build": "npm run clean && npm run build:core && npm run build:engine && npm run build:gateway && tsc && node scripts/copy-build-assets.mjs && node scripts/generate-octopi-schema.mjs",
23
+ "build": "npm run clean && npm run build:core && npm run build:engine && npm run build:gateway && npm run build:web && tsc && node scripts/copy-build-assets.mjs && node scripts/generate-octopi-schema.mjs",
24
24
  "build:core": "npm --prefix packages/core run build",
25
25
  "build:engine": "npm --prefix packages/engine run build",
26
26
  "build:gateway": "npm --prefix packages/gateway run build",
@@ -64,10 +64,10 @@
64
64
  "dependencies": {
65
65
  "@earendil-works/pi-tui": "^0.78.0",
66
66
  "@modelcontextprotocol/sdk": "^1.29.0",
67
- "@octopi-agent/core": "0.58.0",
68
- "@octopi-agent/engine": "0.58.0",
69
- "@octopi-agent/gateway": "0.58.0",
70
- "@octopi-agent/webui": "0.58.0",
67
+ "@octopi-agent/core": "0.65.0",
68
+ "@octopi-agent/engine": "0.65.0",
69
+ "@octopi-agent/gateway": "0.65.0",
70
+ "@octopi-agent/webui": "0.65.0",
71
71
  "@types/ws": "^8.18.1",
72
72
  "chalk": "^5.6.2",
73
73
  "js-yaml": "^4.3.2",