qlogicagent 0.3.0 → 0.4.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.
Files changed (119) hide show
  1. package/README.md +45 -45
  2. package/package.json +1 -1
  3. package/dist/agent.js +0 -1
  4. package/dist/cli.js +0 -9
  5. package/dist/contracts.js +0 -1
  6. package/dist/index.js +0 -5
  7. package/dist/orchestration.js +0 -118
  8. package/dist/types/agent/agent.d.ts +0 -43
  9. package/dist/types/agent/tool-loop.d.ts +0 -64
  10. package/dist/types/agent/types.d.ts +0 -175
  11. package/dist/types/cli/main.d.ts +0 -11
  12. package/dist/types/cli/stdio-server.d.ts +0 -45
  13. package/dist/types/config/config.d.ts +0 -17
  14. package/dist/types/contracts/hooks.d.ts +0 -120
  15. package/dist/types/contracts/index.d.ts +0 -10
  16. package/dist/types/contracts/planner.d.ts +0 -35
  17. package/dist/types/contracts/skill-candidate.d.ts +0 -63
  18. package/dist/types/contracts/todo.d.ts +0 -14
  19. package/dist/types/index.d.ts +0 -13
  20. package/dist/types/llm/builtin-providers.d.ts +0 -10
  21. package/dist/types/llm/index.d.ts +0 -15
  22. package/dist/types/llm/llm-client.d.ts +0 -43
  23. package/dist/types/llm/model-catalog.d.ts +0 -53
  24. package/dist/types/llm/provider-def.d.ts +0 -59
  25. package/dist/types/llm/provider-registry.d.ts +0 -54
  26. package/dist/types/llm/transport.d.ts +0 -62
  27. package/dist/types/llm/transports/anthropic-messages.d.ts +0 -31
  28. package/dist/types/llm/transports/openai-chat.d.ts +0 -36
  29. package/dist/types/orchestration/agent-registry.d.ts +0 -41
  30. package/dist/types/orchestration/approval-aware-tool-plan.d.ts +0 -32
  31. package/dist/types/orchestration/context-compression.d.ts +0 -220
  32. package/dist/types/orchestration/conversation-repair.d.ts +0 -61
  33. package/dist/types/orchestration/curator-scheduler.d.ts +0 -119
  34. package/dist/types/orchestration/embedded-failover-policy.d.ts +0 -110
  35. package/dist/types/orchestration/error-classification.d.ts +0 -12
  36. package/dist/types/orchestration/failover-classification.d.ts +0 -8
  37. package/dist/types/orchestration/failover-error.d.ts +0 -33
  38. package/dist/types/orchestration/fork-subagent.d.ts +0 -100
  39. package/dist/types/orchestration/index.d.ts +0 -120
  40. package/dist/types/orchestration/memory-flush-policy.d.ts +0 -57
  41. package/dist/types/orchestration/memory-provider.d.ts +0 -14
  42. package/dist/types/orchestration/parallel-tool-calls.d.ts +0 -41
  43. package/dist/types/orchestration/prompt-cache-strategy.d.ts +0 -126
  44. package/dist/types/orchestration/reactive-compact.d.ts +0 -73
  45. package/dist/types/orchestration/retry-loop.d.ts +0 -22
  46. package/dist/types/orchestration/skill-candidate.d.ts +0 -52
  47. package/dist/types/orchestration/skill-consolidation.d.ts +0 -123
  48. package/dist/types/orchestration/skill-improvement.d.ts +0 -59
  49. package/dist/types/orchestration/skill-similarity.d.ts +0 -98
  50. package/dist/types/orchestration/streaming-tool-executor.d.ts +0 -73
  51. package/dist/types/orchestration/team-orchestration.d.ts +0 -195
  52. package/dist/types/orchestration/team-tool-loop-wiring.d.ts +0 -92
  53. package/dist/types/orchestration/tool-choice-policy.d.ts +0 -54
  54. package/dist/types/orchestration/tool-loop-state.d.ts +0 -50
  55. package/dist/types/orchestration/tool-schema.d.ts +0 -39
  56. package/dist/types/orchestration/transcript-repair.d.ts +0 -42
  57. package/dist/types/orchestration/turn-loop-guard.d.ts +0 -86
  58. package/dist/types/orchestration/web-browser-policy.d.ts +0 -17
  59. package/dist/types/runtime/context-compression.d.ts +0 -61
  60. package/dist/types/runtime/hook-registry.d.ts +0 -12
  61. package/dist/types/runtime/memory-hooks.d.ts +0 -23
  62. package/dist/types/runtime/tool-eligibility.d.ts +0 -59
  63. package/dist/types/skills/index.d.ts +0 -108
  64. package/dist/types/skills/memory-extractor.d.ts +0 -64
  65. package/dist/types/skills/memory-query-tool.d.ts +0 -43
  66. package/dist/types/skills/memory-store.d.ts +0 -66
  67. package/dist/types/skills/memory-tool.d.ts +0 -67
  68. package/dist/types/skills/portable-tool.d.ts +0 -71
  69. package/dist/types/skills/qmemory-adapter.d.ts +0 -52
  70. package/dist/types/skills/skill-frontmatter.d.ts +0 -19
  71. package/dist/types/skills/skill-guard.d.ts +0 -23
  72. package/dist/types/skills/skill-loader.d.ts +0 -16
  73. package/dist/types/skills/skill-source.d.ts +0 -119
  74. package/dist/types/skills/skill-types.d.ts +0 -199
  75. package/dist/types/skills/think-tool.d.ts +0 -16
  76. package/dist/types/skills/todo-tool.d.ts +0 -63
  77. package/dist/types/skills/tools/agent-tool.d.ts +0 -91
  78. package/dist/types/skills/tools/apply-patch-tool.d.ts +0 -29
  79. package/dist/types/skills/tools/ask-user-tool.d.ts +0 -80
  80. package/dist/types/skills/tools/brief-tool.d.ts +0 -74
  81. package/dist/types/skills/tools/browser-tool.d.ts +0 -114
  82. package/dist/types/skills/tools/checkpoint-tool.d.ts +0 -66
  83. package/dist/types/skills/tools/config-tool.d.ts +0 -63
  84. package/dist/types/skills/tools/cron-tool.d.ts +0 -116
  85. package/dist/types/skills/tools/edit-tool.d.ts +0 -43
  86. package/dist/types/skills/tools/exec-tool.d.ts +0 -102
  87. package/dist/types/skills/tools/image-generate-tool.d.ts +0 -62
  88. package/dist/types/skills/tools/instructions-tool.d.ts +0 -103
  89. package/dist/types/skills/tools/lsp-tool.d.ts +0 -153
  90. package/dist/types/skills/tools/mcp-client-types.d.ts +0 -269
  91. package/dist/types/skills/tools/mcp-tool.d.ts +0 -249
  92. package/dist/types/skills/tools/memory-tool.d.ts +0 -74
  93. package/dist/types/skills/tools/monitor-tool.d.ts +0 -113
  94. package/dist/types/skills/tools/music-generate-tool.d.ts +0 -55
  95. package/dist/types/skills/tools/notify-tool.d.ts +0 -53
  96. package/dist/types/skills/tools/patch-tool.d.ts +0 -45
  97. package/dist/types/skills/tools/pdf-tool.d.ts +0 -66
  98. package/dist/types/skills/tools/plan-mode-tool.d.ts +0 -59
  99. package/dist/types/skills/tools/read-tool.d.ts +0 -51
  100. package/dist/types/skills/tools/repl-tool.d.ts +0 -70
  101. package/dist/types/skills/tools/search-tool.d.ts +0 -112
  102. package/dist/types/skills/tools/send-message-tool.d.ts +0 -51
  103. package/dist/types/skills/tools/skill-list-tool.d.ts +0 -33
  104. package/dist/types/skills/tools/skill-manage-tool.d.ts +0 -73
  105. package/dist/types/skills/tools/skill-view-tool.d.ts +0 -37
  106. package/dist/types/skills/tools/sleep-tool.d.ts +0 -49
  107. package/dist/types/skills/tools/structured-output-tool.d.ts +0 -116
  108. package/dist/types/skills/tools/task-tool.d.ts +0 -104
  109. package/dist/types/skills/tools/team-tool.d.ts +0 -89
  110. package/dist/types/skills/tools/tool-search-tool.d.ts +0 -51
  111. package/dist/types/skills/tools/tts-tool.d.ts +0 -38
  112. package/dist/types/skills/tools/video-edit-tool.d.ts +0 -69
  113. package/dist/types/skills/tools/video-generate-tool.d.ts +0 -62
  114. package/dist/types/skills/tools/video-merge-tool.d.ts +0 -105
  115. package/dist/types/skills/tools/video-upscale-tool.d.ts +0 -45
  116. package/dist/types/skills/tools/web-fetch-tool.d.ts +0 -78
  117. package/dist/types/skills/tools/web-search-tool.d.ts +0 -57
  118. package/dist/types/skills/tools/worktree-tool.d.ts +0 -69
  119. package/dist/types/skills/tools/write-tool.d.ts +0 -45
@@ -1,54 +0,0 @@
1
- import type { RuntimeToolEligibilityContract } from "qlogicagent-runtime-contracts";
2
- export type ToolChoiceLike = "auto" | "none" | "required" | {
3
- type: "function";
4
- function?: {
5
- name?: string;
6
- };
7
- } | Record<string, unknown> | undefined;
8
- export interface ToolChoiceToolLike {
9
- type?: string;
10
- function?: {
11
- name?: string;
12
- description?: string;
13
- parameters?: Record<string, unknown>;
14
- };
15
- name?: string;
16
- description?: string;
17
- requiresApproval?: boolean;
18
- }
19
- export type ToolEligibilityLike = RuntimeToolEligibilityContract;
20
- export interface ToolChoiceCompatibilityPolicy {
21
- allowNamedToolChoice?: boolean;
22
- allowRequiredToolChoice?: boolean;
23
- requiredFallback?: "required" | "auto" | "none";
24
- namedFallback?: "required" | "auto" | "none";
25
- requireAutoWhenThinking?: boolean;
26
- }
27
- export interface ApplyToolChoicePolicyInput<TTool extends ToolChoiceToolLike> {
28
- tools: readonly TTool[];
29
- toolChoice: ToolChoiceLike;
30
- eligibility?: readonly ToolEligibilityLike[];
31
- thinkingEnabled?: boolean;
32
- compatibility?: ToolChoiceCompatibilityPolicy;
33
- }
34
- export interface ApplyToolChoicePolicyResult<TTool extends ToolChoiceToolLike> {
35
- tools: TTool[];
36
- normalizedToolChoice?: ToolChoiceLike;
37
- extraSystemPrompt?: string;
38
- warnings: string[];
39
- }
40
- export declare function filterEligibleTools<TTool extends ToolChoiceToolLike>(params: {
41
- tools: readonly TTool[];
42
- eligibility?: readonly ToolEligibilityLike[];
43
- }): TTool[];
44
- export declare function normalizeAnthropicFunctionToolDefinition(tool: unknown): Record<string, unknown> | undefined;
45
- export declare function normalizeAnthropicToolChoice(toolChoice: unknown): unknown;
46
- export declare function applyToolChoiceCompatibility(params: {
47
- toolChoice: ToolChoiceLike;
48
- thinkingEnabled?: boolean;
49
- compatibility?: ToolChoiceCompatibilityPolicy;
50
- }): {
51
- normalizedToolChoice?: ToolChoiceLike;
52
- warnings: string[];
53
- };
54
- export declare function applyToolChoicePolicy<TTool extends ToolChoiceToolLike>(params: ApplyToolChoicePolicyInput<TTool>): ApplyToolChoicePolicyResult<TTool>;
@@ -1,50 +0,0 @@
1
- import { type ConversationRepairOptions, type OpenAiChatMessageLike, type OpenAiResponsesItemLike } from "./conversation-repair.js";
2
- export interface ToolLoopState<TMessage = unknown> {
3
- round: number;
4
- maxRounds: number;
5
- pendingToolCallIds: string[];
6
- completedToolCallIds: string[];
7
- lastStopReason?: string;
8
- replayMessages: TMessage[];
9
- }
10
- export interface ToolLoopRepairAction {
11
- kind: "strip-forced-stop-tool-metadata" | "inject-placeholder-tool-result" | "drop-orphan-tool-result" | "rewrite-openai-function-call-pair" | "drop-trailing-reasoning";
12
- detail?: string;
13
- }
14
- export interface RepairToolLoopStateResult<TMessage> {
15
- state: ToolLoopState<TMessage>;
16
- recoveryActions: ToolLoopRepairAction[];
17
- }
18
- export declare function createToolLoopState<TMessage>(params: {
19
- maxRounds: number;
20
- replayMessages?: readonly TMessage[];
21
- round?: number;
22
- pendingToolCallIds?: readonly string[];
23
- completedToolCallIds?: readonly string[];
24
- lastStopReason?: string;
25
- }): ToolLoopState<TMessage>;
26
- export declare function advanceToolLoopState<TMessage>(state: ToolLoopState<TMessage>, params: {
27
- replayMessages?: readonly TMessage[];
28
- pendingToolCallIds?: readonly string[];
29
- completedToolCallIds?: readonly string[];
30
- lastStopReason?: string;
31
- }): ToolLoopState<TMessage>;
32
- export declare function settleToolLoopState<TMessage>(state: ToolLoopState<TMessage>, params: {
33
- replayMessages?: readonly TMessage[];
34
- completedToolCallIds?: readonly string[];
35
- lastStopReason?: string;
36
- }): ToolLoopState<TMessage>;
37
- export declare function recoverToolLoopStateFromChatConversation<TMessage extends OpenAiChatMessageLike>(params: {
38
- maxRounds: number;
39
- replayMessages: readonly TMessage[];
40
- round?: number;
41
- lastStopReason?: string;
42
- options?: ConversationRepairOptions;
43
- }): RepairToolLoopStateResult<TMessage>;
44
- export declare function recoverToolLoopStateFromResponsesItems<TItem extends OpenAiResponsesItemLike>(params: {
45
- maxRounds: number;
46
- replayItems: readonly TItem[];
47
- round?: number;
48
- lastStopReason?: string;
49
- options?: ConversationRepairOptions;
50
- }): RepairToolLoopStateResult<TItem>;
@@ -1,39 +0,0 @@
1
- import type { OpenAiToolCall } from "./conversation-repair.js";
2
- export type ToolSchemaProvider = {
3
- modelProvider?: string;
4
- modelId?: string;
5
- };
6
- export interface FunctionToolSource {
7
- name: string;
8
- description?: string;
9
- parameters?: Record<string, unknown>;
10
- }
11
- export interface FunctionToolDefinition {
12
- type: "function";
13
- function: {
14
- name: string;
15
- description?: string;
16
- parameters: Record<string, unknown>;
17
- };
18
- }
19
- export interface CapabilityToolManifestLike {
20
- name: string;
21
- description?: string;
22
- requiredParameters?: string[];
23
- }
24
- export declare function isXaiProvider(modelProvider?: string, modelId?: string): boolean;
25
- export declare function normalizeFunctionToolParameters(parameters: Record<string, unknown> | undefined, options?: ToolSchemaProvider): Record<string, unknown>;
26
- export declare function convertFunctionTools(tools: readonly FunctionToolSource[], options?: ToolSchemaProvider): FunctionToolDefinition[];
27
- export declare function convertCapabilityToolManifestsToFunctionTools(tools: readonly CapabilityToolManifestLike[]): FunctionToolDefinition[];
28
- export declare function normalizeMessageTextContent(content: unknown): string;
29
- export declare function parseOpenAiToolCallsFromChatResponse(responseBody: string): {
30
- toolCalls: OpenAiToolCall[];
31
- responseText: string;
32
- };
33
- export declare function buildAssistantToolCallMessage(toolCalls: OpenAiToolCall[]): Record<string, unknown>;
34
- export declare function buildToolResultMessage(callId: string, result: {
35
- ok: boolean;
36
- payload?: unknown;
37
- error?: string;
38
- }): Record<string, unknown>;
39
- export declare function cleanToolSchemaForGemini(schema: Record<string, unknown>): unknown;
@@ -1,42 +0,0 @@
1
- export type TranscriptMessageLike = {
2
- role?: unknown;
3
- content?: unknown;
4
- stopReason?: unknown;
5
- toolCallId?: unknown;
6
- toolUseId?: unknown;
7
- toolName?: unknown;
8
- details?: unknown;
9
- isError?: unknown;
10
- timestamp?: unknown;
11
- };
12
- export type TranscriptToolCallLike = {
13
- id: string;
14
- name?: string;
15
- };
16
- export type ToolCallInputRepairReport<TMessage extends TranscriptMessageLike> = {
17
- messages: TMessage[];
18
- droppedToolCalls: number;
19
- droppedAssistantMessages: number;
20
- };
21
- export type ToolUseRepairReport<TMessage extends TranscriptMessageLike> = {
22
- messages: TMessage[];
23
- added: TMessage[];
24
- droppedDuplicateCount: number;
25
- droppedOrphanCount: number;
26
- moved: boolean;
27
- };
28
- export type ToolCallInputRepairOptions = {
29
- allowedToolNames?: Iterable<string>;
30
- };
31
- export type ToolUseRepairOptions<TMessage extends TranscriptMessageLike> = {
32
- createMissingToolResult?: (params: {
33
- toolCallId: string;
34
- toolName?: string;
35
- }) => TMessage;
36
- };
37
- export declare function stripToolResultDetails<TMessage extends TranscriptMessageLike>(messages: readonly TMessage[]): TMessage[];
38
- export declare function repairToolCallInputs<TMessage extends TranscriptMessageLike>(messages: readonly TMessage[], options?: ToolCallInputRepairOptions): ToolCallInputRepairReport<TMessage>;
39
- export declare function sanitizeToolCallInputs<TMessage extends TranscriptMessageLike>(messages: readonly TMessage[], options?: ToolCallInputRepairOptions): TMessage[];
40
- export declare function repairToolUseResultPairing<TMessage extends TranscriptMessageLike>(messages: readonly TMessage[], options?: ToolUseRepairOptions<TMessage>): ToolUseRepairReport<TMessage>;
41
- export declare function sanitizeToolUseResultPairing<TMessage extends TranscriptMessageLike>(messages: readonly TMessage[], options?: ToolUseRepairOptions<TMessage>): TMessage[];
42
- export declare function stripTransientErrorMessages<TMessage extends TranscriptMessageLike>(messages: readonly TMessage[]): TMessage[];
@@ -1,86 +0,0 @@
1
- /**
2
- * Turn Loop Guard — Abort signal + token budget warning for preventive termination.
3
- *
4
- * Aligned with Claude Code's multi-condition termination:
5
- * 1. AbortSignal from user cancellation
6
- * 2. Token budget pre-check (don't send API call if over budget)
7
- * 3. max_output_tokens escalation on truncation
8
- * 4. Prompt-too-long reactive compact trigger
9
- */
10
- export interface TurnLoopGuardConfig {
11
- /** Context window size in tokens. */
12
- contextWindowTokens: number;
13
- /** Buffer reserved for response (default: 13000). */
14
- responseBufferTokens: number;
15
- /** Max output tokens for current model. */
16
- maxOutputTokens: number;
17
- /** Abort signal for user cancellation. */
18
- abortSignal?: AbortSignal;
19
- /** Whether reactive compact is available. */
20
- reactiveCompactEnabled: boolean;
21
- /** Whether max_output_tokens escalation is allowed. */
22
- outputEscalationEnabled: boolean;
23
- }
24
- export type TokenWarningState = {
25
- level: "ok";
26
- } | {
27
- level: "warning";
28
- usagePercent: number;
29
- remainingTokens: number;
30
- } | {
31
- level: "blocking";
32
- usagePercent: number;
33
- reason: "prompt_too_long" | "budget_exhausted";
34
- };
35
- export interface TurnLoopGuardState {
36
- /** Current accumulated prompt tokens. */
37
- promptTokens: number;
38
- /** Whether reactive compact has already been attempted this turn. */
39
- hasAttemptedReactiveCompact: boolean;
40
- /** Current max_output_tokens (may escalate). */
41
- currentMaxOutputTokens: number;
42
- /** Number of consecutive max_tokens truncations. */
43
- consecutiveTruncations: number;
44
- /** Whether the turn has been aborted. */
45
- aborted: boolean;
46
- }
47
- /** Initial guard state. */
48
- export declare function createTurnLoopGuardState(config: TurnLoopGuardConfig): TurnLoopGuardState;
49
- /**
50
- * Calculate token warning state before making an API call.
51
- * If level is "blocking", do NOT send the API call.
52
- */
53
- export declare function calculateTokenWarningState(state: TurnLoopGuardState, config: TurnLoopGuardConfig): TokenWarningState;
54
- /**
55
- * Handle API error and determine recovery action.
56
- */
57
- export type ApiErrorRecovery = {
58
- action: "reactive_compact";
59
- } | {
60
- action: "escalate_output_tokens";
61
- newMax: number;
62
- } | {
63
- action: "retry";
64
- reason: string;
65
- } | {
66
- action: "abort";
67
- reason: string;
68
- };
69
- export declare function resolveApiErrorRecovery(error: {
70
- type?: string;
71
- status?: number;
72
- message?: string;
73
- }, state: TurnLoopGuardState, config: TurnLoopGuardConfig): ApiErrorRecovery;
74
- /**
75
- * Handle finish_reason === "max_tokens" — escalate max_output_tokens.
76
- *
77
- * CC pattern: double the output token budget up to model max.
78
- */
79
- export declare function resolveOutputTokenEscalation(state: TurnLoopGuardState, config: TurnLoopGuardConfig, modelMaxOutput: number): {
80
- shouldEscalate: boolean;
81
- newMax: number;
82
- };
83
- /**
84
- * Check if the turn should be aborted (user cancellation).
85
- */
86
- export declare function shouldAbortTurn(state: TurnLoopGuardState, config: TurnLoopGuardConfig): boolean;
@@ -1,17 +0,0 @@
1
- import type { WebCapabilityDescriptorContract, WebCapabilityFamily, WebDegradationTarget, WebEscalationReason, WebTaskMode } from "qlogicagent-runtime-contracts";
2
- export interface ResolveWebBrowserPolicyInput {
3
- capability?: Pick<WebCapabilityDescriptorContract, "capabilityFamily" | "taskMode" | "degradationTarget" | "upgradeTargets" | "escalationReasons" | "supportsLoginState" | "supportsPersistentProfile" | "supportsTransactionality">;
4
- needsInteractiveSession?: boolean;
5
- needsLoginState?: boolean;
6
- needsPersistentSession?: boolean;
7
- needsStateChangingAction?: boolean;
8
- browserAvailable?: boolean;
9
- }
10
- export interface ResolveWebBrowserPolicyResult {
11
- selectedCapabilityFamily: WebCapabilityFamily;
12
- selectedTaskMode?: WebTaskMode;
13
- shouldEscalateToBrowser: boolean;
14
- degradationTarget?: WebDegradationTarget;
15
- escalationReasons: WebEscalationReason[];
16
- }
17
- export declare function resolveWebBrowserPolicy(params: ResolveWebBrowserPolicyInput): ResolveWebBrowserPolicyResult;
@@ -1,61 +0,0 @@
1
- import { ContextEngineRegistry, type CompressibleMessage, type CompressionResult, type CompressionStrategy, type AsyncCompressionStrategy, type SummarizeFn } from "../orchestration/index.js";
2
- import type { HookRegistry } from "./hook-registry.js";
3
- import type { RuntimeLogger } from "./hook-registry.js";
4
- import type { LLMTransport } from "../llm/transport.js";
5
- /** Rough token estimate: ~4 chars per token for mixed CJK/English. */
6
- export declare function estimateTokens(msg: CompressibleMessage): number;
7
- /** Estimate total tokens for a message array. */
8
- export declare function estimateTotalTokens(messages: CompressibleMessage[]): number;
9
- export declare function getCompressionMetrics(): import("../orchestration/context-compression.js").CompressionMetricsSnapshot;
10
- export declare function getContextEngineRegistry(): ContextEngineRegistry;
11
- /**
12
- * Create a summarization callback using an injected LLM transport.
13
- * For CLI mode: uses the same transport that powers the agent loop.
14
- * Falls back to non-LLM summary when transport/apiKey not available.
15
- */
16
- export declare function createSummarizeFn(log: RuntimeLogger, opts?: {
17
- transport?: LLMTransport;
18
- apiKey?: string;
19
- model?: string;
20
- }): SummarizeFn;
21
- /** Phase 1: sync-only pipeline (ToolResultTrim + SlidingWindow) */
22
- export declare function createSyncPipeline(): CompressionStrategy;
23
- /** Phase 2+3: async pipeline with LLM summarization + cache awareness */
24
- export declare function createAsyncPipeline(summarize: SummarizeFn, opts?: {
25
- onCacheInvalidated?: (info: {
26
- droppedCount: number;
27
- strategy: string;
28
- }) => void;
29
- }): AsyncCompressionStrategy;
30
- /** Phase 2.3: incremental compaction pipeline (for partial compact) */
31
- export declare function createIncrementalPipeline(summarize: SummarizeFn, opts?: {
32
- preserveRecentCount?: number;
33
- onCacheInvalidated?: (info: {
34
- droppedCount: number;
35
- strategy: string;
36
- }) => void;
37
- }): AsyncCompressionStrategy;
38
- export interface CompressOptions {
39
- budget?: number;
40
- model?: string;
41
- pipeline?: CompressionStrategy;
42
- allowLlm?: boolean;
43
- summarize?: SummarizeFn;
44
- sessionId?: string;
45
- }
46
- /** Synchronous compression (Phase 1 only). */
47
- export declare function compressMessages(messages: CompressibleMessage[], opts?: CompressOptions): CompressionResult;
48
- /** Async compression (Phase 2+) — supports LLM summarization. */
49
- export declare function compressMessagesAsync(messages: CompressibleMessage[], opts: CompressOptions & {
50
- summarize: SummarizeFn;
51
- }): Promise<CompressionResult>;
52
- export declare function registerDefaultContextEngine(log: RuntimeLogger, opts?: {
53
- transport?: LLMTransport;
54
- apiKey?: string;
55
- model?: string;
56
- }): void;
57
- export declare function registerContextCompressionHook(hooks: HookRegistry, log: RuntimeLogger, opts?: {
58
- transport?: LLMTransport;
59
- apiKey?: string;
60
- model?: string;
61
- }): void;
@@ -1,12 +0,0 @@
1
- import type { HookPoint, HookContextMap, HookResult, HookHandler, HookRegistration, HookRegistry } from "../contracts/hooks.js";
2
- export type { HookPoint, HookContextMap, HookResult, HookHandler, HookRegistration, HookRegistry };
3
- /** Minimal logger interface — compatible with both pino and AgentLogger. */
4
- export interface RuntimeLogger {
5
- info(msg: string): void;
6
- info(obj: Record<string, unknown>, msg: string): void;
7
- warn(msg: string): void;
8
- warn(obj: Record<string, unknown>, msg: string): void;
9
- debug(msg: string): void;
10
- debug(obj: Record<string, unknown>, msg: string): void;
11
- }
12
- export declare function createHookRegistry(log: RuntimeLogger): HookRegistry;
@@ -1,23 +0,0 @@
1
- import type { HookRegistry } from "../contracts/hooks.js";
2
- import type { MemoryProvider } from "qlogicagent-runtime-contracts";
3
- export interface MemoryHooksDeps {
4
- /** QMemory adapter (MemoryProvider with search/health). */
5
- memoryProvider?: MemoryProvider;
6
- /** User ID for memory lookups. */
7
- userId: string;
8
- /** Logger. */
9
- log: {
10
- debug(msg: string): void;
11
- warn(msg: string): void;
12
- };
13
- }
14
- /**
15
- * Register memory lifecycle hooks on the HookRegistry.
16
- *
17
- * Hook points wired:
18
- * - memory.before_recall: prefetch context from qmemory (query-based)
19
- * - memory.after_recall: log recall results
20
- *
21
- * Returns a cleanup function to unregister.
22
- */
23
- export declare function registerMemoryHooks(hooks: HookRegistry, deps: MemoryHooksDeps): () => void;
@@ -1,59 +0,0 @@
1
- /**
2
- * Tool eligibility resolver for CLI subprocess mode.
3
- *
4
- * Ported from src/core/runtime/tool-eligibility.ts, replacing Hub's
5
- * StoredGatewayCapabilitySnapshot with CLI's ToolDefinition[] from agent.turn.
6
- *
7
- * Core decision logic preserved:
8
- * - Policy blocked (explicit block list)
9
- * - Approval required (meta.requiresApproval / meta.isDangerous)
10
- * - Read-only / safe tools (meta.isReadOnly → skip approval even in strict)
11
- * - All tools from Gateway manifest are considered enabled & reachable
12
- * (Gateway only sends available tools)
13
- *
14
- * Zero imports from express/pg/ioredis/ws.
15
- */
16
- import type { ToolDefinition } from "../agent/types.js";
17
- /**
18
- * Tool permission levels aligned with Claude Code's permission model:
19
- *
20
- * Level 1 — always-allow: isReadOnly tools (e.g. read_file, search)
21
- * Level 2 — default-allow: normal tools with no risk markers
22
- * Level 3 — notify: isDangerous tools → emit tool_blocked warning but allow
23
- * Level 4 — ask: requiresApproval tools → hook can block, emit approval.requested
24
- * Level 5 — never-allow: explicitly blocked by policy
25
- */
26
- export type PermissionLevel = 1 | 2 | 3 | 4 | 5;
27
- export type ToolEligibilityStatus = "eligible" | "approval-required" | "blocked-by-policy" | "dangerous-notify";
28
- export type ToolEligibilityReasonCode = "policy_blocked" | "approval_required" | "dangerous_tool" | "always_allowed";
29
- export interface ToolEligibilityEntry {
30
- toolName: string;
31
- status: ToolEligibilityStatus;
32
- permissionLevel: PermissionLevel;
33
- approvalRequired: boolean;
34
- reasonCodes: ToolEligibilityReasonCode[];
35
- }
36
- export interface ToolEligibilityContext {
37
- /** Explicitly blocked tool names (e.g. from config or policy) */
38
- blockedToolNames?: string[];
39
- /** Dangerous tool name patterns (regex strings) for pattern-based detection */
40
- dangerousPatterns?: string[];
41
- }
42
- export interface ToolEligibilityResult {
43
- /** Tools eligible for execution (includes approval-required ones) */
44
- eligibleTools: ToolDefinition[];
45
- /** Tools blocked by policy (removed from LLM tool list) */
46
- blockedTools: ToolEligibilityEntry[];
47
- /** Tools needing approval before execution */
48
- approvalRequiredTools: ToolEligibilityEntry[];
49
- /** Full eligibility map by tool name */
50
- eligibilityByName: Map<string, ToolEligibilityEntry>;
51
- }
52
- /**
53
- * Resolve tool eligibility for a set of tools from agent.turn.
54
- *
55
- * Returns filtered tool lists and eligibility metadata.
56
- * Blocked tools are removed from the eligible list (not sent to LLM).
57
- * Approval-required tools remain in the list but flagged for hook interception.
58
- */
59
- export declare function resolveToolEligibility(tools: ToolDefinition[], context?: ToolEligibilityContext): ToolEligibilityResult;
@@ -1,108 +0,0 @@
1
- export type { PortableTool, PortableToolResult, ToolContentBlock, } from "./portable-tool.js";
2
- export { MEMORY_TOOL_NAME, MEMORY_TOOL_MAX_CONTENT_LENGTH, MEMORY_TOOL_ACTIONS, MEMORY_TOOL_SCHEMA, MEMORY_TOOL_DESCRIPTION, MEMORY_TOOL_LABEL, isMemoryContentSafe, executeMemoryTool, } from "./memory-tool.js";
3
- export type { MemoryToolAction, MemoryToolParams, MemoryToolResult, MemoryToolExecutorDeps, } from "./memory-tool.js";
4
- export { MemoryStore, MEMORY_ENTRY_DELIMITER, DEFAULT_MEMORY_CHAR_LIMIT, DEFAULT_USER_CHAR_LIMIT, } from "./memory-store.js";
5
- export type { MemoryStoreTarget, MemoryStoreResult, MemoryStoreOptions, MemoryStoreSerialized, } from "./memory-store.js";
6
- export { createQMemoryAdapter } from "./qmemory-adapter.js";
7
- export type { QMemoryAdapterConfig, QMemoryHealthStatus, ExtractedMemoryItem } from "./qmemory-adapter.js";
8
- export { createMemoryExtractor } from "./memory-extractor.js";
9
- export type { ExtractedMemory, ProfileUpdate, ExtractionResult, ExtractionCompleteFn, MemoryExtractorOptions, } from "./memory-extractor.js";
10
- export { THINK_TOOL_NAME, THINK_TOOL_SCHEMA, createThinkTool } from "./think-tool.js";
11
- export type { ThinkToolParams } from "./think-tool.js";
12
- export { TODO_TOOL_NAME, TODO_TOOL_SCHEMA, createTodoTool } from "./todo-tool.js";
13
- export type { TodoToolParams, TodoToolOptions } from "./todo-tool.js";
14
- export { MEMORY_QUERY_TOOL_NAME, MEMORY_QUERY_TOOL_SCHEMA, createMemoryQueryTool, } from "./memory-query-tool.js";
15
- export type { MemoryQueryToolParams, MemoryQueryToolDeps, MediaPreferencesSummary, } from "./memory-query-tool.js";
16
- export { READ_TOOL_NAME, READ_TOOL_SCHEMA, createReadTool } from "./tools/read-tool.js";
17
- export type { ReadToolParams, ReadToolDeps, ReadResultType } from "./tools/read-tool.js";
18
- export { WRITE_TOOL_NAME, WRITE_TOOL_SCHEMA, createWriteTool } from "./tools/write-tool.js";
19
- export type { WriteToolParams, WriteToolDeps } from "./tools/write-tool.js";
20
- export { EDIT_TOOL_NAME, EDIT_TOOL_SCHEMA, createEditTool } from "./tools/edit-tool.js";
21
- export type { EditToolParams, EditToolDeps } from "./tools/edit-tool.js";
22
- export { APPLY_PATCH_TOOL_NAME, APPLY_PATCH_TOOL_SCHEMA, createApplyPatchTool } from "./tools/apply-patch-tool.js";
23
- export type { ApplyPatchToolParams, ApplyPatchToolDeps, ApplyPatchSummary } from "./tools/apply-patch-tool.js";
24
- export { PDF_TOOL_NAME, PDF_TOOL_SCHEMA, createPdfTool } from "./tools/pdf-tool.js";
25
- export type { PdfToolParams, PdfToolDeps } from "./tools/pdf-tool.js";
26
- export { EXEC_TOOL_NAME, EXEC_TOOL_SCHEMA, createExecTool } from "./tools/exec-tool.js";
27
- export type { ExecToolParams, ExecToolDeps, ExecResult, BackgroundExecResult } from "./tools/exec-tool.js";
28
- export { SEARCH_TOOL_NAME, SEARCH_TOOL_SCHEMA, createSearchTool } from "./tools/search-tool.js";
29
- export type { SearchToolParams, SearchToolDeps, SearchMode, SearchOutput, SearchFileResult, SearchContentResult, } from "./tools/search-tool.js";
30
- export { IMAGE_GENERATE_TOOL_NAME, IMAGE_GENERATE_TOOL_SCHEMA, createImageGenerateTool } from "./tools/image-generate-tool.js";
31
- export type { ImageGenerateToolParams, ImageGenerateToolDeps, ImageGenerateResult } from "./tools/image-generate-tool.js";
32
- export { VIDEO_GENERATE_TOOL_NAME, VIDEO_GENERATE_TOOL_SCHEMA, createVideoGenerateTool } from "./tools/video-generate-tool.js";
33
- export type { VideoGenerateToolParams, VideoGenerateToolDeps, VideoGenerateResult } from "./tools/video-generate-tool.js";
34
- export { VIDEO_MERGE_TOOL_NAME, VIDEO_MERGE_TOOL_SCHEMA, createVideoMergeTool } from "./tools/video-merge-tool.js";
35
- export type { VideoMergeToolParams, VideoMergeToolDeps, VideoMergeClip, VideoMergeResult } from "./tools/video-merge-tool.js";
36
- export { VIDEO_UPSCALE_TOOL_NAME, VIDEO_UPSCALE_TOOL_SCHEMA, createVideoUpscaleTool } from "./tools/video-upscale-tool.js";
37
- export type { VideoUpscaleToolParams, VideoUpscaleToolDeps, VideoUpscaleResult } from "./tools/video-upscale-tool.js";
38
- export { VIDEO_EDIT_TOOL_NAME, VIDEO_EDIT_TOOL_SCHEMA, createVideoEditTool } from "./tools/video-edit-tool.js";
39
- export type { VideoEditToolParams, VideoEditToolDeps, VideoEditResult } from "./tools/video-edit-tool.js";
40
- export { MUSIC_GENERATE_TOOL_NAME, MUSIC_GENERATE_TOOL_SCHEMA, createMusicGenerateTool } from "./tools/music-generate-tool.js";
41
- export type { MusicGenerateToolParams, MusicGenerateToolDeps, MusicGenerateResult } from "./tools/music-generate-tool.js";
42
- export { TTS_TOOL_NAME, TTS_TOOL_SCHEMA, createTtsTool } from "./tools/tts-tool.js";
43
- export type { TtsToolParams, TtsToolDeps, TtsResult } from "./tools/tts-tool.js";
44
- export { WEB_FETCH_TOOL_NAME, WEB_FETCH_TOOL_SCHEMA, createWebFetchTool } from "./tools/web-fetch-tool.js";
45
- export type { WebFetchToolParams, WebFetchToolDeps, WebFetchResult } from "./tools/web-fetch-tool.js";
46
- export { WEB_SEARCH_TOOL_NAME, WEB_SEARCH_TOOL_SCHEMA, createWebSearchTool } from "./tools/web-search-tool.js";
47
- export type { WebSearchToolParams, WebSearchToolDeps, WebSearchResult, WebSearchOutput } from "./tools/web-search-tool.js";
48
- export { ASK_USER_TOOL_NAME, ASK_USER_TOOL_SCHEMA, createAskUserTool } from "./tools/ask-user-tool.js";
49
- export type { AskUserToolParams, AskUserToolDeps, AskUserQuestion, AskUserOption, AskUserAnswer } from "./tools/ask-user-tool.js";
50
- export { BRIEF_TOOL_NAME, BRIEF_TOOL_SCHEMA, createBriefTool } from "./tools/brief-tool.js";
51
- export type { BriefToolParams, BriefToolDeps, BriefMessageStatus, BriefAttachment, BriefDeliveryResult, BriefModeConfig, } from "./tools/brief-tool.js";
52
- export { TOOL_SEARCH_TOOL_NAME, TOOL_SEARCH_TOOL_SCHEMA, createToolSearchTool } from "./tools/tool-search-tool.js";
53
- export type { ToolSearchToolParams, ToolSearchToolDeps, DeferredToolInfo, ToolSearchOutput } from "./tools/tool-search-tool.js";
54
- export { SKILL_LIST_TOOL_NAME, SKILL_LIST_TOOL_SCHEMA, createSkillListTool } from "./tools/skill-list-tool.js";
55
- export type { SkillListToolParams, SkillListToolDeps, SkillListItem, SkillListOutput } from "./tools/skill-list-tool.js";
56
- export { SKILL_VIEW_TOOL_NAME, SKILL_VIEW_TOOL_SCHEMA, createSkillViewTool } from "./tools/skill-view-tool.js";
57
- export type { SkillViewToolParams, SkillViewToolDeps, SkillViewOutput } from "./tools/skill-view-tool.js";
58
- export { SKILL_MANAGE_TOOL_NAME, SKILL_MANAGE_TOOL_SCHEMA, createSkillManageTool } from "./tools/skill-manage-tool.js";
59
- export type { SkillManageToolParams, SkillManageToolDeps, SkillManageResult, SkillManageAction } from "./tools/skill-manage-tool.js";
60
- export { PATCH_TOOL_NAME, PATCH_TOOL_SCHEMA, createPatchTool, fuzzyFind } from "./tools/patch-tool.js";
61
- export type { PatchToolParams, PatchToolDeps, PatchResult, MatchStrategy, MatchResult } from "./tools/patch-tool.js";
62
- export { AGENT_TOOL_NAME, AGENT_TOOL_SCHEMA, createAgentTool } from "./tools/agent-tool.js";
63
- export type { AgentToolParams, AgentToolDeps, AgentResult } from "./tools/agent-tool.js";
64
- export { TASK_TOOL_NAME, TASK_TOOL_SCHEMA, createTaskTool } from "./tools/task-tool.js";
65
- export type { TaskToolParams, TaskToolDeps, TaskInfo, TaskResult, TaskAction, TaskStatus } from "./tools/task-tool.js";
66
- export { REPL_TOOL_NAME, REPL_TOOL_SCHEMA, REPL_HIDES_TOOLS, createReplTool } from "./tools/repl-tool.js";
67
- export type { ReplToolParams, ReplToolDeps, ReplPrimitives, ReplExecResult } from "./tools/repl-tool.js";
68
- export { BROWSER_TOOL_NAME, BROWSER_TOOL_SCHEMA, createBrowserTool } from "./tools/browser-tool.js";
69
- export type { BrowserToolParams, BrowserToolDeps, BrowserAction, BrowserSnapshot, BrowserScreenshot } from "./tools/browser-tool.js";
70
- export { CRON_TOOL_NAME, CRON_TOOL_SCHEMA, MAX_CRON_JOBS, createCronTool } from "./tools/cron-tool.js";
71
- export type { CronToolParams, CronToolDeps, CronJob, CronResult, CronAction } from "./tools/cron-tool.js";
72
- export { MEMORY_SEARCH_TOOL_NAME, MEMORY_SEARCH_TOOL_SCHEMA, createMemorySearchTool } from "./tools/memory-tool.js";
73
- export type { MemorySearchToolParams, MemorySearchToolDeps, MemoryEntry, MemoryQueryOutput, MemorySource } from "./tools/memory-tool.js";
74
- export { CHECKPOINT_TOOL_NAME, CHECKPOINT_TOOL_SCHEMA, createCheckpointTool } from "./tools/checkpoint-tool.js";
75
- export type { CheckpointToolParams, CheckpointToolDeps, Checkpoint, CheckpointResult, CheckpointAction } from "./tools/checkpoint-tool.js";
76
- export { NOTIFY_TOOL_NAME, NOTIFY_TOOL_SCHEMA, createNotifyTool } from "./tools/notify-tool.js";
77
- export type { NotifyToolParams, NotifyToolDeps, NotifyResult } from "./tools/notify-tool.js";
78
- export { SEND_MESSAGE_TOOL_NAME, SEND_MESSAGE_TOOL_SCHEMA, createSendMessageTool } from "./tools/send-message-tool.js";
79
- export type { SendMessageToolParams, SendMessageToolDeps, SendMessageResult } from "./tools/send-message-tool.js";
80
- export { TEAM_TOOL_NAME, TEAM_TOOL_SCHEMA, createTeamTool } from "./tools/team-tool.js";
81
- export type { TeamToolParams, TeamToolDeps, TeamMember, Team, TeamResult, TeamAction } from "./tools/team-tool.js";
82
- export { LSP_TOOL_NAME, LSP_TOOL_SCHEMA, createLspTool } from "./tools/lsp-tool.js";
83
- export type { LspToolParams, LspToolDeps, LspOperation, LspLocation, LspSymbol, LspDiagnostic, LspHoverInfo, LspCompletion, LspRenameEdit, LspCodeAction, LspResult } from "./tools/lsp-tool.js";
84
- export { PLAN_MODE_TOOL_NAME, PLAN_MODE_TOOL_SCHEMA, PLAN_MODE_ALLOWED_TOOLS, createPlanModeTool } from "./tools/plan-mode-tool.js";
85
- export type { PlanModeToolParams, PlanModeToolDeps, PlanModeAction, PlanModeState, PlanModeResult } from "./tools/plan-mode-tool.js";
86
- export { WORKTREE_TOOL_NAME, WORKTREE_TOOL_SCHEMA, createWorktreeTool } from "./tools/worktree-tool.js";
87
- export type { WorktreeToolParams, WorktreeToolDeps, WorktreeAction, WorktreeInfo, WorktreeResult } from "./tools/worktree-tool.js";
88
- export { MCP_TOOL_NAME, MCP_TOOL_SCHEMA, createMcpTool, createMcpAuthProxy } from "./tools/mcp-tool.js";
89
- export { normalizeNameForMcp, buildMcpToolName, getMcpServerPrefix, parseMcpToolName, isMcpToolName, MCP_CONNECTION_TIMEOUT_MS, MCP_REQUEST_TIMEOUT_MS, MCP_TOOL_CALL_TIMEOUT_MS, MCP_MAX_RECONNECT_ATTEMPTS, MCP_MAX_DESCRIPTION_LENGTH, } from "./tools/mcp-tool.js";
90
- export type { McpToolParams, McpToolDeps, McpAction, McpManageAction, McpServer, McpToolInfo, McpResource, McpResourceContent, McpCallResult, McpAuthResult, McpPromptResult, McpManageResult, McpAuthProxyDeps, McpServerConfig, McpStdioConfig, McpSseConfig, McpHttpConfig, McpWsConfig, McpInProcessConfig, McpServerState, McpConnectionStatus, McpServerCapabilities, McpExternalTool, McpToolAnnotations, McpToolIdentifier, McpToolsChangedEvent, McpResourceDefinition, McpResourceTemplate, McpPersistedResourceContent, McpPromptDefinition, McpPromptMessage, McpPromptArgument, McpPromptContent, McpElicitResult, McpElicitRequest, McpOAuthConfig, McpOAuthTokens, McpAuthState, McpLogEntry, McpLogLevel, McpTransportType, } from "./tools/mcp-tool.js";
91
- export type { McpResourceContentItem, } from "./tools/mcp-client-types.js";
92
- export { CONFIG_TOOL_NAME, CONFIG_TOOL_SCHEMA, CONFIG_READONLY_KEYS, createConfigTool } from "./tools/config-tool.js";
93
- export type { ConfigToolParams, ConfigToolDeps, ConfigAction, ConfigSetting, ConfigResult } from "./tools/config-tool.js";
94
- export { SLEEP_TOOL_NAME, SLEEP_TOOL_SCHEMA, createSleepTool } from "./tools/sleep-tool.js";
95
- export type { SleepToolParams, SleepToolDeps, SleepResult } from "./tools/sleep-tool.js";
96
- export { MONITOR_TOOL_NAME, MONITOR_TOOL_SCHEMA, createMonitorTool } from "./tools/monitor-tool.js";
97
- export type { MonitorToolParams, MonitorToolDeps, MonitorSource, MonitorAction, MonitorCondition, MonitorInfo, MonitorResult, } from "./tools/monitor-tool.js";
98
- export { STRUCTURED_OUTPUT_TOOL_NAME, STRUCTURED_OUTPUT_TOOL_SCHEMA, STRUCTURED_OUTPUT_MAX_CHARS, createStructuredOutputTool, createConfiguredStructuredOutputTool, isStructuredOutputEnabled, } from "./tools/structured-output-tool.js";
99
- export type { StructuredOutputToolParams, StructuredOutputToolDeps, StructuredOutputResult, SchemaValidationError, ConfiguredToolResult, SchemaCompiler, } from "./tools/structured-output-tool.js";
100
- export { INSTRUCTIONS_LIST_TOOL_NAME, INSTRUCTIONS_LIST_SCHEMA, createInstructionsListTool, INSTRUCTIONS_READ_TOOL_NAME, INSTRUCTIONS_READ_SCHEMA, createInstructionsReadTool, INSTRUCTIONS_WRITE_TOOL_NAME, INSTRUCTIONS_WRITE_SCHEMA, createInstructionsWriteTool, INSTRUCTIONS_DELETE_TOOL_NAME, INSTRUCTIONS_DELETE_SCHEMA, createInstructionsDeleteTool, } from "./tools/instructions-tool.js";
101
- export type { InstructionFileInfo, InstructionFileContent, InstructionsToolDeps, InstructionsListParams, InstructionsReadParams, InstructionsWriteParams, InstructionsDeleteParams, } from "./tools/instructions-tool.js";
102
- export type { ParsedSkillFrontmatter, WorkspaceSkill, SkillInstallSpec, SkillMetadata, SkillInvocationPolicy, SkillEntry, SkillCommandDispatchSpec, SkillCommandSpec, SkillSnapshot, SkillScanSeverity, SkillScanFinding, SkillScanSummary, SkillScanOptions, SkillFsDeps, SkillPathDeps, SkillLoadLimits, SkillSearchPaths, SkillLoaderDeps, } from "./skill-types.js";
103
- export { parseFrontmatter, resolveSkillMetadata, resolveSkillInvocationPolicy, resolveSkillKey, } from "./skill-frontmatter.js";
104
- export { loadSkillEntries, filterSkillEntries, buildSkillSnapshot, } from "./skill-loader.js";
105
- export { scanSource, scanSkillDirectory, hasCriticalFindings, isScannable, } from "./skill-guard.js";
106
- export type { SkillGuardDeps } from "./skill-guard.js";
107
- export { installSkill, uninstallSkill, createEmptyLockfile, } from "./skill-source.js";
108
- export type { TrustLevel, ScanVerdict, SkillSourceDescriptor, SkillFetchResult, SkillFetchDeps, SkillStorageDeps, SkillLockEntry, SkillLockfile, SkillInstallResult, } from "./skill-source.js";
@@ -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-chat"). */
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
- };