2026-05-10 23:51:24 +02:00
|
|
|
import type { GitService, KtxFileStorePort } from '../core/index.js';
|
2026-05-10 23:12:26 +02:00
|
|
|
import type { SemanticLayerService } from '../sl/index.js';
|
|
|
|
|
import type { KnowledgeWikiService } from '../wiki/index.js';
|
|
|
|
|
import type { TouchedSlSourceSet } from './touched-sl-sources.js';
|
|
|
|
|
|
|
|
|
|
export interface IngestToolMetadata {
|
|
|
|
|
runId: string;
|
|
|
|
|
jobId: string;
|
|
|
|
|
syncId: string;
|
|
|
|
|
sourceKey: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface MemoryAction {
|
|
|
|
|
target: 'wiki' | 'sl';
|
|
|
|
|
type: 'created' | 'updated' | 'removed';
|
|
|
|
|
key: string;
|
|
|
|
|
detail: string;
|
|
|
|
|
targetConnectionId?: string | null;
|
2026-05-12 16:56:58 -04:00
|
|
|
rawPaths?: string[];
|
2026-05-10 23:12:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
interface EvictionDecisionRecord {
|
|
|
|
|
rawPath: string;
|
|
|
|
|
artifactKind: 'wiki' | 'sl';
|
|
|
|
|
artifactKey: string;
|
2026-05-13 15:55:00 +02:00
|
|
|
action: 'removed';
|
2026-05-10 23:12:26 +02:00
|
|
|
reason: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Per-WU (or per-memory-agent) state threaded through ToolContext. When present,
|
|
|
|
|
* SL/wiki tools read session-scoped services and emit touched-set entries / actions
|
|
|
|
|
* instead of hitting shared services. When absent, tools behave as they do for
|
|
|
|
|
* interactive research/workshop callers.
|
|
|
|
|
*/
|
|
|
|
|
export interface ToolSession {
|
|
|
|
|
/**
|
|
|
|
|
* Warehouse connection targeted by SL tools. `null` when the session has no
|
|
|
|
|
* warehouse connection (wiki-only memory-agent turns) — SL tools must guard
|
|
|
|
|
* for this and return a structured error rather than execute against a
|
|
|
|
|
* blank connection.
|
|
|
|
|
*/
|
|
|
|
|
connectionId: string | null;
|
|
|
|
|
/** When true, worktree-scoped service writes bypass DB index updates. */
|
|
|
|
|
isWorktreeScoped: boolean;
|
|
|
|
|
preHead: string | null;
|
|
|
|
|
touchedSlSources: TouchedSlSourceSet;
|
|
|
|
|
actions: MemoryAction[];
|
2026-05-12 16:56:58 -04:00
|
|
|
allowedRawPaths?: ReadonlySet<string>;
|
2026-05-13 13:43:23 +02:00
|
|
|
allowedConnectionNames?: ReadonlySet<string>;
|
2026-05-10 23:12:26 +02:00
|
|
|
semanticLayerService: SemanticLayerService;
|
|
|
|
|
wikiService: KnowledgeWikiService;
|
2026-05-10 23:51:24 +02:00
|
|
|
configService: KtxFileStorePort;
|
2026-05-10 23:12:26 +02:00
|
|
|
gitService: GitService;
|
|
|
|
|
ingest?: IngestToolMetadata;
|
|
|
|
|
evictionDecisions?: EvictionDecisionRecord[];
|
|
|
|
|
}
|