@agent-deck/backend 1.2.10 → 1.3.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.
- package/dist/.tsbuildinfo +1 -1
- package/dist/cli-runtime.d.ts +62 -0
- package/dist/cli-runtime.d.ts.map +1 -1
- package/dist/cli-runtime.js +120 -0
- package/dist/cli-runtime.js.map +1 -1
- package/dist/export-import/export-bundle.d.ts +9 -0
- package/dist/export-import/export-bundle.d.ts.map +1 -0
- package/dist/export-import/export-bundle.js +78 -0
- package/dist/export-import/export-bundle.js.map +1 -0
- package/dist/export-import/import-bundle.d.ts +8 -0
- package/dist/export-import/import-bundle.d.ts.map +1 -0
- package/dist/export-import/import-bundle.js +267 -0
- package/dist/export-import/import-bundle.js.map +1 -0
- package/dist/export-import/index.d.ts +4 -0
- package/dist/export-import/index.d.ts.map +1 -0
- package/dist/export-import/index.js +15 -0
- package/dist/export-import/index.js.map +1 -0
- package/dist/export-import/sanitize-for-export.d.ts +8 -0
- package/dist/export-import/sanitize-for-export.d.ts.map +1 -0
- package/dist/export-import/sanitize-for-export.js +75 -0
- package/dist/export-import/sanitize-for-export.js.map +1 -0
- package/dist/mcp-server.d.ts +3 -1
- package/dist/mcp-server.d.ts.map +1 -1
- package/dist/mcp-server.js +22 -644
- package/dist/mcp-server.js.map +1 -1
- package/dist/mcp-tools/deck-card-ops.d.ts +21 -0
- package/dist/mcp-tools/deck-card-ops.d.ts.map +1 -0
- package/dist/mcp-tools/deck-card-ops.js +94 -0
- package/dist/mcp-tools/deck-card-ops.js.map +1 -0
- package/dist/mcp-tools/profile.d.ts +17 -0
- package/dist/mcp-tools/profile.d.ts.map +1 -0
- package/dist/mcp-tools/profile.js +25 -0
- package/dist/mcp-tools/profile.js.map +1 -0
- package/dist/mcp-tools/register.d.ts +49 -0
- package/dist/mcp-tools/register.d.ts.map +1 -0
- package/dist/mcp-tools/register.js +635 -0
- package/dist/mcp-tools/register.js.map +1 -0
- package/dist/mcp-tools/test-harness.d.ts +31 -0
- package/dist/mcp-tools/test-harness.d.ts.map +1 -0
- package/dist/mcp-tools/test-harness.js +108 -0
- package/dist/mcp-tools/test-harness.js.map +1 -0
- package/dist/models/database.d.ts +8 -0
- package/dist/models/database.d.ts.map +1 -1
- package/dist/models/database.js +151 -67
- package/dist/models/database.js.map +1 -1
- package/dist/routes/export-import.d.ts +3 -0
- package/dist/routes/export-import.d.ts.map +1 -0
- package/dist/routes/export-import.js +52 -0
- package/dist/routes/export-import.js.map +1 -0
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +2 -0
- package/dist/server/index.js.map +1 -1
- package/package.json +2 -2
- package/static-ui/assets/index-BkYGH65z.js +420 -0
- package/static-ui/assets/index-DMYIwycS.css +1 -0
- package/static-ui/index.html +2 -2
- package/static-ui/assets/index-CQoBRW1p.js +0 -409
- package/static-ui/assets/index-wleyGzod.css +0 -1
package/dist/cli-runtime.d.ts
CHANGED
|
@@ -1,4 +1,66 @@
|
|
|
1
|
+
import type { BundleV1, ExportRequest, ImportReport } from '@agent-deck/shared';
|
|
1
2
|
import { CredentialManager } from './vault';
|
|
3
|
+
import { PlaybookDependencyError } from './playbooks/playbook-manager';
|
|
4
|
+
import { ExportBundleError, ImportBundleError } from './export-import';
|
|
2
5
|
/** Shared credential manager for the agent-deck CLI (vault + exec). */
|
|
3
6
|
export declare function createCliCredentialManager(): CredentialManager;
|
|
7
|
+
/**
|
|
8
|
+
* Rare collection/deck ops for the CLI (not MCP).
|
|
9
|
+
* Delete service/playbook/deck — same dependency checks as the dashboard API.
|
|
10
|
+
*/
|
|
11
|
+
export declare function createCliCollectionAdmin(): {
|
|
12
|
+
deleteService(id: string): Promise<{
|
|
13
|
+
ok: true;
|
|
14
|
+
} | {
|
|
15
|
+
ok: false;
|
|
16
|
+
error: string;
|
|
17
|
+
}>;
|
|
18
|
+
deletePlaybook(id: string): Promise<{
|
|
19
|
+
ok: true;
|
|
20
|
+
} | {
|
|
21
|
+
ok: false;
|
|
22
|
+
error: string;
|
|
23
|
+
}>;
|
|
24
|
+
deleteDeck(id: string): Promise<{
|
|
25
|
+
ok: true;
|
|
26
|
+
} | {
|
|
27
|
+
ok: false;
|
|
28
|
+
error: string;
|
|
29
|
+
}>;
|
|
30
|
+
listServices(): Promise<Array<{
|
|
31
|
+
id: string;
|
|
32
|
+
name: string;
|
|
33
|
+
type: string;
|
|
34
|
+
}>>;
|
|
35
|
+
listPlaybooks(): Promise<Array<{
|
|
36
|
+
id: string;
|
|
37
|
+
title: string;
|
|
38
|
+
}>>;
|
|
39
|
+
listDecks(): Promise<Array<{
|
|
40
|
+
id: string;
|
|
41
|
+
name: string;
|
|
42
|
+
}>>;
|
|
43
|
+
};
|
|
44
|
+
export type CliCollectionAdmin = ReturnType<typeof createCliCollectionAdmin>;
|
|
45
|
+
/**
|
|
46
|
+
* Export / import layouts (MCP + playbooks + decks). No credentials or secrets.
|
|
47
|
+
*/
|
|
48
|
+
export declare function createCliExportImport(): {
|
|
49
|
+
exportToFile(outputPath: string, request: ExportRequest): Promise<{
|
|
50
|
+
ok: true;
|
|
51
|
+
bundle: BundleV1;
|
|
52
|
+
} | {
|
|
53
|
+
ok: false;
|
|
54
|
+
error: string;
|
|
55
|
+
}>;
|
|
56
|
+
importFromFile(inputPath: string): Promise<{
|
|
57
|
+
ok: true;
|
|
58
|
+
report: ImportReport;
|
|
59
|
+
} | {
|
|
60
|
+
ok: false;
|
|
61
|
+
error: string;
|
|
62
|
+
}>;
|
|
63
|
+
};
|
|
64
|
+
export type CliExportImport = ReturnType<typeof createCliExportImport>;
|
|
65
|
+
export { PlaybookDependencyError, ExportBundleError, ImportBundleError };
|
|
4
66
|
//# sourceMappingURL=cli-runtime.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-runtime.d.ts","sourceRoot":"","sources":["../src/cli-runtime.ts"],"names":[],"mappings":"AAEA,OAAO,EAAqB,iBAAiB,EAAE,MAAM,SAAS,CAAC;
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C,CAAC;EAKlE;AAED,MAAM,MAAM,kBAAkB,GAAG,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE7E;;GAEG;AACH,wBAAgB,qBAAqB;6BAKnB,MAAM,WACT,aAAa,GACrB,OAAO,CAAC;QAAE,EAAE,EAAE,IAAI,CAAC;QAAC,MAAM,EAAE,QAAQ,CAAA;KAAE,GAAG;QAAE,EAAE,EAAE,KAAK,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;8BAmB5D,MAAM,GAChB,OAAO,CAAC;QAAE,EAAE,EAAE,IAAI,CAAC;QAAC,MAAM,EAAE,YAAY,CAAA;KAAE,GAAG;QAAE,EAAE,EAAE,KAAK,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;EAoBhF;AAED,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEvE,OAAO,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,CAAC"}
|
package/dist/cli-runtime.js
CHANGED
|
@@ -1,12 +1,132 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ImportBundleError = exports.ExportBundleError = exports.PlaybookDependencyError = void 0;
|
|
3
7
|
exports.createCliCredentialManager = createCliCredentialManager;
|
|
8
|
+
exports.createCliCollectionAdmin = createCliCollectionAdmin;
|
|
9
|
+
exports.createCliExportImport = createCliExportImport;
|
|
10
|
+
const promises_1 = __importDefault(require("node:fs/promises"));
|
|
11
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
4
12
|
const database_1 = require("./models/database");
|
|
5
13
|
const paths_1 = require("./lib/paths");
|
|
6
14
|
const vault_1 = require("./vault");
|
|
15
|
+
const playbook_manager_1 = require("./playbooks/playbook-manager");
|
|
16
|
+
Object.defineProperty(exports, "PlaybookDependencyError", { enumerable: true, get: function () { return playbook_manager_1.PlaybookDependencyError; } });
|
|
17
|
+
const export_import_1 = require("./export-import");
|
|
18
|
+
Object.defineProperty(exports, "ExportBundleError", { enumerable: true, get: function () { return export_import_1.ExportBundleError; } });
|
|
19
|
+
Object.defineProperty(exports, "ImportBundleError", { enumerable: true, get: function () { return export_import_1.ImportBundleError; } });
|
|
7
20
|
/** Shared credential manager for the agent-deck CLI (vault + exec). */
|
|
8
21
|
function createCliCredentialManager() {
|
|
9
22
|
const db = new database_1.DatabaseManager((0, paths_1.resolveDatabasePath)());
|
|
10
23
|
return new vault_1.CredentialManager(db, (0, vault_1.createSecretStore)());
|
|
11
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* Rare collection/deck ops for the CLI (not MCP).
|
|
27
|
+
* Delete service/playbook/deck — same dependency checks as the dashboard API.
|
|
28
|
+
*/
|
|
29
|
+
function createCliCollectionAdmin() {
|
|
30
|
+
const db = new database_1.DatabaseManager((0, paths_1.resolveDatabasePath)());
|
|
31
|
+
const playbooks = new playbook_manager_1.PlaybookManager(db);
|
|
32
|
+
return {
|
|
33
|
+
async deleteService(id) {
|
|
34
|
+
const service = await db.getService(id);
|
|
35
|
+
if (!service) {
|
|
36
|
+
return { ok: false, error: `Service not found: ${id}` };
|
|
37
|
+
}
|
|
38
|
+
const dependents = await db.getPlaybooksDependingOnService(id);
|
|
39
|
+
if (dependents.length > 0) {
|
|
40
|
+
const titles = dependents.map((playbook) => playbook.title).join(', ');
|
|
41
|
+
return {
|
|
42
|
+
ok: false,
|
|
43
|
+
error: `Cannot delete MCP "${service.name}": referenced by playbook(s): ${titles}`,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
const deleted = await db.deleteService(id);
|
|
47
|
+
if (!deleted) {
|
|
48
|
+
return { ok: false, error: `Service not found: ${id}` };
|
|
49
|
+
}
|
|
50
|
+
return { ok: true };
|
|
51
|
+
},
|
|
52
|
+
async deletePlaybook(id) {
|
|
53
|
+
const deleted = await playbooks.delete(id);
|
|
54
|
+
if (!deleted) {
|
|
55
|
+
return { ok: false, error: `Playbook not found: ${id}` };
|
|
56
|
+
}
|
|
57
|
+
return { ok: true };
|
|
58
|
+
},
|
|
59
|
+
async deleteDeck(id) {
|
|
60
|
+
const deck = await db.getDeck(id);
|
|
61
|
+
if (!deck) {
|
|
62
|
+
return { ok: false, error: `Deck not found: ${id}` };
|
|
63
|
+
}
|
|
64
|
+
const deleted = await db.deleteDeck(id);
|
|
65
|
+
if (!deleted) {
|
|
66
|
+
return { ok: false, error: `Deck not found: ${id}` };
|
|
67
|
+
}
|
|
68
|
+
return { ok: true };
|
|
69
|
+
},
|
|
70
|
+
async listServices() {
|
|
71
|
+
const services = await db.getAllServices();
|
|
72
|
+
return services.map((service) => ({
|
|
73
|
+
id: service.id,
|
|
74
|
+
name: service.name,
|
|
75
|
+
type: service.type,
|
|
76
|
+
}));
|
|
77
|
+
},
|
|
78
|
+
async listPlaybooks() {
|
|
79
|
+
const items = await playbooks.list();
|
|
80
|
+
return items.map((playbook) => ({ id: playbook.id, title: playbook.title }));
|
|
81
|
+
},
|
|
82
|
+
async listDecks() {
|
|
83
|
+
const decks = await db.getAllDecks();
|
|
84
|
+
return decks.map((deck) => ({ id: deck.id, name: deck.name }));
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Export / import layouts (MCP + playbooks + decks). No credentials or secrets.
|
|
90
|
+
*/
|
|
91
|
+
function createCliExportImport() {
|
|
92
|
+
const db = new database_1.DatabaseManager((0, paths_1.resolveDatabasePath)());
|
|
93
|
+
return {
|
|
94
|
+
async exportToFile(outputPath, request) {
|
|
95
|
+
try {
|
|
96
|
+
const bundle = await (0, export_import_1.buildExportBundle)(db, request);
|
|
97
|
+
const resolved = node_path_1.default.resolve(outputPath);
|
|
98
|
+
await promises_1.default.mkdir(node_path_1.default.dirname(resolved), { recursive: true });
|
|
99
|
+
await promises_1.default.writeFile(resolved, `${JSON.stringify(bundle, null, 2)}\n`, 'utf8');
|
|
100
|
+
return { ok: true, bundle };
|
|
101
|
+
}
|
|
102
|
+
catch (error) {
|
|
103
|
+
const message = error instanceof export_import_1.ExportBundleError
|
|
104
|
+
? error.message
|
|
105
|
+
: error instanceof Error
|
|
106
|
+
? error.message
|
|
107
|
+
: String(error);
|
|
108
|
+
return { ok: false, error: message };
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
async importFromFile(inputPath) {
|
|
112
|
+
try {
|
|
113
|
+
const text = await promises_1.default.readFile(node_path_1.default.resolve(inputPath), 'utf8');
|
|
114
|
+
const raw = (0, export_import_1.parseBundleJson)(text);
|
|
115
|
+
const report = await (0, export_import_1.importBundle)(db, raw);
|
|
116
|
+
if (report.status === 'failed') {
|
|
117
|
+
return { ok: false, error: report.warnings.join('; ') || 'Import failed' };
|
|
118
|
+
}
|
|
119
|
+
return { ok: true, report };
|
|
120
|
+
}
|
|
121
|
+
catch (error) {
|
|
122
|
+
const message = error instanceof export_import_1.ImportBundleError
|
|
123
|
+
? error.message
|
|
124
|
+
: error instanceof Error
|
|
125
|
+
? error.message
|
|
126
|
+
: String(error);
|
|
127
|
+
return { ok: false, error: message };
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
};
|
|
131
|
+
}
|
|
12
132
|
//# sourceMappingURL=cli-runtime.js.map
|
package/dist/cli-runtime.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-runtime.js","sourceRoot":"","sources":["../src/cli-runtime.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cli-runtime.js","sourceRoot":"","sources":["../src/cli-runtime.ts"],"names":[],"mappings":";;;;;;AAgBA,gEAGC;AAMD,4DAkEC;AAOD,sDA+CC;AAjJD,gEAAkC;AAClC,0DAA6B;AAE7B,gDAAoD;AACpD,uCAAkD;AAClD,mCAA+D;AAC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C,CAAC;gBACtB,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;YACvC,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BundleV1, ExportRequest } from '@agent-deck/shared';
|
|
2
|
+
import type { DatabaseManager } from '../models/database';
|
|
3
|
+
export declare class ExportBundleError extends Error {
|
|
4
|
+
constructor(message: string);
|
|
5
|
+
}
|
|
6
|
+
export declare function buildExportBundle(db: DatabaseManager, request: ExportRequest, options?: {
|
|
7
|
+
agentDeckVersion?: string;
|
|
8
|
+
}): Promise<BundleV1>;
|
|
9
|
+
//# sourceMappingURL=export-bundle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export-bundle.d.ts","sourceRoot":"","sources":["../../src/export-import/export-bundle.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAER,aAAa,EAId,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAI1D,qBAAa,iBAAkB,SAAQ,KAAK;gBAC9B,OAAO,EAAE,MAAM;CAI5B;AA2BD,wBAAsB,iBAAiB,CACrC,EAAE,EAAE,eAAe,EACnB,OAAO,EAAE,aAAa,EACtB,OAAO,CAAC,EAAE;IAAE,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAAE,GACtC,OAAO,CAAC,QAAQ,CAAC,CA8DnB"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExportBundleError = void 0;
|
|
4
|
+
exports.buildExportBundle = buildExportBundle;
|
|
5
|
+
const shared_1 = require("@agent-deck/shared");
|
|
6
|
+
const version_1 = require("../lib/version");
|
|
7
|
+
const sanitize_for_export_1 = require("./sanitize-for-export");
|
|
8
|
+
class ExportBundleError extends Error {
|
|
9
|
+
constructor(message) {
|
|
10
|
+
super(message);
|
|
11
|
+
this.name = 'ExportBundleError';
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.ExportBundleError = ExportBundleError;
|
|
15
|
+
function toBundlePlaybook(playbook, allowedServiceIds) {
|
|
16
|
+
return {
|
|
17
|
+
id: playbook.id,
|
|
18
|
+
title: playbook.title,
|
|
19
|
+
body: playbook.body,
|
|
20
|
+
triggers: playbook.triggers,
|
|
21
|
+
dependsOnServiceIds: playbook.dependsOnServiceIds.filter((id) => allowedServiceIds.has(id)),
|
|
22
|
+
...(playbook.exec ? { exec: playbook.exec } : {}),
|
|
23
|
+
...(playbook.skill ? { skill: playbook.skill } : {}),
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
async function buildExportBundle(db, request, options) {
|
|
27
|
+
const input = shared_1.ExportRequestSchema.parse(request);
|
|
28
|
+
const agentDeckVersion = options?.agentDeckVersion ?? (0, version_1.getAgentDeckVersion)();
|
|
29
|
+
let services = [];
|
|
30
|
+
let playbooks = [];
|
|
31
|
+
let decks = [];
|
|
32
|
+
if (input.scope === 'collection') {
|
|
33
|
+
const allServices = await db.getAllServices();
|
|
34
|
+
services = allServices.map(sanitize_for_export_1.sanitizeServiceForExport);
|
|
35
|
+
const allowedServiceIds = new Set(services.map((service) => service.id));
|
|
36
|
+
const allPlaybooks = await db.getAllPlaybooks();
|
|
37
|
+
playbooks = allPlaybooks.map((playbook) => toBundlePlaybook(playbook, allowedServiceIds));
|
|
38
|
+
const allDecks = await db.getAllDecks();
|
|
39
|
+
decks = allDecks.map((deck) => ({
|
|
40
|
+
id: deck.id,
|
|
41
|
+
name: deck.name,
|
|
42
|
+
...(deck.description ? { description: deck.description } : {}),
|
|
43
|
+
serviceIds: (deck.services ?? []).map((service) => service.id),
|
|
44
|
+
playbookIds: (deck.playbooks ?? []).map((playbook) => playbook.id),
|
|
45
|
+
}));
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
const deck = await db.getDeck(input.deckId);
|
|
49
|
+
if (!deck) {
|
|
50
|
+
throw new ExportBundleError(`Deck not found: ${input.deckId}`);
|
|
51
|
+
}
|
|
52
|
+
const deckServices = deck.services ?? [];
|
|
53
|
+
services = deckServices.map(sanitize_for_export_1.sanitizeServiceForExport);
|
|
54
|
+
const allowedServiceIds = new Set(services.map((service) => service.id));
|
|
55
|
+
const deckPlaybooks = deck.playbooks ?? [];
|
|
56
|
+
playbooks = deckPlaybooks.map((playbook) => toBundlePlaybook(playbook, allowedServiceIds));
|
|
57
|
+
decks = [
|
|
58
|
+
{
|
|
59
|
+
id: deck.id,
|
|
60
|
+
name: deck.name,
|
|
61
|
+
...(deck.description ? { description: deck.description } : {}),
|
|
62
|
+
serviceIds: deckServices.map((service) => service.id),
|
|
63
|
+
playbookIds: deckPlaybooks.map((playbook) => playbook.id),
|
|
64
|
+
},
|
|
65
|
+
];
|
|
66
|
+
}
|
|
67
|
+
return shared_1.BundleV1Schema.parse({
|
|
68
|
+
format: 'agent-deck-bundle',
|
|
69
|
+
version: 1,
|
|
70
|
+
exportedAt: new Date().toISOString(),
|
|
71
|
+
exportedFrom: { agentDeckVersion },
|
|
72
|
+
scope: input.scope,
|
|
73
|
+
services,
|
|
74
|
+
playbooks,
|
|
75
|
+
decks,
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=export-bundle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export-bundle.js","sourceRoot":"","sources":["../../src/export-import/export-bundle.ts"],"names":[],"mappings":";;;AA4CA,8CAkEC;AA9GD,+CAO4B;AAE5B,4CAAqD;AACrD,+DAAiE;AAEjE,MAAa,iBAAkB,SAAQ,KAAK;IAC1C,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;IAClC,CAAC;CACF;AALD,8CAKC;AAED,SAAS,gBAAgB,CACvB,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AC,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC;QAEzE,MAAM,aAAa,GAAG,IAAI,CAAC,SAAS,IAAI,EAAE,CAAC;QAC3C,SAAS,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CACzC,gBAAgB,CAAC,QAAQ,EAAE,iBAAiB,CAAC,CAC9C,CAAC;QAEF,KAAK,GAAG;YACN;gBACE,EAAE,EAAE,IAAI,CAAC,EAAE;gBACX,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBAC9D,UAAU,EAAE,YAAY,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;gBACrD,WAAW,EAAE,aAAa,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC;aAC1D;SACF,CAAC;IACJ,CAAC;IAED,OAAO,uBAAc,CAAC,KAAK,CAAC;QAC1B,MAAM,EAAE,mBAAmB;QAC3B,OAAO,EAAE,CAAC;QACV,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACpC,YAAY,EAAE,EAAE,gBAAgB,EAAE;QAClC,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,QAAQ;QACR,SAAS;QACT,KAAK;KACN,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ImportReport } from '@agent-deck/shared';
|
|
2
|
+
import type { DatabaseManager } from '../models/database';
|
|
3
|
+
export declare class ImportBundleError extends Error {
|
|
4
|
+
constructor(message: string);
|
|
5
|
+
}
|
|
6
|
+
export declare function importBundle(db: DatabaseManager, raw: unknown): Promise<ImportReport>;
|
|
7
|
+
export declare function parseBundleJson(text: string): unknown;
|
|
8
|
+
//# sourceMappingURL=import-bundle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"import-bundle.d.ts","sourceRoot":"","sources":["../../src/export-import/import-bundle.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,YAAY,EAIb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAG1D,qBAAa,iBAAkB,SAAQ,KAAK;gBAC9B,OAAO,EAAE,MAAM;CAI5B;AA+LD,wBAAsB,YAAY,CAChC,EAAE,EAAE,eAAe,EACnB,GAAG,EAAE,OAAO,GACX,OAAO,CAAC,YAAY,CAAC,CAgIvB;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAMrD"}
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ImportBundleError = void 0;
|
|
4
|
+
exports.importBundle = importBundle;
|
|
5
|
+
exports.parseBundleJson = parseBundleJson;
|
|
6
|
+
const shared_1 = require("@agent-deck/shared");
|
|
7
|
+
const sanitize_for_export_1 = require("./sanitize-for-export");
|
|
8
|
+
class ImportBundleError extends Error {
|
|
9
|
+
constructor(message) {
|
|
10
|
+
super(message);
|
|
11
|
+
this.name = 'ImportBundleError';
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.ImportBundleError = ImportBundleError;
|
|
15
|
+
function isUniqueConstraintError(error) {
|
|
16
|
+
const code = error && typeof error === 'object' && 'code' in error
|
|
17
|
+
? String(error.code)
|
|
18
|
+
: '';
|
|
19
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
20
|
+
return (code.includes('CONSTRAINT') ||
|
|
21
|
+
message.includes('UNIQUE constraint failed') ||
|
|
22
|
+
message.includes('already exists'));
|
|
23
|
+
}
|
|
24
|
+
function remapServiceDeps(playbookTitle, dependsOnServiceIds, serviceIdMap, warnings) {
|
|
25
|
+
const resolved = [];
|
|
26
|
+
for (const bundleServiceId of dependsOnServiceIds) {
|
|
27
|
+
const mapped = serviceIdMap[bundleServiceId];
|
|
28
|
+
if (mapped) {
|
|
29
|
+
resolved.push(mapped);
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
warnings.push(`Playbook "${playbookTitle}": dropped missing service dependency ${bundleServiceId}`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return resolved;
|
|
36
|
+
}
|
|
37
|
+
async function resolveService(db, service, warnings, servicesNeedingOauth) {
|
|
38
|
+
try {
|
|
39
|
+
const created = await db.createService({
|
|
40
|
+
name: service.name,
|
|
41
|
+
type: service.type,
|
|
42
|
+
url: service.url,
|
|
43
|
+
cardColor: service.cardColor ?? '#92E4DD',
|
|
44
|
+
...(service.description ? { description: service.description } : {}),
|
|
45
|
+
...(service.iconUrl ? { iconUrl: service.iconUrl } : {}),
|
|
46
|
+
...(service.headers ? { headers: service.headers } : {}),
|
|
47
|
+
...(service.oauthClientId ? { oauthClientId: service.oauthClientId } : {}),
|
|
48
|
+
...(service.oauthAuthorizationUrl
|
|
49
|
+
? { oauthAuthorizationUrl: service.oauthAuthorizationUrl }
|
|
50
|
+
: {}),
|
|
51
|
+
...(service.oauthTokenUrl ? { oauthTokenUrl: service.oauthTokenUrl } : {}),
|
|
52
|
+
...(service.oauthRedirectUri
|
|
53
|
+
? { oauthRedirectUri: service.oauthRedirectUri }
|
|
54
|
+
: {}),
|
|
55
|
+
...(service.oauthScope ? { oauthScope: service.oauthScope } : {}),
|
|
56
|
+
...(service.localCommand ? { localCommand: service.localCommand } : {}),
|
|
57
|
+
...(service.localArgs ? { localArgs: service.localArgs } : {}),
|
|
58
|
+
...(service.localWorkingDir
|
|
59
|
+
? { localWorkingDir: service.localWorkingDir }
|
|
60
|
+
: {}),
|
|
61
|
+
});
|
|
62
|
+
if (service.disabledToolNames && service.disabledToolNames.length > 0) {
|
|
63
|
+
await db.updateServiceDisabledTools(created.id, service.disabledToolNames);
|
|
64
|
+
}
|
|
65
|
+
if ((0, sanitize_for_export_1.serviceNeedsOauthReconnect)(service)) {
|
|
66
|
+
servicesNeedingOauth.push(service.name);
|
|
67
|
+
}
|
|
68
|
+
return { targetId: created.id, created: true };
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
if (!isUniqueConstraintError(error)) {
|
|
72
|
+
throw error;
|
|
73
|
+
}
|
|
74
|
+
const existing = (await db.getAllServices()).find((row) => row.name === service.name);
|
|
75
|
+
if (!existing) {
|
|
76
|
+
throw error;
|
|
77
|
+
}
|
|
78
|
+
warnings.push(`Skipped service "${service.name}" (already exists)`);
|
|
79
|
+
return { targetId: existing.id, created: false };
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
async function resolvePlaybook(db, playbook, serviceIdMap, warnings) {
|
|
83
|
+
try {
|
|
84
|
+
const dependsOnServiceIds = remapServiceDeps(playbook.title, playbook.dependsOnServiceIds, serviceIdMap, warnings);
|
|
85
|
+
const created = await db.createPlaybook({
|
|
86
|
+
id: playbook.id,
|
|
87
|
+
title: playbook.title,
|
|
88
|
+
body: playbook.body,
|
|
89
|
+
triggers: playbook.triggers,
|
|
90
|
+
dependsOnCredentialIds: [],
|
|
91
|
+
dependsOnServiceIds,
|
|
92
|
+
exec: playbook.exec,
|
|
93
|
+
skill: playbook.skill,
|
|
94
|
+
});
|
|
95
|
+
return { targetId: created.id, created: true };
|
|
96
|
+
}
|
|
97
|
+
catch (error) {
|
|
98
|
+
if (!isUniqueConstraintError(error)) {
|
|
99
|
+
throw error;
|
|
100
|
+
}
|
|
101
|
+
const byId = await db.getPlaybook(playbook.id);
|
|
102
|
+
const byTitle = byId ??
|
|
103
|
+
(await db.getAllPlaybooks()).find((row) => row.title === playbook.title);
|
|
104
|
+
if (!byTitle) {
|
|
105
|
+
throw error;
|
|
106
|
+
}
|
|
107
|
+
warnings.push(`Skipped playbook "${playbook.title}" (${playbook.id}) (already exists)`);
|
|
108
|
+
return { targetId: byTitle.id, created: false };
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
async function resolveDeck(db, name, description, warnings) {
|
|
112
|
+
try {
|
|
113
|
+
const created = await db.createDeck({
|
|
114
|
+
name,
|
|
115
|
+
...(description ? { description } : {}),
|
|
116
|
+
isActive: false,
|
|
117
|
+
credentials: [],
|
|
118
|
+
playbooks: [],
|
|
119
|
+
});
|
|
120
|
+
return { targetId: created.id, created: true };
|
|
121
|
+
}
|
|
122
|
+
catch (error) {
|
|
123
|
+
if (!isUniqueConstraintError(error)) {
|
|
124
|
+
throw error;
|
|
125
|
+
}
|
|
126
|
+
const existing = (await db.getAllDecks()).find((row) => row.name === name);
|
|
127
|
+
if (!existing) {
|
|
128
|
+
throw error;
|
|
129
|
+
}
|
|
130
|
+
warnings.push(`Skipped deck "${name}" (already exists)`);
|
|
131
|
+
return { targetId: existing.id, created: false };
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
async function linkService(db, deckId, serviceId, position) {
|
|
135
|
+
const existing = await db.getDeckServices(deckId);
|
|
136
|
+
if (existing.some((row) => row.serviceId === serviceId)) {
|
|
137
|
+
return false;
|
|
138
|
+
}
|
|
139
|
+
await db.addServiceToDeck({ deckId, serviceId, position });
|
|
140
|
+
return true;
|
|
141
|
+
}
|
|
142
|
+
async function linkPlaybook(db, deckId, playbookId, position) {
|
|
143
|
+
const existing = await db.getDeckPlaybooks(deckId);
|
|
144
|
+
if (existing.some((row) => row.playbookId === playbookId)) {
|
|
145
|
+
return false;
|
|
146
|
+
}
|
|
147
|
+
await db.addPlaybookToDeck({ deckId, playbookId, position });
|
|
148
|
+
return true;
|
|
149
|
+
}
|
|
150
|
+
async function importBundle(db, raw) {
|
|
151
|
+
const parsed = shared_1.BundleV1Schema.safeParse(raw);
|
|
152
|
+
if (!parsed.success) {
|
|
153
|
+
const message = parsed.error.issues
|
|
154
|
+
.map((issue) => `${issue.path.join('.') || 'bundle'}: ${issue.message}`)
|
|
155
|
+
.join('; ');
|
|
156
|
+
throw new ImportBundleError(`Invalid bundle: ${message}`);
|
|
157
|
+
}
|
|
158
|
+
const bundle = parsed.data;
|
|
159
|
+
const warnings = [];
|
|
160
|
+
const servicesNeedingOauth = [];
|
|
161
|
+
const idMap = {};
|
|
162
|
+
const counts = {
|
|
163
|
+
services: { created: 0, reused: 0 },
|
|
164
|
+
playbooks: { created: 0, reused: 0 },
|
|
165
|
+
decks: { created: 0, reused: 0 },
|
|
166
|
+
};
|
|
167
|
+
try {
|
|
168
|
+
const seenBundleServiceIds = new Set();
|
|
169
|
+
for (const service of bundle.services) {
|
|
170
|
+
if (seenBundleServiceIds.has(service.id)) {
|
|
171
|
+
warnings.push(`Skipped duplicate service id in bundle: ${service.id}`);
|
|
172
|
+
continue;
|
|
173
|
+
}
|
|
174
|
+
seenBundleServiceIds.add(service.id);
|
|
175
|
+
const resolved = await resolveService(db, service, warnings, servicesNeedingOauth);
|
|
176
|
+
idMap[service.id] = resolved.targetId;
|
|
177
|
+
if (resolved.created) {
|
|
178
|
+
counts.services.created += 1;
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
counts.services.reused += 1;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
const seenBundlePlaybookIds = new Set();
|
|
185
|
+
for (const playbook of bundle.playbooks) {
|
|
186
|
+
if (seenBundlePlaybookIds.has(playbook.id)) {
|
|
187
|
+
warnings.push(`Skipped duplicate playbook id in bundle: ${playbook.id}`);
|
|
188
|
+
continue;
|
|
189
|
+
}
|
|
190
|
+
seenBundlePlaybookIds.add(playbook.id);
|
|
191
|
+
const resolved = await resolvePlaybook(db, playbook, idMap, warnings);
|
|
192
|
+
idMap[playbook.id] = resolved.targetId;
|
|
193
|
+
if (resolved.created) {
|
|
194
|
+
counts.playbooks.created += 1;
|
|
195
|
+
}
|
|
196
|
+
else {
|
|
197
|
+
counts.playbooks.reused += 1;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
for (const deck of bundle.decks) {
|
|
201
|
+
const resolved = await resolveDeck(db, deck.name, deck.description, warnings);
|
|
202
|
+
idMap[deck.id] = resolved.targetId;
|
|
203
|
+
if (resolved.created) {
|
|
204
|
+
counts.decks.created += 1;
|
|
205
|
+
}
|
|
206
|
+
else {
|
|
207
|
+
counts.decks.reused += 1;
|
|
208
|
+
}
|
|
209
|
+
const deckId = resolved.targetId;
|
|
210
|
+
const existingServices = await db.getDeckServices(deckId);
|
|
211
|
+
let position = existingServices.length;
|
|
212
|
+
for (const bundleServiceId of deck.serviceIds) {
|
|
213
|
+
const serviceId = idMap[bundleServiceId];
|
|
214
|
+
if (!serviceId) {
|
|
215
|
+
warnings.push(`Deck "${deck.name}": skipped unknown service ${bundleServiceId}`);
|
|
216
|
+
continue;
|
|
217
|
+
}
|
|
218
|
+
const linked = await linkService(db, deckId, serviceId, position);
|
|
219
|
+
if (linked) {
|
|
220
|
+
position += 1;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
const existingPlaybooks = await db.getDeckPlaybooks(deckId);
|
|
224
|
+
position = existingPlaybooks.length;
|
|
225
|
+
for (const bundlePlaybookId of deck.playbookIds) {
|
|
226
|
+
const playbookId = idMap[bundlePlaybookId];
|
|
227
|
+
if (!playbookId) {
|
|
228
|
+
warnings.push(`Deck "${deck.name}": skipped unknown playbook ${bundlePlaybookId}`);
|
|
229
|
+
continue;
|
|
230
|
+
}
|
|
231
|
+
const linked = await linkPlaybook(db, deckId, playbookId, position);
|
|
232
|
+
if (linked) {
|
|
233
|
+
position += 1;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
return shared_1.ImportReportSchema.parse({
|
|
238
|
+
status: 'completed',
|
|
239
|
+
counts,
|
|
240
|
+
servicesNeedingOauth,
|
|
241
|
+
warnings,
|
|
242
|
+
idMap,
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
catch (error) {
|
|
246
|
+
if (error instanceof ImportBundleError) {
|
|
247
|
+
throw error;
|
|
248
|
+
}
|
|
249
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
250
|
+
return shared_1.ImportReportSchema.parse({
|
|
251
|
+
status: 'failed',
|
|
252
|
+
counts,
|
|
253
|
+
servicesNeedingOauth,
|
|
254
|
+
warnings: [...warnings, message],
|
|
255
|
+
idMap,
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
function parseBundleJson(text) {
|
|
260
|
+
try {
|
|
261
|
+
return JSON.parse(text);
|
|
262
|
+
}
|
|
263
|
+
catch {
|
|
264
|
+
throw new ImportBundleError('Bundle is not valid JSON');
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
//# sourceMappingURL=import-bundle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"import-bundle.js","sourceRoot":"","sources":["../../src/export-import/import-bundle.ts"],"names":[],"mappings":";;;AA+MA,oCAmIC;AAED,0CAMC;AA1VD,+CAO4B;AAE5B,+DAAmE;AAEnE,MAAa,iBAAkB,SAAQ,KAAK;IAC1C,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;IAClC,CAAC;CACF;AALD,8CAKC;AAOD,SAAS,uBAAuB,CAAC,KAAc;IAC7C,MAAM,IAAI,GACR,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,IAAI,KAAK;QACnD,CAAC,CAAC,MAAM,CAAE,KAA2B,CAAC,IAAI,CAAC;QAC3C,CAAC,CAAC,EAAE,CAAC;IACT,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACvE,OAAO,CACL,IAAI,CAAC,QAAQ,CAAC,YAAY,CA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H,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAY,CAAC;IACrC,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,iBAAiB,CAAC,0BAA0B,CAAC,CAAC;IAC1D,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { buildExportBundle, ExportBundleError } from './export-bundle';
|
|
2
|
+
export { importBundle, parseBundleJson, ImportBundleError } from './import-bundle';
|
|
3
|
+
export { sanitizeServiceForExport, serviceNeedsOauthReconnect, FORBIDDEN_EXPORT_SERVICE_KEYS, } from './sanitize-for-export';
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/export-import/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACnF,OAAO,EACL,wBAAwB,EACxB,0BAA0B,EAC1B,6BAA6B,GAC9B,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FORBIDDEN_EXPORT_SERVICE_KEYS = exports.serviceNeedsOauthReconnect = exports.sanitizeServiceForExport = exports.ImportBundleError = exports.parseBundleJson = exports.importBundle = exports.ExportBundleError = exports.buildExportBundle = void 0;
|
|
4
|
+
var export_bundle_1 = require("./export-bundle");
|
|
5
|
+
Object.defineProperty(exports, "buildExportBundle", { enumerable: true, get: function () { return export_bundle_1.buildExportBundle; } });
|
|
6
|
+
Object.defineProperty(exports, "ExportBundleError", { enumerable: true, get: function () { return export_bundle_1.ExportBundleError; } });
|
|
7
|
+
var import_bundle_1 = require("./import-bundle");
|
|
8
|
+
Object.defineProperty(exports, "importBundle", { enumerable: true, get: function () { return import_bundle_1.importBundle; } });
|
|
9
|
+
Object.defineProperty(exports, "parseBundleJson", { enumerable: true, get: function () { return import_bundle_1.parseBundleJson; } });
|
|
10
|
+
Object.defineProperty(exports, "ImportBundleError", { enumerable: true, get: function () { return import_bundle_1.ImportBundleError; } });
|
|
11
|
+
var sanitize_for_export_1 = require("./sanitize-for-export");
|
|
12
|
+
Object.defineProperty(exports, "sanitizeServiceForExport", { enumerable: true, get: function () { return sanitize_for_export_1.sanitizeServiceForExport; } });
|
|
13
|
+
Object.defineProperty(exports, "serviceNeedsOauthReconnect", { enumerable: true, get: function () { return sanitize_for_export_1.serviceNeedsOauthReconnect; } });
|
|
14
|
+
Object.defineProperty(exports, "FORBIDDEN_EXPORT_SERVICE_KEYS", { enumerable: true, get: function () { return sanitize_for_export_1.FORBIDDEN_EXPORT_SERVICE_KEYS; } });
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/export-import/index.ts"],"names":[],"mappings":";;;AAAA,iDAAuE;AAA9D,kHAAA,iBAAiB,OAAA;AAAE,kHAAA,iBAAiB,OAAA;AAC7C,iDAAmF;AAA1E,6GAAA,YAAY,OAAA;AAAE,gHAAA,eAAe,OAAA;AAAE,kHAAA,iBAAiB,OAAA;AACzD,6DAI+B;AAH7B,+HAAA,wBAAwB,OAAA;AACxB,iIAAA,0BAA0B,OAAA;AAC1B,oIAAA,6BAA6B,OAAA"}
|