qlogicagent 0.5.0 → 0.5.3
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/README.md +402 -402
- package/dist/agent.js +18 -0
- package/dist/cli.js +360 -0
- package/dist/contracts.js +1 -0
- package/dist/index.js +22 -0
- package/dist/orchestration.js +125 -0
- package/dist/types/agent/agent.d.ts +43 -0
- package/dist/types/agent/constants.d.ts +47 -0
- package/dist/types/agent/tool-loop.d.ts +96 -0
- package/dist/types/agent/types.d.ts +250 -0
- package/dist/types/cli/main.d.ts +11 -0
- package/dist/types/cli/stdio-server.d.ts +56 -0
- package/dist/types/cli/tool-bootstrap.d.ts +21 -0
- package/dist/types/config/config.d.ts +17 -0
- package/dist/types/contracts/hooks.d.ts +175 -0
- package/dist/types/contracts/index.d.ts +10 -0
- package/dist/types/contracts/planner.d.ts +35 -0
- package/dist/types/contracts/skill-candidate.d.ts +63 -0
- package/dist/types/contracts/todo.d.ts +14 -0
- package/dist/types/index.d.ts +13 -0
- package/dist/types/llm/builtin-providers.d.ts +10 -0
- package/dist/types/llm/debug-transport.d.ts +12 -0
- package/dist/types/llm/index.d.ts +16 -0
- package/dist/types/llm/llm-client.d.ts +43 -0
- package/dist/types/llm/model-catalog.d.ts +53 -0
- package/dist/types/llm/provider-def.d.ts +59 -0
- package/dist/types/llm/provider-registry.d.ts +54 -0
- package/dist/types/llm/transport.d.ts +62 -0
- package/dist/types/llm/transports/anthropic-messages.d.ts +31 -0
- package/dist/types/llm/transports/openai-chat.d.ts +36 -0
- package/dist/types/orchestration/agent-registry.d.ts +46 -0
- package/dist/types/orchestration/context-collapse.d.ts +58 -0
- package/dist/types/orchestration/context-compression.d.ts +301 -0
- package/dist/types/orchestration/conversation-repair.d.ts +61 -0
- package/dist/types/orchestration/curator-scheduler.d.ts +119 -0
- package/dist/types/orchestration/error-classification.d.ts +12 -0
- package/dist/types/orchestration/failover-classification.d.ts +8 -0
- package/dist/types/orchestration/failover-error.d.ts +33 -0
- package/dist/types/orchestration/fork-subagent.d.ts +100 -0
- package/dist/types/orchestration/index.d.ts +113 -0
- package/dist/types/orchestration/memory-provider.d.ts +14 -0
- package/dist/types/orchestration/reactive-compact.d.ts +73 -0
- package/dist/types/orchestration/retry-loop.d.ts +69 -0
- package/dist/types/orchestration/skill-candidate.d.ts +52 -0
- package/dist/types/orchestration/skill-consolidation.d.ts +123 -0
- package/dist/types/orchestration/skill-improvement.d.ts +59 -0
- package/dist/types/orchestration/skill-similarity.d.ts +98 -0
- package/dist/types/orchestration/task-types.d.ts +142 -0
- package/dist/types/orchestration/team-orchestration.d.ts +195 -0
- package/dist/types/orchestration/team-tool-loop-wiring.d.ts +92 -0
- package/dist/types/orchestration/tool-choice-policy.d.ts +54 -0
- package/dist/types/orchestration/tool-loop-state.d.ts +50 -0
- package/dist/types/orchestration/tool-schema.d.ts +39 -0
- package/dist/types/orchestration/turn-loop-guard.d.ts +86 -0
- package/dist/types/runtime/execution/dream-agent.d.ts +199 -0
- package/dist/types/runtime/execution/forked-agent.d.ts +111 -0
- package/dist/types/runtime/execution/index.d.ts +6 -0
- package/dist/types/runtime/execution/progress-tracker.d.ts +78 -0
- package/dist/types/runtime/execution/remote-agent.d.ts +63 -0
- package/dist/types/runtime/execution/streaming-tool-executor.d.ts +100 -0
- package/dist/types/runtime/execution/tool-eligibility.d.ts +59 -0
- package/dist/types/runtime/execution/tool-result-storage.d.ts +87 -0
- package/dist/types/runtime/hooks/context-compression.d.ts +61 -0
- package/dist/types/runtime/hooks/hook-registry.d.ts +12 -0
- package/dist/types/runtime/hooks/index.d.ts +3 -0
- package/dist/types/runtime/hooks/memory-hooks.d.ts +49 -0
- package/dist/types/runtime/index.d.ts +5 -0
- package/dist/types/runtime/infra/cleanup-registry.d.ts +23 -0
- package/dist/types/runtime/infra/file-watcher.d.ts +72 -0
- package/dist/types/runtime/infra/index.d.ts +6 -0
- package/dist/types/runtime/infra/secure-storage.d.ts +81 -0
- package/dist/types/runtime/infra/task-runtime.d.ts +108 -0
- package/dist/types/runtime/infra/token-budget.d.ts +92 -0
- package/dist/types/runtime/infra/worktree-backend.d.ts +85 -0
- package/dist/types/runtime/prompt/environment-context.d.ts +23 -0
- package/dist/types/runtime/prompt/index.d.ts +3 -0
- package/dist/types/runtime/prompt/instruction-loader.d.ts +64 -0
- package/dist/types/runtime/prompt/system-prompt-sections.d.ts +63 -0
- package/dist/types/runtime/session/index.d.ts +2 -0
- package/dist/types/runtime/session/session-memory.d.ts +91 -0
- package/dist/types/runtime/session/session-persistence.d.ts +94 -0
- package/dist/types/runtime/session/session-state.d.ts +117 -0
- package/dist/types/skills/index.d.ts +125 -0
- package/dist/types/skills/mcp/index.d.ts +3 -0
- package/dist/types/skills/mcp/mcp-http-client.d.ts +66 -0
- package/dist/types/skills/mcp/mcp-manager.d.ts +84 -0
- package/dist/types/skills/mcp/mcp-stdio-client.d.ts +84 -0
- package/dist/types/skills/memory-extractor.d.ts +64 -0
- package/dist/types/skills/memory-query-tool.d.ts +43 -0
- package/dist/types/skills/memory-store.d.ts +66 -0
- package/dist/types/skills/memory-tool.d.ts +67 -0
- package/dist/types/skills/permissions/bash-classifier.d.ts +30 -0
- package/dist/types/skills/permissions/classifier-cache.d.ts +51 -0
- package/dist/types/skills/permissions/denial-tracking.d.ts +42 -0
- package/dist/types/skills/permissions/hook-runner.d.ts +85 -0
- package/dist/types/skills/permissions/index.d.ts +12 -0
- package/dist/types/skills/permissions/permission-classifier.d.ts +41 -0
- package/dist/types/skills/permissions/rule-engine.d.ts +41 -0
- package/dist/types/skills/permissions/settings-watcher.d.ts +46 -0
- package/dist/types/skills/permissions/types.d.ts +113 -0
- package/dist/types/skills/plugins/index.d.ts +2 -0
- package/dist/types/skills/plugins/plugin-api.d.ts +38 -0
- package/dist/types/skills/plugins/plugin-loader.d.ts +45 -0
- package/dist/types/skills/plugins/plugin-marketplace.d.ts +61 -0
- package/dist/types/skills/portable-tool.d.ts +71 -0
- package/dist/types/skills/qmemory-adapter.d.ts +42 -0
- package/dist/types/skills/skill-frontmatter.d.ts +19 -0
- package/dist/types/skills/skill-guard.d.ts +23 -0
- package/dist/types/skills/skill-loader.d.ts +16 -0
- package/dist/types/skills/skill-source.d.ts +119 -0
- package/dist/types/skills/skill-types.d.ts +199 -0
- package/dist/types/skills/think-tool.d.ts +16 -0
- package/dist/types/skills/todo-tool.d.ts +63 -0
- package/dist/types/skills/tool-registry.d.ts +29 -0
- package/dist/types/skills/tools/agent-tool.d.ts +91 -0
- package/dist/types/skills/tools/apply-patch-tool.d.ts +29 -0
- package/dist/types/skills/tools/ask-user-tool.d.ts +80 -0
- package/dist/types/skills/tools/brief-tool.d.ts +74 -0
- package/dist/types/skills/tools/browser-tool.d.ts +114 -0
- package/dist/types/skills/tools/checkpoint-tool.d.ts +66 -0
- package/dist/types/skills/tools/config-tool.d.ts +63 -0
- package/dist/types/skills/tools/cron-tool.d.ts +116 -0
- package/dist/types/skills/tools/edit-tool.d.ts +43 -0
- package/dist/types/skills/tools/exec-tool.d.ts +97 -0
- package/dist/types/skills/tools/image-generate-tool.d.ts +62 -0
- package/dist/types/skills/tools/instructions-tool.d.ts +103 -0
- package/dist/types/skills/tools/lsp-tool.d.ts +153 -0
- package/dist/types/skills/tools/mcp-client-types.d.ts +269 -0
- package/dist/types/skills/tools/mcp-resource-tools.d.ts +14 -0
- package/dist/types/skills/tools/mcp-tool.d.ts +249 -0
- package/dist/types/skills/tools/memory-tool.d.ts +74 -0
- package/dist/types/skills/tools/monitor-tool.d.ts +113 -0
- package/dist/types/skills/tools/music-generate-tool.d.ts +55 -0
- package/dist/types/skills/tools/notebook-edit-tool.d.ts +15 -0
- package/dist/types/skills/tools/notify-tool.d.ts +53 -0
- package/dist/types/skills/tools/patch-tool.d.ts +45 -0
- package/dist/types/skills/tools/pdf-tool.d.ts +66 -0
- package/dist/types/skills/tools/plan-mode-tool.d.ts +98 -0
- package/dist/types/skills/tools/read-tool.d.ts +51 -0
- package/dist/types/skills/tools/repl-tool.d.ts +70 -0
- package/dist/types/skills/tools/search-tool.d.ts +112 -0
- package/dist/types/skills/tools/send-message-tool.d.ts +51 -0
- package/dist/types/skills/tools/shell/bash-provider.d.ts +26 -0
- package/dist/types/skills/tools/shell/command-classification.d.ts +44 -0
- package/dist/types/skills/tools/shell/command-semantics.d.ts +14 -0
- package/dist/types/skills/tools/shell/destructive-command-warning.d.ts +10 -0
- package/dist/types/skills/tools/shell/exec-permissions.d.ts +52 -0
- package/dist/types/skills/tools/shell/index.d.ts +17 -0
- package/dist/types/skills/tools/shell/powershell-provider.d.ts +15 -0
- package/dist/types/skills/tools/shell/shell-command.d.ts +54 -0
- package/dist/types/skills/tools/shell/shell-exec.d.ts +33 -0
- package/dist/types/skills/tools/shell/shell-provider.d.ts +85 -0
- package/dist/types/skills/tools/shell/task-output.d.ts +45 -0
- package/dist/types/skills/tools/skill-invoke-tool.d.ts +46 -0
- package/dist/types/skills/tools/skill-list-tool.d.ts +33 -0
- package/dist/types/skills/tools/skill-manage-tool.d.ts +73 -0
- package/dist/types/skills/tools/skill-view-tool.d.ts +37 -0
- package/dist/types/skills/tools/sleep-tool.d.ts +49 -0
- package/dist/types/skills/tools/structured-output-tool.d.ts +116 -0
- package/dist/types/skills/tools/task-tool.d.ts +104 -0
- package/dist/types/skills/tools/team-tool.d.ts +89 -0
- package/dist/types/skills/tools/tool-search-tool.d.ts +51 -0
- package/dist/types/skills/tools/tts-tool.d.ts +38 -0
- package/dist/types/skills/tools/video-edit-tool.d.ts +69 -0
- package/dist/types/skills/tools/video-generate-tool.d.ts +62 -0
- package/dist/types/skills/tools/video-merge-tool.d.ts +105 -0
- package/dist/types/skills/tools/video-upscale-tool.d.ts +45 -0
- package/dist/types/skills/tools/web-fetch-tool.d.ts +78 -0
- package/dist/types/skills/tools/web-search-tool.d.ts +57 -0
- package/dist/types/skills/tools/workflow-tool.d.ts +44 -0
- package/dist/types/skills/tools/worktree-tool.d.ts +69 -0
- package/dist/types/skills/tools/write-tool.d.ts +45 -0
- package/package.json +4 -2
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Classifier Cache — CC preToolUse approval cache parity.
|
|
3
|
+
*
|
|
4
|
+
* Caches already-judged tool use classification results to avoid
|
|
5
|
+
* redundant LLM classifier calls for identical tool invocations.
|
|
6
|
+
*
|
|
7
|
+
* CC pattern: The auto-mode classifier is expensive (2 LLM calls per tool).
|
|
8
|
+
* Caching results for identical (toolName + normalized args) combinations
|
|
9
|
+
* eliminates redundant classification within a session.
|
|
10
|
+
*
|
|
11
|
+
* Cache Key: `${toolName}::${normalizedArgs}`
|
|
12
|
+
* - Args are sorted-key JSON for deterministic comparison
|
|
13
|
+
* - Bash commands are normalized (whitespace collapse, env var strip)
|
|
14
|
+
*
|
|
15
|
+
* Cache is session-scoped (cleared on session end or mode change).
|
|
16
|
+
*
|
|
17
|
+
* Reference: claude-code src/utils/permissions/permissionCache.ts
|
|
18
|
+
*/
|
|
19
|
+
export interface CachedClassification {
|
|
20
|
+
shouldBlock: boolean;
|
|
21
|
+
reason: string;
|
|
22
|
+
/** Timestamp when this classification was made */
|
|
23
|
+
classifiedAt: number;
|
|
24
|
+
/** How many times this cache entry was reused */
|
|
25
|
+
hitCount: number;
|
|
26
|
+
}
|
|
27
|
+
export declare class ClassifierCache {
|
|
28
|
+
private cache;
|
|
29
|
+
/**
|
|
30
|
+
* Look up a cached classification result.
|
|
31
|
+
* Returns undefined if not cached or expired.
|
|
32
|
+
*/
|
|
33
|
+
get(toolName: string, args: Record<string, unknown>): CachedClassification | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Store a classification result.
|
|
36
|
+
*/
|
|
37
|
+
set(toolName: string, args: Record<string, unknown>, result: {
|
|
38
|
+
shouldBlock: boolean;
|
|
39
|
+
reason: string;
|
|
40
|
+
}): void;
|
|
41
|
+
/**
|
|
42
|
+
* Check if a tool+args combination is cached.
|
|
43
|
+
*/
|
|
44
|
+
has(toolName: string, args: Record<string, unknown>): boolean;
|
|
45
|
+
/** Clear all cached classifications (called on mode change or session end) */
|
|
46
|
+
clear(): void;
|
|
47
|
+
/** Number of cached entries */
|
|
48
|
+
get size(): number;
|
|
49
|
+
/** Total cache hits across all entries */
|
|
50
|
+
get totalHits(): number;
|
|
51
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Denial Tracking — CC denialTracking.ts parity.
|
|
3
|
+
*
|
|
4
|
+
* Tracks consecutive and total classifier denials to determine
|
|
5
|
+
* when to fall back to interactive prompting.
|
|
6
|
+
*
|
|
7
|
+
* CC reference: src/utils/permissions/denialTracking.ts
|
|
8
|
+
*
|
|
9
|
+
* Integration:
|
|
10
|
+
* - recordDenial() after each classifier block
|
|
11
|
+
* - recordSuccess() after each classifier allow
|
|
12
|
+
* - shouldFallbackToPrompting() before skipping approval dialog
|
|
13
|
+
*/
|
|
14
|
+
export interface DenialTrackingState {
|
|
15
|
+
consecutiveDenials: number;
|
|
16
|
+
totalDenials: number;
|
|
17
|
+
}
|
|
18
|
+
export declare const DENIAL_LIMITS: {
|
|
19
|
+
/** Max consecutive denials before falling back to prompting. */
|
|
20
|
+
readonly maxConsecutive: 3;
|
|
21
|
+
/** Max total denials in a session before forcing prompt mode. */
|
|
22
|
+
readonly maxTotal: 20;
|
|
23
|
+
};
|
|
24
|
+
export declare function createDenialTrackingState(): DenialTrackingState;
|
|
25
|
+
/**
|
|
26
|
+
* Record a classifier denial. Increments both counters.
|
|
27
|
+
* Returns a new state object (immutable pattern).
|
|
28
|
+
*/
|
|
29
|
+
export declare function recordDenial(state: DenialTrackingState): DenialTrackingState;
|
|
30
|
+
/**
|
|
31
|
+
* Record a classifier success. Resets consecutive counter only.
|
|
32
|
+
* Returns same reference if no change needed (optimization).
|
|
33
|
+
*/
|
|
34
|
+
export declare function recordSuccess(state: DenialTrackingState): DenialTrackingState;
|
|
35
|
+
/**
|
|
36
|
+
* Check if the classifier should fall back to interactive prompting.
|
|
37
|
+
*
|
|
38
|
+
* CC pattern: After N consecutive denials or M total denials,
|
|
39
|
+
* the auto-classifier is likely miscalibrated — show the user
|
|
40
|
+
* the approval dialog instead.
|
|
41
|
+
*/
|
|
42
|
+
export declare function shouldFallbackToPrompting(state: DenialTrackingState): boolean;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import type { HookRegistry } from "../../contracts/hooks.js";
|
|
2
|
+
import type { ToolDefinition } from "../../agent/types.js";
|
|
3
|
+
import { PermissionRuleEngine } from "./rule-engine.js";
|
|
4
|
+
import type { PermissionUpdate, ApprovalRequest, ApprovalResponse } from "./types.js";
|
|
5
|
+
import { type ClassifierLLMCall } from "./permission-classifier.js";
|
|
6
|
+
import type { PermissionRole } from "../../orchestration/task-types.js";
|
|
7
|
+
export interface PermissionCheckerDeps {
|
|
8
|
+
ruleEngine: PermissionRuleEngine;
|
|
9
|
+
hookRegistry: HookRegistry;
|
|
10
|
+
/**
|
|
11
|
+
* Callback to send an approval request to the host (Gateway/Electron).
|
|
12
|
+
* Must return a promise that resolves when the user responds.
|
|
13
|
+
* If the host does not support approval, this should reject or return denied.
|
|
14
|
+
*/
|
|
15
|
+
onRequestApproval: (request: ApprovalRequest) => Promise<ApprovalResponse>;
|
|
16
|
+
/** Called when a persistent permission update is returned from the approval dialog */
|
|
17
|
+
onPermissionUpdate?: (update: PermissionUpdate) => void;
|
|
18
|
+
/** Called when a tool is denied (for logging/observability) */
|
|
19
|
+
onDenied?: (toolName: string, message: string) => void;
|
|
20
|
+
/**
|
|
21
|
+
* LLM call function for the auto-mode classifier (cc yoloClassifier pattern).
|
|
22
|
+
* If not provided, auto mode falls back to the approval dialog.
|
|
23
|
+
*/
|
|
24
|
+
classifierLLMCall?: ClassifierLLMCall;
|
|
25
|
+
/**
|
|
26
|
+
* Recent conversation messages for classifier context.
|
|
27
|
+
* Called lazily when the classifier needs to run.
|
|
28
|
+
*/
|
|
29
|
+
getRecentMessages?: () => import("../../agent/types.js").ChatMessage[];
|
|
30
|
+
/**
|
|
31
|
+
* Permission role context (CC: interactive/coordinator/worker).
|
|
32
|
+
* Determines how the checker behaves:
|
|
33
|
+
* - interactive: full approval dialog flow (default)
|
|
34
|
+
* - coordinator: auto-approve non-destructive ops, no user prompts
|
|
35
|
+
* - worker: classifier-only path, no approval dialog fallback
|
|
36
|
+
*/
|
|
37
|
+
permissionRole?: PermissionRole;
|
|
38
|
+
}
|
|
39
|
+
export declare class PermissionChecker {
|
|
40
|
+
private readonly ruleEngine;
|
|
41
|
+
private readonly hookRegistry;
|
|
42
|
+
private readonly onRequestApproval;
|
|
43
|
+
private readonly onPermissionUpdate;
|
|
44
|
+
private readonly onDenied;
|
|
45
|
+
private readonly classifierLLMCall;
|
|
46
|
+
private readonly getRecentMessages;
|
|
47
|
+
private readonly permissionRole;
|
|
48
|
+
private readonly pendingApprovals;
|
|
49
|
+
private unregisterHook;
|
|
50
|
+
/** Tool meta cache — populated from ToolDefinition[] at agent creation */
|
|
51
|
+
private toolMetaCache;
|
|
52
|
+
/** Classifier result cache — avoids redundant LLM calls (CC permissionCache parity) */
|
|
53
|
+
private classifierCache;
|
|
54
|
+
/** Denial tracking state — CC denialTracking.ts parity */
|
|
55
|
+
private denialTracking;
|
|
56
|
+
constructor(deps: PermissionCheckerDeps);
|
|
57
|
+
/**
|
|
58
|
+
* Register the permission check hook on the HookRegistry.
|
|
59
|
+
* Returns an unregister function.
|
|
60
|
+
*/
|
|
61
|
+
register(): () => void;
|
|
62
|
+
/**
|
|
63
|
+
* Resolve an incoming approval response (called by host RPC handler).
|
|
64
|
+
*/
|
|
65
|
+
resolveApproval(response: ApprovalResponse): void;
|
|
66
|
+
/**
|
|
67
|
+
* Update tool metadata cache (call when tool list changes).
|
|
68
|
+
*/
|
|
69
|
+
setToolMeta(tools: ToolDefinition[]): void;
|
|
70
|
+
get ruleEngineRef(): PermissionRuleEngine;
|
|
71
|
+
/** Fire permission.denied hook + onDenied callback */
|
|
72
|
+
private fireDenied;
|
|
73
|
+
private handleResult;
|
|
74
|
+
/**
|
|
75
|
+
* Worker/coordinator "ask" handler: classifier-only, no approval dialog.
|
|
76
|
+
* CC pattern: headless workers never prompt users.
|
|
77
|
+
*/
|
|
78
|
+
private handleWorkerAsk;
|
|
79
|
+
private requestApproval;
|
|
80
|
+
/**
|
|
81
|
+
* Clear the classifier cache (CC parity: called on mode change / session end).
|
|
82
|
+
*/
|
|
83
|
+
clearClassifierCache(): void;
|
|
84
|
+
private cancelAllPending;
|
|
85
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { PermissionRuleEngine, parsePermissionConfig } from "./rule-engine.js";
|
|
2
|
+
export { PermissionChecker } from "./hook-runner.js";
|
|
3
|
+
export type { PermissionCheckerDeps } from "./hook-runner.js";
|
|
4
|
+
export { classifyToolAction, isAutoModeAllowlistedTool, } from "./permission-classifier.js";
|
|
5
|
+
export type { ClassifierLLMCall, ClassifierResult, } from "./permission-classifier.js";
|
|
6
|
+
export { classifyBashCommand } from "./bash-classifier.js";
|
|
7
|
+
export type { BashClassifyResult } from "./bash-classifier.js";
|
|
8
|
+
export { ClassifierCache } from "./classifier-cache.js";
|
|
9
|
+
export type { CachedClassification } from "./classifier-cache.js";
|
|
10
|
+
export { watchSettings, loadInitialSettings } from "./settings-watcher.js";
|
|
11
|
+
export type { SettingsFile, SettingsWatcherDeps } from "./settings-watcher.js";
|
|
12
|
+
export type { PermissionMode, PermissionBehavior, PermissionResult, PermissionRuleEntry, PermissionConfig, PermissionUpdate, PermissionDecisionReason, ToolPermissionCheckInput, ApprovalRequest, ApprovalResponse, } from "./types.js";
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { ChatMessage } from "../../agent/types.js";
|
|
2
|
+
export interface ClassifierResult {
|
|
3
|
+
shouldBlock: boolean;
|
|
4
|
+
reason: string;
|
|
5
|
+
stage: "allowlist" | "fast" | "thinking";
|
|
6
|
+
durationMs: number;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* LLM call interface — injected by the host so the classifier
|
|
10
|
+
* doesn't depend on a specific LLM client.
|
|
11
|
+
*/
|
|
12
|
+
export interface ClassifierLLMCall {
|
|
13
|
+
(params: {
|
|
14
|
+
system: string;
|
|
15
|
+
messages: Array<{
|
|
16
|
+
role: "user" | "assistant";
|
|
17
|
+
content: string;
|
|
18
|
+
}>;
|
|
19
|
+
maxTokens: number;
|
|
20
|
+
temperature: number;
|
|
21
|
+
stop?: string[];
|
|
22
|
+
/** If true, host should cache the system prompt (cc cache_control). */
|
|
23
|
+
cacheSystemPrompt?: boolean;
|
|
24
|
+
}): Promise<{
|
|
25
|
+
text: string;
|
|
26
|
+
usage?: {
|
|
27
|
+
promptTokens: number;
|
|
28
|
+
completionTokens: number;
|
|
29
|
+
};
|
|
30
|
+
}>;
|
|
31
|
+
}
|
|
32
|
+
export declare function isAutoModeAllowlistedTool(toolName: string): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Two-stage XML classifier for auto-mode permission decisions.
|
|
35
|
+
*
|
|
36
|
+
* Stage 1 (fast): Quick classification with minimal tokens.
|
|
37
|
+
* Stage 2 (thinking): Only if stage 1 blocks, do a more careful review.
|
|
38
|
+
*
|
|
39
|
+
* cc reference: classifyYoloAction() in yoloClassifier.ts
|
|
40
|
+
*/
|
|
41
|
+
export declare function classifyToolAction(toolName: string, toolArgs: Record<string, unknown>, recentMessages: ChatMessage[], llmCall: ClassifierLLMCall): Promise<ClassifierResult>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { PermissionMode, PermissionBehavior, PermissionResult, PermissionRuleEntry, PermissionConfig, PermissionUpdate, ToolPermissionCheckInput } from "./types.js";
|
|
2
|
+
export declare class PermissionRuleEngine {
|
|
3
|
+
private mode;
|
|
4
|
+
private rules;
|
|
5
|
+
private defaultBehavior;
|
|
6
|
+
private compiledPatterns;
|
|
7
|
+
constructor(config: PermissionConfig);
|
|
8
|
+
getMode(): PermissionMode;
|
|
9
|
+
setMode(mode: PermissionMode): void;
|
|
10
|
+
getRules(): readonly PermissionRuleEntry[];
|
|
11
|
+
getDefaultBehavior(): PermissionBehavior;
|
|
12
|
+
/** Replace all rules at once (for settings hot-reload). */
|
|
13
|
+
replaceRules(rules: PermissionRuleEntry[]): void;
|
|
14
|
+
/** Update the default behavior (for settings hot-reload). */
|
|
15
|
+
setDefaultBehavior(behavior: PermissionBehavior): void;
|
|
16
|
+
addRule(rule: PermissionRuleEntry): void;
|
|
17
|
+
/**
|
|
18
|
+
* Apply a persistent permission update (e.g. from approval dialog "always allow").
|
|
19
|
+
*/
|
|
20
|
+
applyUpdate(update: PermissionUpdate): void;
|
|
21
|
+
/**
|
|
22
|
+
* 4-layer permission check (cc hasPermissionsToUseTool parity).
|
|
23
|
+
*
|
|
24
|
+
* Layer 0: Mode override
|
|
25
|
+
* Layer 1: Explicit rules (first match wins)
|
|
26
|
+
* Layer 2: Tool metadata (isReadOnly/isDangerous/requiresApproval)
|
|
27
|
+
* Layer 3: Default behavior
|
|
28
|
+
*/
|
|
29
|
+
check(input: ToolPermissionCheckInput): PermissionResult;
|
|
30
|
+
private compileRules;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Parse permission config from Gateway-injected or local settings.
|
|
34
|
+
*
|
|
35
|
+
* Accepts cc-compatible format:
|
|
36
|
+
* { mode?: "default", allow: [...], deny: [...], ask: [...], default?: "allow" }
|
|
37
|
+
*
|
|
38
|
+
* And extended rule format:
|
|
39
|
+
* { rules: [{ pattern, behavior, reason, source }] }
|
|
40
|
+
*/
|
|
41
|
+
export declare function parsePermissionConfig(raw: unknown): PermissionConfig;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Settings Watcher — CC settings.json hot-reload parity.
|
|
3
|
+
*
|
|
4
|
+
* Watches the project-local settings file and reloads permission rules
|
|
5
|
+
* when it changes on disk. This allows users to adjust permission rules
|
|
6
|
+
* without restarting the agent session.
|
|
7
|
+
*
|
|
8
|
+
* Settings file location: `.openclaw/settings.json` in the project root
|
|
9
|
+
*
|
|
10
|
+
* Watched fields:
|
|
11
|
+
* - permissionMode: PermissionMode
|
|
12
|
+
* - permissionRules: PermissionRuleEntry[]
|
|
13
|
+
* - defaultBehavior: PermissionBehavior
|
|
14
|
+
*
|
|
15
|
+
* CC reference: src/utils/settings/settings.ts (watchSettings, applySettings)
|
|
16
|
+
*/
|
|
17
|
+
import type { HookRegistry } from "../../contracts/hooks.js";
|
|
18
|
+
import type { PermissionRuleEntry, PermissionMode, PermissionBehavior } from "./types.js";
|
|
19
|
+
import { PermissionRuleEngine } from "./rule-engine.js";
|
|
20
|
+
/** On-disk settings file schema */
|
|
21
|
+
export interface SettingsFile {
|
|
22
|
+
permissionMode?: PermissionMode;
|
|
23
|
+
permissionRules?: PermissionRuleEntry[];
|
|
24
|
+
defaultBehavior?: PermissionBehavior;
|
|
25
|
+
}
|
|
26
|
+
export interface SettingsWatcherDeps {
|
|
27
|
+
/** Project root directory (where .openclaw/ lives) */
|
|
28
|
+
projectRoot: string;
|
|
29
|
+
/** Permission rule engine to update on changes */
|
|
30
|
+
ruleEngine: PermissionRuleEngine;
|
|
31
|
+
/** Hook registry for config.changed events */
|
|
32
|
+
hooks?: HookRegistry;
|
|
33
|
+
/** Logger */
|
|
34
|
+
log?: (msg: string) => void;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Watch the settings file for changes and hot-reload permission rules.
|
|
38
|
+
*
|
|
39
|
+
* Returns an unsubscribe function.
|
|
40
|
+
*/
|
|
41
|
+
export declare function watchSettings(deps: SettingsWatcherDeps): () => void;
|
|
42
|
+
/**
|
|
43
|
+
* Load initial settings (non-watching).
|
|
44
|
+
* Call at session start to apply project settings before the watcher starts.
|
|
45
|
+
*/
|
|
46
|
+
export declare function loadInitialSettings(projectRoot: string, ruleEngine: PermissionRuleEngine): Promise<SettingsFile | null>;
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* User-configurable permission modes.
|
|
3
|
+
*
|
|
4
|
+
* cc reference:
|
|
5
|
+
* 'default' → normal prompting
|
|
6
|
+
* 'bypassPermissions' → auto-accept all
|
|
7
|
+
* 'acceptEdits' → auto-accept edits only
|
|
8
|
+
* 'dontAsk' → auto-deny all
|
|
9
|
+
* 'plan' → planning mode (pause execution)
|
|
10
|
+
*
|
|
11
|
+
* We keep the cc names for compatibility.
|
|
12
|
+
*/
|
|
13
|
+
export type PermissionMode = "default" | "bypassPermissions" | "acceptEdits" | "dontAsk" | "plan" | "auto";
|
|
14
|
+
export declare const PERMISSION_MODES: readonly PermissionMode[];
|
|
15
|
+
export type PermissionBehavior = "allow" | "deny" | "ask";
|
|
16
|
+
export type PermissionDecisionReason = {
|
|
17
|
+
type: "rule";
|
|
18
|
+
rule: PermissionRuleEntry;
|
|
19
|
+
} | {
|
|
20
|
+
type: "mode";
|
|
21
|
+
mode: PermissionMode;
|
|
22
|
+
} | {
|
|
23
|
+
type: "hook";
|
|
24
|
+
hookName: string;
|
|
25
|
+
reason: string;
|
|
26
|
+
} | {
|
|
27
|
+
type: "classifier";
|
|
28
|
+
classifier: string;
|
|
29
|
+
reason: string;
|
|
30
|
+
} | {
|
|
31
|
+
type: "tool_check";
|
|
32
|
+
reason: string;
|
|
33
|
+
} | {
|
|
34
|
+
type: "eligibility";
|
|
35
|
+
reasonCodes: string[];
|
|
36
|
+
} | {
|
|
37
|
+
type: "sandbox";
|
|
38
|
+
reason: string;
|
|
39
|
+
} | {
|
|
40
|
+
type: "other";
|
|
41
|
+
reason: string;
|
|
42
|
+
};
|
|
43
|
+
export interface PermissionAllowResult {
|
|
44
|
+
behavior: "allow";
|
|
45
|
+
updatedInput?: Record<string, unknown>;
|
|
46
|
+
decisionReason?: PermissionDecisionReason;
|
|
47
|
+
}
|
|
48
|
+
export interface PermissionAskResult {
|
|
49
|
+
behavior: "ask";
|
|
50
|
+
message: string;
|
|
51
|
+
toolName: string;
|
|
52
|
+
input?: Record<string, unknown>;
|
|
53
|
+
suggestions?: PermissionUpdate[];
|
|
54
|
+
decisionReason?: PermissionDecisionReason;
|
|
55
|
+
}
|
|
56
|
+
export interface PermissionDenyResult {
|
|
57
|
+
behavior: "deny";
|
|
58
|
+
message: string;
|
|
59
|
+
decisionReason: PermissionDecisionReason;
|
|
60
|
+
}
|
|
61
|
+
export type PermissionResult = PermissionAllowResult | PermissionAskResult | PermissionDenyResult;
|
|
62
|
+
export interface PermissionUpdate {
|
|
63
|
+
/** Tool name or glob pattern */
|
|
64
|
+
pattern: string;
|
|
65
|
+
/** New rule to apply */
|
|
66
|
+
behavior: PermissionBehavior;
|
|
67
|
+
/** Human-readable description */
|
|
68
|
+
description?: string;
|
|
69
|
+
}
|
|
70
|
+
export interface PermissionRuleEntry {
|
|
71
|
+
/** Exact tool name or glob pattern */
|
|
72
|
+
pattern: string;
|
|
73
|
+
/** Action for matching tools */
|
|
74
|
+
behavior: PermissionBehavior;
|
|
75
|
+
/** Optional reason for logging/display */
|
|
76
|
+
reason?: string;
|
|
77
|
+
/** Source of this rule (config/user/plugin) */
|
|
78
|
+
source?: string;
|
|
79
|
+
}
|
|
80
|
+
export interface PermissionConfig {
|
|
81
|
+
/** Active permission mode */
|
|
82
|
+
mode: PermissionMode;
|
|
83
|
+
/** Rules evaluated in order; first match wins */
|
|
84
|
+
rules: PermissionRuleEntry[];
|
|
85
|
+
/** Default behavior when no rule matches */
|
|
86
|
+
defaultBehavior: PermissionBehavior;
|
|
87
|
+
}
|
|
88
|
+
export interface ToolPermissionCheckInput {
|
|
89
|
+
toolName: string;
|
|
90
|
+
arguments?: Record<string, unknown>;
|
|
91
|
+
/** Tool metadata from ToolDefinition.meta */
|
|
92
|
+
meta?: {
|
|
93
|
+
isReadOnly?: boolean;
|
|
94
|
+
isDangerous?: boolean;
|
|
95
|
+
requiresApproval?: boolean;
|
|
96
|
+
parallelSafe?: boolean;
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
export interface ApprovalRequest {
|
|
100
|
+
approvalId: string;
|
|
101
|
+
callId: string;
|
|
102
|
+
toolName: string;
|
|
103
|
+
arguments?: Record<string, unknown>;
|
|
104
|
+
message: string;
|
|
105
|
+
suggestions?: PermissionUpdate[];
|
|
106
|
+
}
|
|
107
|
+
export interface ApprovalResponse {
|
|
108
|
+
approvalId: string;
|
|
109
|
+
decision: "approved" | "denied";
|
|
110
|
+
updatedInput?: Record<string, unknown>;
|
|
111
|
+
/** Persistent rule to save */
|
|
112
|
+
permissionUpdate?: PermissionUpdate;
|
|
113
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { PortableTool } from "../portable-tool.js";
|
|
2
|
+
import type { HookPoint, HookHandler } from "../../contracts/hooks.js";
|
|
3
|
+
import type { WorkspaceSkill } from "../skill-types.js";
|
|
4
|
+
export type PluginHookPhase = "preToolUse" | "postToolUse" | "onTurnStart" | "onTurnEnd" | "onSessionEnd";
|
|
5
|
+
/** Map plugin hook phases to internal HookPoint names */
|
|
6
|
+
export declare const PLUGIN_HOOK_MAP: Record<PluginHookPhase, HookPoint>;
|
|
7
|
+
export interface PluginApi {
|
|
8
|
+
/** Register a tool that will be available to the LLM. */
|
|
9
|
+
registerTool(tool: PortableTool): void;
|
|
10
|
+
/** Register a hook at a specific lifecycle phase. */
|
|
11
|
+
registerHook(phase: PluginHookPhase, handler: HookHandler<any>): void;
|
|
12
|
+
/** Register a skill (Markdown instructions + metadata). */
|
|
13
|
+
registerSkill(skill: WorkspaceSkill): void;
|
|
14
|
+
/** Get plugin-scoped configuration (from openclaw/plugins/name/config.json). */
|
|
15
|
+
getConfig(): Record<string, unknown>;
|
|
16
|
+
/**
|
|
17
|
+
* Set an activation check function. When it returns false, the plugin's
|
|
18
|
+
* tools and hooks are temporarily deactivated. Results are cached for
|
|
19
|
+
* `ttlMs` (default: 60 000) to avoid expensive re-checks.
|
|
20
|
+
*/
|
|
21
|
+
setActivationCheck(checkFn: () => boolean | Promise<boolean>, ttlMs?: number): void;
|
|
22
|
+
/** Plugin's own name (directory name). */
|
|
23
|
+
readonly pluginName: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Every plugin must export a `register` function.
|
|
27
|
+
* Called once during plugin loading.
|
|
28
|
+
*/
|
|
29
|
+
export interface PluginModule {
|
|
30
|
+
register(api: PluginApi): void | Promise<void>;
|
|
31
|
+
}
|
|
32
|
+
export interface LoadedPlugin {
|
|
33
|
+
name: string;
|
|
34
|
+
directory: string;
|
|
35
|
+
toolCount: number;
|
|
36
|
+
hookCount: number;
|
|
37
|
+
skillCount: number;
|
|
38
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { ToolRegistry } from "../tool-registry.js";
|
|
2
|
+
import type { HookRegistry } from "../../contracts/hooks.js";
|
|
3
|
+
import type { WorkspaceSkill } from "../skill-types.js";
|
|
4
|
+
import { type LoadedPlugin } from "./plugin-api.js";
|
|
5
|
+
export interface PluginLoaderConfig {
|
|
6
|
+
/** Directories to scan for plugins (order = priority) */
|
|
7
|
+
pluginDirs: string[];
|
|
8
|
+
/** ToolRegistry to inject plugin tools into */
|
|
9
|
+
toolRegistry: ToolRegistry;
|
|
10
|
+
/** HookRegistry to wire plugin hooks into */
|
|
11
|
+
hookRegistry: HookRegistry;
|
|
12
|
+
/** Logger */
|
|
13
|
+
log?: {
|
|
14
|
+
info(msg: string): void;
|
|
15
|
+
warn(msg: string): void;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export declare class PluginLoader {
|
|
19
|
+
private config;
|
|
20
|
+
private loaded;
|
|
21
|
+
private pluginSkills;
|
|
22
|
+
private activations;
|
|
23
|
+
private log;
|
|
24
|
+
constructor(config: PluginLoaderConfig);
|
|
25
|
+
/**
|
|
26
|
+
* Discover and load all plugins from configured directories.
|
|
27
|
+
* Returns the list of successfully loaded plugins.
|
|
28
|
+
*/
|
|
29
|
+
loadAll(): Promise<LoadedPlugin[]>;
|
|
30
|
+
/**
|
|
31
|
+
* Get all skills registered by plugins.
|
|
32
|
+
*/
|
|
33
|
+
getPluginSkills(): WorkspaceSkill[];
|
|
34
|
+
/**
|
|
35
|
+
* Get list of all loaded plugins.
|
|
36
|
+
*/
|
|
37
|
+
getLoaded(): LoadedPlugin[];
|
|
38
|
+
/**
|
|
39
|
+
* Re-check activation for plugins whose TTL has expired.
|
|
40
|
+
* Call this before tool resolution or periodically in the agent loop.
|
|
41
|
+
* Only re-runs check functions when the cache has expired.
|
|
42
|
+
*/
|
|
43
|
+
refreshActivations(): Promise<void>;
|
|
44
|
+
private loadPlugin;
|
|
45
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export interface MarketplaceSource {
|
|
2
|
+
/** Source type */
|
|
3
|
+
type: "npm" | "git" | "url";
|
|
4
|
+
/** Package name (npm), git URL, or zip URL */
|
|
5
|
+
specifier: string;
|
|
6
|
+
/** Optional version constraint (npm only) */
|
|
7
|
+
version?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface MarketplaceConfig {
|
|
10
|
+
/** Enabled plugins from marketplace */
|
|
11
|
+
enabledPlugins: MarketplaceSource[];
|
|
12
|
+
/**
|
|
13
|
+
* Enterprise policy: only allow plugins matching these names.
|
|
14
|
+
* If set, any plugin not in the allowlist is blocked.
|
|
15
|
+
*/
|
|
16
|
+
allowlist?: string[];
|
|
17
|
+
/**
|
|
18
|
+
* Enterprise policy: block these plugin names.
|
|
19
|
+
*/
|
|
20
|
+
blocklist?: string[];
|
|
21
|
+
}
|
|
22
|
+
export interface MarketplaceCatalogEntry {
|
|
23
|
+
/** Plugin name */
|
|
24
|
+
name: string;
|
|
25
|
+
/** Installed version */
|
|
26
|
+
version: string;
|
|
27
|
+
/** Source that provided this plugin */
|
|
28
|
+
source: MarketplaceSource;
|
|
29
|
+
/** Local install path */
|
|
30
|
+
installPath: string;
|
|
31
|
+
/** Install timestamp */
|
|
32
|
+
installedAt: string;
|
|
33
|
+
}
|
|
34
|
+
export interface InstalledPluginsManifest {
|
|
35
|
+
version: 1;
|
|
36
|
+
plugins: MarketplaceCatalogEntry[];
|
|
37
|
+
}
|
|
38
|
+
export interface MarketplaceLogger {
|
|
39
|
+
info(msg: string): void;
|
|
40
|
+
warn(msg: string): void;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Load plugins from cache only (no network). Fast startup path.
|
|
44
|
+
* CC parity: loadAllPluginsCacheOnly()
|
|
45
|
+
*/
|
|
46
|
+
export declare function loadCachedPlugins(): string[];
|
|
47
|
+
/**
|
|
48
|
+
* Install/update marketplace plugins and return their local paths.
|
|
49
|
+
* CC parity: loadAllPluginsWithDynamic()
|
|
50
|
+
*/
|
|
51
|
+
export declare function installMarketplacePlugins(config: MarketplaceConfig, log: MarketplaceLogger): Promise<string[]>;
|
|
52
|
+
/**
|
|
53
|
+
* Get the marketplace config from user settings.
|
|
54
|
+
* Reads ~/.openclaw/marketplace.json
|
|
55
|
+
*/
|
|
56
|
+
export declare function loadMarketplaceConfig(): MarketplaceConfig | null;
|
|
57
|
+
/**
|
|
58
|
+
* Combine local plugin dirs + marketplace plugin dirs for PluginLoader.
|
|
59
|
+
* CC parity: loadAllPlugins() merges session + marketplace + builtin.
|
|
60
|
+
*/
|
|
61
|
+
export declare function resolveAllPluginDirs(localDirs: string[], log: MarketplaceLogger): Promise<string[]>;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Content block returned by tool execution.
|
|
3
|
+
* Compatible with OpenAI / Anthropic content array format.
|
|
4
|
+
*/
|
|
5
|
+
export interface ToolContentBlock {
|
|
6
|
+
type: "text" | "image";
|
|
7
|
+
text?: string;
|
|
8
|
+
/** base64-encoded image data (only when type === "image") */
|
|
9
|
+
data?: string;
|
|
10
|
+
mimeType?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Result of executing a portable tool.
|
|
14
|
+
*/
|
|
15
|
+
export interface PortableToolResult {
|
|
16
|
+
content: ToolContentBlock[];
|
|
17
|
+
/** Arbitrary structured metadata for the calling runtime. */
|
|
18
|
+
details?: Record<string, unknown>;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* A runtime-agnostic tool definition.
|
|
22
|
+
*
|
|
23
|
+
* @typeParam TParams The expected parameter shape (for TypeScript consumers).
|
|
24
|
+
*/
|
|
25
|
+
export interface PortableTool<TParams = Record<string, unknown>> {
|
|
26
|
+
/** Unique tool name (e.g. "think", "todo", "memory_query"). */
|
|
27
|
+
name: string;
|
|
28
|
+
/** Human-readable label. */
|
|
29
|
+
label: string;
|
|
30
|
+
/** Tool description shown to the LLM. */
|
|
31
|
+
description: string;
|
|
32
|
+
/** JSON Schema object describing the tool's parameters. */
|
|
33
|
+
parameters: Record<string, unknown>;
|
|
34
|
+
/**
|
|
35
|
+
* When true, the tool should NOT appear in the default tool list.
|
|
36
|
+
* The host injects it only for complex tasks (e.g. multi-step reasoning)
|
|
37
|
+
* or when explicitly activated via tool_search.
|
|
38
|
+
* This saves context tokens in simple conversations.
|
|
39
|
+
*/
|
|
40
|
+
shouldDefer?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Whether the tool can safely run concurrently with other tools.
|
|
43
|
+
* When true, the runtime may execute this tool in parallel with others.
|
|
44
|
+
* Default: false (sequential execution assumed).
|
|
45
|
+
*/
|
|
46
|
+
isConcurrencySafe?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Whether the tool only reads state and never mutates anything.
|
|
49
|
+
* Read-only tools can skip confirmation prompts in strict permission modes.
|
|
50
|
+
*/
|
|
51
|
+
isReadOnly?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Brief keyword hint for tool_search to match against
|
|
54
|
+
* (e.g. "return the final response as structured JSON").
|
|
55
|
+
*/
|
|
56
|
+
searchHint?: string;
|
|
57
|
+
/**
|
|
58
|
+
* Maximum allowed content size in characters for the tool result.
|
|
59
|
+
* The runtime should truncate/reject results exceeding this.
|
|
60
|
+
*/
|
|
61
|
+
maxResultSizeChars?: number;
|
|
62
|
+
/**
|
|
63
|
+
* Execute the tool.
|
|
64
|
+
*
|
|
65
|
+
* @param toolCallId - Unique ID for this tool invocation (for tracing).
|
|
66
|
+
* @param params - Parsed parameters matching the JSON Schema.
|
|
67
|
+
* @param signal - Optional abort signal.
|
|
68
|
+
* @returns Tool result with content blocks + optional details.
|
|
69
|
+
*/
|
|
70
|
+
execute(toolCallId: string, params: TParams, signal?: AbortSignal): Promise<PortableToolResult>;
|
|
71
|
+
}
|