qlogicagent 2.14.9 → 2.14.10

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.
@@ -57,11 +57,5 @@ export declare function getProjectSettingsPath(cwd: string): string;
57
57
  export declare function getProjectInstructionsPath(cwd: string): string;
58
58
  /** `<cwd>/.qlogicagent/rules/` — unified rules + instructions directory */
59
59
  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
60
  /** `<gitRoot>/.qlogicagent/hooks/` */
67
61
  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,7 @@
1
+ /**
2
+ * Project Data GC — best-effort startup reclamation of the companion-data tree, mirroring VS Code's
3
+ * UnusedWorkspaceStorageDataCleaner: it only removes data that is clearly unowned (a projectData/<id>
4
+ * dir whose projectId has no projects.json entry — orphaned by a crash or an incomplete delete) and
5
+ * prunes stale deletion tombstones. It NEVER touches live projects' data or the user's workspace.
6
+ */
7
+ export declare function gcOrphanProjectData(): void;
@@ -0,0 +1,28 @@
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
+ * Keying by projectId (not workspaceDir) decouples bookkeeping from the user's folder, so:
11
+ * - deleting a project = `rm` projectData/<id>/ (always safe; never touches the user's files);
12
+ * - sessions/checkpoints can never leak into, or orphan inside, an external user folder.
13
+ *
14
+ * This module is the ONE place that imports project-store for the workspaceDir→projectId reverse
15
+ * lookup; the low-level agent-paths stays dependency-free (no project-store cycle).
16
+ */
17
+ /** `~/.qlogicagent/profiles/<owner>/projectData/<projectId>/` (key = projectId or workspaceDir). */
18
+ export declare function getProjectDataDir(key: string): string;
19
+ /** Direct projectData dir for a known projectId (no reverse lookup) — used by project delete/GC. */
20
+ export declare function getProjectDataDirById(projectId: string): string;
21
+ /** Root of the project-data tree for the current owner (for orphan GC). */
22
+ export declare function getProjectDataRoot(): string;
23
+ /** `projectData/<id>/sessions/` */
24
+ export declare function getProjectDataSessionsRoot(key: string): string;
25
+ /** `projectData/<id>/checkpoints/` or `.../checkpoints/<sessionId>` */
26
+ export declare function getProjectDataCheckpointsDir(key: string, sessionId?: string): string;
27
+ /** `projectData/<id>/uploads/` or `.../uploads/<sessionId>` */
28
+ export declare function getProjectDataUploadsDir(key: string, sessionId?: string): string;
@@ -48,6 +48,12 @@ export declare function findByGroupId(groupId: string): ProjectInfo | null;
48
48
  * a cwd that maps to no project is ignored rather than silently leaking files outside any project.
49
49
  */
50
50
  export declare function findByWorkspaceDir(dir: string): ProjectInfo | null;
51
+ /**
52
+ * Reverse-lookup a workspaceDir to its owning projectId across ALL projects (active + archived).
53
+ * Used for projectData storage keying so a session/checkpoint dir resolves correctly even for an
54
+ * archived project (findByWorkspaceDir matches active-only and would miss it).
55
+ */
56
+ export declare function findProjectIdByWorkspaceDirAnyStatus(dir: string): string | undefined;
51
57
  export declare function archiveByGroupId(groupId: string): {
52
58
  archived: boolean;
53
59
  projectId?: string;
@@ -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.14.10",
4
4
  "description": "XiaozhiClaw Agent CLI — subprocess architecture (JSON-RPC over stdio)",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",