@gencow/core 0.1.26 → 0.1.28
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/crud.d.ts +12 -0
- package/dist/crud.js +16 -0
- package/dist/db.d.ts +13 -0
- package/dist/db.js +16 -0
- package/dist/document-types.d.ts +65 -0
- package/dist/document-types.js +15 -0
- package/dist/grounded-answer-types.d.ts +62 -0
- package/dist/grounded-answer-types.js +6 -0
- package/dist/index.d.ts +12 -2
- package/dist/index.js +5 -1
- package/dist/rag-ingest-types.d.ts +39 -0
- package/dist/rag-ingest-types.js +1 -0
- package/dist/rag-operations-types.d.ts +81 -0
- package/dist/rag-operations-types.js +1 -0
- package/dist/rag-schema.d.ts +1557 -0
- package/dist/rag-schema.js +87 -0
- package/dist/reactive.d.ts +13 -0
- package/dist/rls-db.d.ts +9 -2
- package/dist/runtime-env-policy.d.ts +5 -0
- package/dist/runtime-env-policy.js +56 -0
- package/dist/search-types.d.ts +83 -0
- package/dist/search-types.js +1 -0
- package/dist/server.d.ts +1 -2
- package/dist/server.js +0 -1
- package/dist/storage-shared.d.ts +36 -0
- package/dist/storage-shared.js +39 -0
- package/dist/storage.d.ts +2 -26
- package/dist/storage.js +19 -15
- package/dist/workflow-types.d.ts +3 -1
- package/package.json +1 -1
- package/src/crud.ts +33 -0
- package/src/document-types.ts +95 -0
- package/src/grounded-answer-types.ts +78 -0
- package/src/index.ts +68 -2
- package/src/rag-ingest-types.ts +52 -0
- package/src/rag-operations-types.ts +90 -0
- package/src/rag-schema.ts +94 -0
- package/src/reactive.ts +13 -0
- package/src/rls-db.ts +9 -4
- package/src/runtime-env-policy.ts +66 -0
- package/src/search-types.ts +91 -0
- package/src/server.ts +1 -2
- package/src/storage-shared.ts +74 -0
- package/src/storage.ts +29 -46
- package/src/workflow-types.ts +3 -1
- package/src/__tests__/auth.test.ts +0 -118
- package/src/__tests__/crons.test.ts +0 -83
- package/src/__tests__/crud-codegen-integration.test.ts +0 -246
- package/src/__tests__/crud-owner-rls.test.ts +0 -387
- package/src/__tests__/crud.test.ts +0 -930
- package/src/__tests__/dist-exports.test.ts +0 -176
- package/src/__tests__/fixtures/basic/auth.ts +0 -32
- package/src/__tests__/fixtures/basic/drizzle.config.ts +0 -12
- package/src/__tests__/fixtures/basic/index.ts +0 -6
- package/src/__tests__/fixtures/basic/migrations/0000_last_warstar.sql +0 -75
- package/src/__tests__/fixtures/basic/migrations/meta/0000_snapshot.json +0 -497
- package/src/__tests__/fixtures/basic/migrations/meta/_journal.json +0 -13
- package/src/__tests__/fixtures/basic/schema.ts +0 -51
- package/src/__tests__/fixtures/basic/tasks.ts +0 -15
- package/src/__tests__/fixtures/common/auth-schema.ts +0 -67
- package/src/__tests__/helpers/basic-rls-fixture.ts +0 -135
- package/src/__tests__/helpers/pglite-migrations.ts +0 -32
- package/src/__tests__/helpers/pglite-rls-session.ts +0 -51
- package/src/__tests__/helpers/seed-like-fill.ts +0 -202
- package/src/__tests__/helpers/test-gencow-ctx-rls.ts +0 -50
- package/src/__tests__/httpaction.test.ts +0 -122
- package/src/__tests__/image-optimization.test.ts +0 -648
- package/src/__tests__/load.test.ts +0 -389
- package/src/__tests__/network-sim.test.ts +0 -319
- package/src/__tests__/reactive.test.ts +0 -479
- package/src/__tests__/retry.test.ts +0 -113
- package/src/__tests__/rls-crud-basic.test.ts +0 -317
- package/src/__tests__/rls-crud-no-owner-rls-pglite.test.ts +0 -117
- package/src/__tests__/rls-custom-mutation-handlers.test.ts +0 -142
- package/src/__tests__/rls-custom-query-handlers.test.ts +0 -128
- package/src/__tests__/rls-db-leased-connection.test.ts +0 -118
- package/src/__tests__/rls-session-and-policies.test.ts +0 -228
- package/src/__tests__/scheduler-durable-v2.test.ts +0 -288
- package/src/__tests__/scheduler-durable.test.ts +0 -173
- package/src/__tests__/scheduler-exec.test.ts +0 -328
- package/src/__tests__/scheduler.test.ts +0 -187
- package/src/__tests__/storage.test.ts +0 -334
- package/src/__tests__/tsconfig.json +0 -8
- package/src/__tests__/validator.test.ts +0 -323
- package/src/__tests__/workflow.test.ts +0 -606
- package/src/__tests__/ws-integration.test.ts +0 -309
- package/src/__tests__/ws-scale.test.ts +0 -241
- package/src/auth.ts +0 -155
package/dist/crud.d.ts
CHANGED
|
@@ -74,6 +74,18 @@ type CrudOptions<T extends PgTable> = {
|
|
|
74
74
|
*/
|
|
75
75
|
methods?: ("list" | "get" | "create" | "update" | "remove")[];
|
|
76
76
|
};
|
|
77
|
+
export interface CrudCodegenMeta {
|
|
78
|
+
tableName: string;
|
|
79
|
+
prefix: string;
|
|
80
|
+
methods: ("list" | "get" | "create" | "update" | "remove")[];
|
|
81
|
+
allowedFilters: string[];
|
|
82
|
+
searchFields: string[];
|
|
83
|
+
isPublic: boolean;
|
|
84
|
+
}
|
|
85
|
+
declare global {
|
|
86
|
+
var __gencow_crudCodegenRegistry: Map<string, CrudCodegenMeta>;
|
|
87
|
+
}
|
|
88
|
+
export declare function getRegisteredCrudCodegenMeta(): CrudCodegenMeta[];
|
|
77
89
|
/** 지원 연산자 목록 */
|
|
78
90
|
declare const FILTER_OPS: readonly ["eq", "ne", "gt", "gte", "lt", "lte", "in", "nin", "like", "ilike"];
|
|
79
91
|
type FilterOp = (typeof FILTER_OPS)[number];
|
package/dist/crud.js
CHANGED
|
@@ -46,6 +46,13 @@ const _ownerRlsTables = [];
|
|
|
46
46
|
export function getOwnerRlsTables() {
|
|
47
47
|
return _ownerRlsTables;
|
|
48
48
|
}
|
|
49
|
+
if (!globalThis.__gencow_crudCodegenRegistry) {
|
|
50
|
+
globalThis.__gencow_crudCodegenRegistry = new Map();
|
|
51
|
+
}
|
|
52
|
+
const crudCodegenRegistry = globalThis.__gencow_crudCodegenRegistry;
|
|
53
|
+
export function getRegisteredCrudCodegenMeta() {
|
|
54
|
+
return Array.from(crudCodegenRegistry.values());
|
|
55
|
+
}
|
|
49
56
|
// ─── Helpers ────────────────────────────────────────────
|
|
50
57
|
/**
|
|
51
58
|
* id 컬럼의 Drizzle dataType을 검사하여 적절한 validator를 반환.
|
|
@@ -353,6 +360,15 @@ export function crud(table, options) {
|
|
|
353
360
|
// ── methods 필터링: 지정된 메서드만 레지스트리 등록 ──
|
|
354
361
|
// methods 옵션 미지정 시 전체 5개 등록 (하위호환)
|
|
355
362
|
const enabledMethods = new Set(options?.methods ?? ["list", "get", "create", "update", "remove"]);
|
|
363
|
+
const enabledMethodsList = Array.from(enabledMethods);
|
|
364
|
+
crudCodegenRegistry.set(prefix, {
|
|
365
|
+
tableName,
|
|
366
|
+
prefix,
|
|
367
|
+
methods: enabledMethodsList,
|
|
368
|
+
allowedFilters: (options?.allowedFilters ?? []).map((field) => String(field)),
|
|
369
|
+
searchFields: (options?.searchFields ?? []).map((field) => String(field)),
|
|
370
|
+
isPublic,
|
|
371
|
+
});
|
|
356
372
|
// ── list ──────────────────────────────────────
|
|
357
373
|
const listDef = !enabledMethods.has("list")
|
|
358
374
|
? undefined
|
package/dist/db.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated — 레거시 싱글톤 DB 인스턴스.
|
|
3
|
+
* 새 코드에서는 ctx.db를 사용하세요.
|
|
4
|
+
* 서버의 createDatabase() (database.ts)가 실제 DB 연결을 관리합니다.
|
|
5
|
+
*/
|
|
6
|
+
import { PGlite } from "@electric-sql/pglite";
|
|
7
|
+
/** @deprecated Use ctx.db instead */
|
|
8
|
+
export declare function createDb(dataDir?: string): Promise<{
|
|
9
|
+
db: import("drizzle-orm/pglite").PgliteDatabase<Record<string, never>> & {
|
|
10
|
+
$client: PGlite;
|
|
11
|
+
};
|
|
12
|
+
client: PGlite;
|
|
13
|
+
}>;
|
package/dist/db.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated — 레거시 싱글톤 DB 인스턴스.
|
|
3
|
+
* 새 코드에서는 ctx.db를 사용하세요.
|
|
4
|
+
* 서버의 createDatabase() (database.ts)가 실제 DB 연결을 관리합니다.
|
|
5
|
+
*/
|
|
6
|
+
import { PGlite } from "@electric-sql/pglite";
|
|
7
|
+
import { drizzle } from "drizzle-orm/pglite";
|
|
8
|
+
let pgliteInstance = null;
|
|
9
|
+
/** @deprecated Use ctx.db instead */
|
|
10
|
+
export async function createDb(dataDir = "./data") {
|
|
11
|
+
if (!pgliteInstance) {
|
|
12
|
+
pgliteInstance = new PGlite(dataDir);
|
|
13
|
+
}
|
|
14
|
+
const db = drizzle(pgliteInstance);
|
|
15
|
+
return { db, client: pgliteInstance };
|
|
16
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
export type DocumentVisibility = "private" | "shared" | "public";
|
|
2
|
+
export type DocumentConvertMode = "auto" | "text-only" | "no-external-provider" | "prefer-external" | "force-external" | "force-ocr";
|
|
3
|
+
export type DocumentConvertProvider = "auto" | "local_text" | "gemini" | "openai" | "ocr" | "custom_vlm";
|
|
4
|
+
export type DocumentResolvedProvider = Exclude<DocumentConvertProvider, "auto">;
|
|
5
|
+
export type DocumentProviderRoute = "local_text" | "vlm" | "ocr_fallback";
|
|
6
|
+
export type DocumentCacheArtifact = "convert" | "embedding" | "summary" | "rerank";
|
|
7
|
+
export type DocumentConvertInput = {
|
|
8
|
+
storageId: string;
|
|
9
|
+
filename?: string;
|
|
10
|
+
mimeType?: string;
|
|
11
|
+
corpus: string;
|
|
12
|
+
visibility: DocumentVisibility;
|
|
13
|
+
ownerUserId?: string;
|
|
14
|
+
mode?: DocumentConvertMode;
|
|
15
|
+
provider?: DocumentConvertProvider;
|
|
16
|
+
};
|
|
17
|
+
export type DocumentPage = {
|
|
18
|
+
page: number;
|
|
19
|
+
charStart: number;
|
|
20
|
+
charEnd: number;
|
|
21
|
+
previewText?: string;
|
|
22
|
+
};
|
|
23
|
+
export type DocumentSection = {
|
|
24
|
+
id: string;
|
|
25
|
+
title?: string;
|
|
26
|
+
depth: number;
|
|
27
|
+
path: string[];
|
|
28
|
+
pageStart?: number;
|
|
29
|
+
pageEnd?: number;
|
|
30
|
+
charStart: number;
|
|
31
|
+
charEnd: number;
|
|
32
|
+
};
|
|
33
|
+
export type DocumentProviderTrace = {
|
|
34
|
+
provider: DocumentResolvedProvider;
|
|
35
|
+
route: DocumentProviderRoute;
|
|
36
|
+
external: boolean;
|
|
37
|
+
requestId?: string;
|
|
38
|
+
durationMs: number;
|
|
39
|
+
bytes: number;
|
|
40
|
+
};
|
|
41
|
+
export type DocumentConvertResult = {
|
|
42
|
+
text: string;
|
|
43
|
+
markdown: string;
|
|
44
|
+
pages: DocumentPage[];
|
|
45
|
+
sections: DocumentSection[];
|
|
46
|
+
warnings: string[];
|
|
47
|
+
providerTrace: DocumentProviderTrace;
|
|
48
|
+
};
|
|
49
|
+
export interface GencowServicesCtx {
|
|
50
|
+
}
|
|
51
|
+
export interface WorkflowDocumentServicesCtx {
|
|
52
|
+
document: {
|
|
53
|
+
convert(input: DocumentConvertInput): Promise<DocumentConvertResult>;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
export type DocumentCacheKeyInput = {
|
|
57
|
+
appId: string;
|
|
58
|
+
ownerUserId?: string | null;
|
|
59
|
+
corpus: string;
|
|
60
|
+
sourceKey: string;
|
|
61
|
+
checksum: string;
|
|
62
|
+
provider: DocumentResolvedProvider;
|
|
63
|
+
artifact: DocumentCacheArtifact;
|
|
64
|
+
};
|
|
65
|
+
export declare function buildDocumentCacheKey(input: DocumentCacheKeyInput): string;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
function normalizeCachePart(value) {
|
|
2
|
+
return value.trim() || "unknown";
|
|
3
|
+
}
|
|
4
|
+
export function buildDocumentCacheKey(input) {
|
|
5
|
+
const owner = input.ownerUserId?.trim() ? input.ownerUserId.trim() : "shared";
|
|
6
|
+
return [
|
|
7
|
+
`app:${normalizeCachePart(input.appId)}`,
|
|
8
|
+
`user:${normalizeCachePart(owner)}`,
|
|
9
|
+
`corpus:${normalizeCachePart(input.corpus)}`,
|
|
10
|
+
`source:${normalizeCachePart(input.sourceKey)}`,
|
|
11
|
+
`checksum:${normalizeCachePart(input.checksum)}`,
|
|
12
|
+
`provider:${normalizeCachePart(input.provider)}`,
|
|
13
|
+
`artifact:${normalizeCachePart(input.artifact)}`,
|
|
14
|
+
].join(":");
|
|
15
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { SearchFilter, SearchScope } from "./search-types.js";
|
|
2
|
+
export type CitationCoverage = "direct" | "partial" | "context";
|
|
3
|
+
export type ClaimSupportStatus = "supported" | "partially_supported" | "insufficient_evidence";
|
|
4
|
+
export type GroundedAnswerMode = "qa" | "compare" | "topic";
|
|
5
|
+
export type Citation = {
|
|
6
|
+
sourceId: string;
|
|
7
|
+
sourceTitle: string;
|
|
8
|
+
sectionId?: string;
|
|
9
|
+
sectionPath?: string[];
|
|
10
|
+
pageStart?: number;
|
|
11
|
+
pageEnd?: number;
|
|
12
|
+
chunkIds: string[];
|
|
13
|
+
snippet: string;
|
|
14
|
+
coverage: CitationCoverage;
|
|
15
|
+
confidence: number;
|
|
16
|
+
};
|
|
17
|
+
export type ClaimEvidenceMap = {
|
|
18
|
+
claimId: string;
|
|
19
|
+
claimText: string;
|
|
20
|
+
status: ClaimSupportStatus;
|
|
21
|
+
citations: Citation[];
|
|
22
|
+
missingEvidenceReasons?: string[];
|
|
23
|
+
};
|
|
24
|
+
export type GroundedAnswer = {
|
|
25
|
+
answer: string;
|
|
26
|
+
claims: ClaimEvidenceMap[];
|
|
27
|
+
citations: Citation[];
|
|
28
|
+
warnings: string[];
|
|
29
|
+
grounded: boolean;
|
|
30
|
+
};
|
|
31
|
+
export type GroundingBudget = {
|
|
32
|
+
maxVerifyLoops: number;
|
|
33
|
+
maxResearchQueriesPerLoop: number;
|
|
34
|
+
maxCitationsPerClaim: number;
|
|
35
|
+
maxClaimsPerAnswer: number;
|
|
36
|
+
};
|
|
37
|
+
export declare const DEFAULT_GROUNDING_BUDGET: GroundingBudget;
|
|
38
|
+
export type GroundedClaimInput = {
|
|
39
|
+
claimId?: string;
|
|
40
|
+
claimText: string;
|
|
41
|
+
requiredTerms?: string[];
|
|
42
|
+
};
|
|
43
|
+
export type GroundedCompareInput = {
|
|
44
|
+
left: string;
|
|
45
|
+
right: string;
|
|
46
|
+
};
|
|
47
|
+
export type GroundedTopicInput = {
|
|
48
|
+
minDistinctSections?: number;
|
|
49
|
+
};
|
|
50
|
+
export type GroundedAnswerInput = {
|
|
51
|
+
question: string;
|
|
52
|
+
scope: SearchScope;
|
|
53
|
+
filters?: SearchFilter;
|
|
54
|
+
claims?: GroundedClaimInput[];
|
|
55
|
+
mode?: GroundedAnswerMode;
|
|
56
|
+
compare?: GroundedCompareInput;
|
|
57
|
+
topic?: GroundedTopicInput;
|
|
58
|
+
budget?: Partial<GroundingBudget>;
|
|
59
|
+
};
|
|
60
|
+
export type GroundingRuntime = {
|
|
61
|
+
answer(input: GroundedAnswerInput): Promise<GroundedAnswer>;
|
|
62
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -5,8 +5,16 @@
|
|
|
5
5
|
* All with Convex-compatible DX patterns.
|
|
6
6
|
*/
|
|
7
7
|
export type { GencowCtx, AuthCtx, UserIdentity, QueryDef, MutationDef, RealtimeCtx, HttpActionDef, HttpActionRequest, HttpActionResponse, HttpActionHandler, AIContext, AIMessage, AIResult, } from "./reactive.js";
|
|
8
|
+
export type { SearchPrimitive, SearchScope, SearchFilter, SearchOptions, VectorSearchOptions, HybridSearchOptions, SearchHit, SearchResponse, SearchTierConfig, } from "./search-types.js";
|
|
9
|
+
export type { DocumentVisibility, DocumentConvertMode, DocumentConvertProvider, DocumentResolvedProvider, DocumentConvertInput, DocumentPage, DocumentSection, DocumentProviderTrace, DocumentConvertResult, DocumentCacheArtifact, DocumentCacheKeyInput, GencowServicesCtx, WorkflowDocumentServicesCtx, } from "./document-types.js";
|
|
10
|
+
export { buildDocumentCacheKey } from "./document-types.js";
|
|
11
|
+
export type { RagIngestReindexMode, RagIngestInput, RagIngestWorkflowArgs, RagIngestStartResult, RagIngestJobStatus, RagIngestJobRecord, } from "./rag-ingest-types.js";
|
|
12
|
+
export type { CitationCoverage, ClaimSupportStatus, GroundedAnswerMode, Citation, ClaimEvidenceMap, GroundedAnswer, GroundingBudget, GroundedClaimInput, GroundedCompareInput, GroundedTopicInput, GroundedAnswerInput, GroundingRuntime, } from "./grounded-answer-types.js";
|
|
13
|
+
export { DEFAULT_GROUNDING_BUDGET } from "./grounded-answer-types.js";
|
|
14
|
+
export type { RagOperationKind, RagOperationMetricUnit, RagIndexHealth, RagOperationMetric, RagOperationsSummary, RagEvaluationExpectedClaim, RagEvaluationFixture, RagEvaluationFixtureResult, RagEvaluationRunResult, RagReindexMode, RagReindexPlan, } from "./rag-operations-types.js";
|
|
15
|
+
export { ragCorpora, ragSources, ragSections, ragChunks, ragIngestJobs, ragOperationMetrics } from "./rag-schema.js";
|
|
8
16
|
export { query, mutation, httpAction, buildRealtimeCtx, subscribe, unsubscribe, registerClient, deregisterClient, handleWsMessage, getQueryHandler, getQueryDef, getRegisteredQueries, getRegisteredMutations, getRegisteredHttpActions, } from "./reactive.js";
|
|
9
|
-
export type { Storage } from "./storage.js";
|
|
17
|
+
export type { Storage, StoredFile } from "./storage.js";
|
|
10
18
|
export { createScheduler, getSchedulerInfo } from "./scheduler.js";
|
|
11
19
|
export type { Scheduler, ScheduleOptions, FailedJob, CreateSchedulerOptions, ScheduledJobRecord, } from "./scheduler.js";
|
|
12
20
|
export { workflow, getWorkflowDef, getRegisteredWorkflows, getWorkflowResumeActionName, getWorkflowRealtimeKey, createWorkflowRealtimeToken, serializeWorkflowValue, deserializeWorkflowValue, parseWorkflowDurationMs, DEFAULT_WORKFLOW_MAX_DURATION_MS, DEFAULT_WORKFLOW_MAX_RETRIES, WORKFLOW_RESUME_ACTION_PREFIX, WORKFLOW_REALTIME_KEY_PREFIX, } from "./workflow.js";
|
|
@@ -17,6 +25,7 @@ export { v, parseArgs, GencowValidationError } from "./v.js";
|
|
|
17
25
|
export type { Validator, Infer, InferArgs } from "./v.js";
|
|
18
26
|
export { withRetry } from "./retry.js";
|
|
19
27
|
export type { RetryOptions } from "./retry.js";
|
|
28
|
+
export { filterTenantRuntimeEnvVars, isReservedTenantRuntimeEnvKey } from "./runtime-env-policy.js";
|
|
20
29
|
export { cronJobs } from "./crons.js";
|
|
21
30
|
export type { CronJobsBuilder, CronJobDef, IntervalOptions, DailyOptions, WeeklyOptions } from "./crons.js";
|
|
22
31
|
export { defineAuth } from "./auth-config.js";
|
|
@@ -25,5 +34,6 @@ export { ownerRls, getOwnerRlsMeta, registerOwnerRls } from "./rls.js";
|
|
|
25
34
|
export type { OwnerRlsMeta } from "./rls.js";
|
|
26
35
|
export { createRlsDb } from "./rls-db.js";
|
|
27
36
|
export type { RlsSessionContext } from "./rls-db.js";
|
|
28
|
-
export { crud, parseFilterNode, applyFilterOp, getOwnerRlsTables } from "./crud.js";
|
|
37
|
+
export { crud, parseFilterNode, applyFilterOp, getOwnerRlsTables, getRegisteredCrudCodegenMeta } from "./crud.js";
|
|
38
|
+
export type { CrudCodegenMeta } from "./crud.js";
|
|
29
39
|
export { crud as gencowCrud } from "./crud.js";
|
package/dist/index.js
CHANGED
|
@@ -4,6 +4,9 @@
|
|
|
4
4
|
* Provides: query, mutation, storage, scheduler, auth
|
|
5
5
|
* All with Convex-compatible DX patterns.
|
|
6
6
|
*/
|
|
7
|
+
export { buildDocumentCacheKey } from "./document-types.js";
|
|
8
|
+
export { DEFAULT_GROUNDING_BUDGET } from "./grounded-answer-types.js";
|
|
9
|
+
export { ragCorpora, ragSources, ragSections, ragChunks, ragIngestJobs, ragOperationMetrics } from "./rag-schema.js";
|
|
7
10
|
export { query, mutation, httpAction, buildRealtimeCtx, subscribe, unsubscribe, registerClient, deregisterClient, handleWsMessage, getQueryHandler, getQueryDef, getRegisteredQueries, getRegisteredMutations, getRegisteredHttpActions, } from "./reactive.js";
|
|
8
11
|
export { createScheduler, getSchedulerInfo } from "./scheduler.js";
|
|
9
12
|
export { workflow, getWorkflowDef, getRegisteredWorkflows, getWorkflowResumeActionName, getWorkflowRealtimeKey, createWorkflowRealtimeToken, serializeWorkflowValue, deserializeWorkflowValue, parseWorkflowDurationMs, DEFAULT_WORKFLOW_MAX_DURATION_MS, DEFAULT_WORKFLOW_MAX_RETRIES, WORKFLOW_RESUME_ACTION_PREFIX, WORKFLOW_REALTIME_KEY_PREFIX, } from "./workflow.js";
|
|
@@ -11,11 +14,12 @@ export { deriveWorkflowStatus } from "./workflow-types.js";
|
|
|
11
14
|
export { loadWorkflowSnapshot } from "./workflows-api.js";
|
|
12
15
|
export { v, parseArgs, GencowValidationError } from "./v.js";
|
|
13
16
|
export { withRetry } from "./retry.js";
|
|
17
|
+
export { filterTenantRuntimeEnvVars, isReservedTenantRuntimeEnvKey } from "./runtime-env-policy.js";
|
|
14
18
|
export { cronJobs } from "./crons.js";
|
|
15
19
|
export { defineAuth } from "./auth-config.js";
|
|
16
20
|
// ─── RLS + CRUD Factory ───────────
|
|
17
21
|
export { ownerRls, getOwnerRlsMeta, registerOwnerRls } from "./rls.js";
|
|
18
22
|
export { createRlsDb } from "./rls-db.js";
|
|
19
|
-
export { crud, parseFilterNode, applyFilterOp, getOwnerRlsTables } from "./crud.js";
|
|
23
|
+
export { crud, parseFilterNode, applyFilterOp, getOwnerRlsTables, getRegisteredCrudCodegenMeta } from "./crud.js";
|
|
20
24
|
// Deprecated alias — 하위호환용, 향후 메이저 버전에서 제거 예정
|
|
21
25
|
export { crud as gencowCrud } from "./crud.js";
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { DocumentConvertProvider, DocumentConvertMode, DocumentProviderTrace, DocumentVisibility } from "./document-types.js";
|
|
2
|
+
export type RagIngestReindexMode = "if_changed" | "force";
|
|
3
|
+
export type RagIngestJobStatus = "queued" | "converting" | "chunking" | "embedding" | "upserting" | "completed" | "failed" | "canceled";
|
|
4
|
+
export type RagIngestInput = {
|
|
5
|
+
storageId: string;
|
|
6
|
+
corpus: string;
|
|
7
|
+
visibility: DocumentVisibility;
|
|
8
|
+
ownerUserId?: string;
|
|
9
|
+
sourceKey?: string;
|
|
10
|
+
metadata?: Record<string, unknown>;
|
|
11
|
+
reindexMode?: RagIngestReindexMode;
|
|
12
|
+
mode?: DocumentConvertMode;
|
|
13
|
+
provider?: DocumentConvertProvider;
|
|
14
|
+
};
|
|
15
|
+
export type RagIngestWorkflowArgs = RagIngestInput & {
|
|
16
|
+
jobId: string;
|
|
17
|
+
sourceId: string;
|
|
18
|
+
};
|
|
19
|
+
export type RagIngestStartResult = {
|
|
20
|
+
workflowId: string;
|
|
21
|
+
jobId: string;
|
|
22
|
+
sourceId: string;
|
|
23
|
+
status: "queued";
|
|
24
|
+
};
|
|
25
|
+
export type RagIngestJobRecord = {
|
|
26
|
+
id: string;
|
|
27
|
+
workflowId: string;
|
|
28
|
+
sourceId: string;
|
|
29
|
+
corpus: string;
|
|
30
|
+
visibility: DocumentVisibility;
|
|
31
|
+
ownerUserId: string | null;
|
|
32
|
+
status: RagIngestJobStatus;
|
|
33
|
+
stage: string;
|
|
34
|
+
providerTrace: Partial<DocumentProviderTrace> | Record<string, never>;
|
|
35
|
+
metrics: Record<string, unknown>;
|
|
36
|
+
error: string | null;
|
|
37
|
+
startedAt: string;
|
|
38
|
+
completedAt: string | null;
|
|
39
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { SearchScope } from "./search-types.js";
|
|
2
|
+
export type RagOperationKind = "ingest" | "retrieve" | "answer" | "reindex" | "evaluate";
|
|
3
|
+
export type RagOperationMetricUnit = "ms" | "count" | "tokens" | "usd";
|
|
4
|
+
export type RagIndexHealth = "ready" | "empty" | "degraded" | "failed";
|
|
5
|
+
export type RagOperationMetric = {
|
|
6
|
+
id: string;
|
|
7
|
+
appId: string;
|
|
8
|
+
corpus: string;
|
|
9
|
+
visibility: SearchScope["visibility"];
|
|
10
|
+
ownerUserId: string | null;
|
|
11
|
+
operation: RagOperationKind;
|
|
12
|
+
jobId: string | null;
|
|
13
|
+
workflowId: string | null;
|
|
14
|
+
sourceId: string | null;
|
|
15
|
+
metricName: string;
|
|
16
|
+
metricValue: number;
|
|
17
|
+
unit: RagOperationMetricUnit | null;
|
|
18
|
+
metadata: Record<string, unknown>;
|
|
19
|
+
recordedAt: string;
|
|
20
|
+
};
|
|
21
|
+
export type RagOperationsSummary = {
|
|
22
|
+
corpus: string;
|
|
23
|
+
visibility: SearchScope["visibility"];
|
|
24
|
+
ownerUserId: string | null;
|
|
25
|
+
sourceCount: number;
|
|
26
|
+
sectionCount: number;
|
|
27
|
+
chunkCount: number;
|
|
28
|
+
jobCounts: Record<string, number>;
|
|
29
|
+
latestJob: {
|
|
30
|
+
id: string;
|
|
31
|
+
status: string;
|
|
32
|
+
stage: string;
|
|
33
|
+
updatedAt: string;
|
|
34
|
+
} | null;
|
|
35
|
+
recentMetricCounts: Record<string, number>;
|
|
36
|
+
averageLatencyMs: number | null;
|
|
37
|
+
indexHealth: RagIndexHealth;
|
|
38
|
+
};
|
|
39
|
+
export type RagEvaluationExpectedClaim = {
|
|
40
|
+
claim: string;
|
|
41
|
+
verdict: "supported" | "partial" | "unsupported";
|
|
42
|
+
};
|
|
43
|
+
export type RagEvaluationFixture = {
|
|
44
|
+
name: string;
|
|
45
|
+
scope: SearchScope;
|
|
46
|
+
query: string;
|
|
47
|
+
expectedSourceIds?: string[];
|
|
48
|
+
expectedCitationCountMin?: number;
|
|
49
|
+
expectedClaims?: RagEvaluationExpectedClaim[];
|
|
50
|
+
};
|
|
51
|
+
export type RagEvaluationFixtureResult = {
|
|
52
|
+
name: string;
|
|
53
|
+
ok: boolean;
|
|
54
|
+
failures: string[];
|
|
55
|
+
matchedSourceIds: string[];
|
|
56
|
+
citationCount: number;
|
|
57
|
+
claimStatuses: Array<{
|
|
58
|
+
claim: string;
|
|
59
|
+
expected: RagEvaluationExpectedClaim["verdict"];
|
|
60
|
+
actual: string | null;
|
|
61
|
+
}>;
|
|
62
|
+
};
|
|
63
|
+
export type RagEvaluationRunResult = {
|
|
64
|
+
ok: boolean;
|
|
65
|
+
total: number;
|
|
66
|
+
passed: number;
|
|
67
|
+
failed: number;
|
|
68
|
+
results: RagEvaluationFixtureResult[];
|
|
69
|
+
};
|
|
70
|
+
export type RagReindexMode = "source-changed" | "section-changed" | "corpus-policy-changed" | "full-rebuild";
|
|
71
|
+
export type RagReindexPlan = {
|
|
72
|
+
corpus: string;
|
|
73
|
+
visibility: SearchScope["visibility"];
|
|
74
|
+
ownerUserId: string | null;
|
|
75
|
+
mode: RagReindexMode;
|
|
76
|
+
reason: string;
|
|
77
|
+
sourceIds: string[];
|
|
78
|
+
sourceCount: number;
|
|
79
|
+
estimatedChunkCount: number;
|
|
80
|
+
requiresConfirmation: boolean;
|
|
81
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|