qlogicagent 2.14.9 → 2.15.1

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.
@@ -0,0 +1 @@
1
+ export declare function buildPinnedSkillContext(activeSkills: unknown, log?: (m: string) => void): string;
@@ -114,6 +114,9 @@ export interface AcpSessionMeta {
114
114
  /** Runtime turn-config tweaks applied via session/set_config_option. */
115
115
  temperature?: number;
116
116
  maxRounds?: number;
117
+ /** Skills the user explicitly pinned for this turn (scope:name or name). The turn pipeline
118
+ * force-loads each one's SKILL.md, identically to the `skill` tool's invoke (cc-parity). */
119
+ activeSkills?: string[];
117
120
  }
118
121
  export interface AcpSessionNewParams {
119
122
  /** Working directory for the session (standard ACP field from host). */
@@ -7,12 +7,29 @@
7
7
  */
8
8
  /** Dot-directory name used for both user-level and project-level storage. */
9
9
  export declare const AGENT_DOT_DIR = ".qlogicagent";
10
+ /**
11
+ * Derive a project's stable id from its workspaceDir — the mainstream path-derived model
12
+ * (VS Code / Claude Code / cc-haha): same folder → same id, deterministic, recomputable, no random
13
+ * UUID and no central-registry dependency. A short SHA-256 prefix of the resolved, lowercased path
14
+ * keeps the id length-safe on Windows (260-char path limit) while staying collision-free in
15
+ * practice. NOTE: deliberately NO ctime salt (VS Code salts single-folder ids so recreating a folder
16
+ * yields fresh state — a footgun for us; we want a recreated/rebound folder to map back to its data).
17
+ * This is a leaf helper (crypto + path only) so project-store and project-data-paths can both import
18
+ * it without a dependency cycle.
19
+ */
20
+ export declare function deriveProjectId(workspaceDir: string): string;
10
21
  /** `~/.qlogicagent/` (or QLOGICAGENT_HOME override) */
11
22
  export declare function getUserAgentHome(): string;
12
23
  export declare function resolveActiveOwnerUserId(): string;
13
24
  export declare function encodeOwnerProfileSegment(ownerUserId: string): string;
14
25
  export declare function getOwnerProfileDir(ownerUserId?: string): string;
15
26
  export declare function getProfileMemoryDir(ownerUserId?: string): string;
27
+ /** Dir name for our per-project companion data (sessions/checkpoints/uploads). */
28
+ export declare const PROJECT_DATA_DIRNAME = "projectData";
29
+ /** Root of the projectData tree for the current owner. */
30
+ export declare function getProjectDataRoot(): string;
31
+ /** `profiles/<owner>/projectData/<projectId>/` (projectId is the path-derived key). */
32
+ export declare function getProjectDataDirById(projectId: string): string;
16
33
  /**
17
34
  * Ensure the user agent home directory exists and is writable.
18
35
  * Returns the path if accessible, throws with a friendly message otherwise.
@@ -57,11 +74,5 @@ export declare function getProjectSettingsPath(cwd: string): string;
57
74
  export declare function getProjectInstructionsPath(cwd: string): string;
58
75
  /** `<cwd>/.qlogicagent/rules/` — unified rules + instructions directory */
59
76
  export declare function getProjectRulesDir(cwd: string): string;
60
- /** `<cwd>/.qlogicagent/sessions/` */
61
- export declare function getProjectSessionsRoot(cwd: string): string;
62
- /** `<cwd>/.qlogicagent/sessions/{sessionId}` */
63
- export declare function getProjectSessionDir(cwd: string, sessionId: string): string;
64
- /** `<cwd>/.qlogicagent/checkpoints/` or `<cwd>/.qlogicagent/checkpoints/{sessionId}` */
65
- export declare function getProjectCheckpointsDir(cwd: string, sessionId?: string): string;
66
77
  /** `<gitRoot>/.qlogicagent/hooks/` */
67
78
  export declare function getGitRootHooksDir(gitRoot: string): string;
@@ -1,8 +1,9 @@
1
1
  /**
2
2
  * Local Checkpoint Backend — git-based shadow repo implementation.
3
3
  *
4
- * Creates and manages checkpoint snapshots in `<project>/.qlogicagent/checkpoints/<sessionId>/`
5
- * using a shadow git repository independent of the user's project .git.
4
+ * Creates and manages checkpoint snapshots in the centralized companion store
5
+ * `~/.qlogicagent/profiles/<owner>/projectData/<projectId>/checkpoints/<sessionId>/`
6
+ * (NOT inside the user's workspace) using a shadow git repository independent of the user's .git.
6
7
  */
7
8
  import type { CheckpointBackend } from "../ports/checkpoint-contracts.js";
8
9
  export declare function createLocalCheckpointBackend(projectRoot: string, sessionId: string): CheckpointBackend;
@@ -28,6 +28,6 @@ export declare class DefaultPathService implements PathService {
28
28
  getProjectInstructionsPath(projectRoot?: string): string;
29
29
  getProjectPluginsDir(projectRoot?: string): string;
30
30
  getProjectRulesDir(projectRoot?: string): string;
31
- getProjectSessionsRoot(projectRoot?: string): string;
31
+ getProjectSessionsRoot(projectKey?: string): string;
32
32
  }
33
33
  export declare function getDefaultPathService(): PathService;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Project Data GC — best-effort startup reclamation of the companion-data tree, mirroring VS Code's
3
+ * UnusedWorkspaceStorageDataCleaner. A projectData/<id> dir is KEPT when it's either in projects.json
4
+ * OR carries a `project.json` back-ref (the durable truth — rebuildIndexFromBackrefs runs first and
5
+ * re-indexes it). Only a dir with NEITHER (truly corrupt/orphaned — crashed mid-create) is reclaimed.
6
+ * This makes the registry non-load-bearing for recovery: a lost projects.json never causes data loss.
7
+ * Also prunes stale deletion tombstones. NEVER touches live projects' data or the user's workspace.
8
+ */
9
+ export declare function gcOrphanProjectData(): void;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Project Data Paths — centralized location for our per-project COMPANION data (the "account
3
+ * book"): session transcripts/metadata, checkpoint shadow repos, uploaded attachments, deletion
4
+ * tombstones. Mirrors VS Code's workspaceStorage: this data is OURS and lives in a centralized,
5
+ * per-project-id, physically-isolated dir under the owner profile — NEVER inside the user's
6
+ * workspace folder. The workspace folder holds only user work product (code/docs/generated media).
7
+ *
8
+ * ~/.qlogicagent/profiles/<owner>/projectData/<projectId>/{sessions,checkpoints,uploads}/
9
+ *
10
+ * projectId is the PATH-DERIVED key (deriveProjectId(workspaceDir), see agent-paths) — the
11
+ * mainstream model (VS Code / cc-haha): same folder → same id, deterministic, recomputable, no
12
+ * central-registry dependency for the storage key. Deleting a project = `rm` projectData/<id>/.
13
+ */
14
+ export { getProjectDataDirById, getProjectDataRoot } from "./agent-paths.js";
15
+ /** `~/.qlogicagent/profiles/<owner>/projectData/<projectId>/` (key = projectId or workspaceDir). */
16
+ export declare function getProjectDataDir(key: string): string;
17
+ /** `projectData/<id>/sessions/` */
18
+ export declare function getProjectDataSessionsRoot(key: string): string;
19
+ /** `projectData/<id>/checkpoints/` or `.../checkpoints/<sessionId>` */
20
+ export declare function getProjectDataCheckpointsDir(key: string, sessionId?: string): string;
21
+ /** `projectData/<id>/uploads/` or `.../uploads/<sessionId>` */
22
+ export declare function getProjectDataUploadsDir(key: string, sessionId?: string): string;
@@ -7,6 +7,12 @@
7
7
  * Direction A: Agent is the source of truth for project state.
8
8
  */
9
9
  import type { ProjectInfo, ProjectType } from "../../protocol/methods.js";
10
+ /**
11
+ * Rebuild projects.json from the per-project `project.json` back-refs (the durable truth). Self-heals
12
+ * a lost/corrupted index: any projectData/<id> with a back-ref not present in projects.json is
13
+ * re-added. Called at startup before the default-project bootstrap.
14
+ */
15
+ export declare function rebuildIndexFromBackrefs(): void;
10
16
  export declare function createProject(params: {
11
17
  name: string;
12
18
  workspaceDir: string;
@@ -15,14 +21,6 @@ export declare function createProject(params: {
15
21
  skipAutoSwitch?: boolean;
16
22
  }): ProjectInfo;
17
23
  export declare function listProjects(): ProjectInfo[];
18
- /**
19
- * True when another project (active OR archived) still references this workspaceDir. Solo/Product
20
- * plan projects deliberately share their host project's workspaceDir — the run executes inside the
21
- * user's real workspace, isolated per-agent via git worktrees — so deleting one plan project must
22
- * never rmSync the shared directory: that would wipe the host project and every sibling plan. Pass
23
- * excludeProjectId to ignore a project that's still in the store at check time.
24
- */
25
- export declare function isWorkspaceDirShared(workspaceDir: string, excludeProjectId?: string): boolean;
26
24
  export declare function getActiveProject(): ProjectInfo | null;
27
25
  export declare function getDefaultProject(): ProjectInfo | null;
28
26
  export declare function getProjectById(projectId: string): ProjectInfo | null;
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Inbound Upload Persistence (decision A) — the agent owns its companion data, so user-uploaded
3
+ * attachments are persisted by the AGENT (not the gateway) into the session's projectData uploads
4
+ * dir, where they become part of the session record and are cleaned up on session/project delete.
5
+ *
6
+ * The gateway puts an inbound attachment in its short-lived transport cache and hands the agent a
7
+ * `http://127.0.0.1:<port>/media/<id>` URL. We fetch those bytes once, write them under
8
+ * projectData/<projectId>/uploads/<sessionId>/, and rewrite the reference to a gateway local-media
9
+ * proxy URL pointing at the persisted file (same `/api/media/local?src=file://…` shape the gateway
10
+ * used before — provider-core still sees a 127.0.0.1 local URL for cloud upload, and the frontend
11
+ * still GETs it). Any failure degrades gracefully to the original URL (the turn still works off the
12
+ * transport cache; only long-term persistence is skipped).
13
+ */
14
+ import type { ChatMessage } from "../../protocol/wire/index.js";
15
+ /**
16
+ * Persist a single inbound upload URL to projectData uploads and return the rewritten proxy URL.
17
+ * Non-transport URLs (already-persisted, remote, file://) and any failure return the input unchanged.
18
+ */
19
+ export declare function persistInboundUploadUrl(url: string, projectId: string, sessionId: string): Promise<string>;
20
+ /**
21
+ * Persist + rewrite the inbound uploads on the LAST user message of a turn (the new message;
22
+ * resumed history already carries persisted local URLs). Mutates and returns the message array.
23
+ */
24
+ export declare function persistInboundUploadsForTurn(messages: ChatMessage[], projectId: string | undefined, sessionId: string | undefined): Promise<ChatMessage[]>;
@@ -1,6 +1,5 @@
1
1
  export declare const TRANSCRIPT_FILE = "transcript.jsonl";
2
2
  export declare const METADATA_FILE = "metadata.json";
3
- export declare const LEGACY_STATE_FILE = "state.json";
4
3
  export declare function sanitizeSessionId(sessionId: string): string;
5
4
  export declare function getSessionsRoot(projectRoot: string): string;
6
5
  export declare function getSessionDir(sessionId: string, projectRoot: string): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qlogicagent",
3
- "version": "2.14.9",
3
+ "version": "2.15.1",
4
4
  "description": "XiaozhiClaw Agent CLI — subprocess architecture (JSON-RPC over stdio)",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -90,7 +90,7 @@
90
90
  "@agentclientprotocol/sdk": "^0.25.0",
91
91
  "@napi-rs/canvas": "0.1.100",
92
92
  "@xiaozhiclaw/pet-core": "0.1.2",
93
- "@xiaozhiclaw/provider-core": "^0.1.18",
93
+ "@xiaozhiclaw/provider-core": "^0.1.19",
94
94
  "better-sqlite3": "^12.10.0",
95
95
  "dotenv": "^17.3.1",
96
96
  "ioredis": "^5.11.1",
@@ -1,2 +0,0 @@
1
- export { buildMcpBootstrapEntries, configureMcpBootstrap, type McpBootstrapDeps, } from "./mcp-bootstrap.js";
2
- export { configurePluginBootstrap, type PluginBootstrapDeps, } from "./plugin-bootstrap.js";
@@ -1,3 +0,0 @@
1
- import type { RuntimeToolContract, ToolBootstrapProvider, ToolBootstrapProviderContext, ToolRegistrationModuleKind } from "../runtime/ports/index.js";
2
- export declare function runToolBootstrapProviders(providers: readonly ToolBootstrapProvider[], context: ToolBootstrapProviderContext): RuntimeToolContract[];
3
- export declare function createToolBootstrapProvider(id: string, register: ToolBootstrapProvider["register"], kind?: ToolRegistrationModuleKind): ToolBootstrapProvider;
@@ -1 +0,0 @@
1
- export type { QMemoryCategory } from "../../runtime/memory/categories.js";
@@ -1 +0,0 @@
1
- export * from "../../runtime/memory/find-relevant-memories.js";
@@ -1 +0,0 @@
1
- export * from "../../runtime/memory/implicit-extraction.js";
@@ -1 +0,0 @@
1
- export * from "../../runtime/memory/recall-category-filter.js";