@aui.io/apollo 0.1.53 → 0.1.55
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/README.md +2 -2
- package/node_modules/@aui.io/apollo-cli/dist/src/commands/kb.js +34 -1
- package/node_modules/@aui.io/apollo-cli/dist/src/commands/kb.js.map +1 -1
- package/node_modules/@aui.io/apollo-cli/package.json +3 -3
- package/node_modules/@aui.io/apollo-core/dist/src/api/download.d.ts +9 -0
- package/node_modules/@aui.io/apollo-core/dist/src/api/download.js +52 -0
- package/node_modules/@aui.io/apollo-core/dist/src/api/download.js.map +1 -0
- package/node_modules/@aui.io/apollo-core/dist/src/api/kbm.d.ts +58 -0
- package/node_modules/@aui.io/apollo-core/dist/src/api/kbm.js +10 -0
- package/node_modules/@aui.io/apollo-core/dist/src/api/kbm.js.map +1 -1
- package/node_modules/@aui.io/apollo-core/dist/src/services/knowledge.d.ts +85 -0
- package/node_modules/@aui.io/apollo-core/dist/src/services/knowledge.js +369 -10
- package/node_modules/@aui.io/apollo-core/dist/src/services/knowledge.js.map +1 -1
- package/node_modules/@aui.io/apollo-core/package.json +1 -1
- package/node_modules/@aui.io/apollo-tui/dist/src/actions/registry.js +3 -0
- package/node_modules/@aui.io/apollo-tui/dist/src/actions/registry.js.map +1 -1
- package/node_modules/@aui.io/apollo-tui/dist/src/author/resources.js +8 -0
- package/node_modules/@aui.io/apollo-tui/dist/src/author/resources.js.map +1 -1
- package/node_modules/@aui.io/apollo-tui/dist/src/index.d.ts +10 -0
- package/node_modules/@aui.io/apollo-tui/dist/src/index.js +22 -1
- package/node_modules/@aui.io/apollo-tui/dist/src/index.js.map +1 -1
- package/node_modules/@aui.io/apollo-tui/dist/src/lib/actions.d.ts +2 -0
- package/node_modules/@aui.io/apollo-tui/dist/src/lib/actions.js +63 -1
- package/node_modules/@aui.io/apollo-tui/dist/src/lib/actions.js.map +1 -1
- package/node_modules/@aui.io/apollo-tui/dist/src/lib/commands.d.ts +3 -1
- package/node_modules/@aui.io/apollo-tui/dist/src/lib/commands.js +8 -0
- package/node_modules/@aui.io/apollo-tui/dist/src/lib/commands.js.map +1 -1
- package/node_modules/@aui.io/apollo-tui/package.json +2 -2
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -89,8 +89,8 @@ thread create | list | get | messages | trace
|
|
|
89
89
|
mockdb provision | status | describe | export | keys | wire | delete --force
|
|
90
90
|
| collections … | seed | endpoint … | execute | session … | rotate …
|
|
91
91
|
vault set <NAME> | list | get <NAME> | rm <NAME> --force
|
|
92
|
-
kb list | status <name> | check |
|
|
93
|
-
| delete <name> --force
|
|
92
|
+
kb list | status <name> | check | create <name> | add <hub> <files…>
|
|
93
|
+
| add-url <hub> <urls…> | export <hub> | export --all | delete <name> --force
|
|
94
94
|
```
|
|
95
95
|
|
|
96
96
|
Run `apollo <command> --help` for the live flag list on your installed version.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ValidationError } from "@aui.io/apollo-core/errors/index.js";
|
|
2
|
-
import { addFiles, addUrls, createHub, deleteHub, getHubByName, hubRefCheck, hubStatus, listHubs, programHubRefs, } from "@aui.io/apollo-core/services/knowledge.js";
|
|
2
|
+
import { addFiles, addUrls, createHub, defaultExportRoot, deleteHub, describeHubExport, exportHubs, getHubByName, hubRefCheck, hubStatus, KNOWLEDGE_DATA_DIR, listHubs, programHubRefs, } from "@aui.io/apollo-core/services/knowledge.js";
|
|
3
3
|
function hubLine(hub) {
|
|
4
4
|
return `${hub.name.padEnd(32)} ${hub.id}`;
|
|
5
5
|
}
|
|
@@ -17,6 +17,27 @@ function uploadLines(result) {
|
|
|
17
17
|
`Indexing is asynchronous — \`apollo kb status ${result.hub.name}\` shows the outcome.`,
|
|
18
18
|
].join("\n");
|
|
19
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* Export summary: one line per hub, then per-file failures, then where it
|
|
22
|
+
* all landed. Says "indexed" on purpose — the export is what KBM finished
|
|
23
|
+
* indexing, so anything still processing (or failed) is absent by design.
|
|
24
|
+
*/
|
|
25
|
+
function exportLines(result) {
|
|
26
|
+
if (result.hubs.length === 0)
|
|
27
|
+
return "No knowledge hubs for this agent.";
|
|
28
|
+
const lines = result.hubs.map((hub) => describeHubExport(hub, result.destination));
|
|
29
|
+
for (const hub of result.hubs) {
|
|
30
|
+
for (const failure of hub.failures) {
|
|
31
|
+
lines.push(` ✕ ${hub.hub.name}/${failure.title}: ${failure.error}`);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
if (result.unlisted.length > 0) {
|
|
35
|
+
lines.push(`not exported (visible to the scope but not owned by this agent): ${result.unlisted.join(", ")}`);
|
|
36
|
+
}
|
|
37
|
+
const count = result.hubs.length === 1 ? "1 hub" : `${result.hubs.length} hubs`;
|
|
38
|
+
lines.push(`Exported ${count} to ${result.destination} — indexed content only; \`apollo kb status <name>\` shows pending or failed jobs.`);
|
|
39
|
+
return lines.join("\n");
|
|
40
|
+
}
|
|
20
41
|
export function registerKb(program, runtime) {
|
|
21
42
|
const kb = program
|
|
22
43
|
.command("kb")
|
|
@@ -106,6 +127,18 @@ export function registerKb(program, runtime) {
|
|
|
106
127
|
return lines.join("\n");
|
|
107
128
|
});
|
|
108
129
|
});
|
|
130
|
+
kb.command("export [name]")
|
|
131
|
+
.description(`Download a hub's indexed content and original files into ${KNOWLEDGE_DATA_DIR}/<hub>/ — a sibling of bundle/, never part of push`)
|
|
132
|
+
.option("--all", "export every hub of the agent")
|
|
133
|
+
.action(async (name, options) => {
|
|
134
|
+
const run = runtime();
|
|
135
|
+
const result = await exportHubs(run.context, {
|
|
136
|
+
...(name === undefined ? {} : { hub: name }),
|
|
137
|
+
...(options.all === true ? { all: true } : {}),
|
|
138
|
+
destination: defaultExportRoot(run.context.agentRoot),
|
|
139
|
+
}, { onProgress: (message) => run.output.progress(message) });
|
|
140
|
+
run.output.result(result, () => exportLines(result));
|
|
141
|
+
});
|
|
109
142
|
kb.command("delete <name>")
|
|
110
143
|
.description("Permanently delete a hub and all its resources")
|
|
111
144
|
.option("--force", "required confirmation flag")
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kb.js","sourceRoot":"","sources":["../../../src/commands/kb.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAEtE,OAAO,EACL,QAAQ,EACR,OAAO,EACP,SAAS,EACT,SAAS,EACT,YAAY,EACZ,WAAW,EACX,SAAS,EACT,QAAQ,EACR,cAAc,
|
|
1
|
+
{"version":3,"file":"kb.js","sourceRoot":"","sources":["../../../src/commands/kb.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAEtE,OAAO,EACL,QAAQ,EACR,OAAO,EACP,SAAS,EACT,iBAAiB,EACjB,SAAS,EACT,iBAAiB,EACjB,UAAU,EACV,YAAY,EACZ,WAAW,EACX,SAAS,EACT,kBAAkB,EAClB,QAAQ,EACR,cAAc,GAGf,MAAM,2CAA2C,CAAC;AAGnD,SAAS,OAAO,CAAC,GAAkB;IACjC,OAAO,GAAG,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,GAAG,CAAC,EAAE,EAAE,CAAC;AAC5C,CAAC;AAED;;;GAGG;AACH,SAAS,WAAW,CAAC,MAAuB;IAC1C,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO;SAC3B,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,KAAK,SAAS,CAAC;SAC1C,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,KAAK,IAAI,QAAQ,EAAE,CAAC,CAAC;IAChE,OAAO;QACL,GAAG,MAAM,CAAC,GAAG,CAAC,IAAI,KAAK,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,YAC5C,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAA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EAAE,GAAG,CAAC,EAAE,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,EAAE,GAAG,EAAE,CAAC,OAAO,GAAG,CAAC,IAAI,WAAW,CAAC,CAAC;IACtF,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aui.io/apollo-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.55",
|
|
4
4
|
"description": "Command-line client for the Apollo runtime",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -33,12 +33,12 @@
|
|
|
33
33
|
"test": "vitest run"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@aui.io/apollo-core": "0.1.
|
|
36
|
+
"@aui.io/apollo-core": "0.1.55",
|
|
37
37
|
"commander": "^14.0.3",
|
|
38
38
|
"picocolors": "^1.1.1"
|
|
39
39
|
},
|
|
40
40
|
"optionalDependencies": {
|
|
41
|
-
"@aui.io/apollo-tui": "0.1.
|
|
41
|
+
"@aui.io/apollo-tui": "0.1.55"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@eslint/js": "^9.39.5",
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface DownloadOptions {
|
|
2
|
+
fetch?: typeof globalThis.fetch;
|
|
3
|
+
/** Per-download ceiling; binaries can be large, so this floors well above the API default. */
|
|
4
|
+
timeoutMs?: number;
|
|
5
|
+
}
|
|
6
|
+
/** The URL without its query string — signatures must not reach logs or error text. */
|
|
7
|
+
export declare function describeUrl(url: string): string;
|
|
8
|
+
export declare function downloadBytes(url: string, options?: DownloadOptions): Promise<Uint8Array>;
|
|
9
|
+
export declare function downloadText(url: string, options?: DownloadOptions): Promise<string>;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plain GETs against presigned links — GCS signed URLs and KBM's tokenized
|
|
3
|
+
* `/knowledge-bases/view/…` redirects. Deliberately NOT the Transport: these
|
|
4
|
+
* URLs carry their own credential in the query string, so a bearer header
|
|
5
|
+
* would either be rejected by the bucket or hand the session token to a
|
|
6
|
+
* third party. No auth, no service base URL, redirects followed, bytes back.
|
|
7
|
+
*/
|
|
8
|
+
import { CliError } from "../errors/index.js";
|
|
9
|
+
const DEFAULT_TIMEOUT_MS = 120_000;
|
|
10
|
+
/** The URL without its query string — signatures must not reach logs or error text. */
|
|
11
|
+
export function describeUrl(url) {
|
|
12
|
+
try {
|
|
13
|
+
const parsed = new URL(url);
|
|
14
|
+
return `${parsed.origin}${parsed.pathname}`;
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
return url.split("?")[0] ?? url;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export async function downloadBytes(url, options = {}) {
|
|
21
|
+
const fetchImpl = options.fetch ?? globalThis.fetch;
|
|
22
|
+
const timeoutMs = Math.max(options.timeoutMs ?? 0, DEFAULT_TIMEOUT_MS);
|
|
23
|
+
const controller = new AbortController();
|
|
24
|
+
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
25
|
+
try {
|
|
26
|
+
const response = await fetchImpl(url, {
|
|
27
|
+
method: "GET",
|
|
28
|
+
redirect: "follow",
|
|
29
|
+
signal: controller.signal,
|
|
30
|
+
});
|
|
31
|
+
if (!response.ok) {
|
|
32
|
+
throw new CliError(`Download failed (${response.status}) for ${describeUrl(url)}.`, {
|
|
33
|
+
code: "DOWNLOAD_FAILED",
|
|
34
|
+
suggestion: "Signed links expire about an hour after the export starts — re-run the command.",
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
return new Uint8Array(await response.arrayBuffer());
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
if (controller.signal.aborted) {
|
|
41
|
+
throw new CliError(`Download timed out after ${timeoutMs}ms for ${describeUrl(url)}.`, { code: "REQUEST_TIMEOUT", cause: error });
|
|
42
|
+
}
|
|
43
|
+
throw error;
|
|
44
|
+
}
|
|
45
|
+
finally {
|
|
46
|
+
clearTimeout(timer);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
export async function downloadText(url, options = {}) {
|
|
50
|
+
return new TextDecoder().decode(await downloadBytes(url, options));
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=download.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"download.js","sourceRoot":"","sources":["../../../src/api/download.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAQ9C,MAAM,kBAAkB,GAAG,OAAO,CAAC;AAEnC,uFAAuF;AACvF,MAAM,UAAU,WAAW,CAAC,GAAW;IACrC,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;QAC5B,OAAO,GAAG,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC;IAC9C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC;IAClC,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,GAAW,EACX,UAA2B,EAAE;IAE7B,MAAM,SAAS,GAAG,OAAO,CAAC,KAAK,IAAI,UAAU,CAAC,KAAK,CAAC;IACpD,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,SAAS,IAAI,CAAC,EAAE,kBAAkB,CAAC,CAAC;IACvE,MAAM,UAAU,GAAG,IAAI,eAAe,EAAE,CAAC;IACzC,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,EAAE,SAAS,CAAC,CAAC;IAC9D,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,SAAS,CAAC,GAAG,EAAE;YACpC,MAAM,EAAE,KAAK;YACb,QAAQ,EAAE,QAAQ;YAClB,MAAM,EAAE,UAAU,CAAC,MAAM;SAC1B,CAAC,CAAC;QACH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,MAAM,IAAI,QAAQ,CAChB,oBAAoB,QAAQ,CAAC,MAAM,SAAS,WAAW,CAAC,GAAG,CAAC,GAAG,EAC/D;gBACE,IAAI,EAAE,iBAAiB;gBACvB,UAAU,EACR,iFAAiF;aACpF,CACF,CAAC;QACJ,CAAC;QACD,OAAO,IAAI,UAAU,CAAC,MAAM,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAC;IACtD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,UAAU,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YAC9B,MAAM,IAAI,QAAQ,CAChB,4BAA4B,SAAS,UAAU,WAAW,CAAC,GAAG,CAAC,GAAG,EAClE,EAAE,IAAI,EAAE,iBAAiB,EAAE,KAAK,EAAE,KAAK,EAAE,CAC1C,CAAC;QACJ,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC;YAAS,CAAC;QACT,YAAY,CAAC,KAAK,CAAC,CAAC;IACtB,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,GAAW,EACX,UAA2B,EAAE;IAE7B,OAAO,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,MAAM,aAAa,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC;AACrE,CAAC"}
|
|
@@ -64,6 +64,56 @@ export interface UploadFilePart {
|
|
|
64
64
|
content: Uint8Array | string;
|
|
65
65
|
contentType?: string;
|
|
66
66
|
}
|
|
67
|
+
/**
|
|
68
|
+
* `/knowledge-bases/view/export` acceptance. Only a pointer: the manifest
|
|
69
|
+
* itself sits behind `json_url`, a presigned link. Everything the export
|
|
70
|
+
* hands out expires at `expires_at` (~1h) — download in the same run.
|
|
71
|
+
*/
|
|
72
|
+
export interface ViewExportResponse {
|
|
73
|
+
json_url: string;
|
|
74
|
+
expires_at: string;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* One indexed FILE / single_resource inside the export manifest.
|
|
78
|
+
* `download_url` is the extracted body (assembled markdown, or a JSON rows
|
|
79
|
+
* array for tabular sources); `original_download_url` is the uploaded
|
|
80
|
+
* binary and is only set for file resources whose original still exists.
|
|
81
|
+
*/
|
|
82
|
+
export interface ViewExportFile {
|
|
83
|
+
title: string;
|
|
84
|
+
/** "file" | "single_resource" | "website" */
|
|
85
|
+
source: string;
|
|
86
|
+
url?: string | null;
|
|
87
|
+
download_url?: string | null;
|
|
88
|
+
original_download_url?: string | null;
|
|
89
|
+
created_at?: string | null;
|
|
90
|
+
updated_at?: string | null;
|
|
91
|
+
created_by?: string | null;
|
|
92
|
+
}
|
|
93
|
+
/** One scraped website inside the export manifest — the URL is its identity. */
|
|
94
|
+
export interface ViewExportWebsite {
|
|
95
|
+
url: string;
|
|
96
|
+
title?: string | null;
|
|
97
|
+
download_url?: string | null;
|
|
98
|
+
created_at?: string | null;
|
|
99
|
+
updated_at?: string | null;
|
|
100
|
+
created_by?: string | null;
|
|
101
|
+
}
|
|
102
|
+
export interface ViewExportKnowledgeBase {
|
|
103
|
+
name: string;
|
|
104
|
+
description?: string | null;
|
|
105
|
+
settings?: Record<string, unknown> | null;
|
|
106
|
+
tabular_files?: ViewExportFile[];
|
|
107
|
+
markdown_files?: ViewExportFile[];
|
|
108
|
+
websites?: ViewExportWebsite[];
|
|
109
|
+
created_at?: string | null;
|
|
110
|
+
updated_at?: string | null;
|
|
111
|
+
created_by?: string | null;
|
|
112
|
+
}
|
|
113
|
+
/** The JSON behind `ViewExportResponse.json_url`. */
|
|
114
|
+
export interface ViewExportManifest {
|
|
115
|
+
knowledge_bases: ViewExportKnowledgeBase[];
|
|
116
|
+
}
|
|
67
117
|
export declare class KbmClient {
|
|
68
118
|
private readonly http;
|
|
69
119
|
constructor(http: HttpClient);
|
|
@@ -71,6 +121,14 @@ export declare class KbmClient {
|
|
|
71
121
|
listKnowledgeBases(agentId: string): Promise<KnowledgeBase[]>;
|
|
72
122
|
/** Latest indexing jobs for one hub (newest page only). */
|
|
73
123
|
indexingJobs(kbId: string): Promise<IndexingJob[]>;
|
|
124
|
+
/**
|
|
125
|
+
* Start a view export of every hub in the agent's scope (`agent_id`
|
|
126
|
+
* resolves the scope server-side, like the list). Read-only: KBM writes
|
|
127
|
+
* the manifest to storage and answers with a presigned pointer to it.
|
|
128
|
+
* Only INDEXED resources appear — pending and failed ones don't, so
|
|
129
|
+
* `indexingJobs` stays the place to learn about those.
|
|
130
|
+
*/
|
|
131
|
+
exportView(agentId: string): Promise<ViewExportResponse>;
|
|
74
132
|
/** Delete a whole hub (its resources included) — irreversible. */
|
|
75
133
|
deleteKnowledgeBase(kbId: string): Promise<void>;
|
|
76
134
|
/**
|
|
@@ -29,6 +29,16 @@ export class KbmClient {
|
|
|
29
29
|
const result = await this.http.request(`/v1/indexing-jobs/knowledge-base/${encodeURIComponent(kbId)}`, { query: { page: 1, size: PAGE_SIZE } });
|
|
30
30
|
return Array.isArray(result) ? result : result.items;
|
|
31
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Start a view export of every hub in the agent's scope (`agent_id`
|
|
34
|
+
* resolves the scope server-side, like the list). Read-only: KBM writes
|
|
35
|
+
* the manifest to storage and answers with a presigned pointer to it.
|
|
36
|
+
* Only INDEXED resources appear — pending and failed ones don't, so
|
|
37
|
+
* `indexingJobs` stays the place to learn about those.
|
|
38
|
+
*/
|
|
39
|
+
async exportView(agentId) {
|
|
40
|
+
return this.http.request("/v1/knowledge-bases/view/export", { query: { agent_id: agentId } });
|
|
41
|
+
}
|
|
32
42
|
/** Delete a whole hub (its resources included) — irreversible. */
|
|
33
43
|
async deleteKnowledgeBase(kbId) {
|
|
34
44
|
await this.http.request(`/v1/knowledge-bases/${encodeURIComponent(kbId)}`, { method: "DELETE" });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kbm.js","sourceRoot":"","sources":["../../../src/api/kbm.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"kbm.js","sourceRoot":"","sources":["../../../src/api/kbm.ts"],"names":[],"mappings":"AAyIA,MAAM,SAAS,GAAG,EAAE,CAAC;AACrB,MAAM,SAAS,GAAG,EAAE,CAAC;AAErB,MAAM,OAAO,SAAS;IACgB;IAApC,YAAoC,IAAgB;QAAhB,SAAI,GAAJ,IAAI,CAAY;IAAG,CAAC;IAExD,wEAAwE;IACjE,KAAK,CAAC,kBAAkB,CAAC,OAAe;QAC7C,MAAM,GAAG,GAAoB,EAAE,CAAC;QAChC,KAAK,IAAI,IAAI,GAAG,CAAC,EAAE,IAAI,IAAI,SAAS,EAAE,IAAI,IAAI,CAAC,EAAE,CAAC;YAChD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CACpC,qBAAqB,EACrB;gBACE,KAAK,EAAE;oBACL,QAAQ,EAAE,OAAO;oBACjB,IAAI;oBACJ,IAAI,EAAE,SAAS;iBAChB;aACF,CACF,CAAC;YACF,4DAA4D;YAC5D,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;YAC5D,GAAG,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,CAAC;YACnB,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,GAAG,CAAC,MAAM,IAAI,MAAM,CAAC,KAAK;gBAAE,MAAM;QACjE,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;IAED,2DAA2D;IACpD,KAAK,CAAC,YAAY,CAAC,IAAY;QACpC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CACpC,oCAAoC,kBAAkB,CAAC,IAAI,CAAC,EAAE,EAC9D,EA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UAAU,EAAE,KAAK,CAAC,SAAS;aAC5B;SACF,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -71,3 +71,88 @@ export declare function hubRefCheck(refs: string[], hubs: KnowledgeBase[]): {
|
|
|
71
71
|
missing: string[];
|
|
72
72
|
unreferenced: string[];
|
|
73
73
|
};
|
|
74
|
+
/** The export root, relative to the checkout. */
|
|
75
|
+
export declare const KNOWLEDGE_DATA_DIR = "knowledge-data";
|
|
76
|
+
/** Where exports go: `<checkout>/knowledge-data` (cwd-relative outside a checkout). */
|
|
77
|
+
export declare function defaultExportRoot(agentRoot: string | undefined): string;
|
|
78
|
+
/**
|
|
79
|
+
* Hub content is platform data, not program source — it must never land
|
|
80
|
+
* where a push could pick it up. An invariant on the service, not a CLI
|
|
81
|
+
* nicety: every caller gets it.
|
|
82
|
+
*/
|
|
83
|
+
export declare function assertOutsideBundle(destination: string, agentRoot: string | undefined): void;
|
|
84
|
+
/** One indexed resource as written to disk. Paths are relative to the hub directory. */
|
|
85
|
+
export interface ExportedResource {
|
|
86
|
+
kind: "markdown" | "tabular" | "website";
|
|
87
|
+
title: string;
|
|
88
|
+
/** KBM origin type: "file" | "single_resource" | "website". */
|
|
89
|
+
source: string;
|
|
90
|
+
url: string | null;
|
|
91
|
+
/** The extracted body — `.md`, or a `.json` rows array for tabular sources. */
|
|
92
|
+
content: string | null;
|
|
93
|
+
/** The original upload (files only; null when KBM no longer holds the binary). */
|
|
94
|
+
original: string | null;
|
|
95
|
+
created_at: string | null;
|
|
96
|
+
updated_at: string | null;
|
|
97
|
+
created_by: string | null;
|
|
98
|
+
}
|
|
99
|
+
/** `manifest.json` in each hub directory — the CLI's own shape, never the wire's (no signed URLs). */
|
|
100
|
+
export interface ExportManifest {
|
|
101
|
+
format: "apollo-knowledge-export/1";
|
|
102
|
+
exported_at: string;
|
|
103
|
+
agent_id: string;
|
|
104
|
+
hub: {
|
|
105
|
+
id: string | null;
|
|
106
|
+
name: string;
|
|
107
|
+
description: string | null;
|
|
108
|
+
settings: Record<string, unknown> | null;
|
|
109
|
+
};
|
|
110
|
+
resources: ExportedResource[];
|
|
111
|
+
}
|
|
112
|
+
export interface HubExport {
|
|
113
|
+
hub: {
|
|
114
|
+
id: string | null;
|
|
115
|
+
name: string;
|
|
116
|
+
};
|
|
117
|
+
/** Absolute path of the hub directory. */
|
|
118
|
+
dir: string;
|
|
119
|
+
resources: ExportedResource[];
|
|
120
|
+
/** Original binaries actually written. */
|
|
121
|
+
originals: number;
|
|
122
|
+
/** Downloads that failed — the rest of the export still lands; nothing is silent. */
|
|
123
|
+
failures: {
|
|
124
|
+
title: string;
|
|
125
|
+
error: string;
|
|
126
|
+
}[];
|
|
127
|
+
}
|
|
128
|
+
export interface HubExportResult {
|
|
129
|
+
/** Absolute export root. */
|
|
130
|
+
destination: string;
|
|
131
|
+
/** When the signed links KBM handed out stop working; null when nothing was exported. */
|
|
132
|
+
expires_at: string | null;
|
|
133
|
+
hubs: HubExport[];
|
|
134
|
+
/** Hubs KBM exported for this scope that `kb list` does not own — left on the server, reported here. */
|
|
135
|
+
unlisted: string[];
|
|
136
|
+
}
|
|
137
|
+
export interface ExportHubsParams {
|
|
138
|
+
/** One hub by name — mutually exclusive with `all`. */
|
|
139
|
+
hub?: string;
|
|
140
|
+
all?: boolean;
|
|
141
|
+
/** Export root — `defaultExportRoot(...)` for the CLI; must not be inside `bundle/`. */
|
|
142
|
+
destination: string;
|
|
143
|
+
}
|
|
144
|
+
export interface ExportHubsOptions extends KnowledgeServiceOptions {
|
|
145
|
+
/** A notice as each hub's downloads start — human-mode progress on stderr. */
|
|
146
|
+
onProgress?: (message: string) => void;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Snapshot one hub (or every hub) into `<destination>/<hub>/`:
|
|
150
|
+
* `manifest.json`, `content/` (extracted markdown / tabular JSON) and
|
|
151
|
+
* `originals/` (the uploaded binaries). Only INDEXED resources exist in
|
|
152
|
+
* KBM's export — `hubStatus` is where pending/failed jobs show. Per-file
|
|
153
|
+
* download failures are collected, not thrown; the hub's stale files from a
|
|
154
|
+
* previous export are removed so the directory reflects this run.
|
|
155
|
+
*/
|
|
156
|
+
export declare function exportHubs(context: Context, params: ExportHubsParams, options?: ExportHubsOptions): Promise<HubExportResult>;
|
|
157
|
+
/** One human line per hub — shared by progress and the CLI renderer. */
|
|
158
|
+
export declare function describeHubExport(result: HubExport, destination: string): string;
|