qlogicagent 2.6.1 → 2.7.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 (49) hide show
  1. package/dist/agent.js +14 -12
  2. package/dist/cli.js +609 -282
  3. package/dist/index.js +608 -281
  4. package/dist/orchestration.js +15 -15
  5. package/dist/protocol.js +1 -1
  6. package/dist/types/agent/agent.d.ts +3 -0
  7. package/dist/types/agent/tool-loop.d.ts +2 -0
  8. package/dist/types/agent/tunable-defaults.d.ts +18 -1
  9. package/dist/types/agent/types.d.ts +9 -0
  10. package/dist/types/cli/stdio-server.d.ts +42 -6
  11. package/dist/types/cli/tool-bootstrap.d.ts +3 -5
  12. package/dist/types/llm/model-catalog.d.ts +29 -0
  13. package/dist/types/llm/retry.d.ts +1 -1
  14. package/dist/types/orchestration/dag-scheduler.d.ts +46 -0
  15. package/dist/types/orchestration/index.d.ts +1 -1
  16. package/dist/types/orchestration/product-planner.d.ts +146 -0
  17. package/dist/types/orchestration/skill-improvement.d.ts +39 -0
  18. package/dist/types/orchestration/solo-evaluator.d.ts +26 -6
  19. package/dist/types/orchestration/solo-persistence.d.ts +5 -0
  20. package/dist/types/protocol/methods.d.ts +36 -1
  21. package/dist/types/protocol/notifications.d.ts +1 -1
  22. package/dist/types/protocol/wire/acp-protocol.d.ts +7 -0
  23. package/dist/types/protocol/wire/agent-methods.d.ts +1 -1
  24. package/dist/types/protocol/wire/index.d.ts +1 -1
  25. package/dist/types/protocol/wire/memory-provider-lifecycle.d.ts +3 -1
  26. package/dist/types/protocol/wire/notification-payloads.d.ts +52 -3
  27. package/dist/types/runtime/execution/dream-agent.d.ts +32 -5
  28. package/dist/types/runtime/execution/memory-decay.d.ts +17 -5
  29. package/dist/types/runtime/hooks/memory-hooks.d.ts +9 -0
  30. package/dist/types/runtime/infra/acp-types.d.ts +88 -0
  31. package/dist/types/runtime/prompt/environment-context.d.ts +10 -0
  32. package/dist/types/runtime/prompt/index.d.ts +1 -1
  33. package/dist/types/skills/index.d.ts +8 -2
  34. package/dist/types/skills/memory/implicit-extraction.d.ts +58 -0
  35. package/dist/types/skills/memory/local-embedding.d.ts +176 -0
  36. package/dist/types/skills/memory/local-memory-provider.d.ts +197 -0
  37. package/dist/types/skills/memory/local-store.d.ts +254 -0
  38. package/dist/types/skills/memory/memdir.d.ts +6 -1
  39. package/dist/types/skills/memory/memory-provider-factory.d.ts +54 -0
  40. package/dist/types/skills/memory/memory-tool.d.ts +30 -2
  41. package/dist/types/skills/permissions/denial-audit-log.d.ts +52 -0
  42. package/dist/types/skills/permissions/hook-runner.d.ts +14 -4
  43. package/dist/types/skills/skill-system/skill-lifecycle.d.ts +81 -0
  44. package/dist/types/skills/skill-system/skill-validation.d.ts +29 -0
  45. package/dist/types/skills/tools/exec-tool.d.ts +1 -1
  46. package/dist/types/transport/acp-server.d.ts +5 -0
  47. package/package.json +18 -5
  48. package/dist/types/skills/memory/qmemory-adapter.d.ts +0 -55
  49. package/dist/types/skills/memory/qmemory-http-client.d.ts +0 -16
@@ -0,0 +1,81 @@
1
+ export type SkillLifecycleState = "active" | "stale" | "archived";
2
+ export interface SkillLifecycleRecord {
3
+ name: string;
4
+ state: SkillLifecycleState;
5
+ createdAt: string;
6
+ lastUsedAt?: string;
7
+ lastViewedAt?: string;
8
+ lastPatchedAt?: string;
9
+ staleAt?: string;
10
+ archivedAt?: string;
11
+ pinned: boolean;
12
+ useCount: number;
13
+ source: "learned" | "created" | "installed" | "promoted";
14
+ }
15
+ export interface SkillLifecycleStore {
16
+ version: 1;
17
+ records: Record<string, SkillLifecycleRecord>;
18
+ }
19
+ export interface CuratorResult {
20
+ transitioned: Array<{
21
+ name: string;
22
+ from: SkillLifecycleState;
23
+ to: SkillLifecycleState;
24
+ }>;
25
+ skippedPinned: string[];
26
+ }
27
+ export declare function loadLifecycleStore(agentHome: string): SkillLifecycleStore;
28
+ export declare function saveLifecycleStore(agentHome: string, store: SkillLifecycleStore): void;
29
+ /**
30
+ * Ensure a lifecycle record exists for a skill. Creates one if missing.
31
+ */
32
+ export declare function ensureRecord(store: SkillLifecycleStore, name: string, source?: SkillLifecycleRecord["source"]): SkillLifecycleRecord;
33
+ /**
34
+ * Record a skill invocation — resets to active if stale.
35
+ */
36
+ export declare function recordInvocation(store: SkillLifecycleStore, name: string): void;
37
+ /**
38
+ * Record that a skill was viewed/listed.
39
+ */
40
+ export declare function recordView(store: SkillLifecycleStore, name: string): void;
41
+ /**
42
+ * Record that a skill was edited/patched.
43
+ */
44
+ export declare function recordPatch(store: SkillLifecycleStore, name: string): void;
45
+ export declare function pinSkill(store: SkillLifecycleStore, name: string): boolean;
46
+ export declare function unpinSkill(store: SkillLifecycleStore, name: string): boolean;
47
+ export declare function isPinned(store: SkillLifecycleStore, name: string): boolean;
48
+ /**
49
+ * Run curator evaluation on all skills. Transitions states based on inactivity.
50
+ * Pinned skills are never transitioned.
51
+ *
52
+ * Call this on agent idle, periodic timer, or explicit RPC.
53
+ */
54
+ export declare function runCurator(store: SkillLifecycleStore): CuratorResult;
55
+ /**
56
+ * Archive a skill on disk: move its directory to `.archive/` subfolder.
57
+ * Returns true if archival succeeded.
58
+ */
59
+ export declare function archiveSkillOnDisk(skillsDir: string, skillName: string): boolean;
60
+ /**
61
+ * Unarchive a skill: move from `.archive/` back to main skills dir.
62
+ * Resets state to active.
63
+ */
64
+ export declare function unarchiveSkillOnDisk(skillsDir: string, skillName: string): boolean;
65
+ /**
66
+ * Execute full curator cycle: evaluate state transitions + archive on disk.
67
+ * Returns curator result with all transitions made.
68
+ */
69
+ export declare function executeCuratorCycle(agentHome: string, skillsDir: string): CuratorResult;
70
+ /**
71
+ * Get all skills in a given state.
72
+ */
73
+ export declare function getSkillsByState(store: SkillLifecycleStore, state: SkillLifecycleState): SkillLifecycleRecord[];
74
+ /**
75
+ * Get lifecycle record for a skill. Returns undefined if not tracked.
76
+ */
77
+ export declare function getLifecycleRecord(store: SkillLifecycleStore, name: string): SkillLifecycleRecord | undefined;
78
+ /**
79
+ * Remove a lifecycle record (e.g., when skill is deleted).
80
+ */
81
+ export declare function removeRecord(store: SkillLifecycleStore, name: string): void;
@@ -0,0 +1,29 @@
1
+ export interface FrontmatterValidationResult {
2
+ valid: boolean;
3
+ errors: string[];
4
+ warnings: string[];
5
+ /** Parsed frontmatter if valid. */
6
+ parsed?: Record<string, string>;
7
+ }
8
+ /**
9
+ * Validate SKILL.md content for required frontmatter structure.
10
+ * Used before persisting agent-created skills.
11
+ */
12
+ export declare function validateSkillContent(content: string, expectedName?: string): FrontmatterValidationResult;
13
+ /**
14
+ * Generate valid SKILL.md content with proper frontmatter from minimal inputs.
15
+ * Used when auto-persisting skills from skill_instruction events.
16
+ */
17
+ export declare function generateSkillContent(params: {
18
+ name: string;
19
+ description: string;
20
+ tools?: string[];
21
+ body: string;
22
+ version?: string;
23
+ category?: string;
24
+ }): string;
25
+ /**
26
+ * Auto-fix common frontmatter issues in LLM-generated skill content.
27
+ * Returns fixed content or null if unfixable.
28
+ */
29
+ export declare function autoFixFrontmatter(content: string, name: string, description?: string): string | null;
@@ -14,7 +14,7 @@ export declare const EXEC_TOOL_SCHEMA: {
14
14
  readonly properties: {
15
15
  readonly command: {
16
16
  readonly type: "string";
17
- readonly description: "Shell command to execute. On Windows uses PowerShell, on Unix uses bash.";
17
+ readonly description: "Shell command to execute in PowerShell." | "Shell command to execute in bash. Use Unix-style commands (ls, cat, mkdir -p, etc.).";
18
18
  };
19
19
  readonly description: {
20
20
  readonly type: "string";
@@ -60,7 +60,12 @@ export interface AcpRequestHandler {
60
60
  handleAcpSoloSelect(params: Record<string, unknown>): Promise<unknown>;
61
61
  handleAcpSoloCancel(params: Record<string, unknown>): Promise<unknown>;
62
62
  handleAcpSoloSubscribe(params: Record<string, unknown>): Promise<unknown>;
63
+ handleAcpSoloMessage(params: Record<string, unknown>): Promise<unknown>;
64
+ handleAcpSoloEvaluate(params: Record<string, unknown>): Promise<unknown>;
63
65
  handleAcpProductCreate(params: Record<string, unknown>): Promise<unknown>;
66
+ handleAcpProductPlan(params: Record<string, unknown>): Promise<unknown>;
67
+ handleAcpProductConfirm(params: Record<string, unknown>): Promise<unknown>;
68
+ handleAcpProductMessage(params: Record<string, unknown>): Promise<unknown>;
64
69
  handleAcpProductPause(params: Record<string, unknown>): Promise<unknown>;
65
70
  handleAcpProductResume(params: Record<string, unknown>): Promise<unknown>;
66
71
  handleAcpProductCancel(params: Record<string, unknown>): Promise<unknown>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qlogicagent",
3
- "version": "2.6.1",
3
+ "version": "2.7.0",
4
4
  "description": "XiaozhiClaw Agent CLI — subprocess architecture (JSON-RPC over stdio)",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -34,10 +34,18 @@
34
34
  ],
35
35
  "typesVersions": {
36
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"]
37
+ "protocol": [
38
+ "./dist/types/protocol/wire/index.d.ts"
39
+ ],
40
+ "agent": [
41
+ "./dist/types/agent/agent.d.ts"
42
+ ],
43
+ "contracts": [
44
+ "./dist/types/contracts/index.d.ts"
45
+ ],
46
+ "orchestration": [
47
+ "./dist/types/orchestration/index.d.ts"
48
+ ]
41
49
  }
42
50
  },
43
51
  "scripts": {
@@ -54,12 +62,17 @@
54
62
  "node": ">=22.0.0"
55
63
  },
56
64
  "dependencies": {
65
+ "better-sqlite3": "^12.10.0",
57
66
  "dotenv": "^17.3.1",
58
67
  "nanoid": "^5.1.5",
59
68
  "pino": "^9.6.0",
60
69
  "pino-pretty": "^13.0.0"
61
70
  },
71
+ "optionalDependencies": {
72
+ "@xenova/transformers": "^2.17.2"
73
+ },
62
74
  "devDependencies": {
75
+ "@types/better-sqlite3": "^7.6.13",
63
76
  "@types/node": "^22.15.0",
64
77
  "esbuild": "^0.28.0",
65
78
  "tsx": "^4.19.0",
@@ -1,55 +0,0 @@
1
- import type { MemoryIngestOptions, MemoryProvider } from "../../protocol/wire/index.js";
2
- /** A pre-extracted memory item ready to be stored (no LLM needed). */
3
- export interface ExtractedMemoryItem {
4
- text: string;
5
- category?: string;
6
- importance?: number;
7
- speaker?: string;
8
- event_date?: string;
9
- tags?: string[];
10
- }
11
- /** Configuration for the QMemory HTTP adapter. */
12
- export interface QMemoryAdapterConfig {
13
- /** Base URL of the qmemory server (e.g. "http://localhost:18800"). */
14
- baseUrl: string;
15
- /** Optional API key for authentication. */
16
- apiKey?: string;
17
- /** Request timeout in milliseconds (default: 5000). */
18
- timeoutMs?: number;
19
- /** Prefix prepended to userId for multi-tenant isolation. */
20
- userIdPrefix?: string;
21
- }
22
- /** Options for triggering a decay cycle. */
23
- export interface DecayOptions {
24
- temporalExpiry?: boolean;
25
- stalenessDecay?: boolean;
26
- noiseArchival?: boolean;
27
- }
28
- /** Result of a decay cycle. */
29
- export interface DecayResult {
30
- decayed: number;
31
- archived: number;
32
- }
33
- /** Health status returned by qmemory `/v1/health/`. */
34
- export interface QMemoryHealthStatus {
35
- status: string;
36
- version: string;
37
- memoryCount: number;
38
- dbSizeBytes: number;
39
- embeddingModel: string;
40
- uptimeSeconds: number;
41
- }
42
- /**
43
- * Create a MemoryProvider backed by a QMemory HTTP server.
44
- *
45
- * Uses inlined QMemoryHttpClient for HTTP transport (zero external deps).
46
- */
47
- export declare function createQMemoryAdapter(config: QMemoryAdapterConfig): MemoryProvider & {
48
- health(): Promise<QMemoryHealthStatus>;
49
- remove(memoryId: string): Promise<boolean>;
50
- ingestExtracted(items: ExtractedMemoryItem[], userId: string, options?: MemoryIngestOptions): Promise<{
51
- memoriesAdded: number;
52
- }>;
53
- feedback(memoryIds: string[], signal: string, sessionId?: string): Promise<void>;
54
- triggerDecay(userId: string, options?: DecayOptions): Promise<DecayResult>;
55
- };
@@ -1,16 +0,0 @@
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
- }