qlogicagent 2.4.0 → 2.5.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.
@@ -93,6 +93,8 @@ export declare const SKILL_RECALL_MAX_CONTENT_CHARS = 800;
93
93
  export declare const SKILL_RECALL_CACHE_TTL_MS: number;
94
94
  /** Max nested fork depth for sub-agents. */
95
95
  export declare const MAX_FORK_DEPTH = 4;
96
+ /** Team aggregate budget (total tokens across all forked sub-agents). 0 = unlimited. */
97
+ export declare const TEAM_BUDGET_TOKENS = 0;
96
98
  /** Max historical sessions retained on disk. */
97
99
  export declare const MAX_SESSIONS = 50;
98
100
  /** Turn count threshold for triggering task summary. */
@@ -217,6 +219,7 @@ export interface TunableDefaults {
217
219
  idleDreamMinutes: number;
218
220
  dreamCooldownMs: number;
219
221
  dreamMaxDurationMs: number;
222
+ teamBudgetTokens: number;
220
223
  }
221
224
  /**
222
225
  * Snapshot of all current tunable values.
@@ -67,6 +67,10 @@ export declare class StdioServer {
67
67
  /** Process managers for solo/product (stored for agents.processes/kill). */
68
68
  private soloProcessManager;
69
69
  private productProcessManager;
70
+ /** Team aggregate budget — tracks total tokens spent across all forked sub-agents. */
71
+ private teamTokensUsed;
72
+ /** Team aggregate budget limit (0 = unlimited). Set via config.updateTunable. */
73
+ private teamBudgetTokens;
70
74
  /** ACP Server instance — handles ACP protocol alongside legacy protocol. */
71
75
  private acpServer;
72
76
  /** Idle dream timer — fires after configurable idle period to trigger memory consolidation. */
@@ -39,6 +39,12 @@ export declare class SoloEvaluator {
39
39
  private callbacks;
40
40
  private sessions;
41
41
  constructor(processManager: AgentProcessManager, acpDetector: AcpDetector, configStore: AgentConfigStore | null, callbacks?: SoloCallbacks);
42
+ /** Persist current session data to disk (fire-and-forget). */
43
+ private persistSession;
44
+ /** Restore sessions from disk (call once at startup). */
45
+ restoreFromDisk(cwd?: string): Promise<number>;
46
+ /** Delete a solo session from memory and disk. */
47
+ deleteSolo(soloId: string): Promise<boolean>;
42
48
  /**
43
49
  * Start a Solo Mode PK session.
44
50
  * Creates worktrees, spawns agents in parallel, waits for completion, then evaluates.
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Solo Persistence — read/write Solo Mode state to disk.
3
+ *
4
+ * State is stored at `<project>/.qlogicagent/solos/<soloId>/solo-state.json`.
5
+ * Mirrors the product-persistence.ts pattern.
6
+ */
7
+ import type { SoloState, SoloAgentState, SoloEvaluation } from "../runtime/infra/acp-types.js";
8
+ export interface PersistedSoloState {
9
+ soloId: string;
10
+ state: SoloState;
11
+ task: string;
12
+ cwd: string;
13
+ gitRoot: string;
14
+ agents: Array<{
15
+ agentId: string;
16
+ memberId: string;
17
+ worktreePath: string;
18
+ worktreeBranch: string;
19
+ state: SoloAgentState;
20
+ resultText?: string;
21
+ diff?: string;
22
+ usage?: {
23
+ inputTokens: number;
24
+ outputTokens: number;
25
+ };
26
+ error?: string;
27
+ }>;
28
+ evaluation?: SoloEvaluation;
29
+ createdAt: number;
30
+ }
31
+ /** Save solo state to disk. */
32
+ export declare function saveSoloState(state: PersistedSoloState, cwd?: string): Promise<void>;
33
+ /** Load solo state from disk. Returns undefined if not found. */
34
+ export declare function loadSoloState(soloId: string, cwd?: string): Promise<PersistedSoloState | undefined>;
35
+ /** List all solo session IDs with their persisted state. */
36
+ export declare function listSoloSessions(cwd?: string): Promise<PersistedSoloState[]>;
37
+ /** Delete solo state from disk. */
38
+ export declare function deleteSoloState(soloId: string, cwd?: string): Promise<boolean>;
@@ -9,7 +9,7 @@
9
9
  import type { ChatMessage, ToolDefinition } from "../agent/types.js";
10
10
  import type { TodoItem } from "../contracts/todo.js";
11
11
  import type { AgentDescriptor, AgentConfig, GatewayRpcMethodMap, RpcProjectInfo, RpcProjectType, RpcProjectStatus, SoloStatus, ProductStatus, ProductSummary } from "./wire/index.js";
12
- import type { AgentsScanParams, AgentsConfigParams, AgentsSetConfigParams, AgentsGetConfigParams, AgentsRemoveConfigParams, AgentsSetGatewayParams, SoloStartParams, SoloIdParams, SoloSelectParams, ProductCreateParams, ProductIdParams } from "../runtime/infra/acp-types.js";
12
+ import type { AgentsScanParams, AgentsConfigParams, AgentsSetConfigParams, AgentsGetConfigParams, AgentsRemoveConfigParams, AgentsSetGatewayParams, SoloStartParams, SoloIdParams, SoloSelectParams, SoloDeleteParams, ProductCreateParams, ProductIdParams, ProductDeleteParams } from "../runtime/infra/acp-types.js";
13
13
  export interface InitializeParams {
14
14
  protocolVersion: string;
15
15
  host?: {
@@ -512,6 +512,16 @@ export interface RpcMethodMap {
512
512
  mergedBranch: string;
513
513
  };
514
514
  };
515
+ "solo.list": {
516
+ params: undefined;
517
+ result: SoloStatus[];
518
+ };
519
+ "solo.delete": {
520
+ params: SoloDeleteParams;
521
+ result: {
522
+ ok: true;
523
+ };
524
+ };
515
525
  "product.create": {
516
526
  params: ProductCreateParams;
517
527
  result: {
@@ -544,6 +554,26 @@ export interface RpcMethodMap {
544
554
  params: undefined;
545
555
  result: ProductSummary[];
546
556
  };
557
+ "product.delete": {
558
+ params: ProductDeleteParams;
559
+ result: {
560
+ ok: true;
561
+ };
562
+ };
563
+ "product.cancel": {
564
+ params: ProductIdParams;
565
+ result: {
566
+ ok: true;
567
+ };
568
+ };
569
+ "product.rollback": {
570
+ params: ProductIdParams & {
571
+ checkpoint?: string;
572
+ };
573
+ result: {
574
+ ok: true;
575
+ };
576
+ };
547
577
  "project.create": {
548
578
  params: ProjectCreateParams;
549
579
  result: ProjectCreateResult;
@@ -42,7 +42,7 @@ export interface QMemoryHealthStatus {
42
42
  /**
43
43
  * Create a MemoryProvider backed by a QMemory HTTP server.
44
44
  *
45
- * Uses `qlogicagent-adapter-claw` for HTTP transport.
45
+ * Uses inlined QMemoryHttpClient for HTTP transport (zero external deps).
46
46
  */
47
47
  export declare function createQMemoryAdapter(config: QMemoryAdapterConfig): MemoryProvider & {
48
48
  health(): Promise<QMemoryHealthStatus>;
@@ -0,0 +1,16 @@
1
+ export interface QMemoryClientConfig {
2
+ baseUrl: string;
3
+ apiKey?: string;
4
+ timeout?: number;
5
+ }
6
+ /**
7
+ * Lightweight HTTP client for QMemory API.
8
+ * Maps RPC method names to REST endpoints using native fetch.
9
+ */
10
+ export declare class QMemoryHttpClient {
11
+ private readonly baseUrl;
12
+ private readonly apiKey?;
13
+ private readonly timeout;
14
+ constructor(config: QMemoryClientConfig);
15
+ dispatch(rpc: string, params?: Record<string, any>): Promise<any>;
16
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qlogicagent",
3
- "version": "2.4.0",
3
+ "version": "2.5.0",
4
4
  "description": "XiaozhiClaw Agent CLI — subprocess architecture (JSON-RPC over stdio)",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -57,8 +57,7 @@
57
57
  "dotenv": "^17.3.1",
58
58
  "nanoid": "^5.1.5",
59
59
  "pino": "^9.6.0",
60
- "pino-pretty": "^13.0.0",
61
- "qlogicagent-adapter-claw": "^0.2.0"
60
+ "pino-pretty": "^13.0.0"
62
61
  },
63
62
  "devDependencies": {
64
63
  "@types/node": "^22.15.0",
@@ -1,63 +0,0 @@
1
- /**
2
- * Remote Agent Runtime — cloud sandbox execution via HTTP relay.
3
- *
4
- * Enables the local agent to delegate tasks to a cloud-hosted sandbox
5
- * (e.g., qlogicagent-hub GPU workers, CCR-style isolated environments).
6
- *
7
- * Protocol:
8
- * 1. POST /agents/run → start remote execution, returns sessionId
9
- * 2. GET /agents/:id → poll for status + streaming results
10
- * 3. POST /agents/:id/abort → cancel remote execution
11
- *
12
- * Reference: CC cloudCode / remoteAgent patterns
13
- */
14
- import type { AgentLogger, TokenUsage } from "../../agent/types.js";
15
- export interface RemoteAgentConfig {
16
- /** Base URL of the remote execution endpoint (e.g., hub relay). */
17
- baseUrl: string;
18
- /** API key for authentication. */
19
- apiKey: string;
20
- /** Timeout for HTTP requests in ms (default: 30_000). */
21
- timeoutMs?: number;
22
- /** Polling interval in ms (default: 2_000). */
23
- pollIntervalMs?: number;
24
- /** Max polling duration in ms (default: 300_000 = 5 min). */
25
- maxPollDurationMs?: number;
26
- /** Logger. */
27
- log: AgentLogger;
28
- }
29
- export interface RemoteAgentRequest {
30
- /** Task prompt for the remote agent. */
31
- prompt: string;
32
- /** Model to use on the remote side. */
33
- model?: string;
34
- /** Max turns for the remote agent. */
35
- maxTurns?: number;
36
- /** Tool restrictions (allowlist). */
37
- allowedTools?: string[];
38
- /** Label for tracking. */
39
- label?: string;
40
- }
41
- export interface RemoteAgentResult {
42
- /** Remote session ID. */
43
- sessionId: string;
44
- /** Whether it completed successfully. */
45
- ok: boolean;
46
- /** Text output from the remote agent. */
47
- output?: string;
48
- /** Error message if failed. */
49
- error?: string;
50
- /** Token usage on the remote side. */
51
- usage?: TokenUsage;
52
- /** Duration in ms. */
53
- durationMs: number;
54
- }
55
- /**
56
- * Run a task on a remote agent endpoint.
57
- *
58
- * This is a polling-based implementation:
59
- * 1. POST to start the remote execution
60
- * 2. Poll GET until completion or timeout
61
- * 3. Return the aggregated result
62
- */
63
- export declare function runRemoteAgent(config: RemoteAgentConfig, request: RemoteAgentRequest, signal?: AbortSignal): Promise<RemoteAgentResult>;