qlogicagent 0.5.3 → 0.6.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/README.md +24 -23
- package/dist/agent.js +13 -13
- package/dist/cli.js +210 -186
- package/dist/contracts.js +1 -1
- package/dist/index.js +381 -20
- package/dist/orchestration.js +14 -105
- package/dist/types/agent/agent.d.ts +1 -1
- package/dist/types/agent/constants.d.ts +2 -2
- package/dist/types/agent/tool-access.d.ts +30 -0
- package/dist/types/agent/tool-loop.d.ts +2 -4
- package/dist/types/agent/types.d.ts +1 -13
- package/dist/types/cli/main.d.ts +3 -3
- package/dist/types/cli/stdio-server.d.ts +29 -7
- package/dist/types/cli/tool-bootstrap.d.ts +24 -5
- package/dist/types/cli/transport.d.ts +40 -0
- package/dist/types/contracts/index.d.ts +0 -1
- package/dist/types/contracts/todo.d.ts +9 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/llm/model-catalog.d.ts +1 -1
- package/dist/types/orchestration/index.d.ts +14 -112
- package/dist/types/orchestration/skill-improvement.d.ts +2 -2
- package/dist/types/orchestration/{fork-subagent.d.ts → subagent/fork-subagent.d.ts} +2 -4
- package/dist/types/runtime/execution/dream-agent.d.ts +1 -1
- package/dist/types/runtime/execution/forked-agent.d.ts +1 -3
- package/dist/types/runtime/hooks/context-compression.d.ts +1 -1
- package/dist/types/runtime/infra/agent-paths.d.ts +57 -0
- package/dist/types/runtime/infra/checkpoint-backend.d.ts +8 -0
- package/dist/types/runtime/infra/disk-storage.d.ts +36 -0
- package/dist/types/runtime/infra/file-watcher.d.ts +2 -2
- package/dist/types/runtime/infra/index.d.ts +2 -0
- package/dist/types/runtime/infra/secure-storage.d.ts +1 -1
- package/dist/types/runtime/infra/task-runtime.d.ts +1 -1
- package/dist/types/runtime/prompt/instruction-loader.d.ts +6 -6
- package/dist/types/runtime/session/session-memory.d.ts +0 -1
- package/dist/types/runtime/session/session-persistence.d.ts +1 -1
- package/dist/types/skills/index.d.ts +20 -26
- package/dist/types/skills/mcp/mcp-manager.d.ts +3 -4
- package/dist/types/skills/mcp/mcp-stdio-client.d.ts +1 -1
- package/dist/types/skills/{memory-store.d.ts → memory/memory-store.d.ts} +20 -0
- package/dist/types/skills/{memory-tool.d.ts → memory/memory-tool.d.ts} +20 -0
- package/dist/types/skills/permissions/hook-runner.d.ts +1 -1
- package/dist/types/skills/permissions/settings-watcher.d.ts +2 -2
- package/dist/types/skills/plugins/plugin-api.d.ts +1 -1
- package/dist/types/skills/plugins/plugin-loader.d.ts +1 -4
- package/dist/types/skills/plugins/plugin-marketplace.d.ts +1 -1
- package/dist/types/skills/portable-tool.d.ts +34 -1
- package/dist/types/skills/todo-tool.d.ts +51 -42
- package/dist/types/skills/tools/instructions-tool.d.ts +20 -58
- package/dist/types/skills/tools/skill-invoke-tool.d.ts +2 -2
- package/dist/types/skills/tools.d.ts +65 -0
- package/package.json +2 -2
- package/dist/types/contracts/skill-candidate.d.ts +0 -63
- package/dist/types/orchestration/curator-scheduler.d.ts +0 -119
- package/dist/types/orchestration/memory-provider.d.ts +0 -14
- package/dist/types/orchestration/skill-candidate.d.ts +0 -52
- package/dist/types/orchestration/skill-consolidation.d.ts +0 -123
- package/dist/types/orchestration/skill-similarity.d.ts +0 -98
- package/dist/types/orchestration/team-orchestration.d.ts +0 -195
- package/dist/types/orchestration/team-tool-loop-wiring.d.ts +0 -92
- package/dist/types/skills/memory-query-tool.d.ts +0 -43
- package/dist/types/skills/tool-registry.d.ts +0 -29
- package/dist/types/skills/tools/memory-tool.d.ts +0 -74
- package/dist/types/skills/tools/pdf-tool.d.ts +0 -66
- /package/dist/types/orchestration/{context-collapse.d.ts → context/context-collapse.d.ts} +0 -0
- /package/dist/types/orchestration/{context-compression.d.ts → context/context-compression.d.ts} +0 -0
- /package/dist/types/orchestration/{reactive-compact.d.ts → context/reactive-compact.d.ts} +0 -0
- /package/dist/types/orchestration/{turn-loop-guard.d.ts → context/turn-loop-guard.d.ts} +0 -0
- /package/dist/types/orchestration/{error-classification.d.ts → error-handling/error-classification.d.ts} +0 -0
- /package/dist/types/orchestration/{failover-classification.d.ts → error-handling/failover-classification.d.ts} +0 -0
- /package/dist/types/orchestration/{failover-error.d.ts → error-handling/failover-error.d.ts} +0 -0
- /package/dist/types/orchestration/{retry-loop.d.ts → error-handling/retry-loop.d.ts} +0 -0
- /package/dist/types/orchestration/{agent-registry.d.ts → subagent/agent-registry.d.ts} +0 -0
- /package/dist/types/orchestration/{task-types.d.ts → subagent/task-types.d.ts} +0 -0
- /package/dist/types/orchestration/{conversation-repair.d.ts → tool-loop/conversation-repair.d.ts} +0 -0
- /package/dist/types/orchestration/{tool-choice-policy.d.ts → tool-loop/tool-choice-policy.d.ts} +0 -0
- /package/dist/types/orchestration/{tool-loop-state.d.ts → tool-loop/tool-loop-state.d.ts} +0 -0
- /package/dist/types/orchestration/{tool-schema.d.ts → tool-loop/tool-schema.d.ts} +0 -0
- /package/dist/types/skills/{memory-extractor.d.ts → memory/memory-extractor.d.ts} +0 -0
- /package/dist/types/skills/{qmemory-adapter.d.ts → memory/qmemory-adapter.d.ts} +0 -0
- /package/dist/types/skills/{skill-frontmatter.d.ts → skill-system/skill-frontmatter.d.ts} +0 -0
- /package/dist/types/skills/{skill-guard.d.ts → skill-system/skill-guard.d.ts} +0 -0
- /package/dist/types/skills/{skill-loader.d.ts → skill-system/skill-loader.d.ts} +0 -0
- /package/dist/types/skills/{skill-source.d.ts → skill-system/skill-source.d.ts} +0 -0
- /package/dist/types/skills/{skill-types.d.ts → skill-system/skill-types.d.ts} +0 -0
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { ToolRegistry } from "../tool-registry.js";
|
|
2
1
|
/** MCP resource entry from resources/list */
|
|
3
2
|
export interface McpResourceEntry {
|
|
4
3
|
uri: string;
|
|
@@ -42,7 +41,7 @@ export interface McpManagerConfig {
|
|
|
42
41
|
}
|
|
43
42
|
export declare class McpManager {
|
|
44
43
|
private clients;
|
|
45
|
-
private
|
|
44
|
+
private injected;
|
|
46
45
|
private log;
|
|
47
46
|
constructor(config: McpManagerConfig);
|
|
48
47
|
/**
|
|
@@ -50,9 +49,9 @@ export declare class McpManager {
|
|
|
50
49
|
*/
|
|
51
50
|
connectAll(): Promise<void>;
|
|
52
51
|
/**
|
|
53
|
-
* Register all MCP tools into the
|
|
52
|
+
* Register all MCP tools into the centralized tool pool.
|
|
54
53
|
*/
|
|
55
|
-
injectTools(
|
|
54
|
+
injectTools(): void;
|
|
56
55
|
/**
|
|
57
56
|
* Get names of all connected servers.
|
|
58
57
|
*/
|
|
@@ -64,7 +64,7 @@ export declare class McpStdioClient {
|
|
|
64
64
|
blob?: string;
|
|
65
65
|
}>>;
|
|
66
66
|
/**
|
|
67
|
-
* Convert MCP tools to PortableTool instances for
|
|
67
|
+
* Convert MCP tools to PortableTool instances for the tool pool.
|
|
68
68
|
* Tool names are prefixed: mcp__{serverName}__{toolName}
|
|
69
69
|
*/
|
|
70
70
|
toPortableTools(): PortableTool[];
|
|
@@ -14,6 +14,8 @@ export interface MemoryStoreResult {
|
|
|
14
14
|
export interface MemoryStoreOptions {
|
|
15
15
|
memoryCharLimit?: number;
|
|
16
16
|
userCharLimit?: number;
|
|
17
|
+
/** When true, mutations automatically persist to ~/.qlogicagent/memory.json */
|
|
18
|
+
persistToDisk?: boolean;
|
|
17
19
|
}
|
|
18
20
|
export interface MemoryStoreSerialized {
|
|
19
21
|
memory: string;
|
|
@@ -24,8 +26,10 @@ export declare class MemoryStore {
|
|
|
24
26
|
private userEntries;
|
|
25
27
|
private frozenSnapshot;
|
|
26
28
|
private snapshotFrozen;
|
|
29
|
+
private saveTimer;
|
|
27
30
|
private readonly memoryCharLimit;
|
|
28
31
|
private readonly userCharLimit;
|
|
32
|
+
private readonly persistToDisk;
|
|
29
33
|
constructor(options?: MemoryStoreOptions);
|
|
30
34
|
/**
|
|
31
35
|
* Load from serialized form (e.g. from PG or filesystem).
|
|
@@ -36,6 +40,22 @@ export declare class MemoryStore {
|
|
|
36
40
|
* Serialize current live state for persistence.
|
|
37
41
|
*/
|
|
38
42
|
serialize(): MemoryStoreSerialized;
|
|
43
|
+
/**
|
|
44
|
+
* Load from disk (~/.qlogicagent/memory.json). No-op if file doesn't exist.
|
|
45
|
+
* Call this at startup when persistToDisk is enabled.
|
|
46
|
+
*/
|
|
47
|
+
loadFromDisk(): Promise<void>;
|
|
48
|
+
/**
|
|
49
|
+
* Synchronous variant for use in sync constructors / init paths.
|
|
50
|
+
*/
|
|
51
|
+
loadFromDiskSync(): void;
|
|
52
|
+
/**
|
|
53
|
+
* Schedule a debounced save to disk (500ms). Multiple rapid mutations
|
|
54
|
+
* coalesce into a single disk write.
|
|
55
|
+
*/
|
|
56
|
+
private scheduleSave;
|
|
57
|
+
/** Flush any pending save immediately. Call before shutdown. */
|
|
58
|
+
flush(): Promise<void>;
|
|
39
59
|
/**
|
|
40
60
|
* Freeze current entries for system prompt injection.
|
|
41
61
|
* Call once at session start. After freezing, mutations update
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import type { MemoryProvider, MemorySearchResult } from "qlogicagent-runtime-contracts";
|
|
2
2
|
import type { MemoryStore, MemoryStoreTarget } from "./memory-store.js";
|
|
3
|
+
export interface MediaPreferencesSummary {
|
|
4
|
+
imageStyle?: string;
|
|
5
|
+
videoStyle?: string;
|
|
6
|
+
musicGenre?: string;
|
|
7
|
+
musicMood?: string;
|
|
8
|
+
primaryPurpose?: string;
|
|
9
|
+
colorPreference?: string;
|
|
10
|
+
}
|
|
3
11
|
export declare const MEMORY_TOOL_NAME: "memory";
|
|
4
12
|
export declare const MEMORY_TOOL_MAX_CONTENT_LENGTH = 2000;
|
|
5
13
|
export declare const MEMORY_TOOL_ACTIONS: readonly ["add", "replace", "remove", "search"];
|
|
@@ -29,6 +37,11 @@ export declare const MEMORY_TOOL_SCHEMA: {
|
|
|
29
37
|
readonly type: "string";
|
|
30
38
|
readonly description: "Required for 'search'. Natural language query to find relevant memories.";
|
|
31
39
|
};
|
|
40
|
+
readonly category: {
|
|
41
|
+
readonly type: "string";
|
|
42
|
+
readonly enum: readonly ["profile", "facts", "media", "projects"];
|
|
43
|
+
readonly description: string;
|
|
44
|
+
};
|
|
32
45
|
};
|
|
33
46
|
readonly required: readonly ["action"];
|
|
34
47
|
};
|
|
@@ -41,6 +54,7 @@ export interface MemoryToolParams {
|
|
|
41
54
|
content?: string;
|
|
42
55
|
old_text?: string;
|
|
43
56
|
query?: string;
|
|
57
|
+
category?: "profile" | "facts" | "media" | "projects";
|
|
44
58
|
}
|
|
45
59
|
export interface MemoryToolResult {
|
|
46
60
|
ok: boolean;
|
|
@@ -63,5 +77,11 @@ export interface MemoryToolExecutorDeps {
|
|
|
63
77
|
store?: MemoryStore;
|
|
64
78
|
userId: string;
|
|
65
79
|
sessionId?: string;
|
|
80
|
+
/** Query recalled facts/memories by natural language. */
|
|
81
|
+
queryGraph?: (query: string, userId: string) => string[];
|
|
82
|
+
/** Retrieve user profile summary. */
|
|
83
|
+
getProfileSummary?: (userId: string) => string | null;
|
|
84
|
+
/** Retrieve media preferences. */
|
|
85
|
+
getMediaPreferences?: (userId: string) => MediaPreferencesSummary | null;
|
|
66
86
|
}
|
|
67
87
|
export declare function executeMemoryTool(params: MemoryToolParams, deps: MemoryToolExecutorDeps): Promise<MemoryToolResult>;
|
|
@@ -3,7 +3,7 @@ import type { ToolDefinition } from "../../agent/types.js";
|
|
|
3
3
|
import { PermissionRuleEngine } from "./rule-engine.js";
|
|
4
4
|
import type { PermissionUpdate, ApprovalRequest, ApprovalResponse } from "./types.js";
|
|
5
5
|
import { type ClassifierLLMCall } from "./permission-classifier.js";
|
|
6
|
-
import type { PermissionRole } from "../../orchestration/task-types.js";
|
|
6
|
+
import type { PermissionRole } from "../../orchestration/subagent/task-types.js";
|
|
7
7
|
export interface PermissionCheckerDeps {
|
|
8
8
|
ruleEngine: PermissionRuleEngine;
|
|
9
9
|
hookRegistry: HookRegistry;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* when it changes on disk. This allows users to adjust permission rules
|
|
6
6
|
* without restarting the agent session.
|
|
7
7
|
*
|
|
8
|
-
* Settings file location: `.
|
|
8
|
+
* Settings file location: `.qlogicagent/settings.json` in the project root
|
|
9
9
|
*
|
|
10
10
|
* Watched fields:
|
|
11
11
|
* - permissionMode: PermissionMode
|
|
@@ -24,7 +24,7 @@ export interface SettingsFile {
|
|
|
24
24
|
defaultBehavior?: PermissionBehavior;
|
|
25
25
|
}
|
|
26
26
|
export interface SettingsWatcherDeps {
|
|
27
|
-
/** Project root directory (where .
|
|
27
|
+
/** Project root directory (where .qlogicagent/ lives) */
|
|
28
28
|
projectRoot: string;
|
|
29
29
|
/** Permission rule engine to update on changes */
|
|
30
30
|
ruleEngine: PermissionRuleEngine;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { PortableTool } from "../portable-tool.js";
|
|
2
2
|
import type { HookPoint, HookHandler } from "../../contracts/hooks.js";
|
|
3
|
-
import type { WorkspaceSkill } from "../skill-types.js";
|
|
3
|
+
import type { WorkspaceSkill } from "../skill-system/skill-types.js";
|
|
4
4
|
export type PluginHookPhase = "preToolUse" | "postToolUse" | "onTurnStart" | "onTurnEnd" | "onSessionEnd";
|
|
5
5
|
/** Map plugin hook phases to internal HookPoint names */
|
|
6
6
|
export declare const PLUGIN_HOOK_MAP: Record<PluginHookPhase, HookPoint>;
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import type { ToolRegistry } from "../tool-registry.js";
|
|
2
1
|
import type { HookRegistry } from "../../contracts/hooks.js";
|
|
3
|
-
import type { WorkspaceSkill } from "../skill-types.js";
|
|
2
|
+
import type { WorkspaceSkill } from "../skill-system/skill-types.js";
|
|
4
3
|
import { type LoadedPlugin } from "./plugin-api.js";
|
|
5
4
|
export interface PluginLoaderConfig {
|
|
6
5
|
/** Directories to scan for plugins (order = priority) */
|
|
7
6
|
pluginDirs: string[];
|
|
8
|
-
/** ToolRegistry to inject plugin tools into */
|
|
9
|
-
toolRegistry: ToolRegistry;
|
|
10
7
|
/** HookRegistry to wire plugin hooks into */
|
|
11
8
|
hookRegistry: HookRegistry;
|
|
12
9
|
/** Logger */
|
|
@@ -51,7 +51,7 @@ export declare function loadCachedPlugins(): string[];
|
|
|
51
51
|
export declare function installMarketplacePlugins(config: MarketplaceConfig, log: MarketplaceLogger): Promise<string[]>;
|
|
52
52
|
/**
|
|
53
53
|
* Get the marketplace config from user settings.
|
|
54
|
-
* Reads ~/.
|
|
54
|
+
* Reads ~/.qlogicagent/marketplace.json
|
|
55
55
|
*/
|
|
56
56
|
export declare function loadMarketplaceConfig(): MarketplaceConfig | null;
|
|
57
57
|
/**
|
|
@@ -23,7 +23,7 @@ export interface PortableToolResult {
|
|
|
23
23
|
* @typeParam TParams The expected parameter shape (for TypeScript consumers).
|
|
24
24
|
*/
|
|
25
25
|
export interface PortableTool<TParams = Record<string, unknown>> {
|
|
26
|
-
/** Unique tool name (e.g. "think", "todo", "
|
|
26
|
+
/** Unique tool name (e.g. "think", "todo", "memory"). */
|
|
27
27
|
name: string;
|
|
28
28
|
/** Human-readable label. */
|
|
29
29
|
label: string;
|
|
@@ -49,6 +49,27 @@ export interface PortableTool<TParams = Record<string, unknown>> {
|
|
|
49
49
|
* Read-only tools can skip confirmation prompts in strict permission modes.
|
|
50
50
|
*/
|
|
51
51
|
isReadOnly?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Whether the tool is currently available.
|
|
54
|
+
* CC parity: tools that return false are excluded from getTools().
|
|
55
|
+
* Default: true (always enabled).
|
|
56
|
+
*/
|
|
57
|
+
isEnabled?: () => boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Whether the tool performs destructive operations (delete, overwrite, etc.).
|
|
60
|
+
* CC parity: Tool.isDestructive field.
|
|
61
|
+
* Used by permission system to require confirmation.
|
|
62
|
+
*/
|
|
63
|
+
isDestructive?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Tool-specific permission check before execution.
|
|
66
|
+
* CC parity: Tool.checkPermissions — returns allow/deny with reason.
|
|
67
|
+
* Default (via buildTool): always allow, deferring to general permission system.
|
|
68
|
+
*/
|
|
69
|
+
checkPermissions?: (params: TParams) => {
|
|
70
|
+
behavior: "allow" | "deny";
|
|
71
|
+
reason?: string;
|
|
72
|
+
};
|
|
52
73
|
/**
|
|
53
74
|
* Brief keyword hint for tool_search to match against
|
|
54
75
|
* (e.g. "return the final response as structured JSON").
|
|
@@ -69,3 +90,15 @@ export interface PortableTool<TParams = Record<string, unknown>> {
|
|
|
69
90
|
*/
|
|
70
91
|
execute(toolCallId: string, params: TParams, signal?: AbortSignal): Promise<PortableToolResult>;
|
|
71
92
|
}
|
|
93
|
+
/**
|
|
94
|
+
* Build a complete PortableTool from a partial definition, filling safe defaults.
|
|
95
|
+
* CC parity: buildTool() factory in Tool.ts.
|
|
96
|
+
*
|
|
97
|
+
* Defaults (fail-closed where it matters):
|
|
98
|
+
* - isEnabled → true
|
|
99
|
+
* - isConcurrencySafe → false
|
|
100
|
+
* - isReadOnly → false
|
|
101
|
+
* - isDestructive → false
|
|
102
|
+
* - checkPermissions → { behavior: "allow" } (defer to general permission system)
|
|
103
|
+
*/
|
|
104
|
+
export declare function buildTool<TParams = Record<string, unknown>>(partial: PortableTool<TParams>): PortableTool<TParams>;
|
|
@@ -1,63 +1,72 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { TodoItemStatus } from "../contracts/todo.js";
|
|
2
2
|
import type { PortableTool } from "./portable-tool.js";
|
|
3
3
|
export declare const TODO_TOOL_NAME: "todo";
|
|
4
|
+
export declare const TODO_ACTIONS: readonly ["create", "update", "delete", "list"];
|
|
5
|
+
export type TodoAction = (typeof TODO_ACTIONS)[number];
|
|
4
6
|
export interface TodoToolParams {
|
|
5
|
-
|
|
7
|
+
action: TodoAction;
|
|
8
|
+
id?: number;
|
|
9
|
+
title?: string;
|
|
10
|
+
description?: string;
|
|
11
|
+
status?: TodoItemStatus;
|
|
12
|
+
owner?: string;
|
|
13
|
+
addBlocks?: number[];
|
|
14
|
+
addBlockedBy?: number[];
|
|
6
15
|
}
|
|
7
16
|
export declare const TODO_TOOL_SCHEMA: {
|
|
8
17
|
readonly type: "object";
|
|
9
18
|
readonly properties: {
|
|
10
|
-
readonly
|
|
11
|
-
readonly type: "
|
|
19
|
+
readonly action: {
|
|
20
|
+
readonly type: "string";
|
|
21
|
+
readonly enum: readonly ["create", "update", "delete", "list"];
|
|
12
22
|
readonly description: string;
|
|
23
|
+
};
|
|
24
|
+
readonly id: {
|
|
25
|
+
readonly type: "number";
|
|
26
|
+
readonly description: "[update|delete] Task id to operate on.";
|
|
27
|
+
};
|
|
28
|
+
readonly title: {
|
|
29
|
+
readonly type: "string";
|
|
30
|
+
readonly description: "[create|update] Task title (3-7 words).";
|
|
31
|
+
};
|
|
32
|
+
readonly description: {
|
|
33
|
+
readonly type: "string";
|
|
34
|
+
readonly description: "[create|update] Detailed task description.";
|
|
35
|
+
};
|
|
36
|
+
readonly status: {
|
|
37
|
+
readonly type: "string";
|
|
38
|
+
readonly enum: readonly ["not-started", "in-progress", "completed"];
|
|
39
|
+
readonly description: "[create|update] Task status. create defaults to not-started.";
|
|
40
|
+
};
|
|
41
|
+
readonly owner: {
|
|
42
|
+
readonly type: "string";
|
|
43
|
+
readonly description: "[create|update] Owner agent/subagent identifier.";
|
|
44
|
+
};
|
|
45
|
+
readonly addBlocks: {
|
|
46
|
+
readonly type: "array";
|
|
47
|
+
readonly items: {
|
|
48
|
+
readonly type: "number";
|
|
49
|
+
};
|
|
50
|
+
readonly description: "[update] Task IDs that this task should block.";
|
|
51
|
+
};
|
|
52
|
+
readonly addBlockedBy: {
|
|
53
|
+
readonly type: "array";
|
|
13
54
|
readonly items: {
|
|
14
|
-
readonly type: "
|
|
15
|
-
readonly properties: {
|
|
16
|
-
readonly id: {
|
|
17
|
-
readonly type: "number";
|
|
18
|
-
readonly description: "Unique numeric id (sequential from 1).";
|
|
19
|
-
};
|
|
20
|
-
readonly title: {
|
|
21
|
-
readonly type: "string";
|
|
22
|
-
readonly description: "Concise action-oriented label (3-7 words). Displayed in UI.";
|
|
23
|
-
};
|
|
24
|
-
readonly status: {
|
|
25
|
-
readonly type: "string";
|
|
26
|
-
readonly enum: readonly ["not-started", "in-progress", "completed"];
|
|
27
|
-
readonly description: "not-started | in-progress (max 1) | completed";
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
readonly required: readonly ["id", "title", "status"];
|
|
55
|
+
readonly type: "number";
|
|
31
56
|
};
|
|
57
|
+
readonly description: "[update] Task IDs that should block this task.";
|
|
32
58
|
};
|
|
33
59
|
};
|
|
34
|
-
readonly required: readonly ["
|
|
60
|
+
readonly required: readonly ["action"];
|
|
35
61
|
};
|
|
36
62
|
/**
|
|
37
|
-
* Configuration for todo tool behavior
|
|
63
|
+
* Configuration for todo tool behavior.
|
|
38
64
|
*/
|
|
39
65
|
export interface TodoToolOptions {
|
|
40
|
-
/**
|
|
41
|
-
* Unique agent/session identifier for per-agent todo isolation.
|
|
42
|
-
* When provided, different agents have independent todo lists.
|
|
43
|
-
*/
|
|
66
|
+
/** Unique agent/session identifier for per-agent todo isolation. */
|
|
44
67
|
agentId?: string;
|
|
45
|
-
/**
|
|
46
|
-
* Whether verification nudge is enabled.
|
|
47
|
-
* When all items are completed (≥3 items, none matching /verif/i),
|
|
48
|
-
* the tool signals that a verification sub-agent should be spawned.
|
|
49
|
-
*/
|
|
50
|
-
enableVerificationNudge?: boolean;
|
|
51
|
-
/**
|
|
52
|
-
* Whether to auto-clear the list when all items are completed.
|
|
53
|
-
* Matches CC behavior: allDone → newTodos = [].
|
|
54
|
-
*/
|
|
55
|
-
autoClearOnComplete?: boolean;
|
|
56
68
|
}
|
|
57
69
|
/**
|
|
58
|
-
* Create a stateful todo tool instance.
|
|
59
|
-
*
|
|
60
|
-
* Each call returns a tool with its own session-local list.
|
|
61
|
-
* Multiple instances can exist for different sessions/agents.
|
|
70
|
+
* Create a stateful todo tool instance (V2 — incremental CRUD).
|
|
62
71
|
*/
|
|
63
72
|
export declare function createTodoTool(options?: TodoToolOptions): PortableTool<TodoToolParams>;
|
|
@@ -21,83 +21,45 @@ export interface InstructionsToolDeps {
|
|
|
21
21
|
/** Remove an instruction file. Returns true if deleted. */
|
|
22
22
|
remove(projectId: string, filename: string): boolean;
|
|
23
23
|
}
|
|
24
|
-
export declare const
|
|
25
|
-
export
|
|
24
|
+
export declare const INSTRUCTIONS_TOOL_NAME: "instructions";
|
|
25
|
+
export type InstructionsAction = "list" | "read" | "write" | "edit" | "delete";
|
|
26
|
+
export interface InstructionsToolParams {
|
|
27
|
+
action: InstructionsAction;
|
|
26
28
|
project_id: string;
|
|
29
|
+
filename?: string;
|
|
30
|
+
content?: string;
|
|
31
|
+
old_text?: string;
|
|
32
|
+
new_text?: string;
|
|
27
33
|
}
|
|
28
|
-
export declare const
|
|
34
|
+
export declare const INSTRUCTIONS_TOOL_SCHEMA: {
|
|
29
35
|
readonly type: "object";
|
|
30
36
|
readonly properties: {
|
|
31
|
-
readonly
|
|
37
|
+
readonly action: {
|
|
32
38
|
readonly type: "string";
|
|
33
|
-
readonly
|
|
39
|
+
readonly enum: readonly ["list", "read", "write", "edit", "delete"];
|
|
40
|
+
readonly description: "Operation: list all files, read a file, write (create/overwrite), edit (partial replace), or delete a file.";
|
|
34
41
|
};
|
|
35
|
-
};
|
|
36
|
-
readonly required: readonly ["project_id"];
|
|
37
|
-
};
|
|
38
|
-
export declare function createInstructionsListTool(deps: InstructionsToolDeps): PortableTool<InstructionsListParams>;
|
|
39
|
-
export declare const INSTRUCTIONS_READ_TOOL_NAME: "instructions_read";
|
|
40
|
-
export interface InstructionsReadParams {
|
|
41
|
-
project_id: string;
|
|
42
|
-
filename: string;
|
|
43
|
-
}
|
|
44
|
-
export declare const INSTRUCTIONS_READ_SCHEMA: {
|
|
45
|
-
readonly type: "object";
|
|
46
|
-
readonly properties: {
|
|
47
42
|
readonly project_id: {
|
|
48
43
|
readonly type: "string";
|
|
49
44
|
readonly description: "Project ID. Use \"default\" for the default project.";
|
|
50
45
|
};
|
|
51
46
|
readonly filename: {
|
|
52
47
|
readonly type: "string";
|
|
53
|
-
readonly description: "Instruction file name (e.g. \"code-style.md\").
|
|
54
|
-
};
|
|
55
|
-
};
|
|
56
|
-
readonly required: readonly ["project_id", "filename"];
|
|
57
|
-
};
|
|
58
|
-
export declare function createInstructionsReadTool(deps: InstructionsToolDeps): PortableTool<InstructionsReadParams>;
|
|
59
|
-
export declare const INSTRUCTIONS_WRITE_TOOL_NAME: "instructions_write";
|
|
60
|
-
export interface InstructionsWriteParams {
|
|
61
|
-
project_id: string;
|
|
62
|
-
filename: string;
|
|
63
|
-
content: string;
|
|
64
|
-
}
|
|
65
|
-
export declare const INSTRUCTIONS_WRITE_SCHEMA: {
|
|
66
|
-
readonly type: "object";
|
|
67
|
-
readonly properties: {
|
|
68
|
-
readonly project_id: {
|
|
69
|
-
readonly type: "string";
|
|
70
|
-
readonly description: "Project ID. Use \"default\" for the default project.";
|
|
71
|
-
};
|
|
72
|
-
readonly filename: {
|
|
73
|
-
readonly type: "string";
|
|
74
|
-
readonly description: "Instruction file name ending in .md (e.g. \"code-style.md\"). Sub-paths like \"testing/unit-test.md\" are supported.";
|
|
48
|
+
readonly description: "Instruction file name ending in .md (e.g. \"code-style.md\"). Required for read/write/delete. Sub-paths like \"testing/unit-test.md\" are supported.";
|
|
75
49
|
};
|
|
76
50
|
readonly content: {
|
|
77
51
|
readonly type: "string";
|
|
78
|
-
readonly description: "Markdown content for the instruction file.";
|
|
52
|
+
readonly description: "Markdown content for the instruction file. Required for write action.";
|
|
79
53
|
};
|
|
80
|
-
|
|
81
|
-
readonly required: readonly ["project_id", "filename", "content"];
|
|
82
|
-
};
|
|
83
|
-
export declare function createInstructionsWriteTool(deps: InstructionsToolDeps): PortableTool<InstructionsWriteParams>;
|
|
84
|
-
export declare const INSTRUCTIONS_DELETE_TOOL_NAME: "instructions_delete";
|
|
85
|
-
export interface InstructionsDeleteParams {
|
|
86
|
-
project_id: string;
|
|
87
|
-
filename: string;
|
|
88
|
-
}
|
|
89
|
-
export declare const INSTRUCTIONS_DELETE_SCHEMA: {
|
|
90
|
-
readonly type: "object";
|
|
91
|
-
readonly properties: {
|
|
92
|
-
readonly project_id: {
|
|
54
|
+
readonly old_text: {
|
|
93
55
|
readonly type: "string";
|
|
94
|
-
readonly description: "
|
|
56
|
+
readonly description: "Required for edit action: the exact existing text to find and replace (must appear exactly once).";
|
|
95
57
|
};
|
|
96
|
-
readonly
|
|
58
|
+
readonly new_text: {
|
|
97
59
|
readonly type: "string";
|
|
98
|
-
readonly description: "
|
|
60
|
+
readonly description: "Required for edit action: the replacement text.";
|
|
99
61
|
};
|
|
100
62
|
};
|
|
101
|
-
readonly required: readonly ["
|
|
63
|
+
readonly required: readonly ["action", "project_id"];
|
|
102
64
|
};
|
|
103
|
-
export declare function
|
|
65
|
+
export declare function createInstructionsTool(deps: InstructionsToolDeps): PortableTool<InstructionsToolParams>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { PortableTool } from "../portable-tool.js";
|
|
2
|
-
import type { WorkspaceSkill } from "../skill-types.js";
|
|
2
|
+
import type { WorkspaceSkill } from "../skill-system/skill-types.js";
|
|
3
3
|
export declare const SKILL_TOOL_NAME: "skill_invoke";
|
|
4
4
|
export interface SkillInvokeParams {
|
|
5
5
|
skill: string;
|
|
@@ -35,7 +35,7 @@ export interface SkillToolDeps {
|
|
|
35
35
|
* Execute the skill instructions as a sub-turn.
|
|
36
36
|
* The implementation should:
|
|
37
37
|
* 1. Build system prompt from SKILL.md content
|
|
38
|
-
* 2. Run a sub-turn (
|
|
38
|
+
* 2. Run a sub-turn (fork) with skill instructions
|
|
39
39
|
* 3. Return the sub-turn's final response
|
|
40
40
|
*
|
|
41
41
|
* If not provided, the skill content is returned directly
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool Registry — CC-aligned getAllBaseTools() pattern.
|
|
3
|
+
*
|
|
4
|
+
* CC reference: claude-code-haha/src/tools.ts
|
|
5
|
+
*
|
|
6
|
+
* This is the SINGLE SOURCE OF TRUTH for all available tools.
|
|
7
|
+
* Tools are returned as a flat array from getAllBaseTools().
|
|
8
|
+
* Filtering/gating happens via getTools() using deny rules.
|
|
9
|
+
*
|
|
10
|
+
* Factory functions (createXxxTool) are kept because qlogicagent
|
|
11
|
+
* tools receive deps at creation time (vs CC context at call time).
|
|
12
|
+
* The registration pattern is aligned: pure function returns array.
|
|
13
|
+
*/
|
|
14
|
+
import type { PortableTool } from "./portable-tool.js";
|
|
15
|
+
import type { ToolDefinition } from "../agent/types.js";
|
|
16
|
+
import { AGENT_DISALLOWED_TOOLS, CUSTOM_AGENT_DISALLOWED_TOOLS, filterToolsForAgent } from "../agent/tool-access.js";
|
|
17
|
+
export { AGENT_DISALLOWED_TOOLS, CUSTOM_AGENT_DISALLOWED_TOOLS, filterToolsForAgent };
|
|
18
|
+
/**
|
|
19
|
+
* Register tools into the internal pool. Called by initToolDeps().
|
|
20
|
+
*/
|
|
21
|
+
export declare function setToolPool(tools: PortableTool[]): void;
|
|
22
|
+
/**
|
|
23
|
+
* Add a single tool to the pool (for dynamic tools like MCP, plugins).
|
|
24
|
+
*/
|
|
25
|
+
export declare function addTool(tool: PortableTool<any>): void;
|
|
26
|
+
/**
|
|
27
|
+
* Add multiple tools to the pool at once.
|
|
28
|
+
*/
|
|
29
|
+
export declare function addTools(tools: PortableTool<any>[]): void;
|
|
30
|
+
/**
|
|
31
|
+
* Remove a tool by name. Returns true if it existed.
|
|
32
|
+
*/
|
|
33
|
+
export declare function removeTool(name: string): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Find a tool by name.
|
|
36
|
+
*/
|
|
37
|
+
export declare function findTool(name: string): PortableTool | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* Check if a tool exists.
|
|
40
|
+
*/
|
|
41
|
+
export declare function hasTool(name: string): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Get all tool names.
|
|
44
|
+
*/
|
|
45
|
+
export declare function getToolNames(): string[];
|
|
46
|
+
/**
|
|
47
|
+
* Get the number of registered tools.
|
|
48
|
+
*/
|
|
49
|
+
export declare function getToolCount(): number;
|
|
50
|
+
/**
|
|
51
|
+
* Execute a tool by name.
|
|
52
|
+
*/
|
|
53
|
+
export declare function executeTool(name: string, toolCallId: string, args: Record<string, unknown>, signal?: AbortSignal): Promise<import("./portable-tool.js").PortableToolResult>;
|
|
54
|
+
/**
|
|
55
|
+
* CC: getTools() — return all enabled tools.
|
|
56
|
+
* Filters the pool by isEnabled() gate; disabled tools are invisible to callers.
|
|
57
|
+
* CC reference: claude-code-haha/src/tools.ts getTools()
|
|
58
|
+
*/
|
|
59
|
+
export declare function getTools(): PortableTool[];
|
|
60
|
+
/**
|
|
61
|
+
* Generate ToolDefinition[] manifest for LLM tool_use.
|
|
62
|
+
* Filters by isEnabled() — disabled tools never reach the model.
|
|
63
|
+
* CC: getTools() + manifest generation combined.
|
|
64
|
+
*/
|
|
65
|
+
export declare function getToolManifest(includeDeferred?: boolean): ToolDefinition[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "qlogicagent",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "XiaozhiClaw Agent CLI — subprocess architecture (JSON-RPC over stdio)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"dev": "tsx watch src/index.ts",
|
|
33
33
|
"build": "node scripts/build.mjs",
|
|
34
34
|
"build:tsc": "tsc --noCheck",
|
|
35
|
-
"start": "node dist/cli
|
|
35
|
+
"start": "node dist/cli.js",
|
|
36
36
|
"test": "vitest run",
|
|
37
37
|
"test:watch": "vitest",
|
|
38
38
|
"lint": "oxlint .",
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
export declare const SKILL_CANDIDATE_STATUS_VALUES: readonly ["draft", "in_review", "approved", "rejected", "canary", "published", "stale", "superseded", "rolled_back"];
|
|
2
|
-
export declare const SKILL_CANDIDATE_ACTION_VALUES: readonly ["submit-review", "approve", "reject", "start-canary", "record-effectiveness", "promote", "publish", "mark-stale", "mark-superseded", "rollback"];
|
|
3
|
-
export declare const SKILL_CANDIDATE_EFFECTIVENESS_PHASE_VALUES: readonly ["canary", "published"];
|
|
4
|
-
export type SkillCandidateStatus = (typeof SKILL_CANDIDATE_STATUS_VALUES)[number];
|
|
5
|
-
export type SkillCandidateAction = (typeof SKILL_CANDIDATE_ACTION_VALUES)[number];
|
|
6
|
-
export type SkillCandidateEffectivenessPhase = (typeof SKILL_CANDIDATE_EFFECTIVENESS_PHASE_VALUES)[number];
|
|
7
|
-
export type SkillCandidateArtifactContract = {
|
|
8
|
-
uri: string;
|
|
9
|
-
sha256?: string;
|
|
10
|
-
workspaceDir?: string;
|
|
11
|
-
relativePath?: string;
|
|
12
|
-
sourceWorkspaceDir?: string;
|
|
13
|
-
stagedAt?: string;
|
|
14
|
-
};
|
|
15
|
-
export type SkillCandidateSourceExecutionContract = {
|
|
16
|
-
executionId?: string;
|
|
17
|
-
rootExecutionId?: string;
|
|
18
|
-
parentExecutionId?: string;
|
|
19
|
-
sidechainId?: string;
|
|
20
|
-
attemptId?: string;
|
|
21
|
-
outcomeId?: string;
|
|
22
|
-
sessionId?: string;
|
|
23
|
-
turnId?: string;
|
|
24
|
-
};
|
|
25
|
-
export type SkillCandidateReviewContract = {
|
|
26
|
-
action: SkillCandidateAction;
|
|
27
|
-
actor?: string | null;
|
|
28
|
-
notes?: string | null;
|
|
29
|
-
payload?: Record<string, unknown>;
|
|
30
|
-
createdAt?: string;
|
|
31
|
-
};
|
|
32
|
-
export type SkillCandidateEffectivenessContract = {
|
|
33
|
-
phase: SkillCandidateEffectivenessPhase;
|
|
34
|
-
sampleCount: number;
|
|
35
|
-
successCount: number;
|
|
36
|
-
failureCount: number;
|
|
37
|
-
regressionCount: number;
|
|
38
|
-
successRate: number;
|
|
39
|
-
regressionRate: number;
|
|
40
|
-
avgLatencyMs?: number;
|
|
41
|
-
avgCostUsd?: number;
|
|
42
|
-
score?: number;
|
|
43
|
-
staleReason?: string | null;
|
|
44
|
-
notes?: string | null;
|
|
45
|
-
summary?: Record<string, unknown>;
|
|
46
|
-
lastObservedAt?: string;
|
|
47
|
-
updatedAt?: string;
|
|
48
|
-
/** ISO-8601 timestamp of last skill invocation/view/patch activity. */
|
|
49
|
-
lastActivityAt?: string;
|
|
50
|
-
/** Cumulative activity count (use + view + patch). */
|
|
51
|
-
activityCount?: number;
|
|
52
|
-
};
|
|
53
|
-
export declare function coerceSkillCandidateJsonObject(value: unknown): Record<string, unknown>;
|
|
54
|
-
export declare function isSkillCandidateStatus(value: unknown): value is SkillCandidateStatus;
|
|
55
|
-
export declare function isSkillCandidateAction(value: unknown): value is SkillCandidateAction;
|
|
56
|
-
export declare function isSkillCandidateEffectivenessPhase(value: unknown): value is SkillCandidateEffectivenessPhase;
|
|
57
|
-
export declare function normalizeSkillCandidateStatus(value: unknown, fallback?: SkillCandidateStatus): SkillCandidateStatus;
|
|
58
|
-
export declare function normalizeSkillCandidateAction(value: unknown): SkillCandidateAction | null;
|
|
59
|
-
export declare function normalizeSkillCandidateEffectivenessPhase(value: unknown): SkillCandidateEffectivenessPhase | null;
|
|
60
|
-
export declare function normalizeSkillCandidateArtifact(value: unknown): SkillCandidateArtifactContract | null;
|
|
61
|
-
export declare function normalizeSkillCandidateSourceExecution(value: unknown): SkillCandidateSourceExecutionContract | null;
|
|
62
|
-
export declare function normalizeSkillCandidateReview(value: unknown): SkillCandidateReviewContract | null;
|
|
63
|
-
export declare function normalizeSkillCandidateEffectiveness(value: unknown): SkillCandidateEffectivenessContract | null;
|