autodev-cli 1.4.0 → 1.4.3
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/bin/autodev.js +0 -0
- package/out/agentBackup/archive.d.ts +44 -0
- package/out/agentBackup/archive.js +131 -0
- package/out/agentBackup/archive.js.map +1 -0
- package/out/agentBackup/export.d.ts +18 -0
- package/out/agentBackup/export.js +92 -0
- package/out/agentBackup/export.js.map +1 -0
- package/out/agentBackup/import.d.ts +21 -0
- package/out/agentBackup/import.js +40 -0
- package/out/agentBackup/import.js.map +1 -0
- package/out/agentBackup/index.d.ts +6 -0
- package/out/agentBackup/index.js +11 -0
- package/out/agentBackup/index.js.map +1 -0
- package/out/agentBackup/layout.d.ts +30 -0
- package/out/agentBackup/layout.js +126 -0
- package/out/agentBackup/layout.js.map +1 -0
- package/out/agentBackup/manifest.d.ts +24 -0
- package/out/agentBackup/manifest.js +70 -0
- package/out/agentBackup/manifest.js.map +1 -0
- package/out/agentBackup/opencodeDb.d.ts +20 -0
- package/out/agentBackup/opencodeDb.js +213 -0
- package/out/agentBackup/opencodeDb.js.map +1 -0
- package/out/agentBackup/sessionProviders.d.ts +35 -0
- package/out/agentBackup/sessionProviders.js +263 -0
- package/out/agentBackup/sessionProviders.js.map +1 -0
- package/out/agentBackup/upload.d.ts +9 -0
- package/out/agentBackup/upload.js +121 -0
- package/out/agentBackup/upload.js.map +1 -0
- package/out/cli.d.ts +1 -0
- package/out/cli.js +8 -0
- package/out/cli.js.map +1 -1
- package/out/cliExit.d.ts +34 -0
- package/out/cliExit.js +159 -0
- package/out/cliExit.js.map +1 -0
- package/out/commands/config.d.ts +2 -0
- package/out/commands/config.js +7 -7
- package/out/commands/config.js.map +1 -1
- package/out/commands/connect.d.ts +2 -0
- package/out/commands/connect.js +11 -0
- package/out/commands/connect.js.map +1 -1
- package/out/commands/export.d.ts +2 -0
- package/out/commands/export.js +79 -0
- package/out/commands/export.js.map +1 -0
- package/out/commands/import.d.ts +2 -0
- package/out/commands/import.js +92 -0
- package/out/commands/import.js.map +1 -0
- package/out/commands/init.d.ts +16 -0
- package/out/commands/init.js +9 -5
- package/out/commands/init.js.map +1 -1
- package/out/commands/resume.d.ts +2 -0
- package/out/commands/resume.js +65 -0
- package/out/commands/resume.js.map +1 -0
- package/out/commands/sessions.d.ts +2 -0
- package/out/commands/sessions.js +64 -0
- package/out/commands/sessions.js.map +1 -0
- package/out/commands/start.d.ts +2 -0
- package/out/commands/start.js +40 -7
- package/out/commands/start.js.map +1 -1
- package/out/commands/status.d.ts +2 -0
- package/out/commands/status.js +3 -3
- package/out/commands/status.js.map +1 -1
- package/out/commands/tailOutput.d.ts +12 -0
- package/out/commands/up.d.ts +3 -0
- package/out/configManager.d.ts +42 -0
- package/out/configManager.js +430 -0
- package/out/configManager.js.map +1 -0
- package/out/connect.d.ts +4 -0
- package/out/connect.js +7 -7
- package/out/connect.js.map +1 -1
- package/out/core/adapters.d.ts +34 -0
- package/out/core/adapters.js +84 -0
- package/out/core/adapters.js.map +1 -0
- package/out/core/commandHelpers.d.ts +12 -0
- package/out/core/commandHelpers.js +96 -0
- package/out/core/commandHelpers.js.map +1 -0
- package/out/core/projectMcp.d.ts +25 -0
- package/out/core/projectMcp.js +144 -0
- package/out/core/projectMcp.js.map +1 -0
- package/out/core/provider/BaseProvider.d.ts +14 -0
- package/out/core/provider/BaseProvider.js +25 -0
- package/out/core/provider/BaseProvider.js.map +1 -0
- package/out/core/provider/ProviderRegistry.d.ts +12 -0
- package/out/core/provider/ProviderRegistry.js +40 -0
- package/out/core/provider/ProviderRegistry.js.map +1 -0
- package/out/core/provider/contract.d.ts +62 -0
- package/out/core/provider/contract.js +9 -0
- package/out/core/provider/contract.js.map +1 -0
- package/out/core/provider/implementations.d.ts +54 -0
- package/out/core/provider/implementations.js +147 -0
- package/out/core/provider/implementations.js.map +1 -0
- package/out/core/settingsLoader.d.ts +221 -0
- package/out/core/settingsLoader.js +176 -0
- package/out/core/settingsLoader.js.map +1 -0
- package/out/discordGateway.d.ts +26 -0
- package/out/discordGateway.js +230 -0
- package/out/discordGateway.js.map +1 -0
- package/out/discordPoller.d.ts +28 -0
- package/out/discordPoller.js +247 -0
- package/out/discordPoller.js.map +1 -0
- package/out/dispatcher.d.ts +12 -0
- package/out/dispatcher.js +214 -0
- package/out/dispatcher.js.map +1 -0
- package/out/emailPoller.d.ts +42 -0
- package/out/emailPoller.js +221 -0
- package/out/emailPoller.js.map +1 -0
- package/out/git/gitService.d.ts +36 -0
- package/out/git/gitService.js +165 -0
- package/out/git/gitService.js.map +1 -0
- package/out/hookEventNormalizer.d.ts +39 -0
- package/out/hookEventNormalizer.js +397 -0
- package/out/hookEventNormalizer.js.map +1 -0
- package/out/hooksManager.d.ts +25 -0
- package/out/hooksManager.js +471 -0
- package/out/hooksManager.js.map +1 -0
- package/out/launchIde.d.ts +14 -0
- package/out/logger.d.ts +12 -0
- package/out/mcpEmailTest.d.ts +29 -0
- package/out/mcpEmailTest.js +245 -0
- package/out/mcpEmailTest.js.map +1 -0
- package/out/mcpInstallCheck.d.ts +23 -0
- package/out/mcpInstallCheck.js +219 -0
- package/out/mcpInstallCheck.js.map +1 -0
- package/out/mcpManager.d.ts +35 -0
- package/out/mcpManager.js +371 -0
- package/out/mcpManager.js.map +1 -0
- package/out/messageBuilder.d.ts +54 -0
- package/out/messageBuilder.js +373 -0
- package/out/messageBuilder.js.map +1 -0
- package/out/openCodeHooksManager.d.ts +23 -0
- package/out/openCodeHooksManager.js +511 -0
- package/out/openCodeHooksManager.js.map +1 -0
- package/out/periodicActions.d.ts +63 -0
- package/out/periodicActions.js +237 -0
- package/out/periodicActions.js.map +1 -0
- package/out/profileBuilder.d.ts +29 -0
- package/out/profileBuilder.js +366 -0
- package/out/profileBuilder.js.map +1 -0
- package/out/prompt.d.ts +12 -0
- package/out/prompt.js +18 -0
- package/out/prompt.js.map +1 -0
- package/out/protocolSections.d.ts +26 -0
- package/out/protocolSections.js +209 -0
- package/out/protocolSections.js.map +1 -0
- package/out/providers/claudeCliProvider.d.ts +71 -0
- package/out/providers/claudeCliProvider.js +425 -0
- package/out/providers/claudeCliProvider.js.map +1 -0
- package/out/providers/claudeTuiProvider.d.ts +23 -0
- package/out/providers/claudeTuiProvider.js +296 -0
- package/out/providers/claudeTuiProvider.js.map +1 -0
- package/out/providers/copilotCliProvider.d.ts +16 -0
- package/out/providers/copilotCliProvider.js +44 -0
- package/out/providers/copilotCliProvider.js.map +1 -0
- package/out/providers/copilotSdkProvider.d.ts +12 -0
- package/out/providers/copilotSdkProvider.js +445 -0
- package/out/providers/copilotSdkProvider.js.map +1 -0
- package/out/providers/grokTuiProvider.d.ts +14 -0
- package/out/providers/grokTuiProvider.js +271 -0
- package/out/providers/grokTuiProvider.js.map +1 -0
- package/out/providers/opencodeCliProvider.d.ts +29 -0
- package/out/providers/opencodeCliProvider.js +199 -0
- package/out/providers/opencodeCliProvider.js.map +1 -0
- package/out/providers/opencodeSdkProvider.d.ts +22 -0
- package/out/providers/opencodeSdkProvider.js +557 -0
- package/out/providers/opencodeSdkProvider.js.map +1 -0
- package/out/providers.d.ts +9 -0
- package/out/providers.js +44 -0
- package/out/providers.js.map +1 -0
- package/out/rateLimit.d.ts +18 -0
- package/out/rateLimit.js +90 -0
- package/out/rateLimit.js.map +1 -0
- package/out/rdp/auth.d.ts +55 -0
- package/out/rdp/auth.js +197 -0
- package/out/rdp/auth.js.map +1 -0
- package/out/rdp/bridge.d.ts +86 -0
- package/out/rdp/bridge.js +1398 -0
- package/out/rdp/bridge.js.map +1 -0
- package/out/rdp/constants.d.ts +86 -0
- package/out/rdp/constants.js +182 -0
- package/out/rdp/constants.js.map +1 -0
- package/out/rdp/index.d.ts +7 -0
- package/out/rdp/index.js +14 -0
- package/out/rdp/index.js.map +1 -0
- package/out/rdp/session.d.ts +30 -0
- package/out/rdp/session.js +196 -0
- package/out/rdp/session.js.map +1 -0
- package/out/rdp/types.d.ts +27 -0
- package/out/rdp/types.js +6 -0
- package/out/rdp/types.js.map +1 -0
- package/out/sdk/index.d.ts +22 -0
- package/out/sdk/index.js +81 -0
- package/out/sdk/index.js.map +1 -0
- package/out/sessionState.d.ts +54 -0
- package/out/sessionState.js +284 -0
- package/out/sessionState.js.map +1 -0
- package/out/sessions.d.ts +11 -0
- package/out/sessions.js +32 -0
- package/out/sessions.js.map +1 -0
- package/out/taskLoop.d.ts +152 -0
- package/out/taskLoop.js +2505 -0
- package/out/taskLoop.js.map +1 -0
- package/out/todo.d.ts +42 -0
- package/out/todo.js +311 -0
- package/out/todo.js.map +1 -0
- package/out/todoWriteManager.d.ts +26 -0
- package/out/todoWriteManager.js +44 -0
- package/out/todoWriteManager.js.map +1 -0
- package/out/vnc/auth.d.ts +52 -0
- package/out/vnc/auth.js +181 -0
- package/out/vnc/auth.js.map +1 -0
- package/out/vnc/bridge.d.ts +40 -0
- package/out/vnc/bridge.js +540 -0
- package/out/vnc/bridge.js.map +1 -0
- package/out/vnc/constants.d.ts +8 -0
- package/out/vnc/constants.js +34 -0
- package/out/vnc/constants.js.map +1 -0
- package/out/vnc/des.d.ts +6 -0
- package/out/vnc/des.js +93 -0
- package/out/vnc/des.js.map +1 -0
- package/out/vnc/index.d.ts +7 -0
- package/out/vnc/index.js +13 -0
- package/out/vnc/index.js.map +1 -0
- package/out/vnc/session.d.ts +18 -0
- package/out/vnc/session.js +193 -0
- package/out/vnc/session.js.map +1 -0
- package/out/vnc/types.d.ts +16 -0
- package/out/vnc/types.js +6 -0
- package/out/vnc/types.js.map +1 -0
- package/out/webSocketPoller.d.ts +95 -0
- package/out/webSocketPoller.js +986 -0
- package/out/webSocketPoller.js.map +1 -0
- package/out/webhook.d.ts +37 -0
- package/out/webhook.js +265 -0
- package/out/webhook.js.map +1 -0
- package/out/webhookPoller.d.ts +40 -0
- package/out/webhookPoller.js +378 -0
- package/out/webhookPoller.js.map +1 -0
- package/package.json +54 -41
package/bin/autodev.js
CHANGED
|
File without changes
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Abstraction over a zip archive used by the agent backup feature.
|
|
3
|
+
*
|
|
4
|
+
* Export and import depend on this interface rather than on `adm-zip`
|
|
5
|
+
* directly (Dependency Inversion). All path arguments that point at the
|
|
6
|
+
* filesystem are absolute; all `archivePath` arguments are POSIX-style
|
|
7
|
+
* paths *inside* the archive.
|
|
8
|
+
*/
|
|
9
|
+
export interface Archive {
|
|
10
|
+
/** Add a single file. No-op if the source is missing or not a file. */
|
|
11
|
+
addFile(absSource: string, archivePath: string): void;
|
|
12
|
+
/** Add a directory tree. No-op if the source is missing or not a dir. */
|
|
13
|
+
addDir(absSourceDir: string, archiveDir: string): void;
|
|
14
|
+
/** Add raw bytes at the given archive path. */
|
|
15
|
+
addBuffer(archivePath: string, data: Buffer): void;
|
|
16
|
+
/** Persist the archive to disk. */
|
|
17
|
+
write(destPath: string): void;
|
|
18
|
+
/** All entry paths in the archive (POSIX-style, dirs end with `/`). */
|
|
19
|
+
entryPaths(): string[];
|
|
20
|
+
/** Read a text entry, or `undefined` if it does not exist. */
|
|
21
|
+
readText(archivePath: string): string | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* Extract every entry whose path starts with `archiveDirPrefix` into
|
|
24
|
+
* `destAbsDir`, preserving the structure *below* the prefix.
|
|
25
|
+
* Returns the number of files written.
|
|
26
|
+
*/
|
|
27
|
+
extractDir(archiveDirPrefix: string, destAbsDir: string): number;
|
|
28
|
+
}
|
|
29
|
+
/** `adm-zip`-backed {@link Archive} implementation. */
|
|
30
|
+
export declare class AdmZipArchive implements Archive {
|
|
31
|
+
private readonly zip;
|
|
32
|
+
private constructor();
|
|
33
|
+
/** Create an empty archive for writing. */
|
|
34
|
+
static create(): AdmZipArchive;
|
|
35
|
+
/** Open an existing archive on disk for reading. */
|
|
36
|
+
static open(zipPath: string): AdmZipArchive;
|
|
37
|
+
addFile(absSource: string, archivePath: string): void;
|
|
38
|
+
addDir(absSourceDir: string, archiveDir: string): void;
|
|
39
|
+
addBuffer(archivePath: string, data: Buffer): void;
|
|
40
|
+
write(destPath: string): void;
|
|
41
|
+
entryPaths(): string[];
|
|
42
|
+
readText(archivePath: string): string | undefined;
|
|
43
|
+
extractDir(archiveDirPrefix: string, destAbsDir: string): number;
|
|
44
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.AdmZipArchive = void 0;
|
|
40
|
+
const fs = __importStar(require("fs"));
|
|
41
|
+
const path = __importStar(require("path"));
|
|
42
|
+
const adm_zip_1 = __importDefault(require("adm-zip"));
|
|
43
|
+
/** Normalise to forward slashes (adm-zip stores POSIX separators). */
|
|
44
|
+
function toPosix(p) {
|
|
45
|
+
return p.replace(/\\/g, '/');
|
|
46
|
+
}
|
|
47
|
+
/** `adm-zip`-backed {@link Archive} implementation. */
|
|
48
|
+
class AdmZipArchive {
|
|
49
|
+
zip;
|
|
50
|
+
constructor(zip) {
|
|
51
|
+
this.zip = zip;
|
|
52
|
+
}
|
|
53
|
+
/** Create an empty archive for writing. */
|
|
54
|
+
static create() {
|
|
55
|
+
return new AdmZipArchive(new adm_zip_1.default());
|
|
56
|
+
}
|
|
57
|
+
/** Open an existing archive on disk for reading. */
|
|
58
|
+
static open(zipPath) {
|
|
59
|
+
return new AdmZipArchive(new adm_zip_1.default(zipPath));
|
|
60
|
+
}
|
|
61
|
+
addFile(absSource, archivePath) {
|
|
62
|
+
if (!fs.existsSync(absSource)) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
try {
|
|
66
|
+
if (!fs.statSync(absSource).isFile()) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
const ap = toPosix(archivePath);
|
|
70
|
+
this.zip.addLocalFile(absSource, path.posix.dirname(ap), path.posix.basename(ap));
|
|
71
|
+
}
|
|
72
|
+
catch { /* ignore unreadable file */ }
|
|
73
|
+
}
|
|
74
|
+
addDir(absSourceDir, archiveDir) {
|
|
75
|
+
if (!fs.existsSync(absSourceDir)) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
try {
|
|
79
|
+
if (!fs.statSync(absSourceDir).isDirectory()) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
this.zip.addLocalFolder(absSourceDir, toPosix(archiveDir));
|
|
83
|
+
}
|
|
84
|
+
catch { /* ignore unreadable dir */ }
|
|
85
|
+
}
|
|
86
|
+
addBuffer(archivePath, data) {
|
|
87
|
+
this.zip.addFile(toPosix(archivePath), data);
|
|
88
|
+
}
|
|
89
|
+
write(destPath) {
|
|
90
|
+
this.zip.writeZip(destPath);
|
|
91
|
+
}
|
|
92
|
+
entryPaths() {
|
|
93
|
+
return this.zip.getEntries().map(e => toPosix(e.entryName));
|
|
94
|
+
}
|
|
95
|
+
readText(archivePath) {
|
|
96
|
+
const entry = this.zip.getEntry(toPosix(archivePath));
|
|
97
|
+
if (!entry || entry.isDirectory) {
|
|
98
|
+
return undefined;
|
|
99
|
+
}
|
|
100
|
+
try {
|
|
101
|
+
return entry.getData().toString('utf8');
|
|
102
|
+
}
|
|
103
|
+
catch {
|
|
104
|
+
return undefined;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
extractDir(archiveDirPrefix, destAbsDir) {
|
|
108
|
+
const prefix = toPosix(archiveDirPrefix).replace(/\/$/, '') + '/';
|
|
109
|
+
let written = 0;
|
|
110
|
+
for (const entry of this.zip.getEntries()) {
|
|
111
|
+
const name = toPosix(entry.entryName);
|
|
112
|
+
if (entry.isDirectory || !name.startsWith(prefix)) {
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
const rel = name.slice(prefix.length);
|
|
116
|
+
if (!rel || rel.includes('..')) {
|
|
117
|
+
continue;
|
|
118
|
+
} // guard against zip-slip
|
|
119
|
+
const dest = path.join(destAbsDir, rel);
|
|
120
|
+
fs.mkdirSync(path.dirname(dest), { recursive: true });
|
|
121
|
+
try {
|
|
122
|
+
fs.writeFileSync(dest, entry.getData());
|
|
123
|
+
written++;
|
|
124
|
+
}
|
|
125
|
+
catch { /* ignore unwritable target */ }
|
|
126
|
+
}
|
|
127
|
+
return written;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
exports.AdmZipArchive = AdmZipArchive;
|
|
131
|
+
//# sourceMappingURL=archive.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"archive.js","sourceRoot":"","sources":["../../src/agentBackup/archive.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAC7B,sDAA6B;AAkC7B,sEAAsE;AACtE,SAAS,OAAO,CAAC,CAAS;IACxB,OAAO,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AAC/B,CAAC;AAED,uDAAuD;AACvD,MAAa,aAAa;IACP,GAAG,CAAS;IAE7B,YAAoB,GAAW;QAC7B,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACjB,CAAC;IAED,2CAA2C;IAC3C,MAAM,CAAC,MAAM;QACX,OAAO,IAAI,aAAa,CAAC,IAAI,iBAAM,EAAE,CAAC,CAAC;IACzC,CAAC;IAED,oDAAoD;IACpD,MAAM,CAAC,IAAI,CAAC,OAAe;QACzB,OAAO,IAAI,aAAa,CAAC,IAAI,iBAAM,CAAC,OAAO,CAAC,CAAC,CAAC;IAChD,CAAC;IAED,OAAO,CAAC,SAAiB,EAAE,WAAmB;QAC5C,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;YAAC,OAAO;QAAC,CAAC;QAC1C,IAAI,CAAC;YACH,IAAI,CAAC,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC;gBAAC,OAAO;YAAC,CAAC;YACjD,MAAM,EAAE,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;YAChC,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,SAAS,EAAE,IAAI,CAAC,KAA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|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ProviderManifestEntry } from './manifest';
|
|
2
|
+
export interface ExportResult {
|
|
3
|
+
destPath: string;
|
|
4
|
+
/** Provider ids for which real traces were captured. */
|
|
5
|
+
capturedProviders: string[];
|
|
6
|
+
/** Per-provider manifest entries (portability, discovered IDs, etc.). */
|
|
7
|
+
providers: Record<string, ProviderManifestEntry>;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Pure (vscode-free) core: build and write the agent backup ZIP.
|
|
11
|
+
* Called both by the VS Code command (with a dialog-chosen path) and directly
|
|
12
|
+
* from the CLI (with a CLI-supplied path).
|
|
13
|
+
*/
|
|
14
|
+
export declare function createAgentBackup(root: string, destPath: string): Promise<ExportResult>;
|
|
15
|
+
/**
|
|
16
|
+
* VS Code command handler: show a save dialog then call {@link createAgentBackup}.
|
|
17
|
+
* Imports `vscode` lazily so this module stays loadable outside the extension host.
|
|
18
|
+
*/
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.createAgentBackup = createAgentBackup;
|
|
37
|
+
const path = __importStar(require("path"));
|
|
38
|
+
const archive_1 = require("./archive");
|
|
39
|
+
const layout_1 = require("./layout");
|
|
40
|
+
const sessionProviders_1 = require("./sessionProviders");
|
|
41
|
+
const manifest_1 = require("./manifest");
|
|
42
|
+
/**
|
|
43
|
+
* Pure (vscode-free) core: build and write the agent backup ZIP.
|
|
44
|
+
* Called both by the VS Code command (with a dialog-chosen path) and directly
|
|
45
|
+
* from the CLI (with a CLI-supplied path).
|
|
46
|
+
*/
|
|
47
|
+
async function createAgentBackup(root, destPath) {
|
|
48
|
+
const archive = archive_1.AdmZipArchive.create();
|
|
49
|
+
// Workspace state directories (single source of truth in layout).
|
|
50
|
+
for (const rel of layout_1.WORKSPACE_DIRS) {
|
|
51
|
+
archive.addDir(path.join(root, rel), `${layout_1.ARCHIVE_PATHS.workspace}/${rel}`);
|
|
52
|
+
}
|
|
53
|
+
// Root-level agent docs.
|
|
54
|
+
for (const f of layout_1.ROOT_DOCS) {
|
|
55
|
+
archive.addFile(path.join(root, f), `${layout_1.ARCHIVE_PATHS.workspace}/${f}`);
|
|
56
|
+
}
|
|
57
|
+
// Provider session traces (Strategy — one entry per provider family).
|
|
58
|
+
const sessionState = (0, manifest_1.readSessionState)(root);
|
|
59
|
+
const providers = {};
|
|
60
|
+
const capturedProviders = [];
|
|
61
|
+
for (const provider of sessionProviders_1.SESSION_BACKUP_PROVIDERS) {
|
|
62
|
+
const result = await provider.collect(root, archive);
|
|
63
|
+
const connected = {};
|
|
64
|
+
for (const key of provider.sessionStateKeys) {
|
|
65
|
+
connected[key] = sessionState[key] ?? null;
|
|
66
|
+
}
|
|
67
|
+
providers[provider.id] = {
|
|
68
|
+
portability: provider.portability,
|
|
69
|
+
note: provider.note,
|
|
70
|
+
discoveredSessionIds: result.discoveredIds,
|
|
71
|
+
connectedSessionIds: connected,
|
|
72
|
+
tracesCaptured: result.tracesCaptured,
|
|
73
|
+
};
|
|
74
|
+
if (result.tracesCaptured) {
|
|
75
|
+
capturedProviders.push(provider.id);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
// Session-ID manifest (per-provider, honest portability tags).
|
|
79
|
+
const manifest = {
|
|
80
|
+
exportedAt: new Date().toISOString(),
|
|
81
|
+
workspaceRoot: root,
|
|
82
|
+
providers,
|
|
83
|
+
};
|
|
84
|
+
archive.addBuffer(layout_1.ARCHIVE_PATHS.manifest, Buffer.from(JSON.stringify(manifest, null, 2), 'utf8'));
|
|
85
|
+
archive.write(destPath);
|
|
86
|
+
return { destPath, capturedProviders, providers };
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* VS Code command handler: show a save dialog then call {@link createAgentBackup}.
|
|
90
|
+
* Imports `vscode` lazily so this module stays loadable outside the extension host.
|
|
91
|
+
*/
|
|
92
|
+
//# sourceMappingURL=export.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export.js","sourceRoot":"","sources":["../../src/agentBackup/export.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBA,8CA2CC;AA9DD,2C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ACnB,oBAAoB,EAAE,MAAM,CAAC,aAAa;YAC1C,mBAAmB,EAAE,SAAS;YAC9B,cAAc,EAAE,MAAM,CAAC,cAAc;SACtC,CAAC;QACF,IAAI,MAAM,CAAC,cAAc,EAAE,CAAC;YAAC,iBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QAAC,CAAC;IACrE,CAAC;IAED,+DAA+D;IAC/D,MAAM,QAAQ,GAAoB;QAChC,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACpC,aAAa,EAAE,IAAI;QACnB,SAAS;KACV,CAAC;IACF,OAAO,CAAC,SAAS,CAAC,sBAAa,CAAC,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;IAClG,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAExB,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,SAAS,EAAE,CAAC;AACpD,CAAC;AAED;;;GAGG"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface ImportResult {
|
|
2
|
+
destRoot: string;
|
|
3
|
+
workspaceFiles: number;
|
|
4
|
+
/** Provider id → number of session-trace files restored. */
|
|
5
|
+
restoredByProvider: Record<string, number>;
|
|
6
|
+
manifestRestored: boolean;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Restore an agent backup ZIP into a destination folder and wire up its
|
|
10
|
+
* session state so it resumes there. Mirrors {@link './export'} using the
|
|
11
|
+
* same shared layout (DRY).
|
|
12
|
+
*
|
|
13
|
+
* The workspace `.autodev/` (including `session-state.json`) is restored
|
|
14
|
+
* verbatim, so connected session IDs travel automatically — the per-provider
|
|
15
|
+
* `restore()` calls place the matching traces into each host store.
|
|
16
|
+
*/
|
|
17
|
+
export declare function restoreAgentBackup(zipPath: string, destRoot: string): Promise<ImportResult>;
|
|
18
|
+
/**
|
|
19
|
+
* Interactive command flow: pick a backup ZIP, pick a destination folder,
|
|
20
|
+
* restore, then offer to open the restored workspace.
|
|
21
|
+
*/
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.restoreAgentBackup = restoreAgentBackup;
|
|
4
|
+
const archive_1 = require("./archive");
|
|
5
|
+
const layout_1 = require("./layout");
|
|
6
|
+
const sessionProviders_1 = require("./sessionProviders");
|
|
7
|
+
const manifest_1 = require("./manifest");
|
|
8
|
+
/**
|
|
9
|
+
* Restore an agent backup ZIP into a destination folder and wire up its
|
|
10
|
+
* session state so it resumes there. Mirrors {@link './export'} using the
|
|
11
|
+
* same shared layout (DRY).
|
|
12
|
+
*
|
|
13
|
+
* The workspace `.autodev/` (including `session-state.json`) is restored
|
|
14
|
+
* verbatim, so connected session IDs travel automatically — the per-provider
|
|
15
|
+
* `restore()` calls place the matching traces into each host store.
|
|
16
|
+
*/
|
|
17
|
+
async function restoreAgentBackup(zipPath, destRoot) {
|
|
18
|
+
const archive = archive_1.AdmZipArchive.open(zipPath);
|
|
19
|
+
// Reject archives that aren't an agent backup.
|
|
20
|
+
if (!archive.entryPaths().some(p => p.startsWith(`${layout_1.TOP_FOLDER}/`))) {
|
|
21
|
+
throw new Error('Not an AutoDev agent backup (missing agent-export/ root).');
|
|
22
|
+
}
|
|
23
|
+
// 1. Workspace state + root docs back into the destination folder.
|
|
24
|
+
const workspaceFiles = archive.extractDir(layout_1.ARCHIVE_PATHS.workspace, destRoot);
|
|
25
|
+
// 2. Provider session traces into their host stores (Strategy).
|
|
26
|
+
const restoredByProvider = {};
|
|
27
|
+
for (const provider of sessionProviders_1.SESSION_BACKUP_PROVIDERS) {
|
|
28
|
+
const n = await provider.restore(destRoot, archive);
|
|
29
|
+
if (n > 0) {
|
|
30
|
+
restoredByProvider[provider.id] = n;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
const manifest = (0, manifest_1.parseManifest)(archive.readText(layout_1.ARCHIVE_PATHS.manifest));
|
|
34
|
+
return { destRoot, workspaceFiles, restoredByProvider, manifestRestored: !!manifest };
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Interactive command flow: pick a backup ZIP, pick a destination folder,
|
|
38
|
+
* restore, then offer to open the restored workspace.
|
|
39
|
+
*/
|
|
40
|
+
//# sourceMappingURL=import.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"import.js","sourceRoot":"","sources":["../../src/agentBackup/import.ts"],"names":[],"mappings":";;AAuBA,gDAoBC;AA1CD,uCAA0C;AAC1C,qCAAqD;AACrD,yDAA8D;AAC9D,yCAA2C;AAU3C;;;;;;;;GAQG;AACI,KAAK,UAAU,kBAAkB,CAAC,OAAe,EAAE,QAAgB;IACxE,MAAM,OAAO,GAAG,uBAAa,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAE5C,+CAA+C;IAC/C,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,mBAAU,GAAG,CAAC,CAAC,EAAE,CAAC;QACpE,MAAM,IAAI,KAAK,CAAC,2DAA2D,CAAC,CAAC;IAC/E,CAAC;IAED,mEAAmE;IACnE,MAAM,cAAc,GAAG,OAAO,CAAC,UAAU,CAAC,sBAAa,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IAE7E,gEAAgE;IAChE,MAAM,kBAAkB,GAA2B,EAAE,CAAC;IACtD,KAAK,MAAM,QAAQ,IAAI,2CAAwB,EAAE,CAAC;QAChD,MAAM,CAAC,GAAG,MAAM,QAAQ,CAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QACpD,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;YAAC,kBAAkB,CAAC,QAAQ,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;QAAC,CAAC;IACrD,CAAC;IAED,MAAM,QAAQ,GAAG,IAAA,wBAAa,EAAC,OAAO,CAAC,QAAQ,CAAC,sBAAa,CAAC,QAAQ,CAAC,CAAC,CAAC;IACzE,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC;AACxF,CAAC;AAED;;;GAGG"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { createAgentBackup } from './export';
|
|
2
|
+
export type { ExportResult } from './export';
|
|
3
|
+
export { restoreAgentBackup } from './import';
|
|
4
|
+
export type { ImportResult } from './import';
|
|
5
|
+
export { uploadAgentBackup, downloadAgentBackup } from './upload';
|
|
6
|
+
export type { UploadResult } from './upload';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.downloadAgentBackup = exports.uploadAgentBackup = exports.restoreAgentBackup = exports.createAgentBackup = void 0;
|
|
4
|
+
var export_1 = require("./export");
|
|
5
|
+
Object.defineProperty(exports, "createAgentBackup", { enumerable: true, get: function () { return export_1.createAgentBackup; } });
|
|
6
|
+
var import_1 = require("./import");
|
|
7
|
+
Object.defineProperty(exports, "restoreAgentBackup", { enumerable: true, get: function () { return import_1.restoreAgentBackup; } });
|
|
8
|
+
var upload_1 = require("./upload");
|
|
9
|
+
Object.defineProperty(exports, "uploadAgentBackup", { enumerable: true, get: function () { return upload_1.uploadAgentBackup; } });
|
|
10
|
+
Object.defineProperty(exports, "downloadAgentBackup", { enumerable: true, get: function () { return upload_1.downloadAgentBackup; } });
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/agentBackup/index.ts"],"names":[],"mappings":";;;AAAA,mCAA6C;AAApC,2GAAA,iBAAiB,OAAA;AAE1B,mCAA8C;AAArC,4GAAA,kBAAkB,OAAA;AAE3B,mCAAkE;AAAzD,2GAAA,iBAAiB,OAAA;AAAE,6GAAA,mBAAmB,OAAA"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/** Top-level folder inside the archive that everything lives under. */
|
|
2
|
+
export declare const TOP_FOLDER = "agent-export";
|
|
3
|
+
/** Archive sub-paths, derived once from {@link TOP_FOLDER}. */
|
|
4
|
+
export declare const ARCHIVE_PATHS: {
|
|
5
|
+
readonly workspace: "agent-export/workspace";
|
|
6
|
+
readonly sessionsRoot: "agent-export/sessions";
|
|
7
|
+
readonly manifest: "agent-export/manifest/session-ids.json";
|
|
8
|
+
};
|
|
9
|
+
/** Archive path for a given provider's session traces. */
|
|
10
|
+
export declare function sessionsPath(providerId: string): string;
|
|
11
|
+
/**
|
|
12
|
+
* Root-level documents that carry agent context/protocol. Backed up and
|
|
13
|
+
* restored verbatim relative to the workspace root.
|
|
14
|
+
*/
|
|
15
|
+
export declare const ROOT_DOCS: readonly string[];
|
|
16
|
+
/**
|
|
17
|
+
* Directories under the workspace that hold agent state. Each maps a
|
|
18
|
+
* workspace-relative source to the same relative location inside
|
|
19
|
+
* `agent-export/workspace/`. This single list is the source of truth shared
|
|
20
|
+
* by both export and import (DRY).
|
|
21
|
+
*/
|
|
22
|
+
export declare const WORKSPACE_DIRS: readonly string[];
|
|
23
|
+
/** Normalise a filesystem path for comparison (case-insensitive, slash-form). */
|
|
24
|
+
export declare function normalizePath(p: string): string;
|
|
25
|
+
/** Root of the Copilot CLI store. */
|
|
26
|
+
export declare function copilotDir(): string;
|
|
27
|
+
/** `~/.copilot/session-state` — one sub-folder per session, keyed by uuid. */
|
|
28
|
+
export declare function copilotSessionStateDir(): string;
|
|
29
|
+
/** Resolve the OpenCode data directory if present (first existing wins). */
|
|
30
|
+
export declare function findOpenCodeDataDir(): string | undefined;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.WORKSPACE_DIRS = exports.ROOT_DOCS = exports.ARCHIVE_PATHS = exports.TOP_FOLDER = void 0;
|
|
37
|
+
exports.sessionsPath = sessionsPath;
|
|
38
|
+
exports.normalizePath = normalizePath;
|
|
39
|
+
exports.copilotDir = copilotDir;
|
|
40
|
+
exports.copilotSessionStateDir = copilotSessionStateDir;
|
|
41
|
+
exports.findOpenCodeDataDir = findOpenCodeDataDir;
|
|
42
|
+
const fs = __importStar(require("fs"));
|
|
43
|
+
const path = __importStar(require("path"));
|
|
44
|
+
const os = __importStar(require("os"));
|
|
45
|
+
/** Top-level folder inside the archive that everything lives under. */
|
|
46
|
+
exports.TOP_FOLDER = 'agent-export';
|
|
47
|
+
/** Archive sub-paths, derived once from {@link TOP_FOLDER}. */
|
|
48
|
+
exports.ARCHIVE_PATHS = {
|
|
49
|
+
workspace: `${exports.TOP_FOLDER}/workspace`,
|
|
50
|
+
sessionsRoot: `${exports.TOP_FOLDER}/sessions`,
|
|
51
|
+
manifest: `${exports.TOP_FOLDER}/manifest/session-ids.json`,
|
|
52
|
+
};
|
|
53
|
+
/** Archive path for a given provider's session traces. */
|
|
54
|
+
function sessionsPath(providerId) {
|
|
55
|
+
return `${exports.ARCHIVE_PATHS.sessionsRoot}/${providerId}`;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Root-level documents that carry agent context/protocol. Backed up and
|
|
59
|
+
* restored verbatim relative to the workspace root.
|
|
60
|
+
*/
|
|
61
|
+
exports.ROOT_DOCS = [
|
|
62
|
+
'AGENTS.md', 'CLAUDE.md', 'SOUL.md', 'JOURNAL.md', 'CONTRACTS.md', 'TODO.md',
|
|
63
|
+
'DONE.md', 'TASKS.md', 'LESSONS.md', 'NOTES.md', 'SCRATCHPAD.md',
|
|
64
|
+
];
|
|
65
|
+
/**
|
|
66
|
+
* Directories under the workspace that hold agent state. Each maps a
|
|
67
|
+
* workspace-relative source to the same relative location inside
|
|
68
|
+
* `agent-export/workspace/`. This single list is the source of truth shared
|
|
69
|
+
* by both export and import (DRY).
|
|
70
|
+
*/
|
|
71
|
+
exports.WORKSPACE_DIRS = [
|
|
72
|
+
'.autodev',
|
|
73
|
+
path.posix.join('media', 'profile'),
|
|
74
|
+
path.posix.join('media', 'skills'),
|
|
75
|
+
];
|
|
76
|
+
/** Normalise a filesystem path for comparison (case-insensitive, slash-form). */
|
|
77
|
+
function normalizePath(p) {
|
|
78
|
+
return p.replace(/\\/g, '/').replace(/\/+$/, '').toLowerCase();
|
|
79
|
+
}
|
|
80
|
+
// ---------------------------------------------------------------------------
|
|
81
|
+
// Copilot CLI store — VERIFIED on-disk layout (PLAN §2.6)
|
|
82
|
+
// ~/.copilot/session-state/<uuid>/ (events.jsonl, workspace.yaml, …)
|
|
83
|
+
// ~/.copilot/session-store.db (SQLite index — not touched on restore)
|
|
84
|
+
// ---------------------------------------------------------------------------
|
|
85
|
+
/** Root of the Copilot CLI store. */
|
|
86
|
+
function copilotDir() {
|
|
87
|
+
return path.join(os.homedir(), '.copilot');
|
|
88
|
+
}
|
|
89
|
+
/** `~/.copilot/session-state` — one sub-folder per session, keyed by uuid. */
|
|
90
|
+
function copilotSessionStateDir() {
|
|
91
|
+
return path.join(copilotDir(), 'session-state');
|
|
92
|
+
}
|
|
93
|
+
// ---------------------------------------------------------------------------
|
|
94
|
+
// OpenCode store — VERIFIED on-disk layout (PLAN §2.6)
|
|
95
|
+
// ~/.local/share/opencode/opencode.db (SQLite — sessions + messages)
|
|
96
|
+
// ~/.local/share/opencode/storage/… (diffs/snapshots only, not a session)
|
|
97
|
+
// There is NO per-session directory, so per-session restore is NOT supported
|
|
98
|
+
// without a SQLite dependency. Kept only for discovery/diagnostics.
|
|
99
|
+
// ---------------------------------------------------------------------------
|
|
100
|
+
/** Resolve the OpenCode data directory if present (first existing wins). */
|
|
101
|
+
function findOpenCodeDataDir() {
|
|
102
|
+
const candidates = [];
|
|
103
|
+
const xdg = process.env['XDG_DATA_HOME'];
|
|
104
|
+
if (xdg) {
|
|
105
|
+
candidates.push(path.join(xdg, 'opencode'));
|
|
106
|
+
}
|
|
107
|
+
candidates.push(path.join(os.homedir(), '.local', 'share', 'opencode'));
|
|
108
|
+
candidates.push(path.join(os.homedir(), '.opencode'));
|
|
109
|
+
const appdata = process.env['APPDATA'];
|
|
110
|
+
if (appdata) {
|
|
111
|
+
candidates.push(path.join(appdata, 'opencode'));
|
|
112
|
+
}
|
|
113
|
+
const localAppData = process.env['LOCALAPPDATA'];
|
|
114
|
+
if (localAppData) {
|
|
115
|
+
candidates.push(path.join(localAppData, 'opencode'));
|
|
116
|
+
}
|
|
117
|
+
return candidates.find(d => {
|
|
118
|
+
try {
|
|
119
|
+
return fs.statSync(d).isDirectory();
|
|
120
|
+
}
|
|
121
|
+
catch {
|
|
122
|
+
return false;
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
//# sourceMappingURL=layout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout.js","sourceRoot":"","sources":["../../src/agentBackup/layout.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeA,oCAEC;AAwBD,sCAEC;AASD,gCAEC;AAGD,wDAEC;AAWD,kDAaC;AAnFD,uCAAyB;AACzB,2CAA6B;AAC7B,uCAAyB;AAEzB,uEAAuE;AAC1D,QAAA,UAAU,GAAG,cAAc,CAAC;AAEzC,+DAA+D;AAClD,QAAA,aAAa,GAAG;IAC3B,SAAS,EAAE,GAAG,kBAAU,YAAY;IACpC,YAAY,EAAE,GAAG,kBAAU,WAAW;IACtC,QAAQ,EAAE,GAAG,kBAAU,4BAA4B;CAC3C,CAAC;AAEX,0DAA0D;AAC1D,SAAgB,YAAY,CAAC,UAAkB;IAC7C,OAAO,GAAG,qBAAa,CAAC,YAAY,IAAI,UAAU,EAAE,CAAC;AACvD,CAAC;AAED;;;GAGG;AACU,QAAA,SAAS,GAAsB;IAC1C,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,YAAY,EAAE,cAAc,EAAE,SAAS;IAC5E,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,UAAU,EAAE,eAAe;CACjE,CAAC;AA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C,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,CAAC,CAAC,CAAC;IACtD,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IACvC,IAAI,OAAO,EAAE,CAAC;QAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC;IAAC,CAAC;IACjE,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IACjD,IAAI,YAAY,EAAE,CAAC;QAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC,CAAC;IAAC,CAAC;IAC3E,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE;QACzB,IAAI,CAAC;YAAC,OAAO,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;QAAC,CAAC;QAAC,MAAM,CAAC;YAAC,OAAO,KAAK,CAAC;QAAC,CAAC;IACtE,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Portability } from './sessionProviders';
|
|
2
|
+
/** Per-provider record in the manifest. */
|
|
3
|
+
export interface ProviderManifestEntry {
|
|
4
|
+
/** Portability classification for this provider family. */
|
|
5
|
+
portability: Portability;
|
|
6
|
+
/** Human-readable explanation of what was/wasn't captured. */
|
|
7
|
+
note: string;
|
|
8
|
+
/** Session IDs discovered for this workspace. */
|
|
9
|
+
discoveredSessionIds: string[];
|
|
10
|
+
/** Currently connected session ID(s) from session-state.json, keyed. */
|
|
11
|
+
connectedSessionIds: Record<string, string | null>;
|
|
12
|
+
/** True if real conversation traces were written into the archive. */
|
|
13
|
+
tracesCaptured: boolean;
|
|
14
|
+
}
|
|
15
|
+
/** Manifest written into the archive describing what was captured. */
|
|
16
|
+
export interface SessionManifest {
|
|
17
|
+
exportedAt: string;
|
|
18
|
+
workspaceRoot: string;
|
|
19
|
+
providers: Record<string, ProviderManifestEntry>;
|
|
20
|
+
}
|
|
21
|
+
/** Read all string-valued session IDs from `<root>/.autodev/session-state.json`. */
|
|
22
|
+
export declare function readSessionState(root: string): Record<string, string>;
|
|
23
|
+
/** Parse a manifest from its JSON text, or `undefined` if invalid. */
|
|
24
|
+
export declare function parseManifest(text: string | undefined): SessionManifest | undefined;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.readSessionState = readSessionState;
|
|
37
|
+
exports.parseManifest = parseManifest;
|
|
38
|
+
const fs = __importStar(require("fs"));
|
|
39
|
+
const path = __importStar(require("path"));
|
|
40
|
+
/** Read all string-valued session IDs from `<root>/.autodev/session-state.json`. */
|
|
41
|
+
function readSessionState(root) {
|
|
42
|
+
const out = {};
|
|
43
|
+
const p = path.join(root, '.autodev', 'session-state.json');
|
|
44
|
+
try {
|
|
45
|
+
if (!fs.existsSync(p)) {
|
|
46
|
+
return out;
|
|
47
|
+
}
|
|
48
|
+
const raw = JSON.parse(fs.readFileSync(p, 'utf8'));
|
|
49
|
+
for (const [k, v] of Object.entries(raw)) {
|
|
50
|
+
if (typeof v === 'string' && v.trim()) {
|
|
51
|
+
out[k] = v;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
catch { /* ignore malformed file */ }
|
|
56
|
+
return out;
|
|
57
|
+
}
|
|
58
|
+
/** Parse a manifest from its JSON text, or `undefined` if invalid. */
|
|
59
|
+
function parseManifest(text) {
|
|
60
|
+
if (!text) {
|
|
61
|
+
return undefined;
|
|
62
|
+
}
|
|
63
|
+
try {
|
|
64
|
+
return JSON.parse(text);
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
return undefined;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=manifest.js.map
|