@aui.io/apollo 0.1.18 → 0.1.20
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/node_modules/@aui.io/apollo-cli/dist/src/commands/kb.js +49 -4
- 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/kbm.d.ts +78 -3
- package/node_modules/@aui.io/apollo-core/dist/src/api/kbm.js +69 -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/index.d.ts +2 -2
- package/node_modules/@aui.io/apollo-core/dist/src/index.js +1 -1
- package/node_modules/@aui.io/apollo-core/dist/src/index.js.map +1 -1
- package/node_modules/@aui.io/apollo-core/dist/src/services/knowledge.d.ts +37 -0
- package/node_modules/@aui.io/apollo-core/dist/src/services/knowledge.js +114 -3
- 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 +9 -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 +29 -1
- package/node_modules/@aui.io/apollo-tui/dist/src/author/resources.js.map +1 -1
- package/node_modules/@aui.io/apollo-tui/dist/src/lib/actions.js +53 -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.js +60 -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
|
@@ -1,12 +1,26 @@
|
|
|
1
1
|
import { ValidationError } from "@aui.io/apollo-core/errors/index.js";
|
|
2
|
-
import { deleteHub, getHubByName, hubRefCheck, hubStatus, listHubs, programHubRefs, } from "@aui.io/apollo-core/services/knowledge.js";
|
|
2
|
+
import { addFiles, addUrls, createHub, deleteHub, getHubByName, hubRefCheck, hubStatus, 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
|
}
|
|
6
|
+
/**
|
|
7
|
+
* Bulk acceptance rendered honestly: accepted means RECEIVED — indexing
|
|
8
|
+
* runs async, so point at `kb status` for the real outcome.
|
|
9
|
+
*/
|
|
10
|
+
function uploadLines(result) {
|
|
11
|
+
const failing = result.results
|
|
12
|
+
.filter((item) => item.error !== undefined)
|
|
13
|
+
.map((item) => ` ✕ ${item.name}: ${item.error ?? "failed"}`);
|
|
14
|
+
return [
|
|
15
|
+
`${result.hub.name}: ${String(result.accepted)} accepted${result.failed > 0 ? `, ${String(result.failed)} failed` : ""}.`,
|
|
16
|
+
...failing,
|
|
17
|
+
`Indexing is asynchronous — \`apollo kb status ${result.hub.name}\` shows the outcome.`,
|
|
18
|
+
].join("\n");
|
|
19
|
+
}
|
|
6
20
|
export function registerKb(program, runtime) {
|
|
7
21
|
const kb = program
|
|
8
22
|
.command("kb")
|
|
9
|
-
.description("
|
|
23
|
+
.description("The agent's knowledge hubs — the corpora `hub:` sources search at runtime");
|
|
10
24
|
kb.command("list")
|
|
11
25
|
.description("List knowledge hubs owned by the agent")
|
|
12
26
|
.action(async () => {
|
|
@@ -35,8 +49,39 @@ export function registerKb(program, runtime) {
|
|
|
35
49
|
].join("\n");
|
|
36
50
|
});
|
|
37
51
|
});
|
|
52
|
+
kb.command("create <name>")
|
|
53
|
+
.description("Create an empty hub in the agent's scope; reference it as `hub: <name>` in sources")
|
|
54
|
+
.option("--description <text>", "what the hub holds")
|
|
55
|
+
.action(async (name, options) => {
|
|
56
|
+
const run = runtime();
|
|
57
|
+
const hub = await createHub(run.context, {
|
|
58
|
+
name,
|
|
59
|
+
...(options.description === undefined
|
|
60
|
+
? {}
|
|
61
|
+
: { description: options.description }),
|
|
62
|
+
});
|
|
63
|
+
run.output.result(hub, () => [
|
|
64
|
+
`Hub ${hub.name} created (${hub.id}).`,
|
|
65
|
+
`Upload content with \`apollo kb add ${hub.name} <files…>\`;`,
|
|
66
|
+
`programs reference it as \`hub: ${hub.name}\`.`,
|
|
67
|
+
].join("\n"));
|
|
68
|
+
});
|
|
69
|
+
kb.command("add <hub> <files...>")
|
|
70
|
+
.description("Upload documents into an existing hub (resolved by name); indexing runs async — check `kb status`")
|
|
71
|
+
.action(async (hub, files) => {
|
|
72
|
+
const run = runtime();
|
|
73
|
+
const result = await addFiles(run.context, { hub, paths: files });
|
|
74
|
+
run.output.result(result, () => uploadLines(result));
|
|
75
|
+
});
|
|
76
|
+
kb.command("add-url <hub> <urls...>")
|
|
77
|
+
.description("Scrape web pages into an existing hub; indexing runs async — check `kb status`")
|
|
78
|
+
.action(async (hub, urls) => {
|
|
79
|
+
const run = runtime();
|
|
80
|
+
const result = await addUrls(run.context, { hub, urls });
|
|
81
|
+
run.output.result(result, () => uploadLines(result));
|
|
82
|
+
});
|
|
38
83
|
kb.command("check")
|
|
39
|
-
.description("Cross-check program hub: references against remote hubs")
|
|
84
|
+
.description("Cross-check the program's hub: references against the agent's remote hubs — run after editing sources, before push")
|
|
40
85
|
.action(async () => {
|
|
41
86
|
const run = runtime();
|
|
42
87
|
const root = run.context.agentRoot ?? process.cwd();
|
|
@@ -50,7 +95,7 @@ export function registerKb(program, runtime) {
|
|
|
50
95
|
`program references: ${refs.length === 0 ? "none" : refs.join(", ")}`,
|
|
51
96
|
];
|
|
52
97
|
if (check.missing.length > 0) {
|
|
53
|
-
lines.push(`missing remotely (retrieval will be empty): ${check.missing.join(", ")}`);
|
|
98
|
+
lines.push(`missing remotely (retrieval will be empty): ${check.missing.join(", ")}`, ` fix: \`apollo kb create <name>\` then \`kb add\`, or correct the hub: ref`);
|
|
54
99
|
}
|
|
55
100
|
if (check.unreferenced.length > 0) {
|
|
56
101
|
lines.push(`unreferenced hubs: ${check.unreferenced.join(", ")}`);
|
|
@@ -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,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,SAAS,EACT,YAAY,EACZ,WAAW,EACX,SAAS,EACT,QAAQ,EACR,cAAc,GAEf,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,CAAC,KAAK,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,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AC,gDAAgD,CAAC;SAC7D,MAAM,CAAC,SAAS,EAAE,4BAA4B,CAAC;SAC/C,MAAM,CAAC,KAAK,EAAE,IAAY,EAAE,OAA4B,EAAE,EAAE;QAC3D,IAAI,OAAO,CAAC,KAAK,KAAK,IAAI,EAAE,CAAC;YAC3B,MAAM,IAAI,eAAe,CAAC,qCAAqC,CAAC,CAAC;QACnE,CAAC;QACD,MAAM,GAAG,GAAG,OAAO,EAAE,CAAC;QACtB,MAAM,GAAG,GAAG,MAAM,YAAY,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAClD,MAAM,SAAS,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;QAClC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,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.20",
|
|
4
4
|
"description": "Command-line client for the Apollo runtime",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -28,12 +28,12 @@
|
|
|
28
28
|
"test": "vitest run"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@aui.io/apollo-core": "0.1.
|
|
31
|
+
"@aui.io/apollo-core": "0.1.20",
|
|
32
32
|
"commander": "^14.0.3",
|
|
33
33
|
"picocolors": "^1.1.1"
|
|
34
34
|
},
|
|
35
35
|
"optionalDependencies": {
|
|
36
|
-
"@aui.io/apollo-tui": "0.1.
|
|
36
|
+
"@aui.io/apollo-tui": "0.1.20"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@eslint/js": "^9.39.5",
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Knowledge-base-manager client — knowledge hubs (the program's
|
|
3
|
-
* `kind: knowledge` sources resolve against these)
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
* `kind: knowledge` sources resolve against these), their indexing jobs,
|
|
4
|
+
* hub creation, and content writes (bulk file upload / website scrape).
|
|
5
|
+
* Creation is agent-scoped (`agent_id` on the create body — KBM stamps
|
|
6
|
+
* the agent's own scope; no scope object from us). Content writes still
|
|
7
|
+
* target an EXISTING hub by id — v1's name-based create-on-upload is the
|
|
8
|
+
* failure class the console dropped (DESIGN §4.7); creating is explicit.
|
|
6
9
|
*/
|
|
7
10
|
import type { HttpClient } from "./client-types.js";
|
|
8
11
|
/**
|
|
@@ -24,6 +27,40 @@ export interface IndexingJob {
|
|
|
24
27
|
error_message: string | null;
|
|
25
28
|
updated_at: string;
|
|
26
29
|
}
|
|
30
|
+
/** One file/URL's acceptance outcome inside a bulk response. */
|
|
31
|
+
export interface BulkResourceResult {
|
|
32
|
+
resource_id?: string;
|
|
33
|
+
resource_name: string;
|
|
34
|
+
status: string;
|
|
35
|
+
error?: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Bulk acceptance envelope — `files_accepted`/`urls_accepted` mean the
|
|
39
|
+
* upload was RECEIVED; indexing runs async afterwards (indexingJobs tells
|
|
40
|
+
* the real outcome).
|
|
41
|
+
*/
|
|
42
|
+
export interface BulkFilesResponse {
|
|
43
|
+
knowledge_base_id: string;
|
|
44
|
+
knowledge_base_name: string;
|
|
45
|
+
results: BulkResourceResult[];
|
|
46
|
+
total_files: number;
|
|
47
|
+
files_accepted: number;
|
|
48
|
+
files_failed: number;
|
|
49
|
+
}
|
|
50
|
+
export interface BulkWebsitesResponse {
|
|
51
|
+
knowledge_base_id: string;
|
|
52
|
+
knowledge_base_name: string;
|
|
53
|
+
results: BulkResourceResult[];
|
|
54
|
+
total_urls: number;
|
|
55
|
+
urls_accepted: number;
|
|
56
|
+
urls_failed: number;
|
|
57
|
+
}
|
|
58
|
+
/** One local file to upload. */
|
|
59
|
+
export interface UploadFilePart {
|
|
60
|
+
filename: string;
|
|
61
|
+
content: Uint8Array | string;
|
|
62
|
+
contentType?: string;
|
|
63
|
+
}
|
|
27
64
|
export declare class KbmClient {
|
|
28
65
|
private readonly http;
|
|
29
66
|
constructor(http: HttpClient);
|
|
@@ -33,4 +70,42 @@ export declare class KbmClient {
|
|
|
33
70
|
indexingJobs(kbId: string): Promise<IndexingJob[]>;
|
|
34
71
|
/** Delete a whole hub (its resources included) — irreversible. */
|
|
35
72
|
deleteKnowledgeBase(kbId: string): Promise<void>;
|
|
73
|
+
/**
|
|
74
|
+
* Create a hub in the agent's own scope — `agent_id` makes KBM stamp
|
|
75
|
+
* the scope server-side (404 on an unknown agent), so no scope object
|
|
76
|
+
* rides the request and the hub's name resolves for this agent at
|
|
77
|
+
* runtime.
|
|
78
|
+
*/
|
|
79
|
+
createKnowledgeBase(input: {
|
|
80
|
+
name: string;
|
|
81
|
+
agentId: string;
|
|
82
|
+
createdBy: string;
|
|
83
|
+
description?: string;
|
|
84
|
+
}): Promise<KnowledgeBase>;
|
|
85
|
+
/**
|
|
86
|
+
* Upload documents into an existing hub (multipart). The hub is
|
|
87
|
+
* addressed by id only — none of the legacy scope fields
|
|
88
|
+
* (network/account/seed) are sent; they are nullable on the wire and
|
|
89
|
+
* meaningless when the target hub already exists.
|
|
90
|
+
*/
|
|
91
|
+
uploadFiles(input: {
|
|
92
|
+
knowledgeBaseId: string;
|
|
93
|
+
createdBy: string;
|
|
94
|
+
files: UploadFilePart[];
|
|
95
|
+
}): Promise<BulkFilesResponse>;
|
|
96
|
+
/**
|
|
97
|
+
* Scrape URLs into an existing hub. `scope` is required by the schema
|
|
98
|
+
* but has no required properties (type defaults to GLOBAL) — for an
|
|
99
|
+
* existing hub it is inert, so an empty object goes on the wire instead
|
|
100
|
+
* of the legacy network/account scope.
|
|
101
|
+
*/
|
|
102
|
+
uploadWebsites(input: {
|
|
103
|
+
knowledgeBaseId: string;
|
|
104
|
+
createdBy: string;
|
|
105
|
+
urls: {
|
|
106
|
+
url: string;
|
|
107
|
+
resourceName?: string;
|
|
108
|
+
description?: string;
|
|
109
|
+
}[];
|
|
110
|
+
}): Promise<BulkWebsitesResponse>;
|
|
36
111
|
}
|
|
@@ -33,5 +33,74 @@ export class KbmClient {
|
|
|
33
33
|
async deleteKnowledgeBase(kbId) {
|
|
34
34
|
await this.http.request(`/v1/knowledge-bases/${encodeURIComponent(kbId)}`, { method: "DELETE" });
|
|
35
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* Create a hub in the agent's own scope — `agent_id` makes KBM stamp
|
|
38
|
+
* the scope server-side (404 on an unknown agent), so no scope object
|
|
39
|
+
* rides the request and the hub's name resolves for this agent at
|
|
40
|
+
* runtime.
|
|
41
|
+
*/
|
|
42
|
+
async createKnowledgeBase(input) {
|
|
43
|
+
return this.http.request("/v1/knowledge-bases", {
|
|
44
|
+
method: "POST",
|
|
45
|
+
body: {
|
|
46
|
+
name: input.name,
|
|
47
|
+
agent_id: input.agentId,
|
|
48
|
+
created_by: input.createdBy,
|
|
49
|
+
...(input.description === undefined
|
|
50
|
+
? {}
|
|
51
|
+
: { description: input.description }),
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Upload documents into an existing hub (multipart). The hub is
|
|
57
|
+
* addressed by id only — none of the legacy scope fields
|
|
58
|
+
* (network/account/seed) are sent; they are nullable on the wire and
|
|
59
|
+
* meaningless when the target hub already exists.
|
|
60
|
+
*/
|
|
61
|
+
async uploadFiles(input) {
|
|
62
|
+
return this.http.request("/v1/bulk/files", {
|
|
63
|
+
method: "POST",
|
|
64
|
+
form: {
|
|
65
|
+
files: input.files.map((file) => ({
|
|
66
|
+
field: "files",
|
|
67
|
+
filename: file.filename,
|
|
68
|
+
content: file.content,
|
|
69
|
+
...(file.contentType === undefined
|
|
70
|
+
? {}
|
|
71
|
+
: { contentType: file.contentType }),
|
|
72
|
+
})),
|
|
73
|
+
fields: {
|
|
74
|
+
created_by: input.createdBy,
|
|
75
|
+
knowledge_base_id: input.knowledgeBaseId,
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Scrape URLs into an existing hub. `scope` is required by the schema
|
|
82
|
+
* but has no required properties (type defaults to GLOBAL) — for an
|
|
83
|
+
* existing hub it is inert, so an empty object goes on the wire instead
|
|
84
|
+
* of the legacy network/account scope.
|
|
85
|
+
*/
|
|
86
|
+
async uploadWebsites(input) {
|
|
87
|
+
return this.http.request("/v1/bulk/websites", {
|
|
88
|
+
method: "POST",
|
|
89
|
+
body: {
|
|
90
|
+
urls: input.urls.map((item) => ({
|
|
91
|
+
url: item.url,
|
|
92
|
+
...(item.resourceName === undefined
|
|
93
|
+
? {}
|
|
94
|
+
: { resource_name: item.resourceName }),
|
|
95
|
+
...(item.description === undefined
|
|
96
|
+
? {}
|
|
97
|
+
: { description: item.description }),
|
|
98
|
+
})),
|
|
99
|
+
scope: {},
|
|
100
|
+
knowledge_base_id: input.knowledgeBaseId,
|
|
101
|
+
created_by: input.createdBy,
|
|
102
|
+
},
|
|
103
|
+
});
|
|
104
|
+
}
|
|
36
105
|
}
|
|
37
106
|
//# sourceMappingURL=kbm.js.map
|
|
@@ -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":"AA+EA,MAAM,SAAS,GAAG,EAAE,CAAC;AACrB,MAAM,SAAS,GAAG,EAAE,CAAC;AAErB,MAAM,OAAO,SAAS;IACgB;IAApC,YAAoC,IAAgB;QAAhB,SAAI,GAAJ,IAAI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,KAI3B;QACC,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAuB,mBAAmB,EAAE;YAClE,MAAM,EAAE,MAAM;YACd,IAAI,EAAE;gBACJ,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;oBAC9B,GAAG,EAAE,IAAI,CAAC,GAAG;oBACb,GAAG,CAAC,IAAI,CAAC,YAAY,KAAK,SAAS;wBACjC,CAAC,CAAC,EAAE;wBACJ,CAAC,CAAC,EAAE,aAAa,EAAE,IAAI,CAAC,YAAY,EAAE,CAAC;oBACzC,GAAG,CAAC,IAAI,CAAC,WAAW,KAAK,SAAS;wBAChC,CAAC,CAAC,EAAE;wBACJ,CAAC,CAAC,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC;iBACvC,CAAC,CAAC;gBACH,KAAK,EAAE,EAAE;gBACT,iBAAiB,EAAE,KAAK,CAAC,eAAe;gBACxC,UAAU,EAAE,KAAK,CAAC,SAAS;aAC5B;SACF,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -5,7 +5,7 @@ export { IdentityClient, browserLogin, type LoginResult, type Organization, } fr
|
|
|
5
5
|
export { findLiveVersion, ManagementClient, parseVersionTag, type Agent, type AgentVersion, type Project, type VersionPull, type VersionPush, type VersionSource, type VersionStatus, } from "./api/management.js";
|
|
6
6
|
export { MockDbClient, type MockDbAuth, type MockDbClientOptions, type MockDbMgmtAuth, type MockDbProvisionResponse, type MockDbRuntimeAuth, type MockDbTokenAuth, } from "./api/mock-db.js";
|
|
7
7
|
export { VaultClient, type VaultScope, type VaultSecret, type VaultSecretCreate, } from "./api/vault.js";
|
|
8
|
-
export { KbmClient, type IndexingJob, type KnowledgeBase, } from "./api/kbm.js";
|
|
8
|
+
export { KbmClient, type BulkFilesResponse, type BulkResourceResult, type BulkWebsitesResponse, type IndexingJob, type KnowledgeBase, type UploadFilePart, } from "./api/kbm.js";
|
|
9
9
|
export { RuntimeApiClient, type AgentOverride, type Message, type RuntimeTrace, type SendMessageRequest, type SendMessageResponse, type SkillFile, type SkillIndexItem, type Thread, } from "./api/runtime-api.js";
|
|
10
10
|
export { Transport, type FormBody, type FormFilePart, type RequestCapture, type TransportOptions, } from "./api/transport.js";
|
|
11
11
|
export { AgentSettingsClient, type BuildBundle, type BuildBundlePullResponse, type BuildBundlePushResponse, type BundleUploadFile, type EvaluationScorePush, type EvaluationScoreRead, type Scenario, type ScenarioResult, type ScenarioResultStatus, type ScoreReportBlocks, } from "./api/agent-settings.js";
|
|
@@ -27,7 +27,7 @@ export { bindAgent, createAgent, createProject, initialVersionTag, listAgents, l
|
|
|
27
27
|
export { createThread, debugInteraction, getThread, listMessages, listThreads, parseVariables, sendMessage, trace, } from "./services/messaging.js";
|
|
28
28
|
export { createCollection, createEndpoint, deleteEndpoint, deleteMockDb, describeMockDb, executeEndpoint, exportMockDb, getEndpoint, inspectSession, listCollections, listEndpoints, normalizeSchema, parseJsonFlag, provisionMockDb, resetSession, resolveMockDb, rotateMgmtKey, rotateRuntimeKey, seedRows, statusMockDb, storedKeys, updateCollection, updateEndpoint, wireMockDbConnection, type MockDbResolved, type MockDbServiceOptions, type WireResult, } from "./services/mockdb.js";
|
|
29
29
|
export { buildVaultScope, getSecretByName, listSecrets, parseVaultScopeLevel, removeSecretByName, scopeLevelLabel, setSecret, validateSecretName, vaultScopeLevels, type SetSecretParams, type VaultScopeLevel, type VaultServiceOptions, } from "./services/vault.js";
|
|
30
|
-
export { deleteHub, getHubByName, hubRefCheck, hubStatus, listHubs, programHubRefs, type HubStatus, type KnowledgeServiceOptions, } from "./services/knowledge.js";
|
|
30
|
+
export { addFiles, addUrls, createHub, deleteHub, getHubByName, hubRefCheck, hubStatus, listHubs, programHubRefs, type HubStatus, type HubUploadResult, type KnowledgeServiceOptions, } from "./services/knowledge.js";
|
|
31
31
|
export { INTENT_DIR, REPORT_BLOCK_KEYS, SCENARIOS_DIR, SCENARIOS_FILE, SCORES_FILE, assembleBundleUpload, listIntentFiles, pullScenarios, pullScores, pushScenarioBundle, pushScores, readLocalScenarios, readLocalScores, scaffoldScenarios, scenariosPaths, scoresToPushBody, syncScenarios, validateScenariosFile, writeLocalScenarios, writeLocalScores, type AssembledBundle, type LocalScenario, type LocalScores, type PullScenariosResult, type PullScoresResult, type PushBundleResult, type PushScoresResult, type ScaffoldResult, type ScenariosFile, type ScenariosServiceOptions, type SyncScenariosResult, } from "./services/scenarios.js";
|
|
32
32
|
export { currentProfile, listProfiles, useProfile, type CurrentProfile, type ProfileSummary, } from "./services/profile.service.js";
|
|
33
33
|
export { getStatus, type ServiceCheck, type StatusResult, } from "./services/status.service.js";
|
|
@@ -26,7 +26,7 @@ export { bindAgent, createAgent, createProject, initialVersionTag, listAgents, l
|
|
|
26
26
|
export { createThread, debugInteraction, getThread, listMessages, listThreads, parseVariables, sendMessage, trace, } from "./services/messaging.js";
|
|
27
27
|
export { createCollection, createEndpoint, deleteEndpoint, deleteMockDb, describeMockDb, executeEndpoint, exportMockDb, getEndpoint, inspectSession, listCollections, listEndpoints, normalizeSchema, parseJsonFlag, provisionMockDb, resetSession, resolveMockDb, rotateMgmtKey, rotateRuntimeKey, seedRows, statusMockDb, storedKeys, updateCollection, updateEndpoint, wireMockDbConnection, } from "./services/mockdb.js";
|
|
28
28
|
export { buildVaultScope, getSecretByName, listSecrets, parseVaultScopeLevel, removeSecretByName, scopeLevelLabel, setSecret, validateSecretName, vaultScopeLevels, } from "./services/vault.js";
|
|
29
|
-
export { deleteHub, getHubByName, hubRefCheck, hubStatus, listHubs, programHubRefs, } from "./services/knowledge.js";
|
|
29
|
+
export { addFiles, addUrls, createHub, deleteHub, getHubByName, hubRefCheck, hubStatus, listHubs, programHubRefs, } from "./services/knowledge.js";
|
|
30
30
|
export { INTENT_DIR, REPORT_BLOCK_KEYS, SCENARIOS_DIR, SCENARIOS_FILE, SCORES_FILE, assembleBundleUpload, listIntentFiles, pullScenarios, pullScores, pushScenarioBundle, pushScores, readLocalScenarios, readLocalScores, scaffoldScenarios, scenariosPaths, scoresToPushBody, syncScenarios, validateScenariosFile, writeLocalScenarios, writeLocalScores, } from "./services/scenarios.js";
|
|
31
31
|
export { currentProfile, listProfiles, useProfile, } from "./services/profile.service.js";
|
|
32
32
|
export { getStatus, } from "./services/status.service.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,yDAAyD;AAEzD,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAG1C,OAAO,EACL,cAAc,EACd,YAAY,GAGb,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,eAAe,GAQhB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,YAAY,GAOb,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,WAAW,GAIZ,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,SAAS,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,yDAAyD;AAEzD,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAG1C,OAAO,EACL,cAAc,EACd,YAAY,GAGb,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,eAAe,GAQhB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,YAAY,GAOb,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,WAAW,GAIZ,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,SAAS,GAOV,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,gBAAgB,GASjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,SAAS,GAKV,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,mBAAmB,GAWpB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACL,UAAU,E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O,EACL,SAAS,GAGV,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,uBAAuB,EACvB,UAAU,GAIX,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,kBAAkB,GAEnB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAAE,aAAa,EAAoB,MAAM,qBAAqB,CAAC;AAEtE,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE1E,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,cAAc,EACd,gBAAgB,EAChB,aAAa,EACb,oBAAoB,EACpB,gBAAgB,EAChB,YAAY,EACZ,aAAa,GAEd,MAAM,yBAAyB,CAAC"}
|
|
@@ -19,6 +19,43 @@ export declare function hubStatus(context: Context, hub: KnowledgeBase, options?
|
|
|
19
19
|
export declare function getHubByName(context: Context, name: string, options?: KnowledgeServiceOptions): Promise<KnowledgeBase>;
|
|
20
20
|
/** Delete a whole hub — irreversible, resources included. */
|
|
21
21
|
export declare function deleteHub(context: Context, hub: Pick<KnowledgeBase, "id">, options?: KnowledgeServiceOptions): Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* Create a hub in the agent's own scope. The name is what programs put
|
|
24
|
+
* on `hub:` lines, so it must survive a YAML scalar and the ref scan —
|
|
25
|
+
* no whitespace. Duplicate names are refused here (case-insensitive):
|
|
26
|
+
* runtime lookup is by name, so two same-named hubs would be ambiguous.
|
|
27
|
+
*/
|
|
28
|
+
export declare function createHub(context: Context, params: {
|
|
29
|
+
name: string;
|
|
30
|
+
description?: string;
|
|
31
|
+
}, options?: KnowledgeServiceOptions): Promise<KnowledgeBase>;
|
|
32
|
+
/** Bulk outcome, normalized for both files and URLs. */
|
|
33
|
+
export interface HubUploadResult {
|
|
34
|
+
hub: KnowledgeBase;
|
|
35
|
+
accepted: number;
|
|
36
|
+
failed: number;
|
|
37
|
+
results: {
|
|
38
|
+
name: string;
|
|
39
|
+
status: string;
|
|
40
|
+
error?: string;
|
|
41
|
+
}[];
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Upload local documents into an existing hub. Acceptance only — indexing
|
|
45
|
+
* runs async afterwards; `hubStatus` (kb status) reports the real outcome.
|
|
46
|
+
*/
|
|
47
|
+
export declare function addFiles(context: Context, params: {
|
|
48
|
+
hub: string;
|
|
49
|
+
paths: string[];
|
|
50
|
+
}, options?: KnowledgeServiceOptions): Promise<HubUploadResult>;
|
|
51
|
+
/**
|
|
52
|
+
* Scrape URLs into an existing hub — the platform fetches and indexes
|
|
53
|
+
* each page; acceptance only, like addFiles.
|
|
54
|
+
*/
|
|
55
|
+
export declare function addUrls(context: Context, params: {
|
|
56
|
+
hub: string;
|
|
57
|
+
urls: string[];
|
|
58
|
+
}, options?: KnowledgeServiceOptions): Promise<HubUploadResult>;
|
|
22
59
|
/**
|
|
23
60
|
* `hub:` names referenced by the local bundle (sources declaring
|
|
24
61
|
* `kind: knowledge`). Cheap line scan — a full YAML parse buys nothing
|
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Knowledge hubs service — the KBM-side corpora that `kind: knowledge`
|
|
3
|
-
* sources name via `hub:`.
|
|
4
|
-
*
|
|
3
|
+
* sources name via `hub:`. List/status/check/delete, explicit creation
|
|
4
|
+
* (`createHub` — agent-scoped via `agent_id`, KBM stamps the scope), and
|
|
5
|
+
* content writes: `addFiles`/`addUrls` upload straight to KBM against an
|
|
6
|
+
* existing hub (resolved name → id through the agent-scoped list) — no
|
|
7
|
+
* local mirror, no name-based create-on-upload, none of the legacy v1
|
|
8
|
+
* scope fields (DESIGN §4.7).
|
|
5
9
|
*
|
|
6
10
|
* Hubs are agent-scoped and matched BY NAME at runtime —
|
|
7
11
|
* `knowledge_base_names: [hub]` — so the local cross-check compares
|
|
8
12
|
* program `hub:` references against remote hub names.
|
|
9
13
|
*/
|
|
14
|
+
import { readFile } from "node:fs/promises";
|
|
10
15
|
import path from "node:path";
|
|
11
16
|
import { readProgramFiles } from "../bundle/files.js";
|
|
12
|
-
import { CliError, ConfigError } from "../errors/index.js";
|
|
17
|
+
import { CliError, ConfigError, ValidationError } from "../errors/index.js";
|
|
13
18
|
import { createClients } from "./clients.js";
|
|
14
19
|
function clientsFor(context, options) {
|
|
15
20
|
return (options.clients ??
|
|
@@ -53,6 +58,112 @@ export async function getHubByName(context, name, options = {}) {
|
|
|
53
58
|
export async function deleteHub(context, hub, options = {}) {
|
|
54
59
|
await clientsFor(context, options).kbm.deleteKnowledgeBase(hub.id);
|
|
55
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* Create a hub in the agent's own scope. The name is what programs put
|
|
63
|
+
* on `hub:` lines, so it must survive a YAML scalar and the ref scan —
|
|
64
|
+
* no whitespace. Duplicate names are refused here (case-insensitive):
|
|
65
|
+
* runtime lookup is by name, so two same-named hubs would be ambiguous.
|
|
66
|
+
*/
|
|
67
|
+
export async function createHub(context, params, options = {}) {
|
|
68
|
+
const name = params.name.trim();
|
|
69
|
+
if (name.length === 0) {
|
|
70
|
+
throw new ValidationError("Hub name is required.");
|
|
71
|
+
}
|
|
72
|
+
if (/\s/.test(name)) {
|
|
73
|
+
throw new ValidationError(`Hub name "${name}" contains whitespace.`, "Use hyphens or underscores — the name is referenced as `hub: NAME` in source YAML.");
|
|
74
|
+
}
|
|
75
|
+
const agentId = requireAgent(context);
|
|
76
|
+
const createdBy = requireUserId(context);
|
|
77
|
+
const clients = clientsFor(context, options);
|
|
78
|
+
const existing = await clients.kbm.listKnowledgeBases(agentId);
|
|
79
|
+
const clash = existing.find((hub) => hub.name.toLowerCase() === name.toLowerCase());
|
|
80
|
+
if (clash) {
|
|
81
|
+
throw new CliError(`Hub "${clash.name}" already exists for this agent.`, {
|
|
82
|
+
code: "CONFLICT",
|
|
83
|
+
suggestion: "Upload into it with `apollo kb add`, or pick another name.",
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
return clients.kbm.createKnowledgeBase({
|
|
87
|
+
name,
|
|
88
|
+
agentId,
|
|
89
|
+
createdBy,
|
|
90
|
+
...(params.description === undefined
|
|
91
|
+
? {}
|
|
92
|
+
: { description: params.description }),
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
function requireUserId(context) {
|
|
96
|
+
if (!context.userId) {
|
|
97
|
+
throw new ConfigError("No user identity for the upload's created_by.", "Run `apollo login` again to refresh the session.");
|
|
98
|
+
}
|
|
99
|
+
return context.userId;
|
|
100
|
+
}
|
|
101
|
+
function normalizeUpload(hub, response) {
|
|
102
|
+
const accepted = "files_accepted" in response
|
|
103
|
+
? response.files_accepted
|
|
104
|
+
: response.urls_accepted;
|
|
105
|
+
const failed = "files_failed" in response ? response.files_failed : response.urls_failed;
|
|
106
|
+
return {
|
|
107
|
+
hub,
|
|
108
|
+
accepted,
|
|
109
|
+
failed,
|
|
110
|
+
results: response.results.map((item) => ({
|
|
111
|
+
name: item.resource_name,
|
|
112
|
+
status: item.status,
|
|
113
|
+
...(item.error === undefined ? {} : { error: item.error }),
|
|
114
|
+
})),
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Upload local documents into an existing hub. Acceptance only — indexing
|
|
119
|
+
* runs async afterwards; `hubStatus` (kb status) reports the real outcome.
|
|
120
|
+
*/
|
|
121
|
+
export async function addFiles(context, params, options = {}) {
|
|
122
|
+
if (params.paths.length === 0) {
|
|
123
|
+
throw new ValidationError("No files to upload.");
|
|
124
|
+
}
|
|
125
|
+
const createdBy = requireUserId(context);
|
|
126
|
+
const hub = await getHubByName(context, params.hub, options);
|
|
127
|
+
const files = await Promise.all(params.paths.map(async (filePath) => {
|
|
128
|
+
const absolute = path.resolve(filePath);
|
|
129
|
+
let content;
|
|
130
|
+
try {
|
|
131
|
+
content = await readFile(absolute);
|
|
132
|
+
}
|
|
133
|
+
catch {
|
|
134
|
+
throw new ValidationError(`Cannot read file: ${absolute}`);
|
|
135
|
+
}
|
|
136
|
+
return { filename: path.basename(absolute), content: new Uint8Array(content) };
|
|
137
|
+
}));
|
|
138
|
+
const response = await clientsFor(context, options).kbm.uploadFiles({
|
|
139
|
+
knowledgeBaseId: hub.id,
|
|
140
|
+
createdBy,
|
|
141
|
+
files,
|
|
142
|
+
});
|
|
143
|
+
return normalizeUpload(hub, response);
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Scrape URLs into an existing hub — the platform fetches and indexes
|
|
147
|
+
* each page; acceptance only, like addFiles.
|
|
148
|
+
*/
|
|
149
|
+
export async function addUrls(context, params, options = {}) {
|
|
150
|
+
if (params.urls.length === 0) {
|
|
151
|
+
throw new ValidationError("No URLs to add.");
|
|
152
|
+
}
|
|
153
|
+
for (const url of params.urls) {
|
|
154
|
+
if (!/^https?:\/\//i.test(url)) {
|
|
155
|
+
throw new ValidationError(`Not an http(s) URL: ${url}`, "Pass full URLs, e.g. https://docs.example.com/policy");
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
const createdBy = requireUserId(context);
|
|
159
|
+
const hub = await getHubByName(context, params.hub, options);
|
|
160
|
+
const response = await clientsFor(context, options).kbm.uploadWebsites({
|
|
161
|
+
knowledgeBaseId: hub.id,
|
|
162
|
+
createdBy,
|
|
163
|
+
urls: params.urls.map((url) => ({ url })),
|
|
164
|
+
});
|
|
165
|
+
return normalizeUpload(hub, response);
|
|
166
|
+
}
|
|
56
167
|
/**
|
|
57
168
|
* `hub:` names referenced by the local bundle (sources declaring
|
|
58
169
|
* `kind: knowledge`). Cheap line scan — a full YAML parse buys nothing
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"knowledge.js","sourceRoot":"","sources":["../../../src/services/knowledge.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"knowledge.js","sourceRoot":"","sources":["../../../src/services/knowledge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,IAA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;gBAAE,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QACrC,CAAC;IACH,CAAC;IACD,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;AACtD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,WAAW,CACzB,IAAc,EACd,IAAqB;IAErB,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;IACpD,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC;IACjC,OAAO;QACL,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC/C,YAAY,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;KAC9E,CAAC;AACJ,CAAC"}
|
|
@@ -43,6 +43,9 @@ const EXTRA_ALIASES = {
|
|
|
43
43
|
"vault-rm": ["delete-secret", "remove-secret"],
|
|
44
44
|
"kb-list": ["hubs", "knowledge", "rag"],
|
|
45
45
|
"kb-status": ["indexing", "hub-status"],
|
|
46
|
+
"kb-create": ["create-hub", "new-hub"],
|
|
47
|
+
"kb-add": ["upload", "add-files", "upload-documents"],
|
|
48
|
+
"kb-add-url": ["scrape", "add-website", "add-urls"],
|
|
46
49
|
"kb-check": ["refs", "hub-check"],
|
|
47
50
|
"kb-delete": ["delete-hub", "remove-hub"],
|
|
48
51
|
"version-use": ["use-version", "bind-version", "bind-tag"],
|
|
@@ -68,6 +71,9 @@ const KEYWORDS = {
|
|
|
68
71
|
"scores-pull": ["evaluation", "results", "grade"],
|
|
69
72
|
"vault-set": ["vault", "credentials", "api-key"],
|
|
70
73
|
"kb-check": ["knowledge", "sources", "retrieval"],
|
|
74
|
+
"kb-add": ["knowledge", "content", "documents", "pdf"],
|
|
75
|
+
"kb-add-url": ["knowledge", "content", "website", "scrape"],
|
|
76
|
+
"kb-create": ["knowledge", "hub", "provision"],
|
|
71
77
|
};
|
|
72
78
|
/** Actions needing an active agent binding to make sense. */
|
|
73
79
|
const NEEDS_AGENT = new Set([
|
|
@@ -86,6 +92,9 @@ const NEEDS_AGENT = new Set([
|
|
|
86
92
|
// Hubs are agent-scoped.
|
|
87
93
|
"kb-list",
|
|
88
94
|
"kb-status",
|
|
95
|
+
"kb-create",
|
|
96
|
+
"kb-add",
|
|
97
|
+
"kb-add-url",
|
|
89
98
|
"kb-check",
|
|
90
99
|
"kb-delete",
|
|
91
100
|
// Scenario sync is per agent (build bundles + scores).
|