qlogicagent 0.2.1 → 0.3.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.js +1 -0
- package/dist/cli.js +9 -0
- package/dist/contracts.js +1 -0
- package/dist/index.js +5 -15
- package/dist/orchestration.js +118 -0
- package/package.json +56 -42
- package/dist/agent/agent.js +0 -113
- package/dist/agent/tool-loop.js +0 -575
- package/dist/agent/types.js +0 -14
- package/dist/cli/main.js +0 -23
- package/dist/cli/stdio-server.js +0 -463
- package/dist/config/config.js +0 -21
- package/dist/contracts/hooks.js +0 -7
- package/dist/contracts/index.js +0 -10
- package/dist/contracts/planner.js +0 -2
- package/dist/contracts/skill-candidate.js +0 -195
- package/dist/contracts/todo.js +0 -9
- package/dist/llm/builtin-providers.js +0 -531
- package/dist/llm/index.js +0 -14
- package/dist/llm/llm-client.js +0 -67
- package/dist/llm/model-catalog.js +0 -191
- package/dist/llm/provider-def.js +0 -12
- package/dist/llm/provider-registry.js +0 -147
- package/dist/llm/transport.js +0 -27
- package/dist/llm/transports/anthropic-messages.js +0 -293
- package/dist/llm/transports/openai-chat.js +0 -165
- package/dist/orchestration/agent-registry.js +0 -116
- package/dist/orchestration/approval-aware-tool-plan.js +0 -87
- package/dist/orchestration/context-compression.js +0 -583
- package/dist/orchestration/conversation-repair.js +0 -429
- package/dist/orchestration/curator-scheduler.js +0 -135
- package/dist/orchestration/embedded-failover-policy.js +0 -168
- package/dist/orchestration/error-classification.js +0 -77
- package/dist/orchestration/failover-classification.js +0 -381
- package/dist/orchestration/failover-error.js +0 -198
- package/dist/orchestration/fork-subagent.js +0 -98
- package/dist/orchestration/index.js +0 -267
- package/dist/orchestration/memory-flush-policy.js +0 -85
- package/dist/orchestration/memory-provider.js +0 -2
- package/dist/orchestration/parallel-tool-calls.js +0 -59
- package/dist/orchestration/prompt-cache-strategy.js +0 -228
- package/dist/orchestration/reactive-compact.js +0 -78
- package/dist/orchestration/retry-loop.js +0 -24
- package/dist/orchestration/skill-candidate.js +0 -141
- package/dist/orchestration/skill-consolidation.js +0 -220
- package/dist/orchestration/skill-improvement.js +0 -66
- package/dist/orchestration/skill-similarity.js +0 -131
- package/dist/orchestration/streaming-tool-executor.js +0 -96
- package/dist/orchestration/team-orchestration.js +0 -369
- package/dist/orchestration/team-tool-loop-wiring.js +0 -147
- package/dist/orchestration/tool-choice-policy.js +0 -164
- package/dist/orchestration/tool-loop-state.js +0 -133
- package/dist/orchestration/tool-schema.js +0 -297
- package/dist/orchestration/transcript-repair.js +0 -426
- package/dist/orchestration/turn-loop-guard.js +0 -92
- package/dist/orchestration/web-browser-policy.js +0 -39
- package/dist/runtime/context-compression.js +0 -274
- package/dist/runtime/hook-registry.js +0 -53
- package/dist/runtime/memory-hooks.js +0 -65
- package/dist/runtime/tool-eligibility.js +0 -111
- package/dist/skills/index.js +0 -82
- package/dist/skills/memory-extractor.js +0 -173
- package/dist/skills/memory-query-tool.js +0 -127
- package/dist/skills/memory-store.js +0 -228
- package/dist/skills/memory-tool.js +0 -192
- package/dist/skills/portable-tool.js +0 -14
- package/dist/skills/qmemory-adapter.js +0 -165
- package/dist/skills/skill-frontmatter.js +0 -344
- package/dist/skills/skill-guard.js +0 -229
- package/dist/skills/skill-loader.js +0 -303
- package/dist/skills/skill-source.js +0 -126
- package/dist/skills/skill-types.js +0 -6
- package/dist/skills/think-tool.js +0 -59
- package/dist/skills/todo-tool.js +0 -114
- package/dist/skills/tools/agent-tool.js +0 -142
- package/dist/skills/tools/apply-patch-tool.js +0 -184
- package/dist/skills/tools/ask-user-tool.js +0 -121
- package/dist/skills/tools/brief-tool.js +0 -95
- package/dist/skills/tools/browser-tool.js +0 -155
- package/dist/skills/tools/checkpoint-tool.js +0 -102
- package/dist/skills/tools/config-tool.js +0 -143
- package/dist/skills/tools/cron-tool.js +0 -175
- package/dist/skills/tools/edit-tool.js +0 -70
- package/dist/skills/tools/exec-tool.js +0 -133
- package/dist/skills/tools/image-generate-tool.js +0 -67
- package/dist/skills/tools/instructions-tool.js +0 -187
- package/dist/skills/tools/lsp-tool.js +0 -227
- package/dist/skills/tools/mcp-client-types.js +0 -53
- package/dist/skills/tools/mcp-tool.js +0 -503
- package/dist/skills/tools/memory-tool.js +0 -88
- package/dist/skills/tools/monitor-tool.js +0 -131
- package/dist/skills/tools/music-generate-tool.js +0 -62
- package/dist/skills/tools/notify-tool.js +0 -62
- package/dist/skills/tools/patch-tool.js +0 -505
- package/dist/skills/tools/pdf-tool.js +0 -88
- package/dist/skills/tools/plan-mode-tool.js +0 -122
- package/dist/skills/tools/read-tool.js +0 -84
- package/dist/skills/tools/repl-tool.js +0 -69
- package/dist/skills/tools/search-tool.js +0 -225
- package/dist/skills/tools/send-message-tool.js +0 -76
- package/dist/skills/tools/skill-list-tool.js +0 -54
- package/dist/skills/tools/skill-manage-tool.js +0 -153
- package/dist/skills/tools/skill-view-tool.js +0 -72
- package/dist/skills/tools/sleep-tool.js +0 -81
- package/dist/skills/tools/structured-output-tool.js +0 -176
- package/dist/skills/tools/task-tool.js +0 -161
- package/dist/skills/tools/team-tool.js +0 -105
- package/dist/skills/tools/tool-search-tool.js +0 -110
- package/dist/skills/tools/tts-tool.js +0 -45
- package/dist/skills/tools/video-edit-tool.js +0 -74
- package/dist/skills/tools/video-generate-tool.js +0 -66
- package/dist/skills/tools/video-merge-tool.js +0 -92
- package/dist/skills/tools/video-upscale-tool.js +0 -52
- package/dist/skills/tools/web-fetch-tool.js +0 -92
- package/dist/skills/tools/web-search-tool.js +0 -86
- package/dist/skills/tools/worktree-tool.js +0 -147
- package/dist/skills/tools/write-tool.js +0 -81
- /package/dist/{agent → types/agent}/agent.d.ts +0 -0
- /package/dist/{agent → types/agent}/tool-loop.d.ts +0 -0
- /package/dist/{agent → types/agent}/types.d.ts +0 -0
- /package/dist/{cli → types/cli}/main.d.ts +0 -0
- /package/dist/{cli → types/cli}/stdio-server.d.ts +0 -0
- /package/dist/{config → types/config}/config.d.ts +0 -0
- /package/dist/{contracts → types/contracts}/hooks.d.ts +0 -0
- /package/dist/{contracts → types/contracts}/index.d.ts +0 -0
- /package/dist/{contracts → types/contracts}/planner.d.ts +0 -0
- /package/dist/{contracts → types/contracts}/skill-candidate.d.ts +0 -0
- /package/dist/{contracts → types/contracts}/todo.d.ts +0 -0
- /package/dist/{index.d.ts → types/index.d.ts} +0 -0
- /package/dist/{llm → types/llm}/builtin-providers.d.ts +0 -0
- /package/dist/{llm → types/llm}/index.d.ts +0 -0
- /package/dist/{llm → types/llm}/llm-client.d.ts +0 -0
- /package/dist/{llm → types/llm}/model-catalog.d.ts +0 -0
- /package/dist/{llm → types/llm}/provider-def.d.ts +0 -0
- /package/dist/{llm → types/llm}/provider-registry.d.ts +0 -0
- /package/dist/{llm → types/llm}/transport.d.ts +0 -0
- /package/dist/{llm → types/llm}/transports/anthropic-messages.d.ts +0 -0
- /package/dist/{llm → types/llm}/transports/openai-chat.d.ts +0 -0
- /package/dist/{orchestration → types/orchestration}/agent-registry.d.ts +0 -0
- /package/dist/{orchestration → types/orchestration}/approval-aware-tool-plan.d.ts +0 -0
- /package/dist/{orchestration → types/orchestration}/context-compression.d.ts +0 -0
- /package/dist/{orchestration → types/orchestration}/conversation-repair.d.ts +0 -0
- /package/dist/{orchestration → types/orchestration}/curator-scheduler.d.ts +0 -0
- /package/dist/{orchestration → types/orchestration}/embedded-failover-policy.d.ts +0 -0
- /package/dist/{orchestration → types/orchestration}/error-classification.d.ts +0 -0
- /package/dist/{orchestration → types/orchestration}/failover-classification.d.ts +0 -0
- /package/dist/{orchestration → types/orchestration}/failover-error.d.ts +0 -0
- /package/dist/{orchestration → types/orchestration}/fork-subagent.d.ts +0 -0
- /package/dist/{orchestration → types/orchestration}/index.d.ts +0 -0
- /package/dist/{orchestration → types/orchestration}/memory-flush-policy.d.ts +0 -0
- /package/dist/{orchestration → types/orchestration}/memory-provider.d.ts +0 -0
- /package/dist/{orchestration → types/orchestration}/parallel-tool-calls.d.ts +0 -0
- /package/dist/{orchestration → types/orchestration}/prompt-cache-strategy.d.ts +0 -0
- /package/dist/{orchestration → types/orchestration}/reactive-compact.d.ts +0 -0
- /package/dist/{orchestration → types/orchestration}/retry-loop.d.ts +0 -0
- /package/dist/{orchestration → types/orchestration}/skill-candidate.d.ts +0 -0
- /package/dist/{orchestration → types/orchestration}/skill-consolidation.d.ts +0 -0
- /package/dist/{orchestration → types/orchestration}/skill-improvement.d.ts +0 -0
- /package/dist/{orchestration → types/orchestration}/skill-similarity.d.ts +0 -0
- /package/dist/{orchestration → types/orchestration}/streaming-tool-executor.d.ts +0 -0
- /package/dist/{orchestration → types/orchestration}/team-orchestration.d.ts +0 -0
- /package/dist/{orchestration → types/orchestration}/team-tool-loop-wiring.d.ts +0 -0
- /package/dist/{orchestration → types/orchestration}/tool-choice-policy.d.ts +0 -0
- /package/dist/{orchestration → types/orchestration}/tool-loop-state.d.ts +0 -0
- /package/dist/{orchestration → types/orchestration}/tool-schema.d.ts +0 -0
- /package/dist/{orchestration → types/orchestration}/transcript-repair.d.ts +0 -0
- /package/dist/{orchestration → types/orchestration}/turn-loop-guard.d.ts +0 -0
- /package/dist/{orchestration → types/orchestration}/web-browser-policy.d.ts +0 -0
- /package/dist/{runtime → types/runtime}/context-compression.d.ts +0 -0
- /package/dist/{runtime → types/runtime}/hook-registry.d.ts +0 -0
- /package/dist/{runtime → types/runtime}/memory-hooks.d.ts +0 -0
- /package/dist/{runtime → types/runtime}/tool-eligibility.d.ts +0 -0
- /package/dist/{skills → types/skills}/index.d.ts +0 -0
- /package/dist/{skills → types/skills}/memory-extractor.d.ts +0 -0
- /package/dist/{skills → types/skills}/memory-query-tool.d.ts +0 -0
- /package/dist/{skills → types/skills}/memory-store.d.ts +0 -0
- /package/dist/{skills → types/skills}/memory-tool.d.ts +0 -0
- /package/dist/{skills → types/skills}/portable-tool.d.ts +0 -0
- /package/dist/{skills → types/skills}/qmemory-adapter.d.ts +0 -0
- /package/dist/{skills → types/skills}/skill-frontmatter.d.ts +0 -0
- /package/dist/{skills → types/skills}/skill-guard.d.ts +0 -0
- /package/dist/{skills → types/skills}/skill-loader.d.ts +0 -0
- /package/dist/{skills → types/skills}/skill-source.d.ts +0 -0
- /package/dist/{skills → types/skills}/skill-types.d.ts +0 -0
- /package/dist/{skills → types/skills}/think-tool.d.ts +0 -0
- /package/dist/{skills → types/skills}/todo-tool.d.ts +0 -0
- /package/dist/{skills → types/skills}/tools/agent-tool.d.ts +0 -0
- /package/dist/{skills → types/skills}/tools/apply-patch-tool.d.ts +0 -0
- /package/dist/{skills → types/skills}/tools/ask-user-tool.d.ts +0 -0
- /package/dist/{skills → types/skills}/tools/brief-tool.d.ts +0 -0
- /package/dist/{skills → types/skills}/tools/browser-tool.d.ts +0 -0
- /package/dist/{skills → types/skills}/tools/checkpoint-tool.d.ts +0 -0
- /package/dist/{skills → types/skills}/tools/config-tool.d.ts +0 -0
- /package/dist/{skills → types/skills}/tools/cron-tool.d.ts +0 -0
- /package/dist/{skills → types/skills}/tools/edit-tool.d.ts +0 -0
- /package/dist/{skills → types/skills}/tools/exec-tool.d.ts +0 -0
- /package/dist/{skills → types/skills}/tools/image-generate-tool.d.ts +0 -0
- /package/dist/{skills → types/skills}/tools/instructions-tool.d.ts +0 -0
- /package/dist/{skills → types/skills}/tools/lsp-tool.d.ts +0 -0
- /package/dist/{skills → types/skills}/tools/mcp-client-types.d.ts +0 -0
- /package/dist/{skills → types/skills}/tools/mcp-tool.d.ts +0 -0
- /package/dist/{skills → types/skills}/tools/memory-tool.d.ts +0 -0
- /package/dist/{skills → types/skills}/tools/monitor-tool.d.ts +0 -0
- /package/dist/{skills → types/skills}/tools/music-generate-tool.d.ts +0 -0
- /package/dist/{skills → types/skills}/tools/notify-tool.d.ts +0 -0
- /package/dist/{skills → types/skills}/tools/patch-tool.d.ts +0 -0
- /package/dist/{skills → types/skills}/tools/pdf-tool.d.ts +0 -0
- /package/dist/{skills → types/skills}/tools/plan-mode-tool.d.ts +0 -0
- /package/dist/{skills → types/skills}/tools/read-tool.d.ts +0 -0
- /package/dist/{skills → types/skills}/tools/repl-tool.d.ts +0 -0
- /package/dist/{skills → types/skills}/tools/search-tool.d.ts +0 -0
- /package/dist/{skills → types/skills}/tools/send-message-tool.d.ts +0 -0
- /package/dist/{skills → types/skills}/tools/skill-list-tool.d.ts +0 -0
- /package/dist/{skills → types/skills}/tools/skill-manage-tool.d.ts +0 -0
- /package/dist/{skills → types/skills}/tools/skill-view-tool.d.ts +0 -0
- /package/dist/{skills → types/skills}/tools/sleep-tool.d.ts +0 -0
- /package/dist/{skills → types/skills}/tools/structured-output-tool.d.ts +0 -0
- /package/dist/{skills → types/skills}/tools/task-tool.d.ts +0 -0
- /package/dist/{skills → types/skills}/tools/team-tool.d.ts +0 -0
- /package/dist/{skills → types/skills}/tools/tool-search-tool.d.ts +0 -0
- /package/dist/{skills → types/skills}/tools/tts-tool.d.ts +0 -0
- /package/dist/{skills → types/skills}/tools/video-edit-tool.d.ts +0 -0
- /package/dist/{skills → types/skills}/tools/video-generate-tool.d.ts +0 -0
- /package/dist/{skills → types/skills}/tools/video-merge-tool.d.ts +0 -0
- /package/dist/{skills → types/skills}/tools/video-upscale-tool.d.ts +0 -0
- /package/dist/{skills → types/skills}/tools/web-fetch-tool.d.ts +0 -0
- /package/dist/{skills → types/skills}/tools/web-search-tool.d.ts +0 -0
- /package/dist/{skills → types/skills}/tools/worktree-tool.d.ts +0 -0
- /package/dist/{skills → types/skills}/tools/write-tool.d.ts +0 -0
|
@@ -1,274 +0,0 @@
|
|
|
1
|
-
// ============================================================
|
|
2
|
-
// Context Compression Bridge — wires orchestration compression
|
|
3
|
-
// strategies into the Agent turn execution flow.
|
|
4
|
-
//
|
|
5
|
-
// Ported from src/core/runtime/context-compression-bridge.ts.
|
|
6
|
-
// Key change: createSummarizeFn() accepts injected LLM transport
|
|
7
|
-
// instead of hardcoding admin proxy URL. Falls back to sync summary
|
|
8
|
-
// when no LLM is available (CLI standalone mode).
|
|
9
|
-
//
|
|
10
|
-
// Phase 1 (P0): ToolResultTrim + SlidingWindow (no LLM needed)
|
|
11
|
-
// Phase 2 (P1): LLM Summarization — HeadTail + Incremental
|
|
12
|
-
// Phase 3 (P1): Prompt Cache awareness
|
|
13
|
-
// Phase 4 (P2): Adaptive threshold + metrics + engine plugin
|
|
14
|
-
// ============================================================
|
|
15
|
-
import { composeStrategies, composeAsyncStrategies, SlidingWindowStrategy, ToolResultTrimStrategy, HeadTailProtectedStrategy, IncrementalCompactStrategy, CacheAwareCompressionStrategy, CompressionMetricsCollector, ContextEngineRegistry, computeAdaptiveBudget, selectCompressionTier, isAsyncCompressionStrategy, } from "../orchestration/index.js";
|
|
16
|
-
// ── Token estimation ───────────────────────────────────────
|
|
17
|
-
/** Rough token estimate: ~4 chars per token for mixed CJK/English. */
|
|
18
|
-
export function estimateTokens(msg) {
|
|
19
|
-
const text = typeof msg.content === "string"
|
|
20
|
-
? msg.content
|
|
21
|
-
: msg.content != null
|
|
22
|
-
? JSON.stringify(msg.content)
|
|
23
|
-
: "";
|
|
24
|
-
return Math.ceil(text.length / 4);
|
|
25
|
-
}
|
|
26
|
-
/** Estimate total tokens for a message array. */
|
|
27
|
-
export function estimateTotalTokens(messages) {
|
|
28
|
-
let total = 0;
|
|
29
|
-
for (const msg of messages) {
|
|
30
|
-
total += estimateTokens(msg);
|
|
31
|
-
}
|
|
32
|
-
return total;
|
|
33
|
-
}
|
|
34
|
-
// ── Model context window lookup ────────────────────────────
|
|
35
|
-
const MODEL_CONTEXT_WINDOWS = {
|
|
36
|
-
"deepseek-chat": 64_000,
|
|
37
|
-
"deepseek-reasoner": 64_000,
|
|
38
|
-
"deepseek-v4-flash": 64_000,
|
|
39
|
-
"gpt-4o": 128_000,
|
|
40
|
-
"gpt-4o-mini": 128_000,
|
|
41
|
-
"claude-sonnet-4-20250514": 200_000,
|
|
42
|
-
"claude-3-5-haiku-20241022": 200_000,
|
|
43
|
-
"gemini-2.0-flash": 1_000_000,
|
|
44
|
-
"gemini-2.5-flash-preview-05-20": 1_000_000,
|
|
45
|
-
};
|
|
46
|
-
function getModelContextWindow(model) {
|
|
47
|
-
if (!model)
|
|
48
|
-
return 128_000;
|
|
49
|
-
if (model in MODEL_CONTEXT_WINDOWS)
|
|
50
|
-
return MODEL_CONTEXT_WINDOWS[model];
|
|
51
|
-
const lower = model.toLowerCase();
|
|
52
|
-
for (const [key, value] of Object.entries(MODEL_CONTEXT_WINDOWS)) {
|
|
53
|
-
if (lower.startsWith(key.toLowerCase()))
|
|
54
|
-
return value;
|
|
55
|
-
}
|
|
56
|
-
return 128_000;
|
|
57
|
-
}
|
|
58
|
-
// ── Constants ──────────────────────────────────────────────
|
|
59
|
-
const DEFAULT_TOOL_RESULT_MAX_CHARS = 8_000;
|
|
60
|
-
const SUMMARIZE_MODEL = "deepseek-chat";
|
|
61
|
-
// ── Singleton metrics collector (Phase 4) ──────────────────
|
|
62
|
-
const metricsCollector = new CompressionMetricsCollector(200);
|
|
63
|
-
export function getCompressionMetrics() {
|
|
64
|
-
return metricsCollector.snapshot();
|
|
65
|
-
}
|
|
66
|
-
// ── Singleton context engine registry (Phase 4.3) ──────────
|
|
67
|
-
const engineRegistry = new ContextEngineRegistry();
|
|
68
|
-
export function getContextEngineRegistry() {
|
|
69
|
-
return engineRegistry;
|
|
70
|
-
}
|
|
71
|
-
// ── LLM Summarization Callback Factory ─────────────────────
|
|
72
|
-
/**
|
|
73
|
-
* Create a summarization callback using an injected LLM transport.
|
|
74
|
-
* For CLI mode: uses the same transport that powers the agent loop.
|
|
75
|
-
* Falls back to non-LLM summary when transport/apiKey not available.
|
|
76
|
-
*/
|
|
77
|
-
export function createSummarizeFn(log, opts) {
|
|
78
|
-
return async (messages, instruction) => {
|
|
79
|
-
const transport = opts?.transport;
|
|
80
|
-
const apiKey = opts?.apiKey;
|
|
81
|
-
if (!transport || !apiKey) {
|
|
82
|
-
log.debug("[context-compression] no LLM transport for summarization — using sync fallback");
|
|
83
|
-
return fallbackSyncSummary(messages);
|
|
84
|
-
}
|
|
85
|
-
try {
|
|
86
|
-
let content = "";
|
|
87
|
-
const model = opts?.model ?? SUMMARIZE_MODEL;
|
|
88
|
-
for await (const chunk of transport.stream({
|
|
89
|
-
model,
|
|
90
|
-
messages: [
|
|
91
|
-
{ role: "system", content: "You are a precise conversation summarizer." },
|
|
92
|
-
{ role: "user", content: instruction },
|
|
93
|
-
],
|
|
94
|
-
maxTokens: 2000,
|
|
95
|
-
temperature: 0.3,
|
|
96
|
-
}, apiKey, AbortSignal.timeout(30_000))) {
|
|
97
|
-
if (chunk.type === "delta")
|
|
98
|
-
content += chunk.text;
|
|
99
|
-
}
|
|
100
|
-
if (!content) {
|
|
101
|
-
log.warn("[context-compression] empty summary response");
|
|
102
|
-
return fallbackSyncSummary(messages);
|
|
103
|
-
}
|
|
104
|
-
return content;
|
|
105
|
-
}
|
|
106
|
-
catch (err) {
|
|
107
|
-
log.warn({ err: err.message }, "[context-compression] summarize call error — using fallback");
|
|
108
|
-
return fallbackSyncSummary(messages);
|
|
109
|
-
}
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
/** Non-LLM fallback: extract key user messages as bullet points. */
|
|
113
|
-
function fallbackSyncSummary(messages) {
|
|
114
|
-
const userMsgs = messages.filter((m) => m.role === "user");
|
|
115
|
-
const bullets = userMsgs.slice(0, 10).map((m) => {
|
|
116
|
-
const text = typeof m.content === "string" ? m.content : JSON.stringify(m.content ?? "");
|
|
117
|
-
return `- ${text.slice(0, 200)}${text.length > 200 ? "..." : ""}`;
|
|
118
|
-
});
|
|
119
|
-
return `User requests (${userMsgs.length} messages):\n${bullets.join("\n")}`;
|
|
120
|
-
}
|
|
121
|
-
// ── Pipeline factories ─────────────────────────────────────
|
|
122
|
-
/** Phase 1: sync-only pipeline (ToolResultTrim + SlidingWindow) */
|
|
123
|
-
export function createSyncPipeline() {
|
|
124
|
-
return composeStrategies(new ToolResultTrimStrategy(DEFAULT_TOOL_RESULT_MAX_CHARS), new SlidingWindowStrategy(estimateTokens));
|
|
125
|
-
}
|
|
126
|
-
/** Phase 2+3: async pipeline with LLM summarization + cache awareness */
|
|
127
|
-
export function createAsyncPipeline(summarize, opts) {
|
|
128
|
-
const innerPipeline = composeAsyncStrategies(new ToolResultTrimStrategy(DEFAULT_TOOL_RESULT_MAX_CHARS), new HeadTailProtectedStrategy({
|
|
129
|
-
protectedHeadExchanges: 1,
|
|
130
|
-
protectedTailMessages: 8,
|
|
131
|
-
summarize,
|
|
132
|
-
estimateTokens,
|
|
133
|
-
}), new SlidingWindowStrategy(estimateTokens));
|
|
134
|
-
return new CacheAwareCompressionStrategy({
|
|
135
|
-
inner: innerPipeline,
|
|
136
|
-
estimateTokens,
|
|
137
|
-
onCacheInvalidated: opts?.onCacheInvalidated,
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
/** Phase 2.3: incremental compaction pipeline (for partial compact) */
|
|
141
|
-
export function createIncrementalPipeline(summarize, opts) {
|
|
142
|
-
const innerPipeline = composeAsyncStrategies(new ToolResultTrimStrategy(DEFAULT_TOOL_RESULT_MAX_CHARS), new IncrementalCompactStrategy({
|
|
143
|
-
preserveRecentCount: opts?.preserveRecentCount ?? 12,
|
|
144
|
-
summarize,
|
|
145
|
-
estimateTokens,
|
|
146
|
-
}), new SlidingWindowStrategy(estimateTokens));
|
|
147
|
-
return new CacheAwareCompressionStrategy({
|
|
148
|
-
inner: innerPipeline,
|
|
149
|
-
estimateTokens,
|
|
150
|
-
onCacheInvalidated: opts?.onCacheInvalidated,
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
/** Synchronous compression (Phase 1 only). */
|
|
154
|
-
export function compressMessages(messages, opts) {
|
|
155
|
-
const budget = opts?.budget ?? computeAdaptiveBudget({
|
|
156
|
-
modelContextWindow: getModelContextWindow(opts?.model),
|
|
157
|
-
});
|
|
158
|
-
const pipeline = opts?.pipeline ?? createSyncPipeline();
|
|
159
|
-
const result = pipeline.compress(messages, budget);
|
|
160
|
-
if (result.droppedCount > 0) {
|
|
161
|
-
const tokensBefore = estimateTotalTokens(messages);
|
|
162
|
-
const tokensAfter = estimateTotalTokens(result.messages);
|
|
163
|
-
metricsCollector.record({
|
|
164
|
-
timestamp: Date.now(),
|
|
165
|
-
strategy: result.strategy,
|
|
166
|
-
tokensBefore,
|
|
167
|
-
tokensAfter,
|
|
168
|
-
droppedCount: result.droppedCount,
|
|
169
|
-
latencyMs: result.metrics?.latencyMs ?? 0,
|
|
170
|
-
usedLlm: false,
|
|
171
|
-
cacheInvalidated: result.metrics?.cacheInvalidated ?? false,
|
|
172
|
-
tier: selectCompressionTier(tokensBefore, budget),
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
return result;
|
|
176
|
-
}
|
|
177
|
-
/** Async compression (Phase 2+) — supports LLM summarization. */
|
|
178
|
-
export async function compressMessagesAsync(messages, opts) {
|
|
179
|
-
const budget = opts.budget ?? computeAdaptiveBudget({
|
|
180
|
-
modelContextWindow: getModelContextWindow(opts.model),
|
|
181
|
-
});
|
|
182
|
-
const activeEngine = engineRegistry.getActive();
|
|
183
|
-
if (activeEngine) {
|
|
184
|
-
const result = await activeEngine.compressAsync(messages, budget, {
|
|
185
|
-
model: opts.model,
|
|
186
|
-
sessionId: opts.sessionId,
|
|
187
|
-
});
|
|
188
|
-
recordMetrics(messages, result, budget);
|
|
189
|
-
return result;
|
|
190
|
-
}
|
|
191
|
-
return compressWithTierSelection(messages, opts, budget);
|
|
192
|
-
}
|
|
193
|
-
async function compressWithTierSelection(messages, opts, budget) {
|
|
194
|
-
const effectiveBudget = budget ?? computeAdaptiveBudget({
|
|
195
|
-
modelContextWindow: getModelContextWindow(opts.model),
|
|
196
|
-
});
|
|
197
|
-
const currentTokens = estimateTotalTokens(messages);
|
|
198
|
-
const tier = selectCompressionTier(currentTokens, effectiveBudget);
|
|
199
|
-
let result;
|
|
200
|
-
switch (tier) {
|
|
201
|
-
case "none":
|
|
202
|
-
result = { messages, droppedCount: 0, strategy: "none" };
|
|
203
|
-
break;
|
|
204
|
-
case "trim-only":
|
|
205
|
-
result = new ToolResultTrimStrategy(DEFAULT_TOOL_RESULT_MAX_CHARS).compress(messages, effectiveBudget);
|
|
206
|
-
break;
|
|
207
|
-
case "sliding-window": {
|
|
208
|
-
const swPipeline = createAsyncPipeline(opts.summarize);
|
|
209
|
-
result = await swPipeline.compressAsync(messages, effectiveBudget);
|
|
210
|
-
break;
|
|
211
|
-
}
|
|
212
|
-
case "llm-summarize": {
|
|
213
|
-
const pipeline = opts.pipeline ?? createAsyncPipeline(opts.summarize);
|
|
214
|
-
result = isAsyncCompressionStrategy(pipeline)
|
|
215
|
-
? await pipeline.compressAsync(messages, effectiveBudget)
|
|
216
|
-
: pipeline.compress(messages, effectiveBudget);
|
|
217
|
-
break;
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
recordMetrics(messages, result, effectiveBudget);
|
|
221
|
-
return result;
|
|
222
|
-
}
|
|
223
|
-
function recordMetrics(messagesBefore, result, budget) {
|
|
224
|
-
if (result.droppedCount > 0 || result.metrics?.usedLlm) {
|
|
225
|
-
const tokensBefore = result.metrics?.tokensBefore || estimateTotalTokens(messagesBefore);
|
|
226
|
-
const tokensAfter = result.metrics?.tokensAfter || estimateTotalTokens(result.messages);
|
|
227
|
-
metricsCollector.record({
|
|
228
|
-
timestamp: Date.now(),
|
|
229
|
-
strategy: result.strategy,
|
|
230
|
-
tokensBefore,
|
|
231
|
-
tokensAfter,
|
|
232
|
-
droppedCount: result.droppedCount,
|
|
233
|
-
latencyMs: result.metrics?.latencyMs ?? 0,
|
|
234
|
-
usedLlm: result.metrics?.usedLlm ?? false,
|
|
235
|
-
cacheInvalidated: result.metrics?.cacheInvalidated ?? false,
|
|
236
|
-
tier: selectCompressionTier(tokensBefore, budget),
|
|
237
|
-
});
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
// ── Default Context Engine (Phase 4.3) ─────────────────────
|
|
241
|
-
export function registerDefaultContextEngine(log, opts) {
|
|
242
|
-
const summarize = createSummarizeFn(log, opts);
|
|
243
|
-
const engine = {
|
|
244
|
-
id: "builtin-compressor",
|
|
245
|
-
label: "4-Layer Compression Funnel (built-in)",
|
|
246
|
-
async compressAsync(messages, budget, context) {
|
|
247
|
-
return compressWithTierSelection(messages, {
|
|
248
|
-
budget,
|
|
249
|
-
model: context?.model,
|
|
250
|
-
sessionId: context?.sessionId,
|
|
251
|
-
summarize,
|
|
252
|
-
}, budget);
|
|
253
|
-
},
|
|
254
|
-
};
|
|
255
|
-
engineRegistry.register(engine);
|
|
256
|
-
engineRegistry.activate(engine.id);
|
|
257
|
-
log.info(`[context-compression] registered context engine: ${engine.id}`);
|
|
258
|
-
}
|
|
259
|
-
// ── Hook registration ──────────────────────────────────────
|
|
260
|
-
export function registerContextCompressionHook(hooks, log, opts) {
|
|
261
|
-
registerDefaultContextEngine(log, opts);
|
|
262
|
-
hooks.register({
|
|
263
|
-
point: "context.before_compact",
|
|
264
|
-
priority: 50,
|
|
265
|
-
label: "context-compression-bridge",
|
|
266
|
-
handler: (_point, context) => {
|
|
267
|
-
const messageCount = context.messageCount;
|
|
268
|
-
if (messageCount && messageCount > 0) {
|
|
269
|
-
log.debug(`[context-compression] before_compact: ${messageCount} messages entering compression`);
|
|
270
|
-
}
|
|
271
|
-
return { action: "continue" };
|
|
272
|
-
},
|
|
273
|
-
});
|
|
274
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
// ============================================================
|
|
2
|
-
// Hook registry — manages lifecycle hooks for the Agent Runtime.
|
|
3
|
-
// Hook failures never block the main flow (catch + log).
|
|
4
|
-
//
|
|
5
|
-
// Ported from src/core/runtime/hook-registry.ts (zero changes to logic).
|
|
6
|
-
// ============================================================
|
|
7
|
-
export function createHookRegistry(log) {
|
|
8
|
-
const handlers = new Map();
|
|
9
|
-
return {
|
|
10
|
-
register(registration) {
|
|
11
|
-
const list = handlers.get(registration.point) ?? [];
|
|
12
|
-
const entry = {
|
|
13
|
-
handler: registration.handler,
|
|
14
|
-
priority: registration.priority ?? 100,
|
|
15
|
-
label: registration.label,
|
|
16
|
-
};
|
|
17
|
-
list.push(entry);
|
|
18
|
-
list.sort((a, b) => a.priority - b.priority);
|
|
19
|
-
handlers.set(registration.point, list);
|
|
20
|
-
return () => {
|
|
21
|
-
const idx = list.indexOf(entry);
|
|
22
|
-
if (idx >= 0)
|
|
23
|
-
list.splice(idx, 1);
|
|
24
|
-
};
|
|
25
|
-
},
|
|
26
|
-
async invoke(point, context) {
|
|
27
|
-
const list = handlers.get(point);
|
|
28
|
-
if (!list || list.length === 0) {
|
|
29
|
-
return { action: "continue", context };
|
|
30
|
-
}
|
|
31
|
-
let current = context;
|
|
32
|
-
for (const entry of list) {
|
|
33
|
-
try {
|
|
34
|
-
const result = await entry.handler(point, current);
|
|
35
|
-
if (!result || result.action === "continue") {
|
|
36
|
-
if (result?.context) {
|
|
37
|
-
current = result.context;
|
|
38
|
-
}
|
|
39
|
-
continue;
|
|
40
|
-
}
|
|
41
|
-
if (result.action === "abort" || result.action === "skip") {
|
|
42
|
-
log.info({ hook: point, label: entry.label, action: result.action, reason: result.reason }, "hook intercepted");
|
|
43
|
-
return result;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
catch (err) {
|
|
47
|
-
log.warn({ hook: point, label: entry.label, err: err.message }, "hook handler failed (non-blocking)");
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
return { action: "continue", context: current };
|
|
51
|
-
},
|
|
52
|
-
};
|
|
53
|
-
}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
// ============================================================
|
|
2
|
-
// Memory lifecycle hooks — CLI runtime
|
|
3
|
-
//
|
|
4
|
-
// Wires memory.before_recall / memory.after_recall hook points
|
|
5
|
-
// into the qmemory REST API. Registered once per session when
|
|
6
|
-
// the HookRegistry is created.
|
|
7
|
-
//
|
|
8
|
-
// Unlike the Hub version (PG-based), this uses the local
|
|
9
|
-
// qmemory HTTP adapter for recall prefetch.
|
|
10
|
-
// ============================================================
|
|
11
|
-
/**
|
|
12
|
-
* Register memory lifecycle hooks on the HookRegistry.
|
|
13
|
-
*
|
|
14
|
-
* Hook points wired:
|
|
15
|
-
* - memory.before_recall: prefetch context from qmemory (query-based)
|
|
16
|
-
* - memory.after_recall: log recall results
|
|
17
|
-
*
|
|
18
|
-
* Returns a cleanup function to unregister.
|
|
19
|
-
*/
|
|
20
|
-
export function registerMemoryHooks(hooks, deps) {
|
|
21
|
-
const cleanups = [];
|
|
22
|
-
// Shared recall cache per turn (avoids redundant queries)
|
|
23
|
-
let lastRecallTurnId;
|
|
24
|
-
let lastRecallResults = [];
|
|
25
|
-
// memory.before_recall — prefetch from qmemory
|
|
26
|
-
cleanups.push(hooks.register({
|
|
27
|
-
point: "memory.before_recall",
|
|
28
|
-
priority: 50,
|
|
29
|
-
label: "qmemory-prefetch",
|
|
30
|
-
handler: async (_point, ctx) => {
|
|
31
|
-
if (!deps.memoryProvider || !ctx.query) {
|
|
32
|
-
return { action: "continue", context: ctx };
|
|
33
|
-
}
|
|
34
|
-
try {
|
|
35
|
-
const results = await deps.memoryProvider.search(ctx.query, deps.userId, {
|
|
36
|
-
limit: 10,
|
|
37
|
-
});
|
|
38
|
-
lastRecallTurnId = ctx.turnId;
|
|
39
|
-
lastRecallResults = results;
|
|
40
|
-
deps.log.debug(`memory.before_recall: prefetched ${results.length} memories for query="${ctx.query?.slice(0, 60)}"`);
|
|
41
|
-
}
|
|
42
|
-
catch (err) {
|
|
43
|
-
deps.log.warn(`memory.before_recall: qmemory prefetch failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
44
|
-
lastRecallResults = [];
|
|
45
|
-
}
|
|
46
|
-
return { action: "continue", context: ctx };
|
|
47
|
-
},
|
|
48
|
-
}));
|
|
49
|
-
// memory.after_recall — log results
|
|
50
|
-
cleanups.push(hooks.register({
|
|
51
|
-
point: "memory.after_recall",
|
|
52
|
-
priority: 50,
|
|
53
|
-
label: "qmemory-recall-log",
|
|
54
|
-
handler: (_point, ctx) => {
|
|
55
|
-
const count = lastRecallTurnId === ctx.turnId ? lastRecallResults.length : 0;
|
|
56
|
-
deps.log.debug(`memory.after_recall: ${ctx.blockCount ?? 0} blocks assembled, ${count} qmemory results`);
|
|
57
|
-
return { action: "continue", context: ctx };
|
|
58
|
-
},
|
|
59
|
-
}));
|
|
60
|
-
return () => {
|
|
61
|
-
for (const cleanup of cleanups)
|
|
62
|
-
cleanup();
|
|
63
|
-
lastRecallResults = [];
|
|
64
|
-
};
|
|
65
|
-
}
|
|
@@ -1,111 +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
|
-
// ── Dangerous pattern detection (CC parity) ──────────────────────────────────
|
|
17
|
-
const BUILTIN_DANGEROUS_PATTERNS = [
|
|
18
|
-
/^(?:bash|shell|exec|terminal|run_command)$/i,
|
|
19
|
-
/^(?:write_file|delete_file|move_file|create_directory)$/i,
|
|
20
|
-
/^(?:git_push|git_reset|git_force)$/i,
|
|
21
|
-
];
|
|
22
|
-
function matchesDangerousPattern(toolName, extraPatterns) {
|
|
23
|
-
if (BUILTIN_DANGEROUS_PATTERNS.some((re) => re.test(toolName))) {
|
|
24
|
-
return true;
|
|
25
|
-
}
|
|
26
|
-
if (extraPatterns) {
|
|
27
|
-
for (const pattern of extraPatterns) {
|
|
28
|
-
try {
|
|
29
|
-
if (new RegExp(pattern, "i").test(toolName))
|
|
30
|
-
return true;
|
|
31
|
-
}
|
|
32
|
-
catch {
|
|
33
|
-
// Invalid regex — skip
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
return false;
|
|
38
|
-
}
|
|
39
|
-
// ── Core resolver ────────────────────────────────────────────────────────────
|
|
40
|
-
function resolvePermissionLevel(tool, context) {
|
|
41
|
-
const name = tool.function.name;
|
|
42
|
-
const meta = tool.meta;
|
|
43
|
-
const reasons = [];
|
|
44
|
-
// Level 5: explicitly blocked
|
|
45
|
-
if (context.blockedToolNames?.includes(name)) {
|
|
46
|
-
reasons.push("policy_blocked");
|
|
47
|
-
return { level: 5, reasons };
|
|
48
|
-
}
|
|
49
|
-
// Level 1: always allowed (read-only / safe)
|
|
50
|
-
if (meta?.isReadOnly) {
|
|
51
|
-
reasons.push("always_allowed");
|
|
52
|
-
return { level: 1, reasons };
|
|
53
|
-
}
|
|
54
|
-
// Level 4: explicit approval required
|
|
55
|
-
if (meta?.requiresApproval) {
|
|
56
|
-
reasons.push("approval_required");
|
|
57
|
-
return { level: 4, reasons };
|
|
58
|
-
}
|
|
59
|
-
// Level 3: dangerous (by meta flag or pattern detection)
|
|
60
|
-
if (meta?.isDangerous || matchesDangerousPattern(name, context.dangerousPatterns)) {
|
|
61
|
-
reasons.push("dangerous_tool");
|
|
62
|
-
return { level: 3, reasons };
|
|
63
|
-
}
|
|
64
|
-
// Level 2: default allowed
|
|
65
|
-
return { level: 2, reasons };
|
|
66
|
-
}
|
|
67
|
-
function levelToStatus(level) {
|
|
68
|
-
switch (level) {
|
|
69
|
-
case 1: return "eligible";
|
|
70
|
-
case 2: return "eligible";
|
|
71
|
-
case 3: return "dangerous-notify";
|
|
72
|
-
case 4: return "approval-required";
|
|
73
|
-
case 5: return "blocked-by-policy";
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Resolve tool eligibility for a set of tools from agent.turn.
|
|
78
|
-
*
|
|
79
|
-
* Returns filtered tool lists and eligibility metadata.
|
|
80
|
-
* Blocked tools are removed from the eligible list (not sent to LLM).
|
|
81
|
-
* Approval-required tools remain in the list but flagged for hook interception.
|
|
82
|
-
*/
|
|
83
|
-
export function resolveToolEligibility(tools, context = {}) {
|
|
84
|
-
const eligibilityByName = new Map();
|
|
85
|
-
const eligibleTools = [];
|
|
86
|
-
const blockedTools = [];
|
|
87
|
-
const approvalRequiredTools = [];
|
|
88
|
-
for (const tool of tools) {
|
|
89
|
-
const name = tool.function.name;
|
|
90
|
-
const { level, reasons } = resolvePermissionLevel(tool, context);
|
|
91
|
-
const status = levelToStatus(level);
|
|
92
|
-
const entry = {
|
|
93
|
-
toolName: name,
|
|
94
|
-
status,
|
|
95
|
-
permissionLevel: level,
|
|
96
|
-
approvalRequired: level === 4,
|
|
97
|
-
reasonCodes: reasons,
|
|
98
|
-
};
|
|
99
|
-
eligibilityByName.set(name, entry);
|
|
100
|
-
if (level === 5) {
|
|
101
|
-
blockedTools.push(entry);
|
|
102
|
-
}
|
|
103
|
-
else {
|
|
104
|
-
eligibleTools.push(tool);
|
|
105
|
-
if (level === 4) {
|
|
106
|
-
approvalRequiredTools.push(entry);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
return { eligibleTools, blockedTools, approvalRequiredTools, eligibilityByName };
|
|
111
|
-
}
|
package/dist/skills/index.js
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
// skills — public API barrel
|
|
2
|
-
// ── Memory Tool (add/replace/remove/search) ────────────────
|
|
3
|
-
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";
|
|
4
|
-
// ── Memory Store (local MD notes) ───────────────────────────
|
|
5
|
-
export { MemoryStore, MEMORY_ENTRY_DELIMITER, DEFAULT_MEMORY_CHAR_LIMIT, DEFAULT_USER_CHAR_LIMIT, } from "./memory-store.js";
|
|
6
|
-
// ── QMemory Adapter ─────────────────────────────────────────
|
|
7
|
-
export { createQMemoryAdapter } from "./qmemory-adapter.js";
|
|
8
|
-
// ── Memory Extractor (server-side LLM extraction) ─────────
|
|
9
|
-
export { createMemoryExtractor } from "./memory-extractor.js";
|
|
10
|
-
// ── Think Tool ──────────────────────────────────────────────
|
|
11
|
-
export { THINK_TOOL_NAME, THINK_TOOL_SCHEMA, createThinkTool } from "./think-tool.js";
|
|
12
|
-
// ── Todo Tool ───────────────────────────────────────────────
|
|
13
|
-
export { TODO_TOOL_NAME, TODO_TOOL_SCHEMA, createTodoTool } from "./todo-tool.js";
|
|
14
|
-
// ── Memory Query Tool ───────────────────────────────────────
|
|
15
|
-
export { MEMORY_QUERY_TOOL_NAME, MEMORY_QUERY_TOOL_SCHEMA, createMemoryQueryTool, } from "./memory-query-tool.js";
|
|
16
|
-
// ── Coding Tools ────────────────────────────────────────────
|
|
17
|
-
export { READ_TOOL_NAME, READ_TOOL_SCHEMA, createReadTool } from "./tools/read-tool.js";
|
|
18
|
-
export { WRITE_TOOL_NAME, WRITE_TOOL_SCHEMA, createWriteTool } from "./tools/write-tool.js";
|
|
19
|
-
export { EDIT_TOOL_NAME, EDIT_TOOL_SCHEMA, createEditTool } from "./tools/edit-tool.js";
|
|
20
|
-
export { APPLY_PATCH_TOOL_NAME, APPLY_PATCH_TOOL_SCHEMA, createApplyPatchTool } from "./tools/apply-patch-tool.js";
|
|
21
|
-
// ── Document Tools ──────────────────────────────────────────
|
|
22
|
-
export { PDF_TOOL_NAME, PDF_TOOL_SCHEMA, createPdfTool } from "./tools/pdf-tool.js";
|
|
23
|
-
// ── System Tools ────────────────────────────────────────────
|
|
24
|
-
export { EXEC_TOOL_NAME, EXEC_TOOL_SCHEMA, createExecTool } from "./tools/exec-tool.js";
|
|
25
|
-
// ── Search Tools ────────────────────────────────────────────
|
|
26
|
-
export { SEARCH_TOOL_NAME, SEARCH_TOOL_SCHEMA, createSearchTool } from "./tools/search-tool.js";
|
|
27
|
-
// ── Media Tools ─────────────────────────────────────────────
|
|
28
|
-
export { IMAGE_GENERATE_TOOL_NAME, IMAGE_GENERATE_TOOL_SCHEMA, createImageGenerateTool } from "./tools/image-generate-tool.js";
|
|
29
|
-
export { VIDEO_GENERATE_TOOL_NAME, VIDEO_GENERATE_TOOL_SCHEMA, createVideoGenerateTool } from "./tools/video-generate-tool.js";
|
|
30
|
-
export { VIDEO_MERGE_TOOL_NAME, VIDEO_MERGE_TOOL_SCHEMA, createVideoMergeTool } from "./tools/video-merge-tool.js";
|
|
31
|
-
export { VIDEO_UPSCALE_TOOL_NAME, VIDEO_UPSCALE_TOOL_SCHEMA, createVideoUpscaleTool } from "./tools/video-upscale-tool.js";
|
|
32
|
-
export { VIDEO_EDIT_TOOL_NAME, VIDEO_EDIT_TOOL_SCHEMA, createVideoEditTool } from "./tools/video-edit-tool.js";
|
|
33
|
-
export { MUSIC_GENERATE_TOOL_NAME, MUSIC_GENERATE_TOOL_SCHEMA, createMusicGenerateTool } from "./tools/music-generate-tool.js";
|
|
34
|
-
export { TTS_TOOL_NAME, TTS_TOOL_SCHEMA, createTtsTool } from "./tools/tts-tool.js";
|
|
35
|
-
// ── Web Tools ───────────────────────────────────────────────
|
|
36
|
-
export { WEB_FETCH_TOOL_NAME, WEB_FETCH_TOOL_SCHEMA, createWebFetchTool } from "./tools/web-fetch-tool.js";
|
|
37
|
-
export { WEB_SEARCH_TOOL_NAME, WEB_SEARCH_TOOL_SCHEMA, createWebSearchTool } from "./tools/web-search-tool.js";
|
|
38
|
-
// ── Interaction Tools ───────────────────────────────────────
|
|
39
|
-
export { ASK_USER_TOOL_NAME, ASK_USER_TOOL_SCHEMA, createAskUserTool } from "./tools/ask-user-tool.js";
|
|
40
|
-
// ── Brief Tool (SendUserMessage — chat/brief mode output) ───
|
|
41
|
-
export { BRIEF_TOOL_NAME, BRIEF_TOOL_SCHEMA, createBriefTool } from "./tools/brief-tool.js";
|
|
42
|
-
// ── Tool Discovery ──────────────────────────────────────────
|
|
43
|
-
export { TOOL_SEARCH_TOOL_NAME, TOOL_SEARCH_TOOL_SCHEMA, createToolSearchTool } from "./tools/tool-search-tool.js";
|
|
44
|
-
// ── Skill Management Tools ──────────────────────────────────
|
|
45
|
-
export { SKILL_LIST_TOOL_NAME, SKILL_LIST_TOOL_SCHEMA, createSkillListTool } from "./tools/skill-list-tool.js";
|
|
46
|
-
export { SKILL_VIEW_TOOL_NAME, SKILL_VIEW_TOOL_SCHEMA, createSkillViewTool } from "./tools/skill-view-tool.js";
|
|
47
|
-
export { SKILL_MANAGE_TOOL_NAME, SKILL_MANAGE_TOOL_SCHEMA, createSkillManageTool } from "./tools/skill-manage-tool.js";
|
|
48
|
-
// ── P2 Tools ────────────────────────────────────────────────
|
|
49
|
-
export { PATCH_TOOL_NAME, PATCH_TOOL_SCHEMA, createPatchTool, fuzzyFind } from "./tools/patch-tool.js";
|
|
50
|
-
export { AGENT_TOOL_NAME, AGENT_TOOL_SCHEMA, createAgentTool } from "./tools/agent-tool.js";
|
|
51
|
-
export { TASK_TOOL_NAME, TASK_TOOL_SCHEMA, createTaskTool } from "./tools/task-tool.js";
|
|
52
|
-
export { REPL_TOOL_NAME, REPL_TOOL_SCHEMA, REPL_HIDES_TOOLS, createReplTool } from "./tools/repl-tool.js";
|
|
53
|
-
export { BROWSER_TOOL_NAME, BROWSER_TOOL_SCHEMA, createBrowserTool } from "./tools/browser-tool.js";
|
|
54
|
-
export { CRON_TOOL_NAME, CRON_TOOL_SCHEMA, MAX_CRON_JOBS, createCronTool } from "./tools/cron-tool.js";
|
|
55
|
-
export { MEMORY_SEARCH_TOOL_NAME, MEMORY_SEARCH_TOOL_SCHEMA, createMemorySearchTool } from "./tools/memory-tool.js";
|
|
56
|
-
export { CHECKPOINT_TOOL_NAME, CHECKPOINT_TOOL_SCHEMA, createCheckpointTool } from "./tools/checkpoint-tool.js";
|
|
57
|
-
export { NOTIFY_TOOL_NAME, NOTIFY_TOOL_SCHEMA, createNotifyTool } from "./tools/notify-tool.js";
|
|
58
|
-
export { SEND_MESSAGE_TOOL_NAME, SEND_MESSAGE_TOOL_SCHEMA, createSendMessageTool } from "./tools/send-message-tool.js";
|
|
59
|
-
export { TEAM_TOOL_NAME, TEAM_TOOL_SCHEMA, createTeamTool } from "./tools/team-tool.js";
|
|
60
|
-
// ── P3 Tools ────────────────────────────────────────────────
|
|
61
|
-
export { LSP_TOOL_NAME, LSP_TOOL_SCHEMA, createLspTool } from "./tools/lsp-tool.js";
|
|
62
|
-
export { PLAN_MODE_TOOL_NAME, PLAN_MODE_TOOL_SCHEMA, PLAN_MODE_ALLOWED_TOOLS, createPlanModeTool } from "./tools/plan-mode-tool.js";
|
|
63
|
-
export { WORKTREE_TOOL_NAME, WORKTREE_TOOL_SCHEMA, createWorktreeTool } from "./tools/worktree-tool.js";
|
|
64
|
-
export { MCP_TOOL_NAME, MCP_TOOL_SCHEMA, createMcpTool, createMcpAuthProxy } from "./tools/mcp-tool.js";
|
|
65
|
-
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";
|
|
66
|
-
export { CONFIG_TOOL_NAME, CONFIG_TOOL_SCHEMA, CONFIG_READONLY_KEYS, createConfigTool } from "./tools/config-tool.js";
|
|
67
|
-
// ── Autonomous / Proactive Tools ────────────────────────────
|
|
68
|
-
export { SLEEP_TOOL_NAME, SLEEP_TOOL_SCHEMA, createSleepTool } from "./tools/sleep-tool.js";
|
|
69
|
-
export { MONITOR_TOOL_NAME, MONITOR_TOOL_SCHEMA, createMonitorTool } from "./tools/monitor-tool.js";
|
|
70
|
-
// ── Structured Output ───────────────────────────────────────
|
|
71
|
-
export { STRUCTURED_OUTPUT_TOOL_NAME, STRUCTURED_OUTPUT_TOOL_SCHEMA, STRUCTURED_OUTPUT_MAX_CHARS, createStructuredOutputTool, createConfiguredStructuredOutputTool, isStructuredOutputEnabled, } from "./tools/structured-output-tool.js";
|
|
72
|
-
// ── Skill System — Types ────────────────────────────────────
|
|
73
|
-
// ── Instructions Tools (project instruction CRUD) ───────────
|
|
74
|
-
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";
|
|
75
|
-
// ── Skill System — Frontmatter ──────────────────────────────
|
|
76
|
-
export { parseFrontmatter, resolveSkillMetadata, resolveSkillInvocationPolicy, resolveSkillKey, } from "./skill-frontmatter.js";
|
|
77
|
-
// ── Skill System — Loader ───────────────────────────────────
|
|
78
|
-
export { loadSkillEntries, filterSkillEntries, buildSkillSnapshot, } from "./skill-loader.js";
|
|
79
|
-
// ── Skill System — Security Guard ───────────────────────────
|
|
80
|
-
export { scanSource, scanSkillDirectory, hasCriticalFindings, isScannable, } from "./skill-guard.js";
|
|
81
|
-
// ── Skill System — Source & Install ─────────────────────────
|
|
82
|
-
export { installSkill, uninstallSkill, createEmptyLockfile, } from "./skill-source.js";
|