@opengeni/documents 0.5.18 → 0.5.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/atlassian.d.ts +78 -0
- package/dist/atlassian.js +140 -0
- package/dist/atlassian.js.map +1 -0
- package/dist/google-drive.d.ts +2 -0
- package/dist/google-drive.js +12 -1
- package/dist/google-drive.js.map +1 -1
- package/dist/index.d.ts +74 -4
- package/dist/index.js +645 -27
- package/dist/index.js.map +1 -1
- package/dist/knowledge-projection.d.ts +14 -0
- package/package.json +10 -6
- package/src/atlassian.ts +250 -0
- package/src/google-drive.ts +21 -1
- package/src/index.ts +674 -26
- package/src/knowledge-projection.ts +214 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { Settings } from "@opengeni/config";
|
|
2
|
-
import type { AddDocumentRequest, CreateDocumentBaseRequest, Document, DocumentAuthorityKind, DocumentBase, DocumentCurationStatus, DocumentSearchMode, DocumentSearchResult, DocumentStatus, DocumentVisibility, FileAsset, KnowledgeSourceKind } from "@opengeni/contracts";
|
|
2
|
+
import type { AddDocumentRequest, CreateDocumentBaseRequest, Document, DocumentAuthorityKind, DocumentBase, DocumentCurationStatus, DocumentSearchMode, DocumentSearchResult, DocumentStatus, DocumentVisibility, FileAsset, KnowledgeBrowseResponse, KnowledgeRecord, KnowledgeSearchResponse, KnowledgeSourceKind, ListIndexedDocumentsResponse } from "@opengeni/contracts";
|
|
3
3
|
import { type Database } from "@opengeni/db";
|
|
4
4
|
import type { ObjectStorage } from "@opengeni/storage";
|
|
5
|
+
export { projectKnowledgeRecord } from "./knowledge-projection.js";
|
|
5
6
|
export declare const DEFAULT_DOCUMENT_PARSER = "liteparse";
|
|
6
7
|
export declare const DEFAULT_DOCUMENT_EMBEDDING_MODEL = "text-embedding-3-large";
|
|
7
8
|
export declare const DEFAULT_DOCUMENT_EMBEDDING_DIMENSIONS = 3072;
|
|
@@ -10,6 +11,7 @@ export declare const DEFAULT_DOCUMENT_CHUNK_OVERLAP = 160;
|
|
|
10
11
|
export declare const DEFAULT_DOCUMENT_CURATION_MODEL = "gpt-4o-mini";
|
|
11
12
|
export declare const DOCUMENT_CURATION_MAX_INPUT_CHARS = 24000;
|
|
12
13
|
export declare const DOCUMENT_AUTHORITY_SUBJECT_MAX_BYTES = 1024;
|
|
14
|
+
export declare const DOCUMENT_INDEX_CHECKPOINT_MAX_CHARS = 1024;
|
|
13
15
|
export declare const DOCUMENT_CURATION_AUTO_FILE_CONFIDENCE = 0.75;
|
|
14
16
|
export declare const DEFAULT_BASE_NAME = "Default";
|
|
15
17
|
export declare const DEFAULT_BASE_DESCRIPTION = "Default base for dropped files and notes.";
|
|
@@ -134,6 +136,26 @@ export type EffectiveDocumentSearchInput = Omit<DocumentSearchInput, "access"> &
|
|
|
134
136
|
/** Agent retrieval additionally enforces documents.agent_access. */
|
|
135
137
|
surface: "human" | "agent";
|
|
136
138
|
};
|
|
139
|
+
export type ListEffectiveIndexedDocumentsInput = {
|
|
140
|
+
accountId: string;
|
|
141
|
+
workspaceId: string;
|
|
142
|
+
/** Immutable human subject accepted for the logical request/turn. */
|
|
143
|
+
initiatingSubjectId: string;
|
|
144
|
+
checkpoint?: string | undefined;
|
|
145
|
+
limit?: number | undefined;
|
|
146
|
+
};
|
|
147
|
+
export type EffectiveKnowledgeBrowseInput = {
|
|
148
|
+
accountId: string;
|
|
149
|
+
workspaceId: string;
|
|
150
|
+
/** Immutable human subject accepted for the logical request/turn. */
|
|
151
|
+
initiatingSubjectId: string;
|
|
152
|
+
/** Omit to browse top-level documents; pass a document record id for chunks. */
|
|
153
|
+
parentId?: string | undefined;
|
|
154
|
+
topic?: string | undefined;
|
|
155
|
+
sourceKinds?: KnowledgeSourceKind[] | undefined;
|
|
156
|
+
cursor?: string | undefined;
|
|
157
|
+
limit?: number | undefined;
|
|
158
|
+
};
|
|
137
159
|
export type DocumentIndexHooks = {
|
|
138
160
|
beforeEmbed?: (input: {
|
|
139
161
|
accountId: string;
|
|
@@ -156,7 +178,7 @@ export declare class RecursiveTextChunker implements DocumentChunker {
|
|
|
156
178
|
chunk(parsed: ParsedDocument, file: FileAsset): DocumentChunk[];
|
|
157
179
|
}
|
|
158
180
|
export declare class OpenAIEmbeddingProvider implements DocumentEmbedder {
|
|
159
|
-
private
|
|
181
|
+
private clientPromise;
|
|
160
182
|
private readonly apiKey;
|
|
161
183
|
private readonly baseURL;
|
|
162
184
|
constructor(args: {
|
|
@@ -195,7 +217,7 @@ export declare class HeuristicCurationProvider implements DocumentCurator {
|
|
|
195
217
|
curate(input: DocumentCurationInput): Promise<DocumentCurationOutcome>;
|
|
196
218
|
}
|
|
197
219
|
export declare class OpenAICurationProvider implements DocumentCurator {
|
|
198
|
-
private
|
|
220
|
+
private clientPromise;
|
|
199
221
|
private readonly apiKey;
|
|
200
222
|
private readonly baseURL;
|
|
201
223
|
private readonly defaultHeaders;
|
|
@@ -262,6 +284,7 @@ export declare function addDocumentToBase(db: Database, input: AddDocumentReques
|
|
|
262
284
|
organizationAuthorityGranted?: boolean | undefined;
|
|
263
285
|
curationStatus?: DocumentCurationStatus | undefined;
|
|
264
286
|
access?: DocumentAccessFilter | undefined;
|
|
287
|
+
knowledgeSourceIdentity?: string | null | undefined;
|
|
265
288
|
}): Promise<Document>;
|
|
266
289
|
/**
|
|
267
290
|
* Move a document and its indexed chunks to another base. With no explicit
|
|
@@ -285,6 +308,24 @@ export declare function deleteDocumentFromBase(db: Database, input: {
|
|
|
285
308
|
access?: DocumentAccessFilter | undefined;
|
|
286
309
|
}): Promise<void>;
|
|
287
310
|
export declare function listDocuments(db: Database, workspaceId: string, baseId: string, access?: DocumentAccessFilter): Promise<Document[]>;
|
|
311
|
+
/**
|
|
312
|
+
* List newly ready documents in the same effective scope used by agent
|
|
313
|
+
* retrieval. The opaque checkpoint is bound to the account, requesting
|
|
314
|
+
* workspace, and immutable initiating subject, so it cannot be reused across
|
|
315
|
+
* scheduled-task authority boundaries.
|
|
316
|
+
*/
|
|
317
|
+
export declare function listEffectiveIndexedDocuments(db: Database, input: ListEffectiveIndexedDocumentsInput): Promise<ListIndexedDocumentsResponse>;
|
|
318
|
+
export declare function encodeDocumentIndexCheckpoint(input: {
|
|
319
|
+
accountId: string;
|
|
320
|
+
workspaceId: string;
|
|
321
|
+
initiatingSubjectId: string;
|
|
322
|
+
sequence: bigint;
|
|
323
|
+
}): string;
|
|
324
|
+
export declare function decodeDocumentIndexCheckpoint(value: string, scope: {
|
|
325
|
+
accountId: string;
|
|
326
|
+
workspaceId: string;
|
|
327
|
+
initiatingSubjectId: string;
|
|
328
|
+
}): bigint;
|
|
288
329
|
export declare function getDocument(db: Database, workspaceId: string, documentId: string, access?: DocumentAccessFilter): Promise<Document | null>;
|
|
289
330
|
export declare function queueDocumentForReindex(db: Database, workspaceId: string, documentId: string, access?: DocumentAccessFilter, organizationAuthorityGranted?: boolean): Promise<Document>;
|
|
290
331
|
export declare function indexDocumentNow(db: Database, objectStorage: ObjectStorage, workspaceId: string, documentId: string, services?: DocumentServices, hooks?: DocumentIndexHooks, access?: DocumentAccessFilter): Promise<Document>;
|
|
@@ -295,6 +336,36 @@ export declare function searchDocuments(db: Database, input: DocumentSearchInput
|
|
|
295
336
|
* request/tool input can replace it with another user's personal authority.
|
|
296
337
|
*/
|
|
297
338
|
export declare function searchEffectiveDocuments(db: Database, input: EffectiveDocumentSearchInput, services?: Pick<DocumentServices, "embedder">): Promise<DocumentSearchResult[]>;
|
|
339
|
+
/**
|
|
340
|
+
* Agent-facing Knowledge search over the existing Documents evidence store.
|
|
341
|
+
* Search selects candidates only after authority filtering; this second read
|
|
342
|
+
* rechecks every exact chunk before projecting it, so a record revoked between
|
|
343
|
+
* ranking and response construction disappears rather than leaking stale data.
|
|
344
|
+
*/
|
|
345
|
+
export declare function searchEffectiveKnowledge(db: Database, input: EffectiveDocumentSearchInput, services?: Pick<DocumentServices, "embedder">): Promise<KnowledgeSearchResponse>;
|
|
346
|
+
/** Fetch one stable Knowledge record with a fresh authorization check. */
|
|
347
|
+
export declare function getEffectiveKnowledgeRecord(db: Database, input: {
|
|
348
|
+
accountId: string;
|
|
349
|
+
workspaceId: string;
|
|
350
|
+
initiatingSubjectId: string;
|
|
351
|
+
id: string;
|
|
352
|
+
}): Promise<KnowledgeRecord | null>;
|
|
353
|
+
/**
|
|
354
|
+
* Browse top-level authorized documents or the chunks of one authorized
|
|
355
|
+
* document. The cursor is opaque and bound to the caller, workspace, parent,
|
|
356
|
+
* and filters. It can change pagination position but can never widen scope.
|
|
357
|
+
*/
|
|
358
|
+
export declare function browseEffectiveKnowledge(db: Database, input: EffectiveKnowledgeBrowseInput): Promise<KnowledgeBrowseResponse>;
|
|
359
|
+
type KnowledgeBrowseCursorScope = {
|
|
360
|
+
accountId: string;
|
|
361
|
+
workspaceId: string;
|
|
362
|
+
initiatingSubjectId: string;
|
|
363
|
+
parentId: string | null;
|
|
364
|
+
topic: string | null;
|
|
365
|
+
sourceKinds: readonly string[];
|
|
366
|
+
};
|
|
367
|
+
export declare function encodeKnowledgeBrowseCursor(scope: KnowledgeBrowseCursorScope, position: bigint): string;
|
|
368
|
+
export declare function decodeKnowledgeBrowseCursor(value: string, scope: KnowledgeBrowseCursorScope): bigint;
|
|
298
369
|
export declare function getDocumentChunk(db: Database, accountId: string, workspaceId: string, chunkId: string, access?: DocumentAccessFilter): Promise<DocumentSearchResult | null>;
|
|
299
370
|
export declare function resolveDocumentAuthority(input: {
|
|
300
371
|
kind?: DocumentAuthorityKind | undefined;
|
|
@@ -321,4 +392,3 @@ type DocumentAccessRecord = {
|
|
|
321
392
|
export declare function parseDocumentBytes(bytes: Uint8Array, file: FileAsset, parser?: DocumentParser): Promise<ParsedDocument>;
|
|
322
393
|
export declare function chunkText(text: string, maxChars?: number, overlapChars?: number): string[];
|
|
323
394
|
export declare function deterministicEmbedding(text: string, dimensions?: number): number[];
|
|
324
|
-
export {};
|