@aaronsb/kg-cli 0.6.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.
Files changed (266) hide show
  1. package/README.md +112 -0
  2. package/dist/api/client.d.ts +867 -0
  3. package/dist/api/client.d.ts.map +1 -0
  4. package/dist/api/client.js +1362 -0
  5. package/dist/api/client.js.map +1 -0
  6. package/dist/cli/admin/backup.d.ts +9 -0
  7. package/dist/cli/admin/backup.d.ts.map +1 -0
  8. package/dist/cli/admin/backup.js +363 -0
  9. package/dist/cli/admin/backup.js.map +1 -0
  10. package/dist/cli/admin/index.d.ts +7 -0
  11. package/dist/cli/admin/index.d.ts.map +1 -0
  12. package/dist/cli/admin/index.js +52 -0
  13. package/dist/cli/admin/index.js.map +1 -0
  14. package/dist/cli/admin/scheduler.d.ts +7 -0
  15. package/dist/cli/admin/scheduler.d.ts.map +1 -0
  16. package/dist/cli/admin/scheduler.js +125 -0
  17. package/dist/cli/admin/scheduler.js.map +1 -0
  18. package/dist/cli/admin/status.d.ts +7 -0
  19. package/dist/cli/admin/status.d.ts.map +1 -0
  20. package/dist/cli/admin/status.js +134 -0
  21. package/dist/cli/admin/status.js.map +1 -0
  22. package/dist/cli/admin/utils.d.ts +34 -0
  23. package/dist/cli/admin/utils.d.ts.map +1 -0
  24. package/dist/cli/admin/utils.js +441 -0
  25. package/dist/cli/admin/utils.js.map +1 -0
  26. package/dist/cli/ai-config/embedding.d.ts +11 -0
  27. package/dist/cli/ai-config/embedding.d.ts.map +1 -0
  28. package/dist/cli/ai-config/embedding.js +598 -0
  29. package/dist/cli/ai-config/embedding.js.map +1 -0
  30. package/dist/cli/ai-config/extraction.d.ts +11 -0
  31. package/dist/cli/ai-config/extraction.d.ts.map +1 -0
  32. package/dist/cli/ai-config/extraction.js +206 -0
  33. package/dist/cli/ai-config/extraction.js.map +1 -0
  34. package/dist/cli/ai-config/index.d.ts +21 -0
  35. package/dist/cli/ai-config/index.d.ts.map +1 -0
  36. package/dist/cli/ai-config/index.js +27 -0
  37. package/dist/cli/ai-config/index.js.map +1 -0
  38. package/dist/cli/ai-config/keys.d.ts +11 -0
  39. package/dist/cli/ai-config/keys.d.ts.map +1 -0
  40. package/dist/cli/ai-config/keys.js +182 -0
  41. package/dist/cli/ai-config/keys.js.map +1 -0
  42. package/dist/cli/ai-config/utils.d.ts +13 -0
  43. package/dist/cli/ai-config/utils.d.ts.map +1 -0
  44. package/dist/cli/ai-config/utils.js +84 -0
  45. package/dist/cli/ai-config/utils.js.map +1 -0
  46. package/dist/cli/artifact.d.ts +8 -0
  47. package/dist/cli/artifact.d.ts.map +1 -0
  48. package/dist/cli/artifact.js +296 -0
  49. package/dist/cli/artifact.js.map +1 -0
  50. package/dist/cli/auth-admin.d.ts +11 -0
  51. package/dist/cli/auth-admin.d.ts.map +1 -0
  52. package/dist/cli/auth-admin.js +415 -0
  53. package/dist/cli/auth-admin.js.map +1 -0
  54. package/dist/cli/colors.d.ts +105 -0
  55. package/dist/cli/colors.d.ts.map +1 -0
  56. package/dist/cli/colors.js +164 -0
  57. package/dist/cli/colors.js.map +1 -0
  58. package/dist/cli/commands.d.ts +6 -0
  59. package/dist/cli/commands.d.ts.map +1 -0
  60. package/dist/cli/commands.js +164 -0
  61. package/dist/cli/commands.js.map +1 -0
  62. package/dist/cli/config.d.ts +6 -0
  63. package/dist/cli/config.d.ts.map +1 -0
  64. package/dist/cli/config.js +694 -0
  65. package/dist/cli/config.js.map +1 -0
  66. package/dist/cli/curve-viz.d.ts +89 -0
  67. package/dist/cli/curve-viz.d.ts.map +1 -0
  68. package/dist/cli/curve-viz.js +228 -0
  69. package/dist/cli/curve-viz.js.map +1 -0
  70. package/dist/cli/database.d.ts +6 -0
  71. package/dist/cli/database.d.ts.map +1 -0
  72. package/dist/cli/database.js +324 -0
  73. package/dist/cli/database.js.map +1 -0
  74. package/dist/cli/document.d.ts +6 -0
  75. package/dist/cli/document.d.ts.map +1 -0
  76. package/dist/cli/document.js +458 -0
  77. package/dist/cli/document.js.map +1 -0
  78. package/dist/cli/group.d.ts +8 -0
  79. package/dist/cli/group.d.ts.map +1 -0
  80. package/dist/cli/group.js +174 -0
  81. package/dist/cli/group.js.map +1 -0
  82. package/dist/cli/health.d.ts +6 -0
  83. package/dist/cli/health.d.ts.map +1 -0
  84. package/dist/cli/health.js +34 -0
  85. package/dist/cli/health.js.map +1 -0
  86. package/dist/cli/help-formatter.d.ts +16 -0
  87. package/dist/cli/help-formatter.d.ts.map +1 -0
  88. package/dist/cli/help-formatter.js +248 -0
  89. package/dist/cli/help-formatter.js.map +1 -0
  90. package/dist/cli/help.d.ts +9 -0
  91. package/dist/cli/help.d.ts.map +1 -0
  92. package/dist/cli/help.js +227 -0
  93. package/dist/cli/help.js.map +1 -0
  94. package/dist/cli/ingest.d.ts +6 -0
  95. package/dist/cli/ingest.d.ts.map +1 -0
  96. package/dist/cli/ingest.js +722 -0
  97. package/dist/cli/ingest.js.map +1 -0
  98. package/dist/cli/jobs.d.ts +6 -0
  99. package/dist/cli/jobs.d.ts.map +1 -0
  100. package/dist/cli/jobs.js +663 -0
  101. package/dist/cli/jobs.js.map +1 -0
  102. package/dist/cli/login.d.ts +21 -0
  103. package/dist/cli/login.d.ts.map +1 -0
  104. package/dist/cli/login.js +221 -0
  105. package/dist/cli/login.js.map +1 -0
  106. package/dist/cli/logout.d.ts +16 -0
  107. package/dist/cli/logout.d.ts.map +1 -0
  108. package/dist/cli/logout.js +141 -0
  109. package/dist/cli/logout.js.map +1 -0
  110. package/dist/cli/mcp-config.d.ts +10 -0
  111. package/dist/cli/mcp-config.d.ts.map +1 -0
  112. package/dist/cli/mcp-config.js +358 -0
  113. package/dist/cli/mcp-config.js.map +1 -0
  114. package/dist/cli/oauth.d.ts +15 -0
  115. package/dist/cli/oauth.d.ts.map +1 -0
  116. package/dist/cli/oauth.js +296 -0
  117. package/dist/cli/oauth.js.map +1 -0
  118. package/dist/cli/ontology.d.ts +6 -0
  119. package/dist/cli/ontology.d.ts.map +1 -0
  120. package/dist/cli/ontology.js +231 -0
  121. package/dist/cli/ontology.js.map +1 -0
  122. package/dist/cli/polarity.d.ts +6 -0
  123. package/dist/cli/polarity.d.ts.map +1 -0
  124. package/dist/cli/polarity.js +295 -0
  125. package/dist/cli/polarity.js.map +1 -0
  126. package/dist/cli/projection.d.ts +8 -0
  127. package/dist/cli/projection.d.ts.map +1 -0
  128. package/dist/cli/projection.js +297 -0
  129. package/dist/cli/projection.js.map +1 -0
  130. package/dist/cli/query-def.d.ts +8 -0
  131. package/dist/cli/query-def.d.ts.map +1 -0
  132. package/dist/cli/query-def.js +163 -0
  133. package/dist/cli/query-def.js.map +1 -0
  134. package/dist/cli/rbac.d.ts +12 -0
  135. package/dist/cli/rbac.d.ts.map +1 -0
  136. package/dist/cli/rbac.js +615 -0
  137. package/dist/cli/rbac.js.map +1 -0
  138. package/dist/cli/search.d.ts +6 -0
  139. package/dist/cli/search.d.ts.map +1 -0
  140. package/dist/cli/search.js +829 -0
  141. package/dist/cli/search.js.map +1 -0
  142. package/dist/cli/source.d.ts +6 -0
  143. package/dist/cli/source.d.ts.map +1 -0
  144. package/dist/cli/source.js +202 -0
  145. package/dist/cli/source.js.map +1 -0
  146. package/dist/cli/verb-router.d.ts +25 -0
  147. package/dist/cli/verb-router.d.ts.map +1 -0
  148. package/dist/cli/verb-router.js +415 -0
  149. package/dist/cli/verb-router.js.map +1 -0
  150. package/dist/cli/vocabulary/config.d.ts +7 -0
  151. package/dist/cli/vocabulary/config.d.ts.map +1 -0
  152. package/dist/cli/vocabulary/config.js +201 -0
  153. package/dist/cli/vocabulary/config.js.map +1 -0
  154. package/dist/cli/vocabulary/consolidate.d.ts +8 -0
  155. package/dist/cli/vocabulary/consolidate.d.ts.map +1 -0
  156. package/dist/cli/vocabulary/consolidate.js +192 -0
  157. package/dist/cli/vocabulary/consolidate.js.map +1 -0
  158. package/dist/cli/vocabulary/embeddings.d.ts +9 -0
  159. package/dist/cli/vocabulary/embeddings.d.ts.map +1 -0
  160. package/dist/cli/vocabulary/embeddings.js +205 -0
  161. package/dist/cli/vocabulary/embeddings.js.map +1 -0
  162. package/dist/cli/vocabulary/epistemic.d.ts +7 -0
  163. package/dist/cli/vocabulary/epistemic.d.ts.map +1 -0
  164. package/dist/cli/vocabulary/epistemic.js +315 -0
  165. package/dist/cli/vocabulary/epistemic.js.map +1 -0
  166. package/dist/cli/vocabulary/index.d.ts +7 -0
  167. package/dist/cli/vocabulary/index.d.ts.map +1 -0
  168. package/dist/cli/vocabulary/index.js +45 -0
  169. package/dist/cli/vocabulary/index.js.map +1 -0
  170. package/dist/cli/vocabulary/profiles.d.ts +7 -0
  171. package/dist/cli/vocabulary/profiles.d.ts.map +1 -0
  172. package/dist/cli/vocabulary/profiles.js +171 -0
  173. package/dist/cli/vocabulary/profiles.js.map +1 -0
  174. package/dist/cli/vocabulary/similarity.d.ts +9 -0
  175. package/dist/cli/vocabulary/similarity.d.ts.map +1 -0
  176. package/dist/cli/vocabulary/similarity.js +199 -0
  177. package/dist/cli/vocabulary/similarity.js.map +1 -0
  178. package/dist/cli/vocabulary/status.d.ts +8 -0
  179. package/dist/cli/vocabulary/status.d.ts.map +1 -0
  180. package/dist/cli/vocabulary/status.js +280 -0
  181. package/dist/cli/vocabulary/status.js.map +1 -0
  182. package/dist/cli/vocabulary/sync.d.ts +7 -0
  183. package/dist/cli/vocabulary/sync.d.ts.map +1 -0
  184. package/dist/cli/vocabulary/sync.js +111 -0
  185. package/dist/cli/vocabulary/sync.js.map +1 -0
  186. package/dist/index.d.ts +9 -0
  187. package/dist/index.d.ts.map +1 -0
  188. package/dist/index.js +16 -0
  189. package/dist/index.js.map +1 -0
  190. package/dist/lib/auth/auth-client.d.ts +247 -0
  191. package/dist/lib/auth/auth-client.d.ts.map +1 -0
  192. package/dist/lib/auth/auth-client.js +305 -0
  193. package/dist/lib/auth/auth-client.js.map +1 -0
  194. package/dist/lib/auth/challenge.d.ts +39 -0
  195. package/dist/lib/auth/challenge.d.ts.map +1 -0
  196. package/dist/lib/auth/challenge.js +125 -0
  197. package/dist/lib/auth/challenge.js.map +1 -0
  198. package/dist/lib/auth/client-credentials-flow.d.ts +58 -0
  199. package/dist/lib/auth/client-credentials-flow.d.ts.map +1 -0
  200. package/dist/lib/auth/client-credentials-flow.js +118 -0
  201. package/dist/lib/auth/client-credentials-flow.js.map +1 -0
  202. package/dist/lib/auth/device-flow.d.ts +75 -0
  203. package/dist/lib/auth/device-flow.d.ts.map +1 -0
  204. package/dist/lib/auth/device-flow.js +177 -0
  205. package/dist/lib/auth/device-flow.js.map +1 -0
  206. package/dist/lib/auth/index.d.ts +14 -0
  207. package/dist/lib/auth/index.d.ts.map +1 -0
  208. package/dist/lib/auth/index.js +34 -0
  209. package/dist/lib/auth/index.js.map +1 -0
  210. package/dist/lib/auth/oauth-types.d.ts +69 -0
  211. package/dist/lib/auth/oauth-types.d.ts.map +1 -0
  212. package/dist/lib/auth/oauth-types.js +10 -0
  213. package/dist/lib/auth/oauth-types.js.map +1 -0
  214. package/dist/lib/auth/oauth-utils.d.ts +51 -0
  215. package/dist/lib/auth/oauth-utils.d.ts.map +1 -0
  216. package/dist/lib/auth/oauth-utils.js +110 -0
  217. package/dist/lib/auth/oauth-utils.js.map +1 -0
  218. package/dist/lib/auth/token-manager.d.ts +87 -0
  219. package/dist/lib/auth/token-manager.d.ts.map +1 -0
  220. package/dist/lib/auth/token-manager.js +139 -0
  221. package/dist/lib/auth/token-manager.js.map +1 -0
  222. package/dist/lib/auth/token-refresh.d.ts +63 -0
  223. package/dist/lib/auth/token-refresh.d.ts.map +1 -0
  224. package/dist/lib/auth/token-refresh.js +141 -0
  225. package/dist/lib/auth/token-refresh.js.map +1 -0
  226. package/dist/lib/config.d.ts +286 -0
  227. package/dist/lib/config.d.ts.map +1 -0
  228. package/dist/lib/config.js +537 -0
  229. package/dist/lib/config.js.map +1 -0
  230. package/dist/lib/job-stream.d.ts +53 -0
  231. package/dist/lib/job-stream.d.ts.map +1 -0
  232. package/dist/lib/job-stream.js +153 -0
  233. package/dist/lib/job-stream.js.map +1 -0
  234. package/dist/lib/mcp-allowlist.d.ts +101 -0
  235. package/dist/lib/mcp-allowlist.d.ts.map +1 -0
  236. package/dist/lib/mcp-allowlist.js +340 -0
  237. package/dist/lib/mcp-allowlist.js.map +1 -0
  238. package/dist/lib/table-example.d.ts +7 -0
  239. package/dist/lib/table-example.d.ts.map +1 -0
  240. package/dist/lib/table-example.js +105 -0
  241. package/dist/lib/table-example.js.map +1 -0
  242. package/dist/lib/table.d.ts +95 -0
  243. package/dist/lib/table.d.ts.map +1 -0
  244. package/dist/lib/table.js +263 -0
  245. package/dist/lib/table.js.map +1 -0
  246. package/dist/lib/terminal-images.d.ts +66 -0
  247. package/dist/lib/terminal-images.d.ts.map +1 -0
  248. package/dist/lib/terminal-images.js +268 -0
  249. package/dist/lib/terminal-images.js.map +1 -0
  250. package/dist/mcp/formatters.d.ts +100 -0
  251. package/dist/mcp/formatters.d.ts.map +1 -0
  252. package/dist/mcp/formatters.js +1411 -0
  253. package/dist/mcp/formatters.js.map +1 -0
  254. package/dist/mcp-server.d.ts +9 -0
  255. package/dist/mcp-server.d.ts.map +1 -0
  256. package/dist/mcp-server.js +1810 -0
  257. package/dist/mcp-server.js.map +1 -0
  258. package/dist/types/index.d.ts +742 -0
  259. package/dist/types/index.d.ts.map +1 -0
  260. package/dist/types/index.js +6 -0
  261. package/dist/types/index.js.map +1 -0
  262. package/dist/version.d.ts +10 -0
  263. package/dist/version.d.ts.map +1 -0
  264. package/dist/version.js +13 -0
  265. package/dist/version.js.map +1 -0
  266. package/package.json +84 -0
@@ -0,0 +1,867 @@
1
+ /**
2
+ * Knowledge Graph API Client
3
+ *
4
+ * Wraps HTTP calls to the FastAPI server
5
+ */
6
+ import { ApiConfig, JobStatus, JobSubmitResponse, DuplicateJobResponse, IngestRequest, SearchRequest, SearchResponse, SourceSearchRequest, SourceSearchResponse, ConceptDetailsResponse, RelatedConceptsRequest, RelatedConceptsResponse, FindConnectionRequest, FindConnectionResponse, FindConnectionBySearchRequest, FindConnectionBySearchResponse, DatabaseStatsResponse, DatabaseInfoResponse, DatabaseHealthResponse, OntologyListResponse, OntologyInfoResponse, OntologyFilesResponse, OntologyDeleteResponse, OntologyRenameResponse, SystemStatusResponse, BackupRequest, ListBackupsResponse, ResetRequest, ResetResponse, ResourceCreate, ResourceRead, ResourceUpdate, RoleCreate, RoleRead, RoleUpdate, PermissionCreate, PermissionRead, UserRoleAssign, UserRoleRead, PermissionCheckRequest, PermissionCheckResponse } from '../types';
7
+ export declare class KnowledgeGraphClient {
8
+ private client;
9
+ private config;
10
+ private mcpJwtToken;
11
+ constructor(config: ApiConfig);
12
+ /**
13
+ * Set JWT token for MCP server authentication
14
+ *
15
+ * This allows the MCP server to inject a JWT token obtained via automatic login,
16
+ * making authentication transparent to the AI using the MCP tools.
17
+ *
18
+ * @param token JWT access token from login response
19
+ */
20
+ setMcpJwtToken(token: string | null): void;
21
+ /**
22
+ * Health check
23
+ */
24
+ health(): Promise<{
25
+ status: string;
26
+ }>;
27
+ /**
28
+ * Get API info
29
+ */
30
+ info(): Promise<any>;
31
+ /**
32
+ * Ingest a document file
33
+ */
34
+ ingestFile(filePath: string, request: IngestRequest): Promise<JobSubmitResponse | DuplicateJobResponse>;
35
+ /**
36
+ * Ingest raw text
37
+ */
38
+ ingestText(text: string, request: IngestRequest): Promise<JobSubmitResponse | DuplicateJobResponse>;
39
+ /**
40
+ * Ingest image (ADR-057)
41
+ */
42
+ ingestImage(filePath: string, request: IngestRequest & {
43
+ vision_provider?: string;
44
+ vision_model?: string;
45
+ }): Promise<JobSubmitResponse | DuplicateJobResponse>;
46
+ /**
47
+ * Get job status
48
+ */
49
+ getJob(jobId: string): Promise<JobStatus>;
50
+ /**
51
+ * Get job status (alias for getJob)
52
+ */
53
+ getJobStatus(jobId: string): Promise<JobStatus>;
54
+ /**
55
+ * List jobs
56
+ */
57
+ listJobs(status?: string, clientId?: string, limit?: number, offset?: number): Promise<JobStatus[]>;
58
+ /**
59
+ * Cancel a job
60
+ */
61
+ cancelJob(jobId: string): Promise<{
62
+ job_id: string;
63
+ cancelled: boolean;
64
+ message: string;
65
+ }>;
66
+ /**
67
+ * Clear all jobs (nuclear option - requires confirmation)
68
+ */
69
+ clearAllJobs(confirm?: boolean): Promise<{
70
+ success: boolean;
71
+ jobs_deleted: number;
72
+ message: string;
73
+ }>;
74
+ /**
75
+ * Approve a job for processing (ADR-014)
76
+ */
77
+ approveJob(jobId: string): Promise<{
78
+ job_id: string;
79
+ status: string;
80
+ message: string;
81
+ }>;
82
+ /**
83
+ * Poll job until completion
84
+ *
85
+ * @param jobId Job ID to poll
86
+ * @param onProgress Optional callback for progress updates
87
+ * @param pollInterval Poll interval in ms (default: 2000)
88
+ * @returns Final job status
89
+ */
90
+ pollJob(jobId: string, onProgress?: (job: JobStatus) => void, pollInterval?: number): Promise<JobStatus>;
91
+ /**
92
+ * Search for concepts using semantic similarity
93
+ */
94
+ searchConcepts(request: SearchRequest): Promise<SearchResponse>;
95
+ /**
96
+ * Search source text using semantic similarity (ADR-068 Phase 3)
97
+ */
98
+ searchSources(request: SourceSearchRequest): Promise<SourceSearchResponse>;
99
+ /**
100
+ * Get detailed information about a concept
101
+ */
102
+ getConceptDetails(conceptId: string, includeGrounding?: boolean, includeDiversity?: boolean, diversityMaxHops?: number): Promise<ConceptDetailsResponse>;
103
+ /**
104
+ * Find concepts related through graph traversal
105
+ */
106
+ findRelatedConcepts(request: RelatedConceptsRequest): Promise<RelatedConceptsResponse>;
107
+ /**
108
+ * Find shortest paths between two concepts
109
+ */
110
+ findConnection(request: FindConnectionRequest): Promise<FindConnectionResponse>;
111
+ /**
112
+ * Find shortest paths between concepts using natural language queries
113
+ */
114
+ findConnectionBySearch(request: FindConnectionBySearchRequest): Promise<FindConnectionBySearchResponse>;
115
+ /**
116
+ * Get image for a source node (ADR-057)
117
+ * @param sourceId - Source ID from concept instance
118
+ * @returns Image as Buffer (binary data)
119
+ */
120
+ getSourceImage(sourceId: string): Promise<Buffer>;
121
+ /**
122
+ * Get image for a source node as base64 string (ADR-057)
123
+ * Useful for MCP server to return images to Claude
124
+ * @param sourceId - Source ID from concept instance
125
+ * @returns Base64-encoded image string
126
+ */
127
+ getSourceImageBase64(sourceId: string): Promise<string>;
128
+ /**
129
+ * List source nodes with optional filtering
130
+ * @param options - Filter and pagination options
131
+ * @returns List of sources with metadata
132
+ */
133
+ listSources(options?: {
134
+ ontology?: string;
135
+ limit?: number;
136
+ offset?: number;
137
+ }): Promise<{
138
+ sources: Array<{
139
+ source_id: string;
140
+ document: string;
141
+ paragraph: number;
142
+ content_type?: string;
143
+ has_garage_key: boolean;
144
+ }>;
145
+ total: number;
146
+ limit: number;
147
+ offset: number;
148
+ }>;
149
+ /**
150
+ * Get original document for a source node (ADR-081)
151
+ * @param sourceId - Source ID from search results or concept details
152
+ * @returns Document content as Buffer (binary data)
153
+ */
154
+ getSourceDocument(sourceId: string): Promise<Buffer>;
155
+ /**
156
+ * Get source metadata
157
+ * @param sourceId - Source ID
158
+ * @returns Source metadata including garage_key, content_hash, etc.
159
+ */
160
+ getSourceMetadata(sourceId: string): Promise<{
161
+ source_id: string;
162
+ document: string;
163
+ paragraph: number;
164
+ full_text: string;
165
+ file_path?: string;
166
+ content_type?: string;
167
+ storage_key?: string;
168
+ garage_key?: string;
169
+ content_hash?: string;
170
+ char_offset_start?: number;
171
+ char_offset_end?: number;
172
+ chunk_index?: number;
173
+ has_visual_embedding: boolean;
174
+ has_text_embedding: boolean;
175
+ }>;
176
+ /**
177
+ * Search documents using semantic similarity
178
+ * Aggregates chunk-level matches to document level
179
+ */
180
+ searchDocuments(request: {
181
+ query: string;
182
+ min_similarity?: number;
183
+ limit?: number;
184
+ ontology?: string;
185
+ }): Promise<{
186
+ documents: Array<{
187
+ document_id: string;
188
+ filename: string;
189
+ ontology: string;
190
+ content_type: string;
191
+ best_similarity: number;
192
+ source_count: number;
193
+ resources: Array<{
194
+ type: string;
195
+ garage_key: string;
196
+ }>;
197
+ concept_ids: string[];
198
+ }>;
199
+ returned: number;
200
+ total_matches: number;
201
+ }>;
202
+ /**
203
+ * List documents with optional ontology filter
204
+ */
205
+ listDocuments(options?: {
206
+ ontology?: string;
207
+ limit?: number;
208
+ offset?: number;
209
+ }): Promise<{
210
+ documents: Array<{
211
+ document_id: string;
212
+ filename: string;
213
+ ontology: string;
214
+ content_type: string;
215
+ source_count: number;
216
+ concept_count: number;
217
+ }>;
218
+ total: number;
219
+ limit: number;
220
+ offset: number;
221
+ }>;
222
+ /**
223
+ * Get document content from Garage
224
+ */
225
+ getDocumentContent(documentId: string): Promise<{
226
+ document_id: string;
227
+ content_type: string;
228
+ content: {
229
+ document?: string;
230
+ image?: string;
231
+ prose?: string;
232
+ encoding: string;
233
+ error?: string;
234
+ };
235
+ chunks: Array<{
236
+ source_id: string;
237
+ paragraph: number;
238
+ full_text: string;
239
+ char_offset_start?: number;
240
+ char_offset_end?: number;
241
+ }>;
242
+ }>;
243
+ /**
244
+ * Get concepts extracted from a document
245
+ */
246
+ getDocumentConcepts(documentId: string): Promise<{
247
+ document_id: string;
248
+ filename: string;
249
+ concepts: Array<{
250
+ concept_id: string;
251
+ name: string;
252
+ source_id: string;
253
+ instance_count: number;
254
+ }>;
255
+ total: number;
256
+ }>;
257
+ /**
258
+ * Get database statistics
259
+ */
260
+ getDatabaseStats(): Promise<DatabaseStatsResponse>;
261
+ /**
262
+ * Get database connection information
263
+ */
264
+ getDatabaseInfo(): Promise<DatabaseInfoResponse>;
265
+ /**
266
+ * Check database health
267
+ */
268
+ getDatabaseHealth(): Promise<DatabaseHealthResponse>;
269
+ /**
270
+ * Execute a custom cypher query (ADR-048)
271
+ * @param query - openCypher/GQL query string
272
+ * @param params - Optional query parameters
273
+ * @param namespace - Optional namespace: 'concept', 'vocab', or null for raw
274
+ */
275
+ executeCypherQuery(query: string, params?: Record<string, any>, namespace?: string | null): Promise<any>;
276
+ /**
277
+ * Get all graph metrics counters organized by type (ADR-079)
278
+ */
279
+ getDatabaseCounters(): Promise<any>;
280
+ /**
281
+ * Refresh graph metrics counters from current graph state (ADR-079)
282
+ */
283
+ refreshDatabaseCounters(): Promise<any>;
284
+ /**
285
+ * List all ontologies
286
+ */
287
+ listOntologies(): Promise<OntologyListResponse>;
288
+ /**
289
+ * Get ontology information
290
+ */
291
+ getOntologyInfo(ontologyName: string): Promise<OntologyInfoResponse>;
292
+ /**
293
+ * List files in an ontology
294
+ */
295
+ getOntologyFiles(ontologyName: string): Promise<OntologyFilesResponse>;
296
+ /**
297
+ * Delete an ontology
298
+ */
299
+ deleteOntology(ontologyName: string, force?: boolean): Promise<OntologyDeleteResponse>;
300
+ /**
301
+ * Rename an ontology
302
+ */
303
+ renameOntology(oldName: string, newName: string): Promise<OntologyRenameResponse>;
304
+ /**
305
+ * Get system status
306
+ */
307
+ getSystemStatus(): Promise<SystemStatusResponse>;
308
+ /**
309
+ * List available backup files
310
+ */
311
+ listBackups(): Promise<ListBackupsResponse>;
312
+ /**
313
+ * Create a database backup (ADR-015 Phase 2: Streaming Download)
314
+ *
315
+ * Downloads backup as a stream and saves to specified path.
316
+ * Provides progress callback for tracking download.
317
+ *
318
+ * @param request Backup request (type and optional ontology)
319
+ * @param savePath Where to save the backup file
320
+ * @param onProgress Optional callback for progress updates (bytes downloaded, total bytes, percent)
321
+ * @returns Metadata about the downloaded backup
322
+ */
323
+ createBackup(request: BackupRequest, savePath: string, onProgress?: (downloaded: number, total: number, percent: number) => void): Promise<{
324
+ filename: string;
325
+ path: string;
326
+ size: number;
327
+ }>;
328
+ /**
329
+ * Restore a database backup (ADR-015 Phase 2: Multipart Upload)
330
+ *
331
+ * Uploads backup file as multipart/form-data and queues restore job.
332
+ * Server validates backup, creates checkpoint, then executes restore with progress tracking.
333
+ * Uses OAuth authentication (token from login).
334
+ *
335
+ * @param backupFilePath Path to backup file (.tar.gz archive or .json)
336
+ * @param overwrite Whether to overwrite existing data
337
+ * @param handleExternalDeps How to handle external dependencies ('prune', 'stitch', 'defer')
338
+ * @param onUploadProgress Optional callback for upload progress (bytes uploaded, total bytes, percent)
339
+ * @returns Job ID and initial status for polling restore progress
340
+ */
341
+ restoreBackup(backupFilePath: string, overwrite?: boolean, handleExternalDeps?: string, onUploadProgress?: (uploaded: number, total: number, percent: number) => void): Promise<{
342
+ job_id: string;
343
+ status: string;
344
+ message: string;
345
+ backup_stats: any;
346
+ integrity_warnings: number;
347
+ }>;
348
+ /**
349
+ * Reset database (destructive - requires authentication)
350
+ */
351
+ resetDatabase(request: ResetRequest): Promise<ResetResponse>;
352
+ /**
353
+ * Get job scheduler status and statistics (ADR-014)
354
+ */
355
+ getSchedulerStatus(): Promise<any>;
356
+ /**
357
+ * Manually trigger job scheduler cleanup (ADR-014)
358
+ */
359
+ triggerSchedulerCleanup(): Promise<any>;
360
+ /**
361
+ * Regenerate embeddings for concept nodes in the graph
362
+ */
363
+ regenerateConceptEmbeddings(params: {
364
+ only_missing?: boolean;
365
+ ontology?: string;
366
+ limit?: number;
367
+ }): Promise<any>;
368
+ /**
369
+ * Unified embedding regeneration for all graph text entities (ADR-068 Phase 4).
370
+ *
371
+ * Regenerate embeddings for concepts, sources, or vocabulary (relationship types).
372
+ * Useful for model migrations, fixing missing/corrupted embeddings, or bulk regeneration.
373
+ */
374
+ regenerateEmbeddings(params: {
375
+ embedding_type: 'concept' | 'source' | 'vocabulary' | 'all';
376
+ only_missing?: boolean;
377
+ only_incompatible?: boolean;
378
+ ontology?: string;
379
+ limit?: number;
380
+ }): Promise<any>;
381
+ /**
382
+ * Get comprehensive embedding status for all graph text entities.
383
+ *
384
+ * Shows count, percentage, compatibility verification, and hash verification
385
+ * for embeddings across concepts, sources, vocabulary, and images.
386
+ */
387
+ getEmbeddingStatus(ontology?: string): Promise<any>;
388
+ /**
389
+ * List all registered resource types
390
+ */
391
+ listResources(): Promise<ResourceRead[]>;
392
+ /**
393
+ * Get a specific resource type
394
+ */
395
+ getResource(resourceType: string): Promise<ResourceRead>;
396
+ /**
397
+ * Register a new resource type
398
+ */
399
+ createResource(resource: ResourceCreate): Promise<ResourceRead>;
400
+ /**
401
+ * Update a resource type
402
+ */
403
+ updateResource(resourceType: string, update: ResourceUpdate): Promise<ResourceRead>;
404
+ /**
405
+ * Delete a resource type
406
+ */
407
+ deleteResource(resourceType: string): Promise<void>;
408
+ /**
409
+ * List all roles
410
+ */
411
+ listRoles(includeInactive?: boolean): Promise<RoleRead[]>;
412
+ /**
413
+ * Get a specific role
414
+ */
415
+ getRole(roleName: string): Promise<RoleRead>;
416
+ /**
417
+ * Create a new role
418
+ */
419
+ createRole(role: RoleCreate): Promise<RoleRead>;
420
+ /**
421
+ * Update a role
422
+ */
423
+ updateRole(roleName: string, update: RoleUpdate): Promise<RoleRead>;
424
+ /**
425
+ * Delete a role
426
+ */
427
+ deleteRole(roleName: string): Promise<void>;
428
+ /**
429
+ * List permissions (optionally filtered)
430
+ */
431
+ listPermissions(roleName?: string, resourceType?: string): Promise<PermissionRead[]>;
432
+ /**
433
+ * Grant a permission to a role
434
+ */
435
+ createPermission(permission: PermissionCreate): Promise<PermissionRead>;
436
+ /**
437
+ * Revoke a permission from a role
438
+ */
439
+ deletePermission(permissionId: number): Promise<void>;
440
+ /**
441
+ * List role assignments for a user
442
+ */
443
+ listUserRoles(userId: number): Promise<UserRoleRead[]>;
444
+ /**
445
+ * Assign a role to a user
446
+ */
447
+ assignUserRole(assignment: UserRoleAssign): Promise<UserRoleRead>;
448
+ /**
449
+ * Revoke a role assignment from a user
450
+ */
451
+ revokeUserRole(assignmentId: number): Promise<void>;
452
+ /**
453
+ * Check if a user has a specific permission
454
+ */
455
+ checkPermission(request: PermissionCheckRequest): Promise<PermissionCheckResponse>;
456
+ /**
457
+ * Get current vocabulary status
458
+ */
459
+ getVocabularyStatus(): Promise<any>;
460
+ /**
461
+ * List all edge types with statistics
462
+ */
463
+ listEdgeTypes(includeInactive?: boolean, includeBuiltin?: boolean): Promise<any>;
464
+ /**
465
+ * Manually add a new edge type (curator action)
466
+ */
467
+ addEdgeType(request: {
468
+ relationship_type: string;
469
+ category: string;
470
+ description?: string;
471
+ is_builtin?: boolean;
472
+ }): Promise<any>;
473
+ /**
474
+ * Generate vocabulary optimization recommendations
475
+ */
476
+ getVocabularyRecommendations(): Promise<any>;
477
+ /**
478
+ * Execute all auto-approved recommendations
479
+ */
480
+ executeAutoRecommendations(): Promise<any>;
481
+ /**
482
+ * Get detailed vocabulary analysis
483
+ */
484
+ getVocabularyAnalysis(): Promise<any>;
485
+ /**
486
+ * Get vocabulary configuration
487
+ */
488
+ getVocabularyConfig(): Promise<any>;
489
+ /**
490
+ * Get vocabulary configuration details (admin endpoint)
491
+ */
492
+ getVocabularyConfigDetail(): Promise<any>;
493
+ /**
494
+ * Update vocabulary configuration (admin endpoint)
495
+ */
496
+ updateVocabularyConfig(config: {
497
+ vocab_min?: number;
498
+ vocab_max?: number;
499
+ vocab_emergency?: number;
500
+ pruning_mode?: string;
501
+ aggressiveness_profile?: string;
502
+ auto_expand_enabled?: boolean;
503
+ synonym_threshold_strong?: number;
504
+ synonym_threshold_moderate?: number;
505
+ low_value_threshold?: number;
506
+ consolidation_similarity_threshold?: number;
507
+ updated_by: string;
508
+ }): Promise<any>;
509
+ /**
510
+ * List aggressiveness profiles (admin endpoint)
511
+ */
512
+ listAggressivenessProfiles(): Promise<any>;
513
+ /**
514
+ * Get specific aggressiveness profile (admin endpoint)
515
+ */
516
+ getAggressivenessProfile(profileName: string): Promise<any>;
517
+ /**
518
+ * Create custom aggressiveness profile (admin endpoint)
519
+ */
520
+ createAggressivenessProfile(profile: {
521
+ profile_name: string;
522
+ control_x1: number;
523
+ control_y1: number;
524
+ control_x2: number;
525
+ control_y2: number;
526
+ description: string;
527
+ }): Promise<any>;
528
+ /**
529
+ * Delete custom aggressiveness profile (admin endpoint)
530
+ */
531
+ deleteAggressivenessProfile(profileName: string): Promise<any>;
532
+ /**
533
+ * Merge two edge types (curator action)
534
+ */
535
+ mergeEdgeTypes(request: {
536
+ deprecated_type: string;
537
+ target_type: string;
538
+ performed_by: string;
539
+ reason?: string;
540
+ }): Promise<any>;
541
+ /**
542
+ * Get category similarity scores for a relationship type (ADR-047)
543
+ */
544
+ getCategoryScores(relationshipType: string): Promise<any>;
545
+ /**
546
+ * Refresh category assignments for vocabulary types (ADR-047)
547
+ */
548
+ refreshCategories(onlyComputed?: boolean): Promise<any>;
549
+ /**
550
+ * Generate embeddings for vocabulary types (bulk operation)
551
+ */
552
+ generateVocabularyEmbeddings(forceRegenerate?: boolean, onlyMissing?: boolean): Promise<any>;
553
+ /**
554
+ * Run AITL vocabulary consolidation workflow (ADR-032)
555
+ */
556
+ consolidateVocabulary(request: {
557
+ target_size?: number;
558
+ batch_size?: number;
559
+ auto_execute_threshold?: number;
560
+ dry_run?: boolean;
561
+ prune_unused?: boolean;
562
+ }): Promise<any>;
563
+ /**
564
+ * Measure epistemic status for vocabulary types (ADR-065 Phase 2)
565
+ */
566
+ measureEpistemicStatus(request: {
567
+ sample_size?: number;
568
+ store?: boolean;
569
+ verbose?: boolean;
570
+ }): Promise<any>;
571
+ /**
572
+ * List vocabulary types with epistemic status (ADR-065 Phase 2)
573
+ */
574
+ listEpistemicStatus(statusFilter?: string): Promise<any>;
575
+ /**
576
+ * Get epistemic status for a specific vocabulary type (ADR-065 Phase 2)
577
+ */
578
+ getEpistemicStatus(relationshipType: string): Promise<any>;
579
+ /**
580
+ * Sync missing edge types from graph to vocabulary (ADR-077)
581
+ */
582
+ syncVocabulary(dryRun?: boolean): Promise<any>;
583
+ /**
584
+ * Get current embedding configuration (public endpoint)
585
+ */
586
+ getEmbeddingConfig(): Promise<any>;
587
+ /**
588
+ * Get detailed embedding configuration (admin endpoint)
589
+ */
590
+ getEmbeddingConfigDetail(): Promise<any>;
591
+ /**
592
+ * Update embedding configuration (admin endpoint)
593
+ */
594
+ updateEmbeddingConfig(config: any): Promise<any>;
595
+ /**
596
+ * Hot reload embedding model (admin endpoint)
597
+ */
598
+ reloadEmbeddingModel(): Promise<any>;
599
+ /**
600
+ * List all embedding configurations (admin endpoint)
601
+ */
602
+ listEmbeddingConfigs(): Promise<any[]>;
603
+ /**
604
+ * Set protection flags on an embedding config (admin endpoint)
605
+ */
606
+ protectEmbeddingConfig(configId: number, deleteProtected?: boolean, changeProtected?: boolean): Promise<any>;
607
+ /**
608
+ * Delete an embedding configuration (admin endpoint)
609
+ */
610
+ deleteEmbeddingConfig(configId: number): Promise<any>;
611
+ /**
612
+ * Activate an embedding configuration with automatic protection management (admin endpoint)
613
+ */
614
+ activateEmbeddingConfig(configId: number, force?: boolean): Promise<any>;
615
+ /**
616
+ * Get current extraction configuration (public endpoint)
617
+ */
618
+ getExtractionConfig(): Promise<any>;
619
+ /**
620
+ * Get detailed extraction configuration (admin endpoint)
621
+ */
622
+ getExtractionConfigDetail(): Promise<any>;
623
+ /**
624
+ * Update extraction configuration (admin endpoint)
625
+ */
626
+ updateExtractionConfig(config: any): Promise<any>;
627
+ /**
628
+ * List API keys with validation status (admin endpoint)
629
+ */
630
+ listApiKeys(): Promise<any[]>;
631
+ /**
632
+ * Set API key for a provider (admin endpoint)
633
+ */
634
+ setApiKey(provider: string, apiKey: string): Promise<any>;
635
+ /**
636
+ * Delete API key for a provider (admin endpoint)
637
+ */
638
+ deleteApiKey(provider: string): Promise<any>;
639
+ /**
640
+ * Get similar edge types via embedding similarity (ADR-053)
641
+ */
642
+ getSimilarTypes(relationshipType: string, limit?: number, reverse?: boolean): Promise<any>;
643
+ /**
644
+ * Get detailed vocabulary analysis (ADR-053)
645
+ */
646
+ analyzeVocabularyType(relationshipType: string): Promise<any>;
647
+ /**
648
+ * Analyze polarity axis between two concept poles (ADR-070)
649
+ */
650
+ analyzePolarityAxis(request: {
651
+ positive_pole_id: string;
652
+ negative_pole_id: string;
653
+ candidate_ids?: string[];
654
+ auto_discover?: boolean;
655
+ max_candidates?: number;
656
+ max_hops?: number;
657
+ discovery_slot_pct?: number;
658
+ max_workers?: number;
659
+ chunk_size?: number;
660
+ timeout_seconds?: number;
661
+ }): Promise<any>;
662
+ /**
663
+ * Submit async polarity analysis job with artifact creation (ADR-083)
664
+ */
665
+ submitPolarityJob(request: {
666
+ positive_pole_id: string;
667
+ negative_pole_id: string;
668
+ candidate_ids?: string[];
669
+ auto_discover?: boolean;
670
+ max_candidates?: number;
671
+ max_hops?: number;
672
+ discovery_slot_pct?: number;
673
+ max_workers?: number;
674
+ chunk_size?: number;
675
+ timeout_seconds?: number;
676
+ create_artifact?: boolean;
677
+ }): Promise<{
678
+ job_id: string;
679
+ status: string;
680
+ message: string;
681
+ }>;
682
+ /**
683
+ * Get available projection algorithms
684
+ */
685
+ getProjectionAlgorithms(): Promise<{
686
+ available: string[];
687
+ default: string;
688
+ }>;
689
+ /**
690
+ * Get cached projection for an ontology
691
+ */
692
+ getProjection(ontology: string): Promise<any>;
693
+ /**
694
+ * Regenerate projection for an ontology
695
+ */
696
+ regenerateProjection(ontology: string, options?: {
697
+ force?: boolean;
698
+ algorithm?: 'tsne' | 'umap';
699
+ perplexity?: number;
700
+ center?: boolean;
701
+ include_grounding?: boolean;
702
+ include_diversity?: boolean;
703
+ create_artifact?: boolean;
704
+ }): Promise<{
705
+ status: string;
706
+ job_id?: string;
707
+ message: string;
708
+ changelist_id?: string;
709
+ artifact_id?: number;
710
+ }>;
711
+ /**
712
+ * Invalidate (delete) cached projection
713
+ */
714
+ invalidateProjection(ontology: string): Promise<{
715
+ message: string;
716
+ }>;
717
+ /**
718
+ * List artifacts with optional filtering
719
+ */
720
+ listArtifacts(params?: {
721
+ artifact_type?: string;
722
+ representation?: string;
723
+ ontology?: string;
724
+ owner_id?: number;
725
+ limit?: number;
726
+ offset?: number;
727
+ }): Promise<{
728
+ artifacts: any[];
729
+ total: number;
730
+ limit: number;
731
+ offset: number;
732
+ }>;
733
+ /**
734
+ * Get artifact metadata by ID
735
+ */
736
+ getArtifact(artifactId: number): Promise<any>;
737
+ /**
738
+ * Get artifact with full payload
739
+ */
740
+ getArtifactPayload(artifactId: number): Promise<any>;
741
+ /**
742
+ * Create a new artifact
743
+ */
744
+ createArtifact(artifact: {
745
+ artifact_type: string;
746
+ representation: string;
747
+ name?: string;
748
+ parameters: Record<string, any>;
749
+ payload: Record<string, any>;
750
+ metadata?: Record<string, any>;
751
+ ontology?: string;
752
+ concept_ids?: string[];
753
+ expires_at?: string;
754
+ query_definition_id?: number;
755
+ }): Promise<{
756
+ id: number;
757
+ artifact_type: string;
758
+ representation: string;
759
+ name?: string;
760
+ graph_epoch: number;
761
+ storage_location: string;
762
+ garage_key?: string;
763
+ created_at: string;
764
+ }>;
765
+ /**
766
+ * Delete an artifact
767
+ */
768
+ deleteArtifact(artifactId: number): Promise<void>;
769
+ /**
770
+ * List groups
771
+ */
772
+ listGroups(params?: {
773
+ include_system?: boolean;
774
+ include_member_count?: boolean;
775
+ }): Promise<{
776
+ groups: any[];
777
+ total: number;
778
+ }>;
779
+ /**
780
+ * Create a group
781
+ */
782
+ createGroup(group: {
783
+ group_name: string;
784
+ display_name?: string;
785
+ description?: string;
786
+ }): Promise<any>;
787
+ /**
788
+ * List group members
789
+ */
790
+ listGroupMembers(groupId: number): Promise<{
791
+ group_id: number;
792
+ group_name: string;
793
+ members: any[];
794
+ total: number;
795
+ }>;
796
+ /**
797
+ * Add member to group
798
+ */
799
+ addGroupMember(groupId: number, userId: number): Promise<any>;
800
+ /**
801
+ * Remove member from group
802
+ */
803
+ removeGroupMember(groupId: number, userId: number): Promise<void>;
804
+ /**
805
+ * Create a resource grant
806
+ */
807
+ createGrant(grant: {
808
+ resource_type: string;
809
+ resource_id: string;
810
+ principal_type: 'user' | 'group';
811
+ principal_id: number;
812
+ permission: 'read' | 'write' | 'admin';
813
+ }): Promise<any>;
814
+ /**
815
+ * List grants for a resource
816
+ */
817
+ listResourceGrants(resourceType: string, resourceId: string): Promise<{
818
+ grants: any[];
819
+ total: number;
820
+ }>;
821
+ /**
822
+ * Revoke a grant
823
+ */
824
+ revokeGrant(grantId: number): Promise<void>;
825
+ /**
826
+ * List query definitions
827
+ */
828
+ listQueryDefinitions(params?: {
829
+ definition_type?: string;
830
+ limit?: number;
831
+ offset?: number;
832
+ }): Promise<{
833
+ definitions: any[];
834
+ total: number;
835
+ limit: number;
836
+ offset: number;
837
+ }>;
838
+ /**
839
+ * Get a query definition by ID
840
+ */
841
+ getQueryDefinition(definitionId: number): Promise<any>;
842
+ /**
843
+ * Create a query definition
844
+ */
845
+ createQueryDefinition(definition: {
846
+ name: string;
847
+ definition_type: string;
848
+ definition: Record<string, any>;
849
+ }): Promise<any>;
850
+ /**
851
+ * Update a query definition
852
+ */
853
+ updateQueryDefinition(definitionId: number, update: {
854
+ name?: string;
855
+ definition?: Record<string, any>;
856
+ }): Promise<any>;
857
+ /**
858
+ * Delete a query definition
859
+ */
860
+ deleteQueryDefinition(definitionId: number): Promise<void>;
861
+ }
862
+ /**
863
+ * Create a client from environment variables and config file
864
+ * Priority: CLI flags > env vars > config file > defaults
865
+ */
866
+ export declare function createClientFromEnv(): KnowledgeGraphClient;
867
+ //# sourceMappingURL=client.d.ts.map