@fenixforce/kernel 0.1.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/dist/agent/execution-result.d.ts +27 -0
- package/dist/agent-loop.d.ts +55 -0
- package/dist/api/dashboard.d.ts +260 -0
- package/dist/api/index.d.ts +9 -0
- package/dist/api/middleware.d.ts +46 -0
- package/dist/api/openai-compat.d.ts +163 -0
- package/dist/api/server.d.ts +44 -0
- package/dist/api/streaming.d.ts +15 -0
- package/dist/api/webhook-triggers.d.ts +139 -0
- package/dist/billing/cost-meter.d.ts +123 -0
- package/dist/billing/index.d.ts +2 -0
- package/dist/boot.d.ts +109 -0
- package/dist/channels/discord.d.ts +99 -0
- package/dist/channels/email.d.ts +88 -0
- package/dist/channels/http-api.d.ts +155 -0
- package/dist/channels/index.d.ts +20 -0
- package/dist/channels/mcp-channel.d.ts +75 -0
- package/dist/channels/mobile-hil.d.ts +88 -0
- package/dist/channels/openai-compat.d.ts +42 -0
- package/dist/channels/registry.d.ts +80 -0
- package/dist/channels/signal.d.ts +75 -0
- package/dist/channels/slack.d.ts +115 -0
- package/dist/channels/teams.d.ts +106 -0
- package/dist/channels/telegram.d.ts +164 -0
- package/dist/channels/types.d.ts +71 -0
- package/dist/channels/whatsapp.d.ts +83 -0
- package/dist/checkpoint.d.ts +77 -0
- package/dist/config/canary.d.ts +74 -0
- package/dist/config/constitution.d.ts +57 -0
- package/dist/config/defaults.d.ts +17 -0
- package/dist/config/index.d.ts +8 -0
- package/dist/config/loader.d.ts +11 -0
- package/dist/config/provider-config.d.ts +29 -0
- package/dist/config/schema.d.ts +118 -0
- package/dist/config/steering-rules.d.ts +28 -0
- package/dist/content/chunker.d.ts +42 -0
- package/dist/content/entity-extractor.d.ts +58 -0
- package/dist/content/index.d.ts +8 -0
- package/dist/content/ocr.d.ts +79 -0
- package/dist/content/pipeline.d.ts +153 -0
- package/dist/context-overflow.d.ts +19 -0
- package/dist/editions/mobile.d.ts +12 -0
- package/dist/editions/pro.d.ts +12 -0
- package/dist/editions/voices.d.ts +14 -0
- package/dist/events/block-manager.d.ts +37 -0
- package/dist/events/bus.d.ts +39 -0
- package/dist/events/index.d.ts +8 -0
- package/dist/events/session-manager.d.ts +59 -0
- package/dist/events/stream-adapter.d.ts +24 -0
- package/dist/events/types.d.ts +465 -0
- package/dist/events/websocket.d.ts +34 -0
- package/dist/extensions/defaults/05-session-repair.d.ts +6 -0
- package/dist/extensions/defaults/10-logging.d.ts +6 -0
- package/dist/extensions/defaults/15-loop-guard.d.ts +6 -0
- package/dist/extensions/defaults/20-cost-tracking.d.ts +7 -0
- package/dist/extensions/defaults/25-ssrf-protection.d.ts +6 -0
- package/dist/extensions/defaults/30-rate-limiting.d.ts +6 -0
- package/dist/extensions/defaults/35-shell-bleed.d.ts +6 -0
- package/dist/extensions/defaults/40-observation-capture.d.ts +7 -0
- package/dist/extensions/defaults/45-context-survival.d.ts +6 -0
- package/dist/extensions/defaults/50-context-budget.d.ts +6 -0
- package/dist/extensions/defaults/55-steering-rules.d.ts +7 -0
- package/dist/extensions/defaults/60-quality-gates.d.ts +7 -0
- package/dist/extensions/defaults/65-job-dispatch.d.ts +24 -0
- package/dist/extensions/defaults/70-skill-loader.d.ts +18 -0
- package/dist/extensions/hooks.d.ts +74 -0
- package/dist/extensions/index.d.ts +21 -0
- package/dist/extensions/intervention.d.ts +59 -0
- package/dist/extensions/manager.d.ts +63 -0
- package/dist/extensions/runner.d.ts +63 -0
- package/dist/hooks/hook-manager.d.ts +39 -0
- package/dist/hooks/hook-types.d.ts +60 -0
- package/dist/identity/assembler.d.ts +45 -0
- package/dist/identity/ccc-adapter.d.ts +33 -0
- package/dist/identity/index.d.ts +6 -0
- package/dist/identity/persona-parser.d.ts +24 -0
- package/dist/identity/soul-parser.d.ts +23 -0
- package/dist/identity/user-populator.d.ts +20 -0
- package/dist/index.d.ts +227 -0
- package/dist/index.js +579 -0
- package/dist/interrupt.d.ts +84 -0
- package/dist/job-queue.d.ts +69 -0
- package/dist/jobs/index.d.ts +12 -0
- package/dist/jobs/memory-queue.d.ts +23 -0
- package/dist/jobs/planned-tasks.d.ts +121 -0
- package/dist/jobs/queue.d.ts +79 -0
- package/dist/jobs/router.d.ts +23 -0
- package/dist/jobs/synthesize-memories.d.ts +26 -0
- package/dist/jobs/types.d.ts +47 -0
- package/dist/jobs/worker-pool.d.ts +25 -0
- package/dist/jobs/worker.d.ts +40 -0
- package/dist/loop/autonomous-controller.d.ts +91 -0
- package/dist/loop/backpressure.d.ts +64 -0
- package/dist/loop/fresh-context.d.ts +48 -0
- package/dist/loop/prd-importer.d.ts +134 -0
- package/dist/loop/stop-controller.d.ts +31 -0
- package/dist/loop-guard.d.ts +32 -0
- package/dist/mcp/tool-executor.d.ts +57 -0
- package/dist/memory/brain-artifacts.d.ts +25 -0
- package/dist/memory/dual-search.d.ts +67 -0
- package/dist/memory/episodic.d.ts +45 -0
- package/dist/memory/index.d.ts +27 -0
- package/dist/memory/knowledge-graph.d.ts +89 -0
- package/dist/memory/markdown-store.d.ts +64 -0
- package/dist/memory/metadata-filter.d.ts +29 -0
- package/dist/memory/mid-conversation-saves.d.ts +17 -0
- package/dist/memory/note-parser.d.ts +34 -0
- package/dist/memory/observation-store.d.ts +36 -0
- package/dist/memory/observation-thresholds.d.ts +26 -0
- package/dist/memory/progressive-search.d.ts +25 -0
- package/dist/memory/synthesis.d.ts +36 -0
- package/dist/memory/tree-index.d.ts +104 -0
- package/dist/memory/write-gate.d.ts +63 -0
- package/dist/mission-control.d.ts +34 -0
- package/dist/pre-classifier-widgets.d.ts +40 -0
- package/dist/pre-classifier.d.ts +19 -0
- package/dist/prompt/context-budget.d.ts +68 -0
- package/dist/prompt/index.d.ts +3 -0
- package/dist/prompt/system-prompt.d.ts +32 -0
- package/dist/prompt/templates.d.ts +11 -0
- package/dist/providers/anthropic.d.ts +24 -0
- package/dist/providers/auto-detect.d.ts +16 -0
- package/dist/providers/auto-discover.d.ts +28 -0
- package/dist/providers/bedrock.d.ts +38 -0
- package/dist/providers/cache-strategy.d.ts +58 -0
- package/dist/providers/circuit-breaker.d.ts +33 -0
- package/dist/providers/cost-meter.d.ts +74 -0
- package/dist/providers/cost-tracking.d.ts +36 -0
- package/dist/providers/google.d.ts +35 -0
- package/dist/providers/index.d.ts +32 -0
- package/dist/providers/interface.d.ts +98 -0
- package/dist/providers/json-repair.d.ts +10 -0
- package/dist/providers/key-rotation.d.ts +36 -0
- package/dist/providers/manager.d.ts +64 -0
- package/dist/providers/model-registry.d.ts +50 -0
- package/dist/providers/openai-compatible.d.ts +26 -0
- package/dist/providers/optimization-modes.d.ts +38 -0
- package/dist/providers/provider-manager.d.ts +71 -0
- package/dist/providers/runtime-crud.d.ts +68 -0
- package/dist/providers/sidecar-lifecycle.d.ts +40 -0
- package/dist/providers/stream-wrapper.d.ts +21 -0
- package/dist/providers/structured-verify.d.ts +31 -0
- package/dist/providers/versioning.d.ts +18 -0
- package/dist/quality-gates.d.ts +10 -0
- package/dist/scheduler/engine.d.ts +95 -0
- package/dist/scheduler/index.d.ts +4 -0
- package/dist/scheduler/webhook-handler.d.ts +37 -0
- package/dist/sdk/agent.d.ts +22 -0
- package/dist/sdk/cli.d.ts +2 -0
- package/dist/sdk/client.d.ts +19 -0
- package/dist/sdk/index.d.ts +24 -0
- package/dist/sdk/jobs.d.ts +25 -0
- package/dist/sdk/memory.d.ts +18 -0
- package/dist/sdk/types.d.ts +69 -0
- package/dist/security/approval-gates.d.ts +166 -0
- package/dist/security/content-wrapper.d.ts +38 -0
- package/dist/security/guard-rails.d.ts +6 -0
- package/dist/security/index.d.ts +21 -0
- package/dist/security/instruction-hierarchy.d.ts +109 -0
- package/dist/security/pii-tokenizer.d.ts +30 -0
- package/dist/security/reputation.d.ts +53 -0
- package/dist/security/secret-store.d.ts +41 -0
- package/dist/security/security-engine.d.ts +53 -0
- package/dist/security/shell-bleed.d.ts +15 -0
- package/dist/security/ssrf.d.ts +12 -0
- package/dist/security/taint-tracker.d.ts +63 -0
- package/dist/security/tool-access-control.d.ts +114 -0
- package/dist/session-compaction.d.ts +20 -0
- package/dist/session-orient.d.ts +22 -0
- package/dist/session-repair.d.ts +6 -0
- package/dist/storage/index.d.ts +24 -0
- package/dist/storage/interface.d.ts +245 -0
- package/dist/storage/postgres.d.ts +6 -0
- package/dist/storage/sqlite.d.ts +2 -0
- package/dist/streaming/reasoning.d.ts +67 -0
- package/dist/task-tracker.d.ts +26 -0
- package/dist/testing/action-cache.d.ts +39 -0
- package/dist/testing/incident-eval.d.ts +49 -0
- package/dist/testing/workflow-evals.d.ts +73 -0
- package/dist/tools/access-control.d.ts +60 -0
- package/dist/tools/browser-engine.d.ts +73 -0
- package/dist/tools/builtins/jobs-router.d.ts +7 -0
- package/dist/tools/builtins/tasks-router.d.ts +25 -0
- package/dist/tools/index.d.ts +20 -0
- package/dist/tools/map-reduce.d.ts +64 -0
- package/dist/tools/registry.d.ts +39 -0
- package/dist/tools/router.d.ts +30 -0
- package/dist/tools/routers/browser-router.d.ts +12 -0
- package/dist/tools/routers/code-router.d.ts +34 -0
- package/dist/tools/routers/file-router.d.ts +35 -0
- package/dist/tools/routers/memory-router.d.ts +21 -0
- package/dist/tools/routers/schedule-router.d.ts +31 -0
- package/dist/tools/routers/search-backends.d.ts +47 -0
- package/dist/tools/routers/task-router.d.ts +32 -0
- package/dist/tools/routers/web-router.d.ts +36 -0
- package/dist/tools/skill-discovery.d.ts +32 -0
- package/dist/tools/skill-loader.d.ts +76 -0
- package/dist/tools/skill-types.d.ts +21 -0
- package/dist/voice/audio-intelligence.d.ts +42 -0
- package/dist/voice/barge-in.d.ts +51 -0
- package/dist/voice/index.d.ts +22 -0
- package/dist/voice/marker-parser.d.ts +31 -0
- package/dist/voice/sidecar-manager.d.ts +68 -0
- package/dist/voice/speaker-focus.d.ts +41 -0
- package/dist/voice/speaker-voiceprint.d.ts +47 -0
- package/dist/voice/speech-intent.d.ts +51 -0
- package/dist/voice/speechmatics-stt.d.ts +77 -0
- package/dist/voice/speechmatics-tts.d.ts +39 -0
- package/dist/voice/stt-provider.d.ts +40 -0
- package/dist/voice/transcript.d.ts +19 -0
- package/dist/voice/turn-detection.d.ts +53 -0
- package/dist/wrapup.d.ts +15 -0
- package/package.json +39 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { AutonomousLoopController } from "./autonomous-controller.js";
|
|
2
|
+
import type { EventBus } from "../events/bus.js";
|
|
3
|
+
export interface BackpressureConfig {
|
|
4
|
+
/** Ordered list of quality gate commands */
|
|
5
|
+
commands: BackpressureCommand[];
|
|
6
|
+
/** Stop on first failure (default: false — run all, collect results) */
|
|
7
|
+
failFast: boolean;
|
|
8
|
+
/** Per-command timeout in ms (default: 60000) */
|
|
9
|
+
timeout: number;
|
|
10
|
+
}
|
|
11
|
+
export interface BackpressureCommand {
|
|
12
|
+
/** Human-readable name (e.g. "TypeScript type check") */
|
|
13
|
+
name: string;
|
|
14
|
+
/** Shell command to execute (e.g. "bun test", "tsc --noEmit") */
|
|
15
|
+
command: string;
|
|
16
|
+
/** Blocking failures prevent loop exit; warnings are logged only */
|
|
17
|
+
weight: "blocking" | "warning";
|
|
18
|
+
/** Optional regex to extract failure summary from stdout/stderr */
|
|
19
|
+
parseFailures?: RegExp;
|
|
20
|
+
}
|
|
21
|
+
export interface BackpressureResult {
|
|
22
|
+
passed: boolean;
|
|
23
|
+
commandResults: CommandResult[];
|
|
24
|
+
failurePrefix: string | null;
|
|
25
|
+
}
|
|
26
|
+
export interface CommandResult {
|
|
27
|
+
name: string;
|
|
28
|
+
command: string;
|
|
29
|
+
weight: "blocking" | "warning";
|
|
30
|
+
exitCode: number;
|
|
31
|
+
passed: boolean;
|
|
32
|
+
stdout: string;
|
|
33
|
+
stderr: string;
|
|
34
|
+
failureSummary: string | null;
|
|
35
|
+
durationMs: number;
|
|
36
|
+
}
|
|
37
|
+
export type ShellExecutor = (command: string, opts: {
|
|
38
|
+
timeout: number;
|
|
39
|
+
cwd?: string;
|
|
40
|
+
}) => Promise<{
|
|
41
|
+
exitCode: number;
|
|
42
|
+
stdout: string;
|
|
43
|
+
stderr: string;
|
|
44
|
+
}>;
|
|
45
|
+
export declare class BackpressureValidator {
|
|
46
|
+
private config;
|
|
47
|
+
private execute;
|
|
48
|
+
private controller;
|
|
49
|
+
private eventBus;
|
|
50
|
+
private lastPassed;
|
|
51
|
+
constructor(config: BackpressureConfig, execute: ShellExecutor, opts?: {
|
|
52
|
+
controller?: AutonomousLoopController;
|
|
53
|
+
eventBus?: EventBus;
|
|
54
|
+
});
|
|
55
|
+
/**
|
|
56
|
+
* Run all backpressure commands after a loop iteration.
|
|
57
|
+
* Returns a result with pass/fail and an optional failure prefix
|
|
58
|
+
* to inject into the next iteration's context.
|
|
59
|
+
*/
|
|
60
|
+
validate(cwd?: string): Promise<BackpressureResult>;
|
|
61
|
+
private extractFailures;
|
|
62
|
+
private buildFailurePrefix;
|
|
63
|
+
private emit;
|
|
64
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { IterationContext, IterationResult } from "./autonomous-controller.js";
|
|
2
|
+
export interface FreshContextConfig {
|
|
3
|
+
/** fresh = new context each iteration; persistent = keep conversation */
|
|
4
|
+
mode: "fresh" | "persistent";
|
|
5
|
+
/** Files injected into fresh context each iteration (e.g. AGENTS.md, spec) */
|
|
6
|
+
contextFiles: string[];
|
|
7
|
+
/** Workspace state file read/written each iteration */
|
|
8
|
+
stateFile: string;
|
|
9
|
+
/** System prompt template for fresh iterations */
|
|
10
|
+
systemPrompt?: string;
|
|
11
|
+
}
|
|
12
|
+
export type FileReader = (path: string) => Promise<string>;
|
|
13
|
+
export type FileWriter = (path: string, content: string) => Promise<void>;
|
|
14
|
+
export type GitCommitter = (message: string) => Promise<string | null>;
|
|
15
|
+
export type AgentRunner = (prompt: string, opts: {
|
|
16
|
+
sessionId: string | null;
|
|
17
|
+
systemPrompt: string;
|
|
18
|
+
}) => Promise<AgentIterationOutput>;
|
|
19
|
+
export interface AgentIterationOutput {
|
|
20
|
+
output: string;
|
|
21
|
+
sessionId: string;
|
|
22
|
+
filesChanged: string[];
|
|
23
|
+
newCommits: number;
|
|
24
|
+
testResultsChanged: boolean;
|
|
25
|
+
completionIndicators: string[];
|
|
26
|
+
stateUpdate?: string;
|
|
27
|
+
}
|
|
28
|
+
export declare class FreshContextManager {
|
|
29
|
+
private config;
|
|
30
|
+
private readFile;
|
|
31
|
+
private writeFile;
|
|
32
|
+
private commitChanges;
|
|
33
|
+
private runAgent;
|
|
34
|
+
constructor(config: FreshContextConfig, deps: {
|
|
35
|
+
readFile: FileReader;
|
|
36
|
+
writeFile: FileWriter;
|
|
37
|
+
commitChanges: GitCommitter;
|
|
38
|
+
runAgent: AgentRunner;
|
|
39
|
+
});
|
|
40
|
+
/**
|
|
41
|
+
* Build a runIteration callback for the AutonomousLoopController.
|
|
42
|
+
* In fresh mode, each iteration gets a new context built from files.
|
|
43
|
+
* In persistent mode, session ID is carried forward.
|
|
44
|
+
*/
|
|
45
|
+
createIterationRunner(): (ctx: IterationContext) => Promise<IterationResult>;
|
|
46
|
+
private buildIterationPrompt;
|
|
47
|
+
private safeRead;
|
|
48
|
+
}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import type { LLMProvider } from "../providers/interface.js";
|
|
2
|
+
export type ImportSource = {
|
|
3
|
+
type: "markdown";
|
|
4
|
+
content: string;
|
|
5
|
+
title?: string;
|
|
6
|
+
} | {
|
|
7
|
+
type: "url";
|
|
8
|
+
url: string;
|
|
9
|
+
title?: string;
|
|
10
|
+
} | {
|
|
11
|
+
type: "github-issue";
|
|
12
|
+
owner: string;
|
|
13
|
+
repo: string;
|
|
14
|
+
issue: number;
|
|
15
|
+
} | {
|
|
16
|
+
type: "json-prd";
|
|
17
|
+
data: StructuredPRD;
|
|
18
|
+
};
|
|
19
|
+
export interface StructuredPRD {
|
|
20
|
+
title?: string;
|
|
21
|
+
user_stories?: UserStory[];
|
|
22
|
+
requirements?: Requirement[];
|
|
23
|
+
}
|
|
24
|
+
export interface UserStory {
|
|
25
|
+
id?: string;
|
|
26
|
+
title: string;
|
|
27
|
+
description: string;
|
|
28
|
+
acceptance_criteria?: string[];
|
|
29
|
+
priority?: TaskPriority;
|
|
30
|
+
}
|
|
31
|
+
export interface Requirement {
|
|
32
|
+
id?: string;
|
|
33
|
+
title: string;
|
|
34
|
+
description: string;
|
|
35
|
+
priority?: TaskPriority;
|
|
36
|
+
}
|
|
37
|
+
export type TaskPriority = "critical" | "high" | "medium" | "low";
|
|
38
|
+
export interface ImportedTask {
|
|
39
|
+
id: string;
|
|
40
|
+
title: string;
|
|
41
|
+
description: string;
|
|
42
|
+
acceptanceCriteria: AcceptanceCriterion[];
|
|
43
|
+
priority: TaskPriority;
|
|
44
|
+
dependencies: string[];
|
|
45
|
+
}
|
|
46
|
+
export interface AcceptanceCriterion {
|
|
47
|
+
given: string;
|
|
48
|
+
when: string;
|
|
49
|
+
then: string;
|
|
50
|
+
}
|
|
51
|
+
export interface ImportResult {
|
|
52
|
+
sourceTitle: string;
|
|
53
|
+
tasks: ImportedTask[];
|
|
54
|
+
generatedAt: string;
|
|
55
|
+
appended: boolean;
|
|
56
|
+
}
|
|
57
|
+
export type FileReader = (path: string) => Promise<string>;
|
|
58
|
+
export type FileWriter = (path: string, content: string) => Promise<void>;
|
|
59
|
+
export type UrlFetcher = (url: string) => Promise<string>;
|
|
60
|
+
export declare const TASK_LIST_SCHEMA: {
|
|
61
|
+
readonly type: "object";
|
|
62
|
+
readonly properties: {
|
|
63
|
+
readonly tasks: {
|
|
64
|
+
readonly type: "array";
|
|
65
|
+
readonly items: {
|
|
66
|
+
readonly type: "object";
|
|
67
|
+
readonly properties: {
|
|
68
|
+
readonly id: {
|
|
69
|
+
readonly type: "string";
|
|
70
|
+
readonly description: "Unique task ID (TASK-001 format)";
|
|
71
|
+
};
|
|
72
|
+
readonly title: {
|
|
73
|
+
readonly type: "string";
|
|
74
|
+
readonly description: "Short task title";
|
|
75
|
+
};
|
|
76
|
+
readonly description: {
|
|
77
|
+
readonly type: "string";
|
|
78
|
+
readonly description: "Detailed description";
|
|
79
|
+
};
|
|
80
|
+
readonly acceptanceCriteria: {
|
|
81
|
+
readonly type: "array";
|
|
82
|
+
readonly items: {
|
|
83
|
+
readonly type: "object";
|
|
84
|
+
readonly properties: {
|
|
85
|
+
readonly given: {
|
|
86
|
+
readonly type: "string";
|
|
87
|
+
};
|
|
88
|
+
readonly when: {
|
|
89
|
+
readonly type: "string";
|
|
90
|
+
};
|
|
91
|
+
readonly then: {
|
|
92
|
+
readonly type: "string";
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
readonly required: readonly ["given", "when", "then"];
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
readonly priority: {
|
|
99
|
+
readonly type: "string";
|
|
100
|
+
readonly enum: readonly ["critical", "high", "medium", "low"];
|
|
101
|
+
};
|
|
102
|
+
readonly dependencies: {
|
|
103
|
+
readonly type: "array";
|
|
104
|
+
readonly items: {
|
|
105
|
+
readonly type: "string";
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
readonly required: readonly ["id", "title", "description", "acceptanceCriteria", "priority", "dependencies"];
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
readonly required: readonly ["tasks"];
|
|
114
|
+
};
|
|
115
|
+
export declare class PRDImporter {
|
|
116
|
+
private provider;
|
|
117
|
+
private readFile;
|
|
118
|
+
private writeFile;
|
|
119
|
+
private fetchUrl;
|
|
120
|
+
constructor(provider: LLMProvider, deps: {
|
|
121
|
+
readFile: FileReader;
|
|
122
|
+
writeFile: FileWriter;
|
|
123
|
+
fetchUrl: UrlFetcher;
|
|
124
|
+
});
|
|
125
|
+
/**
|
|
126
|
+
* Import a source document and generate/append tasks to IMPLEMENTATION_PLAN.md.
|
|
127
|
+
*/
|
|
128
|
+
import(source: ImportSource, planPath: string): Promise<ImportResult>;
|
|
129
|
+
private resolveSource;
|
|
130
|
+
private extractTasks;
|
|
131
|
+
private parseStructuredPRD;
|
|
132
|
+
private parseExistingTaskIds;
|
|
133
|
+
private safeRead;
|
|
134
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export declare class StopController {
|
|
2
|
+
private controller;
|
|
3
|
+
private reason;
|
|
4
|
+
private cleanupHandlers;
|
|
5
|
+
constructor();
|
|
6
|
+
/** Signal stop from any context. */
|
|
7
|
+
stop(reason?: string): void;
|
|
8
|
+
/** Check before starting a new iteration. */
|
|
9
|
+
get stopRequested(): boolean;
|
|
10
|
+
/** The reason passed to stop(), if any. */
|
|
11
|
+
get stopReason(): string | undefined;
|
|
12
|
+
/** Pass to fetch/async operations for automatic cancellation. */
|
|
13
|
+
get abortSignal(): AbortSignal;
|
|
14
|
+
/** Register a cleanup handler that runs when stop is signaled. */
|
|
15
|
+
onStop(handler: () => void): () => void;
|
|
16
|
+
/** Reset for a new run (creates fresh AbortController). */
|
|
17
|
+
reset(): void;
|
|
18
|
+
/**
|
|
19
|
+
* Create a child StopController that stops when the parent stops.
|
|
20
|
+
* Useful for per-worker controllers in FleetCoordinator.
|
|
21
|
+
*/
|
|
22
|
+
child(): StopController;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Create a fleet-wide stop controller that propagates to all workers.
|
|
26
|
+
* Returns the parent controller and a factory for worker controllers.
|
|
27
|
+
*/
|
|
28
|
+
export declare function createFleetStopController(): {
|
|
29
|
+
controller: StopController;
|
|
30
|
+
createWorkerController: () => StopController;
|
|
31
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Loop guard — SHA256-based tool call tracking that detects stuck patterns.
|
|
3
|
+
*/
|
|
4
|
+
import type { ToolCall } from "./events/types.js";
|
|
5
|
+
export interface LoopGuardResult {
|
|
6
|
+
blocked: boolean;
|
|
7
|
+
warning: boolean;
|
|
8
|
+
reason?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare class LoopGuard {
|
|
11
|
+
private maxTotal;
|
|
12
|
+
private history;
|
|
13
|
+
private callCounts;
|
|
14
|
+
private pairCounts;
|
|
15
|
+
constructor(maxTotal?: number);
|
|
16
|
+
/**
|
|
17
|
+
* Check a batch of tool calls. Call this before executing each tool batch.
|
|
18
|
+
* Optionally provide the result content for outcome-aware detection
|
|
19
|
+
* via recordResult() after the tool executes.
|
|
20
|
+
*/
|
|
21
|
+
check(toolCalls: ToolCall[]): LoopGuardResult;
|
|
22
|
+
/**
|
|
23
|
+
* Record the result of a tool call for outcome-aware detection.
|
|
24
|
+
* Call after the tool executes with the same ToolCall and the result string.
|
|
25
|
+
*/
|
|
26
|
+
recordResult(call: ToolCall, resultContent: string): LoopGuardResult;
|
|
27
|
+
/** Reset all state (e.g. between conversations). */
|
|
28
|
+
reset(): void;
|
|
29
|
+
/** Current total call count. */
|
|
30
|
+
totalCalls(): number;
|
|
31
|
+
private detectPingPong;
|
|
32
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export interface HeartbeatConfig {
|
|
2
|
+
enabled: boolean;
|
|
3
|
+
/** Heartbeat interval in ms. Default: 15000. */
|
|
4
|
+
intervalMs: number;
|
|
5
|
+
/** Execution timeout in ms. Default: 1800000 (30 min). */
|
|
6
|
+
timeoutMs: number;
|
|
7
|
+
}
|
|
8
|
+
export declare const DEFAULT_HEARTBEAT_CONFIG: HeartbeatConfig;
|
|
9
|
+
export interface MCPProgressNotification {
|
|
10
|
+
method: "notifications/progress";
|
|
11
|
+
params: {
|
|
12
|
+
progressToken: string;
|
|
13
|
+
progress: number;
|
|
14
|
+
total: number;
|
|
15
|
+
message: string;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export type ProgressCallback = (elapsed: number, count: number) => void;
|
|
19
|
+
/**
|
|
20
|
+
* Wrap a long-running async function with periodic heartbeat signals.
|
|
21
|
+
* The heartbeat fires every `intervalMs` until the function completes,
|
|
22
|
+
* errors, or times out.
|
|
23
|
+
*/
|
|
24
|
+
export declare function withHeartbeat<T>(fn: () => Promise<T>, config: HeartbeatConfig, progressCallback: ProgressCallback): Promise<T>;
|
|
25
|
+
export interface MCPToolCall {
|
|
26
|
+
name: string;
|
|
27
|
+
arguments: Record<string, unknown>;
|
|
28
|
+
progressToken?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface MCPToolResult {
|
|
31
|
+
content: unknown;
|
|
32
|
+
isError?: boolean;
|
|
33
|
+
}
|
|
34
|
+
export type MCPToolHandler = (args: Record<string, unknown>) => Promise<unknown>;
|
|
35
|
+
export type MCPNotificationSender = (notification: MCPProgressNotification) => void;
|
|
36
|
+
export interface MCPToolExecutorConfig {
|
|
37
|
+
heartbeat?: Partial<HeartbeatConfig>;
|
|
38
|
+
notificationSender?: MCPNotificationSender;
|
|
39
|
+
}
|
|
40
|
+
export declare class MCPToolExecutor {
|
|
41
|
+
private handlers;
|
|
42
|
+
private heartbeatConfig;
|
|
43
|
+
private notificationSender?;
|
|
44
|
+
constructor(config?: MCPToolExecutorConfig);
|
|
45
|
+
/** Register a tool handler. */
|
|
46
|
+
register(name: string, handler: MCPToolHandler): void;
|
|
47
|
+
/** Unregister a tool handler. */
|
|
48
|
+
unregister(name: string): void;
|
|
49
|
+
/** Execute a tool call with heartbeat. */
|
|
50
|
+
execute(call: MCPToolCall): Promise<MCPToolResult>;
|
|
51
|
+
/** List registered tool names. */
|
|
52
|
+
listTools(): string[];
|
|
53
|
+
}
|
|
54
|
+
export declare class MCPTimeoutError extends Error {
|
|
55
|
+
readonly timeoutMs: number;
|
|
56
|
+
constructor(timeoutMs: number);
|
|
57
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Brain artifacts — persistent work-state files loaded during session orient.
|
|
3
|
+
*
|
|
4
|
+
* Wraps StorageAdapter's low-level brain-artifact methods with a
|
|
5
|
+
* filename-oriented API and upsert semantics.
|
|
6
|
+
*/
|
|
7
|
+
import type { StorageAdapter, BrainArtifact } from "../storage/interface.js";
|
|
8
|
+
export declare const STANDARD_ARTIFACTS: Record<string, {
|
|
9
|
+
filename: string;
|
|
10
|
+
template: string;
|
|
11
|
+
}>;
|
|
12
|
+
export declare class BrainArtifactManager {
|
|
13
|
+
private storage;
|
|
14
|
+
constructor(storage: StorageAdapter);
|
|
15
|
+
/** Upsert: update existing artifact by filename or insert a new one. */
|
|
16
|
+
save(conversationId: string, userId: string, filename: string, content: string): Promise<BrainArtifact>;
|
|
17
|
+
/** Load all artifacts for a conversation. */
|
|
18
|
+
load(conversationId: string): Promise<BrainArtifact[]>;
|
|
19
|
+
/** Load a single artifact by filename within a conversation. */
|
|
20
|
+
loadByFilename(conversationId: string, filename: string): Promise<BrainArtifact | null>;
|
|
21
|
+
/** Delete an artifact by filename within a conversation. */
|
|
22
|
+
delete(conversationId: string, filename: string): Promise<void>;
|
|
23
|
+
/** List all artifacts belonging to a user across conversations. */
|
|
24
|
+
listForUser(userId: string): Promise<BrainArtifact[]>;
|
|
25
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dual Search Fusion — combines BM25 lexical search with pgvector
|
|
3
|
+
* semantic search via Promise.allSettled, then merges results using
|
|
4
|
+
* Reciprocal Rank Fusion (RRF).
|
|
5
|
+
*
|
|
6
|
+
* Configurable text vs semantic weights. Gracefully degrades if
|
|
7
|
+
* either backend fails (returns results from whichever succeeded).
|
|
8
|
+
*/
|
|
9
|
+
export interface DualSearchResult {
|
|
10
|
+
/** Document identifier. */
|
|
11
|
+
id: string;
|
|
12
|
+
/** Document content/text. */
|
|
13
|
+
content: string;
|
|
14
|
+
/** Fused RRF score. */
|
|
15
|
+
score: number;
|
|
16
|
+
/** Source(s) that contributed this result. */
|
|
17
|
+
sources: Array<"bm25" | "semantic">;
|
|
18
|
+
/** Raw rank from BM25 (undefined if not in BM25 results). */
|
|
19
|
+
bm25Rank?: number;
|
|
20
|
+
/** Raw rank from semantic search (undefined if not in semantic results). */
|
|
21
|
+
semanticRank?: number;
|
|
22
|
+
/** Optional metadata. */
|
|
23
|
+
metadata?: Record<string, unknown>;
|
|
24
|
+
}
|
|
25
|
+
export interface SearchBackendResult {
|
|
26
|
+
id: string;
|
|
27
|
+
content: string;
|
|
28
|
+
score: number;
|
|
29
|
+
metadata?: Record<string, unknown>;
|
|
30
|
+
}
|
|
31
|
+
/** BM25/lexical search function. */
|
|
32
|
+
export type BM25SearchFn = (query: string, limit: number) => Promise<SearchBackendResult[]>;
|
|
33
|
+
/** Semantic/vector search function. */
|
|
34
|
+
export type SemanticSearchFn = (query: string, limit: number) => Promise<SearchBackendResult[]>;
|
|
35
|
+
export interface DualSearchConfig {
|
|
36
|
+
/** BM25 / full-text search backend. */
|
|
37
|
+
bm25: BM25SearchFn;
|
|
38
|
+
/** Semantic / vector search backend. */
|
|
39
|
+
semantic: SemanticSearchFn;
|
|
40
|
+
/** Weight for BM25 results in RRF. Default 1.0. */
|
|
41
|
+
bm25Weight?: number;
|
|
42
|
+
/** Weight for semantic results in RRF. Default 1.0. */
|
|
43
|
+
semanticWeight?: number;
|
|
44
|
+
/** RRF constant k. Default 60. */
|
|
45
|
+
rrfK?: number;
|
|
46
|
+
/** Maximum results to return. Default 10. */
|
|
47
|
+
maxResults?: number;
|
|
48
|
+
/** Maximum results to fetch from each backend. Default 20. */
|
|
49
|
+
fetchLimit?: number;
|
|
50
|
+
}
|
|
51
|
+
export type DualSearchEventType = "search_start" | "bm25_done" | "bm25_error" | "semantic_done" | "semantic_error" | "fusion_done";
|
|
52
|
+
export interface DualSearchEvent {
|
|
53
|
+
type: DualSearchEventType;
|
|
54
|
+
timestamp: Date;
|
|
55
|
+
detail: string;
|
|
56
|
+
}
|
|
57
|
+
export type DualSearchEventListener = (event: DualSearchEvent) => void;
|
|
58
|
+
export interface DualSearch {
|
|
59
|
+
/** Run dual search with RRF fusion. */
|
|
60
|
+
search(query: string, opts?: {
|
|
61
|
+
maxResults?: number;
|
|
62
|
+
}): Promise<DualSearchResult[]>;
|
|
63
|
+
/** Events. */
|
|
64
|
+
on(listener: DualSearchEventListener): void;
|
|
65
|
+
off(listener: DualSearchEventListener): void;
|
|
66
|
+
}
|
|
67
|
+
export declare function createDualSearch(config: DualSearchConfig): DualSearch;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { StorageAdapter } from "../storage/interface.js";
|
|
2
|
+
export interface EpisodicRecord {
|
|
3
|
+
id: string;
|
|
4
|
+
userId: string;
|
|
5
|
+
conversationId: string;
|
|
6
|
+
/** High-level scope tag: "deploy", "refactor", "debug", etc. */
|
|
7
|
+
taskScope: string;
|
|
8
|
+
/** What was decided */
|
|
9
|
+
decision: string;
|
|
10
|
+
/** Why this path was chosen */
|
|
11
|
+
rationale: string;
|
|
12
|
+
/** What happened as a result */
|
|
13
|
+
outcome: "success" | "partial" | "failure" | "pending";
|
|
14
|
+
/** Embedding vector for similarity retrieval */
|
|
15
|
+
embedding: number[] | null;
|
|
16
|
+
/** Decays over time — controls retrieval priority */
|
|
17
|
+
relevanceScore: number;
|
|
18
|
+
createdAt: Date;
|
|
19
|
+
}
|
|
20
|
+
export interface EpisodicWriteInput {
|
|
21
|
+
userId: string;
|
|
22
|
+
conversationId: string;
|
|
23
|
+
taskScope: string;
|
|
24
|
+
decision: string;
|
|
25
|
+
rationale: string;
|
|
26
|
+
outcome: EpisodicRecord["outcome"];
|
|
27
|
+
embedding?: number[];
|
|
28
|
+
}
|
|
29
|
+
export interface EpisodicRetrievalOpts {
|
|
30
|
+
userId: string;
|
|
31
|
+
queryEmbedding: number[];
|
|
32
|
+
taskScope?: string;
|
|
33
|
+
limit?: number;
|
|
34
|
+
minRelevance?: number;
|
|
35
|
+
}
|
|
36
|
+
export interface EpisodicSearchResult {
|
|
37
|
+
record: EpisodicRecord;
|
|
38
|
+
similarity: number;
|
|
39
|
+
}
|
|
40
|
+
export declare const EPISODIC_SCHEMA = "\nCREATE TABLE IF NOT EXISTS episodic_records (\n id TEXT PRIMARY KEY,\n user_id TEXT NOT NULL,\n conversation_id TEXT NOT NULL,\n task_scope TEXT NOT NULL,\n decision TEXT NOT NULL,\n rationale TEXT NOT NULL,\n outcome TEXT NOT NULL DEFAULT 'pending',\n embedding vector(1536),\n relevance_score REAL NOT NULL DEFAULT 1.0,\n created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()\n);\n\nCREATE INDEX IF NOT EXISTS idx_episodic_user\n ON episodic_records (user_id, task_scope);\nCREATE INDEX IF NOT EXISTS idx_episodic_embedding\n ON episodic_records USING ivfflat (embedding vector_cosine_ops)\n WITH (lists = 50);\n";
|
|
41
|
+
export declare function writeEpisodicRecord(storage: StorageAdapter, input: EpisodicWriteInput): Promise<EpisodicRecord>;
|
|
42
|
+
export declare function retrieveEpisodicRecords(storage: StorageAdapter, opts: EpisodicRetrievalOpts): Promise<EpisodicSearchResult[]>;
|
|
43
|
+
/** Apply time-based decay to all records for a user. */
|
|
44
|
+
export declare function applyEpisodicDecay(storage: StorageAdapter, userId: string): Promise<number>;
|
|
45
|
+
export declare function formatEpisodicContext(results: EpisodicSearchResult[]): string;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export { createKnowledgeGraphStore, extractEntitiesAndRelations, createGraphToolRouter, _resetGraphIds, ENTITY_TYPES, RELATION_TYPES, } from "./knowledge-graph.js";
|
|
2
|
+
export type { EntityType, RelationType, Entity, Relation, EntityUpdate, ExtractedEntity, ExtractedRelation, ExtractionResult, LLMCompleteFn, ToolRoute, GraphToolRouter, KnowledgeGraphStore, } from "./knowledge-graph.js";
|
|
3
|
+
export { DualSearch, createDualSearch } from "./dual-search.js";
|
|
4
|
+
export type { DualSearchResult, SearchBackendResult, BM25SearchFn, SemanticSearchFn, DualSearchConfig, DualSearchEventType, DualSearchEvent, DualSearchEventListener, } from "./dual-search.js";
|
|
5
|
+
export { TreeIndexManager, createTreeIndexManager, _resetTreeIds } from "./tree-index.js";
|
|
6
|
+
export type { TreeNode, TreeIndex, NavigationStep, TreeSearchResult, SummarizeFn, NavigateFn, TreeEventType, TreeEvent, TreeEventListener, TreeIndexConfig, } from "./tree-index.js";
|
|
7
|
+
export { evaluateWriteGate, createTemporalValidity, invalidate, isValid, filterValid, } from "./write-gate.js";
|
|
8
|
+
export type { TemporalValidity, WriteGateInput, WriteGateResult, ExistingMemory, FetchExistingFn, WriteGateConfig, } from "./write-gate.js";
|
|
9
|
+
export { ProgressiveSearch } from "./progressive-search.js";
|
|
10
|
+
export type { SearchResult as ProgressiveSearchResult, ProgressiveSearchConfig, KeywordSearchFn, EmbeddingSearchFn, } from "./progressive-search.js";
|
|
11
|
+
export { BrainArtifactManager, STANDARD_ARTIFACTS } from "./brain-artifacts.js";
|
|
12
|
+
export { recordObservation, retrieveObservations, recordObservationWithEvents, retrieveObservationsWithEvents, resetAccessCounts, DEFAULT_OBSERVATION_CONFIG, } from "./observation-store.js";
|
|
13
|
+
export type { ObservationCategory, ObservationInput, ObservationStoreConfig, } from "./observation-store.js";
|
|
14
|
+
export { immediateMemorySave, immediateMemorySaveWithEvents, } from "./mid-conversation-saves.js";
|
|
15
|
+
export type { ImmediateSaveInput, ImmediateSaveContext, } from "./mid-conversation-saves.js";
|
|
16
|
+
export { writeEpisodicRecord, retrieveEpisodicRecords, applyEpisodicDecay, formatEpisodicContext, EPISODIC_SCHEMA, } from "./episodic.js";
|
|
17
|
+
export type { EpisodicRecord, EpisodicWriteInput, EpisodicRetrievalOpts, EpisodicSearchResult, } from "./episodic.js";
|
|
18
|
+
export { writeTaskDiary, synthesizeMemories, TASK_DIARY_SCHEMA, } from "./synthesis.js";
|
|
19
|
+
export type { TaskDiary, DiaryEntry, SynthesisResult, SynthesizedPattern, LLMSynthesizeFn, } from "./synthesis.js";
|
|
20
|
+
export { parseNote, parseFrontmatter, parseObservations, parseRelations, serializeNote, } from "./note-parser.js";
|
|
21
|
+
export type { NoteFrontmatter, Observation as NoteObservation, NoteRelation, Note, } from "./note-parser.js";
|
|
22
|
+
export { MarkdownStore } from "./markdown-store.js";
|
|
23
|
+
export type { FileSystem, NoteIndex, NoteIndexResult, FileWatcher, MarkdownStoreConfig, MarkdownStoreEventType, MarkdownStoreEvent, MarkdownStoreEventHandler, } from "./markdown-store.js";
|
|
24
|
+
export { filtersToSQL, matchesFilters } from "./metadata-filter.js";
|
|
25
|
+
export type { FilterValue, MetadataFilters, } from "./metadata-filter.js";
|
|
26
|
+
export { detectTensions, checkObservationThresholds, DEFAULT_REVIEW_CONFIG, } from "./observation-thresholds.js";
|
|
27
|
+
export type { ObservationReviewConfig, ObservationReviewResult, } from "./observation-thresholds.js";
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Knowledge Graph — in-memory Entity/Relation store with
|
|
3
|
+
* LLM-driven entity extraction, LightRAG-style two-phase merge,
|
|
4
|
+
* confidence-scored relations, and a "memory.graph" tool router.
|
|
5
|
+
*/
|
|
6
|
+
export declare const ENTITY_TYPES: readonly ["person", "organization", "project", "concept", "location", "tool", "event", "technology"];
|
|
7
|
+
export type EntityType = (typeof ENTITY_TYPES)[number] | (string & {});
|
|
8
|
+
export declare const RELATION_TYPES: readonly ["works_at", "uses", "knows", "created", "relates_to", "part_of", "founded", "located_in"];
|
|
9
|
+
export type RelationType = (typeof RELATION_TYPES)[number] | (string & {});
|
|
10
|
+
export interface Entity {
|
|
11
|
+
id: string;
|
|
12
|
+
name: string;
|
|
13
|
+
type: EntityType;
|
|
14
|
+
properties: Record<string, unknown>;
|
|
15
|
+
observations: string[];
|
|
16
|
+
createdAt: Date;
|
|
17
|
+
updatedAt: Date;
|
|
18
|
+
}
|
|
19
|
+
export interface Relation {
|
|
20
|
+
id: string;
|
|
21
|
+
from: string;
|
|
22
|
+
to: string;
|
|
23
|
+
type: RelationType;
|
|
24
|
+
confidence: number;
|
|
25
|
+
properties: Record<string, unknown>;
|
|
26
|
+
createdAt: Date;
|
|
27
|
+
}
|
|
28
|
+
export interface EntityUpdate {
|
|
29
|
+
name?: string;
|
|
30
|
+
type?: EntityType;
|
|
31
|
+
properties?: Record<string, unknown>;
|
|
32
|
+
observations?: string[];
|
|
33
|
+
}
|
|
34
|
+
export interface ExtractedEntity {
|
|
35
|
+
name: string;
|
|
36
|
+
type: EntityType;
|
|
37
|
+
observations: string[];
|
|
38
|
+
}
|
|
39
|
+
export interface ExtractedRelation {
|
|
40
|
+
fromName: string;
|
|
41
|
+
toName: string;
|
|
42
|
+
type: RelationType;
|
|
43
|
+
confidence?: number;
|
|
44
|
+
}
|
|
45
|
+
export interface ExtractionResult {
|
|
46
|
+
entities: ExtractedEntity[];
|
|
47
|
+
relations: ExtractedRelation[];
|
|
48
|
+
}
|
|
49
|
+
/** Minimal LLM interface: send a prompt, get a text response. */
|
|
50
|
+
export type LLMCompleteFn = (prompt: string) => Promise<string>;
|
|
51
|
+
export interface ToolRoute {
|
|
52
|
+
name: string;
|
|
53
|
+
description: string;
|
|
54
|
+
handler: (args: Record<string, unknown>) => Promise<string>;
|
|
55
|
+
}
|
|
56
|
+
export interface GraphToolRouter {
|
|
57
|
+
readonly routes: ReadonlyArray<ToolRoute>;
|
|
58
|
+
get(name: string): ToolRoute | undefined;
|
|
59
|
+
}
|
|
60
|
+
export interface KnowledgeGraphStore {
|
|
61
|
+
addEntity(name: string, type: string, properties?: Record<string, unknown>, observations?: string[]): Entity;
|
|
62
|
+
getEntity(id: string): Entity | undefined;
|
|
63
|
+
getEntityByName(name: string): Entity | undefined;
|
|
64
|
+
findEntities(query: string): Entity[];
|
|
65
|
+
updateEntity(id: string, updates: EntityUpdate): Entity | undefined;
|
|
66
|
+
deleteEntity(id: string): boolean;
|
|
67
|
+
addRelation(fromId: string, toId: string, type: RelationType, properties?: Record<string, unknown>, confidence?: number): Relation;
|
|
68
|
+
getRelation(id: string): Relation | undefined;
|
|
69
|
+
getRelationsFor(entityId: string): Relation[];
|
|
70
|
+
deleteRelation(id: string): boolean;
|
|
71
|
+
getNeighbors(entityId: string): Entity[];
|
|
72
|
+
findPath(fromId: string, toId: string, maxDepth?: number): Entity[] | null;
|
|
73
|
+
mergeExtracted(result: ExtractionResult): {
|
|
74
|
+
entities: Entity[];
|
|
75
|
+
relations: Relation[];
|
|
76
|
+
};
|
|
77
|
+
mergeExtractedAsync(result: ExtractionResult): Promise<{
|
|
78
|
+
entities: Entity[];
|
|
79
|
+
relations: Relation[];
|
|
80
|
+
}>;
|
|
81
|
+
readonly entityCount: number;
|
|
82
|
+
readonly relationCount: number;
|
|
83
|
+
allEntities(): Entity[];
|
|
84
|
+
allRelations(): Relation[];
|
|
85
|
+
}
|
|
86
|
+
export declare function _resetGraphIds(): void;
|
|
87
|
+
export declare function createKnowledgeGraphStore(): KnowledgeGraphStore;
|
|
88
|
+
export declare function extractEntitiesAndRelations(text: string, llmComplete: LLMCompleteFn, existingEntities?: Entity[]): Promise<ExtractionResult>;
|
|
89
|
+
export declare function createGraphToolRouter(store: KnowledgeGraphStore, llmComplete?: LLMCompleteFn): GraphToolRouter;
|