qlogicagent 1.1.0 → 1.2.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 +8 -6
- package/dist/cli.js +258 -214
- package/dist/index.js +258 -214
- package/dist/orchestration.js +12 -9
- package/dist/types/agent/tool-loop.d.ts +22 -0
- package/dist/types/agent/types.d.ts +32 -0
- package/dist/types/cli/stdio-server.d.ts +96 -1
- package/dist/types/cli/tool-bootstrap.d.ts +8 -1
- package/dist/types/llm/gemini-schema-utils.d.ts +17 -0
- package/dist/types/llm/index.d.ts +11 -2
- package/dist/types/llm/media-transport.d.ts +28 -3
- package/dist/types/llm/model-detection.d.ts +22 -0
- package/dist/types/llm/provider-def.d.ts +17 -4
- package/dist/types/llm/transport.d.ts +60 -2
- package/dist/types/llm/transports/gemini-cache-api.d.ts +86 -0
- package/dist/types/llm/transports/gemini-file-api.d.ts +90 -0
- package/dist/types/llm/transports/gemini-generatecontent.d.ts +52 -0
- package/dist/types/llm/transports/gemini-lyria-realtime.d.ts +117 -0
- package/dist/types/llm/transports/gemini-media.d.ts +40 -8
- package/dist/types/llm/transports/minimax-media.d.ts +34 -5
- package/dist/types/llm/transports/openai-responses.d.ts +60 -0
- package/dist/types/llm/transports/qwen-media.d.ts +32 -7
- package/dist/types/llm/transports/realtime-transport.d.ts +1 -1
- package/dist/types/llm/transports/volcengine-media.d.ts +10 -2
- package/dist/types/llm/transports/zhipu-media.d.ts +24 -2
- package/dist/types/orchestration/agent-instance.d.ts +58 -0
- package/dist/types/orchestration/dag-scheduler.d.ts +72 -0
- package/dist/types/orchestration/product-budget.d.ts +56 -0
- package/dist/types/orchestration/product-checkpoint.d.ts +46 -0
- package/dist/types/orchestration/product-persistence.d.ts +40 -0
- package/dist/types/orchestration/product-worktree.d.ts +13 -0
- package/dist/types/orchestration/solo-evaluator.d.ts +59 -0
- package/dist/types/orchestration/subagent/fork-subagent.d.ts +2 -0
- package/dist/types/orchestration/subagent/task-types.d.ts +4 -0
- package/dist/types/orchestration/tool-cascade.d.ts +2 -2
- package/dist/types/protocol/methods.d.ts +92 -0
- package/dist/types/protocol/notifications.d.ts +162 -0
- package/dist/types/runtime/infra/acp-detector.d.ts +36 -0
- package/dist/types/runtime/infra/acp-detector.test.d.ts +1 -0
- package/dist/types/runtime/infra/acp-protocol-adapter.d.ts +73 -0
- package/dist/types/runtime/infra/acp-protocol-adapter.test.d.ts +1 -0
- package/dist/types/runtime/infra/acp-types.d.ts +397 -0
- package/dist/types/runtime/infra/acp-usage-tracker.d.ts +46 -0
- package/dist/types/runtime/infra/acp-usage-tracker.test.d.ts +1 -0
- package/dist/types/runtime/infra/agent-config-store.d.ts +30 -0
- package/dist/types/runtime/infra/agent-config-store.test.d.ts +1 -0
- package/dist/types/runtime/infra/agent-paths.d.ts +8 -0
- package/dist/types/runtime/infra/agent-process.d.ts +280 -0
- package/dist/types/runtime/infra/agent-process.test.d.ts +1 -0
- package/dist/types/runtime/infra/index.d.ts +10 -0
- package/dist/types/runtime/infra/mcp-bridge.d.ts +166 -0
- package/dist/types/runtime/infra/mcp-bridge.test.d.ts +1 -0
- package/dist/types/runtime/infra/model-id-translator.d.ts +22 -0
- package/dist/types/runtime/infra/model-id-translator.test.d.ts +1 -0
- package/dist/types/runtime/infra/skill-injector.d.ts +51 -0
- package/dist/types/runtime/infra/skill-injector.test.d.ts +1 -0
- package/dist/types/runtime/infra/worktree-backend.d.ts +1 -0
- package/dist/types/runtime/prompt/environment-context.d.ts +6 -0
- package/dist/types/runtime/session/session-persistence.d.ts +9 -8
- package/dist/types/runtime/session/session-state.d.ts +3 -31
- package/dist/types/skills/index.d.ts +2 -10
- package/dist/types/skills/tools/skill-tool.d.ts +101 -0
- package/dist/types/skills/tools/team-tool.d.ts +23 -1
- package/package.json +1 -1
- package/dist/types/runtime/session/session-memory.d.ts +0 -90
- package/dist/types/skills/memory/memory-extractor.d.ts +0 -64
|
@@ -0,0 +1,397 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ACP (Agent-Client Protocol) type definitions for third-party agent management.
|
|
3
|
+
*
|
|
4
|
+
* These types define the contract for discovering, registering, and managing
|
|
5
|
+
* external ACP-compatible agent CLIs alongside qlogicagent's internal agents.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Two-level agent taxonomy:
|
|
9
|
+
* - sub-agent: internal qlogicagent instance, budget/tool restricted
|
|
10
|
+
* - teammate: external ACP CLI agent, full capability
|
|
11
|
+
*/
|
|
12
|
+
export type AgentCategory = "sub-agent" | "teammate";
|
|
13
|
+
/** Communication protocol with the agent. */
|
|
14
|
+
export type AgentProtocol = "internal" | "acp";
|
|
15
|
+
/** Agent availability status. */
|
|
16
|
+
export type AgentStatus = "available" | "unavailable" | "handshake_failed" | "not_installed";
|
|
17
|
+
/** Pre-defined configuration for a known ACP backend. */
|
|
18
|
+
export interface AcpBackendConfig {
|
|
19
|
+
/** Backend ID, e.g. "claude" | "codex" | "goose". */
|
|
20
|
+
id: string;
|
|
21
|
+
/** Display name. */
|
|
22
|
+
name: string;
|
|
23
|
+
/** CLI command name (target for which/where scan). */
|
|
24
|
+
cliCommand: string;
|
|
25
|
+
/** ACP mode launch arguments. */
|
|
26
|
+
acpArgs: string[];
|
|
27
|
+
/** npx fallback path when CLI is not in PATH. */
|
|
28
|
+
defaultCliPath?: string;
|
|
29
|
+
/** Environment variables injected at launch. */
|
|
30
|
+
env?: Record<string, string>;
|
|
31
|
+
/** Whether authentication is required. */
|
|
32
|
+
authRequired: boolean;
|
|
33
|
+
/** Native skill directories. */
|
|
34
|
+
skillsDirs?: string[];
|
|
35
|
+
/** Whether this backend supports base URL override. */
|
|
36
|
+
supportsBaseUrlOverride: boolean;
|
|
37
|
+
/** Environment variable name for the API key. */
|
|
38
|
+
apiKeyEnvVar?: string;
|
|
39
|
+
/** Environment variable name for the base URL. */
|
|
40
|
+
baseUrlEnvVar?: string;
|
|
41
|
+
}
|
|
42
|
+
/** Capabilities discovered during ACP handshake. */
|
|
43
|
+
export interface AgentCapabilities {
|
|
44
|
+
/** Whether the agent supports MCP server injection via session/new. */
|
|
45
|
+
supportsMcp: boolean;
|
|
46
|
+
/** Whether the agent supports session/resume. */
|
|
47
|
+
supportsResume: boolean;
|
|
48
|
+
/** Whether the agent sends usage_update notifications. */
|
|
49
|
+
supportsUsageUpdate: boolean;
|
|
50
|
+
/** Native skill directories, if any. */
|
|
51
|
+
skillsDirs?: string[];
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Descriptor for a discovered or registered agent.
|
|
55
|
+
* Returned by `agents.scan` and `agents.list` RPCs.
|
|
56
|
+
*/
|
|
57
|
+
export interface AgentDescriptor {
|
|
58
|
+
/** Backend ID, e.g. "claude", "codex", "qlogicagent". */
|
|
59
|
+
id: string;
|
|
60
|
+
/** Display name. */
|
|
61
|
+
name: string;
|
|
62
|
+
/** sub-agent (internal) or teammate (external). */
|
|
63
|
+
category: AgentCategory;
|
|
64
|
+
/** Communication protocol. */
|
|
65
|
+
protocol: AgentProtocol;
|
|
66
|
+
/** Current availability. */
|
|
67
|
+
status: AgentStatus;
|
|
68
|
+
/** Resolved CLI binary path (teammates only). */
|
|
69
|
+
cliPath?: string;
|
|
70
|
+
/** CLI version string (teammates only). */
|
|
71
|
+
version?: string;
|
|
72
|
+
/** Capabilities (populated after handshake). */
|
|
73
|
+
capabilities?: AgentCapabilities;
|
|
74
|
+
/** Whether auth is required. */
|
|
75
|
+
authRequired: boolean;
|
|
76
|
+
/** Whether user has configured this agent (apiKey / baseUrl). */
|
|
77
|
+
hasConfig: boolean;
|
|
78
|
+
/** Whether this agent supports LLM base URL redirection. */
|
|
79
|
+
supportsBaseUrlOverride: boolean;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Extended descriptor for external agents,
|
|
83
|
+
* used internally by AgentProcessManager to spawn.
|
|
84
|
+
*/
|
|
85
|
+
export interface ExternalAgentDescriptor {
|
|
86
|
+
/** Backend ID. */
|
|
87
|
+
id: string;
|
|
88
|
+
/** Resolved CLI binary path. */
|
|
89
|
+
cliPath: string;
|
|
90
|
+
/** ACP launch arguments. */
|
|
91
|
+
acpArgs: string[];
|
|
92
|
+
/** Extra environment variables for spawn. */
|
|
93
|
+
env?: Record<string, string>;
|
|
94
|
+
/** Communication protocol. */
|
|
95
|
+
protocol: "acp";
|
|
96
|
+
}
|
|
97
|
+
/** User-provided custom agent definition for agents.config RPC. */
|
|
98
|
+
export interface CustomAgentDef {
|
|
99
|
+
/** Unique ID (user-chosen). */
|
|
100
|
+
id: string;
|
|
101
|
+
/** Display name. */
|
|
102
|
+
name: string;
|
|
103
|
+
/** CLI command or absolute path. */
|
|
104
|
+
cliCommand: string;
|
|
105
|
+
/** ACP mode launch arguments. */
|
|
106
|
+
acpArgs: string[];
|
|
107
|
+
/** Additional environment variables. */
|
|
108
|
+
env?: Record<string, string>;
|
|
109
|
+
/** Whether auth is required. */
|
|
110
|
+
authRequired?: boolean;
|
|
111
|
+
/** Native skill directories. */
|
|
112
|
+
skillsDirs?: string[];
|
|
113
|
+
/** Whether base URL override is supported. */
|
|
114
|
+
supportsBaseUrlOverride?: boolean;
|
|
115
|
+
}
|
|
116
|
+
/** Persisted per-agent configuration. */
|
|
117
|
+
export interface AgentConfig {
|
|
118
|
+
apiKey?: string;
|
|
119
|
+
baseUrl?: string;
|
|
120
|
+
model?: string;
|
|
121
|
+
env?: Record<string, string>;
|
|
122
|
+
customArgs?: string[];
|
|
123
|
+
customCliPath?: string;
|
|
124
|
+
/** Model ID translation: qlogicModelId → externalModelId. */
|
|
125
|
+
modelIdMap?: Record<string, string>;
|
|
126
|
+
}
|
|
127
|
+
/** Root config store schema (persisted to JSON). */
|
|
128
|
+
export interface AgentConfigStoreData {
|
|
129
|
+
/** Global gateway proxy URL. */
|
|
130
|
+
gatewayUrl?: string;
|
|
131
|
+
/** Per-agent override configurations. */
|
|
132
|
+
agents: Record<string, AgentConfig>;
|
|
133
|
+
/** User-registered custom agents. */
|
|
134
|
+
customAgents?: Record<string, CustomAgentDef>;
|
|
135
|
+
}
|
|
136
|
+
/** ACP initialize result (from agent's response). */
|
|
137
|
+
export interface AcpInitializeResult {
|
|
138
|
+
protocolVersion: number;
|
|
139
|
+
capabilities: {
|
|
140
|
+
prompts?: boolean;
|
|
141
|
+
/** Whether this agent supports session/resume (D-1). */
|
|
142
|
+
supportsResume?: boolean;
|
|
143
|
+
[key: string]: unknown;
|
|
144
|
+
};
|
|
145
|
+
serverInfo?: {
|
|
146
|
+
name: string;
|
|
147
|
+
version?: string;
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
/** ACP session/new result. */
|
|
151
|
+
export interface AcpSessionResult {
|
|
152
|
+
id: string;
|
|
153
|
+
}
|
|
154
|
+
/** ACP prompt response content item. */
|
|
155
|
+
export interface AcpContentItem {
|
|
156
|
+
type: "text" | "image" | "resource";
|
|
157
|
+
text?: string;
|
|
158
|
+
data?: string;
|
|
159
|
+
mimeType?: string;
|
|
160
|
+
}
|
|
161
|
+
/** ACP prompt response. */
|
|
162
|
+
export interface AcpPromptResponse {
|
|
163
|
+
content: AcpContentItem[];
|
|
164
|
+
usage?: AcpPromptResponseUsage;
|
|
165
|
+
}
|
|
166
|
+
/** ACP per-turn usage stats. */
|
|
167
|
+
export interface AcpPromptResponseUsage {
|
|
168
|
+
inputTokens?: number;
|
|
169
|
+
outputTokens?: number;
|
|
170
|
+
totalTokens?: number;
|
|
171
|
+
cachedReadTokens?: number;
|
|
172
|
+
thoughtTokens?: number;
|
|
173
|
+
}
|
|
174
|
+
/** ACP usage_update notification payload (session-level). */
|
|
175
|
+
export interface AcpUsageUpdatePayload {
|
|
176
|
+
used?: number;
|
|
177
|
+
size?: number;
|
|
178
|
+
cost?: number;
|
|
179
|
+
inputTokens?: number;
|
|
180
|
+
outputTokens?: number;
|
|
181
|
+
totalTokens?: number;
|
|
182
|
+
}
|
|
183
|
+
/** MCP server config to inject into ACP session/new. */
|
|
184
|
+
export interface McpServerConfig {
|
|
185
|
+
name: string;
|
|
186
|
+
command: string;
|
|
187
|
+
args: string[];
|
|
188
|
+
env?: Record<string, string>;
|
|
189
|
+
}
|
|
190
|
+
export interface AgentsScanParams {
|
|
191
|
+
force?: boolean;
|
|
192
|
+
}
|
|
193
|
+
export interface AgentsConfigParams {
|
|
194
|
+
action: "register" | "unregister" | "update";
|
|
195
|
+
agent: CustomAgentDef;
|
|
196
|
+
}
|
|
197
|
+
export interface AgentsSetConfigParams {
|
|
198
|
+
agentId: string;
|
|
199
|
+
apiKey?: string;
|
|
200
|
+
baseUrl?: string;
|
|
201
|
+
model?: string;
|
|
202
|
+
env?: Record<string, string>;
|
|
203
|
+
customArgs?: string[];
|
|
204
|
+
customCliPath?: string;
|
|
205
|
+
modelIdMap?: Record<string, string>;
|
|
206
|
+
}
|
|
207
|
+
export interface AgentsGetConfigParams {
|
|
208
|
+
agentId: string;
|
|
209
|
+
}
|
|
210
|
+
export interface AgentsRemoveConfigParams {
|
|
211
|
+
agentId: string;
|
|
212
|
+
}
|
|
213
|
+
export interface AgentsSetGatewayParams {
|
|
214
|
+
url: string;
|
|
215
|
+
}
|
|
216
|
+
export type SoloState = "running" | "evaluating" | "completed" | "cancelled" | "failed";
|
|
217
|
+
export type SoloAgentState = "pending" | "running" | "completed" | "failed";
|
|
218
|
+
export interface SoloAgentResult {
|
|
219
|
+
id: string;
|
|
220
|
+
state: SoloAgentState;
|
|
221
|
+
progress?: string;
|
|
222
|
+
resultText?: string;
|
|
223
|
+
diff?: string;
|
|
224
|
+
usage?: {
|
|
225
|
+
inputTokens: number;
|
|
226
|
+
outputTokens: number;
|
|
227
|
+
};
|
|
228
|
+
error?: string;
|
|
229
|
+
worktreePath?: string;
|
|
230
|
+
}
|
|
231
|
+
export interface SoloEvaluation {
|
|
232
|
+
winnerId: string;
|
|
233
|
+
reasoning: string;
|
|
234
|
+
}
|
|
235
|
+
export interface SoloStatus {
|
|
236
|
+
soloId: string;
|
|
237
|
+
state: SoloState;
|
|
238
|
+
agents: SoloAgentResult[];
|
|
239
|
+
evaluation?: SoloEvaluation;
|
|
240
|
+
}
|
|
241
|
+
/** solo.start RPC params. */
|
|
242
|
+
export interface SoloStartParams {
|
|
243
|
+
task: string;
|
|
244
|
+
agents: string[];
|
|
245
|
+
cwd: string;
|
|
246
|
+
}
|
|
247
|
+
/** solo.status / solo.cancel / solo.select RPC params. */
|
|
248
|
+
export interface SoloIdParams {
|
|
249
|
+
soloId: string;
|
|
250
|
+
}
|
|
251
|
+
/** solo.select RPC params. */
|
|
252
|
+
export interface SoloSelectParams {
|
|
253
|
+
soloId: string;
|
|
254
|
+
winnerId: string;
|
|
255
|
+
}
|
|
256
|
+
export type ProductPhase = "active" | "paused" | "completed" | "failed";
|
|
257
|
+
export type ProductInstanceState = "idle" | "running" | "completed" | "failed" | "paused";
|
|
258
|
+
export type ProductTaskStatus = "pending" | "running" | "completed" | "failed" | "paused";
|
|
259
|
+
/** Product budget configuration & runtime counters. */
|
|
260
|
+
export interface ProductBudget {
|
|
261
|
+
maxTotalTokens?: number;
|
|
262
|
+
maxDuration?: number;
|
|
263
|
+
usedTokens: number;
|
|
264
|
+
elapsed: number;
|
|
265
|
+
}
|
|
266
|
+
/** Instance definition within a product. */
|
|
267
|
+
export interface ProductInstanceDef {
|
|
268
|
+
name: string;
|
|
269
|
+
role: string;
|
|
270
|
+
agentId: string;
|
|
271
|
+
}
|
|
272
|
+
/** Task definition within a product DAG. */
|
|
273
|
+
export interface ProductTaskDef {
|
|
274
|
+
taskId: string;
|
|
275
|
+
assignee: string;
|
|
276
|
+
prompt: string;
|
|
277
|
+
dependsOn?: string[];
|
|
278
|
+
}
|
|
279
|
+
/** product.create RPC params. */
|
|
280
|
+
export interface ProductCreateParams {
|
|
281
|
+
name: string;
|
|
282
|
+
cwd: string;
|
|
283
|
+
instances: ProductInstanceDef[];
|
|
284
|
+
tasks: ProductTaskDef[];
|
|
285
|
+
budget?: {
|
|
286
|
+
maxTotalTokens?: number;
|
|
287
|
+
maxDuration?: number;
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
/** product.resume / product.pause / product.checkpoint / product.status RPC params. */
|
|
291
|
+
export interface ProductIdParams {
|
|
292
|
+
productId: string;
|
|
293
|
+
}
|
|
294
|
+
/** Runtime instance state. */
|
|
295
|
+
export interface ProductInstanceStatus {
|
|
296
|
+
instanceId: string;
|
|
297
|
+
name: string;
|
|
298
|
+
agentId: string;
|
|
299
|
+
state: ProductInstanceState;
|
|
300
|
+
worktreePath?: string;
|
|
301
|
+
usage?: {
|
|
302
|
+
inputTokens: number;
|
|
303
|
+
outputTokens: number;
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
/** Runtime task state. */
|
|
307
|
+
export interface ProductTaskState {
|
|
308
|
+
taskId: string;
|
|
309
|
+
assignee: string;
|
|
310
|
+
status: ProductTaskStatus;
|
|
311
|
+
result?: string;
|
|
312
|
+
error?: string;
|
|
313
|
+
startedAt?: string;
|
|
314
|
+
completedAt?: string;
|
|
315
|
+
}
|
|
316
|
+
/** Full product status (product.status response). */
|
|
317
|
+
export interface ProductStatus {
|
|
318
|
+
productId: string;
|
|
319
|
+
name: string;
|
|
320
|
+
phase: ProductPhase;
|
|
321
|
+
instances: ProductInstanceStatus[];
|
|
322
|
+
tasks: ProductTaskState[];
|
|
323
|
+
budget: ProductBudget;
|
|
324
|
+
lastCheckpointAt: string;
|
|
325
|
+
}
|
|
326
|
+
/** Summary for product.list response. */
|
|
327
|
+
export interface ProductSummary {
|
|
328
|
+
productId: string;
|
|
329
|
+
name: string;
|
|
330
|
+
phase: ProductPhase;
|
|
331
|
+
instanceCount: number;
|
|
332
|
+
taskCount: number;
|
|
333
|
+
completedTasks: number;
|
|
334
|
+
createdAt: string;
|
|
335
|
+
lastCheckpointAt: string;
|
|
336
|
+
}
|
|
337
|
+
/** agents.getGateway response. */
|
|
338
|
+
export interface AgentsGetGatewayResult {
|
|
339
|
+
url?: string;
|
|
340
|
+
}
|
|
341
|
+
/** agents.listConfigured response item. */
|
|
342
|
+
export interface AgentsListConfiguredItem {
|
|
343
|
+
agentId: string;
|
|
344
|
+
hasApiKey: boolean;
|
|
345
|
+
hasBaseUrl: boolean;
|
|
346
|
+
hasModel: boolean;
|
|
347
|
+
}
|
|
348
|
+
/** agents.processes response item. */
|
|
349
|
+
export interface AgentsProcessInfo {
|
|
350
|
+
memberId: string;
|
|
351
|
+
name: string;
|
|
352
|
+
pid: number;
|
|
353
|
+
state: string;
|
|
354
|
+
startedAt: number;
|
|
355
|
+
endedAt?: number;
|
|
356
|
+
source: "solo" | "product";
|
|
357
|
+
}
|
|
358
|
+
/** agents.kill RPC params. */
|
|
359
|
+
export interface AgentsKillParams {
|
|
360
|
+
memberId: string;
|
|
361
|
+
}
|
|
362
|
+
/** agents.getLog RPC params. */
|
|
363
|
+
export interface AgentsGetLogParams {
|
|
364
|
+
agentId: string;
|
|
365
|
+
tail?: number;
|
|
366
|
+
}
|
|
367
|
+
/** agents.getLog response. */
|
|
368
|
+
export interface AgentsGetLogResult {
|
|
369
|
+
log: string;
|
|
370
|
+
}
|
|
371
|
+
/** agents.testConnection RPC params. */
|
|
372
|
+
export interface AgentsTestConnectionParams {
|
|
373
|
+
agentId: string;
|
|
374
|
+
timeoutMs?: number;
|
|
375
|
+
}
|
|
376
|
+
/** agents.testConnection response. */
|
|
377
|
+
export interface AgentsTestConnectionResult {
|
|
378
|
+
ok: boolean;
|
|
379
|
+
version?: string;
|
|
380
|
+
capabilities?: AgentCapabilities;
|
|
381
|
+
error?: string;
|
|
382
|
+
durationMs: number;
|
|
383
|
+
}
|
|
384
|
+
/** solo.delete / solo.cancel cleanup RPC params. */
|
|
385
|
+
export interface SoloDeleteParams {
|
|
386
|
+
soloId: string;
|
|
387
|
+
}
|
|
388
|
+
/** product.delete cleanup RPC params. */
|
|
389
|
+
export interface ProductDeleteParams {
|
|
390
|
+
productId: string;
|
|
391
|
+
}
|
|
392
|
+
/** Agent source attribution, attached to turn events when delegated. */
|
|
393
|
+
export interface AgentSource {
|
|
394
|
+
id: string;
|
|
395
|
+
name: string;
|
|
396
|
+
role: "main" | "teammate";
|
|
397
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ACP Usage Tracker — 3-tier token usage tracking for external ACP agents.
|
|
3
|
+
*
|
|
4
|
+
* Tier 1: Real-time `usage_update` notifications (preferred).
|
|
5
|
+
* Tier 2: Per-turn `PromptResponse.usage` fallback.
|
|
6
|
+
* Tier 3: Graceful degradation — no usage data, no budget enforcement.
|
|
7
|
+
*
|
|
8
|
+
* The tracker prevents double-counting when an agent sends both
|
|
9
|
+
* usage_update notifications AND prompt response usage.
|
|
10
|
+
*/
|
|
11
|
+
import type { AcpUsageUpdatePayload, AcpPromptResponseUsage } from "./acp-types.js";
|
|
12
|
+
export interface AccumulatedUsage {
|
|
13
|
+
inputTokens: number;
|
|
14
|
+
outputTokens: number;
|
|
15
|
+
totalTokens: number;
|
|
16
|
+
cachedReadTokens: number;
|
|
17
|
+
thoughtTokens: number;
|
|
18
|
+
/** Total cost (USD), if reported. */
|
|
19
|
+
cost: number;
|
|
20
|
+
/** Whether at least one usage_update was received (Tier 1 active). */
|
|
21
|
+
hasTier1: boolean;
|
|
22
|
+
/** Number of turns processed (Tier 2 fallback). */
|
|
23
|
+
turnCount: number;
|
|
24
|
+
}
|
|
25
|
+
export declare class AcpUsageTracker {
|
|
26
|
+
private usage;
|
|
27
|
+
/**
|
|
28
|
+
* Tier 1: Handle a `usage_update` notification from ACP agent.
|
|
29
|
+
* Sets the hasTier1 flag to prevent double-counting from Tier 2.
|
|
30
|
+
*/
|
|
31
|
+
onUsageUpdate(payload: AcpUsageUpdatePayload): void;
|
|
32
|
+
/**
|
|
33
|
+
* Tier 2: Handle per-turn usage from PromptResponse.
|
|
34
|
+
* Only applied if Tier 1 is NOT active (prevents double-counting).
|
|
35
|
+
*/
|
|
36
|
+
onPromptResponseUsage(usage: AcpPromptResponseUsage | undefined): void;
|
|
37
|
+
/** Get the current accumulated usage snapshot. */
|
|
38
|
+
getUsage(): Readonly<AccumulatedUsage>;
|
|
39
|
+
/** Reset all counters. */
|
|
40
|
+
reset(): void;
|
|
41
|
+
/**
|
|
42
|
+
* Check whether we have any usage data.
|
|
43
|
+
* Returns false in Tier 3 (graceful degradation).
|
|
44
|
+
*/
|
|
45
|
+
hasData(): boolean;
|
|
46
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Config Store — persistent per-agent configuration with project + global fallback.
|
|
3
|
+
*
|
|
4
|
+
* Storage paths:
|
|
5
|
+
* - Project-level: `<cwd>/.qlogicagent/agent-configs.json`
|
|
6
|
+
* - User-level: `~/.qlogicagent/agent-configs.json`
|
|
7
|
+
*
|
|
8
|
+
* Merge strategy: project-level overrides take precedence.
|
|
9
|
+
* Sensitive fields (apiKey) use file permissions 0o600 on Unix.
|
|
10
|
+
*/
|
|
11
|
+
import type { AgentConfig, AgentConfigStoreData, CustomAgentDef } from "./acp-types.js";
|
|
12
|
+
export declare class AgentConfigStore {
|
|
13
|
+
private data;
|
|
14
|
+
private cwd;
|
|
15
|
+
constructor(cwd?: string);
|
|
16
|
+
/** Load config from disk. Project-level merges on top of user-level. */
|
|
17
|
+
load(): Promise<void>;
|
|
18
|
+
/** Get the full store data (for AcpDetector.setConfigStore). */
|
|
19
|
+
getData(): AgentConfigStoreData;
|
|
20
|
+
getAgentConfig(agentId: string): AgentConfig | null;
|
|
21
|
+
setAgentConfig(agentId: string, config: AgentConfig): Promise<void>;
|
|
22
|
+
removeAgentConfig(agentId: string): Promise<void>;
|
|
23
|
+
getGatewayUrl(): string | undefined;
|
|
24
|
+
setGatewayUrl(url: string): Promise<void>;
|
|
25
|
+
registerCustomAgent(def: CustomAgentDef): void;
|
|
26
|
+
unregisterCustomAgent(agentId: string): void;
|
|
27
|
+
getCustomAgents(): Record<string, CustomAgentDef>;
|
|
28
|
+
/** Save to user-level config. Restricts permissions for sensitive data. */
|
|
29
|
+
private save;
|
|
30
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -53,5 +53,13 @@ export declare function getProjectSettingsPath(cwd?: string): string;
|
|
|
53
53
|
export declare function getProjectInstructionsPath(cwd?: string): string;
|
|
54
54
|
/** `<cwd>/.qlogicagent/rules/` */
|
|
55
55
|
export declare function getProjectRulesDir(cwd?: string): string;
|
|
56
|
+
/** `<cwd>/.qlogicagent/sessions/` */
|
|
57
|
+
export declare function getProjectSessionsRoot(cwd: string): string;
|
|
58
|
+
/** `<cwd>/.qlogicagent/sessions/{sessionId}` */
|
|
59
|
+
export declare function getProjectSessionDir(cwd: string, sessionId: string): string;
|
|
60
|
+
/** `<cwd>/.qlogicagent/checkpoints/` or `<cwd>/.qlogicagent/checkpoints/{sessionId}` */
|
|
61
|
+
export declare function getProjectCheckpointsDir(cwd: string, sessionId?: string): string;
|
|
62
|
+
/** `<cwd>/.qlogicagent/memory.json` */
|
|
63
|
+
export declare function getProjectMemoryPath(cwd: string): string;
|
|
56
64
|
/** `<gitRoot>/.qlogicagent/hooks/` */
|
|
57
65
|
export declare function getGitRootHooksDir(gitRoot: string): string;
|