qlogicagent 2.2.0 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent.js +10 -9
- package/dist/cli.js +213 -211
- package/dist/index.js +212 -210
- package/dist/orchestration.js +13 -12
- package/dist/protocol.js +1 -0
- package/dist/types/agent/constants.d.ts +4 -53
- package/dist/types/agent/tunable-defaults.d.ts +225 -0
- package/dist/types/agent/types.d.ts +24 -100
- package/dist/types/cli/stdio-server.d.ts +40 -0
- package/dist/types/cli/tool-bootstrap.d.ts +6 -0
- package/dist/types/contracts/index.d.ts +2 -3
- package/dist/types/llm/provider-def.d.ts +3 -0
- package/dist/types/llm/transport.d.ts +25 -25
- package/dist/types/llm/transports/anthropic-messages.d.ts +2 -2
- package/dist/types/llm/transports/gemini-generatecontent.d.ts +2 -2
- package/dist/types/llm/transports/openai-chat.d.ts +2 -2
- package/dist/types/llm/transports/openai-responses.d.ts +9 -9
- package/dist/types/llm/transports/volcengine-responses.d.ts +11 -11
- package/dist/types/orchestration/agent-instance.d.ts +15 -0
- package/dist/types/orchestration/skill-improvement.d.ts +39 -8
- package/dist/types/orchestration/solo-evaluator.d.ts +7 -0
- package/dist/types/orchestration/subagent/fork-subagent.d.ts +2 -2
- package/dist/types/orchestration/tool-loop/tool-choice-policy.d.ts +1 -1
- package/dist/types/protocol/methods.d.ts +143 -53
- package/dist/types/protocol/notifications.d.ts +4 -495
- package/dist/types/protocol/wire/acp-protocol.d.ts +411 -0
- package/dist/types/protocol/wire/agent-events.d.ts +32 -0
- package/dist/types/protocol/wire/agent-methods.d.ts +587 -0
- package/dist/types/protocol/wire/agent-rpc.d.ts +97 -0
- package/dist/types/protocol/wire/capability-manifest.d.ts +111 -0
- package/dist/types/protocol/wire/capability-transport.d.ts +207 -0
- package/dist/types/protocol/wire/channel-ingress.d.ts +29 -0
- package/dist/types/protocol/wire/channel.d.ts +89 -0
- package/dist/types/protocol/wire/chat-types.d.ts +87 -0
- package/dist/types/protocol/wire/checkpoint-runtime.d.ts +61 -0
- package/dist/types/protocol/wire/checkpoint.d.ts +72 -0
- package/dist/types/protocol/wire/execution.d.ts +391 -0
- package/dist/types/protocol/wire/gateway-rpc.d.ts +314 -0
- package/dist/types/protocol/wire/gateway.d.ts +62 -0
- package/dist/types/protocol/wire/hook-protocol.d.ts +37 -0
- package/dist/types/protocol/wire/index.d.ts +25 -0
- package/dist/types/protocol/wire/memory-provider-lifecycle.d.ts +80 -0
- package/dist/types/protocol/wire/notification-payloads.d.ts +581 -0
- package/dist/types/protocol/wire/provider-runtime-contract.d.ts +66 -0
- package/dist/types/protocol/wire/provider-runtime-core.d.ts +147 -0
- package/dist/types/protocol/wire/provider-runtime-io.d.ts +20 -0
- package/dist/types/protocol/wire/resource-manifest.d.ts +68 -0
- package/dist/types/protocol/wire/session.d.ts +32 -0
- package/dist/types/protocol/wire/thread-protocol.d.ts +157 -0
- package/dist/types/protocol/wire/transport.d.ts +57 -0
- package/dist/types/protocol/wire/turn.d.ts +208 -0
- package/dist/types/protocol/wire/web-capability.d.ts +51 -0
- package/dist/types/runtime/hooks/memory-hooks.d.ts +2 -5
- package/dist/types/runtime/hooks/skill-recall-hooks.d.ts +2 -4
- package/dist/types/runtime/infra/acp-types.d.ts +3 -142
- package/dist/types/runtime/infra/project-store.d.ts +6 -0
- package/dist/types/runtime/infra/skill-injector.d.ts +9 -2
- package/dist/types/runtime/infra/token-budget.d.ts +3 -3
- package/dist/types/runtime/session/index.d.ts +1 -1
- package/dist/types/runtime/session/session-memory.d.ts +46 -0
- package/dist/types/runtime/session/session-persistence.d.ts +34 -8
- package/dist/types/runtime/session/session-state.d.ts +4 -4
- package/dist/types/skills/memory/memory-tool.d.ts +1 -1
- package/dist/types/skills/memory/qmemory-adapter.d.ts +1 -1
- package/dist/types/skills/permissions/hook-runner.d.ts +4 -4
- package/dist/types/skills/permissions/permission-classifier.d.ts +2 -2
- package/dist/types/skills/skill-system/skill-source.d.ts +65 -0
- package/dist/types/skills/tools/project-switch-tool.d.ts +24 -0
- package/dist/types/skills/tools.d.ts +5 -5
- package/dist/types/transport/acp-event-emitter.d.ts +1 -1
- package/dist/types/transport/acp-server.d.ts +18 -9
- package/package.json +14 -3
|
@@ -60,6 +60,33 @@ export interface SkillStorageDeps {
|
|
|
60
60
|
/** Write the registry lock file. */
|
|
61
61
|
writeLockfile(lockfile: SkillLockfile): Promise<void>;
|
|
62
62
|
}
|
|
63
|
+
/**
|
|
64
|
+
* A single version history entry for a skill.
|
|
65
|
+
*/
|
|
66
|
+
export interface SkillVersionEntry {
|
|
67
|
+
version: string;
|
|
68
|
+
updatedAt: string;
|
|
69
|
+
changelog?: string;
|
|
70
|
+
/** Integrity hash of the SKILL.md content at this version (sha256). */
|
|
71
|
+
integrity?: string;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Usage statistics for a skill.
|
|
75
|
+
*/
|
|
76
|
+
export interface SkillUsageStats {
|
|
77
|
+
/** Total number of times this skill has been invoked/applied. */
|
|
78
|
+
invokeCount: number;
|
|
79
|
+
/** Number of turns where the skill was active and contributed. */
|
|
80
|
+
activeCount: number;
|
|
81
|
+
/** Number of times the skill received positive feedback. */
|
|
82
|
+
positiveCount: number;
|
|
83
|
+
/** Number of times the skill received negative feedback. */
|
|
84
|
+
negativeCount: number;
|
|
85
|
+
/** ISO 8601 timestamp of last use. */
|
|
86
|
+
lastUsedAt?: string;
|
|
87
|
+
/** Derived success rate = (invokeCount - negativeCount) / invokeCount */
|
|
88
|
+
successRate?: number;
|
|
89
|
+
}
|
|
63
90
|
/**
|
|
64
91
|
* Single entry in the skill lockfile.
|
|
65
92
|
*/
|
|
@@ -71,6 +98,12 @@ export interface SkillLockEntry {
|
|
|
71
98
|
scanSummary?: SkillScanSummary;
|
|
72
99
|
/** Integrity hash of the SKILL.md content (sha256). */
|
|
73
100
|
integrity?: string;
|
|
101
|
+
/** Current version (from frontmatter or auto-incremented). */
|
|
102
|
+
currentVersion?: string;
|
|
103
|
+
/** Version history — newest first. */
|
|
104
|
+
versionHistory?: SkillVersionEntry[];
|
|
105
|
+
/** Usage statistics. */
|
|
106
|
+
usage?: SkillUsageStats;
|
|
74
107
|
}
|
|
75
108
|
/**
|
|
76
109
|
* Complete lockfile for all installed skills.
|
|
@@ -79,6 +112,38 @@ export interface SkillLockfile {
|
|
|
79
112
|
version: 1;
|
|
80
113
|
entries: Record<string, SkillLockEntry>;
|
|
81
114
|
}
|
|
115
|
+
/**
|
|
116
|
+
* Record a skill usage event. Mutates the lockfile entry in-place.
|
|
117
|
+
*/
|
|
118
|
+
export declare function recordSkillUsage(lockfile: SkillLockfile, skillName: string, feedback?: "positive" | "negative" | null): void;
|
|
119
|
+
/**
|
|
120
|
+
* Record a skill version update. Pushes current version to history.
|
|
121
|
+
*/
|
|
122
|
+
export declare function recordSkillVersionUpdate(lockfile: SkillLockfile, skillName: string, newVersion: string, changelog?: string, integrity?: string): void;
|
|
123
|
+
/**
|
|
124
|
+
* Lightweight per-skill stats stored in `~/.qlogicagent/skill-stats.json`.
|
|
125
|
+
* This is independent of the lockfile — covers learned, promoted, and installed skills.
|
|
126
|
+
*/
|
|
127
|
+
export interface SkillStatsFile {
|
|
128
|
+
[skillName: string]: SkillUsageStats;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Record a skill invocation. Fire-and-forget — never throws.
|
|
132
|
+
* @param agentHome - path to `~/.qlogicagent/`
|
|
133
|
+
* @param skillName - the skill that was invoked
|
|
134
|
+
* @param success - whether the invocation completed without error
|
|
135
|
+
*/
|
|
136
|
+
export declare function trackSkillInvocation(agentHome: string, skillName: string, success: boolean): void;
|
|
137
|
+
/**
|
|
138
|
+
* Read stats for a skill. Returns undefined if no stats recorded.
|
|
139
|
+
*/
|
|
140
|
+
export declare function getSkillStats(agentHome: string, skillName: string): SkillUsageStats | undefined;
|
|
141
|
+
/**
|
|
142
|
+
* Get all skill stats. Useful for UI display.
|
|
143
|
+
*/
|
|
144
|
+
export declare function getAllSkillStats(agentHome: string): SkillStatsFile;
|
|
145
|
+
/** Reset cache (for testing). */
|
|
146
|
+
export declare function resetStatsCache(): void;
|
|
82
147
|
/**
|
|
83
148
|
* Result of a skill install operation.
|
|
84
149
|
*/
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { PortableTool } from "../portable-tool.js";
|
|
2
|
+
export declare const PROJECT_SWITCH_TOOL_NAME: "project_switch";
|
|
3
|
+
export interface ProjectSwitchToolParams {
|
|
4
|
+
projectName: string;
|
|
5
|
+
}
|
|
6
|
+
export interface ProjectSwitchToolDeps {
|
|
7
|
+
listProjects: () => Array<{
|
|
8
|
+
id: string;
|
|
9
|
+
name: string;
|
|
10
|
+
workspaceDir: string;
|
|
11
|
+
}>;
|
|
12
|
+
switchProject: (projectId: string) => {
|
|
13
|
+
id: string;
|
|
14
|
+
name: string;
|
|
15
|
+
workspaceDir: string;
|
|
16
|
+
} | null;
|
|
17
|
+
/** Called after a successful switch so the host can update cwd/notifications. */
|
|
18
|
+
onSwitched?: (project: {
|
|
19
|
+
id: string;
|
|
20
|
+
name: string;
|
|
21
|
+
workspaceDir: string;
|
|
22
|
+
}) => void;
|
|
23
|
+
}
|
|
24
|
+
export declare function createProjectSwitchTool(deps: ProjectSwitchToolDeps): PortableTool<ProjectSwitchToolParams>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Tool Registry
|
|
2
|
+
* Tool Registry 鈥?CC-aligned getAllBaseTools() pattern.
|
|
3
3
|
*
|
|
4
4
|
* CC reference: claude-code-haha/src/tools.ts
|
|
5
5
|
*
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* The registration pattern is aligned: pure function returns array.
|
|
13
13
|
*/
|
|
14
14
|
import type { PortableTool } from "./portable-tool.js";
|
|
15
|
-
import type { ToolDefinition } from "../
|
|
15
|
+
import type { ToolDefinition } from "../protocol/wire/index.js";
|
|
16
16
|
import { AGENT_DISALLOWED_TOOLS, CUSTOM_AGENT_DISALLOWED_TOOLS, filterToolsForAgent } from "../agent/tool-access.js";
|
|
17
17
|
export { AGENT_DISALLOWED_TOOLS, CUSTOM_AGENT_DISALLOWED_TOOLS, filterToolsForAgent };
|
|
18
18
|
/**
|
|
@@ -52,14 +52,14 @@ export declare function getToolCount(): number;
|
|
|
52
52
|
*/
|
|
53
53
|
export declare function executeTool(name: string, toolCallId: string, args: Record<string, unknown>, signal?: AbortSignal): Promise<import("./portable-tool.js").PortableToolResult>;
|
|
54
54
|
/**
|
|
55
|
-
* CC: getTools()
|
|
55
|
+
* CC: getTools() 鈥?return all enabled tools.
|
|
56
56
|
* Filters the pool by isEnabled() gate; disabled tools are invisible to callers.
|
|
57
57
|
* CC reference: claude-code-haha/src/tools.ts getTools()
|
|
58
58
|
*/
|
|
59
59
|
export declare function getTools(): PortableTool[];
|
|
60
60
|
/**
|
|
61
61
|
* Activate a deferred tool so it appears in subsequent LLM manifests.
|
|
62
|
-
* CC parity: tool_search select:
|
|
62
|
+
* CC parity: tool_search select: 鈫?activateTool 鈫?tool included in manifest.
|
|
63
63
|
* Returns true if the tool exists, is enabled, and was activated.
|
|
64
64
|
*/
|
|
65
65
|
export declare function activateTool(name: string): boolean;
|
|
@@ -73,7 +73,7 @@ export declare function isToolActivated(name: string): boolean;
|
|
|
73
73
|
export declare function clearActivatedTools(): void;
|
|
74
74
|
/**
|
|
75
75
|
* Generate ToolDefinition[] manifest for LLM tool_use.
|
|
76
|
-
* Filters by isEnabled()
|
|
76
|
+
* Filters by isEnabled() 鈥?disabled tools never reach the model.
|
|
77
77
|
* Deferred tools are excluded UNLESS they have been activated via tool_search.
|
|
78
78
|
* CC: getTools() + manifest generation combined.
|
|
79
79
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* ACP Event Emitter
|
|
2
|
+
* ACP Event Emitter 鈥?translates internal qlogicagent notifications to ACP
|
|
3
3
|
* session/update notifications.
|
|
4
4
|
*
|
|
5
5
|
* Maps the 47+ internal notification methods (turn.delta, turn.tool_call, etc.)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* ACP Server
|
|
2
|
+
* ACP Server 鈥?Agent-Client Protocol server layer for qlogicagent.
|
|
3
3
|
*
|
|
4
4
|
* This module implements qlogicagent as an ACP Server, allowing any ACP-compliant
|
|
5
5
|
* host (AionUI, Cursor, openclaw, etc.) to connect and interact with the agent.
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* existing internal handlers.
|
|
18
18
|
*/
|
|
19
19
|
import type { Transport } from "../cli/transport.js";
|
|
20
|
-
import { type AcpInitializeParams, type AcpInitializeResult, type AcpSessionNewParams, type AcpSessionNewResult, type AcpSessionPromptParams, type AcpSessionPromptResult, type AcpSessionEndParams, type AcpSessionSetConfigParams, type AcpSessionUpdateType, type AcpPermissionRequestParams, type AcpPermissionRequestResult } from "
|
|
20
|
+
import { type AcpInitializeParams, type AcpInitializeResult, type AcpSessionNewParams, type AcpSessionNewResult, type AcpSessionPromptParams, type AcpSessionPromptResult, type AcpSessionEndParams, type AcpSessionSetConfigParams, type AcpSessionUpdateType, type AcpPermissionRequestParams, type AcpPermissionRequestResult } from "../protocol/wire/index.js";
|
|
21
21
|
export declare const ACP_ERROR_CODES: {
|
|
22
22
|
readonly PARSE_ERROR: -32700;
|
|
23
23
|
readonly INVALID_REQUEST: -32600;
|
|
@@ -54,26 +54,33 @@ export interface AcpRequestHandler {
|
|
|
54
54
|
ok: boolean;
|
|
55
55
|
summary?: string;
|
|
56
56
|
}>;
|
|
57
|
+
handleAcpAgentsList(): Promise<unknown>;
|
|
57
58
|
handleAcpSoloStart(params: Record<string, unknown>): Promise<unknown>;
|
|
58
59
|
handleAcpSoloStatus(params: Record<string, unknown>): Promise<unknown>;
|
|
59
60
|
handleAcpSoloSelect(params: Record<string, unknown>): Promise<unknown>;
|
|
61
|
+
handleAcpSoloCancel(params: Record<string, unknown>): Promise<unknown>;
|
|
62
|
+
handleAcpSoloSubscribe(params: Record<string, unknown>): Promise<unknown>;
|
|
60
63
|
handleAcpProductCreate(params: Record<string, unknown>): Promise<unknown>;
|
|
64
|
+
handleAcpProductPause(params: Record<string, unknown>): Promise<unknown>;
|
|
61
65
|
handleAcpProductResume(params: Record<string, unknown>): Promise<unknown>;
|
|
66
|
+
handleAcpProductCancel(params: Record<string, unknown>): Promise<unknown>;
|
|
67
|
+
handleAcpProductRollback(params: Record<string, unknown>): Promise<unknown>;
|
|
62
68
|
handleAcpProductStatus(params: Record<string, unknown>): Promise<unknown>;
|
|
69
|
+
handleAcpProductSubscribe(params: Record<string, unknown>): Promise<unknown>;
|
|
63
70
|
handleAcpTeamDelegate(params: Record<string, unknown>): Promise<unknown>;
|
|
64
71
|
}
|
|
65
72
|
export interface AcpServerConfig {
|
|
66
73
|
verbose?: boolean;
|
|
67
74
|
}
|
|
68
75
|
/**
|
|
69
|
-
* AcpServer
|
|
76
|
+
* AcpServer 鈥?manages the ACP protocol state machine.
|
|
70
77
|
*
|
|
71
78
|
* Lifecycle:
|
|
72
79
|
* 1. Host connects (stdio)
|
|
73
|
-
* 2. Host sends `initialize`
|
|
74
|
-
* 3. Host sends `session/new`
|
|
75
|
-
* 4. Host sends `session/prompt`
|
|
76
|
-
* 5. Host sends `session/end`
|
|
80
|
+
* 2. Host sends `initialize` 鈫?agent responds with capabilities
|
|
81
|
+
* 3. Host sends `session/new` 鈫?session created
|
|
82
|
+
* 4. Host sends `session/prompt` 鈫?agent runs turn, emits session/update notifications
|
|
83
|
+
* 5. Host sends `session/end` 鈫?session cleaned up
|
|
77
84
|
*/
|
|
78
85
|
export declare class AcpServer {
|
|
79
86
|
private transport;
|
|
@@ -87,8 +94,10 @@ export declare class AcpServer {
|
|
|
87
94
|
private hostSupportsExtendedMethods;
|
|
88
95
|
/** Active session ID (ACP v1 = single session per connection) */
|
|
89
96
|
private activeSessionId;
|
|
90
|
-
/** Pending permission requests (agent
|
|
97
|
+
/** Pending permission requests (agent 鈫?host) waiting for response */
|
|
91
98
|
private pendingPermissions;
|
|
99
|
+
/** Map from outbound JSON-RPC request id 鈫?permissionId for response matching */
|
|
100
|
+
private outboundRequestMap;
|
|
92
101
|
constructor(transport: Transport, handler: AcpRequestHandler, config?: AcpServerConfig);
|
|
93
102
|
/**
|
|
94
103
|
* Route an incoming raw message through ACP protocol handling.
|
|
@@ -103,7 +112,7 @@ export declare class AcpServer {
|
|
|
103
112
|
*/
|
|
104
113
|
emitSessionUpdate(sessionId: string, type: AcpSessionUpdateType, payload: Record<string, unknown>): void;
|
|
105
114
|
/**
|
|
106
|
-
* Send a permission request to the host (agent
|
|
115
|
+
* Send a permission request to the host (agent 鈫?host RPC).
|
|
107
116
|
* Returns a promise that resolves with the host's chosen option.
|
|
108
117
|
*/
|
|
109
118
|
requestPermission(params: AcpPermissionRequestParams): Promise<AcpPermissionRequestResult>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "qlogicagent",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"description": "XiaozhiClaw Agent CLI — subprocess architecture (JSON-RPC over stdio)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -23,11 +23,23 @@
|
|
|
23
23
|
"./orchestration": {
|
|
24
24
|
"types": "./dist/types/orchestration/index.d.ts",
|
|
25
25
|
"default": "./dist/orchestration.js"
|
|
26
|
+
},
|
|
27
|
+
"./protocol": {
|
|
28
|
+
"types": "./dist/types/protocol/wire/index.d.ts",
|
|
29
|
+
"default": "./dist/protocol.js"
|
|
26
30
|
}
|
|
27
31
|
},
|
|
28
32
|
"files": [
|
|
29
33
|
"dist/"
|
|
30
34
|
],
|
|
35
|
+
"typesVersions": {
|
|
36
|
+
"*": {
|
|
37
|
+
"protocol": ["./dist/types/protocol/wire/index.d.ts"],
|
|
38
|
+
"agent": ["./dist/types/agent/agent.d.ts"],
|
|
39
|
+
"contracts": ["./dist/types/contracts/index.d.ts"],
|
|
40
|
+
"orchestration": ["./dist/types/orchestration/index.d.ts"]
|
|
41
|
+
}
|
|
42
|
+
},
|
|
31
43
|
"scripts": {
|
|
32
44
|
"dev": "tsx watch src/index.ts",
|
|
33
45
|
"build": "node scripts/build.mjs",
|
|
@@ -46,8 +58,7 @@
|
|
|
46
58
|
"nanoid": "^5.1.5",
|
|
47
59
|
"pino": "^9.6.0",
|
|
48
60
|
"pino-pretty": "^13.0.0",
|
|
49
|
-
"qlogicagent-adapter-claw": "^0.2.0"
|
|
50
|
-
"qlogicagent-runtime-contracts": "^3.0.0"
|
|
61
|
+
"qlogicagent-adapter-claw": "^0.2.0"
|
|
51
62
|
},
|
|
52
63
|
"devDependencies": {
|
|
53
64
|
"@types/node": "^22.15.0",
|