qlogicagent 0.2.1 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (226) hide show
  1. package/README.md +45 -45
  2. package/package.json +56 -42
  3. package/dist/agent/agent.d.ts +0 -43
  4. package/dist/agent/agent.js +0 -113
  5. package/dist/agent/tool-loop.d.ts +0 -64
  6. package/dist/agent/tool-loop.js +0 -575
  7. package/dist/agent/types.d.ts +0 -175
  8. package/dist/agent/types.js +0 -14
  9. package/dist/cli/main.d.ts +0 -11
  10. package/dist/cli/main.js +0 -23
  11. package/dist/cli/stdio-server.d.ts +0 -45
  12. package/dist/cli/stdio-server.js +0 -463
  13. package/dist/config/config.d.ts +0 -17
  14. package/dist/config/config.js +0 -21
  15. package/dist/contracts/hooks.d.ts +0 -120
  16. package/dist/contracts/hooks.js +0 -7
  17. package/dist/contracts/index.d.ts +0 -10
  18. package/dist/contracts/index.js +0 -10
  19. package/dist/contracts/planner.d.ts +0 -35
  20. package/dist/contracts/planner.js +0 -2
  21. package/dist/contracts/skill-candidate.d.ts +0 -63
  22. package/dist/contracts/skill-candidate.js +0 -195
  23. package/dist/contracts/todo.d.ts +0 -14
  24. package/dist/contracts/todo.js +0 -9
  25. package/dist/index.d.ts +0 -13
  26. package/dist/index.js +0 -15
  27. package/dist/llm/builtin-providers.d.ts +0 -10
  28. package/dist/llm/builtin-providers.js +0 -531
  29. package/dist/llm/index.d.ts +0 -15
  30. package/dist/llm/index.js +0 -14
  31. package/dist/llm/llm-client.d.ts +0 -43
  32. package/dist/llm/llm-client.js +0 -67
  33. package/dist/llm/model-catalog.d.ts +0 -53
  34. package/dist/llm/model-catalog.js +0 -191
  35. package/dist/llm/provider-def.d.ts +0 -59
  36. package/dist/llm/provider-def.js +0 -12
  37. package/dist/llm/provider-registry.d.ts +0 -54
  38. package/dist/llm/provider-registry.js +0 -147
  39. package/dist/llm/transport.d.ts +0 -62
  40. package/dist/llm/transport.js +0 -27
  41. package/dist/llm/transports/anthropic-messages.d.ts +0 -31
  42. package/dist/llm/transports/anthropic-messages.js +0 -293
  43. package/dist/llm/transports/openai-chat.d.ts +0 -36
  44. package/dist/llm/transports/openai-chat.js +0 -165
  45. package/dist/orchestration/agent-registry.d.ts +0 -41
  46. package/dist/orchestration/agent-registry.js +0 -116
  47. package/dist/orchestration/approval-aware-tool-plan.d.ts +0 -32
  48. package/dist/orchestration/approval-aware-tool-plan.js +0 -87
  49. package/dist/orchestration/context-compression.d.ts +0 -220
  50. package/dist/orchestration/context-compression.js +0 -583
  51. package/dist/orchestration/conversation-repair.d.ts +0 -61
  52. package/dist/orchestration/conversation-repair.js +0 -429
  53. package/dist/orchestration/curator-scheduler.d.ts +0 -119
  54. package/dist/orchestration/curator-scheduler.js +0 -135
  55. package/dist/orchestration/embedded-failover-policy.d.ts +0 -110
  56. package/dist/orchestration/embedded-failover-policy.js +0 -168
  57. package/dist/orchestration/error-classification.d.ts +0 -12
  58. package/dist/orchestration/error-classification.js +0 -77
  59. package/dist/orchestration/failover-classification.d.ts +0 -8
  60. package/dist/orchestration/failover-classification.js +0 -381
  61. package/dist/orchestration/failover-error.d.ts +0 -33
  62. package/dist/orchestration/failover-error.js +0 -198
  63. package/dist/orchestration/fork-subagent.d.ts +0 -100
  64. package/dist/orchestration/fork-subagent.js +0 -98
  65. package/dist/orchestration/index.d.ts +0 -120
  66. package/dist/orchestration/index.js +0 -267
  67. package/dist/orchestration/memory-flush-policy.d.ts +0 -57
  68. package/dist/orchestration/memory-flush-policy.js +0 -85
  69. package/dist/orchestration/memory-provider.d.ts +0 -14
  70. package/dist/orchestration/memory-provider.js +0 -2
  71. package/dist/orchestration/parallel-tool-calls.d.ts +0 -41
  72. package/dist/orchestration/parallel-tool-calls.js +0 -59
  73. package/dist/orchestration/prompt-cache-strategy.d.ts +0 -126
  74. package/dist/orchestration/prompt-cache-strategy.js +0 -228
  75. package/dist/orchestration/reactive-compact.d.ts +0 -73
  76. package/dist/orchestration/reactive-compact.js +0 -78
  77. package/dist/orchestration/retry-loop.d.ts +0 -22
  78. package/dist/orchestration/retry-loop.js +0 -24
  79. package/dist/orchestration/skill-candidate.d.ts +0 -52
  80. package/dist/orchestration/skill-candidate.js +0 -141
  81. package/dist/orchestration/skill-consolidation.d.ts +0 -123
  82. package/dist/orchestration/skill-consolidation.js +0 -220
  83. package/dist/orchestration/skill-improvement.d.ts +0 -59
  84. package/dist/orchestration/skill-improvement.js +0 -66
  85. package/dist/orchestration/skill-similarity.d.ts +0 -98
  86. package/dist/orchestration/skill-similarity.js +0 -131
  87. package/dist/orchestration/streaming-tool-executor.d.ts +0 -73
  88. package/dist/orchestration/streaming-tool-executor.js +0 -96
  89. package/dist/orchestration/team-orchestration.d.ts +0 -195
  90. package/dist/orchestration/team-orchestration.js +0 -369
  91. package/dist/orchestration/team-tool-loop-wiring.d.ts +0 -92
  92. package/dist/orchestration/team-tool-loop-wiring.js +0 -147
  93. package/dist/orchestration/tool-choice-policy.d.ts +0 -54
  94. package/dist/orchestration/tool-choice-policy.js +0 -164
  95. package/dist/orchestration/tool-loop-state.d.ts +0 -50
  96. package/dist/orchestration/tool-loop-state.js +0 -133
  97. package/dist/orchestration/tool-schema.d.ts +0 -39
  98. package/dist/orchestration/tool-schema.js +0 -297
  99. package/dist/orchestration/transcript-repair.d.ts +0 -42
  100. package/dist/orchestration/transcript-repair.js +0 -426
  101. package/dist/orchestration/turn-loop-guard.d.ts +0 -86
  102. package/dist/orchestration/turn-loop-guard.js +0 -92
  103. package/dist/orchestration/web-browser-policy.d.ts +0 -17
  104. package/dist/orchestration/web-browser-policy.js +0 -39
  105. package/dist/runtime/context-compression.d.ts +0 -61
  106. package/dist/runtime/context-compression.js +0 -274
  107. package/dist/runtime/hook-registry.d.ts +0 -12
  108. package/dist/runtime/hook-registry.js +0 -53
  109. package/dist/runtime/memory-hooks.d.ts +0 -23
  110. package/dist/runtime/memory-hooks.js +0 -65
  111. package/dist/runtime/tool-eligibility.d.ts +0 -59
  112. package/dist/runtime/tool-eligibility.js +0 -111
  113. package/dist/skills/index.d.ts +0 -108
  114. package/dist/skills/index.js +0 -82
  115. package/dist/skills/memory-extractor.d.ts +0 -64
  116. package/dist/skills/memory-extractor.js +0 -173
  117. package/dist/skills/memory-query-tool.d.ts +0 -43
  118. package/dist/skills/memory-query-tool.js +0 -127
  119. package/dist/skills/memory-store.d.ts +0 -66
  120. package/dist/skills/memory-store.js +0 -228
  121. package/dist/skills/memory-tool.d.ts +0 -67
  122. package/dist/skills/memory-tool.js +0 -192
  123. package/dist/skills/portable-tool.d.ts +0 -71
  124. package/dist/skills/portable-tool.js +0 -14
  125. package/dist/skills/qmemory-adapter.d.ts +0 -52
  126. package/dist/skills/qmemory-adapter.js +0 -165
  127. package/dist/skills/skill-frontmatter.d.ts +0 -19
  128. package/dist/skills/skill-frontmatter.js +0 -344
  129. package/dist/skills/skill-guard.d.ts +0 -23
  130. package/dist/skills/skill-guard.js +0 -229
  131. package/dist/skills/skill-loader.d.ts +0 -16
  132. package/dist/skills/skill-loader.js +0 -303
  133. package/dist/skills/skill-source.d.ts +0 -119
  134. package/dist/skills/skill-source.js +0 -126
  135. package/dist/skills/skill-types.d.ts +0 -199
  136. package/dist/skills/skill-types.js +0 -6
  137. package/dist/skills/think-tool.d.ts +0 -16
  138. package/dist/skills/think-tool.js +0 -59
  139. package/dist/skills/todo-tool.d.ts +0 -63
  140. package/dist/skills/todo-tool.js +0 -114
  141. package/dist/skills/tools/agent-tool.d.ts +0 -91
  142. package/dist/skills/tools/agent-tool.js +0 -142
  143. package/dist/skills/tools/apply-patch-tool.d.ts +0 -29
  144. package/dist/skills/tools/apply-patch-tool.js +0 -184
  145. package/dist/skills/tools/ask-user-tool.d.ts +0 -80
  146. package/dist/skills/tools/ask-user-tool.js +0 -121
  147. package/dist/skills/tools/brief-tool.d.ts +0 -74
  148. package/dist/skills/tools/brief-tool.js +0 -95
  149. package/dist/skills/tools/browser-tool.d.ts +0 -114
  150. package/dist/skills/tools/browser-tool.js +0 -155
  151. package/dist/skills/tools/checkpoint-tool.d.ts +0 -66
  152. package/dist/skills/tools/checkpoint-tool.js +0 -102
  153. package/dist/skills/tools/config-tool.d.ts +0 -63
  154. package/dist/skills/tools/config-tool.js +0 -143
  155. package/dist/skills/tools/cron-tool.d.ts +0 -116
  156. package/dist/skills/tools/cron-tool.js +0 -175
  157. package/dist/skills/tools/edit-tool.d.ts +0 -43
  158. package/dist/skills/tools/edit-tool.js +0 -70
  159. package/dist/skills/tools/exec-tool.d.ts +0 -102
  160. package/dist/skills/tools/exec-tool.js +0 -133
  161. package/dist/skills/tools/image-generate-tool.d.ts +0 -62
  162. package/dist/skills/tools/image-generate-tool.js +0 -67
  163. package/dist/skills/tools/instructions-tool.d.ts +0 -103
  164. package/dist/skills/tools/instructions-tool.js +0 -187
  165. package/dist/skills/tools/lsp-tool.d.ts +0 -153
  166. package/dist/skills/tools/lsp-tool.js +0 -227
  167. package/dist/skills/tools/mcp-client-types.d.ts +0 -269
  168. package/dist/skills/tools/mcp-client-types.js +0 -53
  169. package/dist/skills/tools/mcp-tool.d.ts +0 -249
  170. package/dist/skills/tools/mcp-tool.js +0 -503
  171. package/dist/skills/tools/memory-tool.d.ts +0 -74
  172. package/dist/skills/tools/memory-tool.js +0 -88
  173. package/dist/skills/tools/monitor-tool.d.ts +0 -113
  174. package/dist/skills/tools/monitor-tool.js +0 -131
  175. package/dist/skills/tools/music-generate-tool.d.ts +0 -55
  176. package/dist/skills/tools/music-generate-tool.js +0 -62
  177. package/dist/skills/tools/notify-tool.d.ts +0 -53
  178. package/dist/skills/tools/notify-tool.js +0 -62
  179. package/dist/skills/tools/patch-tool.d.ts +0 -45
  180. package/dist/skills/tools/patch-tool.js +0 -505
  181. package/dist/skills/tools/pdf-tool.d.ts +0 -66
  182. package/dist/skills/tools/pdf-tool.js +0 -88
  183. package/dist/skills/tools/plan-mode-tool.d.ts +0 -59
  184. package/dist/skills/tools/plan-mode-tool.js +0 -122
  185. package/dist/skills/tools/read-tool.d.ts +0 -51
  186. package/dist/skills/tools/read-tool.js +0 -84
  187. package/dist/skills/tools/repl-tool.d.ts +0 -70
  188. package/dist/skills/tools/repl-tool.js +0 -69
  189. package/dist/skills/tools/search-tool.d.ts +0 -112
  190. package/dist/skills/tools/search-tool.js +0 -225
  191. package/dist/skills/tools/send-message-tool.d.ts +0 -51
  192. package/dist/skills/tools/send-message-tool.js +0 -76
  193. package/dist/skills/tools/skill-list-tool.d.ts +0 -33
  194. package/dist/skills/tools/skill-list-tool.js +0 -54
  195. package/dist/skills/tools/skill-manage-tool.d.ts +0 -73
  196. package/dist/skills/tools/skill-manage-tool.js +0 -153
  197. package/dist/skills/tools/skill-view-tool.d.ts +0 -37
  198. package/dist/skills/tools/skill-view-tool.js +0 -72
  199. package/dist/skills/tools/sleep-tool.d.ts +0 -49
  200. package/dist/skills/tools/sleep-tool.js +0 -81
  201. package/dist/skills/tools/structured-output-tool.d.ts +0 -116
  202. package/dist/skills/tools/structured-output-tool.js +0 -176
  203. package/dist/skills/tools/task-tool.d.ts +0 -104
  204. package/dist/skills/tools/task-tool.js +0 -161
  205. package/dist/skills/tools/team-tool.d.ts +0 -89
  206. package/dist/skills/tools/team-tool.js +0 -105
  207. package/dist/skills/tools/tool-search-tool.d.ts +0 -51
  208. package/dist/skills/tools/tool-search-tool.js +0 -110
  209. package/dist/skills/tools/tts-tool.d.ts +0 -38
  210. package/dist/skills/tools/tts-tool.js +0 -45
  211. package/dist/skills/tools/video-edit-tool.d.ts +0 -69
  212. package/dist/skills/tools/video-edit-tool.js +0 -74
  213. package/dist/skills/tools/video-generate-tool.d.ts +0 -62
  214. package/dist/skills/tools/video-generate-tool.js +0 -66
  215. package/dist/skills/tools/video-merge-tool.d.ts +0 -105
  216. package/dist/skills/tools/video-merge-tool.js +0 -92
  217. package/dist/skills/tools/video-upscale-tool.d.ts +0 -45
  218. package/dist/skills/tools/video-upscale-tool.js +0 -52
  219. package/dist/skills/tools/web-fetch-tool.d.ts +0 -78
  220. package/dist/skills/tools/web-fetch-tool.js +0 -92
  221. package/dist/skills/tools/web-search-tool.d.ts +0 -57
  222. package/dist/skills/tools/web-search-tool.js +0 -86
  223. package/dist/skills/tools/worktree-tool.d.ts +0 -69
  224. package/dist/skills/tools/worktree-tool.js +0 -147
  225. package/dist/skills/tools/write-tool.d.ts +0 -45
  226. package/dist/skills/tools/write-tool.js +0 -81
@@ -1,175 +0,0 @@
1
- /**
2
- * Pure agent types — zero I/O framework dependencies.
3
- *
4
- * These types define the contract between:
5
- * - CLI stdio layer ↔ Agent class
6
- * - Agent class ↔ LLM Provider
7
- * - Agent class ↔ Tool loop
8
- *
9
- * Ported from Hub semantic-turn-shared.ts / semantic-turn-tools.ts,
10
- * with Hub infrastructure (WS/PG/Redis) replaced by DI interfaces.
11
- *
12
- * No imports from express/pg/ioredis/ws.
13
- */
14
- import type { SkillInstruction } from "../orchestration/index.js";
15
- import type { HookRegistry } from "../contracts/hooks.js";
16
- export type ChatMessageRole = "system" | "user" | "assistant" | "tool";
17
- export interface ChatMessage {
18
- role: ChatMessageRole;
19
- content: string | null;
20
- /** For assistant messages with tool calls */
21
- tool_calls?: ToolCallMessage[];
22
- /** For tool result messages */
23
- tool_call_id?: string;
24
- /** For tool result messages — tool name */
25
- name?: string;
26
- }
27
- export interface ToolCallMessage {
28
- id: string;
29
- type: "function";
30
- function: {
31
- name: string;
32
- arguments: string;
33
- };
34
- }
35
- export interface ToolDefinition {
36
- type: "function";
37
- function: {
38
- name: string;
39
- description: string;
40
- parameters?: Record<string, unknown>;
41
- };
42
- /** Tool scheduling metadata from host manifest (optional) */
43
- meta?: {
44
- serialOnly?: boolean;
45
- parallelSafe?: boolean;
46
- /** If true, host should request user approval before execution (CC PreToolUse parity) */
47
- requiresApproval?: boolean;
48
- /** Tool is read-only / safe — skip approval even in strict mode */
49
- isReadOnly?: boolean;
50
- /** Tool can cause irreversible side-effects — force approval in default mode */
51
- isDangerous?: boolean;
52
- };
53
- }
54
- export interface TokenUsage {
55
- prompt: number;
56
- completion: number;
57
- /** Reasoning tokens (for models like o1/DeepSeek-R1) */
58
- reasoning?: number;
59
- }
60
- export interface TurnRequest {
61
- turnId: string;
62
- sessionId: string;
63
- messages: ChatMessage[];
64
- tools: ToolDefinition[];
65
- systemPrompt?: string;
66
- config?: TurnConfig;
67
- }
68
- export interface TurnConfig {
69
- /** LLM provider id, e.g. "deepseek" */
70
- provider?: string;
71
- /** Model id, e.g. "deepseek-chat" */
72
- model?: string;
73
- /** User API key */
74
- apiKey?: string;
75
- /** Optional base URL override */
76
- baseUrl?: string;
77
- /** Max tool-call rounds per turn (default 25, max 100) */
78
- maxRounds?: number;
79
- /** Temperature override */
80
- temperature?: number;
81
- /** Context window size in tokens (for turn-loop-guard budget checks) */
82
- contextWindowTokens?: number;
83
- /** Max output tokens for current model */
84
- maxOutputTokens?: number;
85
- /** Model's absolute max output tokens (for escalation ceiling) */
86
- modelMaxOutputTokens?: number;
87
- /** Tool choice strategy: "auto" (default), "none", "required" */
88
- toolChoice?: "auto" | "none" | "required";
89
- /** Parent sidechain depth (0 = top-level, default 0) */
90
- parentDepth?: number;
91
- }
92
- export type TurnEvent = {
93
- type: "start";
94
- turnId: string;
95
- } | {
96
- type: "delta";
97
- turnId: string;
98
- text: string;
99
- } | {
100
- type: "tool_call";
101
- turnId: string;
102
- callId: string;
103
- name: string;
104
- arguments: string;
105
- } | {
106
- type: "end";
107
- turnId: string;
108
- content: string;
109
- usage?: TokenUsage;
110
- model?: string;
111
- provider?: string;
112
- } | {
113
- type: "error";
114
- turnId: string;
115
- error: string;
116
- code?: string;
117
- } | {
118
- type: "skill_instruction";
119
- turnId: string;
120
- instruction: SkillInstruction;
121
- } | {
122
- type: "tool_result";
123
- turnId: string;
124
- callId: string;
125
- name: string;
126
- ok: boolean;
127
- error?: string;
128
- } | {
129
- type: "sidechain_started";
130
- turnId: string;
131
- depth: number;
132
- role: "orchestrator" | "leaf";
133
- } | {
134
- type: "sidechain_completed";
135
- turnId: string;
136
- depth: number;
137
- toolCallCount: number;
138
- } | {
139
- type: "tool_blocked";
140
- turnId: string;
141
- callId: string;
142
- name: string;
143
- reason: string;
144
- } | {
145
- type: "recovery";
146
- turnId: string;
147
- action: string;
148
- detail?: string;
149
- } | {
150
- type: "plan_update";
151
- turnId: string;
152
- slug: string;
153
- content: string;
154
- };
155
- /**
156
- * ToolInvoker: request tool execution from the host process (Gateway).
157
- * In CLI mode this sends a JSON-RPC notification over stdio and waits for result.
158
- */
159
- export interface ToolInvoker {
160
- invoke(turnId: string, name: string, args: string, signal?: AbortSignal): Promise<{
161
- result: string;
162
- error?: string;
163
- }>;
164
- }
165
- /**
166
- * AgentLogger: structured logging interface.
167
- * In CLI mode this writes to stderr; in Hub mode this uses pino.
168
- */
169
- export interface AgentLogger {
170
- info(message: string): void;
171
- warn(message: string): void;
172
- error(message: string): void;
173
- debug(message: string): void;
174
- }
175
- export type { HookRegistry };
@@ -1,14 +0,0 @@
1
- /**
2
- * Pure agent types — zero I/O framework dependencies.
3
- *
4
- * These types define the contract between:
5
- * - CLI stdio layer ↔ Agent class
6
- * - Agent class ↔ LLM Provider
7
- * - Agent class ↔ Tool loop
8
- *
9
- * Ported from Hub semantic-turn-shared.ts / semantic-turn-tools.ts,
10
- * with Hub infrastructure (WS/PG/Redis) replaced by DI interfaces.
11
- *
12
- * No imports from express/pg/ioredis/ws.
13
- */
14
- export {};
@@ -1,11 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * qlogicagent CLI — Agent subprocess entry point.
4
- *
5
- * Communicates with openclaw Gateway via JSON-RPC over stdio.
6
- * All log/debug output goes to stderr (never pollutes the stdio protocol).
7
- *
8
- * Usage:
9
- * qlogicagent [--verbose]
10
- */
11
- export {};
package/dist/cli/main.js DELETED
@@ -1,23 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * qlogicagent CLI — Agent subprocess entry point.
4
- *
5
- * Communicates with openclaw Gateway via JSON-RPC over stdio.
6
- * All log/debug output goes to stderr (never pollutes the stdio protocol).
7
- *
8
- * Usage:
9
- * qlogicagent [--verbose]
10
- */
11
- import { StdioServer } from "./stdio-server.js";
12
- import { parseCliArgs } from "../config/config.js";
13
- const config = parseCliArgs(process.argv);
14
- const server = new StdioServer({ verbose: config.verbose });
15
- // Graceful shutdown
16
- const shutdown = () => {
17
- server.stop();
18
- process.exit(0);
19
- };
20
- process.on("SIGTERM", shutdown);
21
- process.on("SIGINT", shutdown);
22
- // Start the JSON-RPC stdio server
23
- server.start();
@@ -1,45 +0,0 @@
1
- /**
2
- * StdioServer — JSON-RPC 2.0 over stdio protocol handler.
3
- *
4
- * Reads line-delimited JSON from stdin, dispatches to handlers,
5
- * writes JSON-RPC responses/notifications to stdout.
6
- * All log output goes to stderr.
7
- *
8
- * Protocol: each line on stdin/stdout is a single JSON-RPC 2.0 message.
9
- */
10
- export interface StdioServerConfig {
11
- verbose: boolean;
12
- }
13
- export declare class StdioServer {
14
- private running;
15
- private activeTurn;
16
- private pendingToolResults;
17
- private verbose;
18
- private registry;
19
- private agent;
20
- private lastLlmConfigKey;
21
- private currentSessionId;
22
- private currentHooks;
23
- constructor(config: StdioServerConfig);
24
- start(): void;
25
- stop(): void;
26
- private handleMessage;
27
- private handleHello;
28
- private handlePing;
29
- private handleAbort;
30
- private handleToolResult;
31
- private handleTurn;
32
- private resolveAgent;
33
- /**
34
- * Request tool execution from the Gateway host.
35
- * Sends a turn.tool_call notification and waits for tool.result.
36
- */
37
- requestToolExecution(turnId: string, name: string, args: string, signal?: AbortSignal): Promise<{
38
- result: string;
39
- error?: string;
40
- }>;
41
- private sendResponse;
42
- private sendNotification;
43
- private writeStdout;
44
- private log;
45
- }