gencow 0.1.299 → 0.2.0
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/bin/gencow.mjs +0 -6
- package/core/package.json +1 -1
- package/docs/packaging.md +14 -4
- package/lib/cli-artifact-guard.mjs +53 -3
- package/lib/cli-dev-runtime.mjs +1 -0
- package/lib/cli-project-runtime.mjs +26 -14
- package/lib/codegen-command.mjs +16 -0
- package/lib/coding-guardrails.mjs +2 -0
- package/lib/dashboard-artifact.mjs +65 -0
- package/lib/dashboard-assets.mjs +20 -0
- package/lib/db-command.mjs +121 -80
- package/lib/db-migration-command-steps.mjs +19 -16
- package/lib/db-push-command.mjs +1 -1
- package/lib/deploy-codegen-preflight.mjs +1 -0
- package/lib/dev-cloud-command.mjs +1 -1
- package/lib/dev-local-command.mjs +19 -56
- package/lib/document-local-converter.mjs +11 -0
- package/lib/local-dashboard-plan.mjs +60 -0
- package/lib/local-database-commands.mjs +127 -0
- package/lib/local-development-migrations.mjs +157 -0
- package/lib/local-drizzle-database.config.mjs +10 -0
- package/lib/local-runtime-features.mjs +12 -0
- package/lib/rag-selection.mjs +7 -0
- package/lib/runtime-local-worker.mjs +116 -0
- package/lib/runtime-mode.mjs +3 -0
- package/lib/standalone-codegen-adapter.mjs +91 -0
- package/lib/ts-codegen-import-extension.mjs +228 -19
- package/package.json +16 -9
- package/runtime/config.mjs +218 -2
- package/runtime/engine/chunk-2HA4CUMS.mjs +90 -0
- package/runtime/engine/chunk-2JLO3KMM.mjs +305 -0
- package/runtime/engine/chunk-2SR2M7SR.mjs +1045 -0
- package/runtime/engine/chunk-3D7MHEUC.mjs +253 -0
- package/runtime/engine/chunk-3R7COBWG.mjs +309 -0
- package/runtime/engine/chunk-3ZKA54UW.mjs +1560 -0
- package/runtime/engine/chunk-45I4YR2J.mjs +9 -0
- package/runtime/engine/chunk-4MLRXO7F.mjs +74 -0
- package/runtime/engine/chunk-5575APCJ.mjs +215 -0
- package/runtime/engine/chunk-5GUJZQF3.mjs +114 -0
- package/runtime/engine/chunk-5MXY3T75.mjs +428 -0
- package/runtime/engine/chunk-5TACQ2US.mjs +44 -0
- package/runtime/engine/chunk-66G4YEDT.mjs +3104 -0
- package/runtime/engine/chunk-67YO53WW.mjs +1426 -0
- package/runtime/engine/chunk-6GQRM7XY.mjs +87 -0
- package/runtime/engine/chunk-6JO72SPP.mjs +68 -0
- package/runtime/engine/chunk-6W653LXI.mjs +13 -0
- package/runtime/engine/chunk-7ITSMI3S.mjs +69 -0
- package/runtime/engine/chunk-7KUJ2H2S.mjs +128 -0
- package/runtime/engine/chunk-A5BMQ5IC.mjs +45 -0
- package/runtime/engine/chunk-ADF3UR6L.mjs +428 -0
- package/runtime/engine/chunk-AEBW7XZJ.mjs +4510 -0
- package/runtime/engine/chunk-AGPQ5XIV.mjs +156 -0
- package/runtime/engine/chunk-CPU4OZSX.mjs +753 -0
- package/runtime/engine/chunk-CSWPPWBL.mjs +50 -0
- package/runtime/engine/chunk-DPWXSMWO.mjs +53 -0
- package/runtime/engine/chunk-EAIELFKU.mjs +151 -0
- package/runtime/engine/chunk-EDU5CBKT.mjs +10 -0
- package/runtime/engine/chunk-EQCTAET7.mjs +173 -0
- package/runtime/engine/chunk-EQCXDF2Z.mjs +70 -0
- package/runtime/engine/chunk-F3G4UGV4.mjs +330 -0
- package/runtime/engine/chunk-F62NUNOO.mjs +26 -0
- package/runtime/engine/chunk-FKPNIFRP.mjs +2492 -0
- package/runtime/engine/chunk-FM23RGVI.mjs +81 -0
- package/runtime/engine/chunk-FW5AK4YP.mjs +1041 -0
- package/runtime/engine/chunk-GDWYAGWV.mjs +23 -0
- package/runtime/engine/chunk-GO5PZUYW.mjs +53 -0
- package/runtime/engine/chunk-GOLP7OSG.mjs +340 -0
- package/runtime/engine/chunk-GSLM44EF.mjs +242 -0
- package/runtime/engine/chunk-GYAJ7OX2.mjs +125 -0
- package/runtime/engine/chunk-I3GWR43K.mjs +14 -0
- package/runtime/engine/chunk-IFMOTJNU.mjs +106 -0
- package/runtime/engine/chunk-IKQKBE2G.mjs +128 -0
- package/runtime/engine/chunk-ITH2NEKM.mjs +282 -0
- package/runtime/engine/chunk-J6SDRCG4.mjs +96 -0
- package/runtime/engine/chunk-JODRNM3S.mjs +29596 -0
- package/runtime/engine/chunk-JUDKX53X.mjs +137 -0
- package/runtime/engine/chunk-K2YZVPJ4.mjs +827 -0
- package/runtime/engine/chunk-KEZJUXEE.mjs +151 -0
- package/runtime/engine/chunk-KVLTJFCH.mjs +234 -0
- package/runtime/engine/chunk-KX2PRQPS.mjs +126 -0
- package/runtime/engine/chunk-LEW5ZMLR.mjs +76 -0
- package/runtime/engine/chunk-LINVSJEM.mjs +175 -0
- package/runtime/engine/chunk-M7K2ICSM.mjs +11 -0
- package/runtime/engine/chunk-MZXDXSDC.mjs +292 -0
- package/runtime/engine/chunk-N2TA2IK2.mjs +678 -0
- package/runtime/engine/chunk-N4LTCKJP.mjs +695 -0
- package/runtime/engine/chunk-N6GCLOUX.mjs +13 -0
- package/runtime/engine/chunk-NAG2OXS5.mjs +37 -0
- package/runtime/engine/chunk-NNZ2QJUG.mjs +381 -0
- package/runtime/engine/chunk-NZPPLDNW.mjs +15 -0
- package/runtime/engine/chunk-ODWM57W6.mjs +138 -0
- package/runtime/engine/chunk-P5IIXAIE.mjs +23 -0
- package/runtime/engine/chunk-PBOXB2BV.mjs +6 -0
- package/runtime/engine/chunk-PMOJLN2P.mjs +8 -0
- package/runtime/engine/chunk-PZFMKFHO.mjs +180 -0
- package/runtime/engine/chunk-QL2TQX2N.mjs +114 -0
- package/runtime/engine/chunk-RITT2RSJ.mjs +258 -0
- package/runtime/engine/chunk-RODBVJ5M.mjs +135 -0
- package/runtime/engine/chunk-RW65MPVY.mjs +261 -0
- package/runtime/engine/chunk-S67UYPB6.mjs +25 -0
- package/runtime/engine/chunk-SVJCOUI3.mjs +47 -0
- package/runtime/engine/chunk-TCN3ZASV.mjs +957 -0
- package/runtime/engine/chunk-U2NRG6KC.mjs +32 -0
- package/runtime/engine/chunk-UM3F7HUV.mjs +432 -0
- package/runtime/engine/chunk-VWU7JJ3P.mjs +146 -0
- package/runtime/engine/chunk-WDTKPPMU.mjs +310 -0
- package/runtime/engine/chunk-WJOO4XTB.mjs +31 -0
- package/runtime/engine/chunk-XNFVL2OY.mjs +63 -0
- package/runtime/engine/chunk-XPWJXP2J.mjs +58 -0
- package/runtime/engine/chunk-Y3HSBJ3I.mjs +1132 -0
- package/runtime/engine/chunk-YMH4RYSX.mjs +317 -0
- package/runtime/engine/chunk-YNOMPSGS.mjs +8 -0
- package/runtime/engine/chunk-YRBAYTEZ.mjs +251 -0
- package/runtime/engine/chunk-YRHM272W.mjs +528 -0
- package/runtime/engine/chunk-ZQUZAGIQ.mjs +149 -0
- package/runtime/engine/chunk-ZXMM7QFP.mjs +176 -0
- package/runtime/engine/chunk-ZZJSIPV2.mjs +262 -0
- package/runtime/engine/composition.mjs +325 -0
- package/runtime/engine/document-local.mjs +504 -0
- package/runtime/engine/graph.json +4134 -0
- package/runtime/engine/index.mjs +265 -0
- package/runtime/engine/local-postgres-support.mjs +69 -0
- package/runtime/engine/local.mjs +3275 -0
- package/runtime/engine/pglite-directory-lock.mjs +8 -0
- package/runtime/engine/rag.mjs +11 -0
- package/runtime/engine/search.mjs +18 -0
- package/runtime/framework-migrations/foundation-bootstrap/rag.sql +115 -0
- package/runtime/framework-migrations/foundation-bootstrap/workflow.sql +194 -0
- package/runtime/framework-migrations/journal-bootstrap/migration.sql +26 -0
- package/runtime/framework-migrations/manifest.json +56 -0
- package/runtime/framework-migrations/rag/20261006111509_mushy_warhawk/migration.sql +121 -0
- package/runtime/framework-migrations/rag/20261013234621_rag_v2_lifecycle_markers/migration.sql +6 -0
- package/runtime/framework-migrations/workflow/20261006111508_perpetual_star_brand/migration.sql +31 -0
- package/runtime/runtime-metadata.json +27 -0
- package/runtime/tooling.mjs +10399 -8951
- package/scripts/bundle-runtime-config.mjs +23 -0
- package/scripts/bundle-runtime.mjs +100 -0
- package/scripts/bundle-runtime.test.mjs +33 -0
- package/scripts/bundle-shared.mjs +3 -0
- package/scripts/copy-dashboard.mjs +16 -0
- package/scripts/pre-publish-check.mjs +23 -11
- package/templateFeature/sso/sso-auth-callback.tsx +37 -5
- package/templateFeature/tools/manifest.json +2 -1
- package/templateFeature/tools/tools.ts +3 -3
- package/runtime/server.mjs +0 -14389
- package/scripts/bundle-server.mjs +0 -223
- package/server/config.js +0 -1
- package/server/index.js +0 -1
- package/server/package.json +0 -6
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import {
|
|
2
|
+
captureRuntimeRagSelection,
|
|
3
|
+
createConfiguredRagEmbeddingTransport
|
|
4
|
+
} from "./chunk-3R7COBWG.mjs";
|
|
5
|
+
import "./chunk-4MLRXO7F.mjs";
|
|
6
|
+
import "./chunk-IFMOTJNU.mjs";
|
|
7
|
+
import "./chunk-AEBW7XZJ.mjs";
|
|
8
|
+
export {
|
|
9
|
+
captureRuntimeRagSelection,
|
|
10
|
+
createConfiguredRagEmbeddingTransport
|
|
11
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {
|
|
2
|
+
captureRuntimeSearchSelection,
|
|
3
|
+
createRuntimeSearchProvider,
|
|
4
|
+
searchCapabilityEnvironmentNames
|
|
5
|
+
} from "./chunk-ZQUZAGIQ.mjs";
|
|
6
|
+
import "./chunk-QL2TQX2N.mjs";
|
|
7
|
+
import {
|
|
8
|
+
RuntimeSearchError
|
|
9
|
+
} from "./chunk-LEW5ZMLR.mjs";
|
|
10
|
+
import "./chunk-IKQKBE2G.mjs";
|
|
11
|
+
import "./chunk-IFMOTJNU.mjs";
|
|
12
|
+
import "./chunk-AEBW7XZJ.mjs";
|
|
13
|
+
export {
|
|
14
|
+
RuntimeSearchError,
|
|
15
|
+
captureRuntimeSearchSelection,
|
|
16
|
+
createRuntimeSearchProvider,
|
|
17
|
+
searchCapabilityEnvironmentNames
|
|
18
|
+
};
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
CREATE TABLE IF NOT EXISTS "public"."rag_chunks" (
|
|
2
|
+
"id" text PRIMARY KEY,
|
|
3
|
+
"corpus" text NOT NULL,
|
|
4
|
+
"visibility_scope" text NOT NULL,
|
|
5
|
+
"owner_user_id" text,
|
|
6
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
7
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
8
|
+
"source_id" text NOT NULL,
|
|
9
|
+
"section_id" text,
|
|
10
|
+
"chunk_index" integer NOT NULL,
|
|
11
|
+
"chunk_text" text NOT NULL,
|
|
12
|
+
"lexical_text" text NOT NULL,
|
|
13
|
+
"embedding" public.vector(1536),
|
|
14
|
+
"page_start" integer,
|
|
15
|
+
"page_end" integer,
|
|
16
|
+
"chunk_checksum" text NOT NULL,
|
|
17
|
+
"metadata" jsonb DEFAULT '{}' NOT NULL
|
|
18
|
+
);
|
|
19
|
+
CREATE TABLE IF NOT EXISTS "public"."rag_corpora" (
|
|
20
|
+
"id" text PRIMARY KEY,
|
|
21
|
+
"corpus" text NOT NULL,
|
|
22
|
+
"visibility_scope" text NOT NULL,
|
|
23
|
+
"owner_user_id" text,
|
|
24
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
25
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
26
|
+
"title" text NOT NULL,
|
|
27
|
+
"description" text,
|
|
28
|
+
"allow_external_providers" boolean DEFAULT false NOT NULL,
|
|
29
|
+
"retention_days" integer,
|
|
30
|
+
"metadata" jsonb DEFAULT '{}' NOT NULL
|
|
31
|
+
);
|
|
32
|
+
CREATE TABLE IF NOT EXISTS "public"."rag_ingest_jobs" (
|
|
33
|
+
"id" text PRIMARY KEY,
|
|
34
|
+
"corpus" text NOT NULL,
|
|
35
|
+
"visibility_scope" text NOT NULL,
|
|
36
|
+
"owner_user_id" text,
|
|
37
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
38
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
39
|
+
"workflow_id" text NOT NULL,
|
|
40
|
+
"source_id" text NOT NULL,
|
|
41
|
+
"status" text NOT NULL,
|
|
42
|
+
"stage" text NOT NULL,
|
|
43
|
+
"provider_trace" jsonb DEFAULT '{}' NOT NULL,
|
|
44
|
+
"metrics" jsonb DEFAULT '{}' NOT NULL,
|
|
45
|
+
"error" text,
|
|
46
|
+
"started_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
47
|
+
"completed_at" timestamp with time zone
|
|
48
|
+
);
|
|
49
|
+
CREATE TABLE IF NOT EXISTS "public"."rag_operation_metrics" (
|
|
50
|
+
"id" text PRIMARY KEY,
|
|
51
|
+
"app_id" text NOT NULL,
|
|
52
|
+
"corpus" text NOT NULL,
|
|
53
|
+
"visibility_scope" text NOT NULL,
|
|
54
|
+
"owner_user_id" text,
|
|
55
|
+
"operation" text NOT NULL,
|
|
56
|
+
"job_id" text,
|
|
57
|
+
"workflow_id" text,
|
|
58
|
+
"source_id" text,
|
|
59
|
+
"metric_name" text NOT NULL,
|
|
60
|
+
"metric_value" double precision NOT NULL,
|
|
61
|
+
"unit" text,
|
|
62
|
+
"metadata" jsonb DEFAULT '{}' NOT NULL,
|
|
63
|
+
"recorded_at" timestamp with time zone DEFAULT now() NOT NULL
|
|
64
|
+
);
|
|
65
|
+
CREATE TABLE IF NOT EXISTS "public"."rag_sections" (
|
|
66
|
+
"id" text PRIMARY KEY,
|
|
67
|
+
"corpus" text NOT NULL,
|
|
68
|
+
"visibility_scope" text NOT NULL,
|
|
69
|
+
"owner_user_id" text,
|
|
70
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
71
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
72
|
+
"source_id" text NOT NULL,
|
|
73
|
+
"section_index" integer NOT NULL,
|
|
74
|
+
"section_path" jsonb DEFAULT '[]' NOT NULL,
|
|
75
|
+
"title" text,
|
|
76
|
+
"depth" integer NOT NULL,
|
|
77
|
+
"page_start" integer,
|
|
78
|
+
"page_end" integer,
|
|
79
|
+
"char_start" integer NOT NULL,
|
|
80
|
+
"char_end" integer NOT NULL
|
|
81
|
+
);
|
|
82
|
+
CREATE TABLE IF NOT EXISTS "public"."rag_sources" (
|
|
83
|
+
"id" text PRIMARY KEY,
|
|
84
|
+
"corpus" text NOT NULL,
|
|
85
|
+
"visibility_scope" text NOT NULL,
|
|
86
|
+
"owner_user_id" text,
|
|
87
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
88
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
89
|
+
"storage_id" text NOT NULL,
|
|
90
|
+
"source_key" text NOT NULL,
|
|
91
|
+
"source_title" text NOT NULL,
|
|
92
|
+
"mime_type" text NOT NULL,
|
|
93
|
+
"byte_size" bigint NOT NULL,
|
|
94
|
+
"source_checksum" text NOT NULL,
|
|
95
|
+
"convert_provider" text NOT NULL,
|
|
96
|
+
"convert_status" text NOT NULL,
|
|
97
|
+
"markdown" text DEFAULT '' NOT NULL,
|
|
98
|
+
"text" text DEFAULT '' NOT NULL,
|
|
99
|
+
"warnings" jsonb DEFAULT '[]' NOT NULL,
|
|
100
|
+
"metadata" jsonb DEFAULT '{}' NOT NULL
|
|
101
|
+
);
|
|
102
|
+
CREATE INDEX IF NOT EXISTS "idx_rag_chunks_scope" ON "public"."rag_chunks" ("corpus","visibility_scope",COALESCE("owner_user_id", ''::text));
|
|
103
|
+
CREATE INDEX IF NOT EXISTS "idx_rag_chunks_source" ON "public"."rag_chunks" ("source_id","chunk_index");
|
|
104
|
+
CREATE INDEX IF NOT EXISTS "gencow_search_81705a48254fd5f7_fts_idx" ON "public"."rag_chunks" USING gin (to_tsvector('simple', lower(normalize(regexp_replace(COALESCE("chunk_text"::text, ''), '[[:space:]]+', ' ', 'g'), NFC))));
|
|
105
|
+
CREATE INDEX IF NOT EXISTS "gencow_search_81705a48254fd5f7_trgm_idx" ON "public"."rag_chunks" USING gin (lower(normalize(regexp_replace(COALESCE("chunk_text"::text, ''), '[[:space:]]+', ' ', 'g'), NFC)) public.gin_trgm_ops);
|
|
106
|
+
CREATE INDEX IF NOT EXISTS "gencow_search_0df8e10144f36b7c_fts_idx" ON "public"."rag_chunks" USING gin (to_tsvector('simple', lower(normalize(regexp_replace(COALESCE("lexical_text"::text, ''), '[[:space:]]+', ' ', 'g'), NFC))));
|
|
107
|
+
CREATE INDEX IF NOT EXISTS "gencow_search_0df8e10144f36b7c_trgm_idx" ON "public"."rag_chunks" USING gin (lower(normalize(regexp_replace(COALESCE("lexical_text"::text, ''), '[[:space:]]+', ' ', 'g'), NFC)) public.gin_trgm_ops);
|
|
108
|
+
CREATE UNIQUE INDEX IF NOT EXISTS "idx_rag_corpora_scope" ON "public"."rag_corpora" ("corpus","visibility_scope",COALESCE("owner_user_id", ''::text));
|
|
109
|
+
CREATE UNIQUE INDEX IF NOT EXISTS "idx_rag_ingest_jobs_workflow" ON "public"."rag_ingest_jobs" ("workflow_id");
|
|
110
|
+
CREATE INDEX IF NOT EXISTS "idx_rag_ingest_jobs_source" ON "public"."rag_ingest_jobs" ("source_id","started_at" DESC NULLS FIRST);
|
|
111
|
+
CREATE INDEX IF NOT EXISTS "idx_rag_operation_metrics_scope" ON "public"."rag_operation_metrics" ("corpus","visibility_scope",COALESCE("owner_user_id", ''::text),"recorded_at" DESC NULLS FIRST);
|
|
112
|
+
CREATE INDEX IF NOT EXISTS "idx_rag_operation_metrics_operation" ON "public"."rag_operation_metrics" ("operation","metric_name","recorded_at" DESC NULLS FIRST);
|
|
113
|
+
CREATE INDEX IF NOT EXISTS "idx_rag_sections_source" ON "public"."rag_sections" ("source_id","section_index");
|
|
114
|
+
CREATE UNIQUE INDEX IF NOT EXISTS "idx_rag_sources_scope_key" ON "public"."rag_sources" ("corpus","visibility_scope",COALESCE("owner_user_id", ''::text),"source_key");
|
|
115
|
+
CREATE INDEX IF NOT EXISTS "idx_rag_sources_checksum" ON "public"."rag_sources" ("corpus","source_checksum");
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
CREATE TABLE "public"."_gencow_job_admission_buckets" (
|
|
2
|
+
"scope" text,
|
|
3
|
+
"bucket_start" timestamp with time zone,
|
|
4
|
+
"count" integer DEFAULT 0 NOT NULL,
|
|
5
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
6
|
+
CONSTRAINT "_gencow_job_admission_buckets_pkey" PRIMARY KEY("scope","bucket_start")
|
|
7
|
+
);
|
|
8
|
+
--> statement-breakpoint
|
|
9
|
+
CREATE TABLE "public"."_gencow_workflow_capacity_locks_v2" (
|
|
10
|
+
"scope" text PRIMARY KEY,
|
|
11
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
|
|
12
|
+
);
|
|
13
|
+
--> statement-breakpoint
|
|
14
|
+
CREATE TABLE "public"."_gencow_workflow_events_v2" (
|
|
15
|
+
"id" bigserial PRIMARY KEY,
|
|
16
|
+
"run_id" text NOT NULL,
|
|
17
|
+
"event_type" text NOT NULL,
|
|
18
|
+
"event_json" jsonb,
|
|
19
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL
|
|
20
|
+
);
|
|
21
|
+
--> statement-breakpoint
|
|
22
|
+
CREATE TABLE "public"."_gencow_workflow_events" (
|
|
23
|
+
"id" text PRIMARY KEY DEFAULT gen_random_uuid()::text,
|
|
24
|
+
"workflow_id" text NOT NULL,
|
|
25
|
+
"event_name" text NOT NULL,
|
|
26
|
+
"payload" jsonb,
|
|
27
|
+
"received_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
28
|
+
"consumed_at" timestamp with time zone
|
|
29
|
+
);
|
|
30
|
+
--> statement-breakpoint
|
|
31
|
+
CREATE TABLE "public"."_gencow_workflows" (
|
|
32
|
+
"id" text PRIMARY KEY,
|
|
33
|
+
"name" text NOT NULL,
|
|
34
|
+
"args" jsonb DEFAULT '{}' NOT NULL,
|
|
35
|
+
"status" text DEFAULT 'pending' NOT NULL,
|
|
36
|
+
"current_step" text,
|
|
37
|
+
"result" jsonb,
|
|
38
|
+
"error" text,
|
|
39
|
+
"error_code" text,
|
|
40
|
+
"realtime_token" text DEFAULT '' NOT NULL,
|
|
41
|
+
"retry_count" integer DEFAULT 0 NOT NULL,
|
|
42
|
+
"max_retries" integer DEFAULT 3 NOT NULL,
|
|
43
|
+
"max_duration_ms" bigint DEFAULT 1800000 NOT NULL,
|
|
44
|
+
"first_claimed_at" timestamp with time zone,
|
|
45
|
+
"handler_started_at" timestamp with time zone,
|
|
46
|
+
"last_resume_attempt_at" timestamp with time zone,
|
|
47
|
+
"runnable_at" timestamp with time zone,
|
|
48
|
+
"started_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
49
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
50
|
+
"completed_at" timestamp with time zone,
|
|
51
|
+
"user_id" text
|
|
52
|
+
);
|
|
53
|
+
--> statement-breakpoint
|
|
54
|
+
CREATE TABLE "public"."_gencow_workflow_steps" (
|
|
55
|
+
"id" serial PRIMARY KEY,
|
|
56
|
+
"workflow_id" text NOT NULL,
|
|
57
|
+
"step_name" text NOT NULL,
|
|
58
|
+
"status" text DEFAULT 'pending' NOT NULL,
|
|
59
|
+
"output" jsonb,
|
|
60
|
+
"error" text,
|
|
61
|
+
"started_at" timestamp with time zone,
|
|
62
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
63
|
+
"completed_at" timestamp with time zone,
|
|
64
|
+
CONSTRAINT "_gencow_workflow_steps_workflow_id_step_name_key" UNIQUE("workflow_id","step_name")
|
|
65
|
+
);
|
|
66
|
+
--> statement-breakpoint
|
|
67
|
+
CREATE TABLE "public"."_gencow_workflow_outbox_v2" (
|
|
68
|
+
"id" text PRIMARY KEY,
|
|
69
|
+
"run_id" text NOT NULL,
|
|
70
|
+
"kind" text NOT NULL,
|
|
71
|
+
"available_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
72
|
+
"status" text DEFAULT 'pending' NOT NULL,
|
|
73
|
+
"attempt_count" integer DEFAULT 0 NOT NULL,
|
|
74
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
75
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
|
|
76
|
+
);
|
|
77
|
+
--> statement-breakpoint
|
|
78
|
+
CREATE TABLE "public"."_gencow_workflow_runs_v2" (
|
|
79
|
+
"id" text PRIMARY KEY,
|
|
80
|
+
"workflow_name" text NOT NULL,
|
|
81
|
+
"workflow_version" text,
|
|
82
|
+
"status" text DEFAULT 'queued' NOT NULL,
|
|
83
|
+
"args_json" jsonb DEFAULT '{}' NOT NULL,
|
|
84
|
+
"user_id" text,
|
|
85
|
+
"capacity_defer_count" integer DEFAULT 0 NOT NULL,
|
|
86
|
+
"capacity_deferred_at" timestamp with time zone,
|
|
87
|
+
"command_protocol" smallint DEFAULT 1 NOT NULL,
|
|
88
|
+
"definition_missing_since" timestamp with time zone,
|
|
89
|
+
"result_json" jsonb,
|
|
90
|
+
"error_json" jsonb,
|
|
91
|
+
"error_code" text,
|
|
92
|
+
"current_step_key" text,
|
|
93
|
+
"priority" integer DEFAULT 0 NOT NULL,
|
|
94
|
+
"runnable_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
95
|
+
"lease_owner" text,
|
|
96
|
+
"lease_epoch" integer DEFAULT 0 NOT NULL,
|
|
97
|
+
"lease_expires_at" timestamp with time zone,
|
|
98
|
+
"heartbeat_at" timestamp with time zone,
|
|
99
|
+
"attempt_count" integer DEFAULT 0 NOT NULL,
|
|
100
|
+
"max_attempts" integer DEFAULT 3 NOT NULL,
|
|
101
|
+
"retry_count" integer DEFAULT 0 NOT NULL,
|
|
102
|
+
"max_retries" integer DEFAULT 3 NOT NULL,
|
|
103
|
+
"max_active_duration_ms" bigint DEFAULT 1800000 NOT NULL,
|
|
104
|
+
"active_started_at" timestamp with time zone,
|
|
105
|
+
"active_deadline_at" timestamp with time zone,
|
|
106
|
+
"lifecycle_deadline_at" timestamp with time zone,
|
|
107
|
+
"cancel_requested_at" timestamp with time zone,
|
|
108
|
+
"idempotency_key" text CONSTRAINT "_gencow_workflow_runs_v2_idempotency_key_key" UNIQUE,
|
|
109
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
110
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
111
|
+
"completed_at" timestamp with time zone
|
|
112
|
+
);
|
|
113
|
+
--> statement-breakpoint
|
|
114
|
+
CREATE TABLE "public"."_gencow_workflow_signals_v2" (
|
|
115
|
+
"id" text PRIMARY KEY,
|
|
116
|
+
"run_id" text NOT NULL,
|
|
117
|
+
"event_name" text NOT NULL,
|
|
118
|
+
"payload_json" jsonb,
|
|
119
|
+
"idempotency_key" text,
|
|
120
|
+
"received_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
121
|
+
"consumed_at" timestamp with time zone,
|
|
122
|
+
"consumed_by_command" text,
|
|
123
|
+
CONSTRAINT "_gencow_workflow_signals_v2_run_id_event_name_idempotency_k_key" UNIQUE("run_id","event_name","idempotency_key")
|
|
124
|
+
);
|
|
125
|
+
--> statement-breakpoint
|
|
126
|
+
CREATE TABLE "public"."_gencow_workflow_steps_v2" (
|
|
127
|
+
"id" bigserial PRIMARY KEY,
|
|
128
|
+
"run_id" text NOT NULL,
|
|
129
|
+
"step_key" text NOT NULL,
|
|
130
|
+
"step_index" integer DEFAULT 0 NOT NULL,
|
|
131
|
+
"status" text DEFAULT 'pending' NOT NULL,
|
|
132
|
+
"input_hash" text,
|
|
133
|
+
"output_json" jsonb,
|
|
134
|
+
"error_json" jsonb,
|
|
135
|
+
"error_code" text,
|
|
136
|
+
"attempt_count" integer DEFAULT 0 NOT NULL,
|
|
137
|
+
"max_attempts" integer DEFAULT 3 NOT NULL,
|
|
138
|
+
"runnable_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
139
|
+
"lease_owner" text,
|
|
140
|
+
"lease_epoch" integer DEFAULT 0 NOT NULL,
|
|
141
|
+
"lease_expires_at" timestamp with time zone,
|
|
142
|
+
"started_at" timestamp with time zone,
|
|
143
|
+
"heartbeat_at" timestamp with time zone,
|
|
144
|
+
"completed_at" timestamp with time zone,
|
|
145
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
146
|
+
"command_kind" text,
|
|
147
|
+
"command_name" text,
|
|
148
|
+
"command_scope" text DEFAULT '' NOT NULL,
|
|
149
|
+
"command_seq" integer,
|
|
150
|
+
"output_codec" text,
|
|
151
|
+
"failure_final" boolean DEFAULT false NOT NULL,
|
|
152
|
+
"signal_id" text,
|
|
153
|
+
CONSTRAINT "_gencow_workflow_steps_v2_run_id_step_key_key" UNIQUE("run_id","step_key")
|
|
154
|
+
);
|
|
155
|
+
--> statement-breakpoint
|
|
156
|
+
CREATE TABLE "public"."_gencow_workflow_timers_v2" (
|
|
157
|
+
"id" text PRIMARY KEY,
|
|
158
|
+
"run_id" text NOT NULL,
|
|
159
|
+
"kind" text NOT NULL,
|
|
160
|
+
"fire_at" timestamp with time zone NOT NULL,
|
|
161
|
+
"status" text DEFAULT 'pending' NOT NULL,
|
|
162
|
+
"dedupe_key" text,
|
|
163
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
164
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
165
|
+
"command_key" text,
|
|
166
|
+
CONSTRAINT "_gencow_workflow_timers_v2_run_id_dedupe_key_key" UNIQUE("run_id","dedupe_key")
|
|
167
|
+
);
|
|
168
|
+
--> statement-breakpoint
|
|
169
|
+
CREATE INDEX "idx__gencow_job_admission_buckets_updated" ON "public"."_gencow_job_admission_buckets" ("updated_at");--> statement-breakpoint
|
|
170
|
+
CREATE INDEX "idx__gencow_workflow_events_v2_timeline" ON "public"."_gencow_workflow_events_v2" ("run_id","created_at","id");--> statement-breakpoint
|
|
171
|
+
CREATE INDEX "idx__gencow_workflow_events_lookup" ON "public"."_gencow_workflow_events" ("workflow_id","event_name","received_at");--> statement-breakpoint
|
|
172
|
+
CREATE INDEX "idx__gencow_workflows_status" ON "public"."_gencow_workflows" ("status","started_at" DESC);--> statement-breakpoint
|
|
173
|
+
CREATE INDEX "idx__gencow_workflow_steps_lookup" ON "public"."_gencow_workflow_steps" ("workflow_id","step_name");--> statement-breakpoint
|
|
174
|
+
CREATE INDEX "idx__gencow_workflow_outbox_v2_due" ON "public"."_gencow_workflow_outbox_v2" ("status","available_at");--> statement-breakpoint
|
|
175
|
+
CREATE INDEX "idx__gencow_workflow_outbox_v2_run" ON "public"."_gencow_workflow_outbox_v2" ("run_id");--> statement-breakpoint
|
|
176
|
+
CREATE INDEX "idx__gencow_workflow_outbox_v2_due_pending" ON "public"."_gencow_workflow_outbox_v2" ("available_at") WHERE status IN ('pending', 'sending');--> statement-breakpoint
|
|
177
|
+
CREATE INDEX "idx__gencow_workflow_runs_v2_claim" ON "public"."_gencow_workflow_runs_v2" ("status","runnable_at","priority" DESC,"created_at") WHERE completed_at IS NULL;--> statement-breakpoint
|
|
178
|
+
CREATE INDEX "idx__gencow_workflow_runs_v2_lease" ON "public"."_gencow_workflow_runs_v2" ("lease_expires_at") WHERE status = 'running' AND completed_at IS NULL;--> statement-breakpoint
|
|
179
|
+
CREATE INDEX "idx__gencow_workflow_runs_v2_active_deadline" ON "public"."_gencow_workflow_runs_v2" ("active_deadline_at") WHERE completed_at IS NULL AND active_deadline_at IS NOT NULL;--> statement-breakpoint
|
|
180
|
+
CREATE INDEX "idx__gencow_workflow_runs_v2_lifecycle_deadline" ON "public"."_gencow_workflow_runs_v2" ("lifecycle_deadline_at") WHERE completed_at IS NULL AND lifecycle_deadline_at IS NOT NULL;--> statement-breakpoint
|
|
181
|
+
CREATE INDEX "idx__gencow_workflow_runs_v2_cancel" ON "public"."_gencow_workflow_runs_v2" ("cancel_requested_at") WHERE completed_at IS NULL AND cancel_requested_at IS NOT NULL;--> statement-breakpoint
|
|
182
|
+
CREATE INDEX "idx__gencow_workflow_runs_v2_admission" ON "public"."_gencow_workflow_runs_v2" ("workflow_name","status") WHERE completed_at IS NULL;--> statement-breakpoint
|
|
183
|
+
CREATE INDEX "idx__gencow_workflow_signals_v2_wait" ON "public"."_gencow_workflow_signals_v2" ("run_id","event_name","received_at") WHERE consumed_at IS NULL;--> statement-breakpoint
|
|
184
|
+
CREATE INDEX "idx__gencow_workflow_steps_v2_lookup" ON "public"."_gencow_workflow_steps_v2" ("run_id","step_key");--> statement-breakpoint
|
|
185
|
+
CREATE UNIQUE INDEX "idx__gencow_workflow_steps_v2_scope_seq" ON "public"."_gencow_workflow_steps_v2" ("run_id","command_scope","command_seq") WHERE command_seq IS NOT NULL;--> statement-breakpoint
|
|
186
|
+
CREATE INDEX "idx__gencow_workflow_timers_v2_due" ON "public"."_gencow_workflow_timers_v2" ("status","fire_at");--> statement-breakpoint
|
|
187
|
+
CREATE INDEX "idx__gencow_workflow_timers_v2_due_pending" ON "public"."_gencow_workflow_timers_v2" ("fire_at") WHERE status = 'pending';--> statement-breakpoint
|
|
188
|
+
ALTER TABLE "public"."_gencow_workflow_events_v2" ADD CONSTRAINT "_gencow_workflow_events_v2_run_id_fkey" FOREIGN KEY ("run_id") REFERENCES "public"."_gencow_workflow_runs_v2"("id") ON DELETE CASCADE;--> statement-breakpoint
|
|
189
|
+
ALTER TABLE "public"."_gencow_workflow_events" ADD CONSTRAINT "_gencow_workflow_events_workflow_id_fkey" FOREIGN KEY ("workflow_id") REFERENCES "public"."_gencow_workflows"("id") ON DELETE CASCADE;--> statement-breakpoint
|
|
190
|
+
ALTER TABLE "public"."_gencow_workflow_steps" ADD CONSTRAINT "_gencow_workflow_steps_workflow_id_fkey" FOREIGN KEY ("workflow_id") REFERENCES "public"."_gencow_workflows"("id") ON DELETE CASCADE;--> statement-breakpoint
|
|
191
|
+
ALTER TABLE "public"."_gencow_workflow_outbox_v2" ADD CONSTRAINT "_gencow_workflow_outbox_v2_run_id_fkey" FOREIGN KEY ("run_id") REFERENCES "public"."_gencow_workflow_runs_v2"("id") ON DELETE CASCADE;--> statement-breakpoint
|
|
192
|
+
ALTER TABLE "public"."_gencow_workflow_signals_v2" ADD CONSTRAINT "_gencow_workflow_signals_v2_run_id_fkey" FOREIGN KEY ("run_id") REFERENCES "public"."_gencow_workflow_runs_v2"("id") ON DELETE CASCADE;--> statement-breakpoint
|
|
193
|
+
ALTER TABLE "public"."_gencow_workflow_steps_v2" ADD CONSTRAINT "_gencow_workflow_steps_v2_run_id_fkey" FOREIGN KEY ("run_id") REFERENCES "public"."_gencow_workflow_runs_v2"("id") ON DELETE CASCADE;--> statement-breakpoint
|
|
194
|
+
ALTER TABLE "public"."_gencow_workflow_timers_v2" ADD CONSTRAINT "_gencow_workflow_timers_v2_run_id_fkey" FOREIGN KEY ("run_id") REFERENCES "public"."_gencow_workflow_runs_v2"("id") ON DELETE CASCADE;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
DO $framework$
|
|
2
|
+
BEGIN
|
|
3
|
+
IF NOT EXISTS (SELECT 1 FROM pg_catalog.pg_namespace WHERE nspname = 'drizzle') THEN
|
|
4
|
+
CREATE SCHEMA drizzle;
|
|
5
|
+
END IF;
|
|
6
|
+
END
|
|
7
|
+
$framework$;
|
|
8
|
+
|
|
9
|
+
CREATE TABLE "drizzle"."__gencow_framework_migrations" (
|
|
10
|
+
"id" serial PRIMARY KEY,
|
|
11
|
+
"component_id" text NOT NULL,
|
|
12
|
+
"migration_id" text NOT NULL,
|
|
13
|
+
"migration_order" integer NOT NULL,
|
|
14
|
+
"hash" text NOT NULL,
|
|
15
|
+
"created_at" bigint NOT NULL,
|
|
16
|
+
"applied_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
17
|
+
"applied_via" text NOT NULL,
|
|
18
|
+
CONSTRAINT "__gencow_framework_migrations_component_id_migration_id_key" UNIQUE("component_id","migration_id"),
|
|
19
|
+
CONSTRAINT "__gencow_framework_migrations_component_id_migration_order_key" UNIQUE("component_id","migration_order"),
|
|
20
|
+
CONSTRAINT "__gencow_framework_migrations_component_id_check" CHECK (length("component_id") BETWEEN 1 AND 63),
|
|
21
|
+
CONSTRAINT "__gencow_framework_migrations_migration_id_check" CHECK (length("migration_id") BETWEEN 1 AND 128),
|
|
22
|
+
CONSTRAINT "__gencow_framework_migrations_order_check" CHECK ("migration_order" > 0),
|
|
23
|
+
CONSTRAINT "__gencow_framework_migrations_hash_check" CHECK ("hash" ~ '^[0-9a-f]{64}$'),
|
|
24
|
+
CONSTRAINT "__gencow_framework_migrations_created_at_check" CHECK ("created_at" > 0),
|
|
25
|
+
CONSTRAINT "__gencow_framework_migrations_applied_via_check" CHECK ("applied_via" IN ('migration', 'baseline'))
|
|
26
|
+
);
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"formatVersion": 2,
|
|
3
|
+
"components": [
|
|
4
|
+
{
|
|
5
|
+
"componentId": "workflow",
|
|
6
|
+
"targetHead": "20261006111508_perpetual_star_brand",
|
|
7
|
+
"migrations": [
|
|
8
|
+
{
|
|
9
|
+
"migrationId": "20261006111508_perpetual_star_brand",
|
|
10
|
+
"migrationOrder": 1,
|
|
11
|
+
"createdAt": 1791285308000,
|
|
12
|
+
"hash": "24343c58cb8a73f97efa2f9fbb97325c8c01fa108f674ef0a68dfdac5100fc49",
|
|
13
|
+
"executionEligibility": "startup-compatible"
|
|
14
|
+
}
|
|
15
|
+
]
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"componentId": "rag",
|
|
19
|
+
"targetHead": "20261013234621_rag_v2_lifecycle_markers",
|
|
20
|
+
"migrations": [
|
|
21
|
+
{
|
|
22
|
+
"migrationId": "20261006111509_mushy_warhawk",
|
|
23
|
+
"migrationOrder": 1,
|
|
24
|
+
"createdAt": 1791285309000,
|
|
25
|
+
"hash": "2cd052ed1289dcabdb61b95f84bfcd04db3dd7ba1dce1d241775c047448c4aed",
|
|
26
|
+
"executionEligibility": "startup-compatible"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"migrationId": "20261013234621_rag_v2_lifecycle_markers",
|
|
30
|
+
"migrationOrder": 2,
|
|
31
|
+
"createdAt": 1791935181000,
|
|
32
|
+
"hash": "524d5a6a42b57a9f65e302e90366a777e0554dfb94e10824b710d68328a99330",
|
|
33
|
+
"executionEligibility": "startup-compatible"
|
|
34
|
+
}
|
|
35
|
+
]
|
|
36
|
+
}
|
|
37
|
+
],
|
|
38
|
+
"journalBootstrap": {
|
|
39
|
+
"artifactId": "framework-journal-v1",
|
|
40
|
+
"hash": "f09347ee037bfaebcfb12398f2ad84af3f54a776ecf252a19db5499cd620874b"
|
|
41
|
+
},
|
|
42
|
+
"foundationBootstraps": [
|
|
43
|
+
{
|
|
44
|
+
"componentId": "workflow",
|
|
45
|
+
"artifactId": "framework-foundation-workflow-v1",
|
|
46
|
+
"hash": "72764ef1aaacb529d4253eb1d8e90ca5a4ed5069bbb43ae90ef9496fedc0b11f",
|
|
47
|
+
"executionEligibility": "startup-compatible"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"componentId": "rag",
|
|
51
|
+
"artifactId": "framework-foundation-rag-v1",
|
|
52
|
+
"hash": "d9a58c96dec4a58eca66c8da338bfd2bd0f1f0eb6ca85914c52496aaa73ac606",
|
|
53
|
+
"executionEligibility": "startup-compatible"
|
|
54
|
+
}
|
|
55
|
+
]
|
|
56
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
CREATE TABLE "public"."rag_chunks" (
|
|
2
|
+
"id" text PRIMARY KEY,
|
|
3
|
+
"corpus" text NOT NULL,
|
|
4
|
+
"visibility_scope" text NOT NULL,
|
|
5
|
+
"owner_user_id" text,
|
|
6
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
7
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
8
|
+
"source_id" text NOT NULL,
|
|
9
|
+
"section_id" text,
|
|
10
|
+
"chunk_index" integer NOT NULL,
|
|
11
|
+
"chunk_text" text NOT NULL,
|
|
12
|
+
"lexical_text" text NOT NULL,
|
|
13
|
+
"embedding" public.vector(1536),
|
|
14
|
+
"page_start" integer,
|
|
15
|
+
"page_end" integer,
|
|
16
|
+
"chunk_checksum" text NOT NULL,
|
|
17
|
+
"metadata" jsonb DEFAULT '{}' NOT NULL
|
|
18
|
+
);
|
|
19
|
+
--> statement-breakpoint
|
|
20
|
+
CREATE TABLE "public"."rag_corpora" (
|
|
21
|
+
"id" text PRIMARY KEY,
|
|
22
|
+
"corpus" text NOT NULL,
|
|
23
|
+
"visibility_scope" text NOT NULL,
|
|
24
|
+
"owner_user_id" text,
|
|
25
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
26
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
27
|
+
"title" text NOT NULL,
|
|
28
|
+
"description" text,
|
|
29
|
+
"allow_external_providers" boolean DEFAULT false NOT NULL,
|
|
30
|
+
"retention_days" integer,
|
|
31
|
+
"metadata" jsonb DEFAULT '{}' NOT NULL
|
|
32
|
+
);
|
|
33
|
+
--> statement-breakpoint
|
|
34
|
+
CREATE TABLE "public"."rag_ingest_jobs" (
|
|
35
|
+
"id" text PRIMARY KEY,
|
|
36
|
+
"corpus" text NOT NULL,
|
|
37
|
+
"visibility_scope" text NOT NULL,
|
|
38
|
+
"owner_user_id" text,
|
|
39
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
40
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
41
|
+
"workflow_id" text NOT NULL,
|
|
42
|
+
"source_id" text NOT NULL,
|
|
43
|
+
"status" text NOT NULL,
|
|
44
|
+
"stage" text NOT NULL,
|
|
45
|
+
"provider_trace" jsonb DEFAULT '{}' NOT NULL,
|
|
46
|
+
"metrics" jsonb DEFAULT '{}' NOT NULL,
|
|
47
|
+
"error" text,
|
|
48
|
+
"started_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
49
|
+
"completed_at" timestamp with time zone
|
|
50
|
+
);
|
|
51
|
+
--> statement-breakpoint
|
|
52
|
+
CREATE TABLE "public"."rag_operation_metrics" (
|
|
53
|
+
"id" text PRIMARY KEY,
|
|
54
|
+
"app_id" text NOT NULL,
|
|
55
|
+
"corpus" text NOT NULL,
|
|
56
|
+
"visibility_scope" text NOT NULL,
|
|
57
|
+
"owner_user_id" text,
|
|
58
|
+
"operation" text NOT NULL,
|
|
59
|
+
"job_id" text,
|
|
60
|
+
"workflow_id" text,
|
|
61
|
+
"source_id" text,
|
|
62
|
+
"metric_name" text NOT NULL,
|
|
63
|
+
"metric_value" double precision NOT NULL,
|
|
64
|
+
"unit" text,
|
|
65
|
+
"metadata" jsonb DEFAULT '{}' NOT NULL,
|
|
66
|
+
"recorded_at" timestamp with time zone DEFAULT now() NOT NULL
|
|
67
|
+
);
|
|
68
|
+
--> statement-breakpoint
|
|
69
|
+
CREATE TABLE "public"."rag_sections" (
|
|
70
|
+
"id" text PRIMARY KEY,
|
|
71
|
+
"corpus" text NOT NULL,
|
|
72
|
+
"visibility_scope" text NOT NULL,
|
|
73
|
+
"owner_user_id" text,
|
|
74
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
75
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
76
|
+
"source_id" text NOT NULL,
|
|
77
|
+
"section_index" integer NOT NULL,
|
|
78
|
+
"section_path" jsonb DEFAULT '[]' NOT NULL,
|
|
79
|
+
"title" text,
|
|
80
|
+
"depth" integer NOT NULL,
|
|
81
|
+
"page_start" integer,
|
|
82
|
+
"page_end" integer,
|
|
83
|
+
"char_start" integer NOT NULL,
|
|
84
|
+
"char_end" integer NOT NULL
|
|
85
|
+
);
|
|
86
|
+
--> statement-breakpoint
|
|
87
|
+
CREATE TABLE "public"."rag_sources" (
|
|
88
|
+
"id" text PRIMARY KEY,
|
|
89
|
+
"corpus" text NOT NULL,
|
|
90
|
+
"visibility_scope" text NOT NULL,
|
|
91
|
+
"owner_user_id" text,
|
|
92
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
93
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
94
|
+
"storage_id" text NOT NULL,
|
|
95
|
+
"source_key" text NOT NULL,
|
|
96
|
+
"source_title" text NOT NULL,
|
|
97
|
+
"mime_type" text NOT NULL,
|
|
98
|
+
"byte_size" bigint NOT NULL,
|
|
99
|
+
"source_checksum" text NOT NULL,
|
|
100
|
+
"convert_provider" text NOT NULL,
|
|
101
|
+
"convert_status" text NOT NULL,
|
|
102
|
+
"markdown" text DEFAULT '' NOT NULL,
|
|
103
|
+
"text" text DEFAULT '' NOT NULL,
|
|
104
|
+
"warnings" jsonb DEFAULT '[]' NOT NULL,
|
|
105
|
+
"metadata" jsonb DEFAULT '{}' NOT NULL
|
|
106
|
+
);
|
|
107
|
+
--> statement-breakpoint
|
|
108
|
+
CREATE INDEX "idx_rag_chunks_scope" ON "public"."rag_chunks" ("corpus","visibility_scope",COALESCE("owner_user_id", ''::text));--> statement-breakpoint
|
|
109
|
+
CREATE INDEX "idx_rag_chunks_source" ON "public"."rag_chunks" ("source_id","chunk_index");--> statement-breakpoint
|
|
110
|
+
CREATE INDEX "gencow_search_81705a48254fd5f7_fts_idx" ON "public"."rag_chunks" USING gin (to_tsvector('simple', lower(normalize(regexp_replace(COALESCE("chunk_text"::text, ''), '[[:space:]]+', ' ', 'g'), NFC))));--> statement-breakpoint
|
|
111
|
+
CREATE INDEX "gencow_search_81705a48254fd5f7_trgm_idx" ON "public"."rag_chunks" USING gin (lower(normalize(regexp_replace(COALESCE("chunk_text"::text, ''), '[[:space:]]+', ' ', 'g'), NFC)) public.gin_trgm_ops);--> statement-breakpoint
|
|
112
|
+
CREATE INDEX "gencow_search_0df8e10144f36b7c_fts_idx" ON "public"."rag_chunks" USING gin (to_tsvector('simple', lower(normalize(regexp_replace(COALESCE("lexical_text"::text, ''), '[[:space:]]+', ' ', 'g'), NFC))));--> statement-breakpoint
|
|
113
|
+
CREATE INDEX "gencow_search_0df8e10144f36b7c_trgm_idx" ON "public"."rag_chunks" USING gin (lower(normalize(regexp_replace(COALESCE("lexical_text"::text, ''), '[[:space:]]+', ' ', 'g'), NFC)) public.gin_trgm_ops);--> statement-breakpoint
|
|
114
|
+
CREATE UNIQUE INDEX "idx_rag_corpora_scope" ON "public"."rag_corpora" ("corpus","visibility_scope",COALESCE("owner_user_id", ''::text));--> statement-breakpoint
|
|
115
|
+
CREATE UNIQUE INDEX "idx_rag_ingest_jobs_workflow" ON "public"."rag_ingest_jobs" ("workflow_id");--> statement-breakpoint
|
|
116
|
+
CREATE INDEX "idx_rag_ingest_jobs_source" ON "public"."rag_ingest_jobs" ("source_id","started_at" DESC NULLS FIRST);--> statement-breakpoint
|
|
117
|
+
CREATE INDEX "idx_rag_operation_metrics_scope" ON "public"."rag_operation_metrics" ("corpus","visibility_scope",COALESCE("owner_user_id", ''::text),"recorded_at" DESC NULLS FIRST);--> statement-breakpoint
|
|
118
|
+
CREATE INDEX "idx_rag_operation_metrics_operation" ON "public"."rag_operation_metrics" ("operation","metric_name","recorded_at" DESC NULLS FIRST);--> statement-breakpoint
|
|
119
|
+
CREATE INDEX "idx_rag_sections_source" ON "public"."rag_sections" ("source_id","section_index");--> statement-breakpoint
|
|
120
|
+
CREATE UNIQUE INDEX "idx_rag_sources_scope_key" ON "public"."rag_sources" ("corpus","visibility_scope",COALESCE("owner_user_id", ''::text),"source_key");--> statement-breakpoint
|
|
121
|
+
CREATE INDEX "idx_rag_sources_checksum" ON "public"."rag_sources" ("corpus","source_checksum");
|
package/runtime/framework-migrations/rag/20261013234621_rag_v2_lifecycle_markers/migration.sql
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
ALTER TABLE "rag_ingest_jobs" ADD COLUMN "retry_revision" integer DEFAULT 0 NOT NULL;--> statement-breakpoint
|
|
2
|
+
ALTER TABLE "rag_ingest_jobs" ADD COLUMN "writer_fenced_at" timestamp with time zone;--> statement-breakpoint
|
|
3
|
+
ALTER TABLE "rag_ingest_jobs" ADD COLUMN "finalization_retry_after" timestamp with time zone;--> statement-breakpoint
|
|
4
|
+
ALTER TABLE "rag_ingest_jobs" ADD COLUMN "finalized_revision" integer;--> statement-breakpoint
|
|
5
|
+
ALTER TABLE "rag_ingest_jobs" ADD COLUMN "retired_at" timestamp with time zone;--> statement-breakpoint
|
|
6
|
+
ALTER TABLE "rag_sources" ADD COLUMN "active_ingest_workflow_id" text;
|
package/runtime/framework-migrations/workflow/20261006111508_perpetual_star_brand/migration.sql
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
CREATE TABLE "public"."_gencow_workflow_terminal_guard" (
|
|
2
|
+
"id" uuid PRIMARY KEY,
|
|
3
|
+
"backend_pid" integer NOT NULL,
|
|
4
|
+
"transaction_id" xid8 NOT NULL,
|
|
5
|
+
"original_deadline" timestamp with time zone NOT NULL
|
|
6
|
+
);
|
|
7
|
+
--> statement-breakpoint
|
|
8
|
+
CREATE FUNCTION public._gencow_workflow_terminal_guard_check() RETURNS trigger LANGUAGE plpgsql
|
|
9
|
+
SECURITY INVOKER SET search_path=pg_catalog AS $guard$DECLARE erased integer;
|
|
10
|
+
BEGIN
|
|
11
|
+
IF NEW.backend_pid <> pg_catalog.pg_backend_pid() OR NEW.transaction_id <> pg_catalog.pg_current_xact_id() THEN
|
|
12
|
+
RAISE EXCEPTION 'Workflow terminal fence identity unavailable' USING ERRCODE='GCW02';
|
|
13
|
+
END IF;
|
|
14
|
+
IF pg_catalog.lower(pg_catalog.btrim(pg_catalog.current_query())) NOT IN ('commit','commit;') THEN
|
|
15
|
+
RAISE EXCEPTION 'Workflow terminal fence boundary unavailable' USING ERRCODE='GCW02';
|
|
16
|
+
END IF;
|
|
17
|
+
IF pg_catalog.clock_timestamp() >= NEW.original_deadline THEN
|
|
18
|
+
RAISE EXCEPTION 'Workflow completion lease expired' USING ERRCODE='GCW01';
|
|
19
|
+
END IF;
|
|
20
|
+
DELETE FROM public._gencow_workflow_terminal_guard WHERE id=NEW.id;
|
|
21
|
+
GET DIAGNOSTICS erased = ROW_COUNT;
|
|
22
|
+
IF erased <> 1 THEN
|
|
23
|
+
RAISE EXCEPTION 'Workflow terminal fence cleanup unavailable' USING ERRCODE='GCW02';
|
|
24
|
+
END IF;
|
|
25
|
+
RETURN NEW;
|
|
26
|
+
END$guard$;
|
|
27
|
+
--> statement-breakpoint
|
|
28
|
+
CREATE CONSTRAINT TRIGGER _gencow_workflow_terminal_guard_check AFTER INSERT ON public._gencow_workflow_terminal_guard
|
|
29
|
+
DEFERRABLE INITIALLY DEFERRED FOR EACH ROW EXECUTE FUNCTION public._gencow_workflow_terminal_guard_check();
|
|
30
|
+
--> statement-breakpoint
|
|
31
|
+
ALTER TABLE public._gencow_workflow_terminal_guard ENABLE ALWAYS TRIGGER _gencow_workflow_terminal_guard_check;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"runtimeVersion": "0.1.0",
|
|
3
|
+
"coreVersion": "0.2.0",
|
|
4
|
+
"peerDependencies": {
|
|
5
|
+
"@azure/identity": "4.13.1",
|
|
6
|
+
"@azure/storage-blob": "12.33.0",
|
|
7
|
+
"@better-auth/core": "^1.7.11",
|
|
8
|
+
"@electric-sql/pglite": "^0.4.6",
|
|
9
|
+
"@gencow/core": "^0.2.0",
|
|
10
|
+
"better-auth": "^1.7.11",
|
|
11
|
+
"drizzle-orm": "^1.0.0-rc.4 || ^1.0.0",
|
|
12
|
+
"mammoth": "^1.12.0",
|
|
13
|
+
"node-cron": "4.6.0",
|
|
14
|
+
"pdf-parse": "^2.4.5",
|
|
15
|
+
"sharp": "^0.35.5"
|
|
16
|
+
},
|
|
17
|
+
"facades": {
|
|
18
|
+
"index": ".",
|
|
19
|
+
"local": "./local",
|
|
20
|
+
"composition": "./composition",
|
|
21
|
+
"search": "./search",
|
|
22
|
+
"rag": "./rag",
|
|
23
|
+
"local-postgres-support": "./private/local-postgres-support",
|
|
24
|
+
"pglite-directory-lock": "./adapters/database/pglite-directory-lock",
|
|
25
|
+
"document-local": "./adapters/document/local"
|
|
26
|
+
}
|
|
27
|
+
}
|