qlogicagent 1.1.1 → 1.2.1
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.js +8 -6
- package/dist/cli.js +258 -214
- package/dist/index.js +258 -214
- package/dist/orchestration.js +12 -9
- package/dist/types/agent/tool-loop.d.ts +22 -0
- package/dist/types/agent/types.d.ts +33 -1
- package/dist/types/cli/stdio-server.d.ts +96 -1
- package/dist/types/cli/tool-bootstrap.d.ts +8 -1
- package/dist/types/llm/gemini-schema-utils.d.ts +17 -0
- package/dist/types/llm/index.d.ts +11 -2
- package/dist/types/llm/media-transport.d.ts +28 -3
- package/dist/types/llm/model-detection.d.ts +22 -0
- package/dist/types/llm/provider-def.d.ts +17 -4
- package/dist/types/llm/transport.d.ts +60 -2
- package/dist/types/llm/transports/gemini-cache-api.d.ts +86 -0
- package/dist/types/llm/transports/gemini-file-api.d.ts +90 -0
- package/dist/types/llm/transports/gemini-generatecontent.d.ts +52 -0
- package/dist/types/llm/transports/gemini-lyria-realtime.d.ts +117 -0
- package/dist/types/llm/transports/gemini-media.d.ts +40 -8
- package/dist/types/llm/transports/minimax-media.d.ts +34 -5
- package/dist/types/llm/transports/openai-responses.d.ts +60 -0
- package/dist/types/llm/transports/qwen-media.d.ts +32 -7
- package/dist/types/llm/transports/realtime-transport.d.ts +1 -1
- package/dist/types/llm/transports/volcengine-media.d.ts +10 -2
- package/dist/types/llm/transports/zhipu-media.d.ts +24 -2
- package/dist/types/orchestration/agent-instance.d.ts +58 -0
- package/dist/types/orchestration/dag-scheduler.d.ts +72 -0
- package/dist/types/orchestration/product-budget.d.ts +56 -0
- package/dist/types/orchestration/product-checkpoint.d.ts +46 -0
- package/dist/types/orchestration/product-persistence.d.ts +40 -0
- package/dist/types/orchestration/product-worktree.d.ts +13 -0
- package/dist/types/orchestration/solo-evaluator.d.ts +59 -0
- package/dist/types/orchestration/subagent/fork-subagent.d.ts +2 -0
- package/dist/types/orchestration/subagent/task-types.d.ts +4 -0
- package/dist/types/orchestration/tool-cascade.d.ts +2 -2
- package/dist/types/protocol/methods.d.ts +92 -0
- package/dist/types/protocol/notifications.d.ts +163 -1
- package/dist/types/runtime/infra/acp-detector.d.ts +36 -0
- package/dist/types/runtime/infra/acp-detector.test.d.ts +1 -0
- package/dist/types/runtime/infra/acp-protocol-adapter.d.ts +73 -0
- package/dist/types/runtime/infra/acp-protocol-adapter.test.d.ts +1 -0
- package/dist/types/runtime/infra/acp-types.d.ts +397 -0
- package/dist/types/runtime/infra/acp-usage-tracker.d.ts +46 -0
- package/dist/types/runtime/infra/acp-usage-tracker.test.d.ts +1 -0
- package/dist/types/runtime/infra/agent-config-store.d.ts +30 -0
- package/dist/types/runtime/infra/agent-config-store.test.d.ts +1 -0
- package/dist/types/runtime/infra/agent-paths.d.ts +8 -0
- package/dist/types/runtime/infra/agent-process.d.ts +280 -0
- package/dist/types/runtime/infra/agent-process.test.d.ts +1 -0
- package/dist/types/runtime/infra/index.d.ts +10 -0
- package/dist/types/runtime/infra/mcp-bridge.d.ts +166 -0
- package/dist/types/runtime/infra/mcp-bridge.test.d.ts +1 -0
- package/dist/types/runtime/infra/model-id-translator.d.ts +22 -0
- package/dist/types/runtime/infra/model-id-translator.test.d.ts +1 -0
- package/dist/types/runtime/infra/skill-injector.d.ts +51 -0
- package/dist/types/runtime/infra/skill-injector.test.d.ts +1 -0
- package/dist/types/runtime/infra/worktree-backend.d.ts +1 -0
- package/dist/types/runtime/prompt/environment-context.d.ts +6 -0
- package/dist/types/runtime/session/session-persistence.d.ts +9 -8
- package/dist/types/runtime/session/session-state.d.ts +3 -31
- package/dist/types/skills/index.d.ts +2 -10
- package/dist/types/skills/tools/skill-tool.d.ts +101 -0
- package/dist/types/skills/tools/team-tool.d.ts +23 -1
- package/package.json +1 -1
- package/dist/types/runtime/session/session-memory.d.ts +0 -90
- package/dist/types/skills/memory/memory-extractor.d.ts +0 -64
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
* Unified state container for a single agent session:
|
|
5
5
|
* - Token usage / cost accumulation across turns
|
|
6
6
|
* - Session trust acceptance (per-session, non-persistent)
|
|
7
|
-
* - Background memory extraction trigger thresholds
|
|
8
7
|
* - Session-level settings
|
|
9
8
|
*
|
|
10
9
|
* This module is the qlogicagent equivalent of CC's:
|
|
@@ -39,15 +38,6 @@ export interface SessionUsageSnapshot {
|
|
|
39
38
|
}
|
|
40
39
|
/** @deprecated Use SessionUsageSnapshot. Kept for persistence compat. */
|
|
41
40
|
export type SessionCostSnapshot = SessionUsageSnapshot;
|
|
42
|
-
/** Thresholds for background memory extraction — CC sessionMemory.ts parity */
|
|
43
|
-
export interface MemoryExtractionThresholds {
|
|
44
|
-
/** Token threshold before FIRST extraction (default 10000) */
|
|
45
|
-
initialTokenThreshold: number;
|
|
46
|
-
/** Token threshold between UPDATES (default 5000) */
|
|
47
|
-
updateTokenThreshold: number;
|
|
48
|
-
/** Tool call threshold (default 3) */
|
|
49
|
-
toolCallThreshold: number;
|
|
50
|
-
}
|
|
51
41
|
export declare class SessionState {
|
|
52
42
|
readonly sessionId: string;
|
|
53
43
|
private _trustAccepted;
|
|
@@ -56,13 +46,8 @@ export declare class SessionState {
|
|
|
56
46
|
private _totalOutputTokens;
|
|
57
47
|
private _turnCount;
|
|
58
48
|
private _toolCallCount;
|
|
59
|
-
private _tokensSinceLastExtraction;
|
|
60
|
-
private _toolCallsSinceLastExtraction;
|
|
61
|
-
private _hasExtractedOnce;
|
|
62
49
|
private _listeners;
|
|
63
|
-
|
|
64
|
-
readonly extractionThresholds: MemoryExtractionThresholds;
|
|
65
|
-
constructor(sessionId: string, thresholds?: Partial<MemoryExtractionThresholds>);
|
|
50
|
+
constructor(sessionId: string);
|
|
66
51
|
get trustAccepted(): boolean;
|
|
67
52
|
setTrustAccepted(accepted: boolean): void;
|
|
68
53
|
get totalInputTokens(): number;
|
|
@@ -86,23 +71,10 @@ export declare class SessionState {
|
|
|
86
71
|
* Tracks quantities only (calls, seconds, characters); pricing is Hub/Admin's job.
|
|
87
72
|
*/
|
|
88
73
|
addMediaUsage(model: string, billingUnit: string, quantity: number): void;
|
|
89
|
-
/** Record a tool call
|
|
74
|
+
/** Record a tool call */
|
|
90
75
|
recordToolCall(): void;
|
|
91
76
|
/** Increment turn count */
|
|
92
77
|
recordTurnCompleted(): void;
|
|
93
|
-
/**
|
|
94
|
-
* Check whether background memory extraction should trigger.
|
|
95
|
-
* CC sessionMemory.ts shouldExtract() parity.
|
|
96
|
-
*
|
|
97
|
-
* Logic:
|
|
98
|
-
* - Token threshold is ALWAYS required
|
|
99
|
-
* - Tool call threshold is an additional gate
|
|
100
|
-
* - Token threshold: initialTokenThreshold before first extraction,
|
|
101
|
-
* updateTokenThreshold after
|
|
102
|
-
*/
|
|
103
|
-
shouldExtractMemory(): boolean;
|
|
104
|
-
/** Mark that extraction was performed — reset counters */
|
|
105
|
-
markExtractionDone(): void;
|
|
106
78
|
/**
|
|
107
79
|
* Create a snapshot for persistence.
|
|
108
80
|
* CC saveCurrentSessionCosts() parity.
|
|
@@ -123,4 +95,4 @@ export declare class SessionState {
|
|
|
123
95
|
/**
|
|
124
96
|
* Create a new session state instance.
|
|
125
97
|
*/
|
|
126
|
-
export declare function createSessionState(sessionId: string
|
|
98
|
+
export declare function createSessionState(sessionId: string): SessionState;
|
|
@@ -6,8 +6,6 @@ export { MemoryStore, MEMORY_ENTRY_DELIMITER, DEFAULT_MEMORY_CHAR_LIMIT, DEFAULT
|
|
|
6
6
|
export type { MemoryStoreTarget, MemoryStoreResult, MemoryStoreOptions, MemoryStoreSerialized, } from "./memory/memory-store.js";
|
|
7
7
|
export { createQMemoryAdapter } from "./memory/qmemory-adapter.js";
|
|
8
8
|
export type { QMemoryAdapterConfig, QMemoryHealthStatus, ExtractedMemoryItem } from "./memory/qmemory-adapter.js";
|
|
9
|
-
export { createMemoryExtractor } from "./memory/memory-extractor.js";
|
|
10
|
-
export type { ExtractedMemory, ProfileUpdate, ExtractionResult, ExtractionCompleteFn, MemoryExtractorOptions, } from "./memory/memory-extractor.js";
|
|
11
9
|
export { THINK_TOOL_NAME, THINK_TOOL_SCHEMA, createThinkTool } from "./think-tool.js";
|
|
12
10
|
export type { ThinkToolParams } from "./think-tool.js";
|
|
13
11
|
export { TODO_TOOL_NAME, TODO_TOOL_SCHEMA, TODO_ACTIONS, createTodoTool } from "./todo-tool.js";
|
|
@@ -50,12 +48,8 @@ export { BRIEF_TOOL_NAME, BRIEF_TOOL_SCHEMA, createBriefTool } from "./tools/bri
|
|
|
50
48
|
export type { BriefToolParams, BriefToolDeps, BriefMessageStatus, BriefAttachment, BriefDeliveryResult, BriefModeConfig, } from "./tools/brief-tool.js";
|
|
51
49
|
export { TOOL_SEARCH_TOOL_NAME, TOOL_SEARCH_TOOL_SCHEMA, createToolSearchTool } from "./tools/tool-search-tool.js";
|
|
52
50
|
export type { ToolSearchToolParams, ToolSearchToolDeps, DeferredToolInfo, ToolSearchOutput } from "./tools/tool-search-tool.js";
|
|
53
|
-
export {
|
|
54
|
-
export type {
|
|
55
|
-
export { SKILL_VIEW_TOOL_NAME, SKILL_VIEW_TOOL_SCHEMA, createSkillViewTool } from "./tools/skill-view-tool.js";
|
|
56
|
-
export type { SkillViewToolParams, SkillViewToolDeps, SkillViewOutput } from "./tools/skill-view-tool.js";
|
|
57
|
-
export { SKILL_MANAGE_TOOL_NAME, SKILL_MANAGE_TOOL_SCHEMA, createSkillManageTool } from "./tools/skill-manage-tool.js";
|
|
58
|
-
export type { SkillManageToolParams, SkillManageToolDeps, SkillManageResult, SkillManageAction } from "./tools/skill-manage-tool.js";
|
|
51
|
+
export { SKILL_TOOL_NAME, SKILL_TOOL_SCHEMA, createSkillMetaTool } from "./tools/skill-tool.js";
|
|
52
|
+
export type { SkillAction, SkillToolParams, SkillToolDeps, SkillListItem, SkillListOutput, SkillViewOutput, SkillManageResult } from "./tools/skill-tool.js";
|
|
59
53
|
export { PATCH_TOOL_NAME, PATCH_TOOL_SCHEMA, createPatchTool, fuzzyFind } from "./tools/patch-tool.js";
|
|
60
54
|
export type { PatchToolParams, PatchToolDeps, PatchResult, MatchStrategy, MatchResult } from "./tools/patch-tool.js";
|
|
61
55
|
export { AGENT_TOOL_NAME, AGENT_TOOL_SCHEMA, createAgentTool } from "./tools/agent-tool.js";
|
|
@@ -103,8 +97,6 @@ export { scanSource, scanSkillDirectory, hasCriticalFindings, isScannable, } fro
|
|
|
103
97
|
export type { SkillGuardDeps } from "./skill-system/skill-guard.js";
|
|
104
98
|
export { installSkill, uninstallSkill, createEmptyLockfile, } from "./skill-system/skill-source.js";
|
|
105
99
|
export type { TrustLevel, ScanVerdict, SkillSourceDescriptor, SkillFetchResult, SkillFetchDeps, SkillStorageDeps, SkillLockEntry, SkillLockfile, SkillInstallResult, } from "./skill-system/skill-source.js";
|
|
106
|
-
export { SKILL_TOOL_NAME, SKILL_INVOKE_SCHEMA, createSkillTool } from "./tools/skill-invoke-tool.js";
|
|
107
|
-
export type { SkillInvokeParams, SkillToolDeps } from "./tools/skill-invoke-tool.js";
|
|
108
100
|
export { McpStdioClient } from "./mcp/mcp-stdio-client.js";
|
|
109
101
|
export { McpManager, parseMcpConfig } from "./mcp/mcp-manager.js";
|
|
110
102
|
export type { McpServerEntry, McpManagerConfig } from "./mcp/mcp-manager.js";
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import type { PortableTool } from "../portable-tool.js";
|
|
2
|
+
import type { WorkspaceSkill } from "../skill-system/skill-types.js";
|
|
3
|
+
export declare const SKILL_TOOL_NAME: "skill";
|
|
4
|
+
export type SkillAction = "invoke" | "list" | "view" | "create" | "edit" | "patch" | "delete";
|
|
5
|
+
export interface SkillToolParams {
|
|
6
|
+
action: SkillAction;
|
|
7
|
+
name?: string;
|
|
8
|
+
args?: string;
|
|
9
|
+
category?: string;
|
|
10
|
+
content?: string;
|
|
11
|
+
filePath?: string;
|
|
12
|
+
fileContent?: string;
|
|
13
|
+
oldString?: string;
|
|
14
|
+
newString?: string;
|
|
15
|
+
}
|
|
16
|
+
export declare const SKILL_TOOL_SCHEMA: {
|
|
17
|
+
readonly type: "object";
|
|
18
|
+
readonly properties: {
|
|
19
|
+
readonly action: {
|
|
20
|
+
readonly type: "string";
|
|
21
|
+
readonly enum: readonly ["invoke", "list", "view", "create", "edit", "patch", "delete"];
|
|
22
|
+
readonly description: string;
|
|
23
|
+
};
|
|
24
|
+
readonly name: {
|
|
25
|
+
readonly type: "string";
|
|
26
|
+
readonly description: "Skill name (required for invoke/view/create/edit/patch/delete).";
|
|
27
|
+
};
|
|
28
|
+
readonly args: {
|
|
29
|
+
readonly type: "string";
|
|
30
|
+
readonly description: "Arguments or context to pass when invoking a skill.";
|
|
31
|
+
};
|
|
32
|
+
readonly category: {
|
|
33
|
+
readonly type: "string";
|
|
34
|
+
readonly description: "Filter skills by category (for 'list' action).";
|
|
35
|
+
};
|
|
36
|
+
readonly content: {
|
|
37
|
+
readonly type: "string";
|
|
38
|
+
readonly description: "Full SKILL.md content for create/edit actions.";
|
|
39
|
+
};
|
|
40
|
+
readonly filePath: {
|
|
41
|
+
readonly type: "string";
|
|
42
|
+
readonly description: "View a specific file within the skill (for 'view' action).";
|
|
43
|
+
};
|
|
44
|
+
readonly fileContent: {
|
|
45
|
+
readonly type: "string";
|
|
46
|
+
readonly description: "Content for writing supporting files.";
|
|
47
|
+
};
|
|
48
|
+
readonly oldString: {
|
|
49
|
+
readonly type: "string";
|
|
50
|
+
readonly description: "Text to find for patch action.";
|
|
51
|
+
};
|
|
52
|
+
readonly newString: {
|
|
53
|
+
readonly type: "string";
|
|
54
|
+
readonly description: "Replacement text for patch action.";
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
readonly required: readonly ["action"];
|
|
58
|
+
};
|
|
59
|
+
export interface SkillListItem {
|
|
60
|
+
name: string;
|
|
61
|
+
description: string;
|
|
62
|
+
version?: string;
|
|
63
|
+
category?: string;
|
|
64
|
+
}
|
|
65
|
+
export interface SkillListOutput {
|
|
66
|
+
skills: SkillListItem[];
|
|
67
|
+
categories: string[];
|
|
68
|
+
}
|
|
69
|
+
export interface SkillViewOutput {
|
|
70
|
+
name: string;
|
|
71
|
+
content: string;
|
|
72
|
+
referenceFiles?: string[];
|
|
73
|
+
}
|
|
74
|
+
export interface SkillManageResult {
|
|
75
|
+
success: boolean;
|
|
76
|
+
message: string;
|
|
77
|
+
path?: string;
|
|
78
|
+
}
|
|
79
|
+
export interface SkillToolDeps {
|
|
80
|
+
/** List all available skills (Layer 0 metadata). */
|
|
81
|
+
listSkills(): WorkspaceSkill[];
|
|
82
|
+
/** List skills with full detail (for list action). */
|
|
83
|
+
listSkillsFull(category?: string): Promise<SkillListOutput>;
|
|
84
|
+
/** Read skill content (Layer 1 instructions). */
|
|
85
|
+
readSkillContent(name: string): Promise<string | null>;
|
|
86
|
+
/** View skill with optional file path. */
|
|
87
|
+
viewSkill(name: string, filePath?: string): Promise<SkillViewOutput | null>;
|
|
88
|
+
/** Execute skill as sub-turn. */
|
|
89
|
+
executeSkillSubturn?(skillName: string, skillContent: string, userArgs: string | undefined, signal?: AbortSignal): Promise<string>;
|
|
90
|
+
/** Manage skill (create/edit/patch/delete). */
|
|
91
|
+
manageSkill(params: {
|
|
92
|
+
action: string;
|
|
93
|
+
name: string;
|
|
94
|
+
content?: string;
|
|
95
|
+
filePath?: string;
|
|
96
|
+
fileContent?: string;
|
|
97
|
+
oldString?: string;
|
|
98
|
+
newString?: string;
|
|
99
|
+
}): Promise<SkillManageResult>;
|
|
100
|
+
}
|
|
101
|
+
export declare function createSkillMetaTool(deps: SkillToolDeps): PortableTool<SkillToolParams>;
|
|
@@ -5,6 +5,14 @@ export interface TeamMember {
|
|
|
5
5
|
name: string;
|
|
6
6
|
role: string;
|
|
7
7
|
tools?: string[];
|
|
8
|
+
/** Working directory for this member (worktree path or inherited cwd). */
|
|
9
|
+
cwd?: string;
|
|
10
|
+
/** Git worktree path if auto-provisioned (CC TeamMember.worktreePath parity). */
|
|
11
|
+
worktreePath?: string;
|
|
12
|
+
/** Git worktree branch name (for cleanup). */
|
|
13
|
+
worktreeBranch?: string;
|
|
14
|
+
/** Whether the member is currently active. */
|
|
15
|
+
isActive?: boolean;
|
|
8
16
|
}
|
|
9
17
|
export interface TeamToolParams {
|
|
10
18
|
action: TeamAction;
|
|
@@ -84,6 +92,20 @@ export interface TeamToolDeps {
|
|
|
84
92
|
}): Promise<TeamResult>;
|
|
85
93
|
deleteTeam(teamName: string): Promise<TeamResult>;
|
|
86
94
|
listTeams(): Promise<TeamResult>;
|
|
87
|
-
getTeamStatus(teamName: string): Promise<TeamResult
|
|
95
|
+
getTeamStatus(teamName: string): Promise<TeamResult & {
|
|
96
|
+
memberProgress?: Record<string, {
|
|
97
|
+
mediaProgress?: {
|
|
98
|
+
taskId: string;
|
|
99
|
+
mediaType: string;
|
|
100
|
+
percent: number;
|
|
101
|
+
status: string;
|
|
102
|
+
provider?: string;
|
|
103
|
+
updatedAt: number;
|
|
104
|
+
};
|
|
105
|
+
lastToolCall?: string;
|
|
106
|
+
idleFor?: number;
|
|
107
|
+
runningFor?: number;
|
|
108
|
+
}>;
|
|
109
|
+
}>;
|
|
88
110
|
}
|
|
89
111
|
export declare function createTeamTool(deps: TeamToolDeps): PortableTool<TeamToolParams>;
|
package/package.json
CHANGED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Session Memory — CC SessionMemory background extraction parity.
|
|
3
|
-
*
|
|
4
|
-
* Automatically extracts key insights from the conversation and saves
|
|
5
|
-
* them to session memory files. Runs as a forked sub-agent with restricted
|
|
6
|
-
* tool access after each turn when extraction thresholds are met.
|
|
7
|
-
*
|
|
8
|
-
* CC reference:
|
|
9
|
-
* - src/services/SessionMemory/sessionMemory.ts
|
|
10
|
-
* - src/services/SessionMemory/extractMemories.ts
|
|
11
|
-
*
|
|
12
|
-
* Extraction process:
|
|
13
|
-
* 1. Check thresholds (tokens + tool calls since last extraction)
|
|
14
|
-
* 2. Fork a sub-agent with restricted tools (read-only + memory write)
|
|
15
|
-
* 3. Sub-agent reviews conversation, extracts key facts/decisions
|
|
16
|
-
* 4. Sub-agent writes to session-memory.md file
|
|
17
|
-
* 5. Reset threshold counters
|
|
18
|
-
*
|
|
19
|
-
* Tool restrictions for extractor:
|
|
20
|
-
* ✅ read, search, grep, glob (read-only fs)
|
|
21
|
-
* ✅ memory_write (to session-memory path only)
|
|
22
|
-
* ❌ Everything else (no file edits, no bash, no network)
|
|
23
|
-
*/
|
|
24
|
-
import type { ChatMessage, ToolDefinition, ToolInvoker, AgentLogger, HookRegistry } from "../../agent/types.js";
|
|
25
|
-
import type { LLMTransport } from "../../llm/transport.js";
|
|
26
|
-
import type { SessionState } from "./session-state.js";
|
|
27
|
-
/** Tool permission check function (mirrors execution/forked-agent CanUseToolFn). */
|
|
28
|
-
export type CanUseToolFn = (toolName: string, input: Record<string, unknown>) => {
|
|
29
|
-
allowed: true;
|
|
30
|
-
} | {
|
|
31
|
-
allowed: false;
|
|
32
|
-
reason: string;
|
|
33
|
-
};
|
|
34
|
-
/** Forked agent runner signature (injected by CLI layer). */
|
|
35
|
-
export type ForkedAgentRunner = (params: {
|
|
36
|
-
promptMessages: ChatMessage[];
|
|
37
|
-
systemPrompt?: string;
|
|
38
|
-
tools: ToolDefinition[];
|
|
39
|
-
canUseTool?: CanUseToolFn;
|
|
40
|
-
transport: LLMTransport;
|
|
41
|
-
toolInvoker: ToolInvoker;
|
|
42
|
-
apiKey: string;
|
|
43
|
-
model: string;
|
|
44
|
-
log: AgentLogger;
|
|
45
|
-
hooks?: HookRegistry;
|
|
46
|
-
forkLabel: string;
|
|
47
|
-
maxTurns?: number;
|
|
48
|
-
parentSignal?: AbortSignal;
|
|
49
|
-
skipTranscript?: boolean;
|
|
50
|
-
}) => Promise<{
|
|
51
|
-
ok: boolean;
|
|
52
|
-
content?: string;
|
|
53
|
-
error?: string;
|
|
54
|
-
durationMs: number;
|
|
55
|
-
totalUsage: {
|
|
56
|
-
prompt: number;
|
|
57
|
-
completion: number;
|
|
58
|
-
};
|
|
59
|
-
}>;
|
|
60
|
-
export interface SessionMemoryDeps {
|
|
61
|
-
/** Session state (for threshold tracking) */
|
|
62
|
-
sessionState: SessionState;
|
|
63
|
-
/** LLM transport for the extractor agent */
|
|
64
|
-
transport: LLMTransport;
|
|
65
|
-
/** Tool invoker */
|
|
66
|
-
toolInvoker: ToolInvoker;
|
|
67
|
-
/** Available tools (will be filtered for extraction) */
|
|
68
|
-
tools: ToolDefinition[];
|
|
69
|
-
/** API key */
|
|
70
|
-
apiKey: string;
|
|
71
|
-
/** Model for extraction (can use a cheaper/faster model) */
|
|
72
|
-
model: string;
|
|
73
|
-
/** Logger */
|
|
74
|
-
log: AgentLogger;
|
|
75
|
-
/** Hook registry */
|
|
76
|
-
hooks?: HookRegistry;
|
|
77
|
-
/** Path where session memory should be written */
|
|
78
|
-
memoryFilePath: string;
|
|
79
|
-
/** Parent abort signal */
|
|
80
|
-
parentSignal?: AbortSignal;
|
|
81
|
-
/** Forked agent runner (injected by CLI layer, decoupled from execution/) */
|
|
82
|
-
runForkedAgent: ForkedAgentRunner;
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Check if memory extraction should run and execute if thresholds are met.
|
|
86
|
-
*
|
|
87
|
-
* Call this at the end of each turn (after turn.completed hook).
|
|
88
|
-
* It's a no-op if thresholds aren't met.
|
|
89
|
-
*/
|
|
90
|
-
export declare function maybeExtractSessionMemory(deps: SessionMemoryDeps, conversationMessages: ChatMessage[]): Promise<boolean>;
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
export interface ExtractedMemory {
|
|
2
|
-
text: string;
|
|
3
|
-
category: string;
|
|
4
|
-
importance: number;
|
|
5
|
-
speaker: string;
|
|
6
|
-
event_date?: string;
|
|
7
|
-
tags?: string[];
|
|
8
|
-
}
|
|
9
|
-
export interface ProfileUpdate {
|
|
10
|
-
category: string;
|
|
11
|
-
key: string;
|
|
12
|
-
value: string;
|
|
13
|
-
confidence: number;
|
|
14
|
-
}
|
|
15
|
-
export interface ExtractionResult {
|
|
16
|
-
memories: ExtractedMemory[];
|
|
17
|
-
profileUpdates: ProfileUpdate[];
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Generic OpenAI-compatible chat completion function.
|
|
21
|
-
* Consumer provides the actual HTTP transport (e.g. admin/new-api fetch).
|
|
22
|
-
*/
|
|
23
|
-
export type ExtractionCompleteFn = (params: {
|
|
24
|
-
model: string;
|
|
25
|
-
messages: Array<{
|
|
26
|
-
role: string;
|
|
27
|
-
content: string;
|
|
28
|
-
}>;
|
|
29
|
-
tools: unknown[];
|
|
30
|
-
tool_choice: unknown;
|
|
31
|
-
temperature?: number;
|
|
32
|
-
max_tokens?: number;
|
|
33
|
-
}) => Promise<{
|
|
34
|
-
choices?: Array<{
|
|
35
|
-
message?: {
|
|
36
|
-
tool_calls?: Array<{
|
|
37
|
-
function?: {
|
|
38
|
-
name?: string;
|
|
39
|
-
arguments?: string;
|
|
40
|
-
};
|
|
41
|
-
}>;
|
|
42
|
-
content?: string;
|
|
43
|
-
};
|
|
44
|
-
}>;
|
|
45
|
-
}>;
|
|
46
|
-
export interface MemoryExtractorOptions {
|
|
47
|
-
/** Model to use for extraction (default: "deepseek-v4-flash"). */
|
|
48
|
-
model?: string;
|
|
49
|
-
/** Timeout in ms for the LLM call (default: 30_000). */
|
|
50
|
-
timeoutMs?: number;
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Create a memory extractor backed by an OpenAI-compatible LLM endpoint.
|
|
54
|
-
*
|
|
55
|
-
* The `complete` function is injected by the consumer so that
|
|
56
|
-
* skills layer stays transport-agnostic (no admin/new-api dependency).
|
|
57
|
-
*/
|
|
58
|
-
export declare function createMemoryExtractor(complete: ExtractionCompleteFn, options?: MemoryExtractorOptions): {
|
|
59
|
-
/**
|
|
60
|
-
* Extract structured memories from a conversation fragment.
|
|
61
|
-
* Returns empty result if text is too short or LLM call fails.
|
|
62
|
-
*/
|
|
63
|
-
extract(conversationText: string): Promise<ExtractionResult>;
|
|
64
|
-
};
|