@apart-tech/intelligence-core 1.17.3 → 1.18.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.
@@ -20,30 +20,31 @@ model Organization {
20
20
  stripeSubscriptionId String? @map("stripe_subscription_id") @db.VarChar(255)
21
21
  currentPeriodEnd DateTime? @map("current_period_end") @db.Timestamptz
22
22
 
23
- nodes Node[]
24
- edges Edge[]
25
- domains Domain[]
26
- apiKeys ApiKey[]
27
- workspaces Workspace[]
28
- embeddingConfig OrgEmbeddingConfig?
29
- piiConfig OrgPiiConfig?
30
- agentConfig OrgAgentConfig?
31
- agentRuns AgentRun[]
32
- agentSchedules AgentSchedule[]
33
- memberships Membership[]
34
- invites Invite[]
35
- orgAgentTypes OrgAgentType[]
36
- orgMcpServers OrgMcpServer[]
37
- usageRecords UsageRecord[]
38
- quotaOverrides QuotaOverride[]
39
- onboardingPackages OnboardingPackage[]
40
- billingEvents BillingEvent[]
41
- searchMetrics SearchMetric[]
42
- tagDefinitions TagDefinition[]
43
- nodeTags NodeTag[]
44
- nodeChunks NodeChunk[]
45
- piiQueryLogs PiiQueryLog[]
46
- documents Document[]
23
+ nodes Node[]
24
+ edges Edge[]
25
+ domains Domain[]
26
+ apiKeys ApiKey[]
27
+ workspaces Workspace[]
28
+ embeddingConfig OrgEmbeddingConfig?
29
+ piiConfig OrgPiiConfig?
30
+ agentConfig OrgAgentConfig?
31
+ agentRuns AgentRun[]
32
+ agentSchedules AgentSchedule[]
33
+ memberships Membership[]
34
+ invites Invite[]
35
+ orgAgentTypes OrgAgentType[]
36
+ orgMcpServers OrgMcpServer[]
37
+ usageRecords UsageRecord[]
38
+ quotaOverrides QuotaOverride[]
39
+ onboardingPackages OnboardingPackage[]
40
+ billingEvents BillingEvent[]
41
+ searchMetrics SearchMetric[]
42
+ agentInstructions AgentInstruction[]
43
+ tagDefinitions TagDefinition[]
44
+ nodeTags NodeTag[]
45
+ nodeChunks NodeChunk[]
46
+ piiQueryLogs PiiQueryLog[]
47
+ documents Document[]
47
48
 
48
49
  @@map("organizations")
49
50
  }
@@ -173,22 +174,22 @@ model Domain {
173
174
  }
174
175
 
175
176
  model Node {
176
- id String @id @default(uuid()) @db.Uuid
177
- type String @db.VarChar(100)
178
- title String @db.VarChar(500)
179
- content String @default("") @db.Text
180
- embedding Unsupported("vector")?
181
- searchVector Unsupported("tsvector")? @map("search_vector")
182
- metadata Json @default("{}")
183
- status String @default("draft") @db.VarChar(20)
184
- createdBy String @map("created_by") @db.VarChar(255)
185
- createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz
186
- updatedAt DateTime @default(now()) @map("updated_at") @db.Timestamptz
187
- version Int @default(1)
188
- hasPii Boolean @default(false) @map("has_pii")
189
- embeddingPiiMode String? @map("embedding_pii_mode") @db.VarChar(20)
190
- domainId String? @map("domain_id") @db.Uuid
191
- organizationId String @map("organization_id") @db.Uuid
177
+ id String @id @default(uuid()) @db.Uuid
178
+ type String @db.VarChar(100)
179
+ title String @db.VarChar(500)
180
+ content String @default("") @db.Text
181
+ embedding Unsupported("vector")?
182
+ searchVector Unsupported("tsvector")? @map("search_vector")
183
+ metadata Json @default("{}")
184
+ status String @default("draft") @db.VarChar(20)
185
+ createdBy String @map("created_by") @db.VarChar(255)
186
+ createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz
187
+ updatedAt DateTime @default(now()) @map("updated_at") @db.Timestamptz
188
+ version Int @default(1)
189
+ hasPii Boolean @default(false) @map("has_pii")
190
+ embeddingPiiMode String? @map("embedding_pii_mode") @db.VarChar(20)
191
+ domainId String? @map("domain_id") @db.Uuid
192
+ organizationId String @map("organization_id") @db.Uuid
192
193
 
193
194
  sourceEdges Edge[] @relation("SourceNode")
194
195
  targetEdges Edge[] @relation("TargetNode")
@@ -207,19 +208,19 @@ model Node {
207
208
  }
208
209
 
209
210
  model NodeChunk {
210
- id String @id @default(uuid()) @db.Uuid
211
- nodeId String @map("node_id") @db.Uuid
212
- chunkIndex Int @map("chunk_index")
213
- content String @db.Text
214
- tokenCount Int @map("token_count")
215
- headingContext String? @map("heading_context") @db.VarChar(500)
216
- startOffset Int @map("start_offset")
217
- endOffset Int @map("end_offset")
218
- overlapPrev Int @default(0) @map("overlap_prev")
211
+ id String @id @default(uuid()) @db.Uuid
212
+ nodeId String @map("node_id") @db.Uuid
213
+ chunkIndex Int @map("chunk_index")
214
+ content String @db.Text
215
+ tokenCount Int @map("token_count")
216
+ headingContext String? @map("heading_context") @db.VarChar(500)
217
+ startOffset Int @map("start_offset")
218
+ endOffset Int @map("end_offset")
219
+ overlapPrev Int @default(0) @map("overlap_prev")
219
220
  embedding Unsupported("vector")?
220
- embeddingPiiMode String? @map("embedding_pii_mode") @db.VarChar(20)
221
- organizationId String @map("organization_id") @db.Uuid
222
- createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz
221
+ embeddingPiiMode String? @map("embedding_pii_mode") @db.VarChar(20)
222
+ organizationId String @map("organization_id") @db.Uuid
223
+ createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz
223
224
 
224
225
  node Node @relation(fields: [nodeId], references: [id], onDelete: Cascade)
225
226
  organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade)
@@ -326,11 +327,12 @@ model OrgAgentType {
326
327
  secretEnvMapping Json @default("{}") @map("secret_env_mapping")
327
328
  dynamicSecrets String[] @default([]) @map("dynamic_secrets")
328
329
 
329
- organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade)
330
- createdByUser User? @relation("OrgAgentTypeCreatedBy", fields: [createdByUserId], references: [id], onDelete: SetNull)
331
- agentRuns AgentRun[] @relation("AgentRunAgent")
332
- schedules AgentSchedule[] @relation("AgentScheduleAgent")
333
- apiKeys ApiKey[] @relation("ApiKeyAgent")
330
+ organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade)
331
+ createdByUser User? @relation("OrgAgentTypeCreatedBy", fields: [createdByUserId], references: [id], onDelete: SetNull)
332
+ agentRuns AgentRun[] @relation("AgentRunAgent")
333
+ schedules AgentSchedule[] @relation("AgentScheduleAgent")
334
+ apiKeys ApiKey[] @relation("ApiKeyAgent")
335
+ instructions AgentInstruction[] @relation("AgentTypeInstructions")
334
336
 
335
337
  @@unique([organizationId, slug], map: "uq_org_agent_type_org_slug")
336
338
  @@index([organizationId], map: "idx_org_agent_types_organization")
@@ -376,13 +378,21 @@ model AgentRun {
376
378
  parentAgentRunId String? @map("parent_agent_run_id") @db.Uuid
377
379
  actClaim Json? @map("act_claim")
378
380
  capturedAbility Json? @map("captured_ability")
379
-
380
- organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade)
381
- schedule AgentSchedule? @relation(fields: [scheduleId], references: [id], onDelete: SetNull)
382
- agent OrgAgentType? @relation("AgentRunAgent", fields: [agentId], references: [id], onDelete: SetNull)
383
- invokedByUser User? @relation("AgentRunInvokedBy", fields: [invokedByUserId], references: [id], onDelete: SetNull)
384
- parent AgentRun? @relation("AgentRunParent", fields: [parentAgentRunId], references: [id], onDelete: SetNull)
385
- children AgentRun[] @relation("AgentRunParent")
381
+ instructionId String? @map("instruction_id") @db.Uuid
382
+ reasoningTrace Json? @map("reasoning_trace")
383
+ toolsCalled Json? @map("tools_called")
384
+ outcome Json?
385
+ confidence Decimal? @db.Decimal
386
+ taskType String? @map("task_type") @db.VarChar(100)
387
+ outcomeStatus String? @map("outcome_status") @db.VarChar(30)
388
+
389
+ organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade)
390
+ schedule AgentSchedule? @relation(fields: [scheduleId], references: [id], onDelete: SetNull)
391
+ agent OrgAgentType? @relation("AgentRunAgent", fields: [agentId], references: [id], onDelete: SetNull)
392
+ invokedByUser User? @relation("AgentRunInvokedBy", fields: [invokedByUserId], references: [id], onDelete: SetNull)
393
+ parent AgentRun? @relation("AgentRunParent", fields: [parentAgentRunId], references: [id], onDelete: SetNull)
394
+ children AgentRun[] @relation("AgentRunParent")
395
+ instruction AgentInstruction? @relation(fields: [instructionId], references: [id], onDelete: SetNull)
386
396
 
387
397
  @@index([organizationId], map: "idx_agent_runs_organization")
388
398
  @@index([status], map: "idx_agent_runs_status")
@@ -391,9 +401,46 @@ model AgentRun {
391
401
  @@index([agentId], map: "idx_agent_runs_agent_id")
392
402
  @@index([invokedByUserId], map: "idx_agent_runs_invoked_by_user_id")
393
403
  @@index([parentAgentRunId], map: "idx_agent_runs_parent_agent_run_id")
404
+ @@index([instructionId], map: "idx_agent_runs_instruction")
405
+ @@index([taskType, status], map: "idx_agent_runs_task_type")
394
406
  @@map("agent_runs")
395
407
  }
396
408
 
409
+ model AgentInstruction {
410
+ id String @id @default(uuid()) @db.Uuid
411
+ organizationId String @map("organization_id") @db.Uuid
412
+ agentTypeId String? @map("agent_type_id") @db.Uuid
413
+ taskType String? @map("task_type") @db.VarChar(100)
414
+ version String @db.VarChar(20)
415
+ status String @default("draft") @db.VarChar(20)
416
+ systemPrompt String @default("") @map("system_prompt") @db.Text
417
+ tools Json @default("[]")
418
+ guardrails Json @default("{}")
419
+ modelConfig Json @default("{}") @map("model_config")
420
+ contentHash String? @map("content_hash") @db.VarChar(64)
421
+ parentVersionId String? @map("parent_version_id") @db.Uuid
422
+ changeNote String? @map("change_note") @db.Text
423
+ publishedAt DateTime? @map("published_at") @db.Timestamptz
424
+ deprecatedAt DateTime? @map("deprecated_at") @db.Timestamptz
425
+ effectiveFrom DateTime? @map("effective_from") @db.Timestamptz
426
+ effectiveTo DateTime? @map("effective_to") @db.Timestamptz
427
+ createdBy String @map("created_by") @db.VarChar(255)
428
+ createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz
429
+ updatedAt DateTime @default(now()) @map("updated_at") @db.Timestamptz
430
+
431
+ organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade)
432
+ agentType OrgAgentType? @relation("AgentTypeInstructions", fields: [agentTypeId], references: [id], onDelete: SetNull)
433
+ parentVersion AgentInstruction? @relation("InstructionVersionChain", fields: [parentVersionId], references: [id], onDelete: SetNull)
434
+ childVersions AgentInstruction[] @relation("InstructionVersionChain")
435
+ agentRuns AgentRun[]
436
+
437
+ @@index([organizationId], map: "idx_agent_instructions_org")
438
+ @@index([agentTypeId], map: "idx_agent_instructions_agent_type")
439
+ @@index([organizationId, agentTypeId, taskType, status, publishedAt(sort: Desc)], map: "idx_agent_instructions_org_agent_status")
440
+ @@index([contentHash], map: "idx_agent_instructions_hash")
441
+ @@map("agent_instructions")
442
+ }
443
+
397
444
  model AgentSchedule {
398
445
  id String @id @default(uuid()) @db.Uuid
399
446
  organizationId String @map("organization_id") @db.Uuid
@@ -494,32 +541,32 @@ model UsageRecord {
494
541
  // ── Tag System ──────────────────────────────────────────────────────────────
495
542
 
496
543
  model TagDefinition {
497
- id String @id @default(uuid()) @db.Uuid
498
- organizationId String? @map("organization_id") @db.Uuid
499
- tagName String @map("tag_name") @db.VarChar(100)
500
- tagType String @map("tag_type") @db.VarChar(20)
501
- cardinality String @default("singleton") @db.VarChar(10)
502
- source String @default("extracted") @db.VarChar(20)
503
- status String @default("active") @map("status") @db.VarChar(20)
504
- description String @default("") @db.Text
505
- category String? @map("category") @db.VarChar(50)
506
- labels Json? @map("labels") @db.JsonB
507
- applicableNodeTypes Json @default("[]") @map("applicable_node_types")
508
- requiredForNodeTypes Json @default("[]") @map("required_for_node_types")
509
- enumValues Json? @map("enum_values")
510
- enumVersion Int @default(1) @map("enum_version")
511
- dependsOn Json @default("[]") @map("depends_on")
512
- autoAcceptThreshold Float? @map("auto_accept_threshold") @db.Real
513
- parentDefinitionId String? @map("parent_definition_id") @db.Uuid
514
- replacedBy String? @map("replaced_by") @db.Uuid
515
- deprecatedAt DateTime? @map("deprecated_at") @db.Timestamptz
516
- createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz
517
- createdBy String @map("created_by") @db.VarChar(255)
518
-
519
- organization Organization? @relation(fields: [organizationId], references: [id], onDelete: Cascade)
520
- parentDef TagDefinition? @relation("TagDefHierarchy", fields: [parentDefinitionId], references: [id])
544
+ id String @id @default(uuid()) @db.Uuid
545
+ organizationId String? @map("organization_id") @db.Uuid
546
+ tagName String @map("tag_name") @db.VarChar(100)
547
+ tagType String @map("tag_type") @db.VarChar(20)
548
+ cardinality String @default("singleton") @db.VarChar(10)
549
+ source String @default("extracted") @db.VarChar(20)
550
+ status String @default("active") @map("status") @db.VarChar(20)
551
+ description String @default("") @db.Text
552
+ category String? @map("category") @db.VarChar(50)
553
+ labels Json? @map("labels") @db.JsonB
554
+ applicableNodeTypes Json @default("[]") @map("applicable_node_types")
555
+ requiredForNodeTypes Json @default("[]") @map("required_for_node_types")
556
+ enumValues Json? @map("enum_values")
557
+ enumVersion Int @default(1) @map("enum_version")
558
+ dependsOn Json @default("[]") @map("depends_on")
559
+ autoAcceptThreshold Float? @map("auto_accept_threshold") @db.Real
560
+ parentDefinitionId String? @map("parent_definition_id") @db.Uuid
561
+ replacedBy String? @map("replaced_by") @db.Uuid
562
+ deprecatedAt DateTime? @map("deprecated_at") @db.Timestamptz
563
+ createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz
564
+ createdBy String @map("created_by") @db.VarChar(255)
565
+
566
+ organization Organization? @relation(fields: [organizationId], references: [id], onDelete: Cascade)
567
+ parentDef TagDefinition? @relation("TagDefHierarchy", fields: [parentDefinitionId], references: [id])
521
568
  childDefs TagDefinition[] @relation("TagDefHierarchy")
522
- replacementDef TagDefinition? @relation("TagDefReplacement", fields: [replacedBy], references: [id])
569
+ replacementDef TagDefinition? @relation("TagDefReplacement", fields: [replacedBy], references: [id])
523
570
  replacedDefs TagDefinition[] @relation("TagDefReplacement")
524
571
  tags NodeTag[]
525
572
 
@@ -530,25 +577,25 @@ model TagDefinition {
530
577
  }
531
578
 
532
579
  model NodeTag {
533
- id String @id @default(uuid()) @db.Uuid
534
- nodeId String @map("node_id") @db.Uuid
535
- organizationId String @map("organization_id") @db.Uuid
536
- tagDefinitionId String @map("tag_definition_id") @db.Uuid
537
- tagName String @map("tag_name") @db.VarChar(100)
538
- isSingleton Boolean @default(false) @map("is_singleton")
539
-
540
- valueText String? @map("value_text") @db.Text
541
- valueNum Float? @map("value_num") @db.DoublePrecision
542
- valueCurrency String? @map("value_currency") @db.Char(3)
543
- valueUnit String? @map("value_unit") @db.VarChar(20)
544
- valueDate DateTime? @map("value_date") @db.Timestamptz
545
- valueRef String? @map("value_ref") @db.Uuid
546
-
547
- textSpan String? @map("text_span") @db.Text
548
- offsetStart Int? @map("offset_start")
549
- offsetEnd Int? @map("offset_end")
550
- contentVersion Int? @map("content_version")
551
- attrs Json @default("{}") @db.JsonB
580
+ id String @id @default(uuid()) @db.Uuid
581
+ nodeId String @map("node_id") @db.Uuid
582
+ organizationId String @map("organization_id") @db.Uuid
583
+ tagDefinitionId String @map("tag_definition_id") @db.Uuid
584
+ tagName String @map("tag_name") @db.VarChar(100)
585
+ isSingleton Boolean @default(false) @map("is_singleton")
586
+
587
+ valueText String? @map("value_text") @db.Text
588
+ valueNum Float? @map("value_num") @db.DoublePrecision
589
+ valueCurrency String? @map("value_currency") @db.Char(3)
590
+ valueUnit String? @map("value_unit") @db.VarChar(20)
591
+ valueDate DateTime? @map("value_date") @db.Timestamptz
592
+ valueRef String? @map("value_ref") @db.Uuid
593
+
594
+ textSpan String? @map("text_span") @db.Text
595
+ offsetStart Int? @map("offset_start")
596
+ offsetEnd Int? @map("offset_end")
597
+ contentVersion Int? @map("content_version")
598
+ attrs Json @default("{}") @db.JsonB
552
599
 
553
600
  taggedBy String @map("tagged_by") @db.VarChar(255)
554
601
  modelId String? @map("model_id") @db.VarChar(100)
@@ -560,14 +607,14 @@ model NodeTag {
560
607
  supersededBy String? @map("superseded_by") @db.Uuid
561
608
  batchId String? @map("batch_id") @db.Uuid
562
609
 
563
- createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz
564
- updatedAt DateTime @default(now()) @map("updated_at") @db.Timestamptz
610
+ createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz
611
+ updatedAt DateTime @default(now()) @map("updated_at") @db.Timestamptz
565
612
 
566
- node Node @relation(fields: [nodeId], references: [id], onDelete: Cascade)
567
- organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade)
568
- tagDefinition TagDefinition @relation(fields: [tagDefinitionId], references: [id])
569
- supersedes NodeTag? @relation("TagSupersession", fields: [supersededBy], references: [id])
570
- supersededTags NodeTag[] @relation("TagSupersession")
613
+ node Node @relation(fields: [nodeId], references: [id], onDelete: Cascade)
614
+ organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade)
615
+ tagDefinition TagDefinition @relation(fields: [tagDefinitionId], references: [id])
616
+ supersedes NodeTag? @relation("TagSupersession", fields: [supersededBy], references: [id])
617
+ supersededTags NodeTag[] @relation("TagSupersession")
571
618
 
572
619
  @@index([nodeId], map: "idx_node_tags_node")
573
620
  @@index([organizationId, tagName], map: "idx_node_tags_org_name")
@@ -577,25 +624,25 @@ model NodeTag {
577
624
  }
578
625
 
579
626
  model NodeTagHistory {
580
- id String @id @default(uuid()) @db.Uuid
581
- tagId String @map("tag_id") @db.Uuid
582
- nodeId String @map("node_id") @db.Uuid
583
- organizationId String @map("organization_id") @db.Uuid
584
- tagName String @map("tag_name") @db.VarChar(100)
585
-
586
- valueText String? @map("value_text") @db.Text
587
- valueNum Float? @map("value_num") @db.DoublePrecision
588
- valueCurrency String? @map("value_currency") @db.Char(3)
589
- valueUnit String? @map("value_unit") @db.VarChar(20)
590
- valueDate DateTime? @map("value_date") @db.Timestamptz
591
- valueRef String? @map("value_ref") @db.Uuid
592
-
593
- validFrom DateTime @map("valid_from") @db.Timestamptz
594
- validUntil DateTime @map("valid_until") @db.Timestamptz
595
- systemFrom DateTime @map("system_from") @db.Timestamptz
596
- systemTo DateTime? @map("system_to") @db.Timestamptz
597
-
598
- replacedBy String @map("replaced_by") @db.VarChar(255)
627
+ id String @id @default(uuid()) @db.Uuid
628
+ tagId String @map("tag_id") @db.Uuid
629
+ nodeId String @map("node_id") @db.Uuid
630
+ organizationId String @map("organization_id") @db.Uuid
631
+ tagName String @map("tag_name") @db.VarChar(100)
632
+
633
+ valueText String? @map("value_text") @db.Text
634
+ valueNum Float? @map("value_num") @db.DoublePrecision
635
+ valueCurrency String? @map("value_currency") @db.Char(3)
636
+ valueUnit String? @map("value_unit") @db.VarChar(20)
637
+ valueDate DateTime? @map("value_date") @db.Timestamptz
638
+ valueRef String? @map("value_ref") @db.Uuid
639
+
640
+ validFrom DateTime @map("valid_from") @db.Timestamptz
641
+ validUntil DateTime @map("valid_until") @db.Timestamptz
642
+ systemFrom DateTime @map("system_from") @db.Timestamptz
643
+ systemTo DateTime? @map("system_to") @db.Timestamptz
644
+
645
+ replacedBy String @map("replaced_by") @db.VarChar(255)
599
646
 
600
647
  @@index([nodeId, tagName, validFrom], map: "idx_tag_history_node_name_time")
601
648
  @@index([organizationId, tagName, validFrom], map: "idx_tag_history_org_name_time")
@@ -604,16 +651,16 @@ model NodeTagHistory {
604
651
  }
605
652
 
606
653
  model NodeTagAudit {
607
- id String @id @default(uuid()) @db.Uuid
608
- tagId String @map("tag_id") @db.Uuid
609
- nodeId String @map("node_id") @db.Uuid
610
- orgId String @map("organization_id") @db.Uuid
611
- action String @map("action") @db.VarChar(20)
612
- oldValue Json? @map("old_value") @db.JsonB
613
- newValue Json? @map("new_value") @db.JsonB
614
- actorId String @map("actor_id") @db.Uuid
615
- reason String? @db.Text
616
- createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz
654
+ id String @id @default(uuid()) @db.Uuid
655
+ tagId String @map("tag_id") @db.Uuid
656
+ nodeId String @map("node_id") @db.Uuid
657
+ orgId String @map("organization_id") @db.Uuid
658
+ action String @map("action") @db.VarChar(20)
659
+ oldValue Json? @map("old_value") @db.JsonB
660
+ newValue Json? @map("new_value") @db.JsonB
661
+ actorId String @map("actor_id") @db.Uuid
662
+ reason String? @db.Text
663
+ createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz
617
664
 
618
665
  @@index([tagId], map: "idx_tag_audit_tag")
619
666
  @@index([nodeId], map: "idx_tag_audit_node")
@@ -642,25 +689,25 @@ model QuotaOverride {
642
689
  // ── Document Archive ────────────────────────────────────────────────────────
643
690
 
644
691
  model Document {
645
- id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
646
- organizationId String @map("organization_id") @db.Uuid
647
- fileName String @map("file_name") @db.VarChar(500)
648
- mimeType String @map("mime_type") @db.VarChar(100)
649
- fileSizeBytes Int @map("file_size_bytes")
650
- storagePath String @map("storage_path") @db.VarChar(1000)
651
- contentHash String? @map("content_hash") @db.VarChar(64)
652
- status String @default("uploading") @db.VarChar(20)
653
- ocrModel String? @map("ocr_model") @db.VarChar(100)
654
- ocrTokensIn Int? @map("ocr_tokens_in")
655
- ocrTokensOut Int? @map("ocr_tokens_out")
656
- pageCount Int? @map("page_count")
657
- nodeId String? @map("node_id") @db.Uuid
658
- errorMessage String? @map("error_message")
659
- createdBy String @map("created_by") @db.VarChar(255)
660
- createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz
661
- updatedAt DateTime @updatedAt @map("updated_at") @db.Timestamptz
692
+ id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
693
+ organizationId String @map("organization_id") @db.Uuid
694
+ fileName String @map("file_name") @db.VarChar(500)
695
+ mimeType String @map("mime_type") @db.VarChar(100)
696
+ fileSizeBytes Int @map("file_size_bytes")
697
+ storagePath String @map("storage_path") @db.VarChar(1000)
698
+ contentHash String? @map("content_hash") @db.VarChar(64)
699
+ status String @default("uploading") @db.VarChar(20)
700
+ ocrModel String? @map("ocr_model") @db.VarChar(100)
701
+ ocrTokensIn Int? @map("ocr_tokens_in")
702
+ ocrTokensOut Int? @map("ocr_tokens_out")
703
+ pageCount Int? @map("page_count")
704
+ nodeId String? @map("node_id") @db.Uuid
705
+ errorMessage String? @map("error_message")
706
+ createdBy String @map("created_by") @db.VarChar(255)
707
+ createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz
708
+ updatedAt DateTime @updatedAt @map("updated_at") @db.Timestamptz
662
709
 
663
- organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade)
710
+ organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade)
664
711
 
665
712
  @@index([organizationId, contentHash], map: "idx_documents_org_hash")
666
713
  @@index([organizationId, status], map: "idx_documents_org_status")